From 06468a17574746bbd8f90fee6482e07f0221f5b8 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Sat, 23 May 2026 20:50:20 +0800 Subject: [PATCH] Add Discord gig status updates --- apps/admin_dashboard/src/main.tsx | 13 +- .../static/dashboard/.vite/manifest.json | 2 +- .../{index-B41mWS5m.js => index-DAy1pv-J.js} | 2 +- .../backend/static/dashboard/index.html | 2 +- .../src/five08/discord_bot/cogs/jobs.py | 335 +++++++++++++++++- .../integration/test_dashboard_playwright.py | 29 +- tests/unit/test_jobs.py | 93 +++++ 7 files changed, 467 insertions(+), 9 deletions(-) rename apps/api/src/five08/backend/static/dashboard/assets/{index-B41mWS5m.js => index-DAy1pv-J.js} (75%) diff --git a/apps/admin_dashboard/src/main.tsx b/apps/admin_dashboard/src/main.tsx index d317c563..74cc06b0 100644 --- a/apps/admin_dashboard/src/main.tsx +++ b/apps/admin_dashboard/src/main.tsx @@ -1874,8 +1874,17 @@ function App() { function openNotification(notification: DashboardNotification) { if (notification.type === "stale_recruiting_gig") { - setGigStatus("recruiting") - navigate("gigs", true) + const gigId = + notification.engagement_id || + (notification.id.startsWith("stale-recruiting:") + ? notification.id.slice("stale-recruiting:".length) + : "") + if (gigId) { + openGigDetail(gigId) + } else { + setGigStatus("recruiting") + navigate("gigs", true) + } } setNotificationsOpen(false) } diff --git a/apps/api/src/five08/backend/static/dashboard/.vite/manifest.json b/apps/api/src/five08/backend/static/dashboard/.vite/manifest.json index 99bef770..9e96cfa6 100644 --- a/apps/api/src/five08/backend/static/dashboard/.vite/manifest.json +++ b/apps/api/src/five08/backend/static/dashboard/.vite/manifest.json @@ -1,6 +1,6 @@ { "index.html": { - "file": "assets/index-B41mWS5m.js", + "file": "assets/index-DAy1pv-J.js", "name": "index", "src": "index.html", "isEntry": true, diff --git a/apps/api/src/five08/backend/static/dashboard/assets/index-B41mWS5m.js b/apps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.js similarity index 75% rename from apps/api/src/five08/backend/static/dashboard/assets/index-B41mWS5m.js rename to apps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.js index 4751a06d..f115690a 100644 --- a/apps/api/src/five08/backend/static/dashboard/assets/index-B41mWS5m.js +++ b/apps/api/src/five08/backend/static/dashboard/assets/index-DAy1pv-J.js @@ -6,4 +6,4 @@ var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Te=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?we(n):``}function De(e,t){switch(e.tag){case 26:case 27:case 5:return we(e.type);case 16:return we(`Lazy`);case 13:return e.child!==t&&t!==null?we(`Suspense Fallback`):we(`Suspense`);case 19:return we(`SuspenseList`);case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return we(`Activity`);default:return``}}function Oe(e){try{var t=``,n=null;do t+=De(e,n),n=e,e=e.return;while(e);return t}catch(e){return` Error generating stack: `+e.message+` `+e.stack}}var ke=Object.prototype.hasOwnProperty,Ae=t.unstable_scheduleCallback,je=t.unstable_cancelCallback,Me=t.unstable_shouldYield,Ne=t.unstable_requestPaint,Pe=t.unstable_now,Fe=t.unstable_getCurrentPriorityLevel,Ie=t.unstable_ImmediatePriority,Le=t.unstable_UserBlockingPriority,Re=t.unstable_NormalPriority,ze=t.unstable_LowPriority,Be=t.unstable_IdlePriority,Ve=t.log,He=t.unstable_setDisableYieldValue,Ue=null,A=null;function We(e){if(typeof Ve==`function`&&He(e),A&&typeof A.setStrictMode==`function`)try{A.setStrictMode(Ue,e)}catch{}}var Ge=Math.clz32?Math.clz32:Je,Ke=Math.log,qe=Math.LN2;function Je(e){return e>>>=0,e===0?32:31-(Ke(e)/qe|0)|0}var Ye=256,Xe=262144,Ze=4194304;function Qe(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:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;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 j(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Qe(n))):i=Qe(o):i=Qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Qe(n))):i=Qe(o)):i=Qe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function $e(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function et(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 tt(){var e=Ze;return Ze<<=1,!(Ze&62914560)&&(Ze=4194304),e}function nt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function rt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function it(e,t,n,r,i,a){var o=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 s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,`passive`,{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.textContent,a=i.length;for(e=0;e=Bn),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return Rn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!zn&&Gn(e,t)?(e=ln(),cn=sn=on=null,qn=!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)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=z(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=z(e.document)}return t}function xr(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 Sr=nn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==z(r)||(r=Cr,`selectionStart`in r&&xr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tr&&gr(Tr,r)||(Tr=r,r=Td(wr,`onSelect`),0>=o,i-=o,yi=1<<32-Ge(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),K&&xi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),K&&xi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return K&&xi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),K&&xi(i,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=i(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ne&&xa(l)===r.type){n(e,r.sibling),c=i(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=oi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ai(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=i(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=li(o,e.mode,c),c.return=e,e=c}return s(e);case ne:return o=xa(o),b(e,r,o,c)}if(ue(o))return v(e,r,o,c);if(oe(o)){if(l=oe(o),typeof l!=`function`)throw Error(a(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===x)return b(e,r,Yi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,o),c.return=e,e=c):(n(e,r),c=si(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(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 Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(X&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Wl|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(a(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=T.T,s={};T.T=s,As(e,!1,t,n);try{var c=i(),l=T.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,la(c,r),fu(e)):ks(e,t,r,fu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},fu())}finally{E.p=a,o!==null&&s.types!==null&&(o.types=s.types),T.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(a(476));var i=xs(e).queue;vs(e,i,t,de,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:de,baseState:de,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:de},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},fu())}function Cs(){return Ji(Qf)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=fu();e=Ia(n);var r=La(t,e,n);r!==null&&(mu(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=fu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=Yr(e,t,n,r),n!==null&&(mu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,fu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return Jr(e,t,i,0),Ll===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return mu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:ud(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(a(479))}else t=Yr(e,n,r,2),t!==null&&mu(t,e,2)}function js(e){var t=e.alternate;return e===q||t!==null&&t===q}function Ms(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ot(e,n)}}var Ps={readContext:Ji,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ps.useEffectEvent=go;var Fs={readContext:Ji,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){We(!0);try{e()}finally{We(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){We(!0);try{n(t)}finally{We(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,q,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,i=To();if(K){if(n===void 0)throw Error(a(407));n=n()}else{if(n=t(),Ll===null)throw Error(a(349));X&127||Io(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=To(),t=Ll.identifierPrefix;if(K){var n=bi,r=yi;n=(r&~(1<<32-Ge(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}o[ft]=t,o[pt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(a(166));if(e=ge.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ei,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ft]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||ji(t,!0)}else e=Bd(e).createTextNode(r),e[ft]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(t),n!==null){if(e===null){if(!r)throw Error(a(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(a(557));e[ft]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(a(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Pi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(a(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(a(317));i[ft]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),i=!1}else i=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return ye(),e===null&&xd(t.stateNode.containerInfo),Pc(t),null;case 10:return Hi(t.type),Pc(t),null;case 19:if(O(ro),r=t.memoizedState,r===null)return Pc(t),null;if(i=(t.flags&128)!=0,o=r.rendering,o===null)if(i)Nc(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return k(ro,ro.current&1|2),K&&xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Pe()>eu&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304)}else{if(!i)if(e=io(o),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!K)return Pc(t),null}else 2*Pe()-r.renderingStartTime>eu&&n!==536870912&&(t.flags|=128,i=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Pe(),e.sibling=null,n=ro.current,k(ro,i?n&1|2:n&1),K&&xi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&O(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Pc(t),null;case 25:return null;case 30:return null}throw Error(a(156,t.tag))}function Ic(e,t){switch(wi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),ye(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xe(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(a(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(a(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return O(ro),null;case 4:return ye(),null;case 10:return Hi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&O(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Lc(e,t){switch(wi(t),t.tag){case 3:Hi(ea),ye();break;case 26:case 27:case 5:xe(t);break;case 4:ye();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:O(ro);break;case 10:Hi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&O(da);break;case 24:Hi(ea)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Q(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Q(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Q(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Q(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Q(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Q(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Q(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Q(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Q(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[pt]=t}catch(t){Q(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(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&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===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=qt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[ft]=e,t[pt]=n}catch(t){Q(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Rd=sp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Pd(o,r,n),o[ft]=e,St(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,T.T=null,n=cu,cu=null;var o=iu,s=ou;if(ru=0,au=iu=null,ou=0,J&6)throw Error(a(331));var c=J;if(J|=4,Ml(o.current),wl(o,o.current,s,n),J=c,rd(0,!1),A&&typeof A.onPostCommitFiberRoot==`function`)try{A.onPostCommitFiberRoot(Ue,o)}catch{}return!0}finally{E.p=i,T.T=r,Bu(e,t)}}function Uu(e,t,n){t=di(n,t),t=Js(e.stateNode,t,2),e=La(e,t,2),e!==null&&(rt(e,2),nd(e))}function Q(e,t,n){if(e.tag===3)Uu(e,e,n);else for(;t!==null;){if(t.tag===3){Uu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(nu===null||!nu.has(r))){e=di(n,e),n=Ys(2),r=La(t,n,2),r!==null&&(Xs(n,r,t,e),rt(r,2),nd(r));break}}t=t.return}}function Wu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Gu.bind(null,e,t,n),t.then(e,e))}function Gu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(X&n)===n&&(Ul===4||Ul===3&&(X&62914560)===X&&300>Pe()-Ql?!(J&2)&&xu(e,0):Kl|=n,Jl===X&&(Jl=0)),nd(e)}function Ku(e,t){t===0&&(t=tt()),e=Xr(e,t),e!==null&&(rt(e,t),nd(e))}function qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ku(e,n)}function Ju(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(a(314))}r!==null&&r.delete(t),Ku(e,n)}function Yu(e,t){return Ae(e,t)}var Xu=null,Zu=null,Qu=!1,$u=!1,ed=!1,td=0;function nd(e){e!==Zu&&e.next===null&&(Zu===null?Xu=Zu=e:Zu=Zu.next=e),$u=!0,Qu||(Qu=!0,ld())}function rd(e,t){if(!ed&&$u){ed=!0;do for(var n=!1,r=Xu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ge(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,cd(r,a))}else a=X,a=j(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||$e(r,a)||(n=!0,cd(r,a));r=r.next}while(n);ed=!1}}function id(){ad()}function ad(){$u=Qu=!1;var e=0;td!==0&&Gd()&&(e=td);for(var t=Pe(),n=null,r=Xu;r!==null;){var i=r.next,a=od(r,t);a===0?(r.next=null,n===null?Xu=i:n.next=i,i===null&&(Zu=n)):(n=r,(e!==0||a&3)&&($u=!0)),r=i}ru!==0&&ru!==5||rd(e,!1),td!==0&&(td=0)}function od(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=B(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+B(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+B(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+B(n.imageSizes)+`"]`)):i+=`[href="`+B(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+B(r)+`"][href="`+B(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=xt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);St(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ge.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=xt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=xt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=xt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+B(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),St(t),e.head.appendChild(t))}function Pf(e){return`[src="`+B(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+B(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,St(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),St(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=le()}))();function T(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,fe=E,pe=(e,t)=>n=>{if(t?.variants==null)return fe(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=de(t)||de(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return fe(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},D=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),k=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),me=`-`,he=[],ge=`arbitrary..`,_e=e=>{let t=be(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ye(e);let n=e.split(me);return ve(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?D(i,t):t:i||he}return n[e]||he}}},ve=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ve(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(me):e.slice(t).join(me),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ge+r:void 0})(),be=e=>{let{theme:t,classGroups:n}=e;return xe(n,t)},xe=(e,t)=>{let n=k();for(let r in e){let i=e[r];Se(i,n,r,t)}return n},Se=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){we(e,t,n);return}if(typeof e==`function`){Te(e,t,n,r);return}Ee(e,t,n,r)},we=(e,t,n)=>{let r=e===``?t:De(t,e);r.classGroupId=n},Te=(e,t,n,r)=>{if(Oe(e)){Se(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(O(n,e))},Ee=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(me),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,ke=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ae=`!`,je=`:`,Me=[],Ne=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Pe=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Ne(t,l,c,u)};if(t){let e=t+je,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ne(Me,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Fe=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ie=e=>({cache:ke(e.cacheSize),parseClassName:Pe(e),sortModifiers:Fe(e),postfixLookupClassGroupIds:Le(e),..._e(e)}),Le=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Re),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ae:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},Be=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Ie(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ze(e,n);return i(e,a),a};return a=o,(...e)=>a(Be(...e))},Ue=[],A=e=>{let t=t=>t[e]||Ue;return t.isThemeGetter=!0,t},We=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ge=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ke=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,qe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Je=/\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$/,Ye=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Xe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ze=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qe=e=>Ke.test(e),j=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),et=e=>e.endsWith(`%`)&&j(e.slice(0,-1)),tt=e=>qe.test(e),nt=()=>!0,rt=e=>Je.test(e)&&!Ye.test(e),it=()=>!1,at=e=>Xe.test(e),ot=e=>Ze.test(e),st=e=>!M(e)&&!F(e),ct=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),lt=e=>St(e,Et,it),M=e=>We.test(e),ut=e=>St(e,Dt,rt),dt=e=>St(e,Ot,j),ft=e=>St(e,At,nt),pt=e=>St(e,kt,it),mt=e=>St(e,wt,it),N=e=>St(e,Tt,ot),P=e=>St(e,jt,at),F=e=>Ge.test(e),ht=e=>Ct(e,Dt),gt=e=>Ct(e,kt),_t=e=>Ct(e,wt),vt=e=>Ct(e,Et),yt=e=>Ct(e,Tt),bt=e=>Ct(e,jt,!0),xt=e=>Ct(e,At,!0),St=(e,t,n)=>{let r=We.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ct=(e,t,n=!1)=>{let r=Ge.exec(e);return r?r[1]?t(r[1]):n:!1},wt=e=>e===`position`||e===`percentage`,Tt=e=>e===`image`||e===`url`,Et=e=>e===`length`||e===`size`||e===`bg-size`,Dt=e=>e===`length`,Ot=e=>e===`number`,kt=e=>e===`family-name`,At=e=>e===`number`||e===`weight`,jt=e=>e===`shadow`,Mt=He(()=>{let e=A(`color`),t=A(`font`),n=A(`text`),r=A(`font-weight`),i=A(`tracking`),a=A(`leading`),o=A(`breakpoint`),s=A(`container`),c=A(`spacing`),l=A(`radius`),u=A(`shadow`),d=A(`inset-shadow`),f=A(`text-shadow`),p=A(`drop-shadow`),m=A(`blur`),h=A(`perspective`),g=A(`aspect`),_=A(`ease`),v=A(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),F,M],ee=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],S=()=>[`auto`,`contain`,`none`],C=()=>[F,M,c],te=()=>[Qe,`full`,`auto`,...C()],ne=()=>[$e,`none`,`subgrid`,F,M],re=()=>[`auto`,{span:[`full`,$e,F,M]},$e,F,M],ie=()=>[$e,`auto`,F,M],ae=()=>[`auto`,`min`,`max`,`fr`,F,M],oe=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],se=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],w=()=>[`auto`,...C()],ce=()=>[Qe,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...C()],le=()=>[Qe,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...C()],ue=()=>[Qe,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...C()],T=()=>[e,F,M],E=()=>[...b(),_t,mt,{position:[F,M]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,vt,lt,{size:[F,M]}],pe=()=>[et,ht,ut],D=()=>[``,`none`,`full`,l,F,M],O=()=>[``,j,ht,ut],k=()=>[`solid`,`dashed`,`dotted`,`double`],me=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],he=()=>[j,et,_t,mt],ge=()=>[``,`none`,m,F,M],_e=()=>[`none`,j,F,M],ve=()=>[`none`,j,F,M],ye=()=>[j,F,M],be=()=>[Qe,`full`,...C()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[tt],breakpoint:[tt],color:[nt],container:[tt],"drop-shadow":[tt],ease:[`in`,`out`,`in-out`],font:[st],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[tt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[tt],shadow:[tt],spacing:[`px`,j],text:[tt],"text-shadow":[tt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Qe,M,F,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,F,M]}],"container-named":[ct],columns:[{columns:[j,M,F,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:te()}],"inset-x":[{"inset-x":te()}],"inset-y":[{"inset-y":te()}],start:[{"inset-s":te(),start:te()}],end:[{"inset-e":te(),end:te()}],"inset-bs":[{"inset-bs":te()}],"inset-be":[{"inset-be":te()}],top:[{top:te()}],right:[{right:te()}],bottom:[{bottom:te()}],left:[{left:te()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[$e,`auto`,F,M]}],basis:[{basis:[Qe,`full`,`auto`,s,...C()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[j,Qe,`auto`,`initial`,`none`,M]}],grow:[{grow:[``,j,F,M]}],shrink:[{shrink:[``,j,F,M]}],order:[{order:[$e,`first`,`last`,`none`,F,M]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:re()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:re()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...oe(),`normal`]}],"justify-items":[{"justify-items":[...se(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...se()]}],"align-content":[{content:[`normal`,...oe()]}],"align-items":[{items:[...se(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...se(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...se(),`baseline`]}],"place-self":[{"place-self":[`auto`,...se()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mbs:[{mbs:w()}],mbe:[{mbe:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":C()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":C()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ce()}],"inline-size":[{inline:[`auto`,...le()]}],"min-inline-size":[{"min-inline":[`auto`,...le()]}],"max-inline-size":[{"max-inline":[`none`,...le()]}],"block-size":[{block:[`auto`,...ue()]}],"min-block-size":[{"min-block":[`auto`,...ue()]}],"max-block-size":[{"max-block":[`none`,...ue()]}],w:[{w:[s,`screen`,...ce()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ce()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ce()]}],h:[{h:[`screen`,`lh`,...ce()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ce()]}],"max-h":[{"max-h":[`screen`,`lh`,...ce()]}],"font-size":[{text:[`base`,n,ht,ut]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,xt,ft]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,et,M]}],"font-family":[{font:[gt,pt,t]}],"font-features":[{"font-features":[M]}],"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:[i,F,M]}],"line-clamp":[{"line-clamp":[j,`none`,F,dt]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":[`none`,F,M]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,F,M]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...k(),`wavy`]}],"text-decoration-thickness":[{decoration:[j,`from-font`,`auto`,F,ut]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[j,`auto`,F,M]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:C()}],"tab-size":[{tab:[$e,F,M]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,F,M]}],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`,F,M]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:E()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},$e,F,M],radial:[``,F,M],conic:[$e,F,M]},yt,N]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-bs":[{"border-bs":O()}],"border-w-be":[{"border-be":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":O()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...k(),`hidden`,`none`]}],"divide-style":[{divide:[...k(),`hidden`,`none`]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...k(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[j,F,M]}],"outline-w":[{outline:[``,j,ht,ut]}],"outline-color":[{outline:T()}],shadow:[{shadow:[``,`none`,u,bt,P]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":[`none`,d,bt,P]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:O()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[j,ut]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":[`none`,f,bt,P]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[j,F,M]}],"mix-blend":[{"mix-blend":[...me(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":me()}],"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":[j]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[j]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,F,M]}],filter:[{filter:[``,`none`,F,M]}],blur:[{blur:ge()}],brightness:[{brightness:[j,F,M]}],contrast:[{contrast:[j,F,M]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,bt,P]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:[``,j,F,M]}],"hue-rotate":[{"hue-rotate":[j,F,M]}],invert:[{invert:[``,j,F,M]}],saturate:[{saturate:[j,F,M]}],sepia:[{sepia:[``,j,F,M]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,F,M]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[j,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[j,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,j,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j,F,M]}],"backdrop-invert":[{"backdrop-invert":[``,j,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[j,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[j,F,M]}],"backdrop-sepia":[{"backdrop-sepia":[``,j,F,M]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,F,M]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[j,`initial`,F,M]}],ease:[{ease:[`linear`,`initial`,_,F,M]}],delay:[{delay:[j,F,M]}],animate:[{animate:[`none`,v,F,M]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,F,M]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":[`scale-3d`],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[F,M,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":[`translate-none`],zoom:[{zoom:[$e,F,M]}],accent:[{accent:T()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:T()}],"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`,F,M]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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`,F,M]}],fill:[{fill:[`none`,...T()]}],"stroke-w":[{stroke:[j,ht,ut,dt]}],stroke:[{stroke:[`none`,...T()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function I(...e){return Mt(E(e))}var Nt=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=Nt()}))(),Pt=pe(`inline-flex min-h-[22px] items-center rounded-full border px-2 py-0.5 text-[11px] font-extrabold uppercase leading-tight`,{variants:{variant:{neutral:`border-border bg-secondary text-muted-foreground`,succeeded:`border-emerald-400/35 bg-emerald-500/15 text-emerald-300`,failed:`border-red-400/40 bg-red-500/15 text-red-300`,dead:`border-red-400/40 bg-red-500/15 text-red-300`,missing:`border-red-400/40 bg-red-500/15 text-red-300`,running:`border-amber-400/40 bg-amber-500/15 text-amber-300`,queued:`border-teal-400/40 bg-teal-500/15 text-teal-200`,canceled:`border-border bg-secondary text-muted-foreground`}},defaultVariants:{variant:`neutral`}});function R({className:e,variant:t,...n}){return(0,L.jsx)(`span`,{"data-slot":`badge`,className:I(Pt({variant:t,className:e})),...n})}var Ft=pe(`inline-flex min-h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border text-sm font-semibold transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`border-border bg-secondary text-secondary-foreground hover:bg-secondary/80`,outline:`border-border bg-background hover:bg-accent hover:text-accent-foreground`,ghost:`border-transparent hover:bg-accent hover:text-accent-foreground`,destructive:`border-destructive bg-destructive text-white hover:bg-destructive/90`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,icon:`size-9`}},defaultVariants:{variant:`secondary`,size:`default`}});function z({className:e,variant:t,size:n,type:r=`button`,...i}){return(0,L.jsx)(`button`,{"data-slot":`button`,type:r,className:I(Ft({variant:t,size:n,className:e})),...i})}function It({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card`,className:I(`rounded-lg border bg-card text-card-foreground shadow-[0_18px_44px_rgb(0_0_0/0.22)]`,e),...t})}function B({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card-header`,className:I(`flex items-center justify-between gap-3 border-b px-4 py-3`,e),...t})}function Lt({className:e,...t}){return(0,L.jsx)(`h2`,{"data-slot":`card-title`,className:I(`text-[15px] font-bold`,e),...t})}function Rt({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card-content`,className:I(`p-4`,e),...t})}function V({className:e,type:t,...n}){return(0,L.jsx)(`input`,{"data-slot":`input`,type:t,className:I(`flex min-h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}function H({className:e,...t}){return(0,L.jsx)(`label`,{"data-slot":`label`,className:I(`grid gap-1.5 text-xs font-bold text-muted-foreground`,e),...t})}function zt({className:e,...t}){return(0,L.jsx)(`select`,{"data-slot":`select`,className:I(`flex min-h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}function Bt({className:e,...t}){return(0,L.jsx)(`table`,{"data-slot":`table`,className:I(`w-full border-collapse text-sm`,e),...t})}function Vt({className:e,...t}){return(0,L.jsx)(`thead`,{"data-slot":`table-header`,className:e,...t})}function Ht({className:e,...t}){return(0,L.jsx)(`tbody`,{"data-slot":`table-body`,className:e,...t})}function Ut({className:e,...t}){return(0,L.jsx)(`tr`,{"data-slot":`table-row`,className:I(`border-b transition-colors hover:bg-muted/45`,e),...t})}function U({className:e,...t}){return(0,L.jsx)(`th`,{"data-slot":`table-head`,className:I(`bg-secondary px-3 py-3 text-left align-middle text-xs font-extrabold text-muted-foreground`,e),...t})}function W({className:e,...t}){return(0,L.jsx)(`td`,{"data-slot":`table-cell`,className:I(`px-3 py-3 align-middle text-sm`,e),...t})}var Wt={pending:`Needs review`,selected:`Assigned to onboarder`,reachingout:`Reaching out`,awaitingcontribution:`Awaiting contribution`,onboarded:`Onboarded`,waitlist:`Waitlist`,rejected:`Rejected`};function Gt(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Kt(e,t=new Date){if(!e)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let r=t.getTime()-n.getTime();return r<0?0:Math.floor(r/864e5)}function qt(e){return e==null?``:JSON.stringify(e,null,2)}function Jt(e){return e.onboarding_state||e.onboardingState||e.cOnboardingState||``}function Yt(e){let t=String(e||``).trim();if(!t)return`No status`;let n=t.toLowerCase();return Wt[n]?Wt[n]:t.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function Xt(e){let t=String(e||``).trim().toLowerCase();return!t||t===`pending`?`neutral`:t===`selected`?`queued`:t===`rejected`?`failed`:t===`onboarded`?`succeeded`:t===`waitlist`?`running`:`queued`}function Zt(e){let t=String(e||``).trim();return!t||t.toLowerCase()===`none`?``:t}function Qt(e){let t=String(e||``).trim();return t?/^https?:\/\//i.test(t)?t:`https://${t.replace(/^\/+/,``)}`:``}function $t(e){try{return new URL(Qt(e))}catch{return null}}function en(e,t){let n=e.toLowerCase();return n===t||n.endsWith(`.${t}`)}function tn(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function nn(e){let t=String(e||``).trim();if(!t)return``;let n=$t(t);if(n&&en(n.hostname,`linkedin.com`))return n.href;if(/^https?:\/\//i.test(t))return``;let r=t.replace(/^@/,``).replace(/^\/+|\/+$/g,``).replace(/^in\//i,``);return r?`https://www.linkedin.com/in/${tn(r)}`:``}function rn(e){let t=String(e||``).trim().replace(/^@/,``);if(!t)return``;let n=$t(t);if(n&&en(n.hostname,`github.com`))return n.href;if(/^https?:\/\//i.test(t))return``;let r=t.replace(/^\/+|\/+$/g,``);return r?`https://github.com/${tn(r)}`:``}var an={people:`/dashboard/people`,gigs:`/dashboard/gigs`,projects:`/dashboard/projects`,onboarding:`/dashboard/onboarding`,jobs:`/dashboard/jobs`,agent:`/dashboard/agent`,audit:`/dashboard/audit`},on={people:`people:read`,gigs:`gigs:read`,projects:`projects:read`,onboarding:`onboarding:read`,jobs:`jobs:read`,agent:`audit:read`,audit:`audit:read`},sn={discord:{label:`Discord`,options:[[`linked`,`Linked`],[`missing`,`Missing`]]},email_508:{label:`508 email`,options:[[`present`,`Present`],[`missing`,`Missing`]]},resume:{label:`Resume`,options:[[`present`,`Present`],[`missing`,`Missing`]]},skills:{label:`Skills`,options:[[`present`,`Parsed`],[`missing`,`Not parsed`]]},sync_status:{label:`Sync status`,options:[[`active`,`Active`],[`conflict`,`Conflict`],[`missing_in_crm`,`Missing in CRM`]]}},cn=class extends Error{status;statusText;payload;url;method;constructor(e,t,n,r,i,a){super(e),this.name=`ApiRequestError`,this.status=t,this.statusText=n,this.payload=r,this.url=i,this.method=a}};function ln(e,t){let n=e.detail;if(typeof n==`string`&&n.trim())return n;let r=e.error;return typeof r==`string`?r===`person_not_found`?`No CRM person, ERPNext user, or ERPNext supplier matched "${typeof e.person==`string`&&e.person.trim()?e.person:`that person`}". Try an email address or an exact name from CRM/ERPNext.`:r===`candidate_not_found`?`The selected person record is no longer available. Search again and choose one of the current matches.`:r===`ambiguous_person`?`Multiple people matched. Choose the matching person record.`:r||t:t}function un(e,t){return typeof e==`string`&&e.trim()?e:e instanceof Error&&e.message.trim()?e.message:t}function dn(){return window.location.pathname.split(`/`).filter(Boolean)[1]||``}function fn(){let e=dn();return Object.hasOwn(an,e)?e:`people`}function pn(e=`gigs`){let[,t,n]=window.location.pathname.split(`/`).filter(Boolean);if(t!==e||!n)return``;try{return decodeURIComponent(n)}catch{return``}}async function G(e,t={}){let n=String(t.method||`GET`).toUpperCase(),r=new Headers(t.headers);r.set(`Accept`,`application/json`);let i;try{i=await fetch(e,{credentials:`same-origin`,...t,headers:r})}catch(t){throw new cn(un(t,`Network request failed`),0,`Network request failed`,null,e,n)}if(i.status===401){let t=`${window.location.pathname}${window.location.search}`||`/dashboard`;throw window.location.assign(`/auth/login?next=${encodeURIComponent(t)}`),new cn(`Session expired`,i.status,i.statusText,null,e,n)}if(!i.ok){let t=i.statusText,r=null;try{r=await i.json(),r&&typeof r==`object`&&(t=ln(r,String(t||`Request failed`)))}catch{t=i.statusText}throw new cn(typeof t==`string`?t:JSON.stringify(t),i.status,i.statusText,r,e,n)}return i.json()}function mn(e,t,n){if(e===`gigs`){let e=t;if(n===`title`)return e.title||``;if(n===`status`)return e.status||``;if(n===`applications`)return Number(e.application_count||0);if(n===`activity`)return kn(e)}if(e===`projects`){let e=t;if(n===`display_name`)return e.display_name||``;if(n===`customer`)return e.customer||``;if(n===`status`)return e.source_status||``;if(n===`roster_count`)return Number(e.roster_count||0);if(n===`modified`)return e.source_modified_at||e.last_synced_at||``}if(e===`onboarding`){let e=t,r=e.profile_status||{};if(n===`name`)return e.name||e.email_508||e.email||``;if(n===`onboarding_state`){let t=Jt(e);return t.toLowerCase()===`pending`?`zzz-${t}`:t}if(n===`onboarder`)return e.onboarder||``;if(n===`updated`)return e.onboarding_updated_at||``;if(n===`profile_gaps`)return[!r.discord_linked,!r.latest_resume,Number(r.skills_count||0)<=0].filter(Boolean).length}if(e===`people`){let e=t,r=e.profile_status||{};if(n===`name`)return e.name||e.email_508||e.email||``;if(n===`status`)return[r.crm_active,r.is_member,r.discord_linked,r.email_508,r.latest_resume].filter(Boolean).length;if(n===`discord`)return e.discord_username||e.discord_user_id||``;if(n===`resume`)return e.latest_resume_name||e.latest_resume_id||``}if(e===`audit`){let e=t;if(n===`actor`)return e.actor_display_name||e.actor_subject||e.actor_provider||``}return t[n]??``}function hn(e,t,n){let r=n.direction===`asc`?1:-1;return[...t].sort((t,i)=>{let a=mn(e,t,n.key),o=mn(e,i,n.key);return typeof a==`number`&&typeof o==`number`?(a-o)*r:String(a).localeCompare(String(o),void 0,{numeric:!0})*r})}function gn({label:e,scope:t,sort:n,sortKey:r,onSort:i}){let a=n.key===r,o=n.direction===`asc`?`↑`:`↓`;return(0,L.jsx)(`button`,{type:`button`,"data-sort-scope":t,"data-sort-key":r,className:`text-left font-[inherit] text-inherit hover:text-foreground`,onClick:()=>i(t,r),children:a?`${e} ${o}`:e})}function _n({className:e,label:t,scope:n,sort:r,sortKey:i,onSort:a}){return(0,L.jsx)(U,{className:e,"aria-sort":r.key===i?r.direction===`asc`?`ascending`:`descending`:`none`,children:(0,L.jsx)(gn,{label:t,scope:n,sort:r,sortKey:i,onSort:a})})}function vn({label:e,value:t,id:n}){return(0,L.jsxs)(It,{className:`p-4`,children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:e}),(0,L.jsx)(`strong`,{id:n,className:`block text-2xl`,children:t})]})}function yn({children:e,hidden:t}){return t?null:(0,L.jsx)(`div`,{className:`px-4 py-7 text-center text-sm text-muted-foreground`,children:e})}function bn({value:e,query:t}){let n=t.trim().toLowerCase();if(!n)return(0,L.jsx)(L.Fragment,{children:e});let r=e.toLowerCase(),i=[],a=0,o=r.indexOf(n);for(;o>=0;){o>a&&i.push(e.slice(a,o));let t=o+n.length;i.push((0,L.jsx)(`mark`,{className:`rounded-sm bg-amber-200 px-0.5 text-inherit dark:bg-amber-500/35`,children:e.slice(o,t)},`${o}-${t}`)),a=t,o=r.indexOf(n,a)}return avoid 0);function ut(e){return s.includes(e)}function dt(e){return s.includes(`${e}:dry_run`)}function ft(e){return ut(e)||dt(e)}function pt(e){return ut(on[e])}function mt(){return Object.keys(an).find(e=>pt(e))||`people`}function N(e,t){o({message:e,tone:t})}function P(e,t){N(un(e,t),`error`)}function F(e,t){xe(n=>({...n,[e]:t}))}function ht(e,t=!1){let n=e;pt(n)||(N(`${n[0].toUpperCase()}${n.slice(1)} requires SSO validation`,`error`),n=mt()),n!==`gigs`&&ce(``),n!==`projects`&&ue(``),n===`gigs`&&t&&ce(``),n===`projects`&&t&&ue(``),i(n),t?window.history.pushState({view:n},``,an[n]):(!Object.hasOwn(an,dn())||n!==e)&&window.history.replaceState({view:n},``,an[n])}M.current=ht;function gt(e){return!u||!e?``:`${u}/#Contact/view/${encodeURIComponent(e)}`}function _t(e){return!u||!e?``:`${u}/api/v1/Attachment/file/${encodeURIComponent(e)}`}function vt(e,t){De(n=>{let r=n[e];return{...n,[e]:{key:t,direction:r.key===t&&r.direction===`asc`?`desc`:`asc`}}})}function yt(e){ce(e),se(m.find(t=>t.id===e)||null),i(`gigs`),window.history.pushState({view:`gigs`,gigId:e},``,`/dashboard/gigs/${encodeURIComponent(e)}`)}function bt(){ce(``),se(null),window.history.replaceState({view:`gigs`},``,an.gigs)}function xt(e){ue(e),i(`projects`),window.history.pushState({view:`projects`,projectId:e},``,`/dashboard/projects/${encodeURIComponent(e)}`)}function St(){ue(``),window.history.replaceState({view:`projects`},``,an.projects)}async function Ct(){let e=await G(`/dashboard/api/me`);n(e);let t=Array.isArray(e.permissions)?e.permissions:[];return c(t),d((e.crm_base_url||``).replace(/\/+$/,``)),t}function wt(){let e=new URLSearchParams({minutes:Oe,limit:`100`});return Ae&&e.set(`status`,Ae),Me.trim()&&e.set(`type`,Me.trim()),`/dashboard/api/jobs?${e.toString()}`}function Tt(){let e=new URLSearchParams({limit:String(Ie)});return Pe&&e.set(`status`,Pe),`/dashboard/api/gigs?${e.toString()}`}function Et(){let e=new URLSearchParams({limit:`100`,status:Be});return Re.trim()&&e.set(`query`,Re.trim()),`/dashboard/api/projects?${e.toString()}`}async function Dt(){F(`jobs`,!0),N(`Loading jobs`);try{let e=await G(wt());p(e),N(`Loaded ${e.length} jobs`,`ok`)}catch(e){P(e,`Unable to load jobs`)}finally{F(`jobs`,!1)}}async function Ot(){F(`gigs`,!0);try{let e=await G(Tt());v(e),N(`Loaded ${e.length} gig${e.length===1?``:`s`}`,`ok`),Ht()}catch(e){P(e,`Unable to load gigs`)}finally{F(`gigs`,!1)}}async function kt(){F(`projects`,!0);try{let e=await G(Et());S(e.projects||[]),ne(e.summary||{}),N(`Loaded ${(e.projects||[]).length} project${(e.projects||[]).length===1?``:`s`}`,`ok`)}catch(e){P(e,`Unable to load projects`)}finally{F(`projects`,!1)}}async function At(){F(`syncProjects`,!0),N(`Queueing project sync`);try{let e=await G(`/dashboard/api/sync/projects`,{method:`POST`});e.dry_run?N(`Dry run only: would queue ${e.would_enqueue?.job_type||`project sync`}`,`warning`):N(`Queued project sync ${e.job_id}`,`ok`)}catch(e){P(e,`Unable to queue project sync`)}finally{F(`syncProjects`,!1)}}async function jt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/customers?${new URLSearchParams({query:t}).toString()}`)).customers||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search customers`,`error`),[]}}async function Mt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/contacts?${new URLSearchParams({query:t}).toString()}`)).contacts||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search contacts`,`error`),[]}}async function Nt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/account-managers?${new URLSearchParams({query:t}).toString()}`)).users||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search account managers`,`error`),[]}}async function Pt(){try{let e=(await G(`/dashboard/api/erpnext/cost-centers`)).cost_centers||[];return e.length?e:[{name:`Projects - 5`,cost_center_name:`Projects`}]}catch(e){return N(e instanceof Error?e.message:`Unable to load cost centers`,`error`),[{name:`Projects - 5`,cost_center_name:`Projects`}]}}async function R(e){F(`createProject`,!0);try{let t=await G(`/dashboard/api/projects/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return t.project.id?(S(e=>e.some(e=>e.id===t.project.id)?e.map(e=>e.id===t.project.id?t.project:e):[t.project,...e]),N(`Created ERP project setup`,`ok`),xt(t.project.id)):(N(t.cache_refresh_message||`Created ERP project in ERPNext; local sync is pending`,`ok`),kt()),!0}catch(e){return N(e instanceof Error?e.message:`Unable to create project`,`error`),!1}finally{F(`createProject`,!1)}}async function Ft(e,t){F(`project:${e}:status`,!0);try{let n=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})});S(t=>t.map(t=>t.id===e?n.project:t)),N(`Updated project status`,`ok`)}catch(e){P(e,`Unable to update project`)}finally{F(`project:${e}:status`,!1)}}async function It(e,t){if(e.length===0)return!1;F(`projectsBulkUpdate`,!0);try{let n=await G(`/dashboard/api/projects/bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project_ids:e,...t})}),r=n.projects||[];S(e=>e.map(e=>r.find(t=>t.id===e.id)||e));let i=n.failures||[];return N(i.length?`Updated ${r.length}; ${i.length} failed`:`Updated ${r.length} project${r.length===1?``:`s`}`,i.length?`error`:`ok`),i.length===0}catch(e){return P(e,`Unable to bulk update projects`),!1}finally{F(`projectsBulkUpdate`,!1)}}async function B(e,t,n,r){let i=t.trim(),a=n.trim();if(!i||!a)return!1;F(`project:${e}:user`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/users`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({user:i,candidate_id:a,...r||{}})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(t.activity_cost_error?`Added project user; rate failed`:t.activity_cost?`Added project user and rate`:`Added project user`,t.activity_cost_error?`error`:`ok`),!0}catch(e){return P(e,`Unable to add project user`),!1}finally{F(`project:${e}:user`,!1)}}async function Lt(e,t){let n=t.trim();if(!n)return!1;F(`project:${e}:user`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/users/remove`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({user:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(`Removed project user`,`ok`),!0}catch(e){return N(e instanceof Error?e.message:`Unable to remove project user`,`error`),!1}finally{F(`project:${e}:user`,!1)}}async function Rt(e,t,n){let r=t.trim();if(!r)return!1;F(`project:${e}:historical`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/historical-members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({person:r,candidate_id:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),Te(null),N(`Added historical project member`,`ok`),!0}catch(t){if(t instanceof cn&&t.status===409){let n=t.payload?.candidates||[];if(n.length>0)return Te({projectId:e,person:r,candidates:n}),N(`Choose the matching person record`,`error`),!1}return P(t,`Unable to add historical member`),!1}finally{F(`project:${e}:historical`,!1)}}async function V(e,t){let n=t.trim();if(!n)return!1;F(`project:${e}:historical`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/historical-members/remove`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({source_user_id:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(`Removed historical project member`,`ok`),!0}catch(e){return N(e instanceof Error?e.message:`Unable to remove historical member`,`error`),!1}finally{F(`project:${e}:historical`,!1)}}async function H(e,t,n){F(`project:${e}:wiki`,!0);try{await G(`/dashboard/api/projects/${encodeURIComponent(e)}/wiki-match`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t,row_key:n})}),N(t===`no_row`?`Marked as no wiki row`:`Confirmed wiki match`,`ok`),await zt()}catch(e){P(e,`Unable to save wiki match`)}finally{F(`project:${e}:wiki`,!1)}}async function zt(){F(`wikiMatches`,!0);try{ae(await G(`/dashboard/api/projects/wiki-matches`)),N(`Loaded wiki match preview`,`ok`)}catch(e){P(e,`Unable to load wiki matches`)}finally{F(`wikiMatches`,!1)}}async function Bt(e){F(`gig:${e}:detail`,!0);try{se(await G(`/dashboard/api/gigs/${encodeURIComponent(e)}`))}catch(e){se(null),P(e,`Unable to load gig`)}finally{F(`gig:${e}:detail`,!1)}}async function Vt(){await Ot(),w&&await Bt(w)}async function Ht(){if(ut(`gigs:read`)){F(`notifications`,!0);try{let e=await G(`/dashboard/api/notifications?limit=20`);Ue(e.stale_days||7),E(e.notifications||[])}catch(e){P(e,`Unable to load notifications`)}finally{F(`notifications`,!1)}}}async function Ut(e,t){F(`gig:${e}:status`,!0);try{let n=(await G(`/dashboard/api/gigs/${encodeURIComponent(e)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})})).discord_title_sync?.status;N(n===`error`?`Updated gig status; Discord title sync failed`:`Updated gig status`,n===`error`?`error`:`ok`),await Ot(),w===e&&await Bt(e)}catch(e){P(e,`Unable to update gig`)}finally{F(`gig:${e}:status`,!1)}}async function U(e,t,n){F(`application:${t}:status`,!0);try{await G(`/dashboard/api/gigs/${encodeURIComponent(e)}/applications/${encodeURIComponent(t)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:n})}),N(`Updated candidate status`,`ok`),await Ot(),w===e&&await Bt(e)}catch(e){P(e,`Unable to update candidate`)}finally{F(`application:${t}:status`,!1)}}function W(){let e=new URLSearchParams({limit:`25`});A.trim()&&e.set(`query`,A.trim()),Ge&&e.set(`is_member`,Ge);for(let[t,n]of Object.entries(qe))n&&e.set(t,n);return`/dashboard/api/people?${e.toString()}`}async function Wt(){F(`people`,!0);try{D(await G(W()))}catch(e){P(e,`Unable to load people`)}finally{F(`people`,!1)}}function Gt(){let e=new URLSearchParams({limit:`25`});j.trim()&&e.set(`query`,j.trim()),et&&e.set(`onboarding_state`,et),nt.trim()&&e.set(`onboarder`,nt.trim());for(let[t,n]of Object.entries(it))n&&e.set(t,n);return`/dashboard/api/onboarding?${e.toString()}`}async function Kt(){F(`onboarding`,!0);try{k(await G(Gt()))}catch(e){P(e,`Unable to load onboarding`)}finally{F(`onboarding`,!1)}}async function qt(){F(`audit`,!0);try{he(await G(`/dashboard/api/audit-events?limit=25`))}catch(e){P(e,`Unable to load audit events`)}finally{F(`audit`,!1)}}async function Jt(){F(`agent`,!0);try{_e(await G(`/dashboard/api/agent?limit=100`))}catch(e){P(e,`Unable to load agent report`)}finally{F(`agent`,!1)}}async function Yt(e){F(`detail:${e}`,!0),N(`Loading ${e}`);try{ye(await G(`/dashboard/api/jobs/${encodeURIComponent(e)}`)),N(`Loaded ${e}`,`ok`)}catch(e){P(e,`Unable to load job detail`)}finally{F(`detail:${e}`,!1)}}async function Xt(e){F(`rerun:${e}`,!0),N(`Rerunning ${e}`);try{let t=await G(`/dashboard/api/jobs/${encodeURIComponent(e)}/rerun`,{method:`POST`});t.dry_run?N(`Dry run only: would rerun ${t.would_enqueue?.job_type||e}`,`warning`):(N(`Queued rerun ${t.job_id}`,`ok`),await Dt())}catch(e){P(e,`Unable to rerun job`)}finally{F(`rerun:${e}`,!1)}}async function Zt(){F(`syncPeople`,!0),N(`Queueing people sync`);try{let e=await G(`/dashboard/api/sync/people`,{method:`POST`});e.dry_run?N(`Dry run only: would queue ${e.would_enqueue?.job_type||`people sync`}`,`warning`):N(`Queued people sync ${e.job_id}`,`ok`)}catch(e){P(e,`Unable to queue people sync`)}finally{F(`syncPeople`,!1)}}async function Qt(e,t){let n=String(e||``).trim(),r=t.trim();if(!n){N(`Missing CRM contact id`,`error`);return}if(!r){N(`Enter a 508 username`,`error`);return}F(`onboarder:${n}`,!0),N(`Assigning ${r}`);try{let e=await G(`/dashboard/api/onboarding/${encodeURIComponent(n)}/onboarder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({onboarder:r})});k(t=>t.map(t=>t.crm_contact_id===e.contact_id?{...t,onboarder:e.onboarder,onboarding_state:e.state_updated&&e.onboarding_state?e.onboarding_state:t.onboarding_state,onboarding_status_label:e.onboarding_status_label||(e.state_updated?void 0:t.onboarding_status_label)}:t)),N(`Assigned ${e.onboarder}`,`ok`)}catch(e){P(e,`Unable to assign onboarder`)}finally{F(`onboarder:${n}`,!1)}}async function $t(e){let t=e.email.trim().toLowerCase(),n=e.first_name.trim();if(!t?.endsWith(`@508.dev`))return N(`Enter the engineer's @508.dev email`,`error`),null;if(!n)return N(`Enter the engineer name`,`error`),null;F(`engineerSetup`,!0);try{let r=await G(`/dashboard/api/onboarding/engineers`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,email:t,first_name:n})});return N(`Set up ${r.employee_name||r.user||t}`,`ok`),r}catch(e){if(e instanceof cn&&e.status===409){let t=e.payload&&typeof e.payload==`object`?e.payload:null,n=(Array.isArray(t?.matches)?t.matches:[]).map(e=>e?.label||e?.email).filter(Boolean).slice(0,2).join(`, `);N(n?`Similar account exists: ${n}`:`Similar account exists; confirm before creating`,`error`)}else N(e instanceof Error?e.message:`Unable to set up engineer`,`error`);return null}finally{F(`engineerSetup`,!1)}}async function en(){F(`logout`,!0);try{let e=await G(`/auth/logout`,{method:`POST`});window.location.assign(e.end_session_url||`/dashboard`)}catch(e){P(e,`Unable to log out`),F(`logout`,!1)}}(0,l.useEffect)(()=>{Ct().then(e=>{let t=fn(),n=e.includes(on[t])?t:Object.keys(an).find(t=>e.includes(on[t]))||`people`;ce(n===`gigs`?pn():``),ue(n===`projects`?pn(`projects`):``),i(n),(!Object.hasOwn(an,dn())||n!==t)&&window.history.replaceState({view:n},``,an[n])}).catch(e=>{P(e,`Dashboard failed to load`)})},[]),(0,l.useEffect)(()=>{let e=()=>{ce(pn()),ue(pn(`projects`)),M.current(fn(),!1)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(!a.message)return;let e=window.setTimeout(()=>o({message:``}),4500);return()=>window.clearTimeout(e)},[a.message]),(0,l.useEffect)(()=>{},[]),(0,l.useEffect)(()=>{s.length!==0&&(ut(`gigs:read`)&&Ht(),r===`people`&&Wt(),r===`gigs`&&Ot(),r===`projects`&&kt(),r===`onboarding`&&Kt(),r===`jobs`&&Dt(),r===`agent`&&Jt(),r===`audit`&&qt())},[r]),(0,l.useEffect)(()=>{s.length!==0&&(ut(`gigs:read`)&&Ht(),r===`people`&&Wt(),r===`gigs`&&Ot(),r===`projects`&&kt(),r===`onboarding`&&Kt(),r===`jobs`&&Dt(),r===`agent`&&Jt(),r===`audit`&&qt())},[s]),(0,l.useEffect)(()=>{r===`jobs`&&s.length>0&&Dt()},[Oe,Ae]),(0,l.useEffect)(()=>{r===`gigs`&&s.length>0&&Ot()},[Pe,Ie]),(0,l.useEffect)(()=>{r===`projects`&&s.length>0&&kt()},[Be]),(0,l.useEffect)(()=>{r===`gigs`&&w&&s.length>0&&Bt(w)},[r,w,s]),(0,l.useEffect)(()=>{r===`people`&&s.length>0&&Wt()},[Ge]),(0,l.useEffect)(()=>{r===`people`&&s.length>0&&Wt()},[qe]),(0,l.useEffect)(()=>{r===`onboarding`&&s.length>0&&Kt()},[et]),(0,l.useEffect)(()=>{r===`onboarding`&&s.length>0&&Kt()},[it]);let tn=(0,l.useMemo)(()=>hn(`jobs`,f,Ee.jobs),[f,Ee.jobs]),nn=(0,l.useMemo)(()=>hn(`people`,pe,Ee.people),[pe,Ee.people]),rn=(0,l.useMemo)(()=>hn(`onboarding`,O,Ee.onboarding),[O,Ee.onboarding]),ln=(0,l.useMemo)(()=>hn(`gigs`,m,Ee.gigs),[m,Ee.gigs]),mn=(0,l.useMemo)(()=>hn(`projects`,ee,Ee.projects),[ee,Ee.projects]),gn=(0,l.useMemo)(()=>oe?.id===w?oe:ln.find(e=>e.id===w)||null,[oe,w,ln]),_n=(0,l.useMemo)(()=>mn.find(e=>e.id===le)||null,[le,mn]),vn=(0,l.useMemo)(()=>hn(`audit`,me,Ee.audit),[me,Ee.audit]),yn=(0,l.useMemo)(()=>f.reduce((e,t)=>(e[t.status]=(e[t.status]||0)+1,e),{}),[f]),bn=Object.keys(sn).filter(e=>!qe[e]),xn=Object.keys(sn).filter(e=>e!==`sync_status`&&e!==`email_508`&&!it[e]);function Tn(e){e.type===`stale_recruiting_gig`&&(Fe(`recruiting`),ht(`gigs`,!0)),fe(!1)}(0,l.useEffect)(()=>{!bn.includes(Ye)&&bn[0]&&Xe(bn[0])},[bn,Ye]),(0,l.useEffect)(()=>{let e=sn[Ye]?.options;e?.[0]&&!e.some(([e])=>e===Ze)&&Qe(e[0][0])},[Ye,Ze]),(0,l.useEffect)(()=>{!xn.includes(ot)&&xn[0]&&st(xn[0])},[xn,ot]),(0,l.useEffect)(()=>{let e=sn[ot]?.options;e?.[0]&&!e.some(([e])=>e===ct)&<(e[0][0])},[ot,ct]);let En=[t?.email,t?.crm_contact_id?`CRM ${t.crm_contact_id}`:``,t?.actor_provider].filter(Boolean).join(` | `);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`header`,{className:`sticky top-0 z-20 border-b bg-background/90 backdrop-blur`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-4 px-5 py-4 md:flex-row md:items-center md:justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-xl font-bold`,children:`508 Operations Dashboard`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Operations view for authenticated 508 operators.`})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[ut(`gigs:read`)?(0,L.jsx)(`div`,{className:`relative`,children:(0,L.jsxs)(z,{id:`notifications`,type:`button`,variant:`outline`,size:`icon`,"aria-label":`Notifications`,"aria-expanded":de,onClick:()=>fe(e=>!e),children:[(0,L.jsx)(h,{}),T.length>0?(0,L.jsx)(`span`,{className:`absolute -right-1 -top-1 grid min-h-5 min-w-5 place-items-center rounded-full bg-red-500 px-1 text-[11px] font-bold text-white`,children:T.length}):null]})}):null,(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-0.5 text-right text-sm text-muted-foreground`,children:[(0,L.jsx)(`strong`,{id:`userName`,className:`truncate text-foreground`,children:t?.display_name||t?.email||t?.subject||`Loading user`}),(0,L.jsx)(`span`,{id:`userMeta`,className:`truncate`,children:En||`Checking session`})]}),(0,L.jsxs)(z,{id:`logout`,type:`button`,variant:`outline`,onClick:en,disabled:be.logout,children:[(0,L.jsx)(x,{}),`Log out`]})]})]})}),(0,L.jsx)(Sn,{open:de,notifications:T,loading:be.notifications,onClose:()=>fe(!1),onRefresh:Ht,onOpenNotification:Tn}),(0,L.jsx)(wn,{toast:a}),null,(0,L.jsx)(Cn,{choice:we,loading:!!(we&&be[`project:${we.projectId}:historical`]),crmContactUrl:gt,onClose:()=>Te(null),onChoose:e=>{we&&Rt(we.projectId,we.person,e)}}),(0,L.jsxs)(`main`,{className:`mx-auto grid max-w-7xl grid-cols-1 gap-5 px-5 py-5 md:grid-cols-[190px_minmax(0,1fr)]`,children:[(0,L.jsx)(`nav`,{className:`grid content-start gap-1 md:sticky md:top-24`,"aria-label":`Dashboard sections`,children:[[`people`,`People`,ie],[`gigs`,`Gigs`,g],[`projects`,`Projects`,b],[`onboarding`,`Onboarding`,_],[`jobs`,`Jobs`,g],[`agent`,`Agent`,te],[`audit`,`Audit`,y]].filter(([e])=>pt(e)).map(([e,t,n])=>(0,L.jsxs)(`a`,{className:I(`flex min-h-10 items-center gap-2 rounded-md border border-transparent px-3 text-sm font-extrabold text-muted-foreground hover:border-border hover:bg-secondary hover:text-foreground`,r===e&&`border-primary bg-accent text-accent-foreground`),"data-view-link":e,"data-permission":on[e],href:an[e],"aria-current":r===e?`page`:void 0,onClick:t=>{t.preventDefault(),ht(e,!0)},children:[(0,L.jsx)(n,{className:`size-4`}),t]},e))}),(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[r===`people`?(0,L.jsx)(Un,{crmBaseUrl:u,people:nn,sort:Ee.people,canSync:ft(`people:sync`),loading:be,peopleQuery:A,peopleMember:Ge,peopleFilters:qe,peopleFilterKind:Ye,peopleFilterValue:Ze,peopleFilterKeys:bn,onSearch:Wt,onSync:Zt,onSort:e=>vt(`people`,e),setPeopleQuery:We,setPeopleMember:Ke,setPeopleFilterKind:Xe,setPeopleFilterValue:Qe,addFilter:()=>{Je(e=>({...e,[Ye]:Ze}))},removeFilter:e=>{Je(t=>{let n={...t};return delete n[e],n})},crmContactUrl:gt,crmAttachmentUrl:_t}):null,r===`gigs`?(0,L.jsx)(Rn,{gigs:ln,selectedGig:gn,selectedGigId:w,sort:Ee.gigs,loading:be,status:Pe,limit:Ie,staleDays:He,canWrite:ut(`gigs:write`),crmContactUrl:gt,crmAttachmentUrl:_t,setStatus:Fe,setLimit:Le,onRefresh:Vt,onSort:e=>vt(`gigs`,e),onOpenGig:yt,onCloseGig:bt,onUpdateStatus:Ut,onUpdateApplicationStatus:U}):null,r===`projects`?(0,L.jsx)(Fn,{projects:mn,selectedProject:_n,selectedProjectId:le,summary:C,wikiMatches:re,sort:Ee.projects,loading:be,query:Re,status:Be,canSync:ft(`projects:sync`),canWrite:ut(`projects:write`),crmContactUrl:gt,setQuery:ze,setStatus:Ve,onSearch:kt,onSync:At,onSearchCustomers:jt,onSearchContacts:Mt,onSearchAccountManagers:Nt,onLoadCostCenters:Pt,onCreateProject:R,onUpdateStatus:Ft,onBulkUpdate:It,onAddUser:B,onRemoveUser:Lt,onAddHistoricalMember:Rt,onRemoveHistoricalMember:V,onUpdateWikiMatch:H,onWikiMatches:zt,onOpenProject:xt,onCloseProject:St,onSort:e=>vt(`projects`,e)}):null,r===`onboarding`?(0,L.jsx)(Wn,{people:rn,sort:Ee.onboarding,loading:be,onboardingQuery:j,onboardingState:et,onboarderFilter:nt,onboardingFilters:it,onboardingFilterKind:ot,onboardingFilterValue:ct,onboardingFilterKeys:xn,onSearch:Kt,onSort:e=>vt(`onboarding`,e),onAssign:Qt,onSetupEngineer:$t,setOnboardingQuery:$e,setOnboardingState:tt,setOnboarderFilter:rt,setOnboardingFilterKind:st,setOnboardingFilterValue:lt,addFilter:()=>{at(e=>({...e,[ot]:ct}))},removeFilter:e=>{at(t=>{let n={...t};return delete n[e],n})},crmContactUrl:gt,crmAttachmentUrl:_t,canWrite:ut(`onboarding:write`)}):null,r===`jobs`?(0,L.jsx)(Qn,{jobs:tn,jobDetail:ve,sort:Ee.jobs,loading:be,minutes:Oe,status:Ae,jobType:Me,jobCounts:yn,canWrite:ft(`jobs:write`),setMinutes:ke,setStatus:je,setJobType:Ne,onSearch:Dt,onSort:e=>vt(`jobs`,e),onDetail:Yt,onRerun:Xt}):null,r===`audit`?(0,L.jsx)($n,{events:vn,sort:Ee.audit,loading:be,onRefresh:qt,onSort:e=>vt(`audit`,e)}):null,r===`agent`?(0,L.jsx)(er,{report:ge,loading:be,onRefresh:Jt}):null]})]})]})}function Sn({open:e,notifications:t,loading:n,onClose:r,onRefresh:i,onOpenNotification:a}){return e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-40`,"aria-labelledby":`notificationsTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close notifications`,onClick:r}),(0,L.jsxs)(`aside`,{className:`absolute right-0 top-0 grid h-full w-full max-w-md grid-rows-[auto_minmax(0,1fr)] border-l bg-background shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b p-4`,children:[(0,L.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,L.jsx)(`strong`,{id:`notificationsTitle`,className:`text-base`,children:`Notifications`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.length===0?`No active notifications`:`${t.length} active`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,onClick:i,disabled:n,children:[(0,L.jsx)(S,{}),`Refresh`]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,onClick:r,children:(0,L.jsx)(ae,{})})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 overflow-auto p-4`,children:t.length===0?(0,L.jsx)(`div`,{className:`rounded-md border border-dashed p-6 text-sm text-muted-foreground`,children:`No active notifications.`}):(0,L.jsx)(`div`,{className:`grid gap-3`,children:t.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`grid gap-2 rounded-md border p-3 text-left hover:bg-secondary`,onClick:()=>a(e),children:[(0,L.jsx)(`span`,{className:`text-sm font-bold`,children:e.title}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.message})]},e.id))})})]})]}):null}function Cn({choice:e,loading:t,crmContactUrl:n,onClose:r,onChoose:i}){return e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`historicalPersonChoiceTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close person selection`,onClick:r}),(0,L.jsxs)(`div`,{className:`relative grid w-full max-w-2xl gap-4 rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`historicalPersonChoiceTitle`,className:`block text-base`,children:`Choose person record`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.person})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close person selection`,onClick:r,children:(0,L.jsx)(ae,{})})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:e.candidates.map(e=>(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`strong`,{className:`block truncate`,children:e.label||e.full_name||e.email||`Person`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:[e.email?(0,L.jsx)(`span`,{children:e.email}):null,e.sources?.length?(0,L.jsx)(`span`,{children:e.sources.join(`, `)}):null,e.erpnext_user_id?(0,L.jsxs)(`span`,{children:[`ERP `,e.erpnext_user_id]}):null,e.supplier_erpnext_id?(0,L.jsxs)(`span`,{children:[`Supplier `,e.supplier_erpnext_id]}):null,e.crm_contact_id&&n(e.crm_contact_id)?(0,L.jsx)(`a`,{className:`font-semibold text-primary underline-offset-4 hover:underline`,href:n(e.crm_contact_id),target:`_blank`,rel:`noreferrer`,children:`CRM`}):null]})]}),(0,L.jsx)(z,{type:`button`,disabled:t,onClick:()=>i(e.candidate_id),children:`Select`})]},e.candidate_id))})]})]}):null}function wn({toast:e}){return e.message?(0,L.jsx)(`div`,{id:`toast`,role:`status`,className:I(`fixed bottom-5 right-5 z-50 max-w-sm rounded-md border bg-background px-4 py-3 text-sm font-semibold shadow-lg`,e.tone===`ok`&&`border-emerald-500/40 text-emerald-300`,e.tone===`warning`&&`border-amber-500/40 text-amber-200`,e.tone===`error`&&`border-red-500/40 text-red-300`),children:e.message}):null}function Tn({filters:e,onRemove:t,suffix:n=`filter`}){return(0,L.jsx)(`fieldset`,{className:`m-0 flex min-h-7 flex-wrap gap-2 border-0 p-0`,"aria-label":`Active filters`,children:Object.entries(e).map(([e,r])=>{let i=sn[e],a=i.options.find(([e])=>e===r),o=`${i.label}: ${a?a[1]:r}`;return(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,"aria-label":`Remove ${o} ${n}`,onClick:()=>t(e),children:[o,` x`]},e)})})}var En=[`recruiting`,`filled`,`unknown`,`lost`,`outdated`],Dn=[`suggested`,`interested`,`reviewing`,`contacted`,`accepted`,`rejected`,`withdrawn`];function On(e){return String(e||``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function kn(e){let t=[e.last_activity_at,e.last_status_changed_at,e.posted_at,e.created_at].map(e=>e?new Date(e).getTime():NaN).filter(e=>!Number.isNaN(e));return t.length>0?new Date(Math.max(...t)).toISOString():``}function An(e,t){if(e.status!==`recruiting`)return null;let n=Kt(kn(e));return n===null||ne.projects.map(e=>e.id),[e.projects]),h=(0,l.useMemo)(()=>new Set(p),[p]),g=n.filter(e=>h.has(e)),_=e.projects.length>0&&g.length===e.projects.length;(0,l.useEffect)(()=>{r(e=>e.filter(e=>h.has(e)))},[h]);function y(e,t){r(n=>t?Array.from(new Set([...n,e])):n.filter(t=>t!==e))}async function b(){let t={};i&&(t.status=i),o&&(t.project_type=o),await e.onBulkUpdate(g,t)&&(r([]),a(``),s(``),u(!1))}let x=(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-[minmax(0,1fr)_180px_auto_auto_auto] md:items-end`,children:[(0,L.jsxs)(H,{children:[`Search projects`,(0,L.jsx)(V,{id:`projectQuery`,value:e.query,autoComplete:`off`,placeholder:`Project, customer, ERP id`,onChange:t=>e.setQuery(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`projectStatus`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:``,children:`Any status`})]})]}),(0,L.jsxs)(z,{id:`refreshProjects`,type:`button`,onClick:e.onSearch,disabled:e.loading.projects,children:[(0,L.jsx)(S,{}),`Refresh`]}),e.canSync?(0,L.jsxs)(z,{id:`syncProjects`,type:`button`,variant:`outline`,onClick:e.onSync,disabled:e.loading.syncProjects,children:[(0,L.jsx)(S,{}),`Sync ERP`]}):null,(0,L.jsxs)(z,{id:`wikiProjectMatches`,type:`button`,variant:`outline`,onClick:e.onWikiMatches,disabled:e.loading.wikiMatches,children:[(0,L.jsx)(C,{}),`Wiki match`]})]});return e.selectedProjectId&&!e.selectedProject&&e.loading.projects?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Project detail`})}),(0,L.jsx)(Rt,{className:`text-sm text-muted-foreground`,children:`Loading project.`})]})]}):e.selectedProjectId&&!e.selectedProject?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Project detail`})}),(0,L.jsxs)(Rt,{className:`grid gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This project is not in the current result set. Clear filters or refresh the project list.`}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onCloseProject,children:[(0,L.jsx)(m,{}),`Back to projects`]})]})]})]}):e.selectedProject?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsx)(Ln,{project:e.selectedProject,loading:e.loading,canWrite:e.canWrite,crmContactUrl:e.crmContactUrl,onBack:e.onCloseProject,onUpdateStatus:e.onUpdateStatus,onAddUser:e.onAddUser,onRemoveUser:e.onRemoveUser,onAddHistoricalMember:e.onAddHistoricalMember,onRemoveHistoricalMember:e.onRemoveHistoricalMember})]}):(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-2`,"aria-label":`Project summary`,children:[(0,L.jsx)(vn,{id:`projectMetricOpen`,label:`Open`,value:e.summary.open_project_count||0}),(0,L.jsx)(vn,{id:`projectMetricTotal`,label:`Projects`,value:e.summary.project_count||0})]}),e.canWrite?(0,L.jsxs)(It,{className:`flex flex-wrap items-center justify-between gap-3 p-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Selected`}),(0,L.jsxs)(`strong`,{className:`block`,children:[g.length,` project(s)`]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(z,{type:`button`,onClick:()=>f(!0),children:[(0,L.jsx)(ee,{}),`New project`]}),(0,L.jsx)(z,{type:`button`,variant:`outline`,disabled:g.length===0,onClick:()=>u(!0),children:`Bulk edit`})]})]}):null,d?(0,L.jsx)(In,{loading:e.loading.createProject,onClose:()=>f(!1),onSearchCustomers:e.onSearchCustomers,onSearchContacts:e.onSearchContacts,onSearchAccountManagers:e.onSearchAccountManagers,onLoadCostCenters:e.onLoadCostCenters,onCreateProject:e.onCreateProject}):null,c?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`bulkProjectEditTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close bulk project edit`,onClick:()=>u(!1)}),(0,L.jsxs)(`div`,{className:`relative grid w-full max-w-lg gap-4 rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`bulkProjectEditTitle`,className:`block text-base`,children:`Bulk edit projects`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[g.length,` selected`]})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close bulk project edit`,onClick:()=>u(!1),children:(0,L.jsx)(ae,{})})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsx)(`strong`,{className:`text-sm`,children:`Changes`}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{value:i,onChange:e=>a(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`No change`}),(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:`Completed`,children:`Completed`}),(0,L.jsx)(`option`,{value:`Cancelled`,children:`Cancelled`})]})]}),(0,L.jsxs)(H,{children:[`ERP Type`,(0,L.jsxs)(zt,{value:o,onChange:e=>s(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`No change`}),(0,L.jsx)(`option`,{value:`Internal`,children:`Internal`}),(0,L.jsx)(`option`,{value:`External`,children:`External`})]})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>u(!1),children:`Cancel`}),(0,L.jsx)(z,{type:`button`,disabled:e.loading.projectsBulkUpdate||g.length===0||!i&&!o,onClick:()=>void b(),children:`Apply changes`})]})]})]}):null,(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`ERP projects`}),(0,L.jsx)(`span`,{id:`projectsStatus`,className:`text-sm text-muted-foreground`,children:e.loading.projects?`Loading`:`${e.projects.length} shown | synced ${Gt(e.summary.last_synced_at)}`})]}),(0,L.jsx)(yn,{hidden:e.projects.length!==0,children:`No projects match this view. Sync ERP projects if the cache is empty.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`projectsTable`,className:I(`min-w-[1100px]`,e.projects.length===0&&`hidden`),"aria-label":`ERP projects`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[e.canWrite?(0,L.jsx)(U,{className:`w-[48px]`,children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all visible projects`,checked:_,onChange:e=>{r(e.target.checked?p:[])}})}):null,(0,L.jsx)(_n,{className:`w-[24%]`,label:`Project`,scope:`projects`,sort:e.sort,sortKey:`display_name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[16%]`,label:`Customer`,scope:`projects`,sort:e.sort,sortKey:`customer`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[10%]`,label:`Status`,scope:`projects`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{className:`w-[16%]`,children:`Timeline`}),(0,L.jsx)(_n,{className:`w-[10%]`,label:`Roster`,scope:`projects`,sort:e.sort,sortKey:`roster_count`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[14%]`,label:`Modified`,scope:`projects`,sort:e.sort,sortKey:`modified`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{children:`ERP`})]})}),(0,L.jsx)(Ht,{id:`projectsBody`,children:e.projects.map(t=>{let n=t.roster_members||[];return(0,L.jsxs)(Ut,{children:[e.canWrite?(0,L.jsx)(W,{children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`Select ${t.display_name}`,checked:g.includes(t.id),onChange:e=>y(t.id,e.target.checked)})}):null,(0,L.jsxs)(W,{children:[(0,L.jsx)(`button`,{type:`button`,className:`text-left font-bold text-primary underline-offset-4 hover:underline`,onClick:()=>e.onOpenProject(t.id),children:t.display_name}),(0,L.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[t.project_type?(0,L.jsx)(R,{variant:`neutral`,children:t.project_type}):null,t.linked_engagement_count?(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[t.linked_engagement_count,` linked gig`]}):null]})]}),(0,L.jsx)(W,{children:t.customer_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:t.customer_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[t.customer,(0,L.jsx)(v,{className:`size-3.5`})]}):t.customer||`None`}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:jn(t.source_status),children:t.source_status||`Unknown`})}),(0,L.jsx)(W,{children:[t.actual_start_date,t.actual_end_date].filter(Boolean).map(e=>Mn(e)).join(` to `)||`Not set`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`strong`,{children:n.length}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[n.map(Nn).slice(0,4).join(`, `)||`No ERP roster`,n.length>4?` +${n.length-4}`:``]})]})}),(0,L.jsx)(W,{children:Gt(t.source_modified_at)}),(0,L.jsx)(W,{className:`text-xs`,children:t.erpnext_project_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-mono font-semibold text-primary underline-offset-4 hover:underline`,href:t.erpnext_project_url,target:`_blank`,rel:`noreferrer`,children:[t.erpnext_project_id,(0,L.jsx)(v,{className:`size-3.5`})]}):(0,L.jsx)(`span`,{className:`font-mono`,children:`Unlinked`})})]},t.id)})})]})})]}),e.wikiMatches?(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Wiki match preview`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.wikiMatches.document?.title||`Client & Project Info`,` |`,` `,Gt(e.wikiMatches.document?.updatedAt)]})]}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`wikiMatchesTable`,className:`min-w-[920px]`,"aria-label":`Wiki matches`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`ERP project`}),(0,L.jsx)(U,{children:`Best wiki row`}),(0,L.jsx)(U,{children:`Confidence`}),(0,L.jsx)(U,{children:`Section`}),(0,L.jsx)(U,{children:`Decision`})]})}),(0,L.jsx)(Ht,{children:t.map((t,n)=>{let r=t.project,i=t.best_match?.row||{},a=t.manual_match?.match_status||``,o=r?.id||i.row_key||[i.section,i.Client].filter(Boolean).join(`:`)||`wiki-match-${n}`;return(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:r?.display_name||`Unknown`}),(0,L.jsxs)(W,{children:[(0,L.jsx)(`strong`,{children:i.Client||`No match`}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:[i.DRI,i.Members].filter(Boolean).join(` | `)})]}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:t.best_match?.confidence===`high`?`succeeded`:t.best_match?.confidence===`medium`?`running`:`neutral`,children:t.best_match?`${t.best_match.confidence} ${t.best_match.score}`:`none`})}),(0,L.jsx)(W,{children:i.section||``}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,L.jsx)(R,{variant:a===`confirmed`?`succeeded`:`neutral`,children:a===`no_row`?`No wiki row`:`Confirmed`}):null,e.canWrite&&r?.id?(0,L.jsxs)(L.Fragment,{children:[i.row_key?(0,L.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:e.loading[`project:${r.id}:wiki`],onClick:()=>void e.onUpdateWikiMatch(r.id,`confirmed`,i.row_key),children:`Confirm`}):null,(0,L.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:e.loading[`project:${r.id}:wiki`],onClick:()=>void e.onUpdateWikiMatch(r.id,`no_row`),children:`No row`})]}):null]})})]},o)})})]})})]}):null]})}function In(e){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`new`),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)([]),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),[v,y]=(0,l.useState)([]),[b,x]=(0,l.useState)(`USD`),[ee,S]=(0,l.useState)(``),[C,te]=(0,l.useState)(``),[ne,re]=(0,l.useState)(``),[ie,oe]=(0,l.useState)(``),[se,w]=(0,l.useState)(``),[ce,le]=(0,l.useState)(``),[ue,T]=(0,l.useState)(`United States`),[E,de]=(0,l.useState)(``),[fe,pe]=(0,l.useState)(`new`),[D,O]=(0,l.useState)(``),[k,me]=(0,l.useState)(``),[he,ge]=(0,l.useState)([]),[_e,ve]=(0,l.useState)(``),[ye,be]=(0,l.useState)(``),[xe,Se]=(0,l.useState)(``),[Ce,we]=(0,l.useState)(``),[Te,Ee]=(0,l.useState)(``),[De,Oe]=(0,l.useState)(!1),[ke,Ae]=(0,l.useState)([{name:`Projects - 5`,cost_center_name:`Projects`}]),[je,Me]=(0,l.useState)(`Projects - 5`),[Ne,Pe]=(0,l.useState)(``),[Fe,Ie]=(0,l.useState)(!1),Le=(0,l.useRef)(e.onSearchCustomers),Re=(0,l.useRef)(e.onSearchContacts),ze=(0,l.useRef)(e.onSearchAccountManagers),Be=(0,l.useRef)(e.onLoadCostCenters),Ve=(0,l.useRef)(0),He=(0,l.useRef)(0),Ue=(0,l.useRef)(0),A=(0,l.useRef)(0),We=t.trim()?`Engineering for ${t.trim()}`.slice(0,140):``,Ge=[ne,ie,se,ce,E].some(e=>e.trim()),Ke=[_e,ye,xe,Ce,Te].some(e=>e.trim()),qe=t.trim()&&(r===`new`?a.trim():u.trim())&&!e.loading;(0,l.useEffect)(()=>{Le.current=e.onSearchCustomers},[e.onSearchCustomers]),(0,l.useEffect)(()=>{Re.current=e.onSearchContacts},[e.onSearchContacts]),(0,l.useEffect)(()=>{ze.current=e.onSearchAccountManagers},[e.onSearchAccountManagers]),(0,l.useEffect)(()=>{Be.current=e.onLoadCostCenters},[e.onLoadCostCenters]),(0,l.useEffect)(()=>{let e=!0,t=Ve.current+1;return Ve.current=t,Be.current().then(n=>{!e||Ve.current!==t||(Ae(n),Me(e=>n.some(t=>t.name===e)?e:`Projects - 5`))}),()=>{e=!1}},[]),(0,l.useEffect)(()=>{if(r!==`existing`){He.current+=1,p([]);return}let e=!0,t=He.current+1;He.current=t;let n=window.setTimeout(()=>{Le.current(s).then(n=>{!e||He.current!==t||p(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,s]),(0,l.useEffect)(()=>{if(r!==`new`){Ue.current+=1,y([]);return}let e=!0,t=Ue.current+1;Ue.current=t;let n=window.setTimeout(()=>{ze.current(m).then(n=>{!e||Ue.current!==t||y(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,m]),(0,l.useEffect)(()=>{if(r!==`new`||fe!==`existing`){A.current+=1,ge([]);return}let e=!0,t=A.current+1;A.current=t;let n=window.setTimeout(()=>{Re.current(D).then(n=>{!e||A.current!==t||ge(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,fe,D]);async function Je(){qe&&await e.onCreateProject({project_name:t.trim(),customer_mode:r,customer_name:r===`new`?a.trim():void 0,customer:r===`existing`?u.trim():void 0,account_manager:r===`new`&&g.trim()||void 0,default_billing_currency:r===`new`?b.trim()||`USD`:void 0,default_cost_center:je.trim()||`Projects - 5`,activity_type:Fe&&Ne.trim()||void 0,customer_details:r===`new`&&ee.trim()||void 0,customer_website:r===`new`&&C.trim()||void 0,address_line1:r===`new`&&ne.trim()||void 0,address_line2:r===`new`&&ie.trim()||void 0,address_city:r===`new`&&se.trim()||void 0,address_state:r===`new`&&ce.trim()||void 0,address_country:r===`new`&&ne.trim()?ue.trim()||`United States`:void 0,address_postal_code:r===`new`&&E.trim()||void 0,contact:r===`new`&&fe===`existing`&&k.trim()||void 0,contact_first_name:r===`new`&&fe===`new`&&_e.trim()||void 0,contact_last_name:r===`new`&&fe===`new`&&ye.trim()||void 0,contact_email:r===`new`&&fe===`new`&&xe.trim()||void 0,contact_phone:r===`new`&&fe===`new`&&Ce.trim()||void 0,contact_mobile:r===`new`&&fe===`new`&&Te.trim()||void 0})&&e.onClose()}return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`createProjectTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close project creation`,onClick:e.onClose}),(0,L.jsxs)(`div`,{className:`relative grid max-h-[90vh] w-full max-w-2xl gap-4 overflow-y-auto rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`createProjectTitle`,className:`block text-base`,children:`New ERP project`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Creates a project and links a new or existing customer.`})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close project creation`,onClick:e.onClose,children:(0,L.jsx)(ae,{})})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Project name *`,(0,L.jsx)(V,{value:t,autoComplete:`off`,maxLength:140,placeholder:`Acme Portal`,onChange:e=>n(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Customer`}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`new`,`existing`].map(e=>(0,L.jsx)(z,{type:`button`,variant:r===e?`default`:`outline`,onClick:()=>i(e),children:e===`new`?`New customer`:`Existing customer`},e))})]}),r===`new`?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Customer name *`,(0,L.jsx)(V,{value:a,autoComplete:`off`,maxLength:140,placeholder:`Acme`,onChange:e=>o(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Account manager`,(0,L.jsx)(V,{value:m,autoComplete:`off`,placeholder:`Search @508.dev user`,onChange:e=>{h(e.target.value),_(``)}})]}),m.trim().length>=2?(0,L.jsx)(`div`,{className:`grid max-h-40 gap-2 overflow-y-auto rounded-md border p-2 md:col-span-2`,children:v.length?v.map(e=>{let t=e.email||e.name||``;return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpAccountManager`,value:t,checked:g===t,onChange:()=>{_(t),h(t)}}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:e.full_name||t}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t})]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`No enabled @508.dev users found.`})}):null]}):(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Find customer *`,(0,L.jsx)(V,{value:s,autoComplete:`off`,placeholder:`Search customer`,onChange:e=>c(e.target.value)})]}),(0,L.jsx)(`div`,{className:`grid max-h-48 gap-2 overflow-y-auto rounded-md border p-2`,children:f.length?f.map(e=>{let t=e.name||e.customer_name||``;return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpCustomer`,value:t,checked:u===t,onChange:()=>d(t)}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:e.customer_name||t}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:[t,e.default_currency].filter(Boolean).join(` | `)})]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`Search at least two characters.`})})]}),r===`new`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Customer details`,(0,L.jsx)(`textarea`,{value:ee,className:`min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,maxLength:2e3,placeholder:`More information`,onChange:e=>S(e.target.value)})]}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Website`,(0,L.jsx)(V,{value:C,autoComplete:`url`,placeholder:`https://example.com`,onChange:e=>te(e.target.value)})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`strong`,{className:`text-sm text-foreground`,children:`Contact`}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`new`,`existing`].map(e=>(0,L.jsx)(z,{type:`button`,size:`sm`,variant:fe===e?`default`:`outline`,onClick:()=>pe(e),children:e===`new`?`New`:`Existing`},e))})]}),fe===`new`?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{children:[`First name `,Ke?`*`:``,(0,L.jsx)(V,{value:_e,autoComplete:`given-name`,onChange:e=>ve(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Last name`,(0,L.jsx)(V,{value:ye,autoComplete:`family-name`,onChange:e=>be(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Email`,(0,L.jsx)(V,{value:xe,type:`email`,autoComplete:`email`,onChange:e=>Se(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Phone`,(0,L.jsx)(V,{value:Ce,type:`tel`,autoComplete:`tel`,onChange:e=>we(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Mobile`,(0,L.jsx)(V,{value:Te,type:`tel`,autoComplete:`tel`,onChange:e=>Ee(e.target.value)})]})]}):(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Find contact`,(0,L.jsx)(V,{value:D,autoComplete:`off`,placeholder:`Search name or email`,onChange:e=>O(e.target.value)})]}),(0,L.jsx)(`div`,{className:`grid max-h-48 gap-2 overflow-y-auto rounded-md border p-2`,children:he.length?he.map(e=>{let t=e.name||``,n=e.full_name||t,r=[{key:`company`,value:e.company_name},{key:`email`,value:e.email_id},{key:`phone`,value:e.phone},{key:`mobile`,value:e.mobile_no}].filter(e=>!!e.value);return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpContact`,value:t,checked:k===t,onChange:()=>me(t)}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:(0,L.jsx)(bn,{value:n,query:D})}),r.length?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:r.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0?` | `:``,(0,L.jsx)(bn,{value:e.value,query:D})]},e.key))}):null]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`Search at least two characters.`})})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsx)(`strong`,{className:`text-sm text-foreground md:col-span-2`,children:`Address`}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Address line 1 `,Ge?`*`:``,(0,L.jsx)(V,{value:ne,autoComplete:`address-line1`,onChange:e=>re(e.target.value)})]}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Address line 2`,(0,L.jsx)(V,{value:ie,autoComplete:`address-line2`,onChange:e=>oe(e.target.value)})]}),(0,L.jsxs)(H,{children:[`City`,(0,L.jsx)(V,{value:se,autoComplete:`address-level2`,onChange:e=>w(e.target.value)})]}),(0,L.jsxs)(H,{children:[`State`,(0,L.jsx)(V,{value:ce,autoComplete:`address-level1`,onChange:e=>le(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Postal code`,(0,L.jsx)(V,{value:E,autoComplete:`postal-code`,onChange:e=>de(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Country`,(0,L.jsx)(V,{value:ue,autoComplete:`country-name`,onChange:e=>T(e.target.value)})]})]})]}):null,(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>Oe(e=>!e),children:De?`Hide advanced`:`Show advanced`}),De?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[r===`new`?(0,L.jsxs)(H,{children:[`Billing currency`,(0,L.jsx)(V,{value:b,autoComplete:`off`,maxLength:3,onChange:e=>x(e.target.value.toUpperCase())})]}):null,(0,L.jsxs)(H,{children:[`Cost center`,(0,L.jsx)(zt,{value:je,onChange:e=>Me(e.target.value),children:ke.map(e=>{let t=e.name||``;return(0,L.jsx)(`option`,{value:t,children:[t,e.company].filter(Boolean).join(` | `)},t)})})]}),(0,L.jsxs)(H,{children:[`Activity type`,(0,L.jsx)(V,{value:Fe?Ne:We,autoComplete:`off`,maxLength:140,placeholder:We||`Engineering for project`,onChange:e=>{Ie(!0),Pe(e.target.value)}})]})]}):null]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(z,{type:`button`,disabled:!qe,onClick:()=>void Je(),children:`Create project`})]})]})]})}function Ln(e){let t=e.project,n=t.roster_members||[],[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(``),[h,g]=(0,l.useState)(``),_=[t.actual_start_date||t.expected_start_date,t.actual_end_date||t.expected_end_date].filter(Boolean).map(e=>Mn(e)).join(` to `)||`Not set`,y=typeof t.percent_complete==`number`?`${Math.round(t.percent_complete)}%`:`Not set`,b=a.find(e=>e.candidate_id===s),x=r.trim().includes(`@`)?r.trim().length>=5:r.trim().length>=3,ee=!!(u.trim()||f.trim()||h.trim()),S=Pn(f),C=Pn(h),te=!!((f.trim()||h.trim())&&!u.trim()),re=!!(u.trim()&&(!f.trim()||!h.trim())),ae=!!(f.trim()&&S===void 0)||!!(h.trim()&&C===void 0),oe=te||re||ae||S!==void 0&&S<0||C!==void 0&&C<0,se=ee&&!oe?{activity_type:u.trim(),billing_rate:S,costing_rate:C}:void 0;(0,l.useEffect)(()=>{if(!e.canWrite)return;let t=r.trim();if(s&&b&&t===(b.email||b.label||``))return;if(s&&c(``),!(t.includes(`@`)?t.length>=5:t.length>=3)){o([]);return}let n=new AbortController,i=window.setTimeout(()=>{G(`/dashboard/api/project-member-candidates?query=${encodeURIComponent(t)}`,{signal:n.signal}).then(e=>o(e)).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||o([])})},500);return()=>{n.abort(),window.clearTimeout(i)}},[r,e.canWrite,b,s]);function w(e){c(e.candidate_id),i(e.email||e.label||e.full_name||r)}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[auto_minmax(0,1fr)_auto] md:items-start`,children:[(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onBack,children:[(0,L.jsx)(m,{}),`Projects`]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(Lt,{children:t.display_name}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(R,{variant:jn(t.source_status),children:t.source_status||`Unknown`}),t.erpnext_project_id?(0,L.jsx)(`span`,{className:`font-mono`,children:t.erpnext_project_id}):null,t.last_synced_at?(0,L.jsxs)(`span`,{children:[`Synced `,Gt(t.last_synced_at)]}):null]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-start gap-2 md:justify-end`,children:[e.canWrite?(0,L.jsxs)(zt,{className:`w-[160px]`,"aria-label":`Status for ${t.display_name}`,value:t.source_status||``,disabled:e.loading[`project:${t.id}:status`],onChange:n=>e.onUpdateStatus(t.id,n.target.value),children:[(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:`Completed`,children:`Completed`}),(0,L.jsx)(`option`,{value:`Cancelled`,children:`Cancelled`})]}):null,t.erpnext_project_url?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:t.erpnext_project_url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`ERP project`]}):null,t.customer_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:t.customer_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`ERP customer`]}):null]})]})}),(0,L.jsxs)(Rt,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Customer`}),(0,L.jsx)(`strong`,{className:`block`,children:t.customer||`None`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Timeline`}),(0,L.jsx)(`strong`,{className:`block`,children:_})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Progress`}),(0,L.jsx)(`strong`,{className:`block`,children:y})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Linked Gigs`}),(0,L.jsx)(`strong`,{className:`block`,children:t.linked_engagement_count||0})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`ERP Type`}),(0,L.jsx)(`div`,{className:`mt-1`,children:t.project_type?(0,L.jsx)(R,{variant:`neutral`,children:t.project_type}):(0,L.jsx)(`strong`,{className:`block`,children:`Not set`})})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`ERP Modified`}),(0,L.jsx)(`strong`,{className:`block`,children:Gt(t.source_modified_at)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Cache ID`}),(0,L.jsx)(`strong`,{className:`block break-all font-mono text-xs`,children:t.id})]})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Project roster`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n.length?`${n.length} synced ERP user${n.length===1?``:`s`}`:`No ERP roster`})]}),e.canWrite?(0,L.jsxs)(Rt,{className:`grid gap-3 border-b md:grid-cols-[minmax(260px,1fr)_minmax(180px,.7fr)_minmax(130px,.45fr)_minmax(130px,.45fr)_auto_auto] md:items-end`,children:[(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsxs)(H,{children:[`Person search`,(0,L.jsx)(V,{value:r,autoComplete:`off`,placeholder:`Search @508.dev person`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a.length===1&&w(a[0]))}})]}),x&&!s?(0,L.jsx)(`div`,{className:`absolute z-20 mt-1 max-h-64 w-full overflow-auto rounded-md border bg-background shadow-lg`,children:a.length?a.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`grid w-full gap-0.5 px-3 py-2 text-left hover:bg-secondary focus:bg-secondary focus:outline-none`,onClick:()=>w(e),children:[(0,L.jsx)(`span`,{className:`truncate text-sm font-bold`,children:e.label||e.full_name||e.email||`Person`}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[e.email,e.sources?.join(`, `)].filter(Boolean).join(` | `)})]},e.candidate_id)):(0,L.jsx)(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`No verified @508.dev results`})}):null]}),(0,L.jsxs)(H,{children:[`Activity Type`,(0,L.jsx)(V,{value:u,autoComplete:`off`,placeholder:`Optional rate step`,onChange:e=>d(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Billing rate`,(0,L.jsx)(V,{value:f,inputMode:`decimal`,autoComplete:`off`,placeholder:`USD/hr`,onChange:e=>p(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Costing rate`,(0,L.jsx)(V,{value:h,inputMode:`decimal`,autoComplete:`off`,placeholder:`USD/hr`,onChange:e=>g(e.target.value)})]}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,disabled:e.loading[`project:${t.id}:user`]||!s||!b?.email||oe,onClick:()=>void e.onAddUser(t.id,b?.email||r,s,se).then(e=>{e&&(i(``),o([]),c(``),d(``),p(``),g(``))}),children:[(0,L.jsx)(ie,{}),`Add ERP user`]}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,disabled:e.loading[`project:${t.id}:historical`]||!r.trim(),onClick:()=>void e.onAddHistoricalMember(t.id,r).then(e=>{e&&i(``)}),children:[(0,L.jsx)(ie,{}),`Add historical`]})]}):null,(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{className:`min-w-[860px]`,"aria-label":`Project roster`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Name`}),(0,L.jsx)(U,{children:`Email`}),(0,L.jsx)(U,{children:`ERP user`}),(0,L.jsx)(U,{children:`Links`}),(0,L.jsx)(U,{children:`Source`}),(0,L.jsx)(U,{children:`Last seen`}),e.canWrite?(0,L.jsx)(U,{children:`Actions`}):null]})}),(0,L.jsx)(Ht,{children:n.length?n.map(n=>{let r=Nn(n),i=n.source_user_id||n.email||``,a=n.roster_kind===`historical`||n.source===`manual`;return(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:(0,L.jsx)(`strong`,{children:n.full_name||n.email||n.source_user_id})}),(0,L.jsx)(W,{children:n.email||`None`}),(0,L.jsx)(W,{className:`font-mono text-xs`,children:n.erpnext_user_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:n.erpnext_user_url,target:`_blank`,rel:`noreferrer`,children:[n.source_user_id||`ERP user`,(0,L.jsx)(v,{className:`size-3.5`})]}):n.source_user_id||`Unknown`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n.supplier_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:n.supplier_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[`Supplier`,(0,L.jsx)(v,{className:`size-3.5`})]}):null,n.crm_contact_id&&e.crmContactUrl(n.crm_contact_id)?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:e.crmContactUrl(n.crm_contact_id),target:`_blank`,rel:`noreferrer`,children:[`CRM`,(0,L.jsx)(v,{className:`size-3.5`})]}):null,!n.supplier_erpnext_url&&!(n.crm_contact_id&&e.crmContactUrl(n.crm_contact_id))?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):null]})}),(0,L.jsx)(W,{children:n.roster_kind||n.source||`ERP`}),(0,L.jsx)(W,{children:Gt(n.last_seen_at)}),e.canWrite?(0,L.jsx)(W,{children:(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:!i||e.loading[`project:${t.id}:${a?`historical`:`user`}`],onClick:()=>{window.confirm(`Remove ${r} from this project roster?`)&&(a?e.onRemoveHistoricalMember(t.id,i):e.onRemoveUser(t.id,i))},children:[(0,L.jsx)(ne,{}),`Remove`]})}):null]},`${n.source||``}:${n.source_user_id||n.email}`)}):(0,L.jsx)(Ut,{children:(0,L.jsx)(W,{colSpan:e.canWrite?7:6,className:`text-sm text-muted-foreground`,children:`No roster rows have been synced for this project.`})})})]})})]})]})}function Rn(e){let t=e.gigs.reduce((t,n)=>(t.total+=1,t.applications+=Number(n.application_count||0),t.interested+=Number(n.interested_count||0),An(n,e.staleDays)!==null&&(t.stale+=1),t),{total:0,applications:0,interested:0,stale:0}),n=(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-[minmax(160px,1fr)_auto_auto] md:items-end`,children:[(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`gigStatus`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any status`}),En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))]})]}),(0,L.jsxs)(z,{id:`refreshGigs`,type:`button`,onClick:e.onRefresh,disabled:e.loading.gigs,children:[(0,L.jsx)(S,{}),`Refresh gigs`]}),e.gigs.length>=e.limit?(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>e.setLimit(Math.min(e.limit+100,500)),disabled:e.loading.gigs||e.limit>=500,children:`Load more`}):null]}),r=e.selectedGigId?e.loading[`gig:${e.selectedGigId}:detail`]:!1;return e.selectedGigId&&!e.selectedGig&&(e.loading.gigs||r)?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Gig detail`})}),(0,L.jsx)(Rt,{className:`text-sm text-muted-foreground`,children:`Loading gig.`})]})]}):e.selectedGigId&&!e.selectedGig?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Gig detail`})}),(0,L.jsxs)(Rt,{className:`grid gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This gig is not in the current result set. Clear filters or refresh the gig list.`}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onCloseGig,children:[(0,L.jsx)(m,{}),`Back to gigs`]})]})]})]}):e.selectedGig?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsx)(Vn,{gig:e.selectedGig,loading:e.loading,canWrite:e.canWrite,crmContactUrl:e.crmContactUrl,crmAttachmentUrl:e.crmAttachmentUrl,staleDays:e.staleDays,onBack:e.onCloseGig,onUpdateStatus:e.onUpdateStatus,onUpdateApplicationStatus:e.onUpdateApplicationStatus})]}):(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-4`,"aria-label":`Gig summary`,children:[(0,L.jsx)(vn,{id:`gigMetricTotal`,label:`Gigs`,value:t.total}),(0,L.jsx)(vn,{id:`gigMetricCandidates`,label:`Candidates`,value:t.applications}),(0,L.jsx)(vn,{id:`gigMetricInterested`,label:`Interested`,value:t.interested}),(0,L.jsx)(vn,{id:`gigMetricStale`,label:`Stale recruiting`,value:t.stale})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Discord gigs`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>e.onSort(`activity`),"aria-label":`Sort gigs by activity`,children:[`Activity`,` `,e.sort.key===`activity`?e.sort.direction===`asc`?`↑`:`↓`:``]}),(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>e.onSort(`title`),"aria-label":`Sort gigs by title`,children:[`Title `,e.sort.key===`title`?e.sort.direction===`asc`?`↑`:`↓`:``]}),(0,L.jsx)(`span`,{id:`gigsStatus`,className:`text-sm text-muted-foreground`,children:e.loading.gigs?`Loading`:`${e.gigs.length} shown`})]})]}),(0,L.jsx)(yn,{hidden:e.gigs.length!==0,children:`No gigs match this view.`}),(0,L.jsx)(`div`,{id:`gigsBody`,className:I(`grid gap-3 p-4`,e.gigs.length===0&&`hidden`),children:e.gigs.map(t=>(0,L.jsx)(zn,{gig:t,loading:e.loading,canWrite:e.canWrite,staleDays:e.staleDays,onOpenGig:e.onOpenGig,onUpdateStatus:e.onUpdateStatus},t.id))})]})]})}function zn({gig:e,loading:t,canWrite:n,onOpenGig:r,onUpdateStatus:i,staleDays:a}){let o=Array.isArray(e.applications)?e.applications:[],s=e.discord_guild_id&&e.discord_thread_id?`https://discord.com/channels/${encodeURIComponent(e.discord_guild_id)}/${encodeURIComponent(e.discord_thread_id)}`:``,c=An(e,a);return(0,L.jsxs)(`article`,{className:`grid gap-4 rounded-md border bg-background p-4 lg:grid-cols-[minmax(0,1fr)_220px_180px] lg:items-start`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`a`,{className:`text-base font-extrabold text-primary`,href:`/dashboard/gigs/${encodeURIComponent(e.id)}`,onClick:t=>{t.preventDefault(),r(e.id)},children:e.title||`Untitled gig`}),(0,L.jsx)(R,{variant:e.status===`filled`?`succeeded`:e.status===`lost`?`failed`:`queued`,children:e.status_label||On(e.status)}),c===null?null:(0,L.jsxs)(R,{variant:`running`,children:[c,`d stale`]})]}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.posting_type?(0,L.jsx)(R,{variant:`neutral`,children:On(e.posting_type)}):null,e.discord_channel_name?(0,L.jsxs)(R,{variant:`neutral`,children:[`#`,e.discord_channel_name]}):null,(e.required_skills||[]).slice(0,5).map(e=>(0,L.jsx)(R,{variant:`queued`,children:e},e)),(e.preferred_skills||[]).slice(0,3).map(e=>(0,L.jsx)(R,{variant:`neutral`,children:e},e))]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsxs)(`span`,{children:[`Activity `,Gt(kn(e))||`unknown`]}),(0,L.jsxs)(`span`,{children:[`Posted `,Gt(e.posted_at)||`unknown`]}),s?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:s,target:`_blank`,rel:`noreferrer`,children:`Open Discord thread`}):null]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm lg:grid-cols-1`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`block text-xs font-bold text-muted-foreground`,children:`People`}),(0,L.jsx)(`strong`,{children:e.application_count||o.length}),(0,L.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[Number(e.interested_count||0),` interested`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`block text-xs font-bold text-muted-foreground`,children:`Top candidates`}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:o.slice(0,3).map(e=>Bn(e)).join(`, `)||`None yet`})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[n?(0,L.jsx)(zt,{"aria-label":`Status for ${e.title||`gig`}`,value:e.status,disabled:t[`gig:${e.id}:status`],onChange:t=>i(e.id,t.target.value),children:En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))}):null,(0,L.jsx)(z,{type:`button`,onClick:()=>r(e.id),children:`Manage people`})]})]})}function Bn(e){return e.name||e.email_508||e.discord_username||(typeof e.evaluation?.discord_username==`string`?e.evaluation.discord_username:``)||`Candidate`}function Vn({gig:e,loading:t,canWrite:n,crmContactUrl:r,crmAttachmentUrl:i,staleDays:a,onBack:o,onUpdateStatus:s,onUpdateApplicationStatus:c}){let l=Array.isArray(e.applications)?e.applications:[],u=e.discord_guild_id&&e.discord_thread_id?`https://discord.com/channels/${encodeURIComponent(e.discord_guild_id)}/${encodeURIComponent(e.discord_thread_id)}`:``,d=An(e,a);return(0,L.jsxs)(`div`,{className:`grid gap-5`,children:[(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{className:`items-start`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,className:`w-fit`,onClick:o,children:[(0,L.jsx)(m,{}),`Back to gigs`]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(Lt,{className:`text-xl`,children:e.title||`Untitled gig`}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,L.jsx)(R,{variant:e.status===`filled`?`succeeded`:e.status===`lost`?`failed`:`queued`,children:e.status_label||On(e.status)}),d===null?null:(0,L.jsxs)(R,{variant:`running`,children:[d,`d stale`]}),e.posting_type?(0,L.jsx)(R,{variant:`neutral`,children:On(e.posting_type)}):null,e.discord_channel_name?(0,L.jsxs)(R,{variant:`neutral`,children:[`#`,e.discord_channel_name]}):null,(e.required_skills||[]).map(e=>(0,L.jsx)(R,{variant:`queued`,children:e},e)),(e.preferred_skills||[]).map(e=>(0,L.jsx)(R,{variant:`neutral`,children:e},e))]})]})]}),(0,L.jsxs)(`div`,{className:`grid min-w-[190px] gap-2`,children:[n?(0,L.jsxs)(H,{children:[`Gig status`,(0,L.jsx)(zt,{"aria-label":`Status for ${e.title||`gig`}`,value:e.status,disabled:t[`gig:${e.id}:status`],onChange:t=>s(e.id,t.target.value),children:En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))})]}):null,u?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:u,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`Discord thread`]}):null]})]}),(0,L.jsxs)(Rt,{className:`grid gap-4 lg:grid-cols-[1fr_1fr_1fr]`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Activity`}),(0,L.jsx)(`strong`,{className:`block`,children:Gt(kn(e))||`unknown`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Posted `,Gt(e.posted_at)||`unknown`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`People`}),(0,L.jsx)(`strong`,{className:`block`,children:e.application_count||l.length}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Number(e.interested_count||0),` interested`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Discord`}),(0,L.jsx)(`strong`,{className:`block`,children:e.discord_channel_name||`No channel`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.discord_thread_id?`Thread ${e.discord_thread_id}`:`No thread`})]})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`People`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[l.length,` candidate`,l.length===1?``:`s`]})]}),(0,L.jsx)(yn,{hidden:l.length!==0,children:`No suggested or interested people yet.`}),(0,L.jsx)(`div`,{className:I(`grid gap-3 p-4`,l.length===0&&`hidden`),children:l.map(a=>(0,L.jsx)(Hn,{gigId:e.id,application:a,loading:t,canWrite:n,crmContactUrl:r,crmAttachmentUrl:i,onUpdateApplicationStatus:c},a.id))})]})]})}function Hn({gigId:e,application:t,loading:n,canWrite:r,crmContactUrl:i,crmAttachmentUrl:a,onUpdateApplicationStatus:o}){let s=Bn(t),c=i(t.crm_contact_id),l=a(t.latest_resume_id),u=typeof t.fit_score==`number`?`${Math.round(t.fit_score)}/100`:typeof t.match_score==`number`?t.match_score.toFixed(1):``,d=typeof t.evaluation?.llm_summary==`string`?t.evaluation.llm_summary:``;return(0,L.jsxs)(`div`,{className:`grid gap-2 rounded-md border bg-background p-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:c,target:`_blank`,rel:`noopener noreferrer`,children:s}):(0,L.jsx)(`strong`,{children:s}),(0,L.jsx)(R,{variant:t.status===`interested`?`succeeded`:`neutral`,children:On(t.status)}),(0,L.jsx)(R,{variant:`neutral`,children:On(t.source||`manual_add`)}),u?(0,L.jsxs)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:[`Fit `,u]}):null,c?(0,L.jsx)(`a`,{className:`text-xs font-extrabold text-primary`,href:c,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${s} CRM profile`,children:`CRM profile`}):null,l?(0,L.jsx)(`a`,{className:`text-xs font-extrabold text-primary`,href:l,target:`_blank`,rel:`noopener noreferrer`,children:`Resume`}):null]}),d?(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:d}):null,r?(0,L.jsx)(zt,{"aria-label":`Candidate status for ${s}`,value:t.status||`suggested`,disabled:n[`application:${t.id}:status`],onChange:n=>o(e,t.id,n.target.value),children:Dn.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))}):null]})}function Un(e){let t=sn[e.peopleFilterKind]?.options||[];return(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`People lookup`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e.canSync?(0,L.jsxs)(z,{id:`syncPeople`,"data-permission":`people:sync`,type:`button`,onClick:e.onSync,disabled:e.loading.syncPeople,children:[(0,L.jsx)(S,{}),`Sync people`]}):null,e.crmBaseUrl?(0,L.jsx)(`a`,{id:`crmHomeLink`,className:`text-sm font-extrabold text-primary`,href:e.crmBaseUrl,target:`_blank`,rel:`noreferrer`,children:`Open CRM`}):null,(0,L.jsx)(`span`,{id:`peopleStatus`,className:`text-sm text-muted-foreground`,children:e.loading.people?`Loading`:`${e.people.length} shown`})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b p-4 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Search CRM people cache`,(0,L.jsx)(V,{id:`peopleQuery`,value:e.peopleQuery,autoComplete:`off`,placeholder:`Name, email, CRM id, Discord, resume`,onChange:t=>e.setPeopleQuery(t.target.value),onKeyDown:t=>{t.key===`Enter`&&e.onSearch()}})]}),(0,L.jsxs)(z,{id:`searchPeople`,type:`button`,onClick:e.onSearch,disabled:e.loading.people,children:[(0,L.jsx)(C,{}),`Search`]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b bg-background p-4 md:grid-cols-[minmax(120px,.7fr)_minmax(150px,1fr)_minmax(150px,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Member`,(0,L.jsxs)(zt,{id:`peopleMember`,value:e.peopleMember,onChange:t=>e.setPeopleMember(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any`}),(0,L.jsx)(`option`,{value:`true`,children:`Member`}),(0,L.jsx)(`option`,{value:`false`,children:`Not member`})]})]}),(0,L.jsxs)(H,{children:[`Add filter`,(0,L.jsx)(zt,{id:`peopleFilterKind`,value:e.peopleFilterKind,disabled:e.peopleFilterKeys.length===0,onChange:t=>e.setPeopleFilterKind(t.target.value),children:e.peopleFilterKeys.map(e=>(0,L.jsx)(`option`,{value:e,children:sn[e].label},e))})]}),(0,L.jsxs)(H,{children:[`Value`,(0,L.jsx)(zt,{id:`peopleFilterValue`,value:e.peopleFilterValue,onChange:t=>e.setPeopleFilterValue(t.target.value),children:t.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})]}),(0,L.jsx)(z,{id:`addPeopleFilter`,type:`button`,onClick:e.addFilter,disabled:e.peopleFilterKeys.length===0,children:`Add filter`}),(0,L.jsx)(`div`,{id:`activePeopleFilters`,className:`md:col-span-4`,children:(0,L.jsx)(Tn,{filters:e.peopleFilters,onRemove:e.removeFilter})})]}),(0,L.jsx)(yn,{hidden:e.people.length!==0,children:`No people match this lookup.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`peopleTable`,className:I(`min-w-[900px]`,e.people.length===0&&`hidden`),"aria-label":`People lookup results`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[27%]`,label:`Name`,scope:`people`,sort:e.sort,sortKey:`name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Status`,scope:`people`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[20%]`,label:`Discord`,scope:`people`,sort:e.sort,sortKey:`discord`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[25%]`,label:`Resume / skills`,scope:`people`,sort:e.sort,sortKey:`resume`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`peopleBody`,children:e.people.map(t=>{let n=t.name||t.email_508||t.email||`CRM contact`,r=e.crmContactUrl(t.crm_contact_id),i=t.profile_status||{},a=Number(i.skills_count||0),o=e.crmAttachmentUrl(t.latest_resume_id);return(0,L.jsxs)(Ut,{children:[(0,L.jsxs)(W,{children:[r?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:r,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${n} in CRM`,children:n}):(0,L.jsx)(`strong`,{children:n}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:[t.email_508||t.email,t.contact_type].filter(Boolean).join(` | `)})]}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[i.crm_active?null:(0,L.jsx)(R,{variant:`missing`,children:t.sync_status||`CRM sync issue`}),(0,L.jsx)(R,{variant:i.is_member?`succeeded`:`missing`,children:i.is_member?`Member`:`Missing Member`}),(0,L.jsx)(R,{variant:i.discord_linked?`succeeded`:`missing`,children:i.discord_linked?`Discord`:`Missing Discord`}),(0,L.jsx)(R,{variant:i.email_508?`succeeded`:`missing`,children:i.email_508?`508 email`:`Missing 508 email`}),i.latest_resume?null:(0,L.jsx)(R,{variant:`missing`,children:`Missing Resume`})]})}),(0,L.jsx)(W,{children:[t.discord_username,t.discord_user_id].filter(Boolean).join(` | `)||`Not linked`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:o,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${n} resume`,children:`Resume`}):(0,L.jsx)(`span`,{children:t.latest_resume_name||t.latest_resume_id||`No resume`}),(0,L.jsx)(R,{variant:a>0?`succeeded`:`missing`,children:a>0?`Skills parsed`:`Skills not parsed`})]})})]},t.crm_contact_id||n)})})]})})]})}function Wn(e){let t=sn[e.onboardingFilterKind]?.options||[];return(0,L.jsxs)(L.Fragment,{children:[e.canWrite?(0,L.jsx)(Xn,{loading:e.loading.engineerSetup,onSetup:e.onSetupEngineer}):null,(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Onboarding queue`}),(0,L.jsx)(`span`,{id:`onboardingStatus`,className:`text-sm text-muted-foreground`,children:e.loading.onboarding?`Loading`:`${e.people.length} shown`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b p-4 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Search prospects`,(0,L.jsx)(V,{id:`onboardingQuery`,value:e.onboardingQuery,autoComplete:`off`,placeholder:`Name, email, Discord, onboarder`,onChange:t=>e.setOnboardingQuery(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(z,{id:`searchOnboarding`,type:`button`,onClick:e.onSearch,disabled:e.loading.onboarding,children:[(0,L.jsx)(C,{}),`Search`]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b bg-background p-4 md:grid-cols-[minmax(140px,.8fr)_minmax(150px,1fr)_minmax(150px,1fr)_minmax(120px,.7fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`onboardingState`,value:e.onboardingState,onChange:t=>e.setOnboardingState(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any state`}),(0,L.jsx)(`option`,{value:`pending`,children:`Needs review`}),(0,L.jsx)(`option`,{value:`selected`,children:`Assigned to onboarder`}),(0,L.jsx)(`option`,{value:`reachingout`,children:`Reaching out`}),(0,L.jsx)(`option`,{value:`awaitingcontribution`,children:`Awaiting contribution`})]})]}),(0,L.jsxs)(H,{children:[`Onboarder`,(0,L.jsx)(V,{id:`onboarderFilter`,value:e.onboarderFilter,autoComplete:`off`,placeholder:`Any onboarder`,onChange:t=>e.setOnboarderFilter(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(H,{children:[`Add filter`,(0,L.jsx)(zt,{id:`onboardingFilterKind`,value:e.onboardingFilterKind,disabled:e.onboardingFilterKeys.length===0,onChange:t=>e.setOnboardingFilterKind(t.target.value),children:e.onboardingFilterKeys.map(e=>(0,L.jsx)(`option`,{value:e,children:sn[e].label},e))})]}),(0,L.jsxs)(H,{children:[`Value`,(0,L.jsx)(zt,{id:`onboardingFilterValue`,value:e.onboardingFilterValue,onChange:t=>e.setOnboardingFilterValue(t.target.value),children:t.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})]}),(0,L.jsx)(z,{id:`addOnboardingFilter`,type:`button`,onClick:e.addFilter,disabled:e.onboardingFilterKeys.length===0,children:`Add filter`}),(0,L.jsx)(`div`,{id:`activeOnboardingFilters`,className:`md:col-span-5`,children:(0,L.jsx)(Tn,{filters:e.onboardingFilters,onRemove:e.removeFilter,suffix:`onboarding filter`})})]}),(0,L.jsx)(yn,{hidden:e.people.length!==0,children:`No prospects match this queue view.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`onboardingTable`,className:I(`min-w-[1180px]`,e.people.length===0&&`hidden`),"aria-label":`Onboarding queue`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[20%]`,label:`Name`,scope:`onboarding`,sort:e.sort,sortKey:`name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[13%]`,label:`Status`,scope:`onboarding`,sort:e.sort,sortKey:`onboarding_state`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[22%]`,label:`Onboarder`,scope:`onboarding`,sort:e.sort,sortKey:`onboarder`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[13%]`,label:`Updated`,scope:`onboarding`,sort:e.sort,sortKey:`updated`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{className:`w-[15%]`,children:`Links`}),(0,L.jsx)(_n,{className:`w-[17%]`,label:`Needs`,scope:`onboarding`,sort:e.sort,sortKey:`profile_gaps`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`onboardingBody`,children:e.people.map(t=>(0,L.jsx)(Zn,{person:t,loading:e.loading,onAssign:e.onAssign,crmContactUrl:e.crmContactUrl,crmAttachmentUrl:e.crmAttachmentUrl},t.crm_contact_id||t.name))})]})})]})]})}var Gn=[`Female`,`Genderqueer`,`Male`,`Non-Conforming`,`Other`,`Prefer not to say`,`Transgender`],Kn=[`Company Email`,`Personal Email`,`User ID`];function qn(e){let t=(e||``).trim().split(/\s+/).filter(Boolean);return t.length===0?{first:``,middle:``,last:``}:t.length===1?{first:t[0],middle:``,last:``}:t.length===2?{first:t[0],middle:``,last:t[1]}:{first:t[0],middle:t.slice(1,-1).join(` `),last:t[t.length-1]}}function Jn(e){let t=(e.email||``).trim();return!t||t.toLowerCase().endsWith(`@508.dev`)?``:t}function Yn(e){let t=(e.email_508||``).trim();if(t)return t;let n=(e.email||``).trim();return n.toLowerCase().endsWith(`@508.dev`)?n:``}function Xn({loading:e,onSetup:t}){let[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(``),[x,ee]=(0,l.useState)(``),[S,te]=(0,l.useState)(``),[ne,ie]=(0,l.useState)(``),[ae,oe]=(0,l.useState)(``),[se,w]=(0,l.useState)(``);function ce(e){let t=qn(e.name);m(t.first),g(t.middle),v(t.last),f(Yn(e)),oe(Jn(e)),b(e.address_country||``),r(e.name||e.email_508||e.email||``),a([]),u(``)}async function le(){let e=n.trim();if(e){s(!0),u(``);try{a(await G(`/dashboard/api/people?${new URLSearchParams({limit:`8`,query:e}).toString()}`))}catch(e){u(un(e,`Unable to search people`)),a([])}finally{s(!1)}}}async function ue(){let e={email:d,first_name:p,middle_name:h,last_name:_,country:y,personal_email:ae};x.trim()&&(e.gender=x),S.trim()&&(e.date_of_birth=S),ne.trim()&&(e.date_of_joining=ne),se.trim()&&(e.prefered_email=se),await t(e)&&(r(``),a([]),f(``),m(``),g(``),v(``),b(``),ee(``),te(``),ie(``),oe(``),w(``))}return(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Engineer setup`})}),(0,L.jsx)(Rt,{children:(0,L.jsxs)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),ue()},children:[(0,L.jsxs)(`div`,{className:`grid gap-3 border-b pb-3 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`CRM person`,(0,L.jsx)(V,{value:n,autoComplete:`off`,placeholder:`Search name or email`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),le())}})]}),(0,L.jsxs)(z,{type:`button`,onClick:le,disabled:o||!n.trim(),children:[(0,L.jsx)(C,{}),`Search`]}),c?(0,L.jsx)(`span`,{className:`text-sm font-semibold text-destructive`,children:c}):null,i.length>0?(0,L.jsx)(`div`,{className:`grid gap-2 md:col-span-2`,children:i.map(e=>{let t=e.name||e.email_508||e.email||e.crm_contact_id,n=[e.email_508||e.email,e.contact_type].filter(Boolean).join(` | `);return(0,L.jsxs)(`button`,{type:`button`,className:`grid rounded-md border bg-background px-3 py-2 text-left text-sm hover:border-primary`,onClick:()=>ce(e),children:[(0,L.jsx)(`strong`,{children:t}),n?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:n}):null]},e.crm_contact_id||t)})}):null]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(130px,.6fr)]`,children:[(0,L.jsxs)(H,{children:[`Company email`,(0,L.jsx)(V,{value:d,autoComplete:`off`,placeholder:`engineer@508.dev`,onChange:e=>f(e.target.value)})]}),(0,L.jsxs)(H,{children:[`First name`,(0,L.jsx)(V,{value:p,autoComplete:`off`,placeholder:`First`,onChange:e=>m(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Middle name`,(0,L.jsx)(V,{value:h,autoComplete:`off`,placeholder:`Optional`,onChange:e=>g(e.target.value)})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(130px,.6fr)]`,children:[(0,L.jsxs)(H,{children:[`Last name`,(0,L.jsx)(V,{value:_,autoComplete:`off`,placeholder:`Last`,onChange:e=>v(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Country`,(0,L.jsx)(V,{value:y,autoComplete:`off`,placeholder:`Taiwan`,onChange:e=>b(e.target.value)})]})]}),(0,L.jsxs)(`details`,{className:`rounded-md border bg-background p-3`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-extrabold`,children:`Advanced options`}),(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{children:[`Gender`,(0,L.jsxs)(zt,{value:x,onChange:e=>ee(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Default`}),Gn.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]})]}),(0,L.jsxs)(H,{children:[`Date of birth`,(0,L.jsx)(V,{value:S,type:`date`,autoComplete:`off`,onChange:e=>te(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Date of joining`,(0,L.jsx)(V,{value:ne,type:`date`,autoComplete:`off`,onChange:e=>ie(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Personal email`,(0,L.jsx)(V,{value:ae,type:`email`,autoComplete:`off`,placeholder:`Optional`,onChange:e=>oe(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Preferred contact email`,(0,L.jsxs)(zt,{value:se,onChange:e=>w(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Default`}),Kn.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,L.jsxs)(z,{id:`setupEngineer`,type:`submit`,disabled:e||!d.trim()||!p.trim(),children:[(0,L.jsx)(re,{}),`Set up engineer`]})})]})})]})}function Zn({person:e,loading:t,onAssign:n,crmContactUrl:r,crmAttachmentUrl:i}){let a=e.name||e.email_508||e.email||`CRM contact`,[o,s]=(0,l.useState)(Zt(e.onboarder));(0,l.useEffect)(()=>s(Zt(e.onboarder)),[e.onboarder]);let c=e.profile_status||{},u=[[`Discord`,c.discord_linked],[`Resume`,c.latest_resume],[`Skills`,Number(c.skills_count||0)>0]].filter(([,e])=>!e),d=r(e.crm_contact_id),f=i(e.latest_resume_id);return(0,L.jsxs)(Ut,{children:[(0,L.jsxs)(W,{children:[d?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:d,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} in CRM`,children:a}):(0,L.jsx)(`strong`,{children:a}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email_508||e.email||``})]}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:Xt(Jt(e)),children:e.onboarding_status_label||Yt(Jt(e))})}),(0,L.jsx)(W,{children:(0,L.jsxs)(`form`,{className:`grid max-w-64 grid-cols-[minmax(100px,1fr)_auto] items-center gap-2`,onSubmit:t=>{t.preventDefault(),n(e.crm_contact_id,o)},children:[(0,L.jsx)(V,{"aria-label":`Onboarder for ${a}`,value:o,placeholder:`508 username`,onChange:e=>s(e.target.value)}),(0,L.jsx)(z,{type:`submit`,size:`sm`,"aria-label":`Save onboarder for ${a}`,disabled:t[`onboarder:${e.crm_contact_id}`],children:`Save`})]})}),(0,L.jsx)(W,{children:Gt(e.onboarding_updated_at)}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[f?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:f,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} resume`,children:`Resume`}):null,nn(e.linkedin)?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:nn(e.linkedin),target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} LinkedIn`,children:`LinkedIn`}):null,rn(e.github_username)?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:rn(e.github_username),target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} GitHub`,children:e.github_username||`GitHub`}):null,!f&&!nn(e.linkedin)&&!rn(e.github_username)?`None`:null]})}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[u.map(([e])=>(0,L.jsxs)(R,{variant:`missing`,children:[`Missing `,e]},String(e))),u.length===0?`None`:null]})})]})}function Qn(e){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-4 md:items-end`,children:[(0,L.jsxs)(H,{children:[`Window`,(0,L.jsxs)(zt,{id:`minutes`,value:e.minutes,onChange:t=>e.setMinutes(t.target.value),children:[(0,L.jsx)(`option`,{value:`15`,children:`15 minutes`}),(0,L.jsx)(`option`,{value:`60`,children:`1 hour`}),(0,L.jsx)(`option`,{value:`360`,children:`6 hours`}),(0,L.jsx)(`option`,{value:`1440`,children:`24 hours`})]})]}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`status`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any status`}),(0,L.jsx)(`option`,{value:`queued`,children:`Queued`}),(0,L.jsx)(`option`,{value:`running`,children:`Running`}),(0,L.jsx)(`option`,{value:`succeeded`,children:`Succeeded`}),(0,L.jsx)(`option`,{value:`failed`,children:`Failed`}),(0,L.jsx)(`option`,{value:`dead`,children:`Dead`}),(0,L.jsx)(`option`,{value:`canceled`,children:`Canceled`})]})]}),(0,L.jsxs)(H,{children:[`Type`,(0,L.jsx)(V,{id:`jobType`,value:e.jobType,autoComplete:`off`,placeholder:`Any type`,onChange:t=>e.setJobType(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(z,{id:`refreshJobs`,type:`button`,onClick:e.onSearch,disabled:e.loading.jobs,children:[(0,L.jsx)(S,{}),`Refresh jobs`]})]}),(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-4`,"aria-label":`Job summary`,children:[(0,L.jsx)(vn,{id:`metricTotal`,label:`Total`,value:e.jobs.length}),(0,L.jsx)(vn,{id:`metricQueued`,label:`Queued`,value:e.jobCounts.queued||0}),(0,L.jsx)(vn,{id:`metricRunning`,label:`Running`,value:e.jobCounts.running||0}),(0,L.jsx)(vn,{id:`metricFailed`,label:`Failed`,value:(e.jobCounts.failed||0)+(e.jobCounts.dead||0)})]}),(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Recent jobs`})}),(0,L.jsx)(yn,{hidden:e.jobs.length!==0,children:`No jobs match these filters.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`jobsTable`,className:I(`min-w-[980px]`,e.jobs.length===0&&`hidden`),"aria-label":`Recent jobs`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[22%]`,label:`Job id`,scope:`jobs`,sort:e.sort,sortKey:`job_id`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[24%]`,label:`Type`,scope:`jobs`,sort:e.sort,sortKey:`type`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[12%]`,label:`Status`,scope:`jobs`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[12%]`,label:`Attempts`,scope:`jobs`,sort:e.sort,sortKey:`attempts`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[18%]`,label:`Updated`,scope:`jobs`,sort:e.sort,sortKey:`updated_at`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{children:`Actions`})]})}),(0,L.jsx)(Ht,{id:`jobsBody`,children:e.jobs.map(t=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{className:`font-mono`,children:t.job_id}),(0,L.jsx)(W,{children:t.type}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:t.status||`neutral`,children:t.status})}),(0,L.jsxs)(W,{children:[t.attempts,`/`,t.max_attempts]}),(0,L.jsx)(W,{children:Gt(t.updated_at)}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,size:`sm`,variant:`outline`,"aria-label":`View details for ${t.type} job ${t.job_id}`,onClick:()=>e.onDetail(t.job_id),disabled:e.loading[`detail:${t.job_id}`],children:`Details`}),e.canWrite?(0,L.jsx)(z,{type:`button`,size:`sm`,"aria-label":`Rerun ${t.type} job ${t.job_id}`,onClick:()=>e.onRerun(t.job_id),disabled:e.loading[`rerun:${t.job_id}`],children:`Rerun`}):null]})})]},t.job_id))})]})})]}),e.jobDetail?(0,L.jsxs)(It,{id:`jobDetailPanel`,children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Job detail`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.jobDetail.job_id})]}),(0,L.jsxs)(Rt,{className:`grid gap-4`,children:[(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[[`Type`,e.jobDetail.type],[`Status`,e.jobDetail.status],[`Attempts`,`${e.jobDetail.attempts}/${e.jobDetail.max_attempts}`],[`Updated`,Gt(e.jobDetail.updated_at)],[`Created`,Gt(e.jobDetail.created_at)],[`Run after`,Gt(e.jobDetail.run_after)],[`Locked by`,e.jobDetail.locked_by||`None`],[`Last error`,e.jobDetail.last_error||`None`]].map(([e,t])=>(0,L.jsxs)(`div`,{className:`grid gap-1 rounded-md border bg-background p-3`,children:[(0,L.jsx)(`span`,{className:`text-[11px] font-extrabold uppercase text-muted-foreground`,children:e}),(0,L.jsx)(`strong`,{className:`break-words text-sm`,children:t})]},e))}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`mb-2 text-[15px] font-bold`,children:`Payload`}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-background p-3 font-mono text-xs`,children:qt(e.jobDetail.payload)||`No payload`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`mb-2 text-[15px] font-bold`,children:`Result`}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-background p-3 font-mono text-xs`,children:qt(e.jobDetail.result)||`No result`})]})]})]}):null]})}function $n(e){return(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Recent audit`}),(0,L.jsxs)(z,{id:`refreshAudit`,type:`button`,variant:`outline`,onClick:e.onRefresh,disabled:e.loading.audit,children:[(0,L.jsx)(S,{}),`Refresh`]})]}),(0,L.jsx)(yn,{hidden:e.events.length!==0,children:`No audit events found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`auditTable`,className:I(`min-w-[760px]`,e.events.length===0&&`hidden`),"aria-label":`Recent audit events`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[24%]`,label:`Time`,scope:`audit`,sort:e.sort,sortKey:`occurred_at`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Actor`,scope:`audit`,sort:e.sort,sortKey:`actor`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Action`,scope:`audit`,sort:e.sort,sortKey:`action`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[20%]`,label:`Result`,scope:`audit`,sort:e.sort,sortKey:`result`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`auditBody`,children:e.events.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:Gt(e.occurred_at)}),(0,L.jsx)(W,{children:e.actor_display_name||e.actor_subject||e.actor_provider}),(0,L.jsx)(W,{children:e.action}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:e.result===`success`?`succeeded`:`failed`,children:e.result})})]},e.id||`${e.occurred_at||``}-${e.actor_subject||``}-${e.action||``}`))})]})})]})}function er({report:e,loading:t,onRefresh:n}){let r=e?.summary||{},i=[[`Status`,e?.status_counts||{}],[`Intent`,e?.intent_counts||{}],[`Planner`,e?.planner_counts||{}]].flatMap(([e,t])=>Object.entries(t).map(([t,n])=>({label:e,value:t,count:n}))).sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label)),a=Array.isArray(e?.recent_unsupported)?e.recent_unsupported:[];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Agent requests`}),(0,L.jsxs)(z,{id:`refreshAgent`,type:`button`,variant:`outline`,onClick:n,disabled:t.agent,children:[(0,L.jsx)(S,{}),`Refresh`]})]}),(0,L.jsxs)(Rt,{className:`grid gap-3 md:grid-cols-5`,children:[(0,L.jsx)(vn,{id:`agentMetricTotal`,label:`Total`,value:r.total||0}),(0,L.jsx)(vn,{id:`agentMetricHandled`,label:`Handled`,value:r.handled||0}),(0,L.jsx)(vn,{id:`agentMetricConfirmations`,label:`Confirmations`,value:r.requires_confirmation||0}),(0,L.jsx)(vn,{id:`agentMetricClarifications`,label:`Clarifications`,value:r.needs_clarification||0}),(0,L.jsx)(vn,{id:`agentMetricUnsupported`,label:`Not understood`,value:r.unsupported||0})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Request mix`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Recent agent.request audit events.`})]}),(0,L.jsx)(yn,{hidden:i.length!==0,children:`No agent request data found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`agentBreakdownTable`,className:I(`min-w-[860px]`,i.length===0&&`hidden`),"aria-label":`Agent request breakdown`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Dimension`}),(0,L.jsx)(U,{children:`Value`}),(0,L.jsx)(U,{children:`Count`})]})}),(0,L.jsx)(Ht,{id:`agentBreakdownBody`,children:i.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:e.label}),(0,L.jsx)(W,{children:e.value}),(0,L.jsx)(W,{children:e.count})]},`${e.label}-${e.value}`))})]})})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Not understood`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Sanitized request text only.`})]}),(0,L.jsx)(yn,{hidden:a.length!==0,children:`No unsupported agent requests found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`agentUnsupportedTable`,className:I(`min-w-[860px]`,a.length===0&&`hidden`),"aria-label":`Unsupported agent requests`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Time`}),(0,L.jsx)(U,{children:`Actor`}),(0,L.jsx)(U,{children:`Message`}),(0,L.jsx)(U,{children:`Result`})]})}),(0,L.jsx)(Ht,{id:`agentUnsupportedBody`,children:a.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:Gt(e.occurred_at)}),(0,L.jsx)(W,{children:e.actor}),(0,L.jsx)(W,{children:e.message_sanitized}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:e.result===`success`?`succeeded`:`failed`,children:e.result||`unknown`})})]},`${e.occurred_at||``}-${e.actor||``}-${e.message_sanitized||``}`))})]})})]})]})}var tr=document.getElementById(`root`);if(!tr)throw Error(`Missing #root container`);(0,ue.createRoot)(tr).render((0,L.jsx)(l.StrictMode,{children:(0,L.jsx)(xn,{})})); \ No newline at end of file +`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Vt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Vt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:U(e,r,o);break;case`data`:if(t!==`object`){Mt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`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 o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`onScroll`:r!=null&&$(`scroll`,e);break;case`onScrollEnd`:r!=null&&$(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(a(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(a(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Kt(``+r),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`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:I(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:I(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:I(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:I(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:I(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:I(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:I(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:I(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:I(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=B(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+B(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+B(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+B(n.imageSizes)+`"]`)):i+=`[href="`+B(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+B(r)+`"][href="`+B(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=xt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);St(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=xt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),St(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ge.current)?gf(i):null;if(!i)throw Error(a(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=xt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=xt(i).hoistableStyles,s=o.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=i.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.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},mf.set(e,n),o||Nf(i,e,n,s.state))),t&&r===null)throw Error(a(528,``));return s}if(t&&r!==null)throw Error(a(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=xt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Af(e){return`href="`+B(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),St(t),e.head.appendChild(t))}function Pf(e){return`[src="`+B(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+B(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var i=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var o=e.querySelector(jf(i));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Mf(n),(i=mf.get(i))&&Rf(r,i),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(i=e.querySelector(Ff(o)))?(t.instance=i,St(i),i):(r=n,(i=mf.get(o))&&(r=p({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),St(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(a(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Uf(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 Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=le()}))();function T(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,fe=E,pe=(e,t)=>n=>{if(t?.variants==null)return fe(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=de(t)||de(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return fe(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},D=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t({classGroupId:e,validator:t}),k=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),me=`-`,he=[],ge=`arbitrary..`,_e=e=>{let t=be(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return ye(e);let n=e.split(me);return ve(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?D(i,t):t:i||he}return n[e]||he}}},ve=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=ve(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(me):e.slice(t).join(me),s=a.length;for(let e=0;ee.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ge+r:void 0})(),be=e=>{let{theme:t,classGroups:n}=e;return xe(n,t)},xe=(e,t)=>{let n=k();for(let r in e){let i=e[r];Se(i,n,r,t)}return n},Se=(e,t,n,r)=>{let i=e.length;for(let a=0;a{if(typeof e==`string`){we(e,t,n);return}if(typeof e==`function`){Te(e,t,n,r);return}Ee(e,t,n,r)},we=(e,t,n)=>{let r=e===``?t:De(t,e);r.classGroupId=n},Te=(e,t,n,r)=>{if(Oe(e)){Se(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(O(n,e))},Ee=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e{let n=e,r=t.split(me),i=r.length;for(let e=0;e`isThemeGetter`in e&&e.isThemeGetter===!0,ke=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Ae=`!`,je=`:`,Me=[],Ne=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Pe=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;si?a-i:void 0;return Ne(t,l,c,u)};if(t){let e=t+je,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ne(Me,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Fe=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ie=e=>({cache:ke(e.cacheSize),parseClassName:Pe(e),sortModifiers:Fe(e),postfixLookupClassGroupIds:Le(e),..._e(e)}),Le=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(Re),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Ae:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e0?` `+l:l)}return l},Be=(...e)=>{let t=0,n,r,i=``;for(;t{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r{let n,r,i,a,o=o=>(n=Ie(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ze(e,n);return i(e,a),a};return a=o,(...e)=>a(Be(...e))},Ue=[],A=e=>{let t=t=>t[e]||Ue;return t.isThemeGetter=!0,t},We=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ge=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ke=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,qe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Je=/\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$/,Ye=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Xe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ze=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qe=e=>Ke.test(e),j=e=>!!e&&!Number.isNaN(Number(e)),$e=e=>!!e&&Number.isInteger(Number(e)),et=e=>e.endsWith(`%`)&&j(e.slice(0,-1)),tt=e=>qe.test(e),nt=()=>!0,rt=e=>Je.test(e)&&!Ye.test(e),it=()=>!1,at=e=>Xe.test(e),ot=e=>Ze.test(e),st=e=>!M(e)&&!F(e),ct=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),lt=e=>St(e,Et,it),M=e=>We.test(e),ut=e=>St(e,Dt,rt),dt=e=>St(e,Ot,j),ft=e=>St(e,At,nt),pt=e=>St(e,kt,it),mt=e=>St(e,wt,it),N=e=>St(e,Tt,ot),P=e=>St(e,jt,at),F=e=>Ge.test(e),ht=e=>Ct(e,Dt),gt=e=>Ct(e,kt),_t=e=>Ct(e,wt),vt=e=>Ct(e,Et),yt=e=>Ct(e,Tt),bt=e=>Ct(e,jt,!0),xt=e=>Ct(e,At,!0),St=(e,t,n)=>{let r=We.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Ct=(e,t,n=!1)=>{let r=Ge.exec(e);return r?r[1]?t(r[1]):n:!1},wt=e=>e===`position`||e===`percentage`,Tt=e=>e===`image`||e===`url`,Et=e=>e===`length`||e===`size`||e===`bg-size`,Dt=e=>e===`length`,Ot=e=>e===`number`,kt=e=>e===`family-name`,At=e=>e===`number`||e===`weight`,jt=e=>e===`shadow`,Mt=He(()=>{let e=A(`color`),t=A(`font`),n=A(`text`),r=A(`font-weight`),i=A(`tracking`),a=A(`leading`),o=A(`breakpoint`),s=A(`container`),c=A(`spacing`),l=A(`radius`),u=A(`shadow`),d=A(`inset-shadow`),f=A(`text-shadow`),p=A(`drop-shadow`),m=A(`blur`),h=A(`perspective`),g=A(`aspect`),_=A(`ease`),v=A(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),F,M],ee=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],S=()=>[`auto`,`contain`,`none`],C=()=>[F,M,c],te=()=>[Qe,`full`,`auto`,...C()],ne=()=>[$e,`none`,`subgrid`,F,M],re=()=>[`auto`,{span:[`full`,$e,F,M]},$e,F,M],ie=()=>[$e,`auto`,F,M],ae=()=>[`auto`,`min`,`max`,`fr`,F,M],oe=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],se=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],w=()=>[`auto`,...C()],ce=()=>[Qe,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...C()],le=()=>[Qe,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...C()],ue=()=>[Qe,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...C()],T=()=>[e,F,M],E=()=>[...b(),_t,mt,{position:[F,M]}],de=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],fe=()=>[`auto`,`cover`,`contain`,vt,lt,{size:[F,M]}],pe=()=>[et,ht,ut],D=()=>[``,`none`,`full`,l,F,M],O=()=>[``,j,ht,ut],k=()=>[`solid`,`dashed`,`dotted`,`double`],me=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],he=()=>[j,et,_t,mt],ge=()=>[``,`none`,m,F,M],_e=()=>[`none`,j,F,M],ve=()=>[`none`,j,F,M],ye=()=>[j,F,M],be=()=>[Qe,`full`,...C()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[tt],breakpoint:[tt],color:[nt],container:[tt],"drop-shadow":[tt],ease:[`in`,`out`,`in-out`],font:[st],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[tt],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[tt],shadow:[tt],spacing:[`px`,j],text:[tt],"text-shadow":[tt],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Qe,M,F,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,F,M]}],"container-named":[ct],columns:[{columns:[j,M,F,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:x()}],overflow:[{overflow:ee()}],"overflow-x":[{"overflow-x":ee()}],"overflow-y":[{"overflow-y":ee()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:te()}],"inset-x":[{"inset-x":te()}],"inset-y":[{"inset-y":te()}],start:[{"inset-s":te(),start:te()}],end:[{"inset-e":te(),end:te()}],"inset-bs":[{"inset-bs":te()}],"inset-be":[{"inset-be":te()}],top:[{top:te()}],right:[{right:te()}],bottom:[{bottom:te()}],left:[{left:te()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[$e,`auto`,F,M]}],basis:[{basis:[Qe,`full`,`auto`,s,...C()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[j,Qe,`auto`,`initial`,`none`,M]}],grow:[{grow:[``,j,F,M]}],shrink:[{shrink:[``,j,F,M]}],order:[{order:[$e,`first`,`last`,`none`,F,M]}],"grid-cols":[{"grid-cols":ne()}],"col-start-end":[{col:re()}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":ne()}],"row-start-end":[{row:re()}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...oe(),`normal`]}],"justify-items":[{"justify-items":[...se(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...se()]}],"align-content":[{content:[`normal`,...oe()]}],"align-items":[{items:[...se(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...se(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":oe()}],"place-items":[{"place-items":[...se(),`baseline`]}],"place-self":[{"place-self":[`auto`,...se()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mbs:[{mbs:w()}],mbe:[{mbe:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":C()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":C()}],"space-y-reverse":[`space-y-reverse`],size:[{size:ce()}],"inline-size":[{inline:[`auto`,...le()]}],"min-inline-size":[{"min-inline":[`auto`,...le()]}],"max-inline-size":[{"max-inline":[`none`,...le()]}],"block-size":[{block:[`auto`,...ue()]}],"min-block-size":[{"min-block":[`auto`,...ue()]}],"max-block-size":[{"max-block":[`none`,...ue()]}],w:[{w:[s,`screen`,...ce()]}],"min-w":[{"min-w":[s,`screen`,`none`,...ce()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...ce()]}],h:[{h:[`screen`,`lh`,...ce()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...ce()]}],"max-h":[{"max-h":[`screen`,`lh`,...ce()]}],"font-size":[{text:[`base`,n,ht,ut]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,xt,ft]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,et,M]}],"font-family":[{font:[gt,pt,t]}],"font-features":[{"font-features":[M]}],"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:[i,F,M]}],"line-clamp":[{"line-clamp":[j,`none`,F,dt]}],leading:[{leading:[a,...C()]}],"list-image":[{"list-image":[`none`,F,M]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,F,M]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...k(),`wavy`]}],"text-decoration-thickness":[{decoration:[j,`from-font`,`auto`,F,ut]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[j,`auto`,F,M]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:C()}],"tab-size":[{tab:[$e,F,M]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,F,M]}],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`,F,M]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:E()}],"bg-repeat":[{bg:de()}],"bg-size":[{bg:fe()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},$e,F,M],radial:[``,F,M],conic:[$e,F,M]},yt,N]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:pe()}],"gradient-via-pos":[{via:pe()}],"gradient-to-pos":[{to:pe()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-bs":[{"border-bs":O()}],"border-w-be":[{"border-be":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":O()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...k(),`hidden`,`none`]}],"divide-style":[{divide:[...k(),`hidden`,`none`]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...k(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[j,F,M]}],"outline-w":[{outline:[``,j,ht,ut]}],"outline-color":[{outline:T()}],shadow:[{shadow:[``,`none`,u,bt,P]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":[`none`,d,bt,P]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:O()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[j,ut]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":[`none`,f,bt,P]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[j,F,M]}],"mix-blend":[{"mix-blend":[...me(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":me()}],"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":[j]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":b()}],"mask-image-conic-pos":[{"mask-conic":[j]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:de()}],"mask-size":[{mask:fe()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,F,M]}],filter:[{filter:[``,`none`,F,M]}],blur:[{blur:ge()}],brightness:[{brightness:[j,F,M]}],contrast:[{contrast:[j,F,M]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,bt,P]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:[``,j,F,M]}],"hue-rotate":[{"hue-rotate":[j,F,M]}],invert:[{invert:[``,j,F,M]}],saturate:[{saturate:[j,F,M]}],sepia:[{sepia:[``,j,F,M]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,F,M]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[j,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[j,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,j,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[j,F,M]}],"backdrop-invert":[{"backdrop-invert":[``,j,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[j,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[j,F,M]}],"backdrop-sepia":[{"backdrop-sepia":[``,j,F,M]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,F,M]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[j,`initial`,F,M]}],ease:[{ease:[`linear`,`initial`,_,F,M]}],delay:[{delay:[j,F,M]}],animate:[{animate:[`none`,v,F,M]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,F,M]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:_e()}],"rotate-x":[{"rotate-x":_e()}],"rotate-y":[{"rotate-y":_e()}],"rotate-z":[{"rotate-z":_e()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":[`scale-3d`],skew:[{skew:ye()}],"skew-x":[{"skew-x":ye()}],"skew-y":[{"skew-y":ye()}],transform:[{transform:[F,M,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":[`translate-none`],zoom:[{zoom:[$e,F,M]}],accent:[{accent:T()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:T()}],"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`,F,M]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"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`,F,M]}],fill:[{fill:[`none`,...T()]}],"stroke-w":[{stroke:[j,ht,ut,dt]}],stroke:[{stroke:[`none`,...T()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function I(...e){return Mt(E(e))}var Nt=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=Nt()}))(),Pt=pe(`inline-flex min-h-[22px] items-center rounded-full border px-2 py-0.5 text-[11px] font-extrabold uppercase leading-tight`,{variants:{variant:{neutral:`border-border bg-secondary text-muted-foreground`,succeeded:`border-emerald-400/35 bg-emerald-500/15 text-emerald-300`,failed:`border-red-400/40 bg-red-500/15 text-red-300`,dead:`border-red-400/40 bg-red-500/15 text-red-300`,missing:`border-red-400/40 bg-red-500/15 text-red-300`,running:`border-amber-400/40 bg-amber-500/15 text-amber-300`,queued:`border-teal-400/40 bg-teal-500/15 text-teal-200`,canceled:`border-border bg-secondary text-muted-foreground`}},defaultVariants:{variant:`neutral`}});function R({className:e,variant:t,...n}){return(0,L.jsx)(`span`,{"data-slot":`badge`,className:I(Pt({variant:t,className:e})),...n})}var Ft=pe(`inline-flex min-h-9 shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border text-sm font-semibold transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`border-primary bg-primary text-primary-foreground hover:bg-primary/90`,secondary:`border-border bg-secondary text-secondary-foreground hover:bg-secondary/80`,outline:`border-border bg-background hover:bg-accent hover:text-accent-foreground`,ghost:`border-transparent hover:bg-accent hover:text-accent-foreground`,destructive:`border-destructive bg-destructive text-white hover:bg-destructive/90`},size:{default:`h-9 px-4 py-2`,sm:`h-8 rounded-md px-3 text-xs`,icon:`size-9`}},defaultVariants:{variant:`secondary`,size:`default`}});function z({className:e,variant:t,size:n,type:r=`button`,...i}){return(0,L.jsx)(`button`,{"data-slot":`button`,type:r,className:I(Ft({variant:t,size:n,className:e})),...i})}function It({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card`,className:I(`rounded-lg border bg-card text-card-foreground shadow-[0_18px_44px_rgb(0_0_0/0.22)]`,e),...t})}function B({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card-header`,className:I(`flex items-center justify-between gap-3 border-b px-4 py-3`,e),...t})}function Lt({className:e,...t}){return(0,L.jsx)(`h2`,{"data-slot":`card-title`,className:I(`text-[15px] font-bold`,e),...t})}function Rt({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`card-content`,className:I(`p-4`,e),...t})}function V({className:e,type:t,...n}){return(0,L.jsx)(`input`,{"data-slot":`input`,type:t,className:I(`flex min-h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...n})}function H({className:e,...t}){return(0,L.jsx)(`label`,{"data-slot":`label`,className:I(`grid gap-1.5 text-xs font-bold text-muted-foreground`,e),...t})}function zt({className:e,...t}){return(0,L.jsx)(`select`,{"data-slot":`select`,className:I(`flex min-h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t})}function Bt({className:e,...t}){return(0,L.jsx)(`table`,{"data-slot":`table`,className:I(`w-full border-collapse text-sm`,e),...t})}function Vt({className:e,...t}){return(0,L.jsx)(`thead`,{"data-slot":`table-header`,className:e,...t})}function Ht({className:e,...t}){return(0,L.jsx)(`tbody`,{"data-slot":`table-body`,className:e,...t})}function Ut({className:e,...t}){return(0,L.jsx)(`tr`,{"data-slot":`table-row`,className:I(`border-b transition-colors hover:bg-muted/45`,e),...t})}function U({className:e,...t}){return(0,L.jsx)(`th`,{"data-slot":`table-head`,className:I(`bg-secondary px-3 py-3 text-left align-middle text-xs font-extrabold text-muted-foreground`,e),...t})}function W({className:e,...t}){return(0,L.jsx)(`td`,{"data-slot":`table-cell`,className:I(`px-3 py-3 align-middle text-sm`,e),...t})}var Wt={pending:`Needs review`,selected:`Assigned to onboarder`,reachingout:`Reaching out`,awaitingcontribution:`Awaiting contribution`,onboarded:`Onboarded`,waitlist:`Waitlist`,rejected:`Rejected`};function Gt(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Kt(e,t=new Date){if(!e)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;let r=t.getTime()-n.getTime();return r<0?0:Math.floor(r/864e5)}function qt(e){return e==null?``:JSON.stringify(e,null,2)}function Jt(e){return e.onboarding_state||e.onboardingState||e.cOnboardingState||``}function Yt(e){let t=String(e||``).trim();if(!t)return`No status`;let n=t.toLowerCase();return Wt[n]?Wt[n]:t.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function Xt(e){let t=String(e||``).trim().toLowerCase();return!t||t===`pending`?`neutral`:t===`selected`?`queued`:t===`rejected`?`failed`:t===`onboarded`?`succeeded`:t===`waitlist`?`running`:`queued`}function Zt(e){let t=String(e||``).trim();return!t||t.toLowerCase()===`none`?``:t}function Qt(e){let t=String(e||``).trim();return t?/^https?:\/\//i.test(t)?t:`https://${t.replace(/^\/+/,``)}`:``}function $t(e){try{return new URL(Qt(e))}catch{return null}}function en(e,t){let n=e.toLowerCase();return n===t||n.endsWith(`.${t}`)}function tn(e){return e.split(`/`).filter(Boolean).map(e=>encodeURIComponent(e)).join(`/`)}function nn(e){let t=String(e||``).trim();if(!t)return``;let n=$t(t);if(n&&en(n.hostname,`linkedin.com`))return n.href;if(/^https?:\/\//i.test(t))return``;let r=t.replace(/^@/,``).replace(/^\/+|\/+$/g,``).replace(/^in\//i,``);return r?`https://www.linkedin.com/in/${tn(r)}`:``}function rn(e){let t=String(e||``).trim().replace(/^@/,``);if(!t)return``;let n=$t(t);if(n&&en(n.hostname,`github.com`))return n.href;if(/^https?:\/\//i.test(t))return``;let r=t.replace(/^\/+|\/+$/g,``);return r?`https://github.com/${tn(r)}`:``}var an={people:`/dashboard/people`,gigs:`/dashboard/gigs`,projects:`/dashboard/projects`,onboarding:`/dashboard/onboarding`,jobs:`/dashboard/jobs`,agent:`/dashboard/agent`,audit:`/dashboard/audit`},on={people:`people:read`,gigs:`gigs:read`,projects:`projects:read`,onboarding:`onboarding:read`,jobs:`jobs:read`,agent:`audit:read`,audit:`audit:read`},sn={discord:{label:`Discord`,options:[[`linked`,`Linked`],[`missing`,`Missing`]]},email_508:{label:`508 email`,options:[[`present`,`Present`],[`missing`,`Missing`]]},resume:{label:`Resume`,options:[[`present`,`Present`],[`missing`,`Missing`]]},skills:{label:`Skills`,options:[[`present`,`Parsed`],[`missing`,`Not parsed`]]},sync_status:{label:`Sync status`,options:[[`active`,`Active`],[`conflict`,`Conflict`],[`missing_in_crm`,`Missing in CRM`]]}},cn=class extends Error{status;statusText;payload;url;method;constructor(e,t,n,r,i,a){super(e),this.name=`ApiRequestError`,this.status=t,this.statusText=n,this.payload=r,this.url=i,this.method=a}};function ln(e,t){let n=e.detail;if(typeof n==`string`&&n.trim())return n;let r=e.error;return typeof r==`string`?r===`person_not_found`?`No CRM person, ERPNext user, or ERPNext supplier matched "${typeof e.person==`string`&&e.person.trim()?e.person:`that person`}". Try an email address or an exact name from CRM/ERPNext.`:r===`candidate_not_found`?`The selected person record is no longer available. Search again and choose one of the current matches.`:r===`ambiguous_person`?`Multiple people matched. Choose the matching person record.`:r||t:t}function un(e,t){return typeof e==`string`&&e.trim()?e:e instanceof Error&&e.message.trim()?e.message:t}function dn(){return window.location.pathname.split(`/`).filter(Boolean)[1]||``}function fn(){let e=dn();return Object.hasOwn(an,e)?e:`people`}function pn(e=`gigs`){let[,t,n]=window.location.pathname.split(`/`).filter(Boolean);if(t!==e||!n)return``;try{return decodeURIComponent(n)}catch{return``}}async function G(e,t={}){let n=String(t.method||`GET`).toUpperCase(),r=new Headers(t.headers);r.set(`Accept`,`application/json`);let i;try{i=await fetch(e,{credentials:`same-origin`,...t,headers:r})}catch(t){throw new cn(un(t,`Network request failed`),0,`Network request failed`,null,e,n)}if(i.status===401){let t=`${window.location.pathname}${window.location.search}`||`/dashboard`;throw window.location.assign(`/auth/login?next=${encodeURIComponent(t)}`),new cn(`Session expired`,i.status,i.statusText,null,e,n)}if(!i.ok){let t=i.statusText,r=null;try{r=await i.json(),r&&typeof r==`object`&&(t=ln(r,String(t||`Request failed`)))}catch{t=i.statusText}throw new cn(typeof t==`string`?t:JSON.stringify(t),i.status,i.statusText,r,e,n)}return i.json()}function mn(e,t,n){if(e===`gigs`){let e=t;if(n===`title`)return e.title||``;if(n===`status`)return e.status||``;if(n===`applications`)return Number(e.application_count||0);if(n===`activity`)return kn(e)}if(e===`projects`){let e=t;if(n===`display_name`)return e.display_name||``;if(n===`customer`)return e.customer||``;if(n===`status`)return e.source_status||``;if(n===`roster_count`)return Number(e.roster_count||0);if(n===`modified`)return e.source_modified_at||e.last_synced_at||``}if(e===`onboarding`){let e=t,r=e.profile_status||{};if(n===`name`)return e.name||e.email_508||e.email||``;if(n===`onboarding_state`){let t=Jt(e);return t.toLowerCase()===`pending`?`zzz-${t}`:t}if(n===`onboarder`)return e.onboarder||``;if(n===`updated`)return e.onboarding_updated_at||``;if(n===`profile_gaps`)return[!r.discord_linked,!r.latest_resume,Number(r.skills_count||0)<=0].filter(Boolean).length}if(e===`people`){let e=t,r=e.profile_status||{};if(n===`name`)return e.name||e.email_508||e.email||``;if(n===`status`)return[r.crm_active,r.is_member,r.discord_linked,r.email_508,r.latest_resume].filter(Boolean).length;if(n===`discord`)return e.discord_username||e.discord_user_id||``;if(n===`resume`)return e.latest_resume_name||e.latest_resume_id||``}if(e===`audit`){let e=t;if(n===`actor`)return e.actor_display_name||e.actor_subject||e.actor_provider||``}return t[n]??``}function hn(e,t,n){let r=n.direction===`asc`?1:-1;return[...t].sort((t,i)=>{let a=mn(e,t,n.key),o=mn(e,i,n.key);return typeof a==`number`&&typeof o==`number`?(a-o)*r:String(a).localeCompare(String(o),void 0,{numeric:!0})*r})}function gn({label:e,scope:t,sort:n,sortKey:r,onSort:i}){let a=n.key===r,o=n.direction===`asc`?`↑`:`↓`;return(0,L.jsx)(`button`,{type:`button`,"data-sort-scope":t,"data-sort-key":r,className:`text-left font-[inherit] text-inherit hover:text-foreground`,onClick:()=>i(t,r),children:a?`${e} ${o}`:e})}function _n({className:e,label:t,scope:n,sort:r,sortKey:i,onSort:a}){return(0,L.jsx)(U,{className:e,"aria-sort":r.key===i?r.direction===`asc`?`ascending`:`descending`:`none`,children:(0,L.jsx)(gn,{label:t,scope:n,sort:r,sortKey:i,onSort:a})})}function vn({label:e,value:t,id:n}){return(0,L.jsxs)(It,{className:`p-4`,children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:e}),(0,L.jsx)(`strong`,{id:n,className:`block text-2xl`,children:t})]})}function yn({children:e,hidden:t}){return t?null:(0,L.jsx)(`div`,{className:`px-4 py-7 text-center text-sm text-muted-foreground`,children:e})}function bn({value:e,query:t}){let n=t.trim().toLowerCase();if(!n)return(0,L.jsx)(L.Fragment,{children:e});let r=e.toLowerCase(),i=[],a=0,o=r.indexOf(n);for(;o>=0;){o>a&&i.push(e.slice(a,o));let t=o+n.length;i.push((0,L.jsx)(`mark`,{className:`rounded-sm bg-amber-200 px-0.5 text-inherit dark:bg-amber-500/35`,children:e.slice(o,t)},`${o}-${t}`)),a=t,o=r.indexOf(n,a)}return avoid 0);function ut(e){return s.includes(e)}function dt(e){return s.includes(`${e}:dry_run`)}function ft(e){return ut(e)||dt(e)}function pt(e){return ut(on[e])}function mt(){return Object.keys(an).find(e=>pt(e))||`people`}function N(e,t){o({message:e,tone:t})}function P(e,t){N(un(e,t),`error`)}function F(e,t){xe(n=>({...n,[e]:t}))}function ht(e,t=!1){let n=e;pt(n)||(N(`${n[0].toUpperCase()}${n.slice(1)} requires SSO validation`,`error`),n=mt()),n!==`gigs`&&ce(``),n!==`projects`&&ue(``),n===`gigs`&&t&&ce(``),n===`projects`&&t&&ue(``),i(n),t?window.history.pushState({view:n},``,an[n]):(!Object.hasOwn(an,dn())||n!==e)&&window.history.replaceState({view:n},``,an[n])}M.current=ht;function gt(e){return!u||!e?``:`${u}/#Contact/view/${encodeURIComponent(e)}`}function _t(e){return!u||!e?``:`${u}/api/v1/Attachment/file/${encodeURIComponent(e)}`}function vt(e,t){De(n=>{let r=n[e];return{...n,[e]:{key:t,direction:r.key===t&&r.direction===`asc`?`desc`:`asc`}}})}function yt(e){ce(e),se(m.find(t=>t.id===e)||null),i(`gigs`),window.history.pushState({view:`gigs`,gigId:e},``,`/dashboard/gigs/${encodeURIComponent(e)}`)}function bt(){ce(``),se(null),window.history.replaceState({view:`gigs`},``,an.gigs)}function xt(e){ue(e),i(`projects`),window.history.pushState({view:`projects`,projectId:e},``,`/dashboard/projects/${encodeURIComponent(e)}`)}function St(){ue(``),window.history.replaceState({view:`projects`},``,an.projects)}async function Ct(){let e=await G(`/dashboard/api/me`);n(e);let t=Array.isArray(e.permissions)?e.permissions:[];return c(t),d((e.crm_base_url||``).replace(/\/+$/,``)),t}function wt(){let e=new URLSearchParams({minutes:Oe,limit:`100`});return Ae&&e.set(`status`,Ae),Me.trim()&&e.set(`type`,Me.trim()),`/dashboard/api/jobs?${e.toString()}`}function Tt(){let e=new URLSearchParams({limit:String(Ie)});return Pe&&e.set(`status`,Pe),`/dashboard/api/gigs?${e.toString()}`}function Et(){let e=new URLSearchParams({limit:`100`,status:Be});return Re.trim()&&e.set(`query`,Re.trim()),`/dashboard/api/projects?${e.toString()}`}async function Dt(){F(`jobs`,!0),N(`Loading jobs`);try{let e=await G(wt());p(e),N(`Loaded ${e.length} jobs`,`ok`)}catch(e){P(e,`Unable to load jobs`)}finally{F(`jobs`,!1)}}async function Ot(){F(`gigs`,!0);try{let e=await G(Tt());v(e),N(`Loaded ${e.length} gig${e.length===1?``:`s`}`,`ok`),Ht()}catch(e){P(e,`Unable to load gigs`)}finally{F(`gigs`,!1)}}async function kt(){F(`projects`,!0);try{let e=await G(Et());S(e.projects||[]),ne(e.summary||{}),N(`Loaded ${(e.projects||[]).length} project${(e.projects||[]).length===1?``:`s`}`,`ok`)}catch(e){P(e,`Unable to load projects`)}finally{F(`projects`,!1)}}async function At(){F(`syncProjects`,!0),N(`Queueing project sync`);try{let e=await G(`/dashboard/api/sync/projects`,{method:`POST`});e.dry_run?N(`Dry run only: would queue ${e.would_enqueue?.job_type||`project sync`}`,`warning`):N(`Queued project sync ${e.job_id}`,`ok`)}catch(e){P(e,`Unable to queue project sync`)}finally{F(`syncProjects`,!1)}}async function jt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/customers?${new URLSearchParams({query:t}).toString()}`)).customers||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search customers`,`error`),[]}}async function Mt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/contacts?${new URLSearchParams({query:t}).toString()}`)).contacts||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search contacts`,`error`),[]}}async function Nt(e){let t=e.trim();if(t.length<2)return[];try{return(await G(`/dashboard/api/erpnext/account-managers?${new URLSearchParams({query:t}).toString()}`)).users||[]}catch(e){return N(e instanceof Error?e.message:`Unable to search account managers`,`error`),[]}}async function Pt(){try{let e=(await G(`/dashboard/api/erpnext/cost-centers`)).cost_centers||[];return e.length?e:[{name:`Projects - 5`,cost_center_name:`Projects`}]}catch(e){return N(e instanceof Error?e.message:`Unable to load cost centers`,`error`),[{name:`Projects - 5`,cost_center_name:`Projects`}]}}async function R(e){F(`createProject`,!0);try{let t=await G(`/dashboard/api/projects/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});return t.project.id?(S(e=>e.some(e=>e.id===t.project.id)?e.map(e=>e.id===t.project.id?t.project:e):[t.project,...e]),N(`Created ERP project setup`,`ok`),xt(t.project.id)):(N(t.cache_refresh_message||`Created ERP project in ERPNext; local sync is pending`,`ok`),kt()),!0}catch(e){return N(e instanceof Error?e.message:`Unable to create project`,`error`),!1}finally{F(`createProject`,!1)}}async function Ft(e,t){F(`project:${e}:status`,!0);try{let n=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})});S(t=>t.map(t=>t.id===e?n.project:t)),N(`Updated project status`,`ok`)}catch(e){P(e,`Unable to update project`)}finally{F(`project:${e}:status`,!1)}}async function It(e,t){if(e.length===0)return!1;F(`projectsBulkUpdate`,!0);try{let n=await G(`/dashboard/api/projects/bulk`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({project_ids:e,...t})}),r=n.projects||[];S(e=>e.map(e=>r.find(t=>t.id===e.id)||e));let i=n.failures||[];return N(i.length?`Updated ${r.length}; ${i.length} failed`:`Updated ${r.length} project${r.length===1?``:`s`}`,i.length?`error`:`ok`),i.length===0}catch(e){return P(e,`Unable to bulk update projects`),!1}finally{F(`projectsBulkUpdate`,!1)}}async function B(e,t,n,r){let i=t.trim(),a=n.trim();if(!i||!a)return!1;F(`project:${e}:user`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/users`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({user:i,candidate_id:a,...r||{}})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(t.activity_cost_error?`Added project user; rate failed`:t.activity_cost?`Added project user and rate`:`Added project user`,t.activity_cost_error?`error`:`ok`),!0}catch(e){return P(e,`Unable to add project user`),!1}finally{F(`project:${e}:user`,!1)}}async function Lt(e,t){let n=t.trim();if(!n)return!1;F(`project:${e}:user`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/users/remove`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({user:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(`Removed project user`,`ok`),!0}catch(e){return N(e instanceof Error?e.message:`Unable to remove project user`,`error`),!1}finally{F(`project:${e}:user`,!1)}}async function Rt(e,t,n){let r=t.trim();if(!r)return!1;F(`project:${e}:historical`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/historical-members`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({person:r,candidate_id:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),Te(null),N(`Added historical project member`,`ok`),!0}catch(t){if(t instanceof cn&&t.status===409){let n=t.payload?.candidates||[];if(n.length>0)return Te({projectId:e,person:r,candidates:n}),N(`Choose the matching person record`,`error`),!1}return P(t,`Unable to add historical member`),!1}finally{F(`project:${e}:historical`,!1)}}async function V(e,t){let n=t.trim();if(!n)return!1;F(`project:${e}:historical`,!0);try{let t=await G(`/dashboard/api/projects/${encodeURIComponent(e)}/historical-members/remove`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({source_user_id:n})});return S(n=>n.map(n=>n.id===e?t.project:n)),N(`Removed historical project member`,`ok`),!0}catch(e){return N(e instanceof Error?e.message:`Unable to remove historical member`,`error`),!1}finally{F(`project:${e}:historical`,!1)}}async function H(e,t,n){F(`project:${e}:wiki`,!0);try{await G(`/dashboard/api/projects/${encodeURIComponent(e)}/wiki-match`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t,row_key:n})}),N(t===`no_row`?`Marked as no wiki row`:`Confirmed wiki match`,`ok`),await zt()}catch(e){P(e,`Unable to save wiki match`)}finally{F(`project:${e}:wiki`,!1)}}async function zt(){F(`wikiMatches`,!0);try{ae(await G(`/dashboard/api/projects/wiki-matches`)),N(`Loaded wiki match preview`,`ok`)}catch(e){P(e,`Unable to load wiki matches`)}finally{F(`wikiMatches`,!1)}}async function Bt(e){F(`gig:${e}:detail`,!0);try{se(await G(`/dashboard/api/gigs/${encodeURIComponent(e)}`))}catch(e){se(null),P(e,`Unable to load gig`)}finally{F(`gig:${e}:detail`,!1)}}async function Vt(){await Ot(),w&&await Bt(w)}async function Ht(){if(ut(`gigs:read`)){F(`notifications`,!0);try{let e=await G(`/dashboard/api/notifications?limit=20`);Ue(e.stale_days||7),E(e.notifications||[])}catch(e){P(e,`Unable to load notifications`)}finally{F(`notifications`,!1)}}}async function Ut(e,t){F(`gig:${e}:status`,!0);try{let n=(await G(`/dashboard/api/gigs/${encodeURIComponent(e)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:t})})).discord_title_sync?.status;N(n===`error`?`Updated gig status; Discord title sync failed`:`Updated gig status`,n===`error`?`error`:`ok`),await Ot(),w===e&&await Bt(e)}catch(e){P(e,`Unable to update gig`)}finally{F(`gig:${e}:status`,!1)}}async function U(e,t,n){F(`application:${t}:status`,!0);try{await G(`/dashboard/api/gigs/${encodeURIComponent(e)}/applications/${encodeURIComponent(t)}/status`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({status:n})}),N(`Updated candidate status`,`ok`),await Ot(),w===e&&await Bt(e)}catch(e){P(e,`Unable to update candidate`)}finally{F(`application:${t}:status`,!1)}}function W(){let e=new URLSearchParams({limit:`25`});A.trim()&&e.set(`query`,A.trim()),Ge&&e.set(`is_member`,Ge);for(let[t,n]of Object.entries(qe))n&&e.set(t,n);return`/dashboard/api/people?${e.toString()}`}async function Wt(){F(`people`,!0);try{D(await G(W()))}catch(e){P(e,`Unable to load people`)}finally{F(`people`,!1)}}function Gt(){let e=new URLSearchParams({limit:`25`});j.trim()&&e.set(`query`,j.trim()),et&&e.set(`onboarding_state`,et),nt.trim()&&e.set(`onboarder`,nt.trim());for(let[t,n]of Object.entries(it))n&&e.set(t,n);return`/dashboard/api/onboarding?${e.toString()}`}async function Kt(){F(`onboarding`,!0);try{k(await G(Gt()))}catch(e){P(e,`Unable to load onboarding`)}finally{F(`onboarding`,!1)}}async function qt(){F(`audit`,!0);try{he(await G(`/dashboard/api/audit-events?limit=25`))}catch(e){P(e,`Unable to load audit events`)}finally{F(`audit`,!1)}}async function Jt(){F(`agent`,!0);try{_e(await G(`/dashboard/api/agent?limit=100`))}catch(e){P(e,`Unable to load agent report`)}finally{F(`agent`,!1)}}async function Yt(e){F(`detail:${e}`,!0),N(`Loading ${e}`);try{ye(await G(`/dashboard/api/jobs/${encodeURIComponent(e)}`)),N(`Loaded ${e}`,`ok`)}catch(e){P(e,`Unable to load job detail`)}finally{F(`detail:${e}`,!1)}}async function Xt(e){F(`rerun:${e}`,!0),N(`Rerunning ${e}`);try{let t=await G(`/dashboard/api/jobs/${encodeURIComponent(e)}/rerun`,{method:`POST`});t.dry_run?N(`Dry run only: would rerun ${t.would_enqueue?.job_type||e}`,`warning`):(N(`Queued rerun ${t.job_id}`,`ok`),await Dt())}catch(e){P(e,`Unable to rerun job`)}finally{F(`rerun:${e}`,!1)}}async function Zt(){F(`syncPeople`,!0),N(`Queueing people sync`);try{let e=await G(`/dashboard/api/sync/people`,{method:`POST`});e.dry_run?N(`Dry run only: would queue ${e.would_enqueue?.job_type||`people sync`}`,`warning`):N(`Queued people sync ${e.job_id}`,`ok`)}catch(e){P(e,`Unable to queue people sync`)}finally{F(`syncPeople`,!1)}}async function Qt(e,t){let n=String(e||``).trim(),r=t.trim();if(!n){N(`Missing CRM contact id`,`error`);return}if(!r){N(`Enter a 508 username`,`error`);return}F(`onboarder:${n}`,!0),N(`Assigning ${r}`);try{let e=await G(`/dashboard/api/onboarding/${encodeURIComponent(n)}/onboarder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({onboarder:r})});k(t=>t.map(t=>t.crm_contact_id===e.contact_id?{...t,onboarder:e.onboarder,onboarding_state:e.state_updated&&e.onboarding_state?e.onboarding_state:t.onboarding_state,onboarding_status_label:e.onboarding_status_label||(e.state_updated?void 0:t.onboarding_status_label)}:t)),N(`Assigned ${e.onboarder}`,`ok`)}catch(e){P(e,`Unable to assign onboarder`)}finally{F(`onboarder:${n}`,!1)}}async function $t(e){let t=e.email.trim().toLowerCase(),n=e.first_name.trim();if(!t?.endsWith(`@508.dev`))return N(`Enter the engineer's @508.dev email`,`error`),null;if(!n)return N(`Enter the engineer name`,`error`),null;F(`engineerSetup`,!0);try{let r=await G(`/dashboard/api/onboarding/engineers`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,email:t,first_name:n})});return N(`Set up ${r.employee_name||r.user||t}`,`ok`),r}catch(e){if(e instanceof cn&&e.status===409){let t=e.payload&&typeof e.payload==`object`?e.payload:null,n=(Array.isArray(t?.matches)?t.matches:[]).map(e=>e?.label||e?.email).filter(Boolean).slice(0,2).join(`, `);N(n?`Similar account exists: ${n}`:`Similar account exists; confirm before creating`,`error`)}else N(e instanceof Error?e.message:`Unable to set up engineer`,`error`);return null}finally{F(`engineerSetup`,!1)}}async function en(){F(`logout`,!0);try{let e=await G(`/auth/logout`,{method:`POST`});window.location.assign(e.end_session_url||`/dashboard`)}catch(e){P(e,`Unable to log out`),F(`logout`,!1)}}(0,l.useEffect)(()=>{Ct().then(e=>{let t=fn(),n=e.includes(on[t])?t:Object.keys(an).find(t=>e.includes(on[t]))||`people`;ce(n===`gigs`?pn():``),ue(n===`projects`?pn(`projects`):``),i(n),(!Object.hasOwn(an,dn())||n!==t)&&window.history.replaceState({view:n},``,an[n])}).catch(e=>{P(e,`Dashboard failed to load`)})},[]),(0,l.useEffect)(()=>{let e=()=>{ce(pn()),ue(pn(`projects`)),M.current(fn(),!1)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,l.useEffect)(()=>{if(!a.message)return;let e=window.setTimeout(()=>o({message:``}),4500);return()=>window.clearTimeout(e)},[a.message]),(0,l.useEffect)(()=>{},[]),(0,l.useEffect)(()=>{s.length!==0&&(ut(`gigs:read`)&&Ht(),r===`people`&&Wt(),r===`gigs`&&Ot(),r===`projects`&&kt(),r===`onboarding`&&Kt(),r===`jobs`&&Dt(),r===`agent`&&Jt(),r===`audit`&&qt())},[r]),(0,l.useEffect)(()=>{s.length!==0&&(ut(`gigs:read`)&&Ht(),r===`people`&&Wt(),r===`gigs`&&Ot(),r===`projects`&&kt(),r===`onboarding`&&Kt(),r===`jobs`&&Dt(),r===`agent`&&Jt(),r===`audit`&&qt())},[s]),(0,l.useEffect)(()=>{r===`jobs`&&s.length>0&&Dt()},[Oe,Ae]),(0,l.useEffect)(()=>{r===`gigs`&&s.length>0&&Ot()},[Pe,Ie]),(0,l.useEffect)(()=>{r===`projects`&&s.length>0&&kt()},[Be]),(0,l.useEffect)(()=>{r===`gigs`&&w&&s.length>0&&Bt(w)},[r,w,s]),(0,l.useEffect)(()=>{r===`people`&&s.length>0&&Wt()},[Ge]),(0,l.useEffect)(()=>{r===`people`&&s.length>0&&Wt()},[qe]),(0,l.useEffect)(()=>{r===`onboarding`&&s.length>0&&Kt()},[et]),(0,l.useEffect)(()=>{r===`onboarding`&&s.length>0&&Kt()},[it]);let tn=(0,l.useMemo)(()=>hn(`jobs`,f,Ee.jobs),[f,Ee.jobs]),nn=(0,l.useMemo)(()=>hn(`people`,pe,Ee.people),[pe,Ee.people]),rn=(0,l.useMemo)(()=>hn(`onboarding`,O,Ee.onboarding),[O,Ee.onboarding]),ln=(0,l.useMemo)(()=>hn(`gigs`,m,Ee.gigs),[m,Ee.gigs]),mn=(0,l.useMemo)(()=>hn(`projects`,ee,Ee.projects),[ee,Ee.projects]),gn=(0,l.useMemo)(()=>oe?.id===w?oe:ln.find(e=>e.id===w)||null,[oe,w,ln]),_n=(0,l.useMemo)(()=>mn.find(e=>e.id===le)||null,[le,mn]),vn=(0,l.useMemo)(()=>hn(`audit`,me,Ee.audit),[me,Ee.audit]),yn=(0,l.useMemo)(()=>f.reduce((e,t)=>(e[t.status]=(e[t.status]||0)+1,e),{}),[f]),bn=Object.keys(sn).filter(e=>!qe[e]),xn=Object.keys(sn).filter(e=>e!==`sync_status`&&e!==`email_508`&&!it[e]);function Tn(e){if(e.type===`stale_recruiting_gig`){let t=e.engagement_id||(e.id.startsWith(`stale-recruiting:`)?e.id.slice(17):``);t?yt(t):(Fe(`recruiting`),ht(`gigs`,!0))}fe(!1)}(0,l.useEffect)(()=>{!bn.includes(Ye)&&bn[0]&&Xe(bn[0])},[bn,Ye]),(0,l.useEffect)(()=>{let e=sn[Ye]?.options;e?.[0]&&!e.some(([e])=>e===Ze)&&Qe(e[0][0])},[Ye,Ze]),(0,l.useEffect)(()=>{!xn.includes(ot)&&xn[0]&&st(xn[0])},[xn,ot]),(0,l.useEffect)(()=>{let e=sn[ot]?.options;e?.[0]&&!e.some(([e])=>e===ct)&<(e[0][0])},[ot,ct]);let En=[t?.email,t?.crm_contact_id?`CRM ${t.crm_contact_id}`:``,t?.actor_provider].filter(Boolean).join(` | `);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`header`,{className:`sticky top-0 z-20 border-b bg-background/90 backdrop-blur`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col gap-4 px-5 py-4 md:flex-row md:items-center md:justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-xl font-bold`,children:`508 Operations Dashboard`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Operations view for authenticated 508 operators.`})]}),(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[ut(`gigs:read`)?(0,L.jsx)(`div`,{className:`relative`,children:(0,L.jsxs)(z,{id:`notifications`,type:`button`,variant:`outline`,size:`icon`,"aria-label":`Notifications`,"aria-expanded":de,onClick:()=>fe(e=>!e),children:[(0,L.jsx)(h,{}),T.length>0?(0,L.jsx)(`span`,{className:`absolute -right-1 -top-1 grid min-h-5 min-w-5 place-items-center rounded-full bg-red-500 px-1 text-[11px] font-bold text-white`,children:T.length}):null]})}):null,(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-0.5 text-right text-sm text-muted-foreground`,children:[(0,L.jsx)(`strong`,{id:`userName`,className:`truncate text-foreground`,children:t?.display_name||t?.email||t?.subject||`Loading user`}),(0,L.jsx)(`span`,{id:`userMeta`,className:`truncate`,children:En||`Checking session`})]}),(0,L.jsxs)(z,{id:`logout`,type:`button`,variant:`outline`,onClick:en,disabled:be.logout,children:[(0,L.jsx)(x,{}),`Log out`]})]})]})}),(0,L.jsx)(Sn,{open:de,notifications:T,loading:be.notifications,onClose:()=>fe(!1),onRefresh:Ht,onOpenNotification:Tn}),(0,L.jsx)(wn,{toast:a}),null,(0,L.jsx)(Cn,{choice:we,loading:!!(we&&be[`project:${we.projectId}:historical`]),crmContactUrl:gt,onClose:()=>Te(null),onChoose:e=>{we&&Rt(we.projectId,we.person,e)}}),(0,L.jsxs)(`main`,{className:`mx-auto grid max-w-7xl grid-cols-1 gap-5 px-5 py-5 md:grid-cols-[190px_minmax(0,1fr)]`,children:[(0,L.jsx)(`nav`,{className:`grid content-start gap-1 md:sticky md:top-24`,"aria-label":`Dashboard sections`,children:[[`people`,`People`,ie],[`gigs`,`Gigs`,g],[`projects`,`Projects`,b],[`onboarding`,`Onboarding`,_],[`jobs`,`Jobs`,g],[`agent`,`Agent`,te],[`audit`,`Audit`,y]].filter(([e])=>pt(e)).map(([e,t,n])=>(0,L.jsxs)(`a`,{className:I(`flex min-h-10 items-center gap-2 rounded-md border border-transparent px-3 text-sm font-extrabold text-muted-foreground hover:border-border hover:bg-secondary hover:text-foreground`,r===e&&`border-primary bg-accent text-accent-foreground`),"data-view-link":e,"data-permission":on[e],href:an[e],"aria-current":r===e?`page`:void 0,onClick:t=>{t.preventDefault(),ht(e,!0)},children:[(0,L.jsx)(n,{className:`size-4`}),t]},e))}),(0,L.jsxs)(`div`,{className:`grid min-w-0 gap-5`,children:[r===`people`?(0,L.jsx)(Un,{crmBaseUrl:u,people:nn,sort:Ee.people,canSync:ft(`people:sync`),loading:be,peopleQuery:A,peopleMember:Ge,peopleFilters:qe,peopleFilterKind:Ye,peopleFilterValue:Ze,peopleFilterKeys:bn,onSearch:Wt,onSync:Zt,onSort:e=>vt(`people`,e),setPeopleQuery:We,setPeopleMember:Ke,setPeopleFilterKind:Xe,setPeopleFilterValue:Qe,addFilter:()=>{Je(e=>({...e,[Ye]:Ze}))},removeFilter:e=>{Je(t=>{let n={...t};return delete n[e],n})},crmContactUrl:gt,crmAttachmentUrl:_t}):null,r===`gigs`?(0,L.jsx)(Rn,{gigs:ln,selectedGig:gn,selectedGigId:w,sort:Ee.gigs,loading:be,status:Pe,limit:Ie,staleDays:He,canWrite:ut(`gigs:write`),crmContactUrl:gt,crmAttachmentUrl:_t,setStatus:Fe,setLimit:Le,onRefresh:Vt,onSort:e=>vt(`gigs`,e),onOpenGig:yt,onCloseGig:bt,onUpdateStatus:Ut,onUpdateApplicationStatus:U}):null,r===`projects`?(0,L.jsx)(Fn,{projects:mn,selectedProject:_n,selectedProjectId:le,summary:C,wikiMatches:re,sort:Ee.projects,loading:be,query:Re,status:Be,canSync:ft(`projects:sync`),canWrite:ut(`projects:write`),crmContactUrl:gt,setQuery:ze,setStatus:Ve,onSearch:kt,onSync:At,onSearchCustomers:jt,onSearchContacts:Mt,onSearchAccountManagers:Nt,onLoadCostCenters:Pt,onCreateProject:R,onUpdateStatus:Ft,onBulkUpdate:It,onAddUser:B,onRemoveUser:Lt,onAddHistoricalMember:Rt,onRemoveHistoricalMember:V,onUpdateWikiMatch:H,onWikiMatches:zt,onOpenProject:xt,onCloseProject:St,onSort:e=>vt(`projects`,e)}):null,r===`onboarding`?(0,L.jsx)(Wn,{people:rn,sort:Ee.onboarding,loading:be,onboardingQuery:j,onboardingState:et,onboarderFilter:nt,onboardingFilters:it,onboardingFilterKind:ot,onboardingFilterValue:ct,onboardingFilterKeys:xn,onSearch:Kt,onSort:e=>vt(`onboarding`,e),onAssign:Qt,onSetupEngineer:$t,setOnboardingQuery:$e,setOnboardingState:tt,setOnboarderFilter:rt,setOnboardingFilterKind:st,setOnboardingFilterValue:lt,addFilter:()=>{at(e=>({...e,[ot]:ct}))},removeFilter:e=>{at(t=>{let n={...t};return delete n[e],n})},crmContactUrl:gt,crmAttachmentUrl:_t,canWrite:ut(`onboarding:write`)}):null,r===`jobs`?(0,L.jsx)(Qn,{jobs:tn,jobDetail:ve,sort:Ee.jobs,loading:be,minutes:Oe,status:Ae,jobType:Me,jobCounts:yn,canWrite:ft(`jobs:write`),setMinutes:ke,setStatus:je,setJobType:Ne,onSearch:Dt,onSort:e=>vt(`jobs`,e),onDetail:Yt,onRerun:Xt}):null,r===`audit`?(0,L.jsx)($n,{events:vn,sort:Ee.audit,loading:be,onRefresh:qt,onSort:e=>vt(`audit`,e)}):null,r===`agent`?(0,L.jsx)(er,{report:ge,loading:be,onRefresh:Jt}):null]})]})]})}function Sn({open:e,notifications:t,loading:n,onClose:r,onRefresh:i,onOpenNotification:a}){return e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-40`,"aria-labelledby":`notificationsTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close notifications`,onClick:r}),(0,L.jsxs)(`aside`,{className:`absolute right-0 top-0 grid h-full w-full max-w-md grid-rows-[auto_minmax(0,1fr)] border-l bg-background shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b p-4`,children:[(0,L.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,L.jsx)(`strong`,{id:`notificationsTitle`,className:`text-base`,children:`Notifications`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.length===0?`No active notifications`:`${t.length} active`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,onClick:i,disabled:n,children:[(0,L.jsx)(S,{}),`Refresh`]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close`,onClick:r,children:(0,L.jsx)(ae,{})})]})]}),(0,L.jsx)(`div`,{className:`min-h-0 overflow-auto p-4`,children:t.length===0?(0,L.jsx)(`div`,{className:`rounded-md border border-dashed p-6 text-sm text-muted-foreground`,children:`No active notifications.`}):(0,L.jsx)(`div`,{className:`grid gap-3`,children:t.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`grid gap-2 rounded-md border p-3 text-left hover:bg-secondary`,onClick:()=>a(e),children:[(0,L.jsx)(`span`,{className:`text-sm font-bold`,children:e.title}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.message})]},e.id))})})]})]}):null}function Cn({choice:e,loading:t,crmContactUrl:n,onClose:r,onChoose:i}){return e?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`historicalPersonChoiceTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close person selection`,onClick:r}),(0,L.jsxs)(`div`,{className:`relative grid w-full max-w-2xl gap-4 rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`historicalPersonChoiceTitle`,className:`block text-base`,children:`Choose person record`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.person})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close person selection`,onClick:r,children:(0,L.jsx)(ae,{})})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:e.candidates.map(e=>(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3 md:grid-cols-[minmax(0,1fr)_auto] md:items-center`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`strong`,{className:`block truncate`,children:e.label||e.full_name||e.email||`Person`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 text-sm text-muted-foreground`,children:[e.email?(0,L.jsx)(`span`,{children:e.email}):null,e.sources?.length?(0,L.jsx)(`span`,{children:e.sources.join(`, `)}):null,e.erpnext_user_id?(0,L.jsxs)(`span`,{children:[`ERP `,e.erpnext_user_id]}):null,e.supplier_erpnext_id?(0,L.jsxs)(`span`,{children:[`Supplier `,e.supplier_erpnext_id]}):null,e.crm_contact_id&&n(e.crm_contact_id)?(0,L.jsx)(`a`,{className:`font-semibold text-primary underline-offset-4 hover:underline`,href:n(e.crm_contact_id),target:`_blank`,rel:`noreferrer`,children:`CRM`}):null]})]}),(0,L.jsx)(z,{type:`button`,disabled:t,onClick:()=>i(e.candidate_id),children:`Select`})]},e.candidate_id))})]})]}):null}function wn({toast:e}){return e.message?(0,L.jsx)(`div`,{id:`toast`,role:`status`,className:I(`fixed bottom-5 right-5 z-50 max-w-sm rounded-md border bg-background px-4 py-3 text-sm font-semibold shadow-lg`,e.tone===`ok`&&`border-emerald-500/40 text-emerald-300`,e.tone===`warning`&&`border-amber-500/40 text-amber-200`,e.tone===`error`&&`border-red-500/40 text-red-300`),children:e.message}):null}function Tn({filters:e,onRemove:t,suffix:n=`filter`}){return(0,L.jsx)(`fieldset`,{className:`m-0 flex min-h-7 flex-wrap gap-2 border-0 p-0`,"aria-label":`Active filters`,children:Object.entries(e).map(([e,r])=>{let i=sn[e],a=i.options.find(([e])=>e===r),o=`${i.label}: ${a?a[1]:r}`;return(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,className:`rounded-full`,"aria-label":`Remove ${o} ${n}`,onClick:()=>t(e),children:[o,` x`]},e)})})}var En=[`recruiting`,`filled`,`unknown`,`lost`,`outdated`],Dn=[`suggested`,`interested`,`reviewing`,`contacted`,`accepted`,`rejected`,`withdrawn`];function On(e){return String(e||``).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim().replace(/\b\w/g,e=>e.toUpperCase())}function kn(e){let t=[e.last_activity_at,e.last_status_changed_at,e.posted_at,e.created_at].map(e=>e?new Date(e).getTime():NaN).filter(e=>!Number.isNaN(e));return t.length>0?new Date(Math.max(...t)).toISOString():``}function An(e,t){if(e.status!==`recruiting`)return null;let n=Kt(kn(e));return n===null||ne.projects.map(e=>e.id),[e.projects]),h=(0,l.useMemo)(()=>new Set(p),[p]),g=n.filter(e=>h.has(e)),_=e.projects.length>0&&g.length===e.projects.length;(0,l.useEffect)(()=>{r(e=>e.filter(e=>h.has(e)))},[h]);function y(e,t){r(n=>t?Array.from(new Set([...n,e])):n.filter(t=>t!==e))}async function b(){let t={};i&&(t.status=i),o&&(t.project_type=o),await e.onBulkUpdate(g,t)&&(r([]),a(``),s(``),u(!1))}let x=(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-[minmax(0,1fr)_180px_auto_auto_auto] md:items-end`,children:[(0,L.jsxs)(H,{children:[`Search projects`,(0,L.jsx)(V,{id:`projectQuery`,value:e.query,autoComplete:`off`,placeholder:`Project, customer, ERP id`,onChange:t=>e.setQuery(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`projectStatus`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:``,children:`Any status`})]})]}),(0,L.jsxs)(z,{id:`refreshProjects`,type:`button`,onClick:e.onSearch,disabled:e.loading.projects,children:[(0,L.jsx)(S,{}),`Refresh`]}),e.canSync?(0,L.jsxs)(z,{id:`syncProjects`,type:`button`,variant:`outline`,onClick:e.onSync,disabled:e.loading.syncProjects,children:[(0,L.jsx)(S,{}),`Sync ERP`]}):null,(0,L.jsxs)(z,{id:`wikiProjectMatches`,type:`button`,variant:`outline`,onClick:e.onWikiMatches,disabled:e.loading.wikiMatches,children:[(0,L.jsx)(C,{}),`Wiki match`]})]});return e.selectedProjectId&&!e.selectedProject&&e.loading.projects?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Project detail`})}),(0,L.jsx)(Rt,{className:`text-sm text-muted-foreground`,children:`Loading project.`})]})]}):e.selectedProjectId&&!e.selectedProject?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Project detail`})}),(0,L.jsxs)(Rt,{className:`grid gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This project is not in the current result set. Clear filters or refresh the project list.`}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onCloseProject,children:[(0,L.jsx)(m,{}),`Back to projects`]})]})]})]}):e.selectedProject?(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsx)(Ln,{project:e.selectedProject,loading:e.loading,canWrite:e.canWrite,crmContactUrl:e.crmContactUrl,onBack:e.onCloseProject,onUpdateStatus:e.onUpdateStatus,onAddUser:e.onAddUser,onRemoveUser:e.onRemoveUser,onAddHistoricalMember:e.onAddHistoricalMember,onRemoveHistoricalMember:e.onRemoveHistoricalMember})]}):(0,L.jsxs)(L.Fragment,{children:[x,(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-2`,"aria-label":`Project summary`,children:[(0,L.jsx)(vn,{id:`projectMetricOpen`,label:`Open`,value:e.summary.open_project_count||0}),(0,L.jsx)(vn,{id:`projectMetricTotal`,label:`Projects`,value:e.summary.project_count||0})]}),e.canWrite?(0,L.jsxs)(It,{className:`flex flex-wrap items-center justify-between gap-3 p-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Selected`}),(0,L.jsxs)(`strong`,{className:`block`,children:[g.length,` project(s)`]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsxs)(z,{type:`button`,onClick:()=>f(!0),children:[(0,L.jsx)(ee,{}),`New project`]}),(0,L.jsx)(z,{type:`button`,variant:`outline`,disabled:g.length===0,onClick:()=>u(!0),children:`Bulk edit`})]})]}):null,d?(0,L.jsx)(In,{loading:e.loading.createProject,onClose:()=>f(!1),onSearchCustomers:e.onSearchCustomers,onSearchContacts:e.onSearchContacts,onSearchAccountManagers:e.onSearchAccountManagers,onLoadCostCenters:e.onLoadCostCenters,onCreateProject:e.onCreateProject}):null,c?(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`bulkProjectEditTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close bulk project edit`,onClick:()=>u(!1)}),(0,L.jsxs)(`div`,{className:`relative grid w-full max-w-lg gap-4 rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`bulkProjectEditTitle`,className:`block text-base`,children:`Bulk edit projects`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[g.length,` selected`]})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close bulk project edit`,onClick:()=>u(!1),children:(0,L.jsx)(ae,{})})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsx)(`strong`,{className:`text-sm`,children:`Changes`}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{value:i,onChange:e=>a(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`No change`}),(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:`Completed`,children:`Completed`}),(0,L.jsx)(`option`,{value:`Cancelled`,children:`Cancelled`})]})]}),(0,L.jsxs)(H,{children:[`ERP Type`,(0,L.jsxs)(zt,{value:o,onChange:e=>s(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`No change`}),(0,L.jsx)(`option`,{value:`Internal`,children:`Internal`}),(0,L.jsx)(`option`,{value:`External`,children:`External`})]})]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>u(!1),children:`Cancel`}),(0,L.jsx)(z,{type:`button`,disabled:e.loading.projectsBulkUpdate||g.length===0||!i&&!o,onClick:()=>void b(),children:`Apply changes`})]})]})]}):null,(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`ERP projects`}),(0,L.jsx)(`span`,{id:`projectsStatus`,className:`text-sm text-muted-foreground`,children:e.loading.projects?`Loading`:`${e.projects.length} shown | synced ${Gt(e.summary.last_synced_at)}`})]}),(0,L.jsx)(yn,{hidden:e.projects.length!==0,children:`No projects match this view. Sync ERP projects if the cache is empty.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`projectsTable`,className:I(`min-w-[1100px]`,e.projects.length===0&&`hidden`),"aria-label":`ERP projects`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[e.canWrite?(0,L.jsx)(U,{className:`w-[48px]`,children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all visible projects`,checked:_,onChange:e=>{r(e.target.checked?p:[])}})}):null,(0,L.jsx)(_n,{className:`w-[24%]`,label:`Project`,scope:`projects`,sort:e.sort,sortKey:`display_name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[16%]`,label:`Customer`,scope:`projects`,sort:e.sort,sortKey:`customer`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[10%]`,label:`Status`,scope:`projects`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{className:`w-[16%]`,children:`Timeline`}),(0,L.jsx)(_n,{className:`w-[10%]`,label:`Roster`,scope:`projects`,sort:e.sort,sortKey:`roster_count`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[14%]`,label:`Modified`,scope:`projects`,sort:e.sort,sortKey:`modified`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{children:`ERP`})]})}),(0,L.jsx)(Ht,{id:`projectsBody`,children:e.projects.map(t=>{let n=t.roster_members||[];return(0,L.jsxs)(Ut,{children:[e.canWrite?(0,L.jsx)(W,{children:(0,L.jsx)(`input`,{type:`checkbox`,"aria-label":`Select ${t.display_name}`,checked:g.includes(t.id),onChange:e=>y(t.id,e.target.checked)})}):null,(0,L.jsxs)(W,{children:[(0,L.jsx)(`button`,{type:`button`,className:`text-left font-bold text-primary underline-offset-4 hover:underline`,onClick:()=>e.onOpenProject(t.id),children:t.display_name}),(0,L.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5`,children:[t.project_type?(0,L.jsx)(R,{variant:`neutral`,children:t.project_type}):null,t.linked_engagement_count?(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[t.linked_engagement_count,` linked gig`]}):null]})]}),(0,L.jsx)(W,{children:t.customer_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:t.customer_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[t.customer,(0,L.jsx)(v,{className:`size-3.5`})]}):t.customer||`None`}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:jn(t.source_status),children:t.source_status||`Unknown`})}),(0,L.jsx)(W,{children:[t.actual_start_date,t.actual_end_date].filter(Boolean).map(e=>Mn(e)).join(` to `)||`Not set`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`grid gap-1`,children:[(0,L.jsx)(`strong`,{children:n.length}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[n.map(Nn).slice(0,4).join(`, `)||`No ERP roster`,n.length>4?` +${n.length-4}`:``]})]})}),(0,L.jsx)(W,{children:Gt(t.source_modified_at)}),(0,L.jsx)(W,{className:`text-xs`,children:t.erpnext_project_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-mono font-semibold text-primary underline-offset-4 hover:underline`,href:t.erpnext_project_url,target:`_blank`,rel:`noreferrer`,children:[t.erpnext_project_id,(0,L.jsx)(v,{className:`size-3.5`})]}):(0,L.jsx)(`span`,{className:`font-mono`,children:`Unlinked`})})]},t.id)})})]})})]}),e.wikiMatches?(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Wiki match preview`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[e.wikiMatches.document?.title||`Client & Project Info`,` |`,` `,Gt(e.wikiMatches.document?.updatedAt)]})]}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`wikiMatchesTable`,className:`min-w-[920px]`,"aria-label":`Wiki matches`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`ERP project`}),(0,L.jsx)(U,{children:`Best wiki row`}),(0,L.jsx)(U,{children:`Confidence`}),(0,L.jsx)(U,{children:`Section`}),(0,L.jsx)(U,{children:`Decision`})]})}),(0,L.jsx)(Ht,{children:t.map((t,n)=>{let r=t.project,i=t.best_match?.row||{},a=t.manual_match?.match_status||``,o=r?.id||i.row_key||[i.section,i.Client].filter(Boolean).join(`:`)||`wiki-match-${n}`;return(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:r?.display_name||`Unknown`}),(0,L.jsxs)(W,{children:[(0,L.jsx)(`strong`,{children:i.Client||`No match`}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:[i.DRI,i.Members].filter(Boolean).join(` | `)})]}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:t.best_match?.confidence===`high`?`succeeded`:t.best_match?.confidence===`medium`?`running`:`neutral`,children:t.best_match?`${t.best_match.confidence} ${t.best_match.score}`:`none`})}),(0,L.jsx)(W,{children:i.section||``}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,L.jsx)(R,{variant:a===`confirmed`?`succeeded`:`neutral`,children:a===`no_row`?`No wiki row`:`Confirmed`}):null,e.canWrite&&r?.id?(0,L.jsxs)(L.Fragment,{children:[i.row_key?(0,L.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:e.loading[`project:${r.id}:wiki`],onClick:()=>void e.onUpdateWikiMatch(r.id,`confirmed`,i.row_key),children:`Confirm`}):null,(0,L.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:e.loading[`project:${r.id}:wiki`],onClick:()=>void e.onUpdateWikiMatch(r.id,`no_row`),children:`No row`})]}):null]})})]},o)})})]})})]}):null]})}function In(e){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(`new`),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)([]),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),[v,y]=(0,l.useState)([]),[b,x]=(0,l.useState)(`USD`),[ee,S]=(0,l.useState)(``),[C,te]=(0,l.useState)(``),[ne,re]=(0,l.useState)(``),[ie,oe]=(0,l.useState)(``),[se,w]=(0,l.useState)(``),[ce,le]=(0,l.useState)(``),[ue,T]=(0,l.useState)(`United States`),[E,de]=(0,l.useState)(``),[fe,pe]=(0,l.useState)(`new`),[D,O]=(0,l.useState)(``),[k,me]=(0,l.useState)(``),[he,ge]=(0,l.useState)([]),[_e,ve]=(0,l.useState)(``),[ye,be]=(0,l.useState)(``),[xe,Se]=(0,l.useState)(``),[Ce,we]=(0,l.useState)(``),[Te,Ee]=(0,l.useState)(``),[De,Oe]=(0,l.useState)(!1),[ke,Ae]=(0,l.useState)([{name:`Projects - 5`,cost_center_name:`Projects`}]),[je,Me]=(0,l.useState)(`Projects - 5`),[Ne,Pe]=(0,l.useState)(``),[Fe,Ie]=(0,l.useState)(!1),Le=(0,l.useRef)(e.onSearchCustomers),Re=(0,l.useRef)(e.onSearchContacts),ze=(0,l.useRef)(e.onSearchAccountManagers),Be=(0,l.useRef)(e.onLoadCostCenters),Ve=(0,l.useRef)(0),He=(0,l.useRef)(0),Ue=(0,l.useRef)(0),A=(0,l.useRef)(0),We=t.trim()?`Engineering for ${t.trim()}`.slice(0,140):``,Ge=[ne,ie,se,ce,E].some(e=>e.trim()),Ke=[_e,ye,xe,Ce,Te].some(e=>e.trim()),qe=t.trim()&&(r===`new`?a.trim():u.trim())&&!e.loading;(0,l.useEffect)(()=>{Le.current=e.onSearchCustomers},[e.onSearchCustomers]),(0,l.useEffect)(()=>{Re.current=e.onSearchContacts},[e.onSearchContacts]),(0,l.useEffect)(()=>{ze.current=e.onSearchAccountManagers},[e.onSearchAccountManagers]),(0,l.useEffect)(()=>{Be.current=e.onLoadCostCenters},[e.onLoadCostCenters]),(0,l.useEffect)(()=>{let e=!0,t=Ve.current+1;return Ve.current=t,Be.current().then(n=>{!e||Ve.current!==t||(Ae(n),Me(e=>n.some(t=>t.name===e)?e:`Projects - 5`))}),()=>{e=!1}},[]),(0,l.useEffect)(()=>{if(r!==`existing`){He.current+=1,p([]);return}let e=!0,t=He.current+1;He.current=t;let n=window.setTimeout(()=>{Le.current(s).then(n=>{!e||He.current!==t||p(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,s]),(0,l.useEffect)(()=>{if(r!==`new`){Ue.current+=1,y([]);return}let e=!0,t=Ue.current+1;Ue.current=t;let n=window.setTimeout(()=>{ze.current(m).then(n=>{!e||Ue.current!==t||y(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,m]),(0,l.useEffect)(()=>{if(r!==`new`||fe!==`existing`){A.current+=1,ge([]);return}let e=!0,t=A.current+1;A.current=t;let n=window.setTimeout(()=>{Re.current(D).then(n=>{!e||A.current!==t||ge(n)})},250);return()=>{e=!1,window.clearTimeout(n)}},[r,fe,D]);async function Je(){qe&&await e.onCreateProject({project_name:t.trim(),customer_mode:r,customer_name:r===`new`?a.trim():void 0,customer:r===`existing`?u.trim():void 0,account_manager:r===`new`&&g.trim()||void 0,default_billing_currency:r===`new`?b.trim()||`USD`:void 0,default_cost_center:je.trim()||`Projects - 5`,activity_type:Fe&&Ne.trim()||void 0,customer_details:r===`new`&&ee.trim()||void 0,customer_website:r===`new`&&C.trim()||void 0,address_line1:r===`new`&&ne.trim()||void 0,address_line2:r===`new`&&ie.trim()||void 0,address_city:r===`new`&&se.trim()||void 0,address_state:r===`new`&&ce.trim()||void 0,address_country:r===`new`&&ne.trim()?ue.trim()||`United States`:void 0,address_postal_code:r===`new`&&E.trim()||void 0,contact:r===`new`&&fe===`existing`&&k.trim()||void 0,contact_first_name:r===`new`&&fe===`new`&&_e.trim()||void 0,contact_last_name:r===`new`&&fe===`new`&&ye.trim()||void 0,contact_email:r===`new`&&fe===`new`&&xe.trim()||void 0,contact_phone:r===`new`&&fe===`new`&&Ce.trim()||void 0,contact_mobile:r===`new`&&fe===`new`&&Te.trim()||void 0})&&e.onClose()}return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 grid place-items-center p-4`,"aria-labelledby":`createProjectTitle`,"aria-modal":`true`,role:`dialog`,children:[(0,L.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-default bg-black/45`,"aria-label":`Close project creation`,onClick:e.onClose}),(0,L.jsxs)(`div`,{className:`relative grid max-h-[90vh] w-full max-w-2xl gap-4 overflow-y-auto rounded-md border bg-background p-5 shadow-2xl`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`strong`,{id:`createProjectTitle`,className:`block text-base`,children:`New ERP project`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Creates a project and links a new or existing customer.`})]}),(0,L.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Close project creation`,onClick:e.onClose,children:(0,L.jsx)(ae,{})})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Project name *`,(0,L.jsx)(V,{value:t,autoComplete:`off`,maxLength:140,placeholder:`Acme Portal`,onChange:e=>n(e.target.value)})]}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Customer`}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`new`,`existing`].map(e=>(0,L.jsx)(z,{type:`button`,variant:r===e?`default`:`outline`,onClick:()=>i(e),children:e===`new`?`New customer`:`Existing customer`},e))})]}),r===`new`?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Customer name *`,(0,L.jsx)(V,{value:a,autoComplete:`off`,maxLength:140,placeholder:`Acme`,onChange:e=>o(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Account manager`,(0,L.jsx)(V,{value:m,autoComplete:`off`,placeholder:`Search @508.dev user`,onChange:e=>{h(e.target.value),_(``)}})]}),m.trim().length>=2?(0,L.jsx)(`div`,{className:`grid max-h-40 gap-2 overflow-y-auto rounded-md border p-2 md:col-span-2`,children:v.length?v.map(e=>{let t=e.email||e.name||``;return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpAccountManager`,value:t,checked:g===t,onChange:()=>{_(t),h(t)}}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:e.full_name||t}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:t})]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`No enabled @508.dev users found.`})}):null]}):(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Find customer *`,(0,L.jsx)(V,{value:s,autoComplete:`off`,placeholder:`Search customer`,onChange:e=>c(e.target.value)})]}),(0,L.jsx)(`div`,{className:`grid max-h-48 gap-2 overflow-y-auto rounded-md border p-2`,children:f.length?f.map(e=>{let t=e.name||e.customer_name||``;return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpCustomer`,value:t,checked:u===t,onChange:()=>d(t)}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:e.customer_name||t}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:[t,e.default_currency].filter(Boolean).join(` | `)})]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`Search at least two characters.`})})]}),r===`new`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Customer details`,(0,L.jsx)(`textarea`,{value:ee,className:`min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground shadow-xs transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,maxLength:2e3,placeholder:`More information`,onChange:e=>S(e.target.value)})]}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Website`,(0,L.jsx)(V,{value:C,autoComplete:`url`,placeholder:`https://example.com`,onChange:e=>te(e.target.value)})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,L.jsx)(`strong`,{className:`text-sm text-foreground`,children:`Contact`}),(0,L.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[`new`,`existing`].map(e=>(0,L.jsx)(z,{type:`button`,size:`sm`,variant:fe===e?`default`:`outline`,onClick:()=>pe(e),children:e===`new`?`New`:`Existing`},e))})]}),fe===`new`?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{children:[`First name `,Ke?`*`:``,(0,L.jsx)(V,{value:_e,autoComplete:`given-name`,onChange:e=>ve(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Last name`,(0,L.jsx)(V,{value:ye,autoComplete:`family-name`,onChange:e=>be(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Email`,(0,L.jsx)(V,{value:xe,type:`email`,autoComplete:`email`,onChange:e=>Se(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Phone`,(0,L.jsx)(V,{value:Ce,type:`tel`,autoComplete:`tel`,onChange:e=>we(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Mobile`,(0,L.jsx)(V,{value:Te,type:`tel`,autoComplete:`tel`,onChange:e=>Ee(e.target.value)})]})]}):(0,L.jsxs)(`div`,{className:`grid gap-3`,children:[(0,L.jsxs)(H,{children:[`Find contact`,(0,L.jsx)(V,{value:D,autoComplete:`off`,placeholder:`Search name or email`,onChange:e=>O(e.target.value)})]}),(0,L.jsx)(`div`,{className:`grid max-h-48 gap-2 overflow-y-auto rounded-md border p-2`,children:he.length?he.map(e=>{let t=e.name||``,n=e.full_name||t,r=[{key:`company`,value:e.company_name},{key:`email`,value:e.email_id},{key:`phone`,value:e.phone},{key:`mobile`,value:e.mobile_no}].filter(e=>!!e.value);return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-sm px-2 py-1.5 hover:bg-secondary`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`erpContact`,value:t,checked:k===t,onChange:()=>me(t)}),(0,L.jsxs)(`span`,{className:`grid gap-0.5 text-sm`,children:[(0,L.jsx)(`strong`,{children:(0,L.jsx)(bn,{value:n,query:D})}),r.length?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:r.map((e,t)=>(0,L.jsxs)(`span`,{children:[t>0?` | `:``,(0,L.jsx)(bn,{value:e.value,query:D})]},e.key))}):null]})]},t)}):(0,L.jsx)(`span`,{className:`px-2 py-3 text-sm text-muted-foreground`,children:`Search at least two characters.`})})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,L.jsx)(`strong`,{className:`text-sm text-foreground md:col-span-2`,children:`Address`}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Address line 1 `,Ge?`*`:``,(0,L.jsx)(V,{value:ne,autoComplete:`address-line1`,onChange:e=>re(e.target.value)})]}),(0,L.jsxs)(H,{className:`md:col-span-2`,children:[`Address line 2`,(0,L.jsx)(V,{value:ie,autoComplete:`address-line2`,onChange:e=>oe(e.target.value)})]}),(0,L.jsxs)(H,{children:[`City`,(0,L.jsx)(V,{value:se,autoComplete:`address-level2`,onChange:e=>w(e.target.value)})]}),(0,L.jsxs)(H,{children:[`State`,(0,L.jsx)(V,{value:ce,autoComplete:`address-level1`,onChange:e=>le(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Postal code`,(0,L.jsx)(V,{value:E,autoComplete:`postal-code`,onChange:e=>de(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Country`,(0,L.jsx)(V,{value:ue,autoComplete:`country-name`,onChange:e=>T(e.target.value)})]})]})]}):null,(0,L.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>Oe(e=>!e),children:De?`Hide advanced`:`Show advanced`}),De?(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[r===`new`?(0,L.jsxs)(H,{children:[`Billing currency`,(0,L.jsx)(V,{value:b,autoComplete:`off`,maxLength:3,onChange:e=>x(e.target.value.toUpperCase())})]}):null,(0,L.jsxs)(H,{children:[`Cost center`,(0,L.jsx)(zt,{value:je,onChange:e=>Me(e.target.value),children:ke.map(e=>{let t=e.name||``;return(0,L.jsx)(`option`,{value:t,children:[t,e.company].filter(Boolean).join(` | `)},t)})})]}),(0,L.jsxs)(H,{children:[`Activity type`,(0,L.jsx)(V,{value:Fe?Ne:We,autoComplete:`off`,maxLength:140,placeholder:We||`Engineering for project`,onChange:e=>{Ie(!0),Pe(e.target.value)}})]})]}):null]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(z,{type:`button`,disabled:!qe,onClick:()=>void Je(),children:`Create project`})]})]})]})}function Ln(e){let t=e.project,n=t.roster_members||[],[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(``),[h,g]=(0,l.useState)(``),_=[t.actual_start_date||t.expected_start_date,t.actual_end_date||t.expected_end_date].filter(Boolean).map(e=>Mn(e)).join(` to `)||`Not set`,y=typeof t.percent_complete==`number`?`${Math.round(t.percent_complete)}%`:`Not set`,b=a.find(e=>e.candidate_id===s),x=r.trim().includes(`@`)?r.trim().length>=5:r.trim().length>=3,ee=!!(u.trim()||f.trim()||h.trim()),S=Pn(f),C=Pn(h),te=!!((f.trim()||h.trim())&&!u.trim()),re=!!(u.trim()&&(!f.trim()||!h.trim())),ae=!!(f.trim()&&S===void 0)||!!(h.trim()&&C===void 0),oe=te||re||ae||S!==void 0&&S<0||C!==void 0&&C<0,se=ee&&!oe?{activity_type:u.trim(),billing_rate:S,costing_rate:C}:void 0;(0,l.useEffect)(()=>{if(!e.canWrite)return;let t=r.trim();if(s&&b&&t===(b.email||b.label||``))return;if(s&&c(``),!(t.includes(`@`)?t.length>=5:t.length>=3)){o([]);return}let n=new AbortController,i=window.setTimeout(()=>{G(`/dashboard/api/project-member-candidates?query=${encodeURIComponent(t)}`,{signal:n.signal}).then(e=>o(e)).catch(e=>{e instanceof DOMException&&e.name===`AbortError`||o([])})},500);return()=>{n.abort(),window.clearTimeout(i)}},[r,e.canWrite,b,s]);function w(e){c(e.candidate_id),i(e.email||e.label||e.full_name||r)}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[auto_minmax(0,1fr)_auto] md:items-start`,children:[(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onBack,children:[(0,L.jsx)(m,{}),`Projects`]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(Lt,{children:t.display_name}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-muted-foreground`,children:[(0,L.jsx)(R,{variant:jn(t.source_status),children:t.source_status||`Unknown`}),t.erpnext_project_id?(0,L.jsx)(`span`,{className:`font-mono`,children:t.erpnext_project_id}):null,t.last_synced_at?(0,L.jsxs)(`span`,{children:[`Synced `,Gt(t.last_synced_at)]}):null]})]}),(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-start gap-2 md:justify-end`,children:[e.canWrite?(0,L.jsxs)(zt,{className:`w-[160px]`,"aria-label":`Status for ${t.display_name}`,value:t.source_status||``,disabled:e.loading[`project:${t.id}:status`],onChange:n=>e.onUpdateStatus(t.id,n.target.value),children:[(0,L.jsx)(`option`,{value:`Open`,children:`Open`}),(0,L.jsx)(`option`,{value:`Completed`,children:`Completed`}),(0,L.jsx)(`option`,{value:`Cancelled`,children:`Cancelled`})]}):null,t.erpnext_project_url?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:t.erpnext_project_url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`ERP project`]}):null,t.customer_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:t.customer_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`ERP customer`]}):null]})]})}),(0,L.jsxs)(Rt,{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Customer`}),(0,L.jsx)(`strong`,{className:`block`,children:t.customer||`None`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Timeline`}),(0,L.jsx)(`strong`,{className:`block`,children:_})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Progress`}),(0,L.jsx)(`strong`,{className:`block`,children:y})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Linked Gigs`}),(0,L.jsx)(`strong`,{className:`block`,children:t.linked_engagement_count||0})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`ERP Type`}),(0,L.jsx)(`div`,{className:`mt-1`,children:t.project_type?(0,L.jsx)(R,{variant:`neutral`,children:t.project_type}):(0,L.jsx)(`strong`,{className:`block`,children:`Not set`})})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`ERP Modified`}),(0,L.jsx)(`strong`,{className:`block`,children:Gt(t.source_modified_at)})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Cache ID`}),(0,L.jsx)(`strong`,{className:`block break-all font-mono text-xs`,children:t.id})]})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Project roster`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:n.length?`${n.length} synced ERP user${n.length===1?``:`s`}`:`No ERP roster`})]}),e.canWrite?(0,L.jsxs)(Rt,{className:`grid gap-3 border-b md:grid-cols-[minmax(260px,1fr)_minmax(180px,.7fr)_minmax(130px,.45fr)_minmax(130px,.45fr)_auto_auto] md:items-end`,children:[(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsxs)(H,{children:[`Person search`,(0,L.jsx)(V,{value:r,autoComplete:`off`,placeholder:`Search @508.dev person`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a.length===1&&w(a[0]))}})]}),x&&!s?(0,L.jsx)(`div`,{className:`absolute z-20 mt-1 max-h-64 w-full overflow-auto rounded-md border bg-background shadow-lg`,children:a.length?a.map(e=>(0,L.jsxs)(`button`,{type:`button`,className:`grid w-full gap-0.5 px-3 py-2 text-left hover:bg-secondary focus:bg-secondary focus:outline-none`,onClick:()=>w(e),children:[(0,L.jsx)(`span`,{className:`truncate text-sm font-bold`,children:e.label||e.full_name||e.email||`Person`}),(0,L.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:[e.email,e.sources?.join(`, `)].filter(Boolean).join(` | `)})]},e.candidate_id)):(0,L.jsx)(`div`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:`No verified @508.dev results`})}):null]}),(0,L.jsxs)(H,{children:[`Activity Type`,(0,L.jsx)(V,{value:u,autoComplete:`off`,placeholder:`Optional rate step`,onChange:e=>d(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Billing rate`,(0,L.jsx)(V,{value:f,inputMode:`decimal`,autoComplete:`off`,placeholder:`USD/hr`,onChange:e=>p(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Costing rate`,(0,L.jsx)(V,{value:h,inputMode:`decimal`,autoComplete:`off`,placeholder:`USD/hr`,onChange:e=>g(e.target.value)})]}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,disabled:e.loading[`project:${t.id}:user`]||!s||!b?.email||oe,onClick:()=>void e.onAddUser(t.id,b?.email||r,s,se).then(e=>{e&&(i(``),o([]),c(``),d(``),p(``),g(``))}),children:[(0,L.jsx)(ie,{}),`Add ERP user`]}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,disabled:e.loading[`project:${t.id}:historical`]||!r.trim(),onClick:()=>void e.onAddHistoricalMember(t.id,r).then(e=>{e&&i(``)}),children:[(0,L.jsx)(ie,{}),`Add historical`]})]}):null,(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{className:`min-w-[860px]`,"aria-label":`Project roster`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Name`}),(0,L.jsx)(U,{children:`Email`}),(0,L.jsx)(U,{children:`ERP user`}),(0,L.jsx)(U,{children:`Links`}),(0,L.jsx)(U,{children:`Source`}),(0,L.jsx)(U,{children:`Last seen`}),e.canWrite?(0,L.jsx)(U,{children:`Actions`}):null]})}),(0,L.jsx)(Ht,{children:n.length?n.map(n=>{let r=Nn(n),i=n.source_user_id||n.email||``,a=n.roster_kind===`historical`||n.source===`manual`;return(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:(0,L.jsx)(`strong`,{children:n.full_name||n.email||n.source_user_id})}),(0,L.jsx)(W,{children:n.email||`None`}),(0,L.jsx)(W,{className:`font-mono text-xs`,children:n.erpnext_user_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:n.erpnext_user_url,target:`_blank`,rel:`noreferrer`,children:[n.source_user_id||`ERP user`,(0,L.jsx)(v,{className:`size-3.5`})]}):n.source_user_id||`Unknown`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n.supplier_erpnext_url?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:n.supplier_erpnext_url,target:`_blank`,rel:`noreferrer`,children:[`Supplier`,(0,L.jsx)(v,{className:`size-3.5`})]}):null,n.crm_contact_id&&e.crmContactUrl(n.crm_contact_id)?(0,L.jsxs)(`a`,{className:`inline-flex items-center gap-1 font-semibold text-primary underline-offset-4 hover:underline`,href:e.crmContactUrl(n.crm_contact_id),target:`_blank`,rel:`noreferrer`,children:[`CRM`,(0,L.jsx)(v,{className:`size-3.5`})]}):null,!n.supplier_erpnext_url&&!(n.crm_contact_id&&e.crmContactUrl(n.crm_contact_id))?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):null]})}),(0,L.jsx)(W,{children:n.roster_kind||n.source||`ERP`}),(0,L.jsx)(W,{children:Gt(n.last_seen_at)}),e.canWrite?(0,L.jsx)(W,{children:(0,L.jsxs)(z,{type:`button`,variant:`outline`,size:`sm`,disabled:!i||e.loading[`project:${t.id}:${a?`historical`:`user`}`],onClick:()=>{window.confirm(`Remove ${r} from this project roster?`)&&(a?e.onRemoveHistoricalMember(t.id,i):e.onRemoveUser(t.id,i))},children:[(0,L.jsx)(ne,{}),`Remove`]})}):null]},`${n.source||``}:${n.source_user_id||n.email}`)}):(0,L.jsx)(Ut,{children:(0,L.jsx)(W,{colSpan:e.canWrite?7:6,className:`text-sm text-muted-foreground`,children:`No roster rows have been synced for this project.`})})})]})})]})]})}function Rn(e){let t=e.gigs.reduce((t,n)=>(t.total+=1,t.applications+=Number(n.application_count||0),t.interested+=Number(n.interested_count||0),An(n,e.staleDays)!==null&&(t.stale+=1),t),{total:0,applications:0,interested:0,stale:0}),n=(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-[minmax(160px,1fr)_auto_auto] md:items-end`,children:[(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`gigStatus`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any status`}),En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))]})]}),(0,L.jsxs)(z,{id:`refreshGigs`,type:`button`,onClick:e.onRefresh,disabled:e.loading.gigs,children:[(0,L.jsx)(S,{}),`Refresh gigs`]}),e.gigs.length>=e.limit?(0,L.jsx)(z,{type:`button`,variant:`outline`,onClick:()=>e.setLimit(Math.min(e.limit+100,500)),disabled:e.loading.gigs||e.limit>=500,children:`Load more`}):null]}),r=e.selectedGigId?e.loading[`gig:${e.selectedGigId}:detail`]:!1;return e.selectedGigId&&!e.selectedGig&&(e.loading.gigs||r)?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Gig detail`})}),(0,L.jsx)(Rt,{className:`text-sm text-muted-foreground`,children:`Loading gig.`})]})]}):e.selectedGigId&&!e.selectedGig?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Gig detail`})}),(0,L.jsxs)(Rt,{className:`grid gap-3`,children:[(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This gig is not in the current result set. Clear filters or refresh the gig list.`}),(0,L.jsxs)(z,{type:`button`,variant:`outline`,onClick:e.onCloseGig,children:[(0,L.jsx)(m,{}),`Back to gigs`]})]})]})]}):e.selectedGig?(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsx)(Vn,{gig:e.selectedGig,loading:e.loading,canWrite:e.canWrite,crmContactUrl:e.crmContactUrl,crmAttachmentUrl:e.crmAttachmentUrl,staleDays:e.staleDays,onBack:e.onCloseGig,onUpdateStatus:e.onUpdateStatus,onUpdateApplicationStatus:e.onUpdateApplicationStatus})]}):(0,L.jsxs)(L.Fragment,{children:[n,(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-4`,"aria-label":`Gig summary`,children:[(0,L.jsx)(vn,{id:`gigMetricTotal`,label:`Gigs`,value:t.total}),(0,L.jsx)(vn,{id:`gigMetricCandidates`,label:`Candidates`,value:t.applications}),(0,L.jsx)(vn,{id:`gigMetricInterested`,label:`Interested`,value:t.interested}),(0,L.jsx)(vn,{id:`gigMetricStale`,label:`Stale recruiting`,value:t.stale})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Discord gigs`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>e.onSort(`activity`),"aria-label":`Sort gigs by activity`,children:[`Activity`,` `,e.sort.key===`activity`?e.sort.direction===`asc`?`↑`:`↓`:``]}),(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>e.onSort(`title`),"aria-label":`Sort gigs by title`,children:[`Title `,e.sort.key===`title`?e.sort.direction===`asc`?`↑`:`↓`:``]}),(0,L.jsx)(`span`,{id:`gigsStatus`,className:`text-sm text-muted-foreground`,children:e.loading.gigs?`Loading`:`${e.gigs.length} shown`})]})]}),(0,L.jsx)(yn,{hidden:e.gigs.length!==0,children:`No gigs match this view.`}),(0,L.jsx)(`div`,{id:`gigsBody`,className:I(`grid gap-3 p-4`,e.gigs.length===0&&`hidden`),children:e.gigs.map(t=>(0,L.jsx)(zn,{gig:t,loading:e.loading,canWrite:e.canWrite,staleDays:e.staleDays,onOpenGig:e.onOpenGig,onUpdateStatus:e.onUpdateStatus},t.id))})]})]})}function zn({gig:e,loading:t,canWrite:n,onOpenGig:r,onUpdateStatus:i,staleDays:a}){let o=Array.isArray(e.applications)?e.applications:[],s=e.discord_guild_id&&e.discord_thread_id?`https://discord.com/channels/${encodeURIComponent(e.discord_guild_id)}/${encodeURIComponent(e.discord_thread_id)}`:``,c=An(e,a);return(0,L.jsxs)(`article`,{className:`grid gap-4 rounded-md border bg-background p-4 lg:grid-cols-[minmax(0,1fr)_220px_180px] lg:items-start`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(`a`,{className:`text-base font-extrabold text-primary`,href:`/dashboard/gigs/${encodeURIComponent(e.id)}`,onClick:t=>{t.preventDefault(),r(e.id)},children:e.title||`Untitled gig`}),(0,L.jsx)(R,{variant:e.status===`filled`?`succeeded`:e.status===`lost`?`failed`:`queued`,children:e.status_label||On(e.status)}),c===null?null:(0,L.jsxs)(R,{variant:`running`,children:[c,`d stale`]})]}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[e.posting_type?(0,L.jsx)(R,{variant:`neutral`,children:On(e.posting_type)}):null,e.discord_channel_name?(0,L.jsxs)(R,{variant:`neutral`,children:[`#`,e.discord_channel_name]}):null,(e.required_skills||[]).slice(0,5).map(e=>(0,L.jsx)(R,{variant:`queued`,children:e},e)),(e.preferred_skills||[]).slice(0,3).map(e=>(0,L.jsx)(R,{variant:`neutral`,children:e},e))]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground`,children:[(0,L.jsxs)(`span`,{children:[`Activity `,Gt(kn(e))||`unknown`]}),(0,L.jsxs)(`span`,{children:[`Posted `,Gt(e.posted_at)||`unknown`]}),s?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:s,target:`_blank`,rel:`noreferrer`,children:`Open Discord thread`}):null]})]}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm lg:grid-cols-1`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`block text-xs font-bold text-muted-foreground`,children:`People`}),(0,L.jsx)(`strong`,{children:e.application_count||o.length}),(0,L.jsxs)(`span`,{className:`ml-2 text-muted-foreground`,children:[Number(e.interested_count||0),` interested`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`block text-xs font-bold text-muted-foreground`,children:`Top candidates`}),(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:o.slice(0,3).map(e=>Bn(e)).join(`, `)||`None yet`})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[n?(0,L.jsx)(zt,{"aria-label":`Status for ${e.title||`gig`}`,value:e.status,disabled:t[`gig:${e.id}:status`],onChange:t=>i(e.id,t.target.value),children:En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))}):null,(0,L.jsx)(z,{type:`button`,onClick:()=>r(e.id),children:`Manage people`})]})]})}function Bn(e){return e.name||e.email_508||e.discord_username||(typeof e.evaluation?.discord_username==`string`?e.evaluation.discord_username:``)||`Candidate`}function Vn({gig:e,loading:t,canWrite:n,crmContactUrl:r,crmAttachmentUrl:i,staleDays:a,onBack:o,onUpdateStatus:s,onUpdateApplicationStatus:c}){let l=Array.isArray(e.applications)?e.applications:[],u=e.discord_guild_id&&e.discord_thread_id?`https://discord.com/channels/${encodeURIComponent(e.discord_guild_id)}/${encodeURIComponent(e.discord_thread_id)}`:``,d=An(e,a);return(0,L.jsxs)(`div`,{className:`grid gap-5`,children:[(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{className:`items-start`,children:[(0,L.jsxs)(`div`,{className:`grid gap-2`,children:[(0,L.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,className:`w-fit`,onClick:o,children:[(0,L.jsx)(m,{}),`Back to gigs`]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(Lt,{className:`text-xl`,children:e.title||`Untitled gig`}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,L.jsx)(R,{variant:e.status===`filled`?`succeeded`:e.status===`lost`?`failed`:`queued`,children:e.status_label||On(e.status)}),d===null?null:(0,L.jsxs)(R,{variant:`running`,children:[d,`d stale`]}),e.posting_type?(0,L.jsx)(R,{variant:`neutral`,children:On(e.posting_type)}):null,e.discord_channel_name?(0,L.jsxs)(R,{variant:`neutral`,children:[`#`,e.discord_channel_name]}):null,(e.required_skills||[]).map(e=>(0,L.jsx)(R,{variant:`queued`,children:e},e)),(e.preferred_skills||[]).map(e=>(0,L.jsx)(R,{variant:`neutral`,children:e},e))]})]})]}),(0,L.jsxs)(`div`,{className:`grid min-w-[190px] gap-2`,children:[n?(0,L.jsxs)(H,{children:[`Gig status`,(0,L.jsx)(zt,{"aria-label":`Status for ${e.title||`gig`}`,value:e.status,disabled:t[`gig:${e.id}:status`],onChange:t=>s(e.id,t.target.value),children:En.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))})]}):null,u?(0,L.jsxs)(`a`,{className:`inline-flex min-h-9 items-center justify-center gap-2 rounded-md border bg-secondary px-3 text-sm font-semibold`,href:u,target:`_blank`,rel:`noreferrer`,children:[(0,L.jsx)(v,{className:`size-4`}),`Discord thread`]}):null]})]}),(0,L.jsxs)(Rt,{className:`grid gap-4 lg:grid-cols-[1fr_1fr_1fr]`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Activity`}),(0,L.jsx)(`strong`,{className:`block`,children:Gt(kn(e))||`unknown`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`Posted `,Gt(e.posted_at)||`unknown`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`People`}),(0,L.jsx)(`strong`,{className:`block`,children:e.application_count||l.length}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[Number(e.interested_count||0),` interested`]})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:`Discord`}),(0,L.jsx)(`strong`,{className:`block`,children:e.discord_channel_name||`No channel`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.discord_thread_id?`Thread ${e.discord_thread_id}`:`No thread`})]})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`People`}),(0,L.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[l.length,` candidate`,l.length===1?``:`s`]})]}),(0,L.jsx)(yn,{hidden:l.length!==0,children:`No suggested or interested people yet.`}),(0,L.jsx)(`div`,{className:I(`grid gap-3 p-4`,l.length===0&&`hidden`),children:l.map(a=>(0,L.jsx)(Hn,{gigId:e.id,application:a,loading:t,canWrite:n,crmContactUrl:r,crmAttachmentUrl:i,onUpdateApplicationStatus:c},a.id))})]})]})}function Hn({gigId:e,application:t,loading:n,canWrite:r,crmContactUrl:i,crmAttachmentUrl:a,onUpdateApplicationStatus:o}){let s=Bn(t),c=i(t.crm_contact_id),l=a(t.latest_resume_id),u=typeof t.fit_score==`number`?`${Math.round(t.fit_score)}/100`:typeof t.match_score==`number`?t.match_score.toFixed(1):``,d=typeof t.evaluation?.llm_summary==`string`?t.evaluation.llm_summary:``;return(0,L.jsxs)(`div`,{className:`grid gap-2 rounded-md border bg-background p-2`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:c,target:`_blank`,rel:`noopener noreferrer`,children:s}):(0,L.jsx)(`strong`,{children:s}),(0,L.jsx)(R,{variant:t.status===`interested`?`succeeded`:`neutral`,children:On(t.status)}),(0,L.jsx)(R,{variant:`neutral`,children:On(t.source||`manual_add`)}),u?(0,L.jsxs)(`span`,{className:`text-xs font-bold text-muted-foreground`,children:[`Fit `,u]}):null,c?(0,L.jsx)(`a`,{className:`text-xs font-extrabold text-primary`,href:c,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`Open ${s} CRM profile`,children:`CRM profile`}):null,l?(0,L.jsx)(`a`,{className:`text-xs font-extrabold text-primary`,href:l,target:`_blank`,rel:`noopener noreferrer`,children:`Resume`}):null]}),d?(0,L.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:d}):null,r?(0,L.jsx)(zt,{"aria-label":`Candidate status for ${s}`,value:t.status||`suggested`,disabled:n[`application:${t.id}:status`],onChange:n=>o(e,t.id,n.target.value),children:Dn.map(e=>(0,L.jsx)(`option`,{value:e,children:On(e)},e))}):null]})}function Un(e){let t=sn[e.peopleFilterKind]?.options||[];return(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`People lookup`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[e.canSync?(0,L.jsxs)(z,{id:`syncPeople`,"data-permission":`people:sync`,type:`button`,onClick:e.onSync,disabled:e.loading.syncPeople,children:[(0,L.jsx)(S,{}),`Sync people`]}):null,e.crmBaseUrl?(0,L.jsx)(`a`,{id:`crmHomeLink`,className:`text-sm font-extrabold text-primary`,href:e.crmBaseUrl,target:`_blank`,rel:`noreferrer`,children:`Open CRM`}):null,(0,L.jsx)(`span`,{id:`peopleStatus`,className:`text-sm text-muted-foreground`,children:e.loading.people?`Loading`:`${e.people.length} shown`})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b p-4 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Search CRM people cache`,(0,L.jsx)(V,{id:`peopleQuery`,value:e.peopleQuery,autoComplete:`off`,placeholder:`Name, email, CRM id, Discord, resume`,onChange:t=>e.setPeopleQuery(t.target.value),onKeyDown:t=>{t.key===`Enter`&&e.onSearch()}})]}),(0,L.jsxs)(z,{id:`searchPeople`,type:`button`,onClick:e.onSearch,disabled:e.loading.people,children:[(0,L.jsx)(C,{}),`Search`]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b bg-background p-4 md:grid-cols-[minmax(120px,.7fr)_minmax(150px,1fr)_minmax(150px,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Member`,(0,L.jsxs)(zt,{id:`peopleMember`,value:e.peopleMember,onChange:t=>e.setPeopleMember(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any`}),(0,L.jsx)(`option`,{value:`true`,children:`Member`}),(0,L.jsx)(`option`,{value:`false`,children:`Not member`})]})]}),(0,L.jsxs)(H,{children:[`Add filter`,(0,L.jsx)(zt,{id:`peopleFilterKind`,value:e.peopleFilterKind,disabled:e.peopleFilterKeys.length===0,onChange:t=>e.setPeopleFilterKind(t.target.value),children:e.peopleFilterKeys.map(e=>(0,L.jsx)(`option`,{value:e,children:sn[e].label},e))})]}),(0,L.jsxs)(H,{children:[`Value`,(0,L.jsx)(zt,{id:`peopleFilterValue`,value:e.peopleFilterValue,onChange:t=>e.setPeopleFilterValue(t.target.value),children:t.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})]}),(0,L.jsx)(z,{id:`addPeopleFilter`,type:`button`,onClick:e.addFilter,disabled:e.peopleFilterKeys.length===0,children:`Add filter`}),(0,L.jsx)(`div`,{id:`activePeopleFilters`,className:`md:col-span-4`,children:(0,L.jsx)(Tn,{filters:e.peopleFilters,onRemove:e.removeFilter})})]}),(0,L.jsx)(yn,{hidden:e.people.length!==0,children:`No people match this lookup.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`peopleTable`,className:I(`min-w-[900px]`,e.people.length===0&&`hidden`),"aria-label":`People lookup results`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[27%]`,label:`Name`,scope:`people`,sort:e.sort,sortKey:`name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Status`,scope:`people`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[20%]`,label:`Discord`,scope:`people`,sort:e.sort,sortKey:`discord`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[25%]`,label:`Resume / skills`,scope:`people`,sort:e.sort,sortKey:`resume`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`peopleBody`,children:e.people.map(t=>{let n=t.name||t.email_508||t.email||`CRM contact`,r=e.crmContactUrl(t.crm_contact_id),i=t.profile_status||{},a=Number(i.skills_count||0),o=e.crmAttachmentUrl(t.latest_resume_id);return(0,L.jsxs)(Ut,{children:[(0,L.jsxs)(W,{children:[r?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:r,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${n} in CRM`,children:n}):(0,L.jsx)(`strong`,{children:n}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:[t.email_508||t.email,t.contact_type].filter(Boolean).join(` | `)})]}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[i.crm_active?null:(0,L.jsx)(R,{variant:`missing`,children:t.sync_status||`CRM sync issue`}),(0,L.jsx)(R,{variant:i.is_member?`succeeded`:`missing`,children:i.is_member?`Member`:`Missing Member`}),(0,L.jsx)(R,{variant:i.discord_linked?`succeeded`:`missing`,children:i.discord_linked?`Discord`:`Missing Discord`}),(0,L.jsx)(R,{variant:i.email_508?`succeeded`:`missing`,children:i.email_508?`508 email`:`Missing 508 email`}),i.latest_resume?null:(0,L.jsx)(R,{variant:`missing`,children:`Missing Resume`})]})}),(0,L.jsx)(W,{children:[t.discord_username,t.discord_user_id].filter(Boolean).join(` | `)||`Not linked`}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:o,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${n} resume`,children:`Resume`}):(0,L.jsx)(`span`,{children:t.latest_resume_name||t.latest_resume_id||`No resume`}),(0,L.jsx)(R,{variant:a>0?`succeeded`:`missing`,children:a>0?`Skills parsed`:`Skills not parsed`})]})})]},t.crm_contact_id||n)})})]})})]})}function Wn(e){let t=sn[e.onboardingFilterKind]?.options||[];return(0,L.jsxs)(L.Fragment,{children:[e.canWrite?(0,L.jsx)(Xn,{loading:e.loading.engineerSetup,onSetup:e.onSetupEngineer}):null,(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Onboarding queue`}),(0,L.jsx)(`span`,{id:`onboardingStatus`,className:`text-sm text-muted-foreground`,children:e.loading.onboarding?`Loading`:`${e.people.length} shown`})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b p-4 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Search prospects`,(0,L.jsx)(V,{id:`onboardingQuery`,value:e.onboardingQuery,autoComplete:`off`,placeholder:`Name, email, Discord, onboarder`,onChange:t=>e.setOnboardingQuery(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(z,{id:`searchOnboarding`,type:`button`,onClick:e.onSearch,disabled:e.loading.onboarding,children:[(0,L.jsx)(C,{}),`Search`]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 border-b bg-background p-4 md:grid-cols-[minmax(140px,.8fr)_minmax(150px,1fr)_minmax(150px,1fr)_minmax(120px,.7fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`onboardingState`,value:e.onboardingState,onChange:t=>e.setOnboardingState(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any state`}),(0,L.jsx)(`option`,{value:`pending`,children:`Needs review`}),(0,L.jsx)(`option`,{value:`selected`,children:`Assigned to onboarder`}),(0,L.jsx)(`option`,{value:`reachingout`,children:`Reaching out`}),(0,L.jsx)(`option`,{value:`awaitingcontribution`,children:`Awaiting contribution`})]})]}),(0,L.jsxs)(H,{children:[`Onboarder`,(0,L.jsx)(V,{id:`onboarderFilter`,value:e.onboarderFilter,autoComplete:`off`,placeholder:`Any onboarder`,onChange:t=>e.setOnboarderFilter(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(H,{children:[`Add filter`,(0,L.jsx)(zt,{id:`onboardingFilterKind`,value:e.onboardingFilterKind,disabled:e.onboardingFilterKeys.length===0,onChange:t=>e.setOnboardingFilterKind(t.target.value),children:e.onboardingFilterKeys.map(e=>(0,L.jsx)(`option`,{value:e,children:sn[e].label},e))})]}),(0,L.jsxs)(H,{children:[`Value`,(0,L.jsx)(zt,{id:`onboardingFilterValue`,value:e.onboardingFilterValue,onChange:t=>e.setOnboardingFilterValue(t.target.value),children:t.map(([e,t])=>(0,L.jsx)(`option`,{value:e,children:t},e))})]}),(0,L.jsx)(z,{id:`addOnboardingFilter`,type:`button`,onClick:e.addFilter,disabled:e.onboardingFilterKeys.length===0,children:`Add filter`}),(0,L.jsx)(`div`,{id:`activeOnboardingFilters`,className:`md:col-span-5`,children:(0,L.jsx)(Tn,{filters:e.onboardingFilters,onRemove:e.removeFilter,suffix:`onboarding filter`})})]}),(0,L.jsx)(yn,{hidden:e.people.length!==0,children:`No prospects match this queue view.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`onboardingTable`,className:I(`min-w-[1180px]`,e.people.length===0&&`hidden`),"aria-label":`Onboarding queue`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[20%]`,label:`Name`,scope:`onboarding`,sort:e.sort,sortKey:`name`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[13%]`,label:`Status`,scope:`onboarding`,sort:e.sort,sortKey:`onboarding_state`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[22%]`,label:`Onboarder`,scope:`onboarding`,sort:e.sort,sortKey:`onboarder`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[13%]`,label:`Updated`,scope:`onboarding`,sort:e.sort,sortKey:`updated`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{className:`w-[15%]`,children:`Links`}),(0,L.jsx)(_n,{className:`w-[17%]`,label:`Needs`,scope:`onboarding`,sort:e.sort,sortKey:`profile_gaps`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`onboardingBody`,children:e.people.map(t=>(0,L.jsx)(Zn,{person:t,loading:e.loading,onAssign:e.onAssign,crmContactUrl:e.crmContactUrl,crmAttachmentUrl:e.crmAttachmentUrl},t.crm_contact_id||t.name))})]})})]})]})}var Gn=[`Female`,`Genderqueer`,`Male`,`Non-Conforming`,`Other`,`Prefer not to say`,`Transgender`],Kn=[`Company Email`,`Personal Email`,`User ID`];function qn(e){let t=(e||``).trim().split(/\s+/).filter(Boolean);return t.length===0?{first:``,middle:``,last:``}:t.length===1?{first:t[0],middle:``,last:``}:t.length===2?{first:t[0],middle:``,last:t[1]}:{first:t[0],middle:t.slice(1,-1).join(` `),last:t[t.length-1]}}function Jn(e){let t=(e.email||``).trim();return!t||t.toLowerCase().endsWith(`@508.dev`)?``:t}function Yn(e){let t=(e.email_508||``).trim();if(t)return t;let n=(e.email||``).trim();return n.toLowerCase().endsWith(`@508.dev`)?n:``}function Xn({loading:e,onSetup:t}){let[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(``),[x,ee]=(0,l.useState)(``),[S,te]=(0,l.useState)(``),[ne,ie]=(0,l.useState)(``),[ae,oe]=(0,l.useState)(``),[se,w]=(0,l.useState)(``);function ce(e){let t=qn(e.name);m(t.first),g(t.middle),v(t.last),f(Yn(e)),oe(Jn(e)),b(e.address_country||``),r(e.name||e.email_508||e.email||``),a([]),u(``)}async function le(){let e=n.trim();if(e){s(!0),u(``);try{a(await G(`/dashboard/api/people?${new URLSearchParams({limit:`8`,query:e}).toString()}`))}catch(e){u(un(e,`Unable to search people`)),a([])}finally{s(!1)}}}async function ue(){let e={email:d,first_name:p,middle_name:h,last_name:_,country:y,personal_email:ae};x.trim()&&(e.gender=x),S.trim()&&(e.date_of_birth=S),ne.trim()&&(e.date_of_joining=ne),se.trim()&&(e.prefered_email=se),await t(e)&&(r(``),a([]),f(``),m(``),g(``),v(``),b(``),ee(``),te(``),ie(``),oe(``),w(``))}return(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Engineer setup`})}),(0,L.jsx)(Rt,{children:(0,L.jsxs)(`form`,{className:`grid gap-3`,onSubmit:e=>{e.preventDefault(),ue()},children:[(0,L.jsxs)(`div`,{className:`grid gap-3 border-b pb-3 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,L.jsxs)(H,{children:[`CRM person`,(0,L.jsx)(V,{value:n,autoComplete:`off`,placeholder:`Search name or email`,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),le())}})]}),(0,L.jsxs)(z,{type:`button`,onClick:le,disabled:o||!n.trim(),children:[(0,L.jsx)(C,{}),`Search`]}),c?(0,L.jsx)(`span`,{className:`text-sm font-semibold text-destructive`,children:c}):null,i.length>0?(0,L.jsx)(`div`,{className:`grid gap-2 md:col-span-2`,children:i.map(e=>{let t=e.name||e.email_508||e.email||e.crm_contact_id,n=[e.email_508||e.email,e.contact_type].filter(Boolean).join(` | `);return(0,L.jsxs)(`button`,{type:`button`,className:`grid rounded-md border bg-background px-3 py-2 text-left text-sm hover:border-primary`,onClick:()=>ce(e),children:[(0,L.jsx)(`strong`,{children:t}),n?(0,L.jsx)(`span`,{className:`text-muted-foreground`,children:n}):null]},e.crm_contact_id||t)})}):null]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(130px,.6fr)]`,children:[(0,L.jsxs)(H,{children:[`Company email`,(0,L.jsx)(V,{value:d,autoComplete:`off`,placeholder:`engineer@508.dev`,onChange:e=>f(e.target.value)})]}),(0,L.jsxs)(H,{children:[`First name`,(0,L.jsx)(V,{value:p,autoComplete:`off`,placeholder:`First`,onChange:e=>m(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Middle name`,(0,L.jsx)(V,{value:h,autoComplete:`off`,placeholder:`Optional`,onChange:e=>g(e.target.value)})]})]}),(0,L.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-[minmax(0,1fr)_minmax(130px,.6fr)]`,children:[(0,L.jsxs)(H,{children:[`Last name`,(0,L.jsx)(V,{value:_,autoComplete:`off`,placeholder:`Last`,onChange:e=>v(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Country`,(0,L.jsx)(V,{value:y,autoComplete:`off`,placeholder:`Taiwan`,onChange:e=>b(e.target.value)})]})]}),(0,L.jsxs)(`details`,{className:`rounded-md border bg-background p-3`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-extrabold`,children:`Advanced options`}),(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 md:grid-cols-2`,children:[(0,L.jsxs)(H,{children:[`Gender`,(0,L.jsxs)(zt,{value:x,onChange:e=>ee(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Default`}),Gn.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]})]}),(0,L.jsxs)(H,{children:[`Date of birth`,(0,L.jsx)(V,{value:S,type:`date`,autoComplete:`off`,onChange:e=>te(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Date of joining`,(0,L.jsx)(V,{value:ne,type:`date`,autoComplete:`off`,onChange:e=>ie(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Personal email`,(0,L.jsx)(V,{value:ae,type:`email`,autoComplete:`off`,placeholder:`Optional`,onChange:e=>oe(e.target.value)})]}),(0,L.jsxs)(H,{children:[`Preferred contact email`,(0,L.jsxs)(zt,{value:se,onChange:e=>w(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Default`}),Kn.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]})]})]})]}),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,L.jsxs)(z,{id:`setupEngineer`,type:`submit`,disabled:e||!d.trim()||!p.trim(),children:[(0,L.jsx)(re,{}),`Set up engineer`]})})]})})]})}function Zn({person:e,loading:t,onAssign:n,crmContactUrl:r,crmAttachmentUrl:i}){let a=e.name||e.email_508||e.email||`CRM contact`,[o,s]=(0,l.useState)(Zt(e.onboarder));(0,l.useEffect)(()=>s(Zt(e.onboarder)),[e.onboarder]);let c=e.profile_status||{},u=[[`Discord`,c.discord_linked],[`Resume`,c.latest_resume],[`Skills`,Number(c.skills_count||0)>0]].filter(([,e])=>!e),d=r(e.crm_contact_id),f=i(e.latest_resume_id);return(0,L.jsxs)(Ut,{children:[(0,L.jsxs)(W,{children:[d?(0,L.jsx)(`a`,{className:`font-extrabold text-primary`,href:d,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} in CRM`,children:a}):(0,L.jsx)(`strong`,{children:a}),(0,L.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.email_508||e.email||``})]}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:Xt(Jt(e)),children:e.onboarding_status_label||Yt(Jt(e))})}),(0,L.jsx)(W,{children:(0,L.jsxs)(`form`,{className:`grid max-w-64 grid-cols-[minmax(100px,1fr)_auto] items-center gap-2`,onSubmit:t=>{t.preventDefault(),n(e.crm_contact_id,o)},children:[(0,L.jsx)(V,{"aria-label":`Onboarder for ${a}`,value:o,placeholder:`508 username`,onChange:e=>s(e.target.value)}),(0,L.jsx)(z,{type:`submit`,size:`sm`,"aria-label":`Save onboarder for ${a}`,disabled:t[`onboarder:${e.crm_contact_id}`],children:`Save`})]})}),(0,L.jsx)(W,{children:Gt(e.onboarding_updated_at)}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[f?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:f,target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} resume`,children:`Resume`}):null,nn(e.linkedin)?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:nn(e.linkedin),target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} LinkedIn`,children:`LinkedIn`}):null,rn(e.github_username)?(0,L.jsx)(`a`,{className:`inline-flex min-h-7 items-center rounded-md border bg-secondary px-2 text-xs font-extrabold`,href:rn(e.github_username),target:`_blank`,rel:`noreferrer`,"aria-label":`Open ${a} GitHub`,children:e.github_username||`GitHub`}):null,!f&&!nn(e.linkedin)&&!rn(e.github_username)?`None`:null]})}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[u.map(([e])=>(0,L.jsxs)(R,{variant:`missing`,children:[`Missing `,e]},String(e))),u.length===0?`None`:null]})})]})}function Qn(e){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{className:`grid gap-3 p-4 md:grid-cols-4 md:items-end`,children:[(0,L.jsxs)(H,{children:[`Window`,(0,L.jsxs)(zt,{id:`minutes`,value:e.minutes,onChange:t=>e.setMinutes(t.target.value),children:[(0,L.jsx)(`option`,{value:`15`,children:`15 minutes`}),(0,L.jsx)(`option`,{value:`60`,children:`1 hour`}),(0,L.jsx)(`option`,{value:`360`,children:`6 hours`}),(0,L.jsx)(`option`,{value:`1440`,children:`24 hours`})]})]}),(0,L.jsxs)(H,{children:[`Status`,(0,L.jsxs)(zt,{id:`status`,value:e.status,onChange:t=>e.setStatus(t.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`Any status`}),(0,L.jsx)(`option`,{value:`queued`,children:`Queued`}),(0,L.jsx)(`option`,{value:`running`,children:`Running`}),(0,L.jsx)(`option`,{value:`succeeded`,children:`Succeeded`}),(0,L.jsx)(`option`,{value:`failed`,children:`Failed`}),(0,L.jsx)(`option`,{value:`dead`,children:`Dead`}),(0,L.jsx)(`option`,{value:`canceled`,children:`Canceled`})]})]}),(0,L.jsxs)(H,{children:[`Type`,(0,L.jsx)(V,{id:`jobType`,value:e.jobType,autoComplete:`off`,placeholder:`Any type`,onChange:t=>e.setJobType(t.target.value),onKeyDown:t=>t.key===`Enter`&&e.onSearch()})]}),(0,L.jsxs)(z,{id:`refreshJobs`,type:`button`,onClick:e.onSearch,disabled:e.loading.jobs,children:[(0,L.jsx)(S,{}),`Refresh jobs`]})]}),(0,L.jsxs)(`section`,{className:`grid gap-3 md:grid-cols-4`,"aria-label":`Job summary`,children:[(0,L.jsx)(vn,{id:`metricTotal`,label:`Total`,value:e.jobs.length}),(0,L.jsx)(vn,{id:`metricQueued`,label:`Queued`,value:e.jobCounts.queued||0}),(0,L.jsx)(vn,{id:`metricRunning`,label:`Running`,value:e.jobCounts.running||0}),(0,L.jsx)(vn,{id:`metricFailed`,label:`Failed`,value:(e.jobCounts.failed||0)+(e.jobCounts.dead||0)})]}),(0,L.jsxs)(It,{children:[(0,L.jsx)(B,{children:(0,L.jsx)(Lt,{children:`Recent jobs`})}),(0,L.jsx)(yn,{hidden:e.jobs.length!==0,children:`No jobs match these filters.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`jobsTable`,className:I(`min-w-[980px]`,e.jobs.length===0&&`hidden`),"aria-label":`Recent jobs`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[22%]`,label:`Job id`,scope:`jobs`,sort:e.sort,sortKey:`job_id`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[24%]`,label:`Type`,scope:`jobs`,sort:e.sort,sortKey:`type`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[12%]`,label:`Status`,scope:`jobs`,sort:e.sort,sortKey:`status`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[12%]`,label:`Attempts`,scope:`jobs`,sort:e.sort,sortKey:`attempts`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[18%]`,label:`Updated`,scope:`jobs`,sort:e.sort,sortKey:`updated_at`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(U,{children:`Actions`})]})}),(0,L.jsx)(Ht,{id:`jobsBody`,children:e.jobs.map(t=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{className:`font-mono`,children:t.job_id}),(0,L.jsx)(W,{children:t.type}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:t.status||`neutral`,children:t.status})}),(0,L.jsxs)(W,{children:[t.attempts,`/`,t.max_attempts]}),(0,L.jsx)(W,{children:Gt(t.updated_at)}),(0,L.jsx)(W,{children:(0,L.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,L.jsx)(z,{type:`button`,size:`sm`,variant:`outline`,"aria-label":`View details for ${t.type} job ${t.job_id}`,onClick:()=>e.onDetail(t.job_id),disabled:e.loading[`detail:${t.job_id}`],children:`Details`}),e.canWrite?(0,L.jsx)(z,{type:`button`,size:`sm`,"aria-label":`Rerun ${t.type} job ${t.job_id}`,onClick:()=>e.onRerun(t.job_id),disabled:e.loading[`rerun:${t.job_id}`],children:`Rerun`}):null]})})]},t.job_id))})]})})]}),e.jobDetail?(0,L.jsxs)(It,{id:`jobDetailPanel`,children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Job detail`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:e.jobDetail.job_id})]}),(0,L.jsxs)(Rt,{className:`grid gap-4`,children:[(0,L.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[[`Type`,e.jobDetail.type],[`Status`,e.jobDetail.status],[`Attempts`,`${e.jobDetail.attempts}/${e.jobDetail.max_attempts}`],[`Updated`,Gt(e.jobDetail.updated_at)],[`Created`,Gt(e.jobDetail.created_at)],[`Run after`,Gt(e.jobDetail.run_after)],[`Locked by`,e.jobDetail.locked_by||`None`],[`Last error`,e.jobDetail.last_error||`None`]].map(([e,t])=>(0,L.jsxs)(`div`,{className:`grid gap-1 rounded-md border bg-background p-3`,children:[(0,L.jsx)(`span`,{className:`text-[11px] font-extrabold uppercase text-muted-foreground`,children:e}),(0,L.jsx)(`strong`,{className:`break-words text-sm`,children:t})]},e))}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`mb-2 text-[15px] font-bold`,children:`Payload`}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-background p-3 font-mono text-xs`,children:qt(e.jobDetail.payload)||`No payload`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h2`,{className:`mb-2 text-[15px] font-bold`,children:`Result`}),(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md border bg-background p-3 font-mono text-xs`,children:qt(e.jobDetail.result)||`No result`})]})]})]}):null]})}function $n(e){return(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Recent audit`}),(0,L.jsxs)(z,{id:`refreshAudit`,type:`button`,variant:`outline`,onClick:e.onRefresh,disabled:e.loading.audit,children:[(0,L.jsx)(S,{}),`Refresh`]})]}),(0,L.jsx)(yn,{hidden:e.events.length!==0,children:`No audit events found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`auditTable`,className:I(`min-w-[760px]`,e.events.length===0&&`hidden`),"aria-label":`Recent audit events`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(_n,{className:`w-[24%]`,label:`Time`,scope:`audit`,sort:e.sort,sortKey:`occurred_at`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Actor`,scope:`audit`,sort:e.sort,sortKey:`actor`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[28%]`,label:`Action`,scope:`audit`,sort:e.sort,sortKey:`action`,onSort:(t,n)=>e.onSort(n)}),(0,L.jsx)(_n,{className:`w-[20%]`,label:`Result`,scope:`audit`,sort:e.sort,sortKey:`result`,onSort:(t,n)=>e.onSort(n)})]})}),(0,L.jsx)(Ht,{id:`auditBody`,children:e.events.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:Gt(e.occurred_at)}),(0,L.jsx)(W,{children:e.actor_display_name||e.actor_subject||e.actor_provider}),(0,L.jsx)(W,{children:e.action}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:e.result===`success`?`succeeded`:`failed`,children:e.result})})]},e.id||`${e.occurred_at||``}-${e.actor_subject||``}-${e.action||``}`))})]})})]})}function er({report:e,loading:t,onRefresh:n}){let r=e?.summary||{},i=[[`Status`,e?.status_counts||{}],[`Intent`,e?.intent_counts||{}],[`Planner`,e?.planner_counts||{}]].flatMap(([e,t])=>Object.entries(t).map(([t,n])=>({label:e,value:t,count:n}))).sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label)),a=Array.isArray(e?.recent_unsupported)?e.recent_unsupported:[];return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Agent requests`}),(0,L.jsxs)(z,{id:`refreshAgent`,type:`button`,variant:`outline`,onClick:n,disabled:t.agent,children:[(0,L.jsx)(S,{}),`Refresh`]})]}),(0,L.jsxs)(Rt,{className:`grid gap-3 md:grid-cols-5`,children:[(0,L.jsx)(vn,{id:`agentMetricTotal`,label:`Total`,value:r.total||0}),(0,L.jsx)(vn,{id:`agentMetricHandled`,label:`Handled`,value:r.handled||0}),(0,L.jsx)(vn,{id:`agentMetricConfirmations`,label:`Confirmations`,value:r.requires_confirmation||0}),(0,L.jsx)(vn,{id:`agentMetricClarifications`,label:`Clarifications`,value:r.needs_clarification||0}),(0,L.jsx)(vn,{id:`agentMetricUnsupported`,label:`Not understood`,value:r.unsupported||0})]})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Request mix`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Recent agent.request audit events.`})]}),(0,L.jsx)(yn,{hidden:i.length!==0,children:`No agent request data found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`agentBreakdownTable`,className:I(`min-w-[860px]`,i.length===0&&`hidden`),"aria-label":`Agent request breakdown`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Dimension`}),(0,L.jsx)(U,{children:`Value`}),(0,L.jsx)(U,{children:`Count`})]})}),(0,L.jsx)(Ht,{id:`agentBreakdownBody`,children:i.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:e.label}),(0,L.jsx)(W,{children:e.value}),(0,L.jsx)(W,{children:e.count})]},`${e.label}-${e.value}`))})]})})]}),(0,L.jsxs)(It,{children:[(0,L.jsxs)(B,{children:[(0,L.jsx)(Lt,{children:`Not understood`}),(0,L.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Sanitized request text only.`})]}),(0,L.jsx)(yn,{hidden:a.length!==0,children:`No unsupported agent requests found.`}),(0,L.jsx)(`div`,{className:`overflow-x-auto`,children:(0,L.jsxs)(Bt,{id:`agentUnsupportedTable`,className:I(`min-w-[860px]`,a.length===0&&`hidden`),"aria-label":`Unsupported agent requests`,children:[(0,L.jsx)(Vt,{children:(0,L.jsxs)(Ut,{children:[(0,L.jsx)(U,{children:`Time`}),(0,L.jsx)(U,{children:`Actor`}),(0,L.jsx)(U,{children:`Message`}),(0,L.jsx)(U,{children:`Result`})]})}),(0,L.jsx)(Ht,{id:`agentUnsupportedBody`,children:a.map(e=>(0,L.jsxs)(Ut,{children:[(0,L.jsx)(W,{children:Gt(e.occurred_at)}),(0,L.jsx)(W,{children:e.actor}),(0,L.jsx)(W,{children:e.message_sanitized}),(0,L.jsx)(W,{children:(0,L.jsx)(R,{variant:e.result===`success`?`succeeded`:`failed`,children:e.result||`unknown`})})]},`${e.occurred_at||``}-${e.actor||``}-${e.message_sanitized||``}`))})]})})]})]})}var tr=document.getElementById(`root`);if(!tr)throw Error(`Missing #root container`);(0,ue.createRoot)(tr).render((0,L.jsx)(l.StrictMode,{children:(0,L.jsx)(xn,{})})); \ No newline at end of file diff --git a/apps/api/src/five08/backend/static/dashboard/index.html b/apps/api/src/five08/backend/static/dashboard/index.html index 39996034..29e160e5 100644 --- a/apps/api/src/five08/backend/static/dashboard/index.html +++ b/apps/api/src/five08/backend/static/dashboard/index.html @@ -4,7 +4,7 @@ 508 Operations Dashboard - + diff --git a/apps/discord_bot/src/five08/discord_bot/cogs/jobs.py b/apps/discord_bot/src/five08/discord_bot/cogs/jobs.py index 39b911b2..de73163b 100644 --- a/apps/discord_bot/src/five08/discord_bot/cogs/jobs.py +++ b/apps/discord_bot/src/five08/discord_bot/cogs/jobs.py @@ -38,15 +38,19 @@ from five08.engagements import ( DiscordEngagementInput, EngagementApplicationSource, + EngagementStatus, add_engagement_event, get_gig_thread_interest_backfill_marker, list_due_recruiting_reminders, mark_recruiting_reminder_failed, mark_recruiting_reminder_sent, + normalize_engagement_status, parse_status_from_title, record_discord_engagement_activity, requirements_to_payload, + status_label, strip_status_from_title, + update_engagement_status, upsert_discord_engagement, upsert_discord_interest_application, upsert_gig_thread_interest_backfill_marker, @@ -150,6 +154,15 @@ GIG_FORUM_BACKFILL_ARCHIVED_LIMIT = 200 GIG_INTEREST_BACKFILL_MAX_AGE_DAYS = 14 GIG_RECRUITING_REMINDER_CHECK_SECONDS = 6 * 60 * 60 +GIG_STATUS_COMMAND_VALUES = frozenset( + { + "recruiting", + "filled", + "outdated", + "unknown", + "lost", + } +) GIG_INTEREST_PATTERNS = ( re.compile(r"\b(?:i'?m|i am)\s+interested\b", re.IGNORECASE), re.compile(r"\binterested\s+(?:in|for)\s+(?:this|the)\b", re.IGNORECASE), @@ -2320,6 +2333,65 @@ async def _upsert_thread_engagement( ), ) + @staticmethod + async def _rename_gig_thread_for_status( + thread: discord.Thread, + status: EngagementStatus, + *, + reason: str, + ) -> str: + """Apply the visible dashboard status marker to a Discord forum thread.""" + status_marker = status.value.upper() + raw_title = str(thread.name or "").strip() + stripped_title = strip_status_from_title(raw_title) + if ( + parse_status_from_title(raw_title) is not EngagementStatus.UNKNOWN + and stripped_title == raw_title + ): + base_title = "" + else: + base_title = stripped_title + base_title = base_title.strip() or f"Discord gig {thread.id}" + next_name = f"[{status_marker}] {base_title}"[:100] + if thread.name == next_name: + return next_name + + if thread.guild is None or thread.guild.me is None: + raise RuntimeError("bot_member_unresolved") + permissions = thread.permissions_for(thread.guild.me) + if not permissions.manage_threads: + raise PermissionError("missing_manage_threads_permission") + + if thread.archived: + await thread.edit(archived=False, reason=reason) + await thread.edit(name=next_name, reason=reason) + return next_name + + @staticmethod + def _interaction_user_can_update_gig_thread( + interaction: discord.Interaction, + poster_id: str | None, + ) -> bool: + user_id = str(interaction.user.id) + if poster_id and user_id == str(poster_id): + return True + roles = getattr(interaction.user, "roles", None) + return bool( + roles + and check_user_roles_with_hierarchy( + roles, + ["Steering Committee"], + ) + ) + + @staticmethod + def _explicit_gig_status(value: str) -> EngagementStatus | None: + """Parse only slash-command status values, not broader status aliases.""" + raw_status = value.strip().casefold() + if raw_status not in GIG_STATUS_COMMAND_VALUES: + return None + return normalize_engagement_status(raw_status) + async def _persist_thread_engagement_index( self, thread: discord.Thread, @@ -2808,9 +2880,11 @@ async def _send_due_recruiting_reminders(self) -> None: message = await thread.send( ( f'{poster_mention} any update on "{safe_title}"? ' - f"It has been recruiting with no updates for {age_days} day(s). " - "Please update the dashboard status to FILLED, OUTDATED, " - "UNKNOWN, or leave a thread reply if it is still active." + "It has been in status RECRUITING with no updates for " + f"{age_days} day(s). " + "Please use `/update-gig-status` to set it to FILLED, " + "OUTDATED, UNKNOWN, or leave a thread reply if it is " + "still active." ), allowed_mentions=discord.AllowedMentions( users=[discord.Object(id=int(poster_id))], @@ -3395,6 +3469,261 @@ async def register_jobs_channel( ephemeral=True, ) + @app_commands.command( + name="update-gig-status", + description="Update this gig thread's dashboard status and title marker.", + ) + @app_commands.describe( + status="New gig status.", + ) + @app_commands.choices( + status=[ + app_commands.Choice(name="RECRUITING", value="recruiting"), + app_commands.Choice(name="FILLED", value="filled"), + app_commands.Choice(name="OUTDATED", value="outdated"), + app_commands.Choice(name="UNKNOWN", value="unknown"), + app_commands.Choice(name="LOST", value="lost"), + ] + ) + async def update_gig_status( + self, + interaction: discord.Interaction, + status: str, + ) -> None: + """Update the dashboard gig status for the current registered gig thread.""" + thread = interaction.channel + if not isinstance(thread, discord.Thread) or not isinstance( + thread.parent, + discord.ForumChannel, + ): + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={"stage": "not_thread", "status": status}, + ) + await interaction.response.send_message( + "⚠️ Run this inside a registered gig forum post thread.", + ephemeral=True, + ) + return + + guild = thread.guild + if guild is None: + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "guild_unavailable", + "status": status, + "thread_id": str(thread.id), + }, + ) + await interaction.response.send_message( + "⚠️ This command must be used inside a server.", + ephemeral=True, + ) + return + + normalized_status = self._explicit_gig_status(status) + if normalized_status is None: + await interaction.response.send_message( + "⚠️ Choose one of: RECRUITING, FILLED, OUTDATED, UNKNOWN, LOST.", + ephemeral=True, + ) + return + + await interaction.response.defer(ephemeral=True) + + if not await self._refresh_jobs_channel_cache_if_missing(guild.id): + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "jobs_cache_unavailable", + "status": status, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + "channel_id": str(thread.parent.id), + }, + ) + await interaction.followup.send( + "❌ Could not load registered gig channels. Please try again.", + ephemeral=True, + ) + return + + if not self._is_jobs_channel_registered(guild.id, thread.parent.id): + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "forum_not_registered", + "status": status, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + "channel_id": str(thread.parent.id), + }, + ) + await interaction.followup.send( + "⚠️ This thread's forum is not registered as a gig channel.", + ephemeral=True, + ) + return + + post = await self._read_thread_post(thread) + poster_id = self._thread_poster_id(thread, post.starter if post else None) + if not self._interaction_user_can_update_gig_thread(interaction, poster_id): + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "forbidden", + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + "poster_id": poster_id, + }, + ) + await interaction.followup.send( + "❌ Only Steering Committee+ or the original thread poster can update this gig status.", + ephemeral=True, + ) + return + + if post is None: + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "starter_message_unavailable", + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + }, + ) + await interaction.followup.send( + "❌ Could not read the original gig post for this thread.", + ephemeral=True, + ) + return + + try: + engagement_id = await self._upsert_thread_engagement( + thread, + post, + refresh_activity=False, + ) + result = await asyncio.to_thread( + update_engagement_status, + settings, + engagement_id=engagement_id, + status=normalized_status, + actor_discord_user_id=str(interaction.user.id), + ) + except Exception as exc: + logger.warning( + "Failed updating gig status guild=%s thread=%s status=%s: %s", + guild.id, + thread.id, + normalized_status.value, + exc, + ) + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "dashboard_update_failed", + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + }, + ) + await interaction.followup.send( + "❌ Failed to update the dashboard status. Please try again.", + ephemeral=True, + ) + return + + if result is None: + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="error", + metadata={ + "stage": "gig_not_found", + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + }, + ) + await interaction.followup.send( + "❌ Could not find this gig on the dashboard.", + ephemeral=True, + ) + return + + title_sync_status = "updated" + try: + next_title = await self._rename_gig_thread_for_status( + thread, + normalized_status, + reason=f"Discord /update-gig-status by {interaction.user}", + ) + except PermissionError: + title_sync_status = "permission_error" + next_title = thread.name + logger.warning( + "Missing manage_threads permission for gig status title update thread=%s", + thread.id, + ) + except discord.Forbidden: + title_sync_status = "forbidden" + next_title = thread.name + except discord.HTTPException as exc: + title_sync_status = "failed" + next_title = thread.name + logger.warning("Failed renaming gig thread %s: %s", thread.id, exc) + except RuntimeError as exc: + title_sync_status = str(exc) + next_title = thread.name + + self._audit_command_safe( + interaction=interaction, + action="crm.update_gig_status", + result="success" if title_sync_status == "updated" else "partial", + metadata={ + "status": normalized_status.value, + "guild_id": str(guild.id), + "thread_id": str(thread.id), + "channel_id": str(thread.parent.id), + "engagement_id": engagement_id, + "title_sync_status": title_sync_status, + }, + ) + + if title_sync_status != "updated": + await interaction.followup.send( + "⚠️ Dashboard status updated to " + f"**{status_label(normalized_status)}**, but I could not update " + "the thread title. The bot may need Manage Threads permission.", + ephemeral=True, + ) + return + + await interaction.followup.send( + "✅ Updated status to " + f"**{status_label(normalized_status)}** and renamed this thread to " + f"`{next_title}`.", + ephemeral=True, + ) + @app_commands.command( name="backfill-gig-interest", description="Backfill interested applicants from this gig thread's replies.", diff --git a/tests/integration/test_dashboard_playwright.py b/tests/integration/test_dashboard_playwright.py index 1ec6e8ad..150538ef 100644 --- a/tests/integration/test_dashboard_playwright.py +++ b/tests/integration/test_dashboard_playwright.py @@ -376,7 +376,26 @@ def notifications_route(route: Any) -> None: route.fulfill( status=200, content_type="application/json", - body=json.dumps({"stale_days": 7, "notifications": []}), + body=json.dumps( + { + "stale_days": 7, + "notifications": [ + { + "id": ( + "stale-recruiting:" + "11111111-1111-4111-8111-111111111111" + ), + "type": "stale_recruiting_gig", + "severity": "warning", + "title": "Recruiting gig needs an update", + "message": "Webflow build has had no updates for 7 day(s).", + "engagement_id": "11111111-1111-4111-8111-111111111111", + "gig_title": "Webflow build", + "age_days": 7, + } + ], + } + ), ) def gig_application_status_route(route: Any) -> None: @@ -431,6 +450,14 @@ def sync_route(route: Any) -> None: page.route("**/dashboard/api/sync/people", sync_route) try: + page.goto("/dashboard") + page.get_by_role("heading", name="508 Operations Dashboard").wait_for() + page.locator("#notifications").click() + page.get_by_text("Recruiting gig needs an update").click() + expect(page).to_have_url( + f"{dashboard_server}/dashboard/gigs/11111111-1111-4111-8111-111111111111" + ) + page.get_by_role("heading", name="People").wait_for() page.goto("/dashboard") page.get_by_role("heading", name="508 Operations Dashboard").wait_for() expect(page.locator("#userName")).to_have_text("Discord Admin") diff --git a/tests/unit/test_jobs.py b/tests/unit/test_jobs.py index 7855dd46..270f6743 100644 --- a/tests/unit/test_jobs.py +++ b/tests/unit/test_jobs.py @@ -10,6 +10,7 @@ import five08.discord_bot.cogs.jobs as jobs_module from five08.discord_bot.cogs.jobs import JobsCog +from five08.engagements import EngagementStatus from five08.job_match import CandidateRerankResult, JobRequirements @@ -71,6 +72,98 @@ def test_build_match_candidate_lines_uses_crm_name_and_discord_username() -> Non assert "`@caleb`" in lines[0] +def test_update_gig_status_allows_original_thread_poster() -> None: + interaction = SimpleNamespace(user=SimpleNamespace(id=123, roles=[])) + + assert JobsCog._interaction_user_can_update_gig_thread(interaction, "123") is True + + +def test_update_gig_status_allows_steering_or_higher_role() -> None: + interaction = SimpleNamespace( + user=SimpleNamespace( + id=123, + roles=[SimpleNamespace(name="Admin")], + ) + ) + + assert JobsCog._interaction_user_can_update_gig_thread(interaction, "456") is True + + +def test_update_gig_status_rejects_unprivileged_non_poster() -> None: + interaction = SimpleNamespace( + user=SimpleNamespace( + id=123, + roles=[SimpleNamespace(name="Member")], + ) + ) + + assert JobsCog._interaction_user_can_update_gig_thread(interaction, "456") is False + + +def test_update_gig_status_accepts_only_explicit_command_values() -> None: + assert JobsCog._explicit_gig_status("FILLED") is EngagementStatus.FILLED + assert JobsCog._explicit_gig_status("open") is None + assert JobsCog._explicit_gig_status("stale") is None + assert JobsCog._explicit_gig_status("cancelled") is None + + +def test_rename_gig_thread_for_status_rewrites_visible_marker() -> None: + class FakeThread: + id = 200 + name = "[RECRUITING] Need help" + archived = False + guild = SimpleNamespace(me=object()) + + def __init__(self) -> None: + self.edit = AsyncMock() + + def permissions_for(self, _member: object) -> SimpleNamespace: + return SimpleNamespace(manage_threads=True) + + thread = FakeThread() + + result = asyncio.run( + JobsCog._rename_gig_thread_for_status( + thread, + EngagementStatus.FILLED, + reason="test", + ) + ) + + assert result == "[FILLED] Need help" + thread.edit.assert_awaited_once_with(name="[FILLED] Need help", reason="test") + + +def test_rename_gig_thread_for_status_uses_fallback_for_marker_only_title() -> None: + class FakeThread: + id = 200 + name = "[RECRUITING]" + archived = False + guild = SimpleNamespace(me=object()) + + def __init__(self) -> None: + self.edit = AsyncMock() + + def permissions_for(self, _member: object) -> SimpleNamespace: + return SimpleNamespace(manage_threads=True) + + thread = FakeThread() + + result = asyncio.run( + JobsCog._rename_gig_thread_for_status( + thread, + EngagementStatus.FILLED, + reason="test", + ) + ) + + assert result == "[FILLED] Discord gig 200" + thread.edit.assert_awaited_once_with( + name="[FILLED] Discord gig 200", + reason="test", + ) + + def test_build_match_candidate_lines_handles_non_string_names() -> None: candidate = _make_candidate( is_member=True,