@software-dlc/cli 0.192.9 → 0.192.14

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/local/app-contract-readers.d.ts.map +1 -1
  3. package/dist/local/app-contract-readers.js +12 -0
  4. package/dist/local/app-contract-readers.js.map +1 -1
  5. package/dist/local/app-tasks-read.d.ts +18 -0
  6. package/dist/local/app-tasks-read.d.ts.map +1 -1
  7. package/dist/local/app-tasks-read.js +24 -10
  8. package/dist/local/app-tasks-read.js.map +1 -1
  9. package/dist/local/health-schema.d.ts +3 -3
  10. package/dist/local/projection-stat-pool.d.ts +2 -0
  11. package/dist/local/projection-stat-pool.d.ts.map +1 -0
  12. package/dist/local/projection-stat-pool.js +96 -0
  13. package/dist/local/projection-stat-pool.js.map +1 -0
  14. package/dist/local/projection.d.ts +25 -1
  15. package/dist/local/projection.d.ts.map +1 -1
  16. package/dist/local/projection.js +124 -42
  17. package/dist/local/projection.js.map +1 -1
  18. package/dist/local/source-evidence/schema.d.ts +2 -2
  19. package/dist/local/task-context-observations.d.ts +8 -8
  20. package/dist/local/task-context-schema.d.ts +1 -1
  21. package/dist/local/workspace-change-commit.d.ts +110 -0
  22. package/dist/local/workspace-change-commit.d.ts.map +1 -0
  23. package/dist/local/workspace-change-commit.js +354 -0
  24. package/dist/local/workspace-change-commit.js.map +1 -0
  25. package/dist/local/workspace-commit-generations.d.ts +12 -4
  26. package/dist/local/workspace-commit-generations.d.ts.map +1 -1
  27. package/dist/local/workspace-commit-generations.js +48 -27
  28. package/dist/local/workspace-commit-generations.js.map +1 -1
  29. package/dist/local/workspace-graph-store.d.ts +30 -1
  30. package/dist/local/workspace-graph-store.d.ts.map +1 -1
  31. package/dist/local/workspace-graph-store.js +86 -1
  32. package/dist/local/workspace-graph-store.js.map +1 -1
  33. package/dist/local/workspace-graph-tree.d.ts +42 -0
  34. package/dist/local/workspace-graph-tree.d.ts.map +1 -1
  35. package/dist/local/workspace-graph-tree.js +189 -0
  36. package/dist/local/workspace-graph-tree.js.map +1 -1
  37. package/dist/local/workspace-overlap-allocation.d.ts +5 -3
  38. package/dist/local/workspace-overlap-allocation.d.ts.map +1 -1
  39. package/dist/local/workspace-overlap-allocation.js +3 -7
  40. package/dist/local/workspace-overlap-allocation.js.map +1 -1
  41. package/dist/local/workspace-overlap-impact.d.ts.map +1 -1
  42. package/dist/local/workspace-overlap-impact.js +12 -1
  43. package/dist/local/workspace-overlap-impact.js.map +1 -1
  44. package/dist/local/workspace-overlap-index.d.ts +179 -0
  45. package/dist/local/workspace-overlap-index.d.ts.map +1 -0
  46. package/dist/local/workspace-overlap-index.js +559 -0
  47. package/dist/local/workspace-overlap-index.js.map +1 -0
  48. package/dist/local/workspace-overlap.d.ts +41 -9
  49. package/dist/local/workspace-overlap.d.ts.map +1 -1
  50. package/dist/local/workspace-overlap.js +336 -140
  51. package/dist/local/workspace-overlap.js.map +1 -1
  52. package/dist/local/workspace-runtime.d.ts +71 -1
  53. package/dist/local/workspace-runtime.d.ts.map +1 -1
  54. package/dist/local/workspace-runtime.js +626 -66
  55. package/dist/local/workspace-runtime.js.map +1 -1
  56. package/package.json +2 -2
  57. package/viewer/assets/index-CTZHobW_.js +389 -0
  58. package/viewer/assets/index-Cck9Xf1-.css +1 -0
  59. package/viewer/index.html +2 -2
  60. package/viewer/assets/index-B5o6MLCA.js +0 -389
  61. package/viewer/assets/index-DJmPW-on.css +0 -1
@@ -0,0 +1,389 @@
1
+ function L1(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const r=Object.getOwnPropertyDescriptor(a,l);r&&Object.defineProperty(e,l,r.get?r:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function dy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fy={exports:{}},Du={};/**
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 U1=Symbol.for("react.transitional.element"),B1=Symbol.for("react.fragment");function hy(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 l in t)l!=="key"&&(n[l]=t[l])}else n=t;return t=n.ref,{$$typeof:U1,type:e,key:a,ref:t!==void 0?t:null,props:n}}Du.Fragment=B1;Du.jsx=hy;Du.jsxs=hy;fy.exports=Du;var s=fy.exports,my={exports:{}},Ce={};/**
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 gm=Symbol.for("react.transitional.element"),H1=Symbol.for("react.portal"),I1=Symbol.for("react.fragment"),P1=Symbol.for("react.strict_mode"),q1=Symbol.for("react.profiler"),G1=Symbol.for("react.consumer"),V1=Symbol.for("react.context"),Y1=Symbol.for("react.forward_ref"),F1=Symbol.for("react.suspense"),K1=Symbol.for("react.memo"),py=Symbol.for("react.lazy"),Tx=Symbol.iterator;function X1(e){return e===null||typeof e!="object"?null:(e=Tx&&e[Tx]||e["@@iterator"],typeof e=="function"?e:null)}var xy={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},gy=Object.assign,vy={};function Nr(e,t,n){this.props=e,this.context=t,this.refs=vy,this.updater=n||xy}Nr.prototype.isReactComponent={};Nr.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")};Nr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function yy(){}yy.prototype=Nr.prototype;function vm(e,t,n){this.props=e,this.context=t,this.refs=vy,this.updater=n||xy}var ym=vm.prototype=new yy;ym.constructor=vm;gy(ym,Nr.prototype);ym.isPureReactComponent=!0;var Ex=Array.isArray,nt={H:null,A:null,T:null,S:null,V:null},by=Object.prototype.hasOwnProperty;function bm(e,t,n,a,l,r){return n=r.ref,{$$typeof:gm,type:e,key:t,ref:n!==void 0?n:null,props:r}}function Q1(e,t){return bm(e.type,t,void 0,void 0,void 0,e.props)}function jm(e){return typeof e=="object"&&e!==null&&e.$$typeof===gm}function Z1(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ax=/\/+/g;function Bd(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Z1(""+e.key):t.toString(36)}function Mx(){}function W1(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Mx,Mx):(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 Ol(e,t,n,a,l){var r=typeof e;(r==="undefined"||r==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(r){case"bigint":case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case gm:case H1:i=!0;break;case py:return i=e._init,Ol(i(e._payload),t,n,a,l)}}if(i)return l=l(e),i=a===""?"."+Bd(e,0):a,Ex(l)?(n="",i!=null&&(n=i.replace(Ax,"$&/")+"/"),Ol(l,t,n,"",function(d){return d})):l!=null&&(jm(l)&&(l=Q1(l,n+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(Ax,"$&/")+"/")+i)),t.push(l)),1;i=0;var o=a===""?".":a+":";if(Ex(e))for(var c=0;c<e.length;c++)a=e[c],r=o+Bd(a,c),i+=Ol(a,t,n,r,l);else if(c=X1(e),typeof c=="function")for(e=c.call(e),c=0;!(a=e.next()).done;)a=a.value,r=o+Bd(a,c++),i+=Ol(a,t,n,r,l);else if(r==="object"){if(typeof e.then=="function")return Ol(W1(e),t,n,a,l);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 Io(e,t,n){if(e==null)return e;var a=[],l=0;return Ol(e,a,"","",function(r){return t.call(n,r,l++)}),a}function J1(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 Ox=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 eS(){}Ce.Children={map:Io,forEach:function(e,t,n){Io(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Io(e,function(){t++}),t},toArray:function(e){return Io(e,function(t){return t})||[]},only:function(e){if(!jm(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ce.Component=Nr;Ce.Fragment=I1;Ce.Profiler=q1;Ce.PureComponent=vm;Ce.StrictMode=P1;Ce.Suspense=F1;Ce.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=nt;Ce.__COMPILER_RUNTIME={__proto__:null,c:function(e){return nt.H.useMemoCache(e)}};Ce.cache=function(e){return function(){return e.apply(null,arguments)}};Ce.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var a=gy({},e.props),l=e.key,r=void 0;if(t!=null)for(i in t.ref!==void 0&&(r=void 0),t.key!==void 0&&(l=""+t.key),t)!by.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 bm(e.type,l,void 0,void 0,r,a)};Ce.createContext=function(e){return e={$$typeof:V1,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:G1,_context:e},e};Ce.createElement=function(e,t,n){var a,l={},r=null;if(t!=null)for(a in t.key!==void 0&&(r=""+t.key),t)by.call(t,a)&&a!=="key"&&a!=="__self"&&a!=="__source"&&(l[a]=t[a]);var i=arguments.length-2;if(i===1)l.children=n;else if(1<i){for(var o=Array(i),c=0;c<i;c++)o[c]=arguments[c+2];l.children=o}if(e&&e.defaultProps)for(a in i=e.defaultProps,i)l[a]===void 0&&(l[a]=i[a]);return bm(e,r,void 0,void 0,null,l)};Ce.createRef=function(){return{current:null}};Ce.forwardRef=function(e){return{$$typeof:Y1,render:e}};Ce.isValidElement=jm;Ce.lazy=function(e){return{$$typeof:py,_payload:{_status:-1,_result:e},_init:J1}};Ce.memo=function(e,t){return{$$typeof:K1,type:e,compare:t===void 0?null:t}};Ce.startTransition=function(e){var t=nt.T,n={};nt.T=n;try{var a=e(),l=nt.S;l!==null&&l(n,a),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a.then(eS,Ox)}catch(r){Ox(r)}finally{nt.T=t}};Ce.unstable_useCacheRefresh=function(){return nt.H.useCacheRefresh()};Ce.use=function(e){return nt.H.use(e)};Ce.useActionState=function(e,t,n){return nt.H.useActionState(e,t,n)};Ce.useCallback=function(e,t){return nt.H.useCallback(e,t)};Ce.useContext=function(e){return nt.H.useContext(e)};Ce.useDebugValue=function(){};Ce.useDeferredValue=function(e,t){return nt.H.useDeferredValue(e,t)};Ce.useEffect=function(e,t,n){var a=nt.H;if(typeof n=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return a.useEffect(e,t)};Ce.useId=function(){return nt.H.useId()};Ce.useImperativeHandle=function(e,t,n){return nt.H.useImperativeHandle(e,t,n)};Ce.useInsertionEffect=function(e,t){return nt.H.useInsertionEffect(e,t)};Ce.useLayoutEffect=function(e,t){return nt.H.useLayoutEffect(e,t)};Ce.useMemo=function(e,t){return nt.H.useMemo(e,t)};Ce.useOptimistic=function(e,t){return nt.H.useOptimistic(e,t)};Ce.useReducer=function(e,t,n){return nt.H.useReducer(e,t,n)};Ce.useRef=function(e){return nt.H.useRef(e)};Ce.useState=function(e){return nt.H.useState(e)};Ce.useSyncExternalStore=function(e,t,n){return nt.H.useSyncExternalStore(e,t,n)};Ce.useTransition=function(){return nt.H.useTransition()};Ce.version="19.1.0";my.exports=Ce;var u=my.exports;const ra=dy(u),jy=L1({__proto__:null,default:ra},[u]);var wy={exports:{}},zu={},_y={exports:{}},Ny={};/**
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(S,E){var C=S.length;S.push(E);e:for(;0<C;){var $=C-1>>>1,F=S[$];if(0<l(F,E))S[$]=E,S[C]=F,C=$;else break e}}function n(S){return S.length===0?null:S[0]}function a(S){if(S.length===0)return null;var E=S[0],C=S.pop();if(C!==E){S[0]=C;e:for(var $=0,F=S.length,T=F>>>1;$<T;){var P=2*($+1)-1,ne=S[P],le=P+1,ge=S[le];if(0>l(ne,C))le<F&&0>l(ge,ne)?(S[$]=ge,S[le]=C,$=le):(S[$]=ne,S[P]=C,$=P);else if(le<F&&0>l(ge,C))S[$]=ge,S[le]=C,$=le;else break e}}return E}function l(S,E){var C=S.sortIndex-E.sortIndex;return C!==0?C:S.id-E.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var r=performance;e.unstable_now=function(){return r.now()}}else{var i=Date,o=i.now();e.unstable_now=function(){return i.now()-o}}var c=[],d=[],f=1,h=null,m=3,x=!1,j=!1,v=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,b=typeof setImmediate<"u"?setImmediate:null;function w(S){for(var E=n(d);E!==null;){if(E.callback===null)a(d);else if(E.startTime<=S)a(d),E.sortIndex=E.expirationTime,t(c,E);else break;E=n(d)}}function N(S){if(v=!1,w(S),!j)if(n(c)!==null)j=!0,R||(R=!0,V());else{var E=n(d);E!==null&&A(N,E.startTime-S)}}var R=!1,_=-1,k=5,L=-1;function z(){return y?!0:!(e.unstable_now()-L<k)}function X(){if(y=!1,R){var S=e.unstable_now();L=S;var E=!0;try{e:{j=!1,v&&(v=!1,p(_),_=-1),x=!0;var C=m;try{t:{for(w(S),h=n(c);h!==null&&!(h.expirationTime>S&&z());){var $=h.callback;if(typeof $=="function"){h.callback=null,m=h.priorityLevel;var F=$(h.expirationTime<=S);if(S=e.unstable_now(),typeof F=="function"){h.callback=F,w(S),E=!0;break t}h===n(c)&&a(c),w(S)}else a(c);h=n(c)}if(h!==null)E=!0;else{var T=n(d);T!==null&&A(N,T.startTime-S),E=!1}}break e}finally{h=null,m=C,x=!1}E=void 0}}finally{E?V():R=!1}}}var V;if(typeof b=="function")V=function(){b(X)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,M=U.port2;U.port1.onmessage=X,V=function(){M.postMessage(null)}}else V=function(){g(X,0)};function A(S,E){_=g(function(){S(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(S){S.callback=null},e.unstable_forceFrameRate=function(S){0>S||125<S?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<S?Math.floor(1e3/S):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_next=function(S){switch(m){case 1:case 2:case 3:var E=3;break;default:E=m}var C=m;m=E;try{return S()}finally{m=C}},e.unstable_requestPaint=function(){y=!0},e.unstable_runWithPriority=function(S,E){switch(S){case 1:case 2:case 3:case 4:case 5:break;default:S=3}var C=m;m=S;try{return E()}finally{m=C}},e.unstable_scheduleCallback=function(S,E,C){var $=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?$+C:$):C=$,S){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=C+F,S={id:f++,callback:E,priorityLevel:S,startTime:C,expirationTime:F,sortIndex:-1},C>$?(S.sortIndex=C,t(d,S),n(c)===null&&S===n(d)&&(v?(p(_),_=-1):v=!0,A(N,C-$))):(S.sortIndex=F,t(c,S),j||x||(j=!0,R||(R=!0,V()))),S},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(S){var E=m;return function(){var C=m;m=E;try{return S.apply(this,arguments)}finally{m=C}}}})(Ny);_y.exports=Ny;var tS=_y.exports,ky={exports:{}},Gt={};/**
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 nS=u;function Sy(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 qt={d:{f:na,r:function(){throw Error(Sy(522))},D:na,C:na,L:na,m:na,X:na,S:na,M:na},p:0,findDOMNode:null},sS=Symbol.for("react.portal");function aS(e,t,n){var a=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:sS,key:a==null?null:""+a,children:e,containerInfo:t,implementation:n}}var xi=nS.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function Lu(e,t){if(e==="font")return"";if(typeof t=="string")return t==="use-credentials"?t:""}Gt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qt;Gt.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(Sy(299));return aS(e,t,null,n)};Gt.flushSync=function(e){var t=xi.T,n=qt.p;try{if(xi.T=null,qt.p=2,e)return e()}finally{xi.T=t,qt.p=n,qt.d.f()}};Gt.preconnect=function(e,t){typeof e=="string"&&(t?(t=t.crossOrigin,t=typeof t=="string"?t==="use-credentials"?t:"":void 0):t=null,qt.d.C(e,t))};Gt.prefetchDNS=function(e){typeof e=="string"&&qt.d.D(e)};Gt.preinit=function(e,t){if(typeof e=="string"&&t&&typeof t.as=="string"){var n=t.as,a=Lu(n,t.crossOrigin),l=typeof t.integrity=="string"?t.integrity:void 0,r=typeof t.fetchPriority=="string"?t.fetchPriority:void 0;n==="style"?qt.d.S(e,typeof t.precedence=="string"?t.precedence:void 0,{crossOrigin:a,integrity:l,fetchPriority:r}):n==="script"&&qt.d.X(e,{crossOrigin:a,integrity:l,fetchPriority:r,nonce:typeof t.nonce=="string"?t.nonce:void 0})}};Gt.preinitModule=function(e,t){if(typeof e=="string")if(typeof t=="object"&&t!==null){if(t.as==null||t.as==="script"){var n=Lu(t.as,t.crossOrigin);qt.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&&qt.d.M(e)};Gt.preload=function(e,t){if(typeof e=="string"&&typeof t=="object"&&t!==null&&typeof t.as=="string"){var n=t.as,a=Lu(n,t.crossOrigin);qt.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})}};Gt.preloadModule=function(e,t){if(typeof e=="string")if(t){var n=Lu(t.as,t.crossOrigin);qt.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 qt.d.m(e)};Gt.requestFormReset=function(e){qt.d.r(e)};Gt.unstable_batchedUpdates=function(e,t){return e(t)};Gt.useFormState=function(e,t,n){return xi.H.useFormState(e,t,n)};Gt.useFormStatus=function(){return xi.H.useHostTransitionStatus()};Gt.version="19.1.0";function Cy(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Cy)}catch(e){console.error(e)}}Cy(),ky.exports=Gt;var kr=ky.exports;const lS=dy(kr);/**
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 Tt=tS,Ry=u,rS=kr;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 Ty(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ro(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 Ey(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 $x(e){if(ro(e)!==e)throw Error(Q(188))}function iS(e){var t=e.alternate;if(!t){if(t=ro(e),t===null)throw Error(Q(188));return t!==e?null:e}for(var n=e,a=t;;){var l=n.return;if(l===null)break;var r=l.alternate;if(r===null){if(a=l.return,a!==null){n=a;continue}break}if(l.child===r.child){for(r=l.child;r;){if(r===n)return $x(l),e;if(r===a)return $x(l),t;r=r.sibling}throw Error(Q(188))}if(n.return!==a.return)n=l,a=r;else{for(var i=!1,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){for(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)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 Ay(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=Ay(e),t!==null)return t;e=e.sibling}return null}var Je=Object.assign,oS=Symbol.for("react.element"),Po=Symbol.for("react.transitional.element"),li=Symbol.for("react.portal"),Ll=Symbol.for("react.fragment"),My=Symbol.for("react.strict_mode"),Kf=Symbol.for("react.profiler"),cS=Symbol.for("react.provider"),Oy=Symbol.for("react.consumer"),Ds=Symbol.for("react.context"),wm=Symbol.for("react.forward_ref"),Xf=Symbol.for("react.suspense"),Qf=Symbol.for("react.suspense_list"),_m=Symbol.for("react.memo"),ca=Symbol.for("react.lazy"),Zf=Symbol.for("react.activity"),uS=Symbol.for("react.memo_cache_sentinel"),Dx=Symbol.iterator;function Fr(e){return e===null||typeof e!="object"?null:(e=Dx&&e[Dx]||e["@@iterator"],typeof e=="function"?e:null)}var dS=Symbol.for("react.client.reference");function Wf(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===dS?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Ll:return"Fragment";case Kf:return"Profiler";case My:return"StrictMode";case Xf:return"Suspense";case Qf:return"SuspenseList";case Zf:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case li:return"Portal";case Ds:return(e.displayName||"Context")+".Provider";case Oy:return(e._context.displayName||"Context")+".Consumer";case wm:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _m:return t=e.displayName||null,t!==null?t:Wf(e.type)||"Memo";case ca:t=e._payload,e=e._init;try{return Wf(e(t))}catch{}}return null}var ri=Array.isArray,_e=Ry.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ue=rS.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Za={pending:!1,data:null,method:null,action:null},Jf=[],Ul=-1;function ws(e){return{current:e}}function $t(e){0>Ul||(e.current=Jf[Ul],Jf[Ul]=null,Ul--)}function st(e,t){Ul++,Jf[Ul]=e.current,e.current=t}var ps=ws(null),$i=ws(null),ja=ws(null),Hc=ws(null);function Ic(e,t){switch(st(ja,t),st($i,e),st(ps,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hg(t),e=Qj(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$t(ps),st(ps,e)}function cr(){$t(ps),$t($i),$t(ja)}function eh(e){e.memoizedState!==null&&st(Hc,e);var t=ps.current,n=Qj(t,e.type);t!==n&&(st($i,e),st(ps,n))}function Pc(e){$i.current===e&&($t(ps),$t($i)),Hc.current===e&&($t(Hc),Gi._currentValue=Za)}var th=Object.prototype.hasOwnProperty,Nm=Tt.unstable_scheduleCallback,Hd=Tt.unstable_cancelCallback,fS=Tt.unstable_shouldYield,hS=Tt.unstable_requestPaint,xs=Tt.unstable_now,mS=Tt.unstable_getCurrentPriorityLevel,$y=Tt.unstable_ImmediatePriority,Dy=Tt.unstable_UserBlockingPriority,qc=Tt.unstable_NormalPriority,pS=Tt.unstable_LowPriority,zy=Tt.unstable_IdlePriority,xS=Tt.log,gS=Tt.unstable_setDisableYieldValue,io=null,mn=null;function pa(e){if(typeof xS=="function"&&gS(e),mn&&typeof mn.setStrictMode=="function")try{mn.setStrictMode(io,e)}catch{}}var pn=Math.clz32?Math.clz32:bS,vS=Math.log,yS=Math.LN2;function bS(e){return e>>>=0,e===0?32:31-(vS(e)/yS|0)|0}var qo=256,Go=4194304;function Fa(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Uu(e,t,n){var a=e.pendingLanes;if(a===0)return 0;var l=0,r=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var o=a&134217727;return o!==0?(a=o&~r,a!==0?l=Fa(a):(i&=o,i!==0?l=Fa(i):n||(n=o&~e,n!==0&&(l=Fa(n))))):(o=a&~r,o!==0?l=Fa(o):i!==0?l=Fa(i):n||(n=a&~e,n!==0&&(l=Fa(n)))),l===0?0:t!==0&&t!==l&&!(t&r)&&(r=l&-l,n=t&-t,r>=n||r===32&&(n&4194048)!==0)?t:l}function oo(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function jS(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 Ly(){var e=qo;return qo<<=1,!(qo&4194048)&&(qo=256),e}function Uy(){var e=Go;return Go<<=1,!(Go&62914560)&&(Go=4194304),e}function Id(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function co(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function wS(e,t,n,a,l,r){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-pn(n),h=1<<f;o[f]=0,c[f]=-1;var m=d[f];if(m!==null)for(d[f]=null,f=0;f<m.length;f++){var x=m[f];x!==null&&(x.lane&=-536870913)}n&=~h}a!==0&&By(e,a,0),r!==0&&l===0&&e.tag!==0&&(e.suspendedLanes|=r&~(i&~t))}function By(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-pn(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|n&4194090}function Hy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var a=31-pn(n),l=1<<a;l&t|e[a]&t&&(e[a]|=t),n&=~l}}function km(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 Sm(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Iy(){var e=Ue.p;return e!==0?e:(e=window.event,e===void 0?32:r0(e.type))}function _S(e,t){var n=Ue.p;try{return Ue.p=e,t()}finally{Ue.p=n}}var za=Math.random().toString(36).slice(2),Ut="__reactFiber$"+za,nn="__reactProps$"+za,Sr="__reactContainer$"+za,nh="__reactEvents$"+za,NS="__reactListeners$"+za,kS="__reactHandles$"+za,zx="__reactResources$"+za,uo="__reactMarker$"+za;function Cm(e){delete e[Ut],delete e[nn],delete e[nh],delete e[NS],delete e[kS]}function Bl(e){var t=e[Ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Sr]||n[Ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qg(e);e!==null;){if(n=e[Ut])return n;e=qg(e)}return t}e=n,n=e.parentNode}return null}function Cr(e){if(e=e[Ut]||e[Sr]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function ii(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(Q(33))}function Ql(e){var t=e[zx];return t||(t=e[zx]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Mt(e){e[uo]=!0}var Py=new Set,qy={};function pl(e,t){ur(e,t),ur(e+"Capture",t)}function ur(e,t){for(qy[e]=t,e=0;e<t.length;e++)Py.add(t[e])}var SS=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]*$"),Lx={},Ux={};function CS(e){return th.call(Ux,e)?!0:th.call(Lx,e)?!1:SS.test(e)?Ux[e]=!0:(Lx[e]=!0,!1)}function vc(e,t,n){if(CS(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 Vo(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 Cs(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 Pd,Bx;function $l(e){if(Pd===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Pd=t&&t[1]||"",Bx=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+Pd+e+Bx}var qd=!1;function Gd(e,t){if(!e||qd)return"";qd=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var h=function(){throw Error()};if(Object.defineProperty(h.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(h,[])}catch(x){var m=x}Reflect.construct(e,[],h)}else{try{h.call()}catch(x){m=x}e.call(h.prototype)}}else{try{throw Error()}catch(x){m=x}(h=e())&&typeof h.catch=="function"&&h.catch(function(){})}}catch(x){if(x&&m&&typeof x.stack=="string")return[x.stack,m.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var l=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");l&&l.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var r=a.DetermineComponentFrameRoot(),i=r[0],o=r[1];if(i&&o){var c=i.split(`
44
+ `),d=o.split(`
45
+ `);for(l=a=0;a<c.length&&!c[a].includes("DetermineComponentFrameRoot");)a++;for(;l<d.length&&!d[l].includes("DetermineComponentFrameRoot");)l++;if(a===c.length||l===d.length)for(a=c.length-1,l=d.length-1;1<=a&&0<=l&&c[a]!==d[l];)l--;for(;1<=a&&0<=l;a--,l--)if(c[a]!==d[l]){if(a!==1||l!==1)do if(a--,l--,0>l||c[a]!==d[l]){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<=l);break}}}finally{qd=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?$l(n):""}function RS(e){switch(e.tag){case 26:case 27:case 5:return $l(e.type);case 16:return $l("Lazy");case 13:return $l("Suspense");case 19:return $l("SuspenseList");case 0:case 15:return Gd(e.type,!1);case 11:return Gd(e.type.render,!1);case 1:return Gd(e.type,!0);case 31:return $l("Activity");default:return""}}function Hx(e){try{var t="";do t+=RS(e),e=e.return;while(e);return t}catch(n){return`
47
+ Error generating stack: `+n.message+`
48
+ `+n.stack}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function TS(e){var t=Gy(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 l=n.get,r=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){a=""+i,r.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 Gc(e){e._valueTracker||(e._valueTracker=TS(e))}function Vy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),a="";return e&&(a=Gy(e)?e.checked?"true":"false":e.value),e=a,e!==n?(t.setValue(e),!0):!1}function Vc(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 ES=/[\n"\\]/g;function Cn(e){return e.replace(ES,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function sh(e,t,n,a,l,r,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=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?ah(e,i,Nn(t)):n!=null?ah(e,i,Nn(n)):a!=null&&e.removeAttribute("value"),l==null&&r!=null&&(e.defaultChecked=!!r),l!=null&&(e.checked=l&&typeof l!="function"&&typeof l!="symbol"),o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.name=""+Nn(o):e.removeAttribute("name")}function Yy(e,t,n,a,l,r,i,o){if(r!=null&&typeof r!="function"&&typeof r!="symbol"&&typeof r!="boolean"&&(e.type=r),t!=null||n!=null){if(!(r!=="submit"&&r!=="reset"||t!=null))return;n=n!=null?""+Nn(n):"",t=t!=null?""+Nn(t):n,o||t===e.value||(e.value=t),e.defaultValue=t}a=a??l,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 ah(e,t,n){t==="number"&&Vc(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Zl(e,t,n,a){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&a&&(e[n].defaultSelected=!0)}else{for(n=""+Nn(n),t=null,l=0;l<e.length;l++){if(e[l].value===n){e[l].selected=!0,a&&(e[l].defaultSelected=!0);return}t!==null||e[l].disabled||(t=e[l])}t!==null&&(t.selected=!0)}}function Fy(e,t,n){if(t!=null&&(t=""+Nn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Nn(n):""}function Ky(e,t,n,a){if(t==null){if(a!=null){if(n!=null)throw Error(Q(92));if(ri(a)){if(1<a.length)throw Error(Q(93));a=a[0]}n=a}n==null&&(n=""),t=n}n=Nn(t),e.defaultValue=n,a=e.textContent,a===n&&a!==""&&a!==null&&(e.value=a)}function dr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var AS=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 Ix(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||AS.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Xy(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 l in t)a=t[l],t.hasOwnProperty(l)&&n[l]!==a&&Ix(e,l,a)}else for(var r in t)t.hasOwnProperty(r)&&Ix(e,r,t[r])}function Rm(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 MS=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"]]),OS=/^[\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 yc(e){return OS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var lh=null;function Tm(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Hl=null,Wl=null;function Px(e){var t=Cr(e);if(t&&(e=t.stateNode)){var n=e[nn]||null;e:switch(e=t.stateNode,t.type){case"input":if(sh(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="'+Cn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var a=n[t];if(a!==e&&a.form===e.form){var l=a[nn]||null;if(!l)throw Error(Q(90));sh(a,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name)}}for(t=0;t<n.length;t++)a=n[t],a.form===e.form&&Vy(a)}break e;case"textarea":Fy(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Zl(e,!!n.multiple,t,!1)}}}var Vd=!1;function Qy(e,t,n){if(Vd)return e(t,n);Vd=!0;try{var a=e(t);return a}finally{if(Vd=!1,(Hl!==null||Wl!==null)&&(Ku(),Hl&&(t=Hl,e=Wl,Wl=Hl=null,Px(t),e)))for(t=0;t<e.length;t++)Px(e[t])}}function Di(e,t){var n=e.stateNode;if(n===null)return null;var a=n[nn]||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 Ps=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rh=!1;if(Ps)try{var Kr={};Object.defineProperty(Kr,"passive",{get:function(){rh=!0}}),window.addEventListener("test",Kr,Kr),window.removeEventListener("test",Kr,Kr)}catch{rh=!1}var xa=null,Em=null,bc=null;function Zy(){if(bc)return bc;var e,t=Em,n=t.length,a,l="value"in xa?xa.value:xa.textContent,r=l.length;for(e=0;e<n&&t[e]===l[e];e++);var i=n-e;for(a=1;a<=i&&t[n-a]===l[r-a];a++);return bc=l.slice(e,1<a?1-a:void 0)}function jc(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 Yo(){return!0}function qx(){return!1}function an(e){function t(n,a,l,r,i){this._reactName=n,this._targetInst=l,this.type=a,this.nativeEvent=r,this.target=i,this.currentTarget=null;for(var o in e)e.hasOwnProperty(o)&&(n=e[o],this[o]=n?n(r):r[o]);return this.isDefaultPrevented=(r.defaultPrevented!=null?r.defaultPrevented:r.returnValue===!1)?Yo:qx,this.isPropagationStopped=qx,this}return Je(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=Yo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Yo)},persist:function(){},isPersistent:Yo}),t}var xl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bu=an(xl),fo=Je({},xl,{view:0,detail:0}),$S=an(fo),Yd,Fd,Xr,Hu=Je({},fo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Am,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!==Xr&&(Xr&&e.type==="mousemove"?(Yd=e.screenX-Xr.screenX,Fd=e.screenY-Xr.screenY):Fd=Yd=0,Xr=e),Yd)},movementY:function(e){return"movementY"in e?e.movementY:Fd}}),Gx=an(Hu),DS=Je({},Hu,{dataTransfer:0}),zS=an(DS),LS=Je({},fo,{relatedTarget:0}),Kd=an(LS),US=Je({},xl,{animationName:0,elapsedTime:0,pseudoElement:0}),BS=an(US),HS=Je({},xl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),IS=an(HS),PS=Je({},xl,{data:0}),Vx=an(PS),qS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GS={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"},VS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function YS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=VS[e])?!!t[e]:!1}function Am(){return YS}var FS=Je({},fo,{key:function(e){if(e.key){var t=qS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=jc(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?GS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Am,charCode:function(e){return e.type==="keypress"?jc(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?jc(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),KS=an(FS),XS=Je({},Hu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Yx=an(XS),QS=Je({},fo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Am}),ZS=an(QS),WS=Je({},xl,{propertyName:0,elapsedTime:0,pseudoElement:0}),JS=an(WS),e2=Je({},Hu,{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}),t2=an(e2),n2=Je({},xl,{newState:0,oldState:0}),s2=an(n2),a2=[9,13,27,32],Mm=Ps&&"CompositionEvent"in window,gi=null;Ps&&"documentMode"in document&&(gi=document.documentMode);var l2=Ps&&"TextEvent"in window&&!gi,Wy=Ps&&(!Mm||gi&&8<gi&&11>=gi),Fx=" ",Kx=!1;function Jy(e,t){switch(e){case"keyup":return a2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Il=!1;function r2(e,t){switch(e){case"compositionend":return eb(t);case"keypress":return t.which!==32?null:(Kx=!0,Fx);case"textInput":return e=t.data,e===Fx&&Kx?null:e;default:return null}}function i2(e,t){if(Il)return e==="compositionend"||!Mm&&Jy(e,t)?(e=Zy(),bc=Em=xa=null,Il=!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 Wy&&t.locale!=="ko"?null:t.data;default:return null}}var o2={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 Xx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!o2[e.type]:t==="textarea"}function tb(e,t,n,a){Hl?Wl?Wl.push(a):Wl=[a]:Hl=a,t=cu(t,"onChange"),0<t.length&&(n=new Bu("onChange","change",null,n,a),e.push({event:n,listeners:t}))}var vi=null,zi=null;function c2(e){Fj(e,0)}function Iu(e){var t=ii(e);if(Vy(t))return e}function Qx(e,t){if(e==="change")return t}var nb=!1;if(Ps){var Xd;if(Ps){var Qd="oninput"in document;if(!Qd){var Zx=document.createElement("div");Zx.setAttribute("oninput","return;"),Qd=typeof Zx.oninput=="function"}Xd=Qd}else Xd=!1;nb=Xd&&(!document.documentMode||9<document.documentMode)}function Wx(){vi&&(vi.detachEvent("onpropertychange",sb),zi=vi=null)}function sb(e){if(e.propertyName==="value"&&Iu(zi)){var t=[];tb(t,zi,e,Tm(e)),Qy(c2,t)}}function u2(e,t,n){e==="focusin"?(Wx(),vi=t,zi=n,vi.attachEvent("onpropertychange",sb)):e==="focusout"&&Wx()}function d2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Iu(zi)}function f2(e,t){if(e==="click")return Iu(t)}function h2(e,t){if(e==="input"||e==="change")return Iu(t)}function m2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var yn=typeof Object.is=="function"?Object.is:m2;function Li(e,t){if(yn(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 l=n[a];if(!th.call(t,l)||!yn(e[l],t[l]))return!1}return!0}function Jx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function eg(e,t){var n=Jx(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=Jx(n)}}function ab(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ab(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function lb(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Vc(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=Vc(e.document)}return t}function Om(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 p2=Ps&&"documentMode"in document&&11>=document.documentMode,Pl=null,ih=null,yi=null,oh=!1;function tg(e,t,n){var a=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;oh||Pl==null||Pl!==Vc(a)||(a=Pl,"selectionStart"in a&&Om(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}),yi&&Li(yi,a)||(yi=a,a=cu(ih,"onSelect"),0<a.length&&(t=new Bu("onSelect","select",null,t,n),e.push({event:t,listeners:a}),t.target=Pl)))}function Va(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ql={animationend:Va("Animation","AnimationEnd"),animationiteration:Va("Animation","AnimationIteration"),animationstart:Va("Animation","AnimationStart"),transitionrun:Va("Transition","TransitionRun"),transitionstart:Va("Transition","TransitionStart"),transitioncancel:Va("Transition","TransitionCancel"),transitionend:Va("Transition","TransitionEnd")},Zd={},rb={};Ps&&(rb=document.createElement("div").style,"AnimationEvent"in window||(delete ql.animationend.animation,delete ql.animationiteration.animation,delete ql.animationstart.animation),"TransitionEvent"in window||delete ql.transitionend.transition);function gl(e){if(Zd[e])return Zd[e];if(!ql[e])return e;var t=ql[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in rb)return Zd[e]=t[n];return e}var ib=gl("animationend"),ob=gl("animationiteration"),cb=gl("animationstart"),x2=gl("transitionrun"),g2=gl("transitionstart"),v2=gl("transitioncancel"),ub=gl("transitionend"),db=new Map,ch="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(" ");ch.push("scrollEnd");function ts(e,t){db.set(e,t),pl(t,[e])}var ng=new WeakMap;function Rn(e,t){if(typeof e=="object"&&e!==null){var n=ng.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Hx(t)},ng.set(e,t),t)}return{value:e,source:t,stack:Hx(t)}}var _n=[],Gl=0,$m=0;function Pu(){for(var e=Gl,t=$m=Gl=0;t<e;){var n=_n[t];_n[t++]=null;var a=_n[t];_n[t++]=null;var l=_n[t];_n[t++]=null;var r=_n[t];if(_n[t++]=null,a!==null&&l!==null){var i=a.pending;i===null?l.next=l:(l.next=i.next,i.next=l),a.pending=l}r!==0&&fb(n,l,r)}}function qu(e,t,n,a){_n[Gl++]=e,_n[Gl++]=t,_n[Gl++]=n,_n[Gl++]=a,$m|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function Dm(e,t,n,a){return qu(e,t,n,a),Yc(e)}function Rr(e,t){return qu(e,null,null,t),Yc(e)}function fb(e,t,n){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n);for(var l=!1,r=e.return;r!==null;)r.childLanes|=n,a=r.alternate,a!==null&&(a.childLanes|=n),r.tag===22&&(e=r.stateNode,e===null||e._visibility&1||(l=!0)),e=r,r=r.return;return e.tag===3?(r=e.stateNode,l&&t!==null&&(l=31-pn(n),e=r.hiddenUpdates,a=e[l],a===null?e[l]=[t]:a.push(t),t.lane=n|536870912),r):null}function Yc(e){if(50<Ti)throw Ti=0,Eh=null,Error(Q(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Vl={};function y2(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 hn(e,t,n,a){return new y2(e,t,n,a)}function zm(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hs(e,t){var n=e.alternate;return n===null?(n=hn(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 hb(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 wc(e,t,n,a,l,r){var i=0;if(a=e,typeof e=="function")zm(e)&&(i=1);else if(typeof e=="string")i=jC(e,n,ps.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Zf:return e=hn(31,n,t,l),e.elementType=Zf,e.lanes=r,e;case Ll:return Wa(n.children,l,r,t);case My:i=8,l|=24;break;case Kf:return e=hn(12,n,t,l|2),e.elementType=Kf,e.lanes=r,e;case Xf:return e=hn(13,n,t,l),e.elementType=Xf,e.lanes=r,e;case Qf:return e=hn(19,n,t,l),e.elementType=Qf,e.lanes=r,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case cS:case Ds:i=10;break e;case Oy:i=9;break e;case wm:i=11;break e;case _m:i=14;break e;case ca:i=16,a=null;break e}i=29,n=Error(Q(130,e===null?"null":typeof e,"")),a=null}return t=hn(i,n,t,l),t.elementType=e,t.type=a,t.lanes=r,t}function Wa(e,t,n,a){return e=hn(7,e,a,t),e.lanes=n,e}function Wd(e,t,n){return e=hn(6,e,null,t),e.lanes=n,e}function Jd(e,t,n){return t=hn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Yl=[],Fl=0,Fc=null,Kc=0,kn=[],Sn=0,Ja=null,zs=1,Ls="";function Ka(e,t){Yl[Fl++]=Kc,Yl[Fl++]=Fc,Fc=e,Kc=t}function mb(e,t,n){kn[Sn++]=zs,kn[Sn++]=Ls,kn[Sn++]=Ja,Ja=e;var a=zs;e=Ls;var l=32-pn(a)-1;a&=~(1<<l),n+=1;var r=32-pn(t)+l;if(30<r){var i=l-l%5;r=(a&(1<<i)-1).toString(32),a>>=i,l-=i,zs=1<<32-pn(t)+l|n<<l|a,Ls=r+e}else zs=1<<r|n<<l|a,Ls=e}function Lm(e){e.return!==null&&(Ka(e,1),mb(e,1,0))}function Um(e){for(;e===Fc;)Fc=Yl[--Fl],Yl[Fl]=null,Kc=Yl[--Fl],Yl[Fl]=null;for(;e===Ja;)Ja=kn[--Sn],kn[Sn]=null,Ls=kn[--Sn],kn[Sn]=null,zs=kn[--Sn],kn[Sn]=null}var Pt=null,ct=null,Le=!1,el=null,cs=!1,uh=Error(Q(519));function ll(e){var t=Error(Q(418,""));throw Ui(Rn(t,e)),uh}function sg(e){var t=e.stateNode,n=e.type,a=e.memoizedProps;switch(t[Ut]=e,t[nn]=a,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<Ii.length;n++)Ee(Ii[n],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Yy(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0),Gc(t);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Ky(t,a.value,a.defaultValue,a.children),Gc(t)}n=a.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||a.suppressHydrationWarning===!0||Xj(t.textContent,n)?(a.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),a.onScroll!=null&&Ee("scroll",t),a.onScrollEnd!=null&&Ee("scrollend",t),a.onClick!=null&&(t.onclick=Zu),t=!0):t=!1,t||ll(e)}function ag(e){for(Pt=e.return;Pt;)switch(Pt.tag){case 5:case 13:cs=!1;return;case 27:case 3:cs=!0;return;default:Pt=Pt.return}}function Qr(e){if(e!==Pt)return!1;if(!Le)return ag(e),Le=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||zh(e.type,e.memoizedProps)),n=!n),n&&ct&&ll(e),ag(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){ct=Kn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++;e=e.nextSibling}ct=null}}else t===27?(t=ct,La(e.type)?(e=Bh,Bh=null,ct=e):ct=t):ct=Pt?Kn(e.stateNode.nextSibling):null;return!0}function ho(){ct=Pt=null,Le=!1}function lg(){var e=el;return e!==null&&(en===null?en=e:en.push.apply(en,e),el=null),e}function Ui(e){el===null?el=[e]:el.push(e)}var dh=ws(null),vl=null,Us=null;function da(e,t,n){st(dh,t._currentValue),t._currentValue=n}function Is(e){e._currentValue=dh.current,$t(dh)}function fh(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 hh(e,t,n,a){var l=e.child;for(l!==null&&(l.return=e);l!==null;){var r=l.dependencies;if(r!==null){var i=l.child;r=r.firstContext;e:for(;r!==null;){var o=r;r=l;for(var c=0;c<t.length;c++)if(o.context===t[c]){r.lanes|=n,o=r.alternate,o!==null&&(o.lanes|=n),fh(r.return,n,e),a||(i=null);break e}r=o.next}}else if(l.tag===18){if(i=l.return,i===null)throw Error(Q(341));i.lanes|=n,r=i.alternate,r!==null&&(r.lanes|=n),fh(i,n,e),i=null}else i=l.child;if(i!==null)i.return=l;else for(i=l;i!==null;){if(i===e){i=null;break}if(l=i.sibling,l!==null){l.return=i.return,i=l;break}i=i.return}l=i}}function mo(e,t,n,a){e=null;for(var l=t,r=!1;l!==null;){if(!r){if(l.flags&524288)r=!0;else if(l.flags&262144)break}if(l.tag===10){var i=l.alternate;if(i===null)throw Error(Q(387));if(i=i.memoizedProps,i!==null){var o=l.type;yn(l.pendingProps.value,i.value)||(e!==null?e.push(o):e=[o])}}else if(l===Hc.current){if(i=l.alternate,i===null)throw Error(Q(387));i.memoizedState.memoizedState!==l.memoizedState.memoizedState&&(e!==null?e.push(Gi):e=[Gi])}l=l.return}e!==null&&hh(t,e,n,a),t.flags|=262144}function Xc(e){for(e=e.firstContext;e!==null;){if(!yn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function rl(e){vl=e,Us=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Bt(e){return pb(vl,e)}function Fo(e,t){return vl===null&&rl(e),pb(e,t)}function pb(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Us===null){if(e===null)throw Error(Q(308));Us=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Us=Us.next=t;return n}var b2=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()})}},j2=Tt.unstable_scheduleCallback,w2=Tt.unstable_NormalPriority,Ct={$$typeof:Ds,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bm(){return{controller:new b2,data:new Map,refCount:0}}function po(e){e.refCount--,e.refCount===0&&j2(w2,function(){e.controller.abort()})}var bi=null,mh=0,fr=0,Jl=null;function _2(e,t){if(bi===null){var n=bi=[];mh=0,fr=op(),Jl={status:"pending",value:void 0,then:function(a){n.push(a)}}}return mh++,t.then(rg,rg),t}function rg(){if(--mh===0&&bi!==null){Jl!==null&&(Jl.status="fulfilled");var e=bi;bi=null,fr=0,Jl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function N2(e,t){var n=[],a={status:"pending",value:null,reason:null,then:function(l){n.push(l)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var l=0;l<n.length;l++)(0,n[l])(t)},function(l){for(a.status="rejected",a.reason=l,l=0;l<n.length;l++)(0,n[l])(void 0)}),a}var ig=_e.S;_e.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&_2(e,t),ig!==null&&ig(e,t)};var tl=ws(null);function Hm(){var e=tl.current;return e!==null?e:We.pooledCache}function _c(e,t){t===null?st(tl,tl.current):st(tl,t.pool)}function xb(){var e=Hm();return e===null?null:{parent:Ct._currentValue,pool:e}}var xo=Error(Q(460)),gb=Error(Q(474)),Gu=Error(Q(542)),ph={then:function(){}};function og(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ko(){}function vb(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Ko,Ko),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ug(e),e;default:if(typeof t.status=="string")t.then(Ko,Ko);else{if(e=We,e!==null&&100<e.shellSuspendCounter)throw Error(Q(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var l=t;l.status="fulfilled",l.value=a}},function(a){if(t.status==="pending"){var l=t;l.status="rejected",l.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,ug(e),e}throw ji=t,xo}}var ji=null;function cg(){if(ji===null)throw Error(Q(459));var e=ji;return ji=null,e}function ug(e){if(e===xo||e===Gu)throw Error(Q(483))}var ua=!1;function Im(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xh(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 wa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _a(e,t,n){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,Ve&2){var l=a.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),a.pending=t,t=Yc(e),fb(e,null,n),t}return qu(e,a,t,n),Yc(e)}function wi(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,Hy(e,n)}}function ef(e,t){var n=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,n===a)){var l=null,r=null;if(n=n.firstBaseUpdate,n!==null){do{var i={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};r===null?l=r=i:r=r.next=i,n=n.next}while(n!==null);r===null?l=r=t:r=r.next=t}else l=r=t;n={baseState:a.baseState,firstBaseUpdate:l,lastBaseUpdate:r,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 gh=!1;function _i(){if(gh){var e=Jl;if(e!==null)throw e}}function Ni(e,t,n,a){gh=!1;var l=e.updateQueue;ua=!1;var r=l.firstBaseUpdate,i=l.lastBaseUpdate,o=l.shared.pending;if(o!==null){l.shared.pending=null;var c=o,d=c.next;c.next=null,i===null?r=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(r!==null){var h=l.baseState;i=0,f=d=c=null,o=r;do{var m=o.lane&-536870913,x=m!==o.lane;if(x?($e&m)===m:(a&m)===m){m!==0&&m===fr&&(gh=!0),f!==null&&(f=f.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});e:{var j=e,v=o;m=t;var y=n;switch(v.tag){case 1:if(j=v.payload,typeof j=="function"){h=j.call(y,h,m);break e}h=j;break e;case 3:j.flags=j.flags&-65537|128;case 0:if(j=v.payload,m=typeof j=="function"?j.call(y,h,m):j,m==null)break e;h=Je({},h,m);break e;case 2:ua=!0}}m=o.callback,m!==null&&(e.flags|=64,x&&(e.flags|=8192),x=l.callbacks,x===null?l.callbacks=[m]:x.push(m))}else x={lane:m,tag:o.tag,payload:o.payload,callback:o.callback,next:null},f===null?(d=f=x,c=h):f=f.next=x,i|=m;if(o=o.next,o===null){if(o=l.shared.pending,o===null)break;x=o,o=x.next,x.next=null,l.lastBaseUpdate=x,l.shared.pending=null}}while(!0);f===null&&(c=h),l.baseState=c,l.firstBaseUpdate=d,l.lastBaseUpdate=f,r===null&&(l.shared.lanes=0),Ma|=i,e.lanes=i,e.memoizedState=h}}function yb(e,t){if(typeof e!="function")throw Error(Q(191,e));e.call(t)}function bb(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)yb(n[e],t)}var hr=ws(null),Qc=ws(0);function dg(e,t){e=Vs,st(Qc,e),st(hr,t),Vs=e|t.baseLanes}function vh(){st(Qc,Vs),st(hr,hr.current)}function Pm(){Vs=Qc.current,$t(hr),$t(Qc)}var Ea=0,Te=null,Xe=null,yt=null,Zc=!1,er=!1,il=!1,Wc=0,Bi=0,tr=null,k2=0;function mt(){throw Error(Q(321))}function qm(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!yn(e[n],t[n]))return!1;return!0}function Gm(e,t,n,a,l,r){return Ea=r,Te=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_e.H=e===null||e.memoizedState===null?Zb:Wb,il=!1,r=n(a,l),il=!1,er&&(r=wb(t,n,a,l)),jb(e),r}function jb(e){_e.H=Jc;var t=Xe!==null&&Xe.next!==null;if(Ea=0,yt=Xe=Te=null,Zc=!1,Bi=0,tr=null,t)throw Error(Q(300));e===null||Ot||(e=e.dependencies,e!==null&&Xc(e)&&(Ot=!0))}function wb(e,t,n,a){Te=e;var l=0;do{if(er&&(tr=null),Bi=0,er=!1,25<=l)throw Error(Q(301));if(l+=1,yt=Xe=null,e.updateQueue!=null){var r=e.updateQueue;r.lastEffect=null,r.events=null,r.stores=null,r.memoCache!=null&&(r.memoCache.index=0)}_e.H=M2,r=t(n,a)}while(er);return r}function S2(){var e=_e.H,t=e.useState()[0];return t=typeof t.then=="function"?go(t):t,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Te.flags|=1024),t}function Vm(){var e=Wc!==0;return Wc=0,e}function Ym(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fm(e){if(Zc){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Zc=!1}Ea=0,yt=Xe=Te=null,er=!1,Bi=Wc=0,tr=null}function Wt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?Te.memoizedState=yt=e:yt=yt.next=e,yt}function wt(){if(Xe===null){var e=Te.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var t=yt===null?Te.memoizedState:yt.next;if(t!==null)yt=t,Xe=e;else{if(e===null)throw Te.alternate===null?Error(Q(467)):Error(Q(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},yt===null?Te.memoizedState=yt=e:yt=yt.next=e}return yt}function Km(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function go(e){var t=Bi;return Bi+=1,tr===null&&(tr=[]),e=vb(tr,e,t),t=Te,(yt===null?t.memoizedState:yt.next)===null&&(t=t.alternate,_e.H=t===null||t.memoizedState===null?Zb:Wb),e}function Vu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return go(e);if(e.$$typeof===Ds)return Bt(e)}throw Error(Q(438,String(e)))}function Xm(e){var t=null,n=Te.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var a=Te.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(l){return l.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Km(),Te.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]=uS;return t.index++,n}function qs(e,t){return typeof t=="function"?t(e):t}function Nc(e){var t=wt();return Qm(t,Xe,e)}function Qm(e,t,n){var a=e.queue;if(a===null)throw Error(Q(311));a.lastRenderedReducer=n;var l=e.baseQueue,r=a.pending;if(r!==null){if(l!==null){var i=l.next;l.next=r.next,r.next=i}t.baseQueue=l=r,a.pending=null}if(r=e.baseState,l===null)e.memoizedState=r;else{t=l.next;var o=i=null,c=null,d=t,f=!1;do{var h=d.lane&-536870913;if(h!==d.lane?($e&h)===h:(Ea&h)===h){var m=d.revertLane;if(m===0)c!==null&&(c=c.next={lane:0,revertLane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),h===fr&&(f=!0);else if((Ea&m)===m){d=d.next,m===fr&&(f=!0);continue}else h={lane:0,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=h,i=r):c=c.next=h,Te.lanes|=m,Ma|=m;h=d.action,il&&n(r,h),r=d.hasEagerState?d.eagerState:n(r,h)}else m={lane:h,revertLane:d.revertLane,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null},c===null?(o=c=m,i=r):c=c.next=m,Te.lanes|=h,Ma|=h;d=d.next}while(d!==null&&d!==t);if(c===null?i=r:c.next=o,!yn(r,e.memoizedState)&&(Ot=!0,f&&(n=Jl,n!==null)))throw n;e.memoizedState=r,e.baseState=i,e.baseQueue=c,a.lastRenderedState=r}return l===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function tf(e){var t=wt(),n=t.queue;if(n===null)throw Error(Q(311));n.lastRenderedReducer=e;var a=n.dispatch,l=n.pending,r=t.memoizedState;if(l!==null){n.pending=null;var i=l=l.next;do r=e(r,i.action),i=i.next;while(i!==l);yn(r,t.memoizedState)||(Ot=!0),t.memoizedState=r,t.baseQueue===null&&(t.baseState=r),n.lastRenderedState=r}return[r,a]}function _b(e,t,n){var a=Te,l=wt(),r=Le;if(r){if(n===void 0)throw Error(Q(407));n=n()}else n=t();var i=!yn((Xe||l).memoizedState,n);i&&(l.memoizedState=n,Ot=!0),l=l.queue;var o=Sb.bind(null,a,l,e);if(vo(2048,8,o,[e]),l.getSnapshot!==t||i||yt!==null&&yt.memoizedState.tag&1){if(a.flags|=2048,mr(9,Yu(),kb.bind(null,a,l,n,t),null),We===null)throw Error(Q(349));r||Ea&124||Nb(a,t,n)}return n}function Nb(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Te.updateQueue,t===null?(t=Km(),Te.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function kb(e,t,n,a){t.value=n,t.getSnapshot=a,Cb(t)&&Rb(e)}function Sb(e,t,n){return n(function(){Cb(t)&&Rb(e)})}function Cb(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yn(e,n)}catch{return!0}}function Rb(e){var t=Rr(e,2);t!==null&&gn(t,e,2)}function yh(e){var t=Wt();if(typeof e=="function"){var n=e;if(e=n(),il){pa(!0);try{n()}finally{pa(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:e},t}function Tb(e,t,n,a){return e.baseState=n,Qm(e,Xe,typeof a=="function"?a:qs)}function C2(e,t,n,a,l){if(Fu(e))throw Error(Q(485));if(e=t.action,e!==null){var r={payload:l,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(i){r.listeners.push(i)}};_e.T!==null?n(!0):r.isTransition=!1,a(r),n=t.pending,n===null?(r.next=t.pending=r,Eb(t,r)):(r.next=n.next,t.pending=n.next=r)}}function Eb(e,t){var n=t.action,a=t.payload,l=e.state;if(t.isTransition){var r=_e.T,i={};_e.T=i;try{var o=n(l,a),c=_e.S;c!==null&&c(i,o),fg(e,t,o)}catch(d){bh(e,t,d)}finally{_e.T=r}}else try{r=n(l,a),fg(e,t,r)}catch(d){bh(e,t,d)}}function fg(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(a){hg(e,t,a)},function(a){return bh(e,t,a)}):hg(e,t,n)}function hg(e,t,n){t.status="fulfilled",t.value=n,Ab(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Eb(e,n)))}function bh(e,t,n){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=n,Ab(t),t=t.next;while(t!==a)}e.action=null}function Ab(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Mb(e,t){return t}function mg(e,t){if(Le){var n=We.formState;if(n!==null){e:{var a=Te;if(Le){if(ct){t:{for(var l=ct,r=cs;l.nodeType!==8;){if(!r){l=null;break t}if(l=Kn(l.nextSibling),l===null){l=null;break t}}r=l.data,l=r==="F!"||r==="F"?l:null}if(l){ct=Kn(l.nextSibling),a=l.data==="F!";break e}}ll(a)}a=!1}a&&(t=n[0])}}return n=Wt(),n.memoizedState=n.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mb,lastRenderedState:t},n.queue=a,n=Kb.bind(null,Te,a),a.dispatch=n,a=yh(!1),r=ep.bind(null,Te,!1,a.queue),a=Wt(),l={state:t,dispatch:null,action:e,pending:null},a.queue=l,n=C2.bind(null,Te,l,r,n),l.dispatch=n,a.memoizedState=e,[t,n,!1]}function pg(e){var t=wt();return Ob(t,Xe,e)}function Ob(e,t,n){if(t=Qm(e,t,Mb)[0],e=Nc(qs)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=go(t)}catch(i){throw i===xo?Gu:i}else a=t;t=wt();var l=t.queue,r=l.dispatch;return n!==t.memoizedState&&(Te.flags|=2048,mr(9,Yu(),R2.bind(null,l,n),null)),[a,r,e]}function R2(e,t){e.action=t}function xg(e){var t=wt(),n=Xe;if(n!==null)return Ob(t,n,e);wt(),t=t.memoizedState,n=wt();var a=n.queue.dispatch;return n.memoizedState=e,[t,a,!1]}function mr(e,t,n,a){return e={tag:e,create:n,deps:a,inst:t,next:null},t=Te.updateQueue,t===null&&(t=Km(),Te.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 Yu(){return{destroy:void 0,resource:void 0}}function $b(){return wt().memoizedState}function kc(e,t,n,a){var l=Wt();a=a===void 0?null:a,Te.flags|=e,l.memoizedState=mr(1|t,Yu(),n,a)}function vo(e,t,n,a){var l=wt();a=a===void 0?null:a;var r=l.memoizedState.inst;Xe!==null&&a!==null&&qm(a,Xe.memoizedState.deps)?l.memoizedState=mr(t,r,n,a):(Te.flags|=e,l.memoizedState=mr(1|t,r,n,a))}function gg(e,t){kc(8390656,8,e,t)}function Db(e,t){vo(2048,8,e,t)}function zb(e,t){return vo(4,2,e,t)}function Lb(e,t){return vo(4,4,e,t)}function Ub(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 Bb(e,t,n){n=n!=null?n.concat([e]):null,vo(4,4,Ub.bind(null,t,e),n)}function Zm(){}function Hb(e,t){var n=wt();t=t===void 0?null:t;var a=n.memoizedState;return t!==null&&qm(t,a[1])?a[0]:(n.memoizedState=[e,t],e)}function Ib(e,t){var n=wt();t=t===void 0?null:t;var a=n.memoizedState;if(t!==null&&qm(t,a[1]))return a[0];if(a=e(),il){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a}function Wm(e,t,n){return n===void 0||Ea&1073741824?e.memoizedState=t:(e.memoizedState=n,e=Aj(),Te.lanes|=e,Ma|=e,n)}function Pb(e,t,n,a){return yn(n,t)?n:hr.current!==null?(e=Wm(e,n,a),yn(e,t)||(Ot=!0),e):Ea&42?(e=Aj(),Te.lanes|=e,Ma|=e,t):(Ot=!0,e.memoizedState=n)}function qb(e,t,n,a,l){var r=Ue.p;Ue.p=r!==0&&8>r?r:8;var i=_e.T,o={};_e.T=o,ep(e,!1,t,n);try{var c=l(),d=_e.S;if(d!==null&&d(o,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var f=N2(c,a);ki(e,t,f,xn(e))}else ki(e,t,a,xn(e))}catch(h){ki(e,t,{then:function(){},status:"rejected",reason:h},xn())}finally{Ue.p=r,_e.T=i}}function T2(){}function jh(e,t,n,a){if(e.tag!==5)throw Error(Q(476));var l=Gb(e).queue;qb(e,l,t,Za,n===null?T2:function(){return Vb(e),n(a)})}function Gb(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Za,baseState:Za,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:Za},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:qs,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vb(e){var t=Gb(e).next.queue;ki(e,t,{},xn())}function Jm(){return Bt(Gi)}function Yb(){return wt().memoizedState}function Fb(){return wt().memoizedState}function E2(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=xn();e=wa(n);var a=_a(t,e,n);a!==null&&(gn(a,t,n),wi(a,t,n)),t={cache:Bm()},e.payload=t;return}t=t.return}}function A2(e,t,n){var a=xn();n={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null},Fu(e)?Xb(t,n):(n=Dm(e,t,n,a),n!==null&&(gn(n,e,a),Qb(n,t,a)))}function Kb(e,t,n){var a=xn();ki(e,t,n,a)}function ki(e,t,n,a){var l={lane:a,revertLane:0,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fu(e))Xb(t,l);else{var r=e.alternate;if(e.lanes===0&&(r===null||r.lanes===0)&&(r=t.lastRenderedReducer,r!==null))try{var i=t.lastRenderedState,o=r(i,n);if(l.hasEagerState=!0,l.eagerState=o,yn(o,i))return qu(e,t,l,0),We===null&&Pu(),!1}catch{}finally{}if(n=Dm(e,t,l,a),n!==null)return gn(n,e,a),Qb(n,t,a),!0}return!1}function ep(e,t,n,a){if(a={lane:2,revertLane:op(),action:a,hasEagerState:!1,eagerState:null,next:null},Fu(e)){if(t)throw Error(Q(479))}else t=Dm(e,n,a,2),t!==null&&gn(t,e,2)}function Fu(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function Xb(e,t){er=Zc=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Qb(e,t,n){if(n&4194048){var a=t.lanes;a&=e.pendingLanes,n|=a,t.lanes=n,Hy(e,n)}}var Jc={readContext:Bt,use:Vu,useCallback:mt,useContext:mt,useEffect:mt,useImperativeHandle:mt,useLayoutEffect:mt,useInsertionEffect:mt,useMemo:mt,useReducer:mt,useRef:mt,useState:mt,useDebugValue:mt,useDeferredValue:mt,useTransition:mt,useSyncExternalStore:mt,useId:mt,useHostTransitionStatus:mt,useFormState:mt,useActionState:mt,useOptimistic:mt,useMemoCache:mt,useCacheRefresh:mt},Zb={readContext:Bt,use:Vu,useCallback:function(e,t){return Wt().memoizedState=[e,t===void 0?null:t],e},useContext:Bt,useEffect:gg,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,kc(4194308,4,Ub.bind(null,t,e),n)},useLayoutEffect:function(e,t){return kc(4194308,4,e,t)},useInsertionEffect:function(e,t){kc(4,2,e,t)},useMemo:function(e,t){var n=Wt();t=t===void 0?null:t;var a=e();if(il){pa(!0);try{e()}finally{pa(!1)}}return n.memoizedState=[a,t],a},useReducer:function(e,t,n){var a=Wt();if(n!==void 0){var l=n(t);if(il){pa(!0);try{n(t)}finally{pa(!1)}}}else l=t;return a.memoizedState=a.baseState=l,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:l},a.queue=e,e=e.dispatch=A2.bind(null,Te,e),[a.memoizedState,e]},useRef:function(e){var t=Wt();return e={current:e},t.memoizedState=e},useState:function(e){e=yh(e);var t=e.queue,n=Kb.bind(null,Te,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Zm,useDeferredValue:function(e,t){var n=Wt();return Wm(n,e,t)},useTransition:function(){var e=yh(!1);return e=qb.bind(null,Te,e.queue,!0,!1),Wt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=Te,l=Wt();if(Le){if(n===void 0)throw Error(Q(407));n=n()}else{if(n=t(),We===null)throw Error(Q(349));$e&124||Nb(a,t,n)}l.memoizedState=n;var r={value:n,getSnapshot:t};return l.queue=r,gg(Sb.bind(null,a,r,e),[e]),a.flags|=2048,mr(9,Yu(),kb.bind(null,a,r,n,t),null),n},useId:function(){var e=Wt(),t=We.identifierPrefix;if(Le){var n=Ls,a=zs;n=(a&~(1<<32-pn(a)-1)).toString(32)+n,t="«"+t+"R"+n,n=Wc++,0<n&&(t+="H"+n.toString(32)),t+="»"}else n=k2++,t="«"+t+"r"+n.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:Jm,useFormState:mg,useActionState:mg,useOptimistic:function(e){var t=Wt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ep.bind(null,Te,!0,n),n.dispatch=t,[e,t]},useMemoCache:Xm,useCacheRefresh:function(){return Wt().memoizedState=E2.bind(null,Te)}},Wb={readContext:Bt,use:Vu,useCallback:Hb,useContext:Bt,useEffect:Db,useImperativeHandle:Bb,useInsertionEffect:zb,useLayoutEffect:Lb,useMemo:Ib,useReducer:Nc,useRef:$b,useState:function(){return Nc(qs)},useDebugValue:Zm,useDeferredValue:function(e,t){var n=wt();return Pb(n,Xe.memoizedState,e,t)},useTransition:function(){var e=Nc(qs)[0],t=wt().memoizedState;return[typeof e=="boolean"?e:go(e),t]},useSyncExternalStore:_b,useId:Yb,useHostTransitionStatus:Jm,useFormState:pg,useActionState:pg,useOptimistic:function(e,t){var n=wt();return Tb(n,Xe,e,t)},useMemoCache:Xm,useCacheRefresh:Fb},M2={readContext:Bt,use:Vu,useCallback:Hb,useContext:Bt,useEffect:Db,useImperativeHandle:Bb,useInsertionEffect:zb,useLayoutEffect:Lb,useMemo:Ib,useReducer:tf,useRef:$b,useState:function(){return tf(qs)},useDebugValue:Zm,useDeferredValue:function(e,t){var n=wt();return Xe===null?Wm(n,e,t):Pb(n,Xe.memoizedState,e,t)},useTransition:function(){var e=tf(qs)[0],t=wt().memoizedState;return[typeof e=="boolean"?e:go(e),t]},useSyncExternalStore:_b,useId:Yb,useHostTransitionStatus:Jm,useFormState:xg,useActionState:xg,useOptimistic:function(e,t){var n=wt();return Xe!==null?Tb(n,Xe,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Xm,useCacheRefresh:Fb},nr=null,Hi=0;function Xo(e){var t=Hi;return Hi+=1,nr===null&&(nr=[]),vb(nr,e,t)}function Zr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Qo(e,t){throw t.$$typeof===oS?Error(Q(525)):(e=Object.prototype.toString.call(t),Error(Q(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function vg(e){var t=e._init;return t(e._payload)}function Jb(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 l(g,p){return g=Hs(g,p),g.index=0,g.sibling=null,g}function r(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=Wd(b,g.mode,w),p.return=g,p):(p=l(p,b),p.return=g,p)}function c(g,p,b,w){var N=b.type;return N===Ll?f(g,p,b.props.children,w,b.key):p!==null&&(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&vg(N)===p.type)?(p=l(p,b.props),Zr(p,b),p.return=g,p):(p=wc(b.type,b.key,b.props,null,g.mode,w),Zr(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=Jd(b,g.mode,w),p.return=g,p):(p=l(p,b.children||[]),p.return=g,p)}function f(g,p,b,w,N){return p===null||p.tag!==7?(p=Wa(b,g.mode,w,N),p.return=g,p):(p=l(p,b),p.return=g,p)}function h(g,p,b){if(typeof p=="string"&&p!==""||typeof p=="number"||typeof p=="bigint")return p=Wd(""+p,g.mode,b),p.return=g,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case Po:return b=wc(p.type,p.key,p.props,null,g.mode,b),Zr(b,p),b.return=g,b;case li:return p=Jd(p,g.mode,b),p.return=g,p;case ca:var w=p._init;return p=w(p._payload),h(g,p,b)}if(ri(p)||Fr(p))return p=Wa(p,g.mode,b,null),p.return=g,p;if(typeof p.then=="function")return h(g,Xo(p),b);if(p.$$typeof===Ds)return h(g,Fo(g,p),b);Qo(g,p)}return null}function m(g,p,b,w){var N=p!==null?p.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return N!==null?null:o(g,p,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Po:return b.key===N?c(g,p,b,w):null;case li:return b.key===N?d(g,p,b,w):null;case ca:return N=b._init,b=N(b._payload),m(g,p,b,w)}if(ri(b)||Fr(b))return N!==null?null:f(g,p,b,w,null);if(typeof b.then=="function")return m(g,p,Xo(b),w);if(b.$$typeof===Ds)return m(g,p,Fo(g,b),w);Qo(g,b)}return null}function x(g,p,b,w,N){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(b)||null,o(p,g,""+w,N);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Po:return g=g.get(w.key===null?b:w.key)||null,c(p,g,w,N);case li:return g=g.get(w.key===null?b:w.key)||null,d(p,g,w,N);case ca:var R=w._init;return w=R(w._payload),x(g,p,b,w,N)}if(ri(w)||Fr(w))return g=g.get(b)||null,f(p,g,w,N,null);if(typeof w.then=="function")return x(g,p,b,Xo(w),N);if(w.$$typeof===Ds)return x(g,p,b,Fo(p,w),N);Qo(p,w)}return null}function j(g,p,b,w){for(var N=null,R=null,_=p,k=p=0,L=null;_!==null&&k<b.length;k++){_.index>k?(L=_,_=null):L=_.sibling;var z=m(g,_,b[k],w);if(z===null){_===null&&(_=L);break}e&&_&&z.alternate===null&&t(g,_),p=r(z,p,k),R===null?N=z:R.sibling=z,R=z,_=L}if(k===b.length)return n(g,_),Le&&Ka(g,k),N;if(_===null){for(;k<b.length;k++)_=h(g,b[k],w),_!==null&&(p=r(_,p,k),R===null?N=_:R.sibling=_,R=_);return Le&&Ka(g,k),N}for(_=a(_);k<b.length;k++)L=x(_,g,k,b[k],w),L!==null&&(e&&L.alternate!==null&&_.delete(L.key===null?k:L.key),p=r(L,p,k),R===null?N=L:R.sibling=L,R=L);return e&&_.forEach(function(X){return t(g,X)}),Le&&Ka(g,k),N}function v(g,p,b,w){if(b==null)throw Error(Q(151));for(var N=null,R=null,_=p,k=p=0,L=null,z=b.next();_!==null&&!z.done;k++,z=b.next()){_.index>k?(L=_,_=null):L=_.sibling;var X=m(g,_,z.value,w);if(X===null){_===null&&(_=L);break}e&&_&&X.alternate===null&&t(g,_),p=r(X,p,k),R===null?N=X:R.sibling=X,R=X,_=L}if(z.done)return n(g,_),Le&&Ka(g,k),N;if(_===null){for(;!z.done;k++,z=b.next())z=h(g,z.value,w),z!==null&&(p=r(z,p,k),R===null?N=z:R.sibling=z,R=z);return Le&&Ka(g,k),N}for(_=a(_);!z.done;k++,z=b.next())z=x(_,g,k,z.value,w),z!==null&&(e&&z.alternate!==null&&_.delete(z.key===null?k:z.key),p=r(z,p,k),R===null?N=z:R.sibling=z,R=z);return e&&_.forEach(function(V){return t(g,V)}),Le&&Ka(g,k),N}function y(g,p,b,w){if(typeof b=="object"&&b!==null&&b.type===Ll&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case Po:e:{for(var N=b.key;p!==null;){if(p.key===N){if(N=b.type,N===Ll){if(p.tag===7){n(g,p.sibling),w=l(p,b.props.children),w.return=g,g=w;break e}}else if(p.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===ca&&vg(N)===p.type){n(g,p.sibling),w=l(p,b.props),Zr(w,b),w.return=g,g=w;break e}n(g,p);break}else t(g,p);p=p.sibling}b.type===Ll?(w=Wa(b.props.children,g.mode,w,b.key),w.return=g,g=w):(w=wc(b.type,b.key,b.props,null,g.mode,w),Zr(w,b),w.return=g,g=w)}return i(g);case li:e:{for(N=b.key;p!==null;){if(p.key===N)if(p.tag===4&&p.stateNode.containerInfo===b.containerInfo&&p.stateNode.implementation===b.implementation){n(g,p.sibling),w=l(p,b.children||[]),w.return=g,g=w;break e}else{n(g,p);break}else t(g,p);p=p.sibling}w=Jd(b,g.mode,w),w.return=g,g=w}return i(g);case ca:return N=b._init,b=N(b._payload),y(g,p,b,w)}if(ri(b))return j(g,p,b,w);if(Fr(b)){if(N=Fr(b),typeof N!="function")throw Error(Q(150));return b=N.call(b),v(g,p,b,w)}if(typeof b.then=="function")return y(g,p,Xo(b),w);if(b.$$typeof===Ds)return y(g,p,Fo(g,b),w);Qo(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=l(p,b),w.return=g,g=w):(n(g,p),w=Wd(b,g.mode,w),w.return=g,g=w),i(g)):n(g,p)}return function(g,p,b,w){try{Hi=0;var N=y(g,p,b,w);return nr=null,N}catch(_){if(_===xo||_===Gu)throw _;var R=hn(29,_,null,g.mode);return R.lanes=w,R.return=g,R}finally{}}}var pr=Jb(!0),ej=Jb(!1),$n=ws(null),gs=null;function fa(e){var t=e.alternate;st(Rt,Rt.current&1),st($n,e),gs===null&&(t===null||hr.current!==null||t.memoizedState!==null)&&(gs=e)}function tj(e){if(e.tag===22){if(st(Rt,Rt.current),st($n,e),gs===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(gs=e)}}else ha()}function ha(){st(Rt,Rt.current),st($n,$n.current)}function Bs(e){$t($n),gs===e&&(gs=null),$t(Rt)}var Rt=ws(0);function eu(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==="$?"||Uh(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 nf(e,t,n,a){t=e.memoizedState,n=n(a,t),n=n==null?t:Je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var wh={enqueueSetState:function(e,t,n){e=e._reactInternals;var a=xn(),l=wa(a);l.payload=t,n!=null&&(l.callback=n),t=_a(e,l,a),t!==null&&(gn(t,e,a),wi(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var a=xn(),l=wa(a);l.tag=1,l.payload=t,n!=null&&(l.callback=n),t=_a(e,l,a),t!==null&&(gn(t,e,a),wi(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xn(),a=wa(n);a.tag=2,t!=null&&(a.callback=t),t=_a(e,a,n),t!==null&&(gn(t,e,n),wi(t,e,n))}};function yg(e,t,n,a,l,r,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,r,i):t.prototype&&t.prototype.isPureReactComponent?!Li(n,a)||!Li(l,r):!0}function bg(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&&wh.enqueueReplaceState(t,t.state,null)}function ol(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=Je({},n));for(var l in e)n[l]===void 0&&(n[l]=e[l])}return n}var tu=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 nj(e){tu(e)}function sj(e){console.error(e)}function aj(e){tu(e)}function nu(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function jg(e,t,n){try{var a=e.onCaughtError;a(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(l){setTimeout(function(){throw l})}}function _h(e,t,n){return n=wa(n),n.tag=3,n.payload={element:null},n.callback=function(){nu(e,t)},n}function lj(e){return e=wa(e),e.tag=3,e}function rj(e,t,n,a){var l=n.type.getDerivedStateFromError;if(typeof l=="function"){var r=a.value;e.payload=function(){return l(r)},e.callback=function(){jg(t,n,a)}}var i=n.stateNode;i!==null&&typeof i.componentDidCatch=="function"&&(e.callback=function(){jg(t,n,a),typeof l!="function"&&(Na===null?Na=new Set([this]):Na.add(this));var o=a.stack;this.componentDidCatch(a.value,{componentStack:o!==null?o:""})})}function O2(e,t,n,a,l){if(n.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=n.alternate,t!==null&&mo(t,n,l,!0),n=$n.current,n!==null){switch(n.tag){case 13:return gs===null?Ah():n.alternate===null&&ut===0&&(ut=3),n.flags&=-257,n.flags|=65536,n.lanes=l,a===ph?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([a]):t.add(a),mf(e,a,l)),!1;case 22:return n.flags|=65536,a===ph?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)),mf(e,a,l)),!1}throw Error(Q(435,n.tag))}return mf(e,a,l),Ah(),!1}if(Le)return t=$n.current,t!==null?(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=l,a!==uh&&(e=Error(Q(422),{cause:a}),Ui(Rn(e,n)))):(a!==uh&&(t=Error(Q(423),{cause:a}),Ui(Rn(t,n))),e=e.current.alternate,e.flags|=65536,l&=-l,e.lanes|=l,a=Rn(a,n),l=_h(e.stateNode,a,l),ef(e,l),ut!==4&&(ut=2)),!1;var r=Error(Q(520),{cause:a});if(r=Rn(r,n),Ri===null?Ri=[r]:Ri.push(r),ut!==4&&(ut=2),t===null)return!0;a=Rn(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=l&-l,n.lanes|=e,e=_h(n.stateNode,a,e),ef(n,e),!1;case 1:if(t=n.type,r=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||r!==null&&typeof r.componentDidCatch=="function"&&(Na===null||!Na.has(r))))return n.flags|=65536,l&=-l,n.lanes|=l,l=lj(l),rj(l,e,n,a),ef(n,l),!1}n=n.return}while(n!==null);return!1}var ij=Error(Q(461)),Ot=!1;function Dt(e,t,n,a){t.child=e===null?ej(t,null,n,a):pr(t,e.child,n,a)}function wg(e,t,n,a,l){n=n.render;var r=t.ref;if("ref"in a){var i={};for(var o in a)o!=="ref"&&(i[o]=a[o])}else i=a;return rl(t),a=Gm(e,t,n,i,r,l),o=Vm(),e!==null&&!Ot?(Ym(e,t,l),Gs(e,t,l)):(Le&&o&&Lm(t),t.flags|=1,Dt(e,t,a,l),t.child)}function _g(e,t,n,a,l){if(e===null){var r=n.type;return typeof r=="function"&&!zm(r)&&r.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=r,oj(e,t,r,a,l)):(e=wc(n.type,null,a,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(r=e.child,!tp(e,l)){var i=r.memoizedProps;if(n=n.compare,n=n!==null?n:Li,n(i,a)&&e.ref===t.ref)return Gs(e,t,l)}return t.flags|=1,e=Hs(r,a),e.ref=t.ref,e.return=t,t.child=e}function oj(e,t,n,a,l){if(e!==null){var r=e.memoizedProps;if(Li(r,a)&&e.ref===t.ref)if(Ot=!1,t.pendingProps=a=r,tp(e,l))e.flags&131072&&(Ot=!0);else return t.lanes=e.lanes,Gs(e,t,l)}return Nh(e,t,n,a,l)}function cj(e,t,n){var a=t.pendingProps,l=a.children,r=e!==null?e.memoizedState:null;if(a.mode==="hidden"){if(t.flags&128){if(a=r!==null?r.baseLanes|n:n,e!==null){for(l=t.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;t.childLanes=r&~a}else t.childLanes=0,t.child=null;return Ng(e,t,a,n)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&_c(t,r!==null?r.cachePool:null),r!==null?dg(t,r):vh(),tj(t);else return t.lanes=t.childLanes=536870912,Ng(e,t,r!==null?r.baseLanes|n:n,n)}else r!==null?(_c(t,r.cachePool),dg(t,r),ha(),t.memoizedState=null):(e!==null&&_c(t,null),vh(),ha());return Dt(e,t,l,n),t.child}function Ng(e,t,n,a){var l=Hm();return l=l===null?null:{parent:Ct._currentValue,pool:l},t.memoizedState={baseLanes:n,cachePool:l},e!==null&&_c(t,null),vh(),tj(t),e!==null&&mo(e,t,a,!0),null}function Sc(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 Nh(e,t,n,a,l){return rl(t),n=Gm(e,t,n,a,void 0,l),a=Vm(),e!==null&&!Ot?(Ym(e,t,l),Gs(e,t,l)):(Le&&a&&Lm(t),t.flags|=1,Dt(e,t,n,l),t.child)}function kg(e,t,n,a,l,r){return rl(t),t.updateQueue=null,n=wb(t,a,n,l),jb(e),a=Vm(),e!==null&&!Ot?(Ym(e,t,r),Gs(e,t,r)):(Le&&a&&Lm(t),t.flags|=1,Dt(e,t,n,r),t.child)}function Sg(e,t,n,a,l){if(rl(t),t.stateNode===null){var r=Vl,i=n.contextType;typeof i=="object"&&i!==null&&(r=Bt(i)),r=new n(a,r),t.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=wh,t.stateNode=r,r._reactInternals=t,r=t.stateNode,r.props=a,r.state=t.memoizedState,r.refs={},Im(t),i=n.contextType,r.context=typeof i=="object"&&i!==null?Bt(i):Vl,r.state=t.memoizedState,i=n.getDerivedStateFromProps,typeof i=="function"&&(nf(t,n,i,a),r.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(i=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),i!==r.state&&wh.enqueueReplaceState(r,r.state,null),Ni(t,a,r,l),_i(),r.state=t.memoizedState),typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){r=t.stateNode;var o=t.memoizedProps,c=ol(n,o);r.props=c;var d=r.context,f=n.contextType;i=Vl,typeof f=="object"&&f!==null&&(i=Bt(f));var h=n.getDerivedStateFromProps;f=typeof h=="function"||typeof r.getSnapshotBeforeUpdate=="function",o=t.pendingProps!==o,f||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(o||d!==i)&&bg(t,r,a,i),ua=!1;var m=t.memoizedState;r.state=m,Ni(t,a,r,l),_i(),d=t.memoizedState,o||m!==d||ua?(typeof h=="function"&&(nf(t,n,h,a),d=t.memoizedState),(c=ua||yg(t,n,c,a,m,d,i))?(f||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(t.flags|=4194308)):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=d),r.props=a,r.state=d,r.context=i,a=c):(typeof r.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{r=t.stateNode,xh(e,t),i=t.memoizedProps,f=ol(n,i),r.props=f,h=t.pendingProps,m=r.context,d=n.contextType,c=Vl,typeof d=="object"&&d!==null&&(c=Bt(d)),o=n.getDerivedStateFromProps,(d=typeof o=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(i!==h||m!==c)&&bg(t,r,a,c),ua=!1,m=t.memoizedState,r.state=m,Ni(t,a,r,l),_i();var x=t.memoizedState;i!==h||m!==x||ua||e!==null&&e.dependencies!==null&&Xc(e.dependencies)?(typeof o=="function"&&(nf(t,n,o,a),x=t.memoizedState),(f=ua||yg(t,n,f,a,m,x,c)||e!==null&&e.dependencies!==null&&Xc(e.dependencies))?(d||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(a,x,c),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(a,x,c)),typeof r.componentDidUpdate=="function"&&(t.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=x),r.props=a,r.state=x,r.context=c,a=f):(typeof r.componentDidUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||i===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),a=!1)}return r=a,Sc(e,t),a=(t.flags&128)!==0,r||a?(r=t.stateNode,n=a&&typeof n.getDerivedStateFromError!="function"?null:r.render(),t.flags|=1,e!==null&&a?(t.child=pr(t,e.child,null,l),t.child=pr(t,null,n,l)):Dt(e,t,n,l),t.memoizedState=r.state,e=t.child):e=Gs(e,t,l),e}function Cg(e,t,n,a){return ho(),t.flags|=256,Dt(e,t,n,a),t.child}var sf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function af(e){return{baseLanes:e,cachePool:xb()}}function lf(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Tn),e}function uj(e,t,n){var a=t.pendingProps,l=!1,r=(t.flags&128)!==0,i;if((i=r)||(i=e!==null&&e.memoizedState===null?!1:(Rt.current&2)!==0),i&&(l=!0,t.flags&=-129),i=(t.flags&32)!==0,t.flags&=-33,e===null){if(Le){if(l?fa(t):ha(),Le){var o=ct,c;if(c=o){e:{for(c=o,o=cs;c.nodeType!==8;){if(!o){o=null;break e}if(c=Kn(c.nextSibling),c===null){o=null;break e}}o=c}o!==null?(t.memoizedState={dehydrated:o,treeContext:Ja!==null?{id:zs,overflow:Ls}:null,retryLane:536870912,hydrationErrors:null},c=hn(18,null,null,0),c.stateNode=o,c.return=t,t.child=c,Pt=t,ct=null,c=!0):c=!1}c||ll(t)}if(o=t.memoizedState,o!==null&&(o=o.dehydrated,o!==null))return Uh(o)?t.lanes=32:t.lanes=536870912,null;Bs(t)}return o=a.children,a=a.fallback,l?(ha(),l=t.mode,o=su({mode:"hidden",children:o},l),a=Wa(a,l,n,null),o.return=t,a.return=t,o.sibling=a,t.child=o,l=t.child,l.memoizedState=af(n),l.childLanes=lf(e,i,n),t.memoizedState=sf,a):(fa(t),kh(t,o))}if(c=e.memoizedState,c!==null&&(o=c.dehydrated,o!==null)){if(r)t.flags&256?(fa(t),t.flags&=-257,t=rf(e,t,n)):t.memoizedState!==null?(ha(),t.child=e.child,t.flags|=128,t=null):(ha(),l=a.fallback,o=t.mode,a=su({mode:"visible",children:a.children},o),l=Wa(l,o,n,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,pr(t,e.child,null,n),a=t.child,a.memoizedState=af(n),a.childLanes=lf(e,i,n),t.memoizedState=sf,t=l);else if(fa(t),Uh(o)){if(i=o.nextSibling&&o.nextSibling.dataset,i)var d=i.dgst;i=d,a=Error(Q(419)),a.stack="",a.digest=i,Ui({value:a,source:null,stack:null}),t=rf(e,t,n)}else if(Ot||mo(e,t,n,!1),i=(n&e.childLanes)!==0,Ot||i){if(i=We,i!==null&&(a=n&-n,a=a&42?1:km(a),a=a&(i.suspendedLanes|n)?0:a,a!==0&&a!==c.retryLane))throw c.retryLane=a,Rr(e,a),gn(i,e,a),ij;o.data==="$?"||Ah(),t=rf(e,t,n)}else o.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=c.treeContext,ct=Kn(o.nextSibling),Pt=t,Le=!0,el=null,cs=!1,e!==null&&(kn[Sn++]=zs,kn[Sn++]=Ls,kn[Sn++]=Ja,zs=e.id,Ls=e.overflow,Ja=t),t=kh(t,a.children),t.flags|=4096);return t}return l?(ha(),l=a.fallback,o=t.mode,c=e.child,d=c.sibling,a=Hs(c,{mode:"hidden",children:a.children}),a.subtreeFlags=c.subtreeFlags&65011712,d!==null?l=Hs(d,l):(l=Wa(l,o,n,null),l.flags|=2),l.return=t,a.return=t,a.sibling=l,t.child=a,a=l,l=t.child,o=e.child.memoizedState,o===null?o=af(n):(c=o.cachePool,c!==null?(d=Ct._currentValue,c=c.parent!==d?{parent:d,pool:d}:c):c=xb(),o={baseLanes:o.baseLanes|n,cachePool:c}),l.memoizedState=o,l.childLanes=lf(e,i,n),t.memoizedState=sf,a):(fa(t),n=e.child,e=n.sibling,n=Hs(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 kh(e,t){return t=su({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function su(e,t){return e=hn(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function rf(e,t,n){return pr(t,e.child,null,n),e=kh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Rg(e,t,n){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),fh(e.return,t,n)}function of(e,t,n,a,l){var r=e.memoizedState;r===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:n,tailMode:l}:(r.isBackwards=t,r.rendering=null,r.renderingStartTime=0,r.last=a,r.tail=n,r.tailMode=l)}function dj(e,t,n){var a=t.pendingProps,l=a.revealOrder,r=a.tail;if(Dt(e,t,a.children,n),a=Rt.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&&Rg(e,n,t);else if(e.tag===19)Rg(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(st(Rt,a),l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&eu(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),of(t,!1,l,n,r);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&eu(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}of(t,!0,n,null,r);break;case"together":of(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Gs(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ma|=t.lanes,!(n&t.childLanes))if(e!==null){if(mo(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=Hs(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Hs(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function tp(e,t){return e.lanes&t?!0:(e=e.dependencies,!!(e!==null&&Xc(e)))}function $2(e,t,n){switch(t.tag){case 3:Ic(t,t.stateNode.containerInfo),da(t,Ct,e.memoizedState.cache),ho();break;case 27:case 5:eh(t);break;case 4:Ic(t,t.stateNode.containerInfo);break;case 10:da(t,t.type,t.memoizedProps.value);break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(fa(t),t.flags|=128,null):n&t.child.childLanes?uj(e,t,n):(fa(t),e=Gs(e,t,n),e!==null?e.sibling:null);fa(t);break;case 19:var l=(e.flags&128)!==0;if(a=(n&t.childLanes)!==0,a||(mo(e,t,n,!1),a=(n&t.childLanes)!==0),l){if(a)return dj(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),st(Rt,Rt.current),a)break;return null;case 22:case 23:return t.lanes=0,cj(e,t,n);case 24:da(t,Ct,e.memoizedState.cache)}return Gs(e,t,n)}function fj(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ot=!0;else{if(!tp(e,n)&&!(t.flags&128))return Ot=!1,$2(e,t,n);Ot=!!(e.flags&131072)}else Ot=!1,Le&&t.flags&1048576&&mb(t,Kc,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var a=t.elementType,l=a._init;if(a=l(a._payload),t.type=a,typeof a=="function")zm(a)?(e=ol(a,e),t.tag=1,t=Sg(null,t,a,e,n)):(t.tag=0,t=Nh(null,t,a,e,n));else{if(a!=null){if(l=a.$$typeof,l===wm){t.tag=11,t=wg(null,t,a,e,n);break e}else if(l===_m){t.tag=14,t=_g(null,t,a,e,n);break e}}throw t=Wf(a)||a,Error(Q(306,t,""))}}return t;case 0:return Nh(e,t,t.type,t.pendingProps,n);case 1:return a=t.type,l=ol(a,t.pendingProps),Sg(e,t,a,l,n);case 3:e:{if(Ic(t,t.stateNode.containerInfo),e===null)throw Error(Q(387));a=t.pendingProps;var r=t.memoizedState;l=r.element,xh(e,t),Ni(t,a,null,n);var i=t.memoizedState;if(a=i.cache,da(t,Ct,a),a!==r.cache&&hh(t,[Ct],n,!0),_i(),a=i.element,r.isDehydrated)if(r={element:a,isDehydrated:!1,cache:i.cache},t.updateQueue.baseState=r,t.memoizedState=r,t.flags&256){t=Cg(e,t,a,n);break e}else if(a!==l){l=Rn(Error(Q(424)),t),Ui(l),t=Cg(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(ct=Kn(e.firstChild),Pt=t,Le=!0,el=null,cs=!0,n=ej(t,null,a,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ho(),a===l){t=Gs(e,t,n);break e}Dt(e,t,a,n)}t=t.child}return t;case 26:return Sc(e,t),e===null?(n=Vg(t.type,null,t.pendingProps,null))?t.memoizedState=n:Le||(n=t.type,e=t.pendingProps,a=uu(ja.current).createElement(n),a[Ut]=t,a[nn]=e,Lt(a,n,e),Mt(a),t.stateNode=a):t.memoizedState=Vg(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return eh(t),e===null&&Le&&(a=t.stateNode=Wj(t.type,t.pendingProps,ja.current),Pt=t,cs=!0,l=ct,La(t.type)?(Bh=l,ct=Kn(a.firstChild)):ct=l),Dt(e,t,t.pendingProps.children,n),Sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Le&&((l=a=ct)&&(a=oC(a,t.type,t.pendingProps,cs),a!==null?(t.stateNode=a,Pt=t,ct=Kn(a.firstChild),cs=!1,l=!0):l=!1),l||ll(t)),eh(t),l=t.type,r=t.pendingProps,i=e!==null?e.memoizedProps:null,a=r.children,zh(l,r)?a=null:i!==null&&zh(l,i)&&(t.flags|=32),t.memoizedState!==null&&(l=Gm(e,t,S2,null,null,n),Gi._currentValue=l),Sc(e,t),Dt(e,t,a,n),t.child;case 6:return e===null&&Le&&((e=n=ct)&&(n=cC(n,t.pendingProps,cs),n!==null?(t.stateNode=n,Pt=t,ct=null,e=!0):e=!1),e||ll(t)),null;case 13:return uj(e,t,n);case 4:return Ic(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=pr(t,null,a,n):Dt(e,t,a,n),t.child;case 11:return wg(e,t,t.type,t.pendingProps,n);case 7:return Dt(e,t,t.pendingProps,n),t.child;case 8:return Dt(e,t,t.pendingProps.children,n),t.child;case 12:return Dt(e,t,t.pendingProps.children,n),t.child;case 10:return a=t.pendingProps,da(t,t.type,a.value),Dt(e,t,a.children,n),t.child;case 9:return l=t.type._context,a=t.pendingProps.children,rl(t),l=Bt(l),a=a(l),t.flags|=1,Dt(e,t,a,n),t.child;case 14:return _g(e,t,t.type,t.pendingProps,n);case 15:return oj(e,t,t.type,t.pendingProps,n);case 19:return dj(e,t,n);case 31:return a=t.pendingProps,n=t.mode,a={mode:a.mode,children:a.children},e===null?(n=su(a,n),n.ref=t.ref,t.child=n,n.return=t,t=n):(n=Hs(e.child,a),n.ref=t.ref,t.child=n,n.return=t,t=n),t;case 22:return cj(e,t,n);case 24:return rl(t),a=Bt(Ct),e===null?(l=Hm(),l===null&&(l=We,r=Bm(),l.pooledCache=r,r.refCount++,r!==null&&(l.pooledCacheLanes|=n),l=r),t.memoizedState={parent:a,cache:l},Im(t),da(t,Ct,l)):(e.lanes&n&&(xh(e,t),Ni(t,null,null,n),_i()),l=e.memoizedState,r=t.memoizedState,l.parent!==a?(l={parent:a,cache:a},t.memoizedState=l,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=l),da(t,Ct,a)):(a=r.cache,da(t,Ct,a),a!==l.cache&&hh(t,[Ct],n,!0))),Dt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(Q(156,t.tag))}function Rs(e){e.flags|=4}function Tg(e,t){if(t.type!=="stylesheet"||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!t0(t)){if(t=$n.current,t!==null&&(($e&4194048)===$e?gs!==null:($e&62914560)!==$e&&!($e&536870912)||t!==gs))throw ji=ph,gb;e.flags|=8192}}function Zo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Uy():536870912,e.lanes|=t,xr|=t)}function Wr(e,t){if(!Le)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 at(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,a=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags&65011712,a|=l.flags&65011712,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,a|=l.subtreeFlags,a|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=a,e.childLanes=n,t}function D2(e,t,n){var a=t.pendingProps;switch(Um(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(t),null;case 1:return at(t),null;case 3:return n=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Is(Ct),cr(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Qr(t)?Rs(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,lg())),at(t),null;case 26:return n=t.memoizedState,e===null?(Rs(t),n!==null?(at(t),Tg(t,n)):(at(t),t.flags&=-16777217)):n?n!==e.memoizedState?(Rs(t),at(t),Tg(t,n)):(at(t),t.flags&=-16777217):(e.memoizedProps!==a&&Rs(t),at(t),t.flags&=-16777217),null;case 27:Pc(t),n=ja.current;var l=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Rs(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return at(t),null}e=ps.current,Qr(t)?sg(t):(e=Wj(l,a,n),t.stateNode=e,Rs(t))}return at(t),null;case 5:if(Pc(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Rs(t);else{if(!a){if(t.stateNode===null)throw Error(Q(166));return at(t),null}if(e=ps.current,Qr(t))sg(t);else{switch(l=uu(ja.current),e){case 1:e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":e=l.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":e=l.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":e=l.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof a.is=="string"?l.createElement("select",{is:a.is}):l.createElement("select"),a.multiple?e.multiple=!0:a.size&&(e.size=a.size);break;default:e=typeof a.is=="string"?l.createElement(n,{is:a.is}):l.createElement(n)}}e[Ut]=t,e[nn]=a;e:for(l=t.child;l!==null;){if(l.tag===5||l.tag===6)e.appendChild(l.stateNode);else if(l.tag!==4&&l.tag!==27&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break e;for(;l.sibling===null;){if(l.return===null||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}t.stateNode=e;e:switch(Lt(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&&Rs(t)}}return at(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Rs(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(Q(166));if(e=ja.current,Qr(t)){if(e=t.stateNode,n=t.memoizedProps,a=null,l=Pt,l!==null)switch(l.tag){case 27:case 5:a=l.memoizedProps}e[Ut]=t,e=!!(e.nodeValue===n||a!==null&&a.suppressHydrationWarning===!0||Xj(e.nodeValue,n)),e||ll(t)}else e=uu(e).createTextNode(a),e[Ut]=t,t.stateNode=e}return at(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(l=Qr(t),a!==null&&a.dehydrated!==null){if(e===null){if(!l)throw Error(Q(318));if(l=t.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(Q(317));l[Ut]=t}else ho(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;at(t),l=!1}else l=lg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l)return t.flags&256?(Bs(t),t):(Bs(t),null)}if(Bs(t),t.flags&128)return t.lanes=n,t;if(n=a!==null,e=e!==null&&e.memoizedState!==null,n){a=t.child,l=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(l=a.alternate.memoizedState.cachePool.pool);var r=null;a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==l&&(a.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Zo(t,t.updateQueue),at(t),null;case 4:return cr(),e===null&&cp(t.stateNode.containerInfo),at(t),null;case 10:return Is(t.type),at(t),null;case 19:if($t(Rt),l=t.memoizedState,l===null)return at(t),null;if(a=(t.flags&128)!==0,r=l.rendering,r===null)if(a)Wr(l,!1);else{if(ut!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(r=eu(e),r!==null){for(t.flags|=128,Wr(l,!1),e=r.updateQueue,t.updateQueue=e,Zo(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)hb(n,e),n=n.sibling;return st(Rt,Rt.current&1|2),t.child}e=e.sibling}l.tail!==null&&xs()>lu&&(t.flags|=128,a=!0,Wr(l,!1),t.lanes=4194304)}else{if(!a)if(e=eu(r),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Zo(t,e),Wr(l,!0),l.tail===null&&l.tailMode==="hidden"&&!r.alternate&&!Le)return at(t),null}else 2*xs()-l.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,Wr(l,!1),t.lanes=4194304);l.isBackwards?(r.sibling=t.child,t.child=r):(e=l.last,e!==null?e.sibling=r:t.child=r,l.last=r)}return l.tail!==null?(t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=xs(),t.sibling=null,e=Rt.current,st(Rt,a?e&1|2:e&1),t):(at(t),null);case 22:case 23:return Bs(t),Pm(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?n&536870912&&!(t.flags&128)&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),n=t.updateQueue,n!==null&&Zo(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),e!==null&&$t(tl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Is(Ct),at(t),null;case 25:return null;case 30:return null}throw Error(Q(156,t.tag))}function z2(e,t){switch(Um(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Is(Ct),cr(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Pc(t),null;case 13:if(Bs(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Q(340));ho()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $t(Rt),null;case 4:return cr(),null;case 10:return Is(t.type),null;case 22:case 23:return Bs(t),Pm(),e!==null&&$t(tl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Is(Ct),null;case 25:return null;default:return null}}function hj(e,t){switch(Um(t),t.tag){case 3:Is(Ct),cr();break;case 26:case 27:case 5:Pc(t);break;case 4:cr();break;case 13:Bs(t);break;case 19:$t(Rt);break;case 10:Is(t.type);break;case 22:case 23:Bs(t),Pm(),e!==null&&$t(tl);break;case 24:Is(Ct)}}function yo(e,t){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var l=a.next;n=l;do{if((n.tag&e)===e){a=void 0;var r=n.create,i=n.inst;a=r(),i.destroy=a}n=n.next}while(n!==l)}}catch(o){Ze(t,t.return,o)}}function Aa(e,t,n){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var r=l.next;a=r;do{if((a.tag&e)===e){var i=a.inst,o=i.destroy;if(o!==void 0){i.destroy=void 0,l=t;var c=n,d=o;try{d()}catch(f){Ze(l,c,f)}}}a=a.next}while(a!==r)}}catch(f){Ze(t,t.return,f)}}function mj(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{bb(t,n)}catch(a){Ze(e,e.return,a)}}}function pj(e,t,n){n.props=ol(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(a){Ze(e,t,a)}}function Si(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(l){Ze(e,t,l)}}function fs(e,t){var n=e.ref,a=e.refCleanup;if(n!==null)if(typeof a=="function")try{a()}catch(l){Ze(e,t,l)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(l){Ze(e,t,l)}else n.current=null}function xj(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(l){Ze(e,e.return,l)}}function cf(e,t,n){try{var a=e.stateNode;sC(a,e.type,n,t),a[nn]=t}catch(l){Ze(e,e.return,l)}}function gj(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&La(e.type)||e.tag===4}function uf(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gj(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&&La(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 Sh(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=Zu));else if(a!==4&&(a===27&&La(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Sh(e,t,n),e=e.sibling;e!==null;)Sh(e,t,n),e=e.sibling}function au(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&&La(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(au(e,t,n),e=e.sibling;e!==null;)au(e,t,n),e=e.sibling}function vj(e){var t=e.stateNode,n=e.memoizedProps;try{for(var a=e.type,l=t.attributes;l.length;)t.removeAttributeNode(l[0]);Lt(t,a,n),t[Ut]=e,t[nn]=n}catch(r){Ze(e,e.return,r)}}var $s=!1,pt=!1,df=!1,Eg=typeof WeakSet=="function"?WeakSet:Set,At=null;function L2(e,t){if(e=e.containerInfo,$h=mu,e=lb(e),Om(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 l=a.anchorOffset,r=a.focusNode;a=a.focusOffset;try{n.nodeType,r.nodeType}catch{n=null;break e}var i=0,o=-1,c=-1,d=0,f=0,h=e,m=null;t:for(;;){for(var x;h!==n||l!==0&&h.nodeType!==3||(o=i+l),h!==r||a!==0&&h.nodeType!==3||(c=i+a),h.nodeType===3&&(i+=h.nodeValue.length),(x=h.firstChild)!==null;)m=h,h=x;for(;;){if(h===e)break t;if(m===n&&++d===l&&(o=i),m===r&&++f===a&&(c=i),(x=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=x}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dh={focusedElem:e,selectionRange:n},mu=!1,At=t;At!==null;)if(t=At,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,At=e;else for(;At!==null;){switch(t=At,r=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if(e&1024&&r!==null){e=void 0,n=t,l=r.memoizedProps,r=r.memoizedState,a=n.stateNode;try{var j=ol(n.type,l,n.elementType===n.type);e=a.getSnapshotBeforeUpdate(j,r),a.__reactInternalSnapshotBeforeUpdate=e}catch(v){Ze(n,n.return,v)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Lh(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Lh(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,At=e;break}At=t.return}}function yj(e,t,n){var a=n.flags;switch(n.tag){case 0:case 11:case 15:sa(e,n),a&4&&yo(5,n);break;case 1:if(sa(e,n),a&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(i){Ze(n,n.return,i)}else{var l=ol(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(l,t,e.__reactInternalSnapshotBeforeUpdate)}catch(i){Ze(n,n.return,i)}}a&64&&mj(n),a&512&&Si(n,n.return);break;case 3:if(sa(e,n),a&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{bb(e,t)}catch(i){Ze(n,n.return,i)}}break;case 27:t===null&&a&4&&vj(n);case 26:case 5:sa(e,n),t===null&&a&4&&xj(n),a&512&&Si(n,n.return);break;case 12:sa(e,n);break;case 13:sa(e,n),a&4&&wj(e,n),a&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Y2.bind(null,n),uC(e,n))));break;case 22:if(a=n.memoizedState!==null||$s,!a){t=t!==null&&t.memoizedState!==null||pt,l=$s;var r=pt;$s=a,(pt=t)&&!r?ia(e,n,(n.subtreeFlags&8772)!==0):sa(e,n),$s=l,pt=r}break;case 30:break;default:sa(e,n)}}function bj(e){var t=e.alternate;t!==null&&(e.alternate=null,bj(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Cm(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 tt=null,Jt=!1;function Ts(e,t,n){for(n=n.child;n!==null;)jj(e,t,n),n=n.sibling}function jj(e,t,n){if(mn&&typeof mn.onCommitFiberUnmount=="function")try{mn.onCommitFiberUnmount(io,n)}catch{}switch(n.tag){case 26:pt||fs(n,t),Ts(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:pt||fs(n,t);var a=tt,l=Jt;La(n.type)&&(tt=n.stateNode,Jt=!1),Ts(e,t,n),Ei(n.stateNode),tt=a,Jt=l;break;case 5:pt||fs(n,t);case 6:if(a=tt,l=Jt,tt=null,Ts(e,t,n),tt=a,Jt=l,tt!==null)if(Jt)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(n.stateNode)}catch(r){Ze(n,t,r)}else try{tt.removeChild(n.stateNode)}catch(r){Ze(n,t,r)}break;case 18:tt!==null&&(Jt?(e=tt,Pg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Fi(e)):Pg(tt,n.stateNode));break;case 4:a=tt,l=Jt,tt=n.stateNode.containerInfo,Jt=!0,Ts(e,t,n),tt=a,Jt=l;break;case 0:case 11:case 14:case 15:pt||Aa(2,n,t),pt||Aa(4,n,t),Ts(e,t,n);break;case 1:pt||(fs(n,t),a=n.stateNode,typeof a.componentWillUnmount=="function"&&pj(n,t,a)),Ts(e,t,n);break;case 21:Ts(e,t,n);break;case 22:pt=(a=pt)||n.memoizedState!==null,Ts(e,t,n),pt=a;break;default:Ts(e,t,n)}}function wj(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Fi(e)}catch(n){Ze(t,t.return,n)}}function U2(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Eg),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Eg),t;default:throw Error(Q(435,e.tag))}}function ff(e,t){var n=U2(e);t.forEach(function(a){var l=F2.bind(null,e,a);n.has(a)||(n.add(a),a.then(l,l))})}function on(e,t){var n=t.deletions;if(n!==null)for(var a=0;a<n.length;a++){var l=n[a],r=e,i=t,o=i;e:for(;o!==null;){switch(o.tag){case 27:if(La(o.type)){tt=o.stateNode,Jt=!1;break e}break;case 5:tt=o.stateNode,Jt=!1;break e;case 3:case 4:tt=o.stateNode.containerInfo,Jt=!0;break e}o=o.return}if(tt===null)throw Error(Q(160));jj(r,i,l),tt=null,Jt=!1,r=l.alternate,r!==null&&(r.return=null),l.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)_j(t,e),t=t.sibling}var Gn=null;function _j(e,t){var n=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:on(t,e),cn(e),a&4&&(Aa(3,e,e.return),yo(3,e),Aa(5,e,e.return));break;case 1:on(t,e),cn(e),a&512&&(pt||n===null||fs(n,n.return)),a&64&&$s&&(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 l=Gn;if(on(t,e),cn(e),a&512&&(pt||n===null||fs(n,n.return)),a&4){var r=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,l=l.ownerDocument||l;t:switch(a){case"title":r=l.getElementsByTagName("title")[0],(!r||r[uo]||r[Ut]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=l.createElement(a),l.head.insertBefore(r,l.querySelector("head > title"))),Lt(r,a,n),r[Ut]=e,Mt(r),a=r;break e;case"link":var i=Fg("link","href",l).get(a+(n.href||""));if(i){for(var o=0;o<i.length;o++)if(r=i[o],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(o,1);break t}}r=l.createElement(a),Lt(r,a,n),l.head.appendChild(r);break;case"meta":if(i=Fg("meta","content",l).get(a+(n.content||""))){for(o=0;o<i.length;o++)if(r=i[o],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(o,1);break t}}r=l.createElement(a),Lt(r,a,n),l.head.appendChild(r);break;default:throw Error(Q(468,a))}r[Ut]=e,Mt(r),a=r}e.stateNode=a}else Kg(l,e.type,e.stateNode);else e.stateNode=Yg(l,a,e.memoizedProps);else r!==a?(r===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):r.count--,a===null?Kg(l,e.type,e.stateNode):Yg(l,a,e.memoizedProps)):a===null&&e.stateNode!==null&&cf(e,e.memoizedProps,n.memoizedProps)}break;case 27:on(t,e),cn(e),a&512&&(pt||n===null||fs(n,n.return)),n!==null&&a&4&&cf(e,e.memoizedProps,n.memoizedProps);break;case 5:if(on(t,e),cn(e),a&512&&(pt||n===null||fs(n,n.return)),e.flags&32){l=e.stateNode;try{dr(l,"")}catch(x){Ze(e,e.return,x)}}a&4&&e.stateNode!=null&&(l=e.memoizedProps,cf(e,l,n!==null?n.memoizedProps:l)),a&1024&&(df=!0);break;case 6:if(on(t,e),cn(e),a&4){if(e.stateNode===null)throw Error(Q(162));a=e.memoizedProps,n=e.stateNode;try{n.nodeValue=a}catch(x){Ze(e,e.return,x)}}break;case 3:if(Tc=null,l=Gn,Gn=du(t.containerInfo),on(t,e),Gn=l,cn(e),a&4&&n!==null&&n.memoizedState.isDehydrated)try{Fi(t.containerInfo)}catch(x){Ze(e,e.return,x)}df&&(df=!1,Nj(e));break;case 4:a=Gn,Gn=du(e.stateNode.containerInfo),on(t,e),cn(e),Gn=a;break;case 12:on(t,e),cn(e);break;case 13:on(t,e),cn(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(rp=xs()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ff(e,a)));break;case 22:l=e.memoizedState!==null;var c=n!==null&&n.memoizedState!==null,d=$s,f=pt;if($s=d||l,pt=f||c,on(t,e),pt=f,$s=d,cn(e),a&8192)e:for(t=e.stateNode,t._visibility=l?t._visibility&-2:t._visibility|1,l&&(n===null||c||$s||pt||Xa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){c=n=t;try{if(r=c.stateNode,l)i=r.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none";else{o=c.stateNode;var h=c.memoizedProps.style,m=h!=null&&h.hasOwnProperty("display")?h.display:null;o.style.display=m==null||typeof m=="boolean"?"":(""+m).trim()}}catch(x){Ze(c,c.return,x)}}}else if(t.tag===6){if(n===null){c=t;try{c.stateNode.nodeValue=l?"":c.memoizedProps}catch(x){Ze(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,ff(e,n))));break;case 19:on(t,e),cn(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,ff(e,a)));break;case 30:break;case 21:break;default:on(t,e),cn(e)}}function cn(e){var t=e.flags;if(t&2){try{for(var n,a=e.return;a!==null;){if(gj(a)){n=a;break}a=a.return}if(n==null)throw Error(Q(160));switch(n.tag){case 27:var l=n.stateNode,r=uf(e);au(e,r,l);break;case 5:var i=n.stateNode;n.flags&32&&(dr(i,""),n.flags&=-33);var o=uf(e);au(e,o,i);break;case 3:case 4:var c=n.stateNode.containerInfo,d=uf(e);Sh(e,d,c);break;default:throw Error(Q(161))}}catch(f){Ze(e,e.return,f)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Nj(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Nj(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function sa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)yj(e,t.alternate,t),t=t.sibling}function Xa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Aa(4,t,t.return),Xa(t);break;case 1:fs(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&pj(t,t.return,n),Xa(t);break;case 27:Ei(t.stateNode);case 26:case 5:fs(t,t.return),Xa(t);break;case 22:t.memoizedState===null&&Xa(t);break;case 30:Xa(t);break;default:Xa(t)}e=e.sibling}}function ia(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,l=e,r=t,i=r.flags;switch(r.tag){case 0:case 11:case 15:ia(l,r,n),yo(4,r);break;case 1:if(ia(l,r,n),a=r,l=a.stateNode,typeof l.componentDidMount=="function")try{l.componentDidMount()}catch(d){Ze(a,a.return,d)}if(a=r,l=a.updateQueue,l!==null){var o=a.stateNode;try{var c=l.shared.hiddenCallbacks;if(c!==null)for(l.shared.hiddenCallbacks=null,l=0;l<c.length;l++)yb(c[l],o)}catch(d){Ze(a,a.return,d)}}n&&i&64&&mj(r),Si(r,r.return);break;case 27:vj(r);case 26:case 5:ia(l,r,n),n&&a===null&&i&4&&xj(r),Si(r,r.return);break;case 12:ia(l,r,n);break;case 13:ia(l,r,n),n&&i&4&&wj(l,r);break;case 22:r.memoizedState===null&&ia(l,r,n),Si(r,r.return);break;case 30:break;default:ia(l,r,n)}t=t.sibling}}function np(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&&po(n))}function sp(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&po(e))}function os(e,t,n,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kj(e,t,n,a),t=t.sibling}function kj(e,t,n,a){var l=t.flags;switch(t.tag){case 0:case 11:case 15:os(e,t,n,a),l&2048&&yo(9,t);break;case 1:os(e,t,n,a);break;case 3:os(e,t,n,a),l&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&po(e)));break;case 12:if(l&2048){os(e,t,n,a),e=t.stateNode;try{var r=t.memoizedProps,i=r.id,o=r.onPostCommit;typeof o=="function"&&o(i,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(c){Ze(t,t.return,c)}}else os(e,t,n,a);break;case 13:os(e,t,n,a);break;case 23:break;case 22:r=t.stateNode,i=t.alternate,t.memoizedState!==null?r._visibility&2?os(e,t,n,a):Ci(e,t):r._visibility&2?os(e,t,n,a):(r._visibility|=2,Dl(e,t,n,a,(t.subtreeFlags&10256)!==0)),l&2048&&np(i,t);break;case 24:os(e,t,n,a),l&2048&&sp(t.alternate,t);break;default:os(e,t,n,a)}}function Dl(e,t,n,a,l){for(l=l&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var r=e,i=t,o=n,c=a,d=i.flags;switch(i.tag){case 0:case 11:case 15:Dl(r,i,o,c,l),yo(8,i);break;case 23:break;case 22:var f=i.stateNode;i.memoizedState!==null?f._visibility&2?Dl(r,i,o,c,l):Ci(r,i):(f._visibility|=2,Dl(r,i,o,c,l)),l&&d&2048&&np(i.alternate,i);break;case 24:Dl(r,i,o,c,l),l&&d&2048&&sp(i.alternate,i);break;default:Dl(r,i,o,c,l)}t=t.sibling}}function Ci(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,a=t,l=a.flags;switch(a.tag){case 22:Ci(n,a),l&2048&&np(a.alternate,a);break;case 24:Ci(n,a),l&2048&&sp(a.alternate,a);break;default:Ci(n,a)}t=t.sibling}}var oi=8192;function _l(e){if(e.subtreeFlags&oi)for(e=e.child;e!==null;)Sj(e),e=e.sibling}function Sj(e){switch(e.tag){case 26:_l(e),e.flags&oi&&e.memoizedState!==null&&_C(Gn,e.memoizedState,e.memoizedProps);break;case 5:_l(e);break;case 3:case 4:var t=Gn;Gn=du(e.stateNode.containerInfo),_l(e),Gn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=oi,oi=16777216,_l(e),oi=t):_l(e));break;default:_l(e)}}function Cj(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 Jr(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];At=a,Tj(a,e)}Cj(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rj(e),e=e.sibling}function Rj(e){switch(e.tag){case 0:case 11:case 15:Jr(e),e.flags&2048&&Aa(9,e,e.return);break;case 3:Jr(e);break;case 12:Jr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Cc(e)):Jr(e);break;default:Jr(e)}}function Cc(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var a=t[n];At=a,Tj(a,e)}Cj(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Aa(8,t,t.return),Cc(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Cc(t));break;default:Cc(t)}e=e.sibling}}function Tj(e,t){for(;At!==null;){var n=At;switch(n.tag){case 0:case 11:case 15:Aa(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:po(n.memoizedState.cache)}if(a=n.child,a!==null)a.return=n,At=a;else e:for(n=e;At!==null;){a=At;var l=a.sibling,r=a.return;if(bj(a),a===n){At=null;break e}if(l!==null){l.return=r,At=l;break e}At=r}}}var B2={getCacheForType:function(e){var t=Bt(Ct),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n}},H2=typeof WeakMap=="function"?WeakMap:Map,Ve=0,We=null,Ae=null,$e=0,Ge=0,dn=null,ga=!1,Tr=!1,ap=!1,Vs=0,ut=0,Ma=0,nl=0,lp=0,Tn=0,xr=0,Ri=null,en=null,Ch=!1,rp=0,lu=1/0,ru=null,Na=null,zt=0,ka=null,gr=null,sr=0,Rh=0,Th=null,Ej=null,Ti=0,Eh=null;function xn(){if(Ve&2&&$e!==0)return $e&-$e;if(_e.T!==null){var e=fr;return e!==0?e:op()}return Iy()}function Aj(){Tn===0&&(Tn=!($e&536870912)||Le?Ly():536870912);var e=$n.current;return e!==null&&(e.flags|=32),Tn}function gn(e,t,n){(e===We&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)&&(vr(e,0),va(e,$e,Tn,!1)),co(e,n),(!(Ve&2)||e!==We)&&(e===We&&(!(Ve&2)&&(nl|=n),ut===4&&va(e,$e,Tn,!1)),_s(e))}function Mj(e,t,n){if(Ve&6)throw Error(Q(327));var a=!n&&(t&124)===0&&(t&e.expiredLanes)===0||oo(e,t),l=a?q2(e,t):hf(e,t,!0),r=a;do{if(l===0){Tr&&!a&&va(e,t,0,!1);break}else{if(n=e.current.alternate,r&&!I2(n)){l=hf(e,t,!1),r=!1;continue}if(l===2){if(r=t,e.errorRecoveryDisabledLanes&r)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;l=Ri;var c=o.current.memoizedState.isDehydrated;if(c&&(vr(o,i).flags|=256),i=hf(o,i,!1),i!==2){if(ap&&!c){o.errorRecoveryDisabledLanes|=r,nl|=r,l=4;break e}r=en,en=l,r!==null&&(en===null?en=r:en.push.apply(en,r))}l=i}if(r=!1,l!==2)continue}}if(l===1){vr(e,0),va(e,t,0,!0);break}e:{switch(a=e,r=l,r){case 0:case 1:throw Error(Q(345));case 4:if((t&4194048)!==t)break;case 6:va(a,t,Tn,!ga);break e;case 2:en=null;break;case 3:case 5:break;default:throw Error(Q(329))}if((t&62914560)===t&&(l=rp+300-xs(),10<l)){if(va(a,t,Tn,!ga),Uu(a,0,!0)!==0)break e;a.timeoutHandle=Zj(Ag.bind(null,a,n,en,ru,Ch,t,Tn,nl,xr,ga,r,2,-0,0),l);break e}Ag(a,n,en,ru,Ch,t,Tn,nl,xr,ga,r,0,-0,0)}}break}while(!0);_s(e)}function Ag(e,t,n,a,l,r,i,o,c,d,f,h,m,x){if(e.timeoutHandle=-1,h=t.subtreeFlags,(h&8192||(h&16785408)===16785408)&&(qi={stylesheets:null,count:0,unsuspend:wC},Sj(t),h=NC(),h!==null)){e.cancelPendingCommit=h(Og.bind(null,e,t,r,n,a,l,i,o,c,f,1,m,x)),va(e,r,i,!d);return}Og(e,t,r,n,a,l,i,o,c)}function I2(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 l=n[a],r=l.getSnapshot;l=l.value;try{if(!yn(r(),l))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 va(e,t,n,a){t&=~lp,t&=~nl,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var l=t;0<l;){var r=31-pn(l),i=1<<r;a[r]=-1,l&=~i}n!==0&&By(e,n,t)}function Ku(){return Ve&6?!0:(bo(0),!1)}function ip(){if(Ae!==null){if(Ge===0)var e=Ae.return;else e=Ae,Us=vl=null,Fm(e),nr=null,Hi=0,e=Ae;for(;e!==null;)hj(e.alternate,e),e=e.return;Ae=null}}function vr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,lC(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),ip(),We=e,Ae=n=Hs(e.current,null),$e=t,Ge=0,dn=null,ga=!1,Tr=oo(e,t),ap=!1,xr=Tn=lp=nl=Ma=ut=0,en=Ri=null,Ch=!1,t&8&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var l=31-pn(a),r=1<<l;t|=e[l],a&=~r}return Vs=t,Pu(),n}function Oj(e,t){Te=null,_e.H=Jc,t===xo||t===Gu?(t=cg(),Ge=3):t===gb?(t=cg(),Ge=4):Ge=t===ij?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,dn=t,Ae===null&&(ut=1,nu(e,Rn(t,e.current)))}function $j(){var e=_e.H;return _e.H=Jc,e===null?Jc:e}function Dj(){var e=_e.A;return _e.A=B2,e}function Ah(){ut=4,ga||($e&4194048)!==$e&&$n.current!==null||(Tr=!0),!(Ma&134217727)&&!(nl&134217727)||We===null||va(We,$e,Tn,!1)}function hf(e,t,n){var a=Ve;Ve|=2;var l=$j(),r=Dj();(We!==e||$e!==t)&&(ru=null,vr(e,t)),t=!1;var i=ut;e:do try{if(Ge!==0&&Ae!==null){var o=Ae,c=dn;switch(Ge){case 8:ip(),i=6;break e;case 3:case 2:case 9:case 6:$n.current===null&&(t=!0);var d=Ge;if(Ge=0,dn=null,Kl(e,o,c,d),n&&Tr){i=0;break e}break;default:d=Ge,Ge=0,dn=null,Kl(e,o,c,d)}}P2(),i=ut;break}catch(f){Oj(e,f)}while(!0);return t&&e.shellSuspendCounter++,Us=vl=null,Ve=a,_e.H=l,_e.A=r,Ae===null&&(We=null,$e=0,Pu()),i}function P2(){for(;Ae!==null;)zj(Ae)}function q2(e,t){var n=Ve;Ve|=2;var a=$j(),l=Dj();We!==e||$e!==t?(ru=null,lu=xs()+500,vr(e,t)):Tr=oo(e,t);e:do try{if(Ge!==0&&Ae!==null){t=Ae;var r=dn;t:switch(Ge){case 1:Ge=0,dn=null,Kl(e,t,r,1);break;case 2:case 9:if(og(r)){Ge=0,dn=null,Mg(t);break}t=function(){Ge!==2&&Ge!==9||We!==e||(Ge=7),_s(e)},r.then(t,t);break e;case 3:Ge=7;break e;case 4:Ge=5;break e;case 7:og(r)?(Ge=0,dn=null,Mg(t)):(Ge=0,dn=null,Kl(e,t,r,7));break;case 5:var i=null;switch(Ae.tag){case 26:i=Ae.memoizedState;case 5:case 27:var o=Ae;if(!i||t0(i)){Ge=0,dn=null;var c=o.sibling;if(c!==null)Ae=c;else{var d=o.return;d!==null?(Ae=d,Xu(d)):Ae=null}break t}}Ge=0,dn=null,Kl(e,t,r,5);break;case 6:Ge=0,dn=null,Kl(e,t,r,6);break;case 8:ip(),ut=6;break e;default:throw Error(Q(462))}}G2();break}catch(f){Oj(e,f)}while(!0);return Us=vl=null,_e.H=a,_e.A=l,Ve=n,Ae!==null?0:(We=null,$e=0,Pu(),ut)}function G2(){for(;Ae!==null&&!fS();)zj(Ae)}function zj(e){var t=fj(e.alternate,e,Vs);e.memoizedProps=e.pendingProps,t===null?Xu(e):Ae=t}function Mg(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=kg(n,t,t.pendingProps,t.type,void 0,$e);break;case 11:t=kg(n,t,t.pendingProps,t.type.render,t.ref,$e);break;case 5:Fm(t);default:hj(n,t),t=Ae=hb(t,Vs),t=fj(n,t,Vs)}e.memoizedProps=e.pendingProps,t===null?Xu(e):Ae=t}function Kl(e,t,n,a){Us=vl=null,Fm(t),nr=null,Hi=0;var l=t.return;try{if(O2(e,l,t,n,$e)){ut=1,nu(e,Rn(n,e.current)),Ae=null;return}}catch(r){if(l!==null)throw Ae=l,r;ut=1,nu(e,Rn(n,e.current)),Ae=null;return}t.flags&32768?(Le||a===1?e=!0:Tr||$e&536870912?e=!1:(ga=e=!0,(a===2||a===9||a===3||a===6)&&(a=$n.current,a!==null&&a.tag===13&&(a.flags|=16384))),Lj(t,e)):Xu(t)}function Xu(e){var t=e;do{if(t.flags&32768){Lj(t,ga);return}e=t.return;var n=D2(t.alternate,t,Vs);if(n!==null){Ae=n;return}if(t=t.sibling,t!==null){Ae=t;return}Ae=t=e}while(t!==null);ut===0&&(ut=5)}function Lj(e,t){do{var n=z2(e.alternate,e);if(n!==null){n.flags&=32767,Ae=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ae=e;return}Ae=e=n}while(e!==null);ut=6,Ae=null}function Og(e,t,n,a,l,r,i,o,c){e.cancelPendingCommit=null;do Qu();while(zt!==0);if(Ve&6)throw Error(Q(327));if(t!==null){if(t===e.current)throw Error(Q(177));if(r=t.lanes|t.childLanes,r|=$m,wS(e,n,r,i,o,c),e===We&&(Ae=We=null,$e=0),gr=t,ka=e,sr=n,Rh=r,Th=l,Ej=a,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,K2(qc,function(){return Pj(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,t.subtreeFlags&13878||a){a=_e.T,_e.T=null,l=Ue.p,Ue.p=2,i=Ve,Ve|=4;try{L2(e,t,n)}finally{Ve=i,Ue.p=l,_e.T=a}}zt=1,Uj(),Bj(),Hj()}}function Uj(){if(zt===1){zt=0;var e=ka,t=gr,n=(t.flags&13878)!==0;if(t.subtreeFlags&13878||n){n=_e.T,_e.T=null;var a=Ue.p;Ue.p=2;var l=Ve;Ve|=4;try{_j(t,e);var r=Dh,i=lb(e.containerInfo),o=r.focusedElem,c=r.selectionRange;if(i!==o&&o&&o.ownerDocument&&ab(o.ownerDocument.documentElement,o)){if(c!==null&&Om(o)){var d=c.start,f=c.end;if(f===void 0&&(f=d),"selectionStart"in o)o.selectionStart=d,o.selectionEnd=Math.min(f,o.value.length);else{var h=o.ownerDocument||document,m=h&&h.defaultView||window;if(m.getSelection){var x=m.getSelection(),j=o.textContent.length,v=Math.min(c.start,j),y=c.end===void 0?v:Math.min(c.end,j);!x.extend&&v>y&&(i=y,y=v,v=i);var g=eg(o,v),p=eg(o,y);if(g&&p&&(x.rangeCount!==1||x.anchorNode!==g.node||x.anchorOffset!==g.offset||x.focusNode!==p.node||x.focusOffset!==p.offset)){var b=h.createRange();b.setStart(g.node,g.offset),x.removeAllRanges(),v>y?(x.addRange(b),x.extend(p.node,p.offset)):(b.setEnd(p.node,p.offset),x.addRange(b))}}}}for(h=[],x=o;x=x.parentNode;)x.nodeType===1&&h.push({element:x,left:x.scrollLeft,top:x.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o<h.length;o++){var w=h[o];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}mu=!!$h,Dh=$h=null}finally{Ve=l,Ue.p=a,_e.T=n}}e.current=t,zt=2}}function Bj(){if(zt===2){zt=0;var e=ka,t=gr,n=(t.flags&8772)!==0;if(t.subtreeFlags&8772||n){n=_e.T,_e.T=null;var a=Ue.p;Ue.p=2;var l=Ve;Ve|=4;try{yj(e,t.alternate,t)}finally{Ve=l,Ue.p=a,_e.T=n}}zt=3}}function Hj(){if(zt===4||zt===3){zt=0,hS();var e=ka,t=gr,n=sr,a=Ej;t.subtreeFlags&10256||t.flags&10256?zt=5:(zt=0,gr=ka=null,Ij(e,e.pendingLanes));var l=e.pendingLanes;if(l===0&&(Na=null),Sm(n),t=t.stateNode,mn&&typeof mn.onCommitFiberRoot=="function")try{mn.onCommitFiberRoot(io,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=_e.T,l=Ue.p,Ue.p=2,_e.T=null;try{for(var r=e.onRecoverableError,i=0;i<a.length;i++){var o=a[i];r(o.value,{componentStack:o.stack})}}finally{_e.T=t,Ue.p=l}}sr&3&&Qu(),_s(e),l=e.pendingLanes,n&4194090&&l&42?e===Eh?Ti++:(Ti=0,Eh=e):Ti=0,bo(0)}}function Ij(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,po(t)))}function Qu(e){return Uj(),Bj(),Hj(),Pj()}function Pj(){if(zt!==5)return!1;var e=ka,t=Rh;Rh=0;var n=Sm(sr),a=_e.T,l=Ue.p;try{Ue.p=32>n?32:n,_e.T=null,n=Th,Th=null;var r=ka,i=sr;if(zt=0,gr=ka=null,sr=0,Ve&6)throw Error(Q(331));var o=Ve;if(Ve|=4,Rj(r.current),kj(r,r.current,i,n),Ve=o,bo(0,!1),mn&&typeof mn.onPostCommitFiberRoot=="function")try{mn.onPostCommitFiberRoot(io,r)}catch{}return!0}finally{Ue.p=l,_e.T=a,Ij(e,t)}}function $g(e,t,n){t=Rn(n,t),t=_h(e.stateNode,t,2),e=_a(e,t,2),e!==null&&(co(e,2),_s(e))}function Ze(e,t,n){if(e.tag===3)$g(e,e,n);else for(;t!==null;){if(t.tag===3){$g(t,e,n);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(Na===null||!Na.has(a))){e=Rn(n,e),n=lj(2),a=_a(t,n,2),a!==null&&(rj(n,a,t,e),co(a,2),_s(a));break}}t=t.return}}function mf(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new H2;var l=new Set;a.set(t,l)}else l=a.get(t),l===void 0&&(l=new Set,a.set(t,l));l.has(n)||(ap=!0,l.add(n),e=V2.bind(null,e,t,n),t.then(e,e))}function V2(e,t,n){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,We===e&&($e&n)===n&&(ut===4||ut===3&&($e&62914560)===$e&&300>xs()-rp?!(Ve&2)&&vr(e,0):lp|=n,xr===$e&&(xr=0)),_s(e)}function qj(e,t){t===0&&(t=Uy()),e=Rr(e,t),e!==null&&(co(e,t),_s(e))}function Y2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qj(e,n)}function F2(e,t){var n=0;switch(e.tag){case 13:var a=e.stateNode,l=e.memoizedState;l!==null&&(n=l.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),qj(e,n)}function K2(e,t){return Nm(e,t)}var iu=null,zl=null,Mh=!1,ou=!1,pf=!1,sl=0;function _s(e){e!==zl&&e.next===null&&(zl===null?iu=zl=e:zl=zl.next=e),ou=!0,Mh||(Mh=!0,Q2())}function bo(e,t){if(!pf&&ou){pf=!0;do for(var n=!1,a=iu;a!==null;){if(e!==0){var l=a.pendingLanes;if(l===0)var r=0;else{var i=a.suspendedLanes,o=a.pingedLanes;r=(1<<31-pn(42|e)+1)-1,r&=l&~(i&~o),r=r&201326741?r&201326741|1:r?r|2:0}r!==0&&(n=!0,Dg(a,r))}else r=$e,r=Uu(a,a===We?r:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),!(r&3)||oo(a,r)||(n=!0,Dg(a,r));a=a.next}while(n);pf=!1}}function X2(){Gj()}function Gj(){ou=Mh=!1;var e=0;sl!==0&&(aC()&&(e=sl),sl=0);for(var t=xs(),n=null,a=iu;a!==null;){var l=a.next,r=Vj(a,t);r===0?(a.next=null,n===null?iu=l:n.next=l,l===null&&(zl=n)):(n=a,(e!==0||r&3)&&(ou=!0)),a=l}bo(e)}function Vj(e,t){for(var n=e.suspendedLanes,a=e.pingedLanes,l=e.expirationTimes,r=e.pendingLanes&-62914561;0<r;){var i=31-pn(r),o=1<<i,c=l[i];c===-1?(!(o&n)||o&a)&&(l[i]=jS(o,t)):c<=t&&(e.expiredLanes|=o),r&=~o}if(t=We,n=$e,n=Uu(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,n===0||e===t&&(Ge===2||Ge===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Hd(a),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||oo(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(a!==null&&Hd(a),Sm(n)){case 2:case 8:n=Dy;break;case 32:n=qc;break;case 268435456:n=zy;break;default:n=qc}return a=Yj.bind(null,e),n=Nm(n,a),e.callbackPriority=t,e.callbackNode=n,t}return a!==null&&a!==null&&Hd(a),e.callbackPriority=2,e.callbackNode=null,2}function Yj(e,t){if(zt!==0&&zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Qu()&&e.callbackNode!==n)return null;var a=$e;return a=Uu(e,e===We?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(Mj(e,a,t),Vj(e,xs()),e.callbackNode!=null&&e.callbackNode===n?Yj.bind(null,e):null)}function Dg(e,t){if(Qu())return null;Mj(e,t,!0)}function Q2(){rC(function(){Ve&6?Nm($y,X2):Gj()})}function op(){return sl===0&&(sl=Ly()),sl}function zg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:yc(""+e)}function Lg(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 Z2(e,t,n,a,l){if(t==="submit"&&n&&n.stateNode===l){var r=zg((l[nn]||null).action),i=a.submitter;i&&(t=(t=i[nn]||null)?zg(t.formAction):i.getAttribute("formAction"),t!==null&&(r=t,i=null));var o=new Bu("action","action",null,a,l);e.push({event:o,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(sl!==0){var c=i?Lg(l,i):new FormData(l);jh(n,{pending:!0,data:c,method:l.method,action:r},null,c)}}else typeof r=="function"&&(o.preventDefault(),c=i?Lg(l,i):new FormData(l),jh(n,{pending:!0,data:c,method:l.method,action:r},r,c))},currentTarget:l}]})}}for(var xf=0;xf<ch.length;xf++){var gf=ch[xf],W2=gf.toLowerCase(),J2=gf[0].toUpperCase()+gf.slice(1);ts(W2,"on"+J2)}ts(ib,"onAnimationEnd");ts(ob,"onAnimationIteration");ts(cb,"onAnimationStart");ts("dblclick","onDoubleClick");ts("focusin","onFocus");ts("focusout","onBlur");ts(x2,"onTransitionRun");ts(g2,"onTransitionStart");ts(v2,"onTransitionCancel");ts(ub,"onTransitionEnd");ur("onMouseEnter",["mouseout","mouseover"]);ur("onMouseLeave",["mouseout","mouseover"]);ur("onPointerEnter",["pointerout","pointerover"]);ur("onPointerLeave",["pointerout","pointerover"]);pl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));pl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));pl("onBeforeInput",["compositionend","keypress","textInput","paste"]);pl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));pl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));pl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ii="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(" "),eC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ii));function Fj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var a=e[n],l=a.event;a=a.listeners;e:{var r=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!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){tu(f)}l.currentTarget=null,r=c}else for(i=0;i<a.length;i++){if(o=a[i],c=o.instance,d=o.currentTarget,o=o.listener,c!==r&&l.isPropagationStopped())break e;r=o,l.currentTarget=d;try{r(l)}catch(f){tu(f)}l.currentTarget=null,r=c}}}}function Ee(e,t){var n=t[nh];n===void 0&&(n=t[nh]=new Set);var a=e+"__bubble";n.has(a)||(Kj(t,e,2,!1),n.add(a))}function vf(e,t,n){var a=0;t&&(a|=4),Kj(n,e,a,t)}var Wo="_reactListening"+Math.random().toString(36).slice(2);function cp(e){if(!e[Wo]){e[Wo]=!0,Py.forEach(function(n){n!=="selectionchange"&&(eC.has(n)||vf(n,!1,e),vf(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wo]||(t[Wo]=!0,vf("selectionchange",!1,t))}}function Kj(e,t,n,a){switch(r0(t)){case 2:var l=CC;break;case 8:l=RC;break;default:l=hp}n=l.bind(null,t,n,e),l=void 0,!rh||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(l=!0),a?l!==void 0?e.addEventListener(t,n,{capture:!0,passive:l}):e.addEventListener(t,n,!0):l!==void 0?e.addEventListener(t,n,{passive:l}):e.addEventListener(t,n,!1)}function yf(e,t,n,a,l){var r=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===l)break;if(i===4)for(i=a.return;i!==null;){var c=i.tag;if((c===3||c===4)&&i.stateNode.containerInfo===l)return;i=i.return}for(;o!==null;){if(i=Bl(o),i===null)return;if(c=i.tag,c===5||c===6||c===26||c===27){a=r=i;continue e}o=o.parentNode}}a=a.return}Qy(function(){var d=r,f=Tm(n),h=[];e:{var m=db.get(e);if(m!==void 0){var x=Bu,j=e;switch(e){case"keypress":if(jc(n)===0)break e;case"keydown":case"keyup":x=KS;break;case"focusin":j="focus",x=Kd;break;case"focusout":j="blur",x=Kd;break;case"beforeblur":case"afterblur":x=Kd;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=Gx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=zS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=ZS;break;case ib:case ob:case cb:x=BS;break;case ub:x=JS;break;case"scroll":case"scrollend":x=$S;break;case"wheel":x=t2;break;case"copy":case"cut":case"paste":x=IS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=Yx;break;case"toggle":case"beforetoggle":x=s2}var v=(t&4)!==0,y=!v&&(e==="scroll"||e==="scrollend"),g=v?m!==null?m+"Capture":null:m;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=Di(p,g),w!=null&&v.push(Pi(p,w,b))),y)break;p=p.return}0<v.length&&(m=new x(m,j,null,n,f),h.push({event:m,listeners:v}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",m&&n!==lh&&(j=n.relatedTarget||n.fromElement)&&(Bl(j)||j[Sr]))break e;if((x||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,x?(j=n.relatedTarget||n.toElement,x=d,j=j?Bl(j):null,j!==null&&(y=ro(j),v=j.tag,j!==y||v!==5&&v!==27&&v!==6)&&(j=null)):(x=null,j=d),x!==j)){if(v=Gx,w="onMouseLeave",g="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(v=Yx,w="onPointerLeave",g="onPointerEnter",p="pointer"),y=x==null?m:ii(x),b=j==null?m:ii(j),m=new v(w,p+"leave",x,n,f),m.target=y,m.relatedTarget=b,w=null,Bl(f)===d&&(v=new v(g,p+"enter",j,n,f),v.target=b,v.relatedTarget=y,w=v),y=w,x&&j)t:{for(v=x,g=j,p=0,b=v;b;b=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&&Ug(h,m,x,v,!1),j!==null&&y!==null&&Ug(h,y,j,v,!0)}}e:{if(m=d?ii(d):window,x=m.nodeName&&m.nodeName.toLowerCase(),x==="select"||x==="input"&&m.type==="file")var N=Qx;else if(Xx(m))if(nb)N=h2;else{N=d2;var R=u2}else x=m.nodeName,!x||x.toLowerCase()!=="input"||m.type!=="checkbox"&&m.type!=="radio"?d&&Rm(d.elementType)&&(N=Qx):N=f2;if(N&&(N=N(e,d))){tb(h,N,n,f);break e}R&&R(e,m,d),e==="focusout"&&d&&m.type==="number"&&d.memoizedProps.value!=null&&ah(m,"number",m.value)}switch(R=d?ii(d):window,e){case"focusin":(Xx(R)||R.contentEditable==="true")&&(Pl=R,ih=d,yi=null);break;case"focusout":yi=ih=Pl=null;break;case"mousedown":oh=!0;break;case"contextmenu":case"mouseup":case"dragend":oh=!1,tg(h,n,f);break;case"selectionchange":if(p2)break;case"keydown":case"keyup":tg(h,n,f)}var _;if(Mm)e:{switch(e){case"compositionstart":var k="onCompositionStart";break e;case"compositionend":k="onCompositionEnd";break e;case"compositionupdate":k="onCompositionUpdate";break e}k=void 0}else Il?Jy(e,n)&&(k="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(k="onCompositionStart");k&&(Wy&&n.locale!=="ko"&&(Il||k!=="onCompositionStart"?k==="onCompositionEnd"&&Il&&(_=Zy()):(xa=f,Em="value"in xa?xa.value:xa.textContent,Il=!0)),R=cu(d,k),0<R.length&&(k=new Vx(k,e,null,n,f),h.push({event:k,listeners:R}),_?k.data=_:(_=eb(n),_!==null&&(k.data=_)))),(_=l2?r2(e,n):i2(e,n))&&(k=cu(d,"onBeforeInput"),0<k.length&&(R=new Vx("onBeforeInput","beforeinput",null,n,f),h.push({event:R,listeners:k}),R.data=_)),Z2(h,e,d,n,f)}Fj(h,t)})}function Pi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function cu(e,t){for(var n=t+"Capture",a=[];e!==null;){var l=e,r=l.stateNode;if(l=l.tag,l!==5&&l!==26&&l!==27||r===null||(l=Di(e,n),l!=null&&a.unshift(Pi(e,l,r)),l=Di(e,t),l!=null&&a.push(Pi(e,l,r))),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 Ug(e,t,n,a,l){for(var r=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,l?(d=Di(n,r),d!=null&&i.unshift(Pi(n,d,c))):l||(d=Di(n,r),d!=null&&i.push(Pi(n,d,c)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var tC=/\r\n?/g,nC=/\u0000|\uFFFD/g;function Bg(e){return(typeof e=="string"?e:""+e).replace(tC,`
49
+ `).replace(nC,"")}function Xj(e,t){return t=Bg(t),Bg(e)===t}function Zu(){}function Ke(e,t,n,a,l,r){switch(n){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||dr(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&dr(e,""+a);break;case"className":Vo(e,"class",a);break;case"tabIndex":Vo(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Vo(e,n,a);break;case"style":Xy(e,a,r);break;case"data":if(t!=="object"){Vo(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=yc(""+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 r=="function"&&(n==="formAction"?(t!=="input"&&Ke(e,t,"name",l.name,l,null),Ke(e,t,"formEncType",l.formEncType,l,null),Ke(e,t,"formMethod",l.formMethod,l,null),Ke(e,t,"formTarget",l.formTarget,l,null)):(Ke(e,t,"encType",l.encType,l,null),Ke(e,t,"method",l.method,l,null),Ke(e,t,"target",l.target,l,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(n);break}a=yc(""+a),e.setAttribute(n,a);break;case"onClick":a!=null&&(e.onclick=Zu);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("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(l.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=yc(""+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":Ee("beforetoggle",e),Ee("toggle",e),vc(e,"popover",a);break;case"xlinkActuate":Cs(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Cs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Cs(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Cs(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Cs(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Cs(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Cs(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":vc(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=MS.get(n)||n,vc(e,n,a))}}function Oh(e,t,n,a,l,r){switch(n){case"style":Xy(e,a,r);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(Q(61));if(n=a.__html,n!=null){if(l.children!=null)throw Error(Q(60));e.innerHTML=n}}break;case"children":typeof a=="string"?dr(e,a):(typeof a=="number"||typeof a=="bigint")&&dr(e,""+a);break;case"onScroll":a!=null&&Ee("scroll",e);break;case"onScrollEnd":a!=null&&Ee("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Zu);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qy.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(l=n.endsWith("Capture"),t=n.slice(2,l?n.length-7:void 0),r=e[nn]||null,r=r!=null?r[n]:null,typeof r=="function"&&e.removeEventListener(t,r,l),typeof a=="function")){typeof r!="function"&&r!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,a,l);break e}n in e?e[n]=a:a===!0?e.setAttribute(n,""):vc(e,n,a)}}}function Lt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var a=!1,l=!1,r;for(r in n)if(n.hasOwnProperty(r)){var i=n[r];if(i!=null)switch(r){case"src":a=!0;break;case"srcSet":l=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(Q(137,t));default:Ke(e,t,r,i,n,null)}}l&&Ke(e,t,"srcSet",n.srcSet,n,null),a&&Ke(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var o=r=i=l=null,c=null,d=null;for(a in n)if(n.hasOwnProperty(a)){var f=n[a];if(f!=null)switch(a){case"name":l=f;break;case"type":i=f;break;case"checked":c=f;break;case"defaultChecked":d=f;break;case"value":r=f;break;case"defaultValue":o=f;break;case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(Q(137,t));break;default:Ke(e,t,a,f,n,null)}}Yy(e,r,o,c,d,i,l,!1),Gc(e);return;case"select":Ee("invalid",e),a=i=r=null;for(l in n)if(n.hasOwnProperty(l)&&(o=n[l],o!=null))switch(l){case"value":r=o;break;case"defaultValue":i=o;break;case"multiple":a=o;default:Ke(e,t,l,o,n,null)}t=r,n=i,e.multiple=!!a,t!=null?Zl(e,!!a,t,!1):n!=null&&Zl(e,!!a,n,!0);return;case"textarea":Ee("invalid",e),r=l=a=null;for(i in n)if(n.hasOwnProperty(i)&&(o=n[i],o!=null))switch(i){case"value":a=o;break;case"defaultValue":l=o;break;case"children":r=o;break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(Q(91));break;default:Ke(e,t,i,o,n,null)}Ky(e,a,l,r),Gc(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:Ke(e,t,c,a,n,null)}return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(a=0;a<Ii.length;a++)Ee(Ii[a],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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:Ke(e,t,d,a,n,null)}return;default:if(Rm(t)){for(f in n)n.hasOwnProperty(f)&&(a=n[f],a!==void 0&&Oh(e,t,f,a,n,void 0));return}}for(o in n)n.hasOwnProperty(o)&&(a=n[o],a!=null&&Ke(e,t,o,a,n,null))}function sC(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 l=null,r=null,i=null,o=null,c=null,d=null,f=null;for(x in n){var h=n[x];if(n.hasOwnProperty(x)&&h!=null)switch(x){case"checked":break;case"value":break;case"defaultValue":c=h;default:a.hasOwnProperty(x)||Ke(e,t,x,null,a,h)}}for(var m in a){var x=a[m];if(h=n[m],a.hasOwnProperty(m)&&(x!=null||h!=null))switch(m){case"type":r=x;break;case"name":l=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!==h&&Ke(e,t,m,x,a,h)}}sh(e,i,o,c,d,f,r,l);return;case"select":x=i=o=m=null;for(r in n)if(c=n[r],n.hasOwnProperty(r)&&c!=null)switch(r){case"value":break;case"multiple":x=c;default:a.hasOwnProperty(r)||Ke(e,t,r,null,a,c)}for(l in a)if(r=a[l],c=n[l],a.hasOwnProperty(l)&&(r!=null||c!=null))switch(l){case"value":m=r;break;case"defaultValue":o=r;break;case"multiple":i=r;default:r!==c&&Ke(e,t,l,r,a,c)}t=o,n=i,a=x,m!=null?Zl(e,!!n,m,!1):!!a!=!!n&&(t!=null?Zl(e,!!n,t,!0):Zl(e,!!n,n?[]:"",!1));return;case"textarea":x=m=null;for(o in n)if(l=n[o],n.hasOwnProperty(o)&&l!=null&&!a.hasOwnProperty(o))switch(o){case"value":break;case"children":break;default:Ke(e,t,o,null,a,l)}for(i in a)if(l=a[i],r=n[i],a.hasOwnProperty(i)&&(l!=null||r!=null))switch(i){case"value":m=l;break;case"defaultValue":x=l;break;case"children":break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(Q(91));break;default:l!==r&&Ke(e,t,i,l,a,r)}Fy(e,m,x);return;case"option":for(var j in n)if(m=n[j],n.hasOwnProperty(j)&&m!=null&&!a.hasOwnProperty(j))switch(j){case"selected":e.selected=!1;break;default:Ke(e,t,j,null,a,m)}for(c in a)if(m=a[c],x=n[c],a.hasOwnProperty(c)&&m!==x&&(m!=null||x!=null))switch(c){case"selected":e.selected=m&&typeof m!="function"&&typeof m!="symbol";break;default:Ke(e,t,c,m,a,x)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var v in n)m=n[v],n.hasOwnProperty(v)&&m!=null&&!a.hasOwnProperty(v)&&Ke(e,t,v,null,a,m);for(d in a)if(m=a[d],x=n[d],a.hasOwnProperty(d)&&m!==x&&(m!=null||x!=null))switch(d){case"children":case"dangerouslySetInnerHTML":if(m!=null)throw Error(Q(137,t));break;default:Ke(e,t,d,m,a,x)}return;default:if(Rm(t)){for(var y in n)m=n[y],n.hasOwnProperty(y)&&m!==void 0&&!a.hasOwnProperty(y)&&Oh(e,t,y,void 0,a,m);for(f in a)m=a[f],x=n[f],!a.hasOwnProperty(f)||m===x||m===void 0&&x===void 0||Oh(e,t,f,m,a,x);return}}for(var g in n)m=n[g],n.hasOwnProperty(g)&&m!=null&&!a.hasOwnProperty(g)&&Ke(e,t,g,null,a,m);for(h in a)m=a[h],x=n[h],!a.hasOwnProperty(h)||m===x||m==null&&x==null||Ke(e,t,h,m,a,x)}var $h=null,Dh=null;function uu(e){return e.nodeType===9?e:e.ownerDocument}function Hg(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 Qj(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 zh(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 bf=null;function aC(){var e=window.event;return e&&e.type==="popstate"?e===bf?!1:(bf=e,!0):(bf=null,!1)}var Zj=typeof setTimeout=="function"?setTimeout:void 0,lC=typeof clearTimeout=="function"?clearTimeout:void 0,Ig=typeof Promise=="function"?Promise:void 0,rC=typeof queueMicrotask=="function"?queueMicrotask:typeof Ig<"u"?function(e){return Ig.resolve(null).then(e).catch(iC)}:Zj;function iC(e){setTimeout(function(){throw e})}function La(e){return e==="head"}function Pg(e,t){var n=t,a=0,l=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(0<a&&8>a){n=a;var i=e.ownerDocument;if(n&1&&Ei(i.documentElement),n&2&&Ei(i.body),n&4)for(n=i.head,Ei(n),i=n.firstChild;i;){var o=i.nextSibling,c=i.nodeName;i[uo]||c==="SCRIPT"||c==="STYLE"||c==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=o}}if(l===0){e.removeChild(r),Fi(t);return}l--}else n==="$"||n==="$?"||n==="$!"?l++:a=n.charCodeAt(0)-48;else a=0;n=r}while(n);Fi(t)}function Lh(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":Lh(n),Cm(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function oC(e,t,n,a){for(;e.nodeType===1;){var l=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[uo])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(r=e.getAttribute("rel"),r==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(r!==l.rel||e.getAttribute("href")!==(l.href==null||l.href===""?null:l.href)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin)||e.getAttribute("title")!==(l.title==null?null:l.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(r=e.getAttribute("src"),(r!==(l.src==null?null:l.src)||e.getAttribute("type")!==(l.type==null?null:l.type)||e.getAttribute("crossorigin")!==(l.crossOrigin==null?null:l.crossOrigin))&&r&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var r=l.name==null?null:""+l.name;if(l.type==="hidden"&&e.getAttribute("name")===r)return e}else return e;if(e=Kn(e.nextSibling),e===null)break}return null}function cC(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Kn(e.nextSibling),e===null))return null;return e}function Uh(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function uC(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 Kn(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 Bh=null;function qg(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 Wj(e,t,n){switch(t=uu(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 Ei(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Cm(e)}var Dn=new Map,Gg=new Set;function du(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ks=Ue.d;Ue.d={f:dC,r:fC,D:hC,C:mC,L:pC,m:xC,X:vC,S:gC,M:yC};function dC(){var e=Ks.f(),t=Ku();return e||t}function fC(e){var t=Cr(e);t!==null&&t.tag===5&&t.type==="form"?Vb(t):Ks.r(e)}var Er=typeof document>"u"?null:document;function Jj(e,t,n){var a=Er;if(a&&typeof t=="string"&&t){var l=Cn(t);l='link[rel="'+e+'"][href="'+l+'"]',typeof n=="string"&&(l+='[crossorigin="'+n+'"]'),Gg.has(l)||(Gg.add(l),e={rel:e,crossOrigin:n,href:t},a.querySelector(l)===null&&(t=a.createElement("link"),Lt(t,"link",e),Mt(t),a.head.appendChild(t)))}}function hC(e){Ks.D(e),Jj("dns-prefetch",e,null)}function mC(e,t){Ks.C(e,t),Jj("preconnect",e,t)}function pC(e,t,n){Ks.L(e,t,n);var a=Er;if(a&&e&&t){var l='link[rel="preload"][as="'+Cn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(l+='[imagesrcset="'+Cn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(l+='[imagesizes="'+Cn(n.imageSizes)+'"]')):l+='[href="'+Cn(e)+'"]';var r=l;switch(t){case"style":r=yr(e);break;case"script":r=Ar(e)}Dn.has(r)||(e=Je({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Dn.set(r,e),a.querySelector(l)!==null||t==="style"&&a.querySelector(jo(r))||t==="script"&&a.querySelector(wo(r))||(t=a.createElement("link"),Lt(t,"link",e),Mt(t),a.head.appendChild(t)))}}function xC(e,t){Ks.m(e,t);var n=Er;if(n&&e){var a=t&&typeof t.as=="string"?t.as:"script",l='link[rel="modulepreload"][as="'+Cn(a)+'"][href="'+Cn(e)+'"]',r=l;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":r=Ar(e)}if(!Dn.has(r)&&(e=Je({rel:"modulepreload",href:e},t),Dn.set(r,e),n.querySelector(l)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(wo(r)))return}a=n.createElement("link"),Lt(a,"link",e),Mt(a),n.head.appendChild(a)}}}function gC(e,t,n){Ks.S(e,t,n);var a=Er;if(a&&e){var l=Ql(a).hoistableStyles,r=yr(e);t=t||"default";var i=l.get(r);if(!i){var o={loading:0,preload:null};if(i=a.querySelector(jo(r)))o.loading=5;else{e=Je({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Dn.get(r))&&up(e,n);var c=i=a.createElement("link");Mt(c),Lt(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,Rc(i,t,a)}i={type:"stylesheet",instance:i,count:1,state:o},l.set(r,i)}}}function vC(e,t){Ks.X(e,t);var n=Er;if(n&&e){var a=Ql(n).hoistableScripts,l=Ar(e),r=a.get(l);r||(r=n.querySelector(wo(l)),r||(e=Je({src:e,async:!0},t),(t=Dn.get(l))&&dp(e,t),r=n.createElement("script"),Mt(r),Lt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function yC(e,t){Ks.M(e,t);var n=Er;if(n&&e){var a=Ql(n).hoistableScripts,l=Ar(e),r=a.get(l);r||(r=n.querySelector(wo(l)),r||(e=Je({src:e,async:!0,type:"module"},t),(t=Dn.get(l))&&dp(e,t),r=n.createElement("script"),Mt(r),Lt(r,"link",e),n.head.appendChild(r)),r={type:"script",instance:r,count:1,state:null},a.set(l,r))}}function Vg(e,t,n,a){var l=(l=ja.current)?du(l):null;if(!l)throw Error(Q(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=yr(n.href),n=Ql(l).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=yr(n.href);var r=Ql(l).hoistableStyles,i=r.get(e);if(i||(l=l.ownerDocument||l,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},r.set(e,i),(r=l.querySelector(jo(e)))&&!r._p&&(i.instance=r,i.state.loading=5),Dn.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},Dn.set(e,n),r||bC(l,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=Ar(n),n=Ql(l).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 yr(e){return'href="'+Cn(e)+'"'}function jo(e){return'link[rel="stylesheet"]['+e+"]"}function e0(e){return Je({},e,{"data-precedence":e.precedence,precedence:null})}function bC(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}),Lt(t,"link",n),Mt(t),e.head.appendChild(t))}function Ar(e){return'[src="'+Cn(e)+'"]'}function wo(e){return"script[async]"+e}function Yg(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+Cn(n.href)+'"]');if(a)return t.instance=a,Mt(a),a;var l=Je({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Mt(a),Lt(a,"style",l),Rc(a,n.precedence,e),t.instance=a;case"stylesheet":l=yr(n.href);var r=e.querySelector(jo(l));if(r)return t.state.loading|=4,t.instance=r,Mt(r),r;a=e0(n),(l=Dn.get(l))&&up(a,l),r=(e.ownerDocument||e).createElement("link"),Mt(r);var i=r;return i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),Lt(r,"link",a),t.state.loading|=4,Rc(r,n.precedence,e),t.instance=r;case"script":return r=Ar(n.src),(l=e.querySelector(wo(r)))?(t.instance=l,Mt(l),l):(a=n,(l=Dn.get(r))&&(a=Je({},n),dp(a,l)),e=e.ownerDocument||e,l=e.createElement("script"),Mt(l),Lt(l,"link",a),e.head.appendChild(l),t.instance=l);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,Rc(a,n.precedence,e));return t.instance}function Rc(e,t,n){for(var a=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),l=a.length?a[a.length-1]:null,r=l,i=0;i<a.length;i++){var o=a[i];if(o.dataset.precedence===t)r=o;else if(r!==l)break}r?r.parentNode.insertBefore(e,r.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function up(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function dp(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Tc=null;function Fg(e,t,n){if(Tc===null){var a=new Map,l=Tc=new Map;l.set(n,a)}else l=Tc,a=l.get(n),a||(a=new Map,l.set(n,a));if(a.has(e))return a;for(a.set(e,null),n=n.getElementsByTagName(e),l=0;l<n.length;l++){var r=n[l];if(!(r[uo]||r[Ut]||e==="link"&&r.getAttribute("rel")==="stylesheet")&&r.namespaceURI!=="http://www.w3.org/2000/svg"){var i=r.getAttribute(t)||"";i=e+i;var o=a.get(i);o?o.push(r):a.set(i,[r])}}return a}function Kg(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function jC(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 t0(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}var qi=null;function wC(){}function _C(e,t,n){if(qi===null)throw Error(Q(475));var a=qi;if(t.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&!(t.state.loading&4)){if(t.instance===null){var l=yr(n.href),r=e.querySelector(jo(l));if(r){e=r._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(a.count++,a=fu.bind(a),e.then(a,a)),t.state.loading|=4,t.instance=r,Mt(r);return}r=e.ownerDocument||e,n=e0(n),(l=Dn.get(l))&&up(n,l),r=r.createElement("link"),Mt(r);var i=r;i._p=new Promise(function(o,c){i.onload=o,i.onerror=c}),Lt(r,"link",n),t.instance=r}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(t,e),(e=t.state.preload)&&!(t.state.loading&3)&&(a.count++,t=fu.bind(a),e.addEventListener("load",t),e.addEventListener("error",t))}}function NC(){if(qi===null)throw Error(Q(475));var e=qi;return e.stylesheets&&e.count===0&&Hh(e,e.stylesheets),0<e.count?function(t){var n=setTimeout(function(){if(e.stylesheets&&Hh(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 fu(){if(this.count--,this.count===0){if(this.stylesheets)Hh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var hu=null;function Hh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hu=new Map,t.forEach(kC,e),hu=null,fu.call(e))}function kC(e,t){if(!(t.state.loading&4)){var n=hu.get(e);if(n)var a=n.get(null);else{n=new Map,hu.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),r=0;r<l.length;r++){var i=l[r];(i.nodeName==="LINK"||i.getAttribute("media")!=="not all")&&(n.set(i.dataset.precedence,i),a=i)}a&&n.set(null,a)}l=t.instance,i=l.getAttribute("data-precedence"),r=n.get(i)||a,r===a&&n.set(null,l),n.set(i,l),this.count++,a=fu.bind(this),l.addEventListener("load",a),l.addEventListener("error",a),r?r.parentNode.insertBefore(l,r.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(l,e.firstChild)),t.state.loading|=4}}var Gi={$$typeof:Ds,Provider:null,Consumer:null,_currentValue:Za,_currentValue2:Za,_threadCount:0};function SC(e,t,n,a,l,r,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=Id(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Id(0),this.hiddenUpdates=Id(null),this.identifierPrefix=a,this.onUncaughtError=l,this.onCaughtError=r,this.onRecoverableError=i,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=o,this.incompleteTransitions=new Map}function n0(e,t,n,a,l,r,i,o,c,d,f,h){return e=new SC(e,t,n,i,o,c,d,h),t=1,r===!0&&(t|=24),r=hn(3,null,null,t),e.current=r,r.stateNode=e,t=Bm(),t.refCount++,e.pooledCache=t,t.refCount++,r.memoizedState={element:a,isDehydrated:n,cache:t},Im(r),e}function s0(e){return e?(e=Vl,e):Vl}function a0(e,t,n,a,l,r){l=s0(l),a.context===null?a.context=l:a.pendingContext=l,a=wa(t),a.payload={element:n},r=r===void 0?null:r,r!==null&&(a.callback=r),n=_a(e,a,t),n!==null&&(gn(n,e,t),wi(n,e,t))}function Xg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){Xg(e,t),(e=e.alternate)&&Xg(e,t)}function l0(e){if(e.tag===13){var t=Rr(e,67108864);t!==null&&gn(t,e,67108864),fp(e,67108864)}}var mu=!0;function CC(e,t,n,a){var l=_e.T;_e.T=null;var r=Ue.p;try{Ue.p=2,hp(e,t,n,a)}finally{Ue.p=r,_e.T=l}}function RC(e,t,n,a){var l=_e.T;_e.T=null;var r=Ue.p;try{Ue.p=8,hp(e,t,n,a)}finally{Ue.p=r,_e.T=l}}function hp(e,t,n,a){if(mu){var l=Ih(a);if(l===null)yf(e,t,a,pu,n),Qg(e,a);else if(EC(l,e,t,n,a))a.stopPropagation();else if(Qg(e,a),t&4&&-1<TC.indexOf(e)){for(;l!==null;){var r=Cr(l);if(r!==null)switch(r.tag){case 3:if(r=r.stateNode,r.current.memoizedState.isDehydrated){var i=Fa(r.pendingLanes);if(i!==0){var o=r;for(o.pendingLanes|=2,o.entangledLanes|=2;i;){var c=1<<31-pn(i);o.entanglements[1]|=c,i&=~c}_s(r),!(Ve&6)&&(lu=xs()+500,bo(0))}}break;case 13:o=Rr(r,2),o!==null&&gn(o,r,2),Ku(),fp(r,2)}if(r=Ih(a),r===null&&yf(e,t,a,pu,n),r===l)break;l=r}l!==null&&a.stopPropagation()}else yf(e,t,a,null,n)}}function Ih(e){return e=Tm(e),mp(e)}var pu=null;function mp(e){if(pu=null,e=Bl(e),e!==null){var t=ro(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=Ey(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 pu=e,null}function r0(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(mS()){case $y:return 2;case Dy:return 8;case qc:case pS:return 32;case zy:return 268435456;default:return 32}default:return 32}}var Ph=!1,Sa=null,Ca=null,Ra=null,Vi=new Map,Yi=new Map,ma=[],TC="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 Qg(e,t){switch(e){case"focusin":case"focusout":Sa=null;break;case"dragenter":case"dragleave":Ca=null;break;case"mouseover":case"mouseout":Ra=null;break;case"pointerover":case"pointerout":Vi.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yi.delete(t.pointerId)}}function ei(e,t,n,a,l,r){return e===null||e.nativeEvent!==r?(e={blockedOn:t,domEventName:n,eventSystemFlags:a,nativeEvent:r,targetContainers:[l]},t!==null&&(t=Cr(t),t!==null&&l0(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,l!==null&&t.indexOf(l)===-1&&t.push(l),e)}function EC(e,t,n,a,l){switch(t){case"focusin":return Sa=ei(Sa,e,t,n,a,l),!0;case"dragenter":return Ca=ei(Ca,e,t,n,a,l),!0;case"mouseover":return Ra=ei(Ra,e,t,n,a,l),!0;case"pointerover":var r=l.pointerId;return Vi.set(r,ei(Vi.get(r)||null,e,t,n,a,l)),!0;case"gotpointercapture":return r=l.pointerId,Yi.set(r,ei(Yi.get(r)||null,e,t,n,a,l)),!0}return!1}function i0(e){var t=Bl(e.target);if(t!==null){var n=ro(t);if(n!==null){if(t=n.tag,t===13){if(t=Ey(n),t!==null){e.blockedOn=t,_S(e.priority,function(){if(n.tag===13){var a=xn();a=km(a);var l=Rr(n,a);l!==null&&gn(l,n,a),fp(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 Ec(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ih(e.nativeEvent);if(n===null){n=e.nativeEvent;var a=new n.constructor(n.type,n);lh=a,n.target.dispatchEvent(a),lh=null}else return t=Cr(n),t!==null&&l0(t),e.blockedOn=n,!1;t.shift()}return!0}function Zg(e,t,n){Ec(e)&&n.delete(t)}function AC(){Ph=!1,Sa!==null&&Ec(Sa)&&(Sa=null),Ca!==null&&Ec(Ca)&&(Ca=null),Ra!==null&&Ec(Ra)&&(Ra=null),Vi.forEach(Zg),Yi.forEach(Zg)}function Jo(e,t){e.blockedOn===t&&(e.blockedOn=null,Ph||(Ph=!0,Tt.unstable_scheduleCallback(Tt.unstable_NormalPriority,AC)))}var ec=null;function Wg(e){ec!==e&&(ec=e,Tt.unstable_scheduleCallback(Tt.unstable_NormalPriority,function(){ec===e&&(ec=null);for(var t=0;t<e.length;t+=3){var n=e[t],a=e[t+1],l=e[t+2];if(typeof a!="function"){if(mp(a||n)===null)continue;break}var r=Cr(n);r!==null&&(e.splice(t,3),t-=3,jh(r,{pending:!0,data:l,method:n.method,action:a},a,l))}}))}function Fi(e){function t(c){return Jo(c,e)}Sa!==null&&Jo(Sa,e),Ca!==null&&Jo(Ca,e),Ra!==null&&Jo(Ra,e),Vi.forEach(t),Yi.forEach(t);for(var n=0;n<ma.length;n++){var a=ma[n];a.blockedOn===e&&(a.blockedOn=null)}for(;0<ma.length&&(n=ma[0],n.blockedOn===null);)i0(n),n.blockedOn===null&&ma.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(a=0;a<n.length;a+=3){var l=n[a],r=n[a+1],i=l[nn]||null;if(typeof r=="function")i||Wg(n);else if(i){var o=null;if(r&&r.hasAttribute("formAction")){if(l=r,i=r[nn]||null)o=i.formAction;else if(mp(l)!==null)continue}else o=i.action;typeof o=="function"?n[a+1]=o:(n.splice(a,3),a-=3),Wg(n)}}}function pp(e){this._internalRoot=e}Wu.prototype.render=pp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Q(409));var n=t.current,a=xn();a0(n,a,e,t,null,null)};Wu.prototype.unmount=pp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;a0(e.current,2,null,e,null,null),Ku(),t[Sr]=null}};function Wu(e){this._internalRoot=e}Wu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Iy();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ma.length&&t!==0&&t<ma[n].priority;n++);ma.splice(n,0,e),n===0&&i0(e)}};var Jg=Ry.version;if(Jg!=="19.1.0")throw Error(Q(527,Jg,"19.1.0"));Ue.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=iS(t),e=e!==null?Ay(e):null,e=e===null?null:e.stateNode,e};var MC={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:_e,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tc.isDisabled&&tc.supportsFiber)try{io=tc.inject(MC),mn=tc}catch{}}zu.createRoot=function(e,t){if(!Ty(e))throw Error(Q(299));var n=!1,a="",l=nj,r=sj,i=aj,o=null;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(l=t.onUncaughtError),t.onCaughtError!==void 0&&(r=t.onCaughtError),t.onRecoverableError!==void 0&&(i=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(o=t.unstable_transitionCallbacks)),t=n0(e,1,!1,null,null,n,a,l,r,i,o,null),e[Sr]=t.current,cp(e),new pp(t)};zu.hydrateRoot=function(e,t,n){if(!Ty(e))throw Error(Q(299));var a=!1,l="",r=nj,i=sj,o=aj,c=null,d=null;return n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(l=n.identifierPrefix),n.onUncaughtError!==void 0&&(r=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=n0(e,1,!0,t,n??null,a,l,r,i,o,c,d),t.context=s0(null),n=t.current,a=xn(),a=km(a),l=wa(a),l.callback=null,_a(n,l,a),n=a,t.current.lanes=n,co(t,n),_s(t),e[Sr]=t.current,cp(e),new Wu(t)};zu.version="19.1.0";function o0(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(o0)}catch(e){console.error(e)}}o0(),wy.exports=zu;var OC=wy.exports;const c0=u.createContext(null);function u0({data:e,router:t,identity:n,notify:a,children:l}){return s.jsx(c0.Provider,{value:{data:e,router:t,identity:n,notify:a},children:l})}function Ju(){const e=u.useContext(c0);if(!e)throw new Error("A shared app page rendered outside AppUiProvider.");return e}const $C={success:()=>{},error:()=>{}},ln=()=>Ju().data,Fe=()=>Ju().router,ed=()=>Ju().identity,Mr=()=>Ju().notify??$C;function DC(){const{probe:e}=ln(),{href:t,Link:n}=Fe(),a=ed(),[l,r]=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&&r(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":l??"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 zC=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),LC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),ev=e=>{const t=LC(e);return t.charAt(0).toUpperCase()+t.slice(1)},d0=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),UC=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 BC={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 HC=u.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:l="",children:r,iconNode:i,...o},c)=>u.createElement("svg",{ref:c,...BC,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:d0("lucide",l),...!r&&!UC(o)&&{"aria-hidden":"true"},...o},[...i.map(([d,f])=>u.createElement(d,f)),...Array.isArray(r)?r:[r]]));/**
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 ve=(e,t)=>{const n=u.forwardRef(({className:a,...l},r)=>u.createElement(HC,{ref:r,iconNode:t,className:d0(`lucide-${zC(ev(e))}`,`lucide-${e}`,a),...l}));return n.displayName=ev(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 IC=[["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"}]],PC=ve("archive-restore",IC);/**
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 qC=[["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"}]],tv=ve("archive",qC);/**
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 GC=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],VC=ve("arrow-down",GC);/**
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 YC=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],f0=ve("arrow-left",YC);/**
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 FC=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],KC=ve("arrow-up",FC);/**
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 XC=[["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"}]],xp=ve("bot",XC);/**
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 QC=[["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"}]],ZC=ve("briefcase",QC);/**
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 WC=[["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"}]],JC=ve("building-2",WC);/**
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 eR=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Or=ve("check",eR);/**
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 tR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],h0=ve("chevron-down",tR);/**
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 nR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],gp=ve("chevron-right",nR);/**
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 sR=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],aR=ve("chevron-up",sR);/**
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 lR=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],m0=ve("chevrons-up-down",lR);/**
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 rR=[["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"}]],lt=ve("circle-alert",rR);/**
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 iR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],td=ve("circle-check",iR);/**
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 oR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],cR=ve("circle",oR);/**
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 uR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],dR=ve("clock",uR);/**
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 fR=[["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"}]],hR=ve("copy",fR);/**
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 mR=[["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"}]],vp=ve("ellipsis",mR);/**
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 pR=[["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"}]],xR=ve("eraser",pR);/**
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 gR=[["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"}]],_o=ve("eye",gR);/**
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 vR=[["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"}]],p0=ve("folder-git-2",vR);/**
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 yR=[["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"}]],bR=ve("folder-git",yR);/**
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 jR=[["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"}]],wR=ve("git-fork",jR);/**
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 _R=[["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"}]],NR=ve("hard-drive",_R);/**
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 kR=[["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"}]],SR=ve("history",kR);/**
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 CR=[["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"}]],RR=ve("house",CR);/**
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 TR=[["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"}]],ER=ve("inbox",TR);/**
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 AR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Ua=ve("info",AR);/**
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 MR=[["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"}]],OR=ve("laptop",MR);/**
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 $R=[["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"}]],DR=ve("life-buoy",$R);/**
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 zR=[["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"}]],x0=ve("list-checks",zR);/**
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 LR=[["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"}]],g0=ve("list-ordered",LR);/**
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 UR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],BR=ve("loader-circle",UR);/**
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 HR=[["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"}]],IR=ve("lock",HR);/**
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 PR=[["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"}]],qR=ve("messages-square",PR);/**
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 GR=[["path",{d:"M5 12h14",key:"1ays0h"}]],VR=ve("minus",GR);/**
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 YR=[["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"}]],FR=ve("network",YR);/**
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 KR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],XR=ve("panel-left",KR);/**
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 QR=[["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"}]],v0=ve("pause",QR);/**
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 ZR=[["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"}]],nd=ve("pencil",ZR);/**
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 WR=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],br=ve("plus",WR);/**
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 JR=[["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"}]],yl=ve("refresh-cw",JR);/**
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 eT=[["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"}]],tT=ve("rotate-ccw",eT);/**
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 nT=[["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"}]],sd=ve("search-x",nT);/**
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 sT=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],aT=ve("search",sT);/**
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 lT=[["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"}]],rT=ve("shield-alert",lT);/**
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 iT=[["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"}]],oT=ve("snowflake",iT);/**
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 cT=[["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"}]],xu=ve("tag",cT);/**
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 uT=[["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"}]],sn=ve("triangle-alert",uT);/**
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 dT=[["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"}]],fT=ve("user-check",dT);/**
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 hT=[["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"}]],mT=ve("user-cog",hT);/**
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 pT=[["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"}]],yp=ve("user",pT);/**
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 xT=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ad=ve("x",xT),gT="Local only · this machine · not connected to SoftwareDLC",vT="Checking sync state…",yT="Sync state unknown",bT="Projects are the repositories this viewer reads on this machine. Nothing is shared unless you connect to SoftwareDLC.",cl="Details are in the terminal running sdlc viewer.",jT="How to fix it is in the terminal running sdlc viewer.",ld="Loading…",gu="Not available";function wT(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 ci(e){return(typeof e=="string"?new Date(e):e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}const _T={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 y0(e,t){const n=t?` this list was read at ${ci(t)}.`:"";if(e.reason==="store_locked"){const a=e.store?_T[e.store]:"a local store",l=e.since?` since ${ci(e.since)}`:"";return`Another sdlc command has held ${a}${l};${n||" nothing was read yet."} ${cl}`}return e.status===0?`The viewer did not answer. Is sdlc viewer still running?${t?` This list was read at ${ci(t)}.`:""}`:`The read failed.${t?` This list was read at ${ci(t)}.`:""} ${cl}`}const NT=e=>e.status===409,kT={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 ST(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 l=e.folder?`the folder ${e.folder}`:"its folder";return{kind:"moved_member",cause:`This repository, ${t}, is not where ${l} 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?kT[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 nv=["tasks","issues","releases"],bp=u.createContext(null);function jn(){const e=u.useContext(bp);if(!e)throw new Error("A shell page rendered outside the app shell.");return e}function CT(){var e;return(e=u.useContext(bp))==null?void 0:e.engine}const RT=10,TT=()=>new Date;function ET({shell:e,now:t=TT,children:n}){var U;const[a,l]=u.useState(null),[r,i]=u.useState(null),[o,c]=u.useState(null),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,j]=u.useState(!0),[v,y]=u.useState(!1),[g,p]=u.useState(void 0),[b,w]=u.useState(!1),[N,R]=u.useState(nv),_=u.useRef(!1),k=u.useRef(!1),L=u.useRef(null),z=u.useRef(!0),X=u.useCallback(async(M=!1)=>{L.current&&clearTimeout(L.current),L.current=null,y(!0);const[A,S]=await Promise.all([e.organizations.list(),e.projects.list()]);if(!z.current)return;if(y(!1),j(!1),A.ok&&S.ok){if(_.current=!0,k.current=!1,m(null),f(t()),A.data.organizations.length===0){c("not_in_git"),l(null),i(null);return}c(null),l(A.data.organizations[0]),i(S.data.projects);return}const E=A.ok?S.ok?null:S.refusal:A.refusal;if(!E)return;if(NT(E)){k.current=!1,m(null),c(E),l(null),i(null);return}const C=_.current&&!k.current&&!M;k.current=!0;const $=E.retry_after??RT;m({refusal:E,shown:!C,retryInSeconds:C?$:null}),C&&(L.current=setTimeout(()=>void X(!0),$*1e3))},[e,t]);u.useEffect(()=>(z.current=!0,X(),e.about.about().then(M=>{z.current&&(M.ok?p(M.data):M.refusal.status===404?p(null):w(!0))}),Promise.all(nv.map(async M=>{var A;return[M,await((A=e[M])==null?void 0:A.access())]})).then(M=>{z.current&&R(M.filter(([,A])=>!(A!=null&&A.ok&&!A.data.can_view)).map(([A])=>A))}),()=>{z.current=!1,L.current&&clearTimeout(L.current)}),[e,X]);const V={loading:x,org:a,projects:r,none:o,readAt:d,failure:h,about:g,aboutFailed:b,engine:(g==null?void 0:g.engine)===null?null:(U=g==null?void 0:g.engine)==null?void 0:U.source,domains:N,reading:v,refresh:()=>void X()};return s.jsx(bp.Provider,{value:V,children:n})}const b0=e=>`The ${e} page is not part of this sdlc install`,$r="The sdlc engine here is too old for this page";function AT(e){return e==="checkout"?"Update the main checkout, then restart sdlc viewer.":"Update sdlc to its latest version, then restart sdlc viewer."}function ns(){return AT(CT())}function j0(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(n=j0(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function w0(){for(var e,t,n=0,a="",l=arguments.length;n<l;n++)(e=arguments[n])&&(t=j0(e))&&(a&&(a+=" "),a+=t);return a}const sv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,av=w0,No=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return av(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:l,defaultVariants:r}=t,i=Object.keys(l).map(d=>{const f=n==null?void 0:n[d],h=r==null?void 0:r[d];if(f===null)return null;const m=sv(f)||sv(h);return l[d][m]}),o=n&&Object.entries(n).reduce((d,f)=>{let[h,m]=f;return m===void 0||(d[h]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,f)=>{let{class:h,className:m,...x}=f;return Object.entries(x).every(j=>{let[v,y]=j;return Array.isArray(y)?y.includes({...r,...o}[v]):{...r,...o}[v]===y})?[...d,h,m]:d},[]);return av(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},jp="-",MT=e=>{const t=$T(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i=>{const o=i.split(jp);return o[0]===""&&o.length!==1&&o.shift(),_0(o,t)||OT(i)},getConflictingClassGroupIds:(i,o)=>{const c=n[i]||[];return o&&a[i]?[...c,...a[i]]:c}}},_0=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],a=t.nextPart.get(n),l=a?_0(e.slice(1),a):void 0;if(l)return l;if(t.validators.length===0)return;const r=e.join(jp);return(i=t.validators.find(({validator:o})=>o(r)))==null?void 0:i.classGroupId},lv=/^\[(.+)\]$/,OT=e=>{if(lv.test(e)){const t=lv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},$T=e=>{const{theme:t,classGroups:n}=e,a={nextPart:new Map,validators:[]};for(const l in n)qh(n[l],a,l,t);return a},qh=(e,t,n,a)=>{e.forEach(l=>{if(typeof l=="string"){const r=l===""?t:rv(t,l);r.classGroupId=n;return}if(typeof l=="function"){if(DT(l)){qh(l(a),t,n,a);return}t.validators.push({validator:l,classGroupId:n});return}Object.entries(l).forEach(([r,i])=>{qh(i,rv(t,r),n,a)})})},rv=(e,t)=>{let n=e;return t.split(jp).forEach(a=>{n.nextPart.has(a)||n.nextPart.set(a,{nextPart:new Map,validators:[]}),n=n.nextPart.get(a)}),n},DT=e=>e.isThemeGetter,zT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,a=new Map;const l=(r,i)=>{n.set(r,i),t++,t>e&&(t=0,a=n,n=new Map)};return{get(r){let i=n.get(r);if(i!==void 0)return i;if((i=a.get(r))!==void 0)return l(r,i),i},set(r,i){n.has(r)?n.set(r,i):l(r,i)}}},Gh="!",Vh=":",LT=Vh.length,UT=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=l=>{const r=[];let i=0,o=0,c=0,d;for(let j=0;j<l.length;j++){let v=l[j];if(i===0&&o===0){if(v===Vh){r.push(l.slice(c,j)),c=j+LT;continue}if(v==="/"){d=j;continue}}v==="["?i++:v==="]"?i--:v==="("?o++:v===")"&&o--}const f=r.length===0?l:l.substring(c),h=BT(f),m=h!==f,x=d&&d>c?d-c:void 0;return{modifiers:r,hasImportantModifier:m,baseClassName:h,maybePostfixModifierPosition:x}};if(t){const l=t+Vh,r=a;a=i=>i.startsWith(l)?r(i.substring(l.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const l=a;a=r=>n({className:r,parseClassName:l})}return a},BT=e=>e.endsWith(Gh)?e.substring(0,e.length-1):e.startsWith(Gh)?e.substring(1):e,HT=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return a=>{if(a.length<=1)return a;const l=[];let r=[];return a.forEach(i=>{i[0]==="["||t[i]?(l.push(...r.sort(),i),r=[]):r.push(i)}),l.push(...r.sort()),l}},IT=e=>({cache:zT(e.cacheSize),parseClassName:UT(e),sortModifiers:HT(e),...MT(e)}),PT=/\s+/,qT=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:r}=t,i=[],o=e.trim().split(PT);let c="";for(let d=o.length-1;d>=0;d-=1){const f=o[d],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:j,maybePostfixModifierPosition:v}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let y=!!v,g=a(y?j.substring(0,v):j);if(!g){if(!y){c=f+(c.length>0?" "+c:c);continue}if(g=a(j),!g){c=f+(c.length>0?" "+c:c);continue}y=!1}const p=r(m).join(":"),b=x?p+Gh:p,w=b+g;if(i.includes(w))continue;i.push(w);const N=l(g,y);for(let R=0;R<N.length;++R){const _=N[R];i.push(b+_)}c=f+(c.length>0?" "+c:c)}return c};function GT(){let e=0,t,n,a="";for(;e<arguments.length;)(t=arguments[e++])&&(n=N0(t))&&(a&&(a+=" "),a+=n);return a}const N0=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=N0(e[a]))&&(n&&(n+=" "),n+=t);return n};function VT(e,...t){let n,a,l,r=i;function i(c){const d=t.reduce((f,h)=>h(f),e());return n=IT(d),a=n.cache.get,l=n.cache.set,r=o,o(c)}function o(c){const d=a(c);if(d)return d;const f=qT(c,n);return l(c,f),f}return function(){return r(GT.apply(null,arguments))}}const St=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},k0=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,S0=/^\((?:(\w[\w-]*):)?(.+)\)$/i,YT=/^\d+\/\d+$/,FT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,KT=/\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$/,XT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,QT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ZT=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kl=e=>YT.test(e),Re=e=>!!e&&!Number.isNaN(Number(e)),aa=e=>!!e&&Number.isInteger(Number(e)),jf=e=>e.endsWith("%")&&Re(e.slice(0,-1)),Es=e=>FT.test(e),WT=()=>!0,JT=e=>KT.test(e)&&!XT.test(e),C0=()=>!1,eE=e=>QT.test(e),tE=e=>ZT.test(e),nE=e=>!fe(e)&&!he(e),sE=e=>Dr(e,E0,C0),fe=e=>k0.test(e),Ya=e=>Dr(e,A0,JT),wf=e=>Dr(e,oE,Re),iv=e=>Dr(e,R0,C0),aE=e=>Dr(e,T0,tE),nc=e=>Dr(e,M0,eE),he=e=>S0.test(e),ti=e=>zr(e,A0),lE=e=>zr(e,cE),ov=e=>zr(e,R0),rE=e=>zr(e,E0),iE=e=>zr(e,T0),sc=e=>zr(e,M0,!0),Dr=(e,t,n)=>{const a=k0.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},zr=(e,t,n=!1)=>{const a=S0.exec(e);return a?a[1]?t(a[1]):n:!1},R0=e=>e==="position"||e==="percentage",T0=e=>e==="image"||e==="url",E0=e=>e==="length"||e==="size"||e==="bg-size",A0=e=>e==="length",oE=e=>e==="number",cE=e=>e==="family-name",M0=e=>e==="shadow",uE=()=>{const e=St("color"),t=St("font"),n=St("text"),a=St("font-weight"),l=St("tracking"),r=St("leading"),i=St("breakpoint"),o=St("container"),c=St("spacing"),d=St("radius"),f=St("shadow"),h=St("inset-shadow"),m=St("text-shadow"),x=St("drop-shadow"),j=St("blur"),v=St("perspective"),y=St("aspect"),g=St("ease"),p=St("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"],N=()=>[...w(),he,fe],R=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],k=()=>[he,fe,c],L=()=>[kl,"full","auto",...k()],z=()=>[aa,"none","subgrid",he,fe],X=()=>["auto",{span:["full",aa,he,fe]},aa,he,fe],V=()=>[aa,"auto",he,fe],U=()=>["auto","min","max","fr",he,fe],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],A=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...k()],E=()=>[kl,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],C=()=>[e,he,fe],$=()=>[...w(),ov,iv,{position:[he,fe]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",rE,sE,{size:[he,fe]}],P=()=>[jf,ti,Ya],ne=()=>["","none","full",d,he,fe],le=()=>["",Re,ti,Ya],ge=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[Re,jf,ov,iv],H=()=>["","none",j,he,fe],se=()=>["none",Re,he,fe],B=()=>["none",Re,he,fe],ee=()=>[Re,he,fe],W=()=>[kl,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Es],breakpoint:[Es],color:[WT],container:[Es],"drop-shadow":[Es],ease:["in","out","in-out"],font:[nE],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Es],shadow:[Es],spacing:["px",Re],text:[Es],"text-shadow":[Es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",kl,fe,he,y]}],container:["container"],columns:[{columns:[Re,fe,he,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:N()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[aa,"auto",he,fe]}],basis:[{basis:[kl,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,kl,"auto","initial","none",fe]}],grow:[{grow:["",Re,he,fe]}],shrink:[{shrink:["",Re,he,fe]}],order:[{order:[aa,"first","last","none",he,fe]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":U()}],"auto-rows":[{"auto-rows":U()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"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,ti,Ya]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,he,wf]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jf,fe]}],"font-family":[{font:[lE,fe,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:[l,he,fe]}],"line-clamp":[{"line-clamp":[Re,"none",he,wf]}],leading:[{leading:[r,...k()]}],"list-image":[{"list-image":["none",he,fe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,fe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",he,Ya]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[Re,"auto",he,fe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,fe]}],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",he,fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:$()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},aa,he,fe],radial:["",he,fe],conic:[aa,he,fe]},iE,aE]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:P()}],"gradient-via-pos":[{via:P()}],"gradient-to-pos":[{to:P()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":le()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,he,fe]}],"outline-w":[{outline:["",Re,ti,Ya]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",f,sc,nc]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",h,sc,nc]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[Re,Ya]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",m,sc,nc]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[Re,he,fe]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"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":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[he,fe]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"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":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:$()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,fe]}],filter:[{filter:["","none",he,fe]}],blur:[{blur:H()}],brightness:[{brightness:[Re,he,fe]}],contrast:[{contrast:[Re,he,fe]}],"drop-shadow":[{"drop-shadow":["","none",x,sc,nc]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",Re,he,fe]}],"hue-rotate":[{"hue-rotate":[Re,he,fe]}],invert:[{invert:["",Re,he,fe]}],saturate:[{saturate:[Re,he,fe]}],sepia:[{sepia:["",Re,he,fe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,fe]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Re,he,fe]}],"backdrop-contrast":[{"backdrop-contrast":[Re,he,fe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,he,fe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,he,fe]}],"backdrop-invert":[{"backdrop-invert":["",Re,he,fe]}],"backdrop-opacity":[{"backdrop-opacity":[Re,he,fe]}],"backdrop-saturate":[{"backdrop-saturate":[Re,he,fe]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,he,fe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,fe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",he,fe]}],ease:[{ease:["linear","initial",g,he,fe]}],delay:[{delay:[Re,he,fe]}],animate:[{animate:["none",p,he,fe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,he,fe]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:ee()}],"skew-x":[{"skew-x":ee()}],"skew-y":[{"skew-y":ee()}],transform:[{transform:[he,fe,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"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",he,fe]}],"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":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",he,fe]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[Re,ti,Ya,wf]}],stroke:[{stroke:["none",...C()]}],"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"]}},dE=VT(uE);function ie(...e){return dE(w0(e))}const fE=No("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 pe({className:e,variant:t,...n}){return s.jsx("div",{"data-slot":"alert",role:"alert",className:ie(fE({variant:t}),e),...n})}function be({className:e,...t}){return s.jsx("div",{"data-slot":"alert-title",className:ie("col-start-2 min-h-4 font-medium tracking-tight",e),...t})}function xe({className:e,...t}){return s.jsx("div",{"data-slot":"alert-description",className:ie("col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...t})}function ue(e,t,{checkForDefaultPrevented:n=!0}={}){return function(l){if(e==null||e(l),n===!1||!l.defaultPrevented)return t==null?void 0:t(l)}}function cv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function rd(...e){return t=>{let n=!1;const a=e.map(l=>{const r=cv(l,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let l=0;l<a.length;l++){const r=a[l];typeof r=="function"?r():cv(e[l],null)}}}}function Ie(...e){return u.useCallback(rd(...e),e)}function hE(e,t){const n=u.createContext(t),a=r=>{const{children:i,...o}=r,c=u.useMemo(()=>o,Object.values(o));return s.jsx(n.Provider,{value:c,children:i})};a.displayName=e+"Provider";function l(r){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${r}\` must be used within \`${e}\``)}return[a,l]}function Ns(e,t=[]){let n=[];function a(r,i){const o=u.createContext(i),c=n.length;n=[...n,i];const d=h=>{var g;const{scope:m,children:x,...j}=h,v=((g=m==null?void 0:m[e])==null?void 0:g[c])||o,y=u.useMemo(()=>j,Object.values(j));return s.jsx(v.Provider,{value:y,children:x})};d.displayName=r+"Provider";function f(h,m){var v;const x=((v=m==null?void 0:m[e])==null?void 0:v[c])||o,j=u.useContext(x);if(j)return j;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,f]}const l=()=>{const r=n.map(i=>u.createContext(i));return function(o){const c=(o==null?void 0:o[e])||r;return u.useMemo(()=>({[`__scope${e}`]:{...o,[e]:c}}),[o,c])}};return l.scopeName=e,[a,mE(l,...t)]}function mE(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(l=>({useScope:l(),scopeName:l.scopeName}));return function(r){const i=a.reduce((o,{useScope:c,scopeName:d})=>{const h=c(r)[`__scope${d}`];return{...o,...h}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var Ht=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},pE=jy[" useId ".trim().toString()]||(()=>{}),xE=0;function Xn(e){const[t,n]=u.useState(pE());return Ht(()=>{n(a=>a??String(xE++))},[e]),t?`radix-${t}`:""}var gE=jy[" useInsertionEffect ".trim().toString()]||Ht;function Oa({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[l,r,i]=vE({defaultProp:t,onChange:n}),o=e!==void 0,c=o?e:l;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const h=f.current;h!==o&&console.warn(`${a} is changing from ${h?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=o},[o,a])}const d=u.useCallback(f=>{var h;if(o){const m=yE(f)?f(e):f;m!==e&&((h=i.current)==null||h.call(i,m))}else r(f)},[o,e,r,i]);return[c,d]}function vE({defaultProp:e,onChange:t}){const[n,a]=u.useState(e),l=u.useRef(n),r=u.useRef(t);return gE(()=>{r.current=t},[t]),u.useEffect(()=>{var i;l.current!==n&&((i=r.current)==null||i.call(r,n),l.current=n)},[n,l]),[n,a,r]}function yE(e){return typeof e=="function"}function ul(e){const t=jE(e),n=u.forwardRef((a,l)=>{const{children:r,...i}=a,o=u.Children.toArray(r),c=o.find(_E);if(c){const d=c.props.children,f=o.map(h=>h===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:h);return s.jsx(t,{...i,ref:l,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return s.jsx(t,{...i,ref:l,children:r})});return n.displayName=`${e}.Slot`,n}var bE=ul("Slot");function jE(e){const t=u.forwardRef((n,a)=>{const{children:l,...r}=n;if(u.isValidElement(l)){const i=kE(l),o=NE(r,l.props);return l.type!==u.Fragment&&(o.ref=a?rd(a,i):i),u.cloneElement(l,o)}return u.Children.count(l)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var O0=Symbol("radix.slottable");function wE(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=O0,t}function _E(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===O0}function NE(e,t){const n={...t};for(const a in t){const l=e[a],r=t[a];/^on[A-Z]/.test(a)?l&&r?n[a]=(...o)=>{const c=r(...o);return l(...o),c}:l&&(n[a]=l):a==="style"?n[a]={...l,...r}:a==="className"&&(n[a]=[l,r].filter(Boolean).join(" "))}return{...e,...n}}function kE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var SE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=SE.reduce((e,t)=>{const n=ul(`Primitive.${t}`),a=u.forwardRef((l,r)=>{const{asChild:i,...o}=l,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...o,ref:r})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function $0(e,t){e&&kr.flushSync(()=>e.dispatchEvent(t))}function bs(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 CE(e,t=globalThis==null?void 0:globalThis.document){const n=bs(e);u.useEffect(()=>{const a=l=>{l.key==="Escape"&&n(l)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var RE="DismissableLayer",Yh="dismissableLayer.update",TE="dismissableLayer.pointerDownOutside",EE="dismissableLayer.focusOutside",uv,D0=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ko=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:r,onInteractOutside:i,onDismiss:o,...c}=e,d=u.useContext(D0),[f,h]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=u.useState({}),j=Ie(t,_=>h(_)),v=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),g=v.indexOf(y),p=f?v.indexOf(f):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,w=p>=g,N=OE(_=>{const k=_.target,L=[...d.branches].some(z=>z.contains(k));!w||L||(l==null||l(_),i==null||i(_),_.defaultPrevented||o==null||o())},m),R=$E(_=>{const k=_.target;[...d.branches].some(z=>z.contains(k))||(r==null||r(_),i==null||i(_),_.defaultPrevented||o==null||o())},m);return CE(_=>{p===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&o&&(_.preventDefault(),o()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(uv=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),dv(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=uv)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),dv())},[f,d]),u.useEffect(()=>{const _=()=>x({});return document.addEventListener(Yh,_),()=>document.removeEventListener(Yh,_)},[]),s.jsx(Ne.div,{...c,ref:j,style:{pointerEvents:b?w?"auto":"none":void 0,...e.style},onFocusCapture:ue(e.onFocusCapture,R.onFocusCapture),onBlurCapture:ue(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ue(e.onPointerDownCapture,N.onPointerDownCapture)})});ko.displayName=RE;var AE="DismissableLayerBranch",ME=u.forwardRef((e,t)=>{const n=u.useContext(D0),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return n.branches.add(r),()=>{n.branches.delete(r)}},[n.branches]),s.jsx(Ne.div,{...e,ref:l})});ME.displayName=AE;function OE(e,t=globalThis==null?void 0:globalThis.document){const n=bs(e),a=u.useRef(!1),l=u.useRef(()=>{});return u.useEffect(()=>{const r=o=>{if(o.target&&!a.current){let c=function(){z0(TE,n,d,{discrete:!0})};const d={originalEvent:o};o.pointerType==="touch"?(t.removeEventListener("click",l.current),l.current=c,t.addEventListener("click",l.current,{once:!0})):c()}else t.removeEventListener("click",l.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",r)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",r),t.removeEventListener("click",l.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function $E(e,t=globalThis==null?void 0:globalThis.document){const n=bs(e),a=u.useRef(!1);return u.useEffect(()=>{const l=r=>{r.target&&!a.current&&z0(EE,n,{originalEvent:r},{discrete:!1})};return t.addEventListener("focusin",l),()=>t.removeEventListener("focusin",l)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function dv(){const e=new CustomEvent(Yh);document.dispatchEvent(e)}function z0(e,t,n,{discrete:a}){const l=n.originalEvent.target,r=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&l.addEventListener(e,t,{once:!0}),a?$0(l,r):l.dispatchEvent(r)}var _f="focusScope.autoFocusOnMount",Nf="focusScope.autoFocusOnUnmount",fv={bubbles:!1,cancelable:!0},DE="FocusScope",id=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:l,onUnmountAutoFocus:r,...i}=e,[o,c]=u.useState(null),d=bs(l),f=bs(r),h=u.useRef(null),m=Ie(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)?h.current=w:oa(h.current,{select:!0})},y=function(b){if(x.paused||!o)return;const w=b.relatedTarget;w!==null&&(o.contains(w)||oa(h.current,{select:!0}))},g=function(b){if(document.activeElement===document.body)for(const N of b)N.removedNodes.length>0&&oa(o)};document.addEventListener("focusin",v),document.addEventListener("focusout",y);const p=new MutationObserver(g);return o&&p.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",y),p.disconnect()}}},[a,o,x.paused]),u.useEffect(()=>{if(o){mv.add(x);const v=document.activeElement;if(!o.contains(v)){const g=new CustomEvent(_f,fv);o.addEventListener(_f,d),o.dispatchEvent(g),g.defaultPrevented||(zE(IE(L0(o)),{select:!0}),document.activeElement===v&&oa(o))}return()=>{o.removeEventListener(_f,d),setTimeout(()=>{const g=new CustomEvent(Nf,fv);o.addEventListener(Nf,f),o.dispatchEvent(g),g.defaultPrevented||oa(v??document.body,{select:!0}),o.removeEventListener(Nf,f),mv.remove(x)},0)}}},[o,d,f,x]);const j=u.useCallback(v=>{if(!n&&!a||x.paused)return;const y=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,g=document.activeElement;if(y&&g){const p=v.currentTarget,[b,w]=LE(p);b&&w?!v.shiftKey&&g===w?(v.preventDefault(),n&&oa(b,{select:!0})):v.shiftKey&&g===b&&(v.preventDefault(),n&&oa(w,{select:!0})):g===p&&v.preventDefault()}},[n,a,x.paused]);return s.jsx(Ne.div,{tabIndex:-1,...i,ref:m,onKeyDown:j})});id.displayName=DE;function zE(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(oa(a,{select:t}),document.activeElement!==n)return}function LE(e){const t=L0(e),n=hv(t,e),a=hv(t.reverse(),e);return[n,a]}function L0(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const l=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||l?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function hv(e,t){for(const n of e)if(!UE(n,{upTo:t}))return n}function UE(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 BE(e){return e instanceof HTMLInputElement&&"select"in e}function oa(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&BE(e)&&t&&e.select()}}var mv=HE();function HE(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=pv(e,t),e.unshift(t)},remove(t){var n;e=pv(e,t),(n=e[0])==null||n.resume()}}}function pv(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function IE(e){return e.filter(t=>t.tagName!=="A")}var PE="Portal",So=u.forwardRef((e,t)=>{var o;const{container:n,...a}=e,[l,r]=u.useState(!1);Ht(()=>r(!0),[]);const i=n||l&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return i?lS.createPortal(s.jsx(Ne.div,{...a,ref:t}),i):null});So.displayName=PE;function qE(e,t){return u.useReducer((n,a)=>t[n][a]??n,e)}var zn=e=>{const{present:t,children:n}=e,a=GE(t),l=typeof n=="function"?n({present:a.isPresent}):u.Children.only(n),r=Ie(a.ref,VE(l));return typeof n=="function"||a.isPresent?u.cloneElement(l,{ref:r}):null};zn.displayName="Presence";function GE(e){const[t,n]=u.useState(),a=u.useRef(null),l=u.useRef(e),r=u.useRef("none"),i=e?"mounted":"unmounted",[o,c]=qE(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=ac(a.current);r.current=o==="mounted"?d:"none"},[o]),Ht(()=>{const d=a.current,f=l.current;if(f!==e){const m=r.current,x=ac(d);e?c("MOUNT"):x==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),l.current=e}},[e,c]),Ht(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=x=>{const v=ac(a.current).includes(x.animationName);if(x.target===t&&v&&(c("ANIMATION_END"),!l.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=x=>{x.target===t&&(r.current=ac(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:u.useCallback(d=>{a.current=d?getComputedStyle(d):null,n(d)},[])}}function ac(e){return(e==null?void 0:e.animationName)||"none"}function VE(e){var a,l;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=(l=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:l.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var kf=0;function wp(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??xv()),document.body.insertAdjacentElement("beforeend",e[1]??xv()),kf++,()=>{kf===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),kf--}},[])}function xv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var us=function(){return us=Object.assign||function(t){for(var n,a=1,l=arguments.length;a<l;a++){n=arguments[a];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},us.apply(this,arguments)};function U0(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 l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(n[a[l]]=e[a[l]]);return n}function YE(e,t,n){if(n||arguments.length===2)for(var a=0,l=t.length,r;a<l;a++)(r||!(a in t))&&(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))}var Ac="right-scroll-bar-position",Mc="width-before-scroll-bar",FE="with-scroll-bars-hidden",KE="--removed-body-scroll-bar-size";function Sf(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function XE(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var l=n.value;l!==a&&(n.value=a,n.callback(a,l))}}}})[0];return n.callback=t,n.facade}var QE=typeof window<"u"?u.useLayoutEffect:u.useEffect,gv=new WeakMap;function ZE(e,t){var n=XE(null,function(a){return e.forEach(function(l){return Sf(l,a)})});return QE(function(){var a=gv.get(n);if(a){var l=new Set(a),r=new Set(e),i=n.current;l.forEach(function(o){r.has(o)||Sf(o,null)}),r.forEach(function(o){l.has(o)||Sf(o,i)})}gv.set(n,e)},[e]),n}function WE(e){return e}function JE(e,t){t===void 0&&(t=WE);var n=[],a=!1,l={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(r){var i=t(r,a);return n.push(i),function(){n=n.filter(function(o){return o!==i})}},assignSyncMedium:function(r){for(a=!0;n.length;){var i=n;n=[],i.forEach(r)}n={push:function(o){return r(o)},filter:function(){return n}}},assignMedium:function(r){a=!0;var i=[];if(n.length){var o=n;n=[],o.forEach(r),i=n}var c=function(){var f=i;i=[],f.forEach(r)},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 l}function eA(e){e===void 0&&(e={});var t=JE(null);return t.options=us({async:!0,ssr:!1},e),t}var B0=function(e){var t=e.sideCar,n=U0(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return u.createElement(a,us({},n))};B0.isSideCarExport=!0;function tA(e,t){return e.useMedium(t),B0}var H0=eA(),Cf=function(){},od=u.forwardRef(function(e,t){var n=u.useRef(null),a=u.useState({onScrollCapture:Cf,onWheelCapture:Cf,onTouchMoveCapture:Cf}),l=a[0],r=a[1],i=e.forwardProps,o=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,h=e.shards,m=e.sideCar,x=e.noRelative,j=e.noIsolation,v=e.inert,y=e.allowPinchZoom,g=e.as,p=g===void 0?"div":g,b=e.gapMode,w=U0(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,R=ZE([n,t]),_=us(us({},w),l);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:H0,removeScrollBar:d,shards:h,noRelative:x,noIsolation:j,inert:v,setCallbacks:r,allowPinchZoom:!!y,lockRef:n,gapMode:b}),i?u.cloneElement(u.Children.only(o),us(us({},_),{ref:R})):u.createElement(p,us({},_,{className:c,ref:R}),o))});od.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};od.classNames={fullWidth:Mc,zeroRight:Ac};var nA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=nA();return t&&e.setAttribute("nonce",t),e}function aA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var rA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sA())&&(aA(t,n),lA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},iA=function(){var e=rA();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},I0=function(){var e=iA(),t=function(n){var a=n.styles,l=n.dynamic;return e(a,l),null};return t},oA={left:0,top:0,right:0,gap:0},Rf=function(e){return parseInt(e||"",10)||0},cA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],l=t[e==="padding"?"paddingRight":"marginRight"];return[Rf(n),Rf(a),Rf(l)]},uA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return oA;var t=cA(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])}},dA=I0(),ar="data-scroll-locked",fA=function(e,t,n,a){var l=e.left,r=e.top,i=e.right,o=e.gap;return n===void 0&&(n="margin"),`
340
+ .`.concat(FE,` {
341
+ overflow: hidden `).concat(a,`;
342
+ padding-right: `).concat(o,"px ").concat(a,`;
343
+ }
344
+ body[`).concat(ar,`] {
345
+ overflow: hidden `).concat(a,`;
346
+ overscroll-behavior: contain;
347
+ `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
348
+ padding-left: `.concat(l,`px;
349
+ padding-top: `).concat(r,`px;
350
+ padding-right: `).concat(i,`px;
351
+ margin-left:0;
352
+ margin-top:0;
353
+ margin-right: `).concat(o,"px ").concat(a,`;
354
+ `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(a,";")].filter(Boolean).join(""),`
355
+ }
356
+
357
+ .`).concat(Ac,` {
358
+ right: `).concat(o,"px ").concat(a,`;
359
+ }
360
+
361
+ .`).concat(Mc,` {
362
+ margin-right: `).concat(o,"px ").concat(a,`;
363
+ }
364
+
365
+ .`).concat(Ac," .").concat(Ac,` {
366
+ right: 0 `).concat(a,`;
367
+ }
368
+
369
+ .`).concat(Mc," .").concat(Mc,` {
370
+ margin-right: 0 `).concat(a,`;
371
+ }
372
+
373
+ body[`).concat(ar,`] {
374
+ `).concat(KE,": ").concat(o,`px;
375
+ }
376
+ `)},vv=function(){var e=parseInt(document.body.getAttribute(ar)||"0",10);return isFinite(e)?e:0},hA=function(){u.useEffect(function(){return document.body.setAttribute(ar,(vv()+1).toString()),function(){var e=vv()-1;e<=0?document.body.removeAttribute(ar):document.body.setAttribute(ar,e.toString())}},[])},mA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,l=a===void 0?"margin":a;hA();var r=u.useMemo(function(){return uA(l)},[l]);return u.createElement(dA,{styles:fA(r,!t,l,n?"":"!important")})},Fh=!1;if(typeof window<"u")try{var lc=Object.defineProperty({},"passive",{get:function(){return Fh=!0,!0}});window.addEventListener("test",lc,lc),window.removeEventListener("test",lc,lc)}catch{Fh=!1}var Sl=Fh?{passive:!1}:!1,pA=function(e){return e.tagName==="TEXTAREA"},P0=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!pA(e)&&n[t]==="visible")},xA=function(e){return P0(e,"overflowY")},gA=function(e){return P0(e,"overflowX")},yv=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var l=q0(e,a);if(l){var r=G0(e,a),i=r[1],o=r[2];if(i>o)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},vA=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},yA=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},q0=function(e,t){return e==="v"?xA(t):gA(t)},G0=function(e,t){return e==="v"?vA(t):yA(t)},bA=function(e,t){return e==="h"&&t==="rtl"?-1:1},jA=function(e,t,n,a,l){var r=bA(e,window.getComputedStyle(t).direction),i=r*a,o=n.target,c=t.contains(o),d=!1,f=i>0,h=0,m=0;do{if(!o)break;var x=G0(e,o),j=x[0],v=x[1],y=x[2],g=v-y-r*j;(j||g)&&q0(e,o)&&(h+=g,m+=j);var p=o.parentNode;o=p&&p.nodeType===Node.DOCUMENT_FRAGMENT_NODE?p.host:p}while(!c&&o!==document.body||c&&(t.contains(o)||t===o));return(f&&Math.abs(h)<1||!f&&Math.abs(m)<1)&&(d=!0),d},rc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},bv=function(e){return[e.deltaX,e.deltaY]},jv=function(e){return e&&"current"in e?e.current:e},wA=function(e,t){return e[0]===t[0]&&e[1]===t[1]},_A=function(e){return`
377
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
378
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
379
+ `)},NA=0,Cl=[];function kA(e){var t=u.useRef([]),n=u.useRef([0,0]),a=u.useRef(),l=u.useState(NA++)[0],r=u.useState(I0)[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(l));var v=YE([e.lockRef.current],(e.shards||[]).map(jv),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(l))}),function(){document.body.classList.remove("block-interactivity-".concat(l)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(l))})}}},[e.inert,e.lockRef.current,e.shards]);var o=u.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var g=rc(v),p=n.current,b="deltaX"in v?v.deltaX:p[0]-g[0],w="deltaY"in v?v.deltaY:p[1]-g[1],N,R=v.target,_=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in v&&_==="h"&&R.type==="range")return!1;var k=yv(_,R);if(!k)return!0;if(k?N=_:(N=_==="v"?"h":"v",k=yv(_,R)),!k)return!1;if(!a.current&&"changedTouches"in v&&(b||w)&&(a.current=N),!N)return!0;var L=a.current||N;return jA(L,y,v,L==="h"?b:w)},[]),c=u.useCallback(function(v){var y=v;if(!(!Cl.length||Cl[Cl.length-1]!==r)){var g="deltaY"in y?bv(y):rc(y),p=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&wA(N.delta,g)})[0];if(p&&p.should){y.cancelable&&y.preventDefault();return}if(!p){var b=(i.current.shards||[]).map(jv).filter(Boolean).filter(function(N){return N.contains(y.target)}),w=b.length>0?o(y,b[0]):!i.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),d=u.useCallback(function(v,y,g,p){var b={name:v,delta:y,target:g,should:p,shadowParent:SA(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=rc(v),a.current=void 0},[]),h=u.useCallback(function(v){d(v.type,bv(v),v.target,o(v,e.lockRef.current))},[]),m=u.useCallback(function(v){d(v.type,rc(v),v.target,o(v,e.lockRef.current))},[]);u.useEffect(function(){return Cl.push(r),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Sl),document.addEventListener("touchmove",c,Sl),document.addEventListener("touchstart",f,Sl),function(){Cl=Cl.filter(function(v){return v!==r}),document.removeEventListener("wheel",c,Sl),document.removeEventListener("touchmove",c,Sl),document.removeEventListener("touchstart",f,Sl)}},[]);var x=e.removeScrollBar,j=e.inert;return u.createElement(u.Fragment,null,j?u.createElement(r,{styles:_A(l)}):null,x?u.createElement(mA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function SA(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const CA=tA(H0,kA);var cd=u.forwardRef(function(e,t){return u.createElement(od,us({},e,{ref:t,sideCar:CA}))});cd.classNames=od.classNames;var RA=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Rl=new WeakMap,ic=new WeakMap,oc={},Tf=0,V0=function(e){return e&&(e.host||V0(e.parentNode))},TA=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=V0(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})},EA=function(e,t,n,a){var l=TA(t,Array.isArray(e)?e:[e]);oc[n]||(oc[n]=new WeakMap);var r=oc[n],i=[],o=new Set,c=new Set(l),d=function(h){!h||o.has(h)||(o.add(h),d(h.parentNode))};l.forEach(d);var f=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(o.has(m))f(m);else try{var x=m.getAttribute(a),j=x!==null&&x!=="false",v=(Rl.get(m)||0)+1,y=(r.get(m)||0)+1;Rl.set(m,v),r.set(m,y),i.push(m),v===1&&j&&ic.set(m,!0),y===1&&m.setAttribute(n,"true"),j||m.setAttribute(a,"true")}catch(g){console.error("aria-hidden: cannot operate on ",m,g)}})};return f(t),o.clear(),Tf++,function(){i.forEach(function(h){var m=Rl.get(h)-1,x=r.get(h)-1;Rl.set(h,m),r.set(h,x),m||(ic.has(h)||h.removeAttribute(a),ic.delete(h)),x||h.removeAttribute(n)}),Tf--,Tf||(Rl=new WeakMap,Rl=new WeakMap,ic=new WeakMap,oc={})}},_p=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),l=RA(e);return l?(a.push.apply(a,Array.from(l.querySelectorAll("[aria-live], script"))),EA(a,l,n,"aria-hidden")):function(){return null}},ud="Dialog",[Y0]=Ns(ud),[AA,ss]=Y0(ud),F0=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:l,onOpenChange:r,modal:i=!0}=e,o=u.useRef(null),c=u.useRef(null),[d,f]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:ud});return s.jsx(AA,{scope:t,triggerRef:o,contentRef:c,contentId:Xn(),titleId:Xn(),descriptionId:Xn(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(h=>!h),[f]),modal:i,children:n})};F0.displayName=ud;var K0="DialogTrigger",MA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=ss(K0,n),r=Ie(t,l.triggerRef);return s.jsx(Ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.contentId,"data-state":Sp(l.open),...a,ref:r,onClick:ue(e.onClick,l.onOpenToggle)})});MA.displayName=K0;var Np="DialogPortal",[OA,X0]=Y0(Np,{forceMount:void 0}),Q0=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:l}=e,r=ss(Np,t);return s.jsx(OA,{scope:t,forceMount:n,children:u.Children.map(a,i=>s.jsx(zn,{present:n||r.open,children:s.jsx(So,{asChild:!0,container:l,children:i})}))})};Q0.displayName=Np;var vu="DialogOverlay",Z0=u.forwardRef((e,t)=>{const n=X0(vu,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=ss(vu,e.__scopeDialog);return r.modal?s.jsx(zn,{present:a||r.open,children:s.jsx(DA,{...l,ref:t})}):null});Z0.displayName=vu;var $A=ul("DialogOverlay.RemoveScroll"),DA=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=ss(vu,n);return s.jsx(cd,{as:$A,allowPinchZoom:!0,shards:[l.contentRef],children:s.jsx(Ne.div,{"data-state":Sp(l.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),dl="DialogContent",W0=u.forwardRef((e,t)=>{const n=X0(dl,e.__scopeDialog),{forceMount:a=n.forceMount,...l}=e,r=ss(dl,e.__scopeDialog);return s.jsx(zn,{present:a||r.open,children:r.modal?s.jsx(zA,{...l,ref:t}):s.jsx(LA,{...l,ref:t})})});W0.displayName=dl;var zA=u.forwardRef((e,t)=>{const n=ss(dl,e.__scopeDialog),a=u.useRef(null),l=Ie(t,n.contentRef,a);return u.useEffect(()=>{const r=a.current;if(r)return _p(r)},[]),s.jsx(J0,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ue(e.onCloseAutoFocus,r=>{var i;r.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ue(e.onPointerDownOutside,r=>{const i=r.detail.originalEvent,o=i.button===0&&i.ctrlKey===!0;(i.button===2||o)&&r.preventDefault()}),onFocusOutside:ue(e.onFocusOutside,r=>r.preventDefault())})}),LA=u.forwardRef((e,t)=>{const n=ss(dl,e.__scopeDialog),a=u.useRef(!1),l=u.useRef(!1);return s.jsx(J0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,r),r.defaultPrevented||(a.current||(o=n.triggerRef.current)==null||o.focus(),r.preventDefault()),a.current=!1,l.current=!1},onInteractOutside:r=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(l.current=!0));const i=r.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&l.current&&r.preventDefault()}})}),J0=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:r,...i}=e,o=ss(dl,n),c=u.useRef(null),d=Ie(t,c);return wp(),s.jsxs(s.Fragment,{children:[s.jsx(id,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:l,onUnmountAutoFocus:r,children:s.jsx(ko,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":Sp(o.open),...i,ref:d,onDismiss:()=>o.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(UA,{titleId:o.titleId}),s.jsx(HA,{contentRef:c,descriptionId:o.descriptionId})]})]})}),kp="DialogTitle",ew=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=ss(kp,n);return s.jsx(Ne.h2,{id:l.titleId,...a,ref:t})});ew.displayName=kp;var tw="DialogDescription",nw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=ss(tw,n);return s.jsx(Ne.p,{id:l.descriptionId,...a,ref:t})});nw.displayName=tw;var sw="DialogClose",aw=u.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,l=ss(sw,n);return s.jsx(Ne.button,{type:"button",...a,ref:t,onClick:ue(e.onClick,()=>l.onOpenChange(!1))})});aw.displayName=sw;function Sp(e){return e?"open":"closed"}var lw="DialogTitleWarning",[x5,rw]=hE(lw,{contentName:dl,titleName:kp,docsSlug:"dialog"}),UA=({titleId:e})=>{const t=rw(lw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
380
+
381
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
382
+
383
+ 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},BA="DialogDescriptionWarning",HA=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${rw(BA).contentName}}.`;return u.useEffect(()=>{var r;const l=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");t&&l&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},iw=F0,ow=Q0,cw=Z0,uw=W0,dw=ew,fw=nw,Cp=aw;function bn({className:e,...t}){return s.jsx(BR,{role:"status","aria-label":"Loading",className:ie("size-4 animate-spin",e),...t})}const lr="aria-pressed:border aria-pressed:border-primary aria-pressed:bg-accent aria-pressed:text-accent-foreground",IA="border border-primary bg-accent text-accent-foreground hover:bg-accent",dd=No("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"}}),G=u.forwardRef(({className:e,disabled:t,variant:n,size:a,asChild:l=!1,loading:r,children:i,...o},c)=>{const d=l?bE:"button",f=a==="icon"||a==="sm-icon"||a==="control-icon"||a==="xs-icon",h=s.jsx(bn,{"aria-hidden":"true","aria-label":void 0,role:void 0,className:ie(!f&&"mr-2")}),m=l?i:r&&f?h:s.jsxs(s.Fragment,{children:[r?h:null,i]});return s.jsx(d,{className:ie(dd({variant:n,size:a,className:e})),ref:c,disabled:t||r,...o,children:m})});G.displayName="Button";const hw=u.createContext(null);function PA({container:e,children:t}){return s.jsx(hw.Provider,{value:e,children:t})}function Co(){return u.useContext(hw)??void 0}function mw(e){return s.jsx(iw,{"data-slot":"alert-dialog",...e})}function qA({className:e,...t}){return s.jsx(cw,{"data-slot":"alert-dialog-overlay",className:ie("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 pw({className:e,onOpenAutoFocus:t,onPointerDownOutside:n,onInteractOutside:a,...l}){return s.jsxs(ow,{container:Co(),children:[s.jsx(qA,{}),s.jsx(uw,{"data-slot":"alert-dialog-content",role:"alertdialog",className:ie("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:r=>{if(t==null||t(r),r.defaultPrevented)return;const i=r.currentTarget,o=i instanceof HTMLElement?i.querySelector('[data-slot="alert-dialog-cancel"]'):null;o&&(r.preventDefault(),o.focus())},onPointerDownOutside:r=>{n==null||n(r),r.preventDefault()},onInteractOutside:r=>{a==null||a(r),r.preventDefault()},...l})]})}function xw({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gw({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function vw({className:e,...t}){return s.jsx(dw,{"data-slot":"alert-dialog-title",className:ie("text-lg font-semibold",e),...t})}function yw({className:e,...t}){return s.jsx(fw,{"data-slot":"alert-dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function bw({className:e,variant:t,...n}){return s.jsx(Cp,{"data-slot":"alert-dialog-action",className:ie(dd({variant:t}),e),...n})}function jw({className:e,...t}){return s.jsx(Cp,{"data-slot":"alert-dialog-cancel",className:ie(dd({variant:"outline"}),e),...t})}function GA(){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 VA(e,t){t!=null&&t.isConnected&&(e.preventDefault(),t.focus())}function Ro(){const[e,t]=u.useState(null),n=u.useRef(null),a=u.useRef(null),l=u.useCallback(o=>{var c;(c=n.current)==null||c.resolve(o),n.current=null,t(null)},[]),r=u.useCallback(o=>new Promise(c=>{var f;(f=n.current)==null||f.resolve(!1),a.current=GA();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(mw,{open:e!==null,onOpenChange:o=>{o||l(!1)},children:s.jsxs(pw,{onCloseAutoFocus:o=>VA(o,a.current),children:[s.jsxs(xw,{children:[s.jsx(vw,{children:e==null?void 0:e.title}),s.jsx(yw,{className:"whitespace-pre-line",children:e==null?void 0:e.description})]}),s.jsxs(gw,{children:[s.jsx(jw,{children:"Cancel"}),s.jsx(bw,{variant:e!=null&&e.destructive?"destructive":"default",onClick:()=>l(!0),children:e==null?void 0:e.action_label})]})]})});return{confirm:r,confirm_dialog:i}}const As="px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",YA=No("inline-flex items-center rounded-md border transition-colors",{variants:{variant:{default:`${As} border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80`,secondary:`${As} border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`${As} border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80`,outline:`${As} text-foreground`,success:`${As} border-success/40 bg-success/10 text-success`,warning:`${As} border-warning/40 bg-warning/10 text-warning`,info:`${As} border-info/40 bg-info/10 text-info`,error:`${As} border-destructive/40 bg-destructive/10 text-destructive`,neutral:`${As} 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 me({className:e,variant:t,size:n,...a}){return s.jsx("div",{className:ie(YA({variant:t,size:n}),e),...a})}function ww(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 _w(e){const[t,n]=u.useState(void 0);return Ht(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(l=>{if(!Array.isArray(l)||!l.length)return;const r=l[0];let i,o;if("borderBoxSize"in r){const c=r.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 fd="Checkbox",[FA]=Ns(fd),[KA,Rp]=FA(fd);function XA(e){const{__scopeCheckbox:t,checked:n,children:a,defaultChecked:l,disabled:r,form:i,name:o,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:h}=e,[m,x]=Oa({prop:n,defaultProp:l??!1,onChange:c,caller:fd}),[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useRef(!1),b=j?!!i||!!j.closest("form"):!0,w={checked:m,disabled:r,setChecked:x,control:j,setControl:v,name:o,form:i,value:f,hasConsumerStoppedPropagationRef:p,required:d,defaultChecked:Ta(l)?!1:l,isFormControl:b,bubbleInput:y,setBubbleInput:g};return s.jsx(KA,{scope:t,...w,children:QA(h)?h(w):a})}var Nw="CheckboxTrigger",kw=u.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...a},l)=>{const{control:r,value:i,disabled:o,checked:c,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:j}=Rp(Nw,e),v=Ie(l,f),y=u.useRef(c);return u.useEffect(()=>{const g=r==null?void 0:r.form;if(g){const p=()=>h(y.current);return g.addEventListener("reset",p),()=>g.removeEventListener("reset",p)}},[r,h]),s.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":Ta(c)?"mixed":c,"aria-required":d,"data-state":Ew(c),"data-disabled":o?"":void 0,disabled:o,value:i,...a,ref:v,onKeyDown:ue(t,g=>{g.key==="Enter"&&g.preventDefault()}),onClick:ue(n,g=>{h(p=>Ta(p)?!0:!p),j&&x&&(m.current=g.isPropagationStopped(),m.current||g.stopPropagation())})})});kw.displayName=Nw;var Tp=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:a,checked:l,defaultChecked:r,required:i,disabled:o,value:c,onCheckedChange:d,form:f,...h}=e;return s.jsx(XA,{__scopeCheckbox:n,checked:l,defaultChecked:r,disabled:o,required:i,onCheckedChange:d,name:a,form:f,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(kw,{...h,ref:t,__scopeCheckbox:n}),m&&s.jsx(Tw,{__scopeCheckbox:n})]})})});Tp.displayName=fd;var Sw="CheckboxIndicator",Cw=u.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:a,...l}=e,r=Rp(Sw,n);return s.jsx(zn,{present:a||Ta(r.checked)||r.checked===!0,children:s.jsx(Ne.span,{"data-state":Ew(r.checked),"data-disabled":r.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});Cw.displayName=Sw;var Rw="CheckboxBubbleInput",Tw=u.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:a,hasConsumerStoppedPropagationRef:l,checked:r,defaultChecked:i,required:o,disabled:c,name:d,value:f,form:h,bubbleInput:m,setBubbleInput:x}=Rp(Rw,e),j=Ie(n,x),v=ww(r),y=_w(a);u.useEffect(()=>{const p=m;if(!p)return;const b=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(b,"checked").set,R=!l.current;if(v!==r&&N){const _=new Event("click",{bubbles:R});p.indeterminate=Ta(r),N.call(p,Ta(r)?!1:r),p.dispatchEvent(_)}},[m,v,r,l]);const g=u.useRef(Ta(r)?!1:r);return s.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??g.current,required:o,disabled:c,name:d,value:f,form:h,...t,tabIndex:-1,ref:j,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Tw.displayName=Rw;function QA(e){return typeof e=="function"}function Ta(e){return e==="indeterminate"}function Ew(e){return Ta(e)?"indeterminate":e?"checked":"unchecked"}const Lr=u.forwardRef(({className:e,...t},n)=>s.jsx(Tp,{ref:n,className:ie("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(Cw,{className:ie("flex items-center justify-center text-current"),children:t.checked==="indeterminate"?s.jsx(VR,{className:"size-4","aria-hidden":"true"}):s.jsx(Or,{className:"size-4","aria-hidden":"true"})})}));Lr.displayName=Tp.displayName;const ZA=No("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 Ln({...e}){return s.jsx(iw,{"data-slot":"dialog",...e})}function WA({...e}){const t=Co();return s.jsx(ow,{"data-slot":"dialog-portal",container:t,...e})}function JA({className:e,...t}){return s.jsx(cw,{"data-slot":"dialog-overlay",className:ie("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 Un({className:e,children:t,showCloseButton:n=!0,size:a,...l}){return s.jsxs(WA,{"data-slot":"dialog-portal",children:[s.jsx(JA,{}),s.jsxs(uw,{"data-slot":"dialog-content",className:ie(ZA({size:a}),e),...l,children:[t,n&&s.jsxs(Cp,{"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(ad,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Bn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:ie("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Hn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-footer",className:ie("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function In({className:e,...t}){return s.jsx(dw,{"data-slot":"dialog-title",className:ie("text-lg leading-none font-semibold",e),...t})}function Pn({className:e,...t}){return s.jsx(fw,{"data-slot":"dialog-description",className:ie("text-muted-foreground text-sm",e),...t})}function Ep(e){const t=e+"CollectionProvider",[n,a]=Ns(t),[l,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=v=>{const{scope:y,children:g}=v,p=ra.useRef(null),b=ra.useRef(new Map).current;return s.jsx(l,{scope:y,itemMap:b,collectionRef:p,children:g})};i.displayName=t;const o=e+"CollectionSlot",c=ul(o),d=ra.forwardRef((v,y)=>{const{scope:g,children:p}=v,b=r(o,g),w=Ie(y,b.collectionRef);return s.jsx(c,{ref:w,children:p})});d.displayName=o;const f=e+"CollectionItemSlot",h="data-radix-collection-item",m=ul(f),x=ra.forwardRef((v,y)=>{const{scope:g,children:p,...b}=v,w=ra.useRef(null),N=Ie(y,w),R=r(f,g);return ra.useEffect(()=>(R.itemMap.set(w,{ref:w,...b}),()=>void R.itemMap.delete(w))),s.jsx(m,{[h]:"",ref:N,children:p})});x.displayName=f;function j(v){const y=r(e+"CollectionConsumer",v);return ra.useCallback(()=>{const p=y.collectionRef.current;if(!p)return[];const b=Array.from(p.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((R,_)=>b.indexOf(R.ref.current)-b.indexOf(_.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},j,a]}var eM=u.createContext(void 0);function hd(e){const t=u.useContext(eM);return e||t||"ltr"}const tM=["top","right","bottom","left"],$a=Math.min,fn=Math.max,yu=Math.round,cc=Math.floor,vs=e=>({x:e,y:e}),nM={left:"right",right:"left",bottom:"top",top:"bottom"},sM={start:"end",end:"start"};function Kh(e,t,n){return fn(e,$a(t,n))}function Ys(e,t){return typeof e=="function"?e(t):e}function Fs(e){return e.split("-")[0]}function Ur(e){return e.split("-")[1]}function Ap(e){return e==="x"?"y":"x"}function Mp(e){return e==="y"?"height":"width"}function hs(e){return["top","bottom"].includes(Fs(e))?"y":"x"}function Op(e){return Ap(hs(e))}function aM(e,t,n){n===void 0&&(n=!1);const a=Ur(e),l=Op(e),r=Mp(l);let i=l==="x"?a===(n?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=bu(i)),[i,bu(i)]}function lM(e){const t=bu(e);return[Xh(e),t,Xh(t)]}function Xh(e){return e.replace(/start|end/g,t=>sM[t])}function rM(e,t,n){const a=["left","right"],l=["right","left"],r=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?l:a:t?a:l;case"left":case"right":return t?r:i;default:return[]}}function iM(e,t,n,a){const l=Ur(e);let r=rM(Fs(e),n==="start",a);return l&&(r=r.map(i=>i+"-"+l),t&&(r=r.concat(r.map(Xh)))),r}function bu(e){return e.replace(/left|right|bottom|top/g,t=>nM[t])}function oM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aw(e){return typeof e!="number"?oM(e):{top:e,right:e,bottom:e,left:e}}function ju(e){const{x:t,y:n,width:a,height:l}=e;return{width:a,height:l,top:n,left:t,right:t+a,bottom:n+l,x:t,y:n}}function wv(e,t,n){let{reference:a,floating:l}=e;const r=hs(t),i=Op(t),o=Mp(i),c=Fs(t),d=r==="y",f=a.x+a.width/2-l.width/2,h=a.y+a.height/2-l.height/2,m=a[o]/2-l[o]/2;let x;switch(c){case"top":x={x:f,y:a.y-l.height};break;case"bottom":x={x:f,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:h};break;case"left":x={x:a.x-l.width,y:h};break;default:x={x:a.x,y:a.y}}switch(Ur(t)){case"start":x[i]-=m*(n&&d?-1:1);break;case"end":x[i]+=m*(n&&d?-1:1);break}return x}const cM=async(e,t,n)=>{const{placement:a="bottom",strategy:l="absolute",middleware:r=[],platform:i}=n,o=r.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:l}),{x:f,y:h}=wv(d,a,c),m=a,x={},j=0;for(let v=0;v<o.length;v++){const{name:y,fn:g}=o[v],{x:p,y:b,data:w,reset:N}=await g({x:f,y:h,initialPlacement:a,placement:m,strategy:l,middlewareData:x,rects:d,platform:i,elements:{reference:e,floating:t}});f=p??f,h=b??h,x={...x,[y]:{...x[y],...w}},N&&j<=50&&(j++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:l}):N.rects),{x:f,y:h}=wv(d,m,c)),v=-1)}return{x:f,y:h,placement:m,strategy:l,middlewareData:x}};async function Ki(e,t){var n;t===void 0&&(t={});const{x:a,y:l,platform:r,rects:i,elements:o,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=Ys(t,e),j=Aw(x),y=o[m?h==="floating"?"reference":"floating":h],g=ju(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(y)))==null||n?y:y.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(o.floating)),boundary:d,rootBoundary:f,strategy:c})),p=h==="floating"?{x:a,y:l,width:i.floating.width,height:i.floating.height}:i.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(o.floating)),w=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},N=ju(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:p,offsetParent:b,strategy:c}):p);return{top:(g.top-N.top+j.top)/w.y,bottom:(N.bottom-g.bottom+j.bottom)/w.y,left:(g.left-N.left+j.left)/w.x,right:(N.right-g.right+j.right)/w.x}}const uM=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:a,placement:l,rects:r,platform:i,elements:o,middlewareData:c}=t,{element:d,padding:f=0}=Ys(e,t)||{};if(d==null)return{};const h=Aw(f),m={x:n,y:a},x=Op(l),j=Mp(x),v=await i.getDimensions(d),y=x==="y",g=y?"top":"left",p=y?"bottom":"right",b=y?"clientHeight":"clientWidth",w=r.reference[j]+r.reference[x]-m[x]-r.floating[j],N=m[x]-r.reference[x],R=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=R?R[b]:0;(!_||!await(i.isElement==null?void 0:i.isElement(R)))&&(_=o.floating[b]||r.floating[j]);const k=w/2-N/2,L=_/2-v[j]/2-1,z=$a(h[g],L),X=$a(h[p],L),V=z,U=_-v[j]-X,M=_/2-v[j]/2+k,A=Kh(V,M,U),S=!c.arrow&&Ur(l)!=null&&M!==A&&r.reference[j]/2-(M<V?z:X)-v[j]/2<0,E=S?M<V?M-V:M-U:0;return{[x]:m[x]+E,data:{[x]:A,centerOffset:M-A-E,...S&&{alignmentOffset:E}},reset:S}}}),dM=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,a;const{placement:l,middlewareData:r,rects:i,initialPlacement:o,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:v=!0,...y}=Ys(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const g=Fs(l),p=hs(o),b=Fs(o)===o,w=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(b||!v?[bu(o)]:lM(o)),R=j!=="none";!m&&R&&N.push(...iM(o,v,j,w));const _=[o,...N],k=await Ki(t,y),L=[];let z=((a=r.flip)==null?void 0:a.overflows)||[];if(f&&L.push(k[g]),h){const M=aM(l,i,w);L.push(k[M[0]],k[M[1]])}if(z=[...z,{placement:l,overflows:L}],!L.every(M=>M<=0)){var X,V;const M=(((X=r.flip)==null?void 0:X.index)||0)+1,A=_[M];if(A&&(!(h==="alignment"?p!==hs(A):!1)||z.every(C=>C.overflows[0]>0&&hs(C.placement)===p)))return{data:{index:M,overflows:z},reset:{placement:A}};let S=(V=z.filter(E=>E.overflows[0]<=0).sort((E,C)=>E.overflows[1]-C.overflows[1])[0])==null?void 0:V.placement;if(!S)switch(x){case"bestFit":{var U;const E=(U=z.filter(C=>{if(R){const $=hs(C.placement);return $===p||$==="y"}return!0}).map(C=>[C.placement,C.overflows.filter($=>$>0).reduce(($,F)=>$+F,0)]).sort((C,$)=>C[1]-$[1])[0])==null?void 0:U[0];E&&(S=E);break}case"initialPlacement":S=o;break}if(l!==S)return{reset:{placement:S}}}return{}}}};function _v(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nv(e){return tM.some(t=>e[t]>=0)}const fM=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:a="referenceHidden",...l}=Ys(e,t);switch(a){case"referenceHidden":{const r=await Ki(t,{...l,elementContext:"reference"}),i=_v(r,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Nv(i)}}}case"escaped":{const r=await Ki(t,{...l,altBoundary:!0}),i=_v(r,n.floating);return{data:{escapedOffsets:i,escaped:Nv(i)}}}default:return{}}}}};async function hM(e,t){const{placement:n,platform:a,elements:l}=e,r=await(a.isRTL==null?void 0:a.isRTL(l.floating)),i=Fs(n),o=Ur(n),c=hs(n)==="y",d=["left","top"].includes(i)?-1:1,f=r&&c?-1:1,h=Ys(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof j=="number"&&(x=o==="end"?j*-1:j),c?{x:x*f,y:m*d}:{x:m*d,y:x*f}}const mM=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,a;const{x:l,y:r,placement:i,middlewareData:o}=t,c=await hM(t,e);return i===((n=o.offset)==null?void 0:n.placement)&&(a=o.arrow)!=null&&a.alignmentOffset?{}:{x:l+c.x,y:r+c.y,data:{...c,placement:i}}}}},pM=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:a,placement:l}=t,{mainAxis:r=!0,crossAxis:i=!1,limiter:o={fn:y=>{let{x:g,y:p}=y;return{x:g,y:p}}},...c}=Ys(e,t),d={x:n,y:a},f=await Ki(t,c),h=hs(Fs(l)),m=Ap(h);let x=d[m],j=d[h];if(r){const y=m==="y"?"top":"left",g=m==="y"?"bottom":"right",p=x+f[y],b=x-f[g];x=Kh(p,x,b)}if(i){const y=h==="y"?"top":"left",g=h==="y"?"bottom":"right",p=j+f[y],b=j-f[g];j=Kh(p,j,b)}const v=o.fn({...t,[m]:x,[h]:j});return{...v,data:{x:v.x-n,y:v.y-a,enabled:{[m]:r,[h]:i}}}}}},xM=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:a,placement:l,rects:r,middlewareData:i}=t,{offset:o=0,mainAxis:c=!0,crossAxis:d=!0}=Ys(e,t),f={x:n,y:a},h=hs(l),m=Ap(h);let x=f[m],j=f[h];const v=Ys(o,t),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(c){const b=m==="y"?"height":"width",w=r.reference[m]-r.floating[b]+y.mainAxis,N=r.reference[m]+r.reference[b]-y.mainAxis;x<w?x=w:x>N&&(x=N)}if(d){var g,p;const b=m==="y"?"width":"height",w=["top","left"].includes(Fs(l)),N=r.reference[h]-r.floating[b]+(w&&((g=i.offset)==null?void 0:g[h])||0)+(w?0:y.crossAxis),R=r.reference[h]+r.reference[b]+(w?0:((p=i.offset)==null?void 0:p[h])||0)-(w?y.crossAxis:0);j<N?j=N:j>R&&(j=R)}return{[m]:x,[h]:j}}}},gM=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,a;const{placement:l,rects:r,platform:i,elements:o}=t,{apply:c=()=>{},...d}=Ys(e,t),f=await Ki(t,d),h=Fs(l),m=Ur(l),x=hs(l)==="y",{width:j,height:v}=r.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=m===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(g=h,y=m==="end"?"top":"bottom");const p=v-f.top-f.bottom,b=j-f.left-f.right,w=$a(v-f[y],p),N=$a(j-f[g],b),R=!t.middlewareData.shift;let _=w,k=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=b),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=p),R&&!m){const z=fn(f.left,0),X=fn(f.right,0),V=fn(f.top,0),U=fn(f.bottom,0);x?k=j-2*(z!==0||X!==0?z+X:fn(f.left,f.right)):_=v-2*(V!==0||U!==0?V+U:fn(f.top,f.bottom))}await c({...t,availableWidth:k,availableHeight:_});const L=await i.getDimensions(o.floating);return j!==L.width||v!==L.height?{reset:{rects:!0}}:{}}}};function md(){return typeof window<"u"}function Br(e){return Mw(e)?(e.nodeName||"").toLowerCase():"#document"}function vn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ks(e){var t;return(t=(Mw(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mw(e){return md()?e instanceof Node||e instanceof vn(e).Node:!1}function Wn(e){return md()?e instanceof Element||e instanceof vn(e).Element:!1}function js(e){return md()?e instanceof HTMLElement||e instanceof vn(e).HTMLElement:!1}function kv(e){return!md()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vn(e).ShadowRoot}function To(e){const{overflow:t,overflowX:n,overflowY:a,display:l}=Jn(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+n)&&!["inline","contents"].includes(l)}function vM(e){return["table","td","th"].includes(Br(e))}function pd(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function $p(e){const t=Dp(),n=Wn(e)?Jn(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 yM(e){let t=Da(e);for(;js(t)&&!jr(t);){if($p(t))return t;if(pd(t))return null;t=Da(t)}return null}function Dp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function jr(e){return["html","body","#document"].includes(Br(e))}function Jn(e){return vn(e).getComputedStyle(e)}function xd(e){return Wn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Da(e){if(Br(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kv(e)&&e.host||ks(e);return kv(t)?t.host:t}function Ow(e){const t=Da(e);return jr(t)?e.ownerDocument?e.ownerDocument.body:e.body:js(t)&&To(t)?t:Ow(t)}function Xi(e,t,n){var a;t===void 0&&(t=[]),n===void 0&&(n=!0);const l=Ow(e),r=l===((a=e.ownerDocument)==null?void 0:a.body),i=vn(l);if(r){const o=Qh(i);return t.concat(i,i.visualViewport||[],To(l)?l:[],o&&n?Xi(o):[])}return t.concat(l,Xi(l,[],n))}function Qh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $w(e){const t=Jn(e);let n=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const l=js(e),r=l?e.offsetWidth:n,i=l?e.offsetHeight:a,o=yu(n)!==r||yu(a)!==i;return o&&(n=r,a=i),{width:n,height:a,$:o}}function zp(e){return Wn(e)?e:e.contextElement}function rr(e){const t=zp(e);if(!js(t))return vs(1);const n=t.getBoundingClientRect(),{width:a,height:l,$:r}=$w(t);let i=(r?yu(n.width):n.width)/a,o=(r?yu(n.height):n.height)/l;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const bM=vs(0);function Dw(e){const t=vn(e);return!Dp()||!t.visualViewport?bM:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jM(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==vn(e)?!1:t}function fl(e,t,n,a){t===void 0&&(t=!1),n===void 0&&(n=!1);const l=e.getBoundingClientRect(),r=zp(e);let i=vs(1);t&&(a?Wn(a)&&(i=rr(a)):i=rr(e));const o=jM(r,n,a)?Dw(r):vs(0);let c=(l.left+o.x)/i.x,d=(l.top+o.y)/i.y,f=l.width/i.x,h=l.height/i.y;if(r){const m=vn(r),x=a&&Wn(a)?vn(a):a;let j=m,v=Qh(j);for(;v&&a&&x!==j;){const y=rr(v),g=v.getBoundingClientRect(),p=Jn(v),b=g.left+(v.clientLeft+parseFloat(p.paddingLeft))*y.x,w=g.top+(v.clientTop+parseFloat(p.paddingTop))*y.y;c*=y.x,d*=y.y,f*=y.x,h*=y.y,c+=b,d+=w,j=vn(v),v=Qh(j)}}return ju({width:f,height:h,x:c,y:d})}function Lp(e,t){const n=xd(e).scrollLeft;return t?t.left+n:fl(ks(e)).left+n}function zw(e,t,n){n===void 0&&(n=!1);const a=e.getBoundingClientRect(),l=a.left+t.scrollLeft-(n?0:Lp(e,a)),r=a.top+t.scrollTop;return{x:l,y:r}}function wM(e){let{elements:t,rect:n,offsetParent:a,strategy:l}=e;const r=l==="fixed",i=ks(a),o=t?pd(t.floating):!1;if(a===i||o&&r)return n;let c={scrollLeft:0,scrollTop:0},d=vs(1);const f=vs(0),h=js(a);if((h||!h&&!r)&&((Br(a)!=="body"||To(i))&&(c=xd(a)),js(a))){const x=fl(a);d=rr(a),f.x=x.x+a.clientLeft,f.y=x.y+a.clientTop}const m=i&&!h&&!r?zw(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+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function _M(e){return Array.from(e.getClientRects())}function NM(e){const t=ks(e),n=xd(e),a=e.ownerDocument.body,l=fn(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),r=fn(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-n.scrollLeft+Lp(e);const o=-n.scrollTop;return Jn(a).direction==="rtl"&&(i+=fn(t.clientWidth,a.clientWidth)-l),{width:l,height:r,x:i,y:o}}function kM(e,t){const n=vn(e),a=ks(e),l=n.visualViewport;let r=a.clientWidth,i=a.clientHeight,o=0,c=0;if(l){r=l.width,i=l.height;const d=Dp();(!d||d&&t==="fixed")&&(o=l.offsetLeft,c=l.offsetTop)}return{width:r,height:i,x:o,y:c}}function SM(e,t){const n=fl(e,!0,t==="fixed"),a=n.top+e.clientTop,l=n.left+e.clientLeft,r=js(e)?rr(e):vs(1),i=e.clientWidth*r.x,o=e.clientHeight*r.y,c=l*r.x,d=a*r.y;return{width:i,height:o,x:c,y:d}}function Sv(e,t,n){let a;if(t==="viewport")a=kM(e,n);else if(t==="document")a=NM(ks(e));else if(Wn(t))a=SM(t,n);else{const l=Dw(e);a={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return ju(a)}function Lw(e,t){const n=Da(e);return n===t||!Wn(n)||jr(n)?!1:Jn(n).position==="fixed"||Lw(n,t)}function CM(e,t){const n=t.get(e);if(n)return n;let a=Xi(e,[],!1).filter(o=>Wn(o)&&Br(o)!=="body"),l=null;const r=Jn(e).position==="fixed";let i=r?Da(e):e;for(;Wn(i)&&!jr(i);){const o=Jn(i),c=$p(i);!c&&o.position==="fixed"&&(l=null),(r?!c&&!l:!c&&o.position==="static"&&!!l&&["absolute","fixed"].includes(l.position)||To(i)&&!c&&Lw(e,i))?a=a.filter(f=>f!==i):l=o,i=Da(i)}return t.set(e,a),a}function RM(e){let{element:t,boundary:n,rootBoundary:a,strategy:l}=e;const i=[...n==="clippingAncestors"?pd(t)?[]:CM(t,this._c):[].concat(n),a],o=i[0],c=i.reduce((d,f)=>{const h=Sv(t,f,l);return d.top=fn(h.top,d.top),d.right=$a(h.right,d.right),d.bottom=$a(h.bottom,d.bottom),d.left=fn(h.left,d.left),d},Sv(t,o,l));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function TM(e){const{width:t,height:n}=$w(e);return{width:t,height:n}}function EM(e,t,n){const a=js(t),l=ks(t),r=n==="fixed",i=fl(e,!0,r,t);let o={scrollLeft:0,scrollTop:0};const c=vs(0);function d(){c.x=Lp(l)}if(a||!a&&!r)if((Br(t)!=="body"||To(l))&&(o=xd(t)),a){const x=fl(t,!0,r,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else l&&d();r&&!a&&l&&d();const f=l&&!a&&!r?zw(l,o):vs(0),h=i.left+o.scrollLeft-c.x-f.x,m=i.top+o.scrollTop-c.y-f.y;return{x:h,y:m,width:i.width,height:i.height}}function Ef(e){return Jn(e).position==="static"}function Cv(e,t){if(!js(e)||Jn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ks(e)===n&&(n=n.ownerDocument.body),n}function Uw(e,t){const n=vn(e);if(pd(e))return n;if(!js(e)){let l=Da(e);for(;l&&!jr(l);){if(Wn(l)&&!Ef(l))return l;l=Da(l)}return n}let a=Cv(e,t);for(;a&&vM(a)&&Ef(a);)a=Cv(a,t);return a&&jr(a)&&Ef(a)&&!$p(a)?n:a||yM(e)||n}const AM=async function(e){const t=this.getOffsetParent||Uw,n=this.getDimensions,a=await n(e.floating);return{reference:EM(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function MM(e){return Jn(e).direction==="rtl"}const OM={convertOffsetParentRelativeRectToViewportRelativeRect:wM,getDocumentElement:ks,getClippingRect:RM,getOffsetParent:Uw,getElementRects:AM,getClientRects:_M,getDimensions:TM,getScale:rr,isElement:Wn,isRTL:MM};function Bw(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function $M(e,t){let n=null,a;const l=ks(e);function r(){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),r();const d=e.getBoundingClientRect(),{left:f,top:h,width:m,height:x}=d;if(o||t(),!m||!x)return;const j=cc(h),v=cc(l.clientWidth-(f+m)),y=cc(l.clientHeight-(h+x)),g=cc(f),b={rootMargin:-j+"px "+-v+"px "+-y+"px "+-g+"px",threshold:fn(0,$a(1,c))||1};let w=!0;function N(R){const _=R[0].intersectionRatio;if(_!==c){if(!w)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!Bw(d,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(N,{...b,root:l.ownerDocument})}catch{n=new IntersectionObserver(N,b)}n.observe(e)}return i(!0),r}function DM(e,t,n,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=zp(e),f=l||r?[...d?Xi(d):[],...Xi(t)]:[];f.forEach(g=>{l&&g.addEventListener("scroll",n,{passive:!0}),r&&g.addEventListener("resize",n)});const h=d&&o?$M(d,n):null;let m=-1,x=null;i&&(x=new ResizeObserver(g=>{let[p]=g;p&&p.target===d&&x&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=x)==null||b.observe(t)})),n()}),d&&!c&&x.observe(d),x.observe(t));let j,v=c?fl(e):null;c&&y();function y(){const g=fl(e);v&&!Bw(v,g)&&n(),v=g,j=requestAnimationFrame(y)}return n(),()=>{var g;f.forEach(p=>{l&&p.removeEventListener("scroll",n),r&&p.removeEventListener("resize",n)}),h==null||h(),(g=x)==null||g.disconnect(),x=null,c&&cancelAnimationFrame(j)}}const zM=mM,LM=pM,UM=dM,BM=gM,HM=fM,Rv=uM,IM=xM,PM=(e,t,n)=>{const a=new Map,l={platform:OM,...n},r={...l.platform,_c:a};return cM(e,t,{...l,platform:r})};var qM=typeof document<"u",GM=function(){},Oc=qM?u.useLayoutEffect:GM;function wu(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,l;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(!wu(e[a],t[a]))return!1;return!0}if(l=Object.keys(e),n=l.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!{}.hasOwnProperty.call(t,l[a]))return!1;for(a=n;a--!==0;){const r=l[a];if(!(r==="_owner"&&e.$$typeof)&&!wu(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function Hw(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tv(e,t){const n=Hw(e);return Math.round(t*n)/n}function Af(e){const t=u.useRef(e);return Oc(()=>{t.current=e}),t}function VM(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:a=[],platform:l,elements:{reference:r,floating:i}={},transform:o=!0,whileElementsMounted:c,open:d}=e,[f,h]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=u.useState(a);wu(m,a)||x(a);const[j,v]=u.useState(null),[y,g]=u.useState(null),p=u.useCallback(C=>{C!==R.current&&(R.current=C,v(C))},[]),b=u.useCallback(C=>{C!==_.current&&(_.current=C,g(C))},[]),w=r||j,N=i||y,R=u.useRef(null),_=u.useRef(null),k=u.useRef(f),L=c!=null,z=Af(c),X=Af(l),V=Af(d),U=u.useCallback(()=>{if(!R.current||!_.current)return;const C={placement:t,strategy:n,middleware:m};X.current&&(C.platform=X.current),PM(R.current,_.current,C).then($=>{const F={...$,isPositioned:V.current!==!1};M.current&&!wu(k.current,F)&&(k.current=F,kr.flushSync(()=>{h(F)}))})},[m,t,n,X,V]);Oc(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(C=>({...C,isPositioned:!1})))},[d]);const M=u.useRef(!1);Oc(()=>(M.current=!0,()=>{M.current=!1}),[]),Oc(()=>{if(w&&(R.current=w),N&&(_.current=N),w&&N){if(z.current)return z.current(w,N,U);U()}},[w,N,U,z,L]);const A=u.useMemo(()=>({reference:R,floating:_,setReference:p,setFloating:b}),[p,b]),S=u.useMemo(()=>({reference:w,floating:N}),[w,N]),E=u.useMemo(()=>{const C={position:n,left:0,top:0};if(!S.floating)return C;const $=Tv(S.floating,f.x),F=Tv(S.floating,f.y);return o?{...C,transform:"translate("+$+"px, "+F+"px)",...Hw(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:F}},[n,o,S.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:U,refs:A,elements:S,floatingStyles:E}),[f,U,A,S,E])}const YM=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:a,padding:l}=typeof e=="function"?e(n):e;return a&&t(a)?a.current!=null?Rv({element:a.current,padding:l}).fn(n):{}:a?Rv({element:a,padding:l}).fn(n):{}}}},FM=(e,t)=>({...zM(e),options:[e,t]}),KM=(e,t)=>({...LM(e),options:[e,t]}),XM=(e,t)=>({...IM(e),options:[e,t]}),QM=(e,t)=>({...UM(e),options:[e,t]}),ZM=(e,t)=>({...BM(e),options:[e,t]}),WM=(e,t)=>({...HM(e),options:[e,t]}),JM=(e,t)=>({...YM(e),options:[e,t]});var eO="Arrow",Iw=u.forwardRef((e,t)=>{const{children:n,width:a=10,height:l=5,...r}=e;return s.jsx(Ne.svg,{...r,ref:t,width:a,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});Iw.displayName=eO;var tO=Iw,Up="Popper",[Pw,Hr]=Ns(Up),[nO,qw]=Pw(Up),Gw=e=>{const{__scopePopper:t,children:n}=e,[a,l]=u.useState(null);return s.jsx(nO,{scope:t,anchor:a,onAnchorChange:l,children:n})};Gw.displayName=Up;var Vw="PopperAnchor",Yw=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:a,...l}=e,r=qw(Vw,n),i=u.useRef(null),o=Ie(t,i);return u.useEffect(()=>{r.onAnchorChange((a==null?void 0:a.current)||i.current)}),a?null:s.jsx(Ne.div,{...l,ref:o})});Yw.displayName=Vw;var Bp="PopperContent",[sO,aO]=Pw(Bp),Fw=u.forwardRef((e,t)=>{var O,H,se,B,ee,W;const{__scopePopper:n,side:a="bottom",sideOffset:l=0,align:r="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:j,...v}=e,y=qw(Bp,n),[g,p]=u.useState(null),b=Ie(t,ae=>p(ae)),[w,N]=u.useState(null),R=_w(w),_=(R==null?void 0:R.width)??0,k=(R==null?void 0:R.height)??0,L=a+(r!=="center"?"-"+r:""),z=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},X=Array.isArray(d)?d:[d],V=X.length>0,U={padding:z,boundary:X.filter(rO),altBoundary:V},{refs:M,floatingStyles:A,placement:S,isPositioned:E,middlewareData:C}=VM({strategy:"fixed",placement:L,whileElementsMounted:(...ae)=>DM(...ae,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[FM({mainAxis:l+k,alignmentAxis:i}),c&&KM({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?XM():void 0,...U}),c&&QM({...U}),ZM({...U,apply:({elements:ae,rects:J,availableWidth:Qe,availableHeight:de})=>{const{width:Me,height:K}=J.reference,ke=ae.floating.style;ke.setProperty("--radix-popper-available-width",`${Qe}px`),ke.setProperty("--radix-popper-available-height",`${de}px`),ke.setProperty("--radix-popper-anchor-width",`${Me}px`),ke.setProperty("--radix-popper-anchor-height",`${K}px`)}}),w&&JM({element:w,padding:o}),iO({arrowWidth:_,arrowHeight:k}),m&&WM({strategy:"referenceHidden",...U})]}),[$,F]=Qw(S),T=bs(j);Ht(()=>{E&&(T==null||T())},[E,T]);const P=(O=C.arrow)==null?void 0:O.x,ne=(H=C.arrow)==null?void 0:H.y,le=((se=C.arrow)==null?void 0:se.centerOffset)!==0,[ge,Z]=u.useState();return Ht(()=>{g&&Z(window.getComputedStyle(g).zIndex)},[g]),s.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...A,transform:E?A.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(B=C.transformOrigin)==null?void 0:B.x,(ee=C.transformOrigin)==null?void 0:ee.y].join(" "),...((W=C.hide)==null?void 0:W.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(sO,{scope:n,placedSide:$,onArrowChange:N,arrowX:P,arrowY:ne,shouldHideArrow:le,children:s.jsx(Ne.div,{"data-side":$,"data-align":F,...v,ref:b,style:{...v.style,animation:E?void 0:"none"}})})})});Fw.displayName=Bp;var Kw="PopperArrow",lO={top:"bottom",right:"left",bottom:"top",left:"right"},Xw=u.forwardRef(function(t,n){const{__scopePopper:a,...l}=t,r=aO(Kw,a),i=lO[r.placedSide];return s.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:s.jsx(tO,{...l,ref:n,style:{...l.style,display:"block"}})})});Xw.displayName=Kw;function rO(e){return e!==null}var iO=e=>({name:"transformOrigin",options:e,fn(t){var y,g,p;const{placement:n,rects:a,middlewareData:l}=t,i=((y=l.arrow)==null?void 0:y.centerOffset)!==0,o=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=Qw(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((g=l.arrow)==null?void 0:g.x)??0)+o/2,x=(((p=l.arrow)==null?void 0:p.y)??0)+c/2;let j="",v="";return d==="bottom"?(j=i?h:`${m}px`,v=`${-c}px`):d==="top"?(j=i?h:`${m}px`,v=`${a.floating.height+c}px`):d==="right"?(j=`${-c}px`,v=i?h:`${x}px`):d==="left"&&(j=`${a.floating.width+c}px`,v=i?h:`${x}px`),{data:{x:j,y:v}}}});function Qw(e){const[t,n="center"]=e.split("-");return[t,n]}var Hp=Gw,Ip=Yw,Pp=Fw,qp=Xw,Mf="rovingFocusGroup.onEntryFocus",oO={bubbles:!1,cancelable:!0},Eo="RovingFocusGroup",[Zh,Zw,cO]=Ep(Eo),[uO,gd]=Ns(Eo,[cO]),[dO,fO]=uO(Eo),Ww=u.forwardRef((e,t)=>s.jsx(Zh.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Zh.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(hO,{...e,ref:t})})}));Ww.displayName=Eo;var hO=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:a,loop:l=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=e,m=u.useRef(null),x=Ie(t,m),j=hd(r),[v,y]=Oa({prop:i,defaultProp:o??null,onChange:c,caller:Eo}),[g,p]=u.useState(!1),b=bs(d),w=Zw(n),N=u.useRef(!1),[R,_]=u.useState(0);return u.useEffect(()=>{const k=m.current;if(k)return k.addEventListener(Mf,b),()=>k.removeEventListener(Mf,b)},[b]),s.jsx(dO,{scope:n,orientation:a,dir:j,loop:l,currentTabStopId:v,onItemFocus:u.useCallback(k=>y(k),[y]),onItemShiftTab:u.useCallback(()=>p(!0),[]),onFocusableItemAdd:u.useCallback(()=>_(k=>k+1),[]),onFocusableItemRemove:u.useCallback(()=>_(k=>k-1),[]),children:s.jsx(Ne.div,{tabIndex:g||R===0?-1:0,"data-orientation":a,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ue(e.onMouseDown,()=>{N.current=!0}),onFocus:ue(e.onFocus,k=>{const L=!N.current;if(k.target===k.currentTarget&&L&&!g){const z=new CustomEvent(Mf,oO);if(k.currentTarget.dispatchEvent(z),!z.defaultPrevented){const X=w().filter(S=>S.focusable),V=X.find(S=>S.active),U=X.find(S=>S.id===v),A=[V,U,...X].filter(Boolean).map(S=>S.ref.current);t_(A,f)}}N.current=!1}),onBlur:ue(e.onBlur,()=>p(!1))})})}),Jw="RovingFocusGroupItem",e_=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:a=!0,active:l=!1,tabStopId:r,children:i,...o}=e,c=Xn(),d=r||c,f=fO(Jw,n),h=f.currentTabStopId===d,m=Zw(n),{onFocusableItemAdd:x,onFocusableItemRemove:j,currentTabStopId:v}=f;return u.useEffect(()=>{if(a)return x(),()=>j()},[a,x,j]),s.jsx(Zh.ItemSlot,{scope:n,id:d,focusable:a,active:l,children:s.jsx(Ne.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...o,ref:t,onMouseDown:ue(e.onMouseDown,y=>{a?f.onItemFocus(d):y.preventDefault()}),onFocus:ue(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ue(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){f.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=xO(y,f.orientation,f.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let b=m().filter(w=>w.focusable).map(w=>w.ref.current);if(g==="last")b.reverse();else if(g==="prev"||g==="next"){g==="prev"&&b.reverse();const w=b.indexOf(y.currentTarget);b=f.loop?gO(b,w+1):b.slice(w+1)}setTimeout(()=>t_(b))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:v!=null}):i})})});e_.displayName=Jw;var mO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xO(e,t,n){const a=pO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(a))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(a)))return mO[a]}function t_(e,t=!1){const n=document.activeElement;for(const a of e)if(a===n||(a.focus({preventScroll:t}),document.activeElement!==n))return}function gO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var n_=Ww,s_=e_,Wh=["Enter"," "],vO=["ArrowDown","PageUp","Home"],a_=["ArrowUp","PageDown","End"],yO=[...vO,...a_],bO={ltr:[...Wh,"ArrowRight"],rtl:[...Wh,"ArrowLeft"]},jO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ao="Menu",[Qi,wO,_O]=Ep(Ao),[bl,l_]=Ns(Ao,[_O,Hr,gd]),vd=Hr(),r_=gd(),[NO,jl]=bl(Ao),[kO,Mo]=bl(Ao),i_=e=>{const{__scopeMenu:t,open:n=!1,children:a,dir:l,onOpenChange:r,modal:i=!0}=e,o=vd(t),[c,d]=u.useState(null),f=u.useRef(!1),h=bs(r),m=hd(l);return u.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),s.jsx(Hp,{...o,children:s.jsx(NO,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:d,children:s.jsx(kO,{scope:t,onClose:u.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:i,children:a})})})};i_.displayName=Ao;var SO="MenuAnchor",Gp=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=vd(n);return s.jsx(Ip,{...l,...a,ref:t})});Gp.displayName=SO;var Vp="MenuPortal",[CO,o_]=bl(Vp,{forceMount:void 0}),c_=e=>{const{__scopeMenu:t,forceMount:n,children:a,container:l}=e,r=jl(Vp,t);return s.jsx(CO,{scope:t,forceMount:n,children:s.jsx(zn,{present:n||r.open,children:s.jsx(So,{asChild:!0,container:l,children:a})})})};c_.displayName=Vp;var An="MenuContent",[RO,Yp]=bl(An),u_=u.forwardRef((e,t)=>{const n=o_(An,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=jl(An,e.__scopeMenu),i=Mo(An,e.__scopeMenu);return s.jsx(Qi.Provider,{scope:e.__scopeMenu,children:s.jsx(zn,{present:a||r.open,children:s.jsx(Qi.Slot,{scope:e.__scopeMenu,children:i.modal?s.jsx(TO,{...l,ref:t}):s.jsx(EO,{...l,ref:t})})})})}),TO=u.forwardRef((e,t)=>{const n=jl(An,e.__scopeMenu),a=u.useRef(null),l=Ie(t,a);return u.useEffect(()=>{const r=a.current;if(r)return _p(r)},[]),s.jsx(Fp,{...e,ref:l,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ue(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),EO=u.forwardRef((e,t)=>{const n=jl(An,e.__scopeMenu);return s.jsx(Fp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),AO=ul("MenuContent.ScrollLock"),Fp=u.forwardRef((e,t)=>{const{__scopeMenu:n,loop:a=!1,trapFocus:l,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:j,...v}=e,y=jl(An,n),g=Mo(An,n),p=vd(n),b=r_(n),w=wO(n),[N,R]=u.useState(null),_=u.useRef(null),k=Ie(t,_,y.onContentChange),L=u.useRef(0),z=u.useRef(""),X=u.useRef(0),V=u.useRef(null),U=u.useRef("right"),M=u.useRef(0),A=j?cd:u.Fragment,S=j?{as:AO,allowPinchZoom:!0}:void 0,E=$=>{var O,H;const F=z.current+$,T=w().filter(se=>!se.disabled),P=document.activeElement,ne=(O=T.find(se=>se.ref.current===P))==null?void 0:O.textValue,le=T.map(se=>se.textValue),ge=qO(le,F,ne),Z=(H=T.find(se=>se.textValue===ge))==null?void 0:H.ref.current;(function se(B){z.current=B,window.clearTimeout(L.current),B!==""&&(L.current=window.setTimeout(()=>se(""),1e3))})(F),Z&&setTimeout(()=>Z.focus())};u.useEffect(()=>()=>window.clearTimeout(L.current),[]),wp();const C=u.useCallback($=>{var T,P;return U.current===((T=V.current)==null?void 0:T.side)&&VO($,(P=V.current)==null?void 0:P.area)},[]);return s.jsx(RO,{scope:n,searchRef:z,onItemEnter:u.useCallback($=>{C($)&&$.preventDefault()},[C]),onItemLeave:u.useCallback($=>{var F;C($)||((F=_.current)==null||F.focus(),R(null))},[C]),onTriggerLeave:u.useCallback($=>{C($)&&$.preventDefault()},[C]),pointerGraceTimerRef:X,onPointerGraceIntentChange:u.useCallback($=>{V.current=$},[]),children:s.jsx(A,{...S,children:s.jsx(id,{asChild:!0,trapped:l,onMountAutoFocus:ue(r,$=>{var F;$.preventDefault(),(F=_.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:s.jsx(ko,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:s.jsx(n_,{asChild:!0,...b,dir:g.dir,orientation:"vertical",loop:a,currentTabStopId:N,onCurrentTabStopIdChange:R,onEntryFocus:ue(c,$=>{g.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:s.jsx(Pp,{role:"menu","aria-orientation":"vertical","data-state":S_(y.open),"data-radix-menu-content":"",dir:g.dir,...p,...v,ref:k,style:{outline:"none",...v.style},onKeyDown:ue(v.onKeyDown,$=>{const T=$.target.closest("[data-radix-menu-content]")===$.currentTarget,P=$.ctrlKey||$.altKey||$.metaKey,ne=$.key.length===1;T&&($.key==="Tab"&&$.preventDefault(),!P&&ne&&E($.key));const le=_.current;if($.target!==le||!yO.includes($.key))return;$.preventDefault();const Z=w().filter(O=>!O.disabled).map(O=>O.ref.current);a_.includes($.key)&&Z.reverse(),IO(Z)}),onBlur:ue(e.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(L.current),z.current="")}),onPointerMove:ue(e.onPointerMove,Zi($=>{const F=$.target,T=M.current!==$.clientX;if($.currentTarget.contains(F)&&T){const P=$.clientX>M.current?"right":"left";U.current=P,M.current=$.clientX}}))})})})})})})});u_.displayName=An;var MO="MenuGroup",Kp=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Ne.div,{role:"group",...a,ref:t})});Kp.displayName=MO;var OO="MenuLabel",d_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Ne.div,{...a,ref:t})});d_.displayName=OO;var _u="MenuItem",Ev="menu.itemSelect",yd=u.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:a,...l}=e,r=u.useRef(null),i=Mo(_u,e.__scopeMenu),o=Yp(_u,e.__scopeMenu),c=Ie(t,r),d=u.useRef(!1),f=()=>{const h=r.current;if(!n&&h){const m=new CustomEvent(Ev,{bubbles:!0,cancelable:!0});h.addEventListener(Ev,x=>a==null?void 0:a(x),{once:!0}),$0(h,m),m.defaultPrevented?d.current=!1:i.onClose()}};return s.jsx(f_,{...l,ref:c,disabled:n,onClick:ue(e.onClick,f),onPointerDown:h=>{var m;(m=e.onPointerDown)==null||m.call(e,h),d.current=!0},onPointerUp:ue(e.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:ue(e.onKeyDown,h=>{const m=o.searchRef.current!=="";n||m&&h.key===" "||Wh.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});yd.displayName=_u;var f_=u.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:a=!1,textValue:l,...r}=e,i=Yp(_u,n),o=r_(n),c=u.useRef(null),d=Ie(t,c),[f,h]=u.useState(!1),[m,x]=u.useState("");return u.useEffect(()=>{const j=c.current;j&&x((j.textContent??"").trim())},[r.children]),s.jsx(Qi.ItemSlot,{scope:n,disabled:a,textValue:l??m,children:s.jsx(s_,{asChild:!0,...o,focusable:!a,children:s.jsx(Ne.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":a||void 0,"data-disabled":a?"":void 0,...r,ref:d,onPointerMove:ue(e.onPointerMove,Zi(j=>{a?i.onItemLeave(j):(i.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ue(e.onPointerLeave,Zi(j=>i.onItemLeave(j))),onFocus:ue(e.onFocus,()=>h(!0)),onBlur:ue(e.onBlur,()=>h(!1))})})})}),$O="MenuCheckboxItem",h_=u.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:a,...l}=e;return s.jsx(v_,{scope:e.__scopeMenu,checked:n,children:s.jsx(yd,{role:"menuitemcheckbox","aria-checked":Nu(n)?"mixed":n,...l,ref:t,"data-state":Qp(n),onSelect:ue(l.onSelect,()=>a==null?void 0:a(Nu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});h_.displayName=$O;var m_="MenuRadioGroup",[DO,zO]=bl(m_,{value:void 0,onValueChange:()=>{}}),p_=u.forwardRef((e,t)=>{const{value:n,onValueChange:a,...l}=e,r=bs(a);return s.jsx(DO,{scope:e.__scopeMenu,value:n,onValueChange:r,children:s.jsx(Kp,{...l,ref:t})})});p_.displayName=m_;var x_="MenuRadioItem",g_=u.forwardRef((e,t)=>{const{value:n,...a}=e,l=zO(x_,e.__scopeMenu),r=n===l.value;return s.jsx(v_,{scope:e.__scopeMenu,checked:r,children:s.jsx(yd,{role:"menuitemradio","aria-checked":r,...a,ref:t,"data-state":Qp(r),onSelect:ue(a.onSelect,()=>{var i;return(i=l.onValueChange)==null?void 0:i.call(l,n)},{checkForDefaultPrevented:!1})})})});g_.displayName=x_;var Xp="MenuItemIndicator",[v_,LO]=bl(Xp,{checked:!1}),y_=u.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:a,...l}=e,r=LO(Xp,n);return s.jsx(zn,{present:a||Nu(r.checked)||r.checked===!0,children:s.jsx(Ne.span,{...l,ref:t,"data-state":Qp(r.checked)})})});y_.displayName=Xp;var UO="MenuSeparator",b_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e;return s.jsx(Ne.div,{role:"separator","aria-orientation":"horizontal",...a,ref:t})});b_.displayName=UO;var BO="MenuArrow",j_=u.forwardRef((e,t)=>{const{__scopeMenu:n,...a}=e,l=vd(n);return s.jsx(qp,{...l,...a,ref:t})});j_.displayName=BO;var HO="MenuSub",[g5,w_]=bl(HO),ui="MenuSubTrigger",__=u.forwardRef((e,t)=>{const n=jl(ui,e.__scopeMenu),a=Mo(ui,e.__scopeMenu),l=w_(ui,e.__scopeMenu),r=Yp(ui,e.__scopeMenu),i=u.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=r,d={__scopeMenu:e.__scopeMenu},f=u.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return u.useEffect(()=>f,[f]),u.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),c(null)}},[o,c]),s.jsx(Gp,{asChild:!0,...d,children:s.jsx(f_,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":l.contentId,"data-state":S_(n.open),...e,ref:rd(t,l.onTriggerChange),onClick:h=>{var m;(m=e.onClick)==null||m.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ue(e.onPointerMove,Zi(h=>{r.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:ue(e.onPointerLeave,Zi(h=>{var x,j;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const v=(j=n.content)==null?void 0:j.dataset.side,y=v==="right",g=y?-5:5,p=m[y?"left":"right"],b=m[y?"right":"left"];r.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:p,y:m.top},{x:b,y:m.top},{x:b,y:m.bottom},{x:p,y:m.bottom}],side:v}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(h),h.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:ue(e.onKeyDown,h=>{var x;const m=r.searchRef.current!=="";e.disabled||m&&h.key===" "||bO[a.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});__.displayName=ui;var N_="MenuSubContent",k_=u.forwardRef((e,t)=>{const n=o_(An,e.__scopeMenu),{forceMount:a=n.forceMount,...l}=e,r=jl(An,e.__scopeMenu),i=Mo(An,e.__scopeMenu),o=w_(N_,e.__scopeMenu),c=u.useRef(null),d=Ie(t,c);return s.jsx(Qi.Provider,{scope:e.__scopeMenu,children:s.jsx(zn,{present:a||r.open,children:s.jsx(Qi.Slot,{scope:e.__scopeMenu,children:s.jsx(Fp,{id:o.contentId,"aria-labelledby":o.triggerId,...l,ref:d,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var h;i.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:ue(e.onFocusOutside,f=>{f.target!==o.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:ue(e.onEscapeKeyDown,f=>{i.onClose(),f.preventDefault()}),onKeyDown:ue(e.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=jO[i.dir].includes(f.key);h&&m&&(r.onOpenChange(!1),(x=o.trigger)==null||x.focus(),f.preventDefault())})})})})})});k_.displayName=N_;function S_(e){return e?"open":"closed"}function Nu(e){return e==="indeterminate"}function Qp(e){return Nu(e)?"indeterminate":e?"checked":"unchecked"}function IO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function PO(e,t){return e.map((n,a)=>e[(t+a)%e.length])}function qO(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=PO(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function GO(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(l=!l)}return l}function VO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return GO(n,t)}function Zi(e){return t=>t.pointerType==="mouse"?e(t):void 0}var YO=i_,FO=Gp,KO=c_,XO=u_,QO=Kp,ZO=d_,WO=yd,JO=h_,e4=p_,t4=g_,n4=y_,s4=b_,a4=j_,l4=__,r4=k_,bd="DropdownMenu",[i4]=Ns(bd,[l_]),Vt=l_(),[o4,C_]=i4(bd),R_=e=>{const{__scopeDropdownMenu:t,children:n,dir:a,open:l,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,c=Vt(t),d=u.useRef(null),[f,h]=Oa({prop:l,defaultProp:r??!1,onChange:i,caller:bd});return s.jsx(o4,{scope:t,triggerId:Xn(),triggerRef:d,contentId:Xn(),open:f,onOpenChange:h,onOpenToggle:u.useCallback(()=>h(m=>!m),[h]),modal:o,children:s.jsx(YO,{...c,open:f,onOpenChange:h,dir:a,modal:o,children:n})})};R_.displayName=bd;var T_="DropdownMenuTrigger",E_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:a=!1,...l}=e,r=C_(T_,n),i=Vt(n);return s.jsx(FO,{asChild:!0,...i,children:s.jsx(Ne.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...l,ref:rd(t,r.triggerRef),onPointerDown:ue(e.onPointerDown,o=>{!a&&o.button===0&&o.ctrlKey===!1&&(r.onOpenToggle(),r.open||o.preventDefault())}),onKeyDown:ue(e.onKeyDown,o=>{a||(["Enter"," "].includes(o.key)&&r.onOpenToggle(),o.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});E_.displayName=T_;var c4="DropdownMenuPortal",A_=e=>{const{__scopeDropdownMenu:t,...n}=e,a=Vt(t);return s.jsx(KO,{...a,...n})};A_.displayName=c4;var M_="DropdownMenuContent",O_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=C_(M_,n),r=Vt(n),i=u.useRef(!1);return s.jsx(XO,{id:l.contentId,"aria-labelledby":l.triggerId,...r,...a,ref:t,onCloseAutoFocus:ue(e.onCloseAutoFocus,o=>{var c;i.current||(c=l.triggerRef.current)==null||c.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ue(e.onInteractOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,f=c.button===2||d;(!l.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)"}})});O_.displayName=M_;var u4="DropdownMenuGroup",d4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(QO,{...l,...a,ref:t})});d4.displayName=u4;var f4="DropdownMenuLabel",$_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(ZO,{...l,...a,ref:t})});$_.displayName=f4;var h4="DropdownMenuItem",D_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(WO,{...l,...a,ref:t})});D_.displayName=h4;var m4="DropdownMenuCheckboxItem",z_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(JO,{...l,...a,ref:t})});z_.displayName=m4;var p4="DropdownMenuRadioGroup",x4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(e4,{...l,...a,ref:t})});x4.displayName=p4;var g4="DropdownMenuRadioItem",L_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(t4,{...l,...a,ref:t})});L_.displayName=g4;var v4="DropdownMenuItemIndicator",U_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(n4,{...l,...a,ref:t})});U_.displayName=v4;var y4="DropdownMenuSeparator",B_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(s4,{...l,...a,ref:t})});B_.displayName=y4;var b4="DropdownMenuArrow",j4=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(a4,{...l,...a,ref:t})});j4.displayName=b4;var w4="DropdownMenuSubTrigger",H_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(l4,{...l,...a,ref:t})});H_.displayName=w4;var _4="DropdownMenuSubContent",I_=u.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...a}=e,l=Vt(n);return s.jsx(r4,{...l,...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)"}})});I_.displayName=_4;var N4=R_,k4=E_,S4=A_,P_=O_,q_=$_,G_=D_,V_=z_,Y_=L_,F_=U_,K_=B_,X_=H_,Q_=I_;const jd=N4,wd=k4,C4=u.forwardRef(({className:e,inset:t,children:n,...a},l)=>s.jsxs(X_,{ref:l,className:ie("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(gp,{className:"ml-auto"})]}));C4.displayName=X_.displayName;const R4=u.forwardRef(({className:e,...t},n)=>s.jsx(Q_,{ref:n,className:ie("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}));R4.displayName=Q_.displayName;const Oo=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>s.jsx(S4,{container:Co(),children:s.jsx(P_,{ref:a,sideOffset:t,className:ie("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})}));Oo.displayName=P_.displayName;const wr=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(G_,{ref:a,className:ie("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}));wr.displayName=G_.displayName;const T4=u.forwardRef(({className:e,children:t,checked:n,...a},l)=>s.jsxs(V_,{ref:l,className:ie("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(F_,{children:s.jsx(Or,{className:"h-4 w-4"})})}),t]}));T4.displayName=V_.displayName;const E4=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(Y_,{ref:a,className:ie("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(F_,{children:s.jsx(cR,{className:"h-2 w-2 fill-current"})})}),t]}));E4.displayName=Y_.displayName;const A4=u.forwardRef(({className:e,inset:t,...n},a)=>s.jsx(q_,{ref:a,className:ie("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));A4.displayName=q_.displayName;const M4=u.forwardRef(({className:e,...t},n)=>s.jsx(K_,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));M4.displayName=K_.displayName;const O4={default:"h-9 px-3 py-1 text-sm",control:"h-7 px-2 py-1 text-xs"},_t=u.forwardRef(({className:e,type:t,inputSize:n="default",...a},l)=>s.jsx("input",{type:t,className:ie("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",O4[n],e),ref:l,...a}));_t.displayName="Input";var $4="Label",Z_=u.forwardRef((e,t)=>s.jsx(Ne.label,{...e,ref:t,onMouseDown:n=>{var l;n.target.closest("button, input, select, textarea")||((l=e.onMouseDown)==null||l.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Z_.displayName=$4;var W_=Z_;const D4=No("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Oe=u.forwardRef(({className:e,...t},n)=>s.jsx(W_,{ref:n,className:ie(D4(),e),...t}));Oe.displayName=W_.displayName;function Ba({title:e,description:t,backHref:n,backLabel:a,className:l,icon:r,link:i}){const o=s.jsx(G,{asChild:!0,variant:"outline",size:"sm",className:"mt-4 no-underline",children:s.jsx(i,{href:n,children:a})});return r?s.jsx("div",{className:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",l),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:r}),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:ie("flex-1 px-4 py-8 sm:px-6 lg:px-8",l),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 Yt({title:e,description:t,actions:n,className:a,children:l,...r}){return s.jsxs("header",{"data-slot":"page-header",className:ie("flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",a),...r,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,l]}),n?s.jsx("div",{"data-slot":"page-header-actions",className:"flex shrink-0 items-center gap-2",children:n}):null]})}function gt({as:e="div",className:t,...n}){return s.jsx(e,{className:ie("rounded-lg border",t),...n})}function Av(e,[t,n]){return Math.min(n,Math.max(t,e))}var J_=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"}),z4="VisuallyHidden",eN=u.forwardRef((e,t)=>s.jsx(Ne.span,{...e,ref:t,style:{...J_,...e.style}}));eN.displayName=z4;var L4=eN,U4=[" ","Enter","ArrowUp","ArrowDown"],B4=[" ","Enter"],hl="Select",[_d,Nd,H4]=Ep(hl),[Ir]=Ns(hl,[H4,Hr]),kd=Hr(),[I4,Ha]=Ir(hl),[P4,q4]=Ir(hl),tN=e=>{const{__scopeSelect:t,children:n,open:a,defaultOpen:l,onOpenChange:r,value:i,defaultValue:o,onValueChange:c,dir:d,name:f,autoComplete:h,disabled:m,required:x,form:j}=e,v=kd(t),[y,g]=u.useState(null),[p,b]=u.useState(null),[w,N]=u.useState(!1),R=hd(d),[_,k]=Oa({prop:a,defaultProp:l??!1,onChange:r,caller:hl}),[L,z]=Oa({prop:i,defaultProp:o,onChange:c,caller:hl}),X=u.useRef(null),V=y?j||!!y.closest("form"):!0,[U,M]=u.useState(new Set),A=Array.from(U).map(S=>S.props.value).join(";");return s.jsx(Hp,{...v,children:s.jsxs(I4,{required:x,scope:t,trigger:y,onTriggerChange:g,valueNode:p,onValueNodeChange:b,valueNodeHasChildren:w,onValueNodeHasChildrenChange:N,contentId:Xn(),value:L,onValueChange:z,open:_,onOpenChange:k,dir:R,triggerPointerDownPosRef:X,disabled:m,children:[s.jsx(_d.Provider,{scope:t,children:s.jsx(P4,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(S=>{M(E=>new Set(E).add(S))},[]),onNativeOptionRemove:u.useCallback(S=>{M(E=>{const C=new Set(E);return C.delete(S),C})},[]),children:n})}),V?s.jsxs(kN,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:L,onChange:S=>z(S.target.value),disabled:m,form:j,children:[L===void 0?s.jsx("option",{value:""}):null,Array.from(U)]},A):null]})})};tN.displayName=hl;var nN="SelectTrigger",sN=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:a=!1,...l}=e,r=kd(n),i=Ha(nN,n),o=i.disabled||a,c=Ie(t,i.onTriggerChange),d=Nd(n),f=u.useRef("touch"),[h,m,x]=CN(v=>{const y=d().filter(b=>!b.disabled),g=y.find(b=>b.value===i.value),p=RN(y,v,g);p!==void 0&&i.onValueChange(p.value)}),j=v=>{o||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return s.jsx(Ip,{asChild:!0,...r,children:s.jsx(Ne.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":SN(i.value)?"":void 0,...l,ref:c,onClick:ue(l.onClick,v=>{v.currentTarget.focus(),f.current!=="mouse"&&j(v)}),onPointerDown:ue(l.onPointerDown,v=>{f.current=v.pointerType;const y=v.target;y.hasPointerCapture(v.pointerId)&&y.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(j(v),v.preventDefault())}),onKeyDown:ue(l.onKeyDown,v=>{const y=h.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(y&&v.key===" ")&&U4.includes(v.key)&&(j(),v.preventDefault())})})})});sN.displayName=nN;var aN="SelectValue",lN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,children:r,placeholder:i="",...o}=e,c=Ha(aN,n),{onValueNodeHasChildrenChange:d}=c,f=r!==void 0,h=Ie(t,c.onValueNodeChange);return Ht(()=>{d(f)},[d,f]),s.jsx(Ne.span,{...o,ref:h,style:{pointerEvents:"none"},children:SN(c.value)?s.jsx(s.Fragment,{children:i}):r})});lN.displayName=aN;var G4="SelectIcon",rN=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:a,...l}=e;return s.jsx(Ne.span,{"aria-hidden":!0,...l,ref:t,children:a||"▼"})});rN.displayName=G4;var V4="SelectPortal",iN=e=>s.jsx(So,{asChild:!0,...e});iN.displayName=V4;var ml="SelectContent",oN=u.forwardRef((e,t)=>{const n=Ha(ml,e.__scopeSelect),[a,l]=u.useState();if(Ht(()=>{l(new DocumentFragment)},[]),!n.open){const r=a;return r?kr.createPortal(s.jsx(cN,{scope:e.__scopeSelect,children:s.jsx(_d.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),r):null}return s.jsx(uN,{...e,ref:t})});oN.displayName=ml;var qn=10,[cN,Ia]=Ir(ml),Y4="SelectContentImpl",F4=ul("SelectContent.RemoveScroll"),uN=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:a="item-aligned",onCloseAutoFocus:l,onEscapeKeyDown:r,onPointerDownOutside:i,side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y,...g}=e,p=Ha(ml,n),[b,w]=u.useState(null),[N,R]=u.useState(null),_=Ie(t,O=>w(O)),[k,L]=u.useState(null),[z,X]=u.useState(null),V=Nd(n),[U,M]=u.useState(!1),A=u.useRef(!1);u.useEffect(()=>{if(b)return _p(b)},[b]),wp();const S=u.useCallback(O=>{const[H,...se]=V().map(W=>W.ref.current),[B]=se.slice(-1),ee=document.activeElement;for(const W of O)if(W===ee||(W==null||W.scrollIntoView({block:"nearest"}),W===H&&N&&(N.scrollTop=0),W===B&&N&&(N.scrollTop=N.scrollHeight),W==null||W.focus(),document.activeElement!==ee))return},[V,N]),E=u.useCallback(()=>S([k,b]),[S,k,b]);u.useEffect(()=>{U&&E()},[U,E]);const{onOpenChange:C,triggerPointerDownPosRef:$}=p;u.useEffect(()=>{if(b){let O={x:0,y:0};const H=B=>{var ee,W;O={x:Math.abs(Math.round(B.pageX)-(((ee=$.current)==null?void 0:ee.x)??0)),y:Math.abs(Math.round(B.pageY)-(((W=$.current)==null?void 0:W.y)??0))}},se=B=>{O.x<=10&&O.y<=10?B.preventDefault():b.contains(B.target)||C(!1),document.removeEventListener("pointermove",H),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",H),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",H),document.removeEventListener("pointerup",se,{capture:!0})}}},[b,C,$]),u.useEffect(()=>{const O=()=>C(!1);return window.addEventListener("blur",O),window.addEventListener("resize",O),()=>{window.removeEventListener("blur",O),window.removeEventListener("resize",O)}},[C]);const[F,T]=CN(O=>{const H=V().filter(ee=>!ee.disabled),se=H.find(ee=>ee.ref.current===document.activeElement),B=RN(H,O,se);B&&setTimeout(()=>B.ref.current.focus())}),P=u.useCallback((O,H,se)=>{const B=!A.current&&!se;(p.value!==void 0&&p.value===H||B)&&(L(O),B&&(A.current=!0))},[p.value]),ne=u.useCallback(()=>b==null?void 0:b.focus(),[b]),le=u.useCallback((O,H,se)=>{const B=!A.current&&!se;(p.value!==void 0&&p.value===H||B)&&X(O)},[p.value]),ge=a==="popper"?Jh:dN,Z=ge===Jh?{side:o,sideOffset:c,align:d,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:j,hideWhenDetached:v,avoidCollisions:y}:{};return s.jsx(cN,{scope:n,content:b,viewport:N,onViewportChange:R,itemRefCallback:P,selectedItem:k,onItemLeave:ne,itemTextRefCallback:le,focusSelectedItem:E,selectedItemText:z,position:a,isPositioned:U,searchRef:F,children:s.jsx(cd,{as:F4,allowPinchZoom:!0,children:s.jsx(id,{asChild:!0,trapped:p.open,onMountAutoFocus:O=>{O.preventDefault()},onUnmountAutoFocus:ue(l,O=>{var H;(H=p.trigger)==null||H.focus({preventScroll:!0}),O.preventDefault()}),children:s.jsx(ko,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:O=>O.preventDefault(),onDismiss:()=>p.onOpenChange(!1),children:s.jsx(ge,{role:"listbox",id:p.contentId,"data-state":p.open?"open":"closed",dir:p.dir,onContextMenu:O=>O.preventDefault(),...g,...Z,onPlaced:()=>M(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ue(g.onKeyDown,O=>{const H=O.ctrlKey||O.altKey||O.metaKey;if(O.key==="Tab"&&O.preventDefault(),!H&&O.key.length===1&&T(O.key),["ArrowUp","ArrowDown","Home","End"].includes(O.key)){let B=V().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);if(["ArrowUp","End"].includes(O.key)&&(B=B.slice().reverse()),["ArrowUp","ArrowDown"].includes(O.key)){const ee=O.target,W=B.indexOf(ee);B=B.slice(W+1)}setTimeout(()=>S(B)),O.preventDefault()}})})})})})})});uN.displayName=Y4;var K4="SelectItemAlignedPosition",dN=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:a,...l}=e,r=Ha(ml,n),i=Ia(ml,n),[o,c]=u.useState(null),[d,f]=u.useState(null),h=Ie(t,_=>f(_)),m=Nd(n),x=u.useRef(!1),j=u.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:g,focusSelectedItem:p}=i,b=u.useCallback(()=>{if(r.trigger&&r.valueNode&&o&&d&&v&&y&&g){const _=r.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),L=r.valueNode.getBoundingClientRect(),z=g.getBoundingClientRect();if(r.dir!=="rtl"){const ee=z.left-k.left,W=L.left-ee,ae=_.left-W,J=_.width+ae,Qe=Math.max(J,k.width),de=window.innerWidth-qn,Me=Av(W,[qn,Math.max(qn,de-Qe)]);o.style.minWidth=J+"px",o.style.left=Me+"px"}else{const ee=k.right-z.right,W=window.innerWidth-L.right-ee,ae=window.innerWidth-_.right-W,J=_.width+ae,Qe=Math.max(J,k.width),de=window.innerWidth-qn,Me=Av(W,[qn,Math.max(qn,de-Qe)]);o.style.minWidth=J+"px",o.style.right=Me+"px"}const X=m(),V=window.innerHeight-qn*2,U=v.scrollHeight,M=window.getComputedStyle(d),A=parseInt(M.borderTopWidth,10),S=parseInt(M.paddingTop,10),E=parseInt(M.borderBottomWidth,10),C=parseInt(M.paddingBottom,10),$=A+S+U+C+E,F=Math.min(y.offsetHeight*5,$),T=window.getComputedStyle(v),P=parseInt(T.paddingTop,10),ne=parseInt(T.paddingBottom,10),le=_.top+_.height/2-qn,ge=V-le,Z=y.offsetHeight/2,O=y.offsetTop+Z,H=A+S+O,se=$-H;if(H<=le){const ee=X.length>0&&y===X[X.length-1].ref.current;o.style.bottom="0px";const W=d.clientHeight-v.offsetTop-v.offsetHeight,ae=Math.max(ge,Z+(ee?ne:0)+W+E),J=H+ae;o.style.height=J+"px"}else{const ee=X.length>0&&y===X[0].ref.current;o.style.top="0px";const ae=Math.max(le,A+v.offsetTop+(ee?P:0)+Z)+se;o.style.height=ae+"px",v.scrollTop=H-le+v.offsetTop}o.style.margin=`${qn}px 0`,o.style.minHeight=F+"px",o.style.maxHeight=V+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,r.trigger,r.valueNode,o,d,v,y,g,r.dir,a]);Ht(()=>b(),[b]);const[w,N]=u.useState();Ht(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const R=u.useCallback(_=>{_&&j.current===!0&&(b(),p==null||p(),j.current=!1)},[b,p]);return s.jsx(Q4,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:x,onScrollButtonChange:R,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:s.jsx(Ne.div,{...l,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...l.style}})})})});dN.displayName=K4;var X4="SelectPopperPosition",Jh=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:a="start",collisionPadding:l=qn,...r}=e,i=kd(n);return s.jsx(Pp,{...i,...r,ref:t,align:a,collisionPadding:l,style:{boxSizing:"border-box",...r.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)"}})});Jh.displayName=X4;var[Q4,Zp]=Ir(ml,{}),em="SelectViewport",fN=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:a,...l}=e,r=Ia(em,n),i=Zp(em,n),o=Ie(t,r.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(_d.Slot,{scope:n,children:s.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...l,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...l.style},onScroll:ue(l.onScroll,d=>{const f=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const x=Math.abs(c.current-f.scrollTop);if(x>0){const j=window.innerHeight-qn*2,v=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(v,y);if(g<j){const p=g+x,b=Math.min(j,p),w=p-b;h.style.height=b+"px",h.style.bottom==="0px"&&(f.scrollTop=w>0?w:0,h.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});fN.displayName=em;var hN="SelectGroup",[Z4,W4]=Ir(hN),J4=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=Xn();return s.jsx(Z4,{scope:n,id:l,children:s.jsx(Ne.div,{role:"group","aria-labelledby":l,...a,ref:t})})});J4.displayName=hN;var mN="SelectLabel",pN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=W4(mN,n);return s.jsx(Ne.div,{id:l.id,...a,ref:t})});pN.displayName=mN;var ku="SelectItem",[e$,xN]=Ir(ku),gN=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:a,disabled:l=!1,textValue:r,...i}=e,o=Ha(ku,n),c=Ia(ku,n),d=o.value===a,[f,h]=u.useState(r??""),[m,x]=u.useState(!1),j=Ie(t,p=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,p,a,l)}),v=Xn(),y=u.useRef("touch"),g=()=>{l||(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(e$,{scope:n,value:a,disabled:l,textId:v,isSelected:d,onItemTextChange:u.useCallback(p=>{h(b=>b||((p==null?void 0:p.textContent)??"").trim())},[]),children:s.jsx(_d.ItemSlot,{scope:n,value:a,disabled:l,textValue:f,children:s.jsx(Ne.div,{role:"option","aria-labelledby":v,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":l||void 0,"data-disabled":l?"":void 0,tabIndex:l?void 0:-1,...i,ref:j,onFocus:ue(i.onFocus,()=>x(!0)),onBlur:ue(i.onBlur,()=>x(!1)),onClick:ue(i.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:ue(i.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:ue(i.onPointerDown,p=>{y.current=p.pointerType}),onPointerMove:ue(i.onPointerMove,p=>{var b;y.current=p.pointerType,l?(b=c.onItemLeave)==null||b.call(c):y.current==="mouse"&&p.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,p=>{var b;p.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:ue(i.onKeyDown,p=>{var w;((w=c.searchRef)==null?void 0:w.current)!==""&&p.key===" "||(B4.includes(p.key)&&g(),p.key===" "&&p.preventDefault())})})})})});gN.displayName=ku;var di="SelectItemText",vN=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:a,style:l,...r}=e,i=Ha(di,n),o=Ia(di,n),c=xN(di,n),d=q4(di,n),[f,h]=u.useState(null),m=Ie(t,g=>h(g),c.onItemTextChange,g=>{var p;return(p=o.itemTextRefCallback)==null?void 0:p.call(o,g,c.value,c.disabled)}),x=f==null?void 0:f.textContent,j=u.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:y}=d;return Ht(()=>(v(j),()=>y(j)),[v,y,j]),s.jsxs(s.Fragment,{children:[s.jsx(Ne.span,{id:c.textId,...r,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?kr.createPortal(r.children,i.valueNode):null]})});vN.displayName=di;var yN="SelectItemIndicator",bN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return xN(yN,n).isSelected?s.jsx(Ne.span,{"aria-hidden":!0,...a,ref:t}):null});bN.displayName=yN;var tm="SelectScrollUpButton",jN=u.forwardRef((e,t)=>{const n=Ia(tm,e.__scopeSelect),a=Zp(tm,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Ht(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollTop>0;r(d)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(_N,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop-c.offsetHeight)}}):null});jN.displayName=tm;var nm="SelectScrollDownButton",wN=u.forwardRef((e,t)=>{const n=Ia(nm,e.__scopeSelect),a=Zp(nm,e.__scopeSelect),[l,r]=u.useState(!1),i=Ie(t,a.onScrollButtonChange);return Ht(()=>{if(n.viewport&&n.isPositioned){let o=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;r(f)};const c=n.viewport;return o(),c.addEventListener("scroll",o),()=>c.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),l?s.jsx(_N,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:c}=n;o&&c&&(o.scrollTop=o.scrollTop+c.offsetHeight)}}):null});wN.displayName=nm;var _N=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:a,...l}=e,r=Ia("SelectScrollButton",n),i=u.useRef(null),o=Nd(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),Ht(()=>{var f;const d=o().find(h=>h.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[o]),s.jsx(Ne.div,{"aria-hidden":!0,...l,ref:t,style:{flexShrink:0,...l.style},onPointerDown:ue(l.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:ue(l.onPointerMove,()=>{var d;(d=r.onItemLeave)==null||d.call(r),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:ue(l.onPointerLeave,()=>{c()})})}),t$="SelectSeparator",NN=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e;return s.jsx(Ne.div,{"aria-hidden":!0,...a,ref:t})});NN.displayName=t$;var sm="SelectArrow",n$=u.forwardRef((e,t)=>{const{__scopeSelect:n,...a}=e,l=kd(n),r=Ha(sm,n),i=Ia(sm,n);return r.open&&i.position==="popper"?s.jsx(qp,{...l,...a,ref:t}):null});n$.displayName=sm;var s$="SelectBubbleInput",kN=u.forwardRef(({__scopeSelect:e,value:t,...n},a)=>{const l=u.useRef(null),r=Ie(a,l),i=ww(t);return u.useEffect(()=>{const o=l.current;if(!o)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const h=new Event("change",{bubbles:!0});f.call(o,t),o.dispatchEvent(h)}},[i,t]),s.jsx(Ne.select,{...n,style:{...J_,...n.style},ref:r,defaultValue:t})});kN.displayName=s$;function SN(e){return e===""||e===void 0}function CN(e){const t=bs(e),n=u.useRef(""),a=u.useRef(0),l=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]),r=u.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,l,r]}function RN(e,t,n){const l=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,r=n?e.indexOf(n):-1;let i=a$(e,Math.max(r,0));l.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(l.toLowerCase()));return c!==n?c:void 0}function a$(e,t){return e.map((n,a)=>e[(t+a)%e.length])}var l$=tN,TN=sN,r$=lN,i$=rN,o$=iN,EN=oN,c$=fN,AN=pN,MN=gN,u$=vN,d$=bN,ON=jN,$N=wN,DN=NN;const f$={default:"h-9 px-3 py-2 text-sm",control:"h-7 px-2 py-1 text-xs"},dt=l$,ft=r$,rt=u.forwardRef(({className:e,children:t,triggerSize:n="default",...a},l)=>s.jsxs(TN,{ref:l,className:ie("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",f$[n],e),...a,children:[t,s.jsx(i$,{asChild:!0,children:s.jsx(m0,{className:"text-muted-foreground size-4","aria-hidden":"true"})})]}));rt.displayName=TN.displayName;const zN=u.forwardRef(({className:e,...t},n)=>s.jsx(ON,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(aR,{className:"size-4","aria-hidden":"true"})}));zN.displayName=ON.displayName;const LN=u.forwardRef(({className:e,...t},n)=>s.jsx($N,{ref:n,className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(h0,{className:"size-4","aria-hidden":"true"})}));LN.displayName=$N.displayName;const it=u.forwardRef(({className:e,children:t,position:n="popper",...a},l)=>s.jsx(o$,{container:Co(),children:s.jsxs(EN,{ref:l,className:ie("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(zN,{}),s.jsx(c$,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(LN,{})]})}));it.displayName=EN.displayName;const h$=u.forwardRef(({className:e,...t},n)=>s.jsx(AN,{ref:n,className:ie("px-2 py-1.5 text-sm font-semibold",e),...t}));h$.displayName=AN.displayName;const Se=u.forwardRef(({className:e,children:t,...n},a)=>s.jsxs(MN,{ref:a,className:ie("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(d$,{children:s.jsx(Or,{className:"size-4","aria-hidden":"true"})})}),s.jsx(u$,{children:t})]}));Se.displayName=MN.displayName;const m$=u.forwardRef(({className:e,...t},n)=>s.jsx(DN,{ref:n,className:ie("-mx-1 my-1 h-px bg-muted",e),...t}));m$.displayName=DN.displayName;function xt({className:e,...t}){return s.jsx("div",{className:ie("animate-pulse rounded-md bg-primary/10",e),...t})}const Be=u.forwardRef(({className:e,containerClassName:t,containerRef:n,containerTabIndex:a,containerAriaLabel:l,...r},i)=>s.jsx("div",{ref:n,tabIndex:a,"aria-label":l,className:ie("relative w-full overflow-auto",t),children:s.jsx("table",{ref:i,className:ie("w-full caption-bottom text-sm",e),...r})}));Be.displayName="Table";const Ye=u.forwardRef(({className:e,...t},n)=>s.jsx("thead",{ref:n,className:ie("[&_tr]:border-b",e),...t}));Ye.displayName="TableHeader";const He=u.forwardRef(({className:e,...t},n)=>s.jsx("tbody",{ref:n,className:ie("[&_tr:last-child]:border-0",e),...t}));He.displayName="TableBody";const p$=u.forwardRef(({className:e,...t},n)=>s.jsx("tfoot",{ref:n,className:ie("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t}));p$.displayName="TableFooter";const ce=u.forwardRef(({className:e,...t},n)=>s.jsx("tr",{ref:n,className:ie("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t}));ce.displayName="TableRow";const Y=u.forwardRef(({className:e,...t},n)=>s.jsx("th",{ref:n,className:ie("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}));Y.displayName="TableHead";const q=u.forwardRef(({className:e,...t},n)=>s.jsx("td",{ref:n,className:ie("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t}));q.displayName="TableCell";const x$=u.forwardRef(({className:e,...t},n)=>s.jsx("caption",{ref:n,className:ie("text-muted-foreground mt-4 text-sm",e),...t}));x$.displayName="TableCaption";var Sd="Tabs",[g$]=Ns(Sd,[gd]),UN=gd(),[v$,Wp]=g$(Sd),BN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,onValueChange:l,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:c="automatic",...d}=e,f=hd(o),[h,m]=Oa({prop:a,onChange:l,defaultProp:r??"",caller:Sd});return s.jsx(v$,{scope:n,baseId:Xn(),value:h,onValueChange:m,orientation:i,dir:f,activationMode:c,children:s.jsx(Ne.div,{dir:f,"data-orientation":i,...d,ref:t})})});BN.displayName=Sd;var HN="TabsList",IN=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:a=!0,...l}=e,r=Wp(HN,n),i=UN(n);return s.jsx(n_,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:a,children:s.jsx(Ne.div,{role:"tablist","aria-orientation":r.orientation,...l,ref:t})})});IN.displayName=HN;var PN="TabsTrigger",qN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,disabled:l=!1,...r}=e,i=Wp(PN,n),o=UN(n),c=YN(i.baseId,a),d=FN(i.baseId,a),f=a===i.value;return s.jsx(s_,{asChild:!0,...o,focusable:!l,active:f,children:s.jsx(Ne.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:c,...r,ref:t,onMouseDown:ue(e.onMouseDown,h=>{!l&&h.button===0&&h.ctrlKey===!1?i.onValueChange(a):h.preventDefault()}),onKeyDown:ue(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(a)}),onFocus:ue(e.onFocus,()=>{const h=i.activationMode!=="manual";!f&&!l&&h&&i.onValueChange(a)})})})});qN.displayName=PN;var GN="TabsContent",VN=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:a,forceMount:l,children:r,...i}=e,o=Wp(GN,n),c=YN(o.baseId,a),d=FN(o.baseId,a),f=a===o.value,h=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),s.jsx(zn,{present:l||f,children:({present:m})=>s.jsx(Ne.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:m&&r})})});VN.displayName=GN;function YN(e,t){return`${e}-trigger-${t}`}function FN(e,t){return`${e}-content-${t}`}var y$=BN,KN=IN,XN=qN,QN=VN;const b$=y$,ZN=u.forwardRef(({className:e,...t},n)=>s.jsx(KN,{ref:n,className:ie("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));ZN.displayName=KN.displayName;const am=u.forwardRef(({className:e,...t},n)=>s.jsx(XN,{ref:n,className:ie("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}));am.displayName=XN.displayName;const j$=u.forwardRef(({className:e,...t},n)=>s.jsx(QN,{ref:n,className:ie("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));j$.displayName=QN.displayName;const as=u.forwardRef(({className:e,...t},n)=>s.jsx("textarea",{className:ie("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}));as.displayName="Textarea";var[Cd]=Ns("Tooltip",[Hr]),Rd=Hr(),WN="TooltipProvider",w$=700,lm="tooltip.open",[_$,Jp]=Cd(WN),JN=e=>{const{__scopeTooltip:t,delayDuration:n=w$,skipDelayDuration:a=300,disableHoverableContent:l=!1,children:r}=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(_$,{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:l,children:r})};JN.displayName=WN;var Wi="Tooltip",[N$,$o]=Cd(Wi),ek=e=>{const{__scopeTooltip:t,children:n,open:a,defaultOpen:l,onOpenChange:r,disableHoverableContent:i,delayDuration:o}=e,c=Jp(Wi,e.__scopeTooltip),d=Rd(t),[f,h]=u.useState(null),m=Xn(),x=u.useRef(0),j=i??c.disableHoverableContent,v=o??c.delayDuration,y=u.useRef(!1),[g,p]=Oa({prop:a,defaultProp:l??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(lm))):c.onClose(),r==null||r(_)},caller:Wi}),b=u.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),w=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,y.current=!1,p(!0)},[p]),N=u.useCallback(()=>{window.clearTimeout(x.current),x.current=0,p(!1)},[p]),R=u.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{y.current=!0,p(!0),x.current=0},v)},[v,p]);return u.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),s.jsx(Hp,{...d,children:s.jsx(N$,{scope:t,contentId:m,open:g,stateAttribute:b,trigger:f,onTriggerChange:h,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?R():w()},[c.isOpenDelayedRef,R,w]),onTriggerLeave:u.useCallback(()=>{j?N():(window.clearTimeout(x.current),x.current=0)},[N,j]),onOpen:w,onClose:N,disableHoverableContent:j,children:n})})};ek.displayName=Wi;var rm="TooltipTrigger",tk=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=$o(rm,n),r=Jp(rm,n),i=Rd(n),o=u.useRef(null),c=Ie(t,o,l.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),h=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(Ip,{asChild:!0,...i,children:s.jsx(Ne.button,{"aria-describedby":l.open?l.contentId:void 0,"data-state":l.stateAttribute,...a,ref:c,onPointerMove:ue(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!r.isPointerInTransitRef.current&&(l.onTriggerEnter(),f.current=!0)}),onPointerLeave:ue(e.onPointerLeave,()=>{l.onTriggerLeave(),f.current=!1}),onPointerDown:ue(e.onPointerDown,()=>{l.open&&l.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ue(e.onFocus,()=>{d.current||l.onOpen()}),onBlur:ue(e.onBlur,l.onClose),onClick:ue(e.onClick,l.onClose)})})});tk.displayName=rm;var ex="TooltipPortal",[k$,S$]=Cd(ex,{forceMount:void 0}),nk=e=>{const{__scopeTooltip:t,forceMount:n,children:a,container:l}=e,r=$o(ex,t);return s.jsx(k$,{scope:t,forceMount:n,children:s.jsx(zn,{present:n||r.open,children:s.jsx(So,{asChild:!0,container:l,children:a})})})};nk.displayName=ex;var _r="TooltipContent",sk=u.forwardRef((e,t)=>{const n=S$(_r,e.__scopeTooltip),{forceMount:a=n.forceMount,side:l="top",...r}=e,i=$o(_r,e.__scopeTooltip);return s.jsx(zn,{present:a||i.open,children:i.disableHoverableContent?s.jsx(ak,{side:l,...r,ref:t}):s.jsx(C$,{side:l,...r,ref:t})})}),C$=u.forwardRef((e,t)=>{const n=$o(_r,e.__scopeTooltip),a=Jp(_r,e.__scopeTooltip),l=u.useRef(null),r=Ie(t,l),[i,o]=u.useState(null),{trigger:c,onClose:d}=n,f=l.current,{onPointerInTransitChange:h}=a,m=u.useCallback(()=>{o(null),h(!1)},[h]),x=u.useCallback((j,v)=>{const y=j.currentTarget,g={x:j.clientX,y:j.clientY},p=M$(g,y.getBoundingClientRect()),b=O$(g,p),w=$$(v.getBoundingClientRect()),N=z$([...b,...w]);o(N),h(!0)},[h]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const j=y=>x(y,f),v=y=>x(y,c);return c.addEventListener("pointerleave",j),f.addEventListener("pointerleave",v),()=>{c.removeEventListener("pointerleave",j),f.removeEventListener("pointerleave",v)}}},[c,f,x,m]),u.useEffect(()=>{if(i){const j=v=>{const y=v.target,g={x:v.clientX,y:v.clientY},p=(c==null?void 0:c.contains(y))||(f==null?void 0:f.contains(y)),b=!D$(g,i);p?m():b&&(m(),d())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[c,f,i,d,m]),s.jsx(ak,{...e,ref:r})}),[R$,T$]=Cd(Wi,{isInside:!1}),E$=wE("TooltipContent"),ak=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:a,"aria-label":l,onEscapeKeyDown:r,onPointerDownOutside:i,...o}=e,c=$o(_r,n),d=Rd(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(lm,f),()=>document.removeEventListener(lm,f)),[f]),u.useEffect(()=>{if(c.trigger){const h=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,f]),s.jsx(ko,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:s.jsxs(Pp,{"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(E$,{children:a}),s.jsx(R$,{scope:n,isInside:!0,children:s.jsx(L4,{id:c.contentId,role:"tooltip",children:l||a})})]})})});sk.displayName=_r;var lk="TooltipArrow",A$=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...a}=e,l=Rd(n);return T$(lk,n).isInside?null:s.jsx(qp,{...l,...a,ref:t})});A$.displayName=lk;function M$(e,t){const n=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),l=Math.abs(t.right-e.x),r=Math.abs(t.left-e.x);switch(Math.min(n,a,l,r)){case r:return"left";case l:return"right";case n:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function O$(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 $$(e){const{top:t,right:n,bottom:a,left:l}=e;return[{x:l,y:t},{x:n,y:t},{x:n,y:a},{x:l,y:a}]}function D$(e,t){const{x:n,y:a}=e;let l=!1;for(let r=0,i=t.length-1;r<t.length;i=r++){const o=t[r],c=t[i],d=o.x,f=o.y,h=c.x,m=c.y;f>a!=m>a&&n<(h-d)*(a-f)/(m-f)+d&&(l=!l)}return l}function z$(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),L$(t)}function L$(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const l=e[a];for(;t.length>=2;){const r=t[t.length-1],i=t[t.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))t.pop();else break}t.push(l)}t.pop();const n=[];for(let a=e.length-1;a>=0;a--){const l=e[a];for(;n.length>=2;){const r=n[n.length-1],i=n[n.length-2];if((r.x-i.x)*(l.y-i.y)>=(r.y-i.y)*(l.x-i.x))n.pop();else break}n.push(l)}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 U$=JN,B$=ek,H$=tk,I$=nk,rk=sk;const ik=U$,ok=B$,ck=H$,tx=u.forwardRef(({className:e,sideOffset:t=4,...n},a)=>{const l=Co(),r=s.jsx(rk,{ref:a,sideOffset:t,className:ie("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 l?s.jsx(I$,{container:l,children:r}):r});tx.displayName=rk.displayName;function Xs({page:e,header:t}){return s.jsxs(s.Fragment,{children:[t??s.jsx(Yt,{title:e}),s.jsx(P$,{page:e})]})}function P$({page:e}){return s.jsxs(pe,{variant:"info",role:"status",className:"mt-6","data-testid":"not-installed",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:b0(e)})]})}const Mv=["none","read","comment","write","manage","admin"];function Su(e,t){return Mv.indexOf(e??"none")>=Mv.indexOf(t)}function nx(e){return e==="api_key"?"API key":e==="sdlc_login"?"sdlc login":null}function Of(e,t){const n=nx(e);return e==="sdlc_login"&&t?`${n} on ${uk(t)}`:n}const q$=String.fromCodePoint(8296),G$=String.fromCodePoint(8297);function uk(e){return`${q$}${e}${G$}`}const Ji={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"}},V$={backlog:"neutral",planned:"neutral",in_progress:"info",completed:"success",canceled:"neutral"};function dk(e){return e.name==="Blocked"?"warning":V$[e.category]}const Ov=1800;function es(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Qn(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}function sx(e){return`${Mn(e)}, ${Qn(e)}`}function ni(e){return e<90?`${Math.round(e)} s`:e<5400?`${Math.round(e/60)} min`:`${(e/3600).toFixed(1).replace(/\.0$/,"")} h`}function Mn(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function fk(e){return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Y$(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 F$(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 la="not_set";function K$({open:e,commands:t,list_id:n,list_revision:a,default_status_id:l,statuses:r,priorities:i,members:o,on_close:c,on_created:d}){var V;const f=Mr(),[h,m]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(l??((V=r[0])==null?void 0:V.id)??""),[g,p]=u.useState(la),[b,w]=u.useState(la),[N,R]=u.useState(!1),[_,k]=u.useState(null),[L,z]=u.useState(!1);u.useEffect(()=>{var U;e&&(m(""),j(""),y(l??((U=r[0])==null?void 0:U.id)??""),p(la),w(la),R(!1),k(null))},[e,l,r]);const X=async U=>{if(U.preventDefault(),!h.trim()){R(!0);return}z(!0),k(null);try{const M=await t.run("create_task",{list_id:n,expected_list_revision:a,title:h.trim(),description:x.trim()||null,status_id:v||null,priority_id:g===la?null:g,primary_user_id:b===la?null:b});if(!M.ok){k(M.refusal.message);return}f.success("Task created."),await d()}finally{z(!1)}};return s.jsx(Ln,{open:e,onOpenChange:U=>U?null:c(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:U=>void X(U),noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"New task"}),s.jsx(Pn,{children:"Add a task to this List."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[_&&s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:_})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-title",children:"Title"}),s.jsx(_t,{id:"new-task-title",placeholder:"What needs doing",value:h,required:!0,"aria-invalid":N,"aria-describedby":N?"new-task-title-error":void 0,onChange:U=>{m(U.target.value),R(!1)}}),N&&s.jsx("p",{id:"new-task-title-error",className:"text-destructive text-xs",children:"Give the task a title."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-description",children:"Description (optional)"}),s.jsx(as,{id:"new-task-description",rows:4,value:x,onChange:U=>j(U.target.value)})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-status",children:"Status"}),s.jsxs(dt,{value:v,onValueChange:y,children:[s.jsx(rt,{id:"new-task-status",children:s.jsx(ft,{})}),s.jsx(it,{children:r.map(U=>s.jsx(Se,{value:U.id,children:U.name},U.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-priority",children:"Priority"}),s.jsxs(dt,{value:g,onValueChange:p,children:[s.jsx(rt,{id:"new-task-priority",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:la,children:"Not set"}),i.map(U=>s.jsx(Se,{value:U.id,children:U.name},U.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"new-task-primary",children:"Primary"}),s.jsxs(dt,{value:b,onValueChange:w,children:[s.jsx(rt,{id:"new-task-primary",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:la,children:"Not set"}),o.map(U=>s.jsx(Se,{value:U.user_id,children:U.label},U.user_id))]})]})]})]})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",onClick:c,children:"Cancel"}),s.jsx(G,{type:"submit",disabled:L,children:L?"Creating…":"Create task"})]})]})})})}const X$="Your organization's work, in queue order. Claim a task to show you are working on it.",fi="any",hk="none",Q$=1,Z$=250;function ax(){const e=ln().tasks;if(!e)throw new Error("The Tasks page rendered without the tasks seam.");return e}function W$({org:e}){var j,v;const t=ax(),{href:n,Link:a}=Fe(),[l,r]=u.useState({state:"loading"}),[i,o]=u.useState([]),[c,d]=u.useState(null),f=u.useRef(0),h=u.useCallback(async y=>{const g=f.current+=1;y&&r({state:"loading"});const p=await t.availability({fresh:y});g===f.current&&r(p)},[t.availability]);u.useEffect(()=>{h(!1)},[h]);const m=u.useCallback(()=>void h(!0),[h]);if(u.useEffect(()=>{let y=!0;return t.members().then(g=>{y&&g.ok&&o(g.data)}),()=>{y=!1}},[t.members]),u.useEffect(()=>{if(!t.access)return;let y=!0;return t.access().then(g=>{y&&g.ok&&d(g.data)}),()=>{y=!1}},[t.access]),l.state==="off"&&((j=l.refusal)==null?void 0:j.reason)!=="engine_missing")return s.jsx(Ba,{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)??X$;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:l.state==="active"?s.jsx(eD,{active:l,org:e,members:i,description:x,read_only_reason:c==null?void 0:c.read_only_reason,reload_configuration:m}):l.state==="off"&&((v=l.refusal)==null?void 0:v.reason)==="engine_missing"?s.jsx(Xs,{page:"Tasks"}):s.jsxs(s.Fragment,{children:[s.jsx(Yt,{title:"Tasks",description:x}),l.state==="loading"&&s.jsx(mk,{}),(l.state==="error"||l.state==="off")&&s.jsx(pk,{refusal:l.refusal,on_retry:m}),l.state==="available"&&s.jsx(J$,{on_done:m})]})})}function mk(){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(xt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function pk({refusal:e,on_retry:t}){const n=ns();return(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(pe,{variant:"warning",className:"mt-6",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsx(xe,{children:n})]}):s.jsxs(pe,{variant:"destructive",className:"mt-6",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Tasks could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:e!=null&&e.reason?e.message:"Check your connection and try again."}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function J$({on_done:e}){const{commands:t}=ax(),n=Mr(),[a,l]=u.useState(!1),r=t==null?void 0:t.activate,i=async()=>{if(!r)return;l(!0);const o=await r();if(l(!1),!o.ok){n.error(o.refusal.message);return}n.success("Tasks are on."),e()};return s.jsxs(pe,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{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."}),r?s.jsx(G,{type:"button",size:"sm",className:"mt-2",disabled:a,onClick:()=>void i(),children:"Turn on Tasks"}):null]})]})}const $f=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function eD({active:e,org:t,members:n,description:a,read_only_reason:l,reload_configuration:r}){var Cx;const{commands:i,listTasks:o,waitingOnYou:c,hierarchyRevision:d}=ax(),{href:f,Link:h}=Fe(),{self_id:m}=ed(),x=Mr(),{list:j,workspace:v}=e,y=j.offers,g=y!==void 0,p=u.useMemo(()=>{var I;return((I=v.workflows.find(oe=>oe.id===j.workflow_id))==null?void 0:I.statuses)??[]},[v,j]),b=v.priorities,w=!!i&&Su(j.permission,"write"),N=w&&Su(j.permission,"manage"),R=u.useMemo(()=>new Map(n.map(I=>[I.user_id,I])),[n]),_=I=>{var oe;return I?I===m?"You":((oe=R.get(I))==null?void 0:oe.label)??"A member":""},[k,L]=u.useState("active"),[z,X]=u.useState(!1),[V,U]=u.useState(""),[M,A]=u.useState("");u.useEffect(()=>{const I=setTimeout(()=>A(V),Z$);return()=>clearTimeout(I)},[V]);const[S,E]=u.useState(null),[C,$]=u.useState(fi),[F,T]=u.useState(!1),[P,ne]=u.useState(!1),[le,ge]=u.useState({}),[Z,O]=u.useState([]),[H,se]=u.useState(null),[B,ee]=u.useState([]),[W,ae]=u.useState(null),[J,Qe]=u.useState(0),[de,Me]=u.useState(!1),[K,ke]=u.useState(null),[Pe,Nt]=u.useState(null),je=ns(),[It,Et]=u.useState(!1),[rn,ls]=u.useState(null),[Ft,Kt]=u.useState({}),[Ga,Qs]=u.useState(""),{confirm:re,confirm_dialog:ze}=Ro(),qe=u.useRef(null),rs=u.useRef(null),wn=u.useRef(null),is=u.useRef(null),[ot,Zs]=u.useState(void 0),Ws=!!(M.trim()||S||C!==fi||F||P),Js=u.useRef(0),ea=u.useRef(0),D=u.useCallback(async(I,oe=!1)=>{if(oe&&ea.current>0)return;const De=I?Js.current:Js.current+=1,et={state:k,assigned_to_me:z||void 0,cursor:I,search:M.trim()||void 0,group:S??void 0,owner:C===fi?void 0:C===hk?"":C,urgent:F||void 0,over_estimate:P||void 0,...tD(le,Z)},Qt=Zt=>o(j.id,{...et,cursor:Zt});I||(ea.current+=1);let ht=await Qt(I).finally(()=>{I||(ea.current-=1)}),kt=!!I;if(!ht.ok&&ht.refusal.code==="cursor_stale"&&(ht=await Qt(),kt=!1),De!==Js.current)return;if(!ht.ok){ae(ht.refusal),Qe(Zt=>Zt+1);return}const vt=ht.data;ae(null),Qe(0),!(oe&&$f(vt,wn.current))&&(wn.current=vt,se(vt),vt.facets&&Zs(vt.facets),ee(Zt=>kt?[...Zt,...vt.tasks]:vt.tasks))},[o,j.id,k,z,M,S,C,F,P,le,Z]),ye=u.useCallback(async()=>{const I=await c();if(Nt(De=>I.ok?null:$f(De,I.refusal)?De:I.refusal),!I.ok&&g)return;const oe=I.ok?I.data:null;$f(oe,is.current)||(is.current=oe,ke(oe))},[c,g]);u.useEffect(()=>{wn.current=null,se(null)},[k,z]),u.useEffect(()=>{D()},[D]),u.useEffect(()=>{ye()},[ye]);const te=u.useCallback(async()=>{await Promise.all([D(),ye()])},[D,ye]),we=u.useRef(te);we.current=te;const Xt=y==null?void 0:y.refresh_ms;u.useEffect(()=>{if(!Xt)return;const I=setInterval(()=>{D(void 0,!0),ye()},Xt);return()=>clearInterval(I)},[Xt,D,ye]);const ta=u.useCallback(async(I,oe,De)=>{if(!i)return;const et=await i.run(I,oe);et.ok?De&&x.success(De):(x.error(et.refusal.message),et.refusal.code==="revision_conflict"&&r()),await te()},[i,x,te,r]),Uo=p.find(I=>I.category==="completed"),_x=async(I,oe,De)=>{const et=oe+De,Qt=B[et];if(!Qt||!H||!i)return;const ht=async(kt,vt)=>{const Zt=await i.run(kt,vt);if(!Zt.ok)throw Zt.refusal;return Zt.data};try{let kt=H.list.order_revision,vt=I.revision;if(Qt.queue_rank===null){const Zt=B.findIndex(Ss=>Ss.queue_rank===null);for(const Ss of B.slice(Zt,et+1)){const Rx=await ht("reorder",{task_id:Ss.id,expected_revision:Ss.revision,expected_order_revision:kt,placement:"end"});kt=Rx.list.order_revision,Ss.id===I.id&&(vt=Rx.task.revision)}}await ht("reorder",{task_id:I.id,expected_revision:vt,expected_order_revision:kt,placement:De<0?"before":"after",anchor_task_id:Qt.id})}catch(kt){x.error(kt.message)}await te()},k1=I=>{Uo&&ta("update_task",{task_id:I.id,expected_revision:I.revision,changes:{status_id:Uo.id}},`${I.title} completed.`)},S1=async I=>{if(!H||!await re({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[De,et]=await Promise.all([o(j.id,{limit:1}),d(v.id)]);if(!De.ok||!et.ok){x.error(De.ok?et.ok?"":et.refusal.message:De.refusal.message);return}await ta("archive_task",{task_id:I.id,expected_revision:I.revision,expected_order_revision:De.data.list.order_revision,expected_hierarchy_revision:et.data},`${I.title} archived.`)},C1=async I=>{await ta("release_hold",{hold_id:I},"Hold released.")},Nx=async(I,oe,De,et)=>{if(!(i!=null&&i.complete)||!await re({title:`Mark ${oe} done?`,description:De.reason?`“${De.reason}”
384
+
385
+ It leaves the open tasks.`:"It leaves the open tasks.",action_label:"Mark done"}))return;ls(I);const ht=await i.complete(De);if(ls(null),!ht.ok){Kt(kt=>({...kt,[I]:ht.refusal.message}));return}Kt(({[I]:kt,...vt})=>vt),Qs(`${oe} marked done.`),await we.current(),kx({next:et})},[Yr,kx]=u.useState(null);u.useEffect(()=>{var et;if(!Yr)return;kx(null);const I=rs.current,oe=typeof Yr.next=="function"?Yr.next():Yr.next;(et=(oe?(I==null?void 0:I.querySelector(`[data-done-key="${CSS.escape(oe)}"]`))??(I==null?void 0:I.querySelector(`[data-title-key="${CSS.escape(oe)}"] a`)):null)??qe.current)==null||et.focus()},[Yr]);const Sx=()=>{var I;U(""),A(""),E(null),$(fi),T(!1),ne(!1),(I=qe.current)==null||I.focus()},R1=new Map(p.map(I=>[I.id,I])),T1=new Map(b.map(I=>[I.id,I])),Od=new Map(B.map(I=>[I.id,I.title])),$d=w&&k==="active",E1=B.some(I=>I.local_done),Dd=$d||E1,zd=!g||b.length>0,A1=!z&&!Ws,Ld=5+(zd?1:0)+(Dd?1:0),M1=W!==null&&(W.reason==="store_locked"||W.reason==="engine_failed")&&J<=Q$,Bo=(K==null?void 0:K.holds)??[],Ud=H==null?void 0:H.groups,O1=nD(B,Ud,le,(H==null?void 0:H.matched)===void 0?Z:[]),Ho=Ud?Ud.length===0:B.length===0,$1=(I,oe)=>ge(De=>({...De,[I]:!oe})),D1=I=>O(oe=>oe.includes(I)?oe.filter(De=>De!==I):[...oe,I]),z1=Bo.map(I=>I.id);return s.jsxs("div",{ref:rs,className:"contents",children:[s.jsx(Yt,{title:"Tasks",description:a,actions:w?s.jsxs(G,{type:"button",onClick:()=>Et(!0),children:[s.jsx(br,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]}):null}),g&&(H!=null&&H.open)?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[H.open," open"]}):null,Xt?s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",role:"status",children:W?`Not reading · trying again every ${Math.round(Xt/1e3)}s`:H?`Live · refreshes every ${Math.round(Xt/1e3)}s`:"Connecting…"}):null,g?s.jsx("p",{className:"sr-only",role:"status",children:Ga}):null,(g||Bo.length>0)&&s.jsxs(gt,{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"}),Bo.length>0?s.jsx("ul",{className:"mt-2 divide-y","aria-labelledby":"waiting-title",children:Bo.map((I,oe)=>{var ht,kt;const De=Ji[I.hold_type],et=I.target.kind==="task"?`Because you claim ${Od.get(I.target.task_id)??"the task it waits on"} · `:"",Qt=I.local_done;return s.jsxs("li",{id:`waiting-${I.id}`,"data-title-key":I.id,className:"flex flex-wrap items-center gap-3 py-2",children:[I.task?s.jsx(h,{className:"text-primary min-w-40 flex-1 hover:underline",href:f(`/org/${t}/tasks/${I.task.id}`),children:I.task.title}):s.jsx("span",{className:"min-w-40 flex-1",children:I.reason}),s.jsx(me,{variant:De.tone,children:I.local_label??De.label}),s.jsxs("div",{className:"min-w-48 flex-2",children:[I.task?s.jsx("div",{className:"text-sm",children:I.reason}):null,s.jsxs("div",{className:"text-muted-foreground text-xs",children:[et,"From ",_(I.opened_by)," · ",Mn(I.opened_at)]}),(ht=I.local_threads)!=null&&ht.length?s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Answer it in"," ",s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/threads`),children:"Threads"}),": ",I.local_threads.join(" · ")]}):null,Ft[I.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Ft[I.id]}):null]}),Qt&&(i!=null&&i.complete)?s.jsx(G,{type:"button",variant:"outline",size:"sm","data-done-key":I.id,"aria-label":`Mark ${((kt=I.task)==null?void 0:kt.title)??I.reason} done`,loading:rn===I.id,onClick:()=>{var vt;return void Nx(I.id,((vt=I.task)==null?void 0:vt.title)??I.reason,Qt,z1[oe+1]??null)},children:"Done"}):null,g?null:s.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>void C1(I.id),children:"Release"})]},I.id)})}):K?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"Nothing in this checkout waits on you."}):null,g&&Pe?s.jsx("p",{className:"text-muted-foreground mt-2 text-sm",role:"status",children:Pe.reason==="view_outdated"?`Waiting on you is not read here. ${je}`:"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&&!l&&s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(_o,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"You can view these tasks"}),s.jsx(xe,{children:"Ask an organization admin for write access to change them."})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-4",children:[(y==null?void 0:y.archived)!==!1?s.jsx(b$,{value:k,onValueChange:I=>L(I),children:s.jsxs(ZN,{"aria-label":"Which tasks",children:[s.jsx(am,{value:"active",children:"Active"}),s.jsx(am,{value:"archived",children:"Archived"})]})}):null,(y==null?void 0:y.assigned_to_me)!==!1?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Lr,{id:"tasks-mine",checked:z,onCheckedChange:I=>X(I===!0)}),s.jsx(Oe,{htmlFor:"tasks-mine",children:"Assigned to me"})]}):null,y!=null&&y.search?s.jsx(_t,{ref:qe,type:"search",className:"w-64","aria-label":"Search tasks",placeholder:"Search title, ID or detail",value:V,onChange:I=>U(I.target.value)}):null,ot!=null&&ot.owners?s.jsx(iD,{owners:ot.owners,no_owner:ot.no_owner,value:C,on_change:$}):null]}),(Cx=ot==null?void 0:ot.groups)!=null&&Cx.length?s.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",role:"group","aria-label":"Status",children:[ot.groups.map(I=>s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":S===I.id,onClick:()=>E(oe=>oe===I.id?null:I.id),children:[I.label," ",I.count]},I.id)),ot.marks?s.jsxs(s.Fragment,{children:[s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":F,onClick:()=>T(I=>!I),children:["Urgent ",ot.marks.urgent]}),s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":P,onClick:()=>ne(I=>!I),children:["Over estimate ",ot.marks.over_estimate]})]}):null]}):null,Ws&&(H==null?void 0:H.matched)!==void 0&&H.total!==void 0?s.jsxs("p",{className:"text-muted-foreground mt-2 text-sm",children:[H.matched," of ",H.total," match ·"," ",s.jsx(G,{type:"button",variant:"link",size:"inline-sm",onClick:Sx,children:"Clear"})]}):null,M1?s.jsx("p",{className:"text-muted-foreground mt-4 text-sm",children:"Tasks are busy. Reading them again…"}):W?s.jsx(pk,{refusal:W,on_retry:()=>void D()}):null,!H&&!W&&s.jsx(mk,{}),H&&Ho&&Ws?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(sd,{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(G,{type:"button",variant:"outline",onClick:Sx,children:"Clear filters"})]}):H&&Ho&&k==="active"&&!z&&g?s.jsx("p",{className:"text-muted-foreground mt-6 text-sm",children:"No tasks recorded yet."}):H&&Ho&&k==="active"&&!z?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(x0,{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(G,{type:"button",onClick:()=>Et(!0),children:[s.jsx(br,{className:"mr-2 size-4","aria-hidden":"true"}),"New task"]})]}):H?s.jsxs(s.Fragment,{children:[s.jsx(gt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Tasks",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Title"}),s.jsx(Y,{children:"Status"}),zd?s.jsx(Y,{className:"hidden md:table-cell",children:"Priority"}):null,s.jsx(Y,{className:"hidden md:table-cell",children:"Primary"}),s.jsx(Y,{className:"hidden md:table-cell",children:"Holds"}),s.jsx(Y,{children:"Claimed by"}),Dd?s.jsx(Y,{className:"text-right",children:"Actions"}):null]})}),s.jsxs(He,{children:[O1.map(I=>{var kt,vt;if(I.kind==="group")return s.jsx(aD,{group:I.group,open:I.open,columns:Ld,on_toggle:()=>$1(I.group.id,I.open)},`group:${I.group.id}`);if(I.kind==="more")return s.jsx(lD,{group:I.group,whole:Z.includes(I.group.id),columns:Ld,on_toggle:()=>D1(I.group.id)},`more:${I.group.id}`);const{row:oe,index:De}=I,et=R1.get(oe.status_id),Qt=Y$(oe),ht=oe.local_done;return s.jsxs(ce,{"data-testid":"tasks-row",children:[s.jsxs(q,{"data-title-key":oe.id,children:[oe.no_page?s.jsx("span",{children:oe.title}):s.jsx(h,{className:"text-primary hover:underline",href:f(`/org/${t}/tasks/${oe.id}`),children:oe.title}),oe.parent_task_id&&Od.get(oe.parent_task_id)?s.jsx("div",{className:"text-muted-foreground text-xs",children:Od.get(oe.parent_task_id)}):null,g?s.jsx(rD,{row:oe}):null,Ft[oe.id]?s.jsx("div",{className:"text-destructive text-xs",role:"alert",children:Ft[oe.id]}):null]}),s.jsx(q,{children:et?s.jsx(me,{variant:dk(et),children:et.name}):null}),zd?s.jsx(q,{className:"hidden md:table-cell",children:oe.priority_id?((kt=T1.get(oe.priority_id))==null?void 0:kt.name)??"":s.jsx("span",{className:"text-muted-foreground",children:"Not set"})}):null,s.jsx(q,{className:"hidden md:table-cell",children:oe.owner_title?oe.owner_title:oe.primary_user_id?_(oe.primary_user_id):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}),s.jsx(q,{className:"hidden md:table-cell",children:Qt?s.jsx(me,{variant:Qt.tone,children:Qt.label}):s.jsx("span",{className:"text-muted-foreground",children:"None"})}),s.jsx(q,{"data-testid":"tasks-claim",children:s.jsx(oD,{row:oe,holder:_((vt=oe.claim)==null?void 0:vt.user_id)})}),Dd?s.jsx(q,{className:"text-right whitespace-nowrap",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[ht&&"hold"in ht?s.jsx("a",{className:"text-primary text-sm hover:underline",href:`#waiting-${ht.hold}`,children:"In Waiting on you"}):ht&&(i!=null&&i.complete)?s.jsx(G,{type:"button",variant:"outline",size:"sm","data-done-key":oe.id,"aria-label":`Mark ${oe.title} done`,loading:rn===oe.id,onClick:()=>void Nx(oe.id,oe.title,ht,()=>{var Zt;return(((Zt=wn.current)==null?void 0:Zt.tasks)??[]).map(Ss=>Ss.id).filter(Ss=>Ss!==oe.id)[De]??null}),children:"Done"}):null,$d&&A1?s.jsxs(s.Fragment,{children:[s.jsx(G,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} up`,disabled:De===0,onClick:()=>void _x(oe,De,-1),children:s.jsx(KC,{className:"size-4","aria-hidden":"true"})}),s.jsx(G,{type:"button",variant:"outline",size:"icon","aria-label":`Move ${oe.title} down`,disabled:De===B.length-1,onClick:()=>void _x(oe,De,1),children:s.jsx(VC,{className:"size-4","aria-hidden":"true"})})]}):null,$d?s.jsxs(jd,{children:[s.jsx(wd,{asChild:!0,children:s.jsx(G,{type:"button",variant:"outline",size:"icon","aria-label":`More actions for ${oe.title}`,children:s.jsx(vp,{className:"size-4","aria-hidden":"true"})})}),s.jsxs(Oo,{align:"end",children:[Uo&&oe.status_id!==Uo.id?s.jsx(wr,{onSelect:()=>k1(oe),children:"Complete"}):null,N?s.jsx(wr,{className:"text-destructive focus:text-destructive",onSelect:()=>void S1(oe),children:"Archive"}):null]})]}):null]})}):null]},oe.id)}),Ho&&s.jsx(ce,{children:s.jsx(q,{colSpan:Ld,className:"text-muted-foreground h-24 text-center",children:k==="archived"?"No archived tasks.":"No tasks are assigned to you."})})]})]})}),H.next_cursor?s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2 self-start",disabled:de,onClick:async()=>{Me(!0),await D(H.next_cursor??void 0),Me(!1)},children:"Load more"}):null]}):null,w&&i&&s.jsx(K$,{open:It,commands:i,list_id:j.id,list_revision:(H==null?void 0:H.list.revision)??j.revision,default_status_id:j.default_status_id,statuses:p,priorities:b,members:n,on_close:()=>Et(!1),on_created:async()=>{Et(!1),await te()}}),ze]})}function tD(e,t){const n=Object.keys(e).filter(l=>e[l]),a=Object.keys(e).filter(l=>!e[l]);return{...n.length?{opened_groups:n}:{},...a.length?{closed_groups:a}:{},...t.length?{all_groups:t}:{}}}function nD(e,t,n,a){if(!t)return e.map((r,i)=>({kind:"row",row:r,index:i}));const l=[];for(const r of t){const i=n[r.id]??r.open;if(l.push({kind:"group",group:r,open:i}),!i||!r.open)continue;let o=0;e.forEach((c,d)=>{c.local_state===r.id&&(l.push({kind:"row",row:c,index:d}),o+=1)}),(r.hidden>0||a.includes(r.id)&&o>sD)&&l.push({kind:"more",group:r})}return l}const sD=10;function aD({group:e,open:t,columns:n,on_toggle:a}){const l=t?h0:gp;return s.jsx(ce,{"data-testid":"tasks-group",children:s.jsx(q,{colSpan:n,className:"p-1",children:s.jsxs(G,{type:"button",variant:"ghost",size:"sm",className:"w-full justify-start font-semibold","aria-expanded":t,onClick:a,children:[s.jsx(l,{className:"size-4","aria-hidden":"true"}),e.label," ",e.count]})})})}function lD({group:e,whole:t,columns:n,on_toggle:a}){return s.jsx(ce,{"data-testid":"tasks-group-more",children:s.jsx(q,{colSpan:n,children:s.jsx(G,{type:"button",variant:"link",size:"sm",className:"px-0","aria-expanded":t,onClick:a,children:t?"Show fewer":`Show all ${e.count}`})})})}function rD({row:e}){var n;const t=[e.local_after,e.local_detail].filter(Boolean).join(" · ");return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"text-muted-foreground font-mono text-xs",children:[e.id,e.match?` · matched in ${e.match}`:""]}),t?s.jsx("div",{className:"text-muted-foreground text-xs",children:t}):null,(n=e.local_marks)!=null&&n.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:e.local_marks.map(a=>s.jsx(me,{variant:a.tone??"neutral",children:a.label},a.label))}):null]})}function iD({owners:e,no_owner:t,value:n,on_change:a}){return s.jsxs(dt,{value:n,onValueChange:a,children:[s.jsx(rt,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:fi,children:"Any owner"}),e.map(l=>s.jsxs(Se,{value:l.id,children:[l.label," (",l.count,")"]},l.id)),t!==void 0?s.jsxs(Se,{value:hk,children:["No owner (",t,")"]}):null]})]})}function oD({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 ${es(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?` · ${nx(n.via)}`:""]}),s.jsxs("div",{className:"text-muted-foreground truncate text-xs",title:n.via==="sdlc_login"&&n.via_device?uk(n.via_device):void 0,children:["Until ",es(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 cD={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 uD({open:e,members:t,tasks:n,holds_my_web_claim:a,on_close:l,on_submit:r}){const[i,o]=u.useState("waiting_for_user"),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(!1),[j,v]=u.useState({}),[y,g]=u.useState(null),[p,b]=u.useState(!1);u.useEffect(()=>{e&&(o("waiting_for_user"),d(""),h(""),x(!1),v({}),g(null))},[e]);const w=cD[i],N=async R=>{R.preventDefault();const _={target:w!==null&&!c.trim(),reason:!f.trim()};if(v(_),_.target||_.reason)return;b(!0);const k={hold_type:i,reason:f.trim(),release_claim:m};i==="waiting_for_user"&&(k.target_user_id=c),i==="blocked"&&(k.target_task_id=c),i==="waiting_for_external"&&(k.target_label=c.trim());const L=await r(k);b(!1),g(L)};return s.jsx(Ln,{open:e,onOpenChange:R=>R?null:l(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:R=>void N(R),noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"Add hold"}),s.jsx(Pn,{children:"Say what this task is waiting for."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y&&s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(xe,{children:y})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"hold-type",children:"Type"}),s.jsxs(dt,{value:i,onValueChange:R=>{o(R),d(""),v({})},children:[s.jsx(rt,{id:"hold-type",children:s.jsx(ft,{})}),s.jsx(it,{children:Object.keys(Ji).map(R=>s.jsx(Se,{value:R,children:Ji[R].label},R))})]})]}),w?s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"hold-target",children:w.label}),i==="waiting_for_external"?s.jsx(_t,{id:"hold-target",value:c,"aria-invalid":j.target,onChange:R=>d(R.target.value)}):s.jsxs(dt,{value:c,onValueChange:d,children:[s.jsx(rt,{id:"hold-target","aria-invalid":j.target,children:s.jsx(ft,{placeholder:i==="blocked"?"Choose a task":"Choose a member"})}),s.jsx(it,{children:i==="blocked"?n.map(R=>s.jsx(Se,{value:R.id,children:R.title},R.id)):t.map(R=>s.jsx(Se,{value:R.user_id,children:R.label},R.user_id))})]}),s.jsx("p",{className:j.target?"text-destructive text-xs":"text-muted-foreground text-xs",children:j.target?"Choose what it waits for.":w.help})]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"You resume it yourself."}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"hold-reason",children:"Reason"}),s.jsx(as,{id:"hold-reason",rows:3,placeholder:"What the task is waiting for",value:f,"aria-invalid":j.reason,onChange:R=>h(R.target.value)}),j.reason&&s.jsx("p",{className:"text-destructive text-xs",children:"Give a reason."})]}),a&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Lr,{id:"hold-release-claim",checked:m,onCheckedChange:R=>x(R===!0)}),s.jsx(Oe,{htmlFor:"hold-release-claim",children:"Also release my claim"})]})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),s.jsx(G,{type:"submit",disabled:p,children:p?"Adding…":"Add hold"})]})]})})})}function Do(){const e=ln().tasks;if(!e)throw new Error("The Task page rendered without the tasks seam.");return e}function lx(){return s.jsxs("div",{className:"grid gap-3",role:"status","aria-label":"Loading task",children:[s.jsx(xt,{className:"h-8 w-1/2"}),Array.from({length:7},(e,t)=>s.jsx(xt,{className:t===6?"h-6 w-2/3":"h-6 w-full"},t))]})}function Cu({back:e,description:t}){const{href:n,Link:a}=Fe();return s.jsx(Ba,{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 Tl="not_set",dD=10*60*1e3,$v=20;function fD(){const{members:e}=Do(),[t,n]=u.useState([]);u.useEffect(()=>{let r=!0;return e().then(i=>{r&&i.ok&&n(i.data)}),()=>{r=!1}},[e]);const a=u.useMemo(()=>new Map(t.map(r=>[r.user_id,r])),[t]),l=u.useCallback((r,i)=>{var o;return r?r===i?"You":((o=a.get(r))==null?void 0:o.label)??"A member":""},[a]);return{members:t,name:l}}function hD({active:e,task_id:t,back:n}){const a=Do(),{task:l,activity:r,listTasks:i,hierarchyRevision:o,commands:c}=a,{href:d,Link:f}=Fe(),h=Mr(),{self_id:m}=ed(),{members:x,name:j}=fD(),{workspace:v}=e,{confirm:y,confirm_dialog:g}=Ro(),[p,b]=u.useState(null),[w,N]=u.useState(!1),[R,_]=u.useState(!1),[k,L]=u.useState(null),[z,X]=u.useState([]),[V,U]=u.useState($v),[M,A]=u.useState([]),[S,E]=u.useState(!1),[C,$]=u.useState(null),[F,T]=u.useState(null),[P,ne]=u.useState(""),[le,ge]=u.useState(null),Z=u.useCallback(async()=>{if(!l)return;const D=await l(t);D.ok?(b(D.data),_(!1)):D.refusal.status===404||D.refusal.status===400?N(!0):_(!0)},[l,t]),O=u.useRef(0),H=u.useCallback(async()=>{if(!r)return;const D=O.current+=1;let ye=[],te;for(;;){const we=await r(t,te);if(D!==O.current||!we.ok)return;if(ye=[...ye,...we.data.events].slice(-1e3),!we.data.more||!we.data.next_cursor)break;te=we.data.next_cursor}D===O.current&&X(ye.reverse())},[r,t]);u.useEffect(()=>{Z(),H()},[Z,H]);const se=p?v.lists.find(D=>D.id===p.task.list_id):void 0,B=u.useMemo(()=>{var D;return((D=v.workflows.find(ye=>ye.id===(p==null?void 0:p.task.workflow_id)))==null?void 0:D.statuses)??[]},[v,p==null?void 0:p.task.workflow_id]);u.useEffect(()=>{if(!p)return;let D=!0;return i(p.task.list_id,{limit:100}).then(ye=>{D&&A(ye.ok?ye.data.tasks.filter(te=>te.id!==p.task.id).map(te=>({id:te.id,title:te.title})):[])}),()=>{D=!1}},[i,p==null?void 0:p.task.list_id,p==null?void 0:p.task.id,p]);const ee=u.useCallback(async()=>{await Promise.all([Z(),H()])},[Z,H]),W=u.useCallback((D,ye)=>c?c.run(D,ye):Promise.resolve({ok:!1,refusal:{status:0,message:"This page cannot change tasks."}}),[c]),ae=u.useCallback(async(D,ye,te)=>{const we=await W(D,ye);return we.ok?(te&&h.success(te),await ee(),we.data):(we.refusal.code==="revision_conflict"?L({tone:"warning",title:"This task changed while you were editing",body:"We reloaded it. Check the change, then save again."}):we.refusal.code==="claim_held"?(await Z(),L({tone:"destructive",title:"Someone else claimed this task first",body:"Their claim is shown below. You can take it over if it lapses."})):h.error(we.refusal.message),await ee(),null)},[W,h,ee,Z]),J=(p==null?void 0:p.claim)??null,Qe=J!==null&&J.id===le&&!J.lapsed&&!J.via?J.id:null;if(u.useEffect(()=>{if(!Qe)return;const D=window.setInterval(()=>{W("renew_claim",{claim_id:Qe,lease_seconds:Ov}).then(()=>Z())},dD);return()=>window.clearInterval(D)},[Qe,W,Z]),w)return s.jsx(Cu,{back:n});if(R&&!p)return s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This task could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"Check your connection and try again."}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void Z(),children:"Retry"})]})]});if(!p)return s.jsx(lx,{});const{task:de}=p,Me=de.archived_at!==null,K=Su(p.permission,"write")&&!Me,ke=Su(p.permission,"manage"),Pe=B.find(D=>D.id===de.status_id),Nt=B.find(D=>D.category==="completed"),je=v.priorities.find(D=>D.id===de.priority_id),It=p.contributors.map(D=>D.user_id),Et=J!==null&&J.user_id===m,rn=J!==null&&!J.lapsed,ls=p.checklist.filter(D=>D.is_complete).length,Ft=async()=>{const[D,ye]=await Promise.all([i(de.list_id,{limit:1}),o(v.id)]);return D.ok?ye.ok?{ok:!0,data:{task_id:de.id,expected_revision:de.revision,expected_order_revision:D.data.list.order_revision,expected_hierarchy_revision:ye.data}}:ye:D},Kt=(D,ye)=>ae("update_task",{task_id:de.id,expected_revision:de.revision,changes:D},ye),Ga=D=>y(D.via==="sdlc_login"?{title:"Release this claim?",description:`You claimed it via ${Of(D.via,D.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}),Qs=async()=>{if(!Nt)return;if(rn&&(!Et||J.via)){const ye=J.via==="api_key"?`${Et?"Your":`${j(J.user_id)}'s`} agent is still working on it.`:J.via==="sdlc_login"?`${Et?"You are":`${j(J.user_id)} is`} still working on it via ${Of(J.via,J.via_device)}.`:`${j(J.user_id)} is still working on it.`;if(!await y({title:"Complete this task?",description:ye,action_label:"Mark complete"}))return}await Kt({status_id:Nt.id},"Task completed.")!==null&&J&&Et&&rn&&await ae("end_claim",{claim_id:J.id,outcome:"completed"})},re=async(D,ye)=>{const te=await Ft();if(!te.ok){h.error(te.refusal.message);return}await ae(D,te.data,ye)},ze=async()=>{await y({title:"Archive this task?",description:"It leaves the queue and becomes read-only. Its claim, holds and history stay, and a manager can restore it.",action_label:"Archive task",destructive:!0})&&await re("archive_task","Task archived.")},qe=async()=>{await re("restore_task","Task restored.")},rs=async()=>{var we;const D=J,ye=await ae("claim_task",{task_id:de.id,lease_seconds:Ov}),te=(we=ye==null?void 0:ye.claim)==null?void 0:we.id;te&&!(D&&D.id===te&&D.via)&&ge(te)},wn=async()=>{J&&(J.via&&!await Ga(J)||(await ae("end_claim",{claim_id:J.id,outcome:"released"},"Claim released."),ge(null)))},is=async()=>{J&&await ae("end_claim",{claim_id:J.id,outcome:"expired"},"Claim cleared.")},ot=async D=>{D.hold_type==="paused"&&m&&(D={...D,target_user_id:m});const ye=await W("open_hold",{task_id:de.id,hold_type:D.hold_type,reason:D.reason,...D.target_user_id?{target_user_id:D.target_user_id}:{},...D.target_task_id?{target_task_id:D.target_task_id}:{},...D.target_label?{target_label:D.target_label}:{}});return ye.ok?(E(!1),h.success("Hold added."),D.release_claim&&J&&Et&&!J.via&&(await ae("end_claim",{claim_id:J.id,outcome:"released"}),ge(null)),await ee(),null):ye.refusal.message},Zs=D=>ae("checklist",{task_id:de.id,expected_revision:de.revision,...D}),Ws=async D=>{for(const ye of D.filter(te=>!It.includes(te)))await ae("set_contributor",{task_id:de.id,expected_revision:de.revision,user_id:ye,action:"add"});for(const ye of p.contributors.filter(te=>!D.includes(te.user_id)))await ae("set_contributor",{task_id:de.id,expected_revision:de.revision,user_id:ye.user_id,action:"remove",expected_contributor_revision:ye.revision})},Js=D=>{var te;if(D.target.kind==="user")return j(D.target.user_id,m);if(D.target.kind==="external")return D.target.label;if(D.target.hidden||!D.target.task_id)return"A task you cannot see";const ye=D.target.task_id;return s.jsx(f,{className:"text-primary hover:underline",href:d(`${n}/${ye}`),children:((te=M.find(we=>we.id===ye))==null?void 0:te.title)??"Another task"})},ea=D=>D.target.kind==="user"&&D.target.user_id===m&&!D.released_at?s.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>void ae("release_hold",{hold_id:D.id},"Hold released."),children:"Release"}):K?s.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:()=>void ae("resolve_hold",{hold_id:D.id},"Hold resolved."),children:"Resolve"}):null;return s.jsxs(s.Fragment,{children:[s.jsx(Yt,{title:de.title,description:`Created ${Mn(de.created_at)} by ${j(de.created_by,m)}`,actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[K&&s.jsxs(s.Fragment,{children:[s.jsxs(G,{type:"button",variant:"outline",onClick:()=>$(de.title),children:[s.jsx(nd,{className:"mr-2 size-4","aria-hidden":"true"}),"Edit title"]}),Nt&&de.status_id!==Nt.id&&s.jsxs(G,{type:"button",variant:"outline",onClick:()=>void Qs(),children:[s.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}),"Mark complete"]})]}),ke&&!Me&&s.jsxs(G,{type:"button",variant:"outline",onClick:()=>void ze(),children:[s.jsx(tv,{className:"mr-2 size-4","aria-hidden":"true"}),"Archive"]})]}),children:C!==null?s.jsxs("form",{className:"flex flex-wrap items-center gap-2 pt-1",onSubmit:async D=>{D.preventDefault(),C.trim()&&await Kt({title:C.trim()})!==null&&$(null)},children:[s.jsx(Oe,{htmlFor:"task-title",className:"sr-only",children:"Title"}),s.jsx(_t,{id:"task-title",className:"max-w-xl",value:C,onChange:D=>$(D.target.value)}),s.jsx(G,{type:"submit",size:"sm",children:"Save"}),s.jsx(G,{type:"button",size:"sm",variant:"outline",onClick:()=>$(null),children:"Cancel"})]}):null}),k&&s.jsxs(pe,{variant:k.tone,className:"mt-4","data-testid":"task-notice",children:[k.tone==="warning"?s.jsx(yl,{className:"size-4","aria-hidden":"true"}):s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:k.title}),s.jsx(xe,{children:k.body})]}),Me?s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(tv,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This task is archived"}),s.jsx(xe,{children:ke?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(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void qe(),children:[s.jsx(PC,{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."})})]}):K?null:s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(_o,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"You can view this task"}),s.jsx(xe,{children:"Ask an organization admin for write access to change it."})]}),K?s.jsxs("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-status",children:"Status"}),s.jsxs(dt,{value:de.status_id,onValueChange:D=>void Kt({status_id:D}),children:[s.jsx(rt,{id:"task-status",children:s.jsx(ft,{})}),s.jsx(it,{children:B.map(D=>s.jsx(Se,{value:D.id,children:D.name},D.id))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-priority",children:"Priority"}),s.jsxs(dt,{value:de.priority_id??Tl,onValueChange:D=>void Kt({priority_id:D===Tl?null:D}),children:[s.jsx(rt,{id:"task-priority",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:Tl,children:"Not set"}),v.priorities.map(D=>s.jsx(Se,{value:D.id,children:D.name},D.id))]})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-primary",children:"Primary"}),s.jsxs(dt,{value:de.primary_user_id??Tl,onValueChange:D=>void Kt({primary_user_id:D===Tl?null:D}),children:[s.jsx(rt,{id:"task-primary",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:Tl,children:"Not set"}),x.map(D=>s.jsx(Se,{value:D.user_id,children:D.label},D.user_id))]})]})]}),s.jsx(mD,{members:x,selected:It,on_change:D=>void Ws(D)})]}):s.jsxs("dl",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(uc,{label:"Status",value:(Pe==null?void 0:Pe.name)??""}),s.jsx(uc,{label:"Priority",value:(je==null?void 0:je.name)??"Not set"}),s.jsx(uc,{label:"Primary",value:de.primary_user_id?j(de.primary_user_id,m):"Not set"}),s.jsx(uc,{label:"Contributors",value:It.map(D=>j(D,m)).join(", ")||"None"})]}),!Me&&s.jsx(pD,{claim:J,mine:Et,holder:J?j(J.user_id):"",own:J!==null&&J.id===le,can_write:K,on_claim:()=>void rs(),on_release:()=>void wn(),on_clear:()=>void is()}),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"}),K&&F===null&&s.jsx(G,{type:"button",variant:"ghost",size:"sm",onClick:()=>T(de.description??""),children:"Edit description"})]}),F!==null?s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),await Kt({description:F})!==null&&T(null)},children:[s.jsx(Oe,{htmlFor:"task-description",className:"sr-only",children:"Description"}),s.jsx(as,{id:"task-description",rows:5,value:F,onChange:D=>T(D.target.value)}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(G,{type:"submit",size:"sm",children:"Save"}),s.jsx(G,{type:"button",size:"sm",variant:"outline",onClick:()=>T(null),children:"Cancel"})]})]}):s.jsx("p",{className:"mt-2 text-sm whitespace-pre-wrap",children:de.description||s.jsx("span",{className:"text-muted-foreground",children:"No description."})})]}),s.jsxs("section",{className:"mt-6","aria-labelledby":"task-checklist-title",children:[s.jsxs("h2",{id:"task-checklist-title",className:"text-lg font-semibold",children:["Checklist",p.checklist.length>0?` · ${ls} of ${p.checklist.length} done`:""]}),s.jsx("ul",{className:"mt-2 grid gap-1",children:p.checklist.map(D=>s.jsxs("li",{className:"flex items-center justify-between gap-2 py-1","data-testid":"task-checklist-item",children:[K?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Lr,{id:`check-${D.id}`,checked:D.is_complete,onCheckedChange:ye=>void Zs({action:"toggle",item_id:D.id,expected_item_revision:D.revision,is_complete:ye===!0})}),s.jsx(Oe,{htmlFor:`check-${D.id}`,className:"font-normal",children:D.label})]}):s.jsxs("span",{className:"text-sm",children:[D.is_complete?"Done: ":"To do: ",D.label]}),K&&s.jsxs(jd,{children:[s.jsx(wd,{asChild:!0,children:s.jsx(G,{type:"button",variant:"ghost",size:"icon","aria-label":`Item actions for ${D.label}`,children:s.jsx(vp,{className:"size-4","aria-hidden":"true"})})}),s.jsx(Oo,{align:"end",children:s.jsx(wr,{className:"text-destructive focus:text-destructive",onSelect:()=>void Zs({action:"archive",item_id:D.id,expected_item_revision:D.revision}),children:"Remove"})})]})]},D.id))}),p.checklist.length===0&&!K&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"No checklist items."}),K&&s.jsxs("form",{className:"mt-2 grid gap-2",onSubmit:async D=>{D.preventDefault(),P.trim()&&await Zs({action:"add",label:P.trim()})!==null&&ne("")},children:[s.jsx(Oe,{htmlFor:"task-new-item",children:"Add an item"}),s.jsx(_t,{id:"task-new-item",placeholder:"Add an item and press Enter",value:P,onChange:D=>ne(D.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"}),K&&s.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>E(!0),children:[s.jsx(v0,{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(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Type"}),s.jsx(Y,{children:"Reason"}),s.jsx(Y,{children:"Waiting on"}),s.jsx(Y,{className:"text-right",children:"Actions"})]})}),s.jsxs(He,{children:[p.holds.map(D=>{const ye=Ji[D.hold_type];return s.jsxs(ce,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(me,{variant:ye.tone,children:ye.label})}),s.jsxs(q,{children:[s.jsx("div",{children:D.reason}),s.jsx("div",{className:"text-muted-foreground text-xs",children:D.released_at?`Released by ${j(D.released_by,m)} · ${Mn(D.released_at)} · Ready to resolve`:`Opened by ${j(D.opened_by,m)} · ${Mn(D.opened_at)} · Open`})]}),s.jsx(q,{children:Js(D)}),s.jsx(q,{className:"text-right",children:ea(D)})]},D.id)}),p.holds.length===0&&s.jsx(ce,{children:s.jsx(q,{colSpan:4,className:"text-muted-foreground h-16 text-center",children:"Nothing is holding this task."})})]})]})}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"A hold does not change the task's status. The person it waits on releases it; whoever can edit the task resolves it."})]}),s.jsxs("section",{className:"mt-6 pb-8","aria-labelledby":"task-activity-title",children:[s.jsx("h2",{id:"task-activity-title",className:"text-lg font-semibold",children:"Activity"}),s.jsxs("ul",{className:"mt-2 divide-y rounded-lg border",children:[z.slice(0,V).map(D=>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:F$(D)}),s.jsxs("span",{className:"min-w-0 text-right sm:text-left",children:[s.jsx("span",{children:D.actor_id?j(D.actor_id,m):"The system"}),D.via?s.jsxs("span",{className:"text-muted-foreground block max-w-64 truncate text-xs sm:max-w-none",title:`via ${Of(D.via,D.via_device)}`,children:["via ",nx(D.via),s.jsx(xk,{via:D.via,device:D.via_device})]}):null]}),s.jsx("span",{className:"text-muted-foreground col-span-2 sm:col-span-1 sm:text-right",children:fk(D.created_at)})]},D.id)),z.length===0&&s.jsx("li",{className:"text-muted-foreground px-3 py-2 text-sm",children:"No activity yet."})]}),z.length>V&&s.jsx(G,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>U(D=>D+$v),children:"Load more"})]}),K&&se&&s.jsx(uD,{open:S,members:x,tasks:M,holds_my_web_claim:Et&&rn&&!(J!=null&&J.via),on_close:()=>E(!1),on_submit:ot}),g]})}function uc({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 mD({members:e,selected:t,on_change:n}){return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"task-contributors",children:"Contributors"}),s.jsxs(jd,{children:[s.jsx(wd,{asChild:!0,children:s.jsxs(G,{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(Oo,{align:"start",children:e.map(a=>{const l=t.includes(a.user_id);return s.jsxs(wr,{onSelect:()=>n(l?t.filter(r=>r!==a.user_id):[...t,a.user_id]),children:[l?s.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}):s.jsx("span",{className:"mr-2 size-4"}),a.label]},a.user_id)})})]})]})}function xk({via:e,device:t}){return e!=="sdlc_login"||!t?null:s.jsxs(s.Fragment,{children:[" on ",s.jsx("bdi",{children:t})]})}function pD({claim:e,mine:t,holder:n,own:a,can_write:l,on_claim:r,on_release:i,on_clear:o}){let c=s.jsx(yp,{className:"size-4","aria-hidden":"true"}),d="Nobody is working on this",f=l?"Claim it to show others you are.":"",h=l?s.jsx(G,{type:"button",size:"sm",onClick:r,children:"Claim"}):null;if(e&&e.lapsed){const m=new Date(e.lease_expires_at)<=new Date;c=s.jsx(dR,{className:"size-4","aria-hidden":"true"}),d=m?`${t?"Your":`${n}'s`} claim lapsed at ${es(e.lease_expires_at)}`:`${t?"Your":`${n}'s`} claim lapsed`,f=m?"Its time ran out.":`${n} can no longer edit this task.`,l&&(f+=" Take it over to work on it yourself, or clear it so anyone can claim it."),h=l?s.jsxs(s.Fragment,{children:[s.jsx(G,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Clear claim"}),s.jsx(G,{type:"button",size:"sm",onClick:r,children:"Take over"})]}):null}else if(e){const m=es(e.lease_expires_at);c=e.via==="api_key"?s.jsx(xp,{className:"size-4","aria-hidden":"true"}):e.via==="sdlc_login"?s.jsx(OR,{className:"size-4","aria-hidden":"true"}):s.jsx(fT,{className:"size-4","aria-hidden":"true"});const x=s.jsxs(s.Fragment,{children:["Claimed via sdlc login",s.jsx(xk,{via:e.via,device:e.via_device}),"."]});t&&e.via==="api_key"?(d=`Your agent is working on this until ${m}`,f="Claimed through one of your API keys. This page does not renew it. Releasing it, or Mark complete, ends the agent's claim after asking."):t&&e.via==="sdlc_login"?(d=`You are working on this until ${m}`,f=s.jsxs(s.Fragment,{children:[x," This page does not renew it. Releasing it, or Mark complete, ends that claim after asking."]})):e.via==="sdlc_login"?(d=`${n} is working on this until ${m}`,f=x):t?(d=`You are working on this until ${m}`,f=a?"Claimed on the web, and renewed while this page is open. Marking the task complete ends your claim.":"Claimed on the web. Marking the task complete ends your claim."):e.via==="api_key"?(d=`${n}'s agent is working on this until ${m}`,f="Claimed through an API key."):(d=`${n} is working on this until ${m}`,f=l?"Claimed on the web. You can take it over if the claim lapses.":"Claimed on the web."),h=t?s.jsx(G,{type:"button",size:"sm",variant:"outline",onClick:i,children:"Release claim"}):null}return s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 rounded-lg border p-3","data-testid":"task-claim",children:[c,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm font-medium",children:d}),f?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:f}):null]}),h?s.jsx("div",{className:"flex items-center gap-2",children:h}):null]})}const xD=10,gk=5,gD=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,vk="Not available",vD={added:"Added",changed:"Changed",removed:"Removed"},yD={thread:"Thread",task:"Task",issue:"Issue",release:"Release",test:"Test"},Dv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;function bD(e,t){const n=t!=null&&t.startsWith("task:")?t.slice(5):null;if(n&&gD.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 l=t!=null&&t.startsWith("release:")?t.slice(8):null;if(l&&Dv.test(l))return{label:l==="candidate"?"Candidate":`Release ${l}`,path:`/releases?release=${l}`};const r=t!=null&&t.startsWith("planned:")?t.slice(8):null;return r&&Dv.test(r)?{label:`Planned Release ${r}`,path:`/releases?planned=${r}`}:{label:"Tasks",path:`/org/${e}/tasks`}}const yk=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function jD({org:e,task_id:t,from:n}){var Qs;const a=Do(),{href:l,Link:r}=Fe(),{confirm:i,confirm_dialog:o}=Ro(),c=bD(e,n),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState([]),[x,j]=u.useState([]),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,w]=u.useState({state:"loading"}),[N,R]=u.useState({state:"loading"}),[_,k]=u.useState(null),[L,z]=u.useState(null),[X,V]=u.useState(!1),U=u.useRef(null),M=ns(),A=u.useRef(null),S=u.useRef(null),E=u.useRef(null),C=u.useRef(null),$=u.useRef(!1),F=u.useRef(0),T=u.useRef(0),P=u.useCallback(async()=>{if(!a.taskSections)return;w({state:"loading"});const re=await a.taskSections(t);w(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskSections,t]),ne=u.useCallback(async()=>{if(!a.taskRelated)return;R({state:"loading"});const re=await a.taskRelated(t);R(re.ok?{state:"ok",data:re.data}:{state:"failed",refusal:re.refusal})},[a.taskRelated,t]),le=u.useCallback(async()=>{var wn,is;const re=T.current+=1;p(null),P(),ne();const[ze,qe]=await Promise.all([a.availability(),a.task?a.task(t):Promise.resolve(null)]);if(re!==T.current)return;ze.state==="active"&&m(((wn=ze.workspace.workflows.find(ot=>ot.id===ze.list.workflow_id))==null?void 0:wn.statuses)??[]);const rs=ze.state==="off"&&((is=ze.refusal)==null?void 0:is.reason)==="engine_missing"?ze.refusal:null;if(!qe||!qe.ok&&qe.refusal.reason==="engine_missing"||rs){f({state:"engine_missing",refusal:rs??(qe&&!qe.ok?qe.refusal:{status:0,message:""})});return}if(qe.ok){F.current=0,y(null),z(null),f({state:"ok",detail:qe.data,at:new Date().toISOString()});return}if(qe.refusal.status===404||qe.refusal.reason==="not_found"){f({state:"missing"});return}if(F.current+=1,F.current===1&&yk(qe.refusal)){p(qe.refusal.retry_after??xD);return}y(qe.refusal),f(ot=>ot.state==="loading"?{state:"loading"}:ot)},[a,t,P,ne]);u.useEffect(()=>{le()},[le]),u.useEffect(()=>{if(g===null)return;const re=setTimeout(()=>void le(),g*1e3);return()=>clearTimeout(re)},[g,le]),u.useEffect(()=>{let re=!0;return a.members().then(ze=>{re&&ze.ok&&j(ze.data)}),()=>{re=!1}},[a.members]),u.useEffect(()=>{var ze;if($.current||d.state!=="ok")return;$.current=!0;const re=(ze=U.current)==null?void 0:ze.querySelector("h1");re&&(re.tabIndex=-1,re.focus())},[d.state]),u.useEffect(()=>{var re;_&&((re=S.current)==null||re.focus())},[_]),u.useEffect(()=>{if(L===null)return;const re=setTimeout(()=>{var ze;return(ze=A.current)==null?void 0:ze.focus()},0);return()=>clearTimeout(re)},[L]);const ge=u.useMemo(()=>new Map(x.map(re=>[re.user_id,re.label])),[x]),Z=re=>re?ge.get(re)??re:"",O=()=>{k(null),le()},H=u.useRef(null),se=re=>(H.current=re,re==="graph"?P():ne());if(u.useEffect(()=>{var qe;const re=H.current;if(re===null||(re==="graph"?b:N).state==="loading")return;H.current=null;const ze=(re==="graph"?E:C).current??((qe=U.current)==null?void 0:qe.querySelector("h1"));ze==null||ze.focus()},[b,N]),d.state==="missing")return s.jsx(ya,{children:s.jsx(Cu,{back:`/org/${e}/tasks`,description:`No task ${t} in this checkout. It may have finished and been archived, or never been recorded.`})});const B=s.jsx(G,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(r,{href:l(c.path),children:[s.jsx(f0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(d.state==="engine_missing")return s.jsx(ya,{children:s.jsx("div",{ref:U,className:"contents",children:s.jsx(Xs,{page:"Task",header:s.jsx(Ai,{back:B,id:null,title:t})})})});const ee=v?s.jsxs(pe,{variant:"destructive",className:"mt-4",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Could not read this task"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[v.message,v.since?` Since ${Qn(v.since)}.`:"",d.state==="ok"?` This page was read at ${Qn(d.at)}.`:""," See the sdlc viewer terminal for more."]}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:O,children:"Retry"})]})]}):null,W=g!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(bn,{"aria-hidden":"true"}),"Could not read this task. Trying again in ",g," seconds."]}):null,ae=s.jsx("div",{role:"status","aria-live":"polite",children:W});if(d.state==="loading")return s.jsxs(ya,{children:[ae,ee,!v&&g===null?s.jsx(lx,{}):null]});const{detail:J,at:Qe}=d,{task:de}=J,Me=h.find(re=>re.id===de.status_id),K=J.local_done&&"task"in J.local_done?J.local_done:null,ke=J.local_waits??[],Pe=K?ke[0]??null:null,Nt=Pe?Z(Pe.opened_by):J.owner_title??Z(J.thread),je=b.state==="ok"?b.data:null,It=(je==null?void 0:je.lifecycle)==="finished",Et=It&&(je==null?void 0:je.outcome)==="cancelled",rn=It&&(je==null?void 0:je.outcome)==="complete",ls=!!de.created_at,Ft=J.acceptance??[],Kt=async()=>{var qe;if(!K||!((qe=a.commands)!=null&&qe.complete)||!await i({title:`Mark ${de.title} done?`,description:Pe?`This answers ${Nt}'s ask, “${Pe.reason}”, closes that wait, and tells ${Nt} to check and continue.`:`This tells ${Nt||"its thread"} to check and continue.`,action_label:"Mark done"}))return;V(!0);const ze=await a.commands.complete(K);if(V(!1),!ze.ok){z(ze.refusal.message);return}await le(),k({title:de.title,asker:Nt||"Its thread"})},Ga=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[K&&!_?s.jsxs(s.Fragment,{children:[s.jsxs(G,{ref:A,type:"button",variant:"outline",disabled:X,"aria-disabled":L!==null?!0:void 0,"aria-describedby":L!==null?"task-done-why":void 0,onClick:()=>{L===null&&Kt()},children:[s.jsx(Or,{className:"mr-2 size-4","aria-hidden":"true"}),"Done"]}),L!==null?s.jsx("span",{id:"task-done-why",className:"text-muted-foreground text-xs",children:"Read again first"}):null]}):null,s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Qn(Qe)]}),s.jsxs(G,{type:"button",variant:"ghost",size:"sm",onClick:O,children:[s.jsx(yl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsxs(ya,{children:[s.jsxs("div",{ref:U,className:"contents",children:[s.jsx(Ai,{back:B,id:de.id,badge:Me?s.jsx(me,{variant:dk(Me),children:Me.name}):null,title:de.title,created:ls?`Created ${Mn(de.created_at)}${Nt||J.owner_title?` by ${J.owner_title??Nt}`:""}`:null,actions:Ga}),ae,ee,_?s.jsx("div",{ref:S,tabIndex:-1,role:"status","aria-live":"polite",className:"outline-none",children:s.jsxs(pe,{variant:"success",className:"mt-4",children:[s.jsx(td,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:["Marked ",_.title," done"]}),s.jsxs(xe,{children:[_.asker," is told to check and continue."]})]})}):null,L!==null?s.jsxs(pe,{variant:"destructive",className:"mt-4",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Done was not recorded"}),s.jsxs(xe,{children:[L," Read again to see the task as it is now."]})]}):null,Pe&&!_?s.jsxs(pe,{variant:"warning",className:"mt-4",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:[Nt," asks: ",Pe.reason]}),s.jsxs(xe,{children:["Waiting on you since ",sx(Pe.opened_at),". Done answers it and tells ",Nt," to check and continue."]})]}):null,J.view_outdated?s.jsxs(pe,{variant:"warning",className:"mt-4",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsxs(xe,{children:[M," 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(ms,{label:"Owner thread",value:J.owner_title??(Z(J.thread)||"None")}),s.jsx(ms,{label:"Release",value:J.release??"None"}),s.jsx(ms,{label:"Session",value:b.state==="loading"?"Loading…":b.state==="failed"?"Not available":je!=null&&je.session?s.jsxs(s.Fragment,{children:[je.session.provider," ",s.jsx("span",{className:"font-mono break-all",children:je.session.id})]}):"None"}),s.jsx(ms,{label:"Now",value:J.local_detail??(Me==null?void 0:Me.name)??""})]}),s.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Local tasks have no priority or contributors."}),s.jsx(wD,{detail:J,holder:Z((Qs=J.claim)==null?void 0:Qs.user_id),finished_at:It?(je==null?void 0:je.finished_at)??null:null,read_at:Qe}),s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(_o,{className:"text-info size-4","aria-hidden":"true"}),K?s.jsxs(s.Fragment,{children:[s.jsx(be,{children:"Done is the one change this page makes"}),s.jsx(xe,{children:"Everything else about this task changes through its thread."})]}):s.jsxs(s.Fragment,{children:[s.jsx(be,{children:"This page only reads tasks"}),s.jsx(xe,{children:"A task changes through the agent thread working on it."})]})]}),ls?je!=null&&je.record?s.jsxs("p",{className:"mt-4 text-sm",children:["Record ",s.jsx("span",{className:"font-mono break-all",children:je.record})]}):null:s.jsx("p",{className:"mt-4 text-sm",children:"No task record yet. This page shows what the threads and plans in this checkout say about it."}),K?s.jsx(bt,{id:"task-done-needs",title:"What Done needs",children:Ft.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The task's acceptance; ",Nt||"its thread"," checks these after Done."]}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:Ft.map(re=>s.jsx("li",{children:re},re))})]}):s.jsxs("p",{className:"text-sm",children:["Its thread gave no acceptance. Ask ",Nt||"its thread"," what Done needs before marking it."]})}):Ft.length>0?s.jsxs(bt,{id:"task-acceptance",title:"Acceptance",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:rn?"All met: the task finished complete":Et&&(je!=null&&je.finished_at)?`Cancelled ${Mn(je.finished_at)}`:"Met when the task finishes complete"}),s.jsx("ul",{className:"mt-2 grid list-disc gap-1 pl-5 text-sm",children:Ft.map(re=>s.jsx("li",{children:rn?`Met: ${re}`:re},re))})]}):null,s.jsx(_D,{detail:J,waits:ke,given:K!==null,threadName:Z,threadsLink:s.jsx(r,{className:"text-primary hover:underline",href:l(`/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(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-2/3"})]}):null,je?s.jsx(bt,{id:"task-stands",title:"Where it stands",children:s.jsxs("p",{className:"text-sm",children:[(Me==null?void 0:Me.name)??de.status_id,J.local_detail?` · ${J.local_detail}`:""]})}):null,je!=null&&je.time?s.jsx(ND,{time:je.time}):null,s.jsx(kD,{sections:b,heading_ref:E,on_retry:()=>void se("graph"),taskLink:re=>s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks/${re}?from=task:${de.id}`),children:re})}),je!=null&&je.files?s.jsx(SD,{files:je.files,finished:It}):null,je!=null&&je.proof?s.jsx(CD,{proof:je.proof,finished_at:je.finished_at,who:J.owner_title??null}):null,je&&je.history.length>0?s.jsx(RD,{history:je.history}):null,s.jsx(bk,{related:N,heading_ref:C,on_retry:()=>void se("related"),link:re=>{const ze=re.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(re.id)}`:re.kind==="task"?`/org/${e}/tasks/${re.id}?from=task:${de.id}`:re.kind==="issue"?`/org/${e}/issues/${encodeURIComponent(re.id)}?from=task:${de.id}`:re.kind==="release"?`/releases?${re.planned?"planned":"release"}=${encodeURIComponent(re.id)}`:null;return ze?s.jsx(r,{className:ie("text-primary hover:underline",re.kind!=="thread"&&re.label===re.id&&"font-mono"),href:l(ze),children:re.label}):re.label}})]}),o]})}function ya({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 Ai({back:e,id:t,badge:n,title:a,created:l,actions:r}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsx("div",{children:e}),t?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono",children:t}),n]}):null,s.jsx(Yt,{title:a,description:l??void 0,actions:r})]})}function ms({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 bt({id:e,title:t,aside:n,heading_ref:a,children:l}){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:l})]})}function wD({detail:e,holder:t,finished_at:n,read_at:a}){const l=e.claim,[,r]=u.useReducer(f=>f+1,0),i=l&&!e.view_outdated?new Date(l.lease_expires_at).getTime():null;u.useEffect(()=>{if(i===null||!Number.isFinite(i))return;const f=i-Date.now();if(f<=0)return;const h=setTimeout(r,Math.min(f+50,2147483647));return()=>clearTimeout(h)},[i]);let o=s.jsx(yp,{className:"size-4","aria-hidden":"true"}),c="Nobody is working on this",d=null;if(e.view_outdated)c=`Claimed by: ${vk}`;else if(l){const f=new Date(l.lease_expires_at)<=new Date(Math.max(Date.now(),new Date(a).getTime()));o=s.jsx(xp,{className:"size-4","aria-hidden":"true"}),c=`${t} is working on this until ${Qn(l.lease_expires_at)}${f||l.lapsed?" · passed":""}`,d="Claimed in the coordination registry; its thread renews the claim."}else n&&(o=s.jsx(td,{className:"size-4","aria-hidden":"true"}),d=`Finished ${Mn(n)}. Its claim ended when it finished.`);return s.jsxs(gt,{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 _D({detail:e,waits:t,given:n,threadName:a,threadsLink:l}){if(e.view_outdated)return s.jsx(bt,{id:"task-holds",title:"Holds",children:s.jsx("p",{className:"text-sm",children:vk})});if(e.holds.length===0)return null;const r=new Map(t.map(i=>[i.id,i]));return s.jsxs(bt,{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(gt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Holds",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Type"}),s.jsx(Y,{children:"Reason"}),s.jsx(Y,{children:"Waiting on"}),s.jsx(Y,{children:"Opened"})]})}),s.jsx(He,{children:e.holds.map(i=>{var f;const o=r.get(i.id),c=Ji[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 ",l,": ",o.local_threads.join(" · ")]}):null;return s.jsxs(ce,{"data-testid":"task-hold",children:[s.jsx(q,{children:s.jsx(me,{variant:c.tone,children:(o==null?void 0:o.local_label)??c.label})}),s.jsxs(q,{children:[s.jsx("div",{children:i.reason}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["Opened by ",a(i.opened_by)]})]}),s.jsxs(q,{children:[s.jsx("div",{children:i.target.kind==="user"?"You":i.target.kind==="external"?i.target.label:"Another task"}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null]}),s.jsx(q,{children:sx(i.opened_at)})]},i.id)})})]})})]})}function ND({time:e}){return s.jsx(bt,{id:"task-time",title:"Time",children:s.jsxs("dl",{className:"grid gap-4 sm:grid-cols-3",children:[s.jsx(ms,{label:"Estimate",value:e.estimate?`${ni(e.estimate.low)}–${ni(e.estimate.high)}`:e.unknown_reason??"None"}),s.jsx(ms,{label:"Time taken",value:e.elapsed!==null?`${ni(e.elapsed)}${e.over_estimate?" · over estimate":""}`:"Not started"}),e.forecast?s.jsx(ms,{label:"Reforecast",value:s.jsxs("span",{className:"text-muted-foreground",children:[ni(e.forecast.low),"–",ni(e.forecast.high)," left",e.forecast.reason?` · ${e.forecast.reason}`:""]})}):null]})})}function rx({what:e,again:t,refusal:n,on_retry:a}){return s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:["Could not read ",e]}),s.jsxs(xe,{children:[s.jsx("p",{children:n.message}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:t})]})]})}function kD({sections:e,heading_ref:t,on_retry:n,taskLink:a}){const[l,r]=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(bt,{id:"task-graph",title:"Graph changes",heading_ref:t,children:s.jsx(rx,{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(bt,{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=l?o.changes:o.changes.slice(0,gk),d=o.changes.length-c.length;return s.jsxs(bt,{id:"task-graph",title:"Graph changes",aside:o.document,heading_ref:t,children:[s.jsx(gt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Graph changes",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Change"}),s.jsx(Y,{children:"Kind of change"}),s.jsx(Y,{children:"Also in"}),s.jsx(Y,{children:"In the plan"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ce,{children:[s.jsxs(q,{children:[s.jsx("div",{children:f.label}),s.jsx("div",{className:"text-muted-foreground text-xs",children:f.type})]}),s.jsx(q,{children:vD[f.change]}),s.jsx(q,{children:f.also_in.length===0?"No other task":f.also_in.map((h,m)=>s.jsxs(u.Fragment,{children:[m>0?", ":null,a(h.id)]},h.id))}),s.jsx(q,{children:f.planned?"Yes":s.jsx(me,{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(G,{type:"button",variant:"ghost",size:"sm",onClick:()=>r(!0),children:["Show all ",o.changes.length]})]}):null]})}function SD({files:e,finished:t}){const[n,a]=u.useState(!1),l=n?e.paths:e.paths.slice(0,gk);return s.jsxs(bt,{id:"task-files",title:"Files",children:[l.length>0?s.jsx("ul",{className:"grid gap-1 text-sm",children:l.map(r=>s.jsx("li",{children:s.jsx("span",{className:"font-mono break-all",children:r})},r))}):null,e.paths.length>l.length?s.jsxs(G,{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 CD({proof:e,finished_at:t,who:n}){return s.jsxs(bt,{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 ",Mn(t),n?` by ${n}`:""]}):null]})}function RD({history:e}){return s.jsxs(bt,{id:"task-history",title:"History",children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:"From the task record, newest first"}),s.jsx(gt,{className:"mt-2 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"History",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"What"}),s.jsx(Y,{children:"Who"}),s.jsx(Y,{children:"When"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ce,{children:[s.jsx(q,{children:t.what}),s.jsx(q,{children:t.who??"Its thread"}),s.jsx(q,{children:sx(t.at)})]},`${t.at}:${n}`))})]})})]})}function bk({id:e="task-related",related:t,heading_ref:n,on_retry:a,link:l,fixed:r=!1}){return t.state==="ok"&&t.data.length===0?null:s.jsx(bt,{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(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-2/3"})]}):t.state==="failed"?s.jsx(rx,{what:"related work",again:"Read related work again",refusal:t.refusal,on_retry:a}):s.jsx(gt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Related",className:r?"table-fixed":void 0,children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{className:r?"w-[14%]":void 0,children:"Kind"}),s.jsx(Y,{className:r?"w-[45%]":void 0,children:"Item"}),s.jsx(Y,{className:r?"w-[41%]":void 0,children:"How it relates"})]})}),s.jsx(He,{children:t.data.map(i=>s.jsxs(ce,{children:[s.jsx(q,{children:yD[i.kind]}),s.jsx(q,{className:r?"break-words":void 0,children:l(i)}),s.jsx(q,{className:r?"break-words":void 0,children:i.relation})]},`${i.kind}:${i.planned?"planned:":""}${i.id}`))})]})})})}function TD({org:e,task_id:t,from:n}){const a=Do(),l=`/org/${e}/tasks`;return a.taskSections?s.jsx(jD,{org:e,task_id:t,from:n??null}):s.jsx(ED,{task_id:t,back:l})}function ED({task_id:e,back:t}){const{availability:n}=Do(),[a,l]=u.useState({state:"loading"});return u.useEffect(()=>{let r=!0;return n().then(i=>{r&&l(i)}),()=>{r=!1}},[n]),a.state==="off"?s.jsx(Cu,{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(hD,{active:a,task_id:e,back:t}):a.state==="error"?s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This task could not be loaded"}),s.jsx(xe,{children:"Check your connection and try again."})]}):a.state==="available"?s.jsx(Cu,{back:t}):s.jsx(lx,{})})}function Fn({children:e}){return s.jsx("p",{role:"alert",className:"text-destructive text-sm",children:e})}const AD=["open","triaged","resolved","closed"],ix=["low","normal","high","urgent"],MD=["fixed","works_as_intended","planned","duplicate","wont_fix","cannot_reproduce"],OD=["title","description","external_reference"],Ru={open:"Open",triaged:"Triaged",escalated:"Escalated",waiting_on_fix:"Waiting on fix",resolved:"Resolved",closed:"Closed"},jk={open:"warning",triaged:"info",escalated:"info",waiting_on_fix:"info",resolved:"success",closed:"neutral"},eo={low:"Low",normal:"Normal",high:"High",urgent:"Urgent"},ox={fixed:"Fixed",works_as_intended:"Works as intended",planned:"Planned",duplicate:"Duplicate",wont_fix:"Won't fix",cannot_reproduce:"Cannot reproduce"},wk={title:"Title",description:"Description",external_reference:"External reference"},$D=[["year",365*24*3600],["month",30*24*3600],["week",7*24*3600],["day",24*3600],["hour",3600],["minute",60]];function $c(e,t=Date.now()){const n=Math.round((new Date(e).getTime()-t)/1e3),a=new Intl.RelativeTimeFormat("en",{numeric:"auto"});for(const[l,r]of $D)if(Math.abs(n)>=r)return a.format(Math.round(n/r),l);return"just now"}function im(e,t,n){const a=`/org/${encodeURIComponent(e)}/proj/${encodeURIComponent(t)}/support`;return n?`${a}/${encodeURIComponent(n)}`:a}function cx(e,t){return e?t??"Not available":"A former member"}const DD="the issue integration";function zD(e){return!e.created_by&&e.reporter_kind==="customer"?DD:cx(e.created_by,e.created_by_username)}function LD(e,t){return!e.actor_id&&e.kind==="created"&&t.reporter_kind==="customer"?"The issue integration":cx(e.actor_id,e.actor_username)}const dc="not_set",UD="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 BD({create:e,open:t,onOpenChange:n,onCreated:a}){const[l,r]=u.useState(""),[i,o]=u.useState(""),[c,d]=u.useState(!1),[f,h]=u.useState(""),[m,x]=u.useState(dc),[j,v]=u.useState(!1),[y,g]=u.useState(null),p=u.useRef(null),b=()=>{r(""),o(""),d(!1),h(""),x(dc),g(null),p.current=null},w=_=>{var k;return((k=y==null?void 0:y.personal_data)==null?void 0:k.field)===_?y.message:void 0},N=async _=>{if(_.preventDefault(),j)return;v(!0),p.current??(p.current=crypto.randomUUID());const k=await e({request_id:p.current,title:i.trim()||void 0,description:f||void 0,external_reference:l.trim()||void 0,priority:m===dc?null:m});if(v(!1),!k.ok){k.refusal.status!==0&&(p.current=null),g(k.refusal);return}b(),a(k.data.issue,k.data.duplicates)},R=y&&!y.personal_data?y.message:void 0;return s.jsx(Ln,{open:t,onOpenChange:_=>{_||b(),n(_)},children:s.jsx(Un,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:N,className:"grid gap-4",children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"New support issue"}),s.jsx(Pn,{children:"Log one help-desk report. Text is shown exactly as entered."})]}),s.jsxs(pe,{variant:"warning",children:[s.jsx(sn,{}),s.jsx(xe,{children:UD})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-reference",children:"External reference"}),s.jsx(_t,{id:"maintain-issue-reference",value:l,"aria-invalid":!!w("external_reference"),onChange:_=>{r(_.target.value),c||o(_.target.value)}}),w("external_reference")?s.jsx(Fn,{children:w("external_reference")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"The help-desk ticket number."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-title",children:"Title"}),s.jsx(_t,{id:"maintain-issue-title",value:i,"aria-invalid":!!w("title"),onChange:_=>{o(_.target.value),d(!0)}}),w("title")?s.jsx(Fn,{children:w("title")}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Prefilled from the external reference; edit it if you like."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-description",children:"Description"}),s.jsx(as,{id:"maintain-issue-description",rows:4,placeholder:"What the end user reported, without personal data",value:f,"aria-invalid":!!w("description"),onChange:_=>h(_.target.value)}),w("description")?s.jsx(Fn,{children:w("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-issue-priority",children:"Priority"}),s.jsxs(dt,{value:m,onValueChange:x,children:[s.jsx(rt,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:dc,children:"Not set"}),ix.map(_=>s.jsx(Se,{value:_,children:eo[_]},_))]})]})]}),R?s.jsx(Fn,{children:R}):null,s.jsxs(Hn,{children:[s.jsx(G,{type:"button",variant:"outline",onClick:()=>{b(),n(!1)},children:"Cancel"}),s.jsx(G,{type:"submit",loading:j,disabled:!i.trim()&&!l.trim(),children:"Log issue"})]})]})})})}const HD=["supportAccess","assigneeCandidates","create","update","assign","transition","redact"];function _k(){return ID(ln().issues)}function ID(e){return e&&HD.every(t=>typeof e[t]=="function")?e:null}function Nk(e){const[t,n]=u.useState(null);return u.useEffect(()=>{if(!e)return;let a=!1;return e.supportAccess().then(l=>{a||n({contract:e,state:l.ok?{state:"ready",access:l.data}:{state:"error"}})}),()=>{a=!0}},[e]),t&&e&&t.contract===e?t.state:{state:"loading"}}function kk({access:e,header:t,back_href:n,children:a}){const{href:l,Link:r}=Fe();return e.state==="loading"?s.jsxs("div",{className:"flex flex-1 items-center justify-center py-24",children:[s.jsx(bn,{className:"size-5"}),s.jsx("span",{className:"sr-only",children:"Loading…"})]}):e.state==="error"||!e.access.enabled?s.jsx(Ba,{title:"Page not found",description:"This page does not exist or you do not have access to it.",backHref:l(n),backLabel:"Back to the project",link:r}):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(IR,{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 PD(){const e=Fe();return t=>{e.navigate?e.navigate(t):window.location.assign(e.href(t))}}const un="all",fc=25;function om({action:e}){return s.jsx(Yt,{title:"Support",description:"Help-desk reports logged against this project.",actions:e})}function qD({org:e,project:t,query:n}){const a=_k(),l=Nk(a),r=`/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(kk,{access:l,header:s.jsx(om,{}),back_href:r,children:i=>a?s.jsx(GD,{contract:a,access:i,org_name:e,proj_name:t,query:n}):null})})}function GD({contract:e,access:t,org_name:n,proj_name:a,query:l}){const{href:r,Link:i}=Fe(),o=PD(),[c,d]=u.useState(()=>new URLSearchParams(l).get("external_reference")??""),[f,h]=u.useState(un),[m,x]=u.useState(un),[j,v]=u.useState(un),[y,g]=u.useState(0),[p,b]=u.useState(null),[w,N]=u.useState(0),[R,_]=u.useState(null),[k,L]=u.useState([]),[z,X]=u.useState(!1),V=c.trim()!==""||f!==un||m!==un||j!==un,U=u.useCallback(async()=>{const C=await e.list({external_reference:c.trim()||void 0,status:f===un?void 0:f,priority:m===un?void 0:m,assignee:j===un?void 0:j,limit:fc,offset:y*fc});if(!C.ok){_(C.refusal.message);return}_(null),b(C.data.issues),N(C.data.total)},[e,c,f,m,j,y]);u.useEffect(()=>{const C=setTimeout(()=>void U(),200);return()=>clearTimeout(C)},[U]),u.useEffect(()=>{e.assigneeCandidates().then(C=>{C.ok&&L(C.data.candidates)})},[e]);const M=t.can_change?s.jsxs(G,{onClick:()=>X(!0),children:[s.jsx(br,{className:"mr-2 size-4"}),"New issue"]}):void 0,A=s.jsx(BD,{create:e.create,open:z,onOpenChange:X,onCreated:(C,$)=>{X(!1);const F=im(n,a,C.id);o($.length?`${F}?duplicates=${$.length}`:F)}});if(p!==null&&w===0&&!V&&y===0)return s.jsxs(s.Fragment,{children:[s.jsx(om,{}),s.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[s.jsx(DR,{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(G,{onClick:()=>X(!0),children:[s.jsx(br,{className:"mr-2 size-4"}),"Log the first issue"]}):null]}),A]});const S=w===0?0:y*fc+1,E=Math.min(w,(y+1)*fc);return s.jsxs(s.Fragment,{children:[s.jsx(om,{action:M}),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(aT,{className:"text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2","aria-hidden":!0}),s.jsx(_t,{"aria-label":"Filter by external reference",placeholder:"Filter by external reference",className:"pl-9",value:c,onChange:C=>{d(C.target.value),g(0)}})]}),s.jsx(Df,{label:"Status",value:f,onChange:C=>{h(C),g(0)},options:AD.map(C=>({value:C,label:Ru[C]}))}),s.jsx(Df,{label:"Priority",value:m,onChange:C=>{x(C),g(0)},options:ix.map(C=>({value:C,label:eo[C]}))}),s.jsx(Df,{label:"Assignee",value:j,onChange:C=>{v(C),g(0)},options:[{value:"unassigned",label:"Unassigned"},{value:"cannot_act",label:"Assignee cannot act"},...k.map(C=>({value:C.user_id,label:C.username??"Not available"}))]})]}),R?s.jsx(Fn,{children:R}):null,s.jsx("div",{className:"rounded-md border",children:s.jsxs(Be,{children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Title"}),s.jsx(Y,{children:"External reference"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Priority"}),s.jsx(Y,{children:"Assignee"}),s.jsx(Y,{children:"Updated"})]})}),s.jsx(He,{children:p===null?s.jsx(ce,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"Loading…"})}):p.length===0?s.jsx(ce,{children:s.jsx(q,{colSpan:6,className:"h-24 text-center",children:"No issues match these filters."})}):p.map(C=>s.jsxs(ce,{children:[s.jsx(q,{className:"max-w-md",children:s.jsx(i,{href:r(im(n,a,C.id)),className:"font-medium hover:underline",children:C.title})}),s.jsx(q,{className:"font-mono text-xs",children:C.external_reference??""}),s.jsx(q,{children:s.jsx(me,{variant:jk[C.status],children:Ru[C.status]})}),s.jsx(q,{children:C.priority?eo[C.priority]:""}),s.jsx(q,{children:s.jsx(VD,{issue:C})}),s.jsx(q,{className:"text-muted-foreground",children:$c(C.updated_at)})]},C.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 ${S}–${E} of ${w} issue${w===1?"":"s"}.`}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(G,{variant:"outline",size:"sm",disabled:y===0,onClick:()=>g(C=>Math.max(0,C-1)),children:"Previous"}),s.jsx(G,{variant:"outline",size:"sm",disabled:E>=w,onClick:()=>g(C=>C+1),children:"Next"})]})]}),A]})}function VD({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(me,{variant:"error",children:"Assignee cannot act"}):null]}):s.jsx("span",{className:"text-muted-foreground",children:"Unassigned"})}function Df({label:e,value:t,onChange:n,options:a}){var r;const l=u.useMemo(()=>t===un||a.some(i=>i.value===t),[a,t]);return s.jsxs(dt,{value:l?t:un,onValueChange:n,children:[s.jsx(rt,{className:"w-44","aria-label":e,children:s.jsx(ft,{placeholder:e,children:t===un?e:(r=a.find(i=>i.value===t))==null?void 0:r.label})}),s.jsxs(it,{children:[s.jsx(Se,{value:un,children:"All"}),a.map(i=>s.jsx(Se,{value:i.value,children:i.label},i.value))]})]})}const Sk=[{key:"local",label:"Local"},{key:"staging",label:"Staging"},{key:"production",label:"Production"}],YD=/^iss-\d{1,9}$/,FD=/^col-\d{1,9}$/,KD=e=>e&&e[0].toUpperCase()+e.slice(1);function Ck(e){const t=KD(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 Mi(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 cm={search:"",owner:null,urgent:!1,seen:[],label:null,collection:null};function Dc(e){const t=new URLSearchParams(e),n=t.getAll("seen").filter(l=>Sk.some(r=>r.key===l)),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&&FD.test(a)?a:null}}function Xl(e){const t=new URLSearchParams;e.search&&t.set("search",e.search),e.owner&&t.set("owner",e.owner),e.urgent&&t.set("urgent","1");for(const n of e.seen)t.append("seen",n);return e.label&&t.set("label",e.label),e.collection&&t.set("collection",e.collection),t.toString()}function XD(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 zv=e=>!!(e.search.trim()||e.owner||e.urgent||e.seen.length||e.label||e.collection),QD={agent:"Filed by an agent",user:"Filed by you",tool:"Filed by a tool"},ZD={graph:"Placed on the graph by its anchors",files:"Placed by its files",unplaced:"Triaged, not placed yet"},WD={handoff:"Handed to its owner",backlog:"Sent to the unowned backlog",batch:"Routed to a batch"};function JD(e,t=""){const n=(e??t).trim();if(!n)return"";const a=n.indexOf(": "),l=(a===-1?n:n.slice(0,a)).trim(),r=a===-1?"":n.slice(a+2).trim(),i=o=>r?`${o} ${r}`:o;switch(l){case"filed":return QD[r]??i("Filed by");case"labelled":return i("Labelled");case"unlabelled":return r?`Label removed: ${r}`:"Label removed";case"anchored":return r?`Anchored to ${r}`:"Anchored";case"triaged":return ZD[r]??(r?`Triaged: ${r}`:"Triaged");case"routed":return WD[r]??(r?`Routed: ${r}`:"Routed");case"route closed":return r==="backlog"?"Taken off the unowned backlog":r?`Route closed: ${r}`:"Route closed";case"released":return r?`Released by its owner (task ${r})`:"Released by its owner";case"resolved":return r==="duplicate"?"Resolved as a duplicate":r?`Resolved · ${r.replace(/_/g," ")}`:"Resolved";case"reopened":return r?`Reopened: ${r}`:"Reopened";case"fix landed":return r?`Fix landed in ${r.slice(0,10)}`:"Fix landed";case"merged":return r?`Merged ${r} into this issue`:"Merged a duplicate into this issue";default:return n}}const e3=e=>e.replace(/`+/g,"").replace(/\s+/g," ").trim(),Rk="This page only reads issues",Tk="File, route and resolve issues with the issue command or through the thread working on them.",t3=10,n3=250,El="__all",s3="none",a3=e=>e.status===0||e.reason==="store_locked"||e.reason==="engine_failed"||e.status>=500;function Ek(){const e=ln().issues;if(!e)throw new Error("The Issues page rendered without the issues seam.");return e}const l3=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 r3({project:e,query:t,onQuery:n}){var Z;const a=Ek(),{href:l,Link:r}=Fe(),i=u.useMemo(()=>Dc(t),[t]),o=Xl(i),c=zv(i),[d,f]=u.useState({state:"loading"}),[h,m]=u.useState(null),[x,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(null),b=ns(),w=u.useRef(!1),[N,R]=u.useState(i.search),_=u.useCallback(O=>n(Xl({...i,...O})),[i,n]),k=u.useCallback(async()=>{const O=y.current+=1;j(null);const H=await a.list(XD(Dc(o)));if(O!==y.current)return;if(H.ok){v.current=0,m(null),f({state:"ok",list:H.data,local:H.data.local??l3(new Date().toISOString()),key:o});return}const se=H.refusal.reason;if(se==="engine_missing")return f({state:"engine_missing",refusal:H.refusal});if(se==="view_outdated")return f({state:"view_outdated"});if(v.current+=1,v.current===1&&a3(H.refusal)){j(H.refusal.retry_after??t3);return}m(H.refusal)},[a.list,o]);u.useEffect(()=>{k()},[k]),u.useEffect(()=>{if(x===null)return;const O=setTimeout(()=>void k(),x*1e3);return()=>clearTimeout(O)},[x,k]),u.useEffect(()=>{document.activeElement!==g.current&&R(i.search)},[i.search]),u.useEffect(()=>{if(N===i.search)return;const O=setTimeout(()=>_({search:N}),n3);return()=>clearTimeout(O)},[N,i.search,_]),u.useEffect(()=>{const O=H=>{if(H.key!=="/"||H.metaKey||H.ctrlKey||H.altKey)return;const se=H.target;se&&(se.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(se.tagName))||g.current&&(H.preventDefault(),g.current.focus())};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[]);const L=()=>{var O;R(""),n(Xl(cm)),(O=g.current)==null||O.focus()},z=()=>{v.current=0,k()},X=()=>{w.current=!0,z()};u.useEffect(()=>{var H;if(!w.current||d.state==="loading"||x!==null)return;w.current=!1;const O=(H=p.current)==null?void 0:H.querySelector("h1");O&&(O.tabIndex=-1,O.focus())},[d,h,x]);const V=O=>`/proj/${encodeURIComponent(e)}/issues${O?`?${O}`:""}`,U=O=>`/proj/${encodeURIComponent(e)}/issues/${encodeURIComponent(O)}?from=issues${o?`&${o}`:""}`,M=s.jsx("div",{role:"status","aria-live":"polite",children:x!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(bn,{"aria-hidden":"true"}),"Issues are busy. Reading them again…"]}):null}),A=h?s.jsxs(pe,{variant:"destructive",className:"mt-4",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Issues could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[h.message,h.since?` Since ${Qn(h.since)}.`:"",d.state==="ok"?` The list below was read at ${Qn(d.local.read_at)}.`:"",h.message.includes(cl)?"":` ${cl}`]}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:X,children:"Retry"})]})]}):null,S=s.jsx(Yt,{title:"Issues",description:"This repository's local issues: what agents and you reported, where triage placed each, and what fixes it.",actions:d.state==="ok"?s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Qn(d.local.read_at)]}),s.jsxs(G,{type:"button",variant:"ghost",size:"sm",onClick:z,children:[s.jsx(yl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]}):null});if(d.state==="engine_missing")return s.jsx(hc,{ref:p,children:s.jsx(Xs,{page:"Issues"})});if(d.state==="view_outdated")return s.jsxs(hc,{ref:p,children:[S,s.jsxs(pe,{variant:"warning",className:"mt-6",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsx(xe,{children:b})]})]});if(d.state==="loading")return s.jsxs(hc,{ref:p,children:[S,M,A,!h&&x===null?s.jsx("div",{className:"mt-6 grid gap-2",role:"status","aria-label":"Loading issues",children:Array.from({length:6},(O,H)=>s.jsx(xt,{className:H===5?"h-10 w-2/3":"h-10 w-full"},H))}):null]});const{list:E,local:C}=d,$=!h&&x===null&&(d.key!==o||N!==i.search),F=zv(Dc(d.key)),T=C.scope==="folder",P=C.listed===0&&!c,ne=Math.max(0,C.listed-C.facets.owners.reduce((O,H)=>O+H.count,0)),le=i.collection?((Z=C.collections.find(O=>O.collection===i.collection))==null?void 0:Z.title)??i.collection:null,ge=new Map;for(const O of E.issues){const H=O.group??"unplaced";ge.set(H,[...ge.get(H)??[],O])}return s.jsxs(hc,{ref:p,children:[S,T&&C.folder?s.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Issues of the folder ",C.folder,", from its issue store."]}):null,s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(_o,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:Rk}),s.jsx(xe,{children:Tk})]}),M,A,P?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(ER,{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(_t,{ref:g,type:"search",className:"w-64","aria-label":"Search issues",placeholder:"Search issues",value:N,onChange:O=>R(O.target.value)}),s.jsxs(dt,{value:i.owner??El,onValueChange:O=>_({owner:O===El?null:O}),children:[s.jsx(rt,{className:"w-56","aria-label":"Owner",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:El,children:"All owners"}),s.jsxs(Se,{value:s3,children:["Unowned (",ne,")"]}),C.facets.owners.map(O=>s.jsxs(Se,{value:O.key,children:[O.title," (",O.count,")"]},O.key))]})]}),s.jsxs(dt,{value:i.label??El,onValueChange:O=>_({label:O===El?null:O}),children:[s.jsx(rt,{className:"w-48","aria-label":"Label",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:El,children:"All labels"}),C.facets.labels.map(O=>s.jsxs(Se,{value:O.label,children:[O.label," (",O.count,")"]},O.label))]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2",children:[s.jsx("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Marks",children:s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":i.urgent,onClick:()=>_({urgent:!i.urgent}),children:["Urgent ",C.facets.urgent]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",role:"group","aria-label":"Seen on",children:[s.jsx("span",{className:"text-muted-foreground text-xs",children:"Seen on"}),Sk.map(O=>{const H=i.seen.includes(O.key);return s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":H,onClick:()=>_({seen:H?i.seen.filter(se=>se!==O.key):[...i.seen,O.key]}),children:[O.label," ",C.facets.seen[O.key]]},O.key)}),le!==null?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsxs("span",{"data-testid":"issues-collection-chip",className:ie(dd({variant:"outline",size:"sm"}),IA),children:["Collection ",le]}),s.jsx(G,{type:"button",variant:"ghost",size:"sm-icon","aria-label":"Remove the collection filter",onClick:()=>{var O;_({collection:null}),(O=g.current)==null||O.focus()},children:s.jsx(ad,{className:"size-4","aria-hidden":"true"})})]}):null]})]}),s.jsx("div",{role:"status","aria-live":"polite",children:$?s.jsxs("p",{className:"text-muted-foreground mt-3 flex items-center gap-2 text-sm",children:[s.jsx(bn,{"aria-hidden":"true"}),"Searching…"]}):c&&E.total>0?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:[E.total," of ",C.listed," issues ·"," ",s.jsx(G,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:L,children:"Clear"})]}):null}),s.jsx("div",{"data-testid":"issues-results","aria-busy":$||void 0,className:"shrink-0 transition-opacity aria-busy:opacity-50",children:F&&E.total===0?s.jsxs("p",{className:"mt-6 flex items-center gap-2 text-sm",children:[s.jsx(sd,{className:"text-muted-foreground size-4","aria-hidden":"true"}),"No issues match."," ",s.jsx(G,{type:"button",variant:"link",size:"sm",className:"px-0",onClick:L,children:"Clear"})]}):C.groups.map(O=>s.jsx(i3,{id:`issues-${O.key}`,title:`${O.label} · ${O.count}`,issues:ge.get(O.key)??[],folder:T,link:H=>s.jsx(r,{className:"text-primary hover:underline",href:l(U(H.id)),children:H.title})},O.key))}),!c&&C.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 · ",C.collections.length]}),s.jsx(gt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Collections",className:"table-fixed",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{className:"w-1/2",children:"Collection"}),s.jsx(Y,{className:"w-1/4",children:"Resolved"}),s.jsx(Y,{className:"w-1/4",children:"Updated"})]})}),s.jsx(He,{children:C.collections.map(O=>s.jsxs(ce,{children:[s.jsxs(q,{children:[s.jsx(r,{className:"text-primary hover:underline",href:l(V(Xl({...cm,collection:O.collection}))),children:O.title}),s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:O.collection})]}),s.jsxs(q,{children:[O.resolved," of ",O.total," resolved"]}),s.jsx(q,{className:"text-muted-foreground",children:Mi(O.updated_at)})]},O.collection))})]})})]}):null]})]})}const hc=u.forwardRef(function({children:t},n){return s.jsx("div",{ref:n,className:"flex h-full min-h-0 flex-1 flex-col overflow-auto px-4 py-4 pb-8 sm:px-6 lg:px-8",children:t})});function i3({id:e,title:t,issues:n,folder:a,link:l}){return s.jsxs("section",{className:"mt-6","aria-labelledby":`${e}-title`,"data-testid":"issues-group",children:[s.jsx("h2",{id:`${e}-title`,className:"text-lg font-semibold",children:t}),s.jsx(gt,{className:"mt-2 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:t,className:"table-fixed",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{className:a?"w-[30%]":"w-[36%]",children:"Title"}),s.jsx(Y,{className:"w-[10%]",children:"Issue"}),a?s.jsx(Y,{className:"w-[12%]",children:"Project"}):null,s.jsx(Y,{className:"w-[16%]",children:"Status"}),s.jsx(Y,{className:"w-[8%]",children:"Urgent"}),s.jsx(Y,{className:a?"w-[14%]":"w-[18%]",children:"Owner"}),s.jsx(Y,{className:"w-[12%]",children:"Updated"})]})}),s.jsx(He,{children:n.map(r=>{var o;const i=Ck(r);return s.jsxs(ce,{"data-testid":"issues-row",children:[s.jsxs(q,{className:"break-words",children:[l(r),(o=r.labels)!=null&&o.length?s.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:r.labels.map(c=>s.jsx(me,{variant:"neutral",size:"dense",children:c},c))}):null]}),s.jsx(q,{className:"font-mono text-xs",children:r.id}),a?s.jsx(q,{className:"break-words",children:r.project_id??"Folder"}):null,s.jsx(q,{children:s.jsx(me,{variant:i.tone,children:i.label})}),s.jsx(q,{children:r.urgent&&r.status!=="resolved"&&r.group!=="resolved"?s.jsx(me,{variant:"warning",children:"Urgent"}):null}),s.jsx(q,{className:"break-words",children:r.owner_title?r.owner_title:s.jsx("span",{className:"text-muted-foreground",children:"Unowned"})}),s.jsx(q,{className:"text-muted-foreground",children:Mi(r.updated_at)})]},r.id)})})]})})]})}function o3(e){var t;return(t=ln().issues)!=null&&t.issueSections?s.jsx(r3,{...e}):s.jsx(qD,{org:e.org,project:e.project,query:e.query})}function c3({update:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){const[i,o]=u.useState(t.title),[c,d]=u.useState(t.description),[f,h]=u.useState(t.external_reference??""),[m,x]=u.useState(t),[j,v]=u.useState(null),[y,g]=u.useState(!1);u.useEffect(()=>{n&&(o(t.title),d(t.description),h(t.external_reference??""),x(t),v(null))},[n]);const p=N=>{var R;return((R=j==null?void 0:j.personal_data)==null?void 0:R.field)===N?j.message:void 0},b=async N=>{N.preventDefault(),g(!0);const R=await e(m.id,m.revision,{title:i,description:c,external_reference:f.trim()||null});if(g(!1),!R.ok){v(R.refusal);return}l(R.data.issue)},w=async()=>{const N=await r();N&&(x(N),v(null))};return s.jsx(Ln,{open:n,onOpenChange:a,children:s.jsx(Un,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:b,className:"grid gap-4",children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"Edit issue"}),s.jsx(Pn,{children:"Text is shown exactly as entered."})]}),j!=null&&j.conflict?s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{}),s.jsx(xe,{children:"Someone else saved this issue after you opened it, so nothing was saved. Your text is kept below; reload the latest issue, then save to apply it."})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-edit-title",children:"Title"}),s.jsx(_t,{id:"maintain-edit-title",value:i,"aria-invalid":!!p("title"),onChange:N=>o(N.target.value)}),p("title")?s.jsx(Fn,{children:p("title")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-edit-description",children:"Description"}),s.jsx(as,{id:"maintain-edit-description",rows:4,value:c,"aria-invalid":!!p("description"),onChange:N=>d(N.target.value)}),p("description")?s.jsx(Fn,{children:p("description")}):null]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-edit-reference",children:"External reference"}),s.jsx(_t,{id:"maintain-edit-reference",value:f,"aria-invalid":!!p("external_reference"),onChange:N=>h(N.target.value)}),p("external_reference")?s.jsx(Fn,{children:p("external_reference")}):null]}),j&&!j.conflict&&!j.personal_data?s.jsx(Fn,{children:j.message}):null,s.jsxs(Hn,{children:[s.jsx(G,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),j!=null&&j.conflict?s.jsxs(G,{type:"button",variant:"outline",onClick:w,children:[s.jsx(yl,{className:"mr-2 size-4"}),"Reload latest"]}):null,s.jsx(G,{type:"submit",loading:y,disabled:!!(j!=null&&j.conflict),children:"Save"})]})]})})})}function Lv(e){return e.map(t=>wk[t].toLowerCase()).join(", ")}function u3(e){switch(e.kind){case"created":return"Logged the issue";case"updated":return`Edited the ${Lv(e.fields)}`;case"redacted":return`Redacted the ${Lv(e.fields)}`;case"priority_set":return e.priority?`Set priority to ${eo[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?Ru[e.to_status]:"";return e.resolution_reason?`Moved to ${t}: ${ox[e.resolution_reason]}`:`Moved to ${t}`}}}function Uv(e,t){return t==="external_reference"?e.external_reference??"":e[t]}function d3({redact:e,issue:t,open:n,onOpenChange:a,onDone:l,onReload:r}){const[i,o]=u.useState("description"),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(null),[j,v]=u.useState(t);u.useEffect(()=>{n&&(v(t),d(Uv(t,i)),x(null))},[n]);const y=async g=>{g.preventDefault(),h(!0);const p=await e(j.id,j.revision,i,c);if(h(!1),!p.ok){if(p.refusal.conflict){const b=await r();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}l(p.data.issue)};return s.jsx(Ln,{open:n,onOpenChange:a,children:s.jsx(Un,{className:"sm:max-w-2xl",children:s.jsxs("form",{onSubmit:y,className:"grid gap-4",children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"Redact text"}),s.jsx(Pn,{children:"Replace text that holds personal data, such as a name."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-redact-field",children:"Field"}),s.jsxs(dt,{value:i,onValueChange:g=>{const p=g;o(p),d(Uv(j,p))},children:[s.jsx(rt,{id:"maintain-redact-field",children:s.jsx(ft,{})}),s.jsx(it,{children:OD.map(g=>s.jsx(Se,{value:g,children:wk[g]},g))})]})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-redact-replacement",children:"Replacement text"}),s.jsx(as,{id:"maintain-redact-replacement",rows:4,value:c,onChange:g=>d(g.target.value)})]}),s.jsxs(pe,{variant:"warning",children:[s.jsx(sn,{}),s.jsx(xe,{children:"This cannot be undone: the original text is removed for good. History records only that this field was redacted."})]}),m?s.jsx(Fn,{children:m}):null,s.jsxs(Hn,{children:[s.jsx(G,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(G,{type:"submit",variant:"destructive",loading:f,children:"Redact"})]})]})})})}function f3({transition:e,issue:t,open:n,onOpenChange:a,onDone:l}){const[r,i]=u.useState("fixed"),[o,c]=u.useState(!1),[d,f]=u.useState(null),h=async m=>{m.preventDefault(),c(!0);const x=await e(t.id,t.revision,"resolved",r);if(c(!1),!x.ok){if(x.refusal.conflict){l(null);return}f(x.refusal.message);return}f(null),l(x.data.issue)};return s.jsx(Ln,{open:n,onOpenChange:a,children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:h,className:"grid gap-4",children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"Resolve issue"}),s.jsx(Pn,{children:"Choose how this report ended."})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"maintain-resolution-reason",children:"Resolution reason *"}),s.jsxs(dt,{value:r,onValueChange:m=>i(m),children:[s.jsx(rt,{id:"maintain-resolution-reason",children:s.jsx(ft,{})}),s.jsx(it,{children:MD.map(m=>s.jsx(Se,{value:m,children:ox[m]},m))})]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopening the issue clears its reason."})]}),d?s.jsx(Fn,{children:d}):null,s.jsxs(Hn,{children:[s.jsx(G,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),s.jsx(G,{type:"submit",loading:o,children:"Resolve"})]})]})})})}const Al="not_set";function h3({org:e,project:t,issue_id:n,query:a}){const l=_k(),r=Nk(l),i=im(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(kk,{access:r,header:s.jsx(Yt,{title:"Support"}),back_href:i,children:o=>l?s.jsx(m3,{contract:l,issue_id:n,access:o,list_href:i,duplicates:Number(new URLSearchParams(a).get("duplicates")??0)}):null})})}function m3({contract:e,issue_id:t,access:n,list_href:a,duplicates:l}){const{href:r,Link:i}=Fe(),o=Mr(),[c,d]=u.useState(null),[f,h]=u.useState([]),[m,x]=u.useState(!1),[j,v]=u.useState([]),[y,g]=u.useState(null),p=u.useCallback(async()=>{const _=await e.issue(t);return _.ok?(d(_.data.issue),h(_.data.events),_.data.issue):(_.refusal.status===404?x(!0):o.error(_.refusal.message),null)},[e,t,o]);u.useEffect(()=>{let _=!1;return e.issue(t).then(k=>{if(!_){if(!k.ok){k.refusal.status===404?x(!0):o.error(k.refusal.message);return}d(k.data.issue),h(k.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 k=await _;if(!k.ok){o.error(k.refusal.message),k.refusal.conflict&&await p();return}await p()};if(m)return s.jsx(Ba,{title:"Support issue not found",description:"This issue does not exist in this project.",backHref:r(a),backLabel:"Back to Support",link:i});if(!c)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading…"});const w=c.status==="closed",N=n.can_change,R=_=>b(e.transition(c.id,c.revision,_));return s.jsxs(s.Fragment,{children:[s.jsx(Yt,{title:c.title,actions:N?s.jsxs(s.Fragment,{children:[w?null:s.jsxs(G,{variant:"outline",onClick:()=>g("edit"),children:[s.jsx(nd,{className:"mr-2 size-4"}),"Edit"]}),s.jsxs(G,{variant:"outline",onClick:()=>g("redact"),children:[s.jsx(xR,{className:"mr-2 size-4"}),"Redact"]}),c.status==="open"?s.jsx(G,{variant:"outline",disabled:!c.priority,"aria-description":c.priority?void 0:"Set a priority first.",onClick:()=>void R("triaged"),children:"Triage"}):null,c.status==="open"||c.status==="triaged"?s.jsxs(G,{onClick:()=>g("resolve"),children:[s.jsx(td,{className:"mr-2 size-4"}),"Resolve"]}):null,c.status==="resolved"?s.jsxs(s.Fragment,{children:[s.jsxs(G,{variant:"outline",onClick:()=>void R("open"),children:[s.jsx(tT,{className:"mr-2 size-4"}),"Reopen"]}),s.jsx(G,{onClick:()=>void R("closed"),children:"Close"})]}):null]}):void 0,children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(me,{variant:jk[c.status],children:Ru[c.status]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Logged by ",zD(c)," ",$c(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:[l>0&&c.external_reference?s.jsxs(pe,{variant:"info",children:[s.jsx(Ua,{}),s.jsxs(xe,{className:"flex flex-row flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[c.external_reference," is already logged on"," ",l===1?"another issue":`${l} other issues`," in this project."]}),s.jsx(G,{asChild:!0,variant:"outline",size:"sm",children:s.jsx(i,{href:r(`${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(Be,{children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"When"}),s.jsx(Y,{children:"Who"}),s.jsx(Y,{children:"What"})]})}),s.jsx(He,{children:f.map(_=>s.jsxs(ce,{children:[s.jsx(q,{className:"text-muted-foreground",children:$c(_.created_at)}),s.jsx(q,{children:LD(_,c)}),s.jsx(q,{children:u3(_)})]},_.id))})]})})]})]}),s.jsxs("aside",{className:"flex w-full shrink-0 flex-col gap-5 lg:w-72",children:[s.jsx(si,{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(si,{label:"Resolution",children:s.jsx("span",{className:"text-sm",children:ox[c.resolution_reason]})}):null,s.jsx(si,{label:"Priority",id:"maintain-issue-priority",children:s.jsxs(dt,{value:c.priority??Al,disabled:!N||w,onValueChange:_=>void b(e.update(c.id,c.revision,{priority:_===Al?null:_})),children:[s.jsx(rt,{id:"maintain-issue-priority",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:Al,children:"Not set"}),ix.map(_=>s.jsx(Se,{value:_,children:eo[_]},_))]})]})}),s.jsxs(si,{label:"Assignee",id:"maintain-issue-assignee",children:[s.jsxs(dt,{value:c.assignee_id??Al,disabled:!N||w,onValueChange:_=>void b(e.assign(c.id,c.revision,_===Al?null:_)),children:[s.jsx(rt,{id:"maintain-issue-assignee",children:s.jsx(ft,{})}),s.jsxs(it,{children:[s.jsx(Se,{value:Al,children:"Not set"}),c.assignee_id&&!j.some(_=>_.user_id===c.assignee_id)?s.jsx(Se,{value:c.assignee_id,children:cx(c.assignee_id,c.assignee_username)}):null,j.map(_=>s.jsx(Se,{value:_.user_id,children:_.username??"Not available"},_.user_id))]})]}),c.assignee_can_act===!1?s.jsx(me,{variant:"error",className:"self-start",children:"Assignee cannot act"}):null]}),s.jsx(si,{label:"Updated",children:s.jsx("span",{className:"text-sm",children:$c(c.updated_at)})})]})]}),s.jsx(c3,{update:e.update,issue:c,open:y==="edit",onOpenChange:_=>g(_?"edit":null),onReload:p,onDone:()=>{g(null),p()}}),s.jsx(d3,{redact:e.redact,issue:c,open:y==="redact",onOpenChange:_=>g(_?"redact":null),onReload:p,onDone:()=>{g(null),o.success("The text was redacted."),p()}}),s.jsx(f3,{transition:e.transition,issue:c,open:y==="resolve",onOpenChange:_=>g(_?"resolve":null),onDone:_=>{g(null),_||o.error("Someone else changed this issue; it is reloaded."),p()}})]})}function si({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 p3=10,x3=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/,Bv=/^[A-Za-z0-9][A-Za-z0-9._+-]{0,63}$/;function g3(e,t,n,a=""){const l=n!=null&&n.startsWith("task:")?n.slice(5):null;if(l&&x3.test(l))return{label:l,path:`/org/${e}/tasks/${l}`};const r=`/proj/${encodeURIComponent(t)}/releases`,i=n!=null&&n.startsWith("release:")?n.slice(8):null;if(i&&Bv.test(i))return{label:i==="candidate"?"Candidate":i,path:`${r}?release=${encodeURIComponent(i)}`};const o=n!=null&&n.startsWith("planned:")?n.slice(8):null;if(o&&Bv.test(o))return{label:o,path:`${r}?planned=${encodeURIComponent(o)}`};const c=Xl(Dc(a));return{label:"Issues",path:`/proj/${encodeURIComponent(t)}/issues${c?`?${c}`:""}`}}const v3=["Fixed in","Being fixed in","The release planned to fix it"];function y3(e){const t=e.filter(n=>n.kind==="release");for(const n of v3){const a=t.find(l=>l.relation===n);if(a)return a}return t[0]??null}function b3({org:e,project:t,issue_id:n,from:a,query:l=""}){var Me;const r=Ek(),{href:i,Link:o}=Fe(),c=g3(e,t,a,l),d=`/proj/${encodeURIComponent(t)}/issues`,f=K=>`${d}/${encodeURIComponent(K)}`,[h,m]=u.useState({state:"loading"}),[x,j]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState({state:"loading"}),[b,w]=u.useState({state:"loading"}),N=u.useRef(null),R=ns(),_=u.useRef(null),k=u.useRef(!1),L=u.useRef(0),z=u.useRef(0),X=u.useCallback(async()=>{if(!r.issueSections)return;p({state:"loading"});const K=await r.issueSections(n);p(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueSections,n]),V=u.useCallback(async()=>{if(!r.issueRelated)return;w({state:"loading"});const K=await r.issueRelated(n);w(K.ok?{state:"ok",data:K.data}:{state:"failed",refusal:K.refusal})},[r.issueRelated,n]),U=u.useCallback(async()=>{const K=z.current+=1;if(y(null),!YD.test(n)){m({state:"missing"});return}X(),V();const ke=await r.issue(n);if(K!==z.current)return;if(ke.ok){L.current=0,j(null),m({state:"ok",issue:ke.data.issue,events:ke.data.events,at:new Date().toISOString()});return}const Pe=ke.refusal.reason;if(ke.refusal.status===404||Pe==="not_found")return m({state:"missing"});if(Pe==="engine_missing")return m({state:"engine_missing",refusal:ke.refusal});if(Pe==="view_outdated")return m({state:"view_outdated"});if(L.current+=1,L.current===1&&yk(ke.refusal)){y(ke.refusal.retry_after??p3);return}j(ke.refusal)},[r.issue,n,X,V]);u.useEffect(()=>{U()},[U]),u.useEffect(()=>{if(v===null)return;const K=setTimeout(()=>void U(),v*1e3);return()=>clearTimeout(K)},[v,U]),u.useEffect(()=>{var ke;if(k.current||h.state!=="ok")return;k.current=!0;const K=(ke=N.current)==null?void 0:ke.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h.state]);const M=u.useRef(null);u.useEffect(()=>{var Pe;const K=M.current;if(K===null||(K==="sections"?g:b).state==="loading")return;M.current=null;const ke=(K==="related"?_.current:null)??((Pe=N.current)==null?void 0:Pe.querySelector("h1"));ke==null||ke.focus()},[g,b]);const A=K=>{M.current=K,K==="sections"?X():V()},S=()=>{L.current=0,U()},E=u.useRef(!1),C=()=>{E.current=!0,S()};if(u.useEffect(()=>{var ke;if(!E.current||h.state==="loading"||v!==null)return;E.current=!1;const K=(ke=N.current)==null?void 0:ke.querySelector("h1");K&&(K.tabIndex=-1,K.focus())},[h,x,v]),h.state==="missing")return s.jsx(ya,{children:s.jsx(Ba,{icon:s.jsx(sd,{"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 $=s.jsx(G,{asChild:!0,variant:"link",size:"sm",className:"px-0",children:s.jsxs(o,{href:i(c.path),children:[s.jsx(f0,{className:"size-4","aria-hidden":"true"}),c.label]})});if(h.state==="engine_missing"||h.state==="view_outdated")return s.jsx(ya,{children:h.state==="engine_missing"?s.jsx(Xs,{page:"Issue",header:s.jsx(Ai,{back:$,id:null,title:n})}):s.jsxs(s.Fragment,{children:[s.jsx(Ai,{back:$,id:null,title:n}),s.jsxs(pe,{variant:"warning",className:"mt-4",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsx(xe,{children:R})]})]})});const F=x?s.jsxs(pe,{variant:"destructive",className:"mt-4",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This issue could not be loaded"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[x.message,x.since?` Since ${Qn(x.since)}.`:"",h.state==="ok"?` This page was read at ${Qn(h.at)}.`:"",x.message.includes(cl)?"":` ${cl}`]}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:C,children:"Retry"})]})]}):null,T=s.jsx("div",{role:"status","aria-live":"polite",children:v!==null?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",children:[s.jsx(bn,{"aria-hidden":"true"}),"This issue is busy. Reading it again…"]}):null});if(h.state==="loading")return s.jsxs(ya,{children:[s.jsx("div",{children:$}),T,F,!x&&v===null?s.jsxs("div",{className:"mt-4 grid gap-3",role:"status","aria-label":"Loading issue",children:[s.jsx(xt,{className:"h-6 w-40"}),s.jsx(xt,{className:"h-9 w-2/3"}),s.jsx(xt,{className:"h-24 w-full"})]}):null]});const{issue:P,events:ne,at:le}=h,ge=Ck(P),Z=g.state==="ok"?g.data:null,O=(Z==null?void 0:Z.reporter)??P.created_by_username??null,H=b.state==="ok"?y3(b.data):null,se=P.status==="resolved"||P.group==="resolved",B=!!(Z!=null&&Z.duplicate_of),ee=g.state==="loading"?"Loading…":(Z==null?void 0:Z.routing.owner)??P.owner_title??s.jsx("span",{className:"text-muted-foreground",children:"Unowned"}),W=K=>`${d}?${Xl({...cm,collection:K})}`,ae=Z==null?void 0:Z.report,J=!!(ae&&(ae.actual||ae.expected||ae.steps.length||ae.where)),Qe=[...ne].reverse(),de=s.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-sm",children:["Read at ",Qn(le)]}),s.jsxs(G,{type:"button",variant:"ghost",size:"sm",onClick:S,children:[s.jsx(yl,{className:"mr-2 size-4","aria-hidden":"true"}),"Read again"]})]});return s.jsx(ya,{children:s.jsxs("div",{ref:N,className:"contents",children:[s.jsx(Ai,{back:$,id:P.id,badge:s.jsxs(s.Fragment,{children:[s.jsx(me,{variant:ge.tone,children:ge.label}),P.urgent&&!se?s.jsx(me,{variant:"warning",children:"Urgent"}):null]}),title:P.title,created:`Reported${O?` by ${O}`:""} · ${Mi(P.created_at)}`,actions:de}),Z!=null&&Z.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(Z.duplicate_of)),children:Z.duplicate_of})]}):null,T,F,g.state==="loading"?s.jsxs("p",{className:"text-muted-foreground mt-2 flex items-center gap-2 text-sm",role:"status",children:[s.jsx(bn,{"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(ms,{label:"Owner",value:ee}),B?null:s.jsx(ms,{label:"Release",value:b.state==="loading"?"Loading…":H?s.jsx("span",{className:ie(H.label===H.id&&"font-mono"),children:H.label}):s.jsx("span",{className:"text-muted-foreground",children:"No release yet"})}),s.jsx(ms,{label:"Reported",value:[O,P.created_at?Mn(P.created_at):null].filter(Boolean).join(" · ")})]}),s.jsxs(pe,{variant:"info",className:"mt-4",children:[s.jsx(_o,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:Rk}),s.jsx(xe,{children:Tk})]}),g.state==="failed"?s.jsx("div",{className:"mt-6",children:s.jsx(rx,{what:"this issue's sections",again:"Read the issue again",refusal:g.refusal,on_retry:()=>A("sections")})}):null,Z&&J&&ae?s.jsxs(bt,{id:"issue-report",title:"What happens",children:[ae.actual?s.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ae.actual}):null,ae.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:ae.expected})]}):null,ae.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:ae.steps.map((K,ke)=>s.jsx("li",{children:K},ke))})]}):null,(Me=ae.where)!=null&&Me.env?s.jsxs("p",{className:"text-muted-foreground mt-3 text-sm",children:["Seen on ",ae.where.env,ae.where.sha?s.jsxs(s.Fragment,{children:[" ","at ",s.jsx("span",{className:"font-mono",children:ae.where.sha})]}):null]}):null]}):null,Z&&(Z.placement.placed||Z.placement.unplaced_why)?s.jsx(bt,{id:"issue-placement",title:"Placement",children:Z.placement.placed?s.jsxs("p",{className:"text-sm",children:["Placed in ",Z.placement.placed]}):s.jsxs(pe,{variant:"warning",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:["Not placed yet: ",Z.placement.unplaced_why]})]})}):null,Z&&(Z.routing.route||Z.routing.owner||Z.routing.none)?s.jsxs(bt,{id:"issue-routing",title:"Routing",children:[Z.routing.route?s.jsx("p",{className:"text-sm",children:Z.routing.route}):null,Z.routing.owner?s.jsxs("p",{className:"text-sm",children:["Owner: ",Z.routing.owner]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"Owner: none yet"})]}):null,Z&&(Z.labels.length>0||Z.collections.length>0)?s.jsxs(bt,{id:"issue-labels",title:"Labels and collections",children:[Z.labels.length?s.jsx("div",{className:"flex flex-wrap gap-1",children:Z.labels.map(K=>s.jsx(me,{variant:"neutral",size:"dense",children:K},K))}):null,Z.collections.length?s.jsx("ul",{className:"mt-2 grid gap-1 text-sm",children:Z.collections.map(K=>s.jsxs("li",{children:[s.jsx(o,{className:"text-primary hover:underline",href:i(W(K.collection)),children:K.title}),K.ref?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",K.ref]}):null,s.jsxs("span",{className:"text-muted-foreground",children:[" ","· ",K.resolved," of ",K.total," resolved"]})]},K.collection))}):null]}):null,Z&&Z.anchors.length>0?s.jsx(bt,{id:"issue-anchors",title:"Anchors",children:s.jsx(zf,{label:"Anchors",heads:["Kind","Value","By"],rows:Z.anchors.map(K=>[K.kind,s.jsx("span",{className:"font-mono text-xs break-all",children:K.value}),K.by??""])})}):null,Z&&Z.seen.length>0?s.jsx(bt,{id:"issue-seen",title:"Seen",aside:`${Z.seen.length} of ${Math.max(P.occurrences??0,Z.seen.length)} sightings`,children:s.jsx(zf,{label:"Seen",heads:["When","Where","Who","Note"],rows:Z.seen.map(K=>[Mi(K.at),s.jsxs(s.Fragment,{children:[K.sha?s.jsx("div",{className:"font-mono text-xs",children:K.sha}):null,K.env?s.jsx("div",{className:"text-muted-foreground text-xs",children:K.env}):null]}),K.who??"",K.note??""])})}):null,Qe.length>0?s.jsx(bt,{id:"issue-history",title:"History",aside:"From the issue store, newest first",children:s.jsx(zf,{label:"History",heads:["When","Who","What"],rows:Qe.map(K=>[Mi(K.created_at),K.actor_username??"",JD(K.note,K.kind)])})}):null,s.jsx(bk,{id:"issue-related",related:b,heading_ref:_,on_retry:()=>A("related"),fixed:!0,link:K=>{const ke=K.kind==="thread"?`${e?`/org/${e}`:""}/threads#thread-${encodeURIComponent(K.id)}`:K.kind==="task"?`/org/${e}/tasks/${encodeURIComponent(K.id)}?from=issue:${P.id}`:K.kind==="issue"?f(K.id):K.kind==="release"?`/proj/${encodeURIComponent(t)}/releases?${K.planned?"planned":"release"}=${encodeURIComponent(K.id)}`:null;if(K.kind==="task"&&ke){const Pe=e3(K.label);return s.jsxs("div",{className:"min-w-0",children:[s.jsx(o,{className:"text-primary font-mono text-xs hover:underline",href:i(ke),children:K.id}),Pe&&Pe!==K.id?s.jsx("div",{className:"text-muted-foreground line-clamp-1 text-xs",title:Pe,"data-testid":"related-task-title",children:Pe}):null]})}return ke?s.jsx(o,{className:ie("text-primary hover:underline",K.kind!=="thread"&&K.label===K.id&&"font-mono"),href:i(ke),children:K.label}):K.label}})]})})}function zf({label:e,heads:t,rows:n}){return s.jsx(gt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:e,children:[s.jsx(Ye,{children:s.jsx(ce,{children:t.map(a=>s.jsx(Y,{children:a},a))})}),s.jsx(He,{children:n.map((a,l)=>s.jsx(ce,{children:a.map((r,i)=>s.jsx(q,{className:"break-words",children:r},i))},l))})]})})}function j3({org:e,project:t,issue_id:n,from:a,query:l}){var r;return(r=ln().issues)!=null&&r.issueSections?s.jsx(b3,{org:e,project:t,issue_id:n,from:a,query:l}):s.jsx(h3,{org:e,project:t,issue_id:n,query:l})}function Tu(e,t){u.useEffect(()=>{const n=setInterval(()=>{document.visibilityState==="visible"&&e()},t),a=()=>{document.visibilityState==="visible"&&e()};return document.addEventListener("visibilitychange",a),()=>{clearInterval(n),document.removeEventListener("visibilitychange",a)}},[e,t])}const Ak={integration:"Integration",deploy:"Deploy",publish:"Publish",accept:"Accept",custom:"Custom"},w3={self_service:"Self-service",managed:"Managed",manager_only:"Manager only"},_3={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"},N3={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 k3(e){return N3[e??"in_batch"]}function S3(e){const t=e.turn==="next",n=t?"Next":"Waiting",a=e.batching==="managed"||e.batching==="released"?` · ${e.batching}`:"";return{label:`${n}${a}`,tone:t?"info":"neutral"}}const Mk=(e,t)=>`Holds ${e.toLowerCase()}${t?`: ${t}`:""}`;function C3(e,t,n,a=!0){return e.fixing_since!==void 0?{label:`Fixing forward since ${Vn(e.fixing_since)}`,tone:"warning"}:e.ref===t?{label:"Landing",tone:"info"}:a&&e.hold?{label:Mk(n),tone:"info"}:{label:"Running",tone:"info"}}function Vn(e){return new Date(e*1e3).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function Ml(e){const t=Math.round(e/60);if(t<60)return`${t} min`;const n=Math.floor(t/60),a=t%60;return a?`${n} h ${a} min`:`${n} h`}function R3(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 T3(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 E3(e,t){var o,c;const{policy:n,management:a}=e,l=(o=e.layer)==null?void 0:o.kind,r=d=>T3(d,t),i=[["Mode",_3[a.mode]],["Who can join",r(a.joiners)]];return l==="implement"&&i.push(["Managers",r(a.managers)],["Manager lease",Ml(a.manager_lease_seconds)],["Batches",n.batch.enabled?`Up to ${n.batch.max_members} entries`:"Off"]),((c=e.layer)==null?void 0:c.kind)==="release"&&(e.layer.promotes_to&&i.push(["Promotes to",e.layer.promotes_to]),i.push(["Carries waiting entries",n.ride?"Yes: a done turn carries entries already contained in it":"No"],["Freeze",n.freeze.enabled?`Up to ${Ml(n.freeze.max_seconds)}, ${Ml(n.freeze.default_seconds)} by default`+(e.layer.freezers?` · ${r(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":`${r(a.stall_takers)} may take one after ${Ml(n.stall_seconds)}`])),i.push(["Reorder",r(a.reorderers)]),n.max_turns>1&&i.push(["Turns at once",`Up to ${n.max_turns} independent turns`]),i.push(["Turn lease",Ml(n.lease_seconds)],["Time to start",`${Ml(n.start_grace_seconds)} after the turn comes`]),n.entry_limit!==null&&i.push(["Waiting entries",`Up to ${n.entry_limit}`]),n.footprint!=="off"&&i.push(["Footprint",n.footprint==="required"?"Required":"Optional"]),i}const Ok="Where your organization's agents take turns at a shared branch, environment or proposal. One turn runs at a time in each queue.",$k="A task you cannot see",A3="A former member",M3="A member";function Dk(){const e=ln().queues;if(!e)throw new Error("The Queues page rendered without the queues seam.");return e}function O3({org:e,open:t,path:n}){var h,m;const a=Dk(),{href:l,Link:r}=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"&&((h=o.refusal)==null?void 0:h.reason)!=="engine_missing"?s.jsx(Ba,{title:"Page not found",description:"This page does not exist, or you do not have access to it.",backHref:l(`/org/${e}`),backLabel:"Back to the organization",link:r}):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(D3,{org:e,open:t??null,path:n??`/org/${e}/tasks/queues`}):o.state==="off"&&((m=o.refusal)==null?void 0:m.reason)==="engine_missing"?s.jsx(Xs,{page:"Queues"}):s.jsxs(s.Fragment,{children:[s.jsx(Yt,{title:"Queues",description:a.description??Ok}),o.state==="loading"&&s.jsx(zk,{}),(o.state==="error"||o.state==="off")&&s.jsx(um,{refusal:o.refusal,on_retry:()=>void d(!0)}),o.state==="available"&&s.jsxs(pe,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Tasks are not on for this organization"}),s.jsxs(xe,{children:["Queues hold turns for tasks, so they show once Tasks are on."," ",s.jsx(r,{className:"text-primary hover:underline",href:l(`/org/${e}/tasks`),children:"Go to Tasks"})]})]})]})})}function zk(){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(xt,{className:t===2?"h-10 w-2/3":"h-10 w-full"},t))})}function um({refusal:e,on_retry:t}){const n=ns();return(e==null?void 0:e.reason)==="store_locked"?s.jsxs(pe,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"The local stores are busy"}),s.jsxs(xe,{children:[s.jsx("p",{children:e.message}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]}):(e==null?void 0:e.reason)==="view_outdated"?s.jsxs(pe,{variant:"warning",className:"mt-6",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsx(xe,{children:n})]}):s.jsxs(pe,{variant:"destructive",className:"mt-6",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Queues could not be loaded"}),s.jsxs(xe,{children:[s.jsx("p",{children:"The read did not answer. Try again in a moment."}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}const Lf=e=>e.status===404||e.reason==="not_found"||e.code==="not_found";function $3(e,t,n,a){return t?e===null?`Not reading · trying again every ${n}s`:`Not reading since ${Vn(e)} · trying again every ${n}s`:e===null?"Connecting…":`Live · read ${Vn(e)} · refreshes every ${n}s${a?` · ${a}`:""}`}function D3({org:e,open:t,path:n}){var O;const{listQueues:a,queue:l,members:r,refresh_ms:i,settings_note:o,description:c,read_scope:d,subject_label:f="Task",thread_subjects:h=!1}=Dk(),{self_id:m}=ed(),[x,j]=u.useState(null),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,w]=u.useState(null),[N,R]=u.useState({state:"pending",members:[]});u.useEffect(()=>{let H=!0;return r().then(se=>{H&&R(B=>se.ok?{state:"answered",members:se.data}:{state:"failed",members:B.members})}),()=>{H=!1}},[r]);const _=u.useMemo(()=>new Map(N.members.map(H=>[H.user_id,H])),[N.members]),k=N.state==="answered"?A3:M3,L=u.useCallback((H,se)=>{var B;return(se==null?void 0:se.title)??(h?(se==null?void 0:se.id)??H:H===m?"You":((B=_.get(H))==null?void 0:B.label)??k)},[_,k,m,h]),z=u.useRef({list:{last:null,fresh:!1},detail:{last:null,fresh:!1}}),[X,V]=u.useState(null),[U,M]=u.useState(!1),A=u.useCallback((H,se)=>{z.current[H]={last:se,fresh:!0};const{list:B,detail:ee}=z.current;M(B.last==="failed"||ee.last==="failed"),B.fresh&&ee.fresh&&B.last==="ok"&&ee.last==="ok"&&V(Date.now()/1e3)},[]),S=t??((O=x==null?void 0:x.queues[0])==null?void 0:O.id)??null,E=u.useRef(S);u.useEffect(()=>{E.current=S},[S]);const C=u.useRef(0),$=u.useCallback(async()=>{var B;const H=C.current+=1;z.current.list.fresh=!1;const se=await a();if(H===C.current)if(se.ok){if(j(se.data),y(null),!t){const ee=((B=se.data.queues[0])==null?void 0:B.id)??null;ee===null?z.current.detail={last:"ok",fresh:!0}:ee!==E.current&&(z.current.detail.fresh=!1)}A("list","ok")}else y(se.refusal),A("list","failed")},[a,t,A]),F=u.useRef(0),T=u.useCallback(async()=>{const H=F.current+=1;if(!S)return;z.current.detail.fresh=!1;const se=await l(S);H===F.current&&(se.ok?(p(se.data),w(null),A("detail","ok")):(w(se.refusal),Lf(se.refusal)&&p(null),A("detail",Lf(se.refusal)?"ok":"failed")))},[S,l,A]);u.useEffect(()=>{$()},[$]),u.useEffect(()=>{p(null),w(null),T()},[T]);const P=u.useCallback(()=>{$(),T()},[$,T]),ne=!x&&(v==null?void 0:v.reason)==="engine_missing",le=u.useCallback(()=>{ne||P()},[ne,P]);if(Tu(le,i),ne)return s.jsx(Xs,{page:"Queues"});const ge=Math.round(i/1e3),Z=b!==null&&Lf(b);return s.jsxs(s.Fragment,{children:[s.jsxs(Yt,{title:"Queues",description:c??Ok,children:[s.jsx("p",{className:"text-muted-foreground text-xs",children:$3(X,U,ge,d)}),s.jsx("span",{className:"sr-only",role:"status",children:U?"Not reading":X===null?"Connecting":"Live"})]}),!x&&!v&&s.jsx(zk,{}),!x&&v&&s.jsx(um,{refusal:v,on_retry:P}),x&&x.queues.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(g0,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No queues yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Queues are created through the sdlc CLI, the MCP tools or the API. Once one exists, its turns and waiting work show here."})]}):x?s.jsxs(s.Fragment,{children:[s.jsx(L3,{path:n,queues:x.queues,open_id:S,name:L,held:h}),Z?s.jsxs(pe,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This queue is no longer available"}),s.jsx(xe,{children:"It was archived, or you can no longer read its Workspace. Pick another queue above."})]}):g&&g.queue.id===S?s.jsx(U3,{org:e,detail:g,name:L,settings_note:o,subject_label:f,thread_subjects:h}):b?s.jsx(um,{refusal:b,on_retry:()=>void T()}):s.jsx(xt,{className:"mt-6 h-40 w-full shrink-0",role:"status","aria-label":"Loading the queue"})]}):null]})}function dm({org:e,subject:t,link:n}){const{href:a,Link:l}=Fe();return!t||t.hidden?s.jsx("span",{className:"text-muted-foreground",children:$k}):t.kind==="task"&&n?s.jsx(l,{className:"text-primary hover:underline",href:a(`/org/${e}/tasks/${t.id}`),children:t.title??t.id}):s.jsx("span",{children:t.title??t.id})}function z3(e,t,n){const a=e.freeze?`frozen until ${Vn(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 ${Vn(e.batch.opened_at)}`,a].filter(Boolean).join(" · "),warn:!1};if(e.turn){const l=e.turn.subject,r=l.hidden?$k:l.title??l.id,i=(e.running_count??1)>1?`${e.running_count} turns · `:"",o=e.turn.landing?" landing":"",c=n&&!!e.turn.hold,d=[c?Mk(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}${r}${o}`,secondary:Uf(d.join(" · ")),warn:!1}:{primary:`${i}${r}${o}`,secondary:d.length?Uf(d.join(" · ")):null,warn:d.length>0}}return{primary:"Nothing running",secondary:a?Uf(a):null,warn:!!a}}const Uf=e=>e.charAt(0).toUpperCase()+e.slice(1);function L3({path:e,queues:t,open_id:n,name:a,held:l}){const{href:r,Link:i}=Fe();return s.jsx(gt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Queues",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Queue"}),s.jsx(Y,{className:"hidden md:table-cell",children:"Step"}),s.jsx(Y,{children:"Running turn"}),s.jsx(Y,{className:"hidden text-right md:table-cell",children:"Waiting"})]})}),s.jsx(He,{children:t.map(o=>{var m;const c=o.id===n,d=R3(o),f=z3(o,a,l),h=o.waiting-(((m=o.batch)==null?void 0:m.remaining)??0);return s.jsxs(ce,{"data-testid":"queues-row",className:ie(c&&"bg-accent"),children:[s.jsxs(q,{children:[s.jsx(i,{className:"text-primary hover:underline",href:r(`${e}?queue=${encodeURIComponent(o.id)}`),"aria-current":c?"page":void 0,children:o.name}),d?s.jsx("div",{className:"text-muted-foreground text-xs",children:d}):null,s.jsxs("div",{className:"text-muted-foreground text-xs md:hidden",children:[h," waiting"]})]}),s.jsx(q,{className:"hidden md:table-cell",children:s.jsx(me,{variant:"neutral",children:Ak[o.policy.step]})}),s.jsxs(q,{children:[s.jsx("div",{className:ie(!o.batch&&!o.turn&&"text-muted-foreground"),children:f.primary}),f.secondary?s.jsx("div",{className:ie("text-xs",f.warn?"text-warning":"text-muted-foreground"),children:f.secondary}):null]}),s.jsx(q,{className:"hidden text-right md:table-cell",children:h})]},o.id)})})]})})}function mc({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 Hv({org:e,entries:t,landing:n,queue_name:a,subject_label:l,held:r,label:i}){return s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:i,children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:l}),s.jsx(Y,{children:"State"})]})}),s.jsx(He,{children:t.map(o=>{const c=C3(o,n,a,r);return s.jsxs(ce,{"data-testid":"queues-running",children:[s.jsxs(q,{children:[s.jsx(dm,{org:e,subject:o.subject,link:!r}),r&&o.hold&&o.note&&!o.subject.hidden?s.jsx("div",{className:"text-muted-foreground text-xs",children:o.note}):null]}),s.jsx(q,{children:s.jsx(me,{variant:c.tone,children:c.label})})]},o.ref)})})]})})}function U3({org:e,detail:t,name:n,settings_note:a,subject_label:l,thread_subjects:r}){var w;const{queue:i,state:o}=t,c=N=>n(N),d=new Map(o.entries.map(N=>[N.ref,N.subject])),f=o.entries.filter(N=>N.turn==="running"),h=o.entries.filter(N=>N.turn!=="running"&&N.batching!=="in_batch"),m=o.batch,x=Math.max(1,f.filter(N=>N.batching!=="in_batch").length),j=m&&i.policy.independent_turns?f.filter(N=>N.batching!=="in_batch"&&N.ref!==m.holder):[],v=o.manager,y=o.freeze,g=((w=i.layer)==null?void 0:w.kind)==="release"?i.layer.stall_hold:void 0,p=g?{who:n(g.by),why:g.reason,until:g.until}:v!=null&&v.hold?{who:n(v.holder,v.holder_subject),why:v.hold.why,until:v.hold.until}:null,b=!m&&f.length===0&&h.length===0;return s.jsxs(gt,{as:"section","aria-labelledby":"queue-title",className:"mt-6 flex shrink-0 flex-col gap-4 p-4","data-testid":"queues-detail",children:[s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h2",{id:"queue-title",className:"text-lg font-semibold",children:i.name}),s.jsx(me,{variant:"neutral",children:Ak[i.policy.step]}),s.jsx(me,{variant:"neutral",children:w3[i.management.mode]})]}),i.purpose?s.jsx("p",{className:"text-muted-foreground text-sm",children:i.purpose}):null]}),v?s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm","data-testid":"queues-manager",children:[s.jsx(mT,{className:"text-muted-foreground size-4","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Manager"}),s.jsx("span",{className:"font-medium",children:n(v.holder,v.holder_subject)}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Lease until ",Vn(v.lease_until),v.serving_until!==void 0?" · serving now":""]})]}):null,y?s.jsxs(pe,{variant:"warning",children:[s.jsx(oT,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:["Frozen until ",Vn(y.lease_until)]}),s.jsxs(xe,{children:[n(y.holder,y.holder_subject)," froze this queue at ",Vn(y.since),y.label?`: ${y.label}`:"",". Only ",n(y.holder,y.holder_subject),"'s entries start until it thaws."]})]}):null,p?s.jsxs(pe,{variant:"info",children:[s.jsx(v0,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:["Stall hold until ",Vn(p.until)]}),s.jsxs(xe,{children:[p.who,p.why?`: ${p.why}`:"",". The first entry is not treated as stalled while it lasts."]})]}):null,b?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running, and nothing waits in this queue."}):s.jsxs(s.Fragment,{children:[m?s.jsxs(mc,{id:"queue-running",title:"Running turn",side:`Batch opened by ${n(m.holder,m.holder_subject)} at ${Vn(m.opened_at)}`,children:[s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:"Batch members",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Landing order"}),s.jsx(Y,{children:l}),s.jsx(Y,{children:"Outcome"})]})}),s.jsx(He,{children:m.members.map((N,R)=>{const _=k3(N.outcome);return s.jsxs(ce,{"data-testid":"queues-member",children:[s.jsx(q,{children:R+1}),s.jsx(q,{children:s.jsx(dm,{org:e,subject:N.subject??d.get(N.ref)??(r?{kind:"thread",id:N.ref}:void 0),link:!r})}),s.jsx(q,{children:s.jsx(me,{variant:_.tone,children:_.label})})]},N.ref)})})]})}),j.length>0?s.jsxs(s.Fragment,{children:[s.jsx("h4",{className:"text-muted-foreground text-xs font-medium",children:"Also running"}),s.jsx(Hv,{org:e,entries:j,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Turns running beside the batch"})]}):null]}):s.jsx(mc,{id:"queue-running",title:f.length>1?"Running turns":"Running turn",children:f.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing running."}):s.jsx(Hv,{org:e,entries:f,landing:o.landing,queue_name:i.name,subject_label:l,held:r,label:"Running turns"})}),s.jsx(mc,{id:"queue-waiting",title:"Waiting",children:h.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing waits."}):s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsxs(Be,{containerAriaLabel:"Waiting entries",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Position"}),s.jsx(Y,{children:l}),s.jsx(Y,{className:"hidden md:table-cell",children:"Joined"}),s.jsx(Y,{children:"Turn"}),s.jsx(Y,{className:"hidden md:table-cell",children:"Note"})]})}),s.jsx(He,{children:h.map((N,R)=>{const _=S3(N);return s.jsxs(ce,{"data-testid":"queues-waiting",children:[s.jsx(q,{children:m?x+R+1:N.position}),s.jsx(q,{children:s.jsx(dm,{org:e,subject:N.subject,link:!r})}),s.jsx(q,{className:"hidden md:table-cell",children:Vn(N.joined_at)}),s.jsx(q,{children:s.jsx(me,{variant:_.tone,children:_.label})}),s.jsx(q,{className:"hidden md:table-cell",children:N.subject.hidden?"":N.note??""})]},N.ref)})})]})})})]}),s.jsx(mc,{id:"queue-settings",title:"Settings",children:s.jsx("div",{className:"overflow-x-auto rounded-lg border",children:s.jsx(Be,{containerAriaLabel:"Queue settings",children:s.jsx(He,{children:E3(i,c).map(([N,R])=>s.jsxs(ce,{children:[s.jsx(Y,{scope:"row",className:"h-auto w-48 py-2 font-normal",children:N}),s.jsx(q,{children:R})]},N))})})})}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a})]})}const ds="__no_parent__";function Lk(e,t){const n=new Set([t]);for(let a=!0;a;){a=!1;for(const l of e)l.parent&&n.has(l.parent)&&!n.has(l.key)&&(n.add(l.key),a=!0)}return n}const to=(e,t)=>(e.label||e.key).localeCompare(t.label||t.key);function tn({id:e,label:t,help:n,error:a,children:l}){const r=[n?`${e}-help`:null,a?`${e}-error`:null].filter(Boolean).join(" ")||void 0;return s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:e,children:t}),l(r),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 fm({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 Iv({id:e,label:t,help:n,checked:a,on_change:l}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Lr,{id:e,className:"mt-0.5",checked:a,"aria-describedby":n?`${e}-help`:void 0,onCheckedChange:r=>l(r===!0)}),s.jsx(Oe,{htmlFor:e,className:"font-normal",children:t})]}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground pl-6 text-xs",children:n}):null]})}function Uk({id:e,legend:t,help:n,error:a,options:l,checked:r,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(sn,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsx("div",{className:"grid gap-0.5",children:c.map(h=>s.jsx("p",{children:h},h))})]}):null,l.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:l.map((h,m)=>s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Lr,{id:`${e}-${m}`,className:"mt-0.5",checked:r.has(h.value),onCheckedChange:x=>{const j=new Set(r);x===!0?j.add(h.value):j.delete(h.value),i(j)}}),s.jsx(Oe,{htmlFor:`${e}-${m}`,className:"min-w-0 font-normal break-words",children:h.label})]},h.value))}),n?s.jsx("p",{id:`${e}-help`,className:"text-muted-foreground text-xs",children:n}):null,a?s.jsx("p",{id:`${e}-error`,className:"text-destructive text-sm",children:a}):null]})}function hm({context:e,action:t,title:n="Two-factor sign-in needed",changing:a="Changing the org"}){const l=e.two_factor==="enroll";return s.jsxs(pe,{variant:"destructive",role:"alert",children:[s.jsx(rT,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:n}),s.jsxs(xe,{children:[s.jsx("p",{children:l?`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(G,{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 Pa=e=>e.two_factor==="ok";function Pr({refusal:e,context:t,subject:n,action:a,changing:l,authority_title:r}){if((e==null?void 0:e.kind)==="two_factor")return s.jsx(hm,{context:t,action:a,changing:l,title:`Could not save ${n}`});const i=Pa(t)?null:s.jsx(hm,{context:t,action:a,changing:l});if(!e)return i;const o=e.kind==="changed"?"The org changed since you opened this":e.kind==="authority"?r??`Could not save ${n}`:null;return s.jsxs(s.Fragment,{children:[i,s.jsxs(pe,{variant:"destructive",role:"alert",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),o?s.jsx(be,{children:o}):null,s.jsx(xe,{children:e.message})]})]})}function Bk({id:e,value:t,on_change:n,none:a,options:l,described_by:r}){return s.jsxs(dt,{value:t,onValueChange:n,children:[s.jsx(rt,{id:e,"aria-describedby":r,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsxs(it,{children:[a?s.jsx(Se,{value:ds,children:a}):null,l.map(i=>s.jsx(Se,{value:i.key,children:i.label||i.key},i.key))]})]})}function qr(e){const[t,n]=u.useState(!1),[a,l]=u.useState(null);return{saving:t,refusal:a,set_refusal:l,run:async i=>{n(!0),l(null);try{const o=await i();o?l(o):e()}finally{n(!1)}}}}function Gr({saving:e,blocked:t,described_by:n,children:a}){return s.jsx(G,{type:"submit",disabled:e,"aria-disabled":t||void 0,"aria-describedby":t?n:void 0,children:a})}const Hk=(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 B3({open:e,chart:t,team:n,save:a,on_close:l,context:r=zo,scope:i="full",parents:o}){var C;const c=r.host==="hosted",[d,f]=u.useState(""),[h,m]=u.useState(""),[x,j]=u.useState(""),[v,y]=u.useState(ds),[g,p]=u.useState({}),{saving:b,refusal:w,set_refusal:N,run:R}=qr(l),_=((C=t.teams.find($=>$.parent===null))==null?void 0:C.key)??null;u.useEffect(()=>{e&&(f(""),m((n==null?void 0:n.label)??""),j((n==null?void 0:n.description)??""),y((n==null?void 0:n.parent)??(c&&_&&(!o||o.includes(_))?_:ds)),p({}),N(null))},[e,n,N,c,_,o]);const k=$=>{const F=t.teams.find(T=>T.key===$);return F?F.label||F.key:$??""},L=n?Lk(t.teams,n.key):new Set,z=[...t.teams].filter($=>!L.has($.key)&&(!o||o.includes($.key))).sort(($,F)=>$.key===_?-1:F.key===_?1:to($,F)),X=n?n.label||n.key:"",V=i==="description",U=!Pa(r),M=n?V?"save the description":"save the team":"add the team",A=$=>{if($.preventDefault(),U)return;if(!n){const P=c?h.trim():d.trim();if(!P){p(c?{label:"Give the team a name."}:{key:"Give the team a key."});return}if(c&&v===ds){p({parent:"Choose the parent team."});return}const ne=c?P:h.trim()||P;R(()=>a({action:"add",kind:"team",key:P,...h.trim()?{label:h.trim()}:{},...x.trim()?{description:x.trim()}:{},...v!==ds?{parent:v}:{}},`Team ${ne} added.`));return}if(!V&&!h.trim()){p({label:c?"Give the team a name.":"Give the team a label."});return}const F=v===ds?null:v,T={...!V&&h.trim()!==n.label.trim()?{label:h.trim()}:{},...x.trim()!==(n.description??"").trim()?{description:x.trim()}:{},...!c&&F!==n.parent?{parent:F}:{}};if(Object.keys(T).length===0){l();return}R(()=>a({action:"edit",kind:"team",key:n.key,...T},V?`Saved the description of ${X}.`:`Team ${h.trim()} saved.`))},S=n?V?`Edit the description of ${X}`:`Edit team ${X}`:"Add team";let E;return V?E="Say what the team works on. Only the description is yours to change here.":c?E=n?"Rename the team or say what it works on.":"Add a team to the organization.":n?E=s.jsxs(s.Fragment,{children:["Its key, ",s.jsx("span",{className:"font-mono",children:n.key}),", names it in posts and in sdlc org and does not change."]}):E="Add a team to this repository's local org.",s.jsx(Ln,{open:e,onOpenChange:$=>$||b?null:l(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:A,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:S}),s.jsx(Pn,{children:E})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Pr,{refusal:w,context:r,subject:V?"the description":"the team",action:M}),!n&&!c?s.jsx(tn,{id:"org-team-key",label:"Key",help:Hk("team",r.host),error:g.key,children:$=>s.jsx(_t,{id:"org-team-key",className:"font-mono",value:d,autoComplete:"off","aria-invalid":g.key?!0:void 0,"aria-describedby":$,onChange:F=>{f(F.target.value),p({})}})}):null,V&&n?s.jsx(fm,{label:"Name",children:n.parent?`${X} · under ${k(n.parent)}`:X}):s.jsx(tn,{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:$=>s.jsx(_t,{id:"org-team-label",value:h,"aria-invalid":g.label?!0:void 0,"aria-describedby":$,onChange:F=>{m(F.target.value),p({})}})}),s.jsx(tn,{id:"org-team-description",label:V?"Description":"Description (optional)",children:()=>s.jsx(as,{id:"org-team-description",rows:3,placeholder:"What the team does",value:x,onChange:$=>j($.target.value)})}),V?null:c&&n?s.jsx(fm,{label:"Parent team",children:n.parent?k(n.parent):"None: the organization itself"}):s.jsx(tn,{id:"org-team-parent",label:"Parent team",help:"Where the team sits; its posts report up through the team above.",error:g.parent,children:$=>s.jsx(Bk,{id:"org-team-parent",value:v,on_change:F=>{y(F),p({})},none:c?void 0:"No parent (a root team)",options:z,described_by:$})})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",disabled:b,onClick:l,children:"Cancel"}),s.jsx(Gr,{saving:b,blocked:U,children:n?b?"Saving…":"Save":b?"Adding…":"Add team"})]})]})})})}const H3=(e,t)=>e.length===t.size&&e.every(n=>t.has(n));function I3({open:e,chart:t,job:n,save:a,on_close:l,context:r=zo}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(""),[m,x]=u.useState(ds),[j,v]=u.useState(new Set),[y,g]=u.useState(!1),[p,b]=u.useState(!0),[w,N]=u.useState({}),{saving:R,refusal:_,set_refusal:k,run:L}=qr(l);u.useEffect(()=>{e&&(o(""),d((n==null?void 0:n.label)??""),h((n==null?void 0:n.description)??""),x((n==null?void 0:n.parent)??ds),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),N({}),k(null))},[e,n,k]);const z=n?Lk(t.job_functions,n.key):new Set,X=[...t.job_functions].filter(S=>!z.has(S.key)).sort(to),V=[...t.slots].sort(to).map(S=>({value:S.key,label:S.label||S.key})),U=!Pa(r),M=n?"save the job function":"add the job function",A=S=>{if(S.preventDefault(),U)return;if(!n){if(!i.trim()){N({key:"Give the job function a key."});return}L(()=>a({action:"add",kind:"job_function",key:i.trim(),...c.trim()?{label:c.trim()}:{},...f.trim()?{description:f.trim()}:{},...m!==ds?{parent:m}:{},fills:[...j],requires_person:y,escalable:p},`Job function ${c.trim()||i.trim()} added.`));return}if(!c.trim()){N({label:"Give the job function a label."});return}const E=m===ds?null:m,C={...c.trim()!==n.label.trim()?{label:c.trim()}:{},...f.trim()!==(n.description??"").trim()?{description:f.trim()}:{},...E!==n.parent?{parent:E}:{},...H3(n.fills,j)?{}:{fills:[...j]},...y!==n.requires_person?{requires_person:y}:{},...p!==n.escalable?{escalable:p}:{}};if(Object.keys(C).length===0){l();return}L(()=>a({action:"edit",kind:"job_function",key:n.key,...C},`Job function ${c.trim()} saved.`))};return s.jsx(Ln,{open:e,onOpenChange:S=>S||R?null:l(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:A,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:n?`Edit job function ${n.label||n.key}`:"Add job function"}),s.jsxs(Pn,{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(Pr,{refusal:_,context:r,subject:"the job function",action:M}),n?null:s.jsx(tn,{id:"org-function-key",label:"Key",help:Hk("job function",r.host),error:w.key,children:S=>s.jsx(_t,{id:"org-function-key",className:"font-mono",value:i,autoComplete:"off","aria-invalid":w.key?!0:void 0,"aria-describedby":S,onChange:E=>{o(E.target.value),N({})}})}),s.jsx(tn,{id:"org-function-label",label:n?"Label":"Label (optional)",error:w.label,children:S=>s.jsx(_t,{id:"org-function-label",value:c,"aria-invalid":w.label?!0:void 0,"aria-describedby":S,onChange:E=>{d(E.target.value),N({})}})}),s.jsx(tn,{id:"org-function-description",label:"Job description (optional)",children:()=>s.jsx(as,{id:"org-function-description",rows:3,placeholder:"What this job function does",value:f,onChange:S=>h(S.target.value)})}),s.jsx(tn,{id:"org-function-parent",label:"Parent function",help:"Its posts report to the post of the parent function.",children:S=>s.jsx(Bk,{id:"org-function-parent",value:m,on_change:x,none:"No parent (a root function)",options:X,described_by:S})}),s.jsx(Uk,{id:"org-function-fills",legend:"Slots it fills",options:V,checked:j,on_change:v,empty:r.host==="hosted"?"This organization has no slots yet.":"This org has no slots yet; add them with sdlc org add slot."}),s.jsx(Iv,{id:"org-function-requires-person",label:"Requires a person",help:"Only a person may hold its posts.",checked:y,on_change:g}),s.jsx(Iv,{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(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",disabled:R,onClick:l,children:"Cancel"}),s.jsx(Gr,{saving:R,blocked:U,children:n?R?"Saving…":"Save":R?"Adding…":"Add job function"})]})]})})})}const P3=/^[a-z][a-z0-9_-]{0,63}$/;function q3(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[^a-z]+/,"").slice(0,64).replace(/-+$/,"")}function G3({open:e,chart:t,slot:n,save:a,on_close:l,context:r=zo}){const[i,o]=u.useState(""),[c,d]=u.useState(""),[f,h]=u.useState(!1),[m,x]=u.useState(""),[j,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:b}=qr(l);u.useEffect(()=>{e&&(o((n==null?void 0:n.label)??""),d((n==null?void 0:n.key)??""),h(!1),x((n==null?void 0:n.description)??""),v({}),p(null))},[e,n,p]);const w=!Pa(r),N=n?"save the slot":"add the slot",R=_=>{if(_.preventDefault(),w)return;const k=i.trim();if(n){if(!k){v({label:"Give the slot a label."});return}const z={...k!==(n.label??"").trim()?{label:k}:{},...m.trim()!==(n.description??"").trim()?{description:m.trim()}:{}};if(Object.keys(z).length===0){l();return}b(()=>a({action:"edit",kind:"slot",key:n.key,...z},`Saved slot ${k}.`));return}const L={...k?{}:{label:"Give the slot a label."},...P3.test(c)?t.slots.some(z=>z.key===c)?{key:`Slot ${c} already exists.`}:{}:{key:"Use lowercase letters, digits, _ and -, starting with a letter, at most 64 characters."}};v(L),!(L.label||L.key)&&b(()=>a({action:"add",kind:"slot",key:c,label:k,...m.trim()?{description:m.trim()}:{}},`Added slot ${k}.`))};return s.jsx(Ln,{open:e,onOpenChange:_=>_||y?null:l(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:R,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:n?`Edit ${n.label||n.key}`:"Add slot"}),s.jsx(Pn,{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(Pr,{refusal:g,context:r,subject:"the slot",action:N}),s.jsx(tn,{id:"org-slot-label",label:"Label",help:"How the slot is named on the chart and in project settings.",error:j.label,children:_=>s.jsx(_t,{id:"org-slot-label",value:i,"aria-invalid":j.label?!0:void 0,"aria-describedby":_,onChange:k=>{o(k.target.value),!n&&!f&&d(q3(k.target.value)),v({})}})}),n?s.jsx(fm,{label:"Key",children:s.jsx("span",{className:"font-mono",children:n.key})}):s.jsx(tn,{id:"org-slot-key",label:"Key",help:"Lowercase letters, digits, _ and -, starting with a letter, at most 64 characters. It can't be changed after you save.",error:j.key,children:_=>s.jsx(_t,{id:"org-slot-key",className:"font-mono",value:c,autoComplete:"off","aria-invalid":j.key?!0:void 0,"aria-describedby":_,onChange:k=>{d(k.target.value),h(!0),v({})}})}),s.jsx(tn,{id:"org-slot-description",label:"Description (optional)",children:()=>s.jsx(as,{id:"org-slot-description",rows:3,placeholder:"What this role does",value:m,onChange:_=>x(_.target.value)})})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",disabled:y,onClick:l,children:"Cancel"}),s.jsx(Gr,{saving:y,blocked:w,children:n?y?"Saving…":"Save":y?"Adding…":"Add slot"})]})]})})})}function V3({open:e,chart:t,binding:n,names:a,save:l,confirm:r,on_close:i,context:o=zo,hosted:c}){var U;const[d,f]=u.useState(new Set),[h,m]=u.useState(""),[x,j]=u.useState({}),{saving:v,refusal:y,set_refusal:g,run:p}=qr(i),b=(n==null?void 0:n.slot)??null;if(u.useEffect(()=>{!e||!n||(f(new Set(c&&n.source!=="override"?[]:n.posts.map(M=>M.post))),m(n.source==="override"?n.reason??"":""),j({}),g(null))},[e,b,g]),!n)return null;const w=a.slot(n.slot),N=(U=t.project)!=null&&U.team?t.teams.find(M=>{var A;return M.key===((A=t.project)==null?void 0:A.team)}):void 0,R=N?N.label||N.key:"the owning team",_=new Set(t.job_functions.filter(M=>M.fills.includes(n.slot)).map(M=>M.key)),k=[...t.posts].map(M=>M.post).sort(a.byPost).map(M=>{const A=_.has(M.split("/")[1]??"")?`${a.post(M)} (fills ${w})`:a.post(M),S=c==null?void 0:c.holders(M);return{value:M,label:c?S?`${A}: ${S}`:`${A} (no holder)`:A}}),L=c?[...d].sort(a.byPost).flatMap(M=>[..._.has(M.split("/")[1]??"")?[]:[`${a.post(M)} is not in the job description of ${w}.`],...c.chain.has(M.split("/")[0]??"")?[]:[`${a.post(M)} is outside ${c.owner} and the teams above it.`]]):[],z=!Pa(o),X=M=>{M.preventDefault();const A={...d.size===0?{posts:"Choose at least one post."}:{},...h.trim()?{}:{reason:"Give the reason for the override."}};j(A),!(A.posts||A.reason||z)&&p(()=>l({action:"bind",slot:n.slot,posts:[...d],reason:h.trim()},`Override of ${w} saved.`))},V=async()=>{await r({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(()=>l({action:"unbind",slot:n.slot},`Override of ${w} cleared.`))};return s.jsx(Ln,{open:e,onOpenChange:M=>M||v?null:i(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:X,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsxs(In,{children:["Override ",w]}),s.jsxs(Pn,{children:["Bind ",w," in this project to the posts you choose instead of its"," ",c?"team’s":"job descriptions’"," posts. The override is reported with its reason, who set it and when."]})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[y||z?s.jsx("div",{id:"org-override-refusal",className:"grid gap-4",children:s.jsx(Pr,{refusal:y,context:o,subject:"the override",action:c?"save":"save the override",changing:c?"Changing this project’s slots":void 0,authority_title:c?"Your changes were not saved":void 0})}):null,s.jsx(Uk,{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:L,scroll:!!c,error:x.posts,options:k,checked:d,on_change:M=>{f(M),j(A=>({...A,posts:void 0}))}}),s.jsx(tn,{id:"org-override-reason",label:"Reason",error:x.reason,children:M=>s.jsx(as,{id:"org-override-reason",rows:2,placeholder:"Why this slot needs other posts",value:h,"aria-invalid":x.reason?!0:void 0,"aria-describedby":M,onChange:A=>{m(A.target.value),j(S=>({...S,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 ",R," or of a team above it."]})]}),s.jsxs(Hn,{className:"mt-6",children:[n.source==="override"?s.jsx(G,{type:"button",variant:"ghost",className:"sm:mr-auto",disabled:v,onClick:()=>void V(),children:"Clear override"}):null,s.jsx(G,{type:"button",variant:"outline",disabled:v,onClick:i,children:"Cancel"}),s.jsx(Gr,{saving:v,blocked:z,described_by:"org-override-refusal",children:v?"Saving…":"Save override"})]})]})})})}function Y3(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} or ${e[e.length-1]}`}function F3({open:e,chart:t,names:n,save:a,on_close:l,context:r}){var U;const i=t.authority,o=u.useMemo(()=>new Set((i==null?void 0:i.post_pairs)??[]),[i]),c=((U=t.teams.find(M=>M.parent===null))==null?void 0:U.key)??null,d=[...t.teams].filter(M=>[...o].some(A=>A.startsWith(`${M.key}/`))).sort((M,A)=>M.key===c?-1:A.key===c?1:to(M,A)),[f,h]=u.useState(""),[m,x]=u.useState(""),[j,v]=u.useState({}),{saving:y,refusal:g,set_refusal:p,run:b}=qr(l);u.useEffect(()=>{var M;e&&(h(((M=d[0])==null?void 0:M.key)??""),x(""),v({}),p(null))},[e,p]);const w=new Set(t.posts.filter(M=>M.post.startsWith(`${f}/`)).map(M=>M.post.split("/")[1])),N=[],R=M=>{for(const A of[...t.job_functions].filter(S=>S.parent===M).sort(to))N.push(A),R(A.key)};R(null);const _=N.filter(M=>o.has(`${f}/${M.key}`)&&!w.has(M.key)),k=f!==""&&_.length===0,L=!Pa(r)||k,z=M=>{if(M.preventDefault(),L)return;const A={...f?{}:{team:"Choose a team."},...m?{}:{job:"Choose a job function."}};v(A),!(A.team||A.job)&&b(()=>a({action:"add",kind:"post",key:`${f}/${m}`},`Added post ${n.job(m)} · ${n.team(f)}.`))},X=k?"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.",V=(i==null?void 0:i.ask)??[];return s.jsx(Ln,{open:e,onOpenChange:M=>M||y?null:l(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:z,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsx(In,{children:"Add post"}),s.jsx(Pn,{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(Pr,{refusal:g,context:r,subject:"the post",action:"add the post"}),s.jsx(tn,{id:"org-post-team",label:"Team",help:"The team the post is in.",error:j.team,children:M=>s.jsxs(dt,{value:f,onValueChange:A=>{h(A),x(""),v({})},children:[s.jsx(rt,{id:"org-post-team","aria-describedby":M,"aria-invalid":j.team?!0:void 0,children:s.jsx(ft,{placeholder:"Choose a team"})}),s.jsx(it,{children:d.map(A=>s.jsx(Se,{value:A.key,children:A.label||A.key},A.key))})]})}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(tn,{id:"org-post-function",label:"Job function",help:X,error:j.job,children:M=>s.jsxs(dt,{value:m,disabled:k,onValueChange:A=>{x(A),v({})},children:[s.jsx(rt,{id:"org-post-function","aria-describedby":M,"aria-invalid":j.job?!0:void 0,children:s.jsx(ft,{placeholder:k?"Every job function has a post here":"Choose a job function"})}),s.jsx(it,{children:_.map(A=>s.jsx(Se,{value:A.key,children:A.label||A.key},A.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.",V.length?` For others, ask ${Y3(V)}.`:""]}):null]})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",disabled:y,onClick:l,children:"Cancel"}),s.jsx(Gr,{saving:y,blocked:L,described_by:k?"org-post-function-help":void 0,children:y?"Adding…":"Add post"})]})]})})})}function K3({open:e,chart:t,post:n,names:a,members:l,save:r,on_close:i,context:o}){const[c,d]=u.useState({state:"loading"}),[f,h]=u.useState(""),[m,x]=u.useState(null),[j,v]=u.useState(-1),{saving:y,refusal:g,set_refusal:p,run:b}=qr(i),w=u.useRef(0),N=u.useCallback(async()=>{const T=w.current+=1;d({state:"loading"});const P=await l();T===w.current&&d(P.ok?{state:"read",members:P.data}:{state:"failed"})},[l]);u.useEffect(()=>{e&&(h(""),x(null),v(-1),p(null),N())},[e,N,p]);const R=t.posts.find(T=>T.post===n);if(!n||!R)return null;const _=a.post(n),k=new Set(R.holders.map(T=>T.id)),z=t.posts.some(T=>T.reports_to===n)&&R.holders.length>0?R.holders[0]:null,X=f.trim().toLowerCase(),V=c.state==="read"?c.members.filter(T=>!k.has(T.id)).filter(T=>!X||[T.label,T.detail,T.email].some(P=>P==null?void 0:P.toLowerCase().includes(X))):[],U=c.state==="read"&&c.members.every(T=>k.has(T.id)),M=c.state==="read"&&!U&&V.length>0,A=M&&j>=0&&j<V.length?V[j]:null,S=T=>`org-holder-option-${T.id}`,E=!Pa(o)||!m||z!==null,C=T=>{if(!M)return;const P=V.length-1,ne=le=>{var ge,Z;T.preventDefault(),v(le),(Z=(ge=document.getElementById(S(V[le])))==null?void 0:ge.scrollIntoView)==null||Z.call(ge,{block:"nearest"})};T.key==="ArrowDown"?ne(Math.min(A?j+1:0,P)):T.key==="ArrowUp"?ne(A?Math.max(j-1,0):P):T.key==="Home"&&A?ne(0):T.key==="End"&&A?ne(P):T.key==="Enter"&&A&&(m==null?void 0:m.id)!==A.id&&(T.preventDefault(),x(A))},$=z?void 0:m?"Only members of the organization can hold its posts. Members who already hold it are left out.":"Choose a member to add.",F=T=>{T.preventDefault(),!(E||!m)&&b(()=>r({action:"hold",post:n,member:m.id},`Added ${m.label} to ${_}.`))};return s.jsx(Ln,{open:e,onOpenChange:T=>T||y?null:i(),children:s.jsx(Un,{children:s.jsxs("form",{onSubmit:F,noValidate:!0,children:[s.jsxs(Bn,{children:[s.jsxs(In,{children:["Add holder to ",_]}),s.jsx(Pn,{children:"The member holds this post and reports as it does."})]}),s.jsxs("div",{className:"mt-4 grid gap-4",children:[s.jsx(Pr,{refusal:g,context:o,subject:"the holder",action:"add the holder"}),z?s.jsxs(pe,{variant:"info",id:"org-holder-one",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsxs(xe,{children:["This post takes one holder. Remove ",a.member(z)," first, then add the new holder."]})]}):null,s.jsxs("div",{className:"grid gap-2",children:[s.jsx(Oe,{htmlFor:"org-holder-member",children:"Member"}),s.jsx(_t,{id:"org-holder-member",role:"combobox","aria-expanded":M,"aria-controls":M?"org-holder-members":void 0,"aria-activedescendant":A?S(A):void 0,"aria-autocomplete":"list","aria-describedby":$?"org-holder-member-help":void 0,placeholder:"Search members by name, username or email",autoComplete:"off",value:f,disabled:z!==null,onChange:T=>{h(T.target.value),v(-1)},onKeyDown:C}),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(bn,{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(G,{type:"button",variant:"outline",size:"sm",onClick:()=>void N(),children:"Retry"})]}):U?s.jsx("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:"Every member already holds this post."}):V.length===0?s.jsxs("p",{className:"text-muted-foreground px-3 py-2 text-sm",children:["No member matches “",f.trim(),"”."]}):s.jsx("ul",{id:"org-holder-members",role:"listbox","aria-label":"Members",className:"m-0 list-none p-1",children:V.map((T,P)=>{const ne=(m==null?void 0:m.id)===T.id,le=(A==null?void 0:A.id)===T.id;return s.jsxs("li",{id:S(T),role:"option","aria-selected":ne,className:`cursor-pointer rounded-sm px-2 py-1.5 ${ne?"bg-accent text-accent-foreground":le?"bg-muted":"hover:bg-muted"} ${le?"ring-ring ring-2 ring-inset":""}`,onClick:()=>{z||(v(P),x(T))},children:[s.jsxs("div",{className:"text-sm font-medium break-words",children:[T.label,T.detail&&V.filter(ge=>ge.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)})})}),$?s.jsx("p",{id:"org-holder-member-help",className:"text-muted-foreground text-xs",children:$}):null]})]}),s.jsxs(Hn,{className:"mt-6",children:[s.jsx(G,{type:"button",variant:"outline",disabled:y,onClick:i,children:"Cancel"}),s.jsx(Gr,{saving:y,blocked:E,described_by:z?"org-holder-one":$?"org-holder-member-help":void 0,children:y?"Adding…":"Add holder"})]})]})})})}function X3(e){const[t,n]=u.useState(null),a=u.useRef(t);u.useEffect(()=>{a.current=t},[t]);const l=u.useCallback(c=>{var d;(d=a.current)==null||d.resolve(c),n(null)},[]),r=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=!Pa(e),o=s.jsx(mw,{open:t!==null,onOpenChange:c=>c?null:l(!1),children:s.jsxs(pw,{children:[s.jsxs(xw,{children:[s.jsx(vw,{children:t==null?void 0:t.title}),s.jsx(yw,{className:"whitespace-pre-line",children:t==null?void 0:t.description})]}),t&&i?s.jsx(hm,{context:e,action:t.action}):null,s.jsxs(gw,{children:[s.jsx(jw,{children:"Cancel"}),s.jsx(bw,{variant:t!=null&&t.destructive?"destructive":"default","aria-disabled":i||void 0,onClick:c=>{if(i){c.preventDefault();return}l(!0)},children:t==null?void 0:t.action_label})]})]})});return{confirm:r,confirm_dialog:o}}function no({label:e,on_edit:t,on_remove:n,items:a}){const l=a??[...t?[{label:"Edit",on_select:t}]:[],...n?[{label:"Remove",on_select:n,destructive:!0}]:[]];return s.jsxs(jd,{children:[s.jsx(wd,{asChild:!0,children:s.jsx(G,{type:"button",variant:"ghost",size:"control-icon",className:"-my-1 shrink-0","aria-label":`More actions for ${e}`,children:s.jsx(vp,{className:"size-3.5","aria-hidden":"true"})})}),s.jsx(Oo,{align:"end",children:l.map(r=>s.jsx(wr,{className:r.destructive?"text-destructive focus:text-destructive":void 0,onSelect:r.on_select,children:r.label},r.label))})]})}function Q3({label:e,message:t,bound:n,on_dismiss:a}){return s.jsxs(pe,{variant:"destructive",role:"alert",className:"mb-3",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsxs(be,{children:[e," was not removed"]}),s.jsxs(xe,{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(l=>s.jsxs("li",{className:"grid gap-0.5",children:[s.jsxs("a",{className:"text-primary text-sm underline underline-offset-2",href:l.href,children:["Settings of ",l.name]}),s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Override set by ",l.set_by??"a former member"]})]},l.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(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:a,children:"Dismiss"})]})]})}const zo={host:"local",two_factor:"ok",settings_href:""},Z3={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."},W3="Covered: someone holds a post that fills the slot. Vacant: posts fill it but nobody holds them. Uncovered: no job function fills it.",J3=4,ux=e=>({paddingLeft:16+24*Math.min(e,J3)}),Eu={covered:{label:"Covered",tone:"success"},vacant:{label:"Vacant",tone:"warning"},uncovered:{label:"Uncovered",tone:"error"}};function ez(){const e=ln().org;if(!e)throw new Error("The Org chart page rendered without the org seam.");return e}function tz({host:e="local",org:t=""}={}){const n=ez(),[a,l]=u.useState({state:"loading"}),[r,i]=u.useState(null),o=u.useRef(0),c=u.useRef(null),d=u.useCallback(j=>{const v=async y=>{const g=o.current+=1;c.current&&clearTimeout(c.current);const p=await n.chart();if(g!==o.current)return;if(p.ok){i({chart:p.data,at:new Date().toISOString()}),l({state:"read"});return}const{refusal:b}=p;if(b.reason==="no_local_org"){i(null),l({state:"none",seedable:b.seedable!==!1});return}if(e==="hosted"&&(b.reason==="not_found"||b.status===404)){i(null),l({state:"missing"});return}if(b.retry&&b.reason==="store_locked"&&y>0){const w=b.retry_after??10;l({state:"busy",retry_after:w}),c.current=setTimeout(()=>void v(y-1),w*1e3);return}l({state:"failed",refusal:b})};return v(j)},[n,e]);u.useEffect(()=>(d(1),()=>{o.current+=1,c.current&&clearTimeout(c.current)}),[d]);const f=()=>void d(1),h=a.state==="none"||a.state==="missing"?null:r,{href:m}=Fe(),x=oz(n,()=>void d(1),(h==null?void 0:h.chart)??nz,e,m("/settings/account"));return a.state==="missing"?s.jsx(dz,{org:t}):s.jsx(ik,{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(Yt,{title:"Org chart",description:Z3[e]}),a.state==="busy"&&!h?s.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",role:"status",children:["Another sdlc command holds the repository store; reading again in ",a.retry_after," s."]}):null,(a.state==="loading"||a.state==="busy")&&!h?s.jsx(cz,{quiet:a.state==="busy"}):null,a.state==="none"?s.jsx(uz,{edit:(x==null?void 0:x.actions)??null,seedable:a.seedable}):null,a.state==="failed"?s.jsx(hz,{host:e,kept_at:(h==null?void 0:h.at)??null,on_retry:f}):null,h?s.jsx(mz,{chart:h.chart,host:e,edit:(x==null?void 0:x.actions)??null}):null,(x==null?void 0:x.dialogs)??null]})})}const nz={org:"",workflow:!1,teams:[],job_functions:[],slots:[],posts:[],members:[],slot_resolution:[],project:{team:null,roots:[]}};function sz(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),l=new Set(t.team_descriptions),r=new Set(t.posts);return{functions:t.administer,team_add:a.size>0,team:o=>o===n?t.administer?"root":l.has(o)?"description":null:a.has(o)?"full":l.has(o)?"description":null,post_add:t.post_pairs.length>0,post:o=>r.has(o),override:!1,slots:t.administer}}function az(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 lz={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."},rz={mfa_challenge_required:"challenge",mfa_enrollment_required:"enroll"};function iz(e,t,n){var c;const a=t==="hosted"&&!!n.authority,l=((c=n.authority)==null?void 0:c.two_factor)??!0,[r,i]=u.useState("ok"),o=u.useCallback(async()=>{a&&i(e.twoFactor?await e.twoFactor():l?"ok":"challenge")},[e,a,l]);return u.useEffect(()=>{if(!a){i("ok");return}l?i("ok"):o();const d=()=>void o();return window.addEventListener("focus",d),()=>window.removeEventListener("focus",d)},[a,l,o]),{state:r,set_state:i,check:o}}function oz(e,t,n,a,l){const r=Mr(),i=Ik(n),o=iz(e,a,n),c=a==="hosted"?{host:a,two_factor:o.state,settings_href:l}:zo,{confirm:d,confirm_dialog:f}=X3(c),[h,m]=u.useState(null),[x,j]=u.useState({}),v=S=>j(E=>{if(!E[S])return E;const{[S]:C,...$}=E;return $}),y=e.members,g=u.useCallback(async()=>{if(!y)return{ok:!1};const S=await y();return S.ok?{ok:!0,data:S.data}:{ok:!1}},[y]),p=e.change;if(!p||a==="hosted"&&(!n.authority||!az(n)))return null;const b=sz(n),w=S=>{const E=S.code?rz[S.code]:void 0;return E?(o.set_state(E),{kind:"two_factor",message:S.message}):S.code==="revision_conflict"?(t(),{kind:"changed",message:S.message}):S.code==="outside_authority"?(t(),{kind:"authority",message:S.message}):{message:S.message}},N=S=>S.action==="hold"||S.action==="release"?"posts":"kind"in S?S.kind==="team"?"teams":S.kind==="post"?"posts":S.kind==="slot"?"slots":"functions":null,R=(S,E)=>{const C=S==null?void 0:S.warning;C?r.error(C):r.success(E),t()},_=async(S,E)=>{const C=await p(S);if(!C.ok)return w(C.refusal);const $=N(S);return $&&v($),R(C.data,E),null},k=S=>{o.check(),m(S)},L=async(S,E,C,$)=>{const F=await p(C);if(!F.ok){const T=w(F.refusal),P=F.refusal.bound,ne=P?P.projects.length+P.more:0,le=P?`${P.kind==="slot"?"Slot":"Post"} ${E} is still needed by the ${ne===1?"override of 1 project that binds":`overrides of ${ne} projects that bind`} it. Clear ${ne===1?"it":"them"} on each project's Settings first.`:T.message;j(ge=>({...ge,[S]:{label:E,message:le,...P?{bound:P}:{}}}));return}v(S),R(F.data,$)},z=async(S,E,C)=>{const $=S==="team"?"team":"job function";o.check(),await d({title:`Remove ${$} ${C}?`,description:lz[a],action_label:"Remove",destructive:!0,action:`remove the ${$}`})&&await L(S==="team"?"teams":"functions",C,{action:"remove",kind:S,key:E},`${S==="team"?"Team":"Job function"} ${C} removed.`)},X=async S=>{const E=S.label||S.key;o.check(),await d({title:`Remove slot ${E}?`,description:"Projects stop showing it. This can't be undone.",action_label:"Remove slot",destructive:!0,action:"remove the slot"})&&await L("slots",E,{action:"remove",kind:"slot",key:S.key},`Removed slot ${E}.`)},V=async S=>{const E=i.post(S);o.check(),await d({title:`Remove post ${E}?`,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 L("posts",E,{action:"remove",kind:"post",key:S},`Removed post ${E}.`)},U=async(S,E)=>{const C=i.post(S),$=i.member(E),F=n.posts.find(ge=>ge.post===S),P=((F==null?void 0:F.holders.length)??0)<=1?F!=null&&F.escalates_to?` The post becomes vacant. Until someone holds it, its reports and the slots it fills go to ${i.manager(F.escalates_to)}.`:" The post becomes vacant.":"";if(o.check(),!await d({title:`Remove ${$} from ${C}?`,description:`They stop holding this post and no longer report through it.${P}`,action_label:"Remove",action:"remove the holder"}))return;const le=await p({action:"release",post:S,member:E.id});if(!le.ok){r.error(w(le.refusal).message),t();return}v("posts"),R(le.data,`Removed ${$} from ${C}.`)},M=()=>m(null),A=(h==null?void 0:h.kind)==="override"&&n.project&&n.project.team!==null?n.project.slots.find(S=>S.slot===h.slot)??null:null;return{actions:{can:b,host:a,team:(S,E="full")=>k({kind:"team",team:S,scope:E}),job:S=>k({kind:"function",job:S}),override:S=>k({kind:"override",slot:S}),slot:S=>k({kind:"slot",slot:S}),slot_remove:S=>void X(S),remove:(S,E,C)=>void z(S,E,C),post_add:()=>k({kind:"post"}),post_remove:S=>void V(S),holder_add:S=>k({kind:"holder",post:S}),holder_remove:(S,E)=>void U(S,E),refused:S=>{const E=x[S];return E?s.jsx(Q3,{label:E.label,message:E.message,bound:E.bound,on_dismiss:()=>v(S)}):null}},dialogs:s.jsxs(s.Fragment,{children:[s.jsx(B3,{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:n.authority?n.authority.teams:void 0,save:_,on_close:M,context:c}),s.jsx(I3,{open:(h==null?void 0:h.kind)==="function",chart:n,job:(h==null?void 0:h.kind)==="function"?h.job:null,save:_,on_close:M,context:c}),s.jsx(V3,{open:A!==null,chart:n,binding:A,names:i,save:_,confirm:S=>d({...S,action:"clear the override"}),on_close:M}),s.jsx(G3,{open:(h==null?void 0:h.kind)==="slot",chart:n,slot:(h==null?void 0:h.kind)==="slot"?h.slot:null,save:_,on_close:M,context:c}),s.jsx(F3,{open:(h==null?void 0:h.kind)==="post",chart:n,names:i,save:_,on_close:M,context:c}),s.jsx(K3,{open:(h==null?void 0:h.kind)==="holder",chart:n,post:(h==null?void 0:h.kind)==="holder"?h.post:null,names:i,members:g,save:_,on_close:M,context:c}),f]})}}function cz({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(xt,{className:n===3?"h-10 w-2/3":"h-10 w-full"},n))})}function ir({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 uz({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(pe,{variant:"info",className:"mt-6",children:[s.jsx(Ua,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"This repository has no local org yet"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),t||!e?s.jsxs("div",{className:"mt-2 grid w-full gap-2",children:[t?s.jsx(ir,{children:"sdlc org seed"}):null,e?null:s.jsx(ir,{children:"sdlc org add team <key>"})]}):null,e?s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>e.team(null),children:[s.jsx(br,{className:"size-4","aria-hidden":"true"}),"Add team"]}):null]})]})}function dz({org:e}){const{href:t,Link:n}=Fe();return s.jsx(Ba,{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 fz(e){return new Date(e).toDateString()===new Date().toDateString()?`today at ${es(e)}`:`on ${Mn(e)} at ${es(e)}`}function hz({host:e,kept_at:t,on_retry:n}){const a=t?`The chart read ${fz(t)} is kept below. `:"";return s.jsxs(pe,{variant:"destructive",className:"mt-6",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:e==="hosted"?"Could not read the org chart":"Could not read the local org"}),s.jsxs(xe,{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(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function Ik(e){return u.useMemo(()=>{const t=new Map(e.teams.map(y=>[y.key,y.label||y.key])),n=new Map(e.job_functions.map(y=>[y.key,y.label||y.key])),a=new Map(e.slots.map(y=>[y.key,y.label||y.key])),l=new Map(e.posts.map(y=>[y.post,y.holders])),r=y=>y.label||y.id,i=new Map;for(const y of[...e.members,...e.posts.flatMap(g=>g.holders)]){const g=r(y);i.set(g,(i.get(g)??new Set).add(`${y.kind}:${y.id}`))}const o=y=>{var g;return(((g=i.get(r(y)))==null?void 0:g.size)??0)>1},c=y=>{const g=o(y)?y.detail??y.id:null;return g&&g!==r(y)?g:null},d=y=>{const g=c(y);return g&&g!==r(y)?`${r(y)} (${g})`:r(y)},f=y=>{const[g="",p=""]=y.split("/");return{team:t.get(g)??g,job:n.get(p)??p}},h=y=>{const{team:g,job:p}=f(y);return`${p} · ${g}`},m=y=>{if(y==="top")return"Top of the org";if(typeof y!="string")return`A vacant ${n.get(y.vacant)??y.vacant}`;const g=(l.get(y)??[]).map(d);return g.length?`${h(y)} (${g.join(", ")})`:h(y)},x=new Map(e.teams.map(y=>[y.key,y.parent])),j=y=>{let g=0;for(let p=x.get(y);p&&g<e.teams.length;p=x.get(p))g+=1;return g};return{parts:f,post:h,member:d,memberLabel:r,memberDetail:c,manager:m,byPost:(y,g)=>{const[p="",b=""]=[y.split("/")[0],g.split("/")[0]],[w,N]=[f(y),f(g)];return j(p)-j(b)||w.team.localeCompare(N.team)||w.job.localeCompare(N.job)},slot:y=>a.get(y)??y,job:y=>n.get(y)??y,team:y=>t.get(y)??y}},[e])}function Qa({id:e,title:t,description:n,actions:a,children:l,anchor:r}){const i=u.useRef(null);return u.useEffect(()=>{var o,c;!r||typeof window>"u"||window.location.hash!==`#${r}`||((o=i.current)==null||o.scrollIntoView({block:"start"}),(c=i.current)==null||c.focus({preventScroll:!0}))},[r]),s.jsxs("section",{id:r,"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:r?-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:l})]})}function hi({children:e,on_click:t}){return s.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:t,children:[s.jsx(br,{className:"size-4","aria-hidden":"true"}),e]})}const Pv={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 mz({chart:e,host:t,edit:n}){const a=Ik(e),l=e.members.some(r=>r.kind==="agent");return s.jsxs(s.Fragment,{children:[s.jsxs(Qa,{id:"org-chart-lines",title:"Reporting lines",description:"Each post reports to the post of its parent job function in the same team, or else in the nearest team above it that has one.",actions:n!=null&&n.can.post_add?s.jsx(hi,{on_click:n.post_add,children:"Add post"}):void 0,children:[n==null?void 0:n.refused("posts"),s.jsx(gz,{chart:e,names:a,agents:l,host:t,edit:n})]}),s.jsx(Qa,{id:"org-chart-members",title:"Members",description:l?`${Pv[t]} Each agent answers to the nearest person in its reporting chain.`:Pv[t],children:s.jsx(wz,{chart:e,names:a,host:t,agents:l})}),n?s.jsxs(Qa,{id:"org-chart-teams",title:"Teams",description:"Each team under its parent. A post is one of its job functions staffed in it.",actions:n.can.team_add?s.jsx(hi,{on_click:()=>n.team(null),children:"Add team"}):void 0,children:[n.refused("teams"),s.jsx(pz,{chart:e,edit:n})]}):null,s.jsxs("div",{className:"grid items-start gap-x-6 xl:grid-cols-2",children:[s.jsxs(Qa,{id:"org-chart-functions",title:"Function tree",description:"Each job function under its parent, with the slots it fills.",actions:n!=null&&n.can.functions?s.jsx(hi,{on_click:()=>n.job(null),children:"Add job function"}):void 0,children:[n!=null&&n.can.functions?n.refused("functions"):null,s.jsx(_z,{chart:e,names:a,edit:n!=null&&n.can.functions?n:null})]}),s.jsxs(Qa,{id:"org-chart-slots",anchor:"slots",title:"Slots",description:W3,actions:n!=null&&n.can.slots&&e.slot_resolution.length>0?s.jsx(hi,{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(kz,{chart:e,names:a,host:t,edit:n!=null&&n.can.slots?n:null})]})]}),e.project?s.jsx(Cz,{project:e.project,chart:e,names:a,edit:n!=null&&n.can.override?n:null}):null]})}function pz({chart:e,edit:t}){var c;const n=dx([...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,l=t.host==="hosted",r=(d,f)=>{const h=t.can.team(d.key);return h==="full"?s.jsx(no,{label:f,on_edit:()=>t.team(d),on_remove:()=>t.remove("team",d.key,f)}):h==="root"?s.jsx(no,{label:f,on_edit:()=>t.team(d,"description")}):h==="description"?s.jsx(G,{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(nd,{className:"size-3.5","aria-hidden":"true"})}):null},i=(d,f)=>s.jsx("ul",{role:"list",className:f===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:d.map(({item:h,children:m})=>{const x=h.label||h.key;return s.jsxs("li",{children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-b py-2 pr-4",style:ux(f),"data-testid":"org-chart-team",children:[s.jsx("span",{className:"text-sm font-medium",children:x}),s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[l?null:s.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:h.key}),a===h.key?s.jsx(me,{variant:"neutral",children:"Owns this project"}):null,r(h,x)]})]}),m.length>0?i(m,f+1):null]},h.key)})}),o=l&&e.teams.length===1;return s.jsxs(s.Fragment,{children:[s.jsx(gt,{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 dx(e,t,n){const a=new Set(e.map(t)),l=new Map(e.map(i=>[t(i),{item:i,children:[]}])),r=[];for(const i of e){const o=n(i),c=l.get(t(i));o&&a.has(o)&&o!==t(i)?l.get(o).children.push(c):r.push(c)}return r}const xz={local:"No posts yet.",hosted:"No posts yet. An org admin can add them."};function gz({chart:e,names:t,agents:n,host:a,edit:l}){const r=dx([...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(r.length===0){const c=a==="hosted"&&(l==null?void 0:l.can.functions)&&!l.can.post_add;return s.jsx("p",{className:"text-muted-foreground text-sm",children:l!=null&&l.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.":xz[a]})}const i=new Map(e.members.map(c=>[`${c.kind}:${c.id}`,c])),o=(c,d)=>s.jsx("ul",{role:"list",className:d===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:c.map(({item:f,children:h})=>{const{team:m}=t.parts(f.post),x=typeof f.reports_to=="object"?f.reports_to:null,j=!!(l!=null&&l.can.post(f.post));return s.jsxs("li",{children:[s.jsxs("div",{className:"border-b py-2 pr-4",style:ux(d),"data-testid":"org-chart-post",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(ZC,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"text-sm font-medium",children:t.parts(f.post).job}),s.jsx("span",{className:"text-muted-foreground text-xs",children:x?`${m} · Reports to a vacant ${t.job(x.vacant)}`:m}),j&&l?s.jsx("span",{className:"ml-auto",children:s.jsx(no,{label:t.post(f.post),items:[{label:"Add holder",on_select:()=>l.holder_add(f.post)},{label:"Remove post",on_select:()=>l.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(me,{variant:Eu.vacant.tone,children:Eu.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(v=>s.jsx(bz,{holder:v,post:f.post,member:i.get(`${v.kind}:${v.id}`),names:t,agents:n,host:a,on_remove:j&&l?()=>l.holder_remove(f.post,v):void 0},`${v.kind}:${v.id}`))})]}),h.length>0?o(h,d+1):null]},f.post)})});return s.jsx(gt,{className:"overflow-hidden",children:o(r,0)})}function vz(e){return new Date(e).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function yz(e){if(!e.held_since)return null;const t=vz(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 bz({holder:e,post:t,member:n,names:a,agents:l,host:r,on_remove:i}){const o=e.kind==="person"?yp:xp,c=n==null?void 0:n.posts.find(j=>j.post===t),d=n==null?void 0:n.posts.find(j=>j.primary),f=a.memberDetail(e);let h=null;c!=null&&c.dotted&&d?h=`Dotted line: primary manager is ${a.manager(d.reports_to)}`:e.kind==="agent"&&n&&"accountable_person"in n&&(h=n.accountable_person?`Accountable person ${a.member(n.accountable_person)}`:"No accountable person");const m=r==="hosted"?yz(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(ok,{children:[s.jsx(ck,{asChild:!0,children:s.jsx(G,{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(ad,{className:"size-3.5","aria-hidden":"true"})})}),s.jsxs(tx,{children:["Remove ",x]})]}):null,f?s.jsx("span",{className:"text-muted-foreground text-xs break-all",children:f}):null,l?s.jsx("span",{className:"text-muted-foreground text-xs",children:e.kind==="person"?"Person":"Agent"}):null]}),h?s.jsx("div",{className:"pl-5.5 text-xs",children:h}):null,m?s.jsx("div",{className:"text-muted-foreground pl-5.5 text-xs",children:m}):null]})}const jz=["sdlc org hold <team>/<function> --person <id>","sdlc org hold <team>/<function> --agent <id>"];function wz({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:"}),jz.map(r=>s.jsx(ir,{children:r},r))]});const l=[...e.members].sort((r,i)=>r.kind===i.kind?t.memberLabel(r).localeCompare(t.memberLabel(i))||r.id.localeCompare(i.id):r.kind==="person"?-1:1);return s.jsx(gt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Member"}),s.jsx(Y,{children:"Posts"}),s.jsx(Y,{children:"Primary manager"}),s.jsx(Y,{children:"Dotted lines"}),a?s.jsx(Y,{children:"Accountable person"}):null]})}),s.jsx(He,{children:l.map(r=>{const i=r.posts.find(d=>d.primary),o=r.posts.filter(d=>d.dotted),c=t.memberDetail(r);return s.jsxs(ce,{"data-testid":"org-chart-member",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.memberLabel(r)}),c?s.jsx("div",{className:"text-muted-foreground text-xs",children:c}):null,a?s.jsx("div",{className:"text-muted-foreground text-xs",children:r.kind==="person"?"Person":"Agent"}):null]}),s.jsx(q,{children:r.posts.map(d=>t.post(d.post)).join(", ")}),s.jsx(q,{children:i?t.manager(i.reports_to):"None"}),s.jsx(q,{children:o.length?o.map(d=>t.manager(d.reports_to)).join(", "):"None"}),a?s.jsx(q,{children:r.kind==="person"?"Not an agent":r.accountable_person?t.member(r.accountable_person):"None"}):null]},`${r.kind}:${r.id}`)})})]})})}function _z({chart:e,names:t,edit:n}){const a=dx([...e.job_functions].sort((r,i)=>(r.label||r.key).localeCompare(i.label||i.key)),r=>r.key,r=>r.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 l=(r,i)=>s.jsx("ul",{role:"list",className:i===0?"m-0 -mb-px list-none p-0":"m-0 list-none p-0",children:r.map(({item:o,children:c})=>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:ux(i),"data-testid":"org-chart-function",children:[s.jsx("span",{className:"text-sm font-medium",children:o.label||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(me,{variant:"neutral",children:"Requires a person"}):null,n?s.jsx(no,{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?l(c,i+1):null]},o.key))});return s.jsx(gt,{className:"overflow-hidden",children:l(a,0)})}function Nz(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 Au={covered:0,vacant:1,uncovered:2};function Pk(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 kz({chart:e,names:t,host:n,edit:a}){var i;const l=Pk(e),r=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(gt,{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(hi,{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(gt,{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Slot"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Resolves to"}),a?s.jsx(Y,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(He,{children:[[...e.slot_resolution].sort((o,c)=>Au[o.status]-Au[c.status]||t.slot(o.slot).localeCompare(t.slot(c.slot))).map(o=>{var d,f;const c=Eu[o.status];return s.jsxs(ce,{"data-testid":"org-chart-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.slot(o.slot)}),n==="hosted"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:o.slot}),(d=r.get(o.slot))!=null&&d.description?s.jsx("div",{className:"text-muted-foreground text-xs break-words",children:(f=r.get(o.slot))==null?void 0:f.description}):null]}):null,l.has(o.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.get(o.slot)}):null]}),s.jsx(q,{children:s.jsx(me,{variant:c.tone,children:c.label})}),s.jsxs(q,{children:[Nz(o,t),o.status==="covered"&&o.needs_person?s.jsx("div",{className:"text-muted-foreground text-xs",children:"Needs a person"}):null]}),a&&r.has(o.slot)?s.jsx(q,{className:"text-right",children:s.jsx(no,{label:t.slot(o.slot),on_edit:()=>a.slot(r.get(o.slot)),on_remove:()=>a.slot_remove(r.get(o.slot))})}):null]},o.slot)}),e.slot_resolution.length===0?s.jsx(ce,{children:s.jsx(q,{colSpan:3,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})})}const Sz="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.",Bf=["sdlc org own <team>","sdlc org bind <slot> <team>/<function>... --reason <text>","sdlc org unbind <slot>"];function Cz({project:e,chart:t,names:n,edit:a}){if(e.team===null){const i=e.roots.map(n.team);return s.jsx(Qa,{id:"org-chart-project",title:"This project",description:i.length?`This org has several root teams (${i.join(", ")}), so no team owns this repository's project yet and its slots are not bound. Name the owning team:`:"This org has no team yet, so no team owns this repository's project. Start one:",children:s.jsx("div",{className:"max-w-2xl",children:s.jsx(ir,{children:i.length?Bf[0]:"sdlc org add team <key>"})})})}const l=Pk(t),r=[...e.slots].sort((i,o)=>Au[i.status]-Au[o.status]||n.slot(i.slot).localeCompare(n.slot(o.slot)));return s.jsxs(Qa,{id:"org-chart-project",title:"This project",description:Sz,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(gt,{className:"mt-3 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Slots in this project",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Slot"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Bound to"}),s.jsx(Y,{children:"Source"}),a?s.jsx(Y,{className:"text-right",children:s.jsx("span",{className:"sr-only",children:"Actions"})}):null]})}),s.jsxs(He,{children:[r.map(i=>{const o=Eu[i.status];return s.jsxs(ce,{"data-testid":"org-chart-project-slot",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:n.slot(i.slot)}),l.has(i.slot)?s.jsx("div",{className:"text-muted-foreground text-xs",children:l.get(i.slot)}):null]}),s.jsx(q,{children:s.jsx(me,{variant:o.tone,children:o.label})}),s.jsx(q,{children:s.jsx(Rz,{binding:i,names:n})}),s.jsx(q,{children:s.jsx(Tz,{binding:i})}),a?s.jsx(q,{className:"text-right",children:s.jsx(G,{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(nd,{className:"size-3.5","aria-hidden":"true"})})}):null]},i.slot)}),r.length===0?s.jsx(ce,{children:s.jsx(q,{colSpan:a?5:4,className:"text-muted-foreground h-24 text-center",children:"This org has no slots yet."})}):null]})]})}),a?s.jsxs("div",{className:"mt-3 grid max-w-2xl gap-2",children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Overrides made here are made as ",s.jsx("span",{className:"font-mono",children:"person:user"}),", as sdlc org makes them without --as: that person must hold the lead post of the owning team or of a team above it."]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Change the owning team with sdlc org:"}),s.jsx(ir,{children:Bf[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:"}),Bf.map(i=>s.jsx(ir,{children:i},i))]})]})}function Rz({binding:e,names:t}){const n=[];e.status==="covered"&&e.needs_person&&n.push("Needs a person");for(const l of e.posts)l.off_description&&n.push(`${t.post(l.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(l=>t.post(l.post)).join(", ")} has no holder`:a=e.posts.map(l=>l.holders.length?`${t.post(l.post)}: ${l.holders.map(t.member).join(", ")}`:`${t.post(l.post)}: no holder`).join("; "),s.jsxs(s.Fragment,{children:[a,n.map(l=>s.jsx("div",{className:"text-muted-foreground text-xs",children:l},l))]})}function Tz({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?Mn(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 Ez={breaking:"Breaking",new:"New",improved:"Improved",other:"Other changes"},Az=["breaking","new","improved","other"],Mz={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 qk(e){return Mz[e]??e.replace(/_/g," ")}function Oz(e){return e.bump==="major"?"breaking":e.change==="added"?"new":e.change==="changed"?"improved":"other"}function so(e){const t=new Map;let n=0,a=0;for(const r of e){if(r.modeling_only){a+=1;continue}if(!r.bump){n+=1;continue}const i=Oz(r);t.set(i,[...t.get(i)??[],r])}return{sections:Az.filter(r=>t.has(r)).map(r=>({key:r,label:Ez[r],lines:t.get(r)})),breaking:t.has("breaking"),unlisted_count:n,modeling_only_count:a}}function $z(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 l of a.lines){const r=l.why?`: ${l.why}`:"";n.push(`- ${l.label} (${qk(l.node_type)})${r}`)}}return`${n.join(`
386
+ `)}
387
+ `}const Ms="candidate";function fx(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}const Dz="Versioned records of this project's release branch, with notes from its graph changes.";function Gk({description:e=Dz,actions:t}){return s.jsx(Yt,{title:"Releases",description:e,actions:t})}function Vk(e){var r;if(!e)return"";const t=(r=e.previous_release)==null?void 0:r.version,n=Number(e.version.split("-rc.")[1]??0),a=e.commits_since??n,l=`${e.commits_since===null?"At least ":""}${a} commit${a===1?"":"s"}`;return t?`${l} since ${t}`:`${l} before the first Release`}function zc({active:e,onClick:t,version:n,badges:a,caption:l,item_ref:r}){return s.jsxs("button",{ref:r,type:"button","aria-current":e?"true":void 0,onClick:t,className:ie("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:l})]})}function En({children:e}){return s.jsx("section",{className:"border-border flex flex-col gap-4 rounded-xl border p-4",children:e})}function On({title:e,error:t,onRetry:n}){return s.jsxs(pe,{variant:"destructive",children:[s.jsx(sn,{}),e?s.jsx(be,{children:e}):null,s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[t,n?s.jsx(G,{variant:"outline",size:"sm",onClick:n,children:"Try again"}):null]})]})}function zz({title:e,text:t}){return s.jsx(En,{children:s.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[s.jsx(td,{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 Lz(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 Mu({changes:e}){const t=u.useMemo(()=>so(e),[e]),[n,a]=u.useState(!1),l=t.unlisted_count+t.modeling_only_count;return s.jsxs("div",{className:"flex flex-col gap-4",children:[t.sections.map(r=>{const i=s.jsx("ul",{className:"flex flex-col gap-2",children:r.lines.map(o=>s.jsx(qv,{line:o},`${o.node_id}:${o.change}`))});return r.key==="breaking"?s.jsxs(pe,{variant:"destructive",className:"border-destructive/40",children:[s.jsx(sn,{}),s.jsx(be,{children:s.jsx("h3",{className:"text-destructive text-sm font-semibold",children:r.label})}),s.jsx(xe,{className:"text-foreground",children:i})]},r.key):s.jsxs("div",{className:"flex flex-col gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:r.label}),i]},r.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,l>0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:[l," more change",l===1?"":"s"," do",l===1?"es":""," not affect the version."]}):null,e.length>0?s.jsx(G,{variant:"link",size:"sm",className:"self-start px-0","aria-expanded":n,onClick:()=>a(r=>!r),children:n?"Hide all changes":"Show all changes"}):null,n?s.jsx("ul",{className:"flex flex-col gap-2",children:e.map(r=>s.jsx(qv,{line:r,detail:!0},`all:${r.node_id}:${r.change}:${r.modeling_only}`))}):null]})}function qv({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(me,{variant:"outline",children:qk(e.node_type)})]}),n?s.jsx("span",{className:"text-muted-foreground text-xs",children:n}):null]})}const Yk="Releases of this checkout: the roadmap of open Planned Releases, the next candidate, and each production release with its notes.",Gv=5,mm="Not available",pm="planned:";function Fk(){const e=ns();return s.jsx("p",{className:"text-muted-foreground text-sm",children:`${mm}. ${e}`})}const Zn=e=>`${pm}${e}`,Uz=e=>e!=null&&e.startsWith(pm)?e.slice(pm.length):null,hx=e=>e?e.slice(0,7):"";function Bz(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 Hz(){return s.jsxs(pe,{variant:"info",children:[s.jsx(Ua,{}),s.jsx(be,{children:"This page only reads Releases"}),s.jsx(xe,{className:"text-info",children:"A Release is written when production runs a release candidate, once its commit is merged into origin/main."})]})}function Iz(e){if(e.state==="unreadable")return{badges:s.jsx(me,{variant:"error",children:"Could not be read"}),caption:""};if(e.state==="withdrawn")return{badges:s.jsx(me,{variant:"warning",children:"Withdrawn"}),caption:e.replaced_by?`Replaced by ${e.replaced_by}`:"Withdrawn"};const t=s.jsxs(s.Fragment,{children:[s.jsx(me,{variant:"neutral",children:e.app_changed===!1?"App unchanged":e.previous_release_id?e.bump??"patch":"First"}),e.breaking?s.jsx(me,{variant:"error",children:"Breaking"}):null]}),n=e.written_at?fx(e.written_at):"",a=e.tracks&&e.tracks.length>0?` · ${e.tracks.join(", ")}`:"";return{badges:t,caption:`${n}${a}`}}function al({query:e,select:t,onSelect:n,children:a,inline:l=!1}){return s.jsx("a",{href:`?${e}`,className:l?"text-primary underline":"text-primary hover:underline",onClick:r=>{r.preventDefault(),n(t)},children:a})}function Td({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 Kk(e,t){if(e.judged_commit&&t&&e.judged_commit!==t)return`Judged ${hx(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 Ed({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 Pz={ready:"success",verifying:"info",fixing:"warning",abandoned:"warning",ready_older:"neutral",none:"neutral",unknown:"neutral"};function qz({batch:e}){if(e.state==="loading")return s.jsxs(pe,{children:[s.jsx(xu,{}),s.jsxs(xe,{className:"flex flex-row items-center gap-2",role:"status",children:[s.jsx(bn,{"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(pe,{children:[s.jsx(xu,{}),s.jsxs(be,{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{children:t.text}),s.jsx(me,{variant:Pz[t.state],children:t.chip})]}),t.help?s.jsx(xe,{children:t.help}):null]})}function Gz(e,t,n){return`/org/${e}/issues/${encodeURIComponent(t)}?from=${encodeURIComponent(n)}`}function Xk({issues:e,error:t}){return t?s.jsx(On,{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(Ed,{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 Qk({tracks:e,error:t}){return t?s.jsx(On,{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(Ed,{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(me,{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((l,r)=>s.jsxs("span",{className:"text-muted-foreground text-xs",children:[l.feature,": ",l.entry]},r))]},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 Zk({delivery:e,candidate:t,onSelect:n}){if(!e||e.planned.length===0&&e.outside===0)return null;const a=l=>l.length===0?"—":l.map(r=>r.went?`${r.label} (${r.went})`:r.label).join(", ");return s.jsxs("section",{className:"flex flex-col gap-2",children:[s.jsx(Ed,{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(Be,{containerAriaLabel:"Planned Releases",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Planned Release"}),s.jsx(Y,{children:"Delivered"}),s.jsx(Y,{children:"Not delivered"})]})}),s.jsx(He,{children:e.planned.map(l=>s.jsxs(ce,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.open&&t?s.jsx(al,{query:`planned=${encodeURIComponent(l.id)}`,select:Zn(l.id),onSelect:n,children:l.name}):s.jsx("span",{children:l.name}),s.jsx(ys,{children:l.id})]})}),s.jsx(q,{children:a(l.delivered)}),s.jsx(q,{children:a(l.not_delivered)})]},l.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 Vz={thread:"Thread",task:"Task",issue:"Issue",test:"Test"};function Wk({rows:e,org:t,from:n,untasked:a}){const{href:l,Link:r}=Fe(),[i,o]=u.useState(!1),c=i?e:e.slice(0,Gv),d=f=>f.kind==="task"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(`/org/${t}/tasks/${encodeURIComponent(f.id)}?from=${encodeURIComponent(n)}`),children:f.id}):f.kind==="issue"?s.jsx(r,{className:"text-primary font-mono text-xs hover:underline",href:l(Gz(t,f.id,n)),children:f.id}):f.kind==="thread"?s.jsx(r,{className:"text-primary hover:underline",href:l(`${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(Be,{containerAriaLabel:"Related",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Kind"}),s.jsx(Y,{children:"Item"}),s.jsx(Y,{children:"How it relates"})]})}),s.jsx(He,{children:c.map(f=>s.jsxs(ce,{children:[s.jsx(q,{children:Vz[f.kind]}),s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d(f),f.state&&f.kind!=="thread"?s.jsx("span",{className:"text-muted-foreground text-xs",children:f.state}):null]})}),s.jsx(q,{children:f.relation})]},`${f.kind}:${f.id}`))})]})}),e.length>Gv?s.jsx(G,{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 Jk=e=>(e==null?void 0:e.status)===409&&e.reason==="view_outdated";function e1(e){const t=mx(),[n,a]=u.useState(t!=null&&t.related?{state:"loading"}:null),l=u.useRef(0),r=u.useCallback(async(i=!1)=>{if(!(t!=null&&t.related))return;const o=++l.current;a({state:"loading"});const c=await t.related(e,i?{fresh:!0}:void 0);o===l.current&&a(c.ok?{state:"ready",value:c.data}:{state:"error",error:c.refusal.message,refusal:c.refusal})},[t,e]);return u.useEffect(()=>{r()},[r]),{related:n,read:r}}function t1({related:e,org:t,from:n,onRetry:a}){const l=u.useRef(null),r=u.useRef(!1);if(u.useEffect(()=>{var o;r.current&&(e==null?void 0:e.state)!=="loading"&&(r.current=!1,(o=l.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:l,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(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-full"}),s.jsx(xt,{className:"h-8 w-2/3"})]}):e.state==="error"?Jk(e.refusal)?s.jsx(Fk,{}):s.jsx(On,{title:"Related work could not be read",error:e.error,onRetry:()=>{r.current=!0,a()}}):e.value.rows.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(Wk,{rows:e.value.rows,org:t,from:n,untasked:e.value.untasked})]})}function Yz(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 n1({planned:e,onSelect:t}){return e?e.open?s.jsx(al,{query:`planned=${encodeURIComponent(e.id)}`,select:Zn(e.id),onSelect:t,children:e.name}):s.jsxs("span",{children:[e.name," ",s.jsx(ys,{children:e.id})]}):null}function Fz({candidate:e,org:t,onSelect:n,notes:a}){const l=mx(),{related:r,read:i}=e1("candidate"),[o,c]=u.useState(l!=null&&l.candidateBatch?{state:"loading"}:null);u.useEffect(()=>{if(!(l!=null&&l.candidateBatch))return;let f=!0;return l.candidateBatch().then(h=>{f&&(h.ok?c(h.data.batch===null?null:{state:"ready",value:h.data.batch}):c({state:"error",error:h.refusal.message}))}),()=>{f=!1}},[l]);const d=e.readiness??((r==null?void 0:r.state)==="ready"?r.value.readiness:null)??null;return s.jsxs(s.Fragment,{children:[s.jsx(Td,{pairs:[["Environment",e.environment??"staging"],["Commit",s.jsx(ys,{children:hx(e.head_commit_id)},"commit")],["Readiness",d?Kk(d,e.head_commit_id):null],["Planned",e.planned_release?s.jsx(n1,{planned:e.planned_release,onSelect:n}):null]]}),o?s.jsx(qz,{batch:o}):null,a,s.jsx(Xk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Qk,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Zk,{delivery:e.planned_delivery,candidate:!0,onSelect:n}),s.jsx(t1,{related:r,org:t,from:"release:candidate",onRetry:()=>i(!0)})]})}function Kz({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(me,{variant:"warning",children:"Withdrawn"}):s.jsx(me,{variant:"neutral",children:e.app_changed===!1?"App unchanged":a?"First":e.bump}),e.breaking?s.jsx(me,{variant:"error",children:"Breaking"}):null]}),e.state==="withdrawn"&&e.replaced_by?s.jsxs("p",{className:"text-sm",children:["Replaced by"," ",s.jsx(al,{query:`release=${encodeURIComponent(e.replaced_by)}`,select:e.replaced_by,onSelect:t,inline:!0,children:e.replaced_by})]}):null]})}function Xz({release:e,org:t,onSelect:n,notes:a}){const l=e.label??e.version,{related:r,read:i}=e1(l),o=(r==null?void 0:r.state)==="ready"?Yz(r.value.previews):null;return s.jsxs(s.Fragment,{children:[s.jsx(Td,{pairs:[["Environment",e.environment??"production"],["Commit",e.commit?s.jsx(ys,{children:hx(e.commit)},"commit"):null],["Readiness",e.readiness?`${Kk(e.readiness)} on staging`:null],["Previews",o],["Planned",e.planned_release?s.jsx(n1,{planned:e.planned_release,onSelect:n}):null]]}),a,s.jsx(Xk,{issues:e.known_issues,error:e.known_issues_error}),s.jsx(Qk,{tracks:e.tracks,error:e.tracks_error}),s.jsx(Zk,{delivery:e.planned_delivery,candidate:!1,onSelect:n}),s.jsx(t1,{related:r,org:t,from:`release:${l}`,onRetry:()=>i(!0)})]})}function Qz({id:e,summary:t,org:n,onNotFound:a,forecast:l}){var x,j;const r=mx(),[i,o]=u.useState({state:"loading"}),c=u.useRef(0),d=u.useCallback(async(v=!1)=>{const y=++c.current;if(!(r!=null&&r.plannedRelease)){o({state:"error",error:mm,refusal:{status:409,message:mm,reason:"view_outdated"}});return}o({state:"loading"});const g=await r.plannedRelease(e,v?{fresh:!0}:void 0);y===c.current&&o(g.ok?{state:"ready",value:g.data}:{state:"error",error:g.refusal.message,refusal:g.refusal})},[r,e]);u.useEffect(()=>{d()},[d]);const f=i.state==="error"&&(((x=i.refusal)==null?void 0:x.status)===404||((j=i.refusal)==null?void 0:j.reason)==="not_found");if(u.useEffect(()=>{f&&a()},[f,a]),i.state==="loading")return s.jsxs(En,{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(me,{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(En,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:(t==null?void 0:t.name)??e}),Jk(i.refusal)?s.jsx(Fk,{}):f?null:s.jsx(On,{error:i.error,onRetry:()=>void d(!0)})]});const h=i.value,m=h.order===null?null:h.order===1?`Next of ${h.open} open`:`${h.order} of ${h.open} open`;return s.jsxs(En,{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(me,{variant:"neutral",children:"Planned"})]}),h.goal?s.jsx("p",{className:"text-muted-foreground text-sm",children:h.goal}):null]}),s.jsx(Td,{pairs:[["Planned Release",s.jsx(ys,{children:h.id},"id")],["Date",h.date],["Order",m],["Members",String(h.members.length)]]}),l,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(Ed,{title:"Members",count:h.members.length}),h.members.length>0?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Members",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Member"}),s.jsx(Y,{children:"Level"}),s.jsx(Y,{children:"Tasks"}),s.jsx(Y,{children:"State"})]})}),s.jsx(He,{children:h.members.map(v=>{const y=v.tasks.filter(p=>p.state==="done").length,g=v.tasks.filter(p=>p.state!=="done").map(p=>p.id);return s.jsxs(ce,{children:[s.jsx(q,{children:v.label}),s.jsx(q,{children:v.level?s.jsx(me,{variant:"neutral",children:Zz(v.level)}):null}),s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[v.tasks.length>0?s.jsxs("span",{children:[y," of ",v.tasks.length," done"]}):null,g.length>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Open: ",s.jsx(ys,{children:g.join(", ")})]}):null,v.untracked>0?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[v.untracked," slice",v.untracked===1?" has":"s have"," no task yet"]}):null]})}),s.jsx(q,{children:v.state})]},v.item)})})]})}):null]}),s.jsxs("section",{className:"flex flex-col gap-2","aria-labelledby":"planned-related",children:[s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("h2",{id:"planned-related",className:"text-lg font-semibold",children:"Related"}),s.jsx("span",{className:"text-muted-foreground text-xs",children:h.related.length})]}),h.related.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing related yet."}):s.jsx(Wk,{rows:h.related,org:n,from:`planned:${h.id}`})]})]})}const Zz=e=>e.charAt(0).toUpperCase()+e.slice(1);function mx(){return ln().releases}const Yn={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"},Vv=3,Wz=["in_progress","not_started","planned","blocked"],px="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),jt=e=>e.charAt(0).toUpperCase()+e.slice(1);function Hf(e){const t=/^(\d{4})-(\d{2})-(\d{2})/.exec(String(e??""));return t?`${Number(t[3])} ${px[Number(t[2])-1]}`:String(e??"")}function s1(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${px[t.getMonth()]} ${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`}function Jz(e){if(typeof e!="number")return"";const t=new Date(e*1e3);return Number.isNaN(t.getTime())?"":`${t.getDate()} ${px[t.getMonth()]}`}function Os(e){return e?e.from===e.to&&e.or_later?`${Hf(e.from)} or later`:`${Hf(e.from)} to ${Hf(e.to)}${e.or_later?", or later":""}`:""}function eL(e){if(!e||!e.members)return"";const t=[`${e.sized??0} of ${e.members} members sized (${e.estimated??0} estimated, ${e.predicted??0} predicted)`];return e.not_sized&&t.push(`${e.not_sized} not sized`),t.join(" · ")}function a1(e){var h;const t=e??{},n=t.source??{},l=[t.no_date==="no date: no rate"&&n.rate_why?n.rate_why:"",/members estimated$/.test(t.no_date??"")?"":eL(t)].filter(Boolean).join(" · "),r=t.projected?Os(t.projected):t.no_date??"",i=(h=t.projected)==null?void 0:h.raw,o=!!(i&&t.projected&&(i.from!==t.projected.from||i.to!==t.projected.to)),c=t.projected?n.rate_basis==="release"?"at this release's own rate":n.rate_basis==="machine"?`at the machine's rate${n.rate_why?`: ${n.rate_why}`:""}`:"":"",d=t.track_record,f=[l,c,o&&i&&t.projected?`corrected for past estimates: raw ${Os({...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:r?jt(r):"",caption:f}}function tL(e){const t=e.kinds??[];return[t.includes("range")?"Not promised":"",e.goal??(t.includes("major")?"No goal yet":"")].filter(Boolean).join(" · ")}function nL(e){var c,d,f,h;const t=((c=e.counts)==null?void 0:c.members)??0,n=`${((d=e.counts)==null?void 0:d.done)??0} of ${t} member${t===1?"":"s"} done`,a=(e.blocked??[]).length,l=(e.needs_user??[]).length,r=!a&&!l?["none blocked · none waiting on you"]:[a?`${a} blocked`:"",l?`${l} waiting on you`:""],i=((f=e.tasks)==null?void 0:f.untracked_slices)??0;i&&r.push(`${i} slice${i===1?"":"s"} not tasks yet`);const o=((h=e.not_a_member)==null?void 0:h.count)??0;return o&&r.push(`${o} not a member yet`),{lead:n,rest:r.filter(Boolean).join(" · ")}}const l1=e=>String(e??"").replace(/_/g," ");function sL(e){const t=e??{},n=t.kinds??[],a=n.includes("slipped"),l=!a&&t.was&&t.now?Os(t.was)===Os(t.now)?`, range still ${Os(t.now)}`:`, range was ${Os(t.was)}, now ${Os(t.now)}`:"",r=[a&&t.was?`was ${Os(t.was)}`:"",n.includes("scope changed")?`scope changed${l}`:""].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:r.length?jt(r.join(" · ")):"",what:i}}const or="roadmap",Yv={reading:!1,value:null,refusal:null};function aL(e){const[t,n]=u.useState({all:Yv,mine:Yv}),a=u.useRef({all:0,mine:0}),l=u.useCallback(async(r,i=!1)=>{if(!(e!=null&&e.roadmap))return;const o=++a.current[r];n(d=>({...d,[r]:{...d[r],reading:!0}}));const c=await e.roadmap({...i?{fresh:!0}:{},...r==="mine"?{mine:!0}:{}});o===a.current[r]&&n(d=>({...d,[r]:c.ok?{reading:!1,value:c.data,refusal:null}:{reading:!1,value:d[r].value,refusal:c.refusal}}))},[e]);return{reads:t,read:l,available:!!(e!=null&&e.roadmap)}}function lL(e,t){return`${e} open${t.length?` · ${t.join(", ")} moved since you looked`:""}`}function Oi({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 r1=({level:e})=>e?s.jsx(me,{variant:"neutral",children:jt(e)}):null;function i1({state:e}){const t=jt(l1(e));return Wz.includes(String(e))?s.jsx("span",{className:"font-medium",children:t}):s.jsx("span",{children:t})}function rL({reads:e,scope:t,onScope:n,onRead:a,org:l,onSelect:r}){var x,j;const i=e[t],o=i.value,c=ns(),d=u.useRef(null),f=u.useRef(!1);u.useEffect(()=>{!i.reading&&!i.value&&!i.refusal&&a(t)},[t,i.reading,i.value,i.refusal,a]),u.useEffect(()=>{var v;f.current&&!i.reading&&(f.current=!1,(v=d.current)==null||v.focus())},[i.reading]);const h=()=>{f.current=!0,a(t,!0)},m=o?[o.as_of?`as of ${s1(o.as_of)}`:"",`${((x=o.source)==null?void 0:x.machine)||"this machine"}'s records`,((j=o.decider)==null?void 0:j.words)??""].filter(Boolean).join(" · "):"";return s.jsxs(En,{children:[s.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[s.jsx("h2",{ref:d,tabIndex:-1,className:"text-lg font-semibold outline-none",children:"Roadmap"}),m?s.jsx("p",{className:"text-muted-foreground text-xs",children:m}):null]}),s.jsx("div",{role:"group","aria-label":"Roadmap scope",className:"flex gap-2",children:["all","mine"].map(v=>s.jsx(G,{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(bn,{"aria-hidden":!0,className:"size-4"})," ",jt(Yn.pending),"…"]}):null}),i.refusal&&!i.reading?i.refusal.reason==="no_roadmap"?s.jsx(On,{title:Yn.failedLead,error:`${jt(Yn.noEngineLead)}. ${c}`}):i.refusal.reason==="refused"?s.jsx(On,{title:Yn.failedLead,error:i.refusal.message}):s.jsx(On,{title:Yn.failedLead,error:i.refusal.message,onRetry:h}):null,o?t==="mine"?s.jsx(hL,{mine:o.mine,org:l,onSelect:r}):s.jsx(oL,{read:o,org:l,onSelect:r}):null]})}function iL(e){if(!e||typeof e.seconds_per_day!="number")return"No rate";const t=Jz(e.as_of);return`${Math.round(e.seconds_per_day/3600)} task hours a day over the ${e.days} days${t?` to ${t}`:""}`}function oL({read:e,org:t,onSelect:n}){var l,r;const a=e.releases??[];if(!a.length){const[i,o]=Yn.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(Oi,{children:o})]})}return s.jsxs(s.Fragment,{children:[s.jsx(Td,{pairs:[["Forecast from",jt(`${((l=e.source)==null?void 0:l.machine)||"this machine"}'s task records and rate`)],["Rate",iL(e.rate)],["Not counted",jt(((r=e.source)==null?void 0:r.not_counted)||"other machines' work")]]}),a.map(i=>s.jsx(cL,{row:i,org:t,onSelect:n},i.id))]})}function cL({row:e,org:t,onSelect:n}){var h,m,x;const a=a1(e.forecast),l=nL(e),r=tL(e),i=`roadmap-${e.id}`,o=e.moved?sL(e.told):null,c=(((h=e.counts)==null?void 0:h.members)??0)===0,d=((m=e.not_a_member)==null?void 0:m.count)??0,f=[r,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(al,{query:`planned=${encodeURIComponent(e.id)}`,select:Zn(e.id),onSelect:n,children:e.name})}),e.kinds.map(j=>s.jsx(me,{variant:"neutral",children:j},j))]}),a.lead||a.caption.length?s.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.lead?s.jsx("p",{className:"text-sm",children:a.lead}):null,a.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:jt(a.caption.join(" · "))}):null]}):null,f?s.jsx("p",{className:"text-muted-foreground text-sm",children:f}):null,o?s.jsxs(pe,{variant:"info",children:[s.jsx(SR,{"aria-hidden":!0}),s.jsx(be,{children:"Moved since you looked"}),s.jsxs(xe,{className:"text-info flex flex-col gap-0.5",children:[o.head?s.jsx("span",{children:o.head}):null,o.what.map((j,v)=>s.jsx("span",{className:"text-xs",children:j},v))]})]}):null,c?null:s.jsxs("p",{className:"text-sm",children:[l.lead,l.rest?s.jsxs("span",{className:"text-muted-foreground",children:[" · ",l.rest]}):null]}),(x=e.stale_unchecked)!=null&&x.words?s.jsx("p",{className:"text-muted-foreground text-xs",children:jt(e.stale_unchecked.words)}):null,e.for_you&&e.kinds.includes("major")?s.jsx(uL,{row:e}):null,s.jsx(fL,{row:e,org:t})]})}function uL({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 l=[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:[l?`${jt(l).replace(/\.$/,"")}. `:"","Accept or reject in the terminal:"]}),s.jsx(Oi,{children:a.accept}),s.jsx(Oi,{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(Oi,{children:t.set_goal})]}):null]})}function o1({next:e,org:t}){const{href:n,Link:a}=Fe(),l=e.tasks[0],r=e.label||e.item;return l?s.jsx(a,{className:"text-primary hover:underline",href:n(`/org/${t}/tasks/${encodeURIComponent(l.id)}?from=roadmap`),children:r}):s.jsx("span",{children:r})}function dL(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?jt(e.nobody):""}function fL({row:e,org:t}){const[n,a]=u.useState(!1),l=e.next??[];if(!l.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 r=n?l:l.slice(0,Vv),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(Be,{containerAriaLabel:`Next in ${e.name}`,children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Member"}),s.jsx(Y,{children:"Level"}),s.jsx(Y,{children:"State"}),s.jsx(Y,{children:"Who is on it"})]})}),s.jsx(He,{children:r.map(o=>{const c=i.get(o.item);return s.jsxs(ce,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(o1,{next:o,org:t}),c?s.jsxs("span",{className:"text-muted-foreground text-xs",children:[jt(c.words),c.estimate_as_of?` (estimated ${s1(c.estimate_as_of)})`:""]}):null]})}),s.jsx(q,{children:s.jsx(r1,{level:o.level})}),s.jsx(q,{children:s.jsx(i1,{state:o.state})}),s.jsx(q,{children:dL(o,e)})]},o.item)})})]})}),l.length>Vv&&!n?s.jsxs(G,{variant:"outline",size:"sm",className:"self-start",onClick:()=>a(!0),children:["Show all ",l.length]}):null,r.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 hL({mine:e,org:t,onSelect:n}){const{href:a,Link:l}=Fe();if(!e)return null;const r=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:jt(Yn.noTask)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your work",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Task"}),s.jsx(Y,{children:"Release"}),s.jsx(Y,{children:"Member"})]})}),s.jsx(He,{children:e.tasks.map(i=>{var o,c;return s.jsxs(ce,{children:[s.jsx(q,{children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(l,{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,jt(l1(i.state))].filter(Boolean).join(" · ")})]})}),s.jsx(q,{children:(o=i.members)!=null&&o.length?i.members.map(d=>s.jsx("div",{children:s.jsx(al,{query:`planned=${encodeURIComponent(d.planned_release)}`,select:Zn(d.planned_release),onSelect:n,children:d.name})},d.planned_release)):i.release?s.jsx(al,{query:`planned=${encodeURIComponent(i.release.planned_release)}`,select:Zn(i.release.planned_release),onSelect:n,children:i.release.name}):s.jsx("span",{className:"text-muted-foreground",children:i.words?jt(i.words):"—"})}),s.jsx(q,{children:(c=i.members)!=null&&c.length?i.members.map(d=>s.jsx(r1,{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)})})]})}),r.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(Oi,{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:jt(Yn.noNext)}):s.jsx("div",{className:"overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Your next members",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Release"}),s.jsx(Y,{children:"Member"}),s.jsx(Y,{children:"State"})]})}),s.jsx(He,{children:e.next.map(i=>s.jsxs(ce,{children:[s.jsx(q,{children:s.jsx(al,{query:`planned=${encodeURIComponent(i.release)}`,select:Zn(i.release),onSelect:n,children:i.name})}),s.jsx(q,{children:s.jsx(o1,{next:i,org:t})}),s.jsx(q,{children:s.jsx(i1,{state:i.state})})]},`${i.release}:${i.item}`))})]})})]})]})}function mL({state:e,id:t}){var r;const n=ns();if(!e)return null;const a=(r=e.value)==null?void 0:r.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(bn,{"aria-hidden":!0,className:"size-4"})," ",jt(Yn.pending),"…"]});if(e.refusal){const i=e.refusal.reason==="no_roadmap"?`${jt(Yn.noEngineLead)}. ${n}`:e.refusal.message;return s.jsx("p",{className:"text-muted-foreground text-xs",children:`${Yn.failedLead}: ${i}`})}return null}const l=a1(a.forecast);return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[l.lead?s.jsx("p",{className:"text-sm",children:l.lead}):null,l.caption.length?s.jsx("p",{className:"text-muted-foreground text-xs",children:jt(l.caption.join(" · "))}):null]})}function c1(){const e=ln().releases;if(!e)throw new Error("The Releases page rendered without a Releases contract.");return e}function pL({initial:e,environments:t,branch_options:n,chooseBranch:a,renderWrite:l,selection:r,org:i,onReadAgain:o,onNotFound:c,notice:d,focusOnMount:f}){var rs,wn,is,ot,Zs,Ws,Js,ea,D,ye;const h=c1(),m=e.local??null,[x,j]=u.useState(e),[v,y]=u.useState(null),g=r?r.selected:v,p=r?r.onSelect:y,b=!!(m||x.release_branch),[w,N]=u.useState(m||e.release_branch?{state:"loading"}:{state:"ready",value:null}),[R,_]=u.useState({}),[k,L]=u.useState(null),[z,X]=u.useState(!1),[V,U]=u.useState(null),[M,A]=u.useState(null),S=u.useRef(null),E=m?{fresh:!0}:void 0,C=u.useCallback(async te=>{const we=await h.candidate(te);N(we.ok?{state:"ready",value:we.data.candidate}:{state:"error",error:we.refusal.message,refusal:we.refusal})},[h]),$=u.useCallback(async()=>{N({state:"loading"}),await C(E)},[C,m]),F=u.useCallback(async()=>{const te=await h.list();te.ok&&j(te.data)},[h]),T=((rs=x.release_branch)==null?void 0:rs.id)??null;u.useEffect(()=>{if(!m&&!T)return;let te=!1;return h.candidate().then(we=>{te||N(we.ok?{state:"ready",value:we.data.candidate}:{state:"error",error:we.refusal.message,refusal:we.refusal})}),()=>{te=!0}},[T,h,m]);const P=u.useRef(new Set),ne=u.useCallback((te,we)=>_(Xt=>({...Xt,[te]:we.ok?{state:"ready",value:we.data.release}:{state:"error",error:we.refusal.message,refusal:we.refusal}})),[]),le=async te=>{_(we=>({...we,[te]:{state:"loading"}})),P.current.add(te),ne(te,await h.release(te,E))},ge=w.state!=="ready"||w.value!==null,Z=Uz(g),O=aL(m?h:void 0),H=O.available&&g===or,[se,B]=u.useState("all"),ee=x.release_branch||m?ge?Ms:null:((wn=x.releases[0])==null?void 0:wn.version)??null,W=Z!==null||H?null:g===Ms?ge?Ms:null:g??ee,[ae,J]=u.useState([]),Qe=u.useRef(0);u.useEffect(()=>{if(!m||!h.roadmapMoved)return;let te=!0;const we=Qe.current;return h.roadmapMoved().then(Xt=>{te&&Xt.ok&&we===Qe.current&&J(Xt.data.moved.map(ta=>ta.name))}),()=>{te=!1}},[h,m]);const de=O.reads.all,Me=O.read;u.useEffect(()=>{Z===null||!O.available||!de.value&&!de.reading&&!de.refusal&&Me("all")},[Z,O.available,de,Me]);const[K,ke]=u.useState(0),Pe=u.useRef(0),Nt=te=>{te===or&&ke(we=>we+1),p(te)};u.useEffect(()=>{if(K!==Pe.current){if(!H){Pe.current=K;return}se!=="all"||de.reading||!de.value||!h.roadmapSeen||(Pe.current=K,h.roadmapSeen(de.value.as_of).then(te=>{te.ok&&(Qe.current+=1,J([]))}))}},[K,H,se,de,h]);const je=new Map((((is=de.value)==null?void 0:is.releases)??[]).map(te=>[te.id,[te.kinds.includes("range")?"range":"",te.forecast.projected?Os(te.forecast.projected):"no date"].filter(Boolean).join(" · ")])),It=W===null||W===Ms||x.releases.some(te=>te.version===W);u.useEffect(()=>{!m||!c||W!==null&&W!==Ms&&!It&&c({kind:"release",id:W})},[m,c,W,It]),u.useEffect(()=>{!W||W===Ms||P.current.has(W)||m&&!It||(P.current.add(W),h.release(W).then(te=>ne(W,te)))},[W,h,ne,It]);const Et=u.useRef(g),rn=u.useRef(!1),ls=u.useRef(!!f),Ft=u.useRef(null);u.useEffect(()=>{var we,Xt;if(!m)return;if(ls.current){const ta=(we=Ft.current)==null?void 0:we.querySelector('[aria-current="true"]');if(ta){ls.current=!1,Et.current=g,ta.focus();return}}if(Et.current!==g&&(Et.current=g,rn.current=!0),!rn.current)return;const te=(Xt=S.current)==null?void 0:Xt.querySelector("h2");te&&(rn.current=!1,te.tabIndex=-1,te.focus())});const Kt=async te=>{if(!a)return;L(null);const we=await a(te);if(!we.ok){L(we.error);return}y(null),N({state:"loading"}),await F()},Ga=async()=>{if(!x.next_before)return;A(null);const te=await h.list({before:x.next_before});if(!te.ok){A(te.refusal.message);return}j(we=>({...te.data,releases:[...we.releases,...te.data.releases]}))},Qs=x.release_branch?s.jsx(gL,{value:x.release_branch.id,label:x.release_branch.name,options:n??[],can_write:x.can_write,onChange:Kt}):null,re=m?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"text-muted-foreground text-xs",children:["Read at ",xL(m.read_at)]}),o?s.jsxs(G,{variant:"ghost",size:"sm",onClick:o,children:[s.jsx(yl,{className:"mr-1 size-4","aria-hidden":!0}),"Read again"]}):null]}):Qs,ze=m?Bz(((ot=x.releases[0])==null?void 0:ot.label)??((Zs=x.releases[0])==null?void 0:Zs.version)??null):Lz(((Ws=x.releases[0])==null?void 0:Ws.version)??null,((Js=x.release_branch)==null?void 0:Js.name)??null),qe={org:i??""};return s.jsxs(s.Fragment,{children:[s.jsx(Gk,{description:m?Yk:void 0,actions:re}),d,m?s.jsx(Hz,{}):null,k?s.jsx(On,{error:k}):null,m?null:t,!m&&!x.release_branch?s.jsx(vL,{can_write:x.can_write,options:n??[],onChoose:Kt}):null,x.release_branch||x.releases.length>0||m?s.jsxs("div",{ref:Ft,className:"flex flex-col gap-6 md:flex-row md:items-start",children:[s.jsx(yL,{list:x,candidate:b?w:null,shown:H?or:Z!==null?Zn(Z):W,onSelect:Nt,roadmap:O.available?lL(((ea=x.planned)==null?void 0:ea.length)??0,ae):null,planned_ranges:je,can_load_older:!!x.next_before,older_error:M,onLoadOlder:Ga}),s.jsx("div",{className:"min-w-0 flex-1",ref:S,children:H?s.jsx(rL,{reads:O.reads,scope:se,onScope:B,onRead:Me,org:qe.org,onSelect:p}):Z!==null?s.jsx(Qz,{id:Z,summary:((D=x.planned)==null?void 0:D.find(te=>te.id===Z))??null,org:qe.org,onNotFound:()=>c==null?void 0:c({kind:"planned",id:Z}),forecast:O.available?s.jsx(mL,{state:de,id:Z}):null}):W===Ms?s.jsx(jL,{candidate:w,branch_name:((ye=x.release_branch)==null?void 0:ye.name)??null,can_write:x.can_write&&!!l,local:!!m,org:qe.org,onSelect:p,onRetry:$,onWrite:()=>X(!0)}):W?s.jsx(wL,{detail:R[W]??{state:"loading"},summary:x.releases.find(te=>te.version===W)??null,local:!!m,org:qe.org,onSelect:p,onRetry:()=>le(W)}):(x.release_branch||m)&&w.state==="ready"?s.jsx(zz,{title:ze.title,text:ze.text}):null})]}):null,l&&w.state==="ready"&&w.value?l({candidate:w.value,open:z,notice:V,onOpenChange:te=>{te||U(null),X(te)},onStale:async te=>{U(te),await C()},onWritten:async te=>{X(!1),U(null),await F(),y(te),await $()}}):null]})}function xL(e){return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}function gL({value:e,label:t,options:n,can_write:a,onChange:l}){const r=n.some(i=>i.id===e);return s.jsxs("div",{className:"grid w-56 gap-2",children:[s.jsx(Oe,{htmlFor:"release-branch",children:"Release branch"}),s.jsxs(dt,{value:e,onValueChange:l,disabled:!a,children:[s.jsx(rt,{id:"release-branch",children:s.jsx(ft,{})}),s.jsxs(it,{children:[r?null:s.jsx(Se,{value:e,children:t??"Unnamed branch"}),n.map(i=>s.jsx(Se,{value:i.id,children:i.label},i.id))]})]}),a?null:s.jsx(u1,{})]})}function u1(){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 vL({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(xu,{className:"text-muted-foreground size-8","aria-hidden":!0}),s.jsx("h2",{className:"text-lg font-semibold",children:"Choose a release branch"}),s.jsx("p",{className:"text-muted-foreground max-w-md text-sm",children:"A Release records the graph change between two commits of one branch. Choose the branch you release from; you can change it later."}),s.jsxs("div",{className:"grid w-64 gap-2 text-left",children:[s.jsx(Oe,{htmlFor:"release-branch-first",children:"Release branch"}),s.jsxs(dt,{onValueChange:n,disabled:!e,children:[s.jsx(rt,{id:"release-branch-first",children:s.jsx(ft,{placeholder:"Choose a branch"})}),s.jsx(it,{children:t.map(a=>s.jsx(Se,{value:a.id,children:a.label},a.id))})]})]}),e?null:s.jsx(u1,{})]})}function d1({children:e}){return s.jsx("p",{className:"text-muted-foreground px-3 pt-3 text-xs font-medium tracking-wide uppercase",children:e})}function yL({list:e,candidate:t,shown:n,onSelect:a,roadmap:l,planned_ranges:r,can_load_older:i,older_error:o,onLoadOlder:c}){var h,m;const d=!!e.local,f=(t==null?void 0:t.state)==="ready"&&t.value?so(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&&l?s.jsx(zc,{active:n===or,onClick:()=>a(or),version:"Roadmap",badges:null,caption:l}):null,t&&(t.state!=="ready"||t.value)?s.jsx(zc,{active:n===Ms,onClick:()=>a(Ms),version:t.state==="ready"&&t.value?t.value.version:"Next release",badges:s.jsxs(s.Fragment,{children:[s.jsx(me,{variant:"info",children:"Candidate"}),f!=null&&f.breaking?s.jsx(me,{variant:"error",children:"Breaking"}):t.state==="ready"&&((h=t.value)==null?void 0:h.app_changed)===!1?s.jsx(me,{variant:"neutral",children:"App unchanged"}):t.state==="ready"&&((m=t.value)!=null&&m.classification)?s.jsx(me,{variant:"neutral",children:t.value.classification.bump}):null]}),caption:t.state==="loading"?"Classifying…":t.state==="error"?"Could not be read":Vk(t.value)}):null,d?s.jsx(bL,{list:e,shown:n,onSelect:a,ranges:r}):null,d&&e.releases.length>0?s.jsx(d1,{children:"Released"}):null,e.releases.map(x=>{const j=d?Iz(x):null;return s.jsx(zc,{active:n===x.version,onClick:()=>a(x.version),version:x.label??x.version,badges:(j==null?void 0:j.badges)??s.jsxs(s.Fragment,{children:[s.jsx(me,{variant:"neutral",children:x.previous_release_id?x.bump??"patch":"First"}),x.breaking?s.jsx(me,{variant:"error",children:"Breaking"}):null]}),caption:(j==null?void 0:j.caption)??fx(x.written_at)},x.version)}),i?s.jsx(G,{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 bL({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(d1,{children:"Planned"}),e.planned_error?s.jsx(On,{title:"Planned Releases could not be read",error:e.planned_error}):null,(e.planned??[]).map((l,r)=>s.jsx(zc,{active:t===Zn(l.id),onClick:()=>n(Zn(l.id)),version:l.name,badges:s.jsx(me,{variant:"neutral",children:"Planned"}),caption:`${l.members===0?"no members":`${l.members} member${l.members===1?"":"s"}`}${r===0?" · next":""}${a!=null&&a.get(l.id)?` · ${a.get(l.id)}`:""}`},l.id))]})}function jL({candidate:e,branch_name:t,can_write:n,local:a,org:l,onSelect:r,onRetry:i,onWrite:o}){var m;if(e.state==="loading")return s.jsx(En,{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(En,{children:s.jsx(On,{error:e.error,onRetry:i})});const c=e.value;if(!c)return null;const d=so(c.changes),f=!c.previous_release,h=t??"the release branch";return s.jsxs(En,{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(me,{variant:"info",children:"Candidate"}),d.breaking?s.jsx(me,{variant:"error",children:"Breaking"}):c.app_changed===!1?s.jsx(me,{variant:"neutral",children:"App unchanged"}):c.classification?s.jsx(me,{variant:"neutral",children:c.classification.bump}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[a?"What staging runs over production: ":`What the next Release holds at ${h}'s head: `,Vk(c),". It is computed when you open it and never stored.",d.breaking&&c.next_version.startsWith("0.")?" Before 1.0.0 a major change raises the minor number.":""]}),f?s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The first Release, ",c.next_version,", records the starting point and lists no changes."]}):s.jsx("p",{className:"text-muted-foreground text-xs",children:"Only graph changes are judged, so code that changed without a graph change is not counted."}),(m=c.classification)!=null&&m.marks_approximate?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Modeling-only marks could not all be read, so these notes may leave out a change made after a mark."}):null,c.commits_since===null?s.jsx("p",{className:"text-muted-foreground text-xs",children:"Not every commit since the last Release could be walked, so the count and the rc number are at least what is shown."}):null]}),n?s.jsxs(G,{onClick:o,children:[s.jsx(xu,{className:"mr-2 size-4"}),"Write Release ",c.next_version]}):null]}),a?s.jsx(Fz,{candidate:c,org:l,onSelect:r,notes:f?null:s.jsx(Mu,{changes:c.changes})}):f?null:s.jsx(Mu,{changes:c.changes})]})}function wL({detail:e,summary:t,local:n,org:a,onSelect:l,onRetry:r}){const[i,o]=u.useState(!1);if((t==null?void 0:t.state)==="unreadable")return s.jsxs(En,{children:[s.jsx("h2",{className:"text-lg font-semibold",children:t.label??t.version}),s.jsx(On,{title:"This Release could not be read",error:t.error??"Its record cannot be read."})]});if(e.state==="loading")return s.jsx(En,{children:s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:"Loading the Release…"})});if(e.state==="error")return s.jsx(En,{children:s.jsx(On,{error:e.error,onRetry:r})});const c=e.value,d=!c.previous_release_id,f=c.bump&&c.computed_bump&&c.bump!==c.computed_bump,h=c.label??c.version,m=async()=>{await navigator.clipboard.writeText($z(h,so(c.changes))),o(!0)};return s.jsxs(En,{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(Kz,{release:c,onSelect:l}):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(me,{variant:"neutral",children:d?"First":c.bump}),so(c.changes).breaking?s.jsx(me,{variant:"error",children:"Breaking"}):null]}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:["Written ",fx(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(G,{variant:"outline",onClick:m,children:[s.jsx(hR,{className:"mr-2 size-4"}),i?"Copied":"Copy notes"]})]}),n?s.jsx(Xz,{release:c,org:a,onSelect:l,notes:d?null:s.jsx(Mu,{changes:c.changes})}):d?null:s.jsx(Mu,{changes:c.changes})]})}const _L=5,NL=e=>e.retry===!0||e.reason==="store_locked"||e.status===503;function kL({org:e,query:t,onSelect:n,home:a}){var M,A;const l=c1(),{href:r,Link:i}=Fe(),[o,c]=u.useState({state:"loading"}),[d,f]=u.useState(null),[h,m]=u.useState(null),[x,j]=u.useState(null),v=u.useRef(0),y=u.useRef(0),g=u.useRef(null),p=u.useRef(!1),b=u.useCallback(async S=>{const E=y.current+=1;m(null);const C=await l.list(S?{fresh:!0}:void 0);if(E===y.current){if(C.ok){v.current=0,f(null),c({state:"ok",list:C.data});return}if(C.refusal.reason==="engine_missing"){c({state:"engine_missing",refusal:C.refusal});return}if(v.current+=1,v.current===1&&NL(C.refusal)){m(C.refusal.retry_after??_L);return}f(C.refusal)}},[l]);u.useEffect(()=>{b(!1)},[b]),u.useEffect(()=>{if(h===null)return;const S=setTimeout(()=>void b(!1),h*1e3);return()=>clearTimeout(S)},[h,b]),u.useEffect(()=>{var E;if(!p.current||o.state==="loading"||d||h!==null)return;p.current=!1;const S=(E=g.current)==null?void 0:E.querySelector("h1");S&&(S.tabIndex=-1,S.focus())});const w=()=>{p.current=!0,v.current=0,f(null),b(!0)},N=o.state==="ok"?o.list:null,R=t.roadmap?or:t.planned!==null?t.planned===""?(M=N==null?void 0:N.planned)!=null&&M[0]?Zn(N.planned[0].id):null:Zn(t.planned):t.release,_=`${t.release??""}|${t.planned??""}|${t.roadmap?"roadmap":""}`,k=u.useRef(_);u.useEffect(()=>{k.current!==_&&(k.current=_,j(null))},[_]);const L=u.useRef(!1),z=u.useCallback(S=>{L.current=!0,j(S)},[]),X=!x&&o.state==="ok"&&L.current;if(u.useEffect(()=>{X&&(L.current=!1)},[X]),x)return s.jsx(Ba,{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:r(a),backLabel:"All Releases",link:i});const V=h!==null?s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(bn,{"aria-hidden":!0})," The release records are busy; reading again in ",h," s…"]}):null,U=d?s.jsxs(pe,{variant:"destructive",children:[s.jsx(sn,{}),s.jsx(be,{children:"Releases could not be read"}),s.jsxs(xe,{className:"flex flex-col items-start gap-2",children:[s.jsxs("span",{children:[d.message,N?" The last Releases read stay below.":""]}),s.jsx(G,{variant:"outline",size:"sm",onClick:w,children:"Try again"})]})]}):null;return s.jsx("div",{ref:g,className:"flex w-full flex-1 flex-col gap-6 px-4 py-4 sm:px-6 lg:px-8",children:o.state==="ok"?s.jsx(pL,{initial:o.list,org:e,selection:{selected:R,onSelect:n},onReadAgain:w,onNotFound:z,notice:V||U?s.jsxs(s.Fragment,{children:[V,U]}):null,focusOnMount:X},((A=o.list.local)==null?void 0:A.read_at)??"list"):o.state==="engine_missing"?s.jsx(Xs,{page:"Releases"}):s.jsxs(s.Fragment,{children:[s.jsx(Gk,{description:Yk}),U??V??s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-sm",role:"status","aria-live":"polite",children:[s.jsx(bn,{"aria-hidden":!0})," Loading Releases…"]})]})})}const SL={threads:"Threads",tasks:"Tasks",queues:"Queues",worktrees:"Worktrees",workspaces:"Workspaces",chart:"Org chart"},CL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function Lc(e,t){return e.kind==="home"?"Home":e.kind==="org"?SL[e.page]:e.kind==="project"?e.page?CL[e.page]:t??e.project:"Not found"}const RL="(max-width: 767px)";function TL(){const e=typeof window<"u"&&window.matchMedia?window.matchMedia(RL):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 pc({className:e=""}){return s.jsx("span",{"aria-hidden":"true",className:`block animate-pulse rounded-md bg-sidebar-accent ${e}`})}function Fv({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 Kv({item:e,collapsed:t}){const{Link:n}=Fe(),a=e.icon,l=e.title??(t?e.label:void 0),r=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:l?s.jsxs(ok,{children:[s.jsx(ck,{asChild:!0,children:r}),s.jsx(tx,{side:"right",children:l})]}):r})}const Xv="m-0 flex list-none flex-col gap-1 p-0";function Qv({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 Zv({page:e,collapsed:t,sheet:n=!1}){var M;const{href:a}=Fe(),{worktrees:l}=ln(),r=jn(),{org:i,projects:o,loading:c,none:d,about:f,aboutFailed:h,domains:m,engine:x}=r,j=x===null,v=i?`/org/${i.slug}`:"",y=o==null?void 0:o.find(A=>A.current),g=((M=i==null?void 0:i.source)==null?void 0:M.kind)==="folder"&&y!==void 0,p=A=>g&&y?`${A} · ${y.name}`:A,b=p("Workspaces"),w=p("Tasks"),N=p("Queues"),R=A=>g?A:void 0,_=[{label:"Home",href:a(v||"/"),icon:RR,current:e.kind==="home"},...j?[]:[{label:"Threads",href:a(`${v}/threads`),icon:qR,current:e.kind==="org"&&e.page==="threads"}],...m.includes("tasks")&&!j?[{label:w,title:R(w),href:a(`${v}/tasks`),icon:x0,current:e.kind==="org"&&e.page==="tasks"}]:[],...j?[]:[{label:N,title:R(N),href:a(`${v}/queues`),icon:g0,current:e.kind==="org"&&e.page==="queues"}],...l&&!j?[{label:"Worktrees",href:a(`${v}/worktrees`),icon:p0,current:e.kind==="org"&&e.page==="worktrees"}]:[],{label:b,title:R(b),href:a(`${v}/workspaces`),icon:wR,current:e.kind==="org"&&e.page==="workspaces"},{label:"Org chart",href:a(`${v}/chart`),icon:FR,current:e.kind==="org"&&e.page==="chart"}],k=c?null:d?"No organization":(i==null?void 0:i.name)??"Organization",L=i?wT(i):null,z=f==null?void 0:f.version,X=z?t?z:`sdlc ${z}`:h?gu:ld,V=h||(f==null?void 0:f.sync.state)==="unknown"?yT:f===void 0?vT:gT;let U;return c?U=s.jsx("div",{className:"px-2 py-1",children:s.jsxs(Fv,{label:"Loading projects",children:[s.jsx(pc,{className:"h-4 w-32"}),s.jsx(pc,{className:"h-4 w-24"})]})}):o?U=s.jsx("ul",{className:Xv,children:o.map(A=>s.jsx(Kv,{collapsed:t,item:{label:A.name,title:A.name,href:a(`/proj/${encodeURIComponent(A.id)}`),icon:bR,current:e.kind==="project"&&e.project===A.id}},A.id))}):U=s.jsx("p",{className:"m-0 px-2 text-sm text-sidebar-foreground/70",children:d?"No projects":gu}),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(JC,{className:"size-4","aria-hidden":"true"})}),!t&&s.jsx("div",{className:"grid min-w-0 flex-1 text-left text-sm leading-tight",children:k===null?s.jsxs(Fv,{label:"Loading organization",children:[s.jsx(pc,{className:"h-4 w-28"}),s.jsx(pc,{className:"h-3 w-24"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"truncate font-semibold",title:k,children:k}),L&&s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/70",children:L})]})})]}),s.jsxs("nav",{"aria-label":"App",className:"min-h-0 flex-1 overflow-y-auto",children:[s.jsx(Qv,{label:"Organization",collapsed:t,children:s.jsx("ul",{className:Xv,children:_.map(A=>s.jsx(Kv,{item:A,collapsed:t},A.label))})}),!t&&s.jsx(Qv,{label:"Projects",collapsed:t,children:U})]}),f!==null&&s.jsxs("div",{className:"flex flex-col gap-1 border-t border-sidebar-border p-2 text-xs text-sidebar-foreground/70",children:[s.jsx("p",{className:"m-0 truncate px-2",title:z?`sdlc ${z}`:void 0,children:X}),!t&&s.jsxs("p",{className:"m-0 flex items-start gap-2 px-2",children:[s.jsx(NR,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:V})]})]})]})}const EL="outline-hidden rounded-sm focus-visible:ring-2 focus-visible:ring-ring";function AL({page:e}){var c;const{href:t,Link:n}=Fe(),{org:a,projects:l,loading:r,none:i}=jn(),o=[];if(r)o.push({label:ld});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=l==null?void 0:l.find(h=>h.id===e.project))==null?void 0:c.name)??e.project;o.push({label:f,href:e.page?t(`/proj/${encodeURIComponent(e.project)}`):void 0})}if(e.kind==="org"&&e.item!==void 0)o.push({label:Lc(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:Lc(e),href:t(f)}),o.push({label:e.item})}else e.kind!=="home"&&!(e.kind==="project"&&!e.page)&&o.push({label:Lc(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(gp,{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 ${EL}`,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 ML({page:e,children:t}){var g;const n=TL(),[a,l]=u.useState(!0),[r,i]=u.useState(!1),o=u.useRef(null),c=u.useRef(null),{org:d,projects:f,loading:h,none:m}=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=h?ld:m?"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}${Lc(e,x)} · ${p} · sdlc viewer`},[e,x,d,h,m]);const j=()=>{var p;i(!1),(p=o.current)==null||p.focus()};u.useEffect(()=>{n||i(!1)},[n]);const v=n&&r;u.useEffect(()=>{var w;const p=c.current;if(!v||!p)return;(w=p.querySelector("a, button"))==null||w.focus();const b=N=>{var z;if(N.key==="Escape"){i(!1),(z=o.current)==null||z.focus();return}if(N.key!=="Tab")return;const R=[...p.querySelectorAll("a[href], button:not([disabled])")];if(R.length===0)return;const _=R[0],k=R[R.length-1],L=p.contains(document.activeElement);N.shiftKey&&(document.activeElement===_||!L)?(N.preventDefault(),k.focus()):!N.shiftKey&&(document.activeElement===k||!L)&&(N.preventDefault(),_.focus())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[v]);const y=!n&&!a;return s.jsx(ik,{children:s.jsxs("div",{className:"flex h-svh min-h-0 overflow-hidden bg-background text-foreground",children:[!n&&s.jsx("aside",{"aria-label":"Sidebar",className:`shrink-0 border-r border-sidebar-border transition-[width] ${y?"w-12":"w-64"}`,children:s.jsx(Zv,{page:e,collapsed:y})}),v&&s.jsxs("div",{className:"fixed inset-0 z-50 flex",children:[s.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-label":"Sidebar",className:"relative w-72 max-w-[85vw] border-r border-sidebar-border",children:[s.jsx(Zv,{page:e,collapsed:!1,sheet:!0}),s.jsx("button",{type:"button","aria-label":"Close the sidebar",className:"absolute top-3 right-3 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-sidebar-foreground/70 outline-hidden hover:text-sidebar-foreground focus-visible:ring-2 focus-visible:ring-ring",onClick:j,children:s.jsx(ad,{className:"size-4","aria-hidden":"true"})})]}),s.jsx("button",{type:"button",tabIndex:-1,"aria-hidden":"true",className:"flex-1 border-0 bg-black/80 outline-hidden",onClick:j})]}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden",children:[s.jsxs("header",{className:`flex shrink-0 items-center gap-2 border-b border-border px-4 transition-[height] ${y?"h-12":"h-16"}`,children:[s.jsx("button",{ref:o,type:"button",className:"-ml-1 inline-flex size-7 items-center justify-center rounded-md border-0 bg-transparent text-foreground outline-hidden hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring","aria-label":"Toggle Sidebar","aria-expanded":n?r:a,onClick:()=>n?i(p=>!p):l(p=>!p),children:s.jsx(XR,{className:"size-4","aria-hidden":"true"})}),s.jsx("span",{"aria-hidden":"true",className:"mr-2 h-4 w-px bg-border"}),s.jsx(AL,{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 xx="m-0 text-2xl font-semibold tracking-tight",gx="outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",vx=`rounded-sm font-medium text-primary no-underline hover:underline ${gx}`;function If({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 OL({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(If,{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(If,{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(If,{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?cl:jT})]})}const Wv=`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 ${gx}`;function $L(){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 Vr(){const{href:e,Link:t}=Fe(),{loading:n,projects:a,none:l,failure:r,readAt:i,refresh:o,reading:c}=jn(),[d,f]=u.useState(""),h=s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("h1",{className:xx,children:"Projects"}),!l&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:bT})]});if(l)return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,s.jsx(OL,{why:l==="not_in_git"?{kind:"not_in_git"}:ST(l)})]});const m=r!=null&&r.shown?r:null,x=(a??[]).filter(j=>j.name.toLowerCase().includes(d.trim().toLowerCase()));return s.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[h,m&&s.jsxs("div",{role:"alert",className:"flex flex-col gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-4",children:[s.jsx("p",{className:"m-0 text-sm font-medium text-destructive",children:"The projects could not be refreshed"}),s.jsx("p",{className:"m-0 text-sm",children:y0(m.refusal,i)}),s.jsx("div",{children:s.jsx("button",{type:"button",className:Wv,onClick:o,disabled:c,children:"Retry"})})]}),(a||n)&&s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"search","aria-label":"Filter projects",placeholder:"Filter projects",value:d,onChange:j=>f(j.target.value),className:`h-9 w-full max-w-sm rounded-md border border-input bg-transparent px-3 font-[inherit] text-sm text-foreground placeholder:text-muted-foreground ${gx}`}),!m&&s.jsx("button",{type:"button",className:`${Wv} ml-auto`,onClick:o,disabled:c||n,children:"Refresh"})]}),r&&!r.shown&&i&&s.jsx("p",{className:"m-0 text-sm text-muted-foreground",children:`Showing the list read at ${ci(i)}; reading again in ${r.retryInSeconds??10} seconds.`})]}),n?s.jsx($L,{}):a&&s.jsx("div",{className:"overflow-x-auto rounded-md border border-border",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{className:"border-b border-border text-left text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Name"}),s.jsx("th",{scope:"col",className:"h-10 px-3 font-medium",children:"Location"}),s.jsx("th",{scope:"col",className:"h-10 px-3",children:s.jsx("span",{className:"sr-only",children:"Where this viewer runs"})})]})}),s.jsxs("tbody",{children:[x.map(j=>s.jsxs("tr",{className:"border-b border-border last:border-0",children:[s.jsx("td",{className:"px-3 py-2",children:s.jsx(t,{href:e(`/proj/${encodeURIComponent(j.id)}`),className:vx,children:j.name})}),s.jsx("td",{className:"px-3 py-2 font-mono text-muted-foreground",children:j.location??gu}),s.jsx("td",{className:"px-3 py-2 text-right",children:j.current&&s.jsx("span",{className:"inline-flex items-center rounded-md border border-border px-2 py-0.5 text-xs font-medium",children:"This repository"})})]},j.id)),x.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:3,className:"px-3 py-6 text-center text-muted-foreground",children:"No projects found."})})]})]})})]})}function f1({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:xx,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 ${vx}`,children:"Back to the organization's Home"})})]})})}const DL={tasks:"Tasks",issues:"Issues",releases:"Releases"};function ao({project:e}){const{href:t,Link:n}=Fe(),{org:a,projects:l,loading:r,domains:i}=jn(),o=l==null?void 0:l.find(c=>c.id===e);return r?s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:ld}):l?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:xx,children:o.name}),s.jsx("p",{className:"m-0 font-mono text-sm text-muted-foreground",children:o.location??gu})]}),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:vx,children:DL[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(f1,{title:"Project not found",children:`There is no project '${e}' in this organization.`}):s.jsx(Vr,{})}const Ad=e=>e instanceof Error?e.message:String(e);async function h1(){try{const e=await fetch("api/threads",{cache:"no-store"});return e.status===404?{none:!0}:e.ok?{data:await e.json()}:{error:await e.text()||`HTTP ${e.status}`}}catch(e){return{error:Ad(e)}}}async function zL(){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 l={};for(const[r,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&&(l[r]=o)}return l}catch{return null}}async function LL(){try{return(await fetch("api/pin",{method:"HEAD",cache:"no-store"})).ok}catch{return!1}}async function UL(){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 BL(){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:Ad(e)}}}async function HL(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 l={};try{l=JSON.parse(a)??{}}catch{}return n.ok?{done:l}:{refused:{reason:typeof l.reason=="string"?l.reason:"failed",error:typeof l.error=="string"?l.error:a||`HTTP ${n.status}`,...typeof l.where=="string"&&l.where?{where:l.where}:{}}}}catch(n){return{refused:{reason:"failed",error:Ad(n)}}}}async function IL(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 Ad(n)}}const PL={probe:{source:async()=>{const e=await h1();if("error"in e)throw new Error(e.error);return{label:"Local workspace"}}}},m1={href:e=>e.replace(/^\/+/,"")||"./",Link:({href:e,className:t,children:n,...a})=>s.jsx("a",{href:e,className:t,...a,children:n})},qL={label:"Local viewer",can:()=>!1};function GL(){return u.useEffect(()=>{document.title="Shared app UI · SDLC Workspace Viewer"},[]),s.jsx("div",{className:"app-ui dark",children:s.jsx(u0,{data:PL,router:m1,identity:qL,children:s.jsx(DC,{})})})}const VL="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.",YL=3e4,FL="Reading the workspaces. On a plan workspace this can take a few minutes.",KL="The read failed. Details are in the terminal running sdlc viewer.",XL={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"}},QL=e=>XL[e]??{label:e,tone:"neutral"},ba=e=>e.slice(0,8),p1={human:"Human",ai:"AI"},xm=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function ZL(){const e=ln().workspaces;if(!e)throw new Error("The Workspaces page rendered without the workspaces seam.");return e}function WL(e){const t=ZL(),[n,a]=u.useState(null),[l,r]=u.useState(null),[i,o]=u.useState(!1),c=u.useRef(null),d=u.useRef(!1),f=u.useRef(null),h=u.useCallback(()=>{if(f.current)return f.current;const y=(async()=>{const g=await t.overview();g.ok?(a(g.data),r(null),o(!1)):(r(g.refusal),o(!0))})().finally(()=>{f.current=null});return f.current=y,y},[t]);u.useEffect(()=>{h()},[h]),Tu(()=>void h(),YL),u.useEffect(()=>{var y;d.current&&(n||l)&&(d.current=!1,(y=c.current)==null||y.focus())},[n,l]);const m=()=>{d.current=!0,h()},x=n===null&&l===null,j=n===null&&l!==null,v=n?JL(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(Yt,{title:"Workspaces",description:VL,actions:s.jsxs(s.Fragment,{children:[v?s.jsx("p",{className:"text-muted-foreground text-xs",children:v}):null,s.jsxs(G,{type:"button",variant:"outline",size:"sm","aria-disabled":x||void 0,"aria-describedby":x?"workspaces-reading":void 0,className:"gap-2",onClick:x?void 0:()=>void h(),children:[s.jsx(yl,{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?x1(n,i):""})]})}),s.jsxs("div",{ref:c,tabIndex:-1,className:"outline-none",children:[x?s.jsx(e6,{}):null,j&&l?s.jsx(t6,{refusal:l,on_retry:m}):null,n?s.jsx(n6,{overview:n}):null]})]})}function x1(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 JL(e,t){const n=`Read at ${es(new Date(e.read_at).toISOString())}`,a=x1(e,t);return a?`${n} · ${a}`:n}function e6(){return s.jsxs("div",{className:"mt-6",children:[s.jsx("div",{className:"grid gap-2",role:"status","aria-label":"Loading workspaces",children:Array.from({length:6},(e,t)=>s.jsx(xt,{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:FL})]})}function t6({refusal:e,on_retry:t}){const n=e.reason==="store_locked"?y0(e,null):KL;return s.jsxs(pe,{variant:"destructive",className:"mt-6",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Could not read workspaces"}),s.jsxs(xe,{children:[s.jsx("p",{children:n}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:t,children:"Retry"})]})]})}function n6({overview:e}){const{counts:t}=e,n=[xm(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(s6,{rows:e.workspaces})}),s.jsx(xc,{id:"workspaces-authority",title:"Authority and resolver",caption:"What this checkout's workspace may change",children:s.jsx(a6,{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(Jv,{children:"No integration or reconciliation attempts yet."}):s.jsx(r6,{rows:e.activity})}),s.jsx(xc,{id:"workspaces-handoffs",className:"mt-4",title:"Handoffs",children:e.handoffs.length===0?s.jsx(Jv,{children:"No Handoffs prepared yet."}):s.jsx(i6,{rows:e.handoffs})})]})}function xc({id:e,title:t,caption:n,className:a,children:l}){return s.jsxs("section",{"aria-labelledby":e,className:ie("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]}),l]})}const Jv=({children:e})=>s.jsx("p",{className:"text-muted-foreground text-sm",children:e}),Ou=({children:e,tone:t})=>s.jsx("div",{className:ie("text-xs",t==="error"?"text-destructive":"text-muted-foreground"),children:e});function lo({status:e}){const t=QL(e);return s.jsx(me,{variant:t.tone,children:t.label})}function Md({label:e,children:t}){return s.jsx(gt,{role:"group","aria-label":e,tabIndex:0,className:"overflow-x-auto outline-hidden focus-visible:ring-2 focus-visible:ring-ring",children:t})}function s6({rows:e}){return s.jsx(Md,{label:"Workspaces",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Workspace"}),s.jsx(Y,{children:"Actor"}),s.jsx(Y,{children:"Forked from"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Projection"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ce,{"data-testid":"workspaces-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:t.short_id}),s.jsx(Ou,{children:t.current?`${t.path} · This checkout`:t.path}),t.projection==="unreadable"&&t.projection_error&&s.jsx(Ou,{children:t.projection_error})]}),s.jsx(q,{children:p1[t.actor]}),s.jsx(q,{children:t.source_id?s.jsx("span",{className:"font-mono",children:ba(t.source_id)}):s.jsx("span",{className:"text-muted-foreground",children:"No source"})}),s.jsx(q,{children:s.jsx(lo,{status:t.status})}),s.jsx(q,{children:s.jsx(lo,{status:t.projection})})]},t.id))})]})})}function a6({authority:e}){const t=e.resolver,n=[["Workspace",s.jsx("span",{className:"font-mono",children:ba(e.workspace_id)},"id")],["Actor",p1[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(lo,{status:t.state==="ready"?"ready":"needs_attention"},"resolver")]),t.state==="needs_attention"&&t.issue&&n.push(["Resolver issue",t.issue]),s.jsx(Md,{label:"Authority and resolver",children:s.jsx(Be,{containerClassName:"overflow-visible",children:s.jsx(He,{children:n.map(([a,l])=>s.jsxs(ce,{children:[s.jsx(Y,{scope:"row",className:"text-muted-foreground font-normal",children:a}),s.jsx(q,{children:l})]},a))})})})}function l6(e){const t=[e.merge_attempts?xm(e.merge_attempts,"merge attempt"):null,e.resolver_attempts?xm(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 r6({rows:e}){return s.jsx(Md,{label:"Integration activity",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"Change"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Attempts"}),s.jsx(Y,{children:"Updated"})]})}),s.jsx(He,{children:e.map((t,n)=>s.jsxs(ce,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-medium",children:t.kind==="integration"?`Integrate ${ba(t.child_id)} into ${ba(t.other_id)}`:`Reconcile ${ba(t.child_id)} from ${ba(t.other_id)}`}),s.jsx(Ou,{children:t.kind==="integration"?"Integration":"Source reconciliation"})]}),s.jsx(q,{children:s.jsx(lo,{status:t.status})}),s.jsx(q,{children:l6(t)}),s.jsx(q,{children:fk(t.updated_at)})]},`${t.kind}-${t.child_id}-${t.other_id}-${t.updated_at}-${n}`))})]})})}function i6({rows:e}){return s.jsx(Md,{label:"Handoffs",children:s.jsxs(Be,{containerClassName:"overflow-visible",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{children:"From"}),s.jsx(Y,{children:"To"}),s.jsx(Y,{children:"Status"}),s.jsx(Y,{children:"Pinned"})]})}),s.jsx(He,{children:e.map(t=>s.jsxs(ce,{children:[s.jsxs(q,{children:[s.jsx("div",{className:"font-mono font-medium",children:ba(t.child_id)}),t.error?s.jsx(Ou,{children:t.error}):null]}),s.jsx(q,{className:"font-mono",children:ba(t.source_id)}),s.jsx(q,{children:s.jsx(lo,{status:t.status})}),s.jsx(q,{children:`${t.child_commit} onto ${t.source_commit}`})]},t.id))})]})})}const ey="This machine's worktrees of this repository.",o6="Merge sends one whose thread is at rest to the main queue.",c6=3e4,u6=3e3,d6=6e5,Pf=[{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"}],ai={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"}},f6="no thread to land it",yx="its thread waits on you",g1="its thread is done",v1="its thread is retired",bx=e=>e.archivable&&e.cleanup==="user",h6=e=>e.queue!==null||e.merge.offered===!1&&e.merge.why==="already in a promotion queue",m6=e=>!e.merge.offered&&(e.merge.why===g1||e.merge.why.startsWith(v1)),jx=e=>!e.merge.offered&&e.merge.why===f6||m6(e),qf=(e,t)=>t==="all"?!0:t==="decide"?bx(e):(e.landed!==null?"landed":h6(e)?"queued":jx(e)?"orphan":"needs")===t,p6=e=>e.landed!==null?e.threads.some(t=>t.phase!=="done"):e.threads.length>0&&!jx(e);function Uc(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 y1(e){const t=e%100,n=t>=11&&t<=13?"th":{1:"st",2:"nd",3:"rd"}[e%10]??"th";return`${e}${n}`}function x6(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 Gf=e=>es(new Date(e*1e3).toISOString()),mi=e=>e.charAt(0).toUpperCase()+e.slice(1);function g6(e,t){var l;const n=t.phase?mi(t.phase):"No phase",a=e.merge;if(!a.offered&&a.why.startsWith(v1)){const r=(l=/; (.+) continues it$/.exec(a.why))==null?void 0:l[1];return r?`Retired · continued by ${r}`:"Retired"}return t.phase==="done"||!a.offered&&a.why===g1?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===yx?`${n} · waits on you`:a.why.startsWith("its session is not running")?`${n} · session not running`:n}function v6(){const e=ln().worktrees;if(!e)throw new Error("The Worktrees page rendered without the worktrees seam.");return e}function y6({org:e}){var $,F;const t=v6(),[n,a]=u.useState(null),[l,r]=u.useState(null),[i,o]=u.useState(null),[c,d]=u.useState(!1),[f,h]=u.useState("all"),[m,x]=u.useState(""),[j,v]=u.useState({}),y=u.useRef({}),{confirm:g,confirm_dialog:p}=Ro(),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),r(null)):r(T.refusal)},[t]),N=u.useCallback(async()=>{const T=await t.sizes();d(!T.ok),T.ok&&o(T.data)},[t]);u.useEffect(()=>{w(),N()},[w,N]);const R=(n==null?void 0:n.rows.some(T=>{var P,ne;return((P=T.write)==null?void 0:P.state)==="waiting"||((ne=T.write)==null?void 0:ne.state)==="running"}))??!1;Tu(()=>void w(),R?u6:c6),Tu(()=>void N(),d6);const _=(n==null?void 0:n.rows)??[],k=T=>i==null?void 0:i.sizes[T.path],L=_.filter(bx),z=i?L.reduce((T,P)=>T+(k(P)??0),0):null,X=_.length===0?ey:`${ey} ${o6}${L.length?` ${L.length} ${L.length===1?"is":"are"} yours to decide${z!==null?`: removing them frees about ${Uc(z)}`:""}.`:""}`,V=m.trim().toLowerCase(),U=T=>!V||[T.name,T.path,T.branch??"",...T.threads.map(P=>P.title??P.thread)].some(P=>P.toLowerCase().includes(V)),M=_.filter(T=>qf(T,f)&&U(T)).sort((T,P)=>{if(f==="decide")return(k(P)??0)-(k(T)??0);const ne=le=>p6(le)?le.merge.offered?0:1:2;return ne(T)-ne(P)||(T.idle_days??1/0)-(P.idle_days??1/0)}),A=async(T,P)=>{const ne=await(T==="merge"?t.merge(P.path):t.remove(P.path));ne.ok?v(({[P.path]:le,...ge})=>ge):v(le=>({...le,[P.path]:ne.refusal.message})),await w()},S=async T=>{if(!T.merge.offered)return;const P=T.threads.find(H=>H.thread===(T.merge.offered&&T.merge.thread)),ne=(P==null?void 0:P.title)??T.merge.thread,le=P!=null&&P.holds.length?`has ${P.holds.length} open hold(s) (${P.holds.join(", ")})`:"has no open holds",ge=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",Z=T.merge.caveat?`
388
+
389
+ 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, ${ne}, which ${le} and is told of the join. The queue checks the branch first, and ${ge}. Nothing reaches main before then.${Z}`,action_label:"Join the main queue"})&&await A("merge",T)},E=async T=>{const P=k(T);await g({title:`Remove ${T.name}?`,description:`This deletes the folder ${T.path}${P!==void 0?` and frees about ${Uc(P)}`:""}.${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})&&(P!==void 0&&(y.current[T.path]=P),await A("remove",T))},C=async T=>{await t.dismiss(T),await w()};return(l==null?void 0:l.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(Xs,{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(Yt,{title:"Worktrees",description:X}),!n&&!l&&s.jsx(b6,{}),l?s.jsx(j6,{refusal:l,read_at:n==null?void 0:n.read_at,on_retry:()=>void w()}):null,n!=null&&n.stale?s.jsxs(pe,{variant:"destructive",className:"mt-4",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[n.stale.message," This list was read at ",es(new Date(n.read_at).toISOString()),"."]}),s.jsx(G,{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(pe,{variant:"success",className:"mt-4",role:"status",children:[s.jsx(be,{children:y.current[T.path]!==void 0?`Removed ${T.name} and freed ${Uc(y.current[T.path])}`:`Removed ${T.name}`}),s.jsxs(xe,{children:[s.jsx("p",{children:T.branch?`Its branch ${T.branch} stays, and its records were saved.`:"Its records were saved."}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>void C({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(p0,{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(_t,{type:"search",className:"w-64","aria-label":"Search worktrees",placeholder:"Search worktrees",value:m,onChange:T=>x(T.target.value)}),s.jsxs("p",{className:"text-muted-foreground ml-auto text-xs",children:["Read at ",es(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:Pf.map(T=>s.jsxs(G,{type:"button",variant:"outline",size:"sm",className:lr,"aria-pressed":f===T.id,onClick:()=>h(T.id),children:[T.label," ",_.filter(P=>qf(P,T.id)).length]},T.id))}),M.length===0?s.jsxs("div",{className:"mt-12 flex flex-col items-center gap-2 text-center",children:[s.jsx(sd,{className:"text-muted-foreground size-8","aria-hidden":"true"}),s.jsx("h2",{className:"text-lg font-semibold",children:"No worktrees match"}),V?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",($=Pf.find(T=>T.id===f))==null?void 0:$.empty," matches “",m,"”. Clear the search to see all"," ",_.filter(T=>qf(T,f)).length,"."]}),s.jsx(G,{type:"button",variant:"outline",onClick:()=>x(""),children:"Clear search"})]}):s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No ",(F=Pf.find(T=>T.id===f))==null?void 0:F.empty," right now."]})]}):s.jsx(gt,{className:"mt-4 shrink-0 overflow-x-auto",children:s.jsxs(Be,{containerAriaLabel:"Worktrees",className:"table-fixed",children:[s.jsx(Ye,{children:s.jsxs(ce,{children:[s.jsx(Y,{className:"w-[24%]",children:"Worktree"}),s.jsx(Y,{className:"w-[24%]",children:"Threads"}),s.jsx(Y,{className:"w-[12%]",children:"Landed"}),s.jsx(Y,{className:"w-[18%]",children:"Cleanup"}),s.jsx(Y,{className:"hidden w-[10%] md:table-cell",children:"Last commit"}),s.jsx(Y,{className:"w-[12%] text-right",children:"Actions"})]})}),s.jsx(He,{children:M.map(T=>s.jsx(w6,{org:e,row:T,size:k(T),sizes:i!==null?"read":c?"failed":"measuring",can_write:n.can_write,sent:j[T.path],on_merge:()=>void S(T),on_remove:()=>void E(T),on_dismiss:P=>void C(P),on_clear_sent:()=>v(({[T.path]:P,...ne})=>ne)},T.path))})]})})]}):null,p]})}function b6(){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(xt,{className:t===5?"h-10 w-2/3":"h-10 w-full"},t))})}function j6({refusal:e,read_at:t,on_retry:n}){const a=ns();return e.reason==="view_outdated"?s.jsxs(pe,{variant:"warning",className:"mt-6",children:[s.jsx(sn,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:$r}),s.jsx(xe,{children:a})]}):s.jsxs(pe,{variant:"destructive",className:"mt-6",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"Could not read worktrees"}),s.jsxs(xe,{children:[s.jsxs("p",{children:[e.message,t?` This list was read at ${es(new Date(t).toISOString())}.`:""]}),s.jsx(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:n,children:"Retry"})]})]})}function gc({children:e,muted:t=!0}){return s.jsx("div",{className:ie("truncate text-xs",t&&"text-muted-foreground"),title:e,children:e})}function w6({org:e,row:t,size:n,sizes:a,can_write:l,sent:r,on_merge:i,on_remove:o,on_dismiss:c,on_clear_sent:d}){const{href:f,Link:h}=Fe(),m=e?`/org/${encodeURIComponent(e)}`:"",x=f(`${m}/threads`),j=f(`${m}/tasks`),v=ai[t.landed??"not_landed"],y=bx(t),g=t.write,p=(g==null?void 0:g.state)==="waiting"||(g==null?void 0:g.state)==="running",b=t.threads.find(X=>"thread"in t.merge&&X.thread===t.merge.thread)??t.threads[0],w=t.merge,N=!w.offered&&w.why===yx,R=l&&t.landed===null&&!t.queue&&!N&&!jx(t),_=n!==void 0?Uc(n):a==="measuring"?"Measuring size…":a==="failed"?"Size could not be read":null,k=y?{label:"Yours to decide",muted:!1,second:[_,t.cleanup_why[0]]}:t.archivable?{label:"The manager removes it",muted:!1,second:[_]}:{label:"Stays",muted:!0,second:[_,t.why[0]??null]},L=k.second.filter(Boolean).join(" · "),z=t.path.slice(0,t.path.length-t.name.length-1)||".";return s.jsxs(s.Fragment,{children:[s.jsxs(ce,{"data-testid":"worktrees-row",children:[s.jsxs(q,{children:[s.jsx("div",{className:"truncate font-medium",title:t.name,children:t.name}),s.jsx(gc,{children:t.branch??"Detached"}),z!==".sdlc-worktrees"?s.jsx(gc,{children:`in ${z}`}):null]}),s.jsx(q,{children:b?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"truncate",title:b.title??b.thread,children:b.title??b.thread}),s.jsx(gc,{children:`${g6(t,b)}${t.threads.length>1?` · ${t.threads.length-1} more`:""}`})]}):s.jsx("span",{className:"text-muted-foreground",children:"No thread"})}),s.jsx(q,{children:s.jsx(me,{variant:v.tone,children:v.label})}),s.jsxs(q,{children:[s.jsx("div",{className:ie("truncate",k.muted&&"text-muted-foreground"),children:k.label}),L?s.jsx("div",{className:"hidden md:block",children:s.jsx(gc,{children:L})}):null]}),s.jsx(q,{className:"hidden md:table-cell",children:x6(t.idle_days)}),s.jsx(q,{className:"text-right",children:s.jsxs("div",{className:"flex justify-end gap-2",children:[p?s.jsx(G,{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(me,{variant:ai.queued.tone,children:`${ai.queued.label} · ${y1(t.queue.position)}`}):N?s.jsx(h,{href:j,"aria-label":`${t.name}: its thread waits on you, in Waiting on you`,children:s.jsx(me,{variant:ai.needs_you.tone,children:ai.needs_you.label})}):R?s.jsx(G,{type:"button",variant:"outline",size:"sm",title:w.offered?void 0:w.why,"aria-disabled":!w.offered||void 0,className:ie(!w.offered&&"cursor-not-allowed opacity-50"),"aria-label":`Send ${t.name} to the main queue`,"aria-describedby":w.offered?void 0:`why-${t.name}`,onClick:w.offered?i:void 0,children:"Merge"}):null,y&&l&&!p?s.jsx(G,{type:"button",variant:"outline",size:"sm","aria-label":`Remove ${t.name}`,onClick:o,children:"Remove"}):null]})})]}),s.jsx(_6,{row:t,threads:x,tasks:j,merge_shown:R,sent:r,on_dismiss:c,on_clear_sent:d})]})}function _6({row:e,threads:t,tasks:n,merge_shown:a,sent:l,on_dismiss:r,on_clear_sent:i}){var j,v,y,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(G,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:p,children:"Dismiss"}),f=e.write,h=e.threads.find(p=>p.thread===("thread"in e.merge?e.merge.thread:void 0))??e.threads[0],m=(h==null?void 0:h.title)??"Its thread";let x=null;if(l)x=s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:"It was not sent"}),s.jsxs(xe,{children:[s.jsx("p",{children:l}),d(i)]})]});else if((f==null?void 0:f.state)==="waiting")x=s.jsxs("p",{className:"text-muted-foreground text-sm",role:"status",children:["Another worktree's write runs first; ",e.name," ",f.kind==="merge"?"joins":"is removed"," next."]});else if((f==null?void 0:f.state)==="running")x=s.jsx("p",{className:"text-muted-foreground text-sm",role:"status",children:f.kind==="merge"?`Joining the main queue for ${e.name}. The queue checks its branch first; this can take a few minutes.`:`Removing ${e.name}. It is checked again first.`});else if((f==null?void 0:f.state)==="joined"){const p=((j=f.lands)==null?void 0:j.by)==="manager"?`the merge manager, ${f.lands.manager}, lands it`:"it lands it on its turn";x=s.jsxs(pe,{variant:f.told?"success":"warning",role:"status",children:[s.jsx(be,{children:`${e.name} joined the main queue, ${y1(f.position)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:f.told?`${m} was left a notice, and ${p}.`:"Its thread could not be told, so it does not know its turn is coming. Tell it from Threads; the join itself is unchanged."}),((v=e.queue)==null?void 0:v.position)===1&&e.queue.turn==="next"&&e.queue.passes_at?s.jsx("p",{children:`It is first in the main queue. Its thread was left a notice but not woken: continue it in its session, or the turn passes on at ${Gf(e.queue.passes_at)}.`}):null,s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({write:e.path})),!f.told||((y=e.queue)==null?void 0:y.position)===1?s.jsx("span",{className:"mt-2",children:c()}):null]})]})]})}else if(f&&(f.state==="refused"||f.state==="failed")){const p=f.kind==="merge"?`The main queue refused ${e.name}`:`${e.name} was not removed`;x=s.jsxs(pe,{variant:"destructive",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:f.kind==="merge"&&f.state==="failed"?`${e.name} did not join`:p}),s.jsxs(xe,{children:[s.jsx("p",{children:`${mi(f.message)}${f.kind==="merge"?" Nothing was queued.":" Nothing was deleted."}`}),s.jsxs("div",{className:"flex items-center gap-3",children:[d(()=>r({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(pe,{variant:"warning",children:[s.jsx(lt,{className:"size-4","aria-hidden":"true"}),s.jsx(be,{children:`${e.name}'s turn ${p.outcome==="failed"?"failed":"passed on"} at ${Gf(p.left_at)}`}),s.jsxs(xe,{children:[s.jsx("p",{children:`${mi(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(()=>r({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 ${Gf(e.queue.passes_at)}. `,c()]}):!e.merge.offered&&e.merge.why===yx?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:[`${mi(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:`${mi(e.merge.caveat)}.`}));return x?s.jsx(ce,{className:"hover:bg-transparent",children:s.jsx(q,{colSpan:6,className:"pt-0",children:x})}):null}const N6=["reason","since","store","repository","folder","home","member_path"];function b1(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 N6){const l=t==null?void 0:t[a];typeof l=="string"&&(n[a]=l)}return n}function wl({base:e="",fetcher:t=fetch}){return async(n,a={})=>{const l=new URLSearchParams;for(const[c,d]of Object.entries(a))if(Array.isArray(d))for(const f of d)l.append(c,f);else d!==void 0&&d!==!1&&d!==""&&l.set(c,String(d));const r=l.size>0?`?${l.toString()}`:"";let i;try{i=await t(`${e}api/app/${n}${r}`,{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:b1(i.status,o)}}}function k6(e={}){const t=wl(e),n=l=>async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data[l]}:r},a=encodeURIComponent;return{tasks:{access:n("tasks"),configuration:()=>t("tasks/configuration"),listTasks:l=>t(`tasks/lists/${a(l)}/tasks`),task:l=>t(`tasks/tasks/${a(l)}`)},issues:{access:n("issues"),list:(l={})=>t("issues",l),issue:l=>t(`issues/${a(l)}`),issueSections:l=>t(`issues/${a(l)}/sections`),issueRelated:l=>t(`issues/${a(l)}/related`)},releases:{access:n("releases"),list:()=>t("releases"),release:l=>t(`releases/${a(l)}`),candidate:()=>t("releases/candidate")},organizations:{access:n("organizations"),list:()=>t("orgs")},projects:{access:n("projects"),list:()=>t("projects")},about:{about:()=>t("about")}}}function S6(e={}){const t=wl(e);return{listQueues:()=>t("queues"),queue:n=>t(`queues/${encodeURIComponent(n)}`),members:async()=>({ok:!0,data:[]}),refresh_ms:15e3,settings_note:"Local queue settings are the engine's built-in policies. Turns change through promote.",thread_subjects:!0,description:"Where this checkout's threads take turns: landing on main, deploying to staging, publishing and accepting the graph.",read_scope:"this checkout only",subject_label:"Thread"}}const pi=e=>({ok:!1,refusal:{status:0,message:e}});function wx({base:e="",fetcher:t=fetch}){return async(n,a)=>{let l;try{l=await t(`${e}api/${n}`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})}catch{return pi("The viewer did not answer. Is sdlc viewer still running?")}const r=await l.json().catch(()=>null);return l.ok?{ok:!0,data:r}:{ok:!1,refusal:b1(l.status,r)}}}function C6(e={}){const t=wl(e),n=wx(e);return{chart:()=>t("org"),change:a=>n("org-change",a)}}function R6(e={}){const t=wl(e),n=o=>`tasks/tasks/${encodeURIComponent(o)}`,{base:a="",fetcher:l=fetch}=e;return{access:async()=>{const o=await t("access");return o.ok?{ok:!0,data:o.data.tasks}:o},availability:async()=>{const o=await t("tasks/configuration");if(!o.ok)return o.refusal.reason==="engine_missing"?{state:"off",refusal:o.refusal}:{state:"error",refusal:o.refusal};const c=o.data;if(c.state!=="active")return{state:"available"};const d=c.workspaces.find(h=>h.is_default)??c.workspaces[0],f=d==null?void 0:d.lists[0];return!d||!f?{state:"error"}:{state:"active",configuration:c,workspace:d,list:f}},listTasks:(o,c={})=>{var d,f,h;return c.state==="archived"?Promise.resolve(pi("This checkout keeps no archived tasks.")):c.assigned_to_me?Promise.resolve(pi("Assigned to you is a status group here.")):t(`tasks/lists/${encodeURIComponent(o)}/tasks`,{search:c.search,owner:c.owner===""?"none":c.owner,group:c.group,urgent:c.urgent?"true":void 0,over_estimate:c.over_estimate?"true":void 0,opened:(d=c.opened_groups)!=null&&d.length?c.opened_groups.join(","):void 0,closed:(f=c.closed_groups)!=null&&f.length?c.closed_groups.join(","):void 0,all:(h=c.all_groups)!=null&&h.length?c.all_groups.join(","):void 0})},members:()=>t("tasks/members"),waitingOnYou:()=>t("tasks/waiting-on-you"),task:o=>t(n(o)),taskSections:o=>t(`${n(o)}/sections`),taskRelated:o=>t(`${n(o)}/related`),hierarchyRevision:async()=>({ok:!0,data:0}),commands:{run:async()=>pi("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 l(`${a}api/task-done`,{method:"POST",cache:"no-store",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)})}catch{return pi("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 T6(e={}){const t=wl(e),n=wx(e),a=encodeURIComponent,l=r=>r!=null&&r.fresh?{fresh:1}:{};return{access:async()=>{const r=await t("access");return r.ok?{ok:!0,data:r.data.releases}:r},list:(r={})=>t("releases",l(r)),release:(r,i)=>t(`releases/${a(r)}`,l(i)),candidate:r=>t("releases/candidate",l(r)),candidateBatch:r=>t("releases/candidate/batch",l(r)),related:(r,i)=>t(`releases/${a(r)}/related`,l(i)),plannedRelease:(r,i)=>t(`releases/planned/${a(r)}`,l(i)),roadmap:r=>t("releases/roadmap",{...l(r),...r!=null&&r.mine?{mine:1}:{}}),roadmapMoved:r=>t("releases/roadmap/moved",l(r)),roadmapSeen:r=>n("roadmap/seen",{at:r})}}function E6(e={}){const t=wl(e),n=wx(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 A6(e={}){const t=wl(e);return{overview:()=>t("workspaces")}}const M6=15e3,O6=10,ty="idle-sessions-list",ny="idle-sessions-heading",sy="idle-sessions-confirm-text";function j1(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}const $6=e=>`${Number.isInteger(e)?e:e.toFixed(1)} h`,w1=e=>e===1?"1 session":`${e} sessions`;function D6(e){const t=e.released.length?`Closed ${w1(e.released.length)}.`:"Closed no sessions.";return e.kept.length?`${t} Kept ${e.kept.length}:`:t}function z6({row:e}){const t=[e.name,e.retired?"continued in another session":"",`idle ${$6(e.idle_hours)}`,j1(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 L6(){const[e,t]=u.useState(null),[n,a]=u.useState(!1),[l,r]=u.useState(!1),[i,o]=u.useState(null),[c,d]=u.useState(null),[f,h]=u.useState(""),m=u.useRef(""),x=u.useRef(null),j=u.useRef(null),v=u.useRef(null),y=u.useRef(null),g=u.useRef(0),p=u.useRef(0),b=u.useCallback(async()=>{const U=++g.current,M=await UL();if(!M||U<p.current)return;p.current=U,h("");const A=JSON.stringify(M);A!==m.current&&(m.current=A,t(M))},[]);u.useEffect(()=>{const U=setTimeout(b,0),M=setInterval(b,M6);return()=>{clearTimeout(U),clearInterval(M)}},[b]),u.useEffect(()=>{var M;const U=y.current;U&&(y.current=null,(M={cancel:j,close:x,dismiss:v}[U].current)==null||M.focus())});const w=(e==null?void 0:e.sessions.length)??0;if(u.useEffect(()=>{l&&!w&&i===null&&r(!1)},[l,w,i]),!w&&!c&&!f&&i===null)return null;const N=()=>{i===null&&(r(!0),y.current="cancel")},R=()=>{i===null&&(r(!1),y.current="close")},_=async()=>{if(i!==null)return;o(w),d(null),h("");const U=await BL();p.current=g.current+1,await b(),o(null),r(!1),a(!1),"error"in U?(h(`The sessions were not closed: ${U.error.replace(/\.+$/,"")}.`),y.current="close"):(d(U.done),y.current="dismiss")},k=()=>{d(null),y.current="close"},L=U=>{U.key==="Escape"&&(U.preventDefault(),R())},z=i!==null?`Closing ${w1(i)}…`:c?D6(c):"",X=(e==null?void 0:e.sessions.slice(0,O6))??[],V=w-X.length;return s.jsxs("div",{className:"idle",role:"group",...w?{"aria-labelledby":ny}:{"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:ny,"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 · ",j1(e.memory_mb)]})]}),s.jsxs("div",{className:"tools",children:[s.jsx("button",{type:"button",className:"pin","aria-expanded":n,"aria-controls":ty,"aria-label":n?"Hide the idle sessions list":"Show the idle sessions list",onClick:()=>a(U=>!U),children:n?"Hide":"Show"}),s.jsx("button",{type:"button",className:"pin",ref:x,"aria-expanded":l,"aria-label":"Close idle sessions…",onClick:N,children:"Close idle…"})]})]}),w>0&&s.jsxs("ul",{className:"idle-list",id:ty,hidden:!n,"aria-label":`Sessions idle over ${e==null?void 0:e.idle_over} hours, longest idle first`,children:[X.map(U=>s.jsx(z6,{row:U},U.session)),V>0&&s.jsx("li",{children:s.jsxs("p",{className:"caption muted",children:["…and ",V," more"]})})]}),l&&w>0&&s.jsxs("div",{className:"idle-confirm",role:"group","aria-label":"Close idle sessions","aria-describedby":sy,onKeyDown:L,children:[s.jsxs("p",{id:sy,children:[w===1?"Close this session?":`Close these ${w} sessions?`," Each transcript stays, so reopening a conversation resumes it, and a thread with unfinished work goes on with Continue on its card. A session that is busy or has background work running is kept."]}),s.jsxs("div",{className:"tools start",children:[s.jsx("button",{type:"button",className:"pin","aria-disabled":i!==null?!0:void 0,"aria-busy":i!==null?!0:void 0,onClick:_,children:i!==null?`Closing ${i}…`:`Close ${w}`}),s.jsx("button",{type:"button",className:"pin",ref:j,"aria-disabled":i!==null?!0:void 0,onClick:R,children:"Cancel"})]})]}),s.jsx("p",{className:"idle-status",role:"status",children:z}),c&&s.jsxs(s.Fragment,{children:[c.kept.length>0&&s.jsx("ul",{className:"idle-list","aria-label":"Kept sessions",children:c.kept.map(U=>s.jsxs("li",{children:[s.jsx("p",{className:"idle-name",children:U.title}),s.jsx("p",{className:"caption muted",children:U.why})]},U.session))}),s.jsx("div",{className:"tools start",children:s.jsx("button",{type:"button",className:"pin",ref:v,"aria-label":"Dismiss the close result",onClick:k,children:"Dismiss"})})]})]})}const ay={ok:"lime",you:"amber",alert:"red",waiting:"blue",blocked:"purple",muted:"grey",plain:"grey"};function Bc(e){return e&&Object.hasOwn(ay,e)?ay[e]:"grey"}const U6=1e4,B6=6e4,H6=2,Vf="#thread-",I6=b0("Threads"),P6={working:"▶",prod:"↑",planned:"○"},ly=3,ry=["working","ready","prod","waiting","blocked","paused","planned"],q6={ready:"results ready",prod:"ready for prod"};function G6(e){const t=ry.map(a=>[a,e.filter(l=>l.state===a).length]),n=[...new Set(e.map(a=>a.state).filter(a=>!ry.includes(a)))].map(a=>[a,e.filter(l=>l.state===a).length]);return[...t,...n].filter(([,a])=>a>0).map(([a,l])=>`${l} ${q6[a]??a}`).join(" · ")}const V6={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 Y6(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 F6=new Set(["not_terminal","another_process","continued","no_open","pending"]);function iy({label:e,count:t,hint:n}){const a=n?`hint-${e.toLowerCase().replace(/\W+/g,"-")}`:void 0;return s.jsxs(s.Fragment,{children:[s.jsxs("h2",{className:"group","aria-label":`${e}, ${t}`,"aria-describedby":a,children:[e,s.jsx("span",{className:"count",children:t})]}),n&&s.jsx("span",{className:"sr-only",id:a,children:n})]})}function Yf({text:e,role:t}){return s.jsx("span",{className:`badge tone-${Bc(t)}`,children:e})}function K6({serves:e}){const t=e.slice(0,H6),n=e.length-t.length;return s.jsxs("p",{className:"caption muted serves",children:[t.map((a,l)=>s.jsxs("span",{children:[l>0&&", ",s.jsxs("a",{href:`releases?planned=${encodeURIComponent(a.planned_release)}`,"aria-label":`serves ${a.name}, ${a.level}: open it in Planned releases`,children:["serves ",a.name," (",a.level,")"]})]},a.planned_release)),n>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{"aria-hidden":"true",children:[", +",n," more"]}),s.jsxs("span",{className:"sr-only",children:[", and ",n," more planned releases"]})]})]})}function oy({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 X6({onConnection:e,org:t=null,project:n=null}){const[a,l]=u.useState(null),[r,i]=u.useState(!1),[o,c]=u.useState(""),[d,f]=u.useState(!1),[h,m]=u.useState(null),[x,j]=u.useState(""),[v,y]=u.useState(null),[g,p]=u.useState(null),[b,w]=u.useState(null),N=u.useRef(""),R=u.useRef(""),_=u.useRef(null),k=u.useRef(null),L=u.useRef(null),z=B=>{var ee;return B instanceof HTMLButtonElement&&B.classList.contains("pin")&&((ee=_.current)!=null&&ee.contains(B))?B.dataset.key??null:null},X=B=>{L.current=z(B.target)},V=()=>{setTimeout(()=>{z(document.activeElement)||(L.current=null)},0)},U=u.useCallback(async()=>{const B=await h1();if("none"in B){i(!0),c(""),e("live");return}if("error"in B){c(B.error),e("disconnected");return}i(!1),c(""),j(""),e("live");const ee=JSON.stringify(B.data);ee!==N.current&&(N.current=ee,l(B.data))},[e]);u.useEffect(()=>{let B=!0;LL().then(ae=>B&&f(ae));const ee=setTimeout(U,0),W=setInterval(U,U6);return()=>{B=!1,clearTimeout(ee),clearInterval(W)}},[U]),u.useEffect(()=>{let B=!0;const ee=()=>zL().then(ae=>{B&&ae&&y(J=>JSON.stringify(J)===JSON.stringify(ae)?J:ae)});ee();const W=setInterval(ee,B6);return()=>{B=!1,clearInterval(W)}},[]),u.useEffect(()=>{const B=()=>{var Qe,de,Me;const W=window.location.hash;if(!W.startsWith(Vf)){w(null);return}if(W===R.current)return;let ae;try{ae=decodeURIComponent(W.slice(Vf.length))}catch{ae=W.slice(Vf.length)}const J=document.getElementById(`thread-${ae}`);if(!J||!((Qe=_.current)!=null&&Qe.contains(J))){a&&w(ae);return}R.current=W,w(null),p(ae),(de=J.querySelector(".thread-title"))==null||de.focus({preventScroll:!0}),(Me=J.scrollIntoView)==null||Me.call(J,{block:"center"})},ee=()=>{R.current="",B()};return B(),window.addEventListener("hashchange",ee),()=>window.removeEventListener("hashchange",ee)},[a]),u.useEffect(()=>{if(!g)return;const B=()=>p(null);return document.addEventListener("pointerdown",B,!0),document.addEventListener("keydown",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("keydown",B,!0)}},[g]),u.useLayoutEffect(()=>{const B=L.current??k.current;if(!B||!_.current)return;const ee=document.activeElement;if(ee&&ee!==document.body&&!_.current.contains(ee)){L.current=null;return}const W=[..._.current.querySelectorAll("button.pin")].find(ae=>ae.dataset.key===B);W?ee!==W&&W.focus({preventScroll:B!==k.current}):L.current=null});const M=async B=>{if(h)return;const ee=!B.pinned;k.current=B.key,m(B.key);const W=await IL(B.key,ee);m(null),W||l(ae=>ae&&{...ae,threads:ae.threads.map(J=>J.key===B.key?{...J,pinned:ee}:J)}),await U(),j(W?`The pin was not saved: ${W}`:""),k.current===B.key&&(k.current=null)},[A,S]=u.useState(()=>new Set),[E,C]=u.useState({}),$=ns(),{confirm:F,confirm_dialog:T}=Ro(),P=(B,ee)=>C(W=>{const{[B]:ae,...J}=W;return ee?{...J,[B]:ee}:J}),ne=(B,ee)=>S(W=>{const ae=new Set(W);return ee?ae.add(B):ae.delete(B),ae}),le=Object.keys(E).some(B=>!A.has(B));u.useEffect(()=>{if(!le)return;const B=()=>C(ee=>Object.fromEntries(Object.entries(ee).filter(([W])=>A.has(W))));return document.addEventListener("pointerdown",B,!0),document.addEventListener("click",B,!0),()=>{document.removeEventListener("pointerdown",B,!0),document.removeEventListener("click",B,!0)}},[le,A]);const ge=B=>setTimeout(()=>{var ee,W;return(W=[...((ee=_.current)==null?void 0:ee.querySelectorAll("button.open-thread"))??[]].find(ae=>ae.dataset.key===B))==null?void 0:W.focus()},0),Z=async(B,ee)=>{const W=await F({title:`Reopen ${B.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 ge(B.key),W},O=async B=>{if(A.has(B.key))return;let ee=!1;for(;;){ne(B.key,!0),P(B.key,{key:B.key,text:V6[B.where??""]??"Opening.",role:"waiting"});const W=await HL(B.key,ee);if(ne(B.key,!1),"done"in W){P(B.key,null);return}const{reason:ae,error:J,where:Qe}=W.refused;if(ae==="closed"&&!ee){if(P(B.key,null),!await Z(B,Qe))return;ee=!0;continue}const de=ae==="outdated"?`${J.replace(/\.*$/,".")} ${$}`:J.replace(/\.*$/,"."),Me=ae==="terminal_denied"?"you":F6.has(ae)?"muted":"alert";P(B.key,{key:B.key,text:de,role:Me});return}},H=(a==null?void 0:a.pinnedCount)??0,se=(a==null?void 0:a.threads)??[];return s.jsxs(s.Fragment,{children:[T,s.jsxs("header",{className:"main-head",children:[s.jsx("h1",{children:"Threads"}),a&&!r&&s.jsx("p",{className:"muted",children:a.line})]}),s.jsxs("section",{className:"card threads","aria-label":"Threads",children:[s.jsx(L6,{}),o&&s.jsxs("div",{className:"alert",role:"alert",children:["Threads unavailable: ",o.replace(/\.+$/,""),". Retrying every 10 s."]}),x&&s.jsx("div",{className:"alert",role:"alert",children:x}),s.jsx("p",{className:"caption muted not-listed",role:"status",children:b!==null&&!r?s.jsxs(s.Fragment,{children:["Thread ",b," is not in this list. ",s.jsx("code",{children:"sdlc view --all"})," lists older threads."]}):null}),r?s.jsx("p",{className:"muted",children:I6}):s.jsxs("div",{className:"thread-list",ref:_,onFocus:X,onBlur:V,children:[se.map((B,ee)=>s.jsxs("div",{children:[H>0&&ee===0&&s.jsx(iy,{label:"Pinned",count:H,hint:"Threads you pinned; they stay first in every order"}),H>0&&ee===H&&s.jsx(iy,{label:"Other threads",count:se.length-H}),s.jsx(Q6,{row:v!=null&&v[B.key]?{...B,serves:v[B.key]}:B,arrived:g===B.key,pinnable:d&&typeof B.pinned=="boolean",pinning:h,onPin:()=>M(B),opening:A.has(B.key),note:E[B.key]??null,onOpen:()=>O(B),org:t,project:n})]},B.key)),a&&!se.length&&s.jsx("p",{className:"muted empty",children:"No threads at work or waiting."}),a&&a.hidden>0&&s.jsxs("p",{className:"caption muted",children:[a.hidden," older thread(s) not shown; sdlc view --all lists them."]})]})]})]})}function Q6({row:e,arrived:t,pinnable:n,pinning:a,onPin:l,opening:r,note:i,onOpen:o,org:c,project:d}){const f=g=>c?`org/${encodeURIComponent(c)}/tasks/${encodeURIComponent(g)}`:null,h=g=>d?`proj/${encodeURIComponent(d)}/issues/${encodeURIComponent(g)}`:null,m=[e.where||e.agent,e.phase,e.age,e.waitsOn?`waits on ${e.waitsOn}`:""].filter(Boolean).join(" · "),x=Y6(e),j=`open-note-${e.key}`,[v,y]=u.useState(!1);return s.jsxs("article",{className:t?"thread arrived":"thread",id:`thread-${e.key}`,style:{marginLeft:Math.min(e.depth*22,110)},children:[s.jsxs("div",{className:"thread-head",children:[s.jsx("p",{className:"thread-title",tabIndex:-1,children:e.title}),s.jsxs("div",{className:"tools",children:[e.carried?s.jsxs(s.Fragment,{children:[s.jsx(Yf,{text:e.carried,role:"waiting"}),e.carriedBatch&&s.jsx(Yf,{text:e.carriedBatch.text,role:e.carriedBatch.role})]}):s.jsx(Yf,{text:e.status,role:e.role}),x&&s.jsx("button",{type:"button",className:"open-thread","data-key":e.key,"aria-label":`${x}: ${e.title}`,"aria-describedby":j,"aria-disabled":r?!0:void 0,"aria-busy":r?!0:void 0,onClick:()=>{r||o()},children:r?"Opening…":x}),n&&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":a?!0:void 0,"aria-busy":a===e.key?!0:void 0,onClick:()=>{a||l()},children:e.pinned?"Unpin":"Pin"})]})]}),s.jsx("p",{className:"caption muted",children:m}),x&&s.jsx("p",{id:j,className:`caption open-note tone-${Bc((i==null?void 0:i.role)??"muted")}`,role:(i==null?void 0:i.role)==="alert"||(i==null?void 0:i.role)==="you"?"alert":"status",children:(i==null?void 0:i.text)??null}),e.serves&&e.serves.length>0&&s.jsx(K6,{serves:e.serves}),e.summary&&s.jsx("p",{className:"caption muted",children:e.summary}),e.carriedDetail&&s.jsx("p",{className:"line",children:e.carriedDetail}),e.step&&s.jsxs("p",{className:"caption muted",children:["step: ",e.step]}),e.lines.length>0&&s.jsx("p",{className:"caption muted lines-summary",children:G6(e.lines)}),(v?e.lines:e.lines.slice(0,ly)).map((g,p)=>s.jsxs("p",{className:`line tone-${Bc(g.role)}`,children:[s.jsxs("span",{"aria-hidden":"true",children:[P6[g.state]??"•"," "]}),g.state==="working"&&s.jsx("span",{className:"sr-only",children:"Working: "}),g.task!==void 0&&s.jsx(oy,{id:g.task,href:f(g.task)}),g.task!==void 0&&g.text?" ":null,g.text]},`l${p}`)),e.lines.length>ly&&s.jsx("button",{type:"button",className:"lines-more","aria-expanded":v,"aria-label":v?`Show fewer lines of work of ${e.title}`:`Show all ${e.lines.length} lines of work of ${e.title}`,onClick:()=>y(g=>!g),children:v?"Show fewer":`Show all ${e.lines.length}`}),(e.routed??[]).map(g=>s.jsxs("p",{className:"line",children:["routed ",s.jsx(oy,{id:g.issue,href:h(g.issue)}),g.title?` ${g.title}`:null]},`r${g.issue}`)),e.holds.map((g,p)=>s.jsx("p",{className:`line tone-${Bc(g.role)}`,children:g.text},`h${p}`)),e.plan&&s.jsx("p",{className:"caption muted",children:e.plan})]})}const Z6=5e3;function W6(){const[e,t]=u.useState([]),n=u.useRef(0),a=u.useRef(new Map),l=u.useCallback(c=>{const d=a.current.get(c);d&&clearTimeout(d),a.current.delete(c),t(f=>f.filter(h=>h.id!==c))},[]),r=u.useCallback((c,d)=>{const f=n.current+=1;t(h=>[...h.filter(m=>m.tone!=="error").slice(-2),{id:f,tone:c,message:d}]),c==="success"&&a.current.set(f,setTimeout(()=>l(f),Z6))},[l]);u.useEffect(()=>{const c=a.current;return()=>{for(const d of c.values())clearTimeout(d)}},[]);const i=u.useMemo(()=>({success:c=>r("success",c),error:c=>r("error",c)}),[r]),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(G,{type:"button",variant:"ghost",size:"control",className:"shrink-0",onClick:()=>l(c.id),children:"Dismiss"})]},c.id))});return{notify:i,toasts:o}}const _1=/^#(?:(releases)|release=(.+)|planned(?:=(.+))?)$/,J6=/^#task=(.+)$/,e5=/^#issue=(.+)$/,t5=/^iss-\d{1,9}$/;function N1(e){return e.split("/").filter(Boolean).slice(1).join("/")}function n5(e,t=""){const n=e.split("/").filter(Boolean);if(n.length===0)return{page:{kind:"home"}};if(n.length===1){const[o]=n;return o==="threads"?{page:{kind:"org",page:"threads"},threads:!0}:o==="chat"?{forward:"threads"}:o==="tasks"?{page:{kind:"org",page:"tasks"},tasks:!0}:o==="issues"?{page:{kind:"home"},issues:!0}:o==="chart"?{page:{kind:"org",page:"chart"},chart:!0}:o==="worktrees"?{page:{kind:"org",page:"worktrees"},worktrees:!0}:o==="workspaces"?{page:{kind:"org",page:"workspaces"},workspaces:!0}:o==="queues"?{page:{kind:"org",page:"queues"},queues:!0}:o==="releases"?{page:{kind:"home"},releasesForward:!0}:{page:{kind:"not_found"}}}const[a,l,r,i]=n;if(a==="org"&&r==="tasks"&&i==="queues"&&n.length===4)return{forward:`org/${l}/queues${t}`};if(a==="org"&&r==="chat"&&n.length<=4)return{forward:`org/${l}/threads${i===void 0?"":`#thread-${i}`}`};if(a==="org"&&r==="tasks"&&n.length===4){const o=decodeURIComponent(i);return{page:{kind:"org",page:"tasks",item:o},org:decodeURIComponent(l),task:o}}if(a==="org"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l);return i===void 0?{page:{kind:"home"},org:o,issues:!0}:{page:{kind:"home"},org:o,issues:!0,issue:decodeURIComponent(i)}}if(a==="proj"&&r==="issues"&&n.length<=4){const o=decodeURIComponent(l),c={kind:"project",project:o,page:"issues"};if(i===void 0)return{page:c,issues:!0,project:o};const d=decodeURIComponent(i),f=new URLSearchParams(t);f.delete("from");const h=f.toString();return{page:{...c,item:d,...h?{list_query:h}:{}},issues:!0,project:o,issue:d}}if(a==="org"&&n.length<=3){const o=decodeURIComponent(l);if(r===void 0)return{page:{kind:"home"},org:o};if(r==="threads")return{page:{kind:"org",page:"threads"},org:o,threads:!0};if(r==="tasks")return{page:{kind:"org",page:"tasks"},org:o,tasks:!0};if(r==="chart")return{page:{kind:"org",page:"chart"},org:o,chart:!0};if(r==="worktrees")return{page:{kind:"org",page:"worktrees"},org:o,worktrees:!0};if(r==="workspaces")return{page:{kind:"org",page:"workspaces"},org:o,workspaces:!0};if(r==="queues")return{page:{kind:"org",page:"queues"},org:o,queues:!0};if(r==="releases")return{page:{kind:"home"},org:o,releasesForward:!0}}if(a==="proj"&&n.length<=3){const o=decodeURIComponent(l);if(r===void 0)return{page:{kind:"project",project:o}};if(r==="tasks")return{page:{kind:"project",project:o,page:"tasks"},tasks:!0};if(r==="releases")return{page:{kind:"project",project:o,page:"releases"},releases:!0}}return{page:{kind:"not_found"}}}const s5={label:"Local viewer",can:()=>!1},a5={connecting:"Connecting…",live:"Live · refreshes every 10s",disconnected:"Disconnected"},cy=()=>s.jsx(f1,{title:"Page not found",children:"There is no page at this address in this viewer."});function l5({routeOrg:e}){const{org:t,engine:n}=jn(),{project:a}=Lo(),[l,r]=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(Xs,{page:"Threads"})}):s.jsxs("div",{className:"main viewer-panel",children:[s.jsxs("p",{className:"connection",role:"status",children:[s.jsx("span",{className:`dot ${l}`,"aria-hidden":"true"}),a5[l]]}),s.jsx(X6,{onConnection:r,org:(t==null?void 0:t.slug)??e??null,project:a})]})}const qa=()=>s.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading…"});function r5({route:e,navigate:t}){var f;const{org:n,projects:a,loading:l,none:r}=jn(),i=e.page.kind==="project"?e.page.project:null,o=i!==null&&a!==null&&!((f=a.find(h=>h.id===i))!=null&&f.current),c=e.org===void 0&&!o&&!l&&n!==null?`org/${encodeURIComponent(n.slug)}/tasks`:null;if(u.useEffect(()=>{c&&t(c)},[c,t]),i!==null&&o)return s.jsx(ao,{project:i});if(c||e.org===void 0&&l)return s.jsx(qa,{});const d=(n==null?void 0:n.slug)??e.org;return d===void 0&&i!==null?s.jsx(ao,{project:i}):d===void 0&&r?s.jsx(Vr,{}):d===void 0?s.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Tasks open once the organization reads."}):s.jsx(W$,{org:d})}function i5({route:e,navigate:t}){const{org:n,loading:a,none:l}=jn(),r=e.org===void 0&&!a&&n!==null?`org/${encodeURIComponent(n.slug)}/queues${window.location.search}`:null;if(u.useEffect(()=>{r&&t(r)},[r,t]),r||e.org===void 0&&a)return s.jsx(qa,{});const i=(n==null?void 0:n.slug)??e.org;if(i===void 0&&l)return s.jsx(Vr,{});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(O3,{org:i,open:o,path:`/org/${encodeURIComponent(i)}/queues`})}function o5({route:e,navigate:t}){var j;const{org:n,projects:a}=jn(),{project:l,settled:r}=Lo(),i=e.project??null,o=i!==null&&a!==null&&!((j=a.find(v=>v.id===i))!=null&&j.current),c=window.location.search,d=i===null&&l!==null?`proj/${encodeURIComponent(l)}/issues${e.issue?`/${encodeURIComponent(e.issue)}`:""}${c}`:null;u.useEffect(()=>{d&&t(d)},[d,t]);const[f,h]=u.useState(()=>window.location.search.replace(/^\?/,"")),m=u.useCallback(v=>{window.history.replaceState(window.history.state,"",`${window.location.pathname}${v?`?${v}`:""}`),h(v)},[]);if(i!==null&&o)return s.jsx(ao,{project:i});if(d||i===null&&!r)return s.jsx(qa,{});if(i===null)return s.jsx(Vr,{});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(o3,{org:x,project:i,query:f,onQuery:m})}function c5({issue:e,navigate:t,home:n}){const{project:a,settled:l}=Lo(),r=a!==null?`proj/${encodeURIComponent(a)}/issues/${encodeURIComponent(e)}`:null;return u.useEffect(()=>{r&&t(r)},[r,t]),r||!l?s.jsx(qa,{}):n}function Lo(){var r;const{projects:e,loading:t,none:n,failure:a}=jn();return{project:((r=e==null?void 0:e.find(i=>i.current))==null?void 0:r.id)??null,settled:!t&&(e!==null||n!==null||!!(a!=null&&a.shown))}}function u5({navigate:e}){const{project:t,settled:n}=Lo(),a=t!==null?`proj/${encodeURIComponent(t)}/releases${window.location.search}`:null;return u.useEffect(()=>{a&&e(a)},[a,e]),a||!n?s.jsx(qa,{}):s.jsx(Vr,{})}function uy(e){const t=new URLSearchParams(e);return{release:t.get("release"),planned:t.has("planned")?t.get("planned")??"":null}}function d5({route:e}){var f;const{org:t,projects:n,loading:a}=jn(),l=e.page.kind==="project"?e.page.project:"",[r,i]=u.useState(()=>uy(window.location.search));if(a)return s.jsx(qa,{});if(n!==null&&!((f=n.find(h=>h.id===l))!=null&&f.current))return s.jsx(ao,{project:l});const c=`/proj/${encodeURIComponent(l)}/releases`,d=h=>{const m=new URLSearchParams;h!=null&&h.startsWith("planned:")?m.set("planned",h.slice(8)):h&&m.set("release",h);const x=m.size>0?`?${m.toString()}`:"";window.history.replaceState(window.history.state,"",`${window.location.pathname}${x}`),i(uy(x))};return s.jsx(kL,{org:(t==null?void 0:t.slug)??"",query:r,onSelect:d,home:c})}function f5({hash:e,navigate:t,home:n}){const{project:a,settled:l}=Lo(),r=_1.exec(e),i=r!=null&&r[2]?$u(r[2]):null,o=r!=null&&r[3]?$u(r[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||!l?s.jsx(qa,{}):n}function Ff({route:e,navigate:t}){const{org:n}=jn();let a=e.page;const l=e.org!==void 0&&n!==null&&e.org!==n.slug;l&&(a={kind:"not_found"});let r;if(l)r=s.jsx(cy,{});else if("threads"in e)r=s.jsx(l5,{routeOrg:e.org});else if("task"in e){const i=new URLSearchParams(window.location.search).get("from");r=s.jsx(TD,{org:encodeURIComponent(e.org),task_id:e.task,from:i})}else"tasks"in e?r=s.jsx(r5,{route:e,navigate:t}):"issues"in e?r=s.jsx(o5,{route:e,navigate:t}):"chart"in e?r=s.jsx(tz,{}):"worktrees"in e?r=s.jsx(y6,{org:(n==null?void 0:n.slug)??e.org}):"workspaces"in e?r=s.jsx(WL,{org:(n==null?void 0:n.slug)??e.org}):"queues"in e?r=s.jsx(i5,{route:e,navigate:t}):"releasesForward"in e?r=s.jsx(u5,{navigate:t}):"releases"in e?r=s.jsx(d5,{route:e}):a.kind==="home"?r=s.jsx(Vr,{}):a.kind==="project"?r=s.jsx(ao,{project:a.project}):r=s.jsx(cy,{});return s.jsx(ML,{page:a,children:r})}function h5({task:e,navigate:t,home:n}){const{org:a,loading:l,none:r,failure:i}=jn(),o=a!==null?`org/${encodeURIComponent(a.slug)}/tasks/${encodeURIComponent(e)}`:null,c=!l&&(r!==null||!!(i!=null&&i.shown));return u.useEffect(()=>{o&&t(o)},[o,t]),o||!c?s.jsx(qa,{}):n}const m5=e=>window.location.replace(e);function $u(e){try{return decodeURIComponent(e)}catch{return null}}function p5({navigate:e=m5,data:t}){const n=n5(N1(window.location.pathname),window.location.search),[a,l]=u.useState(null),{notify:r,toasts:i}=W6(),o=J6.exec(window.location.hash),c=o?$u(o[1]):null,d=e5.exec(window.location.hash),f=d?$u(d[1]):null,h=f!==null&&t5.test(f)?f:null,m=_1.test(window.location.hash)?window.location.hash:null,x=o!==null&&c===null||d!==null&&h===null,j="forward"in n?n.forward:null;u.useEffect(()=>{j&&e(j)},[j,e]);const v=u.useMemo(()=>{if(t)return t;const g=k6();return{probe:{source:async()=>({label:"Local workspace"})},shell:g,issues:g.issues,tasks:R6(),org:C6(),worktrees:E6(),workspaces:A6(),queues:S6(),releases:T6()}},[t]);if(j||"forward"in n||!v.shell)return null;const y=s.jsx(Ff,{route:{page:{kind:"home"}},navigate:e});return s.jsx("div",{className:"app-ui dark",ref:l,children:s.jsxs(PA,{container:a,children:[s.jsx(u0,{data:v,router:m1,identity:s5,notify:r,children:s.jsx(ET,{shell:v.shell,children:x?s.jsx(Ff,{route:{page:{kind:"not_found"}},navigate:e}):c!==null?s.jsx(h5,{task:c,navigate:e,home:y}):h!==null?s.jsx(c5,{issue:h,navigate:e,home:y}):m!==null?s.jsx(f5,{hash:m,navigate:e,home:y}):s.jsx(Ff,{route:n,navigate:e})})}),i]})})}OC.createRoot(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:N1(window.location.pathname)==="app-ui-probe"?s.jsx(GL,{}):s.jsx(p5,{})}));