@software-dlc/cli 0.194.2 → 0.194.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/local/app-blockers.d.ts +48 -0
- package/dist/local/app-blockers.d.ts.map +1 -0
- package/dist/local/app-blockers.js +124 -0
- package/dist/local/app-blockers.js.map +1 -0
- package/dist/local/app-shell-readers.d.ts +5 -1
- package/dist/local/app-shell-readers.d.ts.map +1 -1
- package/dist/local/app-shell-readers.js +15 -3
- package/dist/local/app-shell-readers.js.map +1 -1
- package/dist/local/workspace-cli.d.ts.map +1 -1
- package/dist/local/workspace-cli.js +11 -1
- package/dist/local/workspace-cli.js.map +1 -1
- package/dist/local/workspace-viewer-server.d.ts.map +1 -1
- package/dist/local/workspace-viewer-server.js +3 -2
- package/dist/local/workspace-viewer-server.js.map +1 -1
- package/package.json +1 -1
- package/viewer/assets/index-CGLAGVyJ.js +407 -0
- package/viewer/assets/index-CsOulJKz.css +1 -0
- package/viewer/index.html +2 -2
- package/viewer/assets/index-D0DjImMc.js +0 -402
- package/viewer/assets/index-GyusPoyh.css +0 -1
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
function XS(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 Aj(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $j={exports:{}},bd={};/**
|
|
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 WS=Symbol.for("react.transitional.element"),QS=Symbol.for("react.fragment");function Mj(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:WS,type:e,key:a,ref:t!==void 0?t:null,props:n}}bd.Fragment=QS;bd.jsx=Mj;bd.jsxs=Mj;$j.exports=bd;var s=$j.exports,Oj={exports:{}},ze={};/**
|
|
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 hp=Symbol.for("react.transitional.element"),ZS=Symbol.for("react.portal"),JS=Symbol.for("react.fragment"),e2=Symbol.for("react.strict_mode"),t2=Symbol.for("react.profiler"),n2=Symbol.for("react.consumer"),s2=Symbol.for("react.context"),a2=Symbol.for("react.forward_ref"),r2=Symbol.for("react.suspense"),l2=Symbol.for("react.memo"),Dj=Symbol.for("react.lazy"),$g=Symbol.iterator;function i2(e){return e===null||typeof e!="object"?null:(e=$g&&e[$g]||e["@@iterator"],typeof e=="function"?e:null)}var zj={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Lj=Object.assign,Uj={};function ni(e,t,n){this.props=e,this.context=t,this.refs=Uj,this.updater=n||zj}ni.prototype.isReactComponent={};ni.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")};ni.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Bj(){}Bj.prototype=ni.prototype;function mp(e,t,n){this.props=e,this.context=t,this.refs=Uj,this.updater=n||zj}var pp=mp.prototype=new Bj;pp.constructor=mp;Lj(pp,ni.prototype);pp.isPureReactComponent=!0;var Mg=Array.isArray,xt={H:null,A:null,T:null,S:null,V:null},Ij=Object.prototype.hasOwnProperty;function xp(e,t,n,a,r,l){return n=l.ref,{$$typeof:hp,type:e,key:t,ref:n!==void 0?n:null,props:l}}function o2(e,t){return xp(e.type,t,void 0,void 0,void 0,e.props)}function gp(e){return typeof e=="object"&&e!==null&&e.$$typeof===hp}function c2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Og=/\/+/g;function Af(e,t){return typeof e=="object"&&e!==null&&e.key!=null?c2(""+e.key):t.toString(36)}function Dg(){}function u2(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Dg,Dg):(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 dl(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 hp:case ZS:i=!0;break;case Dj:return i=e._init,dl(i(e._payload),t,n,a,r)}}if(i)return r=r(e),i=a===""?"."+Af(e,0):a,Mg(r)?(n="",i!=null&&(n=i.replace(Og,"$&/")+"/"),dl(r,t,n,"",function(d){return d})):r!=null&&(gp(r)&&(r=o2(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Og,"$&/")+"/")+i)),t.push(r)),1;i=0;var o=a===""?".":a+":";if(Mg(e))for(var c=0;c<e.length;c++)a=e[c],l=o+Af(a,c),i+=dl(a,t,n,l,r);else if(c=i2(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,l=o+Af(a,c++),i+=dl(a,t,n,l,r);else if(l==="object"){if(typeof e.then=="function")return dl(u2(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 bc(e,t,n){if(e==null)return e;var a=[],r=0;return dl(e,a,"","",function(l){return t.call(n,l,r++)}),a}function d2(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 zg=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 f2(){}ze.Children={map:bc,forEach:function(e,t,n){bc(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return bc(e,function(){t++}),t},toArray:function(e){return bc(e,function(t){return t})||[]},only:function(e){if(!gp(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ze.Component=ni;ze.Fragment=JS;ze.Profiler=t2;ze.PureComponent=mp;ze.StrictMode=e2;ze.Suspense=r2;ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=xt;ze.__COMPILER_RUNTIME={__proto__:null,c:function(e){return xt.H.useMemoCache(e)}};ze.cache=function(e){return function(){return e.apply(null,arguments)}};ze.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=Lj({},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)!Ij.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 xp(e.type,r,void 0,void 0,l,a)};ze.createContext=function(e){return e={$$typeof:s2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:n2,_context:e},e};ze.createElement=function(e,t,n){var a,r={},l=null;if(t!=null)for(a in t.key!==void 0&&(l=""+t.key),t)Ij.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 xp(e,l,void 0,void 0,null,r)};ze.createRef=function(){return{current:null}};ze.forwardRef=function(e){return{$$typeof:a2,render:e}};ze.isValidElement=gp;ze.lazy=function(e){return{$$typeof:Dj,_payload:{_status:-1,_result:e},_init:d2}};ze.memo=function(e,t){return{$$typeof:l2,type:e,compare:t===void 0?null:t}};ze.startTransition=function(e){var t=xt.T,n={};xt.T=n;try{var a=e(),r=xt.S;r!==null&&r(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(f2,zg)}catch(l){zg(l)}finally{xt.T=t}};ze.unstable_useCacheRefresh=function(){return xt.H.useCacheRefresh()};ze.use=function(e){return xt.H.use(e)};ze.useActionState=function(e,t,n){return xt.H.useActionState(e,t,n)};ze.useCallback=function(e,t){return xt.H.useCallback(e,t)};ze.useContext=function(e){return xt.H.useContext(e)};ze.useDebugValue=function(){};ze.useDeferredValue=function(e,t){return xt.H.useDeferredValue(e,t)};ze.useEffect=function(e,t,n){var a=xt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};ze.useId=function(){return xt.H.useId()};ze.useImperativeHandle=function(e,t,n){return xt.H.useImperativeHandle(e,t,n)};ze.useInsertionEffect=function(e,t){return xt.H.useInsertionEffect(e,t)};ze.useLayoutEffect=function(e,t){return xt.H.useLayoutEffect(e,t)};ze.useMemo=function(e,t){return xt.H.useMemo(e,t)};ze.useOptimistic=function(e,t){return xt.H.useOptimistic(e,t)};ze.useReducer=function(e,t,n){return xt.H.useReducer(e,t,n)};ze.useRef=function(e){return xt.H.useRef(e)};ze.useState=function(e){return xt.H.useState(e)};ze.useSyncExternalStore=function(e,t,n){return xt.H.useSyncExternalStore(e,t,n)};ze.useTransition=function(){return xt.H.useTransition()};ze.version="19.1.0";Oj.exports=ze;var u=Oj.exports;const Ra=Aj(u),Hj=XS({__proto__:null,default:Ra},[u]);var Pj={exports:{}},wd={},qj={exports:{}},Gj={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/(function(e){function t(R,E){var k=R.length;R.push(E);e:for(;0<k;){var M=k-1>>>1,F=R[M];if(0<r(F,E))R[M]=E,R[k]=F,k=M;else break e}}function n(R){return R.length===0?null:R[0]}function a(R){if(R.length===0)return null;var E=R[0],k=R.pop();if(k!==E){R[0]=k;e:for(var M=0,F=R.length,T=F>>>1;M<T;){var H=2*(M+1)-1,X=R[H],Z=H+1,ae=R[Z];if(0>r(X,k))Z<F&&0>r(ae,X)?(R[M]=ae,R[Z]=k,M=Z):(R[M]=X,R[H]=k,M=H);else if(Z<F&&0>r(ae,k))R[M]=ae,R[Z]=k,M=Z;else break e}}return E}function r(R,E){var k=R.sortIndex-E.sortIndex;return k!==0?k:R.id-E.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,m=null,h=3,x=!1,y=!1,v=!1,j=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function w(R){for(var E=n(d);E!==null;){if(E.callback===null)a(d);else if(E.startTime<=R)a(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function S(R){if(v=!1,w(R),!y)if(n(c)!==null)y=!0,C||(C=!0,P());else{var E=n(d);E!==null&&$(S,E.startTime-R)}}var C=!1,_=-1,N=5,O=-1;function D(){return j?!0:!(e.unstable_now()-O<N)}function B(){if(j=!1,C){var R=e.unstable_now();O=R;var E=!0;try{e:{y=!1,v&&(v=!1,p(_),_=-1),x=!0;var k=h;try{t:{for(w(R),m=n(c);m!==null&&!(m.expirationTime>R&&D());){var M=m.callback;if(typeof M=="function"){m.callback=null,h=m.priorityLevel;var F=M(m.expirationTime<=R);if(R=e.unstable_now(),typeof F=="function"){m.callback=F,w(R),E=!0;break t}m===n(c)&&a(c),w(R)}else a(c);m=n(c)}if(m!==null)E=!0;else{var T=n(d);T!==null&&$(S,T.startTime-R),E=!1}}break e}finally{m=null,h=k,x=!1}E=void 0}}finally{E?P():C=!1}}}var P;if(typeof b=="function")P=function(){b(B)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,A=I.port2;I.port1.onmessage=B,P=function(){A.postMessage(null)}}else P=function(){g(B,0)};function $(R,E){_=g(function(){R(e.unstable_now())},E)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_next=function(R){switch(h){case 1:case 2:case 3:var E=3;break;default:E=h}var k=h;h=E;try{return R()}finally{h=k}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(R,E){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var k=h;h=R;try{return E()}finally{h=k}},e.unstable_scheduleCallback=function(R,E,k){var M=e.unstable_now();switch(typeof k=="object"&&k!==null?(k=k.delay,k=typeof k=="number"&&0<k?M+k:M):k=M,R){case 1:var F=-1;break;case 2:F=250;break;case 5:F=1073741823;break;case 4:F=1e4;break;default:F=5e3}return F=k+F,R={id:f++,callback:E,priorityLevel:R,startTime:k,expirationTime:F,sortIndex:-1},k>M?(R.sortIndex=k,t(d,R),n(c)===null&&R===n(d)&&(v?(p(_),_=-1):v=!0,$(S,k-M))):(R.sortIndex=F,t(c,R),y||x||(y=!0,C||(C=!0,P()))),R},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(R){var E=h;return function(){var k=h;h=E;try{return R.apply(this,arguments)}finally{h=k}}}})(Gj);qj.exports=Gj;var h2=qj.exports,Vj={exports:{}},mn={};/**
|
|
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 m2=u;function Yj(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 Na(){}var fn={d:{f:Na,r:function(){throw Error(Yj(522))},D:Na,C:Na,L:Na,m:Na,X:Na,S:Na,M:Na},p:0,findDOMNode:null},p2=Symbol.for("react.portal");function x2(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:p2,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var Wi=m2.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function _d(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=fn;mn.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(Yj(299));return x2(e,t,null,n)};mn.flushSync=function(e){var t=Wi.T,n=fn.p;try{if(Wi.T=null,fn.p=2,e)return e()}finally{Wi.T=t,fn.p=n,fn.d.f()}};mn.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,fn.d.C(e,t))};mn.prefetchDNS=function(e){typeof e=="string"&&fn.d.D(e)};mn.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=_d(n,t.crossOrigin),r=typeof t.integrity=="string"?t.integrity:void 0,l=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?fn.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:r,fetchPriority:l}):n==="script"&&fn.d.X(e,{crossOrigin:a,integrity:r,fetchPriority:l,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};mn.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=_d(t.as,t.crossOrigin);fn.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&&fn.d.M(e)};mn.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=_d(n,t.crossOrigin);fn.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})}};mn.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=_d(t.as,t.crossOrigin);fn.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 fn.d.m(e)};mn.requestFormReset=function(e){fn.d.r(e)};mn.unstable_batchedUpdates=function(e,t){return e(t)};mn.useFormState=function(e,t,n){return Wi.H.useFormState(e,t,n)};mn.useFormStatus=function(){return Wi.H.useHostTransitionStatus()};mn.version="19.1.0";function Fj(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fj)}catch(e){console.error(e)}}Fj(),Vj.exports=mn;var si=Vj.exports;const g2=Aj(si);/**
|
|
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 Bt=h2,Kj=u,v2=si;function Q(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 Xj(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function qo(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 Wj(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 Lg(e){if(qo(e)!==e)throw Error(Q(188))}function y2(e){var t=e.alternate;if(!t){if(t=qo(e),t===null)throw Error(Q(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 Lg(r),e;if(l===a)return Lg(r),t;l=l.sibling}throw Error(Q(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(Q(189))}}if(n.alternate!==a)throw Error(Q(190))}if(n.tag!==3)throw Error(Q(188));return n.stateNode.current===n?e:t}function Qj(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Qj(e),t!==null)return t;e=e.sibling}return null}var ht=Object.assign,j2=Symbol.for("react.element"),wc=Symbol.for("react.transitional.element"),Ii=Symbol.for("react.portal"),xl=Symbol.for("react.fragment"),Zj=Symbol.for("react.strict_mode"),Bh=Symbol.for("react.profiler"),b2=Symbol.for("react.provider"),Jj=Symbol.for("react.consumer"),ca=Symbol.for("react.context"),vp=Symbol.for("react.forward_ref"),Ih=Symbol.for("react.suspense"),Hh=Symbol.for("react.suspense_list"),yp=Symbol.for("react.memo"),Aa=Symbol.for("react.lazy"),Ph=Symbol.for("react.activity"),w2=Symbol.for("react.memo_cache_sentinel"),Ug=Symbol.iterator;function Ri(e){return e===null||typeof e!="object"?null:(e=Ug&&e[Ug]||e["@@iterator"],typeof e=="function"?e:null)}var _2=Symbol.for("react.client.reference");function qh(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===_2?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case xl:return"Fragment";case Bh:return"Profiler";case Zj:return"StrictMode";case Ih:return"Suspense";case Hh:return"SuspenseList";case Ph:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case Ii:return"Portal";case ca:return(e.displayName||"Context")+".Provider";case Jj:return(e._context.displayName||"Context")+".Consumer";case vp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yp:return t=e.displayName||null,t!==null?t:qh(e.type)||"Memo";case Aa:t=e._payload,e=e._init;try{return qh(e(t))}catch{}}return null}var Hi=Array.isArray,Ae=Kj.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ze=v2.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_r={pending:!1,data:null,method:null,action:null},Gh=[],gl=-1;function Ws(e){return{current:e}}function Ft(e){0>gl||(e.current=Gh[gl],Gh[gl]=null,gl--)}function gt(e,t){gl++,Gh[gl]=e.current,e.current=t}var Ps=Ws(null),xo=Ws(null),qa=Ws(null),wu=Ws(null);function _u(e,t){switch(gt(qa,t),gt(xo,e),gt(Ps,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qv(t),e=x0(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ft(Ps),gt(Ps,e)}function Pl(){Ft(Ps),Ft(xo),Ft(qa)}function Vh(e){e.memoizedState!==null&>(wu,e);var t=Ps.current,n=x0(t,e.type);t!==n&&(gt(xo,e),gt(Ps,n))}function Nu(e){xo.current===e&&(Ft(Ps),Ft(xo)),wu.current===e&&(Ft(wu),So._currentValue=_r)}var Yh=Object.prototype.hasOwnProperty,jp=Bt.unstable_scheduleCallback,$f=Bt.unstable_cancelCallback,N2=Bt.unstable_shouldYield,k2=Bt.unstable_requestPaint,qs=Bt.unstable_now,S2=Bt.unstable_getCurrentPriorityLevel,eb=Bt.unstable_ImmediatePriority,tb=Bt.unstable_UserBlockingPriority,ku=Bt.unstable_NormalPriority,C2=Bt.unstable_LowPriority,nb=Bt.unstable_IdlePriority,R2=Bt.log,E2=Bt.unstable_setDisableYieldValue,Go=null,Fn=null;function La(e){if(typeof R2=="function"&&E2(e),Fn&&typeof Fn.setStrictMode=="function")try{Fn.setStrictMode(Go,e)}catch{}}var Kn=Math.clz32?Math.clz32:$2,T2=Math.log,A2=Math.LN2;function $2(e){return e>>>=0,e===0?32:31-(T2(e)/A2|0)|0}var _c=256,Nc=4194304;function vr(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 Nd(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=vr(a):(i&=o,i!==0?r=vr(i):n||(n=o&~e,n!==0&&(r=vr(n))))):(o=a&~l,o!==0?r=vr(o):i!==0?r=vr(i):n||(n=a&~e,n!==0&&(r=vr(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 Vo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function M2(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 sb(){var e=_c;return _c<<=1,!(_c&4194048)&&(_c=256),e}function ab(){var e=Nc;return Nc<<=1,!(Nc&62914560)&&(Nc=4194304),e}function Mf(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yo(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function O2(e,t,n,a,r,l){var i=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var o=e.entanglements,c=e.expirationTimes,d=e.hiddenUpdates;for(n=i&~n;0<n;){var f=31-Kn(n),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&&rb(e,a,0),l!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=l&~(i&~t))}function rb(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-Kn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function lb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-Kn(n),r=1<<a;r&t|e[a]&t&&(e[a]|=t),n&=~r}}function bp(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 wp(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ib(){var e=Ze.p;return e!==0?e:(e=window.event,e===void 0?32:S0(e.type))}function D2(e,t){var n=Ze.p;try{return Ze.p=e,t()}finally{Ze.p=n}}var lr=Math.random().toString(36).slice(2),an="__reactFiber$"+lr,Cn="__reactProps$"+lr,ai="__reactContainer$"+lr,Fh="__reactEvents$"+lr,z2="__reactListeners$"+lr,L2="__reactHandles$"+lr,Bg="__reactResources$"+lr,Fo="__reactMarker$"+lr;function _p(e){delete e[an],delete e[Cn],delete e[Fh],delete e[z2],delete e[L2]}function vl(e){var t=e[an];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ai]||n[an]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Yv(e);e!==null;){if(n=e[an])return n;e=Yv(e)}return t}e=n,n=e.parentNode}return null}function ri(e){if(e=e[an]||e[ai]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function Pi(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Q(33))}function El(e){var t=e[Bg];return t||(t=e[Bg]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Vt(e){e[Fo]=!0}var ob=new Set,cb={};function qr(e,t){ql(e,t),ql(e+"Capture",t)}function ql(e,t){for(cb[e]=t,e=0;e<t.length;e++)ob.add(t[e])}var U2=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]*$"),Ig={},Hg={};function B2(e){return Yh.call(Hg,e)?!0:Yh.call(Ig,e)?!1:U2.test(e)?Hg[e]=!0:(Ig[e]=!0,!1)}function Jc(e,t,n){if(B2(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 kc(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 na(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 Of,Pg;function fl(e){if(Of===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Of=t&&t[1]||"",Pg=-1<n.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+Of+e+Pg}var Df=!1;function zf(e,t){if(!e||Df)return"";Df=!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{Df=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?fl(n):""}function I2(e){switch(e.tag){case 26:case 27:case 5:return fl(e.type);case 16:return fl("Lazy");case 13:return fl("Suspense");case 19:return fl("SuspenseList");case 0:case 15:return zf(e.type,!1);case 11:return zf(e.type.render,!1);case 1:return zf(e.type,!0);case 31:return fl("Activity");default:return""}}function qg(e){try{var t="";do t+=I2(e),e=e.return;while(e);return t}catch(n){return`
|
|
47
|
+
Error generating stack: `+n.message+`
|
|
48
|
+
`+n.stack}}function rs(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ub(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function H2(e){var t=ub(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 Su(e){e._valueTracker||(e._valueTracker=H2(e))}function db(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=ub(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Cu(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 P2=/[\n"\\]/g;function os(e){return e.replace(P2,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Kh(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=""+rs(t)):e.value!==""+rs(t)&&(e.value=""+rs(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?Xh(e,i,rs(t)):n!=null?Xh(e,i,rs(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=""+rs(o):e.removeAttribute("name")}function fb(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?""+rs(n):"",t=t!=null?""+rs(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 Xh(e,t,n){t==="number"&&Cu(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Tl(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=""+rs(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 hb(e,t,n){if(t!=null&&(t=""+rs(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+rs(n):""}function mb(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(Q(92));if(Hi(a)){if(1<a.length)throw Error(Q(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=rs(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function Gl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var q2=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 Gg(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||q2.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function pb(e,t,n){if(t!=null&&typeof t!="object")throw Error(Q(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&&Gg(e,r,a)}else for(var l in t)t.hasOwnProperty(l)&&Gg(e,l,t[l])}function Np(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 G2=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"]]),V2=/^[\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 eu(e){return V2.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var Wh=null;function kp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yl=null,Al=null;function Vg(e){var t=ri(e);if(t&&(e=t.stateNode)){var n=e[Cn]||null;e:switch(e=t.stateNode,t.type){case"input":if(Kh(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="'+os(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var r=a[Cn]||null;if(!r)throw Error(Q(90));Kh(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&&db(a)}break e;case"textarea":hb(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Tl(e,!!n.multiple,t,!1)}}}var Lf=!1;function xb(e,t,n){if(Lf)return e(t,n);Lf=!0;try{var a=e(t);return a}finally{if(Lf=!1,(yl!==null||Al!==null)&&(Od(),yl&&(t=yl,e=Al,Al=yl=null,Vg(t),e)))for(t=0;t<e.length;t++)Vg(e[t])}}function go(e,t){var n=e.stateNode;if(n===null)return null;var a=n[Cn]||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(Q(231,t,typeof n));return n}var xa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qh=!1;if(xa)try{var Ei={};Object.defineProperty(Ei,"passive",{get:function(){Qh=!0}}),window.addEventListener("test",Ei,Ei),window.removeEventListener("test",Ei,Ei)}catch{Qh=!1}var Ua=null,Sp=null,tu=null;function gb(){if(tu)return tu;var e,t=Sp,n=t.length,a,r="value"in Ua?Ua.value:Ua.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 tu=r.slice(e,1<a?1-a:void 0)}function nu(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 Sc(){return!0}function Yg(){return!1}function En(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)?Sc:Yg,this.isPropagationStopped=Yg,this}return ht(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=Sc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sc)},persist:function(){},isPersistent:Sc}),t}var Gr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},kd=En(Gr),Ko=ht({},Gr,{view:0,detail:0}),Y2=En(Ko),Uf,Bf,Ti,Sd=ht({},Ko,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cp,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!==Ti&&(Ti&&e.type==="mousemove"?(Uf=e.screenX-Ti.screenX,Bf=e.screenY-Ti.screenY):Bf=Uf=0,Ti=e),Uf)},movementY:function(e){return"movementY"in e?e.movementY:Bf}}),Fg=En(Sd),F2=ht({},Sd,{dataTransfer:0}),K2=En(F2),X2=ht({},Ko,{relatedTarget:0}),If=En(X2),W2=ht({},Gr,{animationName:0,elapsedTime:0,pseudoElement:0}),Q2=En(W2),Z2=ht({},Gr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),J2=En(Z2),eC=ht({},Gr,{data:0}),Kg=En(eC),tC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},nC={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 aC(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=sC[e])?!!t[e]:!1}function Cp(){return aC}var rC=ht({},Ko,{key:function(e){if(e.key){var t=tC[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=nu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?nC[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cp,charCode:function(e){return e.type==="keypress"?nu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?nu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),lC=En(rC),iC=ht({},Sd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xg=En(iC),oC=ht({},Ko,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cp}),cC=En(oC),uC=ht({},Gr,{propertyName:0,elapsedTime:0,pseudoElement:0}),dC=En(uC),fC=ht({},Sd,{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}),hC=En(fC),mC=ht({},Gr,{newState:0,oldState:0}),pC=En(mC),xC=[9,13,27,32],Rp=xa&&"CompositionEvent"in window,Qi=null;xa&&"documentMode"in document&&(Qi=document.documentMode);var gC=xa&&"TextEvent"in window&&!Qi,vb=xa&&(!Rp||Qi&&8<Qi&&11>=Qi),Wg=" ",Qg=!1;function yb(e,t){switch(e){case"keyup":return xC.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jl=!1;function vC(e,t){switch(e){case"compositionend":return jb(t);case"keypress":return t.which!==32?null:(Qg=!0,Wg);case"textInput":return e=t.data,e===Wg&&Qg?null:e;default:return null}}function yC(e,t){if(jl)return e==="compositionend"||!Rp&&yb(e,t)?(e=gb(),tu=Sp=Ua=null,jl=!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 vb&&t.locale!=="ko"?null:t.data;default:return null}}var jC={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 Zg(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jC[e.type]:t==="textarea"}function bb(e,t,n,a){yl?Al?Al.push(a):Al=[a]:yl=a,t=Vu(t,"onChange"),0<t.length&&(n=new kd("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var Zi=null,vo=null;function bC(e){h0(e,0)}function Cd(e){var t=Pi(e);if(db(t))return e}function Jg(e,t){if(e==="change")return t}var wb=!1;if(xa){var Hf;if(xa){var Pf="oninput"in document;if(!Pf){var ev=document.createElement("div");ev.setAttribute("oninput","return;"),Pf=typeof ev.oninput=="function"}Hf=Pf}else Hf=!1;wb=Hf&&(!document.documentMode||9<document.documentMode)}function tv(){Zi&&(Zi.detachEvent("onpropertychange",_b),vo=Zi=null)}function _b(e){if(e.propertyName==="value"&&Cd(vo)){var t=[];bb(t,vo,e,kp(e)),xb(bC,t)}}function wC(e,t,n){e==="focusin"?(tv(),Zi=t,vo=n,Zi.attachEvent("onpropertychange",_b)):e==="focusout"&&tv()}function _C(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Cd(vo)}function NC(e,t){if(e==="click")return Cd(t)}function kC(e,t){if(e==="input"||e==="change")return Cd(t)}function SC(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Zn=typeof Object.is=="function"?Object.is:SC;function yo(e,t){if(Zn(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(!Yh.call(t,r)||!Zn(e[r],t[r]))return!1}return!0}function nv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sv(e,t){var n=nv(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=nv(n)}}function Nb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Nb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Cu(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=Cu(e.document)}return t}function Ep(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 CC=xa&&"documentMode"in document&&11>=document.documentMode,bl=null,Zh=null,Ji=null,Jh=!1;function av(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jh||bl==null||bl!==Cu(a)||(a=bl,"selectionStart"in a&&Ep(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}),Ji&&yo(Ji,a)||(Ji=a,a=Vu(Zh,"onSelect"),0<a.length&&(t=new kd("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=bl)))}function xr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var wl={animationend:xr("Animation","AnimationEnd"),animationiteration:xr("Animation","AnimationIteration"),animationstart:xr("Animation","AnimationStart"),transitionrun:xr("Transition","TransitionRun"),transitionstart:xr("Transition","TransitionStart"),transitioncancel:xr("Transition","TransitionCancel"),transitionend:xr("Transition","TransitionEnd")},qf={},Sb={};xa&&(Sb=document.createElement("div").style,"AnimationEvent"in window||(delete wl.animationend.animation,delete wl.animationiteration.animation,delete wl.animationstart.animation),"TransitionEvent"in window||delete wl.transitionend.transition);function Vr(e){if(qf[e])return qf[e];if(!wl[e])return e;var t=wl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Sb)return qf[e]=t[n];return e}var Cb=Vr("animationend"),Rb=Vr("animationiteration"),Eb=Vr("animationstart"),RC=Vr("transitionrun"),EC=Vr("transitionstart"),TC=Vr("transitioncancel"),Tb=Vr("transitionend"),Ab=new Map,em="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(" ");em.push("scrollEnd");function As(e,t){Ab.set(e,t),qr(t,[e])}var rv=new WeakMap;function cs(e,t){if(typeof e=="object"&&e!==null){var n=rv.get(e);return n!==void 0?n:(t={value:e,source:t,stack:qg(t)},rv.set(e,t),t)}return{value:e,source:t,stack:qg(t)}}var as=[],_l=0,Tp=0;function Rd(){for(var e=_l,t=Tp=_l=0;t<e;){var n=as[t];as[t++]=null;var a=as[t];as[t++]=null;var r=as[t];as[t++]=null;var l=as[t];if(as[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&&$b(n,r,l)}}function Ed(e,t,n,a){as[_l++]=e,as[_l++]=t,as[_l++]=n,as[_l++]=a,Tp|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Ap(e,t,n,a){return Ed(e,t,n,a),Ru(e)}function li(e,t){return Ed(e,null,null,t),Ru(e)}function $b(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var r=!1,l=e.return;l!==null;)l.childLanes|=n,a=l.alternate,a!==null&&(a.childLanes|=n),l.tag===22&&(e=l.stateNode,e===null||e._visibility&1||(r=!0)),e=l,l=l.return;return e.tag===3?(l=e.stateNode,r&&t!==null&&(r=31-Kn(n),e=l.hiddenUpdates,a=e[r],a===null?e[r]=[t]:a.push(t),t.lane=n|536870912),l):null}function Ru(e){if(50<co)throw co=0,bm=null,Error(Q(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Nl={};function AC(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 Yn(e,t,n,a){return new AC(e,t,n,a)}function $p(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ma(e,t){var n=e.alternate;return n===null?(n=Yn(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 Mb(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 su(e,t,n,a,r,l){var i=0;if(a=e,typeof e=="function")$p(e)&&(i=1);else if(typeof e=="string")i=MR(e,n,Ps.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Ph:return e=Yn(31,n,t,r),e.elementType=Ph,e.lanes=l,e;case xl:return Nr(n.children,r,l,t);case Zj:i=8,r|=24;break;case Bh:return e=Yn(12,n,t,r|2),e.elementType=Bh,e.lanes=l,e;case Ih:return e=Yn(13,n,t,r),e.elementType=Ih,e.lanes=l,e;case Hh:return e=Yn(19,n,t,r),e.elementType=Hh,e.lanes=l,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case b2:case ca:i=10;break e;case Jj:i=9;break e;case vp:i=11;break e;case yp:i=14;break e;case Aa:i=16,a=null;break e}i=29,n=Error(Q(130,e===null?"null":typeof e,"")),a=null}return t=Yn(i,n,t,r),t.elementType=e,t.type=a,t.lanes=l,t}function Nr(e,t,n,a){return e=Yn(7,e,a,t),e.lanes=n,e}function Gf(e,t,n){return e=Yn(6,e,null,t),e.lanes=n,e}function Vf(e,t,n){return t=Yn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var kl=[],Sl=0,Eu=null,Tu=0,ls=[],is=0,kr=null,ua=1,da="";function yr(e,t){kl[Sl++]=Tu,kl[Sl++]=Eu,Eu=e,Tu=t}function Ob(e,t,n){ls[is++]=ua,ls[is++]=da,ls[is++]=kr,kr=e;var a=ua;e=da;var r=32-Kn(a)-1;a&=~(1<<r),n+=1;var l=32-Kn(t)+r;if(30<l){var i=r-r%5;l=(a&(1<<i)-1).toString(32),a>>=i,r-=i,ua=1<<32-Kn(t)+r|n<<r|a,da=l+e}else ua=1<<l|n<<r|a,da=e}function Mp(e){e.return!==null&&(yr(e,1),Ob(e,1,0))}function Op(e){for(;e===Eu;)Eu=kl[--Sl],kl[Sl]=null,Tu=kl[--Sl],kl[Sl]=null;for(;e===kr;)kr=ls[--is],ls[is]=null,da=ls[--is],ls[is]=null,ua=ls[--is],ls[is]=null}var dn=null,wt=null,Qe=!1,Sr=null,zs=!1,tm=Error(Q(519));function $r(e){var t=Error(Q(418,""));throw jo(cs(t,e)),tm}function lv(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[an]=e,t[Cn]=a,n){case"dialog":He("cancel",t),He("close",t);break;case"iframe":case"object":case"embed":He("load",t);break;case"video":case"audio":for(n=0;n<_o.length;n++)He(_o[n],t);break;case"source":He("error",t);break;case"img":case"image":case"link":He("error",t),He("load",t);break;case"details":He("toggle",t);break;case"input":He("invalid",t),fb(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Su(t);break;case"select":He("invalid",t);break;case"textarea":He("invalid",t),mb(t,a.value,a.defaultValue,a.children),Su(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||p0(t.textContent,n)?(a.popover!=null&&(He("beforetoggle",t),He("toggle",t)),a.onScroll!=null&&He("scroll",t),a.onScrollEnd!=null&&He("scrollend",t),a.onClick!=null&&(t.onclick=Ld),t=!0):t=!1,t||$r(e)}function iv(e){for(dn=e.return;dn;)switch(dn.tag){case 5:case 13:zs=!1;return;case 27:case 3:zs=!0;return;default:dn=dn.return}}function Ai(e){if(e!==dn)return!1;if(!Qe)return iv(e),Qe=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Cm(e.type,e.memoizedProps)),n=!n),n&&wt&&$r(e),iv(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Q(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(n=e.data,n==="/$"){if(t===0){wt=ks(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}wt=null}}else t===27?(t=wt,ir(e.type)?(e=Tm,Tm=null,wt=e):wt=t):wt=dn?ks(e.stateNode.nextSibling):null;return!0}function Xo(){wt=dn=null,Qe=!1}function ov(){var e=Sr;return e!==null&&(Nn===null?Nn=e:Nn.push.apply(Nn,e),Sr=null),e}function jo(e){Sr===null?Sr=[e]:Sr.push(e)}var nm=Ws(null),Yr=null,fa=null;function Ma(e,t,n){gt(nm,t._currentValue),t._currentValue=n}function pa(e){e._currentValue=nm.current,Ft(nm)}function sm(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 am(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),sm(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(Q(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),sm(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 Wo(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(Q(387));if(i=i.memoizedProps,i!==null){var o=r.type;Zn(r.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(r===wu.current){if(i=r.alternate,i===null)throw Error(Q(387));i.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(So):e=[So])}r=r.return}e!==null&&am(t,e,n,a),t.flags|=262144}function Au(e){for(e=e.firstContext;e!==null;){if(!Zn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Mr(e){Yr=e,fa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rn(e){return Db(Yr,e)}function Cc(e,t){return Yr===null&&Mr(e),Db(e,t)}function Db(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},fa===null){if(e===null)throw Error(Q(308));fa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else fa=fa.next=t;return n}var $C=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()})}},MC=Bt.unstable_scheduleCallback,OC=Bt.unstable_NormalPriority,Lt={$$typeof:ca,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dp(){return{controller:new $C,data:new Map,refCount:0}}function Qo(e){e.refCount--,e.refCount===0&&MC(OC,function(){e.controller.abort()})}var eo=null,rm=0,Vl=0,$l=null;function DC(e,t){if(eo===null){var n=eo=[];rm=0,Vl=ax(),$l={status:"pending",value:void 0,then:function(a){n.push(a)}}}return rm++,t.then(cv,cv),t}function cv(){if(--rm===0&&eo!==null){$l!==null&&($l.status="fulfilled");var e=eo;eo=null,Vl=0,$l=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function zC(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 uv=Ae.S;Ae.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&DC(e,t),uv!==null&&uv(e,t)};var Cr=Ws(null);function zp(){var e=Cr.current;return e!==null?e:dt.pooledCache}function au(e,t){t===null?gt(Cr,Cr.current):gt(Cr,t.pool)}function zb(){var e=zp();return e===null?null:{parent:Lt._currentValue,pool:e}}var Zo=Error(Q(460)),Lb=Error(Q(474)),Td=Error(Q(542)),lm={then:function(){}};function dv(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Rc(){}function Ub(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Rc,Rc),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,hv(e),e;default:if(typeof t.status=="string")t.then(Rc,Rc);else{if(e=dt,e!==null&&100<e.shellSuspendCounter)throw Error(Q(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,hv(e),e}throw to=t,Zo}}var to=null;function fv(){if(to===null)throw Error(Q(459));var e=to;return to=null,e}function hv(e){if(e===Zo||e===Td)throw Error(Q(483))}var $a=!1;function Lp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function im(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 Ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Va(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,at&2){var r=a.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),a.pending=t,t=Ru(e),$b(e,null,n),t}return Ed(e,a,t,n),Ru(e)}function no(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,lb(e,n)}}function Yf(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 om=!1;function so(){if(om){var e=$l;if(e!==null)throw e}}function ao(e,t,n,a){om=!1;var r=e.updateQueue;$a=!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?(qe&h)===h:(a&h)===h){h!==0&&h===Vl&&(om=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var y=e,v=o;h=t;var j=n;switch(v.tag){case 1:if(y=v.payload,typeof y=="function"){m=y.call(j,m,h);break e}m=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,h=typeof y=="function"?y.call(j,m,h):y,h==null)break e;m=ht({},m,h);break e;case 2:$a=!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),tr|=i,e.lanes=i,e.memoizedState=m}}function Bb(e,t){if(typeof e!="function")throw Error(Q(191,e));e.call(t)}function Ib(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Bb(n[e],t)}var Yl=Ws(null),$u=Ws(0);function mv(e,t){e=ya,gt($u,e),gt(Yl,t),ya=e|t.baseLanes}function cm(){gt($u,ya),gt(Yl,Yl.current)}function Up(){ya=$u.current,Ft(Yl),Ft($u)}var Ja=0,Be=null,it=null,At=null,Mu=!1,Ml=!1,Or=!1,Ou=0,bo=0,Ol=null,LC=0;function Rt(){throw Error(Q(321))}function Bp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Zn(e[n],t[n]))return!1;return!0}function Ip(e,t,n,a,r,l){return Ja=l,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ae.H=e===null||e.memoizedState===null?gw:vw,Or=!1,l=n(a,r),Or=!1,Ml&&(l=Pb(t,n,a,r)),Hb(e),l}function Hb(e){Ae.H=Du;var t=it!==null&&it.next!==null;if(Ja=0,At=it=Be=null,Mu=!1,bo=0,Ol=null,t)throw Error(Q(300));e===null||Yt||(e=e.dependencies,e!==null&&Au(e)&&(Yt=!0))}function Pb(e,t,n,a){Be=e;var r=0;do{if(Ml&&(Ol=null),bo=0,Ml=!1,25<=r)throw Error(Q(301));if(r+=1,At=it=null,e.updateQueue!=null){var l=e.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}Ae.H=GC,l=t(n,a)}while(Ml);return l}function UC(){var e=Ae.H,t=e.useState()[0];return t=typeof t.then=="function"?Jo(t):t,e=e.useState()[0],(it!==null?it.memoizedState:null)!==e&&(Be.flags|=1024),t}function Hp(){var e=Ou!==0;return Ou=0,e}function Pp(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function qp(e){if(Mu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Mu=!1}Ja=0,At=it=Be=null,Ml=!1,bo=Ou=0,Ol=null}function wn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return At===null?Be.memoizedState=At=e:At=At.next=e,At}function Ot(){if(it===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=it.next;var t=At===null?Be.memoizedState:At.next;if(t!==null)At=t,it=e;else{if(e===null)throw Be.alternate===null?Error(Q(467)):Error(Q(310));it=e,e={memoizedState:it.memoizedState,baseState:it.baseState,baseQueue:it.baseQueue,queue:it.queue,next:null},At===null?Be.memoizedState=At=e:At=At.next=e}return At}function Gp(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Jo(e){var t=bo;return bo+=1,Ol===null&&(Ol=[]),e=Ub(Ol,e,t),t=Be,(At===null?t.memoizedState:At.next)===null&&(t=t.alternate,Ae.H=t===null||t.memoizedState===null?gw:vw),e}function Ad(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Jo(e);if(e.$$typeof===ca)return rn(e)}throw Error(Q(438,String(e)))}function Vp(e){var t=null,n=Be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Be.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=Gp(),Be.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]=w2;return t.index++,n}function ga(e,t){return typeof t=="function"?t(e):t}function ru(e){var t=Ot();return Yp(t,it,e)}function Yp(e,t,n){var a=e.queue;if(a===null)throw Error(Q(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?(qe&m)===m:(Ja&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===Vl&&(f=!0);else if((Ja&h)===h){d=d.next,h===Vl&&(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,Be.lanes|=h,tr|=h;m=d.action,Or&&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,Be.lanes|=m,tr|=m;d=d.next}while(d!==null&&d!==t);if(c===null?i=l:c.next=o,!Zn(l,e.memoizedState)&&(Yt=!0,f&&(n=$l,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 Ff(e){var t=Ot(),n=t.queue;if(n===null)throw Error(Q(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);Zn(l,t.memoizedState)||(Yt=!0),t.memoizedState=l,t.baseQueue===null&&(t.baseState=l),n.lastRenderedState=l}return[l,a]}function qb(e,t,n){var a=Be,r=Ot(),l=Qe;if(l){if(n===void 0)throw Error(Q(407));n=n()}else n=t();var i=!Zn((it||r).memoizedState,n);i&&(r.memoizedState=n,Yt=!0),r=r.queue;var o=Yb.bind(null,a,r,e);if(ec(2048,8,o,[e]),r.getSnapshot!==t||i||At!==null&&At.memoizedState.tag&1){if(a.flags|=2048,Fl(9,$d(),Vb.bind(null,a,r,n,t),null),dt===null)throw Error(Q(349));l||Ja&124||Gb(a,t,n)}return n}function Gb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Be.updateQueue,t===null?(t=Gp(),Be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Vb(e,t,n,a){t.value=n,t.getSnapshot=a,Fb(t)&&Kb(e)}function Yb(e,t,n){return n(function(){Fb(t)&&Kb(e)})}function Fb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Zn(e,n)}catch{return!0}}function Kb(e){var t=li(e,2);t!==null&&Wn(t,e,2)}function um(e){var t=wn();if(typeof e=="function"){var n=e;if(e=n(),Or){La(!0);try{n()}finally{La(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:e},t}function Xb(e,t,n,a){return e.baseState=n,Yp(e,it,typeof a=="function"?a:ga)}function BC(e,t,n,a,r){if(Md(e))throw Error(Q(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)}};Ae.T!==null?n(!0):l.isTransition=!1,a(l),n=t.pending,n===null?(l.next=t.pending=l,Wb(t,l)):(l.next=n.next,t.pending=n.next=l)}}function Wb(e,t){var n=t.action,a=t.payload,r=e.state;if(t.isTransition){var l=Ae.T,i={};Ae.T=i;try{var o=n(r,a),c=Ae.S;c!==null&&c(i,o),pv(e,t,o)}catch(d){dm(e,t,d)}finally{Ae.T=l}}else try{l=n(r,a),pv(e,t,l)}catch(d){dm(e,t,d)}}function pv(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){xv(e,t,a)},function(a){return dm(e,t,a)}):xv(e,t,n)}function xv(e,t,n){t.status="fulfilled",t.value=n,Qb(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wb(e,n)))}function dm(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,Qb(t),t=t.next;while(t!==a)}e.action=null}function Qb(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zb(e,t){return t}function gv(e,t){if(Qe){var n=dt.formState;if(n!==null){e:{var a=Be;if(Qe){if(wt){t:{for(var r=wt,l=zs;r.nodeType!==8;){if(!l){r=null;break t}if(r=ks(r.nextSibling),r===null){r=null;break t}}l=r.data,r=l==="F!"||l==="F"?r:null}if(r){wt=ks(r.nextSibling),a=r.data==="F!";break e}}$r(a)}a=!1}a&&(t=n[0])}}return n=wn(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zb,lastRenderedState:t},n.queue=a,n=mw.bind(null,Be,a),a.dispatch=n,a=um(!1),l=Wp.bind(null,Be,!1,a.queue),a=wn(),r={state:t,dispatch:null,action:e,pending:null},a.queue=r,n=BC.bind(null,Be,r,l,n),r.dispatch=n,a.memoizedState=e,[t,n,!1]}function vv(e){var t=Ot();return Jb(t,it,e)}function Jb(e,t,n){if(t=Yp(e,t,Zb)[0],e=ru(ga)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=Jo(t)}catch(i){throw i===Zo?Td:i}else a=t;t=Ot();var r=t.queue,l=r.dispatch;return n!==t.memoizedState&&(Be.flags|=2048,Fl(9,$d(),IC.bind(null,r,n),null)),[a,l,e]}function IC(e,t){e.action=t}function yv(e){var t=Ot(),n=it;if(n!==null)return Jb(t,n,e);Ot(),t=t.memoizedState,n=Ot();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function Fl(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Be.updateQueue,t===null&&(t=Gp(),Be.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 $d(){return{destroy:void 0,resource:void 0}}function ew(){return Ot().memoizedState}function lu(e,t,n,a){var r=wn();a=a===void 0?null:a,Be.flags|=e,r.memoizedState=Fl(1|t,$d(),n,a)}function ec(e,t,n,a){var r=Ot();a=a===void 0?null:a;var l=r.memoizedState.inst;it!==null&&a!==null&&Bp(a,it.memoizedState.deps)?r.memoizedState=Fl(t,l,n,a):(Be.flags|=e,r.memoizedState=Fl(1|t,l,n,a))}function jv(e,t){lu(8390656,8,e,t)}function tw(e,t){ec(2048,8,e,t)}function nw(e,t){return ec(4,2,e,t)}function sw(e,t){return ec(4,4,e,t)}function aw(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 rw(e,t,n){n=n!=null?n.concat([e]):null,ec(4,4,aw.bind(null,t,e),n)}function Fp(){}function lw(e,t){var n=Ot();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&Bp(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function iw(e,t){var n=Ot();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&Bp(t,a[1]))return a[0];if(a=e(),Or){La(!0);try{e()}finally{La(!1)}}return n.memoizedState=[a,t],a}function Kp(e,t,n){return n===void 0||Ja&1073741824?e.memoizedState=t:(e.memoizedState=n,e=Qw(),Be.lanes|=e,tr|=e,n)}function ow(e,t,n,a){return Zn(n,t)?n:Yl.current!==null?(e=Kp(e,n,a),Zn(e,t)||(Yt=!0),e):Ja&42?(e=Qw(),Be.lanes|=e,tr|=e,t):(Yt=!0,e.memoizedState=n)}function cw(e,t,n,a,r){var l=Ze.p;Ze.p=l!==0&&8>l?l:8;var i=Ae.T,o={};Ae.T=o,Wp(e,!1,t,n);try{var c=r(),d=Ae.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=zC(c,a);ro(e,t,f,Xn(e))}else ro(e,t,a,Xn(e))}catch(m){ro(e,t,{then:function(){},status:"rejected",reason:m},Xn())}finally{Ze.p=l,Ae.T=i}}function HC(){}function fm(e,t,n,a){if(e.tag!==5)throw Error(Q(476));var r=uw(e).queue;cw(e,r,t,_r,n===null?HC:function(){return dw(e),n(a)})}function uw(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:_r,baseState:_r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:_r},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ga,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function dw(e){var t=uw(e).next.queue;ro(e,t,{},Xn())}function Xp(){return rn(So)}function fw(){return Ot().memoizedState}function hw(){return Ot().memoizedState}function PC(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Xn();e=Ga(n);var a=Va(t,e,n);a!==null&&(Wn(a,t,n),no(a,t,n)),t={cache:Dp()},e.payload=t;return}t=t.return}}function qC(e,t,n){var a=Xn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Md(e)?pw(t,n):(n=Ap(e,t,n,a),n!==null&&(Wn(n,e,a),xw(n,t,a)))}function mw(e,t,n){var a=Xn();ro(e,t,n,a)}function ro(e,t,n,a){var r={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Md(e))pw(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,Zn(o,i))return Ed(e,t,r,0),dt===null&&Rd(),!1}catch{}finally{}if(n=Ap(e,t,r,a),n!==null)return Wn(n,e,a),xw(n,t,a),!0}return!1}function Wp(e,t,n,a){if(a={lane:2,revertLane:ax(),action:a,hasEagerState:!1,eagerState:null,next:null},Md(e)){if(t)throw Error(Q(479))}else t=Ap(e,n,a,2),t!==null&&Wn(t,e,2)}function Md(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function pw(e,t){Ml=Mu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xw(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,lb(e,n)}}var Du={readContext:rn,use:Ad,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt},gw={readContext:rn,use:Ad,useCallback:function(e,t){return wn().memoizedState=[e,t===void 0?null:t],e},useContext:rn,useEffect:jv,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,lu(4194308,4,aw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return lu(4194308,4,e,t)},useInsertionEffect:function(e,t){lu(4,2,e,t)},useMemo:function(e,t){var n=wn();t=t===void 0?null:t;var a=e();if(Or){La(!0);try{e()}finally{La(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=wn();if(n!==void 0){var r=n(t);if(Or){La(!0);try{n(t)}finally{La(!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=qC.bind(null,Be,e),[a.memoizedState,e]},useRef:function(e){var t=wn();return e={current:e},t.memoizedState=e},useState:function(e){e=um(e);var t=e.queue,n=mw.bind(null,Be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Fp,useDeferredValue:function(e,t){var n=wn();return Kp(n,e,t)},useTransition:function(){var e=um(!1);return e=cw.bind(null,Be,e.queue,!0,!1),wn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Be,r=wn();if(Qe){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),dt===null)throw Error(Q(349));qe&124||Gb(a,t,n)}r.memoizedState=n;var l={value:n,getSnapshot:t};return r.queue=l,jv(Yb.bind(null,a,l,e),[e]),a.flags|=2048,Fl(9,$d(),Vb.bind(null,a,l,n,t),null),n},useId:function(){var e=wn(),t=dt.identifierPrefix;if(Qe){var n=da,a=ua;n=(a&~(1<<32-Kn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Ou++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=LC++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Xp,useFormState:gv,useActionState:gv,useOptimistic:function(e){var t=wn();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Wp.bind(null,Be,!0,n),n.dispatch=t,[e,t]},useMemoCache:Vp,useCacheRefresh:function(){return wn().memoizedState=PC.bind(null,Be)}},vw={readContext:rn,use:Ad,useCallback:lw,useContext:rn,useEffect:tw,useImperativeHandle:rw,useInsertionEffect:nw,useLayoutEffect:sw,useMemo:iw,useReducer:ru,useRef:ew,useState:function(){return ru(ga)},useDebugValue:Fp,useDeferredValue:function(e,t){var n=Ot();return ow(n,it.memoizedState,e,t)},useTransition:function(){var e=ru(ga)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:Jo(e),t]},useSyncExternalStore:qb,useId:fw,useHostTransitionStatus:Xp,useFormState:vv,useActionState:vv,useOptimistic:function(e,t){var n=Ot();return Xb(n,it,e,t)},useMemoCache:Vp,useCacheRefresh:hw},GC={readContext:rn,use:Ad,useCallback:lw,useContext:rn,useEffect:tw,useImperativeHandle:rw,useInsertionEffect:nw,useLayoutEffect:sw,useMemo:iw,useReducer:Ff,useRef:ew,useState:function(){return Ff(ga)},useDebugValue:Fp,useDeferredValue:function(e,t){var n=Ot();return it===null?Kp(n,e,t):ow(n,it.memoizedState,e,t)},useTransition:function(){var e=Ff(ga)[0],t=Ot().memoizedState;return[typeof e=="boolean"?e:Jo(e),t]},useSyncExternalStore:qb,useId:fw,useHostTransitionStatus:Xp,useFormState:yv,useActionState:yv,useOptimistic:function(e,t){var n=Ot();return it!==null?Xb(n,it,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Vp,useCacheRefresh:hw},Dl=null,wo=0;function Ec(e){var t=wo;return wo+=1,Dl===null&&(Dl=[]),Ub(Dl,e,t)}function $i(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Tc(e,t){throw t.$$typeof===j2?Error(Q(525)):(e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function bv(e){var t=e._init;return t(e._payload)}function yw(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=ma(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=Gf(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===xl?f(g,p,b.props.children,w,b.key):p!==null&&(p.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Aa&&bv(S)===p.type)?(p=r(p,b.props),$i(p,b),p.return=g,p):(p=su(b.type,b.key,b.props,null,g.mode,w),$i(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=Vf(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=Nr(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=Gf(""+p,g.mode,b),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case wc:return b=su(p.type,p.key,p.props,null,g.mode,b),$i(b,p),b.return=g,b;case Ii:return p=Vf(p,g.mode,b),p.return=g,p;case Aa:var w=p._init;return p=w(p._payload),m(g,p,b)}if(Hi(p)||Ri(p))return p=Nr(p,g.mode,b,null),p.return=g,p;if(typeof p.then=="function")return m(g,Ec(p),b);if(p.$$typeof===ca)return m(g,Cc(g,p),b);Tc(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 wc:return b.key===S?c(g,p,b,w):null;case Ii:return b.key===S?d(g,p,b,w):null;case Aa:return S=b._init,b=S(b._payload),h(g,p,b,w)}if(Hi(b)||Ri(b))return S!==null?null:f(g,p,b,w,null);if(typeof b.then=="function")return h(g,p,Ec(b),w);if(b.$$typeof===ca)return h(g,p,Cc(g,b),w);Tc(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 wc:return g=g.get(w.key===null?b:w.key)||null,c(p,g,w,S);case Ii:return g=g.get(w.key===null?b:w.key)||null,d(p,g,w,S);case Aa:var C=w._init;return w=C(w._payload),x(g,p,b,w,S)}if(Hi(w)||Ri(w))return g=g.get(b)||null,f(p,g,w,S,null);if(typeof w.then=="function")return x(g,p,b,Ec(w),S);if(w.$$typeof===ca)return x(g,p,b,Cc(p,w),S);Tc(p,w)}return null}function y(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,_),Qe&&yr(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 Qe&&yr(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)}),Qe&&yr(g,N),S}function v(g,p,b,w){if(b==null)throw Error(Q(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,_),Qe&&yr(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 Qe&&yr(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(P){return t(g,P)}),Qe&&yr(g,N),S}function j(g,p,b,w){if(typeof b=="object"&&b!==null&&b.type===xl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case wc:e:{for(var S=b.key;p!==null;){if(p.key===S){if(S=b.type,S===xl){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===Aa&&bv(S)===p.type){n(g,p.sibling),w=r(p,b.props),$i(w,b),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}b.type===xl?(w=Nr(b.props.children,g.mode,w,b.key),w.return=g,g=w):(w=su(b.type,b.key,b.props,null,g.mode,w),$i(w,b),w.return=g,g=w)}return i(g);case Ii: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=Vf(b,g.mode,w),w.return=g,g=w}return i(g);case Aa:return S=b._init,b=S(b._payload),j(g,p,b,w)}if(Hi(b))return y(g,p,b,w);if(Ri(b)){if(S=Ri(b),typeof S!="function")throw Error(Q(150));return b=S.call(b),v(g,p,b,w)}if(typeof b.then=="function")return j(g,p,Ec(b),w);if(b.$$typeof===ca)return j(g,p,Cc(g,b),w);Tc(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=Gf(b,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,b,w){try{wo=0;var S=j(g,p,b,w);return Dl=null,S}catch(_){if(_===Zo||_===Td)throw _;var C=Yn(29,_,null,g.mode);return C.lanes=w,C.return=g,C}finally{}}}var Kl=yw(!0),jw=yw(!1),gs=Ws(null),Gs=null;function Oa(e){var t=e.alternate;gt(Ut,Ut.current&1),gt(gs,e),Gs===null&&(t===null||Yl.current!==null||t.memoizedState!==null)&&(Gs=e)}function bw(e){if(e.tag===22){if(gt(Ut,Ut.current),gt(gs,e),Gs===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Gs=e)}}else Da()}function Da(){gt(Ut,Ut.current),gt(gs,gs.current)}function ha(e){Ft(gs),Gs===e&&(Gs=null),Ft(Ut)}var Ut=Ws(0);function zu(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==="$?"||Em(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 Kf(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:ht({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var hm={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=Xn(),r=Ga(a);r.payload=t,n!=null&&(r.callback=n),t=Va(e,r,a),t!==null&&(Wn(t,e,a),no(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=Xn(),r=Ga(a);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=Va(e,r,a),t!==null&&(Wn(t,e,a),no(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xn(),a=Ga(n);a.tag=2,t!=null&&(a.callback=t),t=Va(e,a,n),t!==null&&(Wn(t,e,n),no(t,e,n))}};function wv(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?!yo(n,a)||!yo(r,l):!0}function _v(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&&hm.enqueueReplaceState(t,t.state,null)}function Dr(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=ht({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}var Lu=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 ww(e){Lu(e)}function _w(e){console.error(e)}function Nw(e){Lu(e)}function Uu(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Nv(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 mm(e,t,n){return n=Ga(n),n.tag=3,n.payload={element:null},n.callback=function(){Uu(e,t)},n}function kw(e){return e=Ga(e),e.tag=3,e}function Sw(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(){Nv(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){Nv(t,n,a),typeof r!="function"&&(Ya===null?Ya=new Set([this]):Ya.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function VC(e,t,n,a,r){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&Wo(t,n,r,!0),n=gs.current,n!==null){switch(n.tag){case 13:return Gs===null?wm():n.alternate===null&&_t===0&&(_t=3),n.flags&=-257,n.flags|=65536,n.lanes=r,a===lm?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),rh(e,a,r)),!1;case 22:return n.flags|=65536,a===lm?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)),rh(e,a,r)),!1}throw Error(Q(435,n.tag))}return rh(e,a,r),wm(),!1}if(Qe)return t=gs.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=r,a!==tm&&(e=Error(Q(422),{cause:a}),jo(cs(e,n)))):(a!==tm&&(t=Error(Q(423),{cause:a}),jo(cs(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,a=cs(a,n),r=mm(e.stateNode,a,r),Yf(e,r),_t!==4&&(_t=2)),!1;var l=Error(Q(520),{cause:a});if(l=cs(l,n),oo===null?oo=[l]:oo.push(l),_t!==4&&(_t=2),t===null)return!0;a=cs(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=mm(n.stateNode,a,e),Yf(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"&&(Ya===null||!Ya.has(l))))return n.flags|=65536,r&=-r,n.lanes|=r,r=kw(r),Sw(r,e,n,a),Yf(n,r),!1}n=n.return}while(n!==null);return!1}var Cw=Error(Q(461)),Yt=!1;function Zt(e,t,n,a){t.child=e===null?jw(t,null,n,a):Kl(t,e.child,n,a)}function kv(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 Mr(t),a=Ip(e,t,n,i,l,r),o=Hp(),e!==null&&!Yt?(Pp(e,t,r),va(e,t,r)):(Qe&&o&&Mp(t),t.flags|=1,Zt(e,t,a,r),t.child)}function Sv(e,t,n,a,r){if(e===null){var l=n.type;return typeof l=="function"&&!$p(l)&&l.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=l,Rw(e,t,l,a,r)):(e=su(n.type,null,a,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(l=e.child,!Qp(e,r)){var i=l.memoizedProps;if(n=n.compare,n=n!==null?n:yo,n(i,a)&&e.ref===t.ref)return va(e,t,r)}return t.flags|=1,e=ma(l,a),e.ref=t.ref,e.return=t,t.child=e}function Rw(e,t,n,a,r){if(e!==null){var l=e.memoizedProps;if(yo(l,a)&&e.ref===t.ref)if(Yt=!1,t.pendingProps=a=l,Qp(e,r))e.flags&131072&&(Yt=!0);else return t.lanes=e.lanes,va(e,t,r)}return pm(e,t,n,a,r)}function Ew(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 Cv(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&au(t,l!==null?l.cachePool:null),l!==null?mv(t,l):cm(),bw(t);else return t.lanes=t.childLanes=536870912,Cv(e,t,l!==null?l.baseLanes|n:n,n)}else l!==null?(au(t,l.cachePool),mv(t,l),Da(),t.memoizedState=null):(e!==null&&au(t,null),cm(),Da());return Zt(e,t,r,n),t.child}function Cv(e,t,n,a){var r=zp();return r=r===null?null:{parent:Lt._currentValue,pool:r},t.memoizedState={baseLanes:n,cachePool:r},e!==null&&au(t,null),cm(),bw(t),e!==null&&Wo(e,t,a,!0),null}function iu(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(Q(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function pm(e,t,n,a,r){return Mr(t),n=Ip(e,t,n,a,void 0,r),a=Hp(),e!==null&&!Yt?(Pp(e,t,r),va(e,t,r)):(Qe&&a&&Mp(t),t.flags|=1,Zt(e,t,n,r),t.child)}function Rv(e,t,n,a,r,l){return Mr(t),t.updateQueue=null,n=Pb(t,a,n,r),Hb(e),a=Hp(),e!==null&&!Yt?(Pp(e,t,l),va(e,t,l)):(Qe&&a&&Mp(t),t.flags|=1,Zt(e,t,n,l),t.child)}function Ev(e,t,n,a,r){if(Mr(t),t.stateNode===null){var l=Nl,i=n.contextType;typeof i=="object"&&i!==null&&(l=rn(i)),l=new n(a,l),t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=hm,t.stateNode=l,l._reactInternals=t,l=t.stateNode,l.props=a,l.state=t.memoizedState,l.refs={},Lp(t),i=n.contextType,l.context=typeof i=="object"&&i!==null?rn(i):Nl,l.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(Kf(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&&hm.enqueueReplaceState(l,l.state,null),ao(t,a,l,r),so(),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=Dr(n,o);l.props=c;var d=l.context,f=n.contextType;i=Nl,typeof f=="object"&&f!==null&&(i=rn(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)&&_v(t,l,a,i),$a=!1;var h=t.memoizedState;l.state=h,ao(t,a,l,r),so(),d=t.memoizedState,o||h!==d||$a?(typeof m=="function"&&(Kf(t,n,m,a),d=t.memoizedState),(c=$a||wv(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,im(e,t),i=t.memoizedProps,f=Dr(n,i),l.props=f,m=t.pendingProps,h=l.context,d=n.contextType,c=Nl,typeof d=="object"&&d!==null&&(c=rn(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)&&_v(t,l,a,c),$a=!1,h=t.memoizedState,l.state=h,ao(t,a,l,r),so();var x=t.memoizedState;i!==m||h!==x||$a||e!==null&&e.dependencies!==null&&Au(e.dependencies)?(typeof o=="function"&&(Kf(t,n,o,a),x=t.memoizedState),(f=$a||wv(t,n,f,a,h,x,c)||e!==null&&e.dependencies!==null&&Au(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,iu(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=Kl(t,e.child,null,r),t.child=Kl(t,null,n,r)):Zt(e,t,n,r),t.memoizedState=l.state,e=t.child):e=va(e,t,r),e}function Tv(e,t,n,a){return Xo(),t.flags|=256,Zt(e,t,n,a),t.child}var Xf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wf(e){return{baseLanes:e,cachePool:zb()}}function Qf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=us),e}function Tw(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:(Ut.current&2)!==0),i&&(r=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Qe){if(r?Oa(t):Da(),Qe){var o=wt,c;if(c=o){e:{for(c=o,o=zs;c.nodeType!==8;){if(!o){o=null;break e}if(c=ks(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:kr!==null?{id:ua,overflow:da}:null,retryLane:536870912,hydrationErrors:null},c=Yn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,dn=t,wt=null,c=!0):c=!1}c||$r(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return Em(o)?t.lanes=32:t.lanes=536870912,null;ha(t)}return o=a.children,a=a.fallback,r?(Da(),r=t.mode,o=Bu({mode:"hidden",children:o},r),a=Nr(a,r,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,r=t.child,r.memoizedState=Wf(n),r.childLanes=Qf(e,i,n),t.memoizedState=Xf,a):(Oa(t),xm(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(l)t.flags&256?(Oa(t),t.flags&=-257,t=Zf(e,t,n)):t.memoizedState!==null?(Da(),t.child=e.child,t.flags|=128,t=null):(Da(),r=a.fallback,o=t.mode,a=Bu({mode:"visible",children:a.children},o),r=Nr(r,o,n,null),r.flags|=2,a.return=t,r.return=t,a.sibling=r,t.child=a,Kl(t,e.child,null,n),a=t.child,a.memoizedState=Wf(n),a.childLanes=Qf(e,i,n),t.memoizedState=Xf,t=r);else if(Oa(t),Em(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(Q(419)),a.stack="",a.digest=i,jo({value:a,source:null,stack:null}),t=Zf(e,t,n)}else if(Yt||Wo(e,t,n,!1),i=(n&e.childLanes)!==0,Yt||i){if(i=dt,i!==null&&(a=n&-n,a=a&42?1:bp(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,li(e,a),Wn(i,e,a),Cw;o.data==="$?"||wm(),t=Zf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,wt=ks(o.nextSibling),dn=t,Qe=!0,Sr=null,zs=!1,e!==null&&(ls[is++]=ua,ls[is++]=da,ls[is++]=kr,ua=e.id,da=e.overflow,kr=t),t=xm(t,a.children),t.flags|=4096);return t}return r?(Da(),r=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=ma(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?r=ma(d,r):(r=Nr(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=Wf(n):(c=o.cachePool,c!==null?(d=Lt._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=zb(),o={baseLanes:o.baseLanes|n,cachePool:c}),r.memoizedState=o,r.childLanes=Qf(e,i,n),t.memoizedState=Xf,a):(Oa(t),n=e.child,e=n.sibling,n=ma(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 xm(e,t){return t=Bu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Bu(e,t){return e=Yn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function Zf(e,t,n){return Kl(t,e.child,null,n),e=xm(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Av(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),sm(e.return,t,n)}function Jf(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 Aw(e,t,n){var a=t.pendingProps,r=a.revealOrder,l=a.tail;if(Zt(e,t,a.children,n),a=Ut.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&&Av(e,n,t);else if(e.tag===19)Av(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(gt(Ut,a),r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&zu(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Jf(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&&zu(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Jf(t,!0,n,null,l);break;case"together":Jf(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function va(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),tr|=t.lanes,!(n&t.childLanes))if(e!==null){if(Wo(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(Q(153));if(t.child!==null){for(e=t.child,n=ma(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ma(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Qp(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Au(e)))}function YC(e,t,n){switch(t.tag){case 3:_u(t,t.stateNode.containerInfo),Ma(t,Lt,e.memoizedState.cache),Xo();break;case 27:case 5:Vh(t);break;case 4:_u(t,t.stateNode.containerInfo);break;case 10:Ma(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(Oa(t),t.flags|=128,null):n&t.child.childLanes?Tw(e,t,n):(Oa(t),e=va(e,t,n),e!==null?e.sibling:null);Oa(t);break;case 19:var r=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(Wo(e,t,n,!1),a=(n&t.childLanes)!==0),r){if(a)return Aw(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),gt(Ut,Ut.current),a)break;return null;case 22:case 23:return t.lanes=0,Ew(e,t,n);case 24:Ma(t,Lt,e.memoizedState.cache)}return va(e,t,n)}function $w(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Yt=!0;else{if(!Qp(e,n)&&!(t.flags&128))return Yt=!1,YC(e,t,n);Yt=!!(e.flags&131072)}else Yt=!1,Qe&&t.flags&1048576&&Ob(t,Tu,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")$p(a)?(e=Dr(a,e),t.tag=1,t=Ev(null,t,a,e,n)):(t.tag=0,t=pm(null,t,a,e,n));else{if(a!=null){if(r=a.$$typeof,r===vp){t.tag=11,t=kv(null,t,a,e,n);break e}else if(r===yp){t.tag=14,t=Sv(null,t,a,e,n);break e}}throw t=qh(a)||a,Error(Q(306,t,""))}}return t;case 0:return pm(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,r=Dr(a,t.pendingProps),Ev(e,t,a,r,n);case 3:e:{if(_u(t,t.stateNode.containerInfo),e===null)throw Error(Q(387));a=t.pendingProps;var l=t.memoizedState;r=l.element,im(e,t),ao(t,a,null,n);var i=t.memoizedState;if(a=i.cache,Ma(t,Lt,a),a!==l.cache&&am(t,[Lt],n,!0),so(),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=Tv(e,t,a,n);break e}else if(a!==r){r=cs(Error(Q(424)),t),jo(r),t=Tv(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(wt=ks(e.firstChild),dn=t,Qe=!0,Sr=null,zs=!0,n=jw(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Xo(),a===r){t=va(e,t,n);break e}Zt(e,t,a,n)}t=t.child}return t;case 26:return iu(e,t),e===null?(n=Kv(t.type,null,t.pendingProps,null))?t.memoizedState=n:Qe||(n=t.type,e=t.pendingProps,a=Yu(qa.current).createElement(n),a[an]=t,a[Cn]=e,en(a,n,e),Vt(a),t.stateNode=a):t.memoizedState=Kv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Vh(t),e===null&&Qe&&(a=t.stateNode=v0(t.type,t.pendingProps,qa.current),dn=t,zs=!0,r=wt,ir(t.type)?(Tm=r,wt=ks(a.firstChild)):wt=r),Zt(e,t,t.pendingProps.children,n),iu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Qe&&((r=a=wt)&&(a=jR(a,t.type,t.pendingProps,zs),a!==null?(t.stateNode=a,dn=t,wt=ks(a.firstChild),zs=!1,r=!0):r=!1),r||$r(t)),Vh(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,a=l.children,Cm(r,l)?a=null:i!==null&&Cm(r,i)&&(t.flags|=32),t.memoizedState!==null&&(r=Ip(e,t,UC,null,null,n),So._currentValue=r),iu(e,t),Zt(e,t,a,n),t.child;case 6:return e===null&&Qe&&((e=n=wt)&&(n=bR(n,t.pendingProps,zs),n!==null?(t.stateNode=n,dn=t,wt=null,e=!0):e=!1),e||$r(t)),null;case 13:return Tw(e,t,n);case 4:return _u(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Kl(t,null,a,n):Zt(e,t,a,n),t.child;case 11:return kv(e,t,t.type,t.pendingProps,n);case 7:return Zt(e,t,t.pendingProps,n),t.child;case 8:return Zt(e,t,t.pendingProps.children,n),t.child;case 12:return Zt(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,Ma(t,t.type,a.value),Zt(e,t,a.children,n),t.child;case 9:return r=t.type._context,a=t.pendingProps.children,Mr(t),r=rn(r),a=a(r),t.flags|=1,Zt(e,t,a,n),t.child;case 14:return Sv(e,t,t.type,t.pendingProps,n);case 15:return Rw(e,t,t.type,t.pendingProps,n);case 19:return Aw(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=Bu(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=ma(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return Ew(e,t,n);case 24:return Mr(t),a=rn(Lt),e===null?(r=zp(),r===null&&(r=dt,l=Dp(),r.pooledCache=l,l.refCount++,l!==null&&(r.pooledCacheLanes|=n),r=l),t.memoizedState={parent:a,cache:r},Lp(t),Ma(t,Lt,r)):(e.lanes&n&&(im(e,t),ao(t,null,null,n),so()),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),Ma(t,Lt,a)):(a=l.cache,Ma(t,Lt,a),a!==r.cache&&am(t,[Lt],n,!0))),Zt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Q(156,t.tag))}function sa(e){e.flags|=4}function $v(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!b0(t)){if(t=gs.current,t!==null&&((qe&4194048)===qe?Gs!==null:(qe&62914560)!==qe&&!(qe&536870912)||t!==Gs))throw to=lm,Lb;e.flags|=8192}}function Ac(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ab():536870912,e.lanes|=t,Xl|=t)}function Mi(e,t){if(!Qe)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 vt(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 FC(e,t,n){var a=t.pendingProps;switch(Op(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(t),null;case 1:return vt(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),pa(Lt),Pl(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ai(t)?sa(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ov())),vt(t),null;case 26:return n=t.memoizedState,e===null?(sa(t),n!==null?(vt(t),$v(t,n)):(vt(t),t.flags&=-16777217)):n?n!==e.memoizedState?(sa(t),vt(t),$v(t,n)):(vt(t),t.flags&=-16777217):(e.memoizedProps!==a&&sa(t),vt(t),t.flags&=-16777217),null;case 27:Nu(t),n=qa.current;var r=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&sa(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return vt(t),null}e=Ps.current,Ai(t)?lv(t):(e=v0(r,a,n),t.stateNode=e,sa(t))}return vt(t),null;case 5:if(Nu(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&sa(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return vt(t),null}if(e=Ps.current,Ai(t))lv(t);else{switch(r=Yu(qa.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[an]=t,e[Cn]=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(en(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&&sa(t)}}return vt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&sa(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(Q(166));if(e=qa.current,Ai(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,r=dn,r!==null)switch(r.tag){case 27:case 5:a=r.memoizedProps}e[an]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||p0(e.nodeValue,n)),e||$r(t)}else e=Yu(e).createTextNode(a),e[an]=t,t.stateNode=e}return vt(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=Ai(t),a!==null&&a.dehydrated!==null){if(e===null){if(!r)throw Error(Q(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(Q(317));r[an]=t}else Xo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;vt(t),r=!1}else r=ov(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ha(t),t):(ha(t),null)}if(ha(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),Ac(t,t.updateQueue),vt(t),null;case 4:return Pl(),e===null&&rx(t.stateNode.containerInfo),vt(t),null;case 10:return pa(t.type),vt(t),null;case 19:if(Ft(Ut),r=t.memoizedState,r===null)return vt(t),null;if(a=(t.flags&128)!==0,l=r.rendering,l===null)if(a)Mi(r,!1);else{if(_t!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(l=zu(e),l!==null){for(t.flags|=128,Mi(r,!1),e=l.updateQueue,t.updateQueue=e,Ac(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Mb(n,e),n=n.sibling;return gt(Ut,Ut.current&1|2),t.child}e=e.sibling}r.tail!==null&&qs()>Hu&&(t.flags|=128,a=!0,Mi(r,!1),t.lanes=4194304)}else{if(!a)if(e=zu(l),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ac(t,e),Mi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!l.alternate&&!Qe)return vt(t),null}else 2*qs()-r.renderingStartTime>Hu&&n!==536870912&&(t.flags|=128,a=!0,Mi(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=qs(),t.sibling=null,e=Ut.current,gt(Ut,a?e&1|2:e&1),t):(vt(t),null);case 22:case 23:return ha(t),Up(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(vt(t),t.subtreeFlags&6&&(t.flags|=8192)):vt(t),n=t.updateQueue,n!==null&&Ac(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&&Ft(Cr),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),pa(Lt),vt(t),null;case 25:return null;case 30:return null}throw Error(Q(156,t.tag))}function KC(e,t){switch(Op(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pa(Lt),Pl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Nu(t),null;case 13:if(ha(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));Xo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ft(Ut),null;case 4:return Pl(),null;case 10:return pa(t.type),null;case 22:case 23:return ha(t),Up(),e!==null&&Ft(Cr),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return pa(Lt),null;case 25:return null;default:return null}}function Mw(e,t){switch(Op(t),t.tag){case 3:pa(Lt),Pl();break;case 26:case 27:case 5:Nu(t);break;case 4:Pl();break;case 13:ha(t);break;case 19:Ft(Ut);break;case 10:pa(t.type);break;case 22:case 23:ha(t),Up(),e!==null&&Ft(Cr);break;case 24:pa(Lt)}}function tc(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){ot(t,t.return,o)}}function er(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){ot(r,c,f)}}}a=a.next}while(a!==l)}}catch(f){ot(t,t.return,f)}}function Ow(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ib(t,n)}catch(a){ot(e,e.return,a)}}}function Dw(e,t,n){n.props=Dr(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){ot(e,t,a)}}function lo(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){ot(e,t,r)}}function Bs(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(r){ot(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){ot(e,t,r)}else n.current=null}function zw(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){ot(e,e.return,r)}}function eh(e,t,n){try{var a=e.stateNode;pR(a,e.type,n,t),a[Cn]=t}catch(r){ot(e,e.return,r)}}function Lw(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ir(e.type)||e.tag===4}function th(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Lw(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&&ir(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 gm(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=Ld));else if(a!==4&&(a===27&&ir(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(gm(e,t,n),e=e.sibling;e!==null;)gm(e,t,n),e=e.sibling}function Iu(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&&ir(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Iu(e,t,n),e=e.sibling;e!==null;)Iu(e,t,n),e=e.sibling}function Uw(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);en(t,a,n),t[an]=e,t[Cn]=n}catch(l){ot(e,e.return,l)}}var oa=!1,Et=!1,nh=!1,Mv=typeof WeakSet=="function"?WeakSet:Set,Gt=null;function XC(e,t){if(e=e.containerInfo,km=Wu,e=kb(e),Ep(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(Sm={focusedElem:e,selectionRange:n},Wu=!1,Gt=t;Gt!==null;)if(t=Gt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Gt=e;else for(;Gt!==null;){switch(t=Gt,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 y=Dr(n.type,r,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(y,l),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){ot(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Rm(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Rm(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(Q(163))}if(e=t.sibling,e!==null){e.return=t.return,Gt=e;break}Gt=t.return}}function Bw(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:ka(e,n),a&4&&tc(5,n);break;case 1:if(ka(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){ot(n,n.return,i)}else{var r=Dr(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){ot(n,n.return,i)}}a&64&&Ow(n),a&512&&lo(n,n.return);break;case 3:if(ka(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{Ib(e,t)}catch(i){ot(n,n.return,i)}}break;case 27:t===null&&a&4&&Uw(n);case 26:case 5:ka(e,n),t===null&&a&4&&zw(n),a&512&&lo(n,n.return);break;case 12:ka(e,n);break;case 13:ka(e,n),a&4&&Pw(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=aR.bind(null,n),wR(e,n))));break;case 22:if(a=n.memoizedState!==null||oa,!a){t=t!==null&&t.memoizedState!==null||Et,r=oa;var l=Et;oa=a,(Et=t)&&!l?Ea(e,n,(n.subtreeFlags&8772)!==0):ka(e,n),oa=r,Et=l}break;case 30:break;default:ka(e,n)}}function Iw(e){var t=e.alternate;t!==null&&(e.alternate=null,Iw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_p(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 pt=null,_n=!1;function aa(e,t,n){for(n=n.child;n!==null;)Hw(e,t,n),n=n.sibling}function Hw(e,t,n){if(Fn&&typeof Fn.onCommitFiberUnmount=="function")try{Fn.onCommitFiberUnmount(Go,n)}catch{}switch(n.tag){case 26:Et||Bs(n,t),aa(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Et||Bs(n,t);var a=pt,r=_n;ir(n.type)&&(pt=n.stateNode,_n=!1),aa(e,t,n),uo(n.stateNode),pt=a,_n=r;break;case 5:Et||Bs(n,t);case 6:if(a=pt,r=_n,pt=null,aa(e,t,n),pt=a,_n=r,pt!==null)if(_n)try{(pt.nodeType===9?pt.body:pt.nodeName==="HTML"?pt.ownerDocument.body:pt).removeChild(n.stateNode)}catch(l){ot(n,t,l)}else try{pt.removeChild(n.stateNode)}catch(l){ot(n,t,l)}break;case 18:pt!==null&&(_n?(e=pt,Vv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Eo(e)):Vv(pt,n.stateNode));break;case 4:a=pt,r=_n,pt=n.stateNode.containerInfo,_n=!0,aa(e,t,n),pt=a,_n=r;break;case 0:case 11:case 14:case 15:Et||er(2,n,t),Et||er(4,n,t),aa(e,t,n);break;case 1:Et||(Bs(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&Dw(n,t,a)),aa(e,t,n);break;case 21:aa(e,t,n);break;case 22:Et=(a=Et)||n.memoizedState!==null,aa(e,t,n),Et=a;break;default:aa(e,t,n)}}function Pw(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Eo(e)}catch(n){ot(t,t.return,n)}}function WC(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Mv),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Mv),t;default:throw Error(Q(435,e.tag))}}function sh(e,t){var n=WC(e);t.forEach(function(a){var r=rR.bind(null,e,a);n.has(a)||(n.add(a),a.then(r,r))})}function Hn(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(ir(o.type)){pt=o.stateNode,_n=!1;break e}break;case 5:pt=o.stateNode,_n=!1;break e;case 3:case 4:pt=o.stateNode.containerInfo,_n=!0;break e}o=o.return}if(pt===null)throw Error(Q(160));Hw(l,i,r),pt=null,_n=!1,l=r.alternate,l!==null&&(l.return=null),r.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)qw(t,e),t=t.sibling}var ws=null;function qw(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Hn(t,e),Pn(e),a&4&&(er(3,e,e.return),tc(3,e),er(5,e,e.return));break;case 1:Hn(t,e),Pn(e),a&512&&(Et||n===null||Bs(n,n.return)),a&64&&oa&&(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=ws;if(Hn(t,e),Pn(e),a&512&&(Et||n===null||Bs(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[Fo]||l[an]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=r.createElement(a),r.head.insertBefore(l,r.querySelector("head > title"))),en(l,a,n),l[an]=e,Vt(l),a=l;break e;case"link":var i=Wv("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),en(l,a,n),r.head.appendChild(l);break;case"meta":if(i=Wv("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),en(l,a,n),r.head.appendChild(l);break;default:throw Error(Q(468,a))}l[an]=e,Vt(l),a=l}e.stateNode=a}else Qv(r,e.type,e.stateNode);else e.stateNode=Xv(r,a,e.memoizedProps);else l!==a?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,a===null?Qv(r,e.type,e.stateNode):Xv(r,a,e.memoizedProps)):a===null&&e.stateNode!==null&&eh(e,e.memoizedProps,n.memoizedProps)}break;case 27:Hn(t,e),Pn(e),a&512&&(Et||n===null||Bs(n,n.return)),n!==null&&a&4&&eh(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Hn(t,e),Pn(e),a&512&&(Et||n===null||Bs(n,n.return)),e.flags&32){r=e.stateNode;try{Gl(r,"")}catch(x){ot(e,e.return,x)}}a&4&&e.stateNode!=null&&(r=e.memoizedProps,eh(e,r,n!==null?n.memoizedProps:r)),a&1024&&(nh=!0);break;case 6:if(Hn(t,e),Pn(e),a&4){if(e.stateNode===null)throw Error(Q(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){ot(e,e.return,x)}}break;case 3:if(uu=null,r=ws,ws=Fu(t.containerInfo),Hn(t,e),ws=r,Pn(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Eo(t.containerInfo)}catch(x){ot(e,e.return,x)}nh&&(nh=!1,Gw(e));break;case 4:a=ws,ws=Fu(e.stateNode.containerInfo),Hn(t,e),Pn(e),ws=a;break;case 12:Hn(t,e),Pn(e);break;case 13:Hn(t,e),Pn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(nx=qs()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,sh(e,a)));break;case 22:r=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=oa,f=Et;if(oa=d||r,Et=f||c,Hn(t,e),Et=f,oa=d,Pn(e),a&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||c||oa||Et||jr(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){ot(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=r?"":c.memoizedProps}catch(x){ot(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,sh(e,n))));break;case 19:Hn(t,e),Pn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,sh(e,a)));break;case 30:break;case 21:break;default:Hn(t,e),Pn(e)}}function Pn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(Lw(a)){n=a;break}a=a.return}if(n==null)throw Error(Q(160));switch(n.tag){case 27:var r=n.stateNode,l=th(e);Iu(e,l,r);break;case 5:var i=n.stateNode;n.flags&32&&(Gl(i,""),n.flags&=-33);var o=th(e);Iu(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=th(e);gm(e,d,c);break;default:throw Error(Q(161))}}catch(f){ot(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Gw(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Gw(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ka(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Bw(e,t.alternate,t),t=t.sibling}function jr(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:er(4,t,t.return),jr(t);break;case 1:Bs(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Dw(t,t.return,n),jr(t);break;case 27:uo(t.stateNode);case 26:case 5:Bs(t,t.return),jr(t);break;case 22:t.memoizedState===null&&jr(t);break;case 30:jr(t);break;default:jr(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),tc(4,l);break;case 1:if(Ea(r,l,n),a=l,r=a.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(d){ot(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++)Bb(c[r],o)}catch(d){ot(a,a.return,d)}}n&&i&64&&Ow(l),lo(l,l.return);break;case 27:Uw(l);case 26:case 5:Ea(r,l,n),n&&a===null&&i&4&&zw(l),lo(l,l.return);break;case 12:Ea(r,l,n);break;case 13:Ea(r,l,n),n&&i&4&&Pw(r,l);break;case 22:l.memoizedState===null&&Ea(r,l,n),lo(l,l.return);break;case 30:break;default:Ea(r,l,n)}t=t.sibling}}function Zp(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&&Qo(n))}function Jp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Qo(e))}function Os(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Vw(e,t,n,a),t=t.sibling}function Vw(e,t,n,a){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Os(e,t,n,a),r&2048&&tc(9,t);break;case 1:Os(e,t,n,a);break;case 3:Os(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&&Qo(e)));break;case 12:if(r&2048){Os(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){ot(t,t.return,c)}}else Os(e,t,n,a);break;case 13:Os(e,t,n,a);break;case 23:break;case 22:l=t.stateNode,i=t.alternate,t.memoizedState!==null?l._visibility&2?Os(e,t,n,a):io(e,t):l._visibility&2?Os(e,t,n,a):(l._visibility|=2,hl(e,t,n,a,(t.subtreeFlags&10256)!==0)),r&2048&&Zp(i,t);break;case 24:Os(e,t,n,a),r&2048&&Jp(t.alternate,t);break;default:Os(e,t,n,a)}}function hl(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:hl(l,i,o,c,r),tc(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?hl(l,i,o,c,r):io(l,i):(f._visibility|=2,hl(l,i,o,c,r)),r&&d&2048&&Zp(i.alternate,i);break;case 24:hl(l,i,o,c,r),r&&d&2048&&Jp(i.alternate,i);break;default:hl(l,i,o,c,r)}t=t.sibling}}function io(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:io(n,a),r&2048&&Zp(a.alternate,a);break;case 24:io(n,a),r&2048&&Jp(a.alternate,a);break;default:io(n,a)}t=t.sibling}}var qi=8192;function tl(e){if(e.subtreeFlags&qi)for(e=e.child;e!==null;)Yw(e),e=e.sibling}function Yw(e){switch(e.tag){case 26:tl(e),e.flags&qi&&e.memoizedState!==null&&DR(ws,e.memoizedState,e.memoizedProps);break;case 5:tl(e);break;case 3:case 4:var t=ws;ws=Fu(e.stateNode.containerInfo),tl(e),ws=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=qi,qi=16777216,tl(e),qi=t):tl(e));break;default:tl(e)}}function Fw(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 Oi(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Gt=a,Xw(a,e)}Fw(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Kw(e),e=e.sibling}function Kw(e){switch(e.tag){case 0:case 11:case 15:Oi(e),e.flags&2048&&er(9,e,e.return);break;case 3:Oi(e);break;case 12:Oi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,ou(e)):Oi(e);break;default:Oi(e)}}function ou(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];Gt=a,Xw(a,e)}Fw(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:er(8,t,t.return),ou(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,ou(t));break;default:ou(t)}e=e.sibling}}function Xw(e,t){for(;Gt!==null;){var n=Gt;switch(n.tag){case 0:case 11:case 15:er(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:Qo(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,Gt=a;else e:for(n=e;Gt!==null;){a=Gt;var r=a.sibling,l=a.return;if(Iw(a),a===n){Gt=null;break e}if(r!==null){r.return=l,Gt=r;break e}Gt=l}}}var QC={getCacheForType:function(e){var t=rn(Lt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},ZC=typeof WeakMap=="function"?WeakMap:Map,at=0,dt=null,Pe=null,qe=0,st=0,Gn=null,Ba=!1,ii=!1,ex=!1,ya=0,_t=0,tr=0,Rr=0,tx=0,us=0,Xl=0,oo=null,Nn=null,vm=!1,nx=0,Hu=1/0,Pu=null,Ya=null,Jt=0,Fa=null,Wl=null,zl=0,ym=0,jm=null,Ww=null,co=0,bm=null;function Xn(){if(at&2&&qe!==0)return qe&-qe;if(Ae.T!==null){var e=Vl;return e!==0?e:ax()}return ib()}function Qw(){us===0&&(us=!(qe&536870912)||Qe?sb():536870912);var e=gs.current;return e!==null&&(e.flags|=32),us}function Wn(e,t,n){(e===dt&&(st===2||st===9)||e.cancelPendingCommit!==null)&&(Ql(e,0),Ia(e,qe,us,!1)),Yo(e,n),(!(at&2)||e!==dt)&&(e===dt&&(!(at&2)&&(Rr|=n),_t===4&&Ia(e,qe,us,!1)),Qs(e))}function Zw(e,t,n){if(at&6)throw Error(Q(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||Vo(e,t),r=a?tR(e,t):ah(e,t,!0),l=a;do{if(r===0){ii&&!a&&Ia(e,t,0,!1);break}else{if(n=e.current.alternate,l&&!JC(n)){r=ah(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=oo;var c=o.current.memoizedState.isDehydrated;if(c&&(Ql(o,i).flags|=256),i=ah(o,i,!1),i!==2){if(ex&&!c){o.errorRecoveryDisabledLanes|=l,Rr|=l,r=4;break e}l=Nn,Nn=r,l!==null&&(Nn===null?Nn=l:Nn.push.apply(Nn,l))}r=i}if(l=!1,r!==2)continue}}if(r===1){Ql(e,0),Ia(e,t,0,!0);break}e:{switch(a=e,l=r,l){case 0:case 1:throw Error(Q(345));case 4:if((t&4194048)!==t)break;case 6:Ia(a,t,us,!Ba);break e;case 2:Nn=null;break;case 3:case 5:break;default:throw Error(Q(329))}if((t&62914560)===t&&(r=nx+300-qs(),10<r)){if(Ia(a,t,us,!Ba),Nd(a,0,!0)!==0)break e;a.timeoutHandle=g0(Ov.bind(null,a,n,Nn,Pu,vm,t,us,Rr,Xl,Ba,l,2,-0,0),r);break e}Ov(a,n,Nn,Pu,vm,t,us,Rr,Xl,Ba,l,0,-0,0)}}break}while(!0);Qs(e)}function Ov(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)&&(ko={stylesheets:null,count:0,unsuspend:OR},Yw(t),m=zR(),m!==null)){e.cancelPendingCommit=m(zv.bind(null,e,t,l,n,a,r,i,o,c,f,1,h,x)),Ia(e,l,i,!d);return}zv(e,t,l,n,a,r,i,o,c)}function JC(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(!Zn(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 Ia(e,t,n,a){t&=~tx,t&=~Rr,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var r=t;0<r;){var l=31-Kn(r),i=1<<l;a[l]=-1,r&=~i}n!==0&&rb(e,n,t)}function Od(){return at&6?!0:(nc(0),!1)}function sx(){if(Pe!==null){if(st===0)var e=Pe.return;else e=Pe,fa=Yr=null,qp(e),Dl=null,wo=0,e=Pe;for(;e!==null;)Mw(e.alternate,e),e=e.return;Pe=null}}function Ql(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,gR(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),sx(),dt=e,Pe=n=ma(e.current,null),qe=t,st=0,Gn=null,Ba=!1,ii=Vo(e,t),ex=!1,Xl=us=tx=Rr=tr=_t=0,Nn=oo=null,vm=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var r=31-Kn(a),l=1<<r;t|=e[r],a&=~l}return ya=t,Rd(),n}function Jw(e,t){Be=null,Ae.H=Du,t===Zo||t===Td?(t=fv(),st=3):t===Lb?(t=fv(),st=4):st=t===Cw?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Gn=t,Pe===null&&(_t=1,Uu(e,cs(t,e.current)))}function e0(){var e=Ae.H;return Ae.H=Du,e===null?Du:e}function t0(){var e=Ae.A;return Ae.A=QC,e}function wm(){_t=4,Ba||(qe&4194048)!==qe&&gs.current!==null||(ii=!0),!(tr&134217727)&&!(Rr&134217727)||dt===null||Ia(dt,qe,us,!1)}function ah(e,t,n){var a=at;at|=2;var r=e0(),l=t0();(dt!==e||qe!==t)&&(Pu=null,Ql(e,t)),t=!1;var i=_t;e:do try{if(st!==0&&Pe!==null){var o=Pe,c=Gn;switch(st){case 8:sx(),i=6;break e;case 3:case 2:case 9:case 6:gs.current===null&&(t=!0);var d=st;if(st=0,Gn=null,Cl(e,o,c,d),n&&ii){i=0;break e}break;default:d=st,st=0,Gn=null,Cl(e,o,c,d)}}eR(),i=_t;break}catch(f){Jw(e,f)}while(!0);return t&&e.shellSuspendCounter++,fa=Yr=null,at=a,Ae.H=r,Ae.A=l,Pe===null&&(dt=null,qe=0,Rd()),i}function eR(){for(;Pe!==null;)n0(Pe)}function tR(e,t){var n=at;at|=2;var a=e0(),r=t0();dt!==e||qe!==t?(Pu=null,Hu=qs()+500,Ql(e,t)):ii=Vo(e,t);e:do try{if(st!==0&&Pe!==null){t=Pe;var l=Gn;t:switch(st){case 1:st=0,Gn=null,Cl(e,t,l,1);break;case 2:case 9:if(dv(l)){st=0,Gn=null,Dv(t);break}t=function(){st!==2&&st!==9||dt!==e||(st=7),Qs(e)},l.then(t,t);break e;case 3:st=7;break e;case 4:st=5;break e;case 7:dv(l)?(st=0,Gn=null,Dv(t)):(st=0,Gn=null,Cl(e,t,l,7));break;case 5:var i=null;switch(Pe.tag){case 26:i=Pe.memoizedState;case 5:case 27:var o=Pe;if(!i||b0(i)){st=0,Gn=null;var c=o.sibling;if(c!==null)Pe=c;else{var d=o.return;d!==null?(Pe=d,Dd(d)):Pe=null}break t}}st=0,Gn=null,Cl(e,t,l,5);break;case 6:st=0,Gn=null,Cl(e,t,l,6);break;case 8:sx(),_t=6;break e;default:throw Error(Q(462))}}nR();break}catch(f){Jw(e,f)}while(!0);return fa=Yr=null,Ae.H=a,Ae.A=r,at=n,Pe!==null?0:(dt=null,qe=0,Rd(),_t)}function nR(){for(;Pe!==null&&!N2();)n0(Pe)}function n0(e){var t=$w(e.alternate,e,ya);e.memoizedProps=e.pendingProps,t===null?Dd(e):Pe=t}function Dv(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Rv(n,t,t.pendingProps,t.type,void 0,qe);break;case 11:t=Rv(n,t,t.pendingProps,t.type.render,t.ref,qe);break;case 5:qp(t);default:Mw(n,t),t=Pe=Mb(t,ya),t=$w(n,t,ya)}e.memoizedProps=e.pendingProps,t===null?Dd(e):Pe=t}function Cl(e,t,n,a){fa=Yr=null,qp(t),Dl=null,wo=0;var r=t.return;try{if(VC(e,r,t,n,qe)){_t=1,Uu(e,cs(n,e.current)),Pe=null;return}}catch(l){if(r!==null)throw Pe=r,l;_t=1,Uu(e,cs(n,e.current)),Pe=null;return}t.flags&32768?(Qe||a===1?e=!0:ii||qe&536870912?e=!1:(Ba=e=!0,(a===2||a===9||a===3||a===6)&&(a=gs.current,a!==null&&a.tag===13&&(a.flags|=16384))),s0(t,e)):Dd(t)}function Dd(e){var t=e;do{if(t.flags&32768){s0(t,Ba);return}e=t.return;var n=FC(t.alternate,t,ya);if(n!==null){Pe=n;return}if(t=t.sibling,t!==null){Pe=t;return}Pe=t=e}while(t!==null);_t===0&&(_t=5)}function s0(e,t){do{var n=KC(e.alternate,e);if(n!==null){n.flags&=32767,Pe=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Pe=e;return}Pe=e=n}while(e!==null);_t=6,Pe=null}function zv(e,t,n,a,r,l,i,o,c){e.cancelPendingCommit=null;do zd();while(Jt!==0);if(at&6)throw Error(Q(327));if(t!==null){if(t===e.current)throw Error(Q(177));if(l=t.lanes|t.childLanes,l|=Tp,O2(e,n,l,i,o,c),e===dt&&(Pe=dt=null,qe=0),Wl=t,Fa=e,zl=n,ym=l,jm=r,Ww=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,lR(ku,function(){return o0(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=Ae.T,Ae.T=null,r=Ze.p,Ze.p=2,i=at,at|=4;try{XC(e,t,n)}finally{at=i,Ze.p=r,Ae.T=a}}Jt=1,a0(),r0(),l0()}}function a0(){if(Jt===1){Jt=0;var e=Fa,t=Wl,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=Ae.T,Ae.T=null;var a=Ze.p;Ze.p=2;var r=at;at|=4;try{qw(t,e);var l=Sm,i=kb(e.containerInfo),o=l.focusedElem,c=l.selectionRange;if(i!==o&&o&&o.ownerDocument&&Nb(o.ownerDocument.documentElement,o)){if(c!==null&&Ep(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(),y=o.textContent.length,v=Math.min(c.start,y),j=c.end===void 0?v:Math.min(c.end,y);!x.extend&&v>j&&(i=j,j=v,v=i);var g=sv(o,v),p=sv(o,j);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>j?(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}}Wu=!!km,Sm=km=null}finally{at=r,Ze.p=a,Ae.T=n}}e.current=t,Jt=2}}function r0(){if(Jt===2){Jt=0;var e=Fa,t=Wl,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=Ae.T,Ae.T=null;var a=Ze.p;Ze.p=2;var r=at;at|=4;try{Bw(e,t.alternate,t)}finally{at=r,Ze.p=a,Ae.T=n}}Jt=3}}function l0(){if(Jt===4||Jt===3){Jt=0,k2();var e=Fa,t=Wl,n=zl,a=Ww;t.subtreeFlags&10256||t.flags&10256?Jt=5:(Jt=0,Wl=Fa=null,i0(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Ya=null),wp(n),t=t.stateNode,Fn&&typeof Fn.onCommitFiberRoot=="function")try{Fn.onCommitFiberRoot(Go,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=Ae.T,r=Ze.p,Ze.p=2,Ae.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{Ae.T=t,Ze.p=r}}zl&3&&zd(),Qs(e),r=e.pendingLanes,n&4194090&&r&42?e===bm?co++:(co=0,bm=e):co=0,nc(0)}}function i0(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Qo(t)))}function zd(e){return a0(),r0(),l0(),o0()}function o0(){if(Jt!==5)return!1;var e=Fa,t=ym;ym=0;var n=wp(zl),a=Ae.T,r=Ze.p;try{Ze.p=32>n?32:n,Ae.T=null,n=jm,jm=null;var l=Fa,i=zl;if(Jt=0,Wl=Fa=null,zl=0,at&6)throw Error(Q(331));var o=at;if(at|=4,Kw(l.current),Vw(l,l.current,i,n),at=o,nc(0,!1),Fn&&typeof Fn.onPostCommitFiberRoot=="function")try{Fn.onPostCommitFiberRoot(Go,l)}catch{}return!0}finally{Ze.p=r,Ae.T=a,i0(e,t)}}function Lv(e,t,n){t=cs(n,t),t=mm(e.stateNode,t,2),e=Va(e,t,2),e!==null&&(Yo(e,2),Qs(e))}function ot(e,t,n){if(e.tag===3)Lv(e,e,n);else for(;t!==null;){if(t.tag===3){Lv(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Ya===null||!Ya.has(a))){e=cs(n,e),n=kw(2),a=Va(t,n,2),a!==null&&(Sw(n,a,t,e),Yo(a,2),Qs(a));break}}t=t.return}}function rh(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new ZC;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)||(ex=!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,dt===e&&(qe&n)===n&&(_t===4||_t===3&&(qe&62914560)===qe&&300>qs()-nx?!(at&2)&&Ql(e,0):tx|=n,Xl===qe&&(Xl=0)),Qs(e)}function c0(e,t){t===0&&(t=ab()),e=li(e,t),e!==null&&(Yo(e,t),Qs(e))}function aR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),c0(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(Q(314))}a!==null&&a.delete(t),c0(e,n)}function lR(e,t){return jp(e,t)}var qu=null,ml=null,_m=!1,Gu=!1,lh=!1,Er=0;function Qs(e){e!==ml&&e.next===null&&(ml===null?qu=ml=e:ml=ml.next=e),Gu=!0,_m||(_m=!0,oR())}function nc(e,t){if(!lh&&Gu){lh=!0;do for(var n=!1,a=qu;a!==null;){if(e!==0){var r=a.pendingLanes;if(r===0)var l=0;else{var i=a.suspendedLanes,o=a.pingedLanes;l=(1<<31-Kn(42|e)+1)-1,l&=r&~(i&~o),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,Uv(a,l))}else l=qe,l=Nd(a,a===dt?l:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(l&3)||Vo(a,l)||(n=!0,Uv(a,l));a=a.next}while(n);lh=!1}}function iR(){u0()}function u0(){Gu=_m=!1;var e=0;Er!==0&&(xR()&&(e=Er),Er=0);for(var t=qs(),n=null,a=qu;a!==null;){var r=a.next,l=d0(a,t);l===0?(a.next=null,n===null?qu=r:n.next=r,r===null&&(ml=n)):(n=a,(e!==0||l&3)&&(Gu=!0)),a=r}nc(e)}function d0(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,r=e.expirationTimes,l=e.pendingLanes&-62914561;0<l;){var i=31-Kn(l),o=1<<i,c=r[i];c===-1?(!(o&n)||o&a)&&(r[i]=M2(o,t)):c<=t&&(e.expiredLanes|=o),l&=~o}if(t=dt,n=qe,n=Nd(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(st===2||st===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&$f(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Vo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&$f(a),wp(n)){case 2:case 8:n=tb;break;case 32:n=ku;break;case 268435456:n=nb;break;default:n=ku}return a=f0.bind(null,e),n=jp(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&$f(a),e.callbackPriority=2,e.callbackNode=null,2}function f0(e,t){if(Jt!==0&&Jt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zd()&&e.callbackNode!==n)return null;var a=qe;return a=Nd(e,e===dt?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Zw(e,a,t),d0(e,qs()),e.callbackNode!=null&&e.callbackNode===n?f0.bind(null,e):null)}function Uv(e,t){if(zd())return null;Zw(e,t,!0)}function oR(){vR(function(){at&6?jp(eb,iR):u0()})}function ax(){return Er===0&&(Er=sb()),Er}function Bv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:eu(""+e)}function Iv(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 cR(e,t,n,a,r){if(t==="submit"&&n&&n.stateNode===r){var l=Bv((r[Cn]||null).action),i=a.submitter;i&&(t=(t=i[Cn]||null)?Bv(t.formAction):i.getAttribute("formAction"),t!==null&&(l=t,i=null));var o=new kd("action","action",null,a,r);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Er!==0){var c=i?Iv(r,i):new FormData(r);fm(n,{pending:!0,data:c,method:r.method,action:l},null,c)}}else typeof l=="function"&&(o.preventDefault(),c=i?Iv(r,i):new FormData(r),fm(n,{pending:!0,data:c,method:r.method,action:l},l,c))},currentTarget:r}]})}}for(var ih=0;ih<em.length;ih++){var oh=em[ih],uR=oh.toLowerCase(),dR=oh[0].toUpperCase()+oh.slice(1);As(uR,"on"+dR)}As(Cb,"onAnimationEnd");As(Rb,"onAnimationIteration");As(Eb,"onAnimationStart");As("dblclick","onDoubleClick");As("focusin","onFocus");As("focusout","onBlur");As(RC,"onTransitionRun");As(EC,"onTransitionStart");As(TC,"onTransitionCancel");As(Tb,"onTransitionEnd");ql("onMouseEnter",["mouseout","mouseover"]);ql("onMouseLeave",["mouseout","mouseover"]);ql("onPointerEnter",["pointerout","pointerover"]);ql("onPointerLeave",["pointerout","pointerover"]);qr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));qr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));qr("onBeforeInput",["compositionend","keypress","textInput","paste"]);qr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));qr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));qr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _o="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(" "),fR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(_o));function h0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],r=a.event;a=a.listeners;e:{var l=void 0;if(t)for(var i=a.length-1;0<=i;i--){var o=a[i],c=o.instance,d=o.currentTarget;if(o=o.listener,c!==l&&r.isPropagationStopped())break e;l=o,r.currentTarget=d;try{l(r)}catch(f){Lu(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){Lu(f)}r.currentTarget=null,l=c}}}}function He(e,t){var n=t[Fh];n===void 0&&(n=t[Fh]=new Set);var a=e+"__bubble";n.has(a)||(m0(t,e,2,!1),n.add(a))}function ch(e,t,n){var a=0;t&&(a|=4),m0(n,e,a,t)}var $c="_reactListening"+Math.random().toString(36).slice(2);function rx(e){if(!e[$c]){e[$c]=!0,ob.forEach(function(n){n!=="selectionchange"&&(fR.has(n)||ch(n,!1,e),ch(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[$c]||(t[$c]=!0,ch("selectionchange",!1,t))}}function m0(e,t,n,a){switch(S0(t)){case 2:var r=BR;break;case 8:r=IR;break;default:r=cx}n=r.bind(null,t,n,e),r=void 0,!Qh||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 uh(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=vl(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}xb(function(){var d=l,f=kp(n),m=[];e:{var h=Ab.get(e);if(h!==void 0){var x=kd,y=e;switch(e){case"keypress":if(nu(n)===0)break e;case"keydown":case"keyup":x=lC;break;case"focusin":y="focus",x=If;break;case"focusout":y="blur",x=If;break;case"beforeblur":case"afterblur":x=If;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=Fg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=K2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=cC;break;case Cb:case Rb:case Eb:x=Q2;break;case Tb:x=dC;break;case"scroll":case"scrollend":x=Y2;break;case"wheel":x=hC;break;case"copy":case"cut":case"paste":x=J2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=Xg;break;case"toggle":case"beforetoggle":x=pC}var v=(t&4)!==0,j=!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=go(p,g),w!=null&&v.push(No(p,w,b))),j)break;p=p.return}0<v.length&&(h=new x(h,y,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!==Wh&&(y=n.relatedTarget||n.fromElement)&&(vl(y)||y[ai]))break e;if((x||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,x?(y=n.relatedTarget||n.toElement,x=d,y=y?vl(y):null,y!==null&&(j=qo(y),v=y.tag,y!==j||v!==5&&v!==27&&v!==6)&&(y=null)):(x=null,y=d),x!==y)){if(v=Fg,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=Xg,w="onPointerLeave",g="onPointerEnter",p="pointer"),j=x==null?h:Pi(x),b=y==null?h:Pi(y),h=new v(w,p+"leave",x,n,f),h.target=j,h.relatedTarget=b,w=null,vl(f)===d&&(v=new v(g,p+"enter",y,n,f),v.target=b,v.relatedTarget=j,w=v),j=w,x&&y)t:{for(v=x,g=y,p=0,b=v;b;b=nl(b))p++;for(b=0,w=g;w;w=nl(w))b++;for(;0<p-b;)v=nl(v),p--;for(;0<b-p;)g=nl(g),b--;for(;p--;){if(v===g||g!==null&&v===g.alternate)break t;v=nl(v),g=nl(g)}v=null}else v=null;x!==null&&Hv(m,h,x,v,!1),y!==null&&j!==null&&Hv(m,j,y,v,!0)}}e:{if(h=d?Pi(d):window,x=h.nodeName&&h.nodeName.toLowerCase(),x==="select"||x==="input"&&h.type==="file")var S=Jg;else if(Zg(h))if(wb)S=kC;else{S=_C;var C=wC}else x=h.nodeName,!x||x.toLowerCase()!=="input"||h.type!=="checkbox"&&h.type!=="radio"?d&&Np(d.elementType)&&(S=Jg):S=NC;if(S&&(S=S(e,d))){bb(m,S,n,f);break e}C&&C(e,h,d),e==="focusout"&&d&&h.type==="number"&&d.memoizedProps.value!=null&&Xh(h,"number",h.value)}switch(C=d?Pi(d):window,e){case"focusin":(Zg(C)||C.contentEditable==="true")&&(bl=C,Zh=d,Ji=null);break;case"focusout":Ji=Zh=bl=null;break;case"mousedown":Jh=!0;break;case"contextmenu":case"mouseup":case"dragend":Jh=!1,av(m,n,f);break;case"selectionchange":if(CC)break;case"keydown":case"keyup":av(m,n,f)}var _;if(Rp)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 jl?yb(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(vb&&n.locale!=="ko"&&(jl||N!=="onCompositionStart"?N==="onCompositionEnd"&&jl&&(_=gb()):(Ua=f,Sp="value"in Ua?Ua.value:Ua.textContent,jl=!0)),C=Vu(d,N),0<C.length&&(N=new Kg(N,e,null,n,f),m.push({event:N,listeners:C}),_?N.data=_:(_=jb(n),_!==null&&(N.data=_)))),(_=gC?vC(e,n):yC(e,n))&&(N=Vu(d,"onBeforeInput"),0<N.length&&(C=new Kg("onBeforeInput","beforeinput",null,n,f),m.push({event:C,listeners:N}),C.data=_)),cR(m,e,d,n,f)}h0(m,t)})}function No(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Vu(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=go(e,n),r!=null&&a.unshift(No(e,r,l)),r=go(e,t),r!=null&&a.push(No(e,r,l))),e.tag===3)return a;e=e.return}return[]}function nl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Hv(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=go(n,l),d!=null&&i.unshift(No(n,d,c))):r||(d=go(n,l),d!=null&&i.push(No(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var hR=/\r\n?/g,mR=/\u0000|\uFFFD/g;function Pv(e){return(typeof e=="string"?e:""+e).replace(hR,`
|
|
49
|
+
`).replace(mR,"")}function p0(e,t){return t=Pv(t),Pv(e)===t}function Ld(){}function lt(e,t,n,a,r,l){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||Gl(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&Gl(e,""+a);break;case"className":kc(e,"class",a);break;case"tabIndex":kc(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":kc(e,n,a);break;case"style":pb(e,a,l);break;case"data":if(t!=="object"){kc(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=eu(""+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"&<(e,t,"name",r.name,r,null),lt(e,t,"formEncType",r.formEncType,r,null),lt(e,t,"formMethod",r.formMethod,r,null),lt(e,t,"formTarget",r.formTarget,r,null)):(lt(e,t,"encType",r.encType,r,null),lt(e,t,"method",r.method,r,null),lt(e,t,"target",r.target,r,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=eu(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Ld);break;case"onScroll":a!=null&&He("scroll",e);break;case"onScrollEnd":a!=null&&He("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(Q(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=eu(""+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":He("beforetoggle",e),He("toggle",e),Jc(e,"popover",a);break;case"xlinkActuate":na(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":na(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":na(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":na(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":na(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":na(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":na(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":na(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":na(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Jc(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=G2.get(n)||n,Jc(e,n,a))}}function Nm(e,t,n,a,r,l){switch(n){case"style":pb(e,a,l);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(r.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"children":typeof a=="string"?Gl(e,a):(typeof a=="number"||typeof a=="bigint")&&Gl(e,""+a);break;case"onScroll":a!=null&&He("scroll",e);break;case"onScrollEnd":a!=null&&He("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Ld);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!cb.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[Cn]||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,""):Jc(e,n,a)}}}function en(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",e),He("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(Q(137,t));default:lt(e,t,l,i,n,null)}}r&<(e,t,"srcSet",n.srcSet,n,null),a&<(e,t,"src",n.src,n,null);return;case"input":He("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(Q(137,t));break;default:lt(e,t,a,f,n,null)}}fb(e,l,o,c,d,i,r,!1),Su(e);return;case"select":He("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:lt(e,t,r,o,n,null)}t=l,n=i,e.multiple=!!a,t!=null?Tl(e,!!a,t,!1):n!=null&&Tl(e,!!a,n,!0);return;case"textarea":He("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(Q(91));break;default:lt(e,t,i,o,n,null)}mb(e,a,r,l),Su(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:lt(e,t,c,a,n,null)}return;case"dialog":He("beforetoggle",e),He("toggle",e),He("cancel",e),He("close",e);break;case"iframe":case"object":He("load",e);break;case"video":case"audio":for(a=0;a<_o.length;a++)He(_o[a],e);break;case"image":He("error",e),He("load",e);break;case"details":He("toggle",e);break;case"embed":case"source":case"link":He("error",e),He("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(Q(137,t));default:lt(e,t,d,a,n,null)}return;default:if(Np(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Nm(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&<(e,t,o,a,n,null))}function pR(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)||lt(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(Q(137,t));break;default:x!==m&<(e,t,h,x,a,m)}}Kh(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)||lt(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&<(e,t,r,l,a,c)}t=o,n=i,a=x,h!=null?Tl(e,!!n,h,!1):!!a!=!!n&&(t!=null?Tl(e,!!n,t,!0):Tl(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:lt(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(Q(91));break;default:r!==l&<(e,t,i,r,a,l)}hb(e,h,x);return;case"option":for(var y in n)if(h=n[y],n.hasOwnProperty(y)&&h!=null&&!a.hasOwnProperty(y))switch(y){case"selected":e.selected=!1;break;default:lt(e,t,y,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:lt(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)&<(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(Q(137,t));break;default:lt(e,t,d,h,a,x)}return;default:if(Np(t)){for(var j in n)h=n[j],n.hasOwnProperty(j)&&h!==void 0&&!a.hasOwnProperty(j)&&Nm(e,t,j,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||Nm(e,t,f,h,a,x);return}}for(var g in n)h=n[g],n.hasOwnProperty(g)&&h!=null&&!a.hasOwnProperty(g)&<(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||lt(e,t,m,h,a,x)}var km=null,Sm=null;function Yu(e){return e.nodeType===9?e:e.ownerDocument}function qv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function x0(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Cm(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 dh=null;function xR(){var e=window.event;return e&&e.type==="popstate"?e===dh?!1:(dh=e,!0):(dh=null,!1)}var g0=typeof setTimeout=="function"?setTimeout:void 0,gR=typeof clearTimeout=="function"?clearTimeout:void 0,Gv=typeof Promise=="function"?Promise:void 0,vR=typeof queueMicrotask=="function"?queueMicrotask:typeof Gv<"u"?function(e){return Gv.resolve(null).then(e).catch(yR)}:g0;function yR(e){setTimeout(function(){throw e})}function ir(e){return e==="head"}function Vv(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&&uo(i.documentElement),n&2&&uo(i.body),n&4)for(n=i.head,uo(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[Fo]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(r===0){e.removeChild(l),Eo(t);return}r--}else n==="$"||n==="$?"||n==="$!"?r++:a=n.charCodeAt(0)-48;else a=0;n=l}while(n);Eo(t)}function Rm(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":Rm(n),_p(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function jR(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[Fo])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=ks(e.nextSibling),e===null)break}return null}function bR(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ks(e.nextSibling),e===null))return null;return e}function Em(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function wR(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 ks(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 Tm=null;function Yv(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}function v0(e,t,n){switch(t=Yu(n),e){case"html":if(e=t.documentElement,!e)throw Error(Q(452));return e;case"head":if(e=t.head,!e)throw Error(Q(453));return e;case"body":if(e=t.body,!e)throw Error(Q(454));return e;default:throw Error(Q(451))}}function uo(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_p(e)}var vs=new Map,Fv=new Set;function Fu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wa=Ze.d;Ze.d={f:_R,r:NR,D:kR,C:SR,L:CR,m:RR,X:TR,S:ER,M:AR};function _R(){var e=wa.f(),t=Od();return e||t}function NR(e){var t=ri(e);t!==null&&t.tag===5&&t.type==="form"?dw(t):wa.r(e)}var oi=typeof document>"u"?null:document;function y0(e,t,n){var a=oi;if(a&&typeof t=="string"&&t){var r=os(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),Fv.has(r)||(Fv.add(r),e={rel:e,crossOrigin:n,href:t},a.querySelector(r)===null&&(t=a.createElement("link"),en(t,"link",e),Vt(t),a.head.appendChild(t)))}}function kR(e){wa.D(e),y0("dns-prefetch",e,null)}function SR(e,t){wa.C(e,t),y0("preconnect",e,t)}function CR(e,t,n){wa.L(e,t,n);var a=oi;if(a&&e&&t){var r='link[rel="preload"][as="'+os(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+os(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+os(n.imageSizes)+'"]')):r+='[href="'+os(e)+'"]';var l=r;switch(t){case"style":l=Zl(e);break;case"script":l=ci(e)}vs.has(l)||(e=ht({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),vs.set(l,e),a.querySelector(r)!==null||t==="style"&&a.querySelector(sc(l))||t==="script"&&a.querySelector(ac(l))||(t=a.createElement("link"),en(t,"link",e),Vt(t),a.head.appendChild(t)))}}function RR(e,t){wa.m(e,t);var n=oi;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+os(a)+'"][href="'+os(e)+'"]',l=r;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=ci(e)}if(!vs.has(l)&&(e=ht({rel:"modulepreload",href:e},t),vs.set(l,e),n.querySelector(r)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ac(l)))return}a=n.createElement("link"),en(a,"link",e),Vt(a),n.head.appendChild(a)}}}function ER(e,t,n){wa.S(e,t,n);var a=oi;if(a&&e){var r=El(a).hoistableStyles,l=Zl(e);t=t||"default";var i=r.get(l);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(sc(l)))o.loading=5;else{e=ht({rel:"stylesheet",href:e,"data-precedence":t},n),(n=vs.get(l))&&lx(e,n);var c=i=a.createElement("link");Vt(c),en(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,cu(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},r.set(l,i)}}}function TR(e,t){wa.X(e,t);var n=oi;if(n&&e){var a=El(n).hoistableScripts,r=ci(e),l=a.get(r);l||(l=n.querySelector(ac(r)),l||(e=ht({src:e,async:!0},t),(t=vs.get(r))&&ix(e,t),l=n.createElement("script"),Vt(l),en(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function AR(e,t){wa.M(e,t);var n=oi;if(n&&e){var a=El(n).hoistableScripts,r=ci(e),l=a.get(r);l||(l=n.querySelector(ac(r)),l||(e=ht({src:e,async:!0,type:"module"},t),(t=vs.get(r))&&ix(e,t),l=n.createElement("script"),Vt(l),en(l,"link",e),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},a.set(r,l))}}function Kv(e,t,n,a){var r=(r=qa.current)?Fu(r):null;if(!r)throw Error(Q(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Zl(n.href),n=El(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=Zl(n.href);var l=El(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(sc(e)))&&!l._p&&(i.instance=l,i.state.loading=5),vs.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},vs.set(e,n),l||$R(r,e,n,i.state))),t&&a===null)throw Error(Q(528,""));return i}if(t&&a!==null)throw Error(Q(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ci(n),n=El(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(Q(444,e))}}function Zl(e){return'href="'+os(e)+'"'}function sc(e){return'link[rel="stylesheet"]['+e+"]"}function j0(e){return ht({},e,{"data-precedence":e.precedence,precedence:null})}function $R(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}),en(t,"link",n),Vt(t),e.head.appendChild(t))}function ci(e){return'[src="'+os(e)+'"]'}function ac(e){return"script[async]"+e}function Xv(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+os(n.href)+'"]');if(a)return t.instance=a,Vt(a),a;var r=ht({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Vt(a),en(a,"style",r),cu(a,n.precedence,e),t.instance=a;case"stylesheet":r=Zl(n.href);var l=e.querySelector(sc(r));if(l)return t.state.loading|=4,t.instance=l,Vt(l),l;a=j0(n),(r=vs.get(r))&&lx(a,r),l=(e.ownerDocument||e).createElement("link"),Vt(l);var i=l;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),en(l,"link",a),t.state.loading|=4,cu(l,n.precedence,e),t.instance=l;case"script":return l=ci(n.src),(r=e.querySelector(ac(l)))?(t.instance=r,Vt(r),r):(a=n,(r=vs.get(l))&&(a=ht({},n),ix(a,r)),e=e.ownerDocument||e,r=e.createElement("script"),Vt(r),en(r,"link",a),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(Q(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(a=t.instance,t.state.loading|=4,cu(a,n.precedence,e));return t.instance}function cu(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 lx(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ix(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var uu=null;function Wv(e,t,n){if(uu===null){var a=new Map,r=uu=new Map;r.set(n,a)}else r=uu,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[Fo]||l[an]||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 Qv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function MR(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function b0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var ko=null;function OR(){}function DR(e,t,n){if(ko===null)throw Error(Q(475));var a=ko;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var r=Zl(n.href),l=e.querySelector(sc(r));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=Ku.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=l,Vt(l);return}l=e.ownerDocument||e,n=j0(n),(r=vs.get(r))&&lx(n,r),l=l.createElement("link"),Vt(l);var i=l;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),en(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=Ku.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function zR(){if(ko===null)throw Error(Q(475));var e=ko;return e.stylesheets&&e.count===0&&Am(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Am(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 Ku(){if(this.count--,this.count===0){if(this.stylesheets)Am(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xu=null;function Am(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xu=new Map,t.forEach(LR,e),Xu=null,Ku.call(e))}function LR(e,t){if(!(t.state.loading&4)){var n=Xu.get(e);if(n)var a=n.get(null);else{n=new Map,Xu.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=Ku.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 So={$$typeof:ca,Provider:null,Consumer:null,_currentValue:_r,_currentValue2:_r,_threadCount:0};function UR(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=Mf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mf(0),this.hiddenUpdates=Mf(null),this.identifierPrefix=a,this.onUncaughtError=r,this.onCaughtError=l,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function w0(e,t,n,a,r,l,i,o,c,d,f,m){return e=new UR(e,t,n,i,o,c,d,m),t=1,l===!0&&(t|=24),l=Yn(3,null,null,t),e.current=l,l.stateNode=e,t=Dp(),t.refCount++,e.pooledCache=t,t.refCount++,l.memoizedState={element:a,isDehydrated:n,cache:t},Lp(l),e}function _0(e){return e?(e=Nl,e):Nl}function N0(e,t,n,a,r,l){r=_0(r),a.context===null?a.context=r:a.pendingContext=r,a=Ga(t),a.payload={element:n},l=l===void 0?null:l,l!==null&&(a.callback=l),n=Va(e,a,t),n!==null&&(Wn(n,e,t),no(n,e,t))}function Zv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ox(e,t){Zv(e,t),(e=e.alternate)&&Zv(e,t)}function k0(e){if(e.tag===13){var t=li(e,67108864);t!==null&&Wn(t,e,67108864),ox(e,67108864)}}var Wu=!0;function BR(e,t,n,a){var r=Ae.T;Ae.T=null;var l=Ze.p;try{Ze.p=2,cx(e,t,n,a)}finally{Ze.p=l,Ae.T=r}}function IR(e,t,n,a){var r=Ae.T;Ae.T=null;var l=Ze.p;try{Ze.p=8,cx(e,t,n,a)}finally{Ze.p=l,Ae.T=r}}function cx(e,t,n,a){if(Wu){var r=$m(a);if(r===null)uh(e,t,a,Qu,n),Jv(e,a);else if(PR(r,e,t,n,a))a.stopPropagation();else if(Jv(e,a),t&4&&-1<HR.indexOf(e)){for(;r!==null;){var l=ri(r);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var i=vr(l.pendingLanes);if(i!==0){var o=l;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-Kn(i);o.entanglements[1]|=c,i&=~c}Qs(l),!(at&6)&&(Hu=qs()+500,nc(0))}}break;case 13:o=li(l,2),o!==null&&Wn(o,l,2),Od(),ox(l,2)}if(l=$m(a),l===null&&uh(e,t,a,Qu,n),l===r)break;r=l}r!==null&&a.stopPropagation()}else uh(e,t,a,null,n)}}function $m(e){return e=kp(e),ux(e)}var Qu=null;function ux(e){if(Qu=null,e=vl(e),e!==null){var t=qo(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Wj(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 Qu=e,null}function S0(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(S2()){case eb:return 2;case tb:return 8;case ku:case C2:return 32;case nb:return 268435456;default:return 32}default:return 32}}var Mm=!1,Ka=null,Xa=null,Wa=null,Co=new Map,Ro=new Map,za=[],HR="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 Jv(e,t){switch(e){case"focusin":case"focusout":Ka=null;break;case"dragenter":case"dragleave":Xa=null;break;case"mouseover":case"mouseout":Wa=null;break;case"pointerover":case"pointerout":Co.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ro.delete(t.pointerId)}}function Di(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=ri(t),t!==null&&k0(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function PR(e,t,n,a,r){switch(t){case"focusin":return Ka=Di(Ka,e,t,n,a,r),!0;case"dragenter":return Xa=Di(Xa,e,t,n,a,r),!0;case"mouseover":return Wa=Di(Wa,e,t,n,a,r),!0;case"pointerover":var l=r.pointerId;return Co.set(l,Di(Co.get(l)||null,e,t,n,a,r)),!0;case"gotpointercapture":return l=r.pointerId,Ro.set(l,Di(Ro.get(l)||null,e,t,n,a,r)),!0}return!1}function C0(e){var t=vl(e.target);if(t!==null){var n=qo(t);if(n!==null){if(t=n.tag,t===13){if(t=Wj(n),t!==null){e.blockedOn=t,D2(e.priority,function(){if(n.tag===13){var a=Xn();a=bp(a);var r=li(n,a);r!==null&&Wn(r,n,a),ox(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 du(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=$m(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);Wh=a,n.target.dispatchEvent(a),Wh=null}else return t=ri(n),t!==null&&k0(t),e.blockedOn=n,!1;t.shift()}return!0}function ey(e,t,n){du(e)&&n.delete(t)}function qR(){Mm=!1,Ka!==null&&du(Ka)&&(Ka=null),Xa!==null&&du(Xa)&&(Xa=null),Wa!==null&&du(Wa)&&(Wa=null),Co.forEach(ey),Ro.forEach(ey)}function Mc(e,t){e.blockedOn===t&&(e.blockedOn=null,Mm||(Mm=!0,Bt.unstable_scheduleCallback(Bt.unstable_NormalPriority,qR)))}var Oc=null;function ty(e){Oc!==e&&(Oc=e,Bt.unstable_scheduleCallback(Bt.unstable_NormalPriority,function(){Oc===e&&(Oc=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(ux(a||n)===null)continue;break}var l=ri(n);l!==null&&(e.splice(t,3),t-=3,fm(l,{pending:!0,data:r,method:n.method,action:a},a,r))}}))}function Eo(e){function t(c){return Mc(c,e)}Ka!==null&&Mc(Ka,e),Xa!==null&&Mc(Xa,e),Wa!==null&&Mc(Wa,e),Co.forEach(t),Ro.forEach(t);for(var n=0;n<za.length;n++){var a=za[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<za.length&&(n=za[0],n.blockedOn===null);)C0(n),n.blockedOn===null&&za.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[Cn]||null;if(typeof l=="function")i||ty(n);else if(i){var o=null;if(l&&l.hasAttribute("formAction")){if(r=l,i=l[Cn]||null)o=i.formAction;else if(ux(r)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),ty(n)}}}function dx(e){this._internalRoot=e}Ud.prototype.render=dx.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));var n=t.current,a=Xn();N0(n,a,e,t,null,null)};Ud.prototype.unmount=dx.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;N0(e.current,2,null,e,null,null),Od(),t[ai]=null}};function Ud(e){this._internalRoot=e}Ud.prototype.unstable_scheduleHydration=function(e){if(e){var t=ib();e={blockedOn:null,target:e,priority:t};for(var n=0;n<za.length&&t!==0&&t<za[n].priority;n++);za.splice(n,0,e),n===0&&C0(e)}};var ny=Kj.version;if(ny!=="19.1.0")throw Error(Q(527,ny,"19.1.0"));Ze.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Q(188)):(e=Object.keys(e).join(","),Error(Q(268,e)));return e=y2(t),e=e!==null?Qj(e):null,e=e===null?null:e.stateNode,e};var GR={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:Ae,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Dc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Dc.isDisabled&&Dc.supportsFiber)try{Go=Dc.inject(GR),Fn=Dc}catch{}}wd.createRoot=function(e,t){if(!Xj(e))throw Error(Q(299));var n=!1,a="",r=ww,l=_w,i=Nw,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(l=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=w0(e,1,!1,null,null,n,a,r,l,i,o,null),e[ai]=t.current,rx(e),new dx(t)};wd.hydrateRoot=function(e,t,n){if(!Xj(e))throw Error(Q(299));var a=!1,r="",l=ww,i=_w,o=Nw,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(l=n.onUncaughtError),n.onCaughtError!==void 0&&(i=n.onCaughtError),n.onRecoverableError!==void 0&&(o=n.onRecoverableError),n.unstable_transitionCallbacks!==void 0&&(c=n.unstable_transitionCallbacks),n.formState!==void 0&&(d=n.formState)),t=w0(e,1,!0,t,n??null,a,r,l,i,o,c,d),t.context=_0(null),n=t.current,a=Xn(),a=bp(a),r=Ga(a),r.callback=null,Va(n,r,a),n=a,t.current.lanes=n,Yo(t,n),Qs(t),e[ai]=t.current,rx(e),new Ud(t)};wd.version="19.1.0";function R0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(R0)}catch(e){console.error(e)}}R0(),Pj.exports=wd;var VR=Pj.exports;const E0=u.createContext(null);function T0({data:e,router:t,identity:n,notify:a,children:r}){return s.jsx(E0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:r})}function Bd(){const e=u.useContext(E0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const YR={success:()=>{},error:()=>{}},pn=()=>Bd().data,Fe=()=>Bd().router,Id=()=>Bd().identity,Fr=()=>Bd().notify??YR;function FR(){const{probe:e}=pn(),{href:t,Link:n}=Fe(),a=Id(),[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 KR=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),XR=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),sy=e=>{const t=XR(e);return t.charAt(0).toUpperCase()+t.slice(1)},A0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),WR=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 QR={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 ZR=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,...QR,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:A0("lucide",r),...!l&&!WR(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(ZR,{ref:l,iconNode:t,className:A0(`lucide-${KR(sy(e))}`,`lucide-${e}`,a),...r}));return n.displayName=sy(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 JR=[["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"}]],eE=Re("archive-restore",JR);/**
|
|
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 tE=[["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"}]],ay=Re("archive",tE);/**
|
|
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 nE=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],sE=Re("arrow-down",nE);/**
|
|
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 aE=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],$0=Re("arrow-left",aE);/**
|
|
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 rE=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],lE=Re("arrow-up",rE);/**
|
|
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 iE=[["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"}]],fx=Re("bot",iE);/**
|
|
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 oE=[["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"}]],cE=Re("briefcase",oE);/**
|
|
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 uE=[["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"}]],dE=Re("building-2",uE);/**
|
|
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 fE=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Kr=Re("check",fE);/**
|
|
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 hE=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Hd=Re("chevron-down",hE);/**
|
|
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 mE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],rc=Re("chevron-right",mE);/**
|
|
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 pE=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xE=Re("chevron-up",pE);/**
|
|
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 gE=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],M0=Re("chevrons-up-down",gE);/**
|
|
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 vE=[["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",vE);/**
|
|
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 yE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Pd=Re("circle-check",yE);/**
|
|
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 jE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],bE=Re("circle",jE);/**
|
|
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 wE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],_E=Re("clock",wE);/**
|
|
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 NE=[["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"}]],O0=Re("copy",NE);/**
|
|
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 kE=[["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"}]],hx=Re("ellipsis",kE);/**
|
|
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 SE=[["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"}]],CE=Re("eraser",SE);/**
|
|
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 RE=[["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"}]],lc=Re("eye",RE);/**
|
|
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 EE=[["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"}]],D0=Re("folder-git-2",EE);/**
|
|
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 TE=[["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"}]],AE=Re("folder-git",TE);/**
|
|
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 $E=[["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"}]],ME=Re("git-fork",$E);/**
|
|
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 OE=[["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"}]],Om=Re("git-pull-request-arrow",OE);/**
|
|
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 DE=[["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"}]],zE=Re("hard-drive",DE);/**
|
|
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"}]],UE=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 BE=[["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"}]],IE=Re("hourglass",BE);/**
|
|
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 HE=[["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"}]],PE=Re("house",HE);/**
|
|
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 qE=[["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"}]],GE=Re("inbox",qE);/**
|
|
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 VE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Rn=Re("info",VE);/**
|
|
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 YE=[["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"}]],FE=Re("laptop",YE);/**
|
|
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 KE=[["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"}]],XE=Re("life-buoy",KE);/**
|
|
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 WE=[["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"}]],z0=Re("list-checks",WE);/**
|
|
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 QE=[["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"}]],L0=Re("list-ordered",QE);/**
|
|
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 ZE=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],JE=Re("loader-circle",ZE);/**
|
|
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 eT=[["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"}]],tT=Re("lock",eT);/**
|
|
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 nT=[["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"}]],Zu=Re("messages-square",nT);/**
|
|
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 sT=[["path",{d:"M5 12h14",key:"1ays0h"}]],aT=Re("minus",sT);/**
|
|
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 rT=[["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"}]],lT=Re("network",rT);/**
|
|
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 iT=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],oT=Re("panel-left",iT);/**
|
|
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 cT=[["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"}]],U0=Re("pause",cT);/**
|
|
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 uT=[["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"}]],qd=Re("pencil",uT);/**
|
|
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 dT=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],fT=Re("play",dT);/**
|
|
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 hT=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zr=Re("plus",hT);/**
|
|
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 mT=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Xr=Re("refresh-cw",mT);/**
|
|
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 pT=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],xT=Re("rotate-ccw",pT);/**
|
|
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 gT=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],Gd=Re("search-x",gT);/**
|
|
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 vT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],yT=Re("search",vT);/**
|
|
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 jT=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],bT=Re("shield-alert",jT);/**
|
|
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 wT=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],_T=Re("snowflake",wT);/**
|
|
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 NT=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Ju=Re("tag",NT);/**
|
|
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 kT=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tn=Re("triangle-alert",kT);/**
|
|
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 ST=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],CT=Re("user-check",ST);/**
|
|
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 RT=[["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m14.305 16.53.923-.382",key:"1itpsq"}],["path",{d:"m15.228 13.852-.923-.383",key:"eplpkm"}],["path",{d:"m16.852 12.228-.383-.923",key:"13v3q0"}],["path",{d:"m16.852 17.772-.383.924",key:"1i8mnm"}],["path",{d:"m19.148 12.228.383-.923",key:"1q8j1v"}],["path",{d:"m19.53 18.696-.382-.924",key:"vk1qj3"}],["path",{d:"m20.772 13.852.924-.383",key:"n880s0"}],["path",{d:"m20.772 16.148.924.383",key:"1g6xey"}],["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],ET=Re("user-cog",RT);/**
|
|
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 TT=[["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"}]],mx=Re("user",TT);/**
|
|
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 AT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Vd=Re("x",AT),$T="Local only · this machine · not connected to SoftwareDLC",MT="Checking sync state…",OT="Sync state unknown",DT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",Lr="Details are in the terminal running sdlc viewer.",zT="How to fix it is in the terminal running sdlc viewer.",Yd="Loading…",ed="Not available";function LT(e){if(!e.source)return null;if(e.source.kind==="repository")return"Repository · in no folder";const t=e.source.repositories;return`Folder · ${t} ${t===1?"repository":"repositories"}`}function Gi(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const UT={repository_registry:"this repository's registry",folder_registry:"the folder registry",issue_store:"the issue store",task_store:"the task store",workspace_store:"the local graph store"};function B0(e,t){const n=t?` this list was read at ${Gi(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?UT[e.store]:"a local store",r=e.since?` since ${Gi(e.since)}`:"";return`Another sdlc command has held ${a}${r};${n||" nothing was read yet."} ${Lr}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${Gi(t)}.`:""}`:`The read failed.${t?` This list was read at ${Gi(t)}.`:""} ${Lr}`}const BT=e=>e.status===409,IT={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 HT(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?IT[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 ry=["tasks","issues","releases"],px=u.createContext(null);function Jn(){const e=u.useContext(px);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function PT(){var e;return(e=u.useContext(px))==null?void 0:e.engine}const qT=10,GT=()=>new Date;function VT({shell:e,now:t=GT,children:n}){var I;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,y]=u.useState(!0),[v,j]=u.useState(!1),[g,p]=u.useState(void 0),[b,w]=u.useState(!1),[S,C]=u.useState(ry),_=u.useRef(!1),N=u.useRef(!1),O=u.useRef(null),D=u.useRef(!0),B=u.useCallback(async(A=!1)=>{O.current&&clearTimeout(O.current),O.current=null,j(!0);const[$,R]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!D.current)return;if(j(!1),y(!1),$.ok&&R.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(R.data.projects);return}const E=$.ok?R.ok?null:R.refusal:$.refusal;if(!E)return;if(BT(E)){N.current=!1,h(null),c(E),r(null),i(null);return}const k=_.current&&!N.current&&!A;N.current=!0;const M=E.retry_after??qT;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(A=>{D.current&&(A.ok?p(A.data):A.refusal.status===404?p(null):w(!0))}),Promise.all(ry.map(async A=>{var $;return[A,await(($=e[A])==null?void 0:$.access())]})).then(A=>{D.current&&C(A.filter(([,$])=>!($!=null&&$.ok&&!$.data.can_view)).map(([$])=>$))}),()=>{D.current=!1,O.current&&clearTimeout(O.current)}),[e,B]);const P={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:(I=g==null?void 0:g.engine)==null?void 0:I.source,domains:S,reading:v,refresh:()=>void B()};return s.jsx(px.Provider,{value:P,children:n})}const I0=e=>`The ${e} page is not part of this sdlc install`,Wr="The sdlc engine here is too old for this page";function YT(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function es(){return YT(PT())}function H0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=H0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function P0(){for(var e,t,n=0,a="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=H0(e))&&(a&&(a+=" "),a+=t);return a}const ly=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,iy=P0,ic=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return iy(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=ly(f)||ly(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(y=>{let[v,j]=y;return Array.isArray(j)?j.includes({...l,...o}[v]):{...l,...o}[v]===j})?[...d,m,h]:d},[]);return iy(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},xx="-",FT=e=>{const t=XT(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(xx);return o[0]===""&&o.length!==1&&o.shift(),q0(o,t)||KT(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},q0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),r=a?q0(e.slice(1),a):void 0;if(r)return r;if(t.validators.length===0)return;const l=e.join(xx);return(i=t.validators.find(({validator:o})=>o(l)))==null?void 0:i.classGroupId},oy=/^\[(.+)\]$/,KT=e=>{if(oy.test(e)){const t=oy.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},XT=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const r in n)Dm(n[r],a,r,t);return a},Dm=(e,t,n,a)=>{e.forEach(r=>{if(typeof r=="string"){const l=r===""?t:cy(t,r);l.classGroupId=n;return}if(typeof r=="function"){if(WT(r)){Dm(r(a),t,n,a);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([l,i])=>{Dm(i,cy(t,l),n,a)})})},cy=(e,t)=>{let n=e;return t.split(xx).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},WT=e=>e.isThemeGetter,QT=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)}}},zm="!",Lm=":",ZT=Lm.length,JT=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=r=>{const l=[];let i=0,o=0,c=0,d;for(let y=0;y<r.length;y++){let v=r[y];if(i===0&&o===0){if(v===Lm){l.push(r.slice(c,y)),c=y+ZT;continue}if(v==="/"){d=y;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=l.length===0?r:r.substring(c),m=eA(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+Lm,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},eA=e=>e.endsWith(zm)?e.substring(0,e.length-1):e.startsWith(zm)?e.substring(1):e,tA=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}},nA=e=>({cache:QT(e.cacheSize),parseClassName:JT(e),sortModifiers:tA(e),...FT(e)}),sA=/\s+/,aA=(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:y,maybePostfixModifierPosition:v}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let j=!!v,g=a(j?y.substring(0,v):y);if(!g){if(!j){c=f+(c.length>0?" "+c:c);continue}if(g=a(y),!g){c=f+(c.length>0?" "+c:c);continue}j=!1}const p=l(h).join(":"),b=x?p+zm:p,w=b+g;if(i.includes(w))continue;i.push(w);const S=r(g,j);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=G0(t))&&(a&&(a+=" "),a+=n);return a}const G0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=G0(e[a]))&&(n&&(n+=" "),n+=t);return n};function lA(e,...t){let n,a,r,l=i;function i(c){const d=t.reduce((f,m)=>m(f),e());return n=nA(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=aA(c,n);return r(c,f),f}return function(){return l(rA.apply(null,arguments))}}const zt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},V0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Y0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,iA=/^\d+\/\d+$/,oA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,cA=/\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$/,uA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,sl=e=>iA.test(e),Ue=e=>!!e&&!Number.isNaN(Number(e)),Sa=e=>!!e&&Number.isInteger(Number(e)),fh=e=>e.endsWith("%")&&Ue(e.slice(0,-1)),ra=e=>oA.test(e),hA=()=>!0,mA=e=>cA.test(e)&&!uA.test(e),F0=()=>!1,pA=e=>dA.test(e),xA=e=>fA.test(e),gA=e=>!_e(e)&&!Ne(e),vA=e=>ui(e,W0,F0),_e=e=>V0.test(e),gr=e=>ui(e,Q0,mA),hh=e=>ui(e,_A,Ue),uy=e=>ui(e,K0,F0),yA=e=>ui(e,X0,xA),zc=e=>ui(e,Z0,pA),Ne=e=>Y0.test(e),zi=e=>di(e,Q0),jA=e=>di(e,NA),dy=e=>di(e,K0),bA=e=>di(e,W0),wA=e=>di(e,X0),Lc=e=>di(e,Z0,!0),ui=(e,t,n)=>{const a=V0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},di=(e,t,n=!1)=>{const a=Y0.exec(e);return a?a[1]?t(a[1]):n:!1},K0=e=>e==="position"||e==="percentage",X0=e=>e==="image"||e==="url",W0=e=>e==="length"||e==="size"||e==="bg-size",Q0=e=>e==="length",_A=e=>e==="number",NA=e=>e==="family-name",Z0=e=>e==="shadow",kA=()=>{const e=zt("color"),t=zt("font"),n=zt("text"),a=zt("font-weight"),r=zt("tracking"),l=zt("leading"),i=zt("breakpoint"),o=zt("container"),c=zt("spacing"),d=zt("radius"),f=zt("shadow"),m=zt("inset-shadow"),h=zt("text-shadow"),x=zt("drop-shadow"),y=zt("blur"),v=zt("perspective"),j=zt("aspect"),g=zt("ease"),p=zt("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=()=>[sl,"full","auto",...N()],D=()=>[Sa,"none","subgrid",Ne,_e],B=()=>["auto",{span:["full",Sa,Ne,_e]},Sa,Ne,_e],P=()=>[Sa,"auto",Ne,_e],I=()=>["auto","min","max","fr",Ne,_e],A=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...N()],E=()=>[sl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],k=()=>[e,Ne,_e],M=()=>[...w(),dy,uy,{position:[Ne,_e]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",bA,vA,{size:[Ne,_e]}],H=()=>[fh,zi,gr],X=()=>["","none","full",d,Ne,_e],Z=()=>["",Ue,zi,gr],ae=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[Ue,fh,dy,uy],te=()=>["","none",y,Ne,_e],Se=()=>["none",Ue,Ne,_e],le=()=>["none",Ue,Ne,_e],je=()=>[Ue,Ne,_e],me=()=>[sl,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ra],breakpoint:[ra],color:[hA],container:[ra],"drop-shadow":[ra],ease:["in","out","in-out"],font:[gA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ra],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ra],shadow:[ra],spacing:["px",Ue],text:[ra],"text-shadow":[ra],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",sl,_e,Ne,j]}],container:["container"],columns:[{columns:[Ue,_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:[Sa,"auto",Ne,_e]}],basis:[{basis:[sl,"full","auto",o,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ue,sl,"auto","initial","none",_e]}],grow:[{grow:["",Ue,Ne,_e]}],shrink:[{shrink:["",Ue,Ne,_e]}],order:[{order:[Sa,"first","last","none",Ne,_e]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...A(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...A()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":A()}],"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:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":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,zi,gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Ne,hh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fh,_e]}],"font-family":[{font:[jA,_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":[Ue,"none",Ne,hh]}],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:[Ue,"from-font","auto",Ne,gr]}],"text-decoration-color":[{decoration:k()}],"underline-offset":[{"underline-offset":[Ue,"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:F()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sa,Ne,_e],radial:["",Ne,_e],conic:[Sa,Ne,_e]},wA,yA]}],"bg-color":[{bg:k()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"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:Z()}],"border-w-x":[{"border-x":Z()}],"border-w-y":[{"border-y":Z()}],"border-w-s":[{"border-s":Z()}],"border-w-e":[{"border-e":Z()}],"border-w-t":[{"border-t":Z()}],"border-w-r":[{"border-r":Z()}],"border-w-b":[{"border-b":Z()}],"border-w-l":[{"border-l":Z()}],"divide-x":[{"divide-x":Z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Z()}],"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":[Ue,Ne,_e]}],"outline-w":[{outline:["",Ue,zi,gr]}],"outline-color":[{outline:k()}],shadow:[{shadow:["","none",f,Lc,zc]}],"shadow-color":[{shadow:k()}],"inset-shadow":[{"inset-shadow":["none",m,Lc,zc]}],"inset-shadow-color":[{"inset-shadow":k()}],"ring-w":[{ring:Z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:k()}],"ring-offset-w":[{"ring-offset":[Ue,gr]}],"ring-offset-color":[{"ring-offset":k()}],"inset-ring-w":[{"inset-ring":Z()}],"inset-ring-color":[{"inset-ring":k()}],"text-shadow":[{"text-shadow":["none",h,Lc,zc]}],"text-shadow-color":[{"text-shadow":k()}],opacity:[{opacity:[Ue,Ne,_e]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"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":[Ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"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":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"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":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"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":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"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":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"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":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"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":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"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":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"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":[Ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"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:F()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,_e]}],filter:[{filter:["","none",Ne,_e]}],blur:[{blur:te()}],brightness:[{brightness:[Ue,Ne,_e]}],contrast:[{contrast:[Ue,Ne,_e]}],"drop-shadow":[{"drop-shadow":["","none",x,Lc,zc]}],"drop-shadow-color":[{"drop-shadow":k()}],grayscale:[{grayscale:["",Ue,Ne,_e]}],"hue-rotate":[{"hue-rotate":[Ue,Ne,_e]}],invert:[{invert:["",Ue,Ne,_e]}],saturate:[{saturate:[Ue,Ne,_e]}],sepia:[{sepia:["",Ue,Ne,_e]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,_e]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ue,Ne,_e]}],"backdrop-contrast":[{"backdrop-contrast":[Ue,Ne,_e]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ue,Ne,_e]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ue,Ne,_e]}],"backdrop-invert":[{"backdrop-invert":["",Ue,Ne,_e]}],"backdrop-opacity":[{"backdrop-opacity":[Ue,Ne,_e]}],"backdrop-saturate":[{"backdrop-saturate":[Ue,Ne,_e]}],"backdrop-sepia":[{"backdrop-sepia":["",Ue,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:[Ue,"initial",Ne,_e]}],ease:[{ease:["linear","initial",g,Ne,_e]}],delay:[{delay:[Ue,Ne,_e]}],animate:[{animate:["none",p,Ne,_e]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Ne,_e]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],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:[Ue,zi,gr,hh]}],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"]}},SA=lA(kA);function oe(...e){return SA(P0(e))}const CA=ic("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 ce({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:oe(CA({variant:t}),e),...n})}function ke({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:oe("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function fe({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:oe("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function ve(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 fy(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fd(...e){return t=>{let n=!1;const a=e.map(r=>{const l=fy(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():fy(e[r],null)}}}}function Je(...e){return u.useCallback(Fd(...e),e)}function RA(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 Zs(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,...y}=m,v=((g=h==null?void 0:h[e])==null?void 0:g[c])||o,j=u.useMemo(()=>y,Object.values(y));return s.jsx(v.Provider,{value:j,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,y=u.useContext(x);if(y)return y;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,EA(r,...t)]}function EA(...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 ln=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},TA=Hj[" useId ".trim().toString()]||(()=>{}),AA=0;function Ss(e){const[t,n]=u.useState(TA());return ln(()=>{n(a=>a??String(AA++))},[e]),t?`radix-${t}`:""}var $A=Hj[" useInsertionEffect ".trim().toString()]||ln;function nr({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[r,l,i]=MA({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=OA(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 MA({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),r=u.useRef(n),l=u.useRef(t);return $A(()=>{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 OA(e){return typeof e=="function"}function Ur(e){const t=zA(e),n=u.forwardRef((a,r)=>{const{children:l,...i}=a,o=u.Children.toArray(l),c=o.find(UA);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 DA=Ur("Slot");function zA(e){const t=u.forwardRef((n,a)=>{const{children:r,...l}=n;if(u.isValidElement(r)){const i=IA(r),o=BA(l,r.props);return r.type!==u.Fragment&&(o.ref=a?Fd(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 J0=Symbol("radix.slottable");function LA(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=J0,t}function UA(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===J0}function BA(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 IA(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 HA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Me=HA.reduce((e,t)=>{const n=Ur(`Primitive.${t}`),a=u.forwardRef((r,l)=>{const{asChild:i,...o}=r,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:l})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function e_(e,t){e&&si.flushSync(()=>e.dispatchEvent(t))}function Fs(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 PA(e,t=globalThis==null?void 0:globalThis.document){const n=Fs(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 qA="DismissableLayer",Um="dismissableLayer.update",GA="dismissableLayer.pointerDownOutside",VA="dismissableLayer.focusOutside",hy,t_=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),oc=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:r,onFocusOutside:l,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(t_),[f,m]=u.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),y=Je(t,_=>m(_)),v=Array.from(d.layers),[j]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(j),p=f?v.indexOf(f):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,S=KA(_=>{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=XA(_=>{const N=_.target;[...d.branches].some(D=>D.contains(N))||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},h);return PA(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},h),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(hy=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),my(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=hy)}},[f,h,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),my())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(Um,_),()=>document.removeEventListener(Um,_)},[]),s.jsx(Me.div,{...c,ref:y,style:{pointerEvents:b?w?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,S.onPointerDownCapture)})});oc.displayName=qA;var YA="DismissableLayerBranch",FA=u.forwardRef((e,t)=>{const n=u.useContext(t_),a=u.useRef(null),r=Je(t,a);return u.useEffect(()=>{const l=a.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),s.jsx(Me.div,{...e,ref:r})});FA.displayName=YA;function KA(e,t=globalThis==null?void 0:globalThis.document){const n=Fs(e),a=u.useRef(!1),r=u.useRef(()=>{});return u.useEffect(()=>{const l=o=>{if(o.target&&!a.current){let c=function(){n_(GA,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 XA(e,t=globalThis==null?void 0:globalThis.document){const n=Fs(e),a=u.useRef(!1);return u.useEffect(()=>{const r=l=>{l.target&&!a.current&&n_(VA,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 my(){const e=new CustomEvent(Um);document.dispatchEvent(e)}function n_(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?e_(r,l):r.dispatchEvent(l)}var mh="focusScope.autoFocusOnMount",ph="focusScope.autoFocusOnUnmount",py={bubbles:!1,cancelable:!0},WA="FocusScope",Kd=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:r,onUnmountAutoFocus:l,...i}=e,[o,c]=u.useState(null),d=Fs(r),f=Fs(l),m=u.useRef(null),h=Je(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:Ta(m.current,{select:!0})},j=function(b){if(x.paused||!o)return;const w=b.relatedTarget;w!==null&&(o.contains(w)||Ta(m.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const S of b)S.removedNodes.length>0&&Ta(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",j);const p=new MutationObserver(g);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",j),p.disconnect()}}},[a,o,x.paused]),u.useEffect(()=>{if(o){gy.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(mh,py);o.addEventListener(mh,d),o.dispatchEvent(g),g.defaultPrevented||(QA(n$(s_(o)),{select:!0}),document.activeElement===v&&Ta(o))}return()=>{o.removeEventListener(mh,d),setTimeout(()=>{const g=new CustomEvent(ph,py);o.addEventListener(ph,f),o.dispatchEvent(g),g.defaultPrevented||Ta(v??document.body,{select:!0}),o.removeEventListener(ph,f),gy.remove(x)},0)}}},[o,d,f,x]);const y=u.useCallback(v=>{if(!n&&!a||x.paused)return;const j=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(j&&g){const p=v.currentTarget,[b,w]=ZA(p);b&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&Ta(b,{select:!0})):v.shiftKey&&g===b&&(v.preventDefault(),n&&Ta(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(Me.div,{tabIndex:-1,...i,ref:h,onKeyDown:y})});Kd.displayName=WA;function QA(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(Ta(a,{select:t}),document.activeElement!==n)return}function ZA(e){const t=s_(e),n=xy(t,e),a=xy(t.reverse(),e);return[n,a]}function s_(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 xy(e,t){for(const n of e)if(!JA(n,{upTo:t}))return n}function JA(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$(e){return e instanceof HTMLInputElement&&"select"in e}function Ta(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&e$(e)&&t&&e.select()}}var gy=t$();function t$(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=vy(e,t),e.unshift(t)},remove(t){var n;e=vy(e,t),(n=e[0])==null||n.resume()}}}function vy(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function n$(e){return e.filter(t=>t.tagName!=="A")}var s$="Portal",cc=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[r,l]=u.useState(!1);ln(()=>l(!0),[]);const i=n||r&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?g2.createPortal(s.jsx(Me.div,{...a,ref:t}),i):null});cc.displayName=s$;function a$(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var ys=e=>{const{present:t,children:n}=e,a=r$(t),r=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),l=Je(a.ref,l$(r));return typeof n=="function"||a.isPresent?u.cloneElement(r,{ref:l}):null};ys.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]=a$(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=Uc(a.current);l.current=o==="mounted"?d:"none"},[o]),ln(()=>{const d=a.current,f=r.current;if(f!==e){const h=l.current,x=Uc(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]),ln(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,m=x=>{const v=Uc(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!r.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},h=x=>{x.target===t&&(l.current=Uc(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 Uc(e){return(e==null?void 0:e.animationName)||"none"}function l$(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 xh=0;function gx(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yy()),document.body.insertAdjacentElement("beforeend",e[1]??yy()),xh++,()=>{xh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xh--}},[])}function yy(){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 Ls=function(){return Ls=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},Ls.apply(this,arguments)};function a_(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 i$(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 fu="right-scroll-bar-position",hu="width-before-scroll-bar",o$="with-scroll-bars-hidden",c$="--removed-body-scroll-bar-size";function gh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function u$(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 d$=typeof window<"u"?u.useLayoutEffect:u.useEffect,jy=new WeakMap;function f$(e,t){var n=u$(null,function(a){return e.forEach(function(r){return gh(r,a)})});return d$(function(){var a=jy.get(n);if(a){var r=new Set(a),l=new Set(e),i=n.current;r.forEach(function(o){l.has(o)||gh(o,null)}),l.forEach(function(o){r.has(o)||gh(o,i)})}jy.set(n,e)},[e]),n}function h$(e){return e}function m$(e,t){t===void 0&&(t=h$);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 p$(e){e===void 0&&(e={});var t=m$(null);return t.options=Ls({async:!0,ssr:!1},e),t}var r_=function(e){var t=e.sideCar,n=a_(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,Ls({},n))};r_.isSideCarExport=!0;function x$(e,t){return e.useMedium(t),r_}var l_=p$(),vh=function(){},Xd=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:vh,onWheelCapture:vh,onTouchMoveCapture:vh}),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,y=e.noIsolation,v=e.inert,j=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,b=e.gapMode,w=a_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=f$([n,t]),_=Ls(Ls({},w),r);return u.createElement(u.Fragment,null,f&&u.createElement(S,{sideCar:l_,removeScrollBar:d,shards:m,noRelative:x,noIsolation:y,inert:v,setCallbacks:l,allowPinchZoom:!!j,lockRef:n,gapMode:b}),i?u.cloneElement(u.Children.only(o),Ls(Ls({},_),{ref:C})):u.createElement(p,Ls({},_,{className:c,ref:C}),o))});Xd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xd.classNames={fullWidth:hu,zeroRight:fu};var g$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function v$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=g$();return t&&e.setAttribute("nonce",t),e}function y$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function j$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var b$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=v$())&&(y$(t,n),j$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},w$=function(){var e=b$();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},i_=function(){var e=w$(),t=function(n){var a=n.styles,r=n.dynamic;return e(a,r),null};return t},_$={left:0,top:0,right:0,gap:0},yh=function(e){return parseInt(e||"",10)||0},N$=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[yh(n),yh(a),yh(r)]},k$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return _$;var t=N$(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])}},S$=i_(),Ll="data-scroll-locked",C$=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(o$,` {
|
|
356
|
+
overflow: hidden `).concat(a,`;
|
|
357
|
+
padding-right: `).concat(o,"px ").concat(a,`;
|
|
358
|
+
}
|
|
359
|
+
body[`).concat(Ll,`] {
|
|
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(fu,` {
|
|
373
|
+
right: `).concat(o,"px ").concat(a,`;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.`).concat(hu,` {
|
|
377
|
+
margin-right: `).concat(o,"px ").concat(a,`;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.`).concat(fu," .").concat(fu,` {
|
|
381
|
+
right: 0 `).concat(a,`;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.`).concat(hu," .").concat(hu,` {
|
|
385
|
+
margin-right: 0 `).concat(a,`;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
body[`).concat(Ll,`] {
|
|
389
|
+
`).concat(c$,": ").concat(o,`px;
|
|
390
|
+
}
|
|
391
|
+
`)},by=function(){var e=parseInt(document.body.getAttribute(Ll)||"0",10);return isFinite(e)?e:0},R$=function(){u.useEffect(function(){return document.body.setAttribute(Ll,(by()+1).toString()),function(){var e=by()-1;e<=0?document.body.removeAttribute(Ll):document.body.setAttribute(Ll,e.toString())}},[])},E$=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,r=a===void 0?"margin":a;R$();var l=u.useMemo(function(){return k$(r)},[r]);return u.createElement(S$,{styles:C$(l,!t,r,n?"":"!important")})},Bm=!1;if(typeof window<"u")try{var Bc=Object.defineProperty({},"passive",{get:function(){return Bm=!0,!0}});window.addEventListener("test",Bc,Bc),window.removeEventListener("test",Bc,Bc)}catch{Bm=!1}var al=Bm?{passive:!1}:!1,T$=function(e){return e.tagName==="TEXTAREA"},o_=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!T$(e)&&n[t]==="visible")},A$=function(e){return o_(e,"overflowY")},$$=function(e){return o_(e,"overflowX")},wy=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var r=c_(e,a);if(r){var l=u_(e,a),i=l[1],o=l[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},M$=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},O$=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},c_=function(e,t){return e==="v"?A$(t):$$(t)},u_=function(e,t){return e==="v"?M$(t):O$(t)},D$=function(e,t){return e==="h"&&t==="rtl"?-1:1},z$=function(e,t,n,a,r){var l=D$(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=u_(e,o),y=x[0],v=x[1],j=x[2],g=v-j-l*y;(y||g)&&c_(e,o)&&(m+=g,h+=y);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},Ic=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_y=function(e){return[e.deltaX,e.deltaY]},Ny=function(e){return e&&"current"in e?e.current:e},L$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},U$=function(e){return`
|
|
392
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
393
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
394
|
+
`)},B$=0,rl=[];function I$(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),r=u.useState(B$++)[0],l=u.useState(i_)[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=i$([e.lockRef.current],(e.shards||[]).map(Ny),!0).filter(Boolean);return v.forEach(function(j){return j.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),v.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var o=u.useCallback(function(v,j){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var g=Ic(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=wy(_,C);if(!N)return!0;if(N?S=_:(S=_==="v"?"h":"v",N=wy(_,C)),!N)return!1;if(!a.current&&"changedTouches"in v&&(b||w)&&(a.current=S),!S)return!0;var O=a.current||S;return z$(O,j,v,O==="h"?b:w)},[]),c=u.useCallback(function(v){var j=v;if(!(!rl.length||rl[rl.length-1]!==l)){var g="deltaY"in j?_y(j):Ic(j),p=t.current.filter(function(S){return S.name===j.type&&(S.target===j.target||j.target===S.shadowParent)&&L$(S.delta,g)})[0];if(p&&p.should){j.cancelable&&j.preventDefault();return}if(!p){var b=(i.current.shards||[]).map(Ny).filter(Boolean).filter(function(S){return S.contains(j.target)}),w=b.length>0?o(j,b[0]):!i.current.noIsolation;w&&j.cancelable&&j.preventDefault()}}},[]),d=u.useCallback(function(v,j,g,p){var b={name:v,delta:j,target:g,should:p,shadowParent:H$(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=Ic(v),a.current=void 0},[]),m=u.useCallback(function(v){d(v.type,_y(v),v.target,o(v,e.lockRef.current))},[]),h=u.useCallback(function(v){d(v.type,Ic(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return rl.push(l),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",c,al),document.addEventListener("touchmove",c,al),document.addEventListener("touchstart",f,al),function(){rl=rl.filter(function(v){return v!==l}),document.removeEventListener("wheel",c,al),document.removeEventListener("touchmove",c,al),document.removeEventListener("touchstart",f,al)}},[]);var x=e.removeScrollBar,y=e.inert;return u.createElement(u.Fragment,null,y?u.createElement(l,{styles:U$(r)}):null,x?u.createElement(E$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function H$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const P$=x$(l_,I$);var Wd=u.forwardRef(function(e,t){return u.createElement(Xd,Ls({},e,{ref:t,sideCar:P$}))});Wd.classNames=Xd.classNames;var q$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ll=new WeakMap,Hc=new WeakMap,Pc={},jh=0,d_=function(e){return e&&(e.host||d_(e.parentNode))},G$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=d_(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})},V$=function(e,t,n,a){var r=G$(t,Array.isArray(e)?e:[e]);Pc[n]||(Pc[n]=new WeakMap);var l=Pc[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),y=x!==null&&x!=="false",v=(ll.get(h)||0)+1,j=(l.get(h)||0)+1;ll.set(h,v),l.set(h,j),i.push(h),v===1&&y&&Hc.set(h,!0),j===1&&h.setAttribute(n,"true"),y||h.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",h,g)}})};return f(t),o.clear(),jh++,function(){i.forEach(function(m){var h=ll.get(m)-1,x=l.get(m)-1;ll.set(m,h),l.set(m,x),h||(Hc.has(m)||m.removeAttribute(a),Hc.delete(m)),x||m.removeAttribute(n)}),jh--,jh||(ll=new WeakMap,ll=new WeakMap,Hc=new WeakMap,Pc={})}},vx=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),r=q$(e);return r?(a.push.apply(a,Array.from(r.querySelectorAll("[aria-live], script"))),V$(a,r,n,"aria-hidden")):function(){return null}},Qd="Dialog",[f_]=Zs(Qd),[Y$,$s]=f_(Qd),h_=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]=nr({prop:a,defaultProp:r??!1,onChange:l,caller:Qd});return s.jsx(Y$,{scope:t,triggerRef:o,contentRef:c,contentId:Ss(),titleId:Ss(),descriptionId:Ss(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(m=>!m),[f]),modal:i,children:n})};h_.displayName=Qd;var m_="DialogTrigger",F$=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=$s(m_,n),l=Je(t,r.triggerRef);return s.jsx(Me.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":bx(r.open),...a,ref:l,onClick:ve(e.onClick,r.onOpenToggle)})});F$.displayName=m_;var yx="DialogPortal",[K$,p_]=f_(yx,{forceMount:void 0}),x_=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:r}=e,l=$s(yx,t);return s.jsx(K$,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx(ys,{present:n||l.open,children:s.jsx(cc,{asChild:!0,container:r,children:i})}))})};x_.displayName=yx;var td="DialogOverlay",g_=u.forwardRef((e,t)=>{const n=p_(td,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=$s(td,e.__scopeDialog);return l.modal?s.jsx(ys,{present:a||l.open,children:s.jsx(W$,{...r,ref:t})}):null});g_.displayName=td;var X$=Ur("DialogOverlay.RemoveScroll"),W$=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=$s(td,n);return s.jsx(Wd,{as:X$,allowPinchZoom:!0,shards:[r.contentRef],children:s.jsx(Me.div,{"data-state":bx(r.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Br="DialogContent",v_=u.forwardRef((e,t)=>{const n=p_(Br,e.__scopeDialog),{forceMount:a=n.forceMount,...r}=e,l=$s(Br,e.__scopeDialog);return s.jsx(ys,{present:a||l.open,children:l.modal?s.jsx(Q$,{...r,ref:t}):s.jsx(Z$,{...r,ref:t})})});v_.displayName=Br;var Q$=u.forwardRef((e,t)=>{const n=$s(Br,e.__scopeDialog),a=u.useRef(null),r=Je(t,n.contentRef,a);return u.useEffect(()=>{const l=a.current;if(l)return vx(l)},[]),s.jsx(y_,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&l.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,l=>l.preventDefault())})}),Z$=u.forwardRef((e,t)=>{const n=$s(Br,e.__scopeDialog),a=u.useRef(!1),r=u.useRef(!1);return s.jsx(y_,{...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()}})}),y_=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:r,onCloseAutoFocus:l,...i}=e,o=$s(Br,n),c=u.useRef(null),d=Je(t,c);return gx(),s.jsxs(s.Fragment,{children:[s.jsx(Kd,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:r,onUnmountAutoFocus:l,children:s.jsx(oc,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":bx(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(J$,{titleId:o.titleId}),s.jsx(tM,{contentRef:c,descriptionId:o.descriptionId})]})]})}),jx="DialogTitle",j_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=$s(jx,n);return s.jsx(Me.h2,{id:r.titleId,...a,ref:t})});j_.displayName=jx;var b_="DialogDescription",w_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=$s(b_,n);return s.jsx(Me.p,{id:r.descriptionId,...a,ref:t})});w_.displayName=b_;var __="DialogClose",N_=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,r=$s(__,n);return s.jsx(Me.button,{type:"button",...a,ref:t,onClick:ve(e.onClick,()=>r.onOpenChange(!1))})});N_.displayName=__;function bx(e){return e?"open":"closed"}var k_="DialogTitleWarning",[rB,S_]=RA(k_,{contentName:Br,titleName:jx,docsSlug:"dialog"}),J$=({titleId:e})=>{const t=S_(k_),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},eM="DialogDescriptionWarning",tM=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S_(eM).contentName}}.`;return u.useEffect(()=>{var l;const r=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},C_=h_,R_=x_,E_=g_,T_=v_,A_=j_,$_=w_,wx=N_;function hn({className:e,...t}){return s.jsx(JE,{role:"status","aria-label":"Loading",className:oe("size-4 animate-spin",e),...t})}const fo="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",nM="border border-primary bg-accent text-accent-foreground hover:bg-accent",Zd=ic("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"}}),V=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:r=!1,loading:l,children:i,...o},c)=>{const d=r?DA:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",m=s.jsx(hn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:oe(!f&&"mr-2")}),h=r?i:l&&f?m:s.jsxs(s.Fragment,{children:[l?m:null,i]});return s.jsx(d,{className:oe(Zd({variant:n,size:a,className:e})),ref:c,disabled:t||l,...o,children:h})});V.displayName="Button";const M_=u.createContext(null);function sM({container:e,children:t}){return s.jsx(M_.Provider,{value:e,children:t})}function uc(){return u.useContext(M_)??void 0}function _x(e){return s.jsx(C_,{"data-slot":"alert-dialog",...e})}function aM({className:e,...t}){return s.jsx(E_,{"data-slot":"alert-dialog-overlay",className:oe("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 Nx({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...r}){return s.jsxs(R_,{container:uc(),children:[s.jsx(aM,{}),s.jsx(T_,{"data-slot":"alert-dialog-content",role:"alertdialog",className:oe("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 kx({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:oe("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Sx({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Cx({className:e,...t}){return s.jsx(A_,{"data-slot":"alert-dialog-title",className:oe("text-lg font-semibold",e),...t})}function Rx({className:e,...t}){return s.jsx($_,{"data-slot":"alert-dialog-description",className:oe("text-muted-foreground text-sm",e),...t})}function O_({className:e,variant:t,...n}){return s.jsx(wx,{"data-slot":"alert-dialog-action",className:oe(Zd({variant:t}),e),...n})}function Ex({className:e,...t}){return s.jsx(wx,{"data-slot":"alert-dialog-cancel",className:oe(Zd({variant:"outline"}),e),...t})}function rM(){if(typeof document>"u")return null;const e=document.activeElement;if(!(e instanceof HTMLElement)||e===document.body)return null;const t=e.closest('[role="menu"]');if(t!=null&&t.id){const n=document.querySelector(`[aria-controls="${CSS.escape(t.id)}"]`);if(n)return n}return e}function lM(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function fi(){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(_x,{open:e!==null,onOpenChange:o=>{o||r(!1)},children:s.jsxs(Nx,{onCloseAutoFocus:o=>lM(o,a.current),children:[s.jsxs(kx,{children:[s.jsx(Cx,{children:e==null?void 0:e.title}),s.jsx(Rx,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(Sx,{children:[s.jsx(Ex,{children:"Cancel"}),s.jsx(O_,{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 la="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",iM=ic("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${la} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${la} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${la} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${la} text-foreground`,success:`${la} border-success/40 bg-success/10 text-success`,warning:`${la} border-warning/40 bg-warning/10 text-warning`,info:`${la} border-info/40 bg-info/10 text-info`,error:`${la} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${la} 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 ue({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:oe(iM({variant:t,size:n}),e),...a})}function D_(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 z_(e){const[t,n]=u.useState(void 0);return ln(()=>{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 Jd="Checkbox",[oM]=Zs(Jd),[cM,Tx]=oM(Jd);function uM(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:r,disabled:l,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:m}=e,[h,x]=nr({prop:n,defaultProp:r??!1,onChange:c,caller:Jd}),[y,v]=u.useState(null),[j,g]=u.useState(null),p=u.useRef(!1),b=y?!!i||!!y.closest("form"):!0,w={checked:h,disabled:l,setChecked:x,control:y,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Qa(r)?!1:r,isFormControl:b,bubbleInput:j,setBubbleInput:g};return s.jsx(cM,{scope:t,...w,children:dM(m)?m(w):a})}var L_="CheckboxTrigger",U_=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:y}=Tx(L_,e),v=Je(r,f),j=u.useRef(c);return u.useEffect(()=>{const g=l==null?void 0:l.form;if(g){const p=()=>m(j.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[l,m]),s.jsx(Me.button,{type:"button",role:"checkbox","aria-checked":Qa(c)?"mixed":c,"aria-required":d,"data-state":q_(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:ve(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ve(n,g=>{m(p=>Qa(p)?!0:!p),y&&x&&(h.current=g.isPropagationStopped(),h.current||g.stopPropagation())})})});U_.displayName=L_;var Ax=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(uM,{__scopeCheckbox:n,checked:r,defaultChecked:l,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:h})=>s.jsxs(s.Fragment,{children:[s.jsx(U_,{...m,ref:t,__scopeCheckbox:n}),h&&s.jsx(P_,{__scopeCheckbox:n})]})})});Ax.displayName=Jd;var B_="CheckboxIndicator",I_=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...r}=e,l=Tx(B_,n);return s.jsx(ys,{present:a||Qa(l.checked)||l.checked===!0,children:s.jsx(Me.span,{"data-state":q_(l.checked),"data-disabled":l.disabled?"":void 0,...r,ref:t,style:{pointerEvents:"none",...e.style}})})});I_.displayName=B_;var H_="CheckboxBubbleInput",P_=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}=Tx(H_,e),y=Je(n,x),v=D_(l),j=z_(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=Qa(l),S.call(p,Qa(l)?!1:l),p.dispatchEvent(_)}},[h,v,l,r]);const g=u.useRef(Qa(l)?!1:l);return s.jsx(Me.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:m,...t,tabIndex:-1,ref:y,style:{...t.style,...j,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});P_.displayName=H_;function dM(e){return typeof e=="function"}function Qa(e){return e==="indeterminate"}function q_(e){return Qa(e)?"indeterminate":e?"checked":"unchecked"}const hi=u.forwardRef(({className:e,...t},n)=>s.jsx(Ax,{ref:n,className:oe("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(I_,{className:oe("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(aT,{className:"size-4","aria-hidden":"true"}):s.jsx(Kr,{className:"size-4","aria-hidden":"true"})})}));hi.displayName=Ax.displayName;const fM=ic("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 Tn({...e}){return s.jsx(C_,{"data-slot":"dialog",...e})}function hM({...e}){const t=uc();return s.jsx(R_,{"data-slot":"dialog-portal",container:t,...e})}function mM({className:e,...t}){return s.jsx(E_,{"data-slot":"dialog-overlay",className:oe("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 An({className:e,children:t,showCloseButton:n=!0,size:a,...r}){return s.jsxs(hM,{"data-slot":"dialog-portal",children:[s.jsx(mM,{}),s.jsxs(T_,{"data-slot":"dialog-content",className:oe(fM({size:a}),e),...r,children:[t,n&&s.jsxs(wx,{"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(Vd,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function $n({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:oe("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Mn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function On({className:e,...t}){return s.jsx(A_,{"data-slot":"dialog-title",className:oe("text-lg leading-none font-semibold",e),...t})}function Dn({className:e,...t}){return s.jsx($_,{"data-slot":"dialog-description",className:oe("text-muted-foreground text-sm",e),...t})}function $x(e){const t=e+"CollectionProvider",[n,a]=Zs(t),[r,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:j,children:g}=v,p=Ra.useRef(null),b=Ra.useRef(new Map).current;return s.jsx(r,{scope:j,itemMap:b,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=Ur(o),d=Ra.forwardRef((v,j)=>{const{scope:g,children:p}=v,b=l(o,g),w=Je(j,b.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",m="data-radix-collection-item",h=Ur(f),x=Ra.forwardRef((v,j)=>{const{scope:g,children:p,...b}=v,w=Ra.useRef(null),S=Je(j,w),C=l(f,g);return Ra.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 y(v){const j=l(e+"CollectionConsumer",v);return Ra.useCallback(()=>{const p=j.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${m}]`));return Array.from(j.itemMap.values()).sort((C,_)=>b.indexOf(C.ref.current)-b.indexOf(_.ref.current))},[j.collectionRef,j.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},y,a]}var pM=u.createContext(void 0);function ef(e){const t=u.useContext(pM);return e||t||"ltr"}const xM=["top","right","bottom","left"],sr=Math.min,Vn=Math.max,nd=Math.round,qc=Math.floor,Vs=e=>({x:e,y:e}),gM={left:"right",right:"left",bottom:"top",top:"bottom"},vM={start:"end",end:"start"};function Im(e,t,n){return Vn(e,sr(t,n))}function ja(e,t){return typeof e=="function"?e(t):e}function ba(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function Mx(e){return e==="x"?"y":"x"}function Ox(e){return e==="y"?"height":"width"}function Is(e){return["top","bottom"].includes(ba(e))?"y":"x"}function Dx(e){return Mx(Is(e))}function yM(e,t,n){n===void 0&&(n=!1);const a=mi(e),r=Dx(e),l=Ox(r);let i=r==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(i=sd(i)),[i,sd(i)]}function jM(e){const t=sd(e);return[Hm(e),t,Hm(t)]}function Hm(e){return e.replace(/start|end/g,t=>vM[t])}function bM(e,t,n){const a=["left","right"],r=["right","left"],l=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:a:t?a:r;case"left":case"right":return t?l:i;default:return[]}}function wM(e,t,n,a){const r=mi(e);let l=bM(ba(e),n==="start",a);return r&&(l=l.map(i=>i+"-"+r),t&&(l=l.concat(l.map(Hm)))),l}function sd(e){return e.replace(/left|right|bottom|top/g,t=>gM[t])}function _M(e){return{top:0,right:0,bottom:0,left:0,...e}}function G_(e){return typeof e!="number"?_M(e):{top:e,right:e,bottom:e,left:e}}function ad(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 ky(e,t,n){let{reference:a,floating:r}=e;const l=Is(t),i=Dx(t),o=Ox(i),c=ba(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(mi(t)){case"start":x[i]-=h*(n&&d?-1:1);break;case"end":x[i]+=h*(n&&d?-1:1);break}return x}const NM=async(e,t,n)=>{const{placement:a="bottom",strategy:r="absolute",middleware:l=[],platform:i}=n,o=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:f,y:m}=ky(d,a,c),h=a,x={},y=0;for(let v=0;v<o.length;v++){const{name:j,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,[j]:{...x[j],...w}},S&&y<=50&&(y++,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}=ky(d,h,c)),v=-1)}return{x:f,y:m,placement:h,strategy:r,middlewareData:x}};async function To(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}=ja(t,e),y=G_(x),j=o[h?m==="floating"?"reference":"floating":m],g=ad(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(j)))==null||n?j:j.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=ad(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:b,strategy:c}):p);return{top:(g.top-S.top+y.top)/w.y,bottom:(S.bottom-g.bottom+y.bottom)/w.y,left:(g.left-S.left+y.left)/w.x,right:(S.right-g.right+y.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}=ja(e,t)||{};if(d==null)return{};const m=G_(f),h={x:n,y:a},x=Dx(r),y=Ox(x),v=await i.getDimensions(d),j=x==="y",g=j?"top":"left",p=j?"bottom":"right",b=j?"clientHeight":"clientWidth",w=l.reference[y]+l.reference[x]-h[x]-l.floating[y],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[y]);const N=w/2-S/2,O=_/2-v[y]/2-1,D=sr(m[g],O),B=sr(m[p],O),P=D,I=_-v[y]-B,A=_/2-v[y]/2+N,$=Im(P,A,I),R=!c.arrow&&mi(r)!=null&&A!==$&&l.reference[y]/2-(A<P?D:B)-v[y]/2<0,E=R?A<P?A-P:A-I:0;return{[x]:h[x]+E,data:{[x]:$,centerOffset:A-$-E,...R&&{alignmentOffset:E}},reset:R}}}),SM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:r,middlewareData:l,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...j}=ja(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const g=ba(r),p=Is(o),b=ba(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=h||(b||!v?[sd(o)]:jM(o)),C=y!=="none";!h&&C&&S.push(...wM(o,v,y,w));const _=[o,...S],N=await To(t,j),O=[];let D=((a=l.flip)==null?void 0:a.overflows)||[];if(f&&O.push(N[g]),m){const A=yM(r,i,w);O.push(N[A[0]],N[A[1]])}if(D=[...D,{placement:r,overflows:O}],!O.every(A=>A<=0)){var B,P;const A=(((B=l.flip)==null?void 0:B.index)||0)+1,$=_[A];if($&&(!(m==="alignment"?p!==Is($):!1)||D.every(k=>k.overflows[0]>0&&Is(k.placement)===p)))return{data:{index:A,overflows:D},reset:{placement:$}};let R=(P=D.filter(E=>E.overflows[0]<=0).sort((E,k)=>E.overflows[1]-k.overflows[1])[0])==null?void 0:P.placement;if(!R)switch(x){case"bestFit":{var I;const E=(I=D.filter(k=>{if(C){const M=Is(k.placement);return M===p||M==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(M=>M>0).reduce((M,F)=>M+F,0)]).sort((k,M)=>k[1]-M[1])[0])==null?void 0:I[0];E&&(R=E);break}case"initialPlacement":R=o;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function Sy(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cy(e){return xM.some(t=>e[t]>=0)}const CM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...r}=ja(e,t);switch(a){case"referenceHidden":{const l=await To(t,{...r,elementContext:"reference"}),i=Sy(l,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Cy(i)}}}case"escaped":{const l=await To(t,{...r,altBoundary:!0}),i=Sy(l,n.floating);return{data:{escapedOffsets:i,escaped:Cy(i)}}}default:return{}}}}};async function RM(e,t){const{placement:n,platform:a,elements:r}=e,l=await(a.isRTL==null?void 0:a.isRTL(r.floating)),i=ba(n),o=mi(n),c=Is(n)==="y",d=["left","top"].includes(i)?-1:1,f=l&&c?-1:1,m=ja(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:y}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return o&&typeof y=="number"&&(x=o==="end"?y*-1:y),c?{x:x*f,y:h*d}:{x:h*d,y:x*f}}const EM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:r,y:l,placement:i,middlewareData:o}=t,c=await RM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:r+c.x,y:l+c.y,data:{...c,placement:i}}}}},TM=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:j=>{let{x:g,y:p}=j;return{x:g,y:p}}},...c}=ja(e,t),d={x:n,y:a},f=await To(t,c),m=Is(ba(r)),h=Mx(m);let x=d[h],y=d[m];if(l){const j=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=x+f[j],b=x-f[g];x=Im(p,x,b)}if(i){const j=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=y+f[j],b=y-f[g];y=Im(p,y,b)}const v=o.fn({...t,[h]:x,[m]:y});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[h]:l,[m]:i}}}}}},AM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:r,rects:l,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=ja(e,t),f={x:n,y:a},m=Is(r),h=Mx(m);let x=f[h],y=f[m];const v=ja(o,t),j=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]+j.mainAxis,S=l.reference[h]+l.reference[b]-j.mainAxis;x<w?x=w:x>S&&(x=S)}if(d){var g,p;const b=h==="y"?"width":"height",w=["top","left"].includes(ba(r)),S=l.reference[m]-l.floating[b]+(w&&((g=i.offset)==null?void 0:g[m])||0)+(w?0:j.crossAxis),C=l.reference[m]+l.reference[b]+(w?0:((p=i.offset)==null?void 0:p[m])||0)-(w?j.crossAxis:0);y<S?y=S:y>C&&(y=C)}return{[h]:x,[m]:y}}}},$M=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}=ja(e,t),f=await To(t,d),m=ba(r),h=mi(r),x=Is(r)==="y",{width:y,height:v}=l.floating;let j,g;m==="top"||m==="bottom"?(j=m,g=h===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=m,j=h==="end"?"top":"bottom");const p=v-f.top-f.bottom,b=y-f.left-f.right,w=sr(v-f[j],p),S=sr(y-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=Vn(f.left,0),B=Vn(f.right,0),P=Vn(f.top,0),I=Vn(f.bottom,0);x?N=y-2*(D!==0||B!==0?D+B:Vn(f.left,f.right)):_=v-2*(P!==0||I!==0?P+I:Vn(f.top,f.bottom))}await c({...t,availableWidth:N,availableHeight:_});const O=await i.getDimensions(o.floating);return y!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function tf(){return typeof window<"u"}function pi(e){return V_(e)?(e.nodeName||"").toLowerCase():"#document"}function Qn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Js(e){var t;return(t=(V_(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function V_(e){return tf()?e instanceof Node||e instanceof Qn(e).Node:!1}function Rs(e){return tf()?e instanceof Element||e instanceof Qn(e).Element:!1}function Ks(e){return tf()?e instanceof HTMLElement||e instanceof Qn(e).HTMLElement:!1}function Ry(e){return!tf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qn(e).ShadowRoot}function dc(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 MM(e){return["table","td","th"].includes(pi(e))}function nf(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function zx(e){const t=Lx(),n=Rs(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 OM(e){let t=ar(e);for(;Ks(t)&&!Jl(t);){if(zx(t))return t;if(nf(t))return null;t=ar(t)}return null}function Lx(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Jl(e){return["html","body","#document"].includes(pi(e))}function Es(e){return Qn(e).getComputedStyle(e)}function sf(e){return Rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ar(e){if(pi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ry(e)&&e.host||Js(e);return Ry(t)?t.host:t}function Y_(e){const t=ar(e);return Jl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&dc(t)?t:Y_(t)}function Ao(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Y_(e),l=r===((a=e.ownerDocument)==null?void 0:a.body),i=Qn(r);if(l){const o=Pm(i);return t.concat(i,i.visualViewport||[],dc(r)?r:[],o&&n?Ao(o):[])}return t.concat(r,Ao(r,[],n))}function Pm(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function F_(e){const t=Es(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const r=Ks(e),l=r?e.offsetWidth:n,i=r?e.offsetHeight:a,o=nd(n)!==l||nd(a)!==i;return o&&(n=l,a=i),{width:n,height:a,$:o}}function Ux(e){return Rs(e)?e:e.contextElement}function Ul(e){const t=Ux(e);if(!Ks(t))return Vs(1);const n=t.getBoundingClientRect(),{width:a,height:r,$:l}=F_(t);let i=(l?nd(n.width):n.width)/a,o=(l?nd(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const DM=Vs(0);function K_(e){const t=Qn(e);return!Lx()||!t.visualViewport?DM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Qn(e)?!1:t}function Ir(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),l=Ux(e);let i=Vs(1);t&&(a?Rs(a)&&(i=Ul(a)):i=Ul(e));const o=zM(l,n,a)?K_(l):Vs(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=Qn(l),x=a&&Rs(a)?Qn(a):a;let y=h,v=Pm(y);for(;v&&a&&x!==y;){const j=Ul(v),g=v.getBoundingClientRect(),p=Es(v),b=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*j.x,w=g.top+(v.clientTop+parseFloat(p.paddingTop))*j.y;c*=j.x,d*=j.y,f*=j.x,m*=j.y,c+=b,d+=w,y=Qn(v),v=Pm(y)}}return ad({width:f,height:m,x:c,y:d})}function Bx(e,t){const n=sf(e).scrollLeft;return t?t.left+n:Ir(Js(e)).left+n}function X_(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),r=a.left+t.scrollLeft-(n?0:Bx(e,a)),l=a.top+t.scrollTop;return{x:r,y:l}}function LM(e){let{elements:t,rect:n,offsetParent:a,strategy:r}=e;const l=r==="fixed",i=Js(a),o=t?nf(t.floating):!1;if(a===i||o&&l)return n;let c={scrollLeft:0,scrollTop:0},d=Vs(1);const f=Vs(0),m=Ks(a);if((m||!m&&!l)&&((pi(a)!=="body"||dc(i))&&(c=sf(a)),Ks(a))){const x=Ir(a);d=Ul(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const h=i&&!m&&!l?X_(i,c,!0):Vs(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 UM(e){return Array.from(e.getClientRects())}function BM(e){const t=Js(e),n=sf(e),a=e.ownerDocument.body,r=Vn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),l=Vn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+Bx(e);const o=-n.scrollTop;return Es(a).direction==="rtl"&&(i+=Vn(t.clientWidth,a.clientWidth)-r),{width:r,height:l,x:i,y:o}}function IM(e,t){const n=Qn(e),a=Js(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=Lx();(!d||d&&t==="fixed")&&(o=r.offsetLeft,c=r.offsetTop)}return{width:l,height:i,x:o,y:c}}function HM(e,t){const n=Ir(e,!0,t==="fixed"),a=n.top+e.clientTop,r=n.left+e.clientLeft,l=Ks(e)?Ul(e):Vs(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 Ey(e,t,n){let a;if(t==="viewport")a=IM(e,n);else if(t==="document")a=BM(Js(e));else if(Rs(t))a=HM(t,n);else{const r=K_(e);a={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ad(a)}function W_(e,t){const n=ar(e);return n===t||!Rs(n)||Jl(n)?!1:Es(n).position==="fixed"||W_(n,t)}function PM(e,t){const n=t.get(e);if(n)return n;let a=Ao(e,[],!1).filter(o=>Rs(o)&&pi(o)!=="body"),r=null;const l=Es(e).position==="fixed";let i=l?ar(e):e;for(;Rs(i)&&!Jl(i);){const o=Es(i),c=zx(i);!c&&o.position==="fixed"&&(r=null),(l?!c&&!r:!c&&o.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||dc(i)&&!c&&W_(e,i))?a=a.filter(f=>f!==i):r=o,i=ar(i)}return t.set(e,a),a}function qM(e){let{element:t,boundary:n,rootBoundary:a,strategy:r}=e;const i=[...n==="clippingAncestors"?nf(t)?[]:PM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const m=Ey(t,f,r);return d.top=Vn(m.top,d.top),d.right=sr(m.right,d.right),d.bottom=sr(m.bottom,d.bottom),d.left=Vn(m.left,d.left),d},Ey(t,o,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function GM(e){const{width:t,height:n}=F_(e);return{width:t,height:n}}function VM(e,t,n){const a=Ks(t),r=Js(t),l=n==="fixed",i=Ir(e,!0,l,t);let o={scrollLeft:0,scrollTop:0};const c=Vs(0);function d(){c.x=Bx(r)}if(a||!a&&!l)if((pi(t)!=="body"||dc(r))&&(o=sf(t)),a){const x=Ir(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?X_(r,o):Vs(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 bh(e){return Es(e).position==="static"}function Ty(e,t){if(!Ks(e)||Es(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Js(e)===n&&(n=n.ownerDocument.body),n}function Q_(e,t){const n=Qn(e);if(nf(e))return n;if(!Ks(e)){let r=ar(e);for(;r&&!Jl(r);){if(Rs(r)&&!bh(r))return r;r=ar(r)}return n}let a=Ty(e,t);for(;a&&MM(a)&&bh(a);)a=Ty(a,t);return a&&Jl(a)&&bh(a)&&!zx(a)?n:a||OM(e)||n}const YM=async function(e){const t=this.getOffsetParent||Q_,n=this.getDimensions,a=await n(e.floating);return{reference:VM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function FM(e){return Es(e).direction==="rtl"}const KM={convertOffsetParentRelativeRectToViewportRelativeRect:LM,getDocumentElement:Js,getClippingRect:qM,getOffsetParent:Q_,getElementRects:YM,getClientRects:UM,getDimensions:GM,getScale:Ul,isElement:Rs,isRTL:FM};function Z_(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function XM(e,t){let n=null,a;const r=Js(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 y=qc(m),v=qc(r.clientWidth-(f+h)),j=qc(r.clientHeight-(m+x)),g=qc(f),b={rootMargin:-y+"px "+-v+"px "+-j+"px "+-g+"px",threshold:Vn(0,sr(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&&!Z_(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 WM(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=Ux(e),f=r||l?[...d?Ao(d):[],...Ao(t)]:[];f.forEach(g=>{r&&g.addEventListener("scroll",n,{passive:!0}),l&&g.addEventListener("resize",n)});const m=d&&o?XM(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 y,v=c?Ir(e):null;c&&j();function j(){const g=Ir(e);v&&!Z_(v,g)&&n(),v=g,y=requestAnimationFrame(j)}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(y)}}const QM=EM,ZM=TM,JM=SM,eO=$M,tO=CM,Ay=kM,nO=AM,sO=(e,t,n)=>{const a=new Map,r={platform:KM,...n},l={...r.platform,_c:a};return NM(e,t,{...r,platform:l})};var aO=typeof document<"u",rO=function(){},mu=aO?u.useLayoutEffect:rO;function rd(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(!rd(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)&&!rd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function J_(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $y(e,t){const n=J_(e);return Math.round(t*n)/n}function wh(e){const t=u.useRef(e);return mu(()=>{t.current=e}),t}function lO(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);rd(h,a)||x(a);const[y,v]=u.useState(null),[j,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||y,S=i||j,C=u.useRef(null),_=u.useRef(null),N=u.useRef(f),O=c!=null,D=wh(c),B=wh(r),P=wh(d),I=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 F={...M,isPositioned:P.current!==!1};A.current&&!rd(N.current,F)&&(N.current=F,si.flushSync(()=>{m(F)}))})},[h,t,n,B,P]);mu(()=>{d===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,m(k=>({...k,isPositioned:!1})))},[d]);const A=u.useRef(!1);mu(()=>(A.current=!0,()=>{A.current=!1}),[]),mu(()=>{if(w&&(C.current=w),S&&(_.current=S),w&&S){if(D.current)return D.current(w,S,I);I()}},[w,S,I,D,O]);const $=u.useMemo(()=>({reference:C,floating:_,setReference:p,setFloating:b}),[p,b]),R=u.useMemo(()=>({reference:w,floating:S}),[w,S]),E=u.useMemo(()=>{const k={position:n,left:0,top:0};if(!R.floating)return k;const M=$y(R.floating,f.x),F=$y(R.floating,f.y);return o?{...k,transform:"translate("+M+"px, "+F+"px)",...J_(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:F}},[n,o,R.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:I,refs:$,elements:R,floatingStyles:E}),[f,I,$,R,E])}const iO=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?Ay({element:a.current,padding:r}).fn(n):{}:a?Ay({element:a,padding:r}).fn(n):{}}}},oO=(e,t)=>({...QM(e),options:[e,t]}),cO=(e,t)=>({...ZM(e),options:[e,t]}),uO=(e,t)=>({...nO(e),options:[e,t]}),dO=(e,t)=>({...JM(e),options:[e,t]}),fO=(e,t)=>({...eO(e),options:[e,t]}),hO=(e,t)=>({...tO(e),options:[e,t]}),mO=(e,t)=>({...iO(e),options:[e,t]});var pO="Arrow",eN=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:r=5,...l}=e;return s.jsx(Me.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"})})});eN.displayName=pO;var xO=eN,Ix="Popper",[tN,xi]=Zs(Ix),[gO,nN]=tN(Ix),sN=e=>{const{__scopePopper:t,children:n}=e,[a,r]=u.useState(null);return s.jsx(gO,{scope:t,anchor:a,onAnchorChange:r,children:n})};sN.displayName=Ix;var aN="PopperAnchor",rN=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...r}=e,l=nN(aN,n),i=u.useRef(null),o=Je(t,i);return u.useEffect(()=>{l.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(Me.div,{...r,ref:o})});rN.displayName=aN;var Hx="PopperContent",[vO,yO]=tN(Hx),lN=u.forwardRef((e,t)=>{var W,te,Se,le,je,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:y,...v}=e,j=nN(Hx,n),[g,p]=u.useState(null),b=Je(t,$e=>p($e)),[w,S]=u.useState(null),C=z_(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],P=B.length>0,I={padding:D,boundary:B.filter(bO),altBoundary:P},{refs:A,floatingStyles:$,placement:R,isPositioned:E,middlewareData:k}=lO({strategy:"fixed",placement:O,whileElementsMounted:(...$e)=>WM(...$e,{animationFrame:x==="always"}),elements:{reference:j.anchor},middleware:[oO({mainAxis:r+N,alignmentAxis:i}),c&&cO({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uO():void 0,...I}),c&&dO({...I}),fO({...I,apply:({elements:$e,rects:xe,availableWidth:Ce,availableHeight:J})=>{const{width:G,height:ne}=xe.reference,se=$e.floating.style;se.setProperty("--radix-popper-available-width",`${Ce}px`),se.setProperty("--radix-popper-available-height",`${J}px`),se.setProperty("--radix-popper-anchor-width",`${G}px`),se.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),w&&mO({element:w,padding:o}),wO({arrowWidth:_,arrowHeight:N}),h&&hO({strategy:"referenceHidden",...I})]}),[M,F]=cN(R),T=Fs(y);ln(()=>{E&&(T==null||T())},[E,T]);const H=(W=k.arrow)==null?void 0:W.x,X=(te=k.arrow)==null?void 0:te.y,Z=((Se=k.arrow)==null?void 0:Se.centerOffset)!==0,[ae,we]=u.useState();return ln(()=>{g&&we(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:E?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(le=k.transformOrigin)==null?void 0:le.x,(je=k.transformOrigin)==null?void 0:je.y].join(" "),...((me=k.hide)==null?void 0:me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(vO,{scope:n,placedSide:M,onArrowChange:S,arrowX:H,arrowY:X,shouldHideArrow:Z,children:s.jsx(Me.div,{"data-side":M,"data-align":F,...v,ref:b,style:{...v.style,animation:E?void 0:"none"}})})})});lN.displayName=Hx;var iN="PopperArrow",jO={top:"bottom",right:"left",bottom:"top",left:"right"},oN=u.forwardRef(function(t,n){const{__scopePopper:a,...r}=t,l=yO(iN,a),i=jO[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(xO,{...r,ref:n,style:{...r.style,display:"block"}})})});oN.displayName=iN;function bO(e){return e!==null}var wO=e=>({name:"transformOrigin",options:e,fn(t){var j,g,p;const{placement:n,rects:a,middlewareData:r}=t,i=((j=r.arrow)==null?void 0:j.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=cN(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 y="",v="";return d==="bottom"?(y=i?m:`${h}px`,v=`${-c}px`):d==="top"?(y=i?m:`${h}px`,v=`${a.floating.height+c}px`):d==="right"?(y=`${-c}px`,v=i?m:`${x}px`):d==="left"&&(y=`${a.floating.width+c}px`,v=i?m:`${x}px`),{data:{x:y,y:v}}}});function cN(e){const[t,n="center"]=e.split("-");return[t,n]}var Px=sN,qx=rN,Gx=lN,Vx=oN,_h="rovingFocusGroup.onEntryFocus",_O={bubbles:!1,cancelable:!0},fc="RovingFocusGroup",[qm,uN,NO]=$x(fc),[kO,af]=Zs(fc,[NO]),[SO,CO]=kO(fc),dN=u.forwardRef((e,t)=>s.jsx(qm.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(qm.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(RO,{...e,ref:t})})}));dN.displayName=fc;var RO=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=Je(t,h),y=ef(l),[v,j]=nr({prop:i,defaultProp:o??null,onChange:c,caller:fc}),[g,p]=u.useState(!1),b=Fs(d),w=uN(n),S=u.useRef(!1),[C,_]=u.useState(0);return u.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(_h,b),()=>N.removeEventListener(_h,b)},[b]),s.jsx(SO,{scope:n,orientation:a,dir:y,loop:r,currentTabStopId:v,onItemFocus:u.useCallback(N=>j(N),[j]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(N=>N+1),[]),onFocusableItemRemove:u.useCallback(()=>_(N=>N-1),[]),children:s.jsx(Me.div,{tabIndex:g||C===0?-1:0,"data-orientation":a,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{S.current=!0}),onFocus:ve(e.onFocus,N=>{const O=!S.current;if(N.target===N.currentTarget&&O&&!g){const D=new CustomEvent(_h,_O);if(N.currentTarget.dispatchEvent(D),!D.defaultPrevented){const B=w().filter(R=>R.focusable),P=B.find(R=>R.active),I=B.find(R=>R.id===v),$=[P,I,...B].filter(Boolean).map(R=>R.ref.current);mN($,f)}}S.current=!1}),onBlur:ve(e.onBlur,()=>p(!1))})})}),fN="RovingFocusGroupItem",hN=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:r=!1,tabStopId:l,children:i,...o}=e,c=Ss(),d=l||c,f=CO(fN,n),m=f.currentTabStopId===d,h=uN(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>y()},[a,x,y]),s.jsx(qm.ItemSlot,{scope:n,id:d,focusable:a,active:r,children:s.jsx(Me.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:ve(e.onMouseDown,j=>{a?f.onItemFocus(d):j.preventDefault()}),onFocus:ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ve(e.onKeyDown,j=>{if(j.key==="Tab"&&j.shiftKey){f.onItemShiftTab();return}if(j.target!==j.currentTarget)return;const g=AO(j,f.orientation,f.dir);if(g!==void 0){if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey)return;j.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(j.currentTarget);b=f.loop?$O(b,w+1):b.slice(w+1)}setTimeout(()=>mN(b))}}),children:typeof i=="function"?i({isCurrentTabStop:m,hasTabStop:v!=null}):i})})});hN.displayName=fN;var EO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function TO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function AO(e,t,n){const a=TO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return EO[a]}function mN(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function $O(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var pN=dN,xN=hN,Gm=["Enter"," "],MO=["ArrowDown","PageUp","Home"],gN=["ArrowUp","PageDown","End"],OO=[...MO,...gN],DO={ltr:[...Gm,"ArrowRight"],rtl:[...Gm,"ArrowLeft"]},zO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},hc="Menu",[$o,LO,UO]=$x(hc),[Qr,vN]=Zs(hc,[UO,xi,af]),rf=xi(),yN=af(),[BO,Zr]=Qr(hc),[IO,mc]=Qr(hc),jN=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:r,onOpenChange:l,modal:i=!0}=e,o=rf(t),[c,d]=u.useState(null),f=u.useRef(!1),m=Fs(l),h=ef(r);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),s.jsx(Px,{...o,children:s.jsx(BO,{scope:t,open:n,onOpenChange:m,content:c,onContentChange:d,children:s.jsx(IO,{scope:t,onClose:u.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:h,modal:i,children:a})})})};jN.displayName=hc;var HO="MenuAnchor",Yx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=rf(n);return s.jsx(qx,{...r,...a,ref:t})});Yx.displayName=HO;var Fx="MenuPortal",[PO,bN]=Qr(Fx,{forceMount:void 0}),wN=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:r}=e,l=Zr(Fx,t);return s.jsx(PO,{scope:t,forceMount:n,children:s.jsx(ys,{present:n||l.open,children:s.jsx(cc,{asChild:!0,container:r,children:a})})})};wN.displayName=Fx;var fs="MenuContent",[qO,Kx]=Qr(fs),_N=u.forwardRef((e,t)=>{const n=bN(fs,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Zr(fs,e.__scopeMenu),i=mc(fs,e.__scopeMenu);return s.jsx($o.Provider,{scope:e.__scopeMenu,children:s.jsx(ys,{present:a||l.open,children:s.jsx($o.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(GO,{...r,ref:t}):s.jsx(VO,{...r,ref:t})})})})}),GO=u.forwardRef((e,t)=>{const n=Zr(fs,e.__scopeMenu),a=u.useRef(null),r=Je(t,a);return u.useEffect(()=>{const l=a.current;if(l)return vx(l)},[]),s.jsx(Xx,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ve(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),VO=u.forwardRef((e,t)=>{const n=Zr(fs,e.__scopeMenu);return s.jsx(Xx,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),YO=Ur("MenuContent.ScrollLock"),Xx=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:y,...v}=e,j=Zr(fs,n),g=mc(fs,n),p=rf(n),b=yN(n),w=LO(n),[S,C]=u.useState(null),_=u.useRef(null),N=Je(t,_,j.onContentChange),O=u.useRef(0),D=u.useRef(""),B=u.useRef(0),P=u.useRef(null),I=u.useRef("right"),A=u.useRef(0),$=y?Wd:u.Fragment,R=y?{as:YO,allowPinchZoom:!0}:void 0,E=M=>{var W,te;const F=D.current+M,T=w().filter(Se=>!Se.disabled),H=document.activeElement,X=(W=T.find(Se=>Se.ref.current===H))==null?void 0:W.textValue,Z=T.map(Se=>Se.textValue),ae=a4(Z,F,X),we=(te=T.find(Se=>Se.textValue===ae))==null?void 0:te.ref.current;(function Se(le){D.current=le,window.clearTimeout(O.current),le!==""&&(O.current=window.setTimeout(()=>Se(""),1e3))})(F),we&&setTimeout(()=>we.focus())};u.useEffect(()=>()=>window.clearTimeout(O.current),[]),gx();const k=u.useCallback(M=>{var T,H;return I.current===((T=P.current)==null?void 0:T.side)&&l4(M,(H=P.current)==null?void 0:H.area)},[]);return s.jsx(qO,{scope:n,searchRef:D,onItemEnter:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),onItemLeave:u.useCallback(M=>{var F;k(M)||((F=_.current)==null||F.focus(),C(null))},[k]),onTriggerLeave:u.useCallback(M=>{k(M)&&M.preventDefault()},[k]),pointerGraceTimerRef:B,onPointerGraceIntentChange:u.useCallback(M=>{P.current=M},[]),children:s.jsx($,{...R,children:s.jsx(Kd,{asChild:!0,trapped:r,onMountAutoFocus:ve(l,M=>{var F;M.preventDefault(),(F=_.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(oc,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:h,onDismiss:x,children:s.jsx(pN,{asChild:!0,...b,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:ve(c,M=>{g.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(Gx,{role:"menu","aria-orientation":"vertical","data-state":BN(j.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:N,style:{outline:"none",...v.style},onKeyDown:ve(v.onKeyDown,M=>{const T=M.target.closest("[data-radix-menu-content]")===M.currentTarget,H=M.ctrlKey||M.altKey||M.metaKey,X=M.key.length===1;T&&(M.key==="Tab"&&M.preventDefault(),!H&&X&&E(M.key));const Z=_.current;if(M.target!==Z||!OO.includes(M.key))return;M.preventDefault();const we=w().filter(W=>!W.disabled).map(W=>W.ref.current);gN.includes(M.key)&&we.reverse(),n4(we)}),onBlur:ve(e.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(O.current),D.current="")}),onPointerMove:ve(e.onPointerMove,Mo(M=>{const F=M.target,T=A.current!==M.clientX;if(M.currentTarget.contains(F)&&T){const H=M.clientX>A.current?"right":"left";I.current=H,A.current=M.clientX}}))})})})})})})});_N.displayName=fs;var FO="MenuGroup",Wx=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Me.div,{role:"group",...a,ref:t})});Wx.displayName=FO;var KO="MenuLabel",NN=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Me.div,{...a,ref:t})});NN.displayName=KO;var ld="MenuItem",My="menu.itemSelect",lf=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...r}=e,l=u.useRef(null),i=mc(ld,e.__scopeMenu),o=Kx(ld,e.__scopeMenu),c=Je(t,l),d=u.useRef(!1),f=()=>{const m=l.current;if(!n&&m){const h=new CustomEvent(My,{bubbles:!0,cancelable:!0});m.addEventListener(My,x=>a==null?void 0:a(x),{once:!0}),e_(m,h),h.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(kN,{...r,ref:c,disabled:n,onClick:ve(e.onClick,f),onPointerDown:m=>{var h;(h=e.onPointerDown)==null||h.call(e,m),d.current=!0},onPointerUp:ve(e.onPointerUp,m=>{var h;d.current||(h=m.currentTarget)==null||h.click()}),onKeyDown:ve(e.onKeyDown,m=>{const h=o.searchRef.current!=="";n||h&&m.key===" "||Gm.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});lf.displayName=ld;var kN=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:r,...l}=e,i=Kx(ld,n),o=yN(n),c=u.useRef(null),d=Je(t,c),[f,m]=u.useState(!1),[h,x]=u.useState("");return u.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[l.children]),s.jsx($o.ItemSlot,{scope:n,disabled:a,textValue:r??h,children:s.jsx(xN,{asChild:!0,...o,focusable:!a,children:s.jsx(Me.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...l,ref:d,onPointerMove:ve(e.onPointerMove,Mo(y=>{a?i.onItemLeave(y):(i.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ve(e.onPointerLeave,Mo(y=>i.onItemLeave(y))),onFocus:ve(e.onFocus,()=>m(!0)),onBlur:ve(e.onBlur,()=>m(!1))})})})}),XO="MenuCheckboxItem",SN=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...r}=e;return s.jsx(AN,{scope:e.__scopeMenu,checked:n,children:s.jsx(lf,{role:"menuitemcheckbox","aria-checked":id(n)?"mixed":n,...r,ref:t,"data-state":Zx(n),onSelect:ve(r.onSelect,()=>a==null?void 0:a(id(n)?!0:!n),{checkForDefaultPrevented:!1})})})});SN.displayName=XO;var CN="MenuRadioGroup",[WO,QO]=Qr(CN,{value:void 0,onValueChange:()=>{}}),RN=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...r}=e,l=Fs(a);return s.jsx(WO,{scope:e.__scopeMenu,value:n,onValueChange:l,children:s.jsx(Wx,{...r,ref:t})})});RN.displayName=CN;var EN="MenuRadioItem",TN=u.forwardRef((e,t)=>{const{value:n,...a}=e,r=QO(EN,e.__scopeMenu),l=n===r.value;return s.jsx(AN,{scope:e.__scopeMenu,checked:l,children:s.jsx(lf,{role:"menuitemradio","aria-checked":l,...a,ref:t,"data-state":Zx(l),onSelect:ve(a.onSelect,()=>{var i;return(i=r.onValueChange)==null?void 0:i.call(r,n)},{checkForDefaultPrevented:!1})})})});TN.displayName=EN;var Qx="MenuItemIndicator",[AN,ZO]=Qr(Qx,{checked:!1}),$N=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...r}=e,l=ZO(Qx,n);return s.jsx(ys,{present:a||id(l.checked)||l.checked===!0,children:s.jsx(Me.span,{...r,ref:t,"data-state":Zx(l.checked)})})});$N.displayName=Qx;var JO="MenuSeparator",MN=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Me.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});MN.displayName=JO;var e4="MenuArrow",ON=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,r=rf(n);return s.jsx(Vx,{...r,...a,ref:t})});ON.displayName=e4;var t4="MenuSub",[lB,DN]=Qr(t4),Vi="MenuSubTrigger",zN=u.forwardRef((e,t)=>{const n=Zr(Vi,e.__scopeMenu),a=mc(Vi,e.__scopeMenu),r=DN(Vi,e.__scopeMenu),l=Kx(Vi,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(Yx,{asChild:!0,...d,children:s.jsx(kN,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":BN(n.open),...e,ref:Fd(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:ve(e.onPointerMove,Mo(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:ve(e.onPointerLeave,Mo(m=>{var x,y;f();const h=(x=n.content)==null?void 0:x.getBoundingClientRect();if(h){const v=(y=n.content)==null?void 0:y.dataset.side,j=v==="right",g=j?-5:5,p=h[j?"left":"right"],b=h[j?"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:ve(e.onKeyDown,m=>{var x;const h=l.searchRef.current!=="";e.disabled||h&&m.key===" "||DO[a.dir].includes(m.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),m.preventDefault())})})})});zN.displayName=Vi;var LN="MenuSubContent",UN=u.forwardRef((e,t)=>{const n=bN(fs,e.__scopeMenu),{forceMount:a=n.forceMount,...r}=e,l=Zr(fs,e.__scopeMenu),i=mc(fs,e.__scopeMenu),o=DN(LN,e.__scopeMenu),c=u.useRef(null),d=Je(t,c);return s.jsx($o.Provider,{scope:e.__scopeMenu,children:s.jsx(ys,{present:a||l.open,children:s.jsx($o.Slot,{scope:e.__scopeMenu,children:s.jsx(Xx,{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:ve(e.onFocusOutside,f=>{f.target!==o.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:ve(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:ve(e.onKeyDown,f=>{var x;const m=f.currentTarget.contains(f.target),h=zO[i.dir].includes(f.key);m&&h&&(l.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});UN.displayName=LN;function BN(e){return e?"open":"closed"}function id(e){return e==="indeterminate"}function Zx(e){return id(e)?"indeterminate":e?"checked":"unchecked"}function n4(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 a4(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 l4(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return r4(n,t)}function Mo(e){return t=>t.pointerType==="mouse"?e(t):void 0}var i4=jN,o4=Yx,c4=wN,u4=_N,d4=Wx,f4=NN,h4=lf,m4=SN,p4=RN,x4=TN,g4=$N,v4=MN,y4=ON,j4=zN,b4=UN,of="DropdownMenu",[w4]=Zs(of,[vN]),xn=vN(),[_4,IN]=w4(of),HN=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:r,defaultOpen:l,onOpenChange:i,modal:o=!0}=e,c=xn(t),d=u.useRef(null),[f,m]=nr({prop:r,defaultProp:l??!1,onChange:i,caller:of});return s.jsx(_4,{scope:t,triggerId:Ss(),triggerRef:d,contentId:Ss(),open:f,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(h=>!h),[m]),modal:o,children:s.jsx(i4,{...c,open:f,onOpenChange:m,dir:a,modal:o,children:n})})};HN.displayName=of;var PN="DropdownMenuTrigger",qN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...r}=e,l=IN(PN,n),i=xn(n);return s.jsx(o4,{asChild:!0,...i,children:s.jsx(Me.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:Fd(t,l.triggerRef),onPointerDown:ve(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(l.onOpenToggle(),l.open||o.preventDefault())}),onKeyDown:ve(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&l.onOpenToggle(),o.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});qN.displayName=PN;var N4="DropdownMenuPortal",GN=e=>{const{__scopeDropdownMenu:t,...n}=e,a=xn(t);return s.jsx(c4,{...a,...n})};GN.displayName=N4;var VN="DropdownMenuContent",YN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=IN(VN,n),l=xn(n),i=u.useRef(!1);return s.jsx(u4,{id:r.contentId,"aria-labelledby":r.triggerId,...l,...a,ref:t,onCloseAutoFocus:ve(e.onCloseAutoFocus,o=>{var c;i.current||(c=r.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ve(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)"}})});YN.displayName=VN;var k4="DropdownMenuGroup",S4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(d4,{...r,...a,ref:t})});S4.displayName=k4;var C4="DropdownMenuLabel",FN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(f4,{...r,...a,ref:t})});FN.displayName=C4;var R4="DropdownMenuItem",KN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(h4,{...r,...a,ref:t})});KN.displayName=R4;var E4="DropdownMenuCheckboxItem",XN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(m4,{...r,...a,ref:t})});XN.displayName=E4;var T4="DropdownMenuRadioGroup",A4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(p4,{...r,...a,ref:t})});A4.displayName=T4;var $4="DropdownMenuRadioItem",WN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(x4,{...r,...a,ref:t})});WN.displayName=$4;var M4="DropdownMenuItemIndicator",QN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(g4,{...r,...a,ref:t})});QN.displayName=M4;var O4="DropdownMenuSeparator",ZN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(v4,{...r,...a,ref:t})});ZN.displayName=O4;var D4="DropdownMenuArrow",z4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(y4,{...r,...a,ref:t})});z4.displayName=D4;var L4="DropdownMenuSubTrigger",JN=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(j4,{...r,...a,ref:t})});JN.displayName=L4;var U4="DropdownMenuSubContent",ek=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,r=xn(n);return s.jsx(b4,{...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)"}})});ek.displayName=U4;var B4=HN,I4=qN,H4=GN,tk=YN,nk=FN,sk=KN,ak=XN,rk=WN,lk=QN,ik=ZN,ok=JN,ck=ek;const cf=B4,uf=I4,P4=u.forwardRef(({className:e,inset:t,children:n,...a},r)=>s.jsxs(ok,{ref:r,className:oe("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(rc,{className:"ml-auto"})]}));P4.displayName=ok.displayName;const q4=u.forwardRef(({className:e,...t},n)=>s.jsx(ck,{ref:n,className:oe("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}));q4.displayName=ck.displayName;const pc=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(H4,{container:uc(),children:s.jsx(tk,{ref:a,sideOffset:t,className:oe("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})}));pc.displayName=tk.displayName;const ei=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(sk,{ref:a,className:oe("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}));ei.displayName=sk.displayName;const G4=u.forwardRef(({className:e,children:t,checked:n,...a},r)=>s.jsxs(ak,{ref:r,className:oe("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(lk,{children:s.jsx(Kr,{className:"h-4 w-4"})})}),t]}));G4.displayName=ak.displayName;const V4=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(rk,{ref:a,className:oe("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(lk,{children:s.jsx(bE,{className:"h-2 w-2 fill-current"})})}),t]}));V4.displayName=rk.displayName;const Y4=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(nk,{ref:a,className:oe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Y4.displayName=nk.displayName;const F4=u.forwardRef(({className:e,...t},n)=>s.jsx(ik,{ref:n,className:oe("-mx-1 my-1 h-px bg-muted",e),...t}));F4.displayName=ik.displayName;const K4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},Tt=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},r)=>s.jsx("input",{type:t,className:oe("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",K4[n],e),ref:r,...a}));Tt.displayName="Input";var X4="Label",uk=u.forwardRef((e,t)=>s.jsx(Me.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())}}));uk.displayName=X4;var dk=uk;const W4=ic("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ie=u.forwardRef(({className:e,...t},n)=>s.jsx(dk,{ref:n,className:oe(W4(),e),...t}));Ie.displayName=dk.displayName;function or({title:e,description:t,backHref:n,backLabel:a,className:r,icon:l,link:i}){const o=s.jsx(V,{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:oe("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:oe("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 nn({title:e,description:t,actions:n,className:a,children:r,...l}){return s.jsxs("header",{"data-slot":"page-header",className:oe("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 ft({as:e="div",className:t,...n}){return s.jsx(e,{className:oe("rounded-lg border",t),...n})}function Oy(e,[t,n]){return Math.min(n,Math.max(t,e))}var fk=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"}),Q4="VisuallyHidden",hk=u.forwardRef((e,t)=>s.jsx(Me.span,{...e,ref:t,style:{...fk,...e.style}}));hk.displayName=Q4;var Z4=hk,J4=[" ","Enter","ArrowUp","ArrowDown"],eD=[" ","Enter"],Hr="Select",[df,ff,tD]=$x(Hr),[gi]=Zs(Hr,[tD,xi]),hf=xi(),[nD,cr]=gi(Hr),[sD,aD]=gi(Hr),mk=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:y}=e,v=hf(t),[j,g]=u.useState(null),[p,b]=u.useState(null),[w,S]=u.useState(!1),C=ef(d),[_,N]=nr({prop:a,defaultProp:r??!1,onChange:l,caller:Hr}),[O,D]=nr({prop:i,defaultProp:o,onChange:c,caller:Hr}),B=u.useRef(null),P=j?y||!!j.closest("form"):!0,[I,A]=u.useState(new Set),$=Array.from(I).map(R=>R.props.value).join(";");return s.jsx(Px,{...v,children:s.jsxs(nD,{required:x,scope:t,trigger:j,onTriggerChange:g,valueNode:p,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:S,contentId:Ss(),value:O,onValueChange:D,open:_,onOpenChange:N,dir:C,triggerPointerDownPosRef:B,disabled:h,children:[s.jsx(df.Provider,{scope:t,children:s.jsx(sD,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(R=>{A(E=>new Set(E).add(R))},[]),onNativeOptionRemove:u.useCallback(R=>{A(E=>{const k=new Set(E);return k.delete(R),k})},[]),children:n})}),P?s.jsxs(Uk,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:m,value:O,onChange:R=>D(R.target.value),disabled:h,form:y,children:[O===void 0?s.jsx("option",{value:""}):null,Array.from(I)]},$):null]})})};mk.displayName=Hr;var pk="SelectTrigger",xk=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...r}=e,l=hf(n),i=cr(pk,n),o=i.disabled||a,c=Je(t,i.onTriggerChange),d=ff(n),f=u.useRef("touch"),[m,h,x]=Ik(v=>{const j=d().filter(b=>!b.disabled),g=j.find(b=>b.value===i.value),p=Hk(j,v,g);p!==void 0&&i.onValueChange(p.value)}),y=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(qx,{asChild:!0,...l,children:s.jsx(Me.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":Bk(i.value)?"":void 0,...r,ref:c,onClick:ve(r.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&y(v)}),onPointerDown:ve(r.onPointerDown,v=>{f.current=v.pointerType;const j=v.target;j.hasPointerCapture(v.pointerId)&&j.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(y(v),v.preventDefault())}),onKeyDown:ve(r.onKeyDown,v=>{const j=m.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(j&&v.key===" ")&&J4.includes(v.key)&&(y(),v.preventDefault())})})})});xk.displayName=pk;var gk="SelectValue",vk=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,children:l,placeholder:i="",...o}=e,c=cr(gk,n),{onValueNodeHasChildrenChange:d}=c,f=l!==void 0,m=Je(t,c.onValueNodeChange);return ln(()=>{d(f)},[d,f]),s.jsx(Me.span,{...o,ref:m,style:{pointerEvents:"none"},children:Bk(c.value)?s.jsx(s.Fragment,{children:i}):l})});vk.displayName=gk;var rD="SelectIcon",yk=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...r}=e;return s.jsx(Me.span,{"aria-hidden":!0,...r,ref:t,children:a||"▼"})});yk.displayName=rD;var lD="SelectPortal",jk=e=>s.jsx(cc,{asChild:!0,...e});jk.displayName=lD;var Pr="SelectContent",bk=u.forwardRef((e,t)=>{const n=cr(Pr,e.__scopeSelect),[a,r]=u.useState();if(ln(()=>{r(new DocumentFragment)},[]),!n.open){const l=a;return l?si.createPortal(s.jsx(wk,{scope:e.__scopeSelect,children:s.jsx(df.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),l):null}return s.jsx(_k,{...e,ref:t})});bk.displayName=Pr;var bs=10,[wk,ur]=gi(Pr),iD="SelectContentImpl",oD=Ur("SelectContent.RemoveScroll"),_k=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:y,hideWhenDetached:v,avoidCollisions:j,...g}=e,p=cr(Pr,n),[b,w]=u.useState(null),[S,C]=u.useState(null),_=Je(t,W=>w(W)),[N,O]=u.useState(null),[D,B]=u.useState(null),P=ff(n),[I,A]=u.useState(!1),$=u.useRef(!1);u.useEffect(()=>{if(b)return vx(b)},[b]),gx();const R=u.useCallback(W=>{const[te,...Se]=P().map(me=>me.ref.current),[le]=Se.slice(-1),je=document.activeElement;for(const me of W)if(me===je||(me==null||me.scrollIntoView({block:"nearest"}),me===te&&S&&(S.scrollTop=0),me===le&&S&&(S.scrollTop=S.scrollHeight),me==null||me.focus(),document.activeElement!==je))return},[P,S]),E=u.useCallback(()=>R([N,b]),[R,N,b]);u.useEffect(()=>{I&&E()},[I,E]);const{onOpenChange:k,triggerPointerDownPosRef:M}=p;u.useEffect(()=>{if(b){let W={x:0,y:0};const te=le=>{var je,me;W={x:Math.abs(Math.round(le.pageX)-(((je=M.current)==null?void 0:je.x)??0)),y:Math.abs(Math.round(le.pageY)-(((me=M.current)==null?void 0:me.y)??0))}},Se=le=>{W.x<=10&&W.y<=10?le.preventDefault():b.contains(le.target)||k(!1),document.removeEventListener("pointermove",te),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",Se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",Se,{capture:!0})}}},[b,k,M]),u.useEffect(()=>{const W=()=>k(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[k]);const[F,T]=Ik(W=>{const te=P().filter(je=>!je.disabled),Se=te.find(je=>je.ref.current===document.activeElement),le=Hk(te,W,Se);le&&setTimeout(()=>le.ref.current.focus())}),H=u.useCallback((W,te,Se)=>{const le=!$.current&&!Se;(p.value!==void 0&&p.value===te||le)&&(O(W),le&&($.current=!0))},[p.value]),X=u.useCallback(()=>b==null?void 0:b.focus(),[b]),Z=u.useCallback((W,te,Se)=>{const le=!$.current&&!Se;(p.value!==void 0&&p.value===te||le)&&B(W)},[p.value]),ae=a==="popper"?Vm:Nk,we=ae===Vm?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:y,hideWhenDetached:v,avoidCollisions:j}:{};return s.jsx(wk,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:H,selectedItem:N,onItemLeave:X,itemTextRefCallback:Z,focusSelectedItem:E,selectedItemText:D,position:a,isPositioned:I,searchRef:F,children:s.jsx(Wd,{as:oD,allowPinchZoom:!0,children:s.jsx(Kd,{asChild:!0,trapped:p.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:ve(r,W=>{var te;(te=p.trigger)==null||te.focus({preventScroll:!0}),W.preventDefault()}),children:s.jsx(oc,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ae,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:W=>W.preventDefault(),...g,...we,onPlaced:()=>A(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ve(g.onKeyDown,W=>{const te=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!te&&W.key.length===1&&T(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let le=P().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(W.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const je=W.target,me=le.indexOf(je);le=le.slice(me+1)}setTimeout(()=>R(le)),W.preventDefault()}})})})})})})});_k.displayName=iD;var cD="SelectItemAlignedPosition",Nk=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...r}=e,l=cr(Pr,n),i=ur(Pr,n),[o,c]=u.useState(null),[d,f]=u.useState(null),m=Je(t,_=>f(_)),h=ff(n),x=u.useRef(!1),y=u.useRef(!0),{viewport:v,selectedItem:j,selectedItemText:g,focusSelectedItem:p}=i,b=u.useCallback(()=>{if(l.trigger&&l.valueNode&&o&&d&&v&&j&&g){const _=l.trigger.getBoundingClientRect(),N=d.getBoundingClientRect(),O=l.valueNode.getBoundingClientRect(),D=g.getBoundingClientRect();if(l.dir!=="rtl"){const je=D.left-N.left,me=O.left-je,$e=_.left-me,xe=_.width+$e,Ce=Math.max(xe,N.width),J=window.innerWidth-bs,G=Oy(me,[bs,Math.max(bs,J-Ce)]);o.style.minWidth=xe+"px",o.style.left=G+"px"}else{const je=N.right-D.right,me=window.innerWidth-O.right-je,$e=window.innerWidth-_.right-me,xe=_.width+$e,Ce=Math.max(xe,N.width),J=window.innerWidth-bs,G=Oy(me,[bs,Math.max(bs,J-Ce)]);o.style.minWidth=xe+"px",o.style.right=G+"px"}const B=h(),P=window.innerHeight-bs*2,I=v.scrollHeight,A=window.getComputedStyle(d),$=parseInt(A.borderTopWidth,10),R=parseInt(A.paddingTop,10),E=parseInt(A.borderBottomWidth,10),k=parseInt(A.paddingBottom,10),M=$+R+I+k+E,F=Math.min(j.offsetHeight*5,M),T=window.getComputedStyle(v),H=parseInt(T.paddingTop,10),X=parseInt(T.paddingBottom,10),Z=_.top+_.height/2-bs,ae=P-Z,we=j.offsetHeight/2,W=j.offsetTop+we,te=$+R+W,Se=M-te;if(te<=Z){const je=B.length>0&&j===B[B.length-1].ref.current;o.style.bottom="0px";const me=d.clientHeight-v.offsetTop-v.offsetHeight,$e=Math.max(ae,we+(je?X:0)+me+E),xe=te+$e;o.style.height=xe+"px"}else{const je=B.length>0&&j===B[0].ref.current;o.style.top="0px";const $e=Math.max(Z,$+v.offsetTop+(je?H:0)+we)+Se;o.style.height=$e+"px",v.scrollTop=te-Z+v.offsetTop}o.style.margin=`${bs}px 0`,o.style.minHeight=F+"px",o.style.maxHeight=P+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[h,l.trigger,l.valueNode,o,d,v,j,g,l.dir,a]);ln(()=>b(),[b]);const[w,S]=u.useState();ln(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const C=u.useCallback(_=>{_&&y.current===!0&&(b(),p==null||p(),y.current=!1)},[b,p]);return s.jsx(dD,{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(Me.div,{...r,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});Nk.displayName=cD;var uD="SelectPopperPosition",Vm=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:r=bs,...l}=e,i=hf(n);return s.jsx(Gx,{...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)"}})});Vm.displayName=uD;var[dD,Jx]=gi(Pr,{}),Ym="SelectViewport",kk=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...r}=e,l=ur(Ym,n),i=Jx(Ym,n),o=Je(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(df.Slot,{scope:n,children:s.jsx(Me.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:ve(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 y=window.innerHeight-bs*2,v=parseFloat(m.style.minHeight),j=parseFloat(m.style.height),g=Math.max(v,j);if(g<y){const p=g+x,b=Math.min(y,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})})})]})});kk.displayName=Ym;var Sk="SelectGroup",[fD,hD]=gi(Sk),mD=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=Ss();return s.jsx(fD,{scope:n,id:r,children:s.jsx(Me.div,{role:"group","aria-labelledby":r,...a,ref:t})})});mD.displayName=Sk;var Ck="SelectLabel",Rk=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=hD(Ck,n);return s.jsx(Me.div,{id:r.id,...a,ref:t})});Rk.displayName=Ck;var od="SelectItem",[pD,Ek]=gi(od),Tk=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:r=!1,textValue:l,...i}=e,o=cr(od,n),c=ur(od,n),d=o.value===a,[f,m]=u.useState(l??""),[h,x]=u.useState(!1),y=Je(t,p=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,p,a,r)}),v=Ss(),j=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(pD,{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(df.ItemSlot,{scope:n,value:a,disabled:r,textValue:f,children:s.jsx(Me.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:y,onFocus:ve(i.onFocus,()=>x(!0)),onBlur:ve(i.onBlur,()=>x(!1)),onClick:ve(i.onClick,()=>{j.current!=="mouse"&&g()}),onPointerUp:ve(i.onPointerUp,()=>{j.current==="mouse"&&g()}),onPointerDown:ve(i.onPointerDown,p=>{j.current=p.pointerType}),onPointerMove:ve(i.onPointerMove,p=>{var b;j.current=p.pointerType,r?(b=c.onItemLeave)==null||b.call(c):j.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,p=>{var b;p.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ve(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(eD.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});Tk.displayName=od;var Yi="SelectItemText",Ak=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:r,...l}=e,i=cr(Yi,n),o=ur(Yi,n),c=Ek(Yi,n),d=aD(Yi,n),[f,m]=u.useState(null),h=Je(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,y=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:j}=d;return ln(()=>(v(y),()=>j(y)),[v,j,y]),s.jsxs(s.Fragment,{children:[s.jsx(Me.span,{id:c.textId,...l,ref:h}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?si.createPortal(l.children,i.valueNode):null]})});Ak.displayName=Yi;var $k="SelectItemIndicator",Mk=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return Ek($k,n).isSelected?s.jsx(Me.span,{"aria-hidden":!0,...a,ref:t}):null});Mk.displayName=$k;var Fm="SelectScrollUpButton",Ok=u.forwardRef((e,t)=>{const n=ur(Fm,e.__scopeSelect),a=Jx(Fm,e.__scopeSelect),[r,l]=u.useState(!1),i=Je(t,a.onScrollButtonChange);return ln(()=>{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(zk,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});Ok.displayName=Fm;var Km="SelectScrollDownButton",Dk=u.forwardRef((e,t)=>{const n=ur(Km,e.__scopeSelect),a=Jx(Km,e.__scopeSelect),[r,l]=u.useState(!1),i=Je(t,a.onScrollButtonChange);return ln(()=>{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(zk,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});Dk.displayName=Km;var zk=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...r}=e,l=ur("SelectScrollButton",n),i=u.useRef(null),o=ff(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),ln(()=>{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(Me.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:ve(r.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:ve(r.onPointerMove,()=>{var d;(d=l.onItemLeave)==null||d.call(l),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:ve(r.onPointerLeave,()=>{c()})})}),xD="SelectSeparator",Lk=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(Me.div,{"aria-hidden":!0,...a,ref:t})});Lk.displayName=xD;var Xm="SelectArrow",gD=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,r=hf(n),l=cr(Xm,n),i=ur(Xm,n);return l.open&&i.position==="popper"?s.jsx(Vx,{...r,...a,ref:t}):null});gD.displayName=Xm;var vD="SelectBubbleInput",Uk=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const r=u.useRef(null),l=Je(a,r),i=D_(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(Me.select,{...n,style:{...fk,...n.style},ref:l,defaultValue:t})});Uk.displayName=vD;function Bk(e){return e===""||e===void 0}function Ik(e){const t=Fs(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 Hk(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=yD(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 yD(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var jD=mk,Pk=xk,bD=vk,wD=yk,_D=jk,qk=bk,ND=kk,Gk=Rk,Vk=Tk,kD=Ak,SD=Mk,Yk=Ok,Fk=Dk,Kk=Lk;const CD={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},Nt=jD,kt=bD,yt=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},r)=>s.jsxs(Pk,{ref:r,className:oe("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",CD[n],e),...a,children:[t,s.jsx(wD,{asChild:!0,children:s.jsx(M0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));yt.displayName=Pk.displayName;const Xk=u.forwardRef(({className:e,...t},n)=>s.jsx(Yk,{ref:n,className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(xE,{className:"size-4","aria-hidden":"true"})}));Xk.displayName=Yk.displayName;const Wk=u.forwardRef(({className:e,...t},n)=>s.jsx(Fk,{ref:n,className:oe("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Hd,{className:"size-4","aria-hidden":"true"})}));Wk.displayName=Fk.displayName;const jt=u.forwardRef(({className:e,children:t,position:n="popper",...a},r)=>s.jsx(_D,{container:uc(),children:s.jsxs(qk,{ref:r,className:oe("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(Xk,{}),s.jsx(ND,{className:oe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(Wk,{})]})}));jt.displayName=qk.displayName;const RD=u.forwardRef(({className:e,...t},n)=>s.jsx(Gk,{ref:n,className:oe("px-2 py-1.5 text-sm font-semibold",e),...t}));RD.displayName=Gk.displayName;const De=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Vk,{ref:a,className:oe("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(SD,{children:s.jsx(Kr,{className:"size-4","aria-hidden":"true"})})}),s.jsx(kD,{children:t})]}));De.displayName=Vk.displayName;const ED=u.forwardRef(({className:e,...t},n)=>s.jsx(Kk,{ref:n,className:oe("-mx-1 my-1 h-px bg-muted",e),...t}));ED.displayName=Kk.displayName;function bt({className:e,...t}){return s.jsx("div",{className:oe("animate-pulse rounded-md bg-primary/10",e),...t})}const Ve=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:oe("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:oe("w-full caption-bottom text-sm",e),...l})}));Ve.displayName="Table";const et=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:oe("[&_tr]:border-b",e),...t}));et.displayName="TableHeader";const Ye=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:oe("[&_tr:last-child]:border-0",e),...t}));Ye.displayName="TableBody";const TD=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:oe("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));TD.displayName="TableFooter";const de=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:oe("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));de.displayName="TableRow";const K=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:oe("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}));K.displayName="TableHead";const Y=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:oe("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));Y.displayName="TableCell";const AD=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:oe("text-muted-foreground mt-4 text-sm",e),...t}));AD.displayName="TableCaption";var mf="Tabs",[$D]=Zs(mf,[af]),Qk=af(),[MD,eg]=$D(mf),Zk=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:r,defaultValue:l,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=ef(o),[m,h]=nr({prop:a,onChange:r,defaultProp:l??"",caller:mf});return s.jsx(MD,{scope:n,baseId:Ss(),value:m,onValueChange:h,orientation:i,dir:f,activationMode:c,children:s.jsx(Me.div,{dir:f,"data-orientation":i,...d,ref:t})})});Zk.displayName=mf;var Jk="TabsList",e1=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...r}=e,l=eg(Jk,n),i=Qk(n);return s.jsx(pN,{asChild:!0,...i,orientation:l.orientation,dir:l.dir,loop:a,children:s.jsx(Me.div,{role:"tablist","aria-orientation":l.orientation,...r,ref:t})})});e1.displayName=Jk;var t1="TabsTrigger",n1=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:r=!1,...l}=e,i=eg(t1,n),o=Qk(n),c=r1(i.baseId,a),d=l1(i.baseId,a),f=a===i.value;return s.jsx(xN,{asChild:!0,...o,focusable:!r,active:f,children:s.jsx(Me.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:ve(e.onMouseDown,m=>{!r&&m.button===0&&m.ctrlKey===!1?i.onValueChange(a):m.preventDefault()}),onKeyDown:ve(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&i.onValueChange(a)}),onFocus:ve(e.onFocus,()=>{const m=i.activationMode!=="manual";!f&&!r&&m&&i.onValueChange(a)})})})});n1.displayName=t1;var s1="TabsContent",a1=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:r,children:l,...i}=e,o=eg(s1,n),c=r1(o.baseId,a),d=l1(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(ys,{present:r||f,children:({present:h})=>s.jsx(Me.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})})});a1.displayName=s1;function r1(e,t){return`${e}-trigger-${t}`}function l1(e,t){return`${e}-content-${t}`}var OD=Zk,i1=e1,o1=n1,c1=a1;const DD=OD,u1=u.forwardRef(({className:e,...t},n)=>s.jsx(i1,{ref:n,className:oe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));u1.displayName=i1.displayName;const Wm=u.forwardRef(({className:e,...t},n)=>s.jsx(o1,{ref:n,className:oe("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}));Wm.displayName=o1.displayName;const zD=u.forwardRef(({className:e,...t},n)=>s.jsx(c1,{ref:n,className:oe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));zD.displayName=c1.displayName;const ts=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:oe("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}));ts.displayName="Textarea";var[pf]=Zs("Tooltip",[xi]),xf=xi(),d1="TooltipProvider",LD=700,Qm="tooltip.open",[UD,tg]=pf(d1),f1=e=>{const{__scopeTooltip:t,delayDuration:n=LD,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(UD,{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})};f1.displayName=d1;var Oo="Tooltip",[BD,xc]=pf(Oo),h1=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:r,onOpenChange:l,disableHoverableContent:i,delayDuration:o}=e,c=tg(Oo,e.__scopeTooltip),d=xf(t),[f,m]=u.useState(null),h=Ss(),x=u.useRef(0),y=i??c.disableHoverableContent,v=o??c.delayDuration,j=u.useRef(!1),[g,p]=nr({prop:a,defaultProp:r??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(Qm))):c.onClose(),l==null||l(_)},caller:Oo}),b=u.useMemo(()=>g?j.current?"delayed-open":"instant-open":"closed",[g]),w=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j.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(()=>{j.current=!0,p(!0),x.current=0},v)},[v,p]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(Px,{...d,children:s.jsx(BD,{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(()=>{y?S():(window.clearTimeout(x.current),x.current=0)},[S,y]),onOpen:w,onClose:S,disableHoverableContent:y,children:n})})};h1.displayName=Oo;var Zm="TooltipTrigger",m1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=xc(Zm,n),l=tg(Zm,n),i=xf(n),o=u.useRef(null),c=Je(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(qx,{asChild:!0,...i,children:s.jsx(Me.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...a,ref:c,onPointerMove:ve(e.onPointerMove,h=>{h.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(r.onTriggerEnter(),f.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{r.onTriggerLeave(),f.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{r.open&&r.onClose(),d.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:ve(e.onFocus,()=>{d.current||r.onOpen()}),onBlur:ve(e.onBlur,r.onClose),onClick:ve(e.onClick,r.onClose)})})});m1.displayName=Zm;var ng="TooltipPortal",[ID,HD]=pf(ng,{forceMount:void 0}),p1=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:r}=e,l=xc(ng,t);return s.jsx(ID,{scope:t,forceMount:n,children:s.jsx(ys,{present:n||l.open,children:s.jsx(cc,{asChild:!0,container:r,children:a})})})};p1.displayName=ng;var ti="TooltipContent",x1=u.forwardRef((e,t)=>{const n=HD(ti,e.__scopeTooltip),{forceMount:a=n.forceMount,side:r="top",...l}=e,i=xc(ti,e.__scopeTooltip);return s.jsx(ys,{present:a||i.open,children:i.disableHoverableContent?s.jsx(g1,{side:r,...l,ref:t}):s.jsx(PD,{side:r,...l,ref:t})})}),PD=u.forwardRef((e,t)=>{const n=xc(ti,e.__scopeTooltip),a=tg(ti,e.__scopeTooltip),r=u.useRef(null),l=Je(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((y,v)=>{const j=y.currentTarget,g={x:y.clientX,y:y.clientY},p=FD(g,j.getBoundingClientRect()),b=KD(g,p),w=XD(v.getBoundingClientRect()),S=QD([...b,...w]);o(S),m(!0)},[m]);return u.useEffect(()=>()=>h(),[h]),u.useEffect(()=>{if(c&&f){const y=j=>x(j,f),v=j=>x(j,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",v)}}},[c,f,x,h]),u.useEffect(()=>{if(i){const y=v=>{const j=v.target,g={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(j))||(f==null?void 0:f.contains(j)),b=!WD(g,i);p?h():b&&(h(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,i,d,h]),s.jsx(g1,{...e,ref:l})}),[qD,GD]=pf(Oo,{isInside:!1}),VD=LA("TooltipContent"),g1=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":r,onEscapeKeyDown:l,onPointerDownOutside:i,...o}=e,c=xc(ti,n),d=xf(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Qm,f),()=>document.removeEventListener(Qm,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(oc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:i,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:s.jsxs(Gx,{"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(VD,{children:a}),s.jsx(qD,{scope:n,isInside:!0,children:s.jsx(Z4,{id:c.contentId,role:"tooltip",children:r||a})})]})})});x1.displayName=ti;var v1="TooltipArrow",YD=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,r=xf(n);return GD(v1,n).isInside?null:s.jsx(Vx,{...r,...a,ref:t})});YD.displayName=v1;function FD(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 KD(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 XD(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 WD(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 QD(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),ZD(t)}function ZD(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 JD=f1,ez=h1,tz=m1,nz=p1,y1=x1;const sg=JD,ag=ez,rg=tz,gf=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const r=uc(),l=s.jsx(y1,{ref:a,sideOffset:t,className:oe("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(nz,{container:r,children:l}):l});gf.displayName=y1.displayName;function ea({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(nn,{title:e}),s.jsx(sz,{page:e})]})}function sz({page:e}){return s.jsxs(ce,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:I0(e)})]})}const az=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Dy="Opening. If macOS asks whether sdlc viewer may control Terminal, allow it.";function lg(e,t){return`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(t)}`}const zy=/^iss-\d{1,9}$/;function rz(e,t,n=null){if(e.kind==="open"||e.kind==="card")return null;if(n!==null)return zy.test(n)?`claude "$(sdlc view --issue ${n} --prompt)"`:null;const a=e.kind==="start"?e.task??t:t;return a&&az.test(a)?`claude "$(sdlc view --task ${a} --prompt)"`:e.kind==="start"&&zy.test(e.issue)?`claude "$(sdlc view --issue ${e.issue} --prompt)"`:null}function vf({org:e,action:t,task_id:n,issue:a=null,open_thread:r,labelled:l=!1}){const{href:i,Link:o}=Fe(),{confirm:c,confirm_dialog:d}=fi(),f=es(),[m,h]=u.useState(!1),[x,y]=u.useState(!1),[v,j]=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),y(!1),j(null)),u.useEffect(()=>{if(!v)return;const B=()=>j(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,P=l?s.jsxs(s.Fragment,{children:[s.jsx(Zu,{className:"mr-2 size-4","aria-hidden":"true"}),"Open thread"]}):s.jsx(Zu,{className:"size-4","aria-hidden":"true"}),I=l?"default":"icon";if(t.kind==="card"||!r)return{button:s.jsx(Ly,{text:`Open thread: ${B}`,children:s.jsx("span",{className:"inline-flex",children:s.jsx(V,{asChild:!0,variant:"outline",size:I,children:s.jsx(o,{href:i(lg(e,t.thread)),"aria-label":`Open thread: ${B}`,children:P})})})}),panel:null};const A=async()=>{if(x)return;const R=p,E=()=>S.current===R;j(null),y(!0);const k=await r(t.thread,async M=>{y(!1);const F=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 F&&E()&&y(!0),F});E()&&(y(!1),"note"in k&&j(k.note))},$=x?Dy:(v==null?void 0:v.role)==="muted"?j1(v,f):"";return{button:s.jsxs(s.Fragment,{children:[s.jsx(Ly,{text:`Open thread: ${B}`,children:s.jsx(V,{type:"button",variant:"outline",size:I,"aria-label":`Open thread: ${B}`,"aria-busy":x||void 0,"aria-disabled":x||void 0,onClick:()=>void A(),children:P})}),s.jsx("span",{role:"status",className:"sr-only",children:$}),d]}),panel:x?s.jsxs(ce,{variant:"info",role:"presentation",className:"mt-2",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{className:"text-current",children:Dy})]}):v?s.jsx(lz,{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"?zr:fT;return{button:s.jsxs(V,{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(iz,{id:g,lead:O,command:C}):null}}function Ly({text:e,children:t}){return s.jsx(sg,{children:s.jsxs(ag,{children:[s.jsx(rg,{asChild:!0,children:t}),s.jsx(gf,{children:e})]})})}function j1(e,t){return e.outdated?`${e.text} ${t}`:e.text}function lz({note:e,outdated_step:t}){const n=j1(e,t);return e.role==="muted"?s.jsxs(ce,{variant:"default",role:"presentation",className:"mt-2",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{children:n})]}):e.role==="you"?s.jsxs(ce,{variant:"warning",className:"mt-2",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{className:"text-current",children:n})]}):s.jsxs(ce,{variant:"destructive",className:"mt-2",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{className:"text-current",children:n})]})}function iz({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(Jm,{text:n,label:"Copy",aria_label:"Copy the command",what:"the command"})]})]})}function Jm({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(V,{type:"button",variant:r,size:l,"aria-label":i==="copied"?void 0:n,onClick:()=>void c(),children:[i==="copied"?s.jsx(Kr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx(O0,{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 Uy=["none","read","comment","write","manage","admin"];function cd(e,t){return Uy.indexOf(e??"none")>=Uy.indexOf(t)}function ig(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Nh(e,t){const n=ig(e);return e==="sdlc_login"&&t?`${n} on ${b1(t)}`:n}const oz=String.fromCodePoint(8296),cz=String.fromCodePoint(8297);function b1(e){return`${oz}${e}${cz}`}const Do={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"}},uz={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function w1(e){return e.name==="Blocked"?"warning":uz[e.category]}const By=1800;function Ts(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function hs(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function og(e){return`${ms(e)}, ${hs(e)}`}function Li(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function ms(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function _1(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function dz(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 fz(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 Ca="not_set";function hz({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 P;const f=Fr(),[m,h]=u.useState(""),[x,y]=u.useState(""),[v,j]=u.useState(r??((P=l[0])==null?void 0:P.id)??""),[g,p]=u.useState(Ca),[b,w]=u.useState(Ca),[S,C]=u.useState(!1),[_,N]=u.useState(null),[O,D]=u.useState(!1);u.useEffect(()=>{var I;e&&(h(""),y(""),j(r??((I=l[0])==null?void 0:I.id)??""),p(Ca),w(Ca),C(!1),N(null))},[e,r,l]);const B=async I=>{if(I.preventDefault(),!m.trim()){C(!0);return}D(!0),N(null);try{const A=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===Ca?null:g,primary_user_id:b===Ca?null:b});if(!A.ok){N(A.refusal.message);return}f.success("Task created."),await d()}finally{D(!1)}};return s.jsx(Tn,{open:e,onOpenChange:I=>I?null:c(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:I=>void B(I),noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:"New task"}),s.jsx(Dn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"new-task-title",children:"Title"}),s.jsx(Tt,{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:I=>{h(I.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(Ie,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(ts,{id:"new-task-description",rows:4,value:x,onChange:I=>y(I.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(Nt,{value:v,onValueChange:j,children:[s.jsx(yt,{id:"new-task-status",children:s.jsx(kt,{})}),s.jsx(jt,{children:l.map(I=>s.jsx(De,{value:I.id,children:I.name},I.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(Nt,{value:g,onValueChange:p,children:[s.jsx(yt,{id:"new-task-priority",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:Ca,children:"Not set"}),i.map(I=>s.jsx(De,{value:I.id,children:I.name},I.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(Nt,{value:b,onValueChange:w,children:[s.jsx(yt,{id:"new-task-primary",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:Ca,children:"Not set"}),o.map(I=>s.jsx(De,{value:I.user_id,children:I.label},I.user_id))]})]})]})]})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:O,children:O?"Creating…":"Create task"})]})]})})})}const mz="Your organization's work, in queue order. Claim a task to show you are working on it.",Fi="any",N1="none",pz=1,xz=250;function cg(){const e=pn().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function gz({org:e}){var y,v;const t=cg(),{href:n,Link:a}=Fe(),[r,l]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),m=u.useCallback(async j=>{const g=f.current+=1;j&&l({state:"loading"});const p=await t.availability({fresh:j});g===f.current&&l(p)},[t.availability]);u.useEffect(()=>{m(!1)},[m]);const h=u.useCallback(()=>void m(!0),[m]);if(u.useEffect(()=>{let j=!0;return t.members().then(g=>{j&&g.ok&&o(g.data)}),()=>{j=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let j=!0;return t.access().then(g=>{j&&g.ok&&d(g.data)}),()=>{j=!1}},[t.access]),r.state==="off"&&((y=r.refusal)==null?void 0:y.reason)!=="engine_missing")return s.jsx(or,{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)??mz;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(yz,{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(ea,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(nn,{title:"Tasks",description:x}),r.state==="loading"&&s.jsx(k1,{}),(r.state==="error"||r.state==="off")&&s.jsx(S1,{refusal:r.refusal,on_retry:h}),r.state==="available"&&s.jsx(vz,{on_done:h})]})})}function k1(){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(bt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function S1({refusal:e,on_retry:t}){const n=es();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(ce,{variant:"warning",className:"mt-6",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{children:n})]}):s.jsxs(ce,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Tasks could not be loaded"}),s.jsxs(fe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function vz({on_done:e}){const{commands:t}=cg(),n=Fr(),[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(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Tasks are not on for this organization"}),s.jsxs(fe,{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(V,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const kh=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function yz({active:e,org:t,members:n,description:a,read_only_reason:r,reload_configuration:l}){var el;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=cg(),{href:f,Link:m}=Fe(),{self_id:h}=Id(),x=Fr(),{list:y,workspace:v}=e,j=y.offers,g=j!==void 0,p=u.useMemo(()=>{var q;return((q=v.workflows.find(ie=>ie.id===y.workflow_id))==null?void 0:q.statuses)??[]},[v,y]),b=v.priorities,w=!!i&&cd(y.permission,"write"),S=w&&cd(y.permission,"manage"),C=u.useMemo(()=>new Map(n.map(q=>[q.user_id,q])),[n]),_=q=>{var ie;return q?q===h?"You":((ie=C.get(q))==null?void 0:ie.label)??"A member":""},[N,O]=u.useState("active"),[D,B]=u.useState(!1),[P,I]=u.useState(""),[A,$]=u.useState("");u.useEffect(()=>{const q=setTimeout(()=>$(P),xz);return()=>clearTimeout(q)},[P]);const[R,E]=u.useState(null),[k,M]=u.useState(Fi),[F,T]=u.useState(!1),[H,X]=u.useState(!1),[Z,ae]=u.useState({}),[we,W]=u.useState([]),[te,Se]=u.useState(null),[le,je]=u.useState([]),[me,$e]=u.useState(null),[xe,Ce]=u.useState(0),[J,G]=u.useState(!1),[ne,se]=u.useState(null),[Ke,Xe]=u.useState(null),rt=es(),[ye,tt]=u.useState(!1),[It,Ht]=u.useState(null),[Kt,Le]=u.useState({}),[zn,Xt]=u.useState(""),{confirm:on,confirm_dialog:gn}=fi(),Pt=u.useRef(null),cn=u.useRef(null),L=u.useRef(null),he=u.useRef(null),[ge,ct]=u.useState(void 0),ns=!!(A.trim()||R||k!==Fi||F||H),vn=u.useRef(0),Wt=u.useRef(0),U=u.useCallback(async(q,ie=!1)=>{if(ie&&Wt.current>0)return;const Ge=q?vn.current:vn.current+=1,mt={state:N,assigned_to_me:D||void 0,cursor:q,search:A.trim()||void 0,group:R??void 0,owner:k===Fi?void 0:k===N1?"":k,urgent:F||void 0,over_estimate:H||void 0,...jz(Z,we)},jn=bn=>o(y.id,{...mt,cursor:bn});q||(Wt.current+=1);let Ct=await jn(q).finally(()=>{q||(Wt.current-=1)}),qt=!!q;if(!Ct.ok&&Ct.refusal.code==="cursor_stale"&&(Ct=await jn(),qt=!1),Ge!==vn.current)return;if(!Ct.ok){$e(Ct.refusal),Ce(bn=>bn+1);return}const Dt=Ct.data;$e(null),Ce(0),!(ie&&kh(Dt,L.current))&&(L.current=Dt,Se(Dt),Dt.facets&&ct(Dt.facets),je(bn=>qt?[...bn,...Dt.tasks]:Dt.tasks))},[o,y.id,N,D,A,R,k,F,H,Z,we]),Ee=u.useCallback(async()=>{const q=await c();if(Xe(Ge=>q.ok?null:kh(Ge,q.refusal)?Ge:q.refusal),!q.ok&&g)return;const ie=q.ok?q.data:null;kh(ie,he.current)||(he.current=ie,se(ie))},[c,g]);u.useEffect(()=>{L.current=null,Se(null)},[N,D]),u.useEffect(()=>{U()},[U]),u.useEffect(()=>{Ee()},[Ee]);const Oe=u.useCallback(async()=>{await Promise.all([U(),Ee()])},[U,Ee]),ut=u.useRef(Oe);ut.current=Oe;const un=j==null?void 0:j.refresh_ms;u.useEffect(()=>{if(!un)return;const q=setInterval(()=>{U(void 0,!0),Ee()},un);return()=>clearInterval(q)},[un,U,Ee]);const ss=u.useCallback(async(q,ie,Ge)=>{if(!i)return;const mt=await i.run(q,ie);mt.ok?Ge&&x.success(Ge):(x.error(mt.refusal.message),mt.refusal.code==="revision_conflict"&&l()),await Oe()},[i,x,Oe,l]),Ln=p.find(q=>q.category==="completed"),Un=async(q,ie,Ge)=>{const mt=ie+Ge,jn=le[mt];if(!jn||!te||!i)return;const Ct=async(qt,Dt)=>{const bn=await i.run(qt,Dt);if(!bn.ok)throw bn.refusal;return bn.data};try{let qt=te.list.order_revision,Dt=q.revision;if(jn.queue_rank===null){const bn=le.findIndex(_a=>_a.queue_rank===null);for(const _a of le.slice(bn,mt+1)){const Ci=await Ct("reorder",{task_id:_a.id,expected_revision:_a.revision,expected_order_revision:qt,placement:"end"});qt=Ci.list.order_revision,_a.id===q.id&&(Dt=Ci.task.revision)}}await Ct("reorder",{task_id:q.id,expected_revision:Dt,expected_order_revision:qt,placement:Ge<0?"before":"after",anchor_task_id:jn.id})}catch(qt){x.error(qt.message)}await Oe()},mr=q=>{Ln&&ss("update_task",{task_id:q.id,expected_revision:q.revision,changes:{status_id:Ln.id}},`${q.title} completed.`)},Ms=async q=>{if(!te||!await on({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[Ge,mt]=await Promise.all([o(y.id,{limit:1}),d(v.id)]);if(!Ge.ok||!mt.ok){x.error(Ge.ok?mt.ok?"":mt.refusal.message:Ge.refusal.message);return}await ss("archive_task",{task_id:q.id,expected_revision:q.revision,expected_order_revision:Ge.data.list.order_revision,expected_hierarchy_revision:mt.data},`${q.title} archived.`)},be=async q=>{await ss("release_hold",{hold_id:q},"Hold released.")},We=async(q,ie,Ge,mt)=>{if(!(i!=null&&i.complete)||!await on({title:`Mark ${ie} done?`,description:Ge.reason?`“${Ge.reason}”
|
|
402
|
+
|
|
403
|
+
It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;Ht(q);const Ct=await i.complete(Ge);if(Ht(null),!Ct.ok){Le(qt=>({...qt,[q]:Ct.refusal.message}));return}Le(({[q]:qt,...Dt})=>Dt),Xt(`${ie} marked done.`),await ut.current(),yn({next:mt})},[Qt,yn]=u.useState(null);u.useEffect(()=>{var mt;if(!Qt)return;yn(null);const q=cn.current,ie=typeof Qt.next=="function"?Qt.next():Qt.next;(mt=(ie?(q==null?void 0:q.querySelector(`[data-done-key="${CSS.escape(ie)}"]`))??(q==null?void 0:q.querySelector(`[data-title-key="${CSS.escape(ie)}"] a`)):null)??Pt.current)==null||mt.focus()},[Qt]);const pr=()=>{var q;I(""),$(""),E(null),M(Fi),T(!1),X(!1),(q=Pt.current)==null||q.focus()},Cf=new Map(p.map(q=>[q.id,q])),Rf=new Map(b.map(q=>[q.id,q])),Jr=new Map(le.map(q=>[q.id,q.title])),Ni=w&&N==="active",Ef=le.some(q=>q.local_done),jc=le.some(q=>q.local_action),z=Ni||Ef||jc,ee=!g||b.length>0,re=!D&&!ns,pe=5+(ee?1:0)+(z?1:0),Te=me!==null&&(me.reason==="store_locked"||me.reason==="engine_failed")&&xe<=pz,St=(ne==null?void 0:ne.holds)??[],Bn=te==null?void 0:te.groups,In=bz(le,Bn,Z,(te==null?void 0:te.matched)===void 0?we:[]),js=Bn?Bn.length===0:le.length===0,ki=(q,ie)=>ae(Ge=>({...Ge,[q]:!ie})),ta=q=>W(ie=>ie.includes(q)?ie.filter(Ge=>Ge!==q):[...ie,q]),Si=St.map(q=>q.id);return s.jsxs("div",{ref:cn,className:"contents",children:[s.jsx(nn,{title:"Tasks",description:a,actions:w?s.jsxs(V,{type:"button",onClick:()=>tt(!0),children:[s.jsx(zr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(te!=null&&te.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[te.open," open"]}):null,un?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:me?`Not reading · trying again every ${Math.round(un/1e3)}s`:te?`Live · refreshes every ${Math.round(un/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:zn}):null,(g||St.length>0)&&s.jsxs(ft,{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"}),St.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:St.map((q,ie)=>{var Ct,qt;const Ge=Do[q.hold_type],mt=q.target.kind==="task"?`Because you claim ${Jr.get(q.target.task_id)??"the task it waits on"} · `:"",jn=q.local_done;return s.jsxs("li",{id:`waiting-${q.id}`,"data-title-key":q.id,className:"flex flex-wrap items-center gap-3 py-2",children:[q.task?s.jsx(m,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${q.task.id}`),children:q.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:q.reason}),s.jsx(ue,{variant:Ge.tone,children:q.local_label??Ge.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[q.task?s.jsx("div",{className:"text-sm",children:q.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[mt,"From ",_(q.opened_by)," · ",ms(q.opened_at)]}),(Ct=q.local_threads)!=null&&Ct.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"}),": ",q.local_threads.join(" · ")]}):null,Kt[q.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Kt[q.id]}):null]}),jn&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":q.id,"aria-label":`Mark ${((qt=q.task)==null?void 0:qt.title)??q.reason} done`,loading:It===q.id,onClick:()=>{var Dt;return void We(q.id,((Dt=q.task)==null?void 0:Dt.title)??q.reason,jn,Si[ie+1]??null)},children:"Done"}):null,g?null:s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void be(q.id),children:"Release"})]},q.id)})}):ne?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&Ke?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Ke.reason==="view_outdated"?`Waiting on you is not read here. ${rt}`:"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(ce,{variant:"info",className:"mt-4",children:[s.jsx(lc,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"You can view these tasks"}),s.jsx(fe,{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:[(j==null?void 0:j.archived)!==!1?s.jsx(DD,{value:N,onValueChange:q=>O(q),children:s.jsxs(u1,{"aria-label":"Which tasks",children:[s.jsx(Wm,{value:"active",children:"Active"}),s.jsx(Wm,{value:"archived",children:"Archived"})]})}):null,(j==null?void 0:j.assigned_to_me)!==!1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(hi,{id:"tasks-mine",checked:D,onCheckedChange:q=>B(q===!0)}),s.jsx(Ie,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,j!=null&&j.search?s.jsx(Tt,{ref:Pt,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:P,onChange:q=>I(q.target.value)}):null,ge!=null&&ge.owners?s.jsx(Rz,{owners:ge.owners,no_owner:ge.no_owner,value:k,on_change:M}):null]}),(el=ge==null?void 0:ge.groups)!=null&&el.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[ge.groups.map(q=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:fo,"aria-pressed":R===q.id,onClick:()=>E(ie=>ie===q.id?null:q.id),children:[q.label," ",q.count]},q.id)),ge.marks?s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:fo,"aria-pressed":F,onClick:()=>T(q=>!q),children:["Urgent ",ge.marks.urgent]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:fo,"aria-pressed":H,onClick:()=>X(q=>!q),children:["Over estimate ",ge.marks.over_estimate]})]}):null]}):null,ns&&(te==null?void 0:te.matched)!==void 0&&te.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[te.matched," of ",te.total," match ·"," ",s.jsx(V,{type:"button",variant:"link",size:"inline-sm",onClick:pr,children:"Clear"})]}):null,Te?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):me?s.jsx(S1,{refusal:me,on_retry:()=>void U()}):null,!te&&!me&&s.jsx(k1,{}),te&&js&&ns?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Gd,{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(V,{type:"button",variant:"outline",onClick:pr,children:"Clear filters"})]}):te&&js&&N==="active"&&!D&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):te&&js&&N==="active"&&!D?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(z0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No 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(V,{type:"button",onClick:()=>tt(!0),children:[s.jsx(zr,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):te?s.jsxs(s.Fragment,{children:[s.jsx(ft,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Tasks",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Title"}),s.jsx(K,{children:"Status"}),ee?s.jsx(K,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(K,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(K,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(K,{children:"Claimed by"}),z?s.jsx(K,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(Ye,{children:[In.map(q=>{if(q.kind==="group")return s.jsx(_z,{group:q.group,open:q.open,columns:pe,on_toggle:()=>ki(q.group.id,q.open)},`group:${q.group.id}`);if(q.kind==="more")return s.jsx(Nz,{group:q.group,whole:we.includes(q.group.id),columns:pe,on_toggle:()=>ta(q.group.id)},`more:${q.group.id}`);const{row:ie,index:Ge}=q,mt=Cf.get(ie.status_id),jn=dz(ie),Ct=ie.local_done;return s.jsx(Sz,{columns:pe,thread:{org:t,action:ie.local_action,task_id:ie.no_page?null:ie.id,open_thread:i==null?void 0:i.open_thread},children:(qt,Dt)=>{var bn,_a;return s.jsxs(de,{"data-testid":"tasks-row",className:Dt?"border-b-0":void 0,children:[s.jsxs(Y,{"data-title-key":ie.id,children:[ie.no_page&&ie.local_thread?s.jsxs(m,{className:"text-primary inline-flex items-center gap-1 hover:underline",href:f(lg(t,ie.local_thread.key)),"aria-label":`${ie.title}: open ${ie.local_thread.title} in Threads`,children:[ie.title,s.jsx(Zu,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}):ie.no_page?s.jsx("span",{children:ie.title}):s.jsx(m,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${ie.id}`),children:ie.title}),ie.parent_task_id&&Jr.get(ie.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Jr.get(ie.parent_task_id)}):null,g?s.jsx(Cz,{row:ie}):null,Kt[ie.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Kt[ie.id]}):null]}),s.jsx(Y,{children:mt?s.jsx(ue,{variant:w1(mt),children:mt.name}):null}),ee?s.jsx(Y,{className:"hidden md:table-cell",children:ie.priority_id?((bn=Rf.get(ie.priority_id))==null?void 0:bn.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(Y,{className:"hidden md:table-cell",children:ie.owner_title?ie.owner_title:ie.primary_user_id?_(ie.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(Y,{className:"hidden md:table-cell",children:jn?s.jsx(ue,{variant:jn.tone,children:jn.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(Y,{"data-testid":"tasks-claim",children:s.jsx(Ez,{row:ie,holder:_((_a=ie.claim)==null?void 0:_a.user_id)})}),z?s.jsx(Y,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[Ct&&"hold"in Ct?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${Ct.hold}`,children:"In Waiting on you"}):Ct&&(i!=null&&i.complete)?s.jsx(V,{type:"button",variant:"outline",size:"sm","data-done-key":ie.id,"aria-label":`Mark ${ie.title} done`,loading:It===ie.id,onClick:()=>void We(ie.id,ie.title,Ct,()=>{var Ci;return(((Ci=L.current)==null?void 0:Ci.tasks)??[]).map(Tf=>Tf.id).filter(Tf=>Tf!==ie.id)[Ge]??null}),children:"Done"}):null,qt,Ni&&re?s.jsxs(s.Fragment,{children:[s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${ie.title} up`,disabled:Ge===0,onClick:()=>void Un(ie,Ge,-1),children:s.jsx(lE,{className:"size-4","aria-hidden":"true"})}),s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${ie.title} down`,disabled:Ge===le.length-1,onClick:()=>void Un(ie,Ge,1),children:s.jsx(sE,{className:"size-4","aria-hidden":"true"})})]}):null,Ni?s.jsxs(cf,{children:[s.jsx(uf,{asChild:!0,children:s.jsx(V,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${ie.title}`,children:s.jsx(hx,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(pc,{align:"end",children:[Ln&&ie.status_id!==Ln.id?s.jsx(ei,{onSelect:()=>mr(ie),children:"Complete"}):null,S?s.jsx(ei,{className:"text-destructive focus:text-destructive",onSelect:()=>void Ms(ie),children:"Archive"}):null]})]}):null]})}):null]})}},ie.id)}),js&&s.jsx(de,{children:s.jsx(Y,{colSpan:pe,className:"text-muted-foreground h-24 text-center",children:N==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),te.next_cursor?s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:J,onClick:async()=>{G(!0),await U(te.next_cursor??void 0),G(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(hz,{open:ye,commands:i,list_id:y.id,list_revision:(te==null?void 0:te.list.revision)??y.revision,default_status_id:y.default_status_id,statuses:p,priorities:b,members:n,on_close:()=>tt(!1),on_created:async()=>{tt(!1),await Oe()}}),gn]})}function jz(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 bz(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>wz)&&r.push({kind:"more",group:l})}return r}const wz=10;function _z({group:e,open:t,columns:n,on_toggle:a}){const r=t?Hd:rc;return s.jsx(de,{"data-testid":"tasks-group",children:s.jsx(Y,{colSpan:n,className:"p-1",children:s.jsxs(V,{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 Nz({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(de,{"data-testid":"tasks-group-more",children:s.jsx(Y,{colSpan:n,children:s.jsx(V,{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 Sz({thread:e,columns:t,children:n}){const{button:a,panel:r}=vf(e);return s.jsxs(s.Fragment,{children:[n(a,!!r),r?s.jsx(de,{"data-testid":"tasks-row-panel",className:"hover:bg-transparent",children:s.jsx(Y,{colSpan:t,className:"pt-0",children:s.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:r})})}):null]})}function Cz({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(ue,{variant:r.tone??"neutral",children:r.label},r.label))}):null]})}function Rz({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(Nt,{value:n,onValueChange:a,children:[s.jsx(yt,{className:"w-56","aria-label":"Owner",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:Fi,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:N1,children:["No owner (",t,")"]}):null]})]})}function Ez({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 ${Ts(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?` · ${ig(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?b1(n.via_device):void 0,children:["Until ",Ts(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 Tz={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 Az({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),[y,v]=u.useState({}),[j,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=Tz[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(Tn,{open:e,onOpenChange:C=>C?null:r(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:C=>void S(C),noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:"Add hold"}),s.jsx(Dn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[j&&s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(fe,{children:j})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"hold-type",children:"Type"}),s.jsxs(Nt,{value:i,onValueChange:C=>{o(C),d(""),v({})},children:[s.jsx(yt,{id:"hold-type",children:s.jsx(kt,{})}),s.jsx(jt,{children:Object.keys(Do).map(C=>s.jsx(De,{value:C,children:Do[C].label},C))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(Tt,{id:"hold-target",value:c,"aria-invalid":y.target,onChange:C=>d(C.target.value)}):s.jsxs(Nt,{value:c,onValueChange:d,children:[s.jsx(yt,{id:"hold-target","aria-invalid":y.target,children:s.jsx(kt,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(jt,{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:y.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:y.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(Ie,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(ts,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":y.reason,onChange:C=>m(C.target.value)}),y.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(hi,{id:"hold-release-claim",checked:h,onCheckedChange:C=>x(C===!0)}),s.jsx(Ie,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),s.jsx(V,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function gc(){const e=pn().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function ug(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(bt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(bt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function ud({back:e,description:t}){const{href:n,Link:a}=Fe();return s.jsx(or,{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 il="not_set",$z=10*60*1e3,Iy=20;function Mz(){const{members:e}=gc(),[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 Oz({active:e,task_id:t,back:n}){const a=gc(),{task:r,activity:l,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Fe(),m=Fr(),{self_id:h}=Id(),{members:x,name:y}=Mz(),{workspace:v}=e,{confirm:j,confirm_dialog:g}=fi(),[p,b]=u.useState(null),[w,S]=u.useState(!1),[C,_]=u.useState(!1),[N,O]=u.useState(null),[D,B]=u.useState([]),[P,I]=u.useState(Iy),[A,$]=u.useState([]),[R,E]=u.useState(!1),[k,M]=u.useState(null),[F,T]=u.useState(null),[H,X]=u.useState(""),[Z,ae]=u.useState(null),we=u.useCallback(async()=>{if(!r)return;const U=await r(t);U.ok?(b(U.data),_(!1)):U.refusal.status===404||U.refusal.status===400?S(!0):_(!0)},[r,t]),W=u.useRef(0),te=u.useCallback(async()=>{if(!l)return;const U=W.current+=1;let Ee=[],Oe;for(;;){const ut=await l(t,Oe);if(U!==W.current||!ut.ok)return;if(Ee=[...Ee,...ut.data.events].slice(-1e3),!ut.data.more||!ut.data.next_cursor)break;Oe=ut.data.next_cursor}U===W.current&&B(Ee.reverse())},[l,t]);u.useEffect(()=>{we(),te()},[we,te]);const Se=p?v.lists.find(U=>U.id===p.task.list_id):void 0,le=u.useMemo(()=>{var U;return((U=v.workflows.find(Ee=>Ee.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:U.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let U=!0;return i(p.task.list_id,{limit:100}).then(Ee=>{U&&$(Ee.ok?Ee.data.tasks.filter(Oe=>Oe.id!==p.task.id).map(Oe=>({id:Oe.id,title:Oe.title})):[])}),()=>{U=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const je=u.useCallback(async()=>{await Promise.all([we(),te()])},[we,te]),me=u.useCallback((U,Ee)=>c?c.run(U,Ee):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),$e=u.useCallback(async(U,Ee,Oe)=>{const ut=await me(U,Ee);return ut.ok?(Oe&&m.success(Oe),await je(),ut.data):(ut.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."}):ut.refusal.code==="claim_held"?(await we(),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(ut.refusal.message),await je(),null)},[me,m,je,we]),xe=(p==null?void 0:p.claim)??null,Ce=xe!==null&&xe.id===Z&&!xe.lapsed&&!xe.via?xe.id:null;if(u.useEffect(()=>{if(!Ce)return;const U=window.setInterval(()=>{me("renew_claim",{claim_id:Ce,lease_seconds:By}).then(()=>we())},$z);return()=>window.clearInterval(U)},[Ce,me,we]),w)return s.jsx(ud,{back:n});if(C&&!p)return s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This task could not be loaded"}),s.jsxs(fe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void we(),children:"Retry"})]})]});if(!p)return s.jsx(ug,{});const{task:J}=p,G=J.archived_at!==null,ne=cd(p.permission,"write")&&!G,se=cd(p.permission,"manage"),Ke=le.find(U=>U.id===J.status_id),Xe=le.find(U=>U.category==="completed"),rt=v.priorities.find(U=>U.id===J.priority_id),ye=p.contributors.map(U=>U.user_id),tt=xe!==null&&xe.user_id===h,It=xe!==null&&!xe.lapsed,Ht=p.checklist.filter(U=>U.is_complete).length,Kt=async()=>{const[U,Ee]=await Promise.all([i(J.list_id,{limit:1}),o(v.id)]);return U.ok?Ee.ok?{ok:!0,data:{task_id:J.id,expected_revision:J.revision,expected_order_revision:U.data.list.order_revision,expected_hierarchy_revision:Ee.data}}:Ee:U},Le=(U,Ee)=>$e("update_task",{task_id:J.id,expected_revision:J.revision,changes:U},Ee),zn=U=>j(U.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Nh(U.via,U.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}),Xt=async()=>{if(!Xe)return;if(It&&(!tt||xe.via)){const Ee=xe.via==="api_key"?`${tt?"Your":`${y(xe.user_id)}'s`} agent is still working on it.`:xe.via==="sdlc_login"?`${tt?"You are":`${y(xe.user_id)} is`} still working on it via ${Nh(xe.via,xe.via_device)}.`:`${y(xe.user_id)} is still working on it.`;if(!await j({title:"Complete this task?",description:Ee,action_label:"Mark complete"}))return}await Le({status_id:Xe.id},"Task completed.")!==null&&xe&&tt&&It&&await $e("end_claim",{claim_id:xe.id,outcome:"completed"})},on=async(U,Ee)=>{const Oe=await Kt();if(!Oe.ok){m.error(Oe.refusal.message);return}await $e(U,Oe.data,Ee)},gn=async()=>{await j({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 on("archive_task","Task archived.")},Pt=async()=>{await on("restore_task","Task restored.")},cn=async()=>{var ut;const U=xe,Ee=await $e("claim_task",{task_id:J.id,lease_seconds:By}),Oe=(ut=Ee==null?void 0:Ee.claim)==null?void 0:ut.id;Oe&&!(U&&U.id===Oe&&U.via)&&ae(Oe)},L=async()=>{xe&&(xe.via&&!await zn(xe)||(await $e("end_claim",{claim_id:xe.id,outcome:"released"},"Claim released."),ae(null)))},he=async()=>{xe&&await $e("end_claim",{claim_id:xe.id,outcome:"expired"},"Claim cleared.")},ge=async U=>{U.hold_type==="paused"&&h&&(U={...U,target_user_id:h});const Ee=await me("open_hold",{task_id:J.id,hold_type:U.hold_type,reason:U.reason,...U.target_user_id?{target_user_id:U.target_user_id}:{},...U.target_task_id?{target_task_id:U.target_task_id}:{},...U.target_label?{target_label:U.target_label}:{}});return Ee.ok?(E(!1),m.success("Hold added."),U.release_claim&&xe&&tt&&!xe.via&&(await $e("end_claim",{claim_id:xe.id,outcome:"released"}),ae(null)),await je(),null):Ee.refusal.message},ct=U=>$e("checklist",{task_id:J.id,expected_revision:J.revision,...U}),ns=async U=>{for(const Ee of U.filter(Oe=>!ye.includes(Oe)))await $e("set_contributor",{task_id:J.id,expected_revision:J.revision,user_id:Ee,action:"add"});for(const Ee of p.contributors.filter(Oe=>!U.includes(Oe.user_id)))await $e("set_contributor",{task_id:J.id,expected_revision:J.revision,user_id:Ee.user_id,action:"remove",expected_contributor_revision:Ee.revision})},vn=U=>{var Oe;if(U.target.kind==="user")return y(U.target.user_id,h);if(U.target.kind==="external")return U.target.label;if(U.target.hidden||!U.target.task_id)return"A task you cannot see";const Ee=U.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${Ee}`),children:((Oe=A.find(ut=>ut.id===Ee))==null?void 0:Oe.title)??"Another task"})},Wt=U=>U.target.kind==="user"&&U.target.user_id===h&&!U.released_at?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void $e("release_hold",{hold_id:U.id},"Hold released."),children:"Release"}):ne?s.jsx(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void $e("resolve_hold",{hold_id:U.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(nn,{title:J.title,description:`Created ${ms(J.created_at)} by ${y(J.created_by,h)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ne&&s.jsxs(s.Fragment,{children:[s.jsxs(V,{type:"button",variant:"outline",onClick:()=>M(J.title),children:[s.jsx(qd,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),Xe&&J.status_id!==Xe.id&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void Xt(),children:[s.jsx(Kr,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),se&&!G&&s.jsxs(V,{type:"button",variant:"outline",onClick:()=>void gn(),children:[s.jsx(ay,{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 U=>{U.preventDefault(),k.trim()&&await Le({title:k.trim()})!==null&&M(null)},children:[s.jsx(Ie,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(Tt,{id:"task-title",className:"max-w-xl",value:k,onChange:U=>M(U.target.value)}),s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>M(null),children:"Cancel"})]}):null}),N&&s.jsxs(ce,{variant:N.tone,className:"mt-4","data-testid":"task-notice",children:[N.tone==="warning"?s.jsx(Xr,{className:"size-4","aria-hidden":"true"}):s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:N.title}),s.jsx(fe,{children:N.body})]}),G?s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(ay,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This task is archived"}),s.jsx(fe,{children:se?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(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Pt(),children:[s.jsx(eE,{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."})})]}):ne?null:s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(lc,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"You can view this task"}),s.jsx(fe,{children:"Ask an organization admin for write access to change it."})]}),ne?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(Ie,{htmlFor:"task-status",children:"Status"}),s.jsxs(Nt,{value:J.status_id,onValueChange:U=>void Le({status_id:U}),children:[s.jsx(yt,{id:"task-status",children:s.jsx(kt,{})}),s.jsx(jt,{children:le.map(U=>s.jsx(De,{value:U.id,children:U.name},U.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(Nt,{value:J.priority_id??il,onValueChange:U=>void Le({priority_id:U===il?null:U}),children:[s.jsx(yt,{id:"task-priority",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:il,children:"Not set"}),v.priorities.map(U=>s.jsx(De,{value:U.id,children:U.name},U.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(Nt,{value:J.primary_user_id??il,onValueChange:U=>void Le({primary_user_id:U===il?null:U}),children:[s.jsx(yt,{id:"task-primary",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:il,children:"Not set"}),x.map(U=>s.jsx(De,{value:U.user_id,children:U.label},U.user_id))]})]})]}),s.jsx(Dz,{members:x,selected:ye,on_change:U=>void ns(U)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(Gc,{label:"Status",value:(Ke==null?void 0:Ke.name)??""}),s.jsx(Gc,{label:"Priority",value:(rt==null?void 0:rt.name)??"Not set"}),s.jsx(Gc,{label:"Primary",value:J.primary_user_id?y(J.primary_user_id,h):"Not set"}),s.jsx(Gc,{label:"Contributors",value:ye.map(U=>y(U,h)).join(", ")||"None"})]}),!G&&s.jsx(zz,{claim:xe,mine:tt,holder:xe?y(xe.user_id):"",own:xe!==null&&xe.id===Z,can_write:ne,on_claim:()=>void cn(),on_release:()=>void L(),on_clear:()=>void he()}),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"}),ne&&F===null&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(J.description??""),children:"Edit description"})]}),F!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),await Le({description:F})!==null&&T(null)},children:[s.jsx(Ie,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(ts,{id:"task-description",rows:5,value:F,onChange:U=>T(U.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{type:"submit",size:"sm",children:"Save"}),s.jsx(V,{type:"button",size:"sm",variant:"outline",onClick:()=>T(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:J.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?` · ${Ht} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(U=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[ne?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(hi,{id:`check-${U.id}`,checked:U.is_complete,onCheckedChange:Ee=>void ct({action:"toggle",item_id:U.id,expected_item_revision:U.revision,is_complete:Ee===!0})}),s.jsx(Ie,{htmlFor:`check-${U.id}`,className:"font-normal",children:U.label})]}):s.jsxs("span",{className:"text-sm",children:[U.is_complete?"Done: ":"To do: ",U.label]}),ne&&s.jsxs(cf,{children:[s.jsx(uf,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${U.label}`,children:s.jsx(hx,{className:"size-4","aria-hidden":"true"})})}),s.jsx(pc,{align:"end",children:s.jsx(ei,{className:"text-destructive focus:text-destructive",onSelect:()=>void ct({action:"archive",item_id:U.id,expected_item_revision:U.revision}),children:"Remove"})})]})]},U.id))}),p.checklist.length===0&&!ne&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),ne&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async U=>{U.preventDefault(),H.trim()&&await ct({action:"add",label:H.trim()})!==null&&X("")},children:[s.jsx(Ie,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(Tt,{id:"task-new-item",placeholder:"Add an item and press Enter",value:H,onChange:U=>X(U.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"}),ne&&s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:()=>E(!0),children:[s.jsx(U0,{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(Ve,{containerAriaLabel:"Holds",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Type"}),s.jsx(K,{children:"Reason"}),s.jsx(K,{children:"Waiting on"}),s.jsx(K,{className:"text-right",children:"Actions"})]})}),s.jsxs(Ye,{children:[p.holds.map(U=>{const Ee=Do[U.hold_type];return s.jsxs(de,{"data-testid":"task-hold",children:[s.jsx(Y,{children:s.jsx(ue,{variant:Ee.tone,children:Ee.label})}),s.jsxs(Y,{children:[s.jsx("div",{children:U.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:U.released_at?`Released by ${y(U.released_by,h)} · ${ms(U.released_at)} · Ready to resolve`:`Opened by ${y(U.opened_by,h)} · ${ms(U.opened_at)} · Open`})]}),s.jsx(Y,{children:vn(U)}),s.jsx(Y,{className:"text-right",children:Wt(U)})]},U.id)}),p.holds.length===0&&s.jsx(de,{children:s.jsx(Y,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"A hold does not change the task's status. The person it waits on releases it; whoever can edit the task resolves it."})]}),s.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[s.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),s.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[D.slice(0,P).map(U=>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:fz(U)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:U.actor_id?y(U.actor_id,h):"The system"}),U.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Nh(U.via,U.via_device)}`,children:["via ",ig(U.via),s.jsx(C1,{via:U.via,device:U.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:_1(U.created_at)})]},U.id)),D.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),D.length>P&&s.jsx(V,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>I(U=>U+Iy),children:"Load more"})]}),ne&&Se&&s.jsx(Az,{open:R,members:x,tasks:A,holds_my_web_claim:tt&&It&&!(xe!=null&&xe.via),on_close:()=>E(!1),on_submit:ge}),g]})}function Gc({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 Dz({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(cf,{children:[s.jsx(uf,{asChild:!0,children:s.jsxs(V,{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(M0,{className:"text-muted-foreground size-4","aria-hidden":"true"})]})}),s.jsx(pc,{align:"start",children:e.map(a=>{const r=t.includes(a.user_id);return s.jsxs(ei,{onSelect:()=>n(r?t.filter(l=>l!==a.user_id):[...t,a.user_id]),children:[r?s.jsx(Kr,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function C1({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function zz({claim:e,mine:t,holder:n,own:a,can_write:r,on_claim:l,on_release:i,on_clear:o}){let c=s.jsx(mx,{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(V,{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(_E,{className:"size-4","aria-hidden":"true"}),d=h?`${t?"Your":`${n}'s`} claim lapsed at ${Ts(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(V,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(V,{type:"button",size:"sm",onClick:l,children:"Take over"})]}):null}else if(e){const h=Ts(e.lease_expires_at);c=e.via==="api_key"?s.jsx(fx,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(FE,{className:"size-4","aria-hidden":"true"}):s.jsx(CT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(C1,{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(V,{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 dg(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 R1(){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 Lz=10,E1=5,Uz=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,T1="Not available",Bz={added:"Added",changed:"Changed",removed:"Removed"},Iz={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},Hy=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function Hz(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&Uz.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&&Hy.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&&Hy.test(l)?{label:`Planned Release ${l}`,path:`/releases?planned=${l}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const A1=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function Pz({org:e,task_id:t,from:n}){var Pt,cn;const a=gc(),{href:r,Link:l}=Fe(),{confirm:i,confirm_dialog:o}=fi(),c=Hz(e,n),[d,f]=u.useState({state:"loading"}),[m,h]=u.useState([]),[x,y]=u.useState([]),[v,j]=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,P]=u.useState(!1),I=u.useRef(null),A=es(),$=vf({org:e,action:d.state==="ok"?d.detail.local_action:void 0,task_id:t,open_thread:(Pt=a.commands)==null?void 0:Pt.open_thread,labelled:!0}),R=u.useRef(null),E=u.useRef(null),k=u.useRef(null),M=u.useRef(null),F=u.useRef(!1),T=u.useRef(0),H=u.useRef(0),X=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const L=await a.taskSections(t);w(L.ok?{state:"ok",data:L.data}:{state:"failed",refusal:L.refusal})},[a.taskSections,t]),Z=u.useCallback(async()=>{if(!a.taskRelated)return;C({state:"loading"});const L=await a.taskRelated(t);C(L.ok?{state:"ok",data:L.data}:{state:"failed",refusal:L.refusal})},[a.taskRelated,t]),ae=u.useCallback(async()=>{var ns,vn;const L=H.current+=1;p(null),X(),Z();const[he,ge]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(L!==H.current)return;he.state==="active"&&h(((ns=he.workspace.workflows.find(Wt=>Wt.id===he.list.workflow_id))==null?void 0:ns.statuses)??[]);const ct=he.state==="off"&&((vn=he.refusal)==null?void 0:vn.reason)==="engine_missing"?he.refusal:null;if(!ge||!ge.ok&&ge.refusal.reason==="engine_missing"||ct){f({state:"engine_missing",refusal:ct??(ge&&!ge.ok?ge.refusal:{status:0,message:""})});return}if(ge.ok){T.current=0,j(null),D(null),f({state:"ok",detail:ge.data,at:new Date().toISOString()});return}if(ge.refusal.status===404||ge.refusal.reason==="not_found"){f({state:"missing"});return}if(T.current+=1,T.current===1&&A1(ge.refusal)){p(ge.refusal.retry_after??Lz);return}j(ge.refusal),f(Wt=>Wt.state==="loading"?{state:"loading"}:Wt)},[a,t,X,Z]);u.useEffect(()=>{ae()},[ae]),u.useEffect(()=>{if(g===null)return;const L=setTimeout(()=>void ae(),g*1e3);return()=>clearTimeout(L)},[g,ae]),u.useEffect(()=>{let L=!0;return a.members().then(he=>{L&&he.ok&&y(he.data)}),()=>{L=!1}},[a.members]),u.useEffect(()=>{var he;if(F.current||d.state!=="ok")return;F.current=!0;const L=(he=I.current)==null?void 0:he.querySelector("h1");L&&(L.tabIndex=-1,L.focus())},[d.state]),u.useEffect(()=>{var L;_&&((L=E.current)==null||L.focus())},[_]),u.useEffect(()=>{if(O===null)return;const L=setTimeout(()=>{var he;return(he=R.current)==null?void 0:he.focus()},0);return()=>clearTimeout(L)},[O]);const we=u.useMemo(()=>new Map(x.map(L=>[L.user_id,L.label])),[x]),W=L=>L?we.get(L)??L:"",te=()=>{N(null),ae()},Se=u.useRef(null),le=L=>(Se.current=L,L==="graph"?X():Z());if(u.useEffect(()=>{var ge;const L=Se.current;if(L===null||(L==="graph"?b:S).state==="loading")return;Se.current=null;const he=(L==="graph"?k:M).current??((ge=I.current)==null?void 0:ge.querySelector("h1"));he==null||he.focus()},[b,S]),d.state==="missing")return s.jsx(Ha,{children:s.jsx(ud,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const je=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(l,{href:r(c.path),children:[s.jsx($0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(Ha,{children:s.jsx("div",{ref:I,className:"contents",children:s.jsx(ea,{page:"Task",header:s.jsx(ho,{back:je,id:null,title:t})})})});const me=v?s.jsxs(ce,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not read this task"}),s.jsxs(fe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${hs(v.since)}.`:"",d.state==="ok"?` This page was read at ${hs(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:te,children:"Retry"})]})]}):null,$e=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(hn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,xe=s.jsx("div",{role:"status","aria-live":"polite",children:$e});if(d.state==="loading")return s.jsxs(Ha,{children:[xe,me,!v&&g===null?s.jsx(ug,{}):null]});const{detail:Ce,at:J}=d,{task:G}=Ce,ne=m.find(L=>L.id===G.status_id),se=Ce.local_done&&"task"in Ce.local_done?Ce.local_done:null,Ke=Ce.local_waits??[],Xe=se?Ke[0]??null:null,rt=Xe?W(Xe.opened_by):Ce.owner_title??W(Ce.thread),ye=b.state==="ok"?b.data:null,tt=(ye==null?void 0:ye.lifecycle)==="finished",It=tt&&(ye==null?void 0:ye.outcome)==="cancelled",Ht=tt&&(ye==null?void 0:ye.outcome)==="complete",Kt=!!G.created_at,Le=Ce.acceptance??[],zn=Ce.local_owner_thread,Xt=zn?s.jsx(l,{className:"text-primary hover:underline",href:r(lg(e,zn.key)),children:zn.title}):Ce.owner_title??(W(Ce.thread)||"None"),on=async()=>{var ge;if(!se||!((ge=a.commands)!=null&&ge.complete)||!await i({title:`Mark ${G.title} done?`,description:Xe?`This answers ${rt}'s ask, “${Xe.reason}”, closes that wait, and tells ${rt} to check and continue.`:`This tells ${rt||"its thread"} to check and continue.`,action_label:"Mark done"}))return;P(!0);const he=await a.commands.complete(se);if(P(!1),!he.ok){D(he.refusal.message);return}await ae(),N({title:G.title,asker:rt||"Its thread"})},gn=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[se&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(V,{ref:R,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&&on()},children:[s.jsx(Kr,{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 ",hs(J)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:te,children:[s.jsx(Xr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(Ha,{children:[s.jsxs("div",{ref:I,className:"contents",children:[s.jsx(ho,{back:je,id:G.id,copy:s.jsx(Jm,{text:G.id,label:"Copy ID",what:"the ID",variant:"ghost"}),badge:ne?s.jsx(ue,{variant:w1(ne),children:ne.name}):null,title:G.title,created:Kt?`Created ${ms(G.created_at)}${rt||Ce.owner_title?` by ${Ce.owner_title??rt}`:""}`:null,actions:gn}),$.panel?s.jsx("div",{className:"mt-1 max-w-180",children:$.panel}):null,xe,me,_?s.jsx("div",{ref:E,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(ce,{variant:"success",className:"mt-4",children:[s.jsx(Pd,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:["Marked ",_.title," done"]}),s.jsxs(fe,{children:[_.asker," is told to check and continue."]})]})}):null,O!==null?s.jsxs(ce,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Done was not recorded"}),s.jsxs(fe,{children:[O," Read again to see the task as it is now."]})]}):null,Xe&&!_?s.jsxs(ce,{variant:"warning",className:"mt-4",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:[rt," asks: ",Xe.reason]}),s.jsxs(fe,{children:["Waiting on you since ",og(Xe.opened_at),". Done answers it and tells ",rt," to check and continue."]})]}):null,Ce.view_outdated?s.jsxs(ce,{variant:"warning",className:"mt-4",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsxs(fe,{children:[A," 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(Hs,{label:"Owner thread",value:Xt}),s.jsx(Hs,{label:"Release",value:Ce.release??"None"}),s.jsx(Hs,{label:"Session",value:b.state==="loading"?"Loading…":b.state==="failed"?"Not available":ye!=null&&ye.session?s.jsxs(s.Fragment,{children:[ye.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:ye.session.id})]}):"None"}),s.jsx(Hs,{label:"Now",value:Ce.local_detail??(ne==null?void 0:ne.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(qz,{detail:Ce,holder:W((cn=Ce.claim)==null?void 0:cn.user_id),finished_at:tt?(ye==null?void 0:ye.finished_at)??null:null,read_at:J}),s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(lc,{className:"text-info size-4","aria-hidden":"true"}),se?s.jsxs(s.Fragment,{children:[s.jsx(ke,{children:"Done is the one change this page makes"}),s.jsx(fe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(ke,{children:"This page only reads tasks"}),s.jsx(fe,{children:"A task changes through the agent thread working on it."})]})]}),Kt?ye!=null&&ye.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:ye.record})]}),s.jsx(Jm,{text:ye.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."}),se?s.jsx($t,{id:"task-done-needs",title:"What Done needs",children:Le.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",rt||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:Le.map(L=>s.jsx("li",{children:L},L))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",rt||"its thread"," what Done needs before marking it."]})}):Le.length>0?s.jsxs($t,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:Ht?"All met: the task finished complete":It&&(ye!=null&&ye.finished_at)?`Cancelled ${ms(ye.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:Le.map(L=>s.jsx("li",{children:Ht?`Met: ${L}`:L},L))})]}):null,s.jsx(Gz,{detail:Ce,waits:Ke,given:se!==null,threadName:W,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(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-2/3"})]}):null,ye?s.jsx($t,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(ne==null?void 0:ne.name)??G.status_id,Ce.local_detail?` · ${Ce.local_detail}`:""]})}):null,ye!=null&&ye.time?s.jsx(Vz,{time:ye.time}):null,s.jsx(Yz,{sections:b,heading_ref:k,on_retry:()=>void le("graph"),taskLink:L=>s.jsx(l,{className:"text-primary hover:underline",href:r(`/org/${e}/tasks/${L}?from=task:${G.id}`),children:L})}),ye!=null&&ye.files?s.jsx(Fz,{files:ye.files,finished:tt}):null,ye!=null&&ye.proof?s.jsx(Kz,{proof:ye.proof,finished_at:ye.finished_at,who:Ce.owner_title??null}):null,ye&&ye.history.length>0?s.jsx(Xz,{history:ye.history}):null,s.jsx($1,{related:S,heading_ref:M,on_retry:()=>void le("related"),link:L=>{const he=L.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(L.id)}`:L.kind==="task"?`/org/${e}/tasks/${L.id}?from=task:${G.id}`:L.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(L.id)}?from=task:${G.id}`:L.kind==="release"?`/releases?${L.planned?"planned":"release"}=${encodeURIComponent(L.id)}`:null;return he?s.jsx(l,{className:oe("text-primary hover:underline",L.kind!=="thread"&&L.label===L.id&&"font-mono"),href:r(he),children:L.label}):L.label}})]}),o]})}function Ha({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 ho({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(nn,{title:r,description:l??void 0,actions:i})]})}function Hs({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 $t({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 qz({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(mx,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${T1}`;else if(r){const f=new Date(r.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(fx,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${hs(r.lease_expires_at)}${f||r.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(Pd,{className:"size-4","aria-hidden":"true"}),d=`Finished ${ms(n)}. Its claim ended when it finished.`);return s.jsxs(ft,{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 Gz({detail:e,waits:t,given:n,threadName:a,threadsLink:r}){if(e.view_outdated)return s.jsx($t,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:T1})});if(e.holds.length===0)return null;const l=new Map(t.map(i=>[i.id,i]));return s.jsxs($t,{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(ft,{className:"mt-2 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Holds",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Type"}),s.jsx(K,{children:"Reason"}),s.jsx(K,{children:"Waiting on"}),s.jsx(K,{children:"Opened"})]})}),s.jsx(Ye,{children:e.holds.map(i=>{var f;const o=l.get(i.id),c=Do[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(de,{"data-testid":"task-hold",children:[s.jsx(Y,{children:s.jsx(ue,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(Y,{children:[s.jsx("div",{children:i.reason}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",a(i.opened_by)]})]}),s.jsxs(Y,{children:[s.jsx("div",{children:i.target.kind==="user"?"You":i.target.kind==="external"?i.target.label:"Another task"}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),s.jsx(Y,{children:og(i.opened_at)})]},i.id)})})]})})]})}function Vz({time:e}){return s.jsx($t,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(Hs,{label:"Estimate",value:e.estimate?`${Li(e.estimate.low)}–${Li(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(Hs,{label:"Time taken",value:e.elapsed!==null?`${Li(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(Hs,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[Li(e.forecast.low),"–",Li(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function fg({what:e,again:t,refusal:n,on_retry:a}){const r=R1();return s.jsxs(ce,{variant:"destructive",ref:r,children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:["Could not read ",e]}),s.jsxs(fe,{children:[s.jsx("p",{children:n.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function Yz({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($t,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(fg,{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($t,{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,E1),d=o.changes.length-c.length;return s.jsxs($t,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(ft,{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Graph changes",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Change"}),s.jsx(K,{children:"Kind of change"}),s.jsx(K,{children:"Also in"}),s.jsx(K,{children:"In the plan"})]})}),s.jsx(Ye,{children:c.map(f=>s.jsxs(de,{children:[s.jsxs(Y,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(Y,{children:Bz[f.change]}),s.jsx(Y,{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(Y,{children:f.planned?"Yes":s.jsx(ue,{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(V,{type:"button",variant:"ghost",size:"sm",onClick:()=>l(!0),children:["Show all ",o.changes.length]})]}):null]})}function Fz({files:e,finished:t}){const[n,a]=u.useState(!1),r=n?e.paths:e.paths.slice(0,E1);return s.jsxs($t,{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(V,{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 Kz({proof:e,finished_at:t,who:n}){return s.jsxs($t,{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 ",ms(t),n?` by ${n}`:""]}):null]})}function Xz({history:e}){return s.jsxs($t,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(ft,{className:"mt-2 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"History",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"What"}),s.jsx(K,{children:"Who"}),s.jsx(K,{children:"When"})]})}),s.jsx(Ye,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsx(Y,{children:t.what}),s.jsx(Y,{children:t.who??"Its thread"}),s.jsx(Y,{children:og(t.at)})]},`${t.at}:${n}`))})]})})]})}function $1({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($t,{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(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(fg,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(ft,{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Related",className:l?"table-fixed":void 0,children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{className:l?"w-[14%]":void 0,children:"Kind"}),s.jsx(K,{className:l?"w-[45%]":void 0,children:"Item"}),s.jsx(K,{className:l?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(Ye,{children:t.data.map(i=>s.jsxs(de,{children:[s.jsx(Y,{children:Iz[i.kind]}),s.jsx(Y,{className:l?"break-words":void 0,children:r(i)}),s.jsx(Y,{className:l?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function Wz({org:e,task_id:t,from:n}){const a=gc(),r=`/org/${e}/tasks`;return a.taskSections?s.jsx(Pz,{org:e,task_id:t,from:n??null}):s.jsx(Qz,{task_id:t,back:r})}function Qz({task_id:e,back:t}){const{availability:n}=gc(),[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(ud,{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(Oz,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This task could not be loaded"}),s.jsx(fe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(ud,{back:t}):s.jsx(ug,{})})}function Ns({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const Zz=["open","triaged","resolved","closed"],hg=["low","normal","high","urgent"],Jz=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],e3=["title","description","external_reference"],dd={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},M1={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},zo={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},mg={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},O1={title:"Title",description:"Description",external_reference:"External reference"},t3=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function pu(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 t3)if(Math.abs(n)>=l)return a.format(Math.round(n/l),r);return"just now"}function ep(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function pg(e,t){return e?t??"Not available":"A former member"}const n3="the issue integration";function s3(e){return!e.created_by&&e.reporter_kind==="customer"?n3:pg(e.created_by,e.created_by_username)}function a3(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":pg(e.actor_id,e.actor_username)}const Vc="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 l3({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(Vc),[y,v]=u.useState(!1),[j,g]=u.useState(null),p=u.useRef(null),b=()=>{l(""),o(""),d(!1),m(""),x(Vc),g(null),p.current=null},w=_=>{var N;return((N=j==null?void 0:j.personal_data)==null?void 0:N.field)===_?j.message:void 0},S=async _=>{if(_.preventDefault(),y)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===Vc?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=j&&!j.personal_data?j.message:void 0;return s.jsx(Tn,{open:t,onOpenChange:_=>{_||b(),n(_)},children:s.jsx(An,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:S,className:"grid gap-4",children:[s.jsxs($n,{children:[s.jsx(On,{children:"New support issue"}),s.jsx(Dn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(ce,{variant:"warning",children:[s.jsx(tn,{}),s.jsx(fe,{children:r3})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(Tt,{id:"maintain-issue-reference",value:r,"aria-invalid":!!w("external_reference"),onChange:_=>{l(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(Ns,{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(Ie,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(Tt,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(Ns,{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(Ie,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(ts,{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(Ns,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(Nt,{value:h,onValueChange:x,children:[s.jsx(yt,{id:"maintain-issue-priority",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:Vc,children:"Not set"}),hg.map(_=>s.jsx(De,{value:_,children:zo[_]},_))]})]})]}),C?s.jsx(Ns,{children:C}):null,s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>{b(),n(!1)},children:"Cancel"}),s.jsx(V,{type:"submit",loading:y,disabled:!i.trim()&&!r.trim(),children:"Log issue"})]})]})})})}const i3=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function D1(){return o3(pn().issues)}function o3(e){return e&&i3.every(t=>typeof e[t]=="function")?e:null}function z1(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 L1({access:e,header:t,back_href:n,children:a}){const{href:r,Link:l}=Fe();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(hn,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(or,{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(tT,{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 c3(){const e=Fe();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const qn="all",Yc=25;function tp({action:e}){return s.jsx(nn,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function u3({org:e,project:t,query:n}){const a=D1(),r=z1(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(L1,{access:r,header:s.jsx(tp,{}),back_href:l,children:i=>a?s.jsx(d3,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function d3({contract:e,access:t,org_name:n,proj_name:a,query:r}){const{href:l,Link:i}=Fe(),o=c3(),[c,d]=u.useState(()=>new URLSearchParams(r).get("external_reference")??""),[f,m]=u.useState(qn),[h,x]=u.useState(qn),[y,v]=u.useState(qn),[j,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),P=c.trim()!==""||f!==qn||h!==qn||y!==qn,I=u.useCallback(async()=>{const k=await e.list({external_reference:c.trim()||void 0,status:f===qn?void 0:f,priority:h===qn?void 0:h,assignee:y===qn?void 0:y,limit:Yc,offset:j*Yc});if(!k.ok){_(k.refusal.message);return}_(null),b(k.data.issues),S(k.data.total)},[e,c,f,h,y,j]);u.useEffect(()=>{const k=setTimeout(()=>void I(),200);return()=>clearTimeout(k)},[I]),u.useEffect(()=>{e.assigneeCandidates().then(k=>{k.ok&&O(k.data.candidates)})},[e]);const A=t.can_change?s.jsxs(V,{onClick:()=>B(!0),children:[s.jsx(zr,{className:"mr-2 size-4"}),"New issue"]}):void 0,$=s.jsx(l3,{create:e.create,open:D,onOpenChange:B,onCreated:(k,M)=>{B(!1);const F=ep(n,a,k.id);o(M.length?`${F}?duplicates=${M.length}`:F)}});if(p!==null&&w===0&&!P&&j===0)return s.jsxs(s.Fragment,{children:[s.jsx(tp,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(XE,{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(V,{onClick:()=>B(!0),children:[s.jsx(zr,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),$]});const R=w===0?0:j*Yc+1,E=Math.min(w,(j+1)*Yc);return s.jsxs(s.Fragment,{children:[s.jsx(tp,{action:A}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative w-full max-w-sm",children:[s.jsx(yT,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(Tt,{"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(Sh,{label:"Status",value:f,onChange:k=>{m(k),g(0)},options:Zz.map(k=>({value:k,label:dd[k]}))}),s.jsx(Sh,{label:"Priority",value:h,onChange:k=>{x(k),g(0)},options:hg.map(k=>({value:k,label:zo[k]}))}),s.jsx(Sh,{label:"Assignee",value:y,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(Ns,{children:C}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Ve,{children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Title"}),s.jsx(K,{children:"External reference"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Priority"}),s.jsx(K,{children:"Assignee"}),s.jsx(K,{children:"Updated"})]})}),s.jsx(Ye,{children:p===null?s.jsx(de,{children:s.jsx(Y,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(de,{children:s.jsx(Y,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(k=>s.jsxs(de,{children:[s.jsx(Y,{className:"max-w-md",children:s.jsx(i,{href:l(ep(n,a,k.id)),className:"font-medium hover:underline",children:k.title})}),s.jsx(Y,{className:"font-mono text-xs",children:k.external_reference??""}),s.jsx(Y,{children:s.jsx(ue,{variant:M1[k.status],children:dd[k.status]})}),s.jsx(Y,{children:k.priority?zo[k.priority]:""}),s.jsx(Y,{children:s.jsx(f3,{issue:k})}),s.jsx(Y,{className:"text-muted-foreground",children:pu(k.updated_at)})]},k.id))})]})}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("p",{className:"text-muted-foreground text-sm",children:w===0?"No issues.":`Showing ${R}–${E} of ${w} issue${w===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(V,{variant:"outline",size:"sm",disabled:j===0,onClick:()=>g(k=>Math.max(0,k-1)),children:"Previous"}),s.jsx(V,{variant:"outline",size:"sm",disabled:E>=w,onClick:()=>g(k=>k+1),children:"Next"})]})]}),$]})}function f3({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(ue,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Sh({label:e,value:t,onChange:n,options:a}){var l;const r=u.useMemo(()=>t===qn||a.some(i=>i.value===t),[a,t]);return s.jsxs(Nt,{value:r?t:qn,onValueChange:n,children:[s.jsx(yt,{className:"w-44","aria-label":e,children:s.jsx(kt,{placeholder:e,children:t===qn?e:(l=a.find(i=>i.value===t))==null?void 0:l.label})}),s.jsxs(jt,{children:[s.jsx(De,{value:qn,children:"All"}),a.map(i=>s.jsx(De,{value:i.value,children:i.label},i.value))]})]})}function rr(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 h3=5e3;function ps(){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},h3)}}}),[])}function yf(e,t){return n=>{(n==="shown"?e.owed():e.busy())||t()}}const U1=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],m3=/^iss-\d{1,9}$/,p3=/^col-\d{1,9}$/,x3=e=>e&&e[0].toUpperCase()+e.slice(1);function B1(e){const t=x3(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 mo(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 np={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function xu(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(r=>U1.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&&p3.test(a)?a:null}}function xg(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 I1=new Set(["resolved"]),Ch=10,g3=new Set(["unplaced","unowned","routed","fixing","resolved"]),v3=["open","fold","all"];function H1(e){const t=new URLSearchParams(e),n=a=>[...new Set(t.getAll(a).filter(r=>g3.has(r)))];return{open:n("open"),fold:n("fold"),all:n("all")}}const y3=(e,t)=>I1.has(t)?!e.open.includes(t):e.fold.includes(t);function j3(e,t,n){const a=e.open.filter(i=>i!==t),r=e.fold.filter(i=>i!==t),l=I1.has(t);return n&&!l&&r.push(t),!n&&l&&a.push(t),{...e,open:a,fold:r}}const b3=(e,t,n)=>({...e,all:n?[...e.all.filter(a=>a!==t),t]:e.all.filter(a=>a!==t)});function pl(e,t){const n=new URLSearchParams(xg(e));for(const a of v3)for(const r of t[a])n.append(a,r);return n.toString()}function w3(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 Py=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),_3={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},N3={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},k3={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function S3(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 _3[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 N3[l]??(l?`Triaged: ${l}`:"Triaged");case"routed":return k3[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 C3=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),P1="This page only reads issues",q1="File, route and resolve issues with the issue command or through the thread working on them.",R3=10,G1=1e4,E3=250,ol="__all",T3="none",A3=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function V1(){const e=pn().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const $3=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 M3({org:e,project:t,query:n,onQuery:a}){var Ce,J;const r=V1(),l=(Ce=r.commands)==null?void 0:Ce.open_thread,i=u.useMemo(()=>l?{org:e,open_thread:l}:void 0,[e,l]),{href:o,Link:c}=Fe(),d=u.useMemo(()=>xu(n),[n]),f=u.useMemo(()=>H1(n),[n]),m=xg(d),h=Py(d),x=pl(d,f),[y,v]=u.useState({state:"loading"}),[j,g]=u.useState(null),[p,b]=u.useState(null),w=u.useRef(0),S=u.useRef(0),C=u.useRef(null),_=u.useRef(null),N=es(),O=u.useRef(!1),[D,B]=u.useState(d.search),P=u.useCallback(G=>a(pl({...d,...G},f)),[d,f,a]),I=u.useCallback(G=>a(pl(d,G)),[d,a]),A=ps(),$=u.useCallback(async()=>{const G=S.current+=1;b(null);const ne=await A.track(r.list(w3(xu(m))));if(G!==S.current)return;if(ne.ok){w.current=0,g(null),v({state:"ok",list:ne.data,local:ne.data.local??$3(new Date().toISOString()),key:m});return}const se=ne.refusal.reason;if(se==="engine_missing")return v({state:"engine_missing",refusal:ne.refusal});if(se==="view_outdated")return v({state:"view_outdated"});if(w.current+=1,w.current===1&&A3(ne.refusal)){b(ne.refusal.retry_after??R3);return}g(ne.refusal)},[r.list,m,A]);u.useEffect(()=>{$()},[$]);const R=u.useMemo(()=>yf(A,()=>void $()),[$,A]);rr(R,G1),u.useEffect(()=>{if(p===null)return;const G=setTimeout(()=>{document.visibilityState==="visible"&&$()},p*1e3);return()=>clearTimeout(G)},[p,$]),u.useEffect(()=>{document.activeElement!==C.current&&B(d.search)},[d.search]),u.useEffect(()=>{if(D===d.search)return;const G=setTimeout(()=>P({search:D}),E3);return()=>clearTimeout(G)},[D,d.search,P]),u.useEffect(()=>{const G=ne=>{if(ne.key!=="/"||ne.metaKey||ne.ctrlKey||ne.altKey)return;const se=ne.target;se&&(se.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(se.tagName))||C.current&&(ne.preventDefault(),C.current.focus())};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[]);const E=()=>{var G;B(""),a(pl(np,f)),(G=C.current)==null||G.focus()},k=()=>{w.current=0,$()},M=()=>{O.current=!0,k()};u.useEffect(()=>{var ne;if(!O.current||y.state==="loading"||p!==null)return;O.current=!1;const G=(ne=_.current)==null?void 0:ne.querySelector("h1");G&&(G.tabIndex=-1,G.focus())},[y,j,p]);const F=dg(_),T=G=>`/proj/${encodeURIComponent(t)}/issues${G?`?${G}`:""}`,H=G=>`/proj/${encodeURIComponent(t)}/issues/${encodeURIComponent(G)}?from=issues${x?`&${x}`:""}`,X=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(hn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),Z=j?s.jsxs(ce,{ref:F,variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Issues could not be loaded"}),s.jsxs(fe,{children:[s.jsxs("p",{children:[j.message,j.since?` Since ${hs(j.since)}.`:"",y.state==="ok"?` The list below was read at ${hs(y.local.read_at)}.`:"",j.message.includes(Lr)?"":` ${Lr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:M,children:"Retry"})]})]}):null,ae=s.jsx(nn,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:y.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 ",hs(y.local.read_at)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:k,children:[s.jsx(Xr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(y.state==="engine_missing")return s.jsx(Fc,{ref:_,children:s.jsx(ea,{page:"Issues"})});if(y.state==="view_outdated")return s.jsxs(Fc,{ref:_,children:[ae,s.jsxs(ce,{variant:"warning",className:"mt-6",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{children:N})]})]});if(y.state==="loading")return s.jsxs(Fc,{ref:_,children:[ae,X,Z,!j&&p===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(G,ne)=>s.jsx(bt,{className:ne===5?"h-10 w-2/3":"h-10 w-full"},ne))}):null]});const{list:we,local:W}=y,te=!j&&p===null&&(y.key!==m||D!==d.search),Se=Py(xu(y.key)),le=W.scope==="folder",je=W.listed===0&&!h,me=Math.max(0,W.listed-W.facets.owners.reduce((G,ne)=>G+ne.count,0)),$e=d.collection?((J=W.collections.find(G=>G.collection===d.collection))==null?void 0:J.title)??d.collection:null,xe=new Map;for(const G of we.issues){const ne=G.group??"unplaced";xe.set(ne,[...xe.get(ne)??[],G])}return s.jsxs(Fc,{ref:_,children:[ae,le&&W.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",W.folder,", from its issue store."]}):null,s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(lc,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:P1}),s.jsx(fe,{children:q1})]}),X,Z,je?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(GE,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No issues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Issues filed in this repository with the issue command appear here."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(Tt,{ref:C,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:D,onChange:G=>B(G.target.value)}),s.jsxs(Nt,{value:d.owner??ol,onValueChange:G=>P({owner:G===ol?null:G}),children:[s.jsx(yt,{className:"w-56","aria-label":"Owner",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:ol,children:"All owners"}),s.jsxs(De,{value:T3,children:["Unowned (",me,")"]}),W.facets.owners.map(G=>s.jsxs(De,{value:G.key,children:[G.title," (",G.count,")"]},G.key))]})]}),s.jsxs(Nt,{value:d.label??ol,onValueChange:G=>P({label:G===ol?null:G}),children:[s.jsx(yt,{className:"w-48","aria-label":"Label",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:ol,children:"All labels"}),W.facets.labels.map(G=>s.jsxs(De,{value:G.label,children:[G.label," (",G.count,")"]},G.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(qy,{pressed:d.urgent,count:W.facets.urgent,onClick:()=>P({urgent:!d.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"}),U1.map(G=>{const ne=d.seen.includes(G.key);return s.jsx(qy,{pressed:ne,count:W.facets.seen[G.key],onClick:()=>P({seen:ne?d.seen.filter(se=>se!==G.key):[...d.seen,G.key]}),children:G.label},G.key)}),$e!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:oe(Zd({variant:"outline",size:"sm"}),nM),children:["Collection ",$e]}),s.jsx(V,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var G;P({collection:null}),(G=C.current)==null||G.focus()},children:s.jsx(Vd,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:te?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(hn,{"aria-hidden":"true"}),"Searching…"]}):h&&we.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[we.total," of ",W.listed," issues ·"," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:E,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":te||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:Se&&we.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(Gd,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(V,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:E,children:"Clear"})]}):s.jsxs(s.Fragment,{children:[!Se&&W.groups.length>0&&W.groups.every(G=>G.key==="resolved")?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm","data-testid":"issues-none-open",children:"No open issues."}):null,W.groups.map(G=>s.jsx(D3,{id:`issues-${G.key}`,title:`${G.label} · ${G.count}`,issues:xe.get(G.key)??[],folder:le,threads:i,fold:Se?void 0:{folded:y3(f,G.key),whole:f.all.includes(G.key),onFold:ne=>I(j3(f,G.key,ne)),onWhole:ne=>I(b3(f,G.key,ne))},link:ne=>s.jsx(c,{className:"text-primary hover:underline",href:o(H(ne.id)),children:ne.title})},G.key))]})}),!h&&W.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 · ",W.collections.length]}),s.jsx(ft,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{className:"w-1/2",children:"Collection"}),s.jsx(K,{className:"w-1/4",children:"Resolved"}),s.jsx(K,{className:"w-1/4",children:"Updated"})]})}),s.jsx(Ye,{children:W.collections.map(G=>s.jsxs(de,{children:[s.jsxs(Y,{children:[s.jsx(c,{className:"text-primary hover:underline",href:o(T(pl({...np,collection:G.collection},f))),children:G.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:G.collection})]}),s.jsxs(Y,{children:[G.resolved," of ",G.total," resolved"]}),s.jsx(Y,{className:"text-muted-foreground",children:mo(G.updated_at)})]},G.collection))})]})})]}):null]})]})}const Fc=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})}),O3={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 qy({pressed:e,count:t,onClick:n,children:a}){const[r,l]=u.useState(!1);return s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:fo,"aria-pressed":e,disabled:t===0&&!e&&!r,onFocus:()=>l(!0),onBlur:()=>l(!1),onClick:n,children:[a," ",t]})}function D3({id:e,title:t,issues:n,folder:a,link:r,threads:l,fold:i}){const o=O3[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>Ch,h=m?n.slice(0,Ch):n,x=f?Hd:rc,[y,v]=u.useState(!1),j=i!==void 0&&(m||i.whole&&n.length>Ch||y);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(V,{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(z3,{title:t,issues:h,folder:a,link:r,threads:l,widths:o,columns:c}),i&&j?s.jsx(V,{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 z3({title:e,issues:t,folder:n,link:a,threads:r,widths:l,columns:i}){return s.jsx(s.Fragment,{children:s.jsx(ft,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:e,className:oe("table-fixed",r&&"min-w-5xl"),children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{className:l.title,children:"Title"}),s.jsx(K,{className:l.issue,children:"Issue"}),n?s.jsx(K,{className:l.project,children:"Project"}):null,s.jsx(K,{className:l.status,children:"Status"}),s.jsx(K,{className:l.urgent,children:"Urgent"}),s.jsx(K,{className:l.owner,children:"Owner"}),s.jsx(K,{className:l.updated,children:"Updated"}),r?s.jsx(K,{className:"w-[14%] text-right",children:"Actions"}):null]})}),s.jsx(Ye,{children:t.map(o=>s.jsx(L3,{issue:o,folder:n,link:a,threads:r,columns:i},o.id))})]})})})}function L3({issue:e,folder:t,link:n,threads:a,columns:r}){var d;const{button:l,panel:i}=vf({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=B1(e),c=[e.reported_by_you?"you reported":"",e.standing??""].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs(de,{"data-testid":"issues-row",className:i?"border-b-0":void 0,children:[s.jsxs(Y,{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(ue,{variant:"neutral",size:"dense",children:f},f))}):null]}),s.jsx(Y,{className:"font-mono text-xs",children:e.id}),t?s.jsx(Y,{className:"break-words",children:e.project_id??"Folder"}):null,s.jsx(Y,{children:s.jsx(ue,{variant:o.tone,children:o.label})}),s.jsx(Y,{children:e.urgent&&e.status!=="resolved"&&e.group!=="resolved"?s.jsx(ue,{variant:"warning",children:"Urgent"}):null}),s.jsx(Y,{className:"break-words",children:e.owner_title?e.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(Y,{className:"text-muted-foreground",children:mo(e.updated_at)}),a?s.jsx(Y,{className:"text-right whitespace-nowrap",children:l}):null]}),i?s.jsx(de,{"data-testid":"issues-row-panel",className:"hover:bg-transparent",children:s.jsx(Y,{colSpan:r,className:"pt-0",children:s.jsx("div",{className:"max-w-180 pl-4 text-left whitespace-normal",children:i})})}):null]})}function U3(e){var t;return(t=pn().issues)!=null&&t.issueSections?s.jsx(M3,{...e}):s.jsx(u3,{org:e.org,project:e.project,query:e.query})}function B3({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),[y,v]=u.useState(null),[j,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=y==null?void 0:y.personal_data)==null?void 0:C.field)===S?y.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(Tn,{open:n,onOpenChange:a,children:s.jsx(An,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[s.jsxs($n,{children:[s.jsx(On,{children:"Edit issue"}),s.jsx(Dn,{children:"Text is shown exactly as entered."})]}),y!=null&&y.conflict?s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{}),s.jsx(fe,{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(Ie,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(Tt,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:S=>o(S.target.value)}),p("title")?s.jsx(Ns,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(ts,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:S=>d(S.target.value)}),p("description")?s.jsx(Ns,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(Tt,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:S=>m(S.target.value)}),p("external_reference")?s.jsx(Ns,{children:p("external_reference")}):null]}),y&&!y.conflict&&!y.personal_data?s.jsx(Ns,{children:y.message}):null,s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),y!=null&&y.conflict?s.jsxs(V,{type:"button",variant:"outline",onClick:w,children:[s.jsx(Xr,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(V,{type:"submit",loading:j,disabled:!!(y!=null&&y.conflict),children:"Save"})]})]})})})}function Gy(e){return e.map(t=>O1[t].toLowerCase()).join(", ")}function I3(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${Gy(e.fields)}`;case"redacted":return`Redacted the ${Gy(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${zo[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?dd[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${mg[e.resolution_reason]}`:`Moved to ${t}`}}}function Vy(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function H3({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),[y,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(Vy(t,i)),x(null))},[n]);const j=async g=>{g.preventDefault(),m(!0);const p=await e(y.id,y.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(Tn,{open:n,onOpenChange:a,children:s.jsx(An,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:j,className:"grid gap-4",children:[s.jsxs($n,{children:[s.jsx(On,{children:"Redact text"}),s.jsx(Dn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(Nt,{value:i,onValueChange:g=>{const p=g;o(p),d(Vy(y,p))},children:[s.jsx(yt,{id:"maintain-redact-field",children:s.jsx(kt,{})}),s.jsx(jt,{children:e3.map(g=>s.jsx(De,{value:g,children:O1[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(ts,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(ce,{variant:"warning",children:[s.jsx(tn,{}),s.jsx(fe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),h?s.jsx(Ns,{children:h}):null,s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function P3({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(Tn,{open:n,onOpenChange:a,children:s.jsx(An,{children:s.jsxs("form",{onSubmit:m,className:"grid gap-4",children:[s.jsxs($n,{children:[s.jsx(On,{children:"Resolve issue"}),s.jsx(Dn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(Nt,{value:l,onValueChange:h=>i(h),children:[s.jsx(yt,{id:"maintain-resolution-reason",children:s.jsx(kt,{})}),s.jsx(jt,{children:Jz.map(h=>s.jsx(De,{value:h,children:mg[h]},h))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(Ns,{children:d}):null,s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(V,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const cl="not_set";function q3({org:e,project:t,issue_id:n,query:a}){const r=D1(),l=z1(r),i=ep(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(L1,{access:l,header:s.jsx(nn,{title:"Support"}),back_href:i,children:o=>r?s.jsx(G3,{contract:r,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function G3({contract:e,issue_id:t,access:n,list_href:a,duplicates:r}){const{href:l,Link:i}=Fe(),o=Fr(),[c,d]=u.useState(null),[f,m]=u.useState([]),[h,x]=u.useState(!1),[y,v]=u.useState([]),[j,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(or,{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(nn,{title:c.title,actions:S?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(V,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(qd,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(V,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(CE,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(V,{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(V,{onClick:()=>g("resolve"),children:[s.jsx(Pd,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(V,{variant:"outline",onClick:()=>void C("open"),children:[s.jsx(xT,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(V,{onClick:()=>void C("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ue,{variant:M1[c.status],children:dd[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",s3(c)," ",pu(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(ce,{variant:"info",children:[s.jsx(Rn,{}),s.jsxs(fe,{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(V,{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(Ve,{children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"When"}),s.jsx(K,{children:"Who"}),s.jsx(K,{children:"What"})]})}),s.jsx(Ye,{children:f.map(_=>s.jsxs(de,{children:[s.jsx(Y,{className:"text-muted-foreground",children:pu(_.created_at)}),s.jsx(Y,{children:a3(_,c)}),s.jsx(Y,{children:I3(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(Ui,{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(Ui,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:mg[c.resolution_reason]})}):null,s.jsx(Ui,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(Nt,{value:c.priority??cl,disabled:!S||w,onValueChange:_=>void b(e.update(c.id,c.revision,{priority:_===cl?null:_})),children:[s.jsx(yt,{id:"maintain-issue-priority",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:cl,children:"Not set"}),hg.map(_=>s.jsx(De,{value:_,children:zo[_]},_))]})]})}),s.jsxs(Ui,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(Nt,{value:c.assignee_id??cl,disabled:!S||w,onValueChange:_=>void b(e.assign(c.id,c.revision,_===cl?null:_)),children:[s.jsx(yt,{id:"maintain-issue-assignee",children:s.jsx(kt,{})}),s.jsxs(jt,{children:[s.jsx(De,{value:cl,children:"Not set"}),c.assignee_id&&!y.some(_=>_.user_id===c.assignee_id)?s.jsx(De,{value:c.assignee_id,children:pg(c.assignee_id,c.assignee_username)}):null,y.map(_=>s.jsx(De,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(ue,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(Ui,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:pu(c.updated_at)})})]})]}),s.jsx(B3,{update:e.update,issue:c,open:j==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(H3,{redact:e.redact,issue:c,open:j==="redact",onOpenChange:_=>g(_?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(P3,{transition:e.transition,issue:c,open:j==="resolve",onOpenChange:_=>g(_?"resolve":null),onDone:_=>{g(null),_||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function Ui({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 V3=10,Y3=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Yy=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function F3(e,t,n,a=""){const r=n!=null&&n.startsWith("task:")?n.slice(5):null;if(r&&Y3.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&&Yy.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&&Yy.test(o))return{label:o,path:`${l}?planned=${encodeURIComponent(o)}`};const c=pl(xu(a),H1(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const K3=["Fixed in","Being fixed in","The release planned to fix it"];function X3(e){const t=e.filter(n=>n.kind==="release");for(const n of K3){const a=t.find(r=>r.relation===n);if(a)return a}return t[0]??null}function W3(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 Q3(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 Z3({org:e,project:t,issue_id:n,from:a,query:r=""}){var gn,Pt,cn;const l=V1(),{href:i,Link:o}=Fe(),c=F3(e,t,a,r),d=`/proj/${encodeURIComponent(t)}/issues`,f=L=>`${d}/${encodeURIComponent(L)}`,m=L=>`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(L)}`,h=L=>`/proj/${encodeURIComponent(t)}/releases?${L.planned?"planned":"release"}=${encodeURIComponent(L.id)}`,[x,y]=u.useState({state:"loading"}),[v,j]=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=u.useRef(0),D=u.useCallback(async L=>{if(!l.openAnchor)return;const he=L.kind==="file"?L.path:L.sha,ge=O.current+=1;N({value:he,state:"opening",words:`Opening ${he}…`});const ct=await l.openAnchor(L);ge===O.current&&N(ct.ok?{value:he,state:"opened",words:`Opened ${he} in ${ct.data.with}`}:{value:he,state:"failed",words:`Could not open ${he}: ${ct.refusal.message}`})},[l]);u.useEffect(()=>{O.current+=1,N(null)},[n]);const B=u.useRef(null),P=es(),I=u.useRef(null),A=u.useRef(!1),$=u.useRef(0),R=u.useRef(0),E=u.useRef(!1),k=ps(),M=u.useRef(0),F=u.useRef(0),T=u.useCallback(async(L=!1)=>{if(!l.issueSections)return;const he=M.current+=1;L||w({state:"loading"});const ge=await k.track(l.issueSections(n));he===M.current&&w(ct=>ge.ok?{state:"ok",data:ge.data}:L&&ct.state==="ok"?ct:{state:"failed",refusal:ge.refusal})},[l.issueSections,n,k]),H=u.useCallback(async(L=!1)=>{if(!l.issueRelated)return;const he=F.current+=1;L||C({state:"loading"});const ge=await k.track(l.issueRelated(n));he===F.current&&C(ct=>ge.ok?{state:"ok",data:ge.data}:L&&ct.state==="ok"?ct:{state:"failed",refusal:ge.refusal})},[l.issueRelated,n,k]),X=u.useCallback(async(L=!1)=>{const he=R.current+=1;if(p(null),!m3.test(n)){y({state:"missing"});return}T(L),H(L);const ge=await k.track(l.issue(n));if(he!==R.current)return;if(ge.ok){$.current=0,j(null),y({state:"ok",issue:ge.data.issue,events:ge.data.events,at:new Date().toISOString()});return}const ct=ge.refusal.reason;if(ge.refusal.status===404||ct==="not_found")return y({state:"missing"});if(ct==="engine_missing")return y({state:"engine_missing",refusal:ge.refusal});if(ct==="view_outdated")return y({state:"view_outdated"});if($.current+=1,$.current===1&&A1(ge.refusal)){E.current=L,p(ge.refusal.retry_after??V3);return}j(ge.refusal)},[l.issue,n,T,H,k]);u.useEffect(()=>{X()},[X]);const Z=u.useMemo(()=>yf(k,()=>void X(!0)),[X,k]);rr(Z,G1),u.useEffect(()=>{if(g===null)return;const L=setTimeout(()=>{document.visibilityState==="visible"&&X(E.current)},g*1e3);return()=>clearTimeout(L)},[g,X]),u.useEffect(()=>{var he;if(A.current||x.state!=="ok")return;A.current=!0;const L=(he=B.current)==null?void 0:he.querySelector("h1");L&&(L.tabIndex=-1,L.focus())},[x.state]);const ae=u.useRef(null);u.useEffect(()=>{var ge;const L=ae.current;if(L===null||(L==="sections"?b:S).state==="loading")return;ae.current=null;const he=(L==="related"?I.current:null)??((ge=B.current)==null?void 0:ge.querySelector("h1"));he==null||he.focus()},[b,S]);const we=L=>{ae.current=L,L==="sections"?T():H()},W=()=>{$.current=0,X()},te=dg(B),Se=u.useRef(!1),le=()=>{Se.current=!0,W()};u.useEffect(()=>{var he;if(!Se.current||x.state==="loading"||g!==null)return;Se.current=!1;const L=(he=B.current)==null?void 0:he.querySelector("h1");L&&(L.tabIndex=-1,L.focus())},[x,v,g]);const je=vf({org:e,labelled:!0,action:(gn=l.commands)!=null&&gn.open_thread&&x.state==="ok"?x.issue.local_action:void 0,task_id:null,issue:n,open_thread:(Pt=l.commands)==null?void 0:Pt.open_thread});if(x.state==="missing")return s.jsx(Ha,{children:s.jsx(or,{icon:s.jsx(Gd,{"aria-hidden":"true"}),title:"Issue not found",description:`No issue ${n} in this repository's issue store.`,backHref:i(a==="issues"?c.path:d),backLabel:"Back to issues",link:o})});const me=s.jsx(V,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx($0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(x.state==="engine_missing"||x.state==="view_outdated")return s.jsx(Ha,{children:x.state==="engine_missing"?s.jsx(ea,{page:"Issue",header:s.jsx(ho,{back:me,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(ho,{back:me,id:null,title:n}),s.jsxs(ce,{variant:"warning",className:"mt-4",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{children:P})]})]})});const $e=v?s.jsxs(ce,{ref:te,variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This issue could not be loaded"}),s.jsxs(fe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${hs(v.since)}.`:"",x.state==="ok"?` This page was read at ${hs(x.at)}.`:"",v.message.includes(Lr)?"":` ${Lr}`]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:le,children:"Retry"})]})]}):null,xe=s.jsx("div",{role:"status","aria-live":"polite",children:g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(hn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(x.state==="loading")return s.jsxs(Ha,{children:[s.jsx("div",{children:me}),xe,$e,!v&&g===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(bt,{className:"h-6 w-40"}),s.jsx(bt,{className:"h-9 w-2/3"}),s.jsx(bt,{className:"h-24 w-full"})]}):null]});const{issue:Ce,events:J,at:G}=x,ne=B1(Ce),se=b.state==="ok"?b.data:null,Ke=(se==null?void 0:se.reporter)??Ce.created_by_username??null,Xe=S.state==="ok"?X3(S.data):null,rt=Ce.status==="resolved"||Ce.group==="resolved",ye=!!(se!=null&&se.duplicate_of),tt=(se==null?void 0:se.routing.owner)??Ce.owner_title??null,It=tt&&S.state==="ok"?W3(S.data,tt):null,Ht=b.state==="loading"?"Loading…":It?s.jsx(o,{className:"text-primary hover:underline",href:i(m(It.id)),children:tt}):tt??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),Kt=L=>`${d}?${xg({...np,collection:L})}`,Le=se==null?void 0:se.report,zn=!!(Le&&(Le.actual||Le.expected||Le.steps.length||Le.where)),Xt=[...J].reverse(),on=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[je.button,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",hs(G)]}),s.jsxs(V,{type:"button",variant:"ghost",size:"sm",onClick:W,children:[s.jsx(Xr,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(Ha,{children:s.jsxs("div",{ref:B,className:"contents",children:[s.jsx(ho,{back:me,id:Ce.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:ne.tone,children:ne.label}),Ce.urgent&&!rt?s.jsx(ue,{variant:"warning",children:"Urgent"}):null]}),title:Ce.title,created:`Reported${Ke?` by ${Ke}`:""} · ${mo(Ce.created_at)}`,actions:on}),se!=null&&se.duplicate_of?s.jsxs("p",{className:"mt-1 text-sm",children:["Duplicate of"," ",s.jsx(o,{className:"text-primary font-mono hover:underline",href:i(f(se.duplicate_of)),children:se.duplicate_of})]}):null,je.panel?s.jsx("div",{className:"mt-1 max-w-180",children:je.panel}):null,xe,$e,b.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(hn,{"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(Hs,{label:"Owner",value:Ht}),ye?null:s.jsx(Hs,{label:"Release",value:S.state==="loading"?"Loading…":Xe?s.jsx(o,{className:oe("text-primary hover:underline",Xe.label===Xe.id&&"font-mono"),href:i(h(Xe)),children:Xe.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(Hs,{label:"Reported",value:[Ke,Ce.created_at?ms(Ce.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(lc,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:P1}),s.jsx(fe,{children:q1})]}),b.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(fg,{what:"this issue's sections",again:"Read the issue again",refusal:b.refusal,on_retry:()=>we("sections")})}):null,se&&zn&&Le?s.jsxs($t,{id:"issue-report",title:"What happens",children:[Le.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:Le.actual}):null,Le.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:Le.expected})]}):null,Le.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:Le.steps.map((L,he)=>s.jsx("li",{children:L},he))})]}):null,(cn=Le.where)!=null&&cn.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",Le.where.env,Le.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:Le.where.sha})]}):null]}):null]}):null,se&&(se.placement.placed||se.placement.unplaced_why)?s.jsx($t,{id:"issue-placement",title:"Placement",children:se.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",se.placement.placed]}):s.jsxs(ce,{variant:"warning",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:["Not placed yet: ",se.placement.unplaced_why]})]})}):null,se&&(se.routing.route||se.routing.owner||se.routing.none)?s.jsxs($t,{id:"issue-routing",title:"Routing",children:[se.routing.route?s.jsx("p",{className:"text-sm",children:se.routing.route}):null,se.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",se.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,se&&(se.labels.length>0||se.collections.length>0)?s.jsxs($t,{id:"issue-labels",title:"Labels and collections",children:[se.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:se.labels.map(L=>s.jsx(ue,{variant:"neutral",size:"dense",children:L},L))}):null,se.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:se.collections.map(L=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(Kt(L.collection)),children:L.title}),L.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",L.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",L.resolved," of ",L.total," resolved"]})]},L.collection))}):null]}):null,se&&se.anchors.length>0?s.jsxs($t,{id:"issue-anchors",title:"Anchors",children:[s.jsx(Rh,{label:"Anchors",heads:["Kind","Value","By"],rows:se.anchors.map(L=>{const he=l.openAnchor?Q3(L.kind,L.value):null;return[L.kind,he?s.jsx(V,{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 ${L.value}`:`Show commit ${L.value}`,onClick:()=>void D(he),children:L.value}):s.jsx("span",{className:"font-mono text-xs break-all",children:L.value}),L.by??""]})}),l.openAnchor?s.jsx("p",{role:"status","aria-live":"polite","data-testid":"issue-anchor-status",className:oe("mt-2 text-sm empty:hidden",(_==null?void 0:_.state)==="failed"?"text-destructive":(_==null?void 0:_.state)==="opened"?"text-success":"text-muted-foreground"),children:(_==null?void 0:_.words)??""}):null]}):null,se&&se.seen.length>0?s.jsx($t,{id:"issue-seen",title:"Seen",aside:`${se.seen.length} of ${Math.max(Ce.occurrences??0,se.seen.length)} sightings`,children:s.jsx(Rh,{label:"Seen",heads:["When","Where","Who","Note"],rows:se.seen.map(L=>[mo(L.at),s.jsxs(s.Fragment,{children:[L.sha?s.jsx("div",{className:"font-mono text-xs",children:L.sha}):null,L.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:L.env}):null]}),L.who??"",L.note??""])})}):null,Xt.length>0?s.jsx($t,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(Rh,{label:"History",heads:["When","Who","What"],rows:Xt.map(L=>[mo(L.created_at),L.actor_username??"",S3(L.note,L.kind)])})}):null,s.jsx($1,{id:"issue-related",related:S,heading_ref:I,on_retry:()=>we("related"),fixed:!0,link:L=>{const he=L.kind==="thread"?m(L.id):L.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(L.id)}?from=issue:${Ce.id}`:L.kind==="issue"?f(L.id):L.kind==="release"?h(L):null;if(L.kind==="task"&&he){const ge=C3(L.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:L.id}),ge&&ge!==L.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:ge,"data-testid":"related-task-title",children:ge}):null]})}return he?s.jsx(o,{className:oe("text-primary hover:underline",L.kind!=="thread"&&L.label===L.id&&"font-mono"),href:i(he),children:L.label}):L.label}})]})})}function Rh({label:e,heads:t,rows:n}){return s.jsx(ft,{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:e,children:[s.jsx(et,{children:s.jsx(de,{children:t.map(a=>s.jsx(K,{children:a},a))})}),s.jsx(Ye,{children:n.map((a,r)=>s.jsx(de,{children:a.map((l,i)=>s.jsx(Y,{className:"break-words",children:l},i))},r))})]})})}function J3({org:e,project:t,issue_id:n,from:a,query:r}){var l;return(l=pn().issues)!=null&&l.issueSections?s.jsx(Z3,{org:e,project:t,issue_id:n,from:a,query:r}):s.jsx(q3,{org:e,project:t,issue_id:n,query:r})}const Xs={label:"Stalled",tone:"error"},eL="A stalled turn passes on at the next queue command.",tL=e=>e.charAt(0).toUpperCase()+e.slice(1);function nL(e){return e==="starts now"?"Now":e==="rides the same deploy"?"With the same deploy":tL(e.replace(/^starts /,""))}const sL=e=>e.replace(/ after its turn came$/," after its turn"),Y1={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},aL={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},rL={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 iL(e){return lL[e??"in_batch"]}function oL(e,t=!1){if(t)return Xs;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 F1=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function cL(e,t,n,a=!0,r=!1){return r?Xs:e.fixing_since!==void 0?{label:`Fixing forward since ${kn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:F1(n),tone:"info"}:{label:"Running",tone:"info"}}function kn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function ul(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 uL(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 dL(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 fL(e,t){var o,c;const{policy:n,management:a}=e,r=(o=e.layer)==null?void 0:o.kind,l=d=>dL(d,t),i=[["Mode",rL[a.mode]],["Who can join",l(a.joiners)]];return r==="implement"&&i.push(["Managers",l(a.managers)],["Manager lease",ul(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 ${ul(n.freeze.max_seconds)}, ${ul(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 ${ul(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",ul(n.lease_seconds)],["Time to start",`${ul(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 fd="heavy",K1="Heavy checks",hL="Every worktree, admitted by memory",mL="Typechecks, builds, test suites and dev servers from every worktree of this repository wait here for memory.",pL="A smaller turn may pass one that does not fit, so the order can change; a passing turn reused on identical code never waits.",xL="Heavy checks are admitted by this machine's memory; there are no settings here.",X1="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",W1="A task you cannot see",gL="A former member",vL="A member";function Q1(){const e=pn().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function yL({org:e,open:t,path:n}){var m,h;const a=Q1(),{href:r,Link:l}=Fe(),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(or,{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(bL,{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(ea,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(nn,{title:"Queues",description:a.description??X1}),o.state==="loading"&&s.jsx(Z1,{}),(o.state==="error"||o.state==="off")&&s.jsx(gu,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Tasks are not on for this organization"}),s.jsxs(fe,{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 Z1(){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(bt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function gu({refusal:e,on_retry:t}){const n=es();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"The local stores are busy"}),s.jsxs(fe,{children:[s.jsx("p",{children:e.message}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(ce,{variant:"warning",className:"mt-6",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{children:n})]}):s.jsxs(ce,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Queues could not be loaded"}),s.jsxs(fe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Eh=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function jL(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${kn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${kn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function bL({org:e,open:t,path:n}){var Ce;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}=Q1(),{self_id:x}=Id(),y=!!h&&t===fd,[v,j]=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 J=!0;return l().then(G=>{J&&N(ne=>G.ok?{state:"answered",members:G.data}:{state:"failed",members:ne.members})}),()=>{J=!1}},[l]);const O=u.useMemo(()=>new Map(_.members.map(J=>[J.user_id,J])),[_.members]),D=_.state==="answered"?gL:vL,B=u.useCallback((J,G)=>{var ne;return(G==null?void 0:G.title)??(m?(G==null?void 0:G.id)??J:J===x?"You":((ne=O.get(J))==null?void 0:ne.label)??D)},[O,D,x,m]),P=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[I,A]=u.useState(null),[$,R]=u.useState(!1),E=u.useCallback((J,G)=>{P.current[J]={last:G,fresh:!0};const{list:ne,detail:se}=P.current;R(ne.last==="failed"||se.last==="failed"),ne.fresh&&se.fresh&&ne.last==="ok"&&se.last==="ok"&&A(Date.now()/1e3)},[]),k=t??((Ce=v==null?void 0:v.queues[0])==null?void 0:Ce.id)??null,M=u.useRef(k);u.useEffect(()=>{M.current=k},[k]);const F=u.useRef(0),T=u.useCallback(async()=>{var ne;const J=F.current+=1;P.current.list.fresh=!1;const G=await a();if(J===F.current)if(G.ok){if(j(G.data),p(null),!t){const se=((ne=G.data.queues[0])==null?void 0:ne.id)??null;se===null?P.current.detail={last:"ok",fresh:!0}:se!==M.current&&(P.current.detail.fresh=!1)}E("list","ok")}else p(G.refusal),E("list","failed")},[a,t,E]),H=u.useRef(0),X=u.useCallback(async()=>{const J=H.current+=1;if(!k)return;if(y){P.current.detail.fresh=!1;return}P.current.detail.fresh=!1;const G=await r(k);J===H.current&&(G.ok?(w(G.data),C(null),E("detail","ok")):(C(G.refusal),Eh(G.refusal)&&w(null),E("detail",Eh(G.refusal)?"ok":"failed")))},[y,k,r,E]),[Z,ae]=u.useState({state:"pending",data:null}),we=u.useRef(0),W=u.useCallback(async()=>{if(!h)return;const J=we.current+=1,G=await h();J===we.current&&(ae(G.ok?{state:"answered",data:G.data}:{state:"failed",data:null}),y&&E("detail",G.ok?"ok":"failed"))},[h,y,E]);u.useEffect(()=>{T()},[T]),u.useEffect(()=>{w(null),C(null),X()},[X]),u.useEffect(()=>{W()},[W]);const te=u.useCallback(()=>{T(),X(),W()},[T,X,W]),Se=u.useMemo(()=>{var J;return new Map((((J=Z.data)==null?void 0:J.queues)??[]).map(G=>[G.key,G]))},[Z.data]),le=Se.get(fd),je=!v&&(g==null?void 0:g.reason)==="engine_missing",me=u.useCallback(()=>{je||te()},[je,te]);if(rr(me,i),je)return s.jsx(ea,{page:"Queues"});const $e=Math.round(i/1e3),xe=S!==null&&Eh(S);return s.jsxs(s.Fragment,{children:[s.jsxs(nn,{title:"Queues",description:c??X1,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:jL(I,$,$e,d)}),s.jsx("span",{className:"sr-only",role:"status",children:$?"Not reading":I===null?"Connecting":"Live"})]}),!v&&!g&&s.jsx(Z1,{}),!v&&g&&s.jsx(gu,{refusal:g,on_retry:te}),v&&v.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(L0,{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(kL,{path:n,queues:v.queues,open_id:k,name:B,held:m,timing_of:Se,heavy:le}),y?le?s.jsx(RL,{org:e,timing:le}):Z.data?s.jsxs(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Heavy checks are not available"}),s.jsx(fe,{children:"This checkout reads no heavy queue. Pick another queue above."})]}):Z.state==="failed"?s.jsx(gu,{on_retry:()=>void W()}):s.jsx(bt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"}):xe?s.jsxs(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This queue is no longer available"}),s.jsx(fe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):b&&b.queue.id===k?s.jsx(EL,{org:e,detail:b,name:B,settings_note:o,subject_label:f,thread_subjects:m,timing:Se.get(b.queue.id)}):S?s.jsx(gu,{refusal:S,on_retry:()=>void X()}):s.jsx(bt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function hd({org:e,subject:t,link:n}){const{href:a,Link:r}=Fe();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:W1}):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 wL(e,t,n){const a=e.freeze?`frozen until ${kn(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 ${kn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const r=e.turn.subject,l=r.hidden?W1: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?F1(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:Za(d.join(" · ")),warn:!1}:{primary:`${i}${l}${o}`,secondary:d.length?Za(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Za(a):null,warn:!!a}}const Za=e=>e.charAt(0).toUpperCase()+e.slice(1),J1=e=>(e==null?void 0:e.rows.filter(t=>t.turn===Xs.label).length)??0;function _L({timing:e}){return e!=null&&e.clears?s.jsx("div",{className:"text-muted-foreground text-xs",children:Za(e.clears)}):null}function NL({timing:e}){const t=J1(e);return t?s.jsx(ue,{variant:Xs.tone,children:`${t} stalled`}):null}function kL({path:e,queues:t,open_id:n,name:a,held:r,timing_of:l,heavy:i}){const{href:o,Link:c}=Fe();return s.jsx(ft,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Queues",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Queue"}),s.jsx(K,{className:"hidden md:table-cell",children:"Step"}),s.jsx(K,{children:"Running turn"}),s.jsx(K,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsxs(Ye,{children:[t.map(d=>{var v;const f=d.id===n,m=uL(d),h=wL(d,a,r),x=d.waiting-(((v=d.batch)==null?void 0:v.remaining)??0),y=l.get(d.id);return s.jsxs(de,{"data-testid":"queues-row",className:oe(f&&"bg-accent"),children:[s.jsxs(Y,{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(Y,{className:"hidden md:table-cell",children:s.jsx(ue,{variant:"neutral",children:Y1[d.policy.step]})}),s.jsxs(Y,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:oe(!d.batch&&!d.turn&&"text-muted-foreground"),children:h.primary}),s.jsx(NL,{timing:y})]}),h.secondary?s.jsx("div",{className:oe("text-xs",h.warn?"text-warning":"text-muted-foreground"),children:h.secondary}):null,s.jsx(_L,{timing:y})]}),s.jsx(Y,{className:"hidden text-right md:table-cell",children:x})]},d.id)}),i?s.jsx(SL,{path:e,timing:i,current:n===fd}):null]})]})})}const sp=e=>e.turn==="Running";function SL({path:e,timing:t,current:n}){const{href:a,Link:r}=Fe(),l=t.rows.filter(sp).length,i=t.rows.length-l,o=t.error?"Not available":l?[`${l} running`,t.memory].filter(Boolean).join(" · "):"Nothing running";return s.jsxs(de,{"data-testid":"queues-row",className:oe(n&&"bg-accent"),children:[s.jsxs(Y,{children:[s.jsx(r,{className:"text-primary hover:underline",href:a(`${e}?queue=${fd}`),"aria-current":n?"page":void 0,children:K1}),s.jsx("div",{className:"text-muted-foreground text-xs",children:hL}),t.error?null:s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[i," waiting"]})]}),s.jsx(Y,{className:"hidden md:table-cell",children:s.jsx(ue,{variant:"neutral",children:"Checks"})}),s.jsxs(Y,{children:[s.jsx("div",{className:oe(!l&&"text-muted-foreground"),children:o}),!l&&!t.error&&t.memory?s.jsx("div",{className:"text-muted-foreground text-xs",children:Za(t.memory)}):null]}),s.jsx(Y,{className:"hidden text-right md:table-cell",children:t.error?"—":i})]})}function CL(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 ap="No estimate yet";function eS(e){return e?e.turn===Xs.label?e.elapsed:[e.elapsed,e.estimate].filter(Boolean).join(" · "):ap}function tS(e){return e?e.turn===Xs.label?sL(e.elapsed):e.estimate?nL(e.estimate):ap:ap}function Rl({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(Ve,{containerAriaLabel:i,children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:r}),s.jsx(K,{children:"State"}),o?s.jsx(K,{children:"Time"}):null]})}),s.jsx(Ye,{children:t.map(c=>{const d=o==null?void 0:o(c),f=cL(c,n,a,l,(d==null?void 0:d.turn)===Xs.label);return s.jsxs(de,{"data-testid":"queues-running",children:[s.jsxs(Y,{children:[s.jsx(hd,{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(Y,{children:s.jsx(ue,{variant:f.tone,children:f.label})}),o?s.jsx(Y,{className:"text-muted-foreground text-xs",title:d==null?void 0:d.basis,children:eS(d)}):null]},c.ref)})})]})})}function Ky({org:e,row:t}){return t.key?s.jsx(hd,{org:e,subject:{kind:"thread",id:t.key,title:t.title},link:!1}):s.jsx("span",{children:t.title})}function Xy({command:e}){return e?s.jsx("span",{className:"block max-w-xs truncate font-mono text-xs",title:e,children:e}):null}function RL({org:e,timing:t}){const n=t.rows.filter(sp),a=t.rows.filter(r=>!sp(r));return s.jsxs(ft,{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:K1}),s.jsx("p",{className:"text-muted-foreground text-sm",children:mL}),t.memory&&!t.error?s.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:Za(t.memory)}):null,s.jsx("p",{className:"text-muted-foreground text-xs",children:pL})]}),t.error?s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Heavy checks could not be read"}),s.jsx(fe,{children:Za(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(Rl,{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(Ve,{containerAriaLabel:"Running turns",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Thread"}),s.jsx(K,{className:"hidden md:table-cell",children:"Command"}),s.jsx(K,{className:"hidden text-right md:table-cell",children:"Memory"}),s.jsx(K,{children:"Time"})]})}),s.jsx(Ye,{children:n.map(r=>s.jsxs(de,{"data-testid":"queues-running",children:[s.jsxs(Y,{children:[s.jsx(Ky,{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(Y,{className:"hidden md:table-cell",children:s.jsx(Xy,{command:r.command})}),s.jsx(Y,{className:"hidden text-right tabular-nums md:table-cell",children:r.memory}),s.jsx(Y,{className:"text-muted-foreground text-xs",title:r.basis,children:eS(r)})]},r.position))})]})})}),s.jsx(Rl,{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(Ve,{containerAriaLabel:"Waiting entries",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Position"}),s.jsx(K,{children:"Thread"}),s.jsx(K,{className:"hidden md:table-cell",children:"Command"}),s.jsx(K,{className:"hidden text-right md:table-cell",children:"Memory"}),s.jsx(K,{children:"Turn"}),s.jsx(K,{children:"Starts"}),s.jsx(K,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ye,{children:a.map(r=>{const l=r.turn===Xs.label?Xs:{label:r.turn,tone:r.turn==="Next"?"info":"neutral"};return s.jsxs(de,{"data-testid":"queues-waiting",children:[s.jsx(Y,{children:r.position}),s.jsxs(Y,{children:[s.jsx(Ky,{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(Y,{className:"hidden md:table-cell",children:s.jsx(Xy,{command:r.command})}),s.jsx(Y,{className:"hidden text-right tabular-nums md:table-cell",children:r.memory}),s.jsx(Y,{children:s.jsx(ue,{variant:l.tone,children:l.label})}),s.jsx(Y,{className:"text-muted-foreground text-xs",title:r.basis,children:tS(r)}),s.jsx(Y,{className:"hidden md:table-cell",children:r.reason?Za(r.reason):""})]},r.position)})})]})})})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:xL})]})}function EL({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?CL(i):void 0,f=J1(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"),y=c.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),v=c.batch,j=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&&y.length===0;return s.jsxs(ft,{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(ue,{variant:"neutral",children:Y1[o.policy.step]}),s.jsx(ue,{variant:"neutral",children:aL[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:eL}):null]}),p?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(ET,{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 ",kn(p.lease_until),p.serving_until!==void 0?" · serving now":""]})]}):null,b?s.jsxs(ce,{variant:"warning",children:[s.jsx(_T,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:["Frozen until ",kn(b.lease_until)]}),s.jsxs(fe,{children:[n(b.holder,b.holder_subject)," froze this queue at ",kn(b.since),b.label?`: ${b.label}`:"",". Only ",n(b.holder,b.holder_subject),"'s entries start until it thaws."]})]}):null,S?s.jsxs(ce,{variant:"info",children:[s.jsx(U0,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:["Stall hold until ",kn(S.until)]}),s.jsxs(fe,{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(Rl,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(v.holder,v.holder_subject)} at ${kn(v.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Ve,{containerAriaLabel:"Batch members",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Landing order"}),s.jsx(K,{children:r}),s.jsx(K,{children:"Outcome"})]})}),s.jsx(Ye,{children:v.members.map((N,O)=>{const D=iL(N.outcome);return s.jsxs(de,{"data-testid":"queues-member",children:[s.jsx(Y,{children:O+1}),s.jsx(Y,{children:s.jsx(hd,{org:e,subject:N.subject??h.get(N.ref)??(l?{kind:"thread",id:N.ref}:void 0),link:!l})}),s.jsx(Y,{children:s.jsx(ue,{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(Rl,{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(Rl,{id:"queue-waiting",title:"Waiting",children:y.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(Ve,{containerAriaLabel:"Waiting entries",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Position"}),s.jsx(K,{children:r}),s.jsx(K,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(K,{children:"Turn"}),d?s.jsx(K,{children:"Starts"}):null,s.jsx(K,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(Ye,{children:y.map((N,O)=>{const D=d==null?void 0:d(N),B=oL(N,(D==null?void 0:D.turn)===Xs.label),P=N.subject.hidden?"":N.note??"";return s.jsxs(de,{"data-testid":"queues-waiting",children:[s.jsx(Y,{children:v?j+O+1:N.position}),s.jsx(Y,{children:s.jsx(hd,{org:e,subject:N.subject,link:!l})}),s.jsx(Y,{className:"hidden md:table-cell",children:kn(N.joined_at)}),s.jsx(Y,{children:s.jsx(ue,{variant:B.tone,children:B.label})}),d?s.jsx(Y,{className:"text-muted-foreground text-xs",title:D==null?void 0:D.basis,children:tS(D)}):null,s.jsx(Y,{className:"hidden md:table-cell",children:P})]},N.ref)})})]})})})]}),s.jsx(Rl,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Ve,{containerAriaLabel:"Queue settings",children:s.jsx(Ye,{children:fL(o,m).map(([N,O])=>s.jsxs(de,{children:[s.jsx(K,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(Y,{children:O})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const Us="__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 Lo=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function Sn({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(Ie,{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 rp({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 Wy({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(hi,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:l=>r(l===!0)}),s.jsx(Ie,{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 sS({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(tn,{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(hi,{id:`${e}-${h}`,className:"mt-0.5",checked:l.has(m.value),onCheckedChange:x=>{const y=new Set(l);x===!0?y.add(m.value):y.delete(m.value),i(y)}}),s.jsx(Ie,{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 Uo({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(ce,{variant:"destructive",role:"alert",children:[s.jsx(bT,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:n}),s.jsxs(fe,{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(V,{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 dr=e=>e.two_factor==="ok";function vi({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(Uo,{context:t,action:a,changing:r,title:`Could not save ${n}`});const i=dr(t)?null:s.jsx(Uo,{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(ce,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),o?s.jsx(ke,{children:o}):null,s.jsx(fe,{children:e.message})]})]})}function aS({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(yt,{id:e,"aria-describedby":l,children:s.jsx(kt,{placeholder:"Choose a team"})}),s.jsxs(jt,{children:[a?s.jsx(De,{value:Us,children:a}):null,r.map(i=>s.jsx(De,{value:i.key,children:i.label||i.key},i.key))]})]})}function yi(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 ji({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(V,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const rS=(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 TL({open:e,chart:t,team:n,save:a,on_close:r,context:l=bi,scope:i="full",parents:o}){var k;const c=l.host==="hosted",[d,f]=u.useState(""),[m,h]=u.useState(""),[x,y]=u.useState(""),[v,j]=u.useState(Us),[g,p]=u.useState({}),{saving:b,refusal:w,set_refusal:S,run:C}=yi(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)??""),y((n==null?void 0:n.description)??""),j((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:Us)),p({}),S(null))},[e,n,S,c,_,o]);const N=M=>{const F=t.teams.find(T=>T.key===M);return F?F.label||F.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,F)=>M.key===_?-1:F.key===_?1:Lo(M,F)),B=n?n.label||n.key:"",P=i==="description",I=!dr(l),A=n?P?"save the description":"save the team":"add the team",$=M=>{if(M.preventDefault(),I)return;if(!n){const H=c?m.trim():d.trim();if(!H){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===Us){p({parent:"Choose the parent team."});return}const X=c?H:m.trim()||H;C(()=>a({action:"add",kind:"team",key:H,...m.trim()?{label:m.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==Us?{parent:v}:{}},`Team ${X} added.`));return}if(!P&&!m.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const F=v===Us?null:v,T={...!P&&m.trim()!==n.label.trim()?{label:m.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&F!==n.parent?{parent:F}:{}};if(Object.keys(T).length===0){r();return}C(()=>a({action:"edit",kind:"team",key:n.key,...T},P?`Saved the description of ${B}.`:`Team ${m.trim()} saved.`))},R=n?P?`Edit the description of ${B}`:`Edit team ${B}`:"Add team";let E;return P?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(Tn,{open:e,onOpenChange:M=>M||b?null:r(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:R}),s.jsx(Dn,{children:E})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(vi,{refusal:w,context:l,subject:P?"the description":"the team",action:A}),!n&&!c?s.jsx(Sn,{id:"org-team-key",label:"Key",help:rS("team",l.host),error:g.key,children:M=>s.jsx(Tt,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":M,onChange:F=>{f(F.target.value),p({})}})}):null,P&&n?s.jsx(rp,{label:"Name",children:n.parent?`${B} · under ${N(n.parent)}`:B}):s.jsx(Sn,{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(Tt,{id:"org-team-label",value:m,"aria-invalid":g.label?!0:void 0,"aria-describedby":M,onChange:F=>{h(F.target.value),p({})}})}),s.jsx(Sn,{id:"org-team-description",label:P?"Description":"Description (optional)",children:()=>s.jsx(ts,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:M=>y(M.target.value)})}),P?null:c&&n?s.jsx(rp,{label:"Parent team",children:n.parent?N(n.parent):"None: the organization itself"}):s.jsx(Sn,{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(aS,{id:"org-team-parent",value:v,on_change:F=>{j(F),p({})},none:c?void 0:"No parent (a root team)",options:D,described_by:M})})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:b,onClick:r,children:"Cancel"}),s.jsx(ji,{saving:b,blocked:I,children:n?b?"Saving…":"Save":b?"Adding…":"Add team"})]})]})})})}const AL=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function $L({open:e,chart:t,job:n,save:a,on_close:r,context:l=bi}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,m]=u.useState(""),[h,x]=u.useState(Us),[y,v]=u.useState(new Set),[j,g]=u.useState(!1),[p,b]=u.useState(!0),[w,S]=u.useState({}),{saving:C,refusal:_,set_refusal:N,run:O}=yi(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)??Us),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(R=>!D.has(R.key)).sort(Lo),P=[...t.slots].sort(Lo).map(R=>({value:R.key,label:R.label||R.key})),I=!dr(l),A=n?"save the job function":"add the job function",$=R=>{if(R.preventDefault(),I)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!==Us?{parent:h}:{},fills:[...y],requires_person:j,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===Us?null:h,k={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...E!==n.parent?{parent:E}:{},...AL(n.fills,y)?{}:{fills:[...y]},...j!==n.requires_person?{requires_person:j}:{},...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(Tn,{open:e,onOpenChange:R=>R||C?null:r(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:$,noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(Dn,{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(vi,{refusal:_,context:l,subject:"the job function",action:A}),n?null:s.jsx(Sn,{id:"org-function-key",label:"Key",help:rS("job function",l.host),error:w.key,children:R=>s.jsx(Tt,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":R,onChange:E=>{o(E.target.value),S({})}})}),s.jsx(Sn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:R=>s.jsx(Tt,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":R,onChange:E=>{d(E.target.value),S({})}})}),s.jsx(Sn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(ts,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:R=>m(R.target.value)})}),s.jsx(Sn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:R=>s.jsx(aS,{id:"org-function-parent",value:h,on_change:x,none:"No parent (a root function)",options:B,described_by:R})}),s.jsx(sS,{id:"org-function-fills",legend:"Slots it fills",options:P,checked:y,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(Wy,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:j,on_change:g}),s.jsx(Wy,{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(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:C,onClick:r,children:"Cancel"}),s.jsx(ji,{saving:C,blocked:I,children:n?C?"Saving…":"Save":C?"Adding…":"Add job function"})]})]})})})}const ML=/^[a-z][a-z0-9_-]{0,63}$/;function OL(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function DL({open:e,chart:t,slot:n,save:a,on_close:r,context:l=bi}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,m]=u.useState(!1),[h,x]=u.useState(""),[y,v]=u.useState({}),{saving:j,refusal:g,set_refusal:p,run:b}=yi(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=!dr(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."},...ML.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(Tn,{open:e,onOpenChange:_=>_||j?null:r(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:C,noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(Dn,{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(vi,{refusal:g,context:l,subject:"the slot",action:S}),s.jsx(Sn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:y.label,children:_=>s.jsx(Tt,{id:"org-slot-label",value:i,"aria-invalid":y.label?!0:void 0,"aria-describedby":_,onChange:N=>{o(N.target.value),!n&&!f&&d(OL(N.target.value)),v({})}})}),n?s.jsx(rp,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(Sn,{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:y.key,children:_=>s.jsx(Tt,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":y.key?!0:void 0,"aria-describedby":_,onChange:N=>{d(N.target.value),m(!0),v({})}})}),s.jsx(Sn,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(ts,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:h,onChange:_=>x(_.target.value)})})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:j,onClick:r,children:"Cancel"}),s.jsx(ji,{saving:j,blocked:w,children:n?j?"Saving…":"Save":j?"Adding…":"Add slot"})]})]})})})}function zL({open:e,chart:t,binding:n,names:a,save:r,confirm:l,on_close:i,context:o=bi,hosted:c}){var I;const[d,f]=u.useState(new Set),[m,h]=u.useState(""),[x,y]=u.useState({}),{saving:v,refusal:j,set_refusal:g,run:p}=yi(i),b=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(A=>A.post))),h(n.source==="override"?n.reason??"":""),y({}),g(null))},[e,b,g]),!n)return null;const w=a.slot(n.slot),S=(I=t.project)!=null&&I.team?t.teams.find(A=>{var $;return A.key===(($=t.project)==null?void 0:$.team)}):void 0,C=S?S.label||S.key:"the owning team",_=new Set(t.job_functions.filter(A=>A.fills.includes(n.slot)).map(A=>A.key)),N=[...t.posts].map(A=>A.post).sort(a.byPost).map(A=>{const $=_.has(A.split("/")[1]??"")?`${a.post(A)} (fills ${w})`:a.post(A),R=c==null?void 0:c.holders(A);return{value:A,label:c?R?`${$}: ${R}`:`${$} (no holder)`:$}}),O=c?[...d].sort(a.byPost).flatMap(A=>[..._.has(A.split("/")[1]??"")?[]:[`${a.post(A)} is not in the job description of ${w}.`],...c.chain.has(A.split("/")[0]??"")?[]:[`${a.post(A)} is outside ${c.owner} and the teams above it.`]]):[],D=!dr(o),B=A=>{A.preventDefault();const $={...d.size===0?{posts:"Choose at least one post."}:{},...m.trim()?{}:{reason:"Give the reason for the override."}};y($),!($.posts||$.reason||D)&&p(()=>r({action:"bind",slot:n.slot,posts:[...d],reason:m.trim()},`Override of ${w} saved.`))},P=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(Tn,{open:e,onOpenChange:A=>A||v?null:i(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:B,noValidate:!0,children:[s.jsxs($n,{children:[s.jsxs(On,{children:["Override ",w]}),s.jsxs(Dn,{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:[j||D?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(vi,{refusal:j,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(sS,{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:A=>{f(A),y($=>({...$,posts:void 0}))}}),s.jsx(Sn,{id:"org-override-reason",label:"Reason",error:x.reason,children:A=>s.jsx(ts,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:m,"aria-invalid":x.reason?!0:void 0,"aria-describedby":A,onChange:$=>{h($.target.value),y(R=>({...R,reason:void 0}))}})}),c?null:s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", who must hold the lead post of ",C," or of a team above it."]})]}),s.jsxs(Mn,{className:"mt-6",children:[n.source==="override"?s.jsx(V,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void P(),children:"Clear override"}):null,s.jsx(V,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(ji,{saving:v,blocked:D,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function LL(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function UL({open:e,chart:t,names:n,save:a,on_close:r,context:l}){var A;const i=t.authority,o=u.useMemo(()=>i?new Set(i.post_pairs):null,[i]),c=$=>!o||o.has($),d=((A=t.teams.find($=>$.parent===null))==null?void 0:A.key)??null,f=[...t.teams].filter($=>!o||[...o].some(R=>R.startsWith(`${$.key}/`))).sort(($,R)=>$.key===d?-1:R.key===d?1:Lo($,R)),[m,h]=u.useState(""),[x,y]=u.useState(""),[v,j]=u.useState({}),{saving:g,refusal:p,set_refusal:b,run:w}=yi(r);u.useEffect(()=>{var $;e&&(h((($=f[0])==null?void 0:$.key)??""),y(""),j({}),b(null))},[e,b]);const S=new Set(t.posts.filter($=>$.post.startsWith(`${m}/`)).map($=>$.post.split("/")[1])),C=[],_=$=>{for(const R of[...t.job_functions].filter(E=>E.parent===$).sort(Lo))C.push(R),_(R.key)};_(null);const N=C.filter($=>c(`${m}/${$.key}`)&&!S.has($.key)),O=m!==""&&N.length===0,D=!dr(l)||O,B=$=>{if($.preventDefault(),D)return;const R={...m?{}:{team:"Choose a team."},...x?{}:{job:"Choose a job function."}};j(R),!(R.team||R.job)&&w(()=>a({action:"add",kind:"post",key:`${m}/${x}`},`Added post ${n.job(x)} · ${n.team(m)}.`))},P=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.",I=(i==null?void 0:i.ask)??[];return s.jsx(Tn,{open:e,onOpenChange:$=>$||g?null:r(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:B,noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:"Add post"}),s.jsx(Dn,{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(vi,{refusal:p,context:l,subject:"the post",action:"add the post"}),s.jsx(Sn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:v.team,children:$=>s.jsxs(Nt,{value:m,onValueChange:R=>{h(R),y(""),j({})},children:[s.jsx(yt,{id:"org-post-team","aria-describedby":$,"aria-invalid":v.team?!0:void 0,children:s.jsx(kt,{placeholder:"Choose a team"})}),s.jsx(jt,{children:f.map(R=>s.jsx(De,{value:R.key,children:R.label||R.key},R.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Sn,{id:"org-post-function",label:"Job function",help:P,error:v.job,children:$=>s.jsxs(Nt,{value:x,disabled:O,onValueChange:R=>{y(R),j({})},children:[s.jsx(yt,{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(jt,{children:N.map(R=>s.jsx(De,{value:R.key,children:R.label||R.key},R.key))})]})}),i&&!i.administer?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["Only the job functions directly below a post you hold are listed.",I.length?` For others, ask ${LL(I)}.`:""]}):null]})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:g,onClick:r,children:"Cancel"}),s.jsx(ji,{saving:g,blocked:D,described_by:O?"org-post-function-help":void 0,children:g?"Adding…":"Add post"})]})]})})})}function BL({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),[y,v]=u.useState(-1),{saving:j,refusal:g,set_refusal:p,run:b}=yi(i),w=u.useRef(0),S=u.useCallback(async()=>{const T=w.current+=1;d({state:"loading"});const H=await r();T===w.current&&d(H.ok?{state:"read",members:H.data}:{state:"failed"})},[r]);u.useEffect(()=>{e&&(m(""),x(null),v(-1),p(null),S())},[e,S,p]);const C=t.posts.find(T=>T.post===n);if(!n||!C)return null;const _=a.post(n),N=new Set(C.holders.map(T=>T.id)),D=t.posts.some(T=>T.reports_to===n)&&C.holders.length>0?C.holders[0]:null,B=f.trim().toLowerCase(),P=c.state==="read"?c.members.filter(T=>!N.has(T.id)).filter(T=>!B||[T.label,T.detail,T.email].some(H=>H==null?void 0:H.toLowerCase().includes(B))):[],I=c.state==="read"&&c.members.every(T=>N.has(T.id)),A=c.state==="read"&&!I&&P.length>0,$=A&&y>=0&&y<P.length?P[y]:null,R=T=>`org-holder-option-${T.id}`,E=!dr(o)||!h||D!==null,k=T=>{if(!A)return;const H=P.length-1,X=Z=>{var ae,we;T.preventDefault(),v(Z),(we=(ae=document.getElementById(R(P[Z])))==null?void 0:ae.scrollIntoView)==null||we.call(ae,{block:"nearest"})};T.key==="ArrowDown"?X(Math.min($?y+1:0,H)):T.key==="ArrowUp"?X($?Math.max(y-1,0):H):T.key==="Home"&&$?X(0):T.key==="End"&&$?X(H):T.key==="Enter"&&$&&(h==null?void 0:h.id)!==$.id&&(T.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.",F=T=>{T.preventDefault(),!(E||!h)&&b(()=>l({action:"hold",post:n,member:h.id},`Added ${h.label} to ${_}.`))};return s.jsx(Tn,{open:e,onOpenChange:T=>T||j?null:i(),children:s.jsx(An,{children:s.jsxs("form",{onSubmit:F,noValidate:!0,children:[s.jsxs($n,{children:[s.jsxs(On,{children:["Add holder to ",_]}),s.jsx(Dn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(vi,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),D?s.jsxs(ce,{variant:"info",id:"org-holder-one",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(fe,{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(Ie,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(Tt,{id:"org-holder-member",role:"combobox","aria-expanded":A,"aria-controls":A?"org-holder-members":void 0,"aria-activedescendant":$?R($):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:T=>{m(T.target.value),v(-1)},onKeyDown:k}),s.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border",children:c.state==="loading"?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 px-3 py-2 text-sm",role:"status",children:[s.jsx(hn,{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(V,{type:"button",variant:"outline",size:"sm",onClick:()=>void S(),children:"Retry"})]}):I?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):P.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:P.map((T,H)=>{const X=(h==null?void 0:h.id)===T.id,Z=($==null?void 0:$.id)===T.id;return s.jsxs("li",{id:R(T),role:"option","aria-selected":X,className:`cursor-pointer rounded-sm px-2 py-1.5 ${X?"bg-accent text-accent-foreground":Z?"bg-muted":"hover:bg-muted"} ${Z?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{D||(v(H),x(T))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[T.label,T.detail&&P.filter(ae=>ae.label===T.label).length>1?` (${T.detail})`:""]}),T.email?s.jsx("div",{className:"text-muted-foreground text-xs break-all",children:T.email}):null]},T.id)})})}),M?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:M}):null]})]}),s.jsxs(Mn,{className:"mt-6",children:[s.jsx(V,{type:"button",variant:"outline",disabled:j,onClick:i,children:"Cancel"}),s.jsx(ji,{saving:j,blocked:E,described_by:D?"org-holder-one":M?"org-holder-member-help":void 0,children:j?"Adding…":"Add holder"})]})]})})})}function lS(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=!dr(e),o=s.jsx(_x,{open:t!==null,onOpenChange:c=>c?null:r(!1),children:s.jsxs(Nx,{children:[s.jsxs(kx,{children:[s.jsx(Cx,{children:t==null?void 0:t.title}),s.jsx(Rx,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(Uo,{context:e,action:t.action}):null,s.jsxs(Sx,{children:[s.jsx(Ex,{children:"Cancel"}),s.jsx(O_,{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 Bl({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(cf,{children:[s.jsx(uf,{asChild:!0,children:s.jsx(V,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(hx,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(pc,{align:"end",children:r.map(l=>s.jsx(ei,{className:l.destructive?"text-destructive focus:text-destructive":void 0,onSelect:l.on_select,children:l.label},l.label))})]})}function IL({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(ce,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsxs(ke,{children:[e," was not removed"]}),s.jsxs(fe,{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(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:"Dismiss"})]})]})}const bi={host:"local",two_factor:"ok",settings_href:""},md={open:{label:"Open",tone:"info"},accepted:{label:"Accepted",tone:"success"},rejected:{label:"Rejected",tone:"error"},withdrawn:{label:"Withdrawn",tone:"neutral"}},HL={added:{label:"Added",tone:"success"},changed:{label:"Changed",tone:"warning"},removed:{label:"Removed",tone:"error"}},PL={team:["team","teams"],job_function:["job function","job functions"],slot:["slot","slots"],post:["post","posts"],fill:["fill","fills"]},qL=["team","job_function","slot","post","fill"];function gg(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function iS(e){const t=a=>gg(qL.filter(r=>e[r][a]>0).map(r=>{const l=e[r][a];return`${l} ${PL[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 pd(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function GL(e){const t=`Proposed by ${e.requested_by} on ${pd(e.requested_at)}`;return e.status==="open"||!e.decided_at?t:`${t} · ${md[e.status].label} by ${e.decided_by??"a former member"} on ${pd(e.decided_at)}`}function VL({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(ue,{className:"shrink-0",variant:"warning",children:"Version withdrawn"}):null]})}function YL(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 Qy({proposal:e,on_open:t}){const n=md[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(V,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-left whitespace-normal",onClick:t,children:e.title}),s.jsx(ue,{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 ${pd(e.requested_at)}`:`${n.label} by ${e.decided_by??"a former member"} on ${pd(e.decided_at??e.requested_at)}`,` · ${iS(e.counts)}`]})]})}const FL="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 KL({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(ue,{variant:"info",children:`${i.length} open`}):null]}),s.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:FL})]}),s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(Om,{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(ft,{className:"flex flex-col items-center gap-2 p-6 text-center",children:[s.jsx(Om,{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(ft,{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(Qy,{proposal:c,on_open:()=>n(c)},c.id))})}):null,o.length?s.jsxs("div",{children:[s.jsxs(V,{type:"button",variant:"ghost",size:"sm","aria-expanded":a,"aria-controls":"org-chart-proposals-decided",onClick:()=>r(c=>!c),children:[a?s.jsx(Hd,{className:"size-4","aria-hidden":"true"}):s.jsx(rc,{className:"size-4","aria-hidden":"true"}),`Decided (${o.length})`]}),a?s.jsx(ft,{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(Qy,{proposal:c,on_open:()=>n(c)},c.id))})}):null]}):null]})]})}const XL="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 WL({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?tn:Om;return s.jsxs(ce,{variant:r?"warning":"info",role:"status",className:"mt-6",children:[s.jsx(o,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:r?"The org changed while you drafted":"You are drafting a proposal"}),s.jsxs(fe,{children:[s.jsx("p",{id:"org-draft-why",children:a?`The org changed what your draft changes: ${gg(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.":XL}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(V,{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(V,{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 QL={proposal_empty:"The proposal changes nothing in the org."};function ZL({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,y]=u.useState(!1),v=u.useRef(!1);u.useEffect(()=>{e&&(f(null),h(null))},[e]);const j=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),y(!0),v.current=!0;try{const b=await n({title:p,...o.trim()?{note:o.trim()}:{}});if(!b.ok){h(QL[b.refusal.code??""]??b.refusal.message);return}b.data.state==="proposed"&&(i(""),c("")),r(b.data,p)}finally{v.current=!1,y(!1)}};return s.jsx(Tn,{open:e,onOpenChange:g=>g?null:a(),children:s.jsx(An,{className:"sm:max-w-lg",children:s.jsxs("form",{onSubmit:g=>void j(g),className:"grid gap-4",noValidate:!0,children:[s.jsxs($n,{children:[s.jsx(On,{children:"Submit proposal"}),s.jsx(Dn,{children:"Someone who may make these changes reviews it. Nothing in the organization changes until it is accepted."})]}),m?s.jsxs(ce,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not submit the proposal"}),s.jsx(fe,{children:s.jsx("p",{children:m})})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"org-proposal-title",children:"Title"}),s.jsx(Tt,{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(Ie,{htmlFor:"org-proposal-note",children:"Note (optional)"}),s.jsx(ts,{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:iS(t.counts)}),s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),s.jsxs(V,{type:"submit","aria-disabled":x||void 0,children:[x?s.jsx(hn,{className:"size-4","aria-hidden":"true"}):null,x?"Submitting…":"Submit proposal"]})]})]})})})}const JL=[{kind:"team",title:"Teams"},{kind:"job_function",title:"Job functions"},{kind:"slot",title:"Slots"},{kind:"post",title:"Posts"},{kind:"fill",title:"Fills"}];function e6({entry:e,decided:t}){const n=!t&&e.state==="settled",a=HL[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(ue,{variant:a.tone,children:a.label}),s.jsx("span",{className:"text-sm font-medium",children:e.name}),n?s.jsx(ue,{variant:"neutral",children:"Already in the org"}):null,!t&&e.state==="conflict"?s.jsx(ue,{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 Zy(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: ${gg(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 t6({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),[y,v]=u.useState(null),[j,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 T=await t.read(C);_.current===C&&(T.ok?(o(T.data),d(null)):d(T.refusal.message))},[t,C]);u.useEffect(()=>{if(o(null),d(null),m(null),x(!1),S(""),!C)return;N(),a().then(g);const T=()=>void a().then(H=>_.current===C&&g(H));return window.addEventListener("focus",T),()=>window.removeEventListener("focus",T)},[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",P=(i==null?void 0:i.entries.some(T=>T.state==="conflict"))??!1,I=!!i&&(i.may_accept||i.may_reject),A=j==="ok",$={...n,two_factor:j},R=async T=>{if(C){v(T),m(null);try{const H=T==="accept"?await t.accept(C):T==="reject"?await t.reject(C,w.trim()||void 0):await t.withdraw(C);if(H.ok){b(null),l(T==="accept"?`Accepted ${D}.`:T==="reject"?`Rejected ${D}.`:`Withdrew ${D}.`);return}if(b(null),H.refusal.code==="mfa_challenge_required"||H.refusal.code==="mfa_enrollment_required"){g(H.refusal.code==="mfa_enrollment_required"?"enroll":"challenge");return}T==="accept"&&x(!0);const X=await t.read(C);if(_.current!==C)return;const Z=X.ok?X.data:i;X.ok&&o(X.data),m({title:`${D} was not ${T==="accept"?"accepted":T==="reject"?"rejected":"withdrawn"}`,message:Zy(Z,H.refusal)})}finally{v(null)}}},E=i&&P&&!f?Zy(i,{code:"proposal_conflict",message:""}):null,k=B&&i&&i.may_reject&&!i.may_accept&&!P?i.accept_refusal??null:null,M=!A||P||!!k||y!==null,F=[A?null:"org-proposal-two-factor",P?"org-proposal-refusal":null,k?"org-proposal-accept-refusal":null].filter(Boolean).join(" ");return s.jsxs(s.Fragment,{children:[s.jsx(Tn,{open:e!==null,onOpenChange:T=>T?null:r(),children:s.jsxs(An,{className:"flex max-h-[90vh] flex-col overflow-hidden sm:max-w-2xl",children:[s.jsxs($n,{children:[s.jsx(On,{children:D}),s.jsx(Dn,{asChild:!0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[O?s.jsx(ue,{variant:md[O.status].tone,children:md[O.status].label}):null,s.jsx("span",{children:O?GL(O):null}),i!=null&&i.proposal.source?s.jsx(VL,{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(ce,{variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not read the proposal"}),s.jsx(fe,{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?JL.map(T=>{const H=i.entries.filter(X=>X.kind===T.kind);return H.length?s.jsxs("div",{className:"grid",children:[s.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:T.title}),s.jsx("ul",{role:"list",className:"m-0 list-none p-0",children:H.map(X=>s.jsx(e6,{entry:X,decided:!B},`${X.kind}:${X.name}`))})]},T.kind):null}):null,B&&i&&!I&&i.decide_refusal?s.jsxs(ce,{variant:"info",role:"status",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"You can't accept or reject this proposal"}),s.jsx(fe,{children:s.jsx("p",{children:i.decide_refusal})})]}):null,k?s.jsxs(ce,{id:"org-proposal-accept-refusal",variant:"info",role:"status",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"You can't accept this proposal"}),s.jsx(fe,{children:s.jsx("p",{children:k})})]}):null,B&&I&&!A?s.jsx("div",{id:"org-proposal-two-factor",children:s.jsx(Uo,{context:$,action:"decide the proposal",changing:"Accepting or rejecting a proposal"})}):null,f||E?s.jsxs(ce,{id:"org-proposal-refusal",variant:"destructive",role:"alert",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:(f==null?void 0:f.title)??(h?`${D} was not accepted`:`${D} can't be accepted`)}),s.jsx(fe,{children:s.jsx("p",{children:(f==null?void 0:f.message)??E})})]}):null]}),s.jsxs(Mn,{children:[s.jsx(V,{type:"button",variant:"outline",onClick:r,children:"Close"}),B&&(i!=null&&i.may_withdraw)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>b("withdraw"),children:"Withdraw proposal"}):null,B&&(i!=null&&i.may_reject)?s.jsx(V,{type:"button",variant:"outline",onClick:()=>b("reject"),children:"Reject"}):null,B&&i&&(i.may_accept||i.may_reject&&(P||k))?s.jsxs(V,{type:"button","aria-disabled":M||void 0,"aria-describedby":F||void 0,onClick:()=>M?void 0:void R("accept"),children:[y==="accept"?s.jsx(hn,{className:"size-4","aria-hidden":"true"}):null,y==="accept"?"Accepting…":"Accept"]}):null]})]})}),s.jsx(_x,{open:p!==null,onOpenChange:T=>T?null:b(null),children:s.jsxs(Nx,{children:[s.jsxs(kx,{children:[s.jsx(Cx,{children:p==="reject"?`Reject ${D}?`:`Withdraw ${D}?`}),s.jsx(Rx,{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"&&!A?s.jsx("div",{id:"org-proposal-reject-two-factor",children:s.jsx(Uo,{context:$,action:"reject the proposal",changing:"Accepting or rejecting a proposal"})}):null,p==="reject"?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Ie,{htmlFor:"org-proposal-reject-note",children:"Note (optional)"}),s.jsx(ts,{id:"org-proposal-reject-note",value:w,rows:2,maxLength:4e3,placeholder:"Why you are rejecting it",onChange:T=>S(T.target.value)})]}):null,s.jsxs(Sx,{children:[s.jsx(Ex,{children:"Cancel"}),p==="reject"?s.jsx(V,{type:"button",variant:"destructive","aria-disabled":!A||y!==null||void 0,"aria-describedby":A?void 0:"org-proposal-reject-two-factor",onClick:()=>!A||y?void 0:void R("reject"),children:y==="reject"?"Rejecting…":"Reject proposal"}):s.jsx(V,{type:"button","aria-disabled":y!==null||void 0,onClick:()=>y?void 0:void R("withdraw"),children:y==="withdraw"?"Withdrawing…":"Withdraw"})]})]})})]})}const n6={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."},s6="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",a6=4,vg=e=>({paddingLeft:16+24*Math.min(e,a6)}),xd={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function r6(){const e=pn().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=r6(),[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 F=>{const T=o.current+=1;c.current&&clearTimeout(c.current);const H=await n.chart();if(T!==o.current)return;if(H.ok){i({chart:H.data,at:new Date().toISOString()}),r({state:"read"});return}const{refusal:X}=H;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"&&F>0){const Z=X.retry_after??10;r({state:"busy",retry_after:Z}),c.current=setTimeout(()=>void M(F-1),Z*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}=Fe(),x=Fr(),y=h("/settings/account"),v=n.proposals,j=YL(v,(m==null?void 0:m.at)??null),g=!!v&&j.state!=="off",[p,b]=u.useState(null),[w,S]=u.useState(!1),[C,_]=u.useState(null),{confirm:N,confirm_dialog:O}=lS(bi),D=u.useMemo(()=>p&&v?{draft:p,change:v.draft.change,on_draft:b}:null,[p,v]),B=p6(n,f,(p==null?void 0:p.chart)??(m==null?void 0:m.chart)??o6,e,y,D),P=n.twoFactor,I=u.useCallback(async()=>P?P():"ok",[P]),A=!!p&&p.total>0,$=u.useRef(()=>{});$.current=()=>{v==null||v.draft.discard(),b(null)},u.useEffect(()=>{if(!A)return;let k=!0;const M=H=>{H.preventDefault()},F=()=>{k=!1,window.removeEventListener("beforeunload",M),document.removeEventListener("click",T,!0)},T=H=>{var te,Se;if(!k||H.defaultPrevented||H.button!==0||H.metaKey||H.ctrlKey||H.shiftKey||H.altKey)return;const X=H.target,Z=(te=X==null?void 0:X.closest)==null?void 0:te.call(X,"a[href]"),ae=Z?null:(Se=X==null?void 0:X.closest)==null?void 0:Se.call(X,i6);let we=null;if(Z&&Z.target!=="_blank"&&!Z.hasAttribute("download")){const le=new URL(Z.href,window.location.href),je=le.pathname===window.location.pathname&&le.search===window.location.search;le.origin===window.location.origin&&!je&&(we=()=>window.location.assign(le.href))}else ae&&ae.getAttribute("aria-current")!=="page"&&ae.getAttribute("aria-disabled")!=="true"&&!ae.hasAttribute("disabled")&&(we=()=>ae.click());if(!we)return;H.preventDefault(),H.stopPropagation();const W=we;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(le=>{le&&(F(),$.current(),W())})};return window.addEventListener("beforeunload",M),document.addEventListener("click",T,!0),F},[A,N]);const R=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(v6,{org:t}):s.jsx(sg,{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(nn,{title:"Org chart",description:n6[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(x6,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(g6,{edit:(B==null?void 0:B.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(j6,{host:e,kept_at:(m==null?void 0:m.at)??null,on_retry:f}):null,m&&p?s.jsx(WL,{draft:p,on_submit:()=>S(!0),on_discard:()=>void E()}):m&&g?s.jsx(KL,{listed:j,on_propose:()=>void R(),on_open:_}):null,m?s.jsx(b6,{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(ZL,{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(t6,{proposal:C,contract:v,context:{host:e,two_factor:"ok",settings_href:y},check_two_factor:I,on_close:()=>_(null),on_decided:k=>{x.success(k),_(null),f()}}):null,O]})})}const i6='[data-sidebar="menu-button"]:not([aria-expanded]), [data-sidebar="menu-sub-button"]',o6={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function c6(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 u6(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 d6={functions:!0,team_add:!0,team:()=>"description",post_add:!0,post:()=>!0,override:!1,slots:!0};function jf({mark:e}){return e?e==="added"?s.jsx(ue,{variant:"success",children:"Added"}):s.jsx(ue,{variant:"warning",children:"Changed"}):null}const f6={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."},h6={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function m6(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 p6(e,t,n,a,r,l=null){const i=Fr(),o=oS(n),c=m6(e,a,n),d=l?{host:a,two_factor:"ok",settings_href:r}:a==="hosted"?{host:a,two_factor:c.state,settings_href:r}:bi,{confirm:f,confirm_dialog:m}=lS(d),[h,x]=u.useState(null),[y,v]=u.useState({}),j=E=>v(k=>{if(!k[E])return k;const{[E]:M,...F}=k;return F}),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||!u6(n)))return null;const w=l?d6:c6(n),S=E=>{const k=E.code?h6[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 F=C(E);return F&&j(F),_(M.data,k),null},O=E=>{c.check(),x(E)},D=async(E,k,M,F)=>{const T=await b(M);if(!T.ok){const H=S(T.refusal),X=T.refusal.bound,Z=X?X.projects.length+X.more:0,ae=X?`${X.kind==="slot"?"Slot":"Post"} ${k} is still needed by the ${Z===1?"override of 1 project that binds":`overrides of ${Z} projects that bind`} it. Clear ${Z===1?"it":"them"} on each project's Settings first.`:H.message;v(we=>({...we,[E]:{label:k,message:ae,...X?{bound:X}:{}}}));return}j(E),_(T.data,F)},B=async(E,k,M)=>{const F=E==="team"?"team":"job function";c.check(),(l||await f({title:`Remove ${F} ${M}?`,description:f6[a],action_label:"Remove",destructive:!0,action:`remove the ${F}`}))&&await D(E==="team"?"teams":"functions",M,{action:"remove",kind:E,key:k},`${E==="team"?"Team":"Job function"} ${M} removed.`)},P=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}.`)},I=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}.`)},A=async(E,k)=>{const M=o.post(E),F=o.member(k),T=n.posts.find(we=>we.post===E),X=((T==null?void 0:T.holders.length)??0)<=1?T!=null&&T.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${o.manager(T.escalates_to)}.`:" The post becomes vacant.":"";if(c.check(),!await f({title:`Remove ${F} 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}j("posts"),_(ae.data,`Removed ${F} from ${M}.`)},$=()=>x(null),R=(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 P(E),remove:(E,k,M)=>void B(E,k,M),post_add:()=>O({kind:"post"}),post_remove:E=>void I(E),holder_add:E=>O({kind:"holder",post:E}),holder_remove:(E,k)=>void A(E,k),refused:E=>{const k=y[E];return k?s.jsx(IL,{label:k.label,message:k.message,bound:k.bound,on_dismiss:()=>j(E)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(TL,{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($L,{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(zL,{open:R!==null,chart:n,binding:R,names:o,save:N,confirm:E=>f({...E,action:"clear the override"}),on_close:$}),s.jsx(DL,{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(UL,{open:(h==null?void 0:h.kind)==="post",chart:n,names:o,save:N,on_close:$,context:d}),s.jsx(BL,{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 x6({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(bt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function Il({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 g6({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(ce,{variant:"info",className:"mt-6",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"This repository has no local org yet"}),s.jsxs(fe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(Il,{children:"sdlc org seed"}):null,e?null:s.jsx(Il,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(zr,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function v6({org:e}){const{href:t,Link:n}=Fe();return s.jsx(or,{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 y6(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${Ts(e)}`:`on ${ms(e)} at ${Ts(e)}`}function j6({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${y6(t)} is kept below. `:"";return s.jsxs(ce,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(fe,{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(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function oS(e){return u.useMemo(()=>{const t=new Map(e.teams.map(j=>[j.key,j.label||j.key])),n=new Map(e.job_functions.map(j=>[j.key,j.label||j.key])),a=new Map(e.slots.map(j=>[j.key,j.label||j.key])),r=new Map(e.posts.map(j=>[j.post,j.holders])),l=j=>j.label||j.id,i=new Map;for(const j of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=l(j);i.set(g,(i.get(g)??new Set).add(`${j.kind}:${j.id}`))}const o=j=>{var g;return(((g=i.get(l(j)))==null?void 0:g.size)??0)>1},c=j=>{const g=o(j)?j.detail??j.id:null;return g&&g!==l(j)?g:null},d=j=>{const g=c(j);return g&&g!==l(j)?`${l(j)} (${g})`:l(j)},f=j=>{const[g="",p=""]=j.split("/");return{team:t.get(g)??g,job:n.get(p)??p}},m=j=>{const{team:g,job:p}=f(j);return`${p} · ${g}`},h=j=>{if(j==="top")return"Top of the org";if(typeof j!="string")return`A vacant ${n.get(j.vacant)??j.vacant}`;const g=(r.get(j)??[]).map(d);return g.length?`${m(j)} (${g.join(", ")})`:m(j)},x=new Map(e.teams.map(j=>[j.key,j.parent])),y=j=>{let g=0;for(let p=x.get(j);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:(j,g)=>{const[p="",b=""]=[j.split("/")[0],g.split("/")[0]],[w,S]=[f(j),f(g)];return y(p)-y(b)||w.team.localeCompare(S.team)||w.job.localeCompare(S.job)},slot:j=>a.get(j)??j,job:j=>n.get(j)??j,team:j=>t.get(j)??j}},[e])}function br({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 Ki({children:e,on_click:t}){return s.jsxs(V,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(zr,{className:"size-4","aria-hidden":"true"}),e]})}const Jy={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 b6({chart:e,host:t,edit:n}){const a=oS(e),r=e.members.some(l=>l.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(br,{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(Ki,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(N6,{chart:e,names:a,agents:r,host:t,edit:n})]}),s.jsx(br,{id:"org-chart-members",title:"Members",description:r?`${Jy[t]} Each agent answers to the nearest person in its reporting chain.`:Jy[t],children:s.jsx(E6,{chart:e,names:a,host:t,agents:r})}),n?s.jsxs(br,{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(Ki,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(w6,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(br,{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(Ki,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(T6,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(br,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:s6,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(Ki,{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($6,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(O6,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function w6({chart:e,edit:t}){var c;const n=yg([...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(Bl,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):m==="root"?s.jsx(Bl,{label:f,on_edit:()=>t.team(d,"description")}):m==="description"&&t.drafting?s.jsx(Bl,{label:f,items:[{label:"Edit description",on_select:()=>t.team(d,"description")}]}):m==="description"?s.jsx(V,{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(qd,{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 y;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:vg(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(jf,{mark:(y=t.marks)==null?void 0:y.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(ue,{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(ft,{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 yg(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 _6={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function N6({chart:e,names:t,agents:n,host:a,edit:r}){const l=yg([...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.":_6[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,y=!!(r!=null&&r.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:vg(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(cE,{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(jf,{mark:(v=r==null?void 0:r.marks)==null?void 0:v.posts[f.post]}),y&&r?s.jsx("span",{className:"ml-auto",children:s.jsx(Bl,{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(ue,{variant:xd.vacant.tone,children:xd.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(j=>s.jsx(C6,{holder:j,post:f.post,member:i.get(`${j.kind}:${j.id}`),names:t,agents:n,host:a,on_remove:y&&r&&!r.drafting?()=>r.holder_remove(f.post,j):void 0},`${j.kind}:${j.id}`))})]}),m.length>0?o(m,d+1):null]},f.post)})});return s.jsx(ft,{className:"overflow-hidden",children:o(l,0)})}function k6(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function S6(e){if(!e.held_since)return null;const t=k6(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 C6({holder:e,post:t,member:n,names:a,agents:r,host:l,on_remove:i}){const o=e.kind==="person"?mx:fx,c=n==null?void 0:n.posts.find(y=>y.post===t),d=n==null?void 0:n.posts.find(y=>y.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"?S6(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(ag,{children:[s.jsx(rg,{asChild:!0,children:s.jsx(V,{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(Vd,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(gf,{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 R6=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function E6({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:"}),R6.map(l=>s.jsx(Il,{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(ft,{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Members",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Member"}),s.jsx(K,{children:"Posts"}),s.jsx(K,{children:"Primary manager"}),s.jsx(K,{children:"Dotted lines"}),a?s.jsx(K,{children:"Accountable person"}):null]})}),s.jsx(Ye,{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(de,{"data-testid":"org-chart-member",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(l)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.kind==="person"?"Person":"Agent"}):null]}),s.jsx(Y,{children:l.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(Y,{children:i?t.manager(i.reports_to):"None"}),s.jsx(Y,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(Y,{children:l.kind==="person"?"Not an agent":l.accountable_person?t.member(l.accountable_person):"None"}):null]},`${l.kind}:${l.id}`)})})]})})}function T6({chart:e,names:t,edit:n}){const a=yg([...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:vg(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(jf,{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(ue,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(Bl,{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(ft,{className:"overflow-hidden",children:r(a,0)})}function A6(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 gd={covered:0,vacant:1,uncovered:2};function cS(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 $6({chart:e,names:t,host:n,edit:a}){var i;const r=cS(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(ft,{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(Ki,{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(ft,{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Slots",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Slot"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Resolves to"}),a?s.jsx(K,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ye,{children:[[...e.slot_resolution].sort((o,c)=>gd[o.status]-gd[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f,m;const c=xd[o.status];return s.jsxs(de,{"data-testid":"org-chart-slot",children:[s.jsxs(Y,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:t.slot(o.slot)}),s.jsx(jf,{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(Y,{children:s.jsx(ue,{variant:c.tone,children:c.label})}),s.jsxs(Y,{children:[A6(o,t),o.status==="covered"&&o.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),a&&l.has(o.slot)?s.jsx(Y,{className:"text-right",children:s.jsx(Bl,{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(de,{children:s.jsx(Y,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const M6="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.",Th=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function O6({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(br,{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(Il,{children:i.length?Th[0]:"sdlc org add team <key>"})})})}const r=cS(t),l=[...e.slots].sort((i,o)=>gd[i.status]-gd[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(br,{id:"org-chart-project",title:"This project",description:M6,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(ft,{className:"mt-3 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Slots in this project",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Slot"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Bound to"}),s.jsx(K,{children:"Source"}),a?s.jsx(K,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(Ye,{children:[l.map(i=>{const o=xd[i.status];return s.jsxs(de,{"data-testid":"org-chart-project-slot",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),r.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.get(i.slot)}):null]}),s.jsx(Y,{children:s.jsx(ue,{variant:o.tone,children:o.label})}),s.jsx(Y,{children:s.jsx(D6,{binding:i,names:n})}),s.jsx(Y,{children:s.jsx(z6,{binding:i})}),a?s.jsx(Y,{className:"text-right",children:s.jsx(V,{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(qd,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),l.length===0?s.jsx(de,{children:s.jsx(Y,{colSpan:a?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),a?s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", as sdlc org makes them without --as: that person must hold the lead post of the owning team or of a team above it."]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),s.jsx(Il,{children:Th[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:"}),Th.map(i=>s.jsx(Il,{children:i},i))]})]})}function D6({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 z6({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?ms(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 L6={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},U6=["breaking","new","improved","other"],B6={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 uS(e){return B6[e]??e.replace(/_/g," ")}function I6(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function Bo(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=I6(l);t.set(i,[...t.get(i)??[],l])}return{sections:U6.filter(l=>t.has(l)).map(l=>({key:l,label:L6[l],lines:t.get(l)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function H6(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} (${uS(r.node_type)})${l}`)}}return`${n.join(`
|
|
404
|
+
`)}
|
|
405
|
+
`}const Ds="candidate";function jg(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const P6="Versioned records of this project's release branch, with notes from its graph changes.";function dS({description:e=P6,actions:t}){return s.jsx(nn,{title:"Releases",description:e,actions:t})}function fS(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 vu({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:oe("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 ds({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function xs({title:e,error:t,onRetry:n}){const a=R1();return s.jsxs(ce,{variant:"destructive",ref:a,children:[s.jsx(tn,{}),e?s.jsx(ke,{children:e}):null,s.jsxs(fe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(V,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function q6({title:e,text:t}){return s.jsx(ds,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(Pd,{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 G6(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 vd({changes:e}){const t=u.useMemo(()=>Bo(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(ej,{line:o},`${o.node_id}:${o.change}`))});return l.key==="breaking"?s.jsxs(ce,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(tn,{}),s.jsx(ke,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:l.label})}),s.jsx(fe,{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(V,{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(ej,{line:l,detail:!0},`all:${l.node_id}:${l.change}:${l.modeling_only}`))}):null]})}function ej({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(ue,{variant:"outline",children:uS(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const hS="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",bf=u.createContext(0);function Io(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 tj=e=>(e==null?void 0:e.status)===404||(e==null?void 0:e.reason)==="not_found",nj=5,lp="Not available",ip="planned:";function mS(){const e=es();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${lp}. ${e}`})}const Cs=e=>`${ip}${e}`,V6=e=>e!=null&&e.startsWith(ip)?e.slice(ip.length):null,bg=e=>e?e.slice(0,7):"";function Y6(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 F6(){return s.jsxs(ce,{variant:"info",children:[s.jsx(Rn,{}),s.jsx(ke,{children:"This page only reads Releases"}),s.jsx(fe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function K6(e){if(e.state==="unreadable")return{badges:s.jsx(ue,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(ue,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?jg(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function Tr({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 wf({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 Ys=({children:e})=>s.jsx("code",{className:"font-mono text-xs",children:e});function pS(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${bg(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 X6={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function W6({batch:e}){if(e.state==="loading")return s.jsxs(ce,{children:[s.jsx(Ju,{}),s.jsxs(fe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(hn,{"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(ce,{children:[s.jsx(Ju,{}),s.jsxs(ke,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(ue,{variant:X6[t.state],children:t.chip})]}),t.help?s.jsx(fe,{children:t.help}):null]})}function Q6(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function xS({issues:e,error:t}){return t?s.jsx(xs,{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(Ys,{children:n.file}):null]},n.key))})]})}function gS({tracks:e,error:t}){return t?s.jsx(xs,{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(Ys,{children:n.version}):null,n.bump?s.jsx(ue,{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(Ys,{children:a.name}),s.jsxs(Ys,{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 vS({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(Ve,{containerAriaLabel:"Planned Releases",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Planned Release"}),s.jsx(K,{children:"Delivered"}),s.jsx(K,{children:"Not delivered"})]})}),s.jsx(Ye,{children:e.planned.map(r=>s.jsxs(de,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.open&&t?s.jsx(Tr,{query:`planned=${encodeURIComponent(r.id)}`,select:Cs(r.id),onSelect:n,children:r.name}):s.jsx("span",{children:r.name}),s.jsx(Ys,{children:r.id})]})}),s.jsx(Y,{children:a(r.delivered)}),s.jsx(Y,{children:a(r.not_delivered)})]},r.id))})]})}):null,e.outside>0?s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.outside," landing",e.outside===1?"":"s"," served no Planned Release."]}):null]})}const Z6={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function yS({rows:e,org:t,from:n,untasked:a}){const{href:r,Link:l}=Fe(),[i,o]=u.useState(!1),c=i?e:e.slice(0,nj),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(Q6(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(Ve,{containerAriaLabel:"Related",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Kind"}),s.jsx(K,{children:"Item"}),s.jsx(K,{children:"How it relates"})]})}),s.jsx(Ye,{children:c.map(f=>s.jsxs(de,{children:[s.jsx(Y,{children:Z6[f.kind]}),s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(f),f.state&&f.kind!=="thread"?s.jsx("span",{className:"text-muted-foreground text-xs",children:f.state}):null]})}),s.jsx(Y,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>nj?s.jsx(V,{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 jS=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function bS(e){const t=wg(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),r=u.useRef(0),l=ps(),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]),Io(u.useContext(bf),()=>void i(!1,!0)),{related:n,read:i}}function wS({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(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-full"}),s.jsx(bt,{className:"h-8 w-2/3"})]}):e.state==="error"?jS(e.refusal)?s.jsx(mS,{}):s.jsx(xs,{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(yS,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function J6(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 _S({planned:e,onSelect:t}){return e?e.open?s.jsx(Tr,{query:`planned=${encodeURIComponent(e.id)}`,select:Cs(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(Ys,{children:e.id})]}):null}function e5({candidate:e,org:t,onSelect:n,notes:a}){const r=wg(),{related:l,read:i}=bS("candidate"),[o,c]=u.useState(r!=null&&r.candidateBatch?{state:"loading"}:null),d=u.useRef(0),f=ps(),m=u.useCallback(async x=>{if(!(r!=null&&r.candidateBatch)||x&&f.busy())return;const y=++d.current,v=await f.track(r.candidateBatch());y===d.current&&(v.ok?c(v.data.batch===null?null:{state:"ready",value:v.data.batch}):c(j=>x&&(j==null?void 0:j.state)==="ready"?j:{state:"error",error:v.refusal.message}))},[r,f]);u.useEffect(()=>(m(!1),()=>{d.current+=1}),[m]),Io(u.useContext(bf),()=>void m(!0));const h=e.readiness??((l==null?void 0:l.state)==="ready"?l.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(wf,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(Ys,{children:bg(e.head_commit_id)},"commit")],["Readiness",h?pS(h,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(_S,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(W6,{batch:o}):null,a,s.jsx(xS,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(gS,{tracks:e.tracks,error:e.tracks_error}),s.jsx(vS,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(wS,{related:l,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function t5({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(ue,{variant:"warning",children:"Withdrawn"}):s.jsx(ue,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(Tr,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function n5({release:e,org:t,onSelect:n,notes:a}){const r=e.label??e.version,{related:l,read:i}=bS(r),o=(l==null?void 0:l.state)==="ready"?J6(l.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(wf,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(Ys,{children:bg(e.commit)},"commit"):null],["Readiness",e.readiness?`${pS(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(_S,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(xS,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(gS,{tracks:e.tracks,error:e.tracks_error}),s.jsx(vS,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(wS,{related:l,org:t,from:`release:${r}`,onRetry:()=>i(!0)})]})}function s5({id:e,summary:t,org:n,onNotFound:a,forecast:r}){const l=wg(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=ps(),f=u.useCallback(async(y=!1,v=!1)=>{if(v&&d.busy())return;const j=++c.current;if(!(l!=null&&l.plannedRelease)){o({state:"error",error:lp,refusal:{status:409,message:lp,reason:"view_outdated"}});return}v||o({state:"loading"});const g=await d.track(l.plannedRelease(e,y?{fresh:!0}:void 0));j===c.current&&o(p=>g.ok?{state:"ready",value:g.data}:v&&p.state==="ready"&&!tj(g.refusal)?p:{state:"error",error:g.refusal.message,refusal:g.refusal})},[l,e,d]);u.useEffect(()=>{f()},[f]),Io(u.useContext(bf),()=>void f(!1,!0));const m=i.state==="error"&&tj(i.refusal);if(u.useEffect(()=>{m&&a()},[m,a]),i.state==="loading")return s.jsxs(ds,{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(ue,{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(ds,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),jS(i.refusal)?s.jsx(mS,{}):m?null:s.jsx(xs,{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(ds,{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(ue,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(wf,{pairs:[["Planned Release",s.jsx(Ys,{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(Ve,{containerAriaLabel:"Members",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Member"}),s.jsx(K,{children:"Level"}),s.jsx(K,{children:"Tasks"}),s.jsx(K,{children:"State"})]})}),s.jsx(Ye,{children:h.members.map(y=>{const v=y.tasks.filter(g=>g.state==="done").length,j=y.tasks.filter(g=>g.state!=="done").map(g=>g.id);return s.jsxs(de,{children:[s.jsx(Y,{children:y.label}),s.jsx(Y,{children:y.level?s.jsx(ue,{variant:"neutral",children:a5(y.level)}):null}),s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[y.tasks.length>0?s.jsxs("span",{children:[v," of ",y.tasks.length," done"]}):null,j.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(Ys,{children:j.join(", ")})]}):null,y.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[y.untracked," slice",y.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(Y,{children:y.state})]},y.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(yS,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const a5=e=>e.charAt(0).toUpperCase()+e.slice(1);function wg(){return pn().releases}const _s={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"},sj=3,r5=["in_progress","not_started","planned","blocked"],_g="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),Mt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ah(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${_g[Number(t[2])-1]}`:String(e??"")}function NS(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${_g[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function l5(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${_g[t.getMonth()]}`}function ia(e){return e?e.from===e.to&&e.or_later?`${Ah(e.from)} or later`:`${Ah(e.from)} to ${Ah(e.to)}${e.or_later?", or later":""}`:""}function i5(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??"")?"":i5(t)].filter(Boolean).join(" · "),l=t.projected?ia(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 ${ia({...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?Mt(l):"",caption:f}}function o5(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function c5(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 SS=e=>String(e??"").replace(/_/g," ");function u5(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),r=!a&&t.was&&t.now?ia(t.was)===ia(t.now)?`, range still ${ia(t.now)}`:`, range was ${ia(t.was)}, now ${ia(t.now)}`:"",l=[a&&t.was?`was ${ia(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?Mt(l.join(" · ")):"",what:i}}const Hl="roadmap",aj={reading:!1,value:null,refusal:null};function d5(e){const[t,n]=u.useState({all:aj,mine:aj}),a=u.useRef({all:0,mine:0}),r=ps(),l=ps(),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 f5(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function po({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 CS=({level:e})=>e?s.jsx(ue,{variant:"neutral",children:Mt(e)}):null;function RS({state:e}){const t=Mt(SS(e));return r5.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function h5({reads:e,scope:t,onScope:n,onRead:a,org:r,onSelect:l}){var x,y;const i=e[t],o=i.value,c=es(),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 ${NS(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((y=o.decider)==null?void 0:y.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(ds,{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(V,{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(hn,{"aria-hidden":!0,className:"size-4"})," ",Mt(_s.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(xs,{title:_s.failedLead,error:`${Mt(_s.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(xs,{title:_s.failedLead,error:i.refusal.message}):s.jsx(xs,{title:_s.failedLead,error:i.refusal.message,onRetry:m}):null,o?t==="mine"?s.jsx(j5,{mine:o.mine,org:r,onSelect:l}):s.jsx(p5,{read:o,org:r,onSelect:l}):null]})}function m5(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=l5(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function p5({read:e,org:t,onSelect:n}){var r,l;const a=e.releases??[];if(!a.length){const[i,o]=_s.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(po,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(wf,{pairs:[["Forecast from",Mt(`${((r=e.source)==null?void 0:r.machine)||"this machine"}'s task records and rate`)],["Rate",m5(e.rate)],["Not counted",Mt(((l=e.source)==null?void 0:l.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(x5,{row:i,org:t,onSelect:n},i.id))]})}function x5({row:e,org:t,onSelect:n}){var m,h,x;const a=kS(e.forecast),r=c5(e),l=o5(e),i=`roadmap-${e.id}`,o=e.moved?u5(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(Tr,{query:`planned=${encodeURIComponent(e.id)}`,select:Cs(e.id),onSelect:n,children:e.name})}),e.kinds.map(y=>s.jsx(ue,{variant:"neutral",children:y},y))]}),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:Mt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(ce,{variant:"info",children:[s.jsx(UE,{"aria-hidden":!0}),s.jsx(ke,{children:"Moved since you looked"}),s.jsxs(fe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((y,v)=>s.jsx("span",{className:"text-xs",children:y},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:Mt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(g5,{row:e}):null,s.jsx(y5,{row:e,org:t})]})}function g5({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?`${Mt(r).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(po,{children:a.accept}),s.jsx(po,{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(po,{children:t.set_goal})]}):null]})}function ES({next:e,org:t}){const{href:n,Link:a}=Fe(),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 v5(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?Mt(e.nobody):""}function y5({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,sj),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(Ve,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Member"}),s.jsx(K,{children:"Level"}),s.jsx(K,{children:"State"}),s.jsx(K,{children:"Who is on it"})]})}),s.jsx(Ye,{children:l.map(o=>{const c=i.get(o.item);return s.jsxs(de,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(ES,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[Mt(c.words),c.estimate_as_of?` (estimated ${NS(c.estimate_as_of)})`:""]}):null]})}),s.jsx(Y,{children:s.jsx(CS,{level:o.level})}),s.jsx(Y,{children:s.jsx(RS,{state:o.state})}),s.jsx(Y,{children:v5(o,e)})]},o.item)})})]})}),r.length>sj&&!n?s.jsxs(V,{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 j5({mine:e,org:t,onSelect:n}){const{href:a,Link:r}=Fe();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:Mt(_s.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Your work",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Task"}),s.jsx(K,{children:"Release"}),s.jsx(K,{children:"Member"})]})}),s.jsx(Ye,{children:e.tasks.map(i=>{var o,c;return s.jsxs(de,{children:[s.jsx(Y,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:a(`/org/${t}/tasks/${encodeURIComponent(i.id)}?from=roadmap`),children:i.id}),s.jsx("span",{className:"text-muted-foreground text-xs",children:[i.title||i.thread,Mt(SS(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(Y,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(Tr,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Cs(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(Tr,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:Cs(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?Mt(i.words):"—"})}),s.jsx(Y,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(CS,{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(po,{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:Mt(_s.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Your next members",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Release"}),s.jsx(K,{children:"Member"}),s.jsx(K,{children:"State"})]})}),s.jsx(Ye,{children:e.next.map(i=>s.jsxs(de,{children:[s.jsx(Y,{children:s.jsx(Tr,{query:`planned=${encodeURIComponent(i.release)}`,select:Cs(i.release),onSelect:n,children:i.name})}),s.jsx(Y,{children:s.jsx(ES,{next:i,org:t})}),s.jsx(Y,{children:s.jsx(RS,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function b5({state:e,id:t}){var l;const n=es();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(hn,{"aria-hidden":!0,className:"size-4"})," ",Mt(_s.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${Mt(_s.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${_s.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:Mt(r.caption.join(" · "))}):null]})}function TS(){const e=pn().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function w5({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 U,Ee,Oe,ut,un,ss,Ln,Un,mr,Ms;const h=TS(),x=e.local??null,y=!!x,[v,j]=u.useState(e);u.useEffect(()=>{e.local&&j(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),[P,I]=u.useState(!1),[A,$]=u.useState(null),[R,E]=u.useState(null),k=u.useRef(null),M=x?{fresh:!0}:void 0,F=u.useRef(0),T=ps(),H=u.useCallback(async(be,We=!1)=>{if(We&&T.busy())return;const Qt=++F.current,yn=await T.track(h.candidate(be));Qt===F.current&&_(pr=>yn.ok?{state:"ready",value:yn.data.candidate}:We&&pr.state==="ready"?pr:{state:"error",error:yn.refusal.message,refusal:yn.refusal})},[h,T]),X=u.useCallback(async()=>{_({state:"loading"}),await H(M)},[H,y]),Z=u.useCallback(async()=>{const be=await h.list();be.ok&&j(be.data)},[h]),ae=((U=v.release_branch)==null?void 0:U.id)??null;u.useEffect(()=>{if(!(!y&&!ae))return H(),()=>{F.current+=1}},[ae,H,y]);const we=u.useRef(new Set),W=u.useCallback((be,We)=>O(Qt=>({...Qt,[be]:We.ok?{state:"ready",value:We.data.release}:{state:"error",error:We.refusal.message,refusal:We.refusal}})),[]),te=async be=>{O(We=>({...We,[be]:{state:"loading"}})),we.current.add(be),W(be,await h.release(be,M))},Se=C.state!=="ready"||C.value!==null,le=V6(b),je=d5(x?h:void 0),me=je.available&&b===Hl,[$e,xe]=u.useState("all"),Ce=v.release_branch||x?Se?Ds:null:((Ee=v.releases[0])==null?void 0:Ee.version)??null,J=le!==null||me?null:b===Ds?Se?Ds:null:b??Ce,[G,ne]=u.useState([]),se=u.useRef(0),Ke=u.useRef(0),Xe=ps(),rt=u.useCallback(()=>{if(!y||!h.roadmapMoved)return;const be=Ke.current,We=se.current;Xe.track(h.roadmapMoved()).then(Qt=>{be===Ke.current&&Qt.ok&&We===se.current&&ne(Qt.data.moved.map(yn=>yn.name))})},[h,y,Xe]);u.useEffect(()=>(rt(),()=>{Ke.current+=1}),[rt]),Io(m,()=>{Xe.busy()||rt()});const ye=je.reads.all,tt=je.read;u.useEffect(()=>{le===null||!je.available||!ye.value&&!ye.reading&&!ye.refusal&&tt("all")},[le,je.available,ye,tt]);const[It,Ht]=u.useState(0),Kt=u.useRef(0),Le=be=>{be===Hl&&Ht(We=>We+1),w(be)};u.useEffect(()=>{if(It!==Kt.current){if(!me){Kt.current=It;return}$e!=="all"||ye.reading||!ye.value||!h.roadmapSeen||(Kt.current=It,h.roadmapSeen(ye.value.as_of).then(be=>{be.ok&&(se.current+=1,ne([]))}))}},[It,me,$e,ye,h]);const zn=new Map((((Oe=ye.value)==null?void 0:Oe.releases)??[]).map(be=>[be.id,[be.kinds.includes("range")?"range":"",be.forecast.projected?ia(be.forecast.projected):"no date"].filter(Boolean).join(" · ")])),Xt=J===null||J===Ds||v.releases.some(be=>be.version===J);u.useEffect(()=>{!x||!c||J!==null&&J!==Ds&&!Xt&&c({kind:"release",id:J})},[x,c,J,Xt]),u.useEffect(()=>{!J||J===Ds||we.current.has(J)||x&&!Xt||(we.current.add(J),h.release(J).then(be=>W(J,be)))},[J,h,W,Xt]);const on=ps();Io(m,()=>{if(x){if(H(void 0,!0),J&&J!==Ds&&Xt&&!on.busy()){const be=J;on.track(h.release(be)).then(We=>{We.ok&&W(be,We)})}me?tt($e,!1,!0):le!==null&&ye.value&&tt("all",!1,!0)}});const gn=u.useRef(b),Pt=u.useRef(!1),cn=u.useRef(!!f),L=u.useRef(null);u.useEffect(()=>{var We,Qt;if(!x)return;if(cn.current){const yn=(We=L.current)==null?void 0:We.querySelector('[aria-current="true"]');if(yn){cn.current=!1,gn.current=b,yn.focus();return}}if(gn.current!==b&&(gn.current=b,Pt.current=!0),!Pt.current)return;const be=(Qt=k.current)==null?void 0:Qt.querySelector("h2");be&&(Pt.current=!1,be.tabIndex=-1,be.focus())});const he=async be=>{if(!a)return;B(null);const We=await a(be);if(!We.ok){B(We.error);return}p(null),_({state:"loading"}),await Z()},ge=async()=>{if(!v.next_before)return;E(null);const be=await h.list({before:v.next_before});if(!be.ok){E(be.refusal.message);return}j(We=>({...be.data,releases:[...We.releases,...be.data.releases]}))},ct=v.release_branch?s.jsx(_5,{value:v.release_branch.id,label:v.release_branch.name,options:n??[],can_write:v.can_write,onChange:he}):null,ns=x?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",hs(x.read_at)]}),o?s.jsxs(V,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(Xr,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):ct,vn=x?Y6(((ut=v.releases[0])==null?void 0:ut.label)??((un=v.releases[0])==null?void 0:un.version)??null):G6(((ss=v.releases[0])==null?void 0:ss.version)??null,((Ln=v.release_branch)==null?void 0:Ln.name)??null),Wt={org:i??""};return s.jsxs(bf.Provider,{value:m,children:[s.jsx(dS,{description:x?hS:void 0,actions:ns}),d,x?s.jsx(F6,{}):null,D?s.jsx(xs,{error:D}):null,x?null:t,!x&&!v.release_branch?s.jsx(N5,{can_write:v.can_write,options:n??[],onChoose:he}):null,v.release_branch||v.releases.length>0||x?s.jsxs("div",{ref:L,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(k5,{list:v,candidate:S?C:null,shown:me?Hl:le!==null?Cs(le):J,onSelect:Le,roadmap:je.available?f5(((Un=v.planned)==null?void 0:Un.length)??0,G):null,planned_ranges:zn,can_load_older:!!v.next_before,older_error:R,onLoadOlder:ge}),s.jsx("div",{className:"min-w-0 flex-1",ref:k,children:me?s.jsx(h5,{reads:je.reads,scope:$e,onScope:xe,onRead:tt,org:Wt.org,onSelect:w}):le!==null?s.jsx(s5,{id:le,summary:((mr=v.planned)==null?void 0:mr.find(be=>be.id===le))??null,org:Wt.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:le}),forecast:je.available?s.jsx(b5,{state:ye,id:le}):null}):J===Ds?s.jsx(C5,{candidate:C,branch_name:((Ms=v.release_branch)==null?void 0:Ms.name)??null,can_write:v.can_write&&!!r,local:!!x,org:Wt.org,onSelect:w,onRetry:X,onWrite:()=>I(!0)}):J?s.jsx(R5,{detail:N[J]??{state:"loading"},summary:v.releases.find(be=>be.version===J)??null,local:!!x,org:Wt.org,onSelect:w,onRetry:()=>te(J)}):(v.release_branch||x)&&C.state==="ready"?s.jsx(q6,{title:vn.title,text:vn.text}):null})]}):null,r&&C.state==="ready"&&C.value?r({candidate:C.value,open:P,notice:A,onOpenChange:be=>{be||$(null),I(be)},onStale:async be=>{$(be),await H()},onWritten:async be=>{I(!1),$(null),await Z(),p(be),await X()}}):null]})}function _5({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(Ie,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(Nt,{value:e,onValueChange:r,disabled:!a,children:[s.jsx(yt,{id:"release-branch",children:s.jsx(kt,{})}),s.jsxs(jt,{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(AS,{})]})}function AS(){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 N5({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(Ju,{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(Ie,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(Nt,{onValueChange:n,disabled:!e,children:[s.jsx(yt,{id:"release-branch-first",children:s.jsx(kt,{placeholder:"Choose a branch"})}),s.jsx(jt,{children:t.map(a=>s.jsx(De,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(AS,{})]})}function $S({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function k5({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?Bo(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(vu,{active:n===Hl,onClick:()=>a(Hl),version:"Roadmap",badges:null,caption:r}):null,t&&(t.state!=="ready"||t.value)?s.jsx(vu,{active:n===Ds,onClick:()=>a(Ds),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):t.state==="ready"&&((m=t.value)==null?void 0:m.app_changed)===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((h=t.value)!=null&&h.classification)?s.jsx(ue,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":fS(t.value)}):null,d?s.jsx(S5,{list:e,shown:n,onSelect:a,ranges:l}):null,d&&e.releases.length>0?s.jsx($S,{children:"Released"}):null,e.releases.map(x=>{const y=d?K6(x):null;return s.jsx(vu,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(y==null?void 0:y.badges)??s.jsxs(s.Fragment,{children:[s.jsx(ue,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),caption:(y==null?void 0:y.caption)??jg(x.written_at)},x.version)}),i?s.jsx(V,{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 S5({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($S,{children:"Planned"}),e.planned_error?s.jsx(xs,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((r,l)=>s.jsx(vu,{active:t===Cs(r.id),onClick:()=>n(Cs(r.id)),version:r.name,badges:s.jsx(ue,{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 C5({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(ds,{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(ds,{children:s.jsx(xs,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=Bo(c.changes),f=!c.previous_release,m=t??"the release branch";return s.jsxs(ds,{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(ue,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(ue,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(ue,{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: `,fS(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(V,{onClick:o,children:[s.jsx(Ju,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(e5,{candidate:c,org:r,onSelect:l,notes:f?null:s.jsx(vd,{changes:c.changes})}):f?null:s.jsx(vd,{changes:c.changes})]})}function R5({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(ds,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(xs,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(ds,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(ds,{children:s.jsx(xs,{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(H6(m,Bo(c.changes))),o(!0)};return s.jsxs(ds,{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(t5,{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(ue,{variant:"neutral",children:d?"First":c.bump}),Bo(c.changes).breaking?s.jsx(ue,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",jg(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(V,{variant:"outline",onClick:h,children:[s.jsx(O0,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(n5,{release:c,org:a,onSelect:r,notes:d?null:s.jsx(vd,{changes:c.changes})}):d?null:s.jsx(vd,{changes:c.changes})]})}const E5=5,T5=1e4,A5=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function $5({org:e,query:t,onSelect:n,home:a}){var k;const r=TS(),{href:l,Link:i}=Fe(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[m,h]=u.useState(null),[x,y]=u.useState(null),v=u.useRef(0),j=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),b=u.useRef(!1),w=dg(g),S=ps(),C=u.useCallback(async(M,F=!1)=>{const T=j.current+=1;h(null);const H=await S.track(r.list(M?{fresh:!0}:void 0));if(T===j.current){if(H.ok){v.current=0,f(null);const X=document.visibilityState==="visible"?1:0;c(Z=>Z.state==="ok"?F?{state:"ok",list:H.data,gen:Z.gen,tick:Z.tick+X}:{state:"ok",list:H.data,gen:Z.gen+1,tick:Z.tick}:{state:"ok",list:H.data,gen:0,tick:0});return}if(H.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:H.refusal});return}if(v.current+=1,v.current===1&&A5(H.refusal)){b.current=F,h(H.refusal.retry_after??E5);return}f(H.refusal)}},[r,S]);u.useEffect(()=>{C(!1)},[C]);const _=u.useMemo(()=>yf(S,()=>void C(!1,!0)),[C,S]);rr(_,T5),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 F;if(!p.current||o.state==="loading"||d||m!==null)return;p.current=!1;const M=(F=g.current)==null?void 0:F.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?Hl:t.planned!==null?t.planned===""?(k=O==null?void 0:O.planned)!=null&&k[0]?Cs(O.planned[0].id):null:Cs(t.planned):t.release,B=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,P=u.useRef(B);u.useEffect(()=>{P.current!==B&&(P.current=B,y(null))},[B]);const I=u.useRef(!1),A=u.useCallback(M=>{I.current=!0,y(M)},[]),$=!x&&o.state==="ok"&&I.current;if(u.useEffect(()=>{$&&(I.current=!1)},[$]),x)return s.jsx(or,{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 R=m!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(hn,{"aria-hidden":!0})," The release records are busy; reading again in ",m," s…"]}):null,E=d?s.jsxs(ce,{ref:w,variant:"destructive",children:[s.jsx(tn,{}),s.jsx(ke,{children:"Releases could not be read"}),s.jsxs(fe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,O?" The last Releases read stays below.":""]}),s.jsx(V,{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(w5,{initial:o.list,tick:o.tick,org:e,selection:{selected:D,onSelect:n},onReadAgain:N,onNotFound:A,notice:R||E?s.jsxs(s.Fragment,{children:[R,E]}):null,focusOnMount:$},o.gen):o.state==="engine_missing"?s.jsx(ea,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(dS,{description:hS}),E??R??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(hn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const M5={threads:"Threads",tasks:"Tasks",queues:"Queues",blockers:"Blockers",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},O5={tasks:"Tasks",issues:"Issues",releases:"Releases"};function yu(e,t){return e.kind==="home"?"Home":e.kind==="org"?M5[e.page]:e.kind==="project"?e.page?O5[e.page]:t??e.project:"Not found"}const D5="(max-width: 767px)";function z5(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(D5):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 Kc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function rj({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 lj({item:e,collapsed:t}){const{Link:n}=Fe(),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(ag,{children:[s.jsx(rg,{asChild:!0,children:l}),s.jsx(gf,{side:"right",children:r})]}):l})}const ij="m-0 flex list-none flex-col gap-1 p-0";function oj({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 cj({page:e,collapsed:t,sheet:n=!1}){var $;const{href:a}=Fe(),{worktrees:r,blockers:l}=pn(),i=Jn(),{org:o,projects:c,loading:d,none:f,about:m,aboutFailed:h,domains:x,engine:y}=i,v=y===null,j=o?`/org/${o.slug}`:"",g=c==null?void 0:c.find(R=>R.current),p=(($=o==null?void 0:o.source)==null?void 0:$.kind)==="folder"&&g!==void 0,b=R=>p&&g?`${R} · ${g.name}`:R,w=b("Workspaces"),S=b("Tasks"),C=b("Queues"),_=R=>p?R:void 0,N=[{label:"Home",href:a(j||"/"),icon:PE,current:e.kind==="home"},...v?[]:[{label:"Threads",href:a(`${j}/threads`),icon:Zu,current:e.kind==="org"&&e.page==="threads"}],...x.includes("tasks")&&!v?[{label:S,title:_(S),href:a(`${j}/tasks`),icon:z0,current:e.kind==="org"&&e.page==="tasks"}]:[],...v?[]:[{label:C,title:_(C),href:a(`${j}/queues`),icon:L0,current:e.kind==="org"&&e.page==="queues"}],...l&&!v?[{label:"Blockers",href:a(`${j}/blockers`),icon:IE,current:e.kind==="org"&&e.page==="blockers"}]:[],...r&&!v?[{label:"Worktrees",href:a(`${j}/worktrees`),icon:D0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:w,title:_(w),href:a(`${j}/workspaces`),icon:ME,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${j}/chart`),icon:lT,current:e.kind==="org"&&e.page==="chart"}],O=d?null:f?"No organization":(o==null?void 0:o.name)??"Organization",D=o?LT(o):null,B=m==null?void 0:m.version,P=B?t?B:`sdlc ${B}`:h?ed:Yd,I=h||(m==null?void 0:m.sync.state)==="unknown"?OT:m===void 0?MT:$T;let A;return d?A=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(rj,{label:"Loading projects",children:[s.jsx(Kc,{className:"h-4 w-32"}),s.jsx(Kc,{className:"h-4 w-24"})]})}):c?A=s.jsx("ul",{className:ij,children:c.map(R=>s.jsx(lj,{collapsed:t,item:{label:R.name,title:R.name,href:a(`/proj/${encodeURIComponent(R.id)}`),icon:AE,current:e.kind==="project"&&e.project===R.id}},R.id))}):A=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:f?"No projects":ed}),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(dE,{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(rj,{label:"Loading organization",children:[s.jsx(Kc,{className:"h-4 w-28"}),s.jsx(Kc,{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(oj,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:ij,children:N.map(R=>s.jsx(lj,{item:R,collapsed:t},R.label))})}),!t&&s.jsx(oj,{label:"Projects",collapsed:t,children:A})]}),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:P}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(zE,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:I})]})]})]})}const L5="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function U5({page:e}){var c;const{href:t,Link:n}=Fe(),{org:a,projects:r,loading:l,none:i}=Jn(),o=[];if(l)o.push({label:Yd});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:yu(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:yu(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:yu(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(rc,{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 ${L5}`,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 B5({page:e,children:t}){var g;const n=z5(),[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}=Jn(),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?Yd: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}${yu(e,x)} · ${p} · sdlc viewer`},[e,x,d,m,h]);const y=()=>{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 j=!n&&!a;return s.jsx(sg,{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] ${j?"w-12":"w-64"}`,children:s.jsx(cj,{page:e,collapsed:j})}),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(cj,{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:y,children:s.jsx(Vd,{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:y})]}),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] ${j?"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(oT,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(U5,{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 Ng="m-0 text-2xl font-semibold tracking-tight",kg="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",Sg=`rounded-sm font-medium text-primary no-underline hover:underline ${kg}`;function $h({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 I5({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($h,{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($h,{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($h,{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?Lr:zT})]})}const uj=`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 ${kg}`;function H5(){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 wi(){const{href:e,Link:t}=Fe(),{loading:n,projects:a,none:r,failure:l,readAt:i,refresh:o,reading:c}=Jn(),[d,f]=u.useState(""),m=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:Ng,children:"Projects"}),!r&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:DT})]});if(r)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[m,s.jsx(I5,{why:r==="not_in_git"?{kind:"not_in_git"}:HT(r)})]});const h=l!=null&&l.shown?l:null,x=(a??[]).filter(y=>y.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:B0(h.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:uj,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:y=>f(y.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 ${kg}`}),!h&&s.jsx("button",{type:"button",className:`${uj} 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 ${Gi(i)}; reading again in ${l.retryInSeconds??10} seconds.`})]}),n?s.jsx(H5,{}):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(y=>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(y.id)}`),className:Sg,children:y.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:y.location??ed}),s.jsx("td",{className:"px-3 py-2 text-right",children:y.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"})})]},y.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 MS({title:e,children:t}){const{href:n,Link:a}=Fe();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:Ng,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 ${Sg}`,children:"Back to the organization's Home"})})]})})}const P5={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Ho({project:e}){const{href:t,Link:n}=Fe(),{org:a,projects:r,loading:l,domains:i}=Jn(),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:Yd}):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:Ng,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??ed})]}),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:Sg,children:P5[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(MS,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(wi,{})}const vc=e=>e instanceof Error?e.message:String(e);async function OS(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:vc(t)}}}async function q5(){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 G5(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function V5(){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 Y5(){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:vc(e)}}}async function DS(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:vc(n)}}}}async function F5(){try{return(await fetch("api/threads/archive",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function K5(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 X5(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 W5(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 K5(n)}catch(n){return vc(n)}}async function Q5(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 vc(n)}}const Z5={probe:{source:async()=>{const e=await OS();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},zS={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},J5={label:"Local viewer",can:()=>!1};function e8(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(T0,{data:Z5,router:zS,identity:J5,children:s.jsx(FR,{})})})}const dj="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.",ju=15,t8="New waits that would close a loop are refused. One thread hands its part over or asks the user.",n8="Threads in line for a queue are on Queues; threads that wait on you are marked Needs you on Threads.";function s8(){const e=pn().blockers;if(!e)throw new Error("The Blockers page rendered without the blockers seam.");return e}const Ar=(e,t,n)=>`${e} ${e===1?t:n}`;function op(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 a8(e,t){return t?e===null?`Not reading · trying again every ${ju}s`:`Not reading since ${kn(e/1e3)} · trying again every ${ju}s`:e===null?"Connecting…":`Live · read ${kn(e/1e3)} · refreshes every ${ju}s`}function r8(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 ${op(e.heard_hours)}`):e.heard_hours!==null&&t.push(`heard ${op(e.heard_hours)} ago`),t.join(" · ")}function l8(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 i8(e,t){const n=Ar(e.blocked_threads,"thread waits","threads wait"),a=`in ${Ar(t,"wait loop","wait loops")}`;return e.blockers?`${n} on ${Ar(e.blockers,"blocker","blockers")}${t?` and ${a}`:""}`:`${n} ${a}`}const o8=e=>e.replace(/\s*\(status release\)$/,"");function c8({org:e}){const t=s8(),n=es(),[a,r]=u.useState(null),[l,i]=u.useState(null),o=ps(),c=u.useRef(0),d=u.useCallback(async x=>{const y=c.current+=1,v=await o.track(t.report(x?{fresh:!0}:void 0));y===c.current&&(v.ok?(r(v.data),i(null)):i(v.refusal))},[t,o]);u.useEffect(()=>{d(!1)},[d]);const f=u.useMemo(()=>yf(o,()=>void d(!1)),[d,o]);if(rr(f,ju*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(ea,{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(nn,{title:"Blockers",description:dj}),s.jsxs(ce,{variant:"warning",className:"mt-6",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{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(nn,{title:"Blockers",description:dj}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:a8(m,h!==null)}),!a&&!l?s.jsx(u8,{}):null,h?s.jsx(d8,{refusal:h,on_retry:()=>void d(!0)}):null,a?s.jsx(f8,{org:e,report:a,stale:h!==null}):null]})}function u8(){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(bt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function d8({refusal:e,on_retry:t}){const n=s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"});return e.reason==="store_locked"?s.jsxs(ce,{variant:"info",className:"mt-4",children:[s.jsx(Rn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"The local stores are busy"}),s.jsxs(fe,{children:[s.jsx("p",{children:e.message}),n]})]}):s.jsxs(ce,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Blockers could not be read"}),s.jsxs(fe,{children:[s.jsx("p",{children:e.message||"The read did not answer. Try again in a moment."}),n]})]})}function Nf(e){const{href:t,Link:n}=Fe(),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 f8({org:e,report:t,stale:n}){const{href:a,Link:r}=Nf(e),{summary:l}=t,i=n?` · last read ${kn(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:`${i8(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:[n8,i]})]})}),t.loops.map(d=>s.jsx(h8,{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(ue,{variant:"neutral",children:t.blockers.length})]}),t.blockers.map(d=>s.jsx(p8,{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: ${Ar(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: ${Ar(f,"thread","threads")} in the main queue`:`In line for ${d}: ${Ar(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 h8({org:e,loop:t}){const{href:n,Link:a}=Nf(e),r=m8(t.waiters);return s.jsxs("div",{className:"mt-4 flex flex-col gap-3",children:[s.jsxs(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:l8(t)}),s.jsxs(fe,{children:[s.jsx("p",{children:t8}),s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.threads.map(l=>l.thread.startsWith("exec-")?null:s.jsx(V,{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: ${Ar(r,"thread","threads")}`}),s.jsx(Cg,{org:e,waiters:t.waiters})]}):null]})}const m8=e=>new Set(function t(n){return n.flatMap(a=>[a.thread,...t(a.waiters??[])])}(e)).size;function p8({org:e,card:t}){const{name:n}=Nf(e),a=r8(t.state);return s.jsxs(ft,{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(ue,{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 ${o8(t.clears)}`}),s.jsx("div",{className:"mt-1",children:s.jsx(Cg,{org:e,waiters:t.waiters})})]})}function Cg({org:e,waiters:t,via:n}){const{name:a}=Nf(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 ${op(r.age_hours)} · ${[n?`via ${n}`:"",r.reason.trim()].filter(Boolean).join(" · ")||"no reason given"}`}),(l=r.waiters)!=null&&l.length?s.jsx(Cg,{org:e,waiters:r.waiters,via:r.title}):null]},`${r.hold}-${r.thread}`)})})}const x8="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.",g8=3e4,v8="Reading the workspaces. On a plan workspace this can take a few minutes.",y8="The read failed. Details are in the terminal running sdlc viewer.",j8={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"}},b8=e=>j8[e]??{label:e,tone:"neutral"},Pa=e=>e.slice(0,8),LS={human:"Human",ai:"AI"},cp=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function w8(){const e=pn().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function _8(e){const t=w8(),[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 j=(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=j,j},[t]);u.useEffect(()=>{m()},[m]),rr(()=>void m(),g8),u.useEffect(()=>{var j;d.current&&(n||r)&&(d.current=!1,(j=c.current)==null||j.focus())},[n,r]);const h=()=>{d.current=!0,m()},x=n===null&&r===null,y=n===null&&r!==null,v=n?N8(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(nn,{title:"Workspaces",description:x8,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(V,{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(Xr,{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?US(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(k8,{}):null,y&&r?s.jsx(S8,{refusal:r,on_retry:h}):null,n?s.jsx(C8,{overview:n}):null]})]})}function US(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 N8(e,t){const n=`Read at ${Ts(new Date(e.read_at).toISOString())}`,a=US(e,t);return a?`${n} · ${a}`:n}function k8(){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(bt,{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:v8})]})}function S8({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?B0(e,null):y8;return s.jsxs(ce,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not read workspaces"}),s.jsxs(fe,{children:[s.jsx("p",{children:n}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function C8({overview:e}){const{counts:t}=e,n=[cp(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(Xc,{id:"workspaces-lineage",title:"Lineage",caption:"Each workspace under the one it forked from",children:s.jsx(R8,{rows:e.workspaces})}),s.jsx(Xc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(E8,{authority:e.authority})})]}),s.jsx(Xc,{id:"workspaces-activity",className:"mt-4",title:"Integration activity",caption:"Newest first",children:e.activity.length===0?s.jsx(fj,{children:"No integration or reconciliation attempts yet."}):s.jsx(A8,{rows:e.activity})}),s.jsx(Xc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(fj,{children:"No Handoffs prepared yet."}):s.jsx($8,{rows:e.handoffs})})]})}function Xc({id:e,title:t,caption:n,className:a,children:r}){return s.jsxs("section",{"aria-labelledby":e,className:oe("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 fj=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),yd=({children:e,tone:t})=>s.jsx("div",{className:oe("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function Po({status:e}){const t=b8(e);return s.jsx(ue,{variant:t.tone,children:t.label})}function kf({label:e,children:t}){return s.jsx(ft,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function R8({rows:e}){return s.jsx(kf,{label:"Workspaces",children:s.jsxs(Ve,{containerClassName:"overflow-visible",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Workspace"}),s.jsx(K,{children:"Actor"}),s.jsx(K,{children:"Forked from"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Projection"})]})}),s.jsx(Ye,{children:e.map(t=>s.jsxs(de,{"data-testid":"workspaces-row",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(yd,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(yd,{children:t.projection_error})]}),s.jsx(Y,{children:LS[t.actor]}),s.jsx(Y,{children:t.source_id?s.jsx("span",{className:"font-mono",children:Pa(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(Y,{children:s.jsx(Po,{status:t.status})}),s.jsx(Y,{children:s.jsx(Po,{status:t.projection})})]},t.id))})]})})}function E8({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:Pa(e.workspace_id)},"id")],["Actor",LS[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(Po,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(kf,{label:"Authority and resolver",children:s.jsx(Ve,{containerClassName:"overflow-visible",children:s.jsx(Ye,{children:n.map(([a,r])=>s.jsxs(de,{children:[s.jsx(K,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(Y,{children:r})]},a))})})})}function T8(e){const t=[e.merge_attempts?cp(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?cp(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 A8({rows:e}){return s.jsx(kf,{label:"Integration activity",children:s.jsxs(Ve,{containerClassName:"overflow-visible",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"Change"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Attempts"}),s.jsx(K,{children:"Updated"})]})}),s.jsx(Ye,{children:e.map((t,n)=>s.jsxs(de,{children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${Pa(t.child_id)} into ${Pa(t.other_id)}`:`Reconcile ${Pa(t.child_id)} from ${Pa(t.other_id)}`}),s.jsx(yd,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(Y,{children:s.jsx(Po,{status:t.status})}),s.jsx(Y,{children:T8(t)}),s.jsx(Y,{children:_1(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function $8({rows:e}){return s.jsx(kf,{label:"Handoffs",children:s.jsxs(Ve,{containerClassName:"overflow-visible",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{children:"From"}),s.jsx(K,{children:"To"}),s.jsx(K,{children:"Status"}),s.jsx(K,{children:"Pinned"})]})}),s.jsx(Ye,{children:e.map(t=>s.jsxs(de,{children:[s.jsxs(Y,{children:[s.jsx("div",{className:"font-mono font-medium",children:Pa(t.child_id)}),t.error?s.jsx(yd,{children:t.error}):null]}),s.jsx(Y,{className:"font-mono",children:Pa(t.source_id)}),s.jsx(Y,{children:s.jsx(Po,{status:t.status})}),s.jsx(Y,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const hj="This machine's worktrees of this repository.",M8="Merge sends one whose thread is at rest to the main queue.",O8=3e4,D8=3e3,z8=6e5,Mh=[{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"}],Bi={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"}},L8="no thread to land it",Rg="its thread waits on you",BS="its thread is done",IS="its thread is retired",Eg=e=>e.archivable&&e.cleanup==="user",U8=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",B8=e=>!e.merge.offered&&(e.merge.why===BS||e.merge.why.startsWith(IS)),Tg=e=>!e.merge.offered&&e.merge.why===L8||B8(e),Oh=(e,t)=>t==="all"?!0:t==="decide"?Eg(e):(e.landed!==null?"landed":U8(e)?"queued":Tg(e)?"orphan":"needs")===t,I8=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!Tg(e);function bu(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 HS(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function H8(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 Dh=e=>Ts(new Date(e*1e3).toISOString()),Xi=e=>e.charAt(0).toUpperCase()+e.slice(1);function P8(e,t){var r;const n=t.phase?Xi(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(IS)){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===BS?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===Rg?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function q8(){const e=pn().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function G8({org:e}){var M,F;const t=q8(),[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(""),[y,v]=u.useState({}),j=u.useRef({}),{confirm:g,confirm_dialog:p}=fi(),b=u.useRef(!1),w=u.useCallback(async()=>{if(b.current)return;b.current=!0;const T=await t.list();b.current=!1,T.ok?(a(T.data),l(null)):l(T.refusal)},[t]),S=u.useCallback(async()=>{const T=await t.sizes();d(!T.ok),T.ok&&o(T.data)},[t]);u.useEffect(()=>{w(),S()},[w,S]);const C=(n==null?void 0:n.rows.some(T=>{var H,X;return((H=T.write)==null?void 0:H.state)==="waiting"||((X=T.write)==null?void 0:X.state)==="running"}))??!1;rr(()=>void w(),C?D8:O8),rr(()=>void S(),z8);const _=(n==null?void 0:n.rows)??[],N=T=>i==null?void 0:i.sizes[T.path],O=_.filter(Eg),D=i?O.reduce((T,H)=>T+(N(H)??0),0):null,B=_.length===0?hj:`${hj} ${M8}${O.length?` ${O.length} ${O.length===1?"is":"are"} yours to decide${D!==null?`: removing them frees about ${bu(D)}`:""}.`:""}`,P=h.trim().toLowerCase(),I=T=>!P||[T.name,T.path,T.branch??"",...T.threads.map(H=>H.title??H.thread)].some(H=>H.toLowerCase().includes(P)),A=_.filter(T=>Oh(T,f)&&I(T)).sort((T,H)=>{if(f==="decide")return(N(H)??0)-(N(T)??0);const X=Z=>I8(Z)?Z.merge.offered?0:1:2;return X(T)-X(H)||(T.idle_days??1/0)-(H.idle_days??1/0)}),$=async(T,H)=>{const X=await(T==="merge"?t.merge(H.path):t.remove(H.path));X.ok?v(({[H.path]:Z,...ae})=>ae):v(Z=>({...Z,[H.path]:X.refusal.message})),await w()},R=async T=>{if(!T.merge.offered)return;const H=T.threads.find(te=>te.thread===(T.merge.offered&&T.merge.thread)),X=(H==null?void 0:H.title)??T.merge.thread,Z=H!=null&&H.holds.length?`has ${H.holds.length} open hold(s) (${H.holds.join(", ")})`:"has no open holds",ae=T.merge.lands.by==="manager"?`on its turn the queue's merge manager, ${T.merge.lands.manager}, lands it on main`:"on its turn that thread lands it on main",we=T.merge.caveat?`
|
|
406
|
+
|
|
407
|
+
Its session could not be read: ${T.merge.caveat}. A turn it does not start passes on.`:"";await g({title:`Send ${T.name} to the main queue`,description:`This joins the main promotion queue for its thread, ${X}, which ${Z} and is told of the join. The queue checks the branch first, and ${ae}. Nothing reaches main before then.${we}`,action_label:"Join the main queue"})&&await $("merge",T)},E=async T=>{const H=N(T);await g({title:`Remove ${T.name}?`,description:`This deletes the folder ${T.path}${H!==void 0?` and frees about ${bu(H)}`:""}.${T.branch?` Its branch ${T.branch} stays, so its work can be checked out again,`:""} and its task records are saved first; a landed plan workspace in it is closed. It stays with you because ${T.cleanup_why[0]??"the Local systems manager leaves it to you"}. The worktree is checked again just before, and nothing is deleted if that check finds work in it.`,action_label:"Remove worktree",destructive:!0})&&(H!==void 0&&(j.current[T.path]=H),await $("remove",T))},k=async T=>{await t.dismiss(T),await w()};return(r==null?void 0:r.reason)==="engine_missing"?s.jsx("div",{className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 sm:px-6 lg:px-8",children:s.jsx(ea,{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(nn,{title:"Worktrees",description:B}),!n&&!r&&s.jsx(V8,{}),r?s.jsx(Y8,{refusal:r,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(ce,{variant:"destructive",className:"mt-4",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not read worktrees"}),s.jsxs(fe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",Ts(new Date(n.read_at).toISOString()),"."]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void w(),children:"Retry"})]})]}):null,n==null?void 0:n.removals.map(T=>s.jsxs(ce,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(ke,{children:j.current[T.path]!==void 0?`Removed ${T.name} and freed ${bu(j.current[T.path])}`:`Removed ${T.name}`}),s.jsxs(fe,{children:[s.jsx("p",{children:T.branch?`Its branch ${T.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void k({removal:T.path}),children:"Dismiss"})]})]},T.path)),n&&_.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(D0,{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(Tt,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:h,onChange:T=>x(T.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",Ts(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:Mh.map(T=>s.jsxs(V,{type:"button",variant:"outline",size:"sm",className:fo,"aria-pressed":f===T.id,onClick:()=>m(T.id),children:[T.label," ",_.filter(H=>Oh(H,T.id)).length]},T.id))}),A.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(Gd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),P?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(M=Mh.find(T=>T.id===f))==null?void 0:M.empty," matches “",h,"”. Clear the search to see all"," ",_.filter(T=>Oh(T,f)).length,"."]}),s.jsx(V,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(F=Mh.find(T=>T.id===f))==null?void 0:F.empty," right now."]})]}):s.jsx(ft,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Ve,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(et,{children:s.jsxs(de,{children:[s.jsx(K,{className:"w-[24%]",children:"Worktree"}),s.jsx(K,{className:"w-[24%]",children:"Threads"}),s.jsx(K,{className:"w-[12%]",children:"Landed"}),s.jsx(K,{className:"w-[18%]",children:"Cleanup"}),s.jsx(K,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(K,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(Ye,{children:A.map(T=>s.jsx(F8,{org:e,row:T,size:N(T),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:y[T.path],on_merge:()=>void R(T),on_remove:()=>void E(T),on_dismiss:H=>void k(H),on_clear_sent:()=>v(({[T.path]:H,...X})=>X)},T.path))})]})})]}):null,p]})}function V8(){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(bt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function Y8({refusal:e,read_at:t,on_retry:n}){const a=es();return e.reason==="view_outdated"?s.jsxs(ce,{variant:"warning",className:"mt-6",children:[s.jsx(tn,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:Wr}),s.jsx(fe,{children:a})]}):s.jsxs(ce,{variant:"destructive",className:"mt-6",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"Could not read worktrees"}),s.jsxs(fe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${Ts(new Date(t).toISOString())}.`:""]}),s.jsx(V,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Wc({children:e,muted:t=!0}){return s.jsx("div",{className:oe("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function F8({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}=Fe(),h=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${h}/threads`),y=f(`${h}/tasks`),v=Bi[t.landed??"not_landed"],j=Eg(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===Rg,C=r&&t.landed===null&&!t.queue&&!S&&!Tg(t),_=n!==void 0?bu(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,N=j?{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(de,{"data-testid":"worktrees-row",children:[s.jsxs(Y,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(Wc,{children:t.branch??"Detached"}),D!==".sdlc-worktrees"?s.jsx(Wc,{children:`in ${D}`}):null]}),s.jsx(Y,{children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:b.title??b.thread,children:b.title??b.thread}),s.jsx(Wc,{children:`${P8(t,b)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(Y,{children:s.jsx(ue,{variant:v.tone,children:v.label})}),s.jsxs(Y,{children:[s.jsx("div",{className:oe("truncate",N.muted&&"text-muted-foreground"),children:N.label}),O?s.jsx("div",{className:"hidden md:block",children:s.jsx(Wc,{children:O})}):null]}),s.jsx(Y,{className:"hidden md:table-cell",children:H8(t.idle_days)}),s.jsx(Y,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(V,{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(ue,{variant:Bi.queued.tone,children:`${Bi.queued.label} · ${HS(t.queue.position)}`}):S?s.jsx(m,{href:y,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(ue,{variant:Bi.needs_you.tone,children:Bi.needs_you.label})}):C?s.jsx(V,{type:"button",variant:"outline",size:"sm",title:w.offered?void 0:w.why,"aria-disabled":!w.offered||void 0,className:oe(!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,j&&r&&!p?s.jsx(V,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(K8,{row:t,threads:x,tasks:y,merge_shown:C,sent:l,on_dismiss:c,on_clear_sent:d})]})}function K8({row:e,threads:t,tasks:n,merge_shown:a,sent:r,on_dismiss:l,on_clear_sent:i}){var y,v,j,g;const{Link:o}=Fe(),c=(p="Open in Threads")=>s.jsx(o,{className:"text-primary text-sm hover:underline",href:t,children:p}),d=p=>s.jsx(V,{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(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:"It was not sent"}),s.jsxs(fe,{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=((y=f.lands)==null?void 0:y.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(ce,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(ke,{children:`${e.name} joined the main queue, ${HS(f.position)}`}),s.jsxs(fe,{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 ${Dh(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),!f.told||((j=e.queue)==null?void 0:j.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(ce,{variant:"destructive",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(fe,{children:[s.jsx("p",{children:`${Xi(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({write:e.path})),f.kind==="merge"?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(e.last_turn){const p=e.last_turn;x=s.jsxs(ce,{variant:"warning",children:[s.jsx(nt,{className:"size-4","aria-hidden":"true"}),s.jsx(ke,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Dh(p.left_at)}`}),s.jsxs(fe,{children:[s.jsx("p",{children:`${Xi(p.reason)}. Continue the thread in its session; Merge sends it again once it is at rest.`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>l({turn:{execution:p.execution,left_at:p.left_at}})),s.jsx("span",{className:"mt-2",children:c()})]})]})]})}else((g=e.queue)==null?void 0:g.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?x=s.jsxs("p",{className:"text-sm",role:"status",children:[`Its turn now: ${e.name} is first in the main queue. Continue its thread in its session, or the turn passes on at ${Dh(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===Rg?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:["Its thread waits on you. Merge comes back once you answer it. ",s.jsx(o,{className:"text-primary hover:underline",href:n,children:"In Waiting on you"})]}):!e.merge.offered&&e.merge.successor&&!e.queue&&e.landed===null?x=s.jsx("p",{className:"text-sm",children:c("Open its successor in Threads")}):a&&!e.merge.offered?x=s.jsxs("p",{className:"text-sm",id:`why-${e.name}`,children:[`${Xi(e.merge.why)}. `,e.merge.thread&&!e.merge.why.startsWith("its thread is at work")?c():null]}):e.merge.offered&&e.merge.caveat&&(x=s.jsx("p",{className:"text-muted-foreground text-sm",children:`${Xi(e.merge.caveat)}.`}));return x?s.jsx(de,{className:"hover:bg-transparent",children:s.jsx(Y,{colSpan:6,className:"pt-0",children:x})}):null}const X8=["reason","since","store","repository","folder","home","member_path"];function Ag(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 X8){const r=t==null?void 0:t[a];typeof r=="string"&&(n[a]=r)}return n}function fr({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:Ag(i.status,o)}}}function W8(e={}){const t=fr(e),n=Sf(e),a=l=>async()=>{const i=await t("access");return i.ok?{ok:!0,data:i.data[l]}:i},r=encodeURIComponent;return{tasks:{access:a("tasks"),configuration:()=>t("tasks/configuration"),listTasks:l=>t(`tasks/lists/${r(l)}/tasks`),task:l=>t(`tasks/tasks/${r(l)}`)},issues:{access:a("issues"),list:(l={})=>t("issues",l),issue:l=>t(`issues/${r(l)}`),issueSections:l=>t(`issues/${r(l)}/sections`),issueRelated:l=>t(`issues/${r(l)}/related`),openAnchor:l=>n("open-anchor",l)},releases:{access:a("releases"),list:()=>t("releases"),release:l=>t(`releases/${r(l)}`),candidate:()=>t("releases/candidate")},organizations:{access:a("organizations"),list:()=>t("orgs")},projects:{access:a("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function Q8(e={}){const t=fr(e),{base:n="",fetcher:a=fetch}=e;return{timing:async()=>{let l;try{l=await a(`${n}api/queues`,{cache:"no-store"})}catch{return wr("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"?wr(typeof(i==null?void 0:i.error)=="string"&&i.error?i.error:"The work queues could not be read."):{ok:!0,data:Z8(i)}:{ok:!1,refusal:Ag(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 wr=e=>({ok:!1,refusal:{status:0,message:e}}),sn=e=>typeof e=="string"&&e?e:void 0;function Z8(e){const t=Array.isArray(e==null?void 0:e.cards)?e.cards:[];return{caption:sn(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=sn((c=r.find(f=>f.kind==="memory"))==null?void 0:c.text),o=(Array.isArray(n.rows)?n.rows:[]).map(f=>{var j;const m=Array.isArray(f.parts)?f.parts:[],h=g=>{var p;return sn((p=m.find(b=>b.kind===g))==null?void 0:p.text)},x=(sn(f.detail)??"").split(" · "),y=sn(f.estimate)??(m.length||!sn(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:sn(f.execution),key:sn(f.key),title:sn(f.title)??"",turn:sn(f.turn)??"Waiting",elapsed:h("elapsed")??x[0]??"",estimate:y??(v?x.at(-1):void 0),basis:sn(f.estimateTitle),command:sn((j=m.find(g=>g.kind==="command"))==null?void 0:j.title)??h("command")??(v?x[1]:void 0),memory:h("memory")??(v?x[2]:void 0),reason:h("reason")}});return{key:sn(n.key)??"",name:sn(n.name)??"",clears:sn(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:sn(n.error)??(l&&n.summary==="Not available"?"no answer":void 0),rows:o}})}}function Sf({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 wr("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:Ag(r.status,l)}}}function J8(e={}){const t=fr(e),n=Sf(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function eU(e={}){const t=fr(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(wr("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(wr("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()=>wr("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 wr("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 tU(e={}){const t=fr(e),n=Sf(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 nU(e={}){const t=fr(e),n=Sf(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 sU(e={}){const t=fr(e);return{report:n=>t("blockers",n!=null&&n.fresh?{fresh:1}:{})}}function aU(e={}){const t=fr(e);return{overview:()=>t("workspaces")}}const rU=new Set(["not_terminal","another_process","continued","no_open","pending"]);function lU(e){return e==="terminal_denied"?"you":rU.has(e)?"muted":"alert"}function iU(e){return e.replace(/\.*$/,".")}function mj(e){return e.commands?{...e,commands:{...e.commands,open_thread:(t,n)=>oU(t,n)}}:e}async function oU(e,t,n=DS){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:iU(i),role:lU(l),...l==="outdated"?{outdated:!0}:{}}}}}const PS=[["stage","Stage"],["blocker","Blocker"],["recent","Recent"]],cU=10,qS="Threads you pinned; they stay first in every order";function up(e,t,n){var P,I;const{order:a,folded:r,showAll:l,narrowed:i,max:o=cU}=n,c=new Map(e.map(A=>[A.key,A])),d=A=>A.pinned===!0,f=A=>{var R;if(d(A)||!A.blockedBy||!c.has(A.blockedBy))return!1;const $=new Set([A.key]);for(let E=A.blockedBy;E&&c.has(E);E=(R=c.get(E))==null?void 0:R.blockedBy){if($.has(E))return!1;$.add(E)}return!0},m=new Map;for(const A of e){if(!f(A))continue;const $=m.get(A.blockedBy)??[];$.push(A),m.set(A.blockedBy,$)}const h=A=>m.get(A.key)??[],x=A=>Math.max(A.mtimeMs??0,...h(A).map(x)),y=A=>!!A.needsYou||h(A).some(y),v=A=>A.activeSince!==void 0,j=(A,$)=>v(A)!==v($)?v(A)?-1:1:y(A)!==y($)?y(A)?-1:1:v(A)?A.activeSince-$.activeSince||A.key.localeCompare($.key):x($)-x(A),g=(A,$)=>Number(v($))-Number(v(A))||(v(A)?$.activeSince-A.activeSince:($.mtimeMs??0)-(A.mtimeMs??0))||A.key.localeCompare($.key),p=l||i,b=!i,w=(A,$=0)=>a==="blocker"?[{row:A,depth:$},...h(A).flatMap(R=>w(R,$+1))]:[{row:A,depth:0}],S=A=>a==="blocker"?1+h(A).reduce(($,R)=>$+S(R),0):1,C=A=>A.reduce(($,R)=>$+S(R),0),_=(A,$,R,E,k,M)=>{const F=!k||!r.has(A);return{key:A,label:$,...M?{hint:M}:{},count:E,folds:k,open:F,rows:F?R.flatMap(T=>w(T)):[]}},N=e.filter(d),O=e.filter(A=>!d(A)),D=[];N.length&&D.push(_("pinned","Pinned",N,C(N),b,qS));let B=null;if(a==="stage"){const A=new Set(t.map(([E])=>E)),$=new Map(t.map(([E])=>[E,[]]));for(const E of O)(P=$.get(E.stage&&A.has(E.stage)?E.stage:"none"))==null||P.push(E);for(const[E,k,M]of t){const F=($.get(E)??[]).sort(j);if(!F.length)continue;const T=E==="none"&&!p?F.slice(0,o):F;D.push({..._(E,k,T,F.length,b&&E!=="none",M),count:F.length})}const R=((I=$.get("none"))==null?void 0:I.length)??0;!i&&R>o&&(B={total:R,unstaged:!0})}else{const A=a==="recent"?[...O].sort(g):O.filter($=>!f($)).sort(j);if(A.length){const $=p?A:A.slice(0,o),R=_("others",N.length?"Other threads":null,$,C(A),!!N.length&&b);D.push(R),!i&&R.open&&A.length>o&&(B={total:A.length,unstaged:!1})}}return{groups:D,more:B}}function uU(e,t,n,a){const l=up(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=!up(e,t,{...n,folded:new Set}).groups.some(c=>c.rows.some(d=>d.row.key===a));return{group:l.key,capped:o}}const dU=15e3,fU=10,pj="idle-sessions-list",xj="idle-sessions-heading",gj="idle-sessions-confirm-text";function GS(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const hU=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,VS=e=>e===1?"1 session":`${e} sessions`;function mU(e){const t=e.released.length?`Closed ${VS(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function pU({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${hU(e.idle_hours)}`,GS(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 xU(){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),y=u.useRef(null),v=u.useRef(null),j=u.useRef(null),g=u.useRef(0),p=u.useRef(0),b=u.useCallback(async()=>{const I=++g.current,A=await V5();if(!A||I<p.current)return;p.current=I,m("");const $=JSON.stringify(A);$!==h.current&&(h.current=$,t(A))},[]);u.useEffect(()=>{const I=setTimeout(b,0),A=setInterval(b,dU);return()=>{clearTimeout(I),clearInterval(A)}},[b]),u.useEffect(()=>{var A;const I=j.current;I&&(j.current=null,(A={cancel:y,close:x,dismiss:v}[I].current)==null||A.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),j.current="cancel")},C=()=>{i===null&&(l(!1),j.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),m("");const I=await Y5();p.current=g.current+1,await b(),o(null),l(!1),a(!1),"error"in I?(m(`The sessions were not closed: ${I.error.replace(/\.+$/,"")}.`),j.current="close"):(d(I.done),j.current="dismiss")},N=()=>{d(null),j.current="close"},O=I=>{I.key==="Escape"&&(I.preventDefault(),C())},D=i!==null?`Closing ${VS(i)}…`:c?mU(c):"",B=(e==null?void 0:e.sessions.slice(0,fU))??[],P=w-B.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":xj}:{"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:xj,"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 · ",GS(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":pj,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(I=>!I),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:pj,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[B.map(I=>s.jsx(pU,{row:I},I.session)),P>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",P," more"]})})]}),r&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":gj,onKeyDown:O,children:[s.jsxs("p",{id:gj,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:y,"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(I=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:I.title}),s.jsx("p",{className:"caption muted",children:I.why})]},I.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 vj={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function _i(e){return e&&Object.hasOwn(vj,e)?vj[e]:"grey"}const gU=1e4,vU=6e4,yU=2,zh="#thread-",jU=["pin","archive-thread","details-toggle","holds-toggle"],bU=2e4,wU=300,_U="Its work goes to whoever carries it on, or it stays in the list as left work if nobody can.",NU=I0("Threads"),kU={working:"▶",prod:"↑",planned:"○"},yj=3,Qc=2,jj=["working","ready","prod","waiting","blocked","paused","planned"],SU={ready:"results ready",prod:"ready for prod"};function CU(e){const t=jj.map(a=>[a,e.filter(r=>r.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!jj.includes(a)))].map(a=>[a,e.filter(r=>r.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,r])=>`${r} ${SU[a]??a}`).join(" · ")}const RU={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 EU(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 dp=[["running","Running"],["you","Needs you"],["blocked","Blocked"],["paused","Paused"],["idle","Idle"]],fp=[["claude","Claude"],["codex","Codex"]],bj={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"},wj=e=>e.kind??"idle",_j=e=>e.agent==="Codex"?"codex":"claude";function Nj(e,t,n,a){const r=n.toLowerCase().split(/\s+/).filter(Boolean),l=dp.map(([v])=>v).filter(v=>a.has(v)),i=fp.map(([v])=>v).filter(v=>a.has(v)),o=v=>!l.length||l.includes(wj(v)),c=v=>!i.length||i.includes(_j(v)),d=v=>{if(!r.length)return!0;const j=v.search??v.title.toLowerCase();return r.every(g=>j.includes(g))},f=e.filter(d),m={};for(const[v]of dp)m[v]=f.filter(j=>c(j)&&wj(j)===v).length;for(const[v]of fp)m[v]=f.filter(j=>o(j)&&_j(j)===v).length;const h=[],x=[],y=[];return e.forEach((v,j)=>{y.length=Math.min(y.length,v.depth);const g=v.depth>0?y[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:j<t&&v.pinned!==!1},(b.pinned?h:x).push({row:v,depth:b.depth})),y.push(b)}),{rows:[...h,...x],pinned:h.length,counts:m,narrowed:r.length+l.length+i.length>0}}const YS="sdlc-viewer:threads-arrange",kj={order:"blocker",compact:!1,folded:[],showAll:!1,archived:!1};function TU(){try{const e=JSON.parse(window.localStorage.getItem(YS)??"{}");return{order:PS.some(([t])=>t===e.order)?e.order:kj.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 kj}}function AU(e){try{window.localStorage.setItem(YS,JSON.stringify(e))}catch{}}const $U=new Set(["not_terminal","another_process","continued","no_open","pending"]);function Lh({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 Zc({text:e,role:t}){return s.jsx("span",{className:`badge tone-${_i(t)}`,children:e})}function MU({serves:e}){const t=e.slice(0,yU),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 OU=4;function Sj({track:e}){return s.jsxs("span",{className:"track",children:[s.jsx("span",{className:"track-dots","aria-hidden":"true",children:Array.from({length:OU},(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 DU({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(Sj,{track:t})]})," · ",s.jsxs("span",{className:`tag tone-${_i(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(Sj,{track:t})]})]})}function Cj({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 zU({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,y]=u.useState(""),[v,j]=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),P=u.useRef(null),[I,A]=u.useState(null),[$,R]=u.useState(null),[E,k]=u.useState(null),[M,F]=u.useState(""),[T,H]=u.useState(()=>new Set),[X,Z]=u.useState(null),[ae,we]=u.useState(TU),W=z=>we(ee=>{const re={...ee,...z};return AU(re),re}),[te,Se]=u.useState({groups:[],all:!1}),[le,je]=u.useState(()=>new Set),[me,$e]=u.useState(()=>new Set),xe=u.useRef(ae.archived),Ce=u.useRef(0),J=u.useRef(null),G=u.useRef(""),ne=u.useRef(""),se=u.useRef(""),Ke=u.useRef(null),Xe=u.useRef(null),rt=u.useRef(null),ye=z=>{var re;if(!(z instanceof HTMLButtonElement)||!((re=Ke.current)!=null&&re.contains(z))||!z.dataset.key)return null;const ee=jU.find(pe=>z.classList.contains(pe));return ee?`${ee} ${z.dataset.key}`:null},tt=z=>{rt.current=ye(z.target)},It=()=>{setTimeout(()=>{ye(document.activeElement)||(rt.current=null)},0)},Ht=u.useCallback(async()=>{const z=++Ce.current,ee=await OS(xe.current);if(z!==Ce.current)return;const re=_.current;if(re&&z>re.after&&O(Te=>Te+1),"none"in ee){i(!0),c(""),e("live");return}if("error"in ee){c(ee.error),e("disconnected");return}i(!1),c(""),y(""),C(""),e("live");const pe=JSON.stringify(ee.data);pe!==G.current&&(G.current=pe,r(ee.data))},[e]);u.useEffect(()=>{let z=!0;const ee=B.current;G5().then(Te=>z&&f(Te)),F5().then(Te=>z&&j(Te));const re=setTimeout(Ht,0),pe=setInterval(Ht,gU);return()=>{z=!1,clearTimeout(re),clearInterval(pe);for(const Te of ee.values())clearTimeout(Te);ee.clear()}},[Ht]),u.useEffect(()=>{let z=!0;const ee=()=>q5().then(pe=>{z&&pe&&A(Te=>JSON.stringify(Te)===JSON.stringify(pe)?Te:pe)});ee();const re=setInterval(ee,vU);return()=>{z=!1,clearInterval(re)}},[]),u.useEffect(()=>{const z=()=>{var St,Bn,In;const re=window.location.hash;if(!re.startsWith(zh)){k(null);return}if(re===ne.current)return;let pe;try{pe=decodeURIComponent(re.slice(zh.length))}catch{pe=re.slice(zh.length)}const Te=document.getElementById(`thread-${pe}`);if(!Te||!((St=Ke.current)!=null&&St.contains(Te))){if(!Ke.current||!a)return;const js=se.current!==re;if(se.current=re,a.threads.some(ki=>ki.key===pe)){const ki=(M||T.size)&&!Nj(a.threads,a.pinnedCount??0,M,T).rows.some(q=>q.row.key===pe),ta=a.stages&&(js||!ki)?uU(a.threads,a.stages,{order:ae.order,folded:new Set,showAll:!1,narrowed:!1},pe):null,Si=ta!==null&&ae.folded.includes(ta.group)&&!te.groups.includes(ta.group),el=ta!==null&&ta.capped&&!ae.showAll&&!te.all;js&&(M||T.size)&&(F(""),H(new Set)),js&&(M||T.size)||Si||el?(Si||el)&&Se(q=>({groups:Si&&ta?[...q.groups,ta.group]:q.groups,all:q.all||el})):ne.current=re,k(null);return}k(pe);return}ne.current=re,k(null),R(pe),(Bn=Te.querySelector(".thread-title"))==null||Bn.focus({preventScroll:!0}),(In=Te.scrollIntoView)==null||In.call(Te,{block:"center"})},ee=()=>{ne.current="",se.current="",z()};return z(),window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[a,M,T,ae,te]),u.useEffect(()=>{if(!$)return;const z=()=>R(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=rt.current??(Xe.current?`pin ${Xe.current}`:null);if(!z||!Ke.current)return;const[ee,re]=[z.slice(0,z.indexOf(" ")),z.slice(z.indexOf(" ")+1)],pe=document.activeElement;if(pe&&pe!==document.body&&!Ke.current.contains(pe)){rt.current=null;return}const Te=[...Ke.current.querySelectorAll(`button.${ee}`)].find(St=>St.dataset.key===re);Te?pe!==Te&&Te.focus({preventScroll:re!==Xe.current}):rt.current=null}),u.useLayoutEffect(()=>{var Bn;const z=_.current;if(!z||!Ke.current)return;_.current=null;const ee=[...Ke.current.querySelectorAll("button.archive-thread")].find(In=>In.dataset.key===z.key);if(ee){ee.focus();return}const re=z.order.indexOf(z.key),Te=[...z.order.slice(re+1),...z.order.slice(0,Math.max(re,0)).reverse()].map(In=>document.getElementById(`thread-${In}`)).find(In=>{var js;return In&&((js=Ke.current)==null?void 0:js.contains(In))}),St=Te==null?void 0:Te.querySelector(".thread-title");St?St.focus():(Bn=P.current)==null||Bn.focus()},[N]);const Kt=async z=>{if(m)return;const ee=!z.pinned;Xe.current=z.key,h(z.key);const re=await Q5(z.key,ee);h(null),re||r(pe=>pe&&{...pe,threads:pe.threads.map(Te=>Te.key===z.key?{...Te,pinned:ee}:Te)}),await Ht(),y(re?`The pin was not saved: ${re}`:""),Xe.current===z.key&&(Xe.current=null)},[Le,zn]=u.useState(()=>new Set),[Xt,on]=u.useState({}),gn=es(),{confirm:Pt,confirm_dialog:cn}=fi(),L=(z,ee)=>on(re=>{const{[z]:pe,...Te}=re;return ee?{...Te,[z]:ee}:Te}),he=(z,ee)=>zn(re=>{const pe=new Set(re);return ee?pe.add(z):pe.delete(z),pe}),ge=Object.keys(Xt).some(z=>!Le.has(z));u.useEffect(()=>{if(!ge)return;const z=()=>on(ee=>Object.fromEntries(Object.entries(ee).filter(([re])=>Le.has(re))));return document.addEventListener("pointerdown",z,!0),document.addEventListener("click",z,!0),()=>{document.removeEventListener("pointerdown",z,!0),document.removeEventListener("click",z,!0)}},[ge,Le]);const ct=z=>setTimeout(()=>{var ee,re;return(re=[...((ee=Ke.current)==null?void 0:ee.querySelectorAll("button.open-thread"))??[]].find(pe=>pe.dataset.key===z))==null?void 0:re.focus()},0),ns=async(z,ee)=>{const re=await Pt({title:`Reopen ${z.title} in Terminal?`,description:`Its session is closed. It opens in a new Terminal window in ${ee??"the thread's folder"}, running claude --resume.`,action_label:"Reopen"});return ct(z.key),re},vn=z=>{const ee=D.current.get(z);if(ee&&Date.now()-ee.at<bU)return ee.detail;const re=X5(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:re}),re},Wt=z=>setTimeout(()=>{var ee,re;return(re=[...((ee=Ke.current)==null?void 0:ee.querySelectorAll("button.archive-thread"))??[]].find(pe=>pe.dataset.key===z))==null?void 0:re.focus()},0),U=async z=>{var Te;if(g||b)return;const ee=z.archiveAction==="archive";if(ee){w(z.key);const St=await vn(z.key);w(null);const Bn=await Pt({title:`Archive ${z.title}?`,description:St??_U,action_label:"Archive"});if(Wt(z.key),!Bn){D.current.delete(z.key);return}}const re=[...((Te=Ke.current)==null?void 0:Te.querySelectorAll("article.thread"))??[]].map(St=>St.id.slice(7));p(z.key);const pe=await W5(z.key,ee);D.current.delete(z.key),p(null),_.current={key:z.key,order:re,after:Ce.current},await Ht(),C(pe?`The archive was not saved: ${pe.replace(/\.*$/,".")}`:"")},Ee=async z=>{if(Le.has(z.key))return;let ee=!1;for(;;){he(z.key,!0),L(z.key,{key:z.key,text:RU[z.where??""]??"Opening.",role:"waiting"});const re=await DS(z.key,ee);if(he(z.key,!1),"done"in re){L(z.key,null);return}const{reason:pe,error:Te,where:St}=re.refused;if(pe==="closed"&&!ee){if(L(z.key,null),!await ns(z,St))return;ee=!0;continue}const Bn=pe==="outdated"?`${Te.replace(/\.*$/,".")} ${gn}`:Te.replace(/\.*$/,"."),In=pe==="terminal_denied"?"you":$U.has(pe)?"muted":"alert";L(z.key,{key:z.key,text:Bn,role:In});return}},Oe=(a==null?void 0:a.threads)??[],ut=!l&&Oe.length>0,un=Nj(Oe,(a==null?void 0:a.pinnedCount)??0,M,T),ss=un.pinned,Ln=un.rows,Un=Array.isArray(a==null?void 0:a.stages)?a.stages:null,mr=new Set(ae.folded.filter(z=>!te.groups.includes(z))),Ms=ae.showAll||te.all,be=Un?up(Ln.map(z=>z.row),Un,{order:ae.order,folded:mr,showAll:Ms,narrowed:un.narrowed}):null,We=Un?(a==null?void 0:a.archived)??0:0,Qt=z=>{Se(ee=>({...ee,groups:ee.groups.filter(re=>re!==z)})),W({folded:mr.has(z)?ae.folded.filter(ee=>ee!==z):[...ae.folded.filter(ee=>ee!==z),z]})},yn=()=>{Se(z=>({...z,all:!1})),W({showAll:!Ms})},pr=()=>{const z=!ae.archived;xe.current=z,W({archived:z}),Ht()},Cf=z=>je(ee=>{const re=new Set(ee);return re.has(z)?re.delete(z):re.add(z),re}),Rf=z=>$e(ee=>{const re=new Set(ee);return re.has(z)?re.delete(z):re.add(z),re}),Jr=(z,ee)=>s.jsx(LU,{depth:ee,row:I!=null&&I[z.key]?{...z,serves:I[z.key]}:z,arrived:$===z.key,pinnable:d&&typeof z.pinned=="boolean",pinning:m,onPin:()=>Kt(z),archiveAction:v?z.archiveAction:void 0,archiving:g,previewing:b,onArchive:()=>U(z),onArchiveHover:re=>{const pe=B.current,Te=pe.get(z.key);if(!re){clearTimeout(Te),pe.delete(z.key);return}z.archiveAction!=="archive"||Te!==void 0||pe.set(z.key,setTimeout(()=>{pe.delete(z.key),vn(z.key)},wU))},opening:Le.has(z.key),note:Xt[z.key]??null,onOpen:()=>Ee(z),org:t,project:n,compact:!!Un&&ae.compact,detailsOpen:le.has(z.key),onDetails:()=>Cf(z.key),holdsOpen:me.has(z.key),onHolds:()=>Rf(z.key)});u.useEffect(()=>{if(!ut)return;const z=ee=>{var pe,Te;if(ee.key!=="/"||ee.ctrlKey||ee.metaKey||ee.altKey||ee.defaultPrevented)return;const re=document.activeElement;re&&(/^(INPUT|TEXTAREA|SELECT)$/.test(re.tagName)||re.isContentEditable)||document.querySelector('[role="dialog"], [role="alertdialog"], dialog[open]')||(ee.preventDefault(),(pe=J.current)==null||pe.focus(),(Te=J.current)==null||Te.select())};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[ut]);const Ni=z=>H(ee=>{const re=new Set(ee);return re.has(z)?re.delete(z):re.add(z),re}),Ef=()=>{var z;F(""),H(new Set),(z=J.current)==null||z.focus()},jc=(z,ee)=>{const re=un.counts[z]??0,pe=T.has(z),Te=bj[z];return s.jsxs("button",{type:"button",className:"filter-chip","aria-pressed":pe,"aria-describedby":Te?`chip-hint-${z}`:void 0,disabled:re===0&&!pe&&X!==z,onFocus:()=>Z(z),onBlur:()=>Z(St=>St===z?null:St),onClick:()=>Ni(z),children:[ee," ",re]},z)};return s.jsxs(s.Fragment,{children:[cn,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{ref:P,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(xU,{}),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?Un?s.jsxs(s.Fragment,{children:["Thread ",E," is not in this list.",!ae.archived&&We>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}),ut&&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:J,type:"search",placeholder:"Search threads","aria-label":"Search threads","aria-keyshortcuts":"/",value:M,onChange:z=>F(z.target.value),onKeyDown:z=>{z.key==="Escape"&&(z.preventDefault(),M?F(""):z.currentTarget.blur())}}),M&&s.jsx("button",{type:"button",className:"search-clear","aria-label":"Clear search",onClick:()=>{var z;F(""),(z=J.current)==null||z.focus()},children:s.jsx("span",{"aria-hidden":"true",children:"×"})})]}),Un&&s.jsx("select",{className:"order-select","aria-label":"Order threads",value:ae.order,onChange:z=>W({order:z.target.value}),children:PS.map(([z,ee])=>s.jsx("option",{value:z,children:ee},z))})]}),s.jsxs("div",{className:"filter-row",children:[s.jsx("div",{className:"filter-group",role:"group","aria-label":"Status",children:dp.map(([z,ee])=>jc(z,ee))}),s.jsx("div",{className:"filter-group",role:"group","aria-label":"Agent",children:fp.map(([z,ee])=>jc(z,ee))}),Un&&s.jsx("button",{type:"button",className:"filter-chip","aria-pressed":ae.compact,onClick:()=>W({compact:!ae.compact}),children:"Compact"})]}),Object.entries(bj).map(([z,ee])=>s.jsx("span",{className:"sr-only",id:`chip-hint-${z}`,children:ee},z)),s.jsx("p",{className:"caption muted narrowed",role:"status",children:un.narrowed?s.jsxs(s.Fragment,{children:[Ln.length," of ",Oe.length," threads ·"," ",s.jsx("button",{type:"button",className:"clear-filters","aria-label":"Clear search and filters",onClick:Ef,children:"Clear"})]}):null})]}),l?s.jsx("p",{className:"muted",children:NU}):s.jsxs("div",{className:"thread-list",ref:Ke,onFocus:tt,onBlur:It,children:[be==null?void 0:be.groups.map(z=>s.jsxs("div",{children:[z.label!==null&&s.jsx(Lh,{label:z.label,count:z.count,hint:z.hint,fold:z.folds?{open:z.open,onToggle:()=>Qt(z.key)}:void 0}),z.rows.map(({row:ee,depth:re})=>s.jsx("div",{children:Jr(ee,re)},ee.key))]},`group-${z.key}`)),!be&&Ln.map(({row:z,depth:ee},re)=>s.jsxs("div",{children:[ss>0&&re===0&&s.jsx(Lh,{label:"Pinned",count:ss,hint:qS}),ss>0&&re===ss&&s.jsx(Lh,{label:"Other threads",count:Ln.length-ss}),Jr(z,ee)]},z.key)),a&&!Oe.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),Oe.length>0&&!Ln.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."]}),(be==null?void 0:be.more)&&s.jsx("button",{type:"button",className:"list-more","aria-expanded":Ms,onClick:yn,children:be.more.unstaged?Ms?"Show fewer without a stage":`Show all without a stage (${be.more.total})`:Ms?"Show fewer":`Show all (${be.more.total})`}),We>0&&s.jsx("button",{type:"button",className:"list-more",onClick:pr,children:ae.archived?"Hide archived":`Show ${We} archived`})]})]})]})}function LU({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:y,project:v,compact:j=!1,detailsOpen:g=!1,onDetails:p,holdsOpen:b=!1,onHolds:w}){const S=j&&!g,C=A=>y?`org/${encodeURIComponent(y)}/tasks/${encodeURIComponent(A)}`:null,_=A=>v?`proj/${encodeURIComponent(v)}/issues/${encodeURIComponent(A)}`:null,N=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),O=EU(e),D=o===e.key?i==="archive"?"Archiving":"Unarchiving":i==="archive"?"Archive":"Unarchive",B=`open-note-${e.key}`,[P,I]=u.useState(!1);return s.jsxs("article",{className:["thread",n?"arrived":"",j?"compact-card":""].filter(Boolean).join(" "),id:`thread-${e.key}`,style:{marginLeft:Math.min(t*22,110)},children:[j&&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(Zc,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Zc,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Zc,{text:e.status,role:e.role}),e.archived&&s.jsx(Zc,{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(DU,{tags:e.tags??[],track:e.track,brief:S})]}),O&&s.jsx("p",{id:B,className:`caption open-note tone-${_i((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(MU,{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(UU,{t:e}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:CU(e.lines)}),S?null:s.jsx(BU,{t:e,nested:t>0,allLines:P,setAllLines:I,allHolds:b,onHolds:w,taskHref:C,issueHref:_})]})}function UU({t:e}){return s.jsxs("p",{className:`caption tone-${_i(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 Rj({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-${_i(t)}`,children:[l??e,i&&s.jsxs("span",{className:"sr-only",children:[". ",i]})]})}function BU({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,yj)).map((c,d)=>s.jsxs("p",{className:`line tone-${_i(c.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[kU[c.state]??"•"," "]}),c.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),c.task!==void 0&&s.jsx(Cj,{id:c.task,href:i(c.task)}),c.task!==void 0&&c.text?" ":null,c.text]},`l${d}`)),e.lines.length>yj&&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(Cj,{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(Rj,{...e.reason,nested:t}),(r||!e.holdsAll?e.holds:e.holds.slice(0,Qc)).map((c,d)=>s.jsx(Rj,{...c,nested:t},`h${d}`)),e.holdsAll&&e.holds.length>Qc&&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-Qc} more holds of ${e.title}`,onClick:l,children:r?"Show fewer holds":`+${e.holds.length-Qc} 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 IU=5e3;function HU(){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),IU))},[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(V,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>r(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const FS=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,PU=/^#task=(.+)$/,qU=/^#issue=(.+)$/,GU=/^iss-\d{1,9}$/;function KS(e){return e.split("/").filter(Boolean).slice(1).join("/")}function VU(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");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 YU={label:"Local viewer",can:()=>!1},FU={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},Ej=()=>s.jsx(MS,{title:"Page not found",children:"There is no page at this address in this viewer."});function KU({routeOrg:e}){const{org:t,engine:n}=Jn(),{project:a}=yc(),[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(ea,{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"}),FU[r]]}),s.jsx(zU,{onConnection:l,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const hr=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function XU({route:e,navigate:t}){var f;const{org:n,projects:a,loading:r,none:l}=Jn(),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(Ho,{project:i});if(c||e.org===void 0&&r)return s.jsx(hr,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(Ho,{project:i}):d===void 0&&l?s.jsx(wi,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(gz,{org:d})}function WU({route:e,navigate:t}){const{org:n,loading:a,none:r}=Jn(),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(hr,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&r)return s.jsx(wi,{});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(yL,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function QU({route:e,navigate:t}){var y;const{org:n,projects:a}=Jn(),{project:r,settled:l}=yc(),i=e.project??null,o=i!==null&&a!==null&&!((y=a.find(v=>v.id===i))!=null&&y.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(Ho,{project:i});if(d||i===null&&!l)return s.jsx(hr,{});if(i===null)return s.jsx(wi,{});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(J3,{org:x,project:i,issue_id:e.issue,from:v,query:f})}return s.jsx(U3,{org:x,project:i,query:f,onQuery:h})}function ZU({issue:e,navigate:t,home:n}){const{project:a,settled:r}=yc(),l=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{l&&t(l)},[l,t]),l||!r?s.jsx(hr,{}):n}function yc(){var l;const{projects:e,loading:t,none:n,failure:a}=Jn();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 JU({navigate:e}){const{project:t,settled:n}=yc(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(hr,{}):s.jsx(wi,{})}function Tj(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function eB({route:e}){var f;const{org:t,projects:n,loading:a}=Jn(),r=e.page.kind==="project"?e.page.project:"",[l,i]=u.useState(()=>Tj(window.location.search));if(a)return s.jsx(hr,{});if(n!==null&&!((f=n.find(m=>m.id===r))!=null&&f.current))return s.jsx(Ho,{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(Tj(x))};return s.jsx($5,{org:(t==null?void 0:t.slug)??"",query:l,onSelect:d,home:c})}function tB({hash:e,navigate:t,home:n}){const{project:a,settled:r}=yc(),l=FS.exec(e),i=l!=null&&l[2]?jd(l[2]):null,o=l!=null&&l[3]?jd(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(hr,{}):n}function Uh({route:e,navigate:t}){const{org:n}=Jn();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(Ej,{});else if("threads"in e)l=s.jsx(KU,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");l=s.jsx(Wz,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?l=s.jsx(XU,{route:e,navigate:t}):"issues"in e?l=s.jsx(QU,{route:e,navigate:t}):"chart"in e?l=s.jsx(l6,{}):"worktrees"in e?l=s.jsx(G8,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?l=s.jsx(_8,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?l=s.jsx(WU,{route:e,navigate:t}):"blockers"in e?l=s.jsx(c8,{org:(n==null?void 0:n.slug)??e.org}):"releasesForward"in e?l=s.jsx(JU,{navigate:t}):"releases"in e?l=s.jsx(eB,{route:e}):a.kind==="home"?l=s.jsx(wi,{}):a.kind==="project"?l=s.jsx(Ho,{project:a.project}):l=s.jsx(Ej,{});return s.jsx(B5,{page:a,children:l})}function nB({task:e,navigate:t,home:n}){const{org:a,loading:r,none:l,failure:i}=Jn(),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(hr,{}):n}const sB=e=>window.location.replace(e);function jd(e){try{return decodeURIComponent(e)}catch{return null}}function aB({navigate:e=sB,data:t}){const n=VU(KS(window.location.pathname),window.location.search),[a,r]=u.useState(null),{notify:l,toasts:i}=HU(),o=PU.exec(window.location.hash),c=o?jd(o[1]):null,d=qU.exec(window.location.hash),f=d?jd(d[1]):null,m=f!==null&&GU.test(f)?f:null,h=FS.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&m===null,y="forward"in n?n.forward:null;u.useEffect(()=>{y&&e(y)},[y,e]);const v=u.useMemo(()=>{if(t)return t;const g=W8();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:mj({...g.issues,commands:{}}),tasks:mj(eU()),org:J8(),worktrees:nU(),workspaces:aU(),queues:Q8(),blockers:sU(),releases:tU()}},[t]);if(y||"forward"in n||!v.shell)return null;const j=s.jsx(Uh,{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(T0,{data:v,router:zS,identity:YU,notify:l,children:s.jsx(VT,{shell:v.shell,children:x?s.jsx(Uh,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(nB,{task:c,navigate:e,home:j}):m!==null?s.jsx(ZU,{issue:m,navigate:e,home:j}):h!==null?s.jsx(tB,{hash:h,navigate:e,home:j}):s.jsx(Uh,{route:n,navigate:e})})}),i]})})}VR.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:KS(window.location.pathname)==="app-ui-probe"?s.jsx(e8,{}):s.jsx(aB,{})}));
|