syntaur 0.51.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-iqEGomW8.js → _basePickBy-BU6PvO_3.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq--Qg0UGRL.js → _baseUniq-ULf4vVpd.js} +1 -1
- package/dashboard/dist/assets/{arc-DARwlKiU.js → arc-XT0l7YJY.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-oWU1lL2y.js → architectureDiagram-2XIMDMQ5-CwB9td79.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-DMuCwZLv.js → blockDiagram-WCTKOSBZ-Bn41j6qN.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-Axpp-L4P.js → c4Diagram-IC4MRINW-C2bB3Wt9.js} +1 -1
- package/dashboard/dist/assets/channel-DdpiJj5X.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-BE-Yhqdt.js → chunk-4BX2VUAB-COuAcNxM.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-DacZdH_M.js → chunk-55IACEB6-CvHPcsLJ.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-vAEg5Z3N.js → chunk-FMBD7UC4-DXIGhmPU.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-CTukijKn.js → chunk-JSJVCQXG-CkwjFzqa.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-C-lU6Wil.js → chunk-KX2RTZJC-DvlBtgWD.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-m-jZxhEZ.js → chunk-NQ4KR5QH-B09GS7hk.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-VA8PtmgY.js → chunk-QZHKN3VN-C3Z8FIAY.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-BhM9cEr9.js → chunk-WL4C6EOR-C9vIH81p.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BmGAlnPn.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BmGAlnPn.js +1 -0
- package/dashboard/dist/assets/clone-BXzabHnl.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-DBGtEkKf.js → cose-bilkent-S5V4N54A-DqW2SOzy.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-BIU8RfcY.js → dagre-KLK3FWXG-CDENVvHX.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-C1OD19qw.js → diagram-E7M64L7V-y2wSierm.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-B-VWSLa6.js → diagram-IFDJBPK2-B0gtFw0q.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-gpFwgRk6.js → diagram-P4PSJMXO-BJ5SuU3K.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-MxL4ZzOD.js → erDiagram-INFDFZHY-Np5HM_kO.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-B0BqXx8A.js → flowDiagram-PKNHOUZH-DqvNjVTP.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-CZSBVo4l.js → ganttDiagram-A5KZAMGK-CoVlQufE.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-CfXBKQ-d.js → gitGraphDiagram-K3NZZRJ6-CVN4LM7Q.js} +1 -1
- package/dashboard/dist/assets/{graph-IrjCiOoy.js → graph-DFGZK77c.js} +1 -1
- package/dashboard/dist/assets/index-BdzQ01f3.css +1 -0
- package/dashboard/dist/assets/index-D_QYTx_w.js +587 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Rf9ZeCX3.js → infoDiagram-LFFYTUFH-CBPe1xjI.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-RAQWTALS.js → ishikawaDiagram-PHBUUO56-BwfJIMNv.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-ZcEWsM-p.js → journeyDiagram-4ABVD52K-BkGYrLtT.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-B-GmGguF.js → kanban-definition-K7BYSVSG-BefYgccp.js} +1 -1
- package/dashboard/dist/assets/{layout-CGl1QE2H.js → layout-cVbKZnNy.js} +1 -1
- package/dashboard/dist/assets/{linear-C8T_EWa_.js → linear-zZo5pYij.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-_rgvEzla.js → mermaid.core-Co8nky_A.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-D9eiyPrJ.js → mindmap-definition-YRQLILUH-BmIEBlPj.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-DuAS5_1b.js → pieDiagram-SKSYHLDU-Dzy3ttSo.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-Bs9cFwnM.js → quadrantDiagram-337W2JSQ-lszdCLyG.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-P8h8bKqs.js → requirementDiagram-Z7DCOOCP-EQJ3-Cgc.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-jvYtbQv9.js → sankeyDiagram-WA2Y5GQK-gEHE1gbB.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-dfHtIxLr.js → sequenceDiagram-2WXFIKYE-I9dC-eXq.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-BVKA9rS_.js → stateDiagram-RAJIS63D-BBazD69p.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-Bf4KSwDT.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-Cm1H8Att.js → timeline-definition-YZTLITO2-D0NlAJNp.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-BRzwg_ce.js → treemap-KZPCXAKY-C-P1ibqX.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-BJ4UoDVK.js → vennDiagram-LZ73GAT5-9vPEPtJ1.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-TyeURVy0.js → xychartDiagram-JWTSCODW-BD3Xjr0J.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +116 -6
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +116 -6
- package/dist/index.js.map +1 -1
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-DJkgIua7.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BQpVKOOw.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BQpVKOOw.js +0 -1
- package/dashboard/dist/assets/clone-Cyb0u6Fm.js +0 -1
- package/dashboard/dist/assets/index-BHyNXpJx.js +0 -577
- package/dashboard/dist/assets/index-KhylT_54.css +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-B1fHHK2b.js +0 -1
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
var UT=Object.defineProperty;var VT=(e,t,n)=>t in e?UT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xm=(e,t,n)=>VT(e,typeof t!="symbol"?t+"":t,n);function HT(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(s,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function xf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function O9(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})}),n}var Zm={exports:{}},Ll={},eh={exports:{}},gt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var nw;function WT(){if(nw)return gt;nw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(H){return H===null||typeof H!="object"?null:(H=g&&H[g]||H["@@iterator"],typeof H=="function"?H:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function v(H,re,U){this.props=H,this.context=re,this.refs=j,this.updater=U||b}v.prototype.isReactComponent={},v.prototype.setState=function(H,re){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,re,"setState")},v.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(H,re,U){this.props=H,this.context=re,this.refs=j,this.updater=U||b}var S=E.prototype=new k;S.constructor=E,C(S,v.prototype),S.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,R={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function $(H,re,U){var ue,ge={},se=null,ye=null;if(re!=null)for(ue in re.ref!==void 0&&(ye=re.ref),re.key!==void 0&&(se=""+re.key),re)A.call(re,ue)&&!P.hasOwnProperty(ue)&&(ge[ue]=re[ue]);var Se=arguments.length-2;if(Se===1)ge.children=U;else if(1<Se){for(var Te=Array(Se),Pe=0;Pe<Se;Pe++)Te[Pe]=arguments[Pe+2];ge.children=Te}if(H&&H.defaultProps)for(ue in Se=H.defaultProps,Se)ge[ue]===void 0&&(ge[ue]=Se[ue]);return{$$typeof:e,type:H,key:se,ref:ye,props:ge,_owner:R.current}}function M(H,re){return{$$typeof:e,type:H.type,key:re,ref:H.ref,props:H.props,_owner:H._owner}}function _(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function D(H){var re={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(U){return re[U]})}var V=/\/+/g;function K(H,re){return typeof H=="object"&&H!==null&&H.key!=null?D(""+H.key):re.toString(36)}function I(H,re,U,ue,ge){var se=typeof H;(se==="undefined"||se==="boolean")&&(H=null);var ye=!1;if(H===null)ye=!0;else switch(se){case"string":case"number":ye=!0;break;case"object":switch(H.$$typeof){case e:case t:ye=!0}}if(ye)return ye=H,ge=ge(ye),H=ue===""?"."+K(ye,0):ue,T(ge)?(U="",H!=null&&(U=H.replace(V,"$&/")+"/"),I(ge,re,U,"",function(Pe){return Pe})):ge!=null&&(_(ge)&&(ge=M(ge,U+(!ge.key||ye&&ye.key===ge.key?"":(""+ge.key).replace(V,"$&/")+"/")+H)),re.push(ge)),1;if(ye=0,ue=ue===""?".":ue+":",T(H))for(var Se=0;Se<H.length;Se++){se=H[Se];var Te=ue+K(se,Se);ye+=I(se,re,U,Te,ge)}else if(Te=y(H),typeof Te=="function")for(H=Te.call(H),Se=0;!(se=H.next()).done;)se=se.value,Te=ue+K(se,Se++),ye+=I(se,re,U,Te,ge);else if(se==="object")throw re=String(H),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.");return ye}function F(H,re,U){if(H==null)return H;var ue=[],ge=0;return I(H,ue,"","",function(se){return re.call(U,se,ge++)}),ue}function q(H){if(H._status===-1){var re=H._result;re=re(),re.then(function(U){(H._status===0||H._status===-1)&&(H._status=1,H._result=U)},function(U){(H._status===0||H._status===-1)&&(H._status=2,H._result=U)}),H._status===-1&&(H._status=0,H._result=re)}if(H._status===1)return H._result.default;throw H._result}var Z={current:null},z={transition:null},G={ReactCurrentDispatcher:Z,ReactCurrentBatchConfig:z,ReactCurrentOwner:R};function L(){throw Error("act(...) is not supported in production builds of React.")}return gt.Children={map:F,forEach:function(H,re,U){F(H,function(){re.apply(this,arguments)},U)},count:function(H){var re=0;return F(H,function(){re++}),re},toArray:function(H){return F(H,function(re){return re})||[]},only:function(H){if(!_(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},gt.Component=v,gt.Fragment=n,gt.Profiler=o,gt.PureComponent=E,gt.StrictMode=s,gt.Suspense=d,gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G,gt.act=L,gt.cloneElement=function(H,re,U){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var ue=C({},H.props),ge=H.key,se=H.ref,ye=H._owner;if(re!=null){if(re.ref!==void 0&&(se=re.ref,ye=R.current),re.key!==void 0&&(ge=""+re.key),H.type&&H.type.defaultProps)var Se=H.type.defaultProps;for(Te in re)A.call(re,Te)&&!P.hasOwnProperty(Te)&&(ue[Te]=re[Te]===void 0&&Se!==void 0?Se[Te]:re[Te])}var Te=arguments.length-2;if(Te===1)ue.children=U;else if(1<Te){Se=Array(Te);for(var Pe=0;Pe<Te;Pe++)Se[Pe]=arguments[Pe+2];ue.children=Se}return{$$typeof:e,type:H.type,key:ge,ref:se,props:ue,_owner:ye}},gt.createContext=function(H){return H={$$typeof:c,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:i,_context:H},H.Consumer=H},gt.createElement=$,gt.createFactory=function(H){var re=$.bind(null,H);return re.type=H,re},gt.createRef=function(){return{current:null}},gt.forwardRef=function(H){return{$$typeof:u,render:H}},gt.isValidElement=_,gt.lazy=function(H){return{$$typeof:h,_payload:{_status:-1,_result:H},_init:q}},gt.memo=function(H,re){return{$$typeof:m,type:H,compare:re===void 0?null:re}},gt.startTransition=function(H){var re=z.transition;z.transition={};try{H()}finally{z.transition=re}},gt.unstable_act=L,gt.useCallback=function(H,re){return Z.current.useCallback(H,re)},gt.useContext=function(H){return Z.current.useContext(H)},gt.useDebugValue=function(){},gt.useDeferredValue=function(H){return Z.current.useDeferredValue(H)},gt.useEffect=function(H,re){return Z.current.useEffect(H,re)},gt.useId=function(){return Z.current.useId()},gt.useImperativeHandle=function(H,re,U){return Z.current.useImperativeHandle(H,re,U)},gt.useInsertionEffect=function(H,re){return Z.current.useInsertionEffect(H,re)},gt.useLayoutEffect=function(H,re){return Z.current.useLayoutEffect(H,re)},gt.useMemo=function(H,re){return Z.current.useMemo(H,re)},gt.useReducer=function(H,re,U){return Z.current.useReducer(H,re,U)},gt.useRef=function(H){return Z.current.useRef(H)},gt.useState=function(H){return Z.current.useState(H)},gt.useSyncExternalStore=function(H,re,U){return Z.current.useSyncExternalStore(H,re,U)},gt.useTransition=function(){return Z.current.useTransition()},gt.version="18.3.1",gt}var rw;function Qg(){return rw||(rw=1,eh.exports=WT()),eh.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var sw;function KT(){if(sw)return Ll;sw=1;var e=Qg(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(u,d,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(b=d.ref);for(h in d)s.call(d,h)&&!i.hasOwnProperty(h)&&(g[h]=d[h]);if(u&&u.defaultProps)for(h in d=u.defaultProps,d)g[h]===void 0&&(g[h]=d[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:o.current}}return Ll.Fragment=n,Ll.jsx=c,Ll.jsxs=c,Ll}var ow;function qT(){return ow||(ow=1,Zm.exports=KT()),Zm.exports}var r=qT(),p=Qg();const Dt=xf(p),ak=HT({__proto__:null,default:Dt},[p]);var nd={},th={exports:{}},ir={},nh={exports:{}},rh={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var aw;function GT(){return aw||(aw=1,(function(e){function t(z,G){var L=z.length;z.push(G);e:for(;0<L;){var H=L-1>>>1,re=z[H];if(0<o(re,G))z[H]=G,z[L]=re,L=H;else break e}}function n(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var G=z[0],L=z.pop();if(L!==G){z[0]=L;e:for(var H=0,re=z.length,U=re>>>1;H<U;){var ue=2*(H+1)-1,ge=z[ue],se=ue+1,ye=z[se];if(0>o(ge,L))se<re&&0>o(ye,ge)?(z[H]=ye,z[se]=L,H=se):(z[H]=ge,z[ue]=L,H=ue);else if(se<re&&0>o(ye,L))z[H]=ye,z[se]=L,H=se;else break e}}return G}function o(z,G){var L=z.sortIndex-G.sortIndex;return L!==0?L:z.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var d=[],m=[],h=1,g=null,y=3,b=!1,C=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(z){for(var G=n(m);G!==null;){if(G.callback===null)s(m);else if(G.startTime<=z)s(m),G.sortIndex=G.expirationTime,t(d,G);else break;G=n(m)}}function T(z){if(j=!1,S(z),!C)if(n(d)!==null)C=!0,q(A);else{var G=n(m);G!==null&&Z(T,G.startTime-z)}}function A(z,G){C=!1,j&&(j=!1,k($),$=-1),b=!0;var L=y;try{for(S(G),g=n(d);g!==null&&(!(g.expirationTime>G)||z&&!D());){var H=g.callback;if(typeof H=="function"){g.callback=null,y=g.priorityLevel;var re=H(g.expirationTime<=G);G=e.unstable_now(),typeof re=="function"?g.callback=re:g===n(d)&&s(d),S(G)}else s(d);g=n(d)}if(g!==null)var U=!0;else{var ue=n(m);ue!==null&&Z(T,ue.startTime-G),U=!1}return U}finally{g=null,y=L,b=!1}}var R=!1,P=null,$=-1,M=5,_=-1;function D(){return!(e.unstable_now()-_<M)}function V(){if(P!==null){var z=e.unstable_now();_=z;var G=!0;try{G=P(!0,z)}finally{G?K():(R=!1,P=null)}}else R=!1}var K;if(typeof E=="function")K=function(){E(V)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,F=I.port2;I.port1.onmessage=V,K=function(){F.postMessage(null)}}else K=function(){v(V,0)};function q(z){P=z,R||(R=!0,K())}function Z(z,G){$=v(function(){z(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_continueExecution=function(){C||b||(C=!0,q(A))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(z){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var L=y;y=G;try{return z()}finally{y=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,G){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var L=y;y=z;try{return G()}finally{y=L}},e.unstable_scheduleCallback=function(z,G,L){var H=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?H+L:H):L=H,z){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=L+re,z={id:h++,callback:G,priorityLevel:z,startTime:L,expirationTime:re,sortIndex:-1},L>H?(z.sortIndex=L,t(m,z),n(d)===null&&z===n(m)&&(j?(k($),$=-1):j=!0,Z(T,L-H))):(z.sortIndex=re,t(d,z),C||b||(C=!0,q(A))),z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(z){var G=y;return function(){var L=y;y=G;try{return z.apply(this,arguments)}finally{y=L}}}})(rh)),rh}var iw;function YT(){return iw||(iw=1,nh.exports=GT()),nh.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var lw;function QT(){if(lw)return ir;lw=1;var e=Qg(),t=YT();function n(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,f=1;f<arguments.length;f++)l+="&args[]="+encodeURIComponent(arguments[f]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function i(a,l){c(a,l),c(a+"Capture",l)}function c(a,l){for(o[a]=l,a=0;a<l.length;a++)s.add(l[a])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(a){return d.call(g,a)?!0:d.call(h,a)?!1:m.test(a)?g[a]=!0:(h[a]=!0,!1)}function b(a,l,f,x){if(f!==null&&f.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return x?!1:f!==null?!f.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function C(a,l,f,x){if(l===null||typeof l>"u"||b(a,l,f,x))return!0;if(x)return!1;if(f!==null)switch(f.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function j(a,l,f,x,w,N,O){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=f,this.propertyName=a,this.type=l,this.sanitizeURL=N,this.removeEmptyString=O}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){v[a]=new j(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var l=a[0];v[l]=new j(l,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){v[a]=new j(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){v[a]=new j(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){v[a]=new j(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){v[a]=new j(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){v[a]=new j(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){v[a]=new j(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){v[a]=new j(a,5,!1,a.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){v[a]=new j(a,1,!1,a.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){v[a]=new j(a,1,!1,a.toLowerCase(),null,!0,!0)});function S(a,l,f,x){var w=v.hasOwnProperty(l)?v[l]:null;(w!==null?w.type!==0:x||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(C(l,f,w,x)&&(f=null),x||w===null?y(l)&&(f===null?a.removeAttribute(l):a.setAttribute(l,""+f)):w.mustUseProperty?a[w.propertyName]=f===null?w.type===3?!1:"":f:(l=w.attributeName,x=w.attributeNamespace,f===null?a.removeAttribute(l):(w=w.type,f=w===3||w===4&&f===!0?"":""+f,x?a.setAttributeNS(x,l,f):a.setAttribute(l,f))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),R=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Z=Symbol.for("react.offscreen"),z=Symbol.iterator;function G(a){return a===null||typeof a!="object"?null:(a=z&&a[z]||a["@@iterator"],typeof a=="function"?a:null)}var L=Object.assign,H;function re(a){if(H===void 0)try{throw Error()}catch(f){var l=f.stack.trim().match(/\n( *(at )?)/);H=l&&l[1]||""}return`
|
|
34
|
+
`+H+a}var U=!1;function ue(a,l){if(!a||U)return"";U=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(de){var x=de}Reflect.construct(a,[],l)}else{try{l.call()}catch(de){x=de}a.call(l.prototype)}else{try{throw Error()}catch(de){x=de}a()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var w=de.stack.split(`
|
|
35
|
+
`),N=x.stack.split(`
|
|
36
|
+
`),O=w.length-1,W=N.length-1;1<=O&&0<=W&&w[O]!==N[W];)W--;for(;1<=O&&0<=W;O--,W--)if(w[O]!==N[W]){if(O!==1||W!==1)do if(O--,W--,0>W||w[O]!==N[W]){var Q=`
|
|
37
|
+
`+w[O].replace(" at new "," at ");return a.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",a.displayName)),Q}while(1<=O&&0<=W);break}}}finally{U=!1,Error.prepareStackTrace=f}return(a=a?a.displayName||a.name:"")?re(a):""}function ge(a){switch(a.tag){case 5:return re(a.type);case 16:return re("Lazy");case 13:return re("Suspense");case 19:return re("SuspenseList");case 0:case 2:case 15:return a=ue(a.type,!1),a;case 11:return a=ue(a.type.render,!1),a;case 1:return a=ue(a.type,!0),a;default:return""}}function se(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case P:return"Fragment";case R:return"Portal";case M:return"Profiler";case $:return"StrictMode";case K:return"Suspense";case I:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case D:return(a.displayName||"Context")+".Consumer";case _:return(a._context.displayName||"Context")+".Provider";case V:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case F:return l=a.displayName||null,l!==null?l:se(a.type)||"Memo";case q:l=a._payload,a=a._init;try{return se(a(l))}catch{}}return null}function ye(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(l);case 8:return l===$?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Se(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Te(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Pe(a){var l=Te(a)?"checked":"value",f=Object.getOwnPropertyDescriptor(a.constructor.prototype,l),x=""+a[l];if(!a.hasOwnProperty(l)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var w=f.get,N=f.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return w.call(this)},set:function(O){x=""+O,N.call(this,O)}}),Object.defineProperty(a,l,{enumerable:f.enumerable}),{getValue:function(){return x},setValue:function(O){x=""+O},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Ke(a){a._valueTracker||(a._valueTracker=Pe(a))}function ct(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var f=l.getValue(),x="";return a&&(x=Te(a)?a.checked?"true":"false":a.value),a=x,a!==f?(l.setValue(a),!0):!1}function et(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function ot(a,l){var f=l.checked;return L({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:f??a._wrapperState.initialChecked})}function X(a,l){var f=l.defaultValue==null?"":l.defaultValue,x=l.checked!=null?l.checked:l.defaultChecked;f=Se(l.value!=null?l.value:f),a._wrapperState={initialChecked:x,initialValue:f,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Me(a,l){l=l.checked,l!=null&&S(a,"checked",l,!1)}function Ce(a,l){Me(a,l);var f=Se(l.value),x=l.type;if(f!=null)x==="number"?(f===0&&a.value===""||a.value!=f)&&(a.value=""+f):a.value!==""+f&&(a.value=""+f);else if(x==="submit"||x==="reset"){a.removeAttribute("value");return}l.hasOwnProperty("value")?Ye(a,l.type,f):l.hasOwnProperty("defaultValue")&&Ye(a,l.type,Se(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(a.defaultChecked=!!l.defaultChecked)}function Ie(a,l,f){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var x=l.type;if(!(x!=="submit"&&x!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+a._wrapperState.initialValue,f||l===a.value||(a.value=l),a.defaultValue=l}f=a.name,f!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,f!==""&&(a.name=f)}function Ye(a,l,f){(l!=="number"||et(a.ownerDocument)!==a)&&(f==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+f&&(a.defaultValue=""+f))}var Fe=Array.isArray;function Ze(a,l,f,x){if(a=a.options,l){l={};for(var w=0;w<f.length;w++)l["$"+f[w]]=!0;for(f=0;f<a.length;f++)w=l.hasOwnProperty("$"+a[f].value),a[f].selected!==w&&(a[f].selected=w),w&&x&&(a[f].defaultSelected=!0)}else{for(f=""+Se(f),l=null,w=0;w<a.length;w++){if(a[w].value===f){a[w].selected=!0,x&&(a[w].defaultSelected=!0);return}l!==null||a[w].disabled||(l=a[w])}l!==null&&(l.selected=!0)}}function Je(a,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return L({},l,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Ot(a,l){var f=l.value;if(f==null){if(f=l.children,l=l.defaultValue,f!=null){if(l!=null)throw Error(n(92));if(Fe(f)){if(1<f.length)throw Error(n(93));f=f[0]}l=f}l==null&&(l=""),f=l}a._wrapperState={initialValue:Se(f)}}function yt(a,l){var f=Se(l.value),x=Se(l.defaultValue);f!=null&&(f=""+f,f!==a.value&&(a.value=f),l.defaultValue==null&&a.defaultValue!==f&&(a.defaultValue=f)),x!=null&&(a.defaultValue=""+x)}function dt(a){var l=a.textContent;l===a._wrapperState.initialValue&&l!==""&&l!==null&&(a.value=l)}function le(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Y(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?le(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var fe,ne=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,f,x,w){MSApp.execUnsafeLocalFunction(function(){return a(l,f,x,w)})}:a})(function(a,l){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=l;else{for(fe=fe||document.createElement("div"),fe.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=fe.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function he(a,l){if(l){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=l;return}}a.textContent=l}var De={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ut=["Webkit","ms","Moz","O"];Object.keys(De).forEach(function(a){ut.forEach(function(l){l=l+a.charAt(0).toUpperCase()+a.substring(1),De[l]=De[a]})});function ae(a,l,f){return l==null||typeof l=="boolean"||l===""?"":f||typeof l!="number"||l===0||De.hasOwnProperty(a)&&De[a]?(""+l).trim():l+"px"}function be(a,l){a=a.style;for(var f in l)if(l.hasOwnProperty(f)){var x=f.indexOf("--")===0,w=ae(f,l[f],x);f==="float"&&(f="cssFloat"),x?a.setProperty(f,w):a[f]=w}}var Le=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function at(a,l){if(l){if(Le[a]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function Be(a,l){if(a.indexOf("-")===-1)return typeof l.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kt=null;function St(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var _t=null,pe=null,te=null;function xe(a){if(a=bl(a)){if(typeof _t!="function")throw Error(n(280));var l=a.stateNode;l&&(l=xu(l),_t(a.stateNode,a.type,l))}}function Oe(a){pe?te?te.push(a):te=[a]:pe=a}function tt(){if(pe){var a=pe,l=te;if(te=pe=null,xe(a),l)for(a=0;a<l.length;a++)xe(l[a])}}function ve(a,l){return a(l)}function Nt(){}var It=!1;function en(a,l,f){if(It)return a(l,f);It=!0;try{return ve(a,l,f)}finally{It=!1,(pe!==null||te!==null)&&(Nt(),tt())}}function jt(a,l){var f=a.stateNode;if(f===null)return null;var x=xu(f);if(x===null)return null;f=x[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(a=a.type,x=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!x;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(n(231,l,typeof f));return f}var wn=!1;if(u)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){wn=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{wn=!1}function oe(a,l,f,x,w,N,O,W,Q){var de=Array.prototype.slice.call(arguments,3);try{l.apply(f,de)}catch(ke){this.onError(ke)}}var Ue=!1,nt=null,bt=!1,tr=null,qr={onError:function(a){Ue=!0,nt=a}};function Ts(a,l,f,x,w,N,O,W,Q){Ue=!1,nt=null,oe.apply(qr,arguments)}function qc(a,l,f,x,w,N,O,W,Q){if(Ts.apply(this,arguments),Ue){if(Ue){var de=nt;Ue=!1,nt=null}else throw Error(n(198));bt||(bt=!0,tr=de)}}function ht(a){var l=a,f=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(f=l.return),a=l.return;while(a)}return l.tag===3?f:null}function Gc(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function tl(a){if(ht(a)!==a)throw Error(n(188))}function Yc(a){var l=a.alternate;if(!l){if(l=ht(a),l===null)throw Error(n(188));return l!==a?null:a}for(var f=a,x=l;;){var w=f.return;if(w===null)break;var N=w.alternate;if(N===null){if(x=w.return,x!==null){f=x;continue}break}if(w.child===N.child){for(N=w.child;N;){if(N===f)return tl(w),a;if(N===x)return tl(w),l;N=N.sibling}throw Error(n(188))}if(f.return!==x.return)f=w,x=N;else{for(var O=!1,W=w.child;W;){if(W===f){O=!0,f=w,x=N;break}if(W===x){O=!0,x=w,f=N;break}W=W.sibling}if(!O){for(W=N.child;W;){if(W===f){O=!0,f=N,x=w;break}if(W===x){O=!0,x=N,f=w;break}W=W.sibling}if(!O)throw Error(n(189))}}if(f.alternate!==x)throw Error(n(190))}if(f.tag!==3)throw Error(n(188));return f.stateNode.current===f?a:l}function on(a){return a=Yc(a),a!==null?Qc(a):null}function Qc(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=Qc(a);if(l!==null)return l;a=a.sibling}return null}var Jc=t.unstable_scheduleCallback,Xc=t.unstable_cancelCallback,bp=t.unstable_shouldYield,vp=t.unstable_requestPaint,tn=t.unstable_now,wp=t.unstable_getCurrentPriorityLevel,nl=t.unstable_ImmediatePriority,Zc=t.unstable_UserBlockingPriority,qs=t.unstable_NormalPriority,va=t.unstable_LowPriority,eu=t.unstable_IdlePriority,wa=null,cn=null;function ja(a){if(cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(wa,a,void 0,(a.current.flags&128)===128)}catch{}}var Bn=Math.clz32?Math.clz32:Sp,jp=Math.log,kp=Math.LN2;function Sp(a){return a>>>=0,a===0?32:31-(jp(a)/kp|0)|0}var Yn=64,ka=4194304;function Gs(a){switch(a&-a){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: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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Do(a,l){var f=a.pendingLanes;if(f===0)return 0;var x=0,w=a.suspendedLanes,N=a.pingedLanes,O=f&268435455;if(O!==0){var W=O&~w;W!==0?x=Gs(W):(N&=O,N!==0&&(x=Gs(N)))}else O=f&~w,O!==0?x=Gs(O):N!==0&&(x=Gs(N));if(x===0)return 0;if(l!==0&&l!==x&&(l&w)===0&&(w=x&-x,N=l&-l,w>=N||w===16&&(N&4194240)!==0))return l;if((x&4)!==0&&(x|=f&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=x;0<l;)f=31-Bn(l),w=1<<f,x|=a[f],l&=~w;return x}function tu(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64: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 l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function nu(a,l){for(var f=a.suspendedLanes,x=a.pingedLanes,w=a.expirationTimes,N=a.pendingLanes;0<N;){var O=31-Bn(N),W=1<<O,Q=w[O];Q===-1?((W&f)===0||(W&x)!==0)&&(w[O]=tu(W,l)):Q<=l&&(a.expiredLanes|=W),N&=~W}}function $o(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function rl(){var a=Yn;return Yn<<=1,(Yn&4194240)===0&&(Yn=64),a}function Jt(a){for(var l=[],f=0;31>f;f++)l.push(a);return l}function Gr(a,l,f){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-Bn(l),a[l]=f}function sl(a,l){var f=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var x=a.eventTimes;for(a=a.expirationTimes;0<f;){var w=31-Bn(f),N=1<<w;l[w]=0,x[w]=-1,a[w]=-1,f&=~N}}function ol(a,l){var f=a.entangledLanes|=l;for(a=a.entanglements;f;){var x=31-Bn(f),w=1<<x;w&l|a[x]&l&&(a[x]|=l),f&=~w}}var Pt=0;function al(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Sa,Na,Ys,Ca,ru,il=!1,In=[],us=null,Pr=null,ds=null,Lo=new Map,Oo=new Map,Un=[],B="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function J(a,l){switch(a){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":Pr=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":Lo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(l.pointerId)}}function me(a,l,f,x,w,N){return a===null||a.nativeEvent!==N?(a={blockedOn:l,domEventName:f,eventSystemFlags:x,nativeEvent:N,targetContainers:[w]},l!==null&&(l=bl(l),l!==null&&Na(l)),a):(a.eventSystemFlags|=x,l=a.targetContainers,w!==null&&l.indexOf(w)===-1&&l.push(w),a)}function _e(a,l,f,x,w){switch(l){case"focusin":return us=me(us,a,l,f,x,w),!0;case"dragenter":return Pr=me(Pr,a,l,f,x,w),!0;case"mouseover":return ds=me(ds,a,l,f,x,w),!0;case"pointerover":var N=w.pointerId;return Lo.set(N,me(Lo.get(N)||null,a,l,f,x,w)),!0;case"gotpointercapture":return N=w.pointerId,Oo.set(N,me(Oo.get(N)||null,a,l,f,x,w)),!0}return!1}function ft(a){var l=_o(a.target);if(l!==null){var f=ht(l);if(f!==null){if(l=f.tag,l===13){if(l=Gc(f),l!==null){a.blockedOn=l,ru(a.priority,function(){Ys(f)});return}}else if(l===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function vt(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var f=Np(a.domEventName,a.eventSystemFlags,l[0],a.nativeEvent);if(f===null){f=a.nativeEvent;var x=new f.constructor(f.type,f);kt=x,f.target.dispatchEvent(x),kt=null}else return l=bl(f),l!==null&&Na(l),a.blockedOn=f,!1;l.shift()}return!0}function Mt(a,l,f){vt(a)&&f.delete(l)}function hr(){il=!1,us!==null&&vt(us)&&(us=null),Pr!==null&&vt(Pr)&&(Pr=null),ds!==null&&vt(ds)&&(ds=null),Lo.forEach(Mt),Oo.forEach(Mt)}function un(a,l){a.blockedOn===l&&(a.blockedOn=null,il||(il=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hr)))}function pn(a){function l(w){return un(w,a)}if(0<In.length){un(In[0],a);for(var f=1;f<In.length;f++){var x=In[f];x.blockedOn===a&&(x.blockedOn=null)}}for(us!==null&&un(us,a),Pr!==null&&un(Pr,a),ds!==null&&un(ds,a),Lo.forEach(l),Oo.forEach(l),f=0;f<Un.length;f++)x=Un[f],x.blockedOn===a&&(x.blockedOn=null);for(;0<Un.length&&(f=Un[0],f.blockedOn===null);)ft(f),f.blockedOn===null&&Un.shift()}var mn=T.ReactCurrentBatchConfig,Io=!0;function su(a,l,f,x){var w=Pt,N=mn.transition;mn.transition=null;try{Pt=1,fs(a,l,f,x)}finally{Pt=w,mn.transition=N}}function Ea(a,l,f,x){var w=Pt,N=mn.transition;mn.transition=null;try{Pt=4,fs(a,l,f,x)}finally{Pt=w,mn.transition=N}}function fs(a,l,f,x){if(Io){var w=Np(a,l,f,x);if(w===null)Up(a,l,x,ou,f),J(a,x);else if(_e(w,a,l,f,x))x.stopPropagation();else if(J(a,x),l&4&&-1<B.indexOf(a)){for(;w!==null;){var N=bl(w);if(N!==null&&Sa(N),N=Np(a,l,f,x),N===null&&Up(a,l,x,ou,f),N===w)break;w=N}w!==null&&x.stopPropagation()}else Up(a,l,x,null,f)}}var ou=null;function Np(a,l,f,x){if(ou=null,a=St(x),a=_o(a),a!==null)if(l=ht(a),l===null)a=null;else if(f=l.tag,f===13){if(a=Gc(l),a!==null)return a;a=null}else if(f===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null);return ou=a,null}function Uy(a){switch(a){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(wp()){case nl:return 1;case Zc:return 4;case qs:case va:return 16;case eu:return 536870912;default:return 16}default:return 16}}var Qs=null,Cp=null,au=null;function Vy(){if(au)return au;var a,l=Cp,f=l.length,x,w="value"in Qs?Qs.value:Qs.textContent,N=w.length;for(a=0;a<f&&l[a]===w[a];a++);var O=f-a;for(x=1;x<=O&&l[f-x]===w[N-x];x++);return au=w.slice(a,1<x?1-x:void 0)}function iu(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function lu(){return!0}function Hy(){return!1}function gr(a){function l(f,x,w,N,O){this._reactName=f,this._targetInst=w,this.type=x,this.nativeEvent=N,this.target=O,this.currentTarget=null;for(var W in a)a.hasOwnProperty(W)&&(f=a[W],this[W]=f?f(N):N[W]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?lu:Hy,this.isPropagationStopped=Hy,this}return L(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=lu)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=lu)},persist:function(){},isPersistent:lu}),l}var Ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ep=gr(Ta),ll=L({},Ta,{view:0,detail:0}),h2=gr(ll),Tp,Rp,cl,cu=L({},ll,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pp,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==cl&&(cl&&a.type==="mousemove"?(Tp=a.screenX-cl.screenX,Rp=a.screenY-cl.screenY):Rp=Tp=0,cl=a),Tp)},movementY:function(a){return"movementY"in a?a.movementY:Rp}}),Wy=gr(cu),g2=L({},cu,{dataTransfer:0}),x2=gr(g2),y2=L({},ll,{relatedTarget:0}),Ap=gr(y2),b2=L({},Ta,{animationName:0,elapsedTime:0,pseudoElement:0}),v2=gr(b2),w2=L({},Ta,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),j2=gr(w2),k2=L({},Ta,{data:0}),Ky=gr(k2),S2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N2={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},C2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function E2(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=C2[a])?!!l[a]:!1}function Pp(){return E2}var T2=L({},ll,{key:function(a){if(a.key){var l=S2[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=iu(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?N2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pp,charCode:function(a){return a.type==="keypress"?iu(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?iu(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),R2=gr(T2),A2=L({},cu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qy=gr(A2),P2=L({},ll,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pp}),D2=gr(P2),$2=L({},Ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),L2=gr($2),O2=L({},cu,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),I2=gr(O2),_2=[9,13,27,32],Dp=u&&"CompositionEvent"in window,ul=null;u&&"documentMode"in document&&(ul=document.documentMode);var M2=u&&"TextEvent"in window&&!ul,Gy=u&&(!Dp||ul&&8<ul&&11>=ul),Yy=" ",Qy=!1;function Jy(a,l){switch(a){case"keyup":return _2.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xy(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ra=!1;function F2(a,l){switch(a){case"compositionend":return Xy(l);case"keypress":return l.which!==32?null:(Qy=!0,Yy);case"textInput":return a=l.data,a===Yy&&Qy?null:a;default:return null}}function z2(a,l){if(Ra)return a==="compositionend"||!Dp&&Jy(a,l)?(a=Vy(),au=Cp=Qs=null,Ra=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Gy&&l.locale!=="ko"?null:l.data;default:return null}}var B2={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zy(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!B2[a.type]:l==="textarea"}function eb(a,l,f,x){Oe(x),l=mu(l,"onChange"),0<l.length&&(f=new Ep("onChange","change",null,f,x),a.push({event:f,listeners:l}))}var dl=null,fl=null;function U2(a){yb(a,0)}function uu(a){var l=La(a);if(ct(l))return a}function V2(a,l){if(a==="change")return l}var tb=!1;if(u){var $p;if(u){var Lp="oninput"in document;if(!Lp){var nb=document.createElement("div");nb.setAttribute("oninput","return;"),Lp=typeof nb.oninput=="function"}$p=Lp}else $p=!1;tb=$p&&(!document.documentMode||9<document.documentMode)}function rb(){dl&&(dl.detachEvent("onpropertychange",sb),fl=dl=null)}function sb(a){if(a.propertyName==="value"&&uu(fl)){var l=[];eb(l,fl,a,St(a)),en(U2,l)}}function H2(a,l,f){a==="focusin"?(rb(),dl=l,fl=f,dl.attachEvent("onpropertychange",sb)):a==="focusout"&&rb()}function W2(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return uu(fl)}function K2(a,l){if(a==="click")return uu(l)}function q2(a,l){if(a==="input"||a==="change")return uu(l)}function G2(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Yr=typeof Object.is=="function"?Object.is:G2;function pl(a,l){if(Yr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var f=Object.keys(a),x=Object.keys(l);if(f.length!==x.length)return!1;for(x=0;x<f.length;x++){var w=f[x];if(!d.call(l,w)||!Yr(a[w],l[w]))return!1}return!0}function ob(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function ab(a,l){var f=ob(a);a=0;for(var x;f;){if(f.nodeType===3){if(x=a+f.textContent.length,a<=l&&x>=l)return{node:f,offset:l-a};a=x}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=ob(f)}}function ib(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?ib(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function lb(){for(var a=window,l=et();l instanceof a.HTMLIFrameElement;){try{var f=typeof l.contentWindow.location.href=="string"}catch{f=!1}if(f)a=l.contentWindow;else break;l=et(a.document)}return l}function Op(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}function Y2(a){var l=lb(),f=a.focusedElem,x=a.selectionRange;if(l!==f&&f&&f.ownerDocument&&ib(f.ownerDocument.documentElement,f)){if(x!==null&&Op(f)){if(l=x.start,a=x.end,a===void 0&&(a=l),"selectionStart"in f)f.selectionStart=l,f.selectionEnd=Math.min(a,f.value.length);else if(a=(l=f.ownerDocument||document)&&l.defaultView||window,a.getSelection){a=a.getSelection();var w=f.textContent.length,N=Math.min(x.start,w);x=x.end===void 0?N:Math.min(x.end,w),!a.extend&&N>x&&(w=x,x=N,N=w),w=ab(f,N);var O=ab(f,x);w&&O&&(a.rangeCount!==1||a.anchorNode!==w.node||a.anchorOffset!==w.offset||a.focusNode!==O.node||a.focusOffset!==O.offset)&&(l=l.createRange(),l.setStart(w.node,w.offset),a.removeAllRanges(),N>x?(a.addRange(l),a.extend(O.node,O.offset)):(l.setEnd(O.node,O.offset),a.addRange(l)))}}for(l=[],a=f;a=a.parentNode;)a.nodeType===1&&l.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<l.length;f++)a=l[f],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var Q2=u&&"documentMode"in document&&11>=document.documentMode,Aa=null,Ip=null,ml=null,_p=!1;function cb(a,l,f){var x=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;_p||Aa==null||Aa!==et(x)||(x=Aa,"selectionStart"in x&&Op(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),ml&&pl(ml,x)||(ml=x,x=mu(Ip,"onSelect"),0<x.length&&(l=new Ep("onSelect","select",null,l,f),a.push({event:l,listeners:x}),l.target=Aa)))}function du(a,l){var f={};return f[a.toLowerCase()]=l.toLowerCase(),f["Webkit"+a]="webkit"+l,f["Moz"+a]="moz"+l,f}var Pa={animationend:du("Animation","AnimationEnd"),animationiteration:du("Animation","AnimationIteration"),animationstart:du("Animation","AnimationStart"),transitionend:du("Transition","TransitionEnd")},Mp={},ub={};u&&(ub=document.createElement("div").style,"AnimationEvent"in window||(delete Pa.animationend.animation,delete Pa.animationiteration.animation,delete Pa.animationstart.animation),"TransitionEvent"in window||delete Pa.transitionend.transition);function fu(a){if(Mp[a])return Mp[a];if(!Pa[a])return a;var l=Pa[a],f;for(f in l)if(l.hasOwnProperty(f)&&f in ub)return Mp[a]=l[f];return a}var db=fu("animationend"),fb=fu("animationiteration"),pb=fu("animationstart"),mb=fu("transitionend"),hb=new Map,gb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Js(a,l){hb.set(a,l),i(l,[a])}for(var Fp=0;Fp<gb.length;Fp++){var zp=gb[Fp],J2=zp.toLowerCase(),X2=zp[0].toUpperCase()+zp.slice(1);Js(J2,"on"+X2)}Js(db,"onAnimationEnd"),Js(fb,"onAnimationIteration"),Js(pb,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(mb,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Z2=new Set("cancel close invalid load scroll toggle".split(" ").concat(hl));function xb(a,l,f){var x=a.type||"unknown-event";a.currentTarget=f,qc(x,l,void 0,a),a.currentTarget=null}function yb(a,l){l=(l&4)!==0;for(var f=0;f<a.length;f++){var x=a[f],w=x.event;x=x.listeners;e:{var N=void 0;if(l)for(var O=x.length-1;0<=O;O--){var W=x[O],Q=W.instance,de=W.currentTarget;if(W=W.listener,Q!==N&&w.isPropagationStopped())break e;xb(w,W,de),N=Q}else for(O=0;O<x.length;O++){if(W=x[O],Q=W.instance,de=W.currentTarget,W=W.listener,Q!==N&&w.isPropagationStopped())break e;xb(w,W,de),N=Q}}}if(bt)throw a=tr,bt=!1,tr=null,a}function Wt(a,l){var f=l[Gp];f===void 0&&(f=l[Gp]=new Set);var x=a+"__bubble";f.has(x)||(bb(l,a,2,!1),f.add(x))}function Bp(a,l,f){var x=0;l&&(x|=4),bb(f,a,x,l)}var pu="_reactListening"+Math.random().toString(36).slice(2);function gl(a){if(!a[pu]){a[pu]=!0,s.forEach(function(f){f!=="selectionchange"&&(Z2.has(f)||Bp(f,!1,a),Bp(f,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[pu]||(l[pu]=!0,Bp("selectionchange",!1,l))}}function bb(a,l,f,x){switch(Uy(l)){case 1:var w=su;break;case 4:w=Ea;break;default:w=fs}f=w.bind(null,l,f,a),w=void 0,!wn||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(w=!0),x?w!==void 0?a.addEventListener(l,f,{capture:!0,passive:w}):a.addEventListener(l,f,!0):w!==void 0?a.addEventListener(l,f,{passive:w}):a.addEventListener(l,f,!1)}function Up(a,l,f,x,w){var N=x;if((l&1)===0&&(l&2)===0&&x!==null)e:for(;;){if(x===null)return;var O=x.tag;if(O===3||O===4){var W=x.stateNode.containerInfo;if(W===w||W.nodeType===8&&W.parentNode===w)break;if(O===4)for(O=x.return;O!==null;){var Q=O.tag;if((Q===3||Q===4)&&(Q=O.stateNode.containerInfo,Q===w||Q.nodeType===8&&Q.parentNode===w))return;O=O.return}for(;W!==null;){if(O=_o(W),O===null)return;if(Q=O.tag,Q===5||Q===6){x=N=O;continue e}W=W.parentNode}}x=x.return}en(function(){var de=N,ke=St(f),Ne=[];e:{var je=hb.get(a);if(je!==void 0){var Ve=Ep,qe=a;switch(a){case"keypress":if(iu(f)===0)break e;case"keydown":case"keyup":Ve=R2;break;case"focusin":qe="focus",Ve=Ap;break;case"focusout":qe="blur",Ve=Ap;break;case"beforeblur":case"afterblur":Ve=Ap;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ve=Wy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ve=x2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ve=D2;break;case db:case fb:case pb:Ve=v2;break;case mb:Ve=L2;break;case"scroll":Ve=h2;break;case"wheel":Ve=I2;break;case"copy":case"cut":case"paste":Ve=j2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ve=qy}var Qe=(l&4)!==0,dn=!Qe&&a==="scroll",ie=Qe?je!==null?je+"Capture":null:je;Qe=[];for(var ee=de,ce;ee!==null;){ce=ee;var Ae=ce.stateNode;if(ce.tag===5&&Ae!==null&&(ce=Ae,ie!==null&&(Ae=jt(ee,ie),Ae!=null&&Qe.push(xl(ee,Ae,ce)))),dn)break;ee=ee.return}0<Qe.length&&(je=new Ve(je,qe,null,f,ke),Ne.push({event:je,listeners:Qe}))}}if((l&7)===0){e:{if(je=a==="mouseover"||a==="pointerover",Ve=a==="mouseout"||a==="pointerout",je&&f!==kt&&(qe=f.relatedTarget||f.fromElement)&&(_o(qe)||qe[Rs]))break e;if((Ve||je)&&(je=ke.window===ke?ke:(je=ke.ownerDocument)?je.defaultView||je.parentWindow:window,Ve?(qe=f.relatedTarget||f.toElement,Ve=de,qe=qe?_o(qe):null,qe!==null&&(dn=ht(qe),qe!==dn||qe.tag!==5&&qe.tag!==6)&&(qe=null)):(Ve=null,qe=de),Ve!==qe)){if(Qe=Wy,Ae="onMouseLeave",ie="onMouseEnter",ee="mouse",(a==="pointerout"||a==="pointerover")&&(Qe=qy,Ae="onPointerLeave",ie="onPointerEnter",ee="pointer"),dn=Ve==null?je:La(Ve),ce=qe==null?je:La(qe),je=new Qe(Ae,ee+"leave",Ve,f,ke),je.target=dn,je.relatedTarget=ce,Ae=null,_o(ke)===de&&(Qe=new Qe(ie,ee+"enter",qe,f,ke),Qe.target=ce,Qe.relatedTarget=dn,Ae=Qe),dn=Ae,Ve&&qe)t:{for(Qe=Ve,ie=qe,ee=0,ce=Qe;ce;ce=Da(ce))ee++;for(ce=0,Ae=ie;Ae;Ae=Da(Ae))ce++;for(;0<ee-ce;)Qe=Da(Qe),ee--;for(;0<ce-ee;)ie=Da(ie),ce--;for(;ee--;){if(Qe===ie||ie!==null&&Qe===ie.alternate)break t;Qe=Da(Qe),ie=Da(ie)}Qe=null}else Qe=null;Ve!==null&&vb(Ne,je,Ve,Qe,!1),qe!==null&&dn!==null&&vb(Ne,dn,qe,Qe,!0)}}e:{if(je=de?La(de):window,Ve=je.nodeName&&je.nodeName.toLowerCase(),Ve==="select"||Ve==="input"&&je.type==="file")var Xe=V2;else if(Zy(je))if(tb)Xe=q2;else{Xe=W2;var rt=H2}else(Ve=je.nodeName)&&Ve.toLowerCase()==="input"&&(je.type==="checkbox"||je.type==="radio")&&(Xe=K2);if(Xe&&(Xe=Xe(a,de))){eb(Ne,Xe,f,ke);break e}rt&&rt(a,je,de),a==="focusout"&&(rt=je._wrapperState)&&rt.controlled&&je.type==="number"&&Ye(je,"number",je.value)}switch(rt=de?La(de):window,a){case"focusin":(Zy(rt)||rt.contentEditable==="true")&&(Aa=rt,Ip=de,ml=null);break;case"focusout":ml=Ip=Aa=null;break;case"mousedown":_p=!0;break;case"contextmenu":case"mouseup":case"dragend":_p=!1,cb(Ne,f,ke);break;case"selectionchange":if(Q2)break;case"keydown":case"keyup":cb(Ne,f,ke)}var st;if(Dp)e:{switch(a){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Ra?Jy(a,f)&&(it="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(it="onCompositionStart");it&&(Gy&&f.locale!=="ko"&&(Ra||it!=="onCompositionStart"?it==="onCompositionEnd"&&Ra&&(st=Vy()):(Qs=ke,Cp="value"in Qs?Qs.value:Qs.textContent,Ra=!0)),rt=mu(de,it),0<rt.length&&(it=new Ky(it,a,null,f,ke),Ne.push({event:it,listeners:rt}),st?it.data=st:(st=Xy(f),st!==null&&(it.data=st)))),(st=M2?F2(a,f):z2(a,f))&&(de=mu(de,"onBeforeInput"),0<de.length&&(ke=new Ky("onBeforeInput","beforeinput",null,f,ke),Ne.push({event:ke,listeners:de}),ke.data=st))}yb(Ne,l)})}function xl(a,l,f){return{instance:a,listener:l,currentTarget:f}}function mu(a,l){for(var f=l+"Capture",x=[];a!==null;){var w=a,N=w.stateNode;w.tag===5&&N!==null&&(w=N,N=jt(a,f),N!=null&&x.unshift(xl(a,N,w)),N=jt(a,l),N!=null&&x.push(xl(a,N,w))),a=a.return}return x}function Da(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function vb(a,l,f,x,w){for(var N=l._reactName,O=[];f!==null&&f!==x;){var W=f,Q=W.alternate,de=W.stateNode;if(Q!==null&&Q===x)break;W.tag===5&&de!==null&&(W=de,w?(Q=jt(f,N),Q!=null&&O.unshift(xl(f,Q,W))):w||(Q=jt(f,N),Q!=null&&O.push(xl(f,Q,W)))),f=f.return}O.length!==0&&a.push({event:l,listeners:O})}var eT=/\r\n?/g,tT=/\u0000|\uFFFD/g;function wb(a){return(typeof a=="string"?a:""+a).replace(eT,`
|
|
38
|
+
`).replace(tT,"")}function hu(a,l,f){if(l=wb(l),wb(a)!==l&&f)throw Error(n(425))}function gu(){}var Vp=null,Hp=null;function Wp(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Kp=typeof setTimeout=="function"?setTimeout:void 0,nT=typeof clearTimeout=="function"?clearTimeout:void 0,jb=typeof Promise=="function"?Promise:void 0,rT=typeof queueMicrotask=="function"?queueMicrotask:typeof jb<"u"?function(a){return jb.resolve(null).then(a).catch(sT)}:Kp;function sT(a){setTimeout(function(){throw a})}function qp(a,l){var f=l,x=0;do{var w=f.nextSibling;if(a.removeChild(f),w&&w.nodeType===8)if(f=w.data,f==="/$"){if(x===0){a.removeChild(w),pn(l);return}x--}else f!=="$"&&f!=="$?"&&f!=="$!"||x++;f=w}while(f);pn(l)}function Xs(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return a}function kb(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"){if(l===0)return a;l--}else f==="/$"&&l++}a=a.previousSibling}return null}var $a=Math.random().toString(36).slice(2),ps="__reactFiber$"+$a,yl="__reactProps$"+$a,Rs="__reactContainer$"+$a,Gp="__reactEvents$"+$a,oT="__reactListeners$"+$a,aT="__reactHandles$"+$a;function _o(a){var l=a[ps];if(l)return l;for(var f=a.parentNode;f;){if(l=f[Rs]||f[ps]){if(f=l.alternate,l.child!==null||f!==null&&f.child!==null)for(a=kb(a);a!==null;){if(f=a[ps])return f;a=kb(a)}return l}a=f,f=a.parentNode}return null}function bl(a){return a=a[ps]||a[Rs],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function La(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function xu(a){return a[yl]||null}var Yp=[],Oa=-1;function Zs(a){return{current:a}}function Kt(a){0>Oa||(a.current=Yp[Oa],Yp[Oa]=null,Oa--)}function Ut(a,l){Oa++,Yp[Oa]=a.current,a.current=l}var eo={},Vn=Zs(eo),nr=Zs(!1),Mo=eo;function Ia(a,l){var f=a.type.contextTypes;if(!f)return eo;var x=a.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===l)return x.__reactInternalMemoizedMaskedChildContext;var w={},N;for(N in f)w[N]=l[N];return x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=w),w}function rr(a){return a=a.childContextTypes,a!=null}function yu(){Kt(nr),Kt(Vn)}function Sb(a,l,f){if(Vn.current!==eo)throw Error(n(168));Ut(Vn,l),Ut(nr,f)}function Nb(a,l,f){var x=a.stateNode;if(l=l.childContextTypes,typeof x.getChildContext!="function")return f;x=x.getChildContext();for(var w in x)if(!(w in l))throw Error(n(108,ye(a)||"Unknown",w));return L({},f,x)}function bu(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||eo,Mo=Vn.current,Ut(Vn,a),Ut(nr,nr.current),!0}function Cb(a,l,f){var x=a.stateNode;if(!x)throw Error(n(169));f?(a=Nb(a,l,Mo),x.__reactInternalMemoizedMergedChildContext=a,Kt(nr),Kt(Vn),Ut(Vn,a)):Kt(nr),Ut(nr,f)}var As=null,vu=!1,Qp=!1;function Eb(a){As===null?As=[a]:As.push(a)}function iT(a){vu=!0,Eb(a)}function to(){if(!Qp&&As!==null){Qp=!0;var a=0,l=Pt;try{var f=As;for(Pt=1;a<f.length;a++){var x=f[a];do x=x(!0);while(x!==null)}As=null,vu=!1}catch(w){throw As!==null&&(As=As.slice(a+1)),Jc(nl,to),w}finally{Pt=l,Qp=!1}}return null}var _a=[],Ma=0,wu=null,ju=0,Dr=[],$r=0,Fo=null,Ps=1,Ds="";function zo(a,l){_a[Ma++]=ju,_a[Ma++]=wu,wu=a,ju=l}function Tb(a,l,f){Dr[$r++]=Ps,Dr[$r++]=Ds,Dr[$r++]=Fo,Fo=a;var x=Ps;a=Ds;var w=32-Bn(x)-1;x&=~(1<<w),f+=1;var N=32-Bn(l)+w;if(30<N){var O=w-w%5;N=(x&(1<<O)-1).toString(32),x>>=O,w-=O,Ps=1<<32-Bn(l)+w|f<<w|x,Ds=N+a}else Ps=1<<N|f<<w|x,Ds=a}function Jp(a){a.return!==null&&(zo(a,1),Tb(a,1,0))}function Xp(a){for(;a===wu;)wu=_a[--Ma],_a[Ma]=null,ju=_a[--Ma],_a[Ma]=null;for(;a===Fo;)Fo=Dr[--$r],Dr[$r]=null,Ds=Dr[--$r],Dr[$r]=null,Ps=Dr[--$r],Dr[$r]=null}var xr=null,yr=null,Xt=!1,Qr=null;function Rb(a,l){var f=_r(5,null,null,0);f.elementType="DELETED",f.stateNode=l,f.return=a,l=a.deletions,l===null?(a.deletions=[f],a.flags|=16):l.push(f)}function Ab(a,l){switch(a.tag){case 5:var f=a.type;return l=l.nodeType!==1||f.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(a.stateNode=l,xr=a,yr=Xs(l.firstChild),!0):!1;case 6:return l=a.pendingProps===""||l.nodeType!==3?null:l,l!==null?(a.stateNode=l,xr=a,yr=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(f=Fo!==null?{id:Ps,overflow:Ds}:null,a.memoizedState={dehydrated:l,treeContext:f,retryLane:1073741824},f=_r(18,null,null,0),f.stateNode=l,f.return=a,a.child=f,xr=a,yr=null,!0):!1;default:return!1}}function Zp(a){return(a.mode&1)!==0&&(a.flags&128)===0}function em(a){if(Xt){var l=yr;if(l){var f=l;if(!Ab(a,l)){if(Zp(a))throw Error(n(418));l=Xs(f.nextSibling);var x=xr;l&&Ab(a,l)?Rb(x,f):(a.flags=a.flags&-4097|2,Xt=!1,xr=a)}}else{if(Zp(a))throw Error(n(418));a.flags=a.flags&-4097|2,Xt=!1,xr=a}}}function Pb(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;xr=a}function ku(a){if(a!==xr)return!1;if(!Xt)return Pb(a),Xt=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!Wp(a.type,a.memoizedProps)),l&&(l=yr)){if(Zp(a))throw Db(),Error(n(418));for(;l;)Rb(a,l),l=Xs(l.nextSibling)}if(Pb(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,l=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"){if(l===0){yr=Xs(a.nextSibling);break e}l--}else f!=="$"&&f!=="$!"&&f!=="$?"||l++}a=a.nextSibling}yr=null}}else yr=xr?Xs(a.stateNode.nextSibling):null;return!0}function Db(){for(var a=yr;a;)a=Xs(a.nextSibling)}function Fa(){yr=xr=null,Xt=!1}function tm(a){Qr===null?Qr=[a]:Qr.push(a)}var lT=T.ReactCurrentBatchConfig;function vl(a,l,f){if(a=f.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(f._owner){if(f=f._owner,f){if(f.tag!==1)throw Error(n(309));var x=f.stateNode}if(!x)throw Error(n(147,a));var w=x,N=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===N?l.ref:(l=function(O){var W=w.refs;O===null?delete W[N]:W[N]=O},l._stringRef=N,l)}if(typeof a!="string")throw Error(n(284));if(!f._owner)throw Error(n(290,a))}return a}function Su(a,l){throw a=Object.prototype.toString.call(l),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function $b(a){var l=a._init;return l(a._payload)}function Lb(a){function l(ie,ee){if(a){var ce=ie.deletions;ce===null?(ie.deletions=[ee],ie.flags|=16):ce.push(ee)}}function f(ie,ee){if(!a)return null;for(;ee!==null;)l(ie,ee),ee=ee.sibling;return null}function x(ie,ee){for(ie=new Map;ee!==null;)ee.key!==null?ie.set(ee.key,ee):ie.set(ee.index,ee),ee=ee.sibling;return ie}function w(ie,ee){return ie=co(ie,ee),ie.index=0,ie.sibling=null,ie}function N(ie,ee,ce){return ie.index=ce,a?(ce=ie.alternate,ce!==null?(ce=ce.index,ce<ee?(ie.flags|=2,ee):ce):(ie.flags|=2,ee)):(ie.flags|=1048576,ee)}function O(ie){return a&&ie.alternate===null&&(ie.flags|=2),ie}function W(ie,ee,ce,Ae){return ee===null||ee.tag!==6?(ee=Km(ce,ie.mode,Ae),ee.return=ie,ee):(ee=w(ee,ce),ee.return=ie,ee)}function Q(ie,ee,ce,Ae){var Xe=ce.type;return Xe===P?ke(ie,ee,ce.props.children,Ae,ce.key):ee!==null&&(ee.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===q&&$b(Xe)===ee.type)?(Ae=w(ee,ce.props),Ae.ref=vl(ie,ee,ce),Ae.return=ie,Ae):(Ae=Gu(ce.type,ce.key,ce.props,null,ie.mode,Ae),Ae.ref=vl(ie,ee,ce),Ae.return=ie,Ae)}function de(ie,ee,ce,Ae){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=qm(ce,ie.mode,Ae),ee.return=ie,ee):(ee=w(ee,ce.children||[]),ee.return=ie,ee)}function ke(ie,ee,ce,Ae,Xe){return ee===null||ee.tag!==7?(ee=Go(ce,ie.mode,Ae,Xe),ee.return=ie,ee):(ee=w(ee,ce),ee.return=ie,ee)}function Ne(ie,ee,ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=Km(""+ee,ie.mode,ce),ee.return=ie,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ce=Gu(ee.type,ee.key,ee.props,null,ie.mode,ce),ce.ref=vl(ie,null,ee),ce.return=ie,ce;case R:return ee=qm(ee,ie.mode,ce),ee.return=ie,ee;case q:var Ae=ee._init;return Ne(ie,Ae(ee._payload),ce)}if(Fe(ee)||G(ee))return ee=Go(ee,ie.mode,ce,null),ee.return=ie,ee;Su(ie,ee)}return null}function je(ie,ee,ce,Ae){var Xe=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Xe!==null?null:W(ie,ee,""+ce,Ae);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:return ce.key===Xe?Q(ie,ee,ce,Ae):null;case R:return ce.key===Xe?de(ie,ee,ce,Ae):null;case q:return Xe=ce._init,je(ie,ee,Xe(ce._payload),Ae)}if(Fe(ce)||G(ce))return Xe!==null?null:ke(ie,ee,ce,Ae,null);Su(ie,ce)}return null}function Ve(ie,ee,ce,Ae,Xe){if(typeof Ae=="string"&&Ae!==""||typeof Ae=="number")return ie=ie.get(ce)||null,W(ee,ie,""+Ae,Xe);if(typeof Ae=="object"&&Ae!==null){switch(Ae.$$typeof){case A:return ie=ie.get(Ae.key===null?ce:Ae.key)||null,Q(ee,ie,Ae,Xe);case R:return ie=ie.get(Ae.key===null?ce:Ae.key)||null,de(ee,ie,Ae,Xe);case q:var rt=Ae._init;return Ve(ie,ee,ce,rt(Ae._payload),Xe)}if(Fe(Ae)||G(Ae))return ie=ie.get(ce)||null,ke(ee,ie,Ae,Xe,null);Su(ee,Ae)}return null}function qe(ie,ee,ce,Ae){for(var Xe=null,rt=null,st=ee,it=ee=0,$n=null;st!==null&&it<ce.length;it++){st.index>it?($n=st,st=null):$n=st.sibling;var At=je(ie,st,ce[it],Ae);if(At===null){st===null&&(st=$n);break}a&&st&&At.alternate===null&&l(ie,st),ee=N(At,ee,it),rt===null?Xe=At:rt.sibling=At,rt=At,st=$n}if(it===ce.length)return f(ie,st),Xt&&zo(ie,it),Xe;if(st===null){for(;it<ce.length;it++)st=Ne(ie,ce[it],Ae),st!==null&&(ee=N(st,ee,it),rt===null?Xe=st:rt.sibling=st,rt=st);return Xt&&zo(ie,it),Xe}for(st=x(ie,st);it<ce.length;it++)$n=Ve(st,ie,it,ce[it],Ae),$n!==null&&(a&&$n.alternate!==null&&st.delete($n.key===null?it:$n.key),ee=N($n,ee,it),rt===null?Xe=$n:rt.sibling=$n,rt=$n);return a&&st.forEach(function(uo){return l(ie,uo)}),Xt&&zo(ie,it),Xe}function Qe(ie,ee,ce,Ae){var Xe=G(ce);if(typeof Xe!="function")throw Error(n(150));if(ce=Xe.call(ce),ce==null)throw Error(n(151));for(var rt=Xe=null,st=ee,it=ee=0,$n=null,At=ce.next();st!==null&&!At.done;it++,At=ce.next()){st.index>it?($n=st,st=null):$n=st.sibling;var uo=je(ie,st,At.value,Ae);if(uo===null){st===null&&(st=$n);break}a&&st&&uo.alternate===null&&l(ie,st),ee=N(uo,ee,it),rt===null?Xe=uo:rt.sibling=uo,rt=uo,st=$n}if(At.done)return f(ie,st),Xt&&zo(ie,it),Xe;if(st===null){for(;!At.done;it++,At=ce.next())At=Ne(ie,At.value,Ae),At!==null&&(ee=N(At,ee,it),rt===null?Xe=At:rt.sibling=At,rt=At);return Xt&&zo(ie,it),Xe}for(st=x(ie,st);!At.done;it++,At=ce.next())At=Ve(st,ie,it,At.value,Ae),At!==null&&(a&&At.alternate!==null&&st.delete(At.key===null?it:At.key),ee=N(At,ee,it),rt===null?Xe=At:rt.sibling=At,rt=At);return a&&st.forEach(function(BT){return l(ie,BT)}),Xt&&zo(ie,it),Xe}function dn(ie,ee,ce,Ae){if(typeof ce=="object"&&ce!==null&&ce.type===P&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:e:{for(var Xe=ce.key,rt=ee;rt!==null;){if(rt.key===Xe){if(Xe=ce.type,Xe===P){if(rt.tag===7){f(ie,rt.sibling),ee=w(rt,ce.props.children),ee.return=ie,ie=ee;break e}}else if(rt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===q&&$b(Xe)===rt.type){f(ie,rt.sibling),ee=w(rt,ce.props),ee.ref=vl(ie,rt,ce),ee.return=ie,ie=ee;break e}f(ie,rt);break}else l(ie,rt);rt=rt.sibling}ce.type===P?(ee=Go(ce.props.children,ie.mode,Ae,ce.key),ee.return=ie,ie=ee):(Ae=Gu(ce.type,ce.key,ce.props,null,ie.mode,Ae),Ae.ref=vl(ie,ee,ce),Ae.return=ie,ie=Ae)}return O(ie);case R:e:{for(rt=ce.key;ee!==null;){if(ee.key===rt)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){f(ie,ee.sibling),ee=w(ee,ce.children||[]),ee.return=ie,ie=ee;break e}else{f(ie,ee);break}else l(ie,ee);ee=ee.sibling}ee=qm(ce,ie.mode,Ae),ee.return=ie,ie=ee}return O(ie);case q:return rt=ce._init,dn(ie,ee,rt(ce._payload),Ae)}if(Fe(ce))return qe(ie,ee,ce,Ae);if(G(ce))return Qe(ie,ee,ce,Ae);Su(ie,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ee!==null&&ee.tag===6?(f(ie,ee.sibling),ee=w(ee,ce),ee.return=ie,ie=ee):(f(ie,ee),ee=Km(ce,ie.mode,Ae),ee.return=ie,ie=ee),O(ie)):f(ie,ee)}return dn}var za=Lb(!0),Ob=Lb(!1),Nu=Zs(null),Cu=null,Ba=null,nm=null;function rm(){nm=Ba=Cu=null}function sm(a){var l=Nu.current;Kt(Nu),a._currentValue=l}function om(a,l,f){for(;a!==null;){var x=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,x!==null&&(x.childLanes|=l)):x!==null&&(x.childLanes&l)!==l&&(x.childLanes|=l),a===f)break;a=a.return}}function Ua(a,l){Cu=a,nm=Ba=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(sr=!0),a.firstContext=null)}function Lr(a){var l=a._currentValue;if(nm!==a)if(a={context:a,memoizedValue:l,next:null},Ba===null){if(Cu===null)throw Error(n(308));Ba=a,Cu.dependencies={lanes:0,firstContext:a}}else Ba=Ba.next=a;return l}var Bo=null;function am(a){Bo===null?Bo=[a]:Bo.push(a)}function Ib(a,l,f,x){var w=l.interleaved;return w===null?(f.next=f,am(l)):(f.next=w.next,w.next=f),l.interleaved=f,$s(a,x)}function $s(a,l){a.lanes|=l;var f=a.alternate;for(f!==null&&(f.lanes|=l),f=a,a=a.return;a!==null;)a.childLanes|=l,f=a.alternate,f!==null&&(f.childLanes|=l),f=a,a=a.return;return f.tag===3?f.stateNode:null}var no=!1;function im(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _b(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function Ls(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function ro(a,l,f){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(Ct&2)!==0){var w=x.pending;return w===null?l.next=l:(l.next=w.next,w.next=l),x.pending=l,$s(a,f)}return w=x.interleaved,w===null?(l.next=l,am(x)):(l.next=w.next,w.next=l),x.interleaved=l,$s(a,f)}function Eu(a,l,f){if(l=l.updateQueue,l!==null&&(l=l.shared,(f&4194240)!==0)){var x=l.lanes;x&=a.pendingLanes,f|=x,l.lanes=f,ol(a,f)}}function Mb(a,l){var f=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,f===x)){var w=null,N=null;if(f=f.firstBaseUpdate,f!==null){do{var O={eventTime:f.eventTime,lane:f.lane,tag:f.tag,payload:f.payload,callback:f.callback,next:null};N===null?w=N=O:N=N.next=O,f=f.next}while(f!==null);N===null?w=N=l:N=N.next=l}else w=N=l;f={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:N,shared:x.shared,effects:x.effects},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=l}function Tu(a,l,f,x){var w=a.updateQueue;no=!1;var N=w.firstBaseUpdate,O=w.lastBaseUpdate,W=w.shared.pending;if(W!==null){w.shared.pending=null;var Q=W,de=Q.next;Q.next=null,O===null?N=de:O.next=de,O=Q;var ke=a.alternate;ke!==null&&(ke=ke.updateQueue,W=ke.lastBaseUpdate,W!==O&&(W===null?ke.firstBaseUpdate=de:W.next=de,ke.lastBaseUpdate=Q))}if(N!==null){var Ne=w.baseState;O=0,ke=de=Q=null,W=N;do{var je=W.lane,Ve=W.eventTime;if((x&je)===je){ke!==null&&(ke=ke.next={eventTime:Ve,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var qe=a,Qe=W;switch(je=l,Ve=f,Qe.tag){case 1:if(qe=Qe.payload,typeof qe=="function"){Ne=qe.call(Ve,Ne,je);break e}Ne=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=Qe.payload,je=typeof qe=="function"?qe.call(Ve,Ne,je):qe,je==null)break e;Ne=L({},Ne,je);break e;case 2:no=!0}}W.callback!==null&&W.lane!==0&&(a.flags|=64,je=w.effects,je===null?w.effects=[W]:je.push(W))}else Ve={eventTime:Ve,lane:je,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ke===null?(de=ke=Ve,Q=Ne):ke=ke.next=Ve,O|=je;if(W=W.next,W===null){if(W=w.shared.pending,W===null)break;je=W,W=je.next,je.next=null,w.lastBaseUpdate=je,w.shared.pending=null}}while(!0);if(ke===null&&(Q=Ne),w.baseState=Q,w.firstBaseUpdate=de,w.lastBaseUpdate=ke,l=w.shared.interleaved,l!==null){w=l;do O|=w.lane,w=w.next;while(w!==l)}else N===null&&(w.shared.lanes=0);Ho|=O,a.lanes=O,a.memoizedState=Ne}}function Fb(a,l,f){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var x=a[l],w=x.callback;if(w!==null){if(x.callback=null,x=f,typeof w!="function")throw Error(n(191,w));w.call(x)}}}var wl={},ms=Zs(wl),jl=Zs(wl),kl=Zs(wl);function Uo(a){if(a===wl)throw Error(n(174));return a}function lm(a,l){switch(Ut(kl,l),Ut(jl,a),Ut(ms,wl),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Y(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=Y(l,a)}Kt(ms),Ut(ms,l)}function Va(){Kt(ms),Kt(jl),Kt(kl)}function zb(a){Uo(kl.current);var l=Uo(ms.current),f=Y(l,a.type);l!==f&&(Ut(jl,a),Ut(ms,f))}function cm(a){jl.current===a&&(Kt(ms),Kt(jl))}var nn=Zs(0);function Ru(a){for(var l=a;l!==null;){if(l.tag===13){var f=l.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||f.data==="$?"||f.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var um=[];function dm(){for(var a=0;a<um.length;a++)um[a]._workInProgressVersionPrimary=null;um.length=0}var Au=T.ReactCurrentDispatcher,fm=T.ReactCurrentBatchConfig,Vo=0,rn=null,jn=null,Pn=null,Pu=!1,Sl=!1,Nl=0,cT=0;function Hn(){throw Error(n(321))}function pm(a,l){if(l===null)return!1;for(var f=0;f<l.length&&f<a.length;f++)if(!Yr(a[f],l[f]))return!1;return!0}function mm(a,l,f,x,w,N){if(Vo=N,rn=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Au.current=a===null||a.memoizedState===null?pT:mT,a=f(x,w),Sl){N=0;do{if(Sl=!1,Nl=0,25<=N)throw Error(n(301));N+=1,Pn=jn=null,l.updateQueue=null,Au.current=hT,a=f(x,w)}while(Sl)}if(Au.current=Lu,l=jn!==null&&jn.next!==null,Vo=0,Pn=jn=rn=null,Pu=!1,l)throw Error(n(300));return a}function hm(){var a=Nl!==0;return Nl=0,a}function hs(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pn===null?rn.memoizedState=Pn=a:Pn=Pn.next=a,Pn}function Or(){if(jn===null){var a=rn.alternate;a=a!==null?a.memoizedState:null}else a=jn.next;var l=Pn===null?rn.memoizedState:Pn.next;if(l!==null)Pn=l,jn=a;else{if(a===null)throw Error(n(310));jn=a,a={memoizedState:jn.memoizedState,baseState:jn.baseState,baseQueue:jn.baseQueue,queue:jn.queue,next:null},Pn===null?rn.memoizedState=Pn=a:Pn=Pn.next=a}return Pn}function Cl(a,l){return typeof l=="function"?l(a):l}function gm(a){var l=Or(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var x=jn,w=x.baseQueue,N=f.pending;if(N!==null){if(w!==null){var O=w.next;w.next=N.next,N.next=O}x.baseQueue=w=N,f.pending=null}if(w!==null){N=w.next,x=x.baseState;var W=O=null,Q=null,de=N;do{var ke=de.lane;if((Vo&ke)===ke)Q!==null&&(Q=Q.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),x=de.hasEagerState?de.eagerState:a(x,de.action);else{var Ne={lane:ke,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};Q===null?(W=Q=Ne,O=x):Q=Q.next=Ne,rn.lanes|=ke,Ho|=ke}de=de.next}while(de!==null&&de!==N);Q===null?O=x:Q.next=W,Yr(x,l.memoizedState)||(sr=!0),l.memoizedState=x,l.baseState=O,l.baseQueue=Q,f.lastRenderedState=x}if(a=f.interleaved,a!==null){w=a;do N=w.lane,rn.lanes|=N,Ho|=N,w=w.next;while(w!==a)}else w===null&&(f.lanes=0);return[l.memoizedState,f.dispatch]}function xm(a){var l=Or(),f=l.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=a;var x=f.dispatch,w=f.pending,N=l.memoizedState;if(w!==null){f.pending=null;var O=w=w.next;do N=a(N,O.action),O=O.next;while(O!==w);Yr(N,l.memoizedState)||(sr=!0),l.memoizedState=N,l.baseQueue===null&&(l.baseState=N),f.lastRenderedState=N}return[N,x]}function Bb(){}function Ub(a,l){var f=rn,x=Or(),w=l(),N=!Yr(x.memoizedState,w);if(N&&(x.memoizedState=w,sr=!0),x=x.queue,ym(Wb.bind(null,f,x,a),[a]),x.getSnapshot!==l||N||Pn!==null&&Pn.memoizedState.tag&1){if(f.flags|=2048,El(9,Hb.bind(null,f,x,w,l),void 0,null),Dn===null)throw Error(n(349));(Vo&30)!==0||Vb(f,l,w)}return w}function Vb(a,l,f){a.flags|=16384,a={getSnapshot:l,value:f},l=rn.updateQueue,l===null?(l={lastEffect:null,stores:null},rn.updateQueue=l,l.stores=[a]):(f=l.stores,f===null?l.stores=[a]:f.push(a))}function Hb(a,l,f,x){l.value=f,l.getSnapshot=x,Kb(l)&&qb(a)}function Wb(a,l,f){return f(function(){Kb(l)&&qb(a)})}function Kb(a){var l=a.getSnapshot;a=a.value;try{var f=l();return!Yr(a,f)}catch{return!0}}function qb(a){var l=$s(a,1);l!==null&&es(l,a,1,-1)}function Gb(a){var l=hs();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Cl,lastRenderedState:a},l.queue=a,a=a.dispatch=fT.bind(null,rn,a),[l.memoizedState,a]}function El(a,l,f,x){return a={tag:a,create:l,destroy:f,deps:x,next:null},l=rn.updateQueue,l===null?(l={lastEffect:null,stores:null},rn.updateQueue=l,l.lastEffect=a.next=a):(f=l.lastEffect,f===null?l.lastEffect=a.next=a:(x=f.next,f.next=a,a.next=x,l.lastEffect=a)),a}function Yb(){return Or().memoizedState}function Du(a,l,f,x){var w=hs();rn.flags|=a,w.memoizedState=El(1|l,f,void 0,x===void 0?null:x)}function $u(a,l,f,x){var w=Or();x=x===void 0?null:x;var N=void 0;if(jn!==null){var O=jn.memoizedState;if(N=O.destroy,x!==null&&pm(x,O.deps)){w.memoizedState=El(l,f,N,x);return}}rn.flags|=a,w.memoizedState=El(1|l,f,N,x)}function Qb(a,l){return Du(8390656,8,a,l)}function ym(a,l){return $u(2048,8,a,l)}function Jb(a,l){return $u(4,2,a,l)}function Xb(a,l){return $u(4,4,a,l)}function Zb(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function ev(a,l,f){return f=f!=null?f.concat([a]):null,$u(4,4,Zb.bind(null,l,a),f)}function bm(){}function tv(a,l){var f=Or();l=l===void 0?null:l;var x=f.memoizedState;return x!==null&&l!==null&&pm(l,x[1])?x[0]:(f.memoizedState=[a,l],a)}function nv(a,l){var f=Or();l=l===void 0?null:l;var x=f.memoizedState;return x!==null&&l!==null&&pm(l,x[1])?x[0]:(a=a(),f.memoizedState=[a,l],a)}function rv(a,l,f){return(Vo&21)===0?(a.baseState&&(a.baseState=!1,sr=!0),a.memoizedState=f):(Yr(f,l)||(f=rl(),rn.lanes|=f,Ho|=f,a.baseState=!0),l)}function uT(a,l){var f=Pt;Pt=f!==0&&4>f?f:4,a(!0);var x=fm.transition;fm.transition={};try{a(!1),l()}finally{Pt=f,fm.transition=x}}function sv(){return Or().memoizedState}function dT(a,l,f){var x=io(a);if(f={lane:x,action:f,hasEagerState:!1,eagerState:null,next:null},ov(a))av(l,f);else if(f=Ib(a,l,f,x),f!==null){var w=Jn();es(f,a,x,w),iv(f,l,x)}}function fT(a,l,f){var x=io(a),w={lane:x,action:f,hasEagerState:!1,eagerState:null,next:null};if(ov(a))av(l,w);else{var N=a.alternate;if(a.lanes===0&&(N===null||N.lanes===0)&&(N=l.lastRenderedReducer,N!==null))try{var O=l.lastRenderedState,W=N(O,f);if(w.hasEagerState=!0,w.eagerState=W,Yr(W,O)){var Q=l.interleaved;Q===null?(w.next=w,am(l)):(w.next=Q.next,Q.next=w),l.interleaved=w;return}}catch{}finally{}f=Ib(a,l,w,x),f!==null&&(w=Jn(),es(f,a,x,w),iv(f,l,x))}}function ov(a){var l=a.alternate;return a===rn||l!==null&&l===rn}function av(a,l){Sl=Pu=!0;var f=a.pending;f===null?l.next=l:(l.next=f.next,f.next=l),a.pending=l}function iv(a,l,f){if((f&4194240)!==0){var x=l.lanes;x&=a.pendingLanes,f|=x,l.lanes=f,ol(a,f)}}var Lu={readContext:Lr,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useInsertionEffect:Hn,useLayoutEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useMutableSource:Hn,useSyncExternalStore:Hn,useId:Hn,unstable_isNewReconciler:!1},pT={readContext:Lr,useCallback:function(a,l){return hs().memoizedState=[a,l===void 0?null:l],a},useContext:Lr,useEffect:Qb,useImperativeHandle:function(a,l,f){return f=f!=null?f.concat([a]):null,Du(4194308,4,Zb.bind(null,l,a),f)},useLayoutEffect:function(a,l){return Du(4194308,4,a,l)},useInsertionEffect:function(a,l){return Du(4,2,a,l)},useMemo:function(a,l){var f=hs();return l=l===void 0?null:l,a=a(),f.memoizedState=[a,l],a},useReducer:function(a,l,f){var x=hs();return l=f!==void 0?f(l):l,x.memoizedState=x.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},x.queue=a,a=a.dispatch=dT.bind(null,rn,a),[x.memoizedState,a]},useRef:function(a){var l=hs();return a={current:a},l.memoizedState=a},useState:Gb,useDebugValue:bm,useDeferredValue:function(a){return hs().memoizedState=a},useTransition:function(){var a=Gb(!1),l=a[0];return a=uT.bind(null,a[1]),hs().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,f){var x=rn,w=hs();if(Xt){if(f===void 0)throw Error(n(407));f=f()}else{if(f=l(),Dn===null)throw Error(n(349));(Vo&30)!==0||Vb(x,l,f)}w.memoizedState=f;var N={value:f,getSnapshot:l};return w.queue=N,Qb(Wb.bind(null,x,N,a),[a]),x.flags|=2048,El(9,Hb.bind(null,x,N,f,l),void 0,null),f},useId:function(){var a=hs(),l=Dn.identifierPrefix;if(Xt){var f=Ds,x=Ps;f=(x&~(1<<32-Bn(x)-1)).toString(32)+f,l=":"+l+"R"+f,f=Nl++,0<f&&(l+="H"+f.toString(32)),l+=":"}else f=cT++,l=":"+l+"r"+f.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},mT={readContext:Lr,useCallback:tv,useContext:Lr,useEffect:ym,useImperativeHandle:ev,useInsertionEffect:Jb,useLayoutEffect:Xb,useMemo:nv,useReducer:gm,useRef:Yb,useState:function(){return gm(Cl)},useDebugValue:bm,useDeferredValue:function(a){var l=Or();return rv(l,jn.memoizedState,a)},useTransition:function(){var a=gm(Cl)[0],l=Or().memoizedState;return[a,l]},useMutableSource:Bb,useSyncExternalStore:Ub,useId:sv,unstable_isNewReconciler:!1},hT={readContext:Lr,useCallback:tv,useContext:Lr,useEffect:ym,useImperativeHandle:ev,useInsertionEffect:Jb,useLayoutEffect:Xb,useMemo:nv,useReducer:xm,useRef:Yb,useState:function(){return xm(Cl)},useDebugValue:bm,useDeferredValue:function(a){var l=Or();return jn===null?l.memoizedState=a:rv(l,jn.memoizedState,a)},useTransition:function(){var a=xm(Cl)[0],l=Or().memoizedState;return[a,l]},useMutableSource:Bb,useSyncExternalStore:Ub,useId:sv,unstable_isNewReconciler:!1};function Jr(a,l){if(a&&a.defaultProps){l=L({},l),a=a.defaultProps;for(var f in a)l[f]===void 0&&(l[f]=a[f]);return l}return l}function vm(a,l,f,x){l=a.memoizedState,f=f(x,l),f=f==null?l:L({},l,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var Ou={isMounted:function(a){return(a=a._reactInternals)?ht(a)===a:!1},enqueueSetState:function(a,l,f){a=a._reactInternals;var x=Jn(),w=io(a),N=Ls(x,w);N.payload=l,f!=null&&(N.callback=f),l=ro(a,N,w),l!==null&&(es(l,a,w,x),Eu(l,a,w))},enqueueReplaceState:function(a,l,f){a=a._reactInternals;var x=Jn(),w=io(a),N=Ls(x,w);N.tag=1,N.payload=l,f!=null&&(N.callback=f),l=ro(a,N,w),l!==null&&(es(l,a,w,x),Eu(l,a,w))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var f=Jn(),x=io(a),w=Ls(f,x);w.tag=2,l!=null&&(w.callback=l),l=ro(a,w,x),l!==null&&(es(l,a,x,f),Eu(l,a,x))}};function lv(a,l,f,x,w,N,O){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(x,N,O):l.prototype&&l.prototype.isPureReactComponent?!pl(f,x)||!pl(w,N):!0}function cv(a,l,f){var x=!1,w=eo,N=l.contextType;return typeof N=="object"&&N!==null?N=Lr(N):(w=rr(l)?Mo:Vn.current,x=l.contextTypes,N=(x=x!=null)?Ia(a,w):eo),l=new l(f,N),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Ou,a.stateNode=l,l._reactInternals=a,x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=w,a.__reactInternalMemoizedMaskedChildContext=N),l}function uv(a,l,f,x){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(f,x),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(f,x),l.state!==a&&Ou.enqueueReplaceState(l,l.state,null)}function wm(a,l,f,x){var w=a.stateNode;w.props=f,w.state=a.memoizedState,w.refs={},im(a);var N=l.contextType;typeof N=="object"&&N!==null?w.context=Lr(N):(N=rr(l)?Mo:Vn.current,w.context=Ia(a,N)),w.state=a.memoizedState,N=l.getDerivedStateFromProps,typeof N=="function"&&(vm(a,l,N,f),w.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(l=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),l!==w.state&&Ou.enqueueReplaceState(w,w.state,null),Tu(a,f,w,x),w.state=a.memoizedState),typeof w.componentDidMount=="function"&&(a.flags|=4194308)}function Ha(a,l){try{var f="",x=l;do f+=ge(x),x=x.return;while(x);var w=f}catch(N){w=`
|
|
39
|
+
Error generating stack: `+N.message+`
|
|
40
|
+
`+N.stack}return{value:a,source:l,stack:w,digest:null}}function jm(a,l,f){return{value:a,source:null,stack:f??null,digest:l??null}}function km(a,l){try{console.error(l.value)}catch(f){setTimeout(function(){throw f})}}var gT=typeof WeakMap=="function"?WeakMap:Map;function dv(a,l,f){f=Ls(-1,f),f.tag=3,f.payload={element:null};var x=l.value;return f.callback=function(){Uu||(Uu=!0,Mm=x),km(a,l)},f}function fv(a,l,f){f=Ls(-1,f),f.tag=3;var x=a.type.getDerivedStateFromError;if(typeof x=="function"){var w=l.value;f.payload=function(){return x(w)},f.callback=function(){km(a,l)}}var N=a.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(f.callback=function(){km(a,l),typeof x!="function"&&(oo===null?oo=new Set([this]):oo.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})}),f}function pv(a,l,f){var x=a.pingCache;if(x===null){x=a.pingCache=new gT;var w=new Set;x.set(l,w)}else w=x.get(l),w===void 0&&(w=new Set,x.set(l,w));w.has(f)||(w.add(f),a=AT.bind(null,a,l,f),l.then(a,a))}function mv(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function hv(a,l,f,x,w){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,f.flags|=131072,f.flags&=-52805,f.tag===1&&(f.alternate===null?f.tag=17:(l=Ls(-1,1),l.tag=2,ro(f,l,1))),f.lanes|=1),a):(a.flags|=65536,a.lanes=w,a)}var xT=T.ReactCurrentOwner,sr=!1;function Qn(a,l,f,x){l.child=a===null?Ob(l,null,f,x):za(l,a.child,f,x)}function gv(a,l,f,x,w){f=f.render;var N=l.ref;return Ua(l,w),x=mm(a,l,f,x,N,w),f=hm(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,Os(a,l,w)):(Xt&&f&&Jp(l),l.flags|=1,Qn(a,l,x,w),l.child)}function xv(a,l,f,x,w){if(a===null){var N=f.type;return typeof N=="function"&&!Wm(N)&&N.defaultProps===void 0&&f.compare===null&&f.defaultProps===void 0?(l.tag=15,l.type=N,yv(a,l,N,x,w)):(a=Gu(f.type,null,x,l,l.mode,w),a.ref=l.ref,a.return=l,l.child=a)}if(N=a.child,(a.lanes&w)===0){var O=N.memoizedProps;if(f=f.compare,f=f!==null?f:pl,f(O,x)&&a.ref===l.ref)return Os(a,l,w)}return l.flags|=1,a=co(N,x),a.ref=l.ref,a.return=l,l.child=a}function yv(a,l,f,x,w){if(a!==null){var N=a.memoizedProps;if(pl(N,x)&&a.ref===l.ref)if(sr=!1,l.pendingProps=x=N,(a.lanes&w)!==0)(a.flags&131072)!==0&&(sr=!0);else return l.lanes=a.lanes,Os(a,l,w)}return Sm(a,l,f,x,w)}function bv(a,l,f){var x=l.pendingProps,w=x.children,N=a!==null?a.memoizedState:null;if(x.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ut(Ka,br),br|=f;else{if((f&1073741824)===0)return a=N!==null?N.baseLanes|f:f,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null,transitions:null},l.updateQueue=null,Ut(Ka,br),br|=a,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=N!==null?N.baseLanes:f,Ut(Ka,br),br|=x}else N!==null?(x=N.baseLanes|f,l.memoizedState=null):x=f,Ut(Ka,br),br|=x;return Qn(a,l,w,f),l.child}function vv(a,l){var f=l.ref;(a===null&&f!==null||a!==null&&a.ref!==f)&&(l.flags|=512,l.flags|=2097152)}function Sm(a,l,f,x,w){var N=rr(f)?Mo:Vn.current;return N=Ia(l,N),Ua(l,w),f=mm(a,l,f,x,N,w),x=hm(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,Os(a,l,w)):(Xt&&x&&Jp(l),l.flags|=1,Qn(a,l,f,w),l.child)}function wv(a,l,f,x,w){if(rr(f)){var N=!0;bu(l)}else N=!1;if(Ua(l,w),l.stateNode===null)_u(a,l),cv(l,f,x),wm(l,f,x,w),x=!0;else if(a===null){var O=l.stateNode,W=l.memoizedProps;O.props=W;var Q=O.context,de=f.contextType;typeof de=="object"&&de!==null?de=Lr(de):(de=rr(f)?Mo:Vn.current,de=Ia(l,de));var ke=f.getDerivedStateFromProps,Ne=typeof ke=="function"||typeof O.getSnapshotBeforeUpdate=="function";Ne||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(W!==x||Q!==de)&&uv(l,O,x,de),no=!1;var je=l.memoizedState;O.state=je,Tu(l,x,O,w),Q=l.memoizedState,W!==x||je!==Q||nr.current||no?(typeof ke=="function"&&(vm(l,f,ke,x),Q=l.memoizedState),(W=no||lv(l,f,W,x,je,Q,de))?(Ne||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(l.flags|=4194308)):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=x,l.memoizedState=Q),O.props=x,O.state=Q,O.context=de,x=W):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),x=!1)}else{O=l.stateNode,_b(a,l),W=l.memoizedProps,de=l.type===l.elementType?W:Jr(l.type,W),O.props=de,Ne=l.pendingProps,je=O.context,Q=f.contextType,typeof Q=="object"&&Q!==null?Q=Lr(Q):(Q=rr(f)?Mo:Vn.current,Q=Ia(l,Q));var Ve=f.getDerivedStateFromProps;(ke=typeof Ve=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(W!==Ne||je!==Q)&&uv(l,O,x,Q),no=!1,je=l.memoizedState,O.state=je,Tu(l,x,O,w);var qe=l.memoizedState;W!==Ne||je!==qe||nr.current||no?(typeof Ve=="function"&&(vm(l,f,Ve,x),qe=l.memoizedState),(de=no||lv(l,f,de,x,je,qe,Q)||!1)?(ke||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(x,qe,Q),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(x,qe,Q)),typeof O.componentDidUpdate=="function"&&(l.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof O.componentDidUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=1024),l.memoizedProps=x,l.memoizedState=qe),O.props=x,O.state=qe,O.context=Q,x=de):(typeof O.componentDidUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=1024),x=!1)}return Nm(a,l,f,x,N,w)}function Nm(a,l,f,x,w,N){vv(a,l);var O=(l.flags&128)!==0;if(!x&&!O)return w&&Cb(l,f,!1),Os(a,l,N);x=l.stateNode,xT.current=l;var W=O&&typeof f.getDerivedStateFromError!="function"?null:x.render();return l.flags|=1,a!==null&&O?(l.child=za(l,a.child,null,N),l.child=za(l,null,W,N)):Qn(a,l,W,N),l.memoizedState=x.state,w&&Cb(l,f,!0),l.child}function jv(a){var l=a.stateNode;l.pendingContext?Sb(a,l.pendingContext,l.pendingContext!==l.context):l.context&&Sb(a,l.context,!1),lm(a,l.containerInfo)}function kv(a,l,f,x,w){return Fa(),tm(w),l.flags|=256,Qn(a,l,f,x),l.child}var Cm={dehydrated:null,treeContext:null,retryLane:0};function Em(a){return{baseLanes:a,cachePool:null,transitions:null}}function Sv(a,l,f){var x=l.pendingProps,w=nn.current,N=!1,O=(l.flags&128)!==0,W;if((W=O)||(W=a!==null&&a.memoizedState===null?!1:(w&2)!==0),W?(N=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(w|=1),Ut(nn,w&1),a===null)return em(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:a.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(O=x.children,a=x.fallback,N?(x=l.mode,N=l.child,O={mode:"hidden",children:O},(x&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=O):N=Yu(O,x,0,null),a=Go(a,x,f,null),N.return=l,a.return=l,N.sibling=a,l.child=N,l.child.memoizedState=Em(f),l.memoizedState=Cm,a):Tm(l,O));if(w=a.memoizedState,w!==null&&(W=w.dehydrated,W!==null))return yT(a,l,O,x,W,w,f);if(N){N=x.fallback,O=l.mode,w=a.child,W=w.sibling;var Q={mode:"hidden",children:x.children};return(O&1)===0&&l.child!==w?(x=l.child,x.childLanes=0,x.pendingProps=Q,l.deletions=null):(x=co(w,Q),x.subtreeFlags=w.subtreeFlags&14680064),W!==null?N=co(W,N):(N=Go(N,O,f,null),N.flags|=2),N.return=l,x.return=l,x.sibling=N,l.child=x,x=N,N=l.child,O=a.child.memoizedState,O=O===null?Em(f):{baseLanes:O.baseLanes|f,cachePool:null,transitions:O.transitions},N.memoizedState=O,N.childLanes=a.childLanes&~f,l.memoizedState=Cm,x}return N=a.child,a=N.sibling,x=co(N,{mode:"visible",children:x.children}),(l.mode&1)===0&&(x.lanes=f),x.return=l,x.sibling=null,a!==null&&(f=l.deletions,f===null?(l.deletions=[a],l.flags|=16):f.push(a)),l.child=x,l.memoizedState=null,x}function Tm(a,l){return l=Yu({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function Iu(a,l,f,x){return x!==null&&tm(x),za(l,a.child,null,f),a=Tm(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function yT(a,l,f,x,w,N,O){if(f)return l.flags&256?(l.flags&=-257,x=jm(Error(n(422))),Iu(a,l,O,x)):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(N=x.fallback,w=l.mode,x=Yu({mode:"visible",children:x.children},w,0,null),N=Go(N,w,O,null),N.flags|=2,x.return=l,N.return=l,x.sibling=N,l.child=x,(l.mode&1)!==0&&za(l,a.child,null,O),l.child.memoizedState=Em(O),l.memoizedState=Cm,N);if((l.mode&1)===0)return Iu(a,l,O,null);if(w.data==="$!"){if(x=w.nextSibling&&w.nextSibling.dataset,x)var W=x.dgst;return x=W,N=Error(n(419)),x=jm(N,x,void 0),Iu(a,l,O,x)}if(W=(O&a.childLanes)!==0,sr||W){if(x=Dn,x!==null){switch(O&-O){case 4:w=2;break;case 16:w=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(x.suspendedLanes|O))!==0?0:w,w!==0&&w!==N.retryLane&&(N.retryLane=w,$s(a,w),es(x,a,w,-1))}return Hm(),x=jm(Error(n(421))),Iu(a,l,O,x)}return w.data==="$?"?(l.flags|=128,l.child=a.child,l=PT.bind(null,a),w._reactRetry=l,null):(a=N.treeContext,yr=Xs(w.nextSibling),xr=l,Xt=!0,Qr=null,a!==null&&(Dr[$r++]=Ps,Dr[$r++]=Ds,Dr[$r++]=Fo,Ps=a.id,Ds=a.overflow,Fo=l),l=Tm(l,x.children),l.flags|=4096,l)}function Nv(a,l,f){a.lanes|=l;var x=a.alternate;x!==null&&(x.lanes|=l),om(a.return,l,f)}function Rm(a,l,f,x,w){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:x,tail:f,tailMode:w}:(N.isBackwards=l,N.rendering=null,N.renderingStartTime=0,N.last=x,N.tail=f,N.tailMode=w)}function Cv(a,l,f){var x=l.pendingProps,w=x.revealOrder,N=x.tail;if(Qn(a,l,x.children,f),x=nn.current,(x&2)!==0)x=x&1|2,l.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Nv(a,f,l);else if(a.tag===19)Nv(a,f,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}x&=1}if(Ut(nn,x),(l.mode&1)===0)l.memoizedState=null;else switch(w){case"forwards":for(f=l.child,w=null;f!==null;)a=f.alternate,a!==null&&Ru(a)===null&&(w=f),f=f.sibling;f=w,f===null?(w=l.child,l.child=null):(w=f.sibling,f.sibling=null),Rm(l,!1,w,f,N);break;case"backwards":for(f=null,w=l.child,l.child=null;w!==null;){if(a=w.alternate,a!==null&&Ru(a)===null){l.child=w;break}a=w.sibling,w.sibling=f,f=w,w=a}Rm(l,!0,f,null,N);break;case"together":Rm(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function _u(a,l){(l.mode&1)===0&&a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2)}function Os(a,l,f){if(a!==null&&(l.dependencies=a.dependencies),Ho|=l.lanes,(f&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(n(153));if(l.child!==null){for(a=l.child,f=co(a,a.pendingProps),l.child=f,f.return=l;a.sibling!==null;)a=a.sibling,f=f.sibling=co(a,a.pendingProps),f.return=l;f.sibling=null}return l.child}function bT(a,l,f){switch(l.tag){case 3:jv(l),Fa();break;case 5:zb(l);break;case 1:rr(l.type)&&bu(l);break;case 4:lm(l,l.stateNode.containerInfo);break;case 10:var x=l.type._context,w=l.memoizedProps.value;Ut(Nu,x._currentValue),x._currentValue=w;break;case 13:if(x=l.memoizedState,x!==null)return x.dehydrated!==null?(Ut(nn,nn.current&1),l.flags|=128,null):(f&l.child.childLanes)!==0?Sv(a,l,f):(Ut(nn,nn.current&1),a=Os(a,l,f),a!==null?a.sibling:null);Ut(nn,nn.current&1);break;case 19:if(x=(f&l.childLanes)!==0,(a.flags&128)!==0){if(x)return Cv(a,l,f);l.flags|=128}if(w=l.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Ut(nn,nn.current),x)break;return null;case 22:case 23:return l.lanes=0,bv(a,l,f)}return Os(a,l,f)}var Ev,Am,Tv,Rv;Ev=function(a,l){for(var f=l.child;f!==null;){if(f.tag===5||f.tag===6)a.appendChild(f.stateNode);else if(f.tag!==4&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===l)break;for(;f.sibling===null;){if(f.return===null||f.return===l)return;f=f.return}f.sibling.return=f.return,f=f.sibling}},Am=function(){},Tv=function(a,l,f,x){var w=a.memoizedProps;if(w!==x){a=l.stateNode,Uo(ms.current);var N=null;switch(f){case"input":w=ot(a,w),x=ot(a,x),N=[];break;case"select":w=L({},w,{value:void 0}),x=L({},x,{value:void 0}),N=[];break;case"textarea":w=Je(a,w),x=Je(a,x),N=[];break;default:typeof w.onClick!="function"&&typeof x.onClick=="function"&&(a.onclick=gu)}at(f,x);var O;f=null;for(de in w)if(!x.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var W=w[de];for(O in W)W.hasOwnProperty(O)&&(f||(f={}),f[O]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(o.hasOwnProperty(de)?N||(N=[]):(N=N||[]).push(de,null));for(de in x){var Q=x[de];if(W=w!=null?w[de]:void 0,x.hasOwnProperty(de)&&Q!==W&&(Q!=null||W!=null))if(de==="style")if(W){for(O in W)!W.hasOwnProperty(O)||Q&&Q.hasOwnProperty(O)||(f||(f={}),f[O]="");for(O in Q)Q.hasOwnProperty(O)&&W[O]!==Q[O]&&(f||(f={}),f[O]=Q[O])}else f||(N||(N=[]),N.push(de,f)),f=Q;else de==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,W=W?W.__html:void 0,Q!=null&&W!==Q&&(N=N||[]).push(de,Q)):de==="children"?typeof Q!="string"&&typeof Q!="number"||(N=N||[]).push(de,""+Q):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(o.hasOwnProperty(de)?(Q!=null&&de==="onScroll"&&Wt("scroll",a),N||W===Q||(N=[])):(N=N||[]).push(de,Q))}f&&(N=N||[]).push("style",f);var de=N;(l.updateQueue=de)&&(l.flags|=4)}},Rv=function(a,l,f,x){f!==x&&(l.flags|=4)};function Tl(a,l){if(!Xt)switch(a.tailMode){case"hidden":l=a.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var x=null;f!==null;)f.alternate!==null&&(x=f),f=f.sibling;x===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:x.sibling=null}}function Wn(a){var l=a.alternate!==null&&a.alternate.child===a.child,f=0,x=0;if(l)for(var w=a.child;w!==null;)f|=w.lanes|w.childLanes,x|=w.subtreeFlags&14680064,x|=w.flags&14680064,w.return=a,w=w.sibling;else for(w=a.child;w!==null;)f|=w.lanes|w.childLanes,x|=w.subtreeFlags,x|=w.flags,w.return=a,w=w.sibling;return a.subtreeFlags|=x,a.childLanes=f,l}function vT(a,l,f){var x=l.pendingProps;switch(Xp(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(l),null;case 1:return rr(l.type)&&yu(),Wn(l),null;case 3:return x=l.stateNode,Va(),Kt(nr),Kt(Vn),dm(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(a===null||a.child===null)&&(ku(l)?l.flags|=4:a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Qr!==null&&(Bm(Qr),Qr=null))),Am(a,l),Wn(l),null;case 5:cm(l);var w=Uo(kl.current);if(f=l.type,a!==null&&l.stateNode!=null)Tv(a,l,f,x,w),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!x){if(l.stateNode===null)throw Error(n(166));return Wn(l),null}if(a=Uo(ms.current),ku(l)){x=l.stateNode,f=l.type;var N=l.memoizedProps;switch(x[ps]=l,x[yl]=N,a=(l.mode&1)!==0,f){case"dialog":Wt("cancel",x),Wt("close",x);break;case"iframe":case"object":case"embed":Wt("load",x);break;case"video":case"audio":for(w=0;w<hl.length;w++)Wt(hl[w],x);break;case"source":Wt("error",x);break;case"img":case"image":case"link":Wt("error",x),Wt("load",x);break;case"details":Wt("toggle",x);break;case"input":X(x,N),Wt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!N.multiple},Wt("invalid",x);break;case"textarea":Ot(x,N),Wt("invalid",x)}at(f,N),w=null;for(var O in N)if(N.hasOwnProperty(O)){var W=N[O];O==="children"?typeof W=="string"?x.textContent!==W&&(N.suppressHydrationWarning!==!0&&hu(x.textContent,W,a),w=["children",W]):typeof W=="number"&&x.textContent!==""+W&&(N.suppressHydrationWarning!==!0&&hu(x.textContent,W,a),w=["children",""+W]):o.hasOwnProperty(O)&&W!=null&&O==="onScroll"&&Wt("scroll",x)}switch(f){case"input":Ke(x),Ie(x,N,!0);break;case"textarea":Ke(x),dt(x);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(x.onclick=gu)}x=w,l.updateQueue=x,x!==null&&(l.flags|=4)}else{O=w.nodeType===9?w:w.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=le(f)),a==="http://www.w3.org/1999/xhtml"?f==="script"?(a=O.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof x.is=="string"?a=O.createElement(f,{is:x.is}):(a=O.createElement(f),f==="select"&&(O=a,x.multiple?O.multiple=!0:x.size&&(O.size=x.size))):a=O.createElementNS(a,f),a[ps]=l,a[yl]=x,Ev(a,l,!1,!1),l.stateNode=a;e:{switch(O=Be(f,x),f){case"dialog":Wt("cancel",a),Wt("close",a),w=x;break;case"iframe":case"object":case"embed":Wt("load",a),w=x;break;case"video":case"audio":for(w=0;w<hl.length;w++)Wt(hl[w],a);w=x;break;case"source":Wt("error",a),w=x;break;case"img":case"image":case"link":Wt("error",a),Wt("load",a),w=x;break;case"details":Wt("toggle",a),w=x;break;case"input":X(a,x),w=ot(a,x),Wt("invalid",a);break;case"option":w=x;break;case"select":a._wrapperState={wasMultiple:!!x.multiple},w=L({},x,{value:void 0}),Wt("invalid",a);break;case"textarea":Ot(a,x),w=Je(a,x),Wt("invalid",a);break;default:w=x}at(f,w),W=w;for(N in W)if(W.hasOwnProperty(N)){var Q=W[N];N==="style"?be(a,Q):N==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&ne(a,Q)):N==="children"?typeof Q=="string"?(f!=="textarea"||Q!=="")&&he(a,Q):typeof Q=="number"&&he(a,""+Q):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(o.hasOwnProperty(N)?Q!=null&&N==="onScroll"&&Wt("scroll",a):Q!=null&&S(a,N,Q,O))}switch(f){case"input":Ke(a),Ie(a,x,!1);break;case"textarea":Ke(a),dt(a);break;case"option":x.value!=null&&a.setAttribute("value",""+Se(x.value));break;case"select":a.multiple=!!x.multiple,N=x.value,N!=null?Ze(a,!!x.multiple,N,!1):x.defaultValue!=null&&Ze(a,!!x.multiple,x.defaultValue,!0);break;default:typeof w.onClick=="function"&&(a.onclick=gu)}switch(f){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}}x&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Wn(l),null;case 6:if(a&&l.stateNode!=null)Rv(a,l,a.memoizedProps,x);else{if(typeof x!="string"&&l.stateNode===null)throw Error(n(166));if(f=Uo(kl.current),Uo(ms.current),ku(l)){if(x=l.stateNode,f=l.memoizedProps,x[ps]=l,(N=x.nodeValue!==f)&&(a=xr,a!==null))switch(a.tag){case 3:hu(x.nodeValue,f,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&hu(x.nodeValue,f,(a.mode&1)!==0)}N&&(l.flags|=4)}else x=(f.nodeType===9?f:f.ownerDocument).createTextNode(x),x[ps]=l,l.stateNode=x}return Wn(l),null;case 13:if(Kt(nn),x=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Xt&&yr!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Db(),Fa(),l.flags|=98560,N=!1;else if(N=ku(l),x!==null&&x.dehydrated!==null){if(a===null){if(!N)throw Error(n(318));if(N=l.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[ps]=l}else Fa(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Wn(l),N=!1}else Qr!==null&&(Bm(Qr),Qr=null),N=!0;if(!N)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=f,l):(x=x!==null,x!==(a!==null&&a.memoizedState!==null)&&x&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(nn.current&1)!==0?kn===0&&(kn=3):Hm())),l.updateQueue!==null&&(l.flags|=4),Wn(l),null);case 4:return Va(),Am(a,l),a===null&&gl(l.stateNode.containerInfo),Wn(l),null;case 10:return sm(l.type._context),Wn(l),null;case 17:return rr(l.type)&&yu(),Wn(l),null;case 19:if(Kt(nn),N=l.memoizedState,N===null)return Wn(l),null;if(x=(l.flags&128)!==0,O=N.rendering,O===null)if(x)Tl(N,!1);else{if(kn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(O=Ru(a),O!==null){for(l.flags|=128,Tl(N,!1),x=O.updateQueue,x!==null&&(l.updateQueue=x,l.flags|=4),l.subtreeFlags=0,x=f,f=l.child;f!==null;)N=f,a=x,N.flags&=14680066,O=N.alternate,O===null?(N.childLanes=0,N.lanes=a,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=O.childLanes,N.lanes=O.lanes,N.child=O.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=O.memoizedProps,N.memoizedState=O.memoizedState,N.updateQueue=O.updateQueue,N.type=O.type,a=O.dependencies,N.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),f=f.sibling;return Ut(nn,nn.current&1|2),l.child}a=a.sibling}N.tail!==null&&tn()>qa&&(l.flags|=128,x=!0,Tl(N,!1),l.lanes=4194304)}else{if(!x)if(a=Ru(O),a!==null){if(l.flags|=128,x=!0,f=a.updateQueue,f!==null&&(l.updateQueue=f,l.flags|=4),Tl(N,!0),N.tail===null&&N.tailMode==="hidden"&&!O.alternate&&!Xt)return Wn(l),null}else 2*tn()-N.renderingStartTime>qa&&f!==1073741824&&(l.flags|=128,x=!0,Tl(N,!1),l.lanes=4194304);N.isBackwards?(O.sibling=l.child,l.child=O):(f=N.last,f!==null?f.sibling=O:l.child=O,N.last=O)}return N.tail!==null?(l=N.tail,N.rendering=l,N.tail=l.sibling,N.renderingStartTime=tn(),l.sibling=null,f=nn.current,Ut(nn,x?f&1|2:f&1),l):(Wn(l),null);case 22:case 23:return Vm(),x=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==x&&(l.flags|=8192),x&&(l.mode&1)!==0?(br&1073741824)!==0&&(Wn(l),l.subtreeFlags&6&&(l.flags|=8192)):Wn(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function wT(a,l){switch(Xp(l),l.tag){case 1:return rr(l.type)&&yu(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Va(),Kt(nr),Kt(Vn),dm(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return cm(l),null;case 13:if(Kt(nn),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Fa()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Kt(nn),null;case 4:return Va(),null;case 10:return sm(l.type._context),null;case 22:case 23:return Vm(),null;case 24:return null;default:return null}}var Mu=!1,Kn=!1,jT=typeof WeakSet=="function"?WeakSet:Set,We=null;function Wa(a,l){var f=a.ref;if(f!==null)if(typeof f=="function")try{f(null)}catch(x){an(a,l,x)}else f.current=null}function Pm(a,l,f){try{f()}catch(x){an(a,l,x)}}var Av=!1;function kT(a,l){if(Vp=Io,a=lb(),Op(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var x=f.getSelection&&f.getSelection();if(x&&x.rangeCount!==0){f=x.anchorNode;var w=x.anchorOffset,N=x.focusNode;x=x.focusOffset;try{f.nodeType,N.nodeType}catch{f=null;break e}var O=0,W=-1,Q=-1,de=0,ke=0,Ne=a,je=null;t:for(;;){for(var Ve;Ne!==f||w!==0&&Ne.nodeType!==3||(W=O+w),Ne!==N||x!==0&&Ne.nodeType!==3||(Q=O+x),Ne.nodeType===3&&(O+=Ne.nodeValue.length),(Ve=Ne.firstChild)!==null;)je=Ne,Ne=Ve;for(;;){if(Ne===a)break t;if(je===f&&++de===w&&(W=O),je===N&&++ke===x&&(Q=O),(Ve=Ne.nextSibling)!==null)break;Ne=je,je=Ne.parentNode}Ne=Ve}f=W===-1||Q===-1?null:{start:W,end:Q}}else f=null}f=f||{start:0,end:0}}else f=null;for(Hp={focusedElem:a,selectionRange:f},Io=!1,We=l;We!==null;)if(l=We,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,We=a;else for(;We!==null;){l=We;try{var qe=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(qe!==null){var Qe=qe.memoizedProps,dn=qe.memoizedState,ie=l.stateNode,ee=ie.getSnapshotBeforeUpdate(l.elementType===l.type?Qe:Jr(l.type,Qe),dn);ie.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ce=l.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ae){an(l,l.return,Ae)}if(a=l.sibling,a!==null){a.return=l.return,We=a;break}We=l.return}return qe=Av,Av=!1,qe}function Rl(a,l,f){var x=l.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&a)===a){var N=w.destroy;w.destroy=void 0,N!==void 0&&Pm(l,f,N)}w=w.next}while(w!==x)}}function Fu(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var f=l=l.next;do{if((f.tag&a)===a){var x=f.create;f.destroy=x()}f=f.next}while(f!==l)}}function Dm(a){var l=a.ref;if(l!==null){var f=a.stateNode;switch(a.tag){case 5:a=f;break;default:a=f}typeof l=="function"?l(a):l.current=a}}function Pv(a){var l=a.alternate;l!==null&&(a.alternate=null,Pv(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[ps],delete l[yl],delete l[Gp],delete l[oT],delete l[aT])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Dv(a){return a.tag===5||a.tag===3||a.tag===4}function $v(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Dv(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function $m(a,l,f){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?f.nodeType===8?f.parentNode.insertBefore(a,l):f.insertBefore(a,l):(f.nodeType===8?(l=f.parentNode,l.insertBefore(a,f)):(l=f,l.appendChild(a)),f=f._reactRootContainer,f!=null||l.onclick!==null||(l.onclick=gu));else if(x!==4&&(a=a.child,a!==null))for($m(a,l,f),a=a.sibling;a!==null;)$m(a,l,f),a=a.sibling}function Lm(a,l,f){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?f.insertBefore(a,l):f.appendChild(a);else if(x!==4&&(a=a.child,a!==null))for(Lm(a,l,f),a=a.sibling;a!==null;)Lm(a,l,f),a=a.sibling}var _n=null,Xr=!1;function so(a,l,f){for(f=f.child;f!==null;)Lv(a,l,f),f=f.sibling}function Lv(a,l,f){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(wa,f)}catch{}switch(f.tag){case 5:Kn||Wa(f,l);case 6:var x=_n,w=Xr;_n=null,so(a,l,f),_n=x,Xr=w,_n!==null&&(Xr?(a=_n,f=f.stateNode,a.nodeType===8?a.parentNode.removeChild(f):a.removeChild(f)):_n.removeChild(f.stateNode));break;case 18:_n!==null&&(Xr?(a=_n,f=f.stateNode,a.nodeType===8?qp(a.parentNode,f):a.nodeType===1&&qp(a,f),pn(a)):qp(_n,f.stateNode));break;case 4:x=_n,w=Xr,_n=f.stateNode.containerInfo,Xr=!0,so(a,l,f),_n=x,Xr=w;break;case 0:case 11:case 14:case 15:if(!Kn&&(x=f.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var N=w,O=N.destroy;N=N.tag,O!==void 0&&((N&2)!==0||(N&4)!==0)&&Pm(f,l,O),w=w.next}while(w!==x)}so(a,l,f);break;case 1:if(!Kn&&(Wa(f,l),x=f.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=f.memoizedProps,x.state=f.memoizedState,x.componentWillUnmount()}catch(W){an(f,l,W)}so(a,l,f);break;case 21:so(a,l,f);break;case 22:f.mode&1?(Kn=(x=Kn)||f.memoizedState!==null,so(a,l,f),Kn=x):so(a,l,f);break;default:so(a,l,f)}}function Ov(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var f=a.stateNode;f===null&&(f=a.stateNode=new jT),l.forEach(function(x){var w=DT.bind(null,a,x);f.has(x)||(f.add(x),x.then(w,w))})}}function Zr(a,l){var f=l.deletions;if(f!==null)for(var x=0;x<f.length;x++){var w=f[x];try{var N=a,O=l,W=O;e:for(;W!==null;){switch(W.tag){case 5:_n=W.stateNode,Xr=!1;break e;case 3:_n=W.stateNode.containerInfo,Xr=!0;break e;case 4:_n=W.stateNode.containerInfo,Xr=!0;break e}W=W.return}if(_n===null)throw Error(n(160));Lv(N,O,w),_n=null,Xr=!1;var Q=w.alternate;Q!==null&&(Q.return=null),w.return=null}catch(de){an(w,l,de)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)Iv(l,a),l=l.sibling}function Iv(a,l){var f=a.alternate,x=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Zr(l,a),gs(a),x&4){try{Rl(3,a,a.return),Fu(3,a)}catch(Qe){an(a,a.return,Qe)}try{Rl(5,a,a.return)}catch(Qe){an(a,a.return,Qe)}}break;case 1:Zr(l,a),gs(a),x&512&&f!==null&&Wa(f,f.return);break;case 5:if(Zr(l,a),gs(a),x&512&&f!==null&&Wa(f,f.return),a.flags&32){var w=a.stateNode;try{he(w,"")}catch(Qe){an(a,a.return,Qe)}}if(x&4&&(w=a.stateNode,w!=null)){var N=a.memoizedProps,O=f!==null?f.memoizedProps:N,W=a.type,Q=a.updateQueue;if(a.updateQueue=null,Q!==null)try{W==="input"&&N.type==="radio"&&N.name!=null&&Me(w,N),Be(W,O);var de=Be(W,N);for(O=0;O<Q.length;O+=2){var ke=Q[O],Ne=Q[O+1];ke==="style"?be(w,Ne):ke==="dangerouslySetInnerHTML"?ne(w,Ne):ke==="children"?he(w,Ne):S(w,ke,Ne,de)}switch(W){case"input":Ce(w,N);break;case"textarea":yt(w,N);break;case"select":var je=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!N.multiple;var Ve=N.value;Ve!=null?Ze(w,!!N.multiple,Ve,!1):je!==!!N.multiple&&(N.defaultValue!=null?Ze(w,!!N.multiple,N.defaultValue,!0):Ze(w,!!N.multiple,N.multiple?[]:"",!1))}w[yl]=N}catch(Qe){an(a,a.return,Qe)}}break;case 6:if(Zr(l,a),gs(a),x&4){if(a.stateNode===null)throw Error(n(162));w=a.stateNode,N=a.memoizedProps;try{w.nodeValue=N}catch(Qe){an(a,a.return,Qe)}}break;case 3:if(Zr(l,a),gs(a),x&4&&f!==null&&f.memoizedState.isDehydrated)try{pn(l.containerInfo)}catch(Qe){an(a,a.return,Qe)}break;case 4:Zr(l,a),gs(a);break;case 13:Zr(l,a),gs(a),w=a.child,w.flags&8192&&(N=w.memoizedState!==null,w.stateNode.isHidden=N,!N||w.alternate!==null&&w.alternate.memoizedState!==null||(_m=tn())),x&4&&Ov(a);break;case 22:if(ke=f!==null&&f.memoizedState!==null,a.mode&1?(Kn=(de=Kn)||ke,Zr(l,a),Kn=de):Zr(l,a),gs(a),x&8192){if(de=a.memoizedState!==null,(a.stateNode.isHidden=de)&&!ke&&(a.mode&1)!==0)for(We=a,ke=a.child;ke!==null;){for(Ne=We=ke;We!==null;){switch(je=We,Ve=je.child,je.tag){case 0:case 11:case 14:case 15:Rl(4,je,je.return);break;case 1:Wa(je,je.return);var qe=je.stateNode;if(typeof qe.componentWillUnmount=="function"){x=je,f=je.return;try{l=x,qe.props=l.memoizedProps,qe.state=l.memoizedState,qe.componentWillUnmount()}catch(Qe){an(x,f,Qe)}}break;case 5:Wa(je,je.return);break;case 22:if(je.memoizedState!==null){Fv(Ne);continue}}Ve!==null?(Ve.return=je,We=Ve):Fv(Ne)}ke=ke.sibling}e:for(ke=null,Ne=a;;){if(Ne.tag===5){if(ke===null){ke=Ne;try{w=Ne.stateNode,de?(N=w.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(W=Ne.stateNode,Q=Ne.memoizedProps.style,O=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,W.style.display=ae("display",O))}catch(Qe){an(a,a.return,Qe)}}}else if(Ne.tag===6){if(ke===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Qe){an(a,a.return,Qe)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===a)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===a)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===a)break e;ke===Ne&&(ke=null),Ne=Ne.return}ke===Ne&&(ke=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Zr(l,a),gs(a),x&4&&Ov(a);break;case 21:break;default:Zr(l,a),gs(a)}}function gs(a){var l=a.flags;if(l&2){try{e:{for(var f=a.return;f!==null;){if(Dv(f)){var x=f;break e}f=f.return}throw Error(n(160))}switch(x.tag){case 5:var w=x.stateNode;x.flags&32&&(he(w,""),x.flags&=-33);var N=$v(a);Lm(a,N,w);break;case 3:case 4:var O=x.stateNode.containerInfo,W=$v(a);$m(a,W,O);break;default:throw Error(n(161))}}catch(Q){an(a,a.return,Q)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function ST(a,l,f){We=a,_v(a)}function _v(a,l,f){for(var x=(a.mode&1)!==0;We!==null;){var w=We,N=w.child;if(w.tag===22&&x){var O=w.memoizedState!==null||Mu;if(!O){var W=w.alternate,Q=W!==null&&W.memoizedState!==null||Kn;W=Mu;var de=Kn;if(Mu=O,(Kn=Q)&&!de)for(We=w;We!==null;)O=We,Q=O.child,O.tag===22&&O.memoizedState!==null?zv(w):Q!==null?(Q.return=O,We=Q):zv(w);for(;N!==null;)We=N,_v(N),N=N.sibling;We=w,Mu=W,Kn=de}Mv(a)}else(w.subtreeFlags&8772)!==0&&N!==null?(N.return=w,We=N):Mv(a)}}function Mv(a){for(;We!==null;){var l=We;if((l.flags&8772)!==0){var f=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Kn||Fu(5,l);break;case 1:var x=l.stateNode;if(l.flags&4&&!Kn)if(f===null)x.componentDidMount();else{var w=l.elementType===l.type?f.memoizedProps:Jr(l.type,f.memoizedProps);x.componentDidUpdate(w,f.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var N=l.updateQueue;N!==null&&Fb(l,N,x);break;case 3:var O=l.updateQueue;if(O!==null){if(f=null,l.child!==null)switch(l.child.tag){case 5:f=l.child.stateNode;break;case 1:f=l.child.stateNode}Fb(l,O,f)}break;case 5:var W=l.stateNode;if(f===null&&l.flags&4){f=W;var Q=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&f.focus();break;case"img":Q.src&&(f.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var de=l.alternate;if(de!==null){var ke=de.memoizedState;if(ke!==null){var Ne=ke.dehydrated;Ne!==null&&pn(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Kn||l.flags&512&&Dm(l)}catch(je){an(l,l.return,je)}}if(l===a){We=null;break}if(f=l.sibling,f!==null){f.return=l.return,We=f;break}We=l.return}}function Fv(a){for(;We!==null;){var l=We;if(l===a){We=null;break}var f=l.sibling;if(f!==null){f.return=l.return,We=f;break}We=l.return}}function zv(a){for(;We!==null;){var l=We;try{switch(l.tag){case 0:case 11:case 15:var f=l.return;try{Fu(4,l)}catch(Q){an(l,f,Q)}break;case 1:var x=l.stateNode;if(typeof x.componentDidMount=="function"){var w=l.return;try{x.componentDidMount()}catch(Q){an(l,w,Q)}}var N=l.return;try{Dm(l)}catch(Q){an(l,N,Q)}break;case 5:var O=l.return;try{Dm(l)}catch(Q){an(l,O,Q)}}}catch(Q){an(l,l.return,Q)}if(l===a){We=null;break}var W=l.sibling;if(W!==null){W.return=l.return,We=W;break}We=l.return}}var NT=Math.ceil,zu=T.ReactCurrentDispatcher,Om=T.ReactCurrentOwner,Ir=T.ReactCurrentBatchConfig,Ct=0,Dn=null,hn=null,Mn=0,br=0,Ka=Zs(0),kn=0,Al=null,Ho=0,Bu=0,Im=0,Pl=null,or=null,_m=0,qa=1/0,Is=null,Uu=!1,Mm=null,oo=null,Vu=!1,ao=null,Hu=0,Dl=0,Fm=null,Wu=-1,Ku=0;function Jn(){return(Ct&6)!==0?tn():Wu!==-1?Wu:Wu=tn()}function io(a){return(a.mode&1)===0?1:(Ct&2)!==0&&Mn!==0?Mn&-Mn:lT.transition!==null?(Ku===0&&(Ku=rl()),Ku):(a=Pt,a!==0||(a=window.event,a=a===void 0?16:Uy(a.type)),a)}function es(a,l,f,x){if(50<Dl)throw Dl=0,Fm=null,Error(n(185));Gr(a,f,x),((Ct&2)===0||a!==Dn)&&(a===Dn&&((Ct&2)===0&&(Bu|=f),kn===4&&lo(a,Mn)),ar(a,x),f===1&&Ct===0&&(l.mode&1)===0&&(qa=tn()+500,vu&&to()))}function ar(a,l){var f=a.callbackNode;nu(a,l);var x=Do(a,a===Dn?Mn:0);if(x===0)f!==null&&Xc(f),a.callbackNode=null,a.callbackPriority=0;else if(l=x&-x,a.callbackPriority!==l){if(f!=null&&Xc(f),l===1)a.tag===0?iT(Uv.bind(null,a)):Eb(Uv.bind(null,a)),rT(function(){(Ct&6)===0&&to()}),f=null;else{switch(al(x)){case 1:f=nl;break;case 4:f=Zc;break;case 16:f=qs;break;case 536870912:f=eu;break;default:f=qs}f=Qv(f,Bv.bind(null,a))}a.callbackPriority=l,a.callbackNode=f}}function Bv(a,l){if(Wu=-1,Ku=0,(Ct&6)!==0)throw Error(n(327));var f=a.callbackNode;if(Ga()&&a.callbackNode!==f)return null;var x=Do(a,a===Dn?Mn:0);if(x===0)return null;if((x&30)!==0||(x&a.expiredLanes)!==0||l)l=qu(a,x);else{l=x;var w=Ct;Ct|=2;var N=Hv();(Dn!==a||Mn!==l)&&(Is=null,qa=tn()+500,Ko(a,l));do try{TT();break}catch(W){Vv(a,W)}while(!0);rm(),zu.current=N,Ct=w,hn!==null?l=0:(Dn=null,Mn=0,l=kn)}if(l!==0){if(l===2&&(w=$o(a),w!==0&&(x=w,l=zm(a,w))),l===1)throw f=Al,Ko(a,0),lo(a,x),ar(a,tn()),f;if(l===6)lo(a,x);else{if(w=a.current.alternate,(x&30)===0&&!CT(w)&&(l=qu(a,x),l===2&&(N=$o(a),N!==0&&(x=N,l=zm(a,N))),l===1))throw f=Al,Ko(a,0),lo(a,x),ar(a,tn()),f;switch(a.finishedWork=w,a.finishedLanes=x,l){case 0:case 1:throw Error(n(345));case 2:qo(a,or,Is);break;case 3:if(lo(a,x),(x&130023424)===x&&(l=_m+500-tn(),10<l)){if(Do(a,0)!==0)break;if(w=a.suspendedLanes,(w&x)!==x){Jn(),a.pingedLanes|=a.suspendedLanes&w;break}a.timeoutHandle=Kp(qo.bind(null,a,or,Is),l);break}qo(a,or,Is);break;case 4:if(lo(a,x),(x&4194240)===x)break;for(l=a.eventTimes,w=-1;0<x;){var O=31-Bn(x);N=1<<O,O=l[O],O>w&&(w=O),x&=~N}if(x=w,x=tn()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*NT(x/1960))-x,10<x){a.timeoutHandle=Kp(qo.bind(null,a,or,Is),x);break}qo(a,or,Is);break;case 5:qo(a,or,Is);break;default:throw Error(n(329))}}}return ar(a,tn()),a.callbackNode===f?Bv.bind(null,a):null}function zm(a,l){var f=Pl;return a.current.memoizedState.isDehydrated&&(Ko(a,l).flags|=256),a=qu(a,l),a!==2&&(l=or,or=f,l!==null&&Bm(l)),a}function Bm(a){or===null?or=a:or.push.apply(or,a)}function CT(a){for(var l=a;;){if(l.flags&16384){var f=l.updateQueue;if(f!==null&&(f=f.stores,f!==null))for(var x=0;x<f.length;x++){var w=f[x],N=w.getSnapshot;w=w.value;try{if(!Yr(N(),w))return!1}catch{return!1}}}if(f=l.child,l.subtreeFlags&16384&&f!==null)f.return=l,l=f;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function lo(a,l){for(l&=~Im,l&=~Bu,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var f=31-Bn(l),x=1<<f;a[f]=-1,l&=~x}}function Uv(a){if((Ct&6)!==0)throw Error(n(327));Ga();var l=Do(a,0);if((l&1)===0)return ar(a,tn()),null;var f=qu(a,l);if(a.tag!==0&&f===2){var x=$o(a);x!==0&&(l=x,f=zm(a,x))}if(f===1)throw f=Al,Ko(a,0),lo(a,l),ar(a,tn()),f;if(f===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,qo(a,or,Is),ar(a,tn()),null}function Um(a,l){var f=Ct;Ct|=1;try{return a(l)}finally{Ct=f,Ct===0&&(qa=tn()+500,vu&&to())}}function Wo(a){ao!==null&&ao.tag===0&&(Ct&6)===0&&Ga();var l=Ct;Ct|=1;var f=Ir.transition,x=Pt;try{if(Ir.transition=null,Pt=1,a)return a()}finally{Pt=x,Ir.transition=f,Ct=l,(Ct&6)===0&&to()}}function Vm(){br=Ka.current,Kt(Ka)}function Ko(a,l){a.finishedWork=null,a.finishedLanes=0;var f=a.timeoutHandle;if(f!==-1&&(a.timeoutHandle=-1,nT(f)),hn!==null)for(f=hn.return;f!==null;){var x=f;switch(Xp(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&yu();break;case 3:Va(),Kt(nr),Kt(Vn),dm();break;case 5:cm(x);break;case 4:Va();break;case 13:Kt(nn);break;case 19:Kt(nn);break;case 10:sm(x.type._context);break;case 22:case 23:Vm()}f=f.return}if(Dn=a,hn=a=co(a.current,null),Mn=br=l,kn=0,Al=null,Im=Bu=Ho=0,or=Pl=null,Bo!==null){for(l=0;l<Bo.length;l++)if(f=Bo[l],x=f.interleaved,x!==null){f.interleaved=null;var w=x.next,N=f.pending;if(N!==null){var O=N.next;N.next=w,x.next=O}f.pending=x}Bo=null}return a}function Vv(a,l){do{var f=hn;try{if(rm(),Au.current=Lu,Pu){for(var x=rn.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}Pu=!1}if(Vo=0,Pn=jn=rn=null,Sl=!1,Nl=0,Om.current=null,f===null||f.return===null){kn=1,Al=l,hn=null;break}e:{var N=a,O=f.return,W=f,Q=l;if(l=Mn,W.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var de=Q,ke=W,Ne=ke.tag;if((ke.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var je=ke.alternate;je?(ke.updateQueue=je.updateQueue,ke.memoizedState=je.memoizedState,ke.lanes=je.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var Ve=mv(O);if(Ve!==null){Ve.flags&=-257,hv(Ve,O,W,N,l),Ve.mode&1&&pv(N,de,l),l=Ve,Q=de;var qe=l.updateQueue;if(qe===null){var Qe=new Set;Qe.add(Q),l.updateQueue=Qe}else qe.add(Q);break e}else{if((l&1)===0){pv(N,de,l),Hm();break e}Q=Error(n(426))}}else if(Xt&&W.mode&1){var dn=mv(O);if(dn!==null){(dn.flags&65536)===0&&(dn.flags|=256),hv(dn,O,W,N,l),tm(Ha(Q,W));break e}}N=Q=Ha(Q,W),kn!==4&&(kn=2),Pl===null?Pl=[N]:Pl.push(N),N=O;do{switch(N.tag){case 3:N.flags|=65536,l&=-l,N.lanes|=l;var ie=dv(N,Q,l);Mb(N,ie);break e;case 1:W=Q;var ee=N.type,ce=N.stateNode;if((N.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(oo===null||!oo.has(ce)))){N.flags|=65536,l&=-l,N.lanes|=l;var Ae=fv(N,W,l);Mb(N,Ae);break e}}N=N.return}while(N!==null)}Kv(f)}catch(Xe){l=Xe,hn===f&&f!==null&&(hn=f=f.return);continue}break}while(!0)}function Hv(){var a=zu.current;return zu.current=Lu,a===null?Lu:a}function Hm(){(kn===0||kn===3||kn===2)&&(kn=4),Dn===null||(Ho&268435455)===0&&(Bu&268435455)===0||lo(Dn,Mn)}function qu(a,l){var f=Ct;Ct|=2;var x=Hv();(Dn!==a||Mn!==l)&&(Is=null,Ko(a,l));do try{ET();break}catch(w){Vv(a,w)}while(!0);if(rm(),Ct=f,zu.current=x,hn!==null)throw Error(n(261));return Dn=null,Mn=0,kn}function ET(){for(;hn!==null;)Wv(hn)}function TT(){for(;hn!==null&&!bp();)Wv(hn)}function Wv(a){var l=Yv(a.alternate,a,br);a.memoizedProps=a.pendingProps,l===null?Kv(a):hn=l,Om.current=null}function Kv(a){var l=a;do{var f=l.alternate;if(a=l.return,(l.flags&32768)===0){if(f=vT(f,l,br),f!==null){hn=f;return}}else{if(f=wT(f,l),f!==null){f.flags&=32767,hn=f;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{kn=6,hn=null;return}}if(l=l.sibling,l!==null){hn=l;return}hn=l=a}while(l!==null);kn===0&&(kn=5)}function qo(a,l,f){var x=Pt,w=Ir.transition;try{Ir.transition=null,Pt=1,RT(a,l,f,x)}finally{Ir.transition=w,Pt=x}return null}function RT(a,l,f,x){do Ga();while(ao!==null);if((Ct&6)!==0)throw Error(n(327));f=a.finishedWork;var w=a.finishedLanes;if(f===null)return null;if(a.finishedWork=null,a.finishedLanes=0,f===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var N=f.lanes|f.childLanes;if(sl(a,N),a===Dn&&(hn=Dn=null,Mn=0),(f.subtreeFlags&2064)===0&&(f.flags&2064)===0||Vu||(Vu=!0,Qv(qs,function(){return Ga(),null})),N=(f.flags&15990)!==0,(f.subtreeFlags&15990)!==0||N){N=Ir.transition,Ir.transition=null;var O=Pt;Pt=1;var W=Ct;Ct|=4,Om.current=null,kT(a,f),Iv(f,a),Y2(Hp),Io=!!Vp,Hp=Vp=null,a.current=f,ST(f),vp(),Ct=W,Pt=O,Ir.transition=N}else a.current=f;if(Vu&&(Vu=!1,ao=a,Hu=w),N=a.pendingLanes,N===0&&(oo=null),ja(f.stateNode),ar(a,tn()),l!==null)for(x=a.onRecoverableError,f=0;f<l.length;f++)w=l[f],x(w.value,{componentStack:w.stack,digest:w.digest});if(Uu)throw Uu=!1,a=Mm,Mm=null,a;return(Hu&1)!==0&&a.tag!==0&&Ga(),N=a.pendingLanes,(N&1)!==0?a===Fm?Dl++:(Dl=0,Fm=a):Dl=0,to(),null}function Ga(){if(ao!==null){var a=al(Hu),l=Ir.transition,f=Pt;try{if(Ir.transition=null,Pt=16>a?16:a,ao===null)var x=!1;else{if(a=ao,ao=null,Hu=0,(Ct&6)!==0)throw Error(n(331));var w=Ct;for(Ct|=4,We=a.current;We!==null;){var N=We,O=N.child;if((We.flags&16)!==0){var W=N.deletions;if(W!==null){for(var Q=0;Q<W.length;Q++){var de=W[Q];for(We=de;We!==null;){var ke=We;switch(ke.tag){case 0:case 11:case 15:Rl(8,ke,N)}var Ne=ke.child;if(Ne!==null)Ne.return=ke,We=Ne;else for(;We!==null;){ke=We;var je=ke.sibling,Ve=ke.return;if(Pv(ke),ke===de){We=null;break}if(je!==null){je.return=Ve,We=je;break}We=Ve}}}var qe=N.alternate;if(qe!==null){var Qe=qe.child;if(Qe!==null){qe.child=null;do{var dn=Qe.sibling;Qe.sibling=null,Qe=dn}while(Qe!==null)}}We=N}}if((N.subtreeFlags&2064)!==0&&O!==null)O.return=N,We=O;else e:for(;We!==null;){if(N=We,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Rl(9,N,N.return)}var ie=N.sibling;if(ie!==null){ie.return=N.return,We=ie;break e}We=N.return}}var ee=a.current;for(We=ee;We!==null;){O=We;var ce=O.child;if((O.subtreeFlags&2064)!==0&&ce!==null)ce.return=O,We=ce;else e:for(O=ee;We!==null;){if(W=We,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Fu(9,W)}}catch(Xe){an(W,W.return,Xe)}if(W===O){We=null;break e}var Ae=W.sibling;if(Ae!==null){Ae.return=W.return,We=Ae;break e}We=W.return}}if(Ct=w,to(),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(wa,a)}catch{}x=!0}return x}finally{Pt=f,Ir.transition=l}}return!1}function qv(a,l,f){l=Ha(f,l),l=dv(a,l,1),a=ro(a,l,1),l=Jn(),a!==null&&(Gr(a,1,l),ar(a,l))}function an(a,l,f){if(a.tag===3)qv(a,a,f);else for(;l!==null;){if(l.tag===3){qv(l,a,f);break}else if(l.tag===1){var x=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(oo===null||!oo.has(x))){a=Ha(f,a),a=fv(l,a,1),l=ro(l,a,1),a=Jn(),l!==null&&(Gr(l,1,a),ar(l,a));break}}l=l.return}}function AT(a,l,f){var x=a.pingCache;x!==null&&x.delete(l),l=Jn(),a.pingedLanes|=a.suspendedLanes&f,Dn===a&&(Mn&f)===f&&(kn===4||kn===3&&(Mn&130023424)===Mn&&500>tn()-_m?Ko(a,0):Im|=f),ar(a,l)}function Gv(a,l){l===0&&((a.mode&1)===0?l=1:(l=ka,ka<<=1,(ka&130023424)===0&&(ka=4194304)));var f=Jn();a=$s(a,l),a!==null&&(Gr(a,l,f),ar(a,f))}function PT(a){var l=a.memoizedState,f=0;l!==null&&(f=l.retryLane),Gv(a,f)}function DT(a,l){var f=0;switch(a.tag){case 13:var x=a.stateNode,w=a.memoizedState;w!==null&&(f=w.retryLane);break;case 19:x=a.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(l),Gv(a,f)}var Yv;Yv=function(a,l,f){if(a!==null)if(a.memoizedProps!==l.pendingProps||nr.current)sr=!0;else{if((a.lanes&f)===0&&(l.flags&128)===0)return sr=!1,bT(a,l,f);sr=(a.flags&131072)!==0}else sr=!1,Xt&&(l.flags&1048576)!==0&&Tb(l,ju,l.index);switch(l.lanes=0,l.tag){case 2:var x=l.type;_u(a,l),a=l.pendingProps;var w=Ia(l,Vn.current);Ua(l,f),w=mm(null,l,x,a,w,f);var N=hm();return l.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,rr(x)?(N=!0,bu(l)):N=!1,l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,im(l),w.updater=Ou,l.stateNode=w,w._reactInternals=l,wm(l,x,a,f),l=Nm(null,l,x,!0,N,f)):(l.tag=0,Xt&&N&&Jp(l),Qn(null,l,w,f),l=l.child),l;case 16:x=l.elementType;e:{switch(_u(a,l),a=l.pendingProps,w=x._init,x=w(x._payload),l.type=x,w=l.tag=LT(x),a=Jr(x,a),w){case 0:l=Sm(null,l,x,a,f);break e;case 1:l=wv(null,l,x,a,f);break e;case 11:l=gv(null,l,x,a,f);break e;case 14:l=xv(null,l,x,Jr(x.type,a),f);break e}throw Error(n(306,x,""))}return l;case 0:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Jr(x,w),Sm(a,l,x,w,f);case 1:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Jr(x,w),wv(a,l,x,w,f);case 3:e:{if(jv(l),a===null)throw Error(n(387));x=l.pendingProps,N=l.memoizedState,w=N.element,_b(a,l),Tu(l,x,null,f);var O=l.memoizedState;if(x=O.element,N.isDehydrated)if(N={element:x,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},l.updateQueue.baseState=N,l.memoizedState=N,l.flags&256){w=Ha(Error(n(423)),l),l=kv(a,l,x,f,w);break e}else if(x!==w){w=Ha(Error(n(424)),l),l=kv(a,l,x,f,w);break e}else for(yr=Xs(l.stateNode.containerInfo.firstChild),xr=l,Xt=!0,Qr=null,f=Ob(l,null,x,f),l.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling;else{if(Fa(),x===w){l=Os(a,l,f);break e}Qn(a,l,x,f)}l=l.child}return l;case 5:return zb(l),a===null&&em(l),x=l.type,w=l.pendingProps,N=a!==null?a.memoizedProps:null,O=w.children,Wp(x,w)?O=null:N!==null&&Wp(x,N)&&(l.flags|=32),vv(a,l),Qn(a,l,O,f),l.child;case 6:return a===null&&em(l),null;case 13:return Sv(a,l,f);case 4:return lm(l,l.stateNode.containerInfo),x=l.pendingProps,a===null?l.child=za(l,null,x,f):Qn(a,l,x,f),l.child;case 11:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Jr(x,w),gv(a,l,x,w,f);case 7:return Qn(a,l,l.pendingProps,f),l.child;case 8:return Qn(a,l,l.pendingProps.children,f),l.child;case 12:return Qn(a,l,l.pendingProps.children,f),l.child;case 10:e:{if(x=l.type._context,w=l.pendingProps,N=l.memoizedProps,O=w.value,Ut(Nu,x._currentValue),x._currentValue=O,N!==null)if(Yr(N.value,O)){if(N.children===w.children&&!nr.current){l=Os(a,l,f);break e}}else for(N=l.child,N!==null&&(N.return=l);N!==null;){var W=N.dependencies;if(W!==null){O=N.child;for(var Q=W.firstContext;Q!==null;){if(Q.context===x){if(N.tag===1){Q=Ls(-1,f&-f),Q.tag=2;var de=N.updateQueue;if(de!==null){de=de.shared;var ke=de.pending;ke===null?Q.next=Q:(Q.next=ke.next,ke.next=Q),de.pending=Q}}N.lanes|=f,Q=N.alternate,Q!==null&&(Q.lanes|=f),om(N.return,f,l),W.lanes|=f;break}Q=Q.next}}else if(N.tag===10)O=N.type===l.type?null:N.child;else if(N.tag===18){if(O=N.return,O===null)throw Error(n(341));O.lanes|=f,W=O.alternate,W!==null&&(W.lanes|=f),om(O,f,l),O=N.sibling}else O=N.child;if(O!==null)O.return=N;else for(O=N;O!==null;){if(O===l){O=null;break}if(N=O.sibling,N!==null){N.return=O.return,O=N;break}O=O.return}N=O}Qn(a,l,w.children,f),l=l.child}return l;case 9:return w=l.type,x=l.pendingProps.children,Ua(l,f),w=Lr(w),x=x(w),l.flags|=1,Qn(a,l,x,f),l.child;case 14:return x=l.type,w=Jr(x,l.pendingProps),w=Jr(x.type,w),xv(a,l,x,w,f);case 15:return yv(a,l,l.type,l.pendingProps,f);case 17:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Jr(x,w),_u(a,l),l.tag=1,rr(x)?(a=!0,bu(l)):a=!1,Ua(l,f),cv(l,x,w),wm(l,x,w,f),Nm(null,l,x,!0,a,f);case 19:return Cv(a,l,f);case 22:return bv(a,l,f)}throw Error(n(156,l.tag))};function Qv(a,l){return Jc(a,l)}function $T(a,l,f,x){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _r(a,l,f,x){return new $T(a,l,f,x)}function Wm(a){return a=a.prototype,!(!a||!a.isReactComponent)}function LT(a){if(typeof a=="function")return Wm(a)?1:0;if(a!=null){if(a=a.$$typeof,a===V)return 11;if(a===F)return 14}return 2}function co(a,l){var f=a.alternate;return f===null?(f=_r(a.tag,l,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=l,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&14680064,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,l=a.dependencies,f.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f}function Gu(a,l,f,x,w,N){var O=2;if(x=a,typeof a=="function")Wm(a)&&(O=1);else if(typeof a=="string")O=5;else e:switch(a){case P:return Go(f.children,w,N,l);case $:O=8,w|=8;break;case M:return a=_r(12,f,l,w|2),a.elementType=M,a.lanes=N,a;case K:return a=_r(13,f,l,w),a.elementType=K,a.lanes=N,a;case I:return a=_r(19,f,l,w),a.elementType=I,a.lanes=N,a;case Z:return Yu(f,w,N,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case _:O=10;break e;case D:O=9;break e;case V:O=11;break e;case F:O=14;break e;case q:O=16,x=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return l=_r(O,f,l,w),l.elementType=a,l.type=x,l.lanes=N,l}function Go(a,l,f,x){return a=_r(7,a,x,l),a.lanes=f,a}function Yu(a,l,f,x){return a=_r(22,a,x,l),a.elementType=Z,a.lanes=f,a.stateNode={isHidden:!1},a}function Km(a,l,f){return a=_r(6,a,null,l),a.lanes=f,a}function qm(a,l,f){return l=_r(4,a.children!==null?a.children:[],a.key,l),l.lanes=f,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function OT(a,l,f,x,w){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Gm(a,l,f,x,w,N,O,W,Q){return a=new OT(a,l,f,W,Q),l===1?(l=1,N===!0&&(l|=8)):l=0,N=_r(3,null,null,l),a.current=N,N.stateNode=a,N.memoizedState={element:x,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null},im(N),a}function IT(a,l,f){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:x==null?null:""+x,children:a,containerInfo:l,implementation:f}}function Jv(a){if(!a)return eo;a=a._reactInternals;e:{if(ht(a)!==a||a.tag!==1)throw Error(n(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(rr(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(a.tag===1){var f=a.type;if(rr(f))return Nb(a,f,l)}return l}function Xv(a,l,f,x,w,N,O,W,Q){return a=Gm(f,x,!0,a,w,N,O,W,Q),a.context=Jv(null),f=a.current,x=Jn(),w=io(f),N=Ls(x,w),N.callback=l??null,ro(f,N,w),a.current.lanes=w,Gr(a,w,x),ar(a,x),a}function Qu(a,l,f,x){var w=l.current,N=Jn(),O=io(w);return f=Jv(f),l.context===null?l.context=f:l.pendingContext=f,l=Ls(N,O),l.payload={element:a},x=x===void 0?null:x,x!==null&&(l.callback=x),a=ro(w,l,O),a!==null&&(es(a,w,O,N),Eu(a,w,O)),O}function Ju(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function Zv(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<l?f:l}}function Ym(a,l){Zv(a,l),(a=a.alternate)&&Zv(a,l)}function _T(){return null}var ew=typeof reportError=="function"?reportError:function(a){console.error(a)};function Qm(a){this._internalRoot=a}Xu.prototype.render=Qm.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Qu(a,l,null,null)},Xu.prototype.unmount=Qm.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Wo(function(){Qu(null,a,null,null)}),l[Rs]=null}};function Xu(a){this._internalRoot=a}Xu.prototype.unstable_scheduleHydration=function(a){if(a){var l=Ca();a={blockedOn:null,target:a,priority:l};for(var f=0;f<Un.length&&l!==0&&l<Un[f].priority;f++);Un.splice(f,0,a),f===0&&ft(a)}};function Jm(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function Zu(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function tw(){}function MT(a,l,f,x,w){if(w){if(typeof x=="function"){var N=x;x=function(){var de=Ju(O);N.call(de)}}var O=Xv(l,x,a,0,null,!1,!1,"",tw);return a._reactRootContainer=O,a[Rs]=O.current,gl(a.nodeType===8?a.parentNode:a),Wo(),O}for(;w=a.lastChild;)a.removeChild(w);if(typeof x=="function"){var W=x;x=function(){var de=Ju(Q);W.call(de)}}var Q=Gm(a,0,!1,null,null,!1,!1,"",tw);return a._reactRootContainer=Q,a[Rs]=Q.current,gl(a.nodeType===8?a.parentNode:a),Wo(function(){Qu(l,Q,f,x)}),Q}function ed(a,l,f,x,w){var N=f._reactRootContainer;if(N){var O=N;if(typeof w=="function"){var W=w;w=function(){var Q=Ju(O);W.call(Q)}}Qu(l,O,a,w)}else O=MT(f,l,a,w,x);return Ju(O)}Sa=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var f=Gs(l.pendingLanes);f!==0&&(ol(l,f|1),ar(l,tn()),(Ct&6)===0&&(qa=tn()+500,to()))}break;case 13:Wo(function(){var x=$s(a,1);if(x!==null){var w=Jn();es(x,a,1,w)}}),Ym(a,1)}},Na=function(a){if(a.tag===13){var l=$s(a,134217728);if(l!==null){var f=Jn();es(l,a,134217728,f)}Ym(a,134217728)}},Ys=function(a){if(a.tag===13){var l=io(a),f=$s(a,l);if(f!==null){var x=Jn();es(f,a,l,x)}Ym(a,l)}},Ca=function(){return Pt},ru=function(a,l){var f=Pt;try{return Pt=a,l()}finally{Pt=f}},_t=function(a,l,f){switch(l){case"input":if(Ce(a,f),l=f.name,f.type==="radio"&&l!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<f.length;l++){var x=f[l];if(x!==a&&x.form===a.form){var w=xu(x);if(!w)throw Error(n(90));ct(x),Ce(x,w)}}}break;case"textarea":yt(a,f);break;case"select":l=f.value,l!=null&&Ze(a,!!f.multiple,l,!1)}},ve=Um,Nt=Wo;var FT={usingClientEntryPoint:!1,Events:[bl,La,xu,Oe,tt,Um]},$l={findFiberByHostInstance:_o,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},zT={bundleType:$l.bundleType,version:$l.version,rendererPackageName:$l.rendererPackageName,rendererConfig:$l.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=on(a),a===null?null:a.stateNode},findFiberByHostInstance:$l.findFiberByHostInstance||_T,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var td=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!td.isDisabled&&td.supportsFiber)try{wa=td.inject(zT),cn=td}catch{}}return ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=FT,ir.createPortal=function(a,l){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Jm(l))throw Error(n(200));return IT(a,l,null,f)},ir.createRoot=function(a,l){if(!Jm(a))throw Error(n(299));var f=!1,x="",w=ew;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(w=l.onRecoverableError)),l=Gm(a,1,!1,null,null,f,!1,x,w),a[Rs]=l.current,gl(a.nodeType===8?a.parentNode:a),new Qm(l)},ir.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=on(l),a=a===null?null:a.stateNode,a},ir.flushSync=function(a){return Wo(a)},ir.hydrate=function(a,l,f){if(!Zu(l))throw Error(n(200));return ed(null,a,l,!0,f)},ir.hydrateRoot=function(a,l,f){if(!Jm(a))throw Error(n(405));var x=f!=null&&f.hydratedSources||null,w=!1,N="",O=ew;if(f!=null&&(f.unstable_strictMode===!0&&(w=!0),f.identifierPrefix!==void 0&&(N=f.identifierPrefix),f.onRecoverableError!==void 0&&(O=f.onRecoverableError)),l=Xv(l,null,a,1,f??null,w,!1,N,O),a[Rs]=l.current,gl(a),x)for(a=0;a<x.length;a++)f=x[a],w=f._getVersion,w=w(f._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[f,w]:l.mutableSourceEagerHydrationData.push(f,w);return new Xu(l)},ir.render=function(a,l,f){if(!Zu(l))throw Error(n(200));return ed(null,a,l,!1,f)},ir.unmountComponentAtNode=function(a){if(!Zu(a))throw Error(n(40));return a._reactRootContainer?(Wo(function(){ed(null,null,a,!1,function(){a._reactRootContainer=null,a[Rs]=null})}),!0):!1},ir.unstable_batchedUpdates=Um,ir.unstable_renderSubtreeIntoContainer=function(a,l,f,x){if(!Zu(f))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return ed(a,l,f,!1,x)},ir.version="18.3.1-next-f1338f8080-20240426",ir}var cw;function ik(){if(cw)return th.exports;cw=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),th.exports=QT(),th.exports}var uw;function JT(){if(uw)return nd;uw=1;var e=ik();return nd.createRoot=e.createRoot,nd.hydrateRoot=e.hydrateRoot,nd}var XT=JT();/**
|
|
41
|
+
* react-router v7.13.1
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/var dw="popstate";function fw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZT(e={}){function t(s,o){var m;let i=(m=o.state)==null?void 0:m.masked,{pathname:c,search:u,hash:d}=i||s.location;return og("",{pathname:c,search:u,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,o){return typeof o=="string"?o:pc(o)}return tR(t,n,null,e)}function sn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ts(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function eR(){return Math.random().toString(36).substring(2,10)}function pw(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function og(e,t,n=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ii(t):t,state:n,key:t&&t.key||s||eR(),unstable_mask:o}}function pc({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ii(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function tR(e,t,n,s={}){let{window:o=document.defaultView,v5Compat:i=!1}=s,c=o.history,u="POP",d=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function g(){u="POP";let v=h(),k=v==null?null:v-m;m=v,d&&d({action:u,location:j.location,delta:k})}function y(v,k){u="PUSH";let E=fw(v)?v:og(j.location,v,k);m=h()+1;let S=pw(E,m),T=j.createHref(E.unstable_mask||E);try{c.pushState(S,"",T)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;o.location.assign(T)}i&&d&&d({action:u,location:j.location,delta:1})}function b(v,k){u="REPLACE";let E=fw(v)?v:og(j.location,v,k);m=h();let S=pw(E,m),T=j.createHref(E.unstable_mask||E);c.replaceState(S,"",T),i&&d&&d({action:u,location:j.location,delta:0})}function C(v){return nR(v)}let j={get action(){return u},get location(){return e(o,c)},listen(v){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(dw,g),d=v,()=>{o.removeEventListener(dw,g),d=null}},createHref(v){return t(o,v)},createURL:C,encodeLocation(v){let k=C(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return j}function nR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),sn(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:pc(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function lk(e,t,n="/"){return rR(e,t,n,!1)}function rR(e,t,n,s){let o=typeof t=="string"?Ii(t):t,i=Bs(o.pathname||"/",n);if(i==null)return null;let c=ck(e);sR(c);let u=null;for(let d=0;u==null&&d<c.length;++d){let m=hR(i);u=pR(c[d],m,s)}return u}function ck(e,t=[],n=[],s="",o=!1){let i=(c,u,d=o,m)=>{let h={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&d)return;sn(h.relativePath.startsWith(s),`Absolute route path "${h.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(s.length)}let g=js([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(sn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),ck(c.children,t,y,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:dR(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))i(c,u);else for(let m of uk(c.path))i(c,u,!0,m)}),t}function uk(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return o?[i,""]:[i];let c=uk(s.join("/")),u=[];return u.push(...c.map(d=>d===""?i:[i,d].join("/"))),o&&u.push(...c),u.map(d=>e.startsWith("/")&&d===""?"/":d)}function sR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fR(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var oR=/^:[\w-]+$/,aR=3,iR=2,lR=1,cR=10,uR=-2,mw=e=>e==="*";function dR(e,t){let n=e.split("/"),s=n.length;return n.some(mw)&&(s+=uR),t&&(s+=iR),n.filter(o=>!mw(o)).reduce((o,i)=>o+(oR.test(i)?aR:i===""?lR:cR),s)}function fR(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function pR(e,t,n=!1){let{routesMeta:s}=e,o={},i="/",c=[];for(let u=0;u<s.length;++u){let d=s[u],m=u===s.length-1,h=i==="/"?t:t.slice(i.length)||"/",g=Md({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},h),y=d.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=Md({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},h)),!g)return null;Object.assign(o,g.params),c.push({params:o,pathname:js([i,g.pathname]),pathnameBase:bR(js([i,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(i=js([i,g.pathnameBase]))}return c}function Md(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=mR(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],c=i.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let C=u[y]||"";c=i.slice(0,i.length-C.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:i,pathnameBase:c,pattern:e}}function mR(e,t=!1,n=!0){ts(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,d,m,h)=>{if(s.push({paramName:u,isOptional:d!=null}),d){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function hR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ts(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Bs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}var gR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function xR(e,t="/"){let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Ii(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=hw(n.substring(1),"/"):i=hw(n,t)):i=t,{pathname:i,search:vR(s),hash:wR(o)}}function hw(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function sh(e,t,n,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function yR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function dk(e){let t=yR(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Jg(e,t,n,s=!1){let o;typeof e=="string"?o=Ii(e):(o={...e},sn(!o.pathname||!o.pathname.includes("?"),sh("?","pathname","search",o)),sn(!o.pathname||!o.pathname.includes("#"),sh("#","pathname","hash",o)),sn(!o.search||!o.search.includes("#"),sh("#","search","hash",o)));let i=e===""||o.pathname==="",c=i?"/":o.pathname,u;if(c==null)u=n;else{let g=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;o.pathname=y.join("/")}u=g>=0?t[g]:"/"}let d=xR(o,u),m=c&&c!=="/"&&c.endsWith("/"),h=(i||c===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(m||h)&&(d.pathname+="/"),d}var js=e=>e.join("/").replace(/\/\/+/g,"/"),bR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),vR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,jR=class{constructor(e,t,n,s=!1){this.status=e,this.statusText=t||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function kR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function SR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var fk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function pk(e,t){let n=e;if(typeof n!="string"||!gR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,o=!1;if(fk)try{let i=new URL(window.location.href),c=n.startsWith("//")?new URL(i.protocol+n):new URL(n),u=Bs(c.pathname,t);c.origin===i.origin&&u!=null?n=u+c.search+c.hash:o=!0}catch{ts(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var mk=["POST","PUT","PATCH","DELETE"];new Set(mk);var NR=["GET",...mk];new Set(NR);var _i=p.createContext(null);_i.displayName="DataRouter";var yf=p.createContext(null);yf.displayName="DataRouterState";var CR=p.createContext(!1),hk=p.createContext({isTransitioning:!1});hk.displayName="ViewTransition";var ER=p.createContext(new Map);ER.displayName="Fetchers";var TR=p.createContext(null);TR.displayName="Await";var Vr=p.createContext(null);Vr.displayName="Navigation";var Cc=p.createContext(null);Cc.displayName="Location";var is=p.createContext({outlet:null,matches:[],isDataRoute:!1});is.displayName="Route";var Xg=p.createContext(null);Xg.displayName="RouteError";var gk="REACT_ROUTER_ERROR",RR="REDIRECT",AR="ROUTE_ERROR_RESPONSE";function PR(e){if(e.startsWith(`${gk}:${RR}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function DR(e){if(e.startsWith(`${gk}:${AR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new jR(t.status,t.statusText,t.data)}catch{}}function $R(e,{relative:t}={}){sn(Ec(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=p.useContext(Vr),{hash:o,pathname:i,search:c}=Tc(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:js([n,i])),s.createHref({pathname:u,search:c,hash:o})}function Ec(){return p.useContext(Cc)!=null}function Xn(){return sn(Ec(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Cc).location}var xk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yk(e){p.useContext(Vr).static||p.useLayoutEffect(e)}function zt(){let{isDataRoute:e}=p.useContext(is);return e?GR():LR()}function LR(){sn(Ec(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(_i),{basename:t,navigator:n}=p.useContext(Vr),{matches:s}=p.useContext(is),{pathname:o}=Xn(),i=JSON.stringify(dk(s)),c=p.useRef(!1);return yk(()=>{c.current=!0}),p.useCallback((d,m={})=>{if(ts(c.current,xk),!c.current)return;if(typeof d=="number"){n.go(d);return}let h=Jg(d,JSON.parse(i),o,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:js([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,i,o,e])}var OR=p.createContext(null);function IR(e){let t=p.useContext(is).outlet;return p.useMemo(()=>t&&p.createElement(OR.Provider,{value:e},t),[t,e])}function Bt(){let{matches:e}=p.useContext(is),t=e[e.length-1];return t?t.params:{}}function Tc(e,{relative:t}={}){let{matches:n}=p.useContext(is),{pathname:s}=Xn(),o=JSON.stringify(dk(n));return p.useMemo(()=>Jg(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function _R(e,t){return bk(e,t)}function bk(e,t,n){var v;sn(Ec(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=p.useContext(Vr),{matches:o}=p.useContext(is),i=o[o.length-1],c=i?i.params:{},u=i?i.pathname:"/",d=i?i.pathnameBase:"/",m=i&&i.route;{let k=m&&m.path||"";wk(u,!m||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
+
|
|
51
|
+
Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=Xn(),g;if(t){let k=typeof t=="string"?Ii(t):t;sn(d==="/"||((v=k.pathname)==null?void 0:v.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(d!=="/"){let k=d.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=lk(e,{pathname:b});ts(m||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ts(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=UR(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:js([d,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?d:js([d,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,n);return t&&j?p.createElement(Cc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function MR(){let e=qR(),t=kR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:i},"ErrorBoundary")," or"," ",p.createElement("code",{style:i},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:o},n):null,c)}var FR=p.createElement(MR,null),vk=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=DR(e.digest);n&&(e=n)}let t=e!==void 0?p.createElement(is.Provider,{value:this.props.routeContext},p.createElement(Xg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(zR,{error:e},t):t}};vk.contextType=CR;var oh=new WeakMap;function zR({children:e,error:t}){let{basename:n}=p.useContext(Vr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=PR(t.digest);if(s){let o=oh.get(t);if(o)throw o;let i=pk(s.location,n);if(fk&&!oh.get(t))if(i.isExternal||s.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw oh.set(t,c),c}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function BR({routeContext:e,match:t,children:n}){let s=p.useContext(_i);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(is.Provider,{value:e},n)}function UR(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,i=s==null?void 0:s.errors;if(i!=null){let h=o.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);sn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<o.length;h++){let g=o[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,C=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||C){n.isStatic&&(c=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let d=n==null?void 0:n.onError,m=s&&d?(h,g)=>{var y,b;d(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:SR(s.matches),errorInfo:g})}:void 0;return o.reduceRight((h,g,y)=>{let b,C=!1,j=null,v=null;s&&(b=i&&g.route.id?i[g.route.id]:void 0,j=g.route.errorElement||FR,c&&(u<0&&y===0?(wk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,v=null):u===y&&(C=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,y+1)),E=()=>{let S;return b?S=j:C?S=v:g.route.Component?S=p.createElement(g.route.Component,null):g.route.element?S=g.route.element:S=h,p.createElement(BR,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?p.createElement(vk,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Zg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VR(e){let t=p.useContext(_i);return sn(t,Zg(e)),t}function HR(e){let t=p.useContext(yf);return sn(t,Zg(e)),t}function WR(e){let t=p.useContext(is);return sn(t,Zg(e)),t}function ex(e){let t=WR(e),n=t.matches[t.matches.length-1];return sn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function KR(){return ex("useRouteId")}function qR(){var s;let e=p.useContext(Xg),t=HR("useRouteError"),n=ex("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function GR(){let{router:e}=VR("useNavigate"),t=ex("useNavigate"),n=p.useRef(!1);return yk(()=>{n.current=!0}),p.useCallback(async(o,i={})=>{ts(n.current,xk),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var gw={};function wk(e,t,n){!t&&!gw[e]&&(gw[e]=!0,ts(!1,n))}p.memo(YR);function YR({routes:e,future:t,state:n,isStatic:s,onError:o}){return bk(e,void 0,{state:n,isStatic:s,onError:o})}function QR(e){return IR(e.context)}function Ge(e){sn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function JR({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:o,static:i=!1,unstable_useTransitions:c}){sn(!Ec(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),d=p.useMemo(()=>({basename:u,navigator:o,static:i,unstable_useTransitions:c,future:{}}),[u,o,i,c]);typeof n=="string"&&(n=Ii(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:C}=n,j=p.useMemo(()=>{let v=Bs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:C},navigationType:s}},[u,m,h,g,y,b,s,C]);return ts(j!=null,`<Router basename="${u}"> is not able to match the URL "${m}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:p.createElement(Vr.Provider,{value:d},p.createElement(Cc.Provider,{children:t,value:j}))}function XR({children:e,location:t}){return _R(ag(e),t)}function ag(e,t=[]){let n=[];return p.Children.forEach(e,(s,o)=>{if(!p.isValidElement(s))return;let i=[...t,o];if(s.type===p.Fragment){n.push.apply(n,ag(s.props.children,i));return}sn(s.type===Ge,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),sn(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=ag(s.props.children,i)),n.push(c)}),n}var jd="get",kd="application/x-www-form-urlencoded";function bf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ZR(e){return bf(e)&&e.tagName.toLowerCase()==="button"}function eA(e){return bf(e)&&e.tagName.toLowerCase()==="form"}function tA(e){return bf(e)&&e.tagName.toLowerCase()==="input"}function nA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function rA(e,t){return e.button===0&&(!t||t==="_self")&&!nA(e)}function ig(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(o=>[n,o]):[[n,s]])},[]))}function sA(e,t){let n=ig(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var rd=null;function oA(){if(rd===null)try{new FormData(document.createElement("form"),0),rd=!1}catch{rd=!0}return rd}var aA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function ah(e){return e!=null&&!aA.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${kd}"`),null):e}function iA(e,t){let n,s,o,i,c;if(eA(e)){let u=e.getAttribute("action");s=u?Bs(u,t):null,n=e.getAttribute("method")||jd,o=ah(e.getAttribute("enctype"))||kd,i=new FormData(e)}else if(ZR(e)||tA(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||u.getAttribute("action");if(s=d?Bs(d,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||jd,o=ah(e.getAttribute("formenctype"))||ah(u.getAttribute("enctype"))||kd,i=new FormData(u,e),!oA()){let{name:m,type:h,value:g}=e;if(h==="image"){let y=m?`${m}.`:"";i.append(`${y}x`,"0"),i.append(`${y}y`,"0")}else m&&i.append(m,g)}}else{if(bf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=jd,s=null,o=kd,c=e}return i&&o==="text/plain"&&(c=i,i=void 0),{action:s,method:n.toLowerCase(),encType:o,formData:i,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function tx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lA(e,t,n,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&Bs(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${s}`,o}async function cA(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function uA(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function dA(e,t,n){let s=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let c=await cA(i,n);return c.links?c.links():[]}return[]}));return hA(s.flat(1).filter(uA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function xw(e,t,n,s,o,i){let c=(d,m)=>n[m]?d.route.id!==n[m].route.id:!0,u=(d,m)=>{var h;return n[m].pathname!==d.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,m)=>c(d,m)||u(d,m)):i==="data"?t.filter((d,m)=>{var g;let h=s.routes[d.route.id];if(!h||!h.hasLoader)return!1;if(c(d,m)||u(d,m))return!0;if(d.route.shouldRevalidate){let y=d.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function fA(e,t,{includeHydrateFallback:n}={}){return pA(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function pA(e){return[...new Set(e)]}function mA(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function hA(e,t){let n=new Set;return new Set(t),e.reduce((s,o)=>{let i=JSON.stringify(mA(o));return n.has(i)||(n.add(i),s.push({key:i,link:o})),s},[])}function jk(){let e=p.useContext(_i);return tx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function gA(){let e=p.useContext(yf);return tx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var nx=p.createContext(void 0);nx.displayName="FrameworkContext";function kk(){let e=p.useContext(nx);return tx(e,"You must render this element inside a <HydratedRouter> element"),e}function xA(e,t){let n=p.useContext(nx),[s,o]=p.useState(!1),[i,c]=p.useState(!1),{onFocus:u,onBlur:d,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=p.useRef(null);p.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(E=>{c(E.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.disconnect()}}},[e]),p.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{o(!0)},C=()=>{o(!1),c(!1)};return n?e!=="intent"?[i,y,{}]:[i,y,{onFocus:Ol(u,b),onBlur:Ol(d,C),onMouseEnter:Ol(m,b),onMouseLeave:Ol(h,C),onTouchStart:Ol(g,b)}]:[!1,y,{}]}function Ol(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yA({page:e,...t}){let{router:n}=jk(),s=p.useMemo(()=>lk(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?p.createElement(vA,{page:e,matches:s,...t}):null}function bA(e){let{manifest:t,routeModules:n}=kk(),[s,o]=p.useState([]);return p.useEffect(()=>{let i=!1;return dA(e,t,n).then(c=>{i||o(c)}),()=>{i=!0}},[e,t,n]),s}function vA({page:e,matches:t,...n}){let s=Xn(),{future:o,manifest:i,routeModules:c}=kk(),{basename:u}=jk(),{loaderData:d,matches:m}=gA(),h=p.useMemo(()=>xw(e,t,m,i,s,"data"),[e,t,m,i,s]),g=p.useMemo(()=>xw(e,t,m,i,s,"assets"),[e,t,m,i,s]),y=p.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,v=!1;if(t.forEach(E=>{var T;let S=i.routes[E.route.id];!S||!S.hasLoader||(!h.some(A=>A.route.id===E.route.id)&&E.route.id in d&&((T=c[E.route.id])!=null&&T.shouldRevalidate)||S.hasClientLoader?v=!0:j.add(E.route.id))}),j.size===0)return[];let k=lA(e,u,o.unstable_trailingSlashAwareDataRequests,"data");return v&&j.size>0&&k.searchParams.set("_routes",t.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[u,o.unstable_trailingSlashAwareDataRequests,d,s,i,h,t,e,c]),b=p.useMemo(()=>fA(g,i),[g,i]),C=bA(g);return p.createElement(p.Fragment,null,y.map(j=>p.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>p.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),C.map(({key:j,link:v})=>p.createElement("link",{key:j,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function wA(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var jA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jA&&(window.__reactRouterVersion="7.13.1")}catch{}function kA({basename:e,children:t,unstable_useTransitions:n,window:s}){let o=p.useRef();o.current==null&&(o.current=ZT({window:s,v5Compat:!0}));let i=o.current,[c,u]=p.useState({action:i.action,location:i.location}),d=p.useCallback(m=>{n===!1?u(m):p.startTransition(()=>u(m))},[n]);return p.useLayoutEffect(()=>i.listen(d),[i,d]),p.createElement(JR,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:i,unstable_useTransitions:n})}var Sk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ee=p.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:o,reloadDocument:i,replace:c,unstable_mask:u,state:d,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...C},j){let{basename:v,navigator:k,unstable_useTransitions:E}=p.useContext(Vr),S=typeof h=="string"&&Sk.test(h),T=pk(h,v);h=T.to;let A=$R(h,{relative:o}),R=Xn(),P=null;if(u){let F=Jg(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(F.pathname=F.pathname==="/"?v:js([v,F.pathname])),P=k.createHref(F)}let[$,M,_]=xA(s,C),D=EA(h,{replace:c,unstable_mask:u,state:d,target:m,preventScrollReset:g,relative:o,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function V(F){t&&t(F),F.defaultPrevented||D(F)}let K=!(T.isExternal||i),I=p.createElement("a",{...C,..._,href:(K?P:void 0)||T.absoluteURL||A,onClick:K?V:t,ref:wA(j,M),target:m,"data-discover":!S&&n==="render"?"true":void 0});return $&&!S?p.createElement(p.Fragment,null,I,p.createElement(yA,{page:A})):I});Ee.displayName="Link";var SA=p.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:o=!1,style:i,to:c,viewTransition:u,children:d,...m},h){let g=Tc(c,{relative:m.relative}),y=Xn(),b=p.useContext(yf),{navigator:C,basename:j}=p.useContext(Vr),v=b!=null&&DA(g)&&u===!0,k=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,E=y.pathname,S=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),S=S?S.toLowerCase():null,k=k.toLowerCase()),S&&j&&(S=Bs(S,j)||S);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let A=E===k||!o&&E.startsWith(k)&&E.charAt(T)==="/",R=S!=null&&(S===k||!o&&S.startsWith(k)&&S.charAt(k.length)==="/"),P={isActive:A,isPending:R,isTransitioning:v},$=A?t:void 0,M;typeof s=="function"?M=s(P):M=[s,A?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let _=typeof i=="function"?i(P):i;return p.createElement(Ee,{...m,"aria-current":$,className:M,ref:h,style:_,to:c,viewTransition:u},typeof d=="function"?d(P):d)});SA.displayName="NavLink";var NA=p.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:o,state:i,method:c=jd,action:u,onSubmit:d,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},C)=>{let{unstable_useTransitions:j}=p.useContext(Vr),v=AA(),k=PA(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",S=typeof u=="string"&&Sk.test(u),T=A=>{if(d&&d(A),A.defaultPrevented)return;A.preventDefault();let R=A.nativeEvent.submitter,P=(R==null?void 0:R.getAttribute("formmethod"))||c,$=()=>v(R||A.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:o,state:i,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});j&&n!==!1?p.startTransition(()=>$()):$()};return p.createElement("form",{ref:C,method:E,action:k,onSubmit:s?d:T,...b,"data-discover":!S&&e==="render"?"true":void 0})});NA.displayName="Form";function CA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Nk(e){let t=p.useContext(_i);return sn(t,CA(e)),t}function EA(e,{target:t,replace:n,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let h=zt(),g=Xn(),y=Tc(e,{relative:c});return p.useCallback(b=>{if(rA(b,t)){b.preventDefault();let C=n!==void 0?n:pc(g)===pc(y),j=()=>h(e,{replace:C,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:d});m?p.startTransition(()=>j()):j()}},[g,h,y,n,s,o,t,e,i,c,u,d,m])}function ls(e){ts(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=p.useRef(ig(e)),n=p.useRef(!1),s=Xn(),o=p.useMemo(()=>sA(s.search,n.current?null:t.current),[s.search]),i=zt(),c=p.useCallback((u,d)=>{const m=ig(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,i("?"+m,d)},[i,o]);return[o,c]}var TA=0,RA=()=>`__${String(++TA)}__`;function AA(){let{router:e}=Nk("useSubmit"),{basename:t}=p.useContext(Vr),n=KR(),s=e.fetch,o=e.navigate;return p.useCallback(async(i,c={})=>{let{action:u,method:d,encType:m,formData:h,body:g}=iA(i,t);if(c.navigate===!1){let y=c.fetcherKey||RA();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await o(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,o,t,n])}function PA(e,{relative:t}={}){let{basename:n}=p.useContext(Vr),s=p.useContext(is);sn(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),i={...Tc(e||".",{relative:t})},c=Xn();if(e==null){i.search=c.search;let u=new URLSearchParams(i.search),d=u.getAll("index");if(d.some(h=>h==="")){u.delete("index"),d.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();i.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:js([n,i.pathname])),pc(i)}function DA(e,{relative:t}={}){let n=p.useContext(hk);sn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Nk("useViewTransitionState"),o=Tc(e,{relative:t});if(!n.isTransitioning)return!1;let i=Bs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Bs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Md(o.pathname,c)!=null||Md(o.pathname,i)!=null}var Fs=ik();const $A=xf(Fs);/**
|
|
52
|
+
* @license lucide-react v0.460.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const LA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ck=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();/**
|
|
57
|
+
* @license lucide-react v0.460.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/var OA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
62
|
+
* @license lucide-react v0.460.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const IA=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:c,...u},d)=>p.createElement("svg",{ref:d,...OA,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Ck("lucide",o),...u},[...c.map(([m,h])=>p.createElement(m,h)),...Array.isArray(i)?i:[i]]));/**
|
|
67
|
+
* @license lucide-react v0.460.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const $e=(e,t)=>{const n=p.forwardRef(({className:s,...o},i)=>p.createElement(IA,{ref:i,iconNode:t,className:Ck(`lucide-${LA(e)}`,s),...o}));return n.displayName=`${e}`,n};/**
|
|
72
|
+
* @license lucide-react v0.460.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const vf=$e("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
77
|
+
* @license lucide-react v0.460.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const Fd=$e("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
|
|
82
|
+
* @license lucide-react v0.460.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const wf=$e("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
87
|
+
* @license lucide-react v0.460.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const zd=$e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
92
|
+
* @license lucide-react v0.460.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const jf=$e("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
|
|
97
|
+
* @license lucide-react v0.460.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const Ek=$e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
102
|
+
* @license lucide-react v0.460.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const Bd=$e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
107
|
+
* @license lucide-react v0.460.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const _A=$e("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/**
|
|
112
|
+
* @license lucide-react v0.460.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const Tk=$e("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
117
|
+
* @license lucide-react v0.460.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const kf=$e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
|
|
122
|
+
* @license lucide-react v0.460.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const MA=$e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
127
|
+
* @license lucide-react v0.460.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Rr=$e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
132
|
+
* @license lucide-react v0.460.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const pr=$e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
137
|
+
* @license lucide-react v0.460.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const FA=$e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
142
|
+
* @license lucide-react v0.460.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Rk=$e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
147
|
+
* @license lucide-react v0.460.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Ak=$e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
152
|
+
* @license lucide-react v0.460.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const Ud=$e("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
157
|
+
* @license lucide-react v0.460.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const rx=$e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
162
|
+
* @license lucide-react v0.460.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const lg=$e("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
167
|
+
* @license lucide-react v0.460.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const zA=$e("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
172
|
+
* @license lucide-react v0.460.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const BA=$e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
177
|
+
* @license lucide-react v0.460.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const UA=$e("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
182
|
+
* @license lucide-react v0.460.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const VA=$e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
187
|
+
* @license lucide-react v0.460.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const HA=$e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
192
|
+
* @license lucide-react v0.460.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const WA=$e("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
197
|
+
* @license lucide-react v0.460.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const Rc=$e("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
|
|
202
|
+
* @license lucide-react v0.460.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const KA=$e("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
207
|
+
* @license lucide-react v0.460.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const Pk=$e("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
212
|
+
* @license lucide-react v0.460.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const Vd=$e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
217
|
+
* @license lucide-react v0.460.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const qA=$e("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
222
|
+
* @license lucide-react v0.460.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const GA=$e("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
227
|
+
* @license lucide-react v0.460.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const Mi=$e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
232
|
+
* @license lucide-react v0.460.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const yw=$e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
237
|
+
* @license lucide-react v0.460.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const YA=$e("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
|
|
242
|
+
* @license lucide-react v0.460.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const QA=$e("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
|
|
247
|
+
* @license lucide-react v0.460.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const Dk=$e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
252
|
+
* @license lucide-react v0.460.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const sx=$e("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
|
|
257
|
+
* @license lucide-react v0.460.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const JA=$e("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/**
|
|
262
|
+
* @license lucide-react v0.460.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const ox=$e("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
267
|
+
* @license lucide-react v0.460.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const XA=$e("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
|
|
272
|
+
* @license lucide-react v0.460.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const Fi=$e("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
277
|
+
* @license lucide-react v0.460.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const ZA=$e("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
|
|
282
|
+
* @license lucide-react v0.460.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const eP=$e("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
287
|
+
* @license lucide-react v0.460.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const ax=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
292
|
+
* @license lucide-react v0.460.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const cg=$e("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
|
|
297
|
+
* @license lucide-react v0.460.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const $k=$e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
|
|
302
|
+
* @license lucide-react v0.460.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const tP=$e("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
307
|
+
* @license lucide-react v0.460.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const nP=$e("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
|
|
312
|
+
* @license lucide-react v0.460.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const rP=$e("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
317
|
+
* @license lucide-react v0.460.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const sP=$e("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
322
|
+
* @license lucide-react v0.460.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const oP=$e("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
|
|
327
|
+
* @license lucide-react v0.460.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const ix=$e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
332
|
+
* @license lucide-react v0.460.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const aP=$e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
337
|
+
* @license lucide-react v0.460.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const iP=$e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
342
|
+
* @license lucide-react v0.460.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const lx=$e("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
347
|
+
* @license lucide-react v0.460.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const lP=$e("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
|
|
352
|
+
* @license lucide-react v0.460.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const ih=$e("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
|
|
357
|
+
* @license lucide-react v0.460.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const Lk=$e("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
|
|
362
|
+
* @license lucide-react v0.460.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const zi=$e("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
367
|
+
* @license lucide-react v0.460.0 - ISC
|
|
368
|
+
*
|
|
369
|
+
* This source code is licensed under the ISC license.
|
|
370
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
371
|
+
*/const cP=$e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
372
|
+
* @license lucide-react v0.460.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/const Lt=$e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
377
|
+
* @license lucide-react v0.460.0 - ISC
|
|
378
|
+
*
|
|
379
|
+
* This source code is licensed under the ISC license.
|
|
380
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
+
*/const Ok=$e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
382
|
+
* @license lucide-react v0.460.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/const uP=$e("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/**
|
|
387
|
+
* @license lucide-react v0.460.0 - ISC
|
|
388
|
+
*
|
|
389
|
+
* This source code is licensed under the ISC license.
|
|
390
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
+
*/const dP=$e("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
392
|
+
* @license lucide-react v0.460.0 - ISC
|
|
393
|
+
*
|
|
394
|
+
* This source code is licensed under the ISC license.
|
|
395
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
+
*/const Us=$e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
397
|
+
* @license lucide-react v0.460.0 - ISC
|
|
398
|
+
*
|
|
399
|
+
* This source code is licensed under the ISC license.
|
|
400
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
+
*/const Sf=$e("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
402
|
+
* @license lucide-react v0.460.0 - ISC
|
|
403
|
+
*
|
|
404
|
+
* This source code is licensed under the ISC license.
|
|
405
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
+
*/const fP=$e("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
407
|
+
* @license lucide-react v0.460.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/const Eo=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
412
|
+
* @license lucide-react v0.460.0 - ISC
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the ISC license.
|
|
415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/const pP=$e("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/**
|
|
417
|
+
* @license lucide-react v0.460.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/const mP=$e("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
422
|
+
* @license lucide-react v0.460.0 - ISC
|
|
423
|
+
*
|
|
424
|
+
* This source code is licensed under the ISC license.
|
|
425
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
+
*/const hP=$e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
427
|
+
* @license lucide-react v0.460.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/const gP=$e("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
432
|
+
* @license lucide-react v0.460.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const xP=$e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
|
|
437
|
+
* @license lucide-react v0.460.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const zr=$e("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
442
|
+
* @license lucide-react v0.460.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const bw=$e("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
|
|
447
|
+
* @license lucide-react v0.460.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const vw=$e("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
452
|
+
* @license lucide-react v0.460.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const cx=$e("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
457
|
+
* @license lucide-react v0.460.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const yP=$e("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
|
|
462
|
+
* @license lucide-react v0.460.0 - ISC
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the ISC license.
|
|
465
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/const Ik=$e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
|
|
467
|
+
* @license lucide-react v0.460.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const gi=$e("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
472
|
+
* @license lucide-react v0.460.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const Tn=$e("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
477
|
+
* @license lucide-react v0.460.0 - ISC
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the ISC license.
|
|
480
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
481
|
+
*/const ux=$e("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
482
|
+
* @license lucide-react v0.460.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const bP=$e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
487
|
+
* @license lucide-react v0.460.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const vP=$e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
492
|
+
* @license lucide-react v0.460.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const dx=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function _k(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=_k(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function wP(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=_k(e))&&(s&&(s+=" "),s+=t);return s}const fx="-",jP=e=>{const t=SP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(fx);return u[0]===""&&u.length!==1&&u.shift(),Mk(u,t)||kP(c)},getConflictingClassGroupIds:(c,u)=>{const d=n[c]||[];return u&&s[c]?[...d,...s[c]]:d}}},Mk=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Mk(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(fx);return(c=t.validators.find(({validator:u})=>u(i)))==null?void 0:c.classGroupId},ww=/^\[(.+)\]$/,kP=e=>{if(ww.test(e)){const t=ww.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},SP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return CP(Object.entries(e.classGroups),n).forEach(([i,c])=>{ug(c,s,i,t)}),s},ug=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:jw(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(NP(o)){ug(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,c])=>{ug(c,jw(t,i),n,s)})})},jw=(e,t)=>{let n=e;return t.split(fx).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},NP=e=>e.isThemeGetter,CP=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([c,u])=>[t+c,u])):i);return[n,o]}):e,EP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,c)=>{n.set(i,c),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let c=n.get(i);if(c!==void 0)return c;if((c=s.get(i))!==void 0)return o(i,c),c},set(i,c){n.has(i)?n.set(i,c):o(i,c)}}},Fk="!",TP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,c=u=>{const d=[];let m=0,h=0,g;for(let v=0;v<u.length;v++){let k=u[v];if(m===0){if(k===o&&(s||u.slice(v,v+i)===t)){d.push(u.slice(h,v)),h=v+i;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=d.length===0?u:u.substring(h),b=y.startsWith(Fk),C=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:d,hasImportantModifier:b,baseClassName:C,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},RP=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},AP=e=>({cache:EP(e.cacheSize),parseClassName:TP(e),...jP(e)}),PP=/\s+/,DP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],c=e.trim().split(PP);let u="";for(let d=c.length-1;d>=0;d-=1){const m=c[d],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let C=!!b,j=s(C?y.substring(0,b):y);if(!j){if(!C){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}C=!1}const v=RP(h).join(":"),k=g?v+Fk:v,E=k+j;if(i.includes(E))continue;i.push(E);const S=o(j,C);for(let T=0;T<S.length;++T){const A=S[T];i.push(k+A)}u=m+(u.length>0?" "+u:u)}return u};function $P(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=zk(t))&&(s&&(s+=" "),s+=n);return s}const zk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=zk(e[s]))&&(n&&(n+=" "),n+=t);return n};function LP(e,...t){let n,s,o,i=c;function c(d){const m=t.reduce((h,g)=>g(h),e());return n=AP(m),s=n.cache.get,o=n.cache.set,i=u,u(d)}function u(d){const m=s(d);if(m)return m;const h=DP(d,n);return o(d,h),h}return function(){return i($P.apply(null,arguments))}}const qt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Bk=/^\[(?:([a-z-]+):)?(.+)\]$/i,OP=/^\d+\/\d+$/,IP=new Set(["px","full","screen"]),_P=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,MP=/\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$/,FP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>xi(e)||IP.has(e)||OP.test(e),fo=e=>Bi(e,"length",YP),xi=e=>!!e&&!Number.isNaN(Number(e)),lh=e=>Bi(e,"number",xi),Il=e=>!!e&&Number.isInteger(Number(e)),UP=e=>e.endsWith("%")&&xi(e.slice(0,-1)),pt=e=>Bk.test(e),po=e=>_P.test(e),VP=new Set(["length","size","percentage"]),HP=e=>Bi(e,VP,Uk),WP=e=>Bi(e,"position",Uk),KP=new Set(["image","url"]),qP=e=>Bi(e,KP,JP),GP=e=>Bi(e,"",QP),_l=()=>!0,Bi=(e,t,n)=>{const s=Bk.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},YP=e=>MP.test(e)&&!FP.test(e),Uk=()=>!1,QP=e=>zP.test(e),JP=e=>BP.test(e),XP=()=>{const e=qt("colors"),t=qt("spacing"),n=qt("blur"),s=qt("brightness"),o=qt("borderColor"),i=qt("borderRadius"),c=qt("borderSpacing"),u=qt("borderWidth"),d=qt("contrast"),m=qt("grayscale"),h=qt("hueRotate"),g=qt("invert"),y=qt("gap"),b=qt("gradientColorStops"),C=qt("gradientColorStopPositions"),j=qt("inset"),v=qt("margin"),k=qt("opacity"),E=qt("padding"),S=qt("saturate"),T=qt("scale"),A=qt("sepia"),R=qt("skew"),P=qt("space"),$=qt("translate"),M=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",pt,t],V=()=>[pt,t],K=()=>["",_s,fo],I=()=>["auto",xi,pt],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",pt],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[xi,pt];return{cacheSize:500,separator:":",theme:{colors:[_l],spacing:[_s,fo],blur:["none","",po,pt],brightness:H(),borderColor:[e],borderRadius:["none","","full",po,pt],borderSpacing:V(),borderWidth:K(),contrast:H(),grayscale:G(),hueRotate:H(),invert:G(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[UP,fo],inset:D(),margin:D(),opacity:H(),padding:V(),saturate:H(),scale:H(),sepia:G(),skew:H(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",pt]}],container:["container"],columns:[{columns:[po]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"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"],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:[...F(),pt]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Il,pt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Il,pt]}],"grid-cols":[{"grid-cols":[_l]}],"col-start-end":[{col:["auto",{span:["full",Il,pt]},pt]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[_l]}],"row-start-end":[{row:["auto",{span:[Il,pt]},pt]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",pt,t]}],"min-w":[{"min-w":[pt,t,"min","max","fit"]}],"max-w":[{"max-w":[pt,t,"none","full","min","max","fit","prose",{screen:[po]},po]}],h:[{h:[pt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",po,fo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",lh]}],"font-family":[{font:[_l]}],"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:["tighter","tight","normal","wide","wider","widest",pt]}],"line-clamp":[{"line-clamp":["none",xi,lh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_s,pt]}],"list-image":[{"list-image":["none",pt]}],"list-style-type":[{list:["none","disc","decimal",pt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_s,fo]}],"underline-offset":[{"underline-offset":["auto",_s,pt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),WP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",HP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},qP]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:q()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[_s,pt]}],"outline-w":[{outline:[_s,fo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[_s,fo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",po,GP]}],"shadow-color":[{shadow:[_l]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",po,pt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[S]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"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:["none","all","","colors","opacity","shadow","transform",pt]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",pt]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",pt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Il,pt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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",pt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",pt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_s,fo,lh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},ZP=LP(XP);function we(...e){return ZP(wP(e))}function zn(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Ur(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Vk(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Hk(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Wk(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=Math.floor((Date.now()-t.getTime())/1e3);if(n<60)return"just now";const s=Math.floor(n/60);if(s<60)return`${s}m ago`;const o=Math.floor(s/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Ri(e){return e.toLocaleString("en-US")}function Ai(e){return`$${e.toFixed(4)}`}function e3(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,s,o]=t,i=new Date(Number(n),Number(s)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Sn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function Kk(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function t3(e){let t=Kk(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":null}function qk(e,t){return t3(e)===t}function Gk(e){let n=Kk(e).split("/").filter(Boolean);const s=[];let o="Overview",i=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:Sn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:s,projectSlug:i};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),o="Projects",n[1]&&(i=n[1],s.push({label:Sn(n[1]),path:`${c}/projects/${n[1]}`}),o=Sn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:Sn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),o=Sn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",d=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:d}),s.push({label:Sn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=Sn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(o="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(o="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(o="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:Sn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(s.push({label:Sn(n[1]),path:`/playbooks/${n[1]}`}),o=Sn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(o="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:o,breadcrumbs:s,projectSlug:i}}function kw({items:e,onNavigate:t}){const n=Xn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const o=s.icon,i=qk(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ee,{to:s.to,onClick:t,className:we("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",i?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[r.jsx(o,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const Yk=[{slug:"default",label:"Syntaur",description:"Brand purple, warm yellow, coral & teal accents.",swatches:{primary:"oklch(70% 0.18 290)",secondary:"oklch(80% 0.14 75)",coral:"oklch(72% 0.17 15)",teal:"oklch(72% 0.14 185)",amber:"oklch(82% 0.16 75)"}},{slug:"ocean",label:"Midnight",description:"Deep indigo-blue with cyan accents. Inspired by One Dark Pro.",swatches:{primary:"oklch(70% 0.16 240)",secondary:"oklch(78% 0.13 200)",coral:"oklch(72% 0.18 350)",teal:"oklch(78% 0.14 195)",amber:"oklch(84% 0.15 90)"}},{slug:"forest",label:"Verdant",description:"Saturated emerald and pine on a dark olive base.",swatches:{primary:"oklch(72% 0.17 145)",secondary:"oklch(80% 0.13 110)",coral:"oklch(72% 0.17 25)",teal:"oklch(75% 0.13 175)",amber:"oklch(82% 0.16 95)"}},{slug:"sunset",label:"Ember",description:"Warm sepia surfaces with copper and amber accents.",swatches:{primary:"oklch(72% 0.18 35)",secondary:"oklch(80% 0.16 60)",coral:"oklch(72% 0.19 15)",teal:"oklch(72% 0.12 180)",amber:"oklch(86% 0.17 70)"}}],n3=Yk.map(e=>e.slug),Hd="default";function Qk(e){return typeof e=="string"&&n3.includes(e)}const Jk={preset:Hd,custom:!1};let Ql=null,Ya=null;function px(e){if(!e||typeof e!="object")return Jk;const t=e;return{preset:Qk(t.preset)?t.preset:Hd,custom:t.custom===!0}}function r3(){return Ql?Promise.resolve(Ql):Ya||(Ya=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=px(e);return Ql=t,Ya=null,t}).catch(()=>(Ya=null,Jk)),Ya)}async function s3(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const s=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(s.error??"Failed to save theme")}const n=px(await t.json());return Ql=n,n}async function o3(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=px(await e.json());return Ql=t,t}const dg="syntaur-theme",Sd="syntaur-preset",Xk=p.createContext(null);function fg(){try{const e=window.localStorage.getItem(dg);return e==="light"||e==="dark"?e:null}catch{return null}}function Zk(){try{const e=window.localStorage.getItem(Sd);return Qk(e)?e:Hd}catch{return Hd}}function eS(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function tS(e){document.documentElement.classList.toggle("dark",e==="dark")}function nS(e){document.documentElement.dataset.theme=e}function a3(){typeof document>"u"||(tS(fg()??eS()),nS(Zk()))}function i3({children:e}){const[t,n]=p.useState(()=>fg()),[s,o]=p.useState(()=>fg()??eS()),[i,c]=p.useState(()=>Zk());p.useEffect(()=>{tS(s)},[s]),p.useEffect(()=>{nS(i)},[i]),p.useEffect(()=>{let h=!1;return r3().then(g=>{if(!h&&g.preset!==i){c(g.preset);try{window.localStorage.setItem(Sd,g.preset)}catch{}}}),()=>{h=!0}},[]),p.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{t||o(h.matches?"dark":"light")};return g(),h.addEventListener("change",g),()=>{h.removeEventListener("change",g)}},[t]);async function u(h){c(h);try{window.localStorage.setItem(Sd,h)}catch{}await s3(h)}async function d(){const h=await o3();c(h.preset);try{window.localStorage.setItem(Sd,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(dg,h),n(h),o(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(dg,h),n(h),o(h)},preset:i,setPreset:u,resetPreset:d};return r.jsx(Xk.Provider,{value:m,children:e})}function mx(){const e=p.useContext(Xk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Nd=new Set;let cr=null,yi=null;function l3(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function rS(){cr&&(cr.readyState===WebSocket.OPEN||cr.readyState===WebSocket.CONNECTING)||(cr=new WebSocket(l3()),cr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Nd)n(t)}catch{}},cr.onclose=()=>{cr=null,yi&&clearTimeout(yi),yi=setTimeout(rS,2e3)},cr.onerror=()=>{cr==null||cr.close()})}function Ac(e){const t=p.useRef(e);t.current=e,p.useEffect(()=>{const n=s=>t.current(s);return Nd.add(n),rS(),()=>{Nd.delete(n),Nd.size===0&&cr&&(yi&&clearTimeout(yi),yi=null,cr.close(),cr=null)}},[])}const Nf=["7d","30d","90d","all","custom"],sS="30d",c3=/^\d{4}-\d{2}-\d{2}$/,Pc=["project","workspace","model","tool"],u3={"7d":7,"30d":30,"90d":90};function Jl(e){if(typeof e!="string"||!c3.test(e))return!1;const[t,n,s]=e.split("-").map(Number);if(n<1||n>12||s<1||s>31)return!1;const o=new Date(Date.UTC(t,n-1,s));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===s}function Sw(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${s}`}function d3(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function f3(e,t=new Date){const n=e.window??sS;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const s=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:Sw(d3(s,-(u3[n]-1))),until:Sw(s)}}function p3(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!Nf.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const s of["since","until"])n[s]!==void 0&&!Jl(n[s])&&t.push(`invalid ${s}: ${String(n[s])} (expected YYYY-MM-DD)`);for(const s of Pc)n[s]!==void 0&&(typeof n[s]!="string"||n[s].length===0)&&t.push(`invalid ${s}: must be a non-empty string`);return Jl(n.since)&&Jl(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Dc(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Nf.includes(n.window)&&(t.window=n.window),Jl(n.since)&&(t.since=n.since),Jl(n.until)&&(t.until=n.until);for(const s of Pc)typeof n[s]=="string"&&n[s].length>0&&(t[s]=n[s]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function pg(e){const t=Dc(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const s of Pc)t[s]&&n.set(s,t[s]);return n}function m3(e){const t={};for(const n of["window","since","until",...Pc]){const s=e.get(n);s!==null&&(t[n]=s)}return Dc(t)}function oS(e,t=new Date){const n=Dc(e),{since:s,until:o}=f3(n,t),i=new URLSearchParams;s&&i.set("since",s),o&&i.set("until",o);for(const c of Pc)n[c]&&i.set(c,n[c]);return i}const h3={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function Nw(e){const t=Dc(e),n=t.window??sS,s=[];return s.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:h3[n]),t.workspace&&s.push(`workspace: ${t.workspace}`),t.project&&s.push(`project: ${t.project}`),t.model&&s.push(`model: ${t.model}`),t.tool&&s.push(`tool: ${t.tool}`),s.join(" · ")}function Qt(e,t,n=!0,s=!1){const[o,i]=p.useState(null),[c,u]=p.useState(!0),[d,m]=p.useState(null),[h,g]=p.useState(0),y=n?e:null,b=p.useCallback(()=>{g(j=>j+1)},[]),C=p.useRef(y);return s&&C.current!==y&&(C.current=y,i(null),m(null)),p.useEffect(()=>{if(!y){u(!1),i(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async v=>{if(!v.ok){const k=await v.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{j||(i(v),u(!1))}).catch(v=>{j||(m(v.message),u(!1))}),()=>{j=!0}},[y,h]),Ac(j=>{!t||!y||((j.type==="project-updated"||j.type==="assignment-updated")&&b(),j.type==="servers-updated"&&t==="servers"&&b(),j.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&b(),j.type==="playbooks-updated"&&t==="playbooks"&&b(),j.type==="leases-updated"&&t==="inventories"&&b())}),{data:o,loading:c,error:d,refetch:b}}function Cs(e=!0){return Qt("/api/projects","projects",e)}function fa(){return Qt("/api/workspaces","projects")}function fn(){const{workspace:e}=Bt();return e?`/w/${e}`:""}function g3(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),s=n?`/api/overview?${n}`:"/api/overview";return Qt(s,"overview")}function Cf(e=!0){return Qt("/api/assignments","assignments",e)}function x3(e=!0){return Qt("/api/archived","assignments",e)}function aS(){return Qt("/api/help")}function iS(e){const t=e?`/api/projects/${e}`:null;return Qt(t,"project")}function y3(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return Qt(n,"assignment")}function b3(e){const t=e?`/api/assignments/${e}`:null;return Qt(t,"assignment")}function lS(e){return Qt(e)}function hx(e=!0){return Qt("/api/servers","servers",e)}function cS(){return Qt("/api/leases","inventories")}function Ef(){return Qt("/api/agent-sessions","agent-sessions")}function v3(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return Qt(n,"agent-sessions")}function w3(e){const t=e?`/api/assignments/${e}/sessions`:null;return Qt(t,"agent-sessions")}function j3(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return Qt(n,void 0,!0,!0)}function k3(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return Qt(t,void 0,!0,!0)}function gx(e=!0){return Qt("/api/playbooks","playbooks",e)}function S3(e){const t=oS(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return Qt(n,void 0,!0,!0)}function uS(e=!0){return Qt("/api/usage/facets",void 0,e)}function N3(e){const t=e?`/api/playbooks/${e}`:null;return Qt(t,"playbooks")}function C3(){return Qt("/api/memories","project")}function E3(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return Qt(n,"project")}function T3(){return Qt("/api/resources","project")}function R3(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return Qt(n,"project")}const Tf=["new-workspace","new-project","new-todo","new-assignment"];function A3(e){return typeof e=="string"&&Tf.includes(e)}const P3=["mod+k","mod+shift+k","?","escape","enter","shift+t","g","g o","g m","g a","g t","g s","g !","g ,","j","k","o","a","e","/","r","p","h","d","s","[","]"],D3=["mod","ctrl","alt","shift"];function dr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(dr).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(u=>u.toLowerCase()),i=new Set,c=[];for(const u of D3)o.includes(u)&&!i.has(u)&&(c.push(u),i.add(u));for(const u of o)i.has(u)||(c.push(u),i.add(u));return[...c,s].join("+")}function $3(e){const t=dr(e);return t?P3.includes(t):!1}const L3={"new-workspace":dr("Mod+Shift+Alt+w"),"new-project":dr("Mod+Shift+Alt+p"),"new-todo":dr("Mod+Shift+Alt+t"),"new-assignment":dr("Mod+Shift+Alt+a")};function O3(e){const t={...L3};for(const n of Tf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function na(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function I3(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function sd(e,t){const n=I3(t);if(e.key.toLowerCase()!==n.key)return!1;const o=na()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function dS(e){const t=[],n=na()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let o;s===" "||s==="Spacebar"?o="space":(s.length,o=s.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const c=[...t,o].join("+");return dr(c)}function ks(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?na()?"⌘":"Ctrl":s==="shift"?na()?"⇧":"Shift":s==="alt"?na()?"⌥":"Alt":s==="ctrl"?na()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(na()?"":"+")}function _3(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const d=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),Ac(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function fS(e=!0){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const d=await fetch("/api/todos");if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[]);return p.useEffect(()=>{if(!e){o(!1);return}u()},[u,e]),Ac(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}async function xx(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function pS(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function mS(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function hS(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function gS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function xS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function yS(e,t,n){const s=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}function yx(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function bS(e,t,n){for(const s of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function vS(e,t,n){const s=await fetch(yx(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function bx(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,c=new Error(i);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function M3(e,t){return await bx(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function F3(e){return await bx("/api/todos/promote-bulk",e)}async function z3(e,t,n){await bx(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const B3=new Set(["/projects","/assignments","/servers","/todos"]);function Cd(e,t){return B3.has(e)?`${t}${e}`:e}const U3=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function V3(e){const t=[];for(const n of U3)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:Cd(n.basePath,e.wsPrefix)});for(const n of e.projects??[]){const s=n.workspace?`/w/${n.workspace}`:"";t.push({type:"project",id:`project-${n.slug}`,title:n.title,subtitle:n.slug,keywords:n.tags,route:`${s}/projects/${n.slug}`}),t.push({type:"todo",id:`project-todos-${n.slug}`,title:`${n.title} todos`,subtitle:`${n.slug} · project`,keywords:[...n.tags??[],"project","todos"],route:`${s}/projects/${n.slug}?tab=todos`})}for(const n of e.assignments??[]){const s=n.projectWorkspace?`/w/${n.projectWorkspace}`:"";t.push({type:"assignment",id:n.projectSlug===null?`assignment-standalone-${n.id}`:`assignment-${n.projectSlug}-${n.slug}`,title:n.title,subtitle:`${n.projectTitle} · ${n.status}`,keywords:[n.projectSlug??"standalone",n.assignee??""].filter(o=>!!o),route:n.projectSlug===null?`/assignments/${n.id}`:`${s}/projects/${n.projectSlug}/assignments/${n.slug}`})}for(const n of e.playbooks??[])t.push({type:"playbook",id:`playbook-${n.slug}`,title:n.name,subtitle:n.description,keywords:n.tags,route:`/playbooks/${n.slug}`});for(const n of e.servers??[])t.push({type:"server",id:`server-${n.name}`,title:n.name,subtitle:n.alive?"alive":"dead",route:`${Cd("/servers",e.wsPrefix)}#server-${encodeURIComponent(n.name)}`});for(const n of e.todos??[]){const s=n.workspace&&n.workspace!=="_ungrouped"?`/w/${n.workspace}`:e.wsPrefix,o=Cd("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${o}?focus=${encodeURIComponent(n.id)}`})}return t}function wr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Ed(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function H3(e,t,n){const s=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${s} playbook`)}n()}async function ch(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error||`Failed to create todo (HTTP ${n.status})`)}}async function Cw(){const e=await fetch("/api/workspaces");if(!e.ok)throw new Error(`Failed to load workspaces (HTTP ${e.status})`);const t=await e.json();return{workspaces:Array.isArray(t.workspaces)?t.workspaces:[],hasUngrouped:t.hasUngrouped===!0}}async function Ew(){const e=await fetch("/api/projects");if(!e.ok)throw new Error(`Failed to load projects (HTTP ${e.status})`);const t=await e.json();return Array.isArray(t)?t:[]}async function uh(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load template (HTTP ${t.status})`);const n=await t.json();if(!n.content)throw new Error("Template returned no content");return n.content}function Yo(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
|
|
497
|
+
${t}: ${JSON.stringify(n)}
|
|
498
|
+
---
|
|
499
|
+
${e}`;const o=s[1],i=s[2],c=s[3],u=e.slice(s[0].length),d=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(i)?h=i.replace(m,`${t}: ${d}`):h=`${i}
|
|
500
|
+
${t}: ${d}`,`${o}${h}${c}${u}`}const W3=/^[a-z0-9][a-z0-9-]*$/;function K3(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:c,navigate:u,toggleTheme:d}=e,m=[];if(m.push({id:"new-workspace",title:"New Workspace",subtitle:"Create a Syntaur workspace",group:"Create",keywords:["new","create","workspace"],bindableKind:"new-workspace",flow:{steps:[{kind:"text",id:"name",label:"Workspace name",placeholder:"lowercase, hyphenated (e.g. acme-app)",required:!0,pattern:{regex:W3,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,g)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!b.ok){const C=await b.json().catch(()=>({}));throw new Error(C.error||`Failed to create workspace (HTTP ${b.status})`)}g.navigate(`/w/${y}/projects`)}}}),m.push({id:"new-project",title:"New Project",subtitle:"Create a project (pick workspace)",group:"Create",keywords:["new","create","project"],bindableKind:"new-project",flow:{steps:[{kind:"picker",id:"workspace",label:"Workspace",emptyMessage:'No workspaces yet — create one with "New Workspace"',loadOptions:async()=>{const{workspaces:h,hasUngrouped:g}=await Cw(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,g)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=wr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");let j=await uh("/api/templates/project");j=Yo(j,"slug",C),j=Yo(j,"title",b),y&&y!=="_ungrouped"&&(j=Yo(j,"workspace",y));const v=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create project (HTTP ${v.status})`);const E=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??C}`:`/projects/${k.slug??C}`;g.navigate(E)}}}),m.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:h},g]=await Promise.all([Cw(),Ew()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});for(const b of g){const C=b.workspace??"_ungrouped";y.push({value:C,label:`${b.title}`,hint:`project · ${b.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const g=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await xx(g,y)}}}),m.push({id:"new-assignment",title:"New Assignment",subtitle:"Pick standalone or a project",group:"Create",keywords:["new","create","assignment"],bindableKind:"new-assignment",flow:{steps:[{kind:"picker",id:"project",label:"Project",loadOptions:async()=>{const h=await Ew(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var S;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=wr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await uh("/api/templates/assignment?standalone=1");T=Yo(T,"slug",C),T=Yo(T,"title",b);const A=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await A.json().catch(()=>({}));if(!A.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${A.status})`);const P=((S=R==null?void 0:R.assignment)==null?void 0:S.id)??(R==null?void 0:R.id);P?g.navigate(`/assignments/${P}`):g.navigate("/assignments");return}let j=await uh("/api/templates/assignment");j=Yo(j,"slug",C),j=Yo(j,"title",b);const v=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${v.status})`);const E=k.slug??C;g.navigate(`/projects/${y}/assignments/${E}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>u(`${i}/create/project`)}),m.push({id:"create-standalone-assignment",title:"New Standalone Assignment (editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","assignment","standalone","one-off","editor"],run:()=>u(`${i}/assignments/new`)}),n&&m.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${s??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>u(`${i}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>u("/playbooks/create")}),m.push({id:"create-todo-global",title:"New Todo (global, quick)",subtitle:"Ungrouped, single-step",group:"Create",keywords:["new","create","todo","global","ungrouped","quick"],requiresInput:{placeholder:"Describe the todo…",runWithInput:async h=>{const g=h.trim();g&&await ch("_ungrouped",g)}}}),i){const h=i.replace(/^\/w\//,"");m.push({id:`create-todo-workspace-${h}`,title:`New Todo in workspace ${h}`,subtitle:h,group:"Create",keywords:["new","create","todo","workspace",h],requiresInput:{placeholder:`Describe the todo for workspace ${h}…`,runWithInput:async g=>{const y=g.trim();y&&await ch(h,y)}}})}n&&o&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${o}`,group:"Create",keywords:["new","create","todo","project",n,o],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const g=h.trim();g&&await ch(o,g)}}});for(const h of t)m.push({id:`toggle-playbook-${h.slug}`,title:`Toggle Playbook: ${h.name}`,subtitle:h.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",h.slug,...h.tags??[]],run:()=>H3(h.slug,h.enabled,c)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>d()}),m}function Zt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Tw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rf(...e){return t=>{let n=!1;const s=e.map(o=>{const i=Tw(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<s.length;o++){const i=s[o];typeof i=="function"?i():Tw(e[o],null)}}}}function qn(...e){return p.useCallback(Rf(...e),e)}function q3(e,t){const n=p.createContext(t),s=i=>{const{children:c,...u}=i,d=p.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:d,children:c})};s.displayName=e+"Provider";function o(i){const c=p.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function pa(e,t=[]){let n=[];function s(i,c){const u=p.createContext(c),d=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...C}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[d])||u,v=p.useMemo(()=>C,Object.values(C));return r.jsx(j.Provider,{value:v,children:b})};m.displayName=i+"Provider";function h(g,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[d])||u,C=p.useContext(b);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${i}\``)}return[m,h]}const o=()=>{const i=n.map(c=>p.createContext(c));return function(u){const d=(u==null?void 0:u[e])||i;return p.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return o.scopeName=e,[s,G3(o,...t)]}function G3(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const c=s.reduce((u,{useScope:d,scopeName:m})=>{const g=d(i)[`__scope${m}`];return{...u,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var jo=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Y3=ak[" useId ".trim().toString()]||(()=>{}),Q3=0;function bi(e){const[t,n]=p.useState(Y3());return jo(()=>{n(s=>s??String(Q3++))},[e]),e||(t?`radix-${t}`:"")}var J3=ak[" useInsertionEffect ".trim().toString()]||jo;function Af({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,c]=X3({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:o;{const h=p.useRef(e!==void 0);p.useEffect(()=>{const g=h.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,s])}const m=p.useCallback(h=>{var g;if(u){const y=Z3(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else i(h)},[u,e,i,c]);return[d,m]}function X3({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),o=p.useRef(n),i=p.useRef(t);return J3(()=>{i.current=t},[t]),p.useEffect(()=>{var c;o.current!==n&&((c=i.current)==null||c.call(i,n),o.current=n)},[n,o]),[n,s,i]}function Z3(e){return typeof e=="function"}function eD(e){const t=tD(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),d=u.find(rD);if(d){const m=d.props.children,h=u.map(g=>g===d?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function tD(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=oD(o),u=sD(i,o.props);return o.type!==p.Fragment&&(u.ref=s?Rf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nD=Symbol("radix.slottable");function rD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nD}function sD(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function oD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=aD.reduce((e,t)=>{const n=eD(`Primitive.${t}`),s=p.forwardRef((o,i)=>{const{asChild:c,...u}=o,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...u,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function iD(e,t){e&&Fs.flushSync(()=>e.dispatchEvent(t))}function ca(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function lD(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e);p.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var cD="DismissableLayer",mg="dismissableLayer.update",uD="dismissableLayer.pointerDownOutside",dD="dismissableLayer.focusOutside",Rw,wS=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),vx=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...d}=e,m=p.useContext(wS),[h,g]=p.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),C=qn(t,P=>g(P)),j=Array.from(m.layers),[v]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),E=h?j.indexOf(h):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,A=mD(P=>{const $=P.target,M=[...m.branches].some(_=>_.contains($));!T||M||(o==null||o(P),c==null||c(P),P.defaultPrevented||u==null||u())},y),R=hD(P=>{const $=P.target;[...m.branches].some(_=>_.contains($))||(i==null||i(P),c==null||c(P),P.defaultPrevented||u==null||u())},y);return lD(P=>{E===m.layers.size-1&&(s==null||s(P),!P.defaultPrevented&&u&&(P.preventDefault(),u()))},y),p.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Rw=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Aw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Rw)}},[h,y,n,m]),p.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Aw())},[h,m]),p.useEffect(()=>{const P=()=>b({});return document.addEventListener(mg,P),()=>document.removeEventListener(mg,P)},[]),r.jsx(vn.div,{...d,ref:C,style:{pointerEvents:S?T?"auto":"none":void 0,...e.style},onFocusCapture:Zt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Zt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Zt(e.onPointerDownCapture,A.onPointerDownCapture)})});vx.displayName=cD;var fD="DismissableLayerBranch",pD=p.forwardRef((e,t)=>{const n=p.useContext(wS),s=p.useRef(null),o=qn(t,s);return p.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(vn.div,{...e,ref:o})});pD.displayName=fD;function mD(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=u=>{if(u.target&&!s.current){let d=function(){jS(uD,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function hD(e,t=globalThis==null?void 0:globalThis.document){const n=ca(e),s=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!s.current&&jS(dD,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function Aw(){const e=new CustomEvent(mg);document.dispatchEvent(e)}function jS(e,t,n,{discrete:s}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?iD(o,i):o.dispatchEvent(i)}var dh="focusScope.autoFocusOnMount",fh="focusScope.autoFocusOnUnmount",Pw={bubbles:!1,cancelable:!0},gD="FocusScope",kS=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=e,[u,d]=p.useState(null),m=ca(o),h=ca(i),g=p.useRef(null),y=qn(t,j=>d(j)),b=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let j=function(S){if(b.paused||!u)return;const T=S.target;u.contains(T)?g.current=T:yo(g.current,{select:!0})},v=function(S){if(b.paused||!u)return;const T=S.relatedTarget;T!==null&&(u.contains(T)||yo(g.current,{select:!0}))},k=function(S){if(document.activeElement===document.body)for(const A of S)A.removedNodes.length>0&&yo(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const E=new MutationObserver(k);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),E.disconnect()}}},[s,u,b.paused]),p.useEffect(()=>{if(u){$w.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(dh,Pw);u.addEventListener(dh,m),u.dispatchEvent(k),k.defaultPrevented||(xD(jD(SS(u)),{select:!0}),document.activeElement===j&&yo(u))}return()=>{u.removeEventListener(dh,m),setTimeout(()=>{const k=new CustomEvent(fh,Pw);u.addEventListener(fh,h),u.dispatchEvent(k),k.defaultPrevented||yo(j??document.body,{select:!0}),u.removeEventListener(fh,h),$w.remove(b)},0)}}},[u,m,h,b]);const C=p.useCallback(j=>{if(!n&&!s||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const E=j.currentTarget,[S,T]=yD(E);S&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&yo(S,{select:!0})):j.shiftKey&&k===S&&(j.preventDefault(),n&&yo(T,{select:!0})):k===E&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(vn.div,{tabIndex:-1,...c,ref:y,onKeyDown:C})});kS.displayName=gD;function xD(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(yo(s,{select:t}),document.activeElement!==n)return}function yD(e){const t=SS(e),n=Dw(t,e),s=Dw(t.reverse(),e);return[n,s]}function SS(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Dw(e,t){for(const n of e)if(!bD(n,{upTo:t}))return n}function bD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function vD(e){return e instanceof HTMLInputElement&&"select"in e}function yo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vD(e)&&t&&e.select()}}var $w=wD();function wD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Lw(e,t),e.unshift(t)},remove(t){var n;e=Lw(e,t),(n=e[0])==null||n.resume()}}}function Lw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function jD(e){return e.filter(t=>t.tagName!=="A")}var kD="Portal",wx=p.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[o,i]=p.useState(!1);jo(()=>i(!0),[]);const c=n||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?$A.createPortal(r.jsx(vn.div,{...s,ref:t}),c):null});wx.displayName=kD;function SD(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var ma=e=>{const{present:t,children:n}=e,s=ND(t),o=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),i=qn(s.ref,CD(o));return typeof n=="function"||s.isPresent?p.cloneElement(o,{ref:i}):null};ma.displayName="Presence";function ND(e){const[t,n]=p.useState(),s=p.useRef(null),o=p.useRef(e),i=p.useRef("none"),c=e?"mounted":"unmounted",[u,d]=SD(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const m=od(s.current);i.current=u==="mounted"?m:"none"},[u]),jo(()=>{const m=s.current,h=o.current;if(h!==e){const y=i.current,b=od(m);e?d("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?d("UNMOUNT"):d(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),jo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=od(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(d("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},y=b=>{b.target===t&&(i.current=od(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:p.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function od(e){return(e==null?void 0:e.animationName)||"none"}function CD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ph=0;function ED(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ow()),document.body.insertAdjacentElement("beforeend",e[1]??Ow()),ph++,()=>{ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ph--}},[])}function Ow(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var bs=function(){return bs=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},bs.apply(this,arguments)};function NS(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function TD(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,i;s<o;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var Td="right-scroll-bar-position",Rd="width-before-scroll-bar",RD="with-scroll-bars-hidden",AD="--removed-body-scroll-bar-size";function mh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function PD(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var DD=typeof window<"u"?p.useLayoutEffect:p.useEffect,Iw=new WeakMap;function $D(e,t){var n=PD(null,function(s){return e.forEach(function(o){return mh(o,s)})});return DD(function(){var s=Iw.get(n);if(s){var o=new Set(s),i=new Set(e),c=n.current;o.forEach(function(u){i.has(u)||mh(u,null)}),i.forEach(function(u){o.has(u)||mh(u,c)})}Iw.set(n,e)},[e]),n}function LD(e){return e}function OD(e,t){t===void 0&&(t=LD);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var c=t(i,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(i){for(s=!0;n.length;){var c=n;n=[],c.forEach(i)}n={push:function(u){return i(u)},filter:function(){return n}}},assignMedium:function(i){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(i),c=n}var d=function(){var h=c;c=[],h.forEach(i)},m=function(){return Promise.resolve().then(d)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return o}function ID(e){e===void 0&&(e={});var t=OD(null);return t.options=bs({async:!0,ssr:!1},e),t}var CS=function(e){var t=e.sideCar,n=NS(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,bs({},n))};CS.isSideCarExport=!0;function _D(e,t){return e.useMedium(t),CS}var ES=ID(),hh=function(){},Pf=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:hh,onWheelCapture:hh,onTouchMoveCapture:hh}),o=s[0],i=s[1],c=e.forwardProps,u=e.children,d=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,C=e.noIsolation,j=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,S=e.gapMode,T=NS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=$D([n,t]),P=bs(bs({},T),o);return p.createElement(p.Fragment,null,h&&p.createElement(A,{sideCar:ES,removeScrollBar:m,shards:g,noRelative:b,noIsolation:C,inert:j,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:S}),c?p.cloneElement(p.Children.only(u),bs(bs({},P),{ref:R})):p.createElement(E,bs({},P,{className:d,ref:R}),u))});Pf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pf.classNames={fullWidth:Rd,zeroRight:Td};var MD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=MD();return t&&e.setAttribute("nonce",t),e}function zD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var UD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=FD())&&(zD(t,n),BD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},VD=function(){var e=UD();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},TS=function(){var e=VD(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},HD={left:0,top:0,right:0,gap:0},gh=function(e){return parseInt(e||"",10)||0},WD=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[gh(n),gh(s),gh(o)]},KD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return HD;var t=WD(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},qD=TS(),vi="data-scroll-locked",GD=function(e,t,n,s){var o=e.left,i=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
501
|
+
.`.concat(RD,` {
|
|
502
|
+
overflow: hidden `).concat(s,`;
|
|
503
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
504
|
+
}
|
|
505
|
+
body[`).concat(vi,`] {
|
|
506
|
+
overflow: hidden `).concat(s,`;
|
|
507
|
+
overscroll-behavior: contain;
|
|
508
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
509
|
+
padding-left: `.concat(o,`px;
|
|
510
|
+
padding-top: `).concat(i,`px;
|
|
511
|
+
padding-right: `).concat(c,`px;
|
|
512
|
+
margin-left:0;
|
|
513
|
+
margin-top:0;
|
|
514
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
515
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
.`).concat(Td,` {
|
|
519
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.`).concat(Rd,` {
|
|
523
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.`).concat(Td," .").concat(Td,` {
|
|
527
|
+
right: 0 `).concat(s,`;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
.`).concat(Rd," .").concat(Rd,` {
|
|
531
|
+
margin-right: 0 `).concat(s,`;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
body[`).concat(vi,`] {
|
|
535
|
+
`).concat(AD,": ").concat(u,`px;
|
|
536
|
+
}
|
|
537
|
+
`)},_w=function(){var e=parseInt(document.body.getAttribute(vi)||"0",10);return isFinite(e)?e:0},YD=function(){p.useEffect(function(){return document.body.setAttribute(vi,(_w()+1).toString()),function(){var e=_w()-1;e<=0?document.body.removeAttribute(vi):document.body.setAttribute(vi,e.toString())}},[])},QD=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;YD();var i=p.useMemo(function(){return KD(o)},[o]);return p.createElement(qD,{styles:GD(i,!t,o,n?"":"!important")})},hg=!1;if(typeof window<"u")try{var ad=Object.defineProperty({},"passive",{get:function(){return hg=!0,!0}});window.addEventListener("test",ad,ad),window.removeEventListener("test",ad,ad)}catch{hg=!1}var Qa=hg?{passive:!1}:!1,JD=function(e){return e.tagName==="TEXTAREA"},RS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!JD(e)&&n[t]==="visible")},XD=function(e){return RS(e,"overflowY")},ZD=function(e){return RS(e,"overflowX")},Mw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=AS(e,s);if(o){var i=PS(e,s),c=i[1],u=i[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},e$=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},t$=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},AS=function(e,t){return e==="v"?XD(t):ZD(t)},PS=function(e,t){return e==="v"?e$(t):t$(t)},n$=function(e,t){return e==="h"&&t==="rtl"?-1:1},r$=function(e,t,n,s,o){var i=n$(e,window.getComputedStyle(t).direction),c=i*s,u=n.target,d=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=PS(e,u),C=b[0],j=b[1],v=b[2],k=j-v-i*C;(C||k)&&AS(e,u)&&(g+=k,y+=C);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},id=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Fw=function(e){return[e.deltaX,e.deltaY]},zw=function(e){return e&&"current"in e?e.current:e},s$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},o$=function(e){return`
|
|
538
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
539
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
540
|
+
`)},a$=0,Ja=[];function i$(e){var t=p.useRef([]),n=p.useRef([0,0]),s=p.useRef(),o=p.useState(a$++)[0],i=p.useState(TS)[0],c=p.useRef(e);p.useEffect(function(){c.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var j=TD([e.lockRef.current],(e.shards||[]).map(zw),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=p.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=id(j),E=n.current,S="deltaX"in j?j.deltaX:E[0]-k[0],T="deltaY"in j?j.deltaY:E[1]-k[1],A,R=j.target,P=Math.abs(S)>Math.abs(T)?"h":"v";if("touches"in j&&P==="h"&&R.type==="range")return!1;var $=window.getSelection(),M=$&&$.anchorNode,_=M?M===R||M.contains(R):!1;if(_)return!1;var D=Mw(P,R);if(!D)return!0;if(D?A=P:(A=P==="v"?"h":"v",D=Mw(P,R)),!D)return!1;if(!s.current&&"changedTouches"in j&&(S||T)&&(s.current=A),!A)return!0;var V=s.current||A;return r$(V,v,j,V==="h"?S:T)},[]),d=p.useCallback(function(j){var v=j;if(!(!Ja.length||Ja[Ja.length-1]!==i)){var k="deltaY"in v?Fw(v):id(v),E=t.current.filter(function(A){return A.name===v.type&&(A.target===v.target||v.target===A.shadowParent)&&s$(A.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var S=(c.current.shards||[]).map(zw).filter(Boolean).filter(function(A){return A.contains(v.target)}),T=S.length>0?u(v,S[0]):!c.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=p.useCallback(function(j,v,k,E){var S={name:j,delta:v,target:k,should:E,shadowParent:l$(k)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(T){return T!==S})},1)},[]),h=p.useCallback(function(j){n.current=id(j),s.current=void 0},[]),g=p.useCallback(function(j){m(j.type,Fw(j),j.target,u(j,e.lockRef.current))},[]),y=p.useCallback(function(j){m(j.type,id(j),j.target,u(j,e.lockRef.current))},[]);p.useEffect(function(){return Ja.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",d,Qa),document.addEventListener("touchmove",d,Qa),document.addEventListener("touchstart",h,Qa),function(){Ja=Ja.filter(function(j){return j!==i}),document.removeEventListener("wheel",d,Qa),document.removeEventListener("touchmove",d,Qa),document.removeEventListener("touchstart",h,Qa)}},[]);var b=e.removeScrollBar,C=e.inert;return p.createElement(p.Fragment,null,C?p.createElement(i,{styles:o$(o)}):null,b?p.createElement(QD,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function l$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const c$=_D(ES,i$);var DS=p.forwardRef(function(e,t){return p.createElement(Pf,bs({},e,{ref:t,sideCar:c$}))});DS.classNames=Pf.classNames;var u$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Xa=new WeakMap,ld=new WeakMap,cd={},xh=0,$S=function(e){return e&&(e.host||$S(e.parentNode))},d$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=$S(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},f$=function(e,t,n,s){var o=d$(t,Array.isArray(e)?e:[e]);cd[n]||(cd[n]=new WeakMap);var i=cd[n],c=[],u=new Set,d=new Set(o),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};o.forEach(m);var h=function(g){!g||d.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),C=b!==null&&b!=="false",j=(Xa.get(y)||0)+1,v=(i.get(y)||0)+1;Xa.set(y,j),i.set(y,v),c.push(y),j===1&&C&&ld.set(y,!0),v===1&&y.setAttribute(n,"true"),C||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),xh++,function(){c.forEach(function(g){var y=Xa.get(g)-1,b=i.get(g)-1;Xa.set(g,y),i.set(g,b),y||(ld.has(g)||g.removeAttribute(s),ld.delete(g)),b||g.removeAttribute(n)}),xh--,xh||(Xa=new WeakMap,Xa=new WeakMap,ld=new WeakMap,cd={})}},p$=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=u$(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),f$(s,o,n,"aria-hidden")):function(){return null}};function m$(e){const t=h$(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),d=u.find(x$);if(d){const m=d.props.children,h=u.map(g=>g===d?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function h$(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=b$(o),u=y$(i,o.props);return o.type!==p.Fragment&&(u.ref=s?Rf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var g$=Symbol("radix.slottable");function x$(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===g$}function y$(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function b$(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Df="Dialog",[LS,OS]=pa(Df),[v$,cs]=LS(Df),IS=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,u=p.useRef(null),d=p.useRef(null),[m,h]=Af({prop:s,defaultProp:o??!1,onChange:i,caller:Df});return r.jsx(v$,{scope:t,triggerRef:u,contentRef:d,contentId:bi(),titleId:bi(),descriptionId:bi(),open:m,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};IS.displayName=Df;var _S="DialogTrigger",MS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(_S,n),i=qn(t,o.triggerRef);return r.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Sx(o.open),...s,ref:i,onClick:Zt(e.onClick,o.onOpenToggle)})});MS.displayName=_S;var jx="DialogPortal",[w$,FS]=LS(jx,{forceMount:void 0}),zS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=cs(jx,t);return r.jsx(w$,{scope:t,forceMount:n,children:p.Children.map(s,c=>r.jsx(ma,{present:n||i.open,children:r.jsx(wx,{asChild:!0,container:o,children:c})}))})};zS.displayName=jx;var Wd="DialogOverlay",BS=p.forwardRef((e,t)=>{const n=FS(Wd,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=cs(Wd,e.__scopeDialog);return i.modal?r.jsx(ma,{present:s||i.open,children:r.jsx(k$,{...o,ref:t})}):null});BS.displayName=Wd;var j$=m$("DialogOverlay.RemoveScroll"),k$=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(Wd,n);return r.jsx(DS,{as:j$,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(vn.div,{"data-state":Sx(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ua="DialogContent",US=p.forwardRef((e,t)=>{const n=FS(ua,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=cs(ua,e.__scopeDialog);return r.jsx(ma,{present:s||i.open,children:i.modal?r.jsx(S$,{...o,ref:t}):r.jsx(N$,{...o,ref:t})})});US.displayName=ua;var S$=p.forwardRef((e,t)=>{const n=cs(ua,e.__scopeDialog),s=p.useRef(null),o=qn(t,n.contentRef,s);return p.useEffect(()=>{const i=s.current;if(i)return p$(i)},[]),r.jsx(VS,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Zt(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Zt(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&i.preventDefault()}),onFocusOutside:Zt(e.onFocusOutside,i=>i.preventDefault())})}),N$=p.forwardRef((e,t)=>{const n=cs(ua,e.__scopeDialog),s=p.useRef(!1),o=p.useRef(!1);return r.jsx(VS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,i),i.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:i=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=i.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),VS=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=e,u=cs(ua,n),d=p.useRef(null),m=qn(t,d);return ED(),r.jsxs(r.Fragment,{children:[r.jsx(kS,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx(vx,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Sx(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(E$,{titleId:u.titleId}),r.jsx(R$,{contentRef:d,descriptionId:u.descriptionId})]})]})}),kx="DialogTitle",HS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(kx,n);return r.jsx(vn.h2,{id:o.titleId,...s,ref:t})});HS.displayName=kx;var WS="DialogDescription",KS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(WS,n);return r.jsx(vn.p,{id:o.descriptionId,...s,ref:t})});KS.displayName=WS;var qS="DialogClose",GS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(qS,n);return r.jsx(vn.button,{type:"button",...s,ref:t,onClick:Zt(e.onClick,()=>o.onOpenChange(!1))})});GS.displayName=qS;function Sx(e){return e?"open":"closed"}var YS="DialogTitleWarning",[C$,QS]=q3(YS,{contentName:ua,titleName:kx,docsSlug:"dialog"}),E$=({titleId:e})=>{const t=QS(YS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
541
|
+
|
|
542
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
543
|
+
|
|
544
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},T$="DialogDescriptionWarning",R$=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${QS(T$).contentName}}.`;return p.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},JS=IS,XS=MS,ZS=zS,Nx=BS,Cx=US,Ex=HS,Tx=KS,Rx=GS;const On=JS,A$=XS,P$=ZS,D$=Rx,e1=p.forwardRef(({className:e,...t},n)=>r.jsx(Nx,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));e1.displayName=Nx.displayName;const Rn=p.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(P$,{children:[r.jsx(e1,{}),r.jsx(Cx,{ref:s,className:we("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...n,children:t})]}));Rn.displayName=Cx.displayName;function Zn({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function Ar({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const An=p.forwardRef(({className:e,...t},n)=>r.jsx(Ex,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));An.displayName=Ex.displayName;const Hr=p.forwardRef(({className:e,...t},n)=>r.jsx(Tx,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));Hr.displayName=Tx.displayName;const $$=-1,L$=-40;function yh(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,o=-2,i=0;for(let c=0;c<e.length;c++){const u=e[c];let d=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===o+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}i>0&&(n+=Math.max(L$,i*$$)),o=s,i=0,s++,d=!0;break}else i++,s++;if(!d)return-1/0}return n}const Bw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Ax(e,t,n=50){const s=e.toLowerCase();if(!s)return t.slice(0,n).map(c=>({...c,score:0}));const i=t.map(c=>{var g;const u=yh(s,c.title.toLowerCase())*1,d=c.subtitle?yh(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?yh(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,d,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return i.sort((c,u)=>u.score!==c.score?u.score-c.score:c.title.length!==u.title.length?c.title.length-u.title.length:c.title!==u.title?c.title<u.title?-1:1:(Bw[c.type]??99)-(Bw[u.type]??99)),i.slice(0,n)}const O$={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function I$({entries:e}){const{paletteOpen:t,closePalette:n}=To(),s=zt(),[o,i]=p.useState(""),[c,u]=p.useState(0),d=p.useRef(null),m=p.useMemo(()=>Ax(o,e,50),[o,e]);p.useEffect(()=>{u(0)},[o,t]),p.useEffect(()=>{t||i("")},[t]),p.useEffect(()=>{var b;const y=(b=d.current)==null?void 0:b.querySelector(`[data-palette-idx="${c}"]`);y==null||y.scrollIntoView({block:"nearest"})},[c]);function h(y){s(y.route),n()}function g(y){if(y.key==="ArrowDown")y.preventDefault(),u(b=>Math.min(m.length-1,b+1));else if(y.key==="ArrowUp")y.preventDefault(),u(b=>Math.max(0,b-1));else if(y.key==="Enter"){y.preventDefault();const b=m[c];b&&h(b)}}return r.jsx(On,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(Rn,{className:"max-w-xl p-0 gap-0",children:[r.jsx(An,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:o,onChange:y=>i(y.target.value),onKeyDown:g,placeholder:"Search projects, assignments, playbooks, servers, todos…",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0"}),r.jsx("div",{ref:d,className:"max-h-[60vh] overflow-y-auto p-1",children:m.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:o?"No matches":"Start typing to search"}):m.map((y,b)=>{const C=b===c;return r.jsxs("button",{type:"button","data-palette-idx":b,onClick:()=>h(y),onMouseEnter:()=>u(b),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${C?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:O$[y.type]??y.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.title}),y.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:y.subtitle}):null]},y.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," open ","·"," Esc close"]}),r.jsxs("span",{children:[m.length," result",m.length===1?"":"s"]})]})]})})}function _$({label:e,onBack:t,disabled:n,stepCounter:s}){return r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-3 py-2",children:[r.jsxs("button",{type:"button",onClick:t,disabled:n,className:"inline-flex h-7 items-center gap-1 rounded border border-border/70 bg-background/60 px-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 hover:text-foreground disabled:opacity-50","aria-label":"Back",children:[r.jsx(FA,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Back"})]}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),s?r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground/80",children:["step ",s.current," of ",s.total]}):null]})}function M$({step:e,initialValue:t,disabled:n,onSubmit:s}){const[o,i]=p.useState(t??""),[c,u]=p.useState(!1),d=p.useRef(null);p.useEffect(()=>{var C;(C=d.current)==null||C.focus()},[]);const m=o.trim(),h=e.required!==!1,g=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!g;function b(C){if(C.key==="Enter"){if(C.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:d,type:"text",value:o,onChange:C=>{i(C.target.value),u(!1)},onKeyDown:b,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),c&&e.pattern&&g?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function F$({step:e,disabled:t,onSubmit:n}){const[s,o]=p.useState({phase:"loading"}),[i,c]=p.useState(""),[u,d]=p.useState(0),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null);p.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),p.useEffect(()=>{let j=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(v=>{j||o({phase:"loaded",options:v})}).catch(v=>{if(j)return;const k=v instanceof Error?v.message:"Failed to load options";o({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=p.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(v=>({type:"option",title:v.label,subtitle:v.hint,keywords:[v.value],option:v}));return Ax(i,j,100)},[s,i]);p.useEffect(()=>{d(0)},[b.length]),p.useEffect(()=>{var v;const j=(v=y.current)==null?void 0:v.querySelector(`[data-picker-idx="${u}"]`);j==null||j.scrollIntoView({block:"nearest"})},[u]);function C(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),d(v=>Math.min(b.length-1,v+1));else if(j.key==="ArrowUp")j.preventDefault(),d(v=>Math.max(0,v-1));else if(j.key==="Enter"){j.preventDefault();const v=b[u];v&&n(v.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:i,onChange:j=>c(j.target.value),onKeyDown:C,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):b.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s.options.length===0?e.emptyMessage??"No options available":"No matches"}):b.map((j,v)=>{const k=v===u;return r.jsxs("button",{type:"button","data-picker-idx":v,onClick:()=>n(j.option.value),onMouseEnter:()=>d(v),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.option.label}),j.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:j.option.hint}):null]},j.option.value)})})]})}function z$({entries:e}){var ue,ge;const t=zt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:o,bindAction:i,findConflict:c,pendingActionKind:u,consumePendingActionKind:d}=To(),[m,h]=p.useState(""),[g,y]=p.useState(0),[b,C]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(null),[S,T]=p.useState(null),[A,R]=p.useState(!1),[P,$]=p.useState(null),M=p.useRef(null),_=p.useMemo(()=>e.map(se=>({type:se.group.toLowerCase(),title:se.title,subtitle:se.subtitle,keywords:se.keywords,action:se})),[e]),D=p.useMemo(()=>Ax(m,_,50),[m,_]);p.useEffect(()=>{y(0)},[m,n]),p.useEffect(()=>{n||(h(""),C(null),v(""),E(null),T(null),R(!1),$(null))},[n]),p.useEffect(()=>{if(!n||!u)return;const se=d();if(!se)return;const ye=e.find(Se=>Se.bindableKind===se);ye&&V(ye)},[n,u]),p.useEffect(()=>{var ye;const se=(ye=M.current)==null?void 0:ye.querySelector(`[data-palette-idx="${g}"]`);se==null||se.scrollIntoView({block:"nearest"})},[g]);async function V(se){if(!A){if(se.flow&&se.flow.steps.length>0){E({action:se,stepIndex:0,values:{}}),$(null);return}if(se.requiresInput){C(se),v(""),$(null);return}if(se.run){R(!0),$(null);try{await se.run(),s()}catch(ye){$(ye instanceof Error?ye.message:"Action failed")}finally{R(!1)}}}}async function K(se){if(!k)return;const ye=k.action.flow.steps[k.stepIndex],Se={...k.values,[ye.id]:se};if(k.stepIndex+1<k.action.flow.steps.length){E({action:k.action,stepIndex:k.stepIndex+1,values:Se});return}R(!0),$(null);try{await k.action.flow.submit(Se,{navigate:t}),s()}catch(Te){$(Te instanceof Error?Te.message:"Action failed")}finally{R(!1)}}function I(){if(k&&!A){if(k.stepIndex===0){E(null),$(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),$(null)}}async function F(){if(A||!(b!=null&&b.requiresInput))return;const se=j.trim();if(se){R(!0),$(null);try{await b.requiresInput.runWithInput(se),s()}catch(ye){$(ye instanceof Error?ye.message:"Action failed")}finally{R(!1)}}}function q(se){if(se.key==="ArrowDown")se.preventDefault(),y(ye=>Math.min(D.length-1,ye+1));else if(se.key==="ArrowUp")se.preventDefault(),y(ye=>Math.max(0,ye-1));else if(se.key==="Enter"&&(se.metaKey||se.ctrlKey)){se.preventDefault();const ye=D[g];ye!=null&&ye.action.bindableKind&&T({action:ye.action,combo:null,conflict:null,saving:!1,error:null})}else if(se.key==="Enter"){se.preventDefault();const ye=D[g];ye&&V(ye.action)}}function Z(se){se.key==="Enter"?(se.preventDefault(),F()):se.key==="Escape"&&(se.preventDefault(),C(null),v(""))}function z(se){if(!S||se.key==="Escape"||se.key==="Enter"&&!S.combo)return;se.preventDefault(),se.stopPropagation();const ye=dS(se.nativeEvent);if(!ye)return;const Se=c(ye,S.action.bindableKind);T({...S,combo:ye,conflict:Se,error:null})}async function G(){var se;if(!(!S||!S.combo||!S.action.bindableKind)){if((se=S.conflict)!=null&&se.description){T({...S,error:`Reserved: ${S.conflict.description}`});return}T({...S,saving:!0,error:null});try{await i(S.action.bindableKind,S.combo),T(null)}catch(ye){T({...S,saving:!1,error:ye instanceof Error?ye.message:"Failed to save binding"})}}}const L=b!==null,H=k!==null,re=S!==null,U=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(On,{open:n,onOpenChange:se=>se?null:s(),children:r.jsxs(Rn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:se=>{if(!A){if(re){se.preventDefault(),T(null);return}if(H){se.preventDefault(),I();return}L&&(se.preventDefault(),C(null),v(""),$(null))}},children:[r.jsx(An,{className:"sr-only",children:"Actions palette"}),re&&S?r.jsxs("div",{onKeyDown:z,tabIndex:-1,autoFocus:!0,children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx(cg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",S.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:S.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:ks(S.combo)}),(ue=S.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(ge=S.conflict)!=null&&ge.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',S.conflict.kind,'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),S.error?r.jsx("div",{className:"text-sm text-destructive",children:S.error}):null]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),r.jsx("span",{children:S.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void G(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:se=>{se.key==="Enter"&&G()}})]}):H&&U&&k?r.jsxs(r.Fragment,{children:[r.jsx(_$,{label:`${k.action.title} · ${U.label}`,onBack:I,disabled:A,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),U.kind==="text"?r.jsx(M$,{step:U,initialValue:k.values[U.id],disabled:A,onSubmit:K}):r.jsx(F$,{step:U,disabled:A,onSubmit:K}),P?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:A?"Running…":""})]})]}):L?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:b.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.title})]}),r.jsx("input",{autoFocus:!0,type:"text",value:j,onChange:se=>v(se.target.value),onKeyDown:Z,placeholder:b.requiresInput.placeholder,disabled:A,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:A?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:se=>h(se.target.value),onKeyDown:q,placeholder:"Run an action: new project, new todo, toggle…",disabled:A,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsx("div",{ref:M,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:m?"No matches":"Start typing to search actions"}):D.map((se,ye)=>{const Se=ye===g,Te=se.action.bindableKind,Pe=Te?o[Te]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ye,onClick:()=>V(se.action),onMouseEnter:()=>y(ye),disabled:A,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${Se?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:se.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:se.action.title}),se.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:se.action.subtitle}):null,Pe?r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-foreground",children:ks(Pe)}):null,Te?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Ke=>{Ke.preventDefault(),Ke.stopPropagation(),T({action:se.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${Se?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(cg,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},se.action.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),r.jsx("span",{children:A?"Running…":`${D.length} action${D.length===1?"":"s"}`})]})]})]})})}const B$=[{combo:"mod+k",description:"Open command palette",scope:"global"},{combo:"mod+shift+k",description:"Open actions palette",scope:"global"},{combo:"?",description:"Show keyboard shortcuts",scope:"global"},{combo:"escape",description:"Close dialog or cancel",scope:"global"},{combo:"enter",description:"Activate selected item",scope:"global"},{combo:"shift+t",description:"Toggle light/dark theme",scope:"global"},{combo:"g",description:"Start navigation chord",scope:"global"},{combo:"g o",description:"Go to Overview",scope:"global"},{combo:"g m",description:"Go to Projects",scope:"global"},{combo:"g a",description:"Go to Assignments",scope:"global"},{combo:"g t",description:"Go to Todos",scope:"global"},{combo:"g s",description:"Go to Servers",scope:"global"},{combo:"g !",description:"Go to Attention",scope:"global"},{combo:"g ,",description:"Go to Settings",scope:"global"},{combo:"j",description:"Move selection down",scope:"list"},{combo:"k",description:"Move selection up",scope:"list"},{combo:"o",description:"Open selected item",scope:"list"},{combo:"a",description:"New assignment in project",scope:"project"},{combo:"e",description:"Edit project / assignment",scope:"project|assignment"},{combo:"/",description:"Focus search",scope:"assignments-board"},{combo:"r",description:"Refresh board",scope:"assignments-board"},{combo:"p",description:"Edit plan",scope:"assignment"},{combo:"h",description:"Append handoff",scope:"assignment"},{combo:"d",description:"Append decision record",scope:"assignment"},{combo:"s",description:"Edit scratchpad",scope:"assignment"},{combo:"[",description:"Previous assignment",scope:"assignment"},{combo:"]",description:"Next assignment",scope:"assignment"}];function U$(e){const t=dr(e);return t?B$.find(n=>n.combo===t)??null:null}const Ml={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},V$={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},H$=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function Uw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${ks(t)} then ${ks(n)}`}return ks(e)}function W$(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:o}=To(),i=p.useMemo(()=>{const d=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&d.add(dr(m));return d},[s]),c=p.useMemo(()=>{if(!e)return new Map;const d=n(),m=new Map;for(const h of d){if(i.has(dr(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,i]),u=p.useMemo(()=>{const d=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=o.find(y=>y.bindableKind===m);d.push({kind:m,combo:h,title:g?g.title:m})}return d},[s,o]);return r.jsx(On,{open:e,onOpenChange:d=>d?null:t(),children:r.jsxs(Rn,{className:"max-w-2xl",children:[r.jsx(An,{children:"Keyboard shortcuts"}),r.jsxs(Hr,{children:["Press Esc to close. ",ks("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),r.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[H$.map(d=>{const m=c.get(d);return!m||m.length===0?null:r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:V$[d]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,g)=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:h.description}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:Uw(h.keys)})]},`${d}-${h.keys}-${g}`))})]},d)}),u.length>0?r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),r.jsx("ul",{className:"space-y-1",children:u.map(d=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:d.title}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:Uw(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const Px={bindings:{},custom:!1};let Xl=null,Za=null;const gg=new Set;function t1(e){Xl=e;for(const t of gg)t(e)}function Dx(e){if(!e||typeof e!="object")return Px;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[s,o]of Object.entries(t.bindings)){if(!A3(s)||typeof o!="string"||o.trim()==="")continue;const i=dr(o);i&&(n[s]=i)}return{bindings:n,custom:t.custom===!0}}function K$(){return Xl?Promise.resolve(Xl):Za||(Za=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Dx(e);return Xl=t,Za=null,t}).catch(()=>(Za=null,Px)),Za)}function q$(){const[e,t]=p.useState(()=>Xl??Px);return p.useEffect(()=>{let n=!1;return K$().then(s=>{n||t(s)}),gg.add(t),()=>{n=!0,gg.delete(t)}},[]),e}async function Vw(e){const t={};for(const o of Tf){const i=e[o];if(typeof i!="string")continue;const c=dr(i);c&&(t[o]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save hotkey bindings")}const s=Dx(await n.json());return t1(s),s}async function G$(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Dx(await e.json());return t1(t),t}const Hw=1500;function Y$(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const n1=p.createContext(null);function Q$({children:e}){const{toggleTheme:t}=mx(),n=Xn(),s=zt(),o=Y$(n.pathname),[i,c]=p.useState(!1),u=Cs(i),d=Cf(i),m=gx(i),h=hx(i),g=fS(i),y=p.useMemo(()=>{var Ze,Je,Ot,yt;const X=u.data??[],Me=((Ze=d.data)==null?void 0:Ze.assignments)??[],Ce=((Je=m.data)==null?void 0:Je.playbooks)??[],Ie=((Ot=h.data)==null?void 0:Ot.sessions)??[],Fe=(((yt=g.data)==null?void 0:yt.workspaces)??[]).flatMap(dt=>dt.items.map(le=>({...le,workspace:dt.workspace})));return V3({projects:X,assignments:Me,playbooks:Ce,servers:Ie,todos:Fe,wsPrefix:o})},[u.data,d.data,m.data,h.data,g.data,o]),C=p.useMemo(()=>Gk(n.pathname),[n.pathname]).projectSlug,j=p.useMemo(()=>{var X;return C?((X=u.data)==null?void 0:X.find(Me=>Me.slug===C))??null:null},[u.data,C]),v=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,E=p.useMemo(()=>{var X;return K3({playbooks:((X=m.data)==null?void 0:X.playbooks)??[],projectSlug:C,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:o,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,C,v,k,o,s,t]),S=p.useRef(new Map),T=p.useRef(["global"]),A=p.useRef({phase:"idle"}),R=p.useRef(null),P=p.useRef(1),[$,M]=p.useState(!1),[_,D]=p.useState(!1),[V,K]=p.useState(!1),[I,F]=p.useState(null);p.useEffect(()=>{($||V)&&c(!0)},[$,V]);const{bindings:q}=q$(),Z=p.useMemo(()=>O3(q),[q]),z=p.useCallback(X=>{const Me=P.current++;return S.current.set(Me,{...X,id:Me}),Me},[]),G=p.useCallback(X=>{S.current.delete(X)},[]),L=p.useCallback(X=>{T.current.push(X)},[]),H=p.useCallback(X=>{const Me=T.current;for(let Ce=Me.length-1;Ce>=0;Ce--)if(Me[Ce]===X){Me.splice(Ce,1);return}},[]),re=p.useCallback(()=>M(!0),[]),U=p.useCallback(()=>M(!1),[]),ue=p.useCallback(()=>D(!0),[]),ge=p.useCallback(()=>D(!1),[]),se=p.useCallback(()=>K(!0),[]),ye=p.useCallback(()=>{K(!1),F(null)},[]),Se=p.useCallback(()=>Array.from(S.current.values()),[]),Te=p.useCallback(()=>{let X=null;return F(Me=>(X=Me,null)),X},[]),Pe=p.useCallback(X=>{F(X),K(!0)},[]),Ke=p.useCallback((X,Me)=>{const Ce=dr(X);if(!Ce)return null;if($3(Ce)){const Ie=U$(Ce);return{description:(Ie==null?void 0:Ie.description)??"Reserved built-in shortcut"}}for(const[Ie,Ye]of Object.entries(Z))if(!(Me&&Ie===Me)&&Ye===Ce)return{kind:Ie};return null},[Z]),ct=p.useCallback(async(X,Me)=>{const Ce=dr(Me);if(!Ce)throw new Error("Empty combo");const Ie=Ke(Ce,X);if(Ie){const Fe=Ie.description?`Reserved: ${Ie.description}`:`Already bound to "${Ie.kind}"`;throw new Error(Fe)}const Ye={...q,[X]:Ce};return await Vw(Ye),Ce},[q,Ke]),et=p.useCallback(async X=>{if(!q[X])return;const Me={...q};delete Me[X],await Vw(Me)},[q]);p.useEffect(()=>{A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),p.useEffect(()=>{function X(Fe){if(!(Fe instanceof HTMLElement))return!1;const Ze=Fe.tagName;return!!(Ze==="INPUT"||Ze==="TEXTAREA"||Ze==="SELECT"||Fe.isContentEditable||Fe.closest('[role="combobox"], [role="textbox"]'))}function Me(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Ce(){const Fe=T.current;return Fe[Fe.length-1]??"global"}function Ie(Fe){return Fe.scope==="global"?!0:Fe.scope===Ce()}function Ye(Fe){const Ze=sd(Fe,"Mod+k"),Je=sd(Fe,"Mod+Shift+k"),Ot=Fe.key==="Escape",yt=Ze||Je||Ot;if(Me()&&!yt||X(Fe.target)&&!yt)return;const dt=A.current;if(dt.phase==="awaiting-second")if(Date.now()-dt.startedAt>Hw)A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const fe=Array.from(S.current.values());for(const ne of fe){if(!Ie(ne))continue;const he=ne.keys.split(" ");if(!(he.length!==2||he[0]!=="g")&&sd(Fe,he[1])&&!(ne.when&&!ne.when())){Fe.preventDefault(),A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),ne.handler(Fe);return}}A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(S.current.values());for(const Y of le){if(!Ie(Y))continue;const fe=Y.keys.split(" ");if(fe.length===1&&sd(Fe,fe[0])&&!(Y.when&&!Y.when())){Fe.preventDefault(),Y.handler(Fe);return}}Fe.key==="g"&&!Fe.metaKey&&!Fe.ctrlKey&&!Fe.altKey&&!Fe.shiftKey&&Array.from(S.current.values()).some(fe=>Ie(fe)&&fe.keys.startsWith("g "))&&(Fe.preventDefault(),A.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{A.current={phase:"idle"},R.current=null},Hw))}return window.addEventListener("keydown",Ye),()=>{window.removeEventListener("keydown",Ye),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),p.useEffect(()=>{const X=z({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>G(X)},[z,G,t]),p.useEffect(()=>{const X=z({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>G(X)},[z,G,ue]),p.useEffect(()=>{const X=z({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if($){U();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||re()}});return()=>G(X)},[z,G,re,U,$]),p.useEffect(()=>{const X=z({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(V){ye();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||se()}});return()=>G(X)},[z,G,se,ye,V]),p.useEffect(()=>{const Me=[{suffix:"o",basePath:"/",desc:"Go to Overview"},{suffix:"m",basePath:"/projects",desc:"Go to Projects"},{suffix:"a",basePath:"/assignments",desc:"Go to Assignments"},{suffix:"t",basePath:"/todos",desc:"Go to Todos"},{suffix:"s",basePath:"/servers",desc:"Go to Servers"},{suffix:",",basePath:"/settings",desc:"Go to Settings"}].map(Ce=>z({keys:`g ${Ce.suffix}`,scope:"global",description:Ce.desc,handler:()=>s(Cd(Ce.basePath,o))}));return()=>Me.forEach(G)},[z,G,s,o]),p.useEffect(()=>{const X=[];for(const[Me,Ce]of Object.entries(Z)){if(!Ce)continue;const Ie=E.find(Fe=>Fe.bindableKind===Me),Ye=Ie?`Custom: ${Ie.title}`:`Custom: ${Me}`;X.push(z({keys:Ce,scope:"global",description:Ye,handler:()=>{F(Me),K(!0)}}))}return()=>X.forEach(G)},[z,G,Z,E]);const ot=p.useMemo(()=>({register:z,unregister:G,pushScope:L,popScope:H,openPalette:re,closePalette:U,paletteOpen:$,openCheatsheet:ue,closeCheatsheet:ge,cheatsheetOpen:_,openActionsPalette:se,closeActionsPalette:ye,actionsPaletteOpen:V,listBindings:Se,wsPrefix:o,paletteEntries:y,actionEntries:E,userBindings:q,customBindings:Z,bindAction:ct,unbindAction:et,findConflict:Ke,openActionsPaletteWithAction:Pe,pendingActionKind:I,consumePendingActionKind:Te}),[z,G,L,H,re,U,$,ue,ge,_,se,ye,V,Se,o,y,E,q,Z,ct,et,Ke,Pe,I,Te]);return r.jsxs(n1.Provider,{value:ot,children:[e,r.jsx(I$,{entries:y}),r.jsx(z$,{entries:E}),r.jsx(W$,{})]})}function To(){const e=p.useContext(n1);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Yt({keys:e,handler:t,scope:n="global",description:s,when:o,enabled:i=!0}){const{register:c,unregister:u}=To(),d=p.useRef(t),m=p.useRef(o);p.useEffect(()=>{d.current=t,m.current=o},[t,o]),p.useEffect(()=>{if(!i)return;const h=c({keys:e,handler:g=>d.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,i])}function Ro(e){const{pushScope:t,popScope:n}=To();p.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function $c(e,t){const[n,s]=p.useState(e.length===0?-1:0),o=Xn();p.useEffect(()=>{s(e.length===0?-1:0)},[o.pathname]),p.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),p.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const d=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",d===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Yt({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Yt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Yt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Yt({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const i=p.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function J$({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const o=fn(),{resolvedTheme:i,toggleTheme:c}=mx(),{openPalette:u}=To();return r.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/70 bg-card/80 text-foreground lg:hidden","aria-label":"Open navigation",children:r.jsx(iP,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?r.jsxs("nav",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-[0.1em] text-muted-foreground",children:[t.slice(0,-1).map((d,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Ee,{to:d.path,className:"hover:text-foreground",children:d.label})]},d.path)),r.jsx("span",{children:"/"})]}):null,r.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:u,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(Eo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:ks("Mod+k")})]}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ee,{className:"shell-action",to:`${o}/create/project`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ee,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}):null,r.jsxs("button",{type:"button",onClick:c,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?r.jsx(yP,{className:"h-4 w-4"}):r.jsx(lP,{className:"h-4 w-4"}),r.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const Kd="_ungrouped",X$=256;function Z$(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const o=s.trim();o.length!==0&&(o.length>X$||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function eL(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function tL(e,t){return t.includes(e)}const $x={hidden:[],custom:!1};let zs=null,Jo=null,mc=0;const xg=new Set;function r1(e){zs=e;for(const t of xg)t(e)}function Lx(e){if(!e||typeof e!="object")return $x;const t=e;return{hidden:Z$(t.hidden),custom:t.custom===!0}}function nL(){if(zs)return Promise.resolve({value:zs,ok:!0});if(Jo)return Jo;const e=++mc;return Jo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Jo=null;const n=Lx(t);return e!==mc?{value:zs??n,ok:!0}:(zs=n,{value:n,ok:!0})}).catch(()=>(Jo=null,{value:$x,ok:!1})),Jo}function s1(){const[e,t]=p.useState(()=>zs??$x),[n,s]=p.useState(()=>zs===null),[o,i]=p.useState(!1),[c,u]=p.useState(0);p.useEffect(()=>{let m=!1;return s(zs===null),nL().then(h=>{m||(t(h.value),s(!1),i(!h.ok))}),xg.add(t),()=>{m=!0,xg.delete(t)}},[c]);function d(){rL(),u(m=>m+1)}return{...e,loading:n,error:o,reload:d}}function rL(){zs=null,Jo=null,++mc}async function sL(e){++mc;const t=await fetch("/api/config/workspace-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=Lx(await t.json());return r1(n),n}async function oL(){++mc;const e=await fetch("/api/config/workspace-visibility",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=Lx(await e.json());return r1(t),t}var aL=Symbol("radix.slottable");function iL(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=aL,t}var o1="AlertDialog",[lL]=pa(o1,[OS]),Ws=OS(),a1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ws(t);return r.jsx(JS,{...s,...n,modal:!0})};a1.displayName=o1;var cL="AlertDialogTrigger",uL=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ws(n);return r.jsx(XS,{...o,...s,ref:t})});uL.displayName=cL;var dL="AlertDialogPortal",i1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ws(t);return r.jsx(ZS,{...s,...n})};i1.displayName=dL;var fL="AlertDialogOverlay",l1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ws(n);return r.jsx(Nx,{...o,...s,ref:t})});l1.displayName=fL;var wi="AlertDialogContent",[pL,mL]=lL(wi),hL=iL("AlertDialogContent"),c1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,i=Ws(n),c=p.useRef(null),u=qn(t,c),d=p.useRef(null);return r.jsx(C$,{contentName:wi,titleName:u1,docsSlug:"alert-dialog",children:r.jsx(pL,{scope:n,cancelRef:d,children:r.jsxs(Cx,{role:"alertdialog",...i,...o,ref:u,onOpenAutoFocus:Zt(o.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=d.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(hL,{children:s}),r.jsx(xL,{contentRef:c})]})})})});c1.displayName=wi;var u1="AlertDialogTitle",d1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ws(n);return r.jsx(Ex,{...o,...s,ref:t})});d1.displayName=u1;var f1="AlertDialogDescription",p1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ws(n);return r.jsx(Tx,{...o,...s,ref:t})});p1.displayName=f1;var gL="AlertDialogAction",m1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ws(n);return r.jsx(Rx,{...o,...s,ref:t})});m1.displayName=gL;var h1="AlertDialogCancel",g1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=mL(h1,n),i=Ws(n),c=qn(t,o);return r.jsx(Rx,{...i,...s,ref:c})});g1.displayName=h1;var xL=({contentRef:e})=>{const t=`\`${wi}\` requires a description for the component to be accessible for screen reader users.
|
|
545
|
+
|
|
546
|
+
You can add a description to the \`${wi}\` by passing a \`${f1}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
547
|
+
|
|
548
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${wi}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
549
|
+
|
|
550
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return p.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yL=a1,bL=i1,x1=l1,y1=c1,b1=m1,v1=g1,w1=d1,j1=p1;const di=yL,vL=bL,k1=p.forwardRef(({className:e,...t},n)=>r.jsx(x1,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));k1.displayName=x1.displayName;const ra=p.forwardRef(({className:e,...t},n)=>r.jsxs(vL,{children:[r.jsx(k1,{}),r.jsx(y1,{ref:n,className:we("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...t})]}));ra.displayName=y1.displayName;function fi({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function pi({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const sa=p.forwardRef(({className:e,...t},n)=>r.jsx(w1,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));sa.displayName=w1.displayName;const oa=p.forwardRef(({className:e,...t},n)=>r.jsx(j1,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));oa.displayName=j1.displayName;const vo=p.forwardRef(({className:e,...t},n)=>r.jsx(b1,{ref:n,className:we(e),...t}));vo.displayName=b1.displayName;const hc=p.forwardRef(({className:e,...t},n)=>r.jsx(v1,{ref:n,className:we(e),...t}));hc.displayName=v1.displayName;const wL=[{to:"/",label:"Overview",icon:Pk},{to:"/playbooks",label:"Playbooks",icon:Tk},{to:"/memories",label:"Memories",icon:MA},{to:"/resources",label:"Resources",icon:tP},{to:"/inventories",label:"Inventories",icon:kf},{to:"/usage",label:"Usage",icon:Rc},{to:"/todos",label:"Todos",icon:zr},{to:"/views",label:"Saved Views",icon:$k},{to:"/archive",label:"Archive",icon:wf}],jL=[{suffix:"/projects",label:"Projects",icon:sx},{suffix:"/assignments",label:"Assignments",icon:sP},{suffix:"/servers",label:"Servers",icon:lx},{suffix:"/inventories",label:"Inventories",icon:kf},{suffix:"/usage",label:"Usage",icon:Rc},{suffix:"/agent-sessions",label:"Agent Sessions",icon:vf},{suffix:"/todos",label:"Todos",icon:zr}],kL=[{to:"/help",label:"Help",icon:nP},{to:"/settings",label:"Settings",icon:gP}];function SL({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:o}){const[i,c]=p.useState(!1);return Yt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(Ww,{activeWorkspace:s})}),i?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Ee,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>c(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx(dx,{className:"h-4 w-4"})})]}),r.jsx(Ww,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(J$,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>c(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:o})]})]})})}function Ww({activeWorkspace:e,onNavigate:t}){const{data:n}=fa(),s=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=s1(),c=Xn(),[u,d]=p.useState(new Set),[m,h]=p.useState(!1),[g,y]=p.useState(""),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(!1),A=zt();function R(_){d(D=>{const V=new Set(D);return V.has(_)?V.delete(_):V.add(_),V})}const P=eL([...s,...o?[Kd]:[]],i);async function $(_){if(j){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(j)}${_?"?cascade=true":""}`,V=await fetch(D,{method:"DELETE"});if(V.status===409){const K=await V.json().catch(()=>({}));E((K==null?void 0:K.blockedBy)??{projects:[],standalones:[]});return}if(!V.ok){const K=await V.json().catch(()=>({}));throw new Error(K.error||"Failed to delete workspace")}v(null),E(null)}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to delete workspace")}finally{T(!1)}}}async function M(_,D){try{if(_.type==="project"){const V=await fetch(`/api/projects/${encodeURIComponent(_.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!V.ok){const K=await V.json().catch(()=>({}));throw new Error(K.error||"Failed to move project")}return}if(_.type==="standalone-assignment"){const V=await fetch(`/api/assignments/${encodeURIComponent(_.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!V.ok){const K=await V.json().catch(()=>({}));throw new Error(K.error||"Failed to move assignment")}return}if(_.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(V){console.error(V),alert(V instanceof Error?V.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Ee,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:r.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),r.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),r.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),r.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(kw,{items:wL,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[P.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),P.map(_=>{const D=_==="_ungrouped",V=D?"Ungrouped":Sn(_),K=D?"/w/_ungrouped":`/w/${_}`,I=u.has(_),F=e===_||e===null&&D&&c.pathname.startsWith("/w/_ungrouped"),q=b===_;return r.jsxs("div",{className:`rounded-md transition ${q?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:Z=>{Z.dataTransfer.types.includes("application/json")&&(Z.preventDefault(),Z.dataTransfer.dropEffect="move",C(_))},onDragLeave:Z=>{Z.currentTarget.contains(Z.relatedTarget)||C(z=>z===_?null:z)},onDrop:async Z=>{try{const z=Z.dataTransfer.getData("application/json");if(!z)return;Z.preventDefault();let G;try{G=JSON.parse(z)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await M(G,D?null:_)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(_),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${F?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(pr,{className:`h-3 w-3 transition-transform ${I?"-rotate-90":""}`}),V]}),D?null:r.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),v(_),E(null)},title:`Delete workspace "${_}"`,"aria-label":`Delete workspace "${_}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(Tn,{className:"h-3 w-3"})})]}),!I&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:jL.map(Z=>{const z=`${K}${Z.suffix}`,G=qk(c.pathname,Z.suffix)&&c.pathname.startsWith(K),L=Z.icon;return r.jsxs(Ee,{to:z,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${G?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(L,{className:"h-4 w-4"}),r.jsx("span",{children:Z.label})]},z)})})]},_)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:_=>{_.preventDefault();const D=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");D&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}).then(()=>{t==null||t(),A(`/w/${D}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:_=>y(_.target.value),onKeyDown:_=>{_.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(Lt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(kw,{items:kL,onNavigate:t}),r.jsx(di,{open:j!==null,onOpenChange:_=>{S||_||(v(null),E(null))},children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsx(sa,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(oa,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(_=>r.jsx("li",{children:r.jsx(Ee,{to:`/projects/${_}`,className:"hover:underline",children:_})},_))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(_=>r.jsx("li",{children:r.jsx(Ee,{to:`/assignments/${_}`,className:"hover:underline",children:_})},_))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',r.jsx("code",{children:"workspace:"})," / ",r.jsx("code",{children:"workspaceGroup:"})," to ",r.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,r.jsxs(pi,{children:[r.jsx(hc,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(vo,{disabled:S,onClick:_=>{_.preventDefault(),$(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Clear references and delete"}):r.jsx(vo,{disabled:S,onClick:_=>{_.preventDefault(),$(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Delete"})]})]})})]})}function NL(){const e=Xn(),{workspace:t}=Bt(),{title:n,breadcrumbs:s,projectSlug:o}=Gk(e.pathname);return r.jsx(SL,{title:n,breadcrumbs:s,projectSlug:o,workspace:t??null,children:r.jsx(QR,{})})}function CL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>s=>{t.forEach(o=>o(s))},t)}const $f=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ui(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ox(e){return"nodeType"in e}function er(e){var t,n;return e?Ui(e)?e:Ox(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Ix(e){const{Document:t}=er(e);return e instanceof t}function Lc(e){return Ui(e)?!1:e instanceof er(e).HTMLElement}function S1(e){return e instanceof er(e).SVGElement}function Vi(e){return e?Ui(e)?e.document:Ox(e)?Ix(e)?e:Lc(e)||S1(e)?e.ownerDocument:document:document:document}const ns=$f?p.useLayoutEffect:p.useEffect;function Lf(e){const t=p.useRef(e);return ns(()=>{t.current=e}),p.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function EL(){const e=p.useRef(null),t=p.useCallback((s,o)=>{e.current=setInterval(s,o)},[]),n=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function gc(e,t){t===void 0&&(t=[e]);const n=p.useRef(e);return ns(()=>{n.current!==e&&(n.current=e)},t),n}function Oc(e,t){const n=p.useRef();return p.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function qd(e){const t=Lf(e),n=p.useRef(null),s=p.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,s]}function Gd(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let bh={};function Ic(e,t){return p.useMemo(()=>{if(t)return t;const n=bh[e]==null?0:bh[e]+1;return bh[e]=n,e+"-"+n},[e,t])}function N1(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return s.reduce((i,c)=>{const u=Object.entries(c);for(const[d,m]of u){const h=i[d];h!=null&&(i[d]=h+e*m)}return i},{...t})}}const ji=N1(1),xc=N1(-1);function TL(e){return"clientX"in e&&"clientY"in e}function Of(e){if(!e)return!1;const{KeyboardEvent:t}=er(e.target);return t&&e instanceof t}function RL(e){if(!e)return!1;const{TouchEvent:t}=er(e.target);return t&&e instanceof t}function Yd(e){if(RL(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return TL(e)?{x:e.clientX,y:e.clientY}:null}const rs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[rs.Translate.toString(e),rs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Kw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AL(e){return e.matches(Kw)?e:e.querySelector(Kw)}const PL={display:"none"};function DL(e){let{id:t,value:n}=e;return Dt.createElement("div",{id:t,style:PL},n)}function $L(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Dt.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function LL(){const[e,t]=p.useState("");return{announce:p.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const C1=p.createContext(null);function OL(e){const t=p.useContext(C1);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function IL(){const[e]=p.useState(()=>new Set),t=p.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[p.useCallback(s=>{let{type:o,event:i}=s;e.forEach(c=>{var u;return(u=c[o])==null?void 0:u.call(c,i)})},[e]),t]}const _L={draggable:`
|
|
551
|
+
To pick up a draggable item, press the space bar.
|
|
552
|
+
While dragging, use the arrow keys to move the item.
|
|
553
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
554
|
+
`},ML={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function FL(e){let{announcements:t=ML,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=_L}=e;const{announce:i,announcement:c}=LL(),u=Ic("DndLiveRegion"),[d,m]=p.useState(!1);if(p.useEffect(()=>{m(!0)},[]),OL(p.useMemo(()=>({onDragStart(g){let{active:y}=g;i(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&i(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;i(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;i(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;i(t.onDragCancel({active:y,over:b}))}}),[i,t])),!d)return null;const h=Dt.createElement(Dt.Fragment,null,Dt.createElement(DL,{id:s,value:o.draggable}),Dt.createElement($L,{id:u,announcement:c}));return n?Fs.createPortal(h,n):h}var Nn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Nn||(Nn={}));function Qd(){}function ko(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function If(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const ss=Object.freeze({x:0,y:0});function E1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zL(e,t){const n=Yd(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function T1(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function BL(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function qw(e){let{left:t,top:n,height:s,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+s},{x:t+o,y:n+s}]}function R1(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Gw(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const _f=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=Gw(t,t.left,t.top),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=E1(Gw(d),o);i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(T1)},UL=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=qw(t),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=qw(d),h=o.reduce((y,b,C)=>y+E1(m[C],b),0),g=Number((h/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:g}})}}return i.sort(T1)};function VL(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=o-s,u=i-n;if(s<o&&n<i){const d=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(d+m-h);return Number(g.toFixed(4))}return 0}const HL=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=[];for(const i of s){const{id:c}=i,u=n.get(c);if(u){const d=VL(u,t);d>0&&o.push({id:c,data:{droppableContainer:i,value:d}})}}return o.sort(BL)};function WL(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function A1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ss}function KL(e){return function(n){for(var s=arguments.length,o=new Array(s>1?s-1:0),i=1;i<s;i++)o[i-1]=arguments[i];return o.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const qL=KL(1);function P1(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function GL(e,t,n){const s=P1(t);if(!s)return e;const{scaleX:o,scaleY:i,x:c,y:u}=s,d=e.left-c-(1-o)*parseFloat(n),m=e.top-u-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=o?e.width/o:e.width,g=i?e.height/i:e.height;return{width:h,height:g,top:m,right:d+h,bottom:m+g,left:d}}const YL={ignoreTransform:!1};function Hi(e,t){t===void 0&&(t=YL);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=er(e).getComputedStyle(e);m&&(n=GL(n,m,h))}const{top:s,left:o,width:i,height:c,bottom:u,right:d}=n;return{top:s,left:o,width:i,height:c,bottom:u,right:d}}function Yw(e){return Hi(e,{ignoreTransform:!0})}function QL(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function JL(e,t){return t===void 0&&(t=er(e).getComputedStyle(e)),t.position==="fixed"}function XL(e,t){t===void 0&&(t=er(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Mf(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(Ix(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Lc(o)||S1(o)||n.includes(o))return n;const i=er(e).getComputedStyle(o);return o!==e&&XL(o,i)&&n.push(o),JL(o,i)?n:s(o.parentNode)}return e?s(e):n}function D1(e){const[t]=Mf(e,1);return t??null}function vh(e){return!$f||!e?null:Ui(e)?e:Ox(e)?Ix(e)||e===Vi(e).scrollingElement?window:Lc(e)?e:null:null}function $1(e){return Ui(e)?e.scrollX:e.scrollLeft}function L1(e){return Ui(e)?e.scrollY:e.scrollTop}function yg(e){return{x:$1(e),y:L1(e)}}var Ln;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ln||(Ln={}));function O1(e){return!$f||!e?!1:e===document.scrollingElement}function I1(e){const t={x:0,y:0},n=O1(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:o,isLeft:i,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const ZL={x:.2,y:.2};function e4(e,t,n,s,o){let{top:i,left:c,right:u,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=ZL);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=I1(e),b={x:0,y:0},C={x:0,y:0},j={height:t.height*o.y,width:t.width*o.x};return!m&&i<=t.top+j.height?(b.y=Ln.Backward,C.y=s*Math.abs((t.top+j.height-i)/j.height)):!h&&d>=t.bottom-j.height&&(b.y=Ln.Forward,C.y=s*Math.abs((t.bottom-j.height-d)/j.height)),!y&&u>=t.right-j.width?(b.x=Ln.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Ln.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function t4(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:s,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:o,width:e.clientWidth,height:e.clientHeight}}function _1(e){return e.reduce((t,n)=>ji(t,yg(n)),ss)}function n4(e){return e.reduce((t,n)=>t+$1(n),0)}function r4(e){return e.reduce((t,n)=>t+L1(n),0)}function M1(e,t){if(t===void 0&&(t=Hi),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);D1(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const s4=[["x",["left","right"],n4],["y",["top","bottom"],r4]];class _x{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Mf(n),o=_1(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of s4)for(const d of c)Object.defineProperty(this,d,{get:()=>{const m=u(s),h=o[i]-m;return this.rect[d]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Zl{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var o;(o=this.target)==null||o.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function o4(e){const{EventTarget:t}=er(e);return e instanceof t?e:Vi(e)}function wh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Mr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Mr||(Mr={}));function Qw(e){e.preventDefault()}function a4(e){e.stopPropagation()}var wt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(wt||(wt={}));const F1={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},i4=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case wt.Right:return{...n,x:n.x+25};case wt.Left:return{...n,x:n.x-25};case wt.Down:return{...n,y:n.y+25};case wt.Up:return{...n,y:n.y-25}}};class Wi{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Zl(Vi(n)),this.windowListeners=new Zl(er(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Mr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&M1(s),n(ss)}handleKeyDown(t){if(Of(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=F1,coordinateGetter:c=i4,scrollBehavior:u="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:ss;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=xc(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const v=t.code,{isTop:k,isRight:E,isLeft:S,isBottom:T,maxScroll:A,minScroll:R}=I1(j),P=t4(j),$={x:Math.min(v===wt.Right?P.right-P.width/2:P.right,Math.max(v===wt.Right?P.left:P.left+P.width/2,g.x)),y:Math.min(v===wt.Down?P.bottom-P.height/2:P.bottom,Math.max(v===wt.Down?P.top:P.top+P.height/2,g.y))},M=v===wt.Right&&!E||v===wt.Left&&!S,_=v===wt.Down&&!T||v===wt.Up&&!k;if(M&&$.x!==g.x){const D=j.scrollLeft+y.x,V=v===wt.Right&&D<=A.x||v===wt.Left&&D>=R.x;if(V&&!y.y){j.scrollTo({left:D,behavior:u});return}V?b.x=j.scrollLeft-D:b.x=v===wt.Right?j.scrollLeft-A.x:j.scrollLeft-R.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(_&&$.y!==g.y){const D=j.scrollTop+y.y,V=v===wt.Down&&D<=A.y||v===wt.Up&&D>=R.y;if(V&&!y.x){j.scrollTo({top:D,behavior:u});return}V?b.y=j.scrollTop-D:b.y=v===wt.Down?j.scrollTop-A.y:j.scrollTop-R.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,ji(xc(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Wi.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=F1,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=i.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Jw(e){return!!(e&&"distance"in e)}function Xw(e){return!!(e&&"delay"in e)}class Mx{constructor(t,n,s){var o;s===void 0&&(s=o4(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=Vi(c),this.documentListeners=new Zl(this.document),this.listeners=new Zl(s),this.windowListeners=new Zl(er(c)),this.initialCoordinates=(o=Yd(i))!=null?o:ss,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.DragStart,Qw),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),this.windowListeners.add(Mr.ContextMenu,Qw),this.documentListeners.add(Mr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Xw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Jw(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Mr.Click,a4,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Mr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:u}}=i;if(!o)return;const d=(n=Yd(t))!=null?n:ss,m=xc(o,d);if(!s&&u){if(Jw(u)){if(u.tolerance!=null&&wh(m,u.tolerance))return this.handleCancel();if(wh(m,u.distance))return this.handleStart()}if(Xw(u)&&wh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===wt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l4={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ki extends Mx{constructor(t){const{event:n}=t,s=Vi(n.target);super(t,l4,s)}}Ki.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const c4={move:{name:"mousemove"},end:{name:"mouseup"}};var bg;(function(e){e[e.RightClick=2]="RightClick"})(bg||(bg={}));class u4 extends Mx{constructor(t){super(t,c4,Vi(t.event.target))}}u4.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===bg.RightClick?!1:(s==null||s({event:n}),!0)}}];const jh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class d4 extends Mx{constructor(t){super(t,jh)}static setup(){return window.addEventListener(jh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(jh.move.name,t)};function t(){}}}d4.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:o}=n;return o.length>1?!1:(s==null||s({event:n}),!0)}}];var ec;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ec||(ec={}));var Jd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Jd||(Jd={}));function f4(e){let{acceleration:t,activator:n=ec.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:c=5,order:u=Jd.TreeOrder,pointerCoordinates:d,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=m4({delta:g,disabled:!i}),[C,j]=EL(),v=p.useRef({x:0,y:0}),k=p.useRef({x:0,y:0}),E=p.useMemo(()=>{switch(n){case ec.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case ec.DraggableRect:return o}},[n,o,d]),S=p.useRef(null),T=p.useCallback(()=>{const R=S.current;if(!R)return;const P=v.current.x*k.current.x,$=v.current.y*k.current.y;R.scrollBy(P,$)},[]),A=p.useMemo(()=>u===Jd.TreeOrder?[...m].reverse():m,[u,m]);p.useEffect(()=>{if(!i||!m.length||!E){j();return}for(const R of A){if((s==null?void 0:s(R))===!1)continue;const P=m.indexOf(R),$=h[P];if(!$)continue;const{direction:M,speed:_}=e4(R,$,E,t,y);for(const D of["x","y"])b[D][M[D]]||(_[D]=0,M[D]=0);if(_.x>0||_.y>0){j(),S.current=R,C(T,c),v.current=_,k.current=M;return}}v.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,i,c,JSON.stringify(E),JSON.stringify(b),C,m,A,h,JSON.stringify(y)])}const p4={x:{[Ln.Backward]:!1,[Ln.Forward]:!1},y:{[Ln.Backward]:!1,[Ln.Forward]:!1}};function m4(e){let{delta:t,disabled:n}=e;const s=Gd(t);return Oc(o=>{if(n||!s||!o)return p4;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Ln.Backward]:o.x[Ln.Backward]||i.x===-1,[Ln.Forward]:o.x[Ln.Forward]||i.x===1},y:{[Ln.Backward]:o.y[Ln.Backward]||i.y===-1,[Ln.Forward]:o.y[Ln.Forward]||i.y===1}}},[n,t,s])}function h4(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Oc(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function g4(e,t){return p.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...i]},[]),[e,t])}var yc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(yc||(yc={}));var vg;(function(e){e.Optimized="optimized"})(vg||(vg={}));const Zw=new Map;function x4(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,c]=p.useState(null),{frequency:u,measure:d,strategy:m}=o,h=p.useRef(e),g=v(),y=gc(g),b=p.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(S=>!E.includes(S))))},[y]),C=p.useRef(null),j=Oc(k=>{if(g&&!n)return Zw;if(!k||k===Zw||h.current!==e||i!=null){const E=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){E.set(S.id,S.rect.current);continue}const T=S.node.current,A=T?new _x(d(T),T):null;S.rect.current=A,A&&E.set(S.id,A)}return E}return k},[e,i,n,g,d]);return p.useEffect(()=>{h.current=e},[e]),p.useEffect(()=>{g||b()},[n,g]),p.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),p.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:i!=null};function v(){switch(m){case yc.Always:return!1;case yc.BeforeDragging:return n;default:return!n}}}function Fx(e,t){return Oc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function y4(e,t){return Fx(e,t)}function b4(e){let{callback:t,disabled:n}=e;const s=Lf(t),o=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return p.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Ff(e){let{callback:t,disabled:n}=e;const s=Lf(t),o=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return p.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function v4(e){return new _x(Hi(e),e)}function ej(e,t,n){t===void 0&&(t=v4);const[s,o]=p.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=d??n)!=null?m:null}const h=t(e);return JSON.stringify(d)===JSON.stringify(h)?d:h})}const c=b4({callback(d){if(e)for(const m of d){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){i();break}}}}),u=Ff({callback:i});return ns(()=>{i(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function w4(e){const t=Fx(e);return A1(e,t)}const tj=[];function j4(e){const t=p.useRef(e),n=Oc(s=>e?s&&s!==tj&&e&&t.current&&e.parentNode===t.current.parentNode?s:Mf(e):tj,[e]);return p.useEffect(()=>{t.current=e},[e]),n}function k4(e){const[t,n]=p.useState(null),s=p.useRef(e),o=p.useCallback(i=>{const c=vh(i.target);c&&n(u=>u?(u.set(c,yg(c)),new Map(u)):null)},[]);return p.useEffect(()=>{const i=s.current;if(e!==i){c(i);const u=e.map(d=>{const m=vh(d);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,yg(m)]):null}).filter(d=>d!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(i)};function c(u){u.forEach(d=>{const m=vh(d);m==null||m.removeEventListener("scroll",o)})}},[o,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>ji(i,c),ss):_1(e):ss,[e,t])}function nj(e,t){t===void 0&&(t=[]);const n=p.useRef(null);return p.useEffect(()=>{n.current=null},t),p.useEffect(()=>{const s=e!==ss;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?xc(e,n.current):ss}function S4(e){p.useEffect(()=>{if(!$f)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function N4(e,t){return p.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function z1(e){return p.useMemo(()=>e?QL(e):null,[e])}const rj=[];function C4(e,t){t===void 0&&(t=Hi);const[n]=e,s=z1(n?er(n):null),[o,i]=p.useState(rj);function c(){i(()=>e.length?e.map(d=>O1(d)?s:new _x(t(d),d)):rj)}const u=Ff({callback:c});return ns(()=>{u==null||u.disconnect(),c(),e.forEach(d=>u==null?void 0:u.observe(d))},[e]),o}function B1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Lc(t)?t:e}function E4(e){let{measure:t}=e;const[n,s]=p.useState(null),o=p.useCallback(m=>{for(const{target:h}of m)if(Lc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),i=Ff({callback:o}),c=p.useCallback(m=>{const h=B1(m);i==null||i.disconnect(),h&&(i==null||i.observe(h)),s(h?t(h):null)},[t,i]),[u,d]=qd(c);return p.useMemo(()=>({nodeRef:u,rect:n,setRef:d}),[n,u,d])}const T4=[{sensor:Ki,options:{}},{sensor:Wi,options:{}}],R4={current:{}},Ad={draggable:{measure:Yw},droppable:{measure:Yw,strategy:yc.WhileDragging,frequency:vg.Optimized},dragOverlay:{measure:Hi}};class tc extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const A4={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new tc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ad,measureDroppableContainers:Qd,windowRect:null,measuringScheduled:!1},U1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qd,draggableNodes:new Map,over:null,measureDroppableContainers:Qd},_c=p.createContext(U1),V1=p.createContext(A4);function P4(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new tc}}}function D4(e,t){switch(t.type){case Nn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Nn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Nn.DragEnd:case Nn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Nn.RegisterDroppable:{const{element:n}=t,{id:s}=n,o=new tc(e.droppable.containers);return o.set(s,n),{...e,droppable:{...e.droppable,containers:o}}}case Nn.SetDroppableDisabled:{const{id:n,key:s,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const c=new tc(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Nn.UnregisterDroppable:{const{id:n,key:s}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new tc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function $4(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=p.useContext(_c),i=Gd(s),c=Gd(n==null?void 0:n.id);return p.useEffect(()=>{if(!t&&!s&&i&&c!=null){if(!Of(i)||document.activeElement===i.target)return;const u=o.get(c);if(!u)return;const{activatorNode:d,node:m}=u;if(!d.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[d.current,m.current]){if(!h)continue;const g=AL(h);if(g){g.focus();break}}})}},[s,t,o,c,i]),null}function H1(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function L4(e){return p.useMemo(()=>({draggable:{...Ad.draggable,...e==null?void 0:e.draggable},droppable:{...Ad.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Ad.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function O4(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=p.useRef(!1),{x:c,y:u}=typeof o=="boolean"?{x:o,y:o}:o;ns(()=>{if(!c&&!u||!t){i.current=!1;return}if(i.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=A1(h,s);if(c||(g.x=0),u||(g.y=0),i.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=D1(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const zf=p.createContext({...ss,scaleX:1,scaleY:1});var bo;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(bo||(bo={}));const Bf=p.memo(function(t){var n,s,o,i;let{id:c,accessibility:u,autoScroll:d=!0,children:m,sensors:h=T4,collisionDetection:g=HL,measuring:y,modifiers:b,...C}=t;const j=p.useReducer(D4,void 0,P4),[v,k]=j,[E,S]=IL(),[T,A]=p.useState(bo.Uninitialized),R=T===bo.Initialized,{draggable:{active:P,nodes:$,translate:M},droppable:{containers:_}}=v,D=P!=null?$.get(P):null,V=p.useRef({initial:null,translated:null}),K=p.useMemo(()=>{var te;return P!=null?{id:P,data:(te=D==null?void 0:D.data)!=null?te:R4,rect:V}:null},[P,D]),I=p.useRef(null),[F,q]=p.useState(null),[Z,z]=p.useState(null),G=gc(C,Object.values(C)),L=Ic("DndDescribedBy",c),H=p.useMemo(()=>_.getEnabled(),[_]),re=L4(y),{droppableRects:U,measureDroppableContainers:ue,measuringScheduled:ge}=x4(H,{dragging:R,dependencies:[M.x,M.y],config:re.droppable}),se=h4($,P),ye=p.useMemo(()=>Z?Yd(Z):null,[Z]),Se=pe(),Te=y4(se,re.draggable.measure);O4({activeNode:P!=null?$.get(P):null,config:Se.layoutShiftCompensation,initialRect:Te,measure:re.draggable.measure});const Pe=ej(se,re.draggable.measure,Te),Ke=ej(se?se.parentElement:null),ct=p.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),et=_.getNodeFor((n=ct.current.over)==null?void 0:n.id),ot=E4({measure:re.dragOverlay.measure}),X=(s=ot.nodeRef.current)!=null?s:se,Me=R?(o=ot.rect)!=null?o:Pe:null,Ce=!!(ot.nodeRef.current&&ot.rect),Ie=w4(Ce?null:Pe),Ye=z1(X?er(X):null),Fe=j4(R?et??se:null),Ze=C4(Fe),Je=H1(b,{transform:{x:M.x-Ie.x,y:M.y-Ie.y,scaleX:1,scaleY:1},activatorEvent:Z,active:K,activeNodeRect:Pe,containerNodeRect:Ke,draggingNodeRect:Me,over:ct.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Fe,scrollableAncestorRects:Ze,windowRect:Ye}),Ot=ye?ji(ye,M):null,yt=k4(Fe),dt=nj(yt),le=nj(yt,[Pe]),Y=ji(Je,dt),fe=Me?qL(Me,Je):null,ne=K&&fe?g({active:K,collisionRect:fe,droppableRects:U,droppableContainers:H,pointerCoordinates:Ot}):null,he=R1(ne,"id"),[De,ut]=p.useState(null),ae=Ce?Je:ji(Je,le),be=WL(ae,(i=De==null?void 0:De.rect)!=null?i:null,Pe),Le=p.useRef(null),at=p.useCallback((te,xe)=>{let{sensor:Oe,options:tt}=xe;if(I.current==null)return;const ve=$.get(I.current);if(!ve)return;const Nt=te.nativeEvent,It=new Oe({active:I.current,activeNode:ve,event:Nt,options:tt,context:ct,onAbort(jt){if(!$.get(jt))return;const{onDragAbort:Rt}=G.current,oe={id:jt};Rt==null||Rt(oe),E({type:"onDragAbort",event:oe})},onPending(jt,wn,Rt,oe){if(!$.get(jt))return;const{onDragPending:nt}=G.current,bt={id:jt,constraint:wn,initialCoordinates:Rt,offset:oe};nt==null||nt(bt),E({type:"onDragPending",event:bt})},onStart(jt){const wn=I.current;if(wn==null)return;const Rt=$.get(wn);if(!Rt)return;const{onDragStart:oe}=G.current,Ue={activatorEvent:Nt,active:{id:wn,data:Rt.data,rect:V}};Fs.unstable_batchedUpdates(()=>{oe==null||oe(Ue),A(bo.Initializing),k({type:Nn.DragStart,initialCoordinates:jt,active:wn}),E({type:"onDragStart",event:Ue}),q(Le.current),z(Nt)})},onMove(jt){k({type:Nn.DragMove,coordinates:jt})},onEnd:en(Nn.DragEnd),onCancel:en(Nn.DragCancel)});Le.current=It;function en(jt){return async function(){const{active:Rt,collisions:oe,over:Ue,scrollAdjustedTranslate:nt}=ct.current;let bt=null;if(Rt&&nt){const{cancelDrop:tr}=G.current;bt={activatorEvent:Nt,active:Rt,collisions:oe,delta:nt,over:Ue},jt===Nn.DragEnd&&typeof tr=="function"&&await Promise.resolve(tr(bt))&&(jt=Nn.DragCancel)}I.current=null,Fs.unstable_batchedUpdates(()=>{k({type:jt}),A(bo.Uninitialized),ut(null),q(null),z(null),Le.current=null;const tr=jt===Nn.DragEnd?"onDragEnd":"onDragCancel";if(bt){const qr=G.current[tr];qr==null||qr(bt),E({type:tr,event:bt})}})}}},[$]),Be=p.useCallback((te,xe)=>(Oe,tt)=>{const ve=Oe.nativeEvent,Nt=$.get(tt);if(I.current!==null||!Nt||ve.dndKit||ve.defaultPrevented)return;const It={active:Nt};te(Oe,xe.options,It)===!0&&(ve.dndKit={capturedBy:xe.sensor},I.current=tt,at(Oe,xe))},[$,at]),kt=g4(h,Be);S4(h),ns(()=>{Pe&&T===bo.Initializing&&A(bo.Initialized)},[Pe,T]),p.useEffect(()=>{const{onDragMove:te}=G.current,{active:xe,activatorEvent:Oe,collisions:tt,over:ve}=ct.current;if(!xe||!Oe)return;const Nt={active:xe,activatorEvent:Oe,collisions:tt,delta:{x:Y.x,y:Y.y},over:ve};Fs.unstable_batchedUpdates(()=>{te==null||te(Nt),E({type:"onDragMove",event:Nt})})},[Y.x,Y.y]),p.useEffect(()=>{const{active:te,activatorEvent:xe,collisions:Oe,droppableContainers:tt,scrollAdjustedTranslate:ve}=ct.current;if(!te||I.current==null||!xe||!ve)return;const{onDragOver:Nt}=G.current,It=tt.get(he),en=It&&It.rect.current?{id:It.id,rect:It.rect.current,data:It.data,disabled:It.disabled}:null,jt={active:te,activatorEvent:xe,collisions:Oe,delta:{x:ve.x,y:ve.y},over:en};Fs.unstable_batchedUpdates(()=>{ut(en),Nt==null||Nt(jt),E({type:"onDragOver",event:jt})})},[he]),ns(()=>{ct.current={activatorEvent:Z,active:K,activeNode:se,collisionRect:fe,collisions:ne,droppableRects:U,draggableNodes:$,draggingNode:X,draggingNodeRect:Me,droppableContainers:_,over:De,scrollableAncestors:Fe,scrollAdjustedTranslate:Y},V.current={initial:Me,translated:fe}},[K,se,ne,fe,$,X,Me,U,_,De,Fe,Y]),f4({...Se,delta:M,draggingRect:fe,pointerCoordinates:Ot,scrollableAncestors:Fe,scrollableAncestorRects:Ze});const St=p.useMemo(()=>({active:K,activeNode:se,activeNodeRect:Pe,activatorEvent:Z,collisions:ne,containerNodeRect:Ke,dragOverlay:ot,draggableNodes:$,droppableContainers:_,droppableRects:U,over:De,measureDroppableContainers:ue,scrollableAncestors:Fe,scrollableAncestorRects:Ze,measuringConfiguration:re,measuringScheduled:ge,windowRect:Ye}),[K,se,Pe,Z,ne,Ke,ot,$,_,U,De,ue,Fe,Ze,re,ge,Ye]),_t=p.useMemo(()=>({activatorEvent:Z,activators:kt,active:K,activeNodeRect:Pe,ariaDescribedById:{draggable:L},dispatch:k,draggableNodes:$,over:De,measureDroppableContainers:ue}),[Z,kt,K,Pe,k,L,$,De,ue]);return Dt.createElement(C1.Provider,{value:S},Dt.createElement(_c.Provider,{value:_t},Dt.createElement(V1.Provider,{value:St},Dt.createElement(zf.Provider,{value:be},m)),Dt.createElement($4,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Dt.createElement(FL,{...u,hiddenTextDescribedById:L}));function pe(){const te=(F==null?void 0:F.autoScrollEnabled)===!1,xe=typeof d=="object"?d.enabled===!1:d===!1,Oe=R&&!te&&!xe;return typeof d=="object"?{...d,enabled:Oe}:{enabled:Oe}}}),I4=p.createContext(null),sj="button",_4="Draggable";function M4(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Ic(_4),{activators:c,activatorEvent:u,active:d,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=p.useContext(_c),{role:b=sj,roleDescription:C="draggable",tabIndex:j=0}=o??{},v=(d==null?void 0:d.id)===t,k=p.useContext(v?zf:I4),[E,S]=qd(),[T,A]=qd(),R=N4(c,t),P=gc(n);ns(()=>(g.set(t,{id:t,key:i,node:E,activatorNode:T,data:P}),()=>{const M=g.get(t);M&&M.key===i&&g.delete(t)}),[g,t]);const $=p.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":v&&b===sj?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,v,C,h.draggable]);return{active:d,activatorEvent:u,activeNodeRect:m,attributes:$,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:S,setActivatorNodeRef:A,transform:k}}function W1(){return p.useContext(V1)}const F4="Droppable",z4={timeout:25};function B4(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Ic(F4),{active:c,dispatch:u,over:d,measureDroppableContainers:m}=p.useContext(_c),h=p.useRef({disabled:n}),g=p.useRef(!1),y=p.useRef(null),b=p.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:v}={...z4,...o},k=gc(j??s),E=p.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},v)},[v]),S=Ff({callback:E,disabled:C||!c}),T=p.useCallback(($,M)=>{S&&(M&&(S.unobserve(M),g.current=!1),$&&S.observe($))},[S]),[A,R]=qd(T),P=gc(t);return p.useEffect(()=>{!S||!A.current||(S.disconnect(),g.current=!1,S.observe(A.current))},[A,S]),p.useEffect(()=>(u({type:Nn.RegisterDroppable,element:{id:s,key:i,disabled:n,node:A,rect:y,data:P}}),()=>u({type:Nn.UnregisterDroppable,key:i,id:s})),[s]),p.useEffect(()=>{n!==h.current.disabled&&(u({type:Nn.SetDroppableDisabled,id:s,key:i,disabled:n}),h.current.disabled=n)},[s,i,n,u]),{active:c,rect:y,isOver:(d==null?void 0:d.id)===s,node:A,over:d,setNodeRef:R}}function U4(e){let{animation:t,children:n}=e;const[s,o]=p.useState(null),[i,c]=p.useState(null),u=Gd(n);return!n&&!s&&u&&o(u),ns(()=>{if(!i)return;const d=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(d==null||m==null){o(null);return}Promise.resolve(t(m,i)).then(()=>{o(null)})},[t,s,i]),Dt.createElement(Dt.Fragment,null,n,s?p.cloneElement(s,{ref:c}):null)}const V4={x:0,y:0,scaleX:1,scaleY:1};function H4(e){let{children:t}=e;return Dt.createElement(_c.Provider,{value:U1},Dt.createElement(zf.Provider,{value:V4},t))}const W4={position:"fixed",touchAction:"none"},K4=e=>Of(e)?"transform 250ms ease":void 0,q4=p.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:o,children:i,className:c,rect:u,style:d,transform:m,transition:h=K4}=e;if(!u)return null;const g=o?m:{...m,scaleX:1,scaleY:1},y={...W4,width:u.width,height:u.height,top:u.top,left:u.left,transform:rs.Transform.toString(g),transformOrigin:o&&s?zL(s,u):void 0,transition:typeof h=="function"?h(s):h,...d};return Dt.createElement(n,{className:c,style:y,ref:t},i)}),G4=e=>t=>{let{active:n,dragOverlay:s}=t;const o={},{styles:i,className:c}=e;if(i!=null&&i.active)for(const[u,d]of Object.entries(i.active))d!==void 0&&(o[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,d));if(i!=null&&i.dragOverlay)for(const[u,d]of Object.entries(i.dragOverlay))d!==void 0&&s.node.style.setProperty(u,d);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[d,m]of Object.entries(o))n.node.style.setProperty(d,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},Y4=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rs.Transform.toString(t)},{transform:rs.Transform.toString(n)}]},Q4={duration:250,easing:"ease",keyframes:Y4,sideEffects:G4({styles:{active:{opacity:"0"}}})};function J4(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:o}=e;return Lf((i,c)=>{if(t===null)return;const u=n.get(i);if(!u)return;const d=u.node.current;if(!d)return;const m=B1(c);if(!m)return;const{transform:h}=er(c).getComputedStyle(c),g=P1(h);if(!g)return;const y=typeof t=="function"?t:X4(t);return M1(d,o.draggable.measure),y({active:{id:i,data:u.data,node:d,rect:o.draggable.measure(d)},draggableNodes:n,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:o,transform:g})})}function X4(e){const{duration:t,easing:n,sideEffects:s,keyframes:o}={...Q4,...e};return i=>{let{active:c,dragOverlay:u,transform:d,...m}=i;if(!t)return;const h={x:u.rect.left-c.rect.left,y:u.rect.top-c.rect.top},g={scaleX:d.scaleX!==1?c.rect.width*d.scaleX/u.rect.width:1,scaleY:d.scaleY!==1?c.rect.height*d.scaleY/u.rect.height:1},y={x:d.x-h.x,y:d.y-h.y,...g},b=o({...m,active:c,dragOverlay:u,transform:{initial:d,final:y}}),[C]=b,j=b[b.length-1];if(JSON.stringify(C)===JSON.stringify(j))return;const v=s==null?void 0:s({active:c,dragOverlay:u,...m}),k=u.node.animate(b,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{v==null||v(),E()}})}}let oj=0;function Z4(e){return p.useMemo(()=>{if(e!=null)return oj++,oj},[e])}const eO=Dt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:o,transition:i,modifiers:c,wrapperElement:u="div",className:d,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggableNodes:C,droppableContainers:j,dragOverlay:v,over:k,measuringConfiguration:E,scrollableAncestors:S,scrollableAncestorRects:T,windowRect:A}=W1(),R=p.useContext(zf),P=Z4(g==null?void 0:g.id),$=H1(c,{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:T,transform:R,windowRect:A}),M=Fx(y),_=J4({config:s,draggableNodes:C,droppableContainers:j,measuringConfiguration:E}),D=M?v.setRef:void 0;return Dt.createElement(H4,null,Dt.createElement(U4,{animation:_},g&&P?Dt.createElement(q4,{key:P,id:g.id,ref:D,as:u,activatorEvent:h,adjustScale:t,className:d,transition:i,rect:M,style:{zIndex:m,...o},transform:$},n):null))});function qi(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function tO(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function ud(e){return e!==null&&e>=0}function nO(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function rO(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const zx=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=qi(t,s,n),c=t[o],u=i[o];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},dd={scaleX:1,scaleY:1},Bx=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:o,rects:i,overIndex:c}=e;const u=(t=i[n])!=null?t:s;if(!u)return null;if(o===n){const m=i[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,...dd}:null}const d=sO(i,o,n);return o>n&&o<=c?{x:0,y:-u.height-d,...dd}:o<n&&o>=c?{x:0,y:u.height+d,...dd}:{x:0,y:0,...dd}};function sO(e,t,n){const s=e[t],o=e[t-1],i=e[t+1];return s?n<t?o?s.top-(o.top+o.height):i?i.top-(s.top+s.height):0:i?i.top-(s.top+s.height):o?s.top-(o.top+o.height):0:0}const K1="Sortable",q1=Dt.createContext({activeIndex:-1,containerId:K1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zx,disabled:{draggable:!1,droppable:!1}});function Uf(e){let{children:t,id:n,items:s,strategy:o=zx,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:d,over:m,measureDroppableContainers:h}=W1(),g=Ic(K1,n),y=u.rect!==null,b=p.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=p.useRef(b),E=!nO(b,k.current),S=v!==-1&&j===-1||E,T=rO(i);ns(()=>{E&&C&&h(b)},[E,b,C,h]),p.useEffect(()=>{k.current=b},[b]);const A=p.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:v,useDragOverlay:y,sortedRects:tO(b,d),strategy:o}),[j,g,T.draggable,T.droppable,S,b,v,d,y,o]);return Dt.createElement(q1.Provider,{value:A},t)}const oO=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return qi(n,s,o).indexOf(t)},aO=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:c,previousItems:u,previousContainerId:d,transition:m}=e;return!m||!s||u!==i&&o===c?!1:n?!0:c!==o&&t===d},iO={duration:200,easing:"ease"},G1="transform",lO=rs.Transition.toString({property:G1,duration:0,easing:"linear"}),cO={roleDescription:"sortable"};function uO(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,c]=p.useState(null),u=p.useRef(n);return ns(()=>{if(!t&&n!==u.current&&s.current){const d=o.current;if(d){const m=Hi(s.current,{ignoreTransform:!0}),h={x:d.left-m.left,y:d.top-m.top,scaleX:d.width/m.width,scaleY:d.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,o]),p.useEffect(()=>{i&&c(null)},[i]),i}function Vf(e){let{animateLayoutChanges:t=aO,attributes:n,disabled:s,data:o,getNewIndex:i=oO,id:c,strategy:u,resizeObserverConfig:d,transition:m=iO}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:v,useDragOverlay:k,strategy:E}=p.useContext(q1),S=dO(s,b),T=h.indexOf(c),A=p.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...o}),[g,o,T,h]),R=p.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:P,node:$,isOver:M,setNodeRef:_}=B4({id:c,data:A,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:D,activatorEvent:V,activeNodeRect:K,attributes:I,setNodeRef:F,listeners:q,isDragging:Z,over:z,setActivatorNodeRef:G,transform:L}=M4({id:c,data:A,attributes:{...cO,...n},disabled:S.draggable}),H=CL(_,F),re=!!D,U=re&&!C&&ud(y)&&ud(v),ue=!k&&Z,ge=ue&&U?L:null,ye=U?ge??(u??E)({rects:j,activeNodeRect:K,activeIndex:y,overIndex:v,index:T}):null,Se=ud(y)&&ud(v)?i({id:c,items:h,activeIndex:y,overIndex:v}):T,Te=D==null?void 0:D.id,Pe=p.useRef({activeId:Te,items:h,newIndex:Se,containerId:g}),Ke=h!==Pe.current.items,ct=t({active:D,containerId:g,isDragging:Z,isSorting:re,id:c,index:T,items:h,newIndex:Pe.current.newIndex,previousItems:Pe.current.items,previousContainerId:Pe.current.containerId,transition:m,wasDragging:Pe.current.activeId!=null}),et=uO({disabled:!ct,index:T,node:$,rect:P});return p.useEffect(()=>{re&&Pe.current.newIndex!==Se&&(Pe.current.newIndex=Se),g!==Pe.current.containerId&&(Pe.current.containerId=g),h!==Pe.current.items&&(Pe.current.items=h)},[re,Se,g,h]),p.useEffect(()=>{if(Te===Pe.current.activeId)return;if(Te!=null&&Pe.current.activeId==null){Pe.current.activeId=Te;return}const X=setTimeout(()=>{Pe.current.activeId=Te},50);return()=>clearTimeout(X)},[Te]),{active:D,activeIndex:y,attributes:I,data:A,rect:P,index:T,newIndex:Se,items:h,isOver:M,isSorting:re,isDragging:Z,listeners:q,node:$,overIndex:v,over:z,setNodeRef:H,setActivatorNodeRef:G,setDroppableNodeRef:_,setDraggableNodeRef:F,transform:et??ye,transition:ot()};function ot(){if(et||Ke&&Pe.current.newIndex===T)return lO;if(!(ue&&!Of(V)||!m)&&(re||ct))return rs.Transition.toString({...m,property:G1})}}function dO(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Xd(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const fO=[wt.Down,wt.Right,wt.Up,wt.Left],Y1=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:o,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(fO.includes(e.code)){if(e.preventDefault(),!n||!s)return;const d=[];i.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=o.get(g.id);if(y)switch(e.code){case wt.Down:s.top<y.top&&d.push(g);break;case wt.Up:s.top>y.top&&d.push(g);break;case wt.Left:s.left>y.left&&d.push(g);break;case wt.Right:s.left<y.left&&d.push(g);break}});const m=UL({collisionRect:s,droppableRects:o,droppableContainers:d});let h=R1(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=i.get(n.id),y=i.get(h),b=y?o.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const v=Mf(C).some((R,P)=>u[P]!==R),k=Q1(g,y),E=pO(g,y),S=v||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},T={x:b.left,y:b.top};return S.x&&S.y?T:xc(T,S)}}}};function Q1(e,t){return!Xd(e)||!Xd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function pO(e,t){return!Xd(e)||!Xd(t)||!Q1(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function xt({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Tt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function Pd({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function He({title:e,description:t,children:n,className:s,actions:o}){return r.jsxs("section",{className:we("surface-panel space-y-3",s),children:[e||o?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function mO({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(He,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,o)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(Pd,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const kh={review:"{total} items ready for your review","review.singular":"Review {title}",ready_to_implement:"{total} plans ready to implement — start with {title}","ready_to_implement.singular":"Start implementing {title}",ready_for_planning:"{total} assignments ready to plan — start with {title}","ready_for_planning.singular":"Plan {title}",in_progress:"Resume {title} ({total} in progress)","in_progress.singular":"Resume {title}",draft:"Shape your {total} drafts — start with {title}","draft.singular":"Shape {title}",blocked:"Unblock {title} ({total} blocked)","blocked.singular":"Unblock {title}",stale:"Triage {total} stale items","stale.singular":"Triage {title} — sitting stale",clean:"You’re all clear. Nothing needs you right now."},aa={emptyStateCleanTitle:"You’re all clear",emptyStateCleanCTA:"Browse projects",recentSessionsEmptyTitle:"No recent sessions",recentSessionsEmptyHint:"Use /grab-assignment or `syntaur track-session` to register one.",recentSessionsCopyPathLabel:"Copy path",recentSessionsCopyPathDisabled:"Session has no path",recentSessionsCopyFallbackHint:"Press ⌘C to copy"};function hO(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function gO({hero:e,itemsById:t}){const n=fn();if(e.kind==="clean")return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:aa.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:kh.clean}),r.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),r.jsx("div",{className:"mt-4",children:r.jsx(Ee,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:aa.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,o=(s==null?void 0:s.assignmentTitle)??"",i=kh[e.copyKey]??kh[e.kind],c=hO(i,{total:e.total,title:o}),u=s?xO(s,n):`${n}/assignments`;return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:"What needs you today"}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:c}),s?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",r.jsx("span",{className:"font-medium text-foreground",children:s.projectTitle??"Standalone"})," ","· status ",r.jsx("span",{className:"font-medium text-foreground",children:s.status})]}):null,r.jsx("div",{className:"mt-4",children:r.jsxs(Ee,{to:u,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function xO(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Ux=["kanban","list","table"],J1=["title","status","priority","assignee","dependencies","created","updated"],yO=["asc","desc"],bO=["comfortable","compact"],vO=["none","status","type","priority","assignee","project"],wO=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function ze(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const o=s.trim();!o||o==="all"||n.includes(o)||n.push(o)}return n}function jO(e,t){const n=ze(e),s=ze(t);return n.length===s.length&&n.every(o=>s.includes(o))}const kO={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},bc={version:1,global:kO,projects:{}};function Sh(e){return e==="table"?"table":"kanban"}function SO(e,t){return t?{...e,...t}:{...e}}function X1(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:SO(n.filters,s.filters)}:n}const NO=["low","medium","high","critical"],Hf={status:{kind:"enum"},priority:{kind:"ordinal",order:NO},type:{kind:"enum"},assignee:{kind:"string",noneSentinel:!0},project:{kind:"string",noneSentinel:!0},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},archived:{kind:"bool"},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title},created:{kind:"timestamp"},updated:{kind:"timestamp"},completedat:{kind:"timestamp",get:e=>e.completedAt},statusage:{kind:"duration",get:e=>e.statusAge},phase:{kind:"enum"},disposition:{kind:"enum"},phaseage:{kind:"duration",get:e=>e.phaseAge},hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},progressstaledays:{kind:"duration",get:e=>e.progressStaleDays},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function CO(e,t){return e[t.toLowerCase()]??null}function jr(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class kr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function Z1(e){const[t,n,s]=e.split("-").map(c=>parseInt(c,10)),o=new Date(t,n-1,s).getTime(),i=new Date(t,n-1,s+1).getTime();return[o,i]}function wg(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.length>0){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function nc(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}function Nh(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function EO(e){return e==null||e===""}function Dd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>EO(jr(e,t,o)):o=>Nh(jr(e,t,o),n.raw);case"substring":return o=>{const i=jr(e,t,o);return typeof i=="string"&&i.toLowerCase().includes(n.raw.toLowerCase())};case"bool":{const o=n.raw.toLowerCase();if(o!=="true"&&o!=="false")throw new kr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return c=>{const u=jr(e,t,c),d=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return d!==null&&d===i}}case"number":{const o=n.num??nc(n.raw);if(o===null)throw new kr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>nc(jr(e,t,i))===o}case"ordinal":return o=>Nh(jr(e,t,o),n.raw);case"list":return o=>{const i=jr(e,t,o);return Array.isArray(i)&&i.some(c=>Nh(c,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=Z1(n.raw);return c=>{const u=wg(jr(e,t,c));return u!==null&&u>=o&&u<i}}throw new kr([{pos:n.pos,message:`Field "${t}" is a timestamp — use a comparison (e.g. ${t} > -36h) or an absolute date (${t}:2026-06-01)`}])}case"duration":throw new kr([{pos:s,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function TO(e,t,n,s){const o=(i,c)=>{switch(n){case"<":return i<c;case">":return i>c;case"<=":return i<=c;case">=":return i>=c;case"=":return i===c;case"!=":return i!==c;default:return!1}};switch(e.kind){case"number":{const i=s.num??nc(s.raw);if(i===null)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=nc(jr(e,t,c));return u!==null&&o(u,i)}}case"ordinal":{const i=e.order??[],c=i.findIndex(u=>u.toLowerCase()===s.raw.toLowerCase());if(c<0)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return u=>{const d=jr(e,t,u),m=typeof d=="string"?i.findIndex(h=>h.toLowerCase()===d.toLowerCase()):-1;return m>=0&&o(m,c)}}case"timestamp":{if(s.type==="duration"){const c=(s.sign===0?-1:s.sign??-1)*(s.num??0);return(u,d)=>{const m=wg(jr(e,t,u));return m!==null&&o(m,d.now+c)}}if(s.type==="date"){const[i,c]=Z1(s.raw);return u=>{const d=wg(jr(e,t,u));if(d===null)return!1;switch(n){case"<":return d<i;case"<=":return d<c;case">":return d>=c;case">=":return d>=i;case"=":return d>=i&&d<c;case"!=":return d<i||d>=c;default:return!1}}}throw new kr([{pos:s.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(s.type!=="duration")throw new kr([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=s.num??0;return c=>{const u=nc(jr(e,t,c));return u!==null&&o(u,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Dd(e,t,s,s.pos);if(n==="!="){const i=Dd(e,t,s,s.pos);return(c,u)=>!i(c,u)}throw new kr([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Dd(e,t,s,s.pos);return n==="="?i:(c,u)=>!i(c,u)}throw new kr([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function RO(e,t){const n=CO(t,e.field);if(!n)throw new kr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(o=>Dd(n,e.field,o,e.pos));return s.length===1?s[0]:(o,i)=>s.some(c=>c(o,i))}return TO(n,e.field,e.op,e.values[0])}function rc(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return RO(e,t);case"not":{const n=rc(e.child,t);return(s,o)=>!n(s,o)}case"and":{const n=e.children.map(s=>rc(s,t));return(s,o)=>n.every(i=>i(s,o))}case"or":{const n=e.children.map(s=>rc(s,t));return(s,o)=>n.some(i=>i(s,o))}}}class ui extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const AO={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},PO=/[A-Za-z_]/,DO=/[A-Za-z0-9_-]/,$O=/^\d{4}-\d{2}-\d{2}/;function LO(e){const t=[];let n=0;const s=(o,i)=>{let c=n;for(;c<e.length&&/\d/.test(e[c]);)c++;const u=e.slice(n,c);let d="";for(;c<e.length&&/[a-z]/i.test(e[c]);)d+=e[c],c++;if(n=c,d.length>0){const m=AO[d.toLowerCase()];if(m===void 0)throw new ui(o,`Unknown duration unit "${d}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(o,c),pos:o,num:parseInt(u,10)*m,sign:i}}return i!==0?{type:"NUMBER",text:e.slice(o,c),pos:o,num:i*parseInt(u,10)}:{type:"NUMBER",text:u,pos:o,num:parseInt(u,10)}};for(;n<e.length;){const o=e[n],i=n;if(o===" "||o===" "||o===`
|
|
555
|
+
`||o==="\r"){n++;continue}if(o==="("){t.push({type:"LPAREN",text:o,pos:i}),n++;continue}if(o===")"){t.push({type:"RPAREN",text:o,pos:i}),n++;continue}if(o===","){t.push({type:"COMMA",text:o,pos:i}),n++;continue}if(o===":"){t.push({type:"COLON",text:o,pos:i}),n++;continue}if(o==="*"){t.push({type:"STAR",text:o,pos:i}),n++;continue}if(o==="<"||o===">"){e[n+1]==="="?(t.push({type:"OP",text:o+"=",pos:i}),n+=2):(t.push({type:"OP",text:o,pos:i}),n++);continue}if(o==="!"){if(e[n+1]==="="){t.push({type:"OP",text:"!=",pos:i}),n+=2;continue}throw new ui(i,'Unexpected "!" (did you mean "!="?)')}if(o==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:i});continue}if(o==='"'||o==="'"){const c=o;let u=n+1,d="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(d+=e[u+1],u+=2):(d+=e[u],u++);if(u>=e.length)throw new ui(i,"Unterminated string literal");t.push({type:"STRING",text:d,pos:i}),n=u+1;continue}if(o==="-"||o==="+"){if(/\d/.test(e[n+1]??"")){const c=o==="-"?-1:1;n++,t.push(s(i,c));continue}if(o==="-"){t.push({type:"MINUS",text:"-",pos:i}),n++;continue}throw new ui(i,'Unexpected "+"')}if(/\d/.test(o)){const c=e.slice(n).match($O);if(c){t.push({type:"DATE",text:c[0],pos:i}),n+=c[0].length;continue}t.push(s(i,0));continue}if(PO.test(o)){let c=n+1;for(;c<e.length&&DO.test(e[c]);)c++;const u=e.slice(n,c),d=u.toLowerCase();d==="and"?t.push({type:"AND",text:u,pos:i}):d==="or"?t.push({type:"OR",text:u,pos:i}):d==="not"?t.push({type:"NOT",text:u,pos:i}):t.push({type:"IDENT",text:u,pos:i}),n=c;continue}throw new ui(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Xo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const OO=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),IO=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class _O{constructor(t){Xm(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const s=this.peek();if(s.type!==t)throw new Xo(s.pos,`Expected ${n}, got "${s.text||s.type}"`);return this.next()}parseQuery(){if(this.peek().type==="EOF")return{kind:"all"};const t=this.orExpr(),n=this.peek();if(n.type!=="EOF")throw new Xo(n.pos,`Unexpected "${n.text}" — unbalanced parentheses or stray token`);return t}orExpr(){const t=[this.andExpr()];for(;this.peek().type==="OR";)this.next(),t.push(this.andExpr());return t.length===1?t[0]:{kind:"or",children:t}}andExpr(){const t=[this.unary()];for(;;){const n=this.peek();if(n.type==="AND")this.next(),t.push(this.unary());else if(IO.has(n.type))t.push(this.unary());else break}return t.length===1?t[0]:{kind:"and",children:t}}unary(){const t=this.peek();if(t.type==="NOT")return this.next(),{kind:"not",child:this.unary()};if(t.type==="MINUS"){this.next();const n=this.peek();if(n.type!=="IDENT")throw new Xo(n.pos,'Expected a field atom after "-" negation');return{kind:"not",child:this.atom()}}return this.primary()}primary(){const t=this.peek();if(t.type==="LPAREN"){this.next();const n=this.orExpr();return this.expect("RPAREN",'")"'),n}if(t.type==="STAR")return this.next(),{kind:"all"};if(t.type==="IDENT")return this.atom();throw new Xo(t.pos,`Expected a field, "(", "*", or NOT — got "${t.text||"end of query"}"`)}atom(){const t=this.expect("IDENT","a field name"),n=this.peek();if(n.type==="COLON"){this.next();const s=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:s,pos:t.pos}}if(n.type==="OP"){this.next();const s=this.value();return{kind:"atom",field:t.text,op:n.text,values:[s],pos:t.pos}}throw new Xo(n.pos,`Expected ":" or a comparison operator after field "${t.text}"`)}valueOrList(){if(this.peek().type==="LPAREN"){this.next();const t=[this.value()];for(;this.peek().type==="COMMA";)this.next(),t.push(this.value());return this.expect("RPAREN",'")" to close the value list'),t}return[this.value()]}value(){const t=this.peek();if(!OO.has(t.type))throw new Xo(t.pos,`Expected a value, got "${t.text||t.type}"`);switch(this.next(),t.type){case"STRING":return{type:"string",raw:t.text,pos:t.pos};case"NUMBER":return{type:"number",raw:t.text,num:t.num,pos:t.pos};case"DATE":return{type:"date",raw:t.text,pos:t.pos};case"DURATION":return{type:"duration",raw:t.text,num:t.num,sign:t.sign??0,pos:t.pos};default:return{type:"word",raw:t.text,pos:t.pos}}}}function Wf(e){try{const t=LO(e);return{ast:new _O(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ui||t instanceof Xo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Vx(e,t=Hf){const n=Wf(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:rc(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof kr)return{query:null,errors:s.errors};throw s}}const MO=/^[A-Za-z_][A-Za-z0-9_-]*$/,FO=new Set(["and","or","not"]);function eN(e){return MO.test(e)&&!FO.has(e.toLowerCase())?e:tN(e)}function tN(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const nN="__unassigned__",rN="__standalone__",zO={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function BO(e){return e.startsWith("older_")?"<":">="}const Hx=["status","type","priority","assignee","project","tags"],UO=["created","updated"];function VO(e){var i;const t={};for(const c of Hx){const u=ze(e[c]);u.length&&(t[c]=u)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let s=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const c=HO(o);if(c)s||(s=c);else{const u=WO(o);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function HO(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function WO(e){if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return null;const s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function sc(e){const t=VO(e),n=[];for(const s of Hx){const o=t[s]??[];o.length&&n.push(KO(s,o))}return t.search&&n.push(`search:${tN(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...GO(t.dateRange)),n.join(" AND ")}function KO(e,t){const n=t.map(s=>qO(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function qO(e,t){return e==="assignee"&&t===nN||e==="project"&&t===rN?"none":eN(t)}function GO(e){if(e.preset)return[`${e.field} ${BO(e.preset)} -${zO[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function oc(e){const t=Wf(e);if(!t.ast)return null;const n=YO(t.ast);if(n===null)return null;const s={},o=new Set,i=new Map;for(const c of n){const u=QO(c);if(!u)return null;switch(u.kind){case"value":{if(o.has(u.field))return null;o.add(u.field),s[u.field]=u.values;break}case"search":{if(o.has("search"))return null;o.add("search"),s.search=u.text;break}case"activity":{if(o.has("activity"))return null;o.add("activity"),s.activity=u.activity;break}case"datePreset":{const d=`date:${u.field}`;if(o.has(d)||i.has(u.field))return null;o.add(d),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const d=`date:${u.field}`;if(o.has(d))return null;const m=i.get(u.field)??{};if(u.bound==="from"){if(m.from!==void 0)return null;m.from=u.date}else{if(m.to!==void 0)return null;m.to=u.date}i.set(u.field,m);break}}}if(i.size>1)return null;for(const[c,u]of i){if(s.dateRange)return null;const d={field:c};u.from!==void 0&&(d.from=u.from),u.to!==void 0&&(d.to=u.to),s.dateRange=d}return s}function YO(e){if(e.kind==="all")return[];if(e.kind==="atom")return[e];if(e.kind==="and"){const t=[];for(const n of e.children){if(n.kind!=="atom")return null;t.push(n)}return t}return null}function QO(e){const t=e.field.toLowerCase();if(e.op===":"){if(Hx.includes(t)){const o=t,i=[];for(const c of e.values){const u=tI(o,c);if(u===null)return null;i.push(u)}return i.length===0?null:{kind:"value",field:o,values:i}}return t==="search"?e.values.length!==1?null:{kind:"search",text:e.values[0].raw}:null}if(!UO.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?JO(n,e.op,s):s.type==="date"?e.op===">="?{kind:"dateBound",field:n,bound:"from",date:s.raw}:e.op==="<="?{kind:"dateBound",field:n,bound:"to",date:s.raw}:null:null}function JO(e,t,n){if(n.sign!==-1)return null;const s=XO(n.raw);if(e==="updated"){if(t==="<"&&s==="7d")return{kind:"activity",activity:"stale"};if(t===">="&&s==="7d")return{kind:"activity",activity:"fresh"}}const o=eI(t,s);return o?{kind:"datePreset",field:e,preset:o}:null}function XO(e){return e.replace(/^[-+]/,"")}const ZO={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function eI(e,t){return e!==">="&&e!=="<"?null:ZO[e][t]??null}function tI(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?nN:e==="project"&&n.toLowerCase()==="none"?rN:n}const Ch=["title","status","priority","assignee","dependencies","created","updated"],nI=["small","wide","tall","large"],rI={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},aj="2026-05-21T00:00:00Z";function Eh(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...rI,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:aj,updatedAt:aj}}const wo={version:1,views:[Eh("default-recently-updated","Recently updated",{}),Eh("default-high-priority","High priority",{priority:"high"}),Eh("default-stale","Stale",{activity:"stale"})],dashboard:{version:1,slots:[{id:"slot-0",widget:{kind:"agent-sessions"}},{id:"slot-1",widget:{kind:"saved-view",viewId:"default-recently-updated"}},{id:"slot-2",widget:{kind:"saved-view",viewId:"default-high-priority"}},{id:"slot-3",widget:{kind:"saved-view",viewId:"default-stale"}},{id:"slot-4",widget:{kind:"inventories"}}]}};function sN(e,t){const n=ze(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,c=e.filters.query,u=typeof c=="string"&&c.trim().length>0&&oc(c)===null;return s&&(!o||o==="all")&&!i&&!u}function oN(e,t){switch(t.kind){case"global":return e.workspace===null;case"workspace":return e.workspace===t.workspace||e.workspace===null;case"project":return e.workspace===t.workspace||e.workspace===null?sN(e.config,t.slug):!1}}const aN=`syntaur.savedViews.cache.v${wo.version}`;let ki=sI(),Zo=null,Wx=null;const jg=new Set,Zd=new Set;let iN=0;function lN(){return++iN}function kg(e){return e===iN}function sI(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(aN);if(!e)return null;const t=JSON.parse(e);return t.version!==wo.version?null:t}catch{return null}}function oI(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(aN,JSON.stringify(e))}catch{}}function cN(e){ki=e,Wx=null,oI(e);for(const t of jg)t(e);for(const t of Zd)t(null)}function aI(e){Wx=e;for(const t of Zd)t(e)}function uN(e){if(!e||typeof e!="object")return wo;const t=e;return t.version!==wo.version||!Array.isArray(t.views)||!t.dashboard?wo:t}function ij(){if(Zo)return Zo;const e=lN();return Zo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=uN(t);return kg(e)&&cN(n),Zo=null,ki??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return kg(e)&&aI(n),Zo=null,ki??wo}),Zo}function Kx(){const[e,t]=p.useState(()=>ki??wo),[n,s]=p.useState(()=>ki===null),[o,i]=p.useState(!1),[c,u]=p.useState(()=>Wx);return p.useEffect(()=>{let m=!1;ki===null&&s(!0),ij().then(y=>{m||(t(y),s(!1),i(!0))});const h=y=>{m||(t(y),s(!1),i(!0),u(null))},g=y=>{m||(u(y),s(!1),i(!0))};return jg.add(h),Zd.add(g),()=>{m=!0,jg.delete(h),Zd.delete(g)}},[]),{file:e,loading:n,ready:o,error:c,refetch:()=>{Zo=null,s(!0),u(null),i(!1),ij()}}}function Mc(){const{file:e,loading:t}=Kx();return{views:e.views,loading:t}}function dN(){const{file:e,loading:t}=Kx();return{layout:e.dashboard,loading:t}}function So(e){const{file:t,loading:n,ready:s,error:o,refetch:i}=Kx();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function Kf(e,t,n){const s=lN(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const c=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(c.error??`HTTP ${o.status}`)}const i=uN(await o.json());return kg(s)&&cN(i),i}function Pi(e){return Kf("POST","/api/saved-views",e)}function ef(e,t){return Kf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function iI(e){return Kf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Sg(e){return Kf("PUT","/api/dashboard",{slots:e})}const lI=["top","right","bottom","left"],No=Math.min,Sr=Math.max,tf=Math.round,fd=Math.floor,Ss=e=>({x:e,y:e}),cI={left:"right",right:"left",bottom:"top",top:"bottom"};function Ng(e,t,n){return Sr(e,No(t,n))}function Vs(e,t){return typeof e=="function"?e(t):e}function Hs(e){return e.split("-")[0]}function Gi(e){return e.split("-")[1]}function qx(e){return e==="x"?"y":"x"}function Gx(e){return e==="y"?"height":"width"}function ws(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Yx(e){return qx(ws(e))}function uI(e,t,n){n===void 0&&(n=!1);const s=Gi(e),o=Yx(e),i=Gx(o);let c=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=nf(c)),[c,nf(c)]}function dI(e){const t=nf(e);return[Cg(e),t,Cg(t)]}function Cg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const lj=["left","right"],cj=["right","left"],fI=["top","bottom"],pI=["bottom","top"];function mI(e,t,n){switch(e){case"top":case"bottom":return n?t?cj:lj:t?lj:cj;case"left":case"right":return t?fI:pI;default:return[]}}function hI(e,t,n,s){const o=Gi(e);let i=mI(Hs(e),n==="start",s);return o&&(i=i.map(c=>c+"-"+o),t&&(i=i.concat(i.map(Cg)))),i}function nf(e){const t=Hs(e);return cI[t]+e.slice(t.length)}function gI(e){return{top:0,right:0,bottom:0,left:0,...e}}function fN(e){return typeof e!="number"?gI(e):{top:e,right:e,bottom:e,left:e}}function rf(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function uj(e,t,n){let{reference:s,floating:o}=e;const i=ws(t),c=Yx(t),u=Gx(c),d=Hs(t),m=i==="y",h=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,y=s[u]/2-o[u]/2;let b;switch(d){case"top":b={x:h,y:s.y-o.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:g};break;case"left":b={x:s.x-o.width,y:g};break;default:b={x:s.x,y:s.y}}switch(Gi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function xI(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:c,elements:u,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Vs(t,e),C=fN(b),v=u[y?g==="floating"?"reference":"floating":g],k=rf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:d})),E=g==="floating"?{x:s,y:o,width:c.floating.width,height:c.floating.height}:c.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},A=rf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:S,strategy:d}):E);return{top:(k.top-A.top+C.top)/T.y,bottom:(A.bottom-k.bottom+C.bottom)/T.y,left:(k.left-A.left+C.left)/T.x,right:(A.right-k.right+C.right)/T.x}}const yI=50,bI=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:xI},d=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:g}=uj(m,s,d),y=s,b=0;const C={};for(let j=0;j<i.length;j++){const v=i[j];if(!v)continue;const{name:k,fn:E}=v,{x:S,y:T,data:A,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:o,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=S??h,g=T??g,C[k]={...C[k],...A},R&&b<yI&&(b++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(m=R.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:h,y:g}=uj(m,y,d)),j=-1)}return{x:h,y:g,placement:y,strategy:o,middlewareData:C}},vI=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:c,elements:u,middlewareData:d}=t,{element:m,padding:h=0}=Vs(e,t)||{};if(m==null)return{};const g=fN(h),y={x:n,y:s},b=Yx(o),C=Gx(b),j=await c.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",S=v?"clientHeight":"clientWidth",T=i.reference[C]+i.reference[b]-y[b]-i.floating[C],A=y[b]-i.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let P=R?R[S]:0;(!P||!await(c.isElement==null?void 0:c.isElement(R)))&&(P=u.floating[S]||i.floating[C]);const $=T/2-A/2,M=P/2-j[C]/2-1,_=No(g[k],M),D=No(g[E],M),V=_,K=P-j[C]-D,I=P/2-j[C]/2+$,F=Ng(V,I,K),q=!d.arrow&&Gi(o)!=null&&I!==F&&i.reference[C]/2-(I<V?_:D)-j[C]/2<0,Z=q?I<V?I-V:I-K:0;return{[b]:y[b]+Z,data:{[b]:F,centerOffset:I-F-Z,...q&&{alignmentOffset:Z}},reset:q}}}),wI=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:c,initialPlacement:u,platform:d,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...v}=Vs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Hs(o),E=ws(u),S=Hs(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(m.floating)),A=y||(S||!j?[nf(u)]:dI(u)),R=C!=="none";!y&&R&&A.push(...hI(u,j,C,T));const P=[u,...A],$=await d.detectOverflow(t,v),M=[];let _=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&M.push($[k]),g){const I=uI(o,c,T);M.push($[I[0]],$[I[1]])}if(_=[..._,{placement:o,overflows:M}],!M.every(I=>I<=0)){var D,V;const I=(((D=i.flip)==null?void 0:D.index)||0)+1,F=P[I];if(F&&(!(g==="alignment"?E!==ws(F):!1)||_.every(z=>ws(z.placement)===E?z.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:F}};let q=(V=_.filter(Z=>Z.overflows[0]<=0).sort((Z,z)=>Z.overflows[1]-z.overflows[1])[0])==null?void 0:V.placement;if(!q)switch(b){case"bestFit":{var K;const Z=(K=_.filter(z=>{if(R){const G=ws(z.placement);return G===E||G==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(G=>G>0).reduce((G,L)=>G+L,0)]).sort((z,G)=>z[1]-G[1])[0])==null?void 0:K[0];Z&&(q=Z);break}case"initialPlacement":q=u;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function dj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fj(e){return lI.some(t=>e[t]>=0)}const jI=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=Vs(e,t);switch(o){case"referenceHidden":{const c=await s.detectOverflow(t,{...i,elementContext:"reference"}),u=dj(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:fj(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...i,altBoundary:!0}),u=dj(c,n.floating);return{data:{escapedOffsets:u,escaped:fj(u)}}}default:return{}}}}},pN=new Set(["left","top"]);async function kI(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),c=Hs(n),u=Gi(n),d=ws(n)==="y",m=pN.has(c)?-1:1,h=i&&d?-1:1,g=Vs(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),d?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const SI=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:c,middlewareData:u}=t,d=await kI(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:c}}}}},NI=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...m}=Vs(e,t),h={x:n,y:s},g=await i.detectOverflow(t,m),y=ws(Hs(o)),b=qx(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",S=C+g[k],T=C-g[E];C=Ng(S,C,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",S=j+g[k],T=j-g[E];j=Ng(S,j,T)}const v=d.fn({...t,[b]:C,[y]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},CI=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:m=!0}=Vs(e,t),h={x:n,y:s},g=ws(o),y=qx(g);let b=h[y],C=h[g];const j=Vs(u,t),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(d){const S=y==="y"?"height":"width",T=i.reference[y]-i.floating[S]+v.mainAxis,A=i.reference[y]+i.reference[S]-v.mainAxis;b<T?b=T:b>A&&(b=A)}if(m){var k,E;const S=y==="y"?"width":"height",T=pN.has(Hs(o)),A=i.reference[g]-i.floating[S]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=i.reference[g]+i.reference[S]+(T?0:((E=c.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);C<A?C=A:C>R&&(C=R)}return{[y]:b,[g]:C}}}},EI=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:c,elements:u}=t,{apply:d=()=>{},...m}=Vs(e,t),h=await c.detectOverflow(t,m),g=Hs(o),y=Gi(o),b=ws(o)==="y",{width:C,height:j}=i.floating;let v,k;g==="top"||g==="bottom"?(v=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,v=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,S=C-h.left-h.right,T=No(j-h[v],E),A=No(C-h[k],S),R=!t.middlewareData.shift;let P=T,$=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(P=E),R&&!y){const _=Sr(h.left,0),D=Sr(h.right,0),V=Sr(h.top,0),K=Sr(h.bottom,0);b?$=C-2*(_!==0||D!==0?_+D:Sr(h.left,h.right)):P=j-2*(V!==0||K!==0?V+K:Sr(h.top,h.bottom))}await d({...t,availableWidth:$,availableHeight:P});const M=await c.getDimensions(u.floating);return C!==M.width||j!==M.height?{reset:{rects:!0}}:{}}}};function qf(){return typeof window<"u"}function Yi(e){return mN(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Es(e){var t;return(t=(mN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mN(e){return qf()?e instanceof Node||e instanceof Tr(e).Node:!1}function os(e){return qf()?e instanceof Element||e instanceof Tr(e).Element:!1}function Ks(e){return qf()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function pj(e){return!qf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}function Fc(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=as(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function TI(e){return/^(table|td|th)$/.test(Yi(e))}function Gf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const RI=/transform|translate|scale|rotate|perspective|filter/,AI=/paint|layout|strict|content/,Qo=e=>!!e&&e!=="none";let Th;function Qx(e){const t=os(e)?as(e):e;return Qo(t.transform)||Qo(t.translate)||Qo(t.scale)||Qo(t.rotate)||Qo(t.perspective)||!Jx()&&(Qo(t.backdropFilter)||Qo(t.filter))||RI.test(t.willChange||"")||AI.test(t.contain||"")}function PI(e){let t=Co(e);for(;Ks(t)&&!Di(t);){if(Qx(t))return t;if(Gf(t))return null;t=Co(t)}return null}function Jx(){return Th==null&&(Th=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Th}function Di(e){return/^(html|body|#document)$/.test(Yi(e))}function as(e){return Tr(e).getComputedStyle(e)}function Yf(e){return os(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Co(e){if(Yi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||pj(e)&&e.host||Es(e);return pj(t)?t.host:t}function hN(e){const t=Co(e);return Di(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&Fc(t)?t:hN(t)}function vc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=hN(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),c=Tr(o);if(i){const u=Eg(c);return t.concat(c,c.visualViewport||[],Fc(o)?o:[],u&&n?vc(u):[])}else return t.concat(o,vc(o,[],n))}function Eg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gN(e){const t=as(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Ks(e),i=o?e.offsetWidth:n,c=o?e.offsetHeight:s,u=tf(n)!==i||tf(s)!==c;return u&&(n=i,s=c),{width:n,height:s,$:u}}function Xx(e){return os(e)?e:e.contextElement}function Si(e){const t=Xx(e);if(!Ks(t))return Ss(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=gN(t);let c=(i?tf(n.width):n.width)/s,u=(i?tf(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const DI=Ss(0);function xN(e){const t=Tr(e);return!Jx()||!t.visualViewport?DI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $I(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function da(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Xx(e);let c=Ss(1);t&&(s?os(s)&&(c=Si(s)):c=Si(e));const u=$I(i,n,s)?xN(i):Ss(0);let d=(o.left+u.x)/c.x,m=(o.top+u.y)/c.y,h=o.width/c.x,g=o.height/c.y;if(i){const y=Tr(i),b=s&&os(s)?Tr(s):s;let C=y,j=Eg(C);for(;j&&s&&b!==C;){const v=Si(j),k=j.getBoundingClientRect(),E=as(j),S=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*v.y;d*=v.x,m*=v.y,h*=v.x,g*=v.y,d+=S,m+=T,C=Tr(j),j=Eg(C)}}return rf({width:h,height:g,x:d,y:m})}function Qf(e,t){const n=Yf(e).scrollLeft;return t?t.left+n:da(Es(e)).left+n}function yN(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Qf(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function LI(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",c=Es(s),u=t?Gf(t.floating):!1;if(s===c||u&&i)return n;let d={scrollLeft:0,scrollTop:0},m=Ss(1);const h=Ss(0),g=Ks(s);if((g||!g&&!i)&&((Yi(s)!=="body"||Fc(c))&&(d=Yf(s)),g)){const b=da(s);m=Si(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!i?yN(c,d):Ss(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-d.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-d.scrollTop*m.y+h.y+y.y}}function OI(e){return Array.from(e.getClientRects())}function II(e){const t=Es(e),n=Yf(e),s=e.ownerDocument.body,o=Sr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Sr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Qf(e);const u=-n.scrollTop;return as(s).direction==="rtl"&&(c+=Sr(t.clientWidth,s.clientWidth)-o),{width:o,height:i,x:c,y:u}}const mj=25;function _I(e,t){const n=Tr(e),s=Es(e),o=n.visualViewport;let i=s.clientWidth,c=s.clientHeight,u=0,d=0;if(o){i=o.width,c=o.height;const h=Jx();(!h||h&&t==="fixed")&&(u=o.offsetLeft,d=o.offsetTop)}const m=Qf(s);if(m<=0){const h=s.ownerDocument,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=mj&&(i-=C)}else m<=mj&&(i+=m);return{width:i,height:c,x:u,y:d}}function MI(e,t){const n=da(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ks(e)?Si(e):Ss(1),c=e.clientWidth*i.x,u=e.clientHeight*i.y,d=o*i.x,m=s*i.y;return{width:c,height:u,x:d,y:m}}function hj(e,t,n){let s;if(t==="viewport")s=_I(e,n);else if(t==="document")s=II(Es(e));else if(os(t))s=MI(t,n);else{const o=xN(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return rf(s)}function bN(e,t){const n=Co(e);return n===t||!os(n)||Di(n)?!1:as(n).position==="fixed"||bN(n,t)}function FI(e,t){const n=t.get(e);if(n)return n;let s=vc(e,[],!1).filter(u=>os(u)&&Yi(u)!=="body"),o=null;const i=as(e).position==="fixed";let c=i?Co(e):e;for(;os(c)&&!Di(c);){const u=as(c),d=Qx(c);!d&&u.position==="fixed"&&(o=null),(i?!d&&!o:!d&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Fc(c)&&!d&&bN(e,c))?s=s.filter(h=>h!==c):o=u,c=Co(c)}return t.set(e,s),s}function zI(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const c=[...n==="clippingAncestors"?Gf(t)?[]:FI(t,this._c):[].concat(n),s],u=hj(t,c[0],o);let d=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=hj(t,c[y],o);d=Sr(b.top,d),m=No(b.right,m),h=No(b.bottom,h),g=Sr(b.left,g)}return{width:m-g,height:h-d,x:g,y:d}}function BI(e){const{width:t,height:n}=gN(e);return{width:t,height:n}}function UI(e,t,n){const s=Ks(t),o=Es(t),i=n==="fixed",c=da(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Ss(0);function m(){d.x=Qf(o)}if(s||!s&&!i)if((Yi(t)!=="body"||Fc(o))&&(u=Yf(t)),s){const b=da(t,!0,i,t);d.x=b.x+t.clientLeft,d.y=b.y+t.clientTop}else o&&m();i&&!s&&o&&m();const h=o&&!s&&!i?yN(o,u):Ss(0),g=c.left+u.scrollLeft-d.x-h.x,y=c.top+u.scrollTop-d.y-h.y;return{x:g,y,width:c.width,height:c.height}}function Rh(e){return as(e).position==="static"}function gj(e,t){if(!Ks(e)||as(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Es(e)===n&&(n=n.ownerDocument.body),n}function vN(e,t){const n=Tr(e);if(Gf(e))return n;if(!Ks(e)){let o=Co(e);for(;o&&!Di(o);){if(os(o)&&!Rh(o))return o;o=Co(o)}return n}let s=gj(e,t);for(;s&&TI(s)&&Rh(s);)s=gj(s,t);return s&&Di(s)&&Rh(s)&&!Qx(s)?n:s||PI(e)||n}const VI=async function(e){const t=this.getOffsetParent||vN,n=this.getDimensions,s=await n(e.floating);return{reference:UI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function HI(e){return as(e).direction==="rtl"}const WI={convertOffsetParentRelativeRectToViewportRelativeRect:LI,getDocumentElement:Es,getClippingRect:zI,getOffsetParent:vN,getElementRects:VI,getClientRects:OI,getDimensions:BI,getScale:Si,isElement:os,isRTL:HI};function wN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KI(e,t){let n=null,s;const o=Es(e);function i(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=fd(g),j=fd(o.clientWidth-(h+y)),v=fd(o.clientHeight-(g+b)),k=fd(h),S={rootMargin:-C+"px "+-j+"px "+-v+"px "+-k+"px",threshold:Sr(0,No(1,d))||1};let T=!0;function A(R){const P=R[0].intersectionRatio;if(P!==d){if(!T)return c();P?c(!1,P):s=setTimeout(()=>{c(!1,1e-7)},1e3)}P===1&&!wN(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(A,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,S)}n.observe(e)}return c(!0),i}function qI(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,m=Xx(e),h=o||i?[...m?vc(m):[],...t?vc(t):[]]:[];h.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const g=m&&u?KI(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var S;(S=b)==null||S.observe(t)})),n()}),m&&!d&&b.observe(m),t&&b.observe(t));let C,j=d?da(e):null;d&&v();function v(){const k=da(e);j&&!wN(j,k)&&n(),j=k,C=requestAnimationFrame(v)}return n(),()=>{var k;h.forEach(E=>{o&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,d&&cancelAnimationFrame(C)}}const GI=SI,YI=NI,QI=wI,JI=EI,XI=jI,xj=vI,ZI=CI,e_=(e,t,n)=>{const s=new Map,o={platform:WI,...n},i={...o.platform,_c:s};return bI(e,t,{...o,platform:i})};var t_=typeof document<"u",n_=function(){},$d=t_?p.useLayoutEffect:n_;function sf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!sf(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!sf(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function jN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yj(e,t){const n=jN(e);return Math.round(t*n)/n}function Ah(e){const t=p.useRef(e);return $d(()=>{t.current=e}),t}function r_(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:i,floating:c}={},transform:u=!0,whileElementsMounted:d,open:m}=e,[h,g]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=p.useState(s);sf(y,s)||b(s);const[C,j]=p.useState(null),[v,k]=p.useState(null),E=p.useCallback(z=>{z!==R.current&&(R.current=z,j(z))},[]),S=p.useCallback(z=>{z!==P.current&&(P.current=z,k(z))},[]),T=i||C,A=c||v,R=p.useRef(null),P=p.useRef(null),$=p.useRef(h),M=d!=null,_=Ah(d),D=Ah(o),V=Ah(m),K=p.useCallback(()=>{if(!R.current||!P.current)return;const z={placement:t,strategy:n,middleware:y};D.current&&(z.platform=D.current),e_(R.current,P.current,z).then(G=>{const L={...G,isPositioned:V.current!==!1};I.current&&!sf($.current,L)&&($.current=L,Fs.flushSync(()=>{g(L)}))})},[y,t,n,D,V]);$d(()=>{m===!1&&$.current.isPositioned&&($.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[m]);const I=p.useRef(!1);$d(()=>(I.current=!0,()=>{I.current=!1}),[]),$d(()=>{if(T&&(R.current=T),A&&(P.current=A),T&&A){if(_.current)return _.current(T,A,K);K()}},[T,A,K,_,M]);const F=p.useMemo(()=>({reference:R,floating:P,setReference:E,setFloating:S}),[E,S]),q=p.useMemo(()=>({reference:T,floating:A}),[T,A]),Z=p.useMemo(()=>{const z={position:n,left:0,top:0};if(!q.floating)return z;const G=yj(q.floating,h.x),L=yj(q.floating,h.y);return u?{...z,transform:"translate("+G+"px, "+L+"px)",...jN(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:L}},[n,u,q.floating,h.x,h.y]);return p.useMemo(()=>({...h,update:K,refs:F,elements:q,floatingStyles:Z}),[h,K,F,q,Z])}const s_=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?xj({element:s.current,padding:o}).fn(n):{}:s?xj({element:s,padding:o}).fn(n):{}}}},o_=(e,t)=>{const n=GI(e);return{name:n.name,fn:n.fn,options:[e,t]}},a_=(e,t)=>{const n=YI(e);return{name:n.name,fn:n.fn,options:[e,t]}},i_=(e,t)=>({fn:ZI(e).fn,options:[e,t]}),l_=(e,t)=>{const n=QI(e);return{name:n.name,fn:n.fn,options:[e,t]}},c_=(e,t)=>{const n=JI(e);return{name:n.name,fn:n.fn,options:[e,t]}},u_=(e,t)=>{const n=XI(e);return{name:n.name,fn:n.fn,options:[e,t]}},d_=(e,t)=>{const n=s_(e);return{name:n.name,fn:n.fn,options:[e,t]}};var f_="Arrow",kN=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...i}=e;return r.jsx(vn.svg,{...i,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});kN.displayName=f_;var p_=kN;function m_(e){const[t,n]=p.useState(void 0);return jo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let c,u;if("borderBoxSize"in i){const d=i.borderBoxSize,m=Array.isArray(d)?d[0]:d;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Zx="Popper",[SN,NN]=pa(Zx),[h_,CN]=SN(Zx),EN=e=>{const{__scopePopper:t,children:n}=e,[s,o]=p.useState(null);return r.jsx(h_,{scope:t,anchor:s,onAnchorChange:o,children:n})};EN.displayName=Zx;var TN="PopperAnchor",RN=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=CN(TN,n),c=p.useRef(null),u=qn(t,c),d=p.useRef(null);return p.useEffect(()=>{const m=d.current;d.current=(s==null?void 0:s.current)||c.current,m!==d.current&&i.onAnchorChange(d.current)}),s?null:r.jsx(vn.div,{...o,ref:u})});RN.displayName=TN;var ey="PopperContent",[g_,x_]=SN(ey),AN=p.forwardRef((e,t)=>{var ye,Se,Te,Pe,Ke,ct;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,v=CN(ey,n),[k,E]=p.useState(null),S=qn(t,et=>E(et)),[T,A]=p.useState(null),R=m_(T),P=(R==null?void 0:R.width)??0,$=(R==null?void 0:R.height)??0,M=s+(i!=="center"?"-"+i:""),_=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},D=Array.isArray(m)?m:[m],V=D.length>0,K={padding:_,boundary:D.filter(b_),altBoundary:V},{refs:I,floatingStyles:F,placement:q,isPositioned:Z,middlewareData:z}=r_({strategy:"fixed",placement:M,whileElementsMounted:(...et)=>qI(...et,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[o_({mainAxis:o+$,alignmentAxis:c}),d&&a_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?i_():void 0,...K}),d&&l_({...K}),c_({...K,apply:({elements:et,rects:ot,availableWidth:X,availableHeight:Me})=>{const{width:Ce,height:Ie}=ot.reference,Ye=et.floating.style;Ye.setProperty("--radix-popper-available-width",`${X}px`),Ye.setProperty("--radix-popper-available-height",`${Me}px`),Ye.setProperty("--radix-popper-anchor-width",`${Ce}px`),Ye.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),T&&d_({element:T,padding:u}),v_({arrowWidth:P,arrowHeight:$}),y&&u_({strategy:"referenceHidden",...K})]}),[G,L]=$N(q),H=ca(C);jo(()=>{Z&&(H==null||H())},[Z,H]);const re=(ye=z.arrow)==null?void 0:ye.x,U=(Se=z.arrow)==null?void 0:Se.y,ue=((Te=z.arrow)==null?void 0:Te.centerOffset)!==0,[ge,se]=p.useState();return jo(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:Z?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(Pe=z.transformOrigin)==null?void 0:Pe.x,(Ke=z.transformOrigin)==null?void 0:Ke.y].join(" "),...((ct=z.hide)==null?void 0:ct.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(g_,{scope:n,placedSide:G,onArrowChange:A,arrowX:re,arrowY:U,shouldHideArrow:ue,children:r.jsx(vn.div,{"data-side":G,"data-align":L,...j,ref:S,style:{...j.style,animation:Z?void 0:"none"}})})})});AN.displayName=ey;var PN="PopperArrow",y_={top:"bottom",right:"left",bottom:"top",left:"right"},DN=p.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=x_(PN,s),c=y_[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(p_,{...o,ref:n,style:{...o.style,display:"block"}})})});DN.displayName=PN;function b_(e){return e!==null}var v_=e=>({name:"transformOrigin",options:e,fn(t){var v,k,E;const{placement:n,rects:s,middlewareData:o}=t,c=((v=o.arrow)==null?void 0:v.centerOffset)!==0,u=c?0:e.arrowWidth,d=c?0:e.arrowHeight,[m,h]=$N(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=o.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=o.arrow)==null?void 0:E.y)??0)+d/2;let C="",j="";return m==="bottom"?(C=c?g:`${y}px`,j=`${-d}px`):m==="top"?(C=c?g:`${y}px`,j=`${s.floating.height+d}px`):m==="right"?(C=`${-d}px`,j=c?g:`${b}px`):m==="left"&&(C=`${s.floating.width+d}px`,j=c?g:`${b}px`),{data:{x:C,y:j}}}});function $N(e){const[t,n="center"]=e.split("-");return[t,n]}var w_=EN,j_=RN,k_=AN,S_=DN,N_=Symbol("radix.slottable");function C_(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=N_,t}var E_=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),T_="VisuallyHidden",LN=p.forwardRef((e,t)=>r.jsx(vn.span,{...e,ref:t,style:{...E_,...e.style}}));LN.displayName=T_;var R_=LN,[Jf]=pa("Tooltip",[NN]),Xf=NN(),ON="TooltipProvider",A_=700,Tg="tooltip.open",[P_,ty]=Jf(ON),IN=e=>{const{__scopeTooltip:t,delayDuration:n=A_,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,c=p.useRef(!0),u=p.useRef(!1),d=p.useRef(0);return p.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),r.jsx(P_,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:p.useCallback(m=>{u.current=m},[]),disableHoverableContent:o,children:i})};IN.displayName=ON;var wc="Tooltip",[D_,zc]=Jf(wc),_N=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:c,delayDuration:u}=e,d=ty(wc,e.__scopeTooltip),m=Xf(t),[h,g]=p.useState(null),y=bi(),b=p.useRef(0),C=c??d.disableHoverableContent,j=u??d.delayDuration,v=p.useRef(!1),[k,E]=Af({prop:s,defaultProp:o??!1,onChange:P=>{P?(d.onOpen(),document.dispatchEvent(new CustomEvent(Tg))):d.onClose(),i==null||i(P)},caller:wc}),S=p.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,E(!0)},[E]),A=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),R=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,E(!0),b.current=0},j)},[j,E]);return p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(w_,{...m,children:r.jsx(D_,{scope:t,contentId:y,open:k,stateAttribute:S,trigger:h,onTriggerChange:g,onTriggerEnter:p.useCallback(()=>{d.isOpenDelayedRef.current?R():T()},[d.isOpenDelayedRef,R,T]),onTriggerLeave:p.useCallback(()=>{C?A():(window.clearTimeout(b.current),b.current=0)},[A,C]),onOpen:T,onClose:A,disableHoverableContent:C,children:n})})};_N.displayName=wc;var Rg="TooltipTrigger",MN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=zc(Rg,n),i=ty(Rg,n),c=Xf(n),u=p.useRef(null),d=qn(t,u,o.onTriggerChange),m=p.useRef(!1),h=p.useRef(!1),g=p.useCallback(()=>m.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(j_,{asChild:!0,...c,children:r.jsx(vn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:d,onPointerMove:Zt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:Zt(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:Zt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Zt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:Zt(e.onBlur,o.onClose),onClick:Zt(e.onClick,o.onClose)})})});MN.displayName=Rg;var ny="TooltipPortal",[$_,L_]=Jf(ny,{forceMount:void 0}),FN=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=zc(ny,t);return r.jsx($_,{scope:t,forceMount:n,children:r.jsx(ma,{present:n||i.open,children:r.jsx(wx,{asChild:!0,container:o,children:s})})})};FN.displayName=ny;var $i="TooltipContent",zN=p.forwardRef((e,t)=>{const n=L_($i,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,c=zc($i,e.__scopeTooltip);return r.jsx(ma,{present:s||c.open,children:c.disableHoverableContent?r.jsx(BN,{side:o,...i,ref:t}):r.jsx(O_,{side:o,...i,ref:t})})}),O_=p.forwardRef((e,t)=>{const n=zc($i,e.__scopeTooltip),s=ty($i,e.__scopeTooltip),o=p.useRef(null),i=qn(t,o),[c,u]=p.useState(null),{trigger:d,onClose:m}=n,h=o.current,{onPointerInTransitChange:g}=s,y=p.useCallback(()=>{u(null),g(!1)},[g]),b=p.useCallback((C,j)=>{const v=C.currentTarget,k={x:C.clientX,y:C.clientY},E=z_(k,v.getBoundingClientRect()),S=B_(k,E),T=U_(j.getBoundingClientRect()),A=H_([...S,...T]);u(A),g(!0)},[g]);return p.useEffect(()=>()=>y(),[y]),p.useEffect(()=>{if(d&&h){const C=v=>b(v,h),j=v=>b(v,d);return d.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{d.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[d,h,b,y]),p.useEffect(()=>{if(c){const C=j=>{const v=j.target,k={x:j.clientX,y:j.clientY},E=(d==null?void 0:d.contains(v))||(h==null?void 0:h.contains(v)),S=!V_(k,c);E?y():S&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[d,h,c,m,y]),r.jsx(BN,{...e,ref:i})}),[I_,__]=Jf(wc,{isInside:!1}),M_=C_("TooltipContent"),BN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:c,...u}=e,d=zc($i,n),m=Xf(n),{onClose:h}=d;return p.useEffect(()=>(document.addEventListener(Tg,h),()=>document.removeEventListener(Tg,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(d.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]),r.jsx(vx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(k_,{"data-state":d.stateAttribute,...m,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(M_,{children:s}),r.jsx(I_,{scope:n,isInside:!0,children:r.jsx(R_,{id:d.contentId,role:"tooltip",children:o||s})})]})})});zN.displayName=$i;var UN="TooltipArrow",F_=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Xf(n);return __(UN,n).isInside?null:r.jsx(S_,{...o,...s,ref:t})});F_.displayName=UN;function z_(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,o,i)){case i:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function B_(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function U_(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function V_(e,t){const{x:n,y:s}=e;let o=!1;for(let i=0,c=t.length-1;i<t.length;c=i++){const u=t[i],d=t[c],m=u.x,h=u.y,g=d.x,y=d.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(o=!o)}return o}function H_(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),W_(t)}function W_(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const i=t[t.length-1],c=t[t.length-2];if((i.x-c.x)*(o.y-c.y)>=(i.y-c.y)*(o.x-c.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const i=n[n.length-1],c=n[n.length-2];if((i.x-c.x)*(o.y-c.y)>=(i.y-c.y)*(o.x-c.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var K_=IN,q_=_N,G_=MN,Y_=FN,VN=zN;const ia=K_,Nr=q_,Cr=G_,ur=p.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(Y_,{children:r.jsx(VN,{ref:s,sideOffset:t,className:we("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));ur.displayName=VN.displayName;function ry({items:e,align:t="end"}){const[n,s]=p.useState(!1),[o,i]=p.useState(null),c=p.useRef(null);if(p.useEffect(()=>{if(!n){i(null);return}function d(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(d,m){const h=d.icon,g=we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",d.disabled?"opacity-50 cursor-not-allowed":d.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?d.active?r.jsx(Rr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:d.label})]});if(d.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return d.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:C}),r.jsx(ur,{side:"left",children:d.disabledReason})]},d.key):r.jsx("div",{children:C},d.key)}return d.href?r.jsx(Ee,{to:d.href,className:g,onClick:()=>s(!1),children:b},d.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var C;(C=d.onSelect)==null||C.call(d),s(!1)},children:b},d.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(d=>!d),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(GA,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:we("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:r.jsx(ia,{delayDuration:200,children:e.map(d=>{if(d.submenu&&d.submenu.length>0){const m=d.icon,h=o===d.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>i(h?null:d.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:d.label}),h?r.jsx(pr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(Rk,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?d.submenu.map(g=>u(g,!0)):null]},d.key)}return u(d,!1)})})})]})}function bj(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const Q_={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function J_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function X_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function Z_(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(s);if(Number.isNaN(o))return!1;if(t.preset){const u=Q_[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-o>u:o>=n-u&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!i&&!c?!0:!(i&&o<J_(i)||c&&o>X_(c))}function e5(e,t,n={}){const{workspace:s,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const c=ze(t.status),u=ze(t.priority),d=ze(t.type),m=ze(t.assignee),h=ze(t.project),g=ze(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||d.length&&!d.includes(e.type??"")||y==="stale"&&!bj(e.updated)||y==="fresh"&&bj(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!Z_(e,t.dateRange))return!1;if(o){const b=o.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function jc(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const Ld={phaseLadder:[{phase:"draft",when:"*",next:"Fill in the objective and acceptance criteria"},{phase:"ready_for_planning",when:"hasRealObjective:true AND acRealTotal > 0",next:"Write a plan and get it approved"},{phase:"ready_to_implement",when:"planApproved:true",next:"Start implementing"},{phase:"in_progress",when:"planApproved:true AND implementationStarted:true",next:"Finish acceptance criteria, then request review"},{phase:"review",when:"acAllChecked:true OR reviewRequested:true",next:"Complete, or address review feedback"}],disposition:[{when:"parked:true",is:"parked"},{when:"blocked:true",is:"blocked"},{when:null,is:"active"}],headline:{terminal:"passthrough",parked:"parked",blocked:"blocked",active:"phase"}};function t5(e,t,n=()=>null){const s=[],o=new Set(t.statuses.map(u=>u.id));e.phaseLadder.length===0&&s.push("phaseLadder must have at least one rung");for(const u of e.phaseLadder){o.has(u.phase)||s.push(`phaseLadder rung "${u.phase}" is not a defined status id`);const d=u.when==="*"?null:n(u.when);d&&s.push(`phaseLadder rung "${u.phase}": invalid condition — ${d}`)}const i=new Set(["active","blocked","parked"]);for(const u of e.disposition)if(i.has(u.is)||s.push(`disposition "${u.is}" is not valid (expected active, blocked, or parked — terminal is never a rule)`),u.when!==null){const d=n(u.when);d&&s.push(`disposition rule "${u.is}": invalid condition — ${d}`)}const c=e.disposition.map((u,d)=>u.when===null?d:-1).filter(u=>u>=0);c.length===0?s.push("disposition rules must end with an `else:` arm (a rule with when: null)"):c.length>1?s.push("disposition rules must have exactly one `else:` arm (when: null)"):c[0]!==e.disposition.length-1&&s.push("the `else:` arm (when: null) must be the LAST disposition rule — rules after it are unreachable");for(const u of["parked","blocked"])o.has(e.headline[u])||s.push(`headline.${u} → "${e.headline[u]}" is not a defined status id (add the definition or run migrate-derive)`);return s}const HN={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],transitionsCustom:!1,custom:!1,derive:Ld,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let ac=null,ea=null;function n5(){return ac?Promise.resolve(ac):ea||(ea=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(ac=e,ea=null,e)).catch(()=>(ea=null,HN)),ea)}function ha(){const[e,t]=p.useState(()=>ac??HN);return p.useEffect(()=>{n5().then(t)},[]),e}function vj(){ac=null,ea=null}function Bc(e,t){const n=e.statuses.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}const wj={critical:0,high:1,medium:2,low:3};function pd(e){return Date.parse(e??"")||0}function Uc(e,t,n){return[...e].sort((o,i)=>{let c=0;switch(t){case"title":c=o.title.localeCompare(i.title);break;case"status":c=o.status.localeCompare(i.status);break;case"priority":c=(wj[o.priority]??99)-(wj[i.priority]??99);break;case"assignee":c=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":c=o.dependsOn.length-i.dependsOn.length;break;case"created":c=pd(o.created)-pd(i.created);break;case"updated":c=pd(o.updated)-pd(i.updated);break}return n==="asc"?c:-c})}function r5(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function WN(e,t,n={}){const{workspace:s,includeArchived:o=!1,now:i=Date.now()}=n,c={now:i};return e.filter(u=>{if(u.archived===!0&&!o)return!1;if(s){if(s==="_ungrouped"){if(u.projectWorkspace!=null)return!1}else if(u.projectWorkspace!==s)return!1}if(!t)return!0;const d=r5(u);return t.predicate(d,c)})}const Zf={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function ep(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},s=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(o=>o.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:s}}function s5(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const s=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(s))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:s,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:s,type:"attestation",binds:i})}}return t}function Ag(e){const t=[],n=new Map;for(const s of Object.keys(Zf))n.set(s,"built-in");for(const s of Object.keys(Hf))n.set(s,"built-in");for(const s of e??[]){const o=((s==null?void 0:s.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(s==null?void 0:s.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(s.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${s.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const m=(s.binds??"none").toString().trim()||"none";if(m!=="plan"&&m!=="commit"&&m!=="none"){t.push(`fact "${o}": invalid binds "${s.binds}" — expected plan, commit, or none`);continue}}const u=ep(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,d=u.find(m=>n.has(m));if(d!==void 0){const m=n.get(d);m==="built-in"?t.push(`fact "${o}": exported field "${d}" collides with a built-in field`):m===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${d}" collides with fact "${m}"`);continue}for(const m of u)n.set(m,o)}return t}function o5(e){const t=new Set([...Object.keys(Zf),...Object.keys(Hf)]),n=[];for(const s of e){const o=ep(s).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(s)}}return n}function KN(e,t){const n=ep(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:s=>s[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:s=>s[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:s=>s[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:s=>s[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:s=>s[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:s=>s[n.exports.fact]}}function sy(e){const t={...Zf};for(const n of e)KN(t,n);return t}function qN(e){const t={...Hf};for(const n of e)KN(t,n);return t}function GN(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","pinned"],n=[];for(const s of e){const o=ep(s);s.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function Et({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Li='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function tp({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:o,canDrop:i,onMove:c,getExternalDragData:u,onCardContextMenu:d,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const C=p.useMemo(()=>new Set(h??[]),[h]),j=p.useMemo(()=>e.filter(I=>!C.has(I.id)),[e,C]),v=p.useMemo(()=>e.filter(I=>C.has(I.id)),[e,C]),[k,E]=p.useState(null),[S,T]=p.useState(null),A=p.useRef(null),R=p.useMemo(()=>new Map(t.map(I=>[n(I),I])),[n,t]),P=p.useMemo(()=>j.map(I=>({column:I,items:t.filter(F=>s(F)===I.id)})),[j,s,t]),$=k?R.get(k)??null:null;function M(I){if(!$)return{allowed:!1};const F=s($);return(i==null?void 0:i({item:$,fromColumnId:F,toColumnId:I}))??{allowed:!0}}function _(){E(null),T(null)}function D(I,F,q){if(b)return;const Z=(u==null?void 0:u(F))??null;!c&&!Z||(I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",q),Z&&I.dataTransfer.setData("application/json",JSON.stringify(Z)),c&&E(q))}function V(I,F,q){b||!c||!$||!M(F).allowed||(I.preventDefault(),I.dataTransfer.dropEffect="move",T(z=>(z==null?void 0:z.columnId)===F&&z.index===q?z:{columnId:F,index:q}))}async function K(I,F,q){var H;if(I.preventDefault(),b||!c||!$){_();return}const Z=s($),G=(((H=P.find(re=>re.column.id===Z))==null?void 0:H.items)??[]).findIndex(re=>n(re)===n($));if(!M(F).allowed||G<0){_();return}if(Z===F&&(q===G||q===G+1)){_();return}try{await c({item:$,fromColumnId:Z,toColumnId:F,fromIndex:G,toIndex:q})}finally{_()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[v.length>0&&g?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),v.map(I=>r.jsxs("button",{type:"button",onClick:()=>g(I.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${I.title}" column`,children:[I.title," ×"]},I.id))]}):null,r.jsx("div",{className:we("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:P.map(({column:I,items:F})=>{const q=M(I.id),Z=(S==null?void 0:S.columnId)===I.id;return r.jsxs("section",{className:we("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",$&&!q.allowed?"border-dashed opacity-65":"",$&&q.allowed?"border-primary/30 bg-accent/30":"",Z?"ring-2 ring-ring/30":""),title:$&&!q.allowed?q.reason:void 0,children:[r.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:we("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:I.title}),I.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:I.description}):null]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:F.length}),g?r.jsx("button",{type:"button",onClick:()=>g(I.id),className:"rounded-full border border-transparent px-1.5 py-0.5 text-xs text-muted-foreground hover:border-border hover:text-foreground",title:`Hide "${I.title}" column`,"aria-label":`Hide column ${I.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:z=>V(z,I.id,F.length),onDrop:z=>K(z,I.id,F.length),children:[F.length===0?b?r.jsx("div",{className:"flex min-h-[128px] items-center justify-center rounded-lg border border-border/60 bg-background/50 px-4 text-center text-sm text-muted-foreground",children:typeof m=="function"?m(I):m}):r.jsx(a5,{active:(S==null?void 0:S.columnId)===I.id&&S.index===0,disabled:!!$&&!q.allowed,children:typeof m=="function"?m(I):m}):null,F.map((z,G)=>{const L=n(z),H=k===L;return r.jsxs(p.Fragment,{children:[r.jsx("div",{className:we("h-2 rounded-full transition",(S==null?void 0:S.columnId)===I.id&&S.index===G?"bg-primary/70":"bg-transparent"),onDragOver:re=>V(re,I.id,G),onDrop:re=>K(re,I.id,G)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:re=>{A.current=re.target},onDragStart:re=>{const U=A.current;if(U!=null&&U.closest(Li)){re.preventDefault();return}D(re,z,L)},onDragEnd:_,onContextMenu:re=>{if(!d)return;const U=re.target;U!=null&&U.closest(Li)||d(z,re)},className:we("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",H?"scale-[0.98] opacity-50":""),children:o(z,{dragging:H})})]},L)}),F.length>0&&!b?r.jsx("div",{className:we("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(S==null?void 0:S.columnId)===I.id&&S.index===F.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",$&&!q.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},I.id)})})]})}function a5({active:e,disabled:t,children:n}){return r.jsx("div",{className:we("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const Yl="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Ph="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",i5="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",l5="border-status-review-foreground/30 bg-status-review text-status-review-foreground",c5="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",u5="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",d5="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",of={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Yl,icon:zi},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Yl,icon:UA},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Yl,icon:Pk},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Ph,icon:cP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Ph,icon:ix},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:i5,icon:Ud},review:{label:"Review",description:"Ready for inspection or approval.",className:l5,icon:fP},completed:{label:"Completed",description:"Finished successfully.",className:c5,icon:rx},failed:{label:"Failed",description:"Could not be completed as planned.",className:u5,icon:Ud},active:{label:"Active",description:"The project has active or review work in flight.",className:Ph,icon:lg},stopped:{label:"Stopped",description:"Session ended without completing.",className:Yl,icon:zA},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:d5,icon:lg}};function af(e){const t=of[e];return t||{className:Yl,icon:lg,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function YN(e,t){return we("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal","shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]",af(e).className,t)}function bn({status:e,className:t,showIcon:n=!0,progress:s}){const o=af(e),i=o.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,d=c?`${o.label} — ${o.description} (${s.checked}/${s.total} criteria)`:`${o.label} — ${o.description}`,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-u)})]}),r.jsx(i,{className:"h-2.5 w-2.5"})]}):r.jsx(i,{className:"h-3.5 w-3.5 shrink-0"}):null;return r.jsxs("span",{title:d,className:YN(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:o.label})]})}function np(e){var t;return((t=of[e])==null?void 0:t.description)??`Status: ${e}`}const QN={definitions:[{id:"feature",label:"Feature"},{id:"bug",label:"Bug"},{id:"refactor",label:"Refactor"},{id:"research",label:"Research"},{id:"chore",label:"Chore"}],default:"feature",custom:!1};let Od=null,ei=null;function f5(){return Od?Promise.resolve(Od):ei||(ei=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Od=e,ei=null,e)).catch(()=>(ei=null,QN)),ei)}function rp(){const[e,t]=p.useState(()=>Od??QN);return p.useEffect(()=>{f5().then(t)},[]),e}function Ni(e,t){if(!t)return"—";const n=e.definitions.find(s=>s.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function p5(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ga({type:e,className:t,compact:n=!1}){const s=rp();if(!e)return null;const o=p5(s,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return r.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:c,className:we("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:i})}async function Vc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return m5(e)}function m5(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function Br({value:e,label:t,disabled:n=!1,disabledReason:s,onError:o}){const[i,c]=p.useState(!1);async function u(){n||(await Vc(e)?(c(!0),setTimeout(()=>c(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(Vd,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?r.jsx(Rr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Vd,{className:"h-3 w-3","aria-hidden":"true"})})}function h5(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function g5({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:o,compact:i=!1}){const c=ha(),[u,d]=p.useState(()=>new Set(o.collapsed));p.useEffect(()=>{d(new Set(o.collapsed))},[o]);const m=h=>{d(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:we("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=Uc(e.filter(C=>C.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=Bc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className:we("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx(pr,{className:we("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:we("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:g.length})]}),y&&r.jsx("ul",{className:we("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:g.map(C=>{const j=h5(C);return r.jsx("li",{children:r.jsxs(Ee,{to:j,className:we("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:zn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function x5(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function y5({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:o=!1}){const i=new Set(s.hidden);i.delete("title");const c=h=>!i.has(h),u=Uc(e,t,n),d=o?"py-2 pr-3":"py-3 pr-4",m=o?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:we("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[c("title")?r.jsx("th",{className:we("font-medium",d),children:"Assignment"}):null,c("status")?r.jsx("th",{className:we("font-medium",d),children:"Status"}):null,c("priority")?r.jsx("th",{className:we("font-medium",d),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:we("font-medium",d),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:we("font-medium",d),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:we("font-medium",d),children:"Created"}):null,c("updated")?r.jsx("th",{className:we("font-medium",d),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=x5(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:d,children:[r.jsx(Ee,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:d,children:r.jsx(bn,{status:h.status,className:"max-w-[150px]"})}):null,c("priority")?r.jsx("td",{className:we("capitalize text-muted-foreground",d),children:h.priority}):null,c("assignee")?r.jsx("td",{className:we("text-muted-foreground",d),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:we("text-muted-foreground",d),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:we("text-muted-foreground",d),children:zn(h.created)}):null,c("updated")?r.jsx("td",{className:we("text-muted-foreground",d),children:zn(h.updated)}):null]},y)})})]})})}function JN({view:e,compact:t,emptyDescription:n}){const{data:s,loading:o,error:i}=Cf(),c=ha(),u=p.useMemo(()=>c.order.map(h=>({id:h,title:Bc(c,h),description:np(h)})),[c]),d=p.useMemo(()=>qN(c.factDeclarations),[c.factDeclarations]),m=p.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??sc(e.config.filters);let g=null;h.trim()!==""&&(g=Vx(h,d).query);const y=WN(s.assignments,g,{workspace:e.workspace});return Uc(y,e.config.sortField,e.config.sortDirection)},[s,e,d]);if(o&&!s)return r.jsx(xt,{label:"Loading assignments…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(m.length===0)return r.jsx(Et,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(tp,{compact:t,dragDisabled:!0,columns:u,items:m,getItemId:h=>h.slug||h.id,getColumnId:h=>h.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:h=>t?r.jsx(b5,{item:h}):r.jsx(v5,{item:h})});case"list":return r.jsx(g5,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(y5,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function b5({item:e}){const t=jc(e);return r.jsxs("div",{className:we("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:zn(e.updated)})]}),e.id?r.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),r.jsx(Br,{value:e.id})]}):null]})}function v5({item:e}){const t=jc(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ga,{type:e.type,compact:!0}),r.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:zn(e.updated)})]})]})}function w5({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:o,refetch:i}=So(e);return s?r.jsx(xt,{label:"Loading view…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),r.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(JN,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),r.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function XN({sessions:e}){return r.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:r.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:aa.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:aa.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(j5,{session:t})},t.sessionId))})]})}function j5({session:e}){const t=fn(),[n,s]=p.useState(!1),o=k5(e,t),i=S5(e),c=!e.path;return r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ee,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",Wk(e.started)]}),n&&e.path?r.jsxs("div",{className:"mt-1 space-y-0.5",children:[r.jsx("code",{className:"block w-full select-all rounded bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",children:e.path}),r.jsx("p",{className:"text-[10px] text-muted-foreground",children:aa.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Br,{value:e.path,label:aa.recentSessionsCopyPathLabel,disabled:c,disabledReason:aa.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function k5(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function S5(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const N5={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function ta(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function C5(e,t,n=Date.now()){const s=ta(e);if(t.preset){const c=N5[t.preset];return c?t.preset.startsWith("older_")?s<n-c:s>=n-c:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&s<o||i!==null&&Number.isFinite(i)&&s>i)}function E5(e,t,n=Date.now()){const{dateRange:s,project:o,agent:i,sessionStatus:c}=t,u=new Set(o??[]),d=new Set(i??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!C5(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(d.size>0&&!Array.from(d).some(y=>y.toLowerCase()===h.agent.toLowerCase()))return!1;if(m.size>0){let g=!1;for(const y of m){switch(y){case"active":h.status==="active"&&(g=!0);break;case"ended":(h.status==="completed"||h.status==="stopped")&&(g=!0);break;case"tracked":g=!0;break}if(g)break}if(!g)return!1}return!0})}function T5(e,t,n){return[...e].sort((o,i)=>{let c=0;switch(t){case"started":c=ta(o.started)-ta(i.started);break;case"lastActivity":c=ta(o.updatedAt)-ta(i.updatedAt);break;case"projectName":{const u=o.projectSlug??"",d=i.projectSlug??"";c=u.localeCompare(d);break}case"agentName":c=o.agent.localeCompare(i.agent);break;default:c=ta(o.started)-ta(i.started);break}return n==="asc"?c:-c})}function R5(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function A5({view:e,emptyDescription:t}){const{data:n,loading:s,error:o}=Ef(),i=p.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,d=u.filters,m={dateRange:d.dateRange?{...d.dateRange,field:"started"}:void 0,project:ze(d.project),agent:ze(d.agent),sessionStatus:ze(d.sessionStatus),limit:u.limit};let h=E5(c,m);return h=T5(h,u.sortField,u.sortDirection),h=R5(h,u.limit),h},[n,e]);return s&&!n?r.jsx(xt,{label:"Loading sessions…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?r.jsx(Et,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(XN,{sessions:i})}function P5({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:o}=Mc(),[i,c]=p.useState(!1),u=p.useRef(null),d=p.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);p.useEffect(()=>{if(!i)return;function g(b){u.current&&!u.current.contains(b.target)&&c(!1)}function y(b){b.key==="Escape"&&c(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[i]);const m=e?s.find(g=>g.id===e)??null:null,h=o?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:o,onClick:()=>c(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(pr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(null)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),d.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",y&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:g.name})]},g.id)})]}),r.jsx("div",{className:"my-1 border-t border-border/40"}),r.jsxs("button",{type:"button",onClick:()=>{c(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[r.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const D5={__unassigned__:"Unassigned",__standalone__:"No project"};function yn({options:e,value:t,onChange:n,allLabel:s="Any",className:o,disabled:i,ariaLabel:c}){const[u,d]=p.useState(!1),m=p.useRef(null),h=p.useRef(null),g=p.useRef([]),y=p.useMemo(()=>{const E=new Set(e.map(T=>T.value)),S=t.filter(T=>!E.has(T)).map(T=>({value:T,label:D5[T]??T}));return[...e,...S]},[e,t]),b=p.useMemo(()=>new Set(t),[t]);p.useEffect(()=>{if(!u)return;function E(S){m.current&&!m.current.contains(S.target)&&d(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),p.useEffect(()=>{var E;u&&((E=g.current[0])==null||E.focus())},[u]);const C=p.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(S=>S.value===t[0]);return E?E.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(E){n(b.has(E)?t.filter(S=>S!==E):[...t,E])}function v(E){var T;const S=Math.max(0,Math.min(E,y.length-1));(T=g.current[S])==null||T.focus()}function k(E){var R;const S=g.current,T=document.activeElement,A=S.findIndex(P=>P===T);E.key==="ArrowDown"?(E.preventDefault(),v(A<0?0:A+1)):E.key==="ArrowUp"?(E.preventDefault(),v(A<0?y.length-1:A-1)):E.key==="Home"?(E.preventDefault(),v(0)):E.key==="End"?(E.preventDefault(),v(y.length-1)):E.key==="Escape"&&(E.preventDefault(),d(!1),(R=h.current)==null||R.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:i,"aria-haspopup":"menu","aria-expanded":u,"aria-label":c,onClick:()=>d(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),d(!0))},className:we("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[r.jsx("span",{className:"truncate",children:C}),r.jsx(pr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":c,onKeyDown:k,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(E=>E.value)),children:"Select all"}),r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((E,S)=>{const T=b.has(E.value);return r.jsxs("button",{ref:A=>{g.current[S]=A},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(E.value),className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",T?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{className:we("flex h-4 w-4 shrink-0 items-center justify-center rounded border",T?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:T?r.jsx(Rr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const jj={last_24h:"Last 24 hours",last_7d:"Last 7 days",last_30d:"Last 30 days",last_90d:"Last 90 days",older_7d:"Older than 7 days",older_30d:"Older than 30 days"},$5=["updated","created"];function sp({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[o,i]=p.useState(!1),c=p.useRef(null),u=(e==null?void 0:e.field)??"updated",d=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=p.useState(d);p.useEffect(()=>h(d),[d]),p.useEffect(()=>{if(!o)return;function k(S){c.current&&!c.current.contains(S.target)&&i(!1)}function E(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[o]);const g=!!(e&&(e.preset||e.from||e.to)),y=p.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${jj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[g,e,u]);function b(k){t(e?{...e,field:k}:{field:k,preset:"",from:"",to:""})}function C(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function v(k,E){const S={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[k]:E})}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":s,onClick:()=>i(k=>!k),className:we("editor-input inline-flex items-center justify-between gap-1.5 text-left",g&&"border-foreground/40 text-foreground",n),children:[r.jsx("span",{className:"truncate",children:y}),r.jsx(pr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?r.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[r.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:$5.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:we("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",u===k?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:k},k))}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Dh,{label:"Any date",selected:!g,onClick:j}),wO.map(k=>r.jsx(Dh,{label:jj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>C(k)},k)),r.jsx(Dh,{label:"Custom range…",selected:m,onClick:()=>{h(!0),t({field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),m?r.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",r.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:k=>v("from",k.target.value),className:"editor-input w-40"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",r.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:k=>v("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function Dh({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:we("flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-sm transition hover:bg-foreground/5",t?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{children:e}),t?r.jsx(Rr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const L5=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function O5(e,t){const n={};for(const[s,o]of Object.entries(e))L5.has(s)||(n[s]=o);return{...n,...t}}function lf(e,t,n){return{...e,viewMode:t.viewMode,filters:O5(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function I5(e,t){var y,b;const n={},s=ze(e.status);s.length&&(n.status=s);const o=ze(e.type);o.length&&(n.type=o);const i=ze(e.priority);i.length&&(n.priority=i);const c=ze(e.assignee);c.length&&(n.assignee=c);const u=ze(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const C=ze(e.project);C.length&&(n.project=C)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const d=ze(e.sessionStatus);d.length&&(n.sessionStatus=d);const m=ze(e.agent);m.length&&(n.agent=m),e.dateRange&&(n.dateRange=e.dateRange);const h=(y=e.search)==null?void 0:y.trim();h&&(n.search=h);const g=(b=e.query)==null?void 0:b.trim();return g&&(n.query=g),n}function Oi(e){const t={viewMode:e.state.viewMode,filters:I5(e.state.filters,e.context.projectSlug),sortField:e.state.sortField,sortDirection:e.state.sortDirection,listSectionVisibility:{collapsed:[...e.state.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...e.state.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...e.state.tableColumnVisibility.hidden]}};return{name:e.name.trim(),workspace:e.context.workspace,config:t}}const ti={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},md={sortField:"started",sortDirection:"desc"};function ZN(e,t){const{config:n}=Oi({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function oy(e,t){const{config:n}=Oi({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function la(e){if(!e)return;if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return;const s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function op(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function eC(e,t){var s,o,i,c,u,d,m,h,g,y,b,C,j,v,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,ze(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,ze(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,ze(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,ze(n.filters.assignee)),(d=t.setProjectFilter)==null||d.call(t,ze(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,ze(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,op(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??sc(n.filters)),t.setActivityFilter){const E=n.filters.activity??"all";t.setActivityFilter(E==="fresh"||E==="stale"?E:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(C=t.setSortDirection)==null||C.call(t,n.sortDirection),(j=t.setListSectionVisibility)==null||j.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(v=t.setKanbanColumnVisibility)==null||v.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Id(e){return e?`/w/${e}/views`:"/views"}function tC(e){return`${Id(e.workspace)}/${encodeURIComponent(e.id)}`}function nC(e){const t=e.workspace?`/w/${e.workspace}`:"",n=ze(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&sN(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const _5=["critical","high","medium","low"],M5={last_24h:"last 24 hours",last_7d:"last 7 days",last_30d:"last 30 days",last_90d:"last 90 days",older_7d:"older than 7 days",older_30d:"older than 30 days"};function F5(e){if(e.preset)return`${e.field} ${M5[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function rC(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&oc(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=ze(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(F5(e.dateRange));const s=(i=e.search)==null?void 0:i.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const kj=80,z5=["started","lastActivity","projectName","agentName"],B5={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},U5=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function sC({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const o=!!n,{data:i}=Cs(),{data:c}=Ef(),[u,d]=p.useState(""),[m,h]=p.useState([]),[g,y]=p.useState([]),[b,C]=p.useState([]),[j,v]=p.useState(null),[k,E]=p.useState(md.sortField),[S,T]=p.useState(md.sortDirection),[A,R]=p.useState(""),[P,$]=p.useState(!1),[M,_]=p.useState(null);function D(){h([]),y([]),C([]),v(null),E(md.sortField),T(md.sortDirection),R("")}p.useEffect(()=>{if(e)if(_(null),$(!1),n){const z=n.config.filters;d(n.name),h(ze(z.project)),y(ze(z.agent)),C(ze(z.sessionStatus)),v(op(z.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else d(""),D()},[e,n]);const V=p.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(G=>({value:G.slug,label:G.title}))],[i]),K=p.useMemo(()=>{const z=new Set;for(const G of(c==null?void 0:c.sessions)??[])G.agent&&z.add(G.agent);return Array.from(z).sort().map(G=>({value:G,label:G}))},[c]),I=u.trim(),F=I.length>0&&I.length<=kj,q=A.trim()===""?void 0:parseInt(A.trim(),10),Z=A.trim()===""||Number.isFinite(q)&&q!==void 0&&q>0&&q<=500;return r.jsx(On,{open:e,onOpenChange:t,children:r.jsx(Rn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async z=>{if(z.preventDefault(),!F||!Z||P)return;$(!0),_(null);const G=la(j),L=G?{...G,field:"started"}:void 0,H={filters:{project:m,agent:g,sessionStatus:b,dateRange:L},sortField:k,sortDirection:S,limit:q};try{await s(I,H)}catch(re){_(re instanceof Error?re.message:String(re)),$(!1)}},children:[r.jsx(Zn,{children:r.jsx(An,{children:o?"Edit session view":"Create session view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),r.jsx("input",{id:"create-session-view-name",type:"text",value:u,autoFocus:!0,required:!0,maxLength:kj,onChange:z=>d(z.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ni,{label:"Date range (session start)",children:r.jsx(sp,{className:"w-full",value:j,onChange:v})}),r.jsx(ni,{label:"Project",children:r.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:m,onChange:h})}),r.jsx(ni,{label:"Agent",children:r.jsx(yn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:K,value:g,onChange:y})}),r.jsx(ni,{label:"Session status",children:r.jsx(yn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:U5,value:b,onChange:C})}),r.jsx(ni,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:z=>E(z.target.value),className:"editor-input w-full",children:z5.map(z=>r.jsx("option",{value:z,children:B5[z]??z},z))}),r.jsx("button",{type:"button",onClick:()=>T(z=>z==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),r.jsxs(ni,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:A,onChange:z=>R(z.target.value),placeholder:"No limit",className:"editor-input w-full"}),Z?null:r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),M?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:M}):null,r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:D,className:"shell-action",disabled:P,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:P,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!F||!Z||P,className:"shell-action shell-action--cta disabled:opacity-50",children:P?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function ni({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const V5=4e3;function Ao(){const[e,t]=p.useState(null),n=p.useRef(null),s=p.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),o=p.useCallback((i,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},V5)},[]);return p.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:s}}function xa({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className:we("syntaur-toast pointer-events-auto rounded-md border px-4 py-3 text-sm font-medium shadow-lg transition",n?"border-error-foreground/30 bg-error text-error-foreground hover:opacity-90":"border-success-foreground/30 bg-success text-success-foreground hover:opacity-90"),children:e.message},e.id)})}function $h({title:e,message:t,onPickAnother:n}){return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:e}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?r.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function H5({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:o,error:i}=Ef(),{view:c,loading:u,ready:d}=So(e??null),{layout:m}=dN(),{showToast:h}=Ao(),[g,y]=p.useState(!1),b=p.useCallback(async v=>{if(!t)return;const k=m.slots.map(E=>E.id===t?{...E,widget:v?{kind:"agent-sessions",viewId:v}:{kind:"agent-sessions"}}:E);try{await Sg(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function C(v,k){const{workspace:E,config:S}=oy(k,null);try{const A=(await Pi({name:v,workspace:E,config:S,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");A&&await b(A.id),y(!1),h(`Created session view "${v}"`)}catch(T){throw h(T instanceof Error?T.message:"Failed to create session view"),T}}let j;return e?u&&!d?j=r.jsx(xt,{label:"Loading view…"}):c?c.entityType!=="session"?j=r.jsx($h,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):j=r.jsx(A5,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):j=r.jsx($h,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!s?j=r.jsx(xt,{label:"Loading sessions…"}):i?j=r.jsx($h,{title:"Couldn't load sessions",message:i}):j=r.jsx(XN,{sessions:(s==null?void 0:s.sessions)??[]}),r.jsxs("div",{className:"space-y-2",children:[t?r.jsx("div",{className:"flex items-center justify-between gap-2",children:r.jsx(P5,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,j,r.jsx(sC,{open:g,onOpenChange:y,workspace:null,onSubmit:C})]})}const W5=5;function K5(){const{data:e,loading:t,error:n}=cS();if(t&&!e)return r.jsx(xt,{label:"Loading inventories…"});if(n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,W5);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ee,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const c=i.inventory,u=i.active_leases.length,d=i.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ee,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",d," leased"]})]})},c.slug)})})]})}function q5(e){let t=0,n=0;for(const s of e.daily)t+=s.total_tokens,n+=s.total_cost;return{tokens:t,cost:n}}function Sj({filters:e,metric:t}){const n=e??{},{data:s,loading:o,error:i}=S3(n),c=t==="cost"?"Spend":"Token Usage",u=`/usage?${pg(n).toString()}`;let d;if(o&&!s)d=r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!s)d=r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!s||s.daily.length===0)d=r.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:m,cost:h}=q5(s),g=t==="cost"?{label:"Total spend",value:Ai(h)}:{label:"Total tokens",value:Ri(m)},y=t==="cost"?{label:"Tokens",value:Ri(m)}:{label:"Spend",value:Ai(h)};d=r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Nj,{label:g.label,value:g.value,emphasize:!0}),r.jsx(Nj,{label:y.label,value:y.value})]})}return r.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground",children:c}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",title:Nw(n),children:Nw(n)})]}),r.jsx(Ee,{to:u,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),r.jsx("div",{className:"px-4 py-4",children:d})]})}function Nj({label:e,value:t,emphasize:n}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const G5={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function Y5(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const ri="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function Cj({config:e,open:t,onSave:n,onCancel:s}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Cs(),{data:c}=fa(),{data:u}=uS(t),[d,m]=p.useState("30d"),[h,g]=p.useState(""),[y,b]=p.useState(""),[C,j]=p.useState(""),[v,k]=p.useState(""),[E,S]=p.useState(""),[T,A]=p.useState(""),[R,P]=p.useState(!1),[$,M]=p.useState(null);p.useEffect(()=>{if(!t)return;const F=Y5(e);m(F.window??"30d"),g(F.since??""),b(F.until??""),j(F.project??""),k(F.workspace??""),S(F.model??""),A(F.tool??""),P(!1),M(null)},[t,e]);function _(){return Dc({window:d,since:d==="custom"?h:void 0,until:d==="custom"?y:void 0,project:C||void 0,workspace:v||void 0,model:E||void 0,tool:T||void 0})}async function D(F){if(F.preventDefault(),R)return;const q=_(),Z=p3(q);if(!Z.ok){M(Z.errors.join("; "));return}P(!0),M(null);const z=e.kind==="token-usage"?{kind:"token-usage",filters:q}:e.kind==="spend"?{kind:"spend",filters:q}:e;try{await n(z)}catch(G){M(G instanceof Error?G.message:String(G)),P(!1)}}const V=(i==null?void 0:i.map(F=>F.slug))??[],K=(c==null?void 0:c.workspaces)??[],I=(c==null?void 0:c.hasUngrouped)??!1;return r.jsx(On,{open:t,onOpenChange:F=>{F||s()},children:r.jsx(Rn,{className:"max-w-md",children:r.jsxs("form",{onSubmit:D,children:[r.jsx(Zn,{children:r.jsx(An,{children:o})}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:Nf.map(F=>r.jsx("button",{type:"button",onClick:()=>m(F),className:"rounded px-2.5 py-1 text-sm border "+(F===d?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:G5[F]},F))})]}),d==="custom"?r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Since"}),r.jsx("input",{type:"date",value:h,onChange:F=>g(F.target.value),className:ri})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Until"}),r.jsx("input",{type:"date",value:y,onChange:F=>b(F.target.value),className:ri})]})]}):null,r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),r.jsxs("select",{value:v,onChange:F=>{k(F.target.value),F.target.value&&j("")},className:ri,children:[r.jsx("option",{value:"",children:"All workspaces"}),I?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,K.map(F=>r.jsx("option",{value:F,children:F},F))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Project"}),r.jsxs("select",{value:C,onChange:F=>{j(F.target.value),F.target.value&&k("")},className:ri,children:[r.jsx("option",{value:"",children:"All projects"}),V.map(F=>r.jsx("option",{value:F,children:F},F))]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Model"}),r.jsxs("select",{value:E,onChange:F=>S(F.target.value),className:ri,children:[r.jsx("option",{value:"",children:"All models"}),((u==null?void 0:u.models)??[]).map(F=>r.jsx("option",{value:F,children:F},F))]})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Tool"}),r.jsxs("select",{value:T,onChange:F=>A(F.target.value),className:ri,children:[r.jsx("option",{value:"",children:"All tools"}),((u==null?void 0:u.tools)??[]).map(F=>r.jsx("option",{value:F,children:F},F))]})]})]}),$?r.jsx("p",{className:"text-xs text-destructive",role:"alert",children:$}):null]}),r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:s,disabled:R,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:R,className:"shell-action shell-action--cta",children:R?"Saving…":"Save"})]})]})})})}const ay={"saved-view":{title:"Saved view",icon:$k,render:(e,t)=>e.kind!=="saved-view"?null:p.createElement(w5,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:vf,render:(e,t)=>e.kind!=="agent-sessions"?null:p.createElement(H5,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:kf,render:()=>p.createElement(K5)},"token-usage":{title:"Token Usage",icon:eP,render:e=>e.kind!=="token-usage"?null:p.createElement(Sj,{filters:e.filters,metric:"tokens"}),ConfigEditor:Cj},spend:{title:"Spend",icon:Rc,render:e=>e.kind!=="spend"?null:p.createElement(Sj,{filters:e.filters,metric:"cost"}),ConfigEditor:Cj}},Q5={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},oC={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function J5({slot:e,onReplace:t,onRemove:n,onResize:s,onConfigChange:o}){const[i,c]=p.useState(!1),{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=Vf({id:e.id}),C={transform:rs.Translate.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0},j=r.jsx("button",{ref:h,...u,...d,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:r.jsx(Fi,{className:"h-4 w-4","aria-hidden":"true"})}),v=e.size??"small",k=Q5[v];if(e.widget===null)return r.jsxs("div",{ref:m,style:C,className:we("relative flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",k,b&&"opacity-0"),children:[r.jsx("div",{className:"absolute left-2 top-2",children:j}),r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add widget"]})]});const E=ay[e.widget.kind];if(!E)return r.jsx("div",{ref:m,style:C,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",k,b&&"opacity-0"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[j,r.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]})});const S=E.icon,T=E.ConfigEditor;return r.jsxs("div",{ref:m,style:C,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",k,b&&"opacity-0"),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[j,r.jsx(S,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(Z5,{slot:e,fallback:E.title})})]}),r.jsx(ry,{items:[{key:"replace",label:"Replace…",icon:uP,onSelect:t},...E.ConfigEditor?[{key:"configure",label:"Configure…",icon:hP,onSelect:()=>c(!0)}]:[],{key:"size",label:"Size",icon:aP,submenu:nI.map(A=>({key:`size-${A}`,label:oC[A],active:A===v,onSelect:()=>s(A)}))},{key:"remove",label:"Remove",icon:Tn,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:E.render(e.widget,{slotId:e.id,onPickAnother:t})}),T?r.jsx(T,{config:e.widget,open:i,onSave:async A=>{await o(A),c(!1)},onCancel:()=>c(!1)}):null]})}function X5({slot:e}){const t=e.widget?ay[e.widget.kind]:null,n=t==null?void 0:t.icon,s=e.widget===null?"Empty widget slot":(t==null?void 0:t.title)??`Unknown widget kind: ${e.widget.kind}`,o=oC[e.size??"small"];return r.jsx("div",{"aria-hidden":"true",className:"w-72 rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",children:r.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(Fi,{className:"h-4 w-4","aria-hidden":"true"}),n?r.jsx(n,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s}),r.jsx("span",{className:"text-[10px] tracking-normal text-muted-foreground/70",children:o})]})})}function Z5({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:s}=So(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const eM=["agent-sessions","inventories","token-usage","spend"];function tM({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:o}=Mc();function i(c){n(c),t(!1)}return r.jsx(On,{open:e,onOpenChange:t,children:r.jsxs(Rn,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsx(An,{children:"Add a widget"}),r.jsx(Hr,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:eM.map(c=>{const u=ay[c],d=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(d,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ee,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsxs("div",{className:"space-y-3",children:[s.some(c=>c.entityType!=="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType!=="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))})]}),s.some(c=>c.entityType==="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType==="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null]})},c.id))})]})]}),!o&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const nM=(e,{currentCoordinates:t,context:n})=>{var g;const s=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();const o=n.over??n.active,i=(g=o==null?void 0:o.data.current)==null?void 0:g.sortable,c=i==null?void 0:i.items;if(!o||!c)return t;const u=c.indexOf(o.id);if(u===-1)return t;const d=c[u+s],m=d===void 0?null:n.droppableRects.get(d),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function rM(){const{data:e,error:t,refetch:n}=g3(),{data:s}=aS(),{layout:o}=dN(),[i,c]=p.useState(!1),[u,d]=p.useState(null),[m,h]=p.useState(null),[g,y]=p.useState(o.slots),[b,C]=p.useState(null);p.useEffect(()=>{y(o.slots)},[o.slots]);const j=If(ko(Ki,{activationConstraint:{distance:8}}),ko(Wi,{coordinateGetter:nM}));Ro("list:overview"),Yt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const v=p.useCallback(_=>{d(_),c(!0)},[]),k=p.useCallback(async(_,D)=>{h(null),y(_);try{await Sg(_)}catch(V){y(D),h(V instanceof Error?V.message:String(V))}},[]),E=p.useCallback(_=>{if(u===null)return;const D=g.map((V,K)=>K===u?{...V,widget:_}:V);d(null),k(D,g)},[g,u,k]),S=p.useCallback(_=>{const D=g.map((V,K)=>K===_?{...V,widget:null}:V);k(D,g)},[g,k]),T=p.useCallback((_,D)=>{const V=g.map((K,I)=>I===_?{...K,size:D}:K);k(V,g)},[g,k]),A=p.useCallback(_=>{const{active:D,over:V}=_;if(C(null),!V||D.id===V.id)return;const K=g.findIndex(q=>q.id===D.id),I=g.findIndex(q=>q.id===V.id);if(K===-1||I===-1)return;const F=qi(g,K,I);k(F,g)},[g,k]),R=p.useCallback(_=>{C(String(_.active.id))},[]),P=g.find(_=>_.id===b)??null,$=p.useCallback(async(_,D)=>{const V=g,K=g.map((I,F)=>F===_?{...I,widget:D}:I);h(null),y(K);try{await Sg(K)}catch(I){y(V);const F=I instanceof Error?I.message:String(I);throw h(F),I instanceof Error?I:new Error(F)}},[g]),M={};if(e)for(const _ of Object.keys(e.segments))for(const D of e.segments[_].items)M[D.id]=D;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("header",{className:"space-y-2",children:[r.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),r.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?r.jsx(gO,{hero:e.hero,itemsById:M}):t?r.jsx(Tt,{error:t}):r.jsx(xt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(mO,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsxs(Bf,{sensors:j,collisionDetection:_f,onDragStart:R,onDragCancel:()=>C(null),onDragEnd:A,children:[r.jsx(Uf,{items:g.map(_=>_.id),strategy:zx,children:r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:g.map((_,D)=>r.jsx(J5,{slot:_,index:D,onReplace:()=>v(D),onRemove:()=>S(D),onResize:V=>T(D,V),onConfigChange:V=>$(D,V)},_.id))})}),r.jsx(eO,{dropAnimation:null,children:P?r.jsx(X5,{slot:P}):null})]}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(lx,{className:"h-3 w-3","aria-hidden":"true"}),r.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,r.jsx(tM,{open:i,onOpenChange:_=>{c(_),_||d(null)},onSelect:E})]})}function sM({term:e,description:t}){return r.jsx("span",{title:t,className:"cursor-help rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-foreground underline decoration-dotted underline-offset-4",children:e})}function oM(){const{data:e,loading:t,error:n}=aS(),{openCheatsheet:s}=To();return t?r.jsx(xt,{label:"Loading help…"}):n||!e?r.jsx(Tt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",ks("Mod+k")," opens the command palette."]})]})}),r.jsx(He,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),r.jsx(He,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(Pd,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(He,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>r.jsx(sM,{term:o.term,description:o.description},o.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),r.jsx(He,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),r.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),r.jsx(He,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx(Ee,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),r.jsx(He,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>r.jsx(Pd,{command:o.command,description:o.description,example:o.example},o.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),r.jsx(He,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(Pd,{command:o.command.command,example:o.command.example}):null,o.href?r.jsx(Ee,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function iy({children:e}){return r.jsx("div",{className:"chrome-card flex flex-col gap-2 !p-2.5 md:flex-row md:flex-wrap md:items-center",children:e})}const ap=p.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(Eo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));ap.displayName="SearchInput";function ip({value:e,options:t,onChange:n}){return r.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(s=>r.jsx("button",{type:"button","aria-pressed":e===s.value,onClick:()=>n(s.value),className:we("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===s.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:s.label},s.value))})}const aM={completed:"bg-status-completed-foreground",in_progress:"bg-status-in-progress-foreground",review:"bg-status-review-foreground",blocked:"bg-status-blocked-foreground",failed:"bg-status-failed-foreground",pending:"bg-status-pending-foreground"},Ej=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function cf({progress:e,className:t,showLegend:n=!1}){const s=ha(),o=p.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(d=>d!=="total")).map(d=>({key:d,className:aM[d]??Ej[c++%Ej.length]}))},[s.order,e]),i=o.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:we("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):i.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${Sn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:we("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:Sn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const iM=["pending","active","blocked","failed","completed"],ly=iM,lM=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function aC(e){return e&&e.length>0?e:[...lM]}function cM(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[o]=s.splice(t,1),i=t<n?n-1:n;return s.splice(Math.max(0,Math.min(i,s.length)),0,o),s}const uM=220,hd=8;function iC({anchor:e,items:t,onClose:n}){const s=p.useRef(null),[o,i]=p.useState(null);return p.useLayoutEffect(()=>{if(!e){i(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??uM,d=(c==null?void 0:c.offsetHeight)??0,m=Math.max(hd,window.innerWidth-u-hd),h=Math.max(hd,window.innerHeight-d-hd);i({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),p.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function d(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",d,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:r.jsx(ia,{delayDuration:200,children:t.map(c=>{const u=c.icon,d=we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:d,children:m})});return c.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:h}),r.jsx(ur,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ee,{to:c.href,className:d,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:d,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const dM="__ungrouped__";function cy({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:c,loading:u}=fa(),[d,m]=p.useState(n),[h,g]=p.useState(!1),[y,b]=p.useState(null);p.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=p.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:dM,label:"Ungrouped",value:null}],[c]),j=!h&&d!==n;async function v(){if(j){g(!0),b(null);try{await s(d),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(On,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Rn,{children:[r.jsxs(Zn,{children:[r.jsx(An,{children:o}),r.jsx(Hr,{children:i})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(ix,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,S=k.value===d;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:we("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:we("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?r.jsx(Rr,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:v,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function Tj(){const{workspace:e}=Bt(),t=fn(),n=zt(),{data:s,loading:o,error:i,refetch:c}=Cs(),u=p.useRef(null);Ro("list:projects");const[d,m]=p.useState(""),[h,g]=p.useState("all"),[y,b]=p.useState("all"),[C,j]=p.useState("updated"),[v,k]=ls(),E=v.get("view"),S=E==="table"||E==="kanban"?E:"cards",T=z=>{k(G=>{const L=new URLSearchParams(G);return z==="cards"?L.delete("view"):L.set("view",z),L})},[A,R]=p.useState({}),[P,$]=p.useState(null),[M,_]=p.useState(null),D=p.useMemo(()=>s?s.filter(z=>{if(e){if(e==="_ungrouped"){if(z.workspace!==null)return!1}else if(z.workspace!==e)return!1}return h!=="all"&&z.status!==h||y!=="all"&&!z.tags.includes(y)?!1:d.trim()?`${z.title} ${z.tags.join(" ")} ${z.slug}`.toLowerCase().includes(d.toLowerCase()):!0}).sort((z,G)=>mM(z,G,C)):[],[s,d,h,y,C,e]),V=D.map(z=>`${z.slug}:${z.status}`).join("|");p.useEffect(()=>{R(hM(D))},[V,C]);const K=p.useMemo(()=>{const z=new Map(D.map(G=>[G.slug,G]));return ly.flatMap(G=>(A[G]??D.filter(H=>H.status===G).map(H=>H.slug)).map(H=>z.get(H)).filter(H=>!!H))},[D,A]),{visibleItems:I,visibleIndexByKey:F}=p.useMemo(()=>{const z=S==="kanban"?K:D,G=new Map;return z.forEach((L,H)=>G.set(L.slug,H)),{visibleItems:z,visibleIndexByKey:G}},[S,D,K]),{hotkeyRowProps:q}=$c(I,{scope:"list:projects",onOpen:z=>n(`${t}/projects/${z.slug}`)});if(Yt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var z;return(z=u.current)==null?void 0:z.focus()}}),Yt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),o)return r.jsx(xt,{label:"Loading projects…"});if(i||!s)return r.jsx(Tt,{error:i||"Project list is unavailable."});const Z=Array.from(new Set(s.flatMap(z=>z.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(iy,{children:[r.jsx(ap,{ref:u,value:d,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:z=>g(z.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All statuses"}),r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"active",children:"Active"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"failed",children:"Failed"}),r.jsx("option",{value:"completed",children:"Completed"})]}),r.jsxs("select",{value:y,onChange:z=>b(z.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),Z.map(z=>r.jsx("option",{value:z,children:z},z))]}),r.jsxs("select",{value:C,onChange:z=>j(z.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"updated",children:"Sort: Updated"}),r.jsx("option",{value:"created",children:"Sort: Created"}),r.jsx("option",{value:"title",children:"Sort: Title"}),r.jsx("option",{value:"attention",children:"Sort: Attention"})]}),r.jsx(ip,{value:S,onChange:z=>T(z),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),D.length===0?s.length===0?r.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[r.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),r.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),r.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),r.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ee,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(Et,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ee,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):S==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:D.map((z,G)=>r.jsxs(Ee,{to:`${t}/projects/${z.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...q(G),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:z.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",zn(z.updated)]})]}),r.jsx(bn,{status:z.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(cf,{progress:z.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:z.tags.map(L=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:L},L))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount})]}),r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:z.progress.total})]})]})]})]},z.slug))}):S==="table"?r.jsx(He,{title:`${D.length} project${D.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:D.map((z,G)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...q(G),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ee,{to:`${t}/projects/${z.slug}`,className:"font-semibold text-foreground hover:text-primary",children:z.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:z.tags.map(L=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:L},L))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(bn,{status:z.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(cf,{progress:z.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:z.needsAttention.blockedCount+z.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:zn(z.updated)})]},z.slug))})]})})}):r.jsx(tp,{columns:pM,items:K,getItemId:z=>z.slug,getColumnId:z=>z.status,canDrop:({fromColumnId:z,toColumnId:G})=>({allowed:!0,reason:z===G?void 0:"This will set a manual status override on the project."}),onMove:({item:z,fromColumnId:G,toColumnId:L,fromIndex:H,toIndex:re})=>{if(G===L){const U=A[G]??D.filter(ue=>ue.status===G).map(ue=>ue.slug);R(ue=>({...ue,[G]:cM(U,H,re)}));return}fetch(`/api/projects/${z.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:L})}).then(()=>{window.location.reload()})},getExternalDragData:z=>({type:"project",id:z.slug}),onCardContextMenu:(z,G)=>{G.preventDefault(),$({project:z,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} projects.`,renderCard:(z,{dragging:G})=>{const L=F.get(z.slug)??-1;return r.jsx("div",{...L>=0?q(L):{},children:r.jsx(gM,{project:z,dragging:G})})}}),r.jsx(iC,{anchor:(P==null?void 0:P.anchor)??null,items:P?[{key:"edit",label:"Edit",icon:zi,onSelect:()=>n(`${t}/projects/${P.project.slug}`)},{key:"move",label:"Move to workspace…",icon:jf,onSelect:()=>_(P.project)}]:[],onClose:()=>$(null)}),r.jsx(cy,{open:M!==null,onOpenChange:z=>{z||_(null)},currentWorkspace:(M==null?void 0:M.workspace)??null,title:"Move project to workspace",onSubmit:async z=>{if(!M)return;const G=await fetch(`/api/projects/${encodeURIComponent(M.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:z})});if(!G.ok){const L=await G.json().catch(()=>({}));throw new Error(L.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(ax,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",S==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const fM={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},pM=ly.map(e=>({id:e,title:fM[e],description:np(e)}));function mM(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Rj(t)-Rj(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Rj(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function hM(e){return Object.fromEntries(ly.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function gM({project:e,dragging:t}){const n=fn();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Ee,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",zn(e.updated)]})]}),r.jsx(bn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(cf,{progress:e.progress})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(s=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:s},s)),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),r.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function uf({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:we("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function xM(){return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-status-archived-foreground/30 bg-status-archived px-2 py-0.5 text-xs font-medium text-status-archived-foreground",children:[r.jsx(wf,{className:"h-3 w-3"}),"Archived"]})}function Aj(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function yM(){const{data:e,loading:t,error:n,refetch:s}=x3(),[o,i]=p.useState(null),[c,u]=p.useState(null),[d,m]=p.useState({}),{toast:h,showToast:g,dismissToast:y}=Ao();async function b(S,T,A){i(T),u(null);try{const R=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const P=await R.json().catch(()=>null);throw new Error((P==null?void 0:P.error)||`HTTP ${R.status}`)}s(),g(A,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{i(null)}}function C(S){return b(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function j(S){const T=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return b(T,`assignment:${S.id}`,"Assignment restored")}if(t)return r.jsx(xt,{label:"Loading archived content…"});if(n)return r.jsx(Tt,{error:n});const v=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=v.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(xa,{toast:h,onDismiss:y}),r.jsx(uf,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(Et,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[v.length>0&&r.jsx(He,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:v.map(S=>{const T=d[S.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(A=>({...A,[S.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(pr,{className:"h-4 w-4"}):r.jsx(Rk,{className:"h-4 w-4"}),r.jsx(sx,{className:"h-4 w-4 text-muted-foreground"}),S.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Ur(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ee,{to:`/projects/${S.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(S),disabled:o===`project:${S.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(Fd,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&S.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(A=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ee,{to:Aj(A),className:"text-foreground hover:text-foreground/80",children:A.title}),r.jsx(bn,{status:A.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:A.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},A.id))})]},S.slug)})})}),k.length>0&&r.jsx(He,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(S=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ee,{to:Aj(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),r.jsx(bn,{status:S.status,showIcon:!1}),r.jsx(xM,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Ur(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(Fd,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const Pj="inline-flex max-w-[14rem] items-center gap-1 whitespace-nowrap rounded-full border px-2 py-0.5 text-[11px] font-semibold tracking-wide border-border/60 text-muted-foreground",Dj="block min-w-0 truncate";function uy({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:we("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:we(Pj,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[r.jsx("span",{className:Dj,children:o}),r.jsx(Mi,{className:"h-2.5 w-2.5 shrink-0"})]},i):r.jsx("span",{className:Pj,title:o,children:r.jsx("span",{className:Dj,children:o})},i)})})}const bM={default:"chrome-card",info:"rounded-lg border border-primary/30 bg-primary/5 p-3 dark:border-primary/40 dark:bg-primary/10",warn:"rounded-lg border border-warning-foreground/30 bg-warning p-3",danger:"rounded-lg border border-error-foreground/30 bg-error p-3",success:"rounded-lg border border-success-foreground/30 bg-success p-3"};function Fn({label:e,value:t,description:n,icon:s,tone:o="default",to:i}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=we(bM[o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?r.jsx(Ee,{to:i,className:u,children:c}):r.jsx("article",{className:u,children:c})}function $j(e){const t=vM(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),d=u.find(jM);if(d){const m=d.props.children,h=u.map(g=>g===d?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function vM(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=SM(o),u=kM(i,o.props);return o.type!==p.Fragment&&(u.ref=s?Rf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wM=Symbol("radix.slottable");function jM(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wM}function kM(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function SM(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function NM(e){const t=e+"CollectionProvider",[n,s]=pa(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:v,children:k}=j,E=Dt.useRef(null),S=Dt.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:S,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",d=$j(u),m=Dt.forwardRef((j,v)=>{const{scope:k,children:E}=j,S=i(u,k),T=qn(v,S.collectionRef);return r.jsx(d,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=$j(h),b=Dt.forwardRef((j,v)=>{const{scope:k,children:E,...S}=j,T=Dt.useRef(null),A=qn(v,T),R=i(h,k);return Dt.useEffect(()=>(R.itemMap.set(T,{ref:T,...S}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:A,children:E})});b.displayName=h;function C(j){const v=i(e+"CollectionConsumer",j);return Dt.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const S=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,P)=>S.indexOf(R.ref.current)-S.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var CM=p.createContext(void 0);function lC(e){const t=p.useContext(CM);return e||t||"ltr"}var Lh="rovingFocusGroup.onEntryFocus",EM={bubbles:!1,cancelable:!0},Hc="RovingFocusGroup",[Pg,cC,TM]=NM(Hc),[RM,uC]=pa(Hc,[TM]),[AM,PM]=RM(Hc),dC=p.forwardRef((e,t)=>r.jsx(Pg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Pg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(DM,{...e,ref:t})})}));dC.displayName=Hc;var DM=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=p.useRef(null),b=qn(t,y),C=lC(i),[j,v]=Af({prop:c,defaultProp:u??null,onChange:d,caller:Hc}),[k,E]=p.useState(!1),S=ca(m),T=cC(n),A=p.useRef(!1),[R,P]=p.useState(0);return p.useEffect(()=>{const $=y.current;if($)return $.addEventListener(Lh,S),()=>$.removeEventListener(Lh,S)},[S]),r.jsx(AM,{scope:n,orientation:s,dir:C,loop:o,currentTabStopId:j,onItemFocus:p.useCallback($=>v($),[v]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>P($=>$+1),[]),onFocusableItemRemove:p.useCallback(()=>P($=>$-1),[]),children:r.jsx(vn.div,{tabIndex:k||R===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Zt(e.onMouseDown,()=>{A.current=!0}),onFocus:Zt(e.onFocus,$=>{const M=!A.current;if($.target===$.currentTarget&&M&&!k){const _=new CustomEvent(Lh,EM);if($.currentTarget.dispatchEvent(_),!_.defaultPrevented){const D=T().filter(q=>q.focusable),V=D.find(q=>q.active),K=D.find(q=>q.id===j),F=[V,K,...D].filter(Boolean).map(q=>q.ref.current);mC(F,h)}}A.current=!1}),onBlur:Zt(e.onBlur,()=>E(!1))})})}),fC="RovingFocusGroupItem",pC=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:c,...u}=e,d=bi(),m=i||d,h=PM(fC,n),g=h.currentTabStopId===m,y=cC(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return p.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(Pg.ItemSlot,{scope:n,id:m,focusable:s,active:o,children:r.jsx(vn.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Zt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Zt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Zt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=OM(v,h.orientation,h.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")S.reverse();else if(k==="prev"||k==="next"){k==="prev"&&S.reverse();const T=S.indexOf(v.currentTarget);S=h.loop?IM(S,T+1):S.slice(T+1)}setTimeout(()=>mC(S))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});pC.displayName=fC;var $M={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function LM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function OM(e,t,n){const s=LM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return $M[s]}function mC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function IM(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var _M=dC,MM=pC,lp="Tabs",[FM]=pa(lp,[uC]),hC=uC(),[zM,dy]=FM(lp),gC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:c="horizontal",dir:u,activationMode:d="automatic",...m}=e,h=lC(u),[g,y]=Af({prop:s,onChange:o,defaultProp:i??"",caller:lp});return r.jsx(zM,{scope:n,baseId:bi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:d,children:r.jsx(vn.div,{dir:h,"data-orientation":c,...m,ref:t})})});gC.displayName=lp;var xC="TabsList",yC=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=dy(xC,n),c=hC(n);return r.jsx(_M,{asChild:!0,...c,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(vn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});yC.displayName=xC;var bC="TabsTrigger",vC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,c=dy(bC,n),u=hC(n),d=kC(c.baseId,s),m=SC(c.baseId,s),h=s===c.value;return r.jsx(MM,{asChild:!0,...u,focusable:!o,active:h,children:r.jsx(vn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...i,ref:t,onMouseDown:Zt(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Zt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Zt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!o&&g&&c.onValueChange(s)})})})});vC.displayName=bC;var wC="TabsContent",jC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...c}=e,u=dy(wC,n),d=kC(u.baseId,s),m=SC(u.baseId,s),h=s===u.value,g=p.useRef(h);return p.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(ma,{present:o||h,children:({present:y})=>r.jsx(vn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&i})})});jC.displayName=wC;function kC(e,t){return`${e}-trigger-${t}`}function SC(e,t){return`${e}-content-${t}`}var NC=gC,CC=yC,Dg=vC,$g=jC;function fy({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(NC,{value:e,onValueChange:t,className:s,children:[r.jsx(CC,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(o=>r.jsxs(Dg,{value:o.value,className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[r.jsx("span",{children:o.label}),typeof o.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:o.count}):null]},o.value))}),n.map(o=>r.jsx($g,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const BM="modulepreload",UM=function(e){return"/"+e},Lj={},VM=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=c(n.map(m=>{if(m=UM(m),m in Lj)return;Lj[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":BM,h||(y.as="script"),y.crossOrigin="",y.href=m,d&&y.setAttribute("nonce",d),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return o.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function HM({definition:e,className:t,nodeRoutes:n={}}){const s=p.useRef(null),[o,i]=p.useState(null),[c,u]=p.useState(!0),d=zt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return p.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await VM(async()=>{const{default:j}=await import("./mermaid.core-Co8nky_A.js").then(v=>v.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:WM(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:C}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=C,KM(s.current,n,d),u(!1)}catch(y){h||(i(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),i(null),g(),()=>{h=!0}},[e,d,n,m]),o?r.jsxs("div",{className:we("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:we("rounded-lg border border-border bg-card p-4",t),children:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function WM(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).trim();return y?`oklch(${y})`:""},s=n("--card"),o=n("--card-foreground"),i=n("--border"),c=n("--primary"),u=n("--primary-foreground"),d=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:o,primaryBorderColor:i,secondaryColor:d,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:d,tertiaryTextColor:m,tertiaryBorderColor:i,lineColor:e?m:i,textColor:o,mainBkg:s,nodeBkg:s,nodeTextColor:o,nodeBorder:i,clusterBkg:d,clusterBorder:i,edgeLabelBackground:s,titleColor:o,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:d,labelColor:o,errorBkgColor:h,errorTextColor:u}}function KM(e,t,n){var s;for(const o of e.querySelectorAll(".node")){const i=((s=o.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[i];if(!c)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const u=()=>n(c);o.addEventListener("click",u),o.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u())})}}function qM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const GM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QM={};function Oj(e,t){return(QM.jsx?YM:GM).test(e)}const JM=/[ \t\n\f\r]/g;function XM(e){return typeof e=="object"?e.type==="text"?Ij(e.value):!1:Ij(e)}function Ij(e){return e.replace(JM,"")===""}class Wc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Wc.prototype.normal={};Wc.prototype.property={};Wc.prototype.space=void 0;function EC(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new Wc(n,s,t)}function Lg(e){return e.toLowerCase()}class mr{constructor(t,n){this.attribute=n,this.property=t}}mr.prototype.attribute="";mr.prototype.booleanish=!1;mr.prototype.boolean=!1;mr.prototype.commaOrSpaceSeparated=!1;mr.prototype.commaSeparated=!1;mr.prototype.defined=!1;mr.prototype.mustUseProperty=!1;mr.prototype.number=!1;mr.prototype.overloadedBoolean=!1;mr.prototype.property="";mr.prototype.spaceSeparated=!1;mr.prototype.space=void 0;let ZM=0;const mt=ya(),gn=ya(),Og=ya(),Re=ya(),Vt=ya(),Ci=ya(),vr=ya();function ya(){return 2**++ZM}const Ig=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:gn,commaOrSpaceSeparated:vr,commaSeparated:Ci,number:Re,overloadedBoolean:Og,spaceSeparated:Vt},Symbol.toStringTag,{value:"Module"})),Oh=Object.keys(Ig);class py extends mr{constructor(t,n,s,o){let i=-1;if(super(t,n),_j(this,"space",o),typeof s=="number")for(;++i<Oh.length;){const c=Oh[i];_j(this,Oh[i],(s&Ig[c])===Ig[c])}}}py.prototype.defined=!0;function _j(e,t,n){n&&(e[t]=n)}function Qi(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new py(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Lg(s)]=s,n[Lg(i.attribute)]=s}return new Wc(t,n,e.space)}const TC=Qi({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:Re,ariaColIndex:Re,ariaColSpan:Re,ariaControls:Vt,ariaCurrent:null,ariaDescribedBy:Vt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:Vt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:Vt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vt,ariaLevel:Re,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:Vt,ariaPlaceholder:null,ariaPosInSet:Re,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:Vt,ariaRowCount:Re,ariaRowIndex:Re,ariaRowSpan:Re,ariaSelected:gn,ariaSetSize:Re,ariaSort:null,ariaValueMax:Re,ariaValueMin:Re,ariaValueNow:Re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function RC(e,t){return t in e?e[t]:t}function AC(e,t){return RC(e,t.toLowerCase())}const eF=Qi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ci,acceptCharset:Vt,accessKey:Vt,action:null,allow:null,allowFullScreen:mt,allowPaymentRequest:mt,allowUserMedia:mt,alt:null,as:null,async:mt,autoCapitalize:null,autoComplete:Vt,autoFocus:mt,autoPlay:mt,blocking:Vt,capture:null,charSet:null,checked:mt,cite:null,className:Vt,cols:Re,colSpan:null,content:null,contentEditable:gn,controls:mt,controlsList:Vt,coords:Re|Ci,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mt,defer:mt,dir:null,dirName:null,disabled:mt,download:Og,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mt,formTarget:null,headers:Vt,height:Re,hidden:Og,high:Re,href:null,hrefLang:null,htmlFor:Vt,httpEquiv:Vt,id:null,imageSizes:null,imageSrcSet:null,inert:mt,inputMode:null,integrity:null,is:null,isMap:mt,itemId:null,itemProp:Vt,itemRef:Vt,itemScope:mt,itemType:Vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mt,low:Re,manifest:null,max:null,maxLength:Re,media:null,method:null,min:null,minLength:Re,multiple:mt,muted:mt,name:null,nonce:null,noModule:mt,noValidate:mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mt,optimum:Re,pattern:null,ping:Vt,placeholder:null,playsInline:mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mt,referrerPolicy:null,rel:Vt,required:mt,reversed:mt,rows:Re,rowSpan:Re,sandbox:Vt,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootClonable:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shape:null,size:Re,sizes:null,slot:null,span:Re,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Re,step:null,style:null,tabIndex:Re,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:gn,width:Re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vt,axis:null,background:null,bgColor:null,border:Re,borderColor:null,bottomMargin:Re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mt,declare:mt,event:null,face:null,frame:null,frameBorder:null,hSpace:Re,leftMargin:Re,link:null,longDesc:null,lowSrc:null,marginHeight:Re,marginWidth:Re,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:Re,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:Re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:mt,disableRemotePlayback:mt,prefix:null,property:null,results:Re,security:null,unselectable:null},space:"html",transform:AC}),tF=Qi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vr,accentHeight:Re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Re,amplitude:Re,arabicForm:null,ascent:Re,attributeName:null,attributeType:null,azimuth:Re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Re,by:null,calcMode:null,capHeight:Re,className:Vt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Re,diffuseConstant:Re,direction:null,display:null,dur:null,divisor:Re,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Re,enableBackground:null,end:null,event:null,exponent:Re,externalResourcesRequired:null,fill:null,fillOpacity:Re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ci,g2:Ci,glyphName:Ci,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Re,horizOriginX:Re,horizOriginY:Re,id:null,ideographic:Re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Re,k:Re,k1:Re,k2:Re,k3:Re,k4:Re,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Re,overlineThickness:Re,paintOrder:null,panose1:null,path:null,pathLength:Re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Re,pointsAtY:Re,pointsAtZ:Re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Re,specularExponent:Re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Re,strikethroughThickness:Re,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Re,strokeOpacity:Re,strokeWidth:null,style:null,surfaceScale:Re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:Re,tableValues:null,target:null,targetX:Re,targetY:Re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Re,underlineThickness:Re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Re,values:null,vAlphabetic:Re,vMathematical:Re,vectorEffect:null,vHanging:Re,vIdeographic:Re,version:null,vertAdvY:Re,vertOriginX:Re,vertOriginY:Re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:RC}),PC=Qi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),DC=Qi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:AC}),$C=Qi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nF={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},rF=/[A-Z]/g,Mj=/-[a-z]/g,sF=/^data[-\w.:]+$/i;function oF(e,t){const n=Lg(t);let s=t,o=mr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&sF.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Mj,iF);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Mj.test(i)){let c=i.replace(rF,aF);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=py}return new o(s,t)}function aF(e){return"-"+e.toLowerCase()}function iF(e){return e.charAt(1).toUpperCase()}const lF=EC([TC,eF,PC,DC,$C],"html"),my=EC([TC,tF,PC,DC,$C],"svg");function cF(e){return e.join(" ").trim()}var si={},Ih,Fj;function uF(){if(Fj)return Ih;Fj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
|
|
556
|
+
`,m="/",h="*",g="",y="comment",b="declaration";function C(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var E=1,S=1;function T(I){var F=I.match(t);F&&(E+=F.length);var q=I.lastIndexOf(d);S=~q?I.length-q:S+I.length}function A(){var I={line:E,column:S};return function(F){return F.position=new R(I),M(),F}}function R(I){this.start=I,this.end={line:E,column:S},this.source=k.source}R.prototype.content=v;function P(I){var F=new Error(k.source+":"+E+":"+S+": "+I);if(F.reason=I,F.filename=k.source,F.line=E,F.column=S,F.source=v,!k.silent)throw F}function $(I){var F=I.exec(v);if(F){var q=F[0];return T(q),v=v.slice(q.length),F}}function M(){$(n)}function _(I){var F;for(I=I||[];F=D();)F!==!1&&I.push(F);return I}function D(){var I=A();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var F=2;g!=v.charAt(F)&&(h!=v.charAt(F)||m!=v.charAt(F+1));)++F;if(F+=2,g===v.charAt(F-1))return P("End of comment missing");var q=v.slice(2,F-2);return S+=2,T(q),v=v.slice(F),S+=2,I({type:y,comment:q})}}function V(){var I=A(),F=$(s);if(F){if(D(),!$(o))return P("property missing ':'");var q=$(i),Z=I({type:b,property:j(F[0].replace(e,g)),value:q?j(q[0].replace(e,g)):g});return $(c),Z}}function K(){var I=[];_(I);for(var F;F=V();)F!==!1&&(I.push(F),_(I));return I}return M(),K()}function j(v){return v?v.replace(u,g):g}return Ih=C,Ih}var zj;function dF(){if(zj)return si;zj=1;var e=si&&si.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(si,"__esModule",{value:!0}),si.default=n;const t=e(uF());function n(s,o){let i=null;if(!s||typeof s!="string")return i;const c=(0,t.default)(s),u=typeof o=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;u?o(m,h,d):h&&(i=i||{},i[m]=h)}),i}return si}var Fl={},Bj;function fF(){if(Bj)return Fl;Bj=1,Object.defineProperty(Fl,"__esModule",{value:!0}),Fl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},d=function(m,h){return h===void 0&&(h={}),i(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(o,u):m=m.replace(s,u),m.replace(t,c))};return Fl.camelCase=d,Fl}var zl,Uj;function pF(){if(Uj)return zl;Uj=1;var e=zl&&zl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(dF()),n=fF();function s(o,i){var c={};return!o||typeof o!="string"||(0,t.default)(o,function(u,d){u&&d&&(c[(0,n.camelCase)(u,i)]=d)}),c}return s.default=s,zl=s,zl}var mF=pF();const hF=xf(mF),LC=OC("end"),hy=OC("start");function OC(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function gF(e){const t=hy(e),n=LC(e);if(t&&n)return{start:t,end:n}}function ic(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Vj(e.position):"start"in e||"end"in e?Vj(e):"line"in e||"column"in e?_g(e):""}function _g(e){return Hj(e&&e.line)+":"+Hj(e&&e.column)}function Vj(e){return _g(e&&e.start)+"-"+_g(e&&e.end)}function Hj(e){return e&&typeof e=="number"?e:1}class Gn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",i={},c=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(c=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?i.ruleId=s:(i.source=s.slice(0,d),i.ruleId=s.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const u=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=u?u.line:void 0,this.name=ic(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=c&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gn.prototype.file="";Gn.prototype.name="";Gn.prototype.reason="";Gn.prototype.message="";Gn.prototype.stack="";Gn.prototype.column=void 0;Gn.prototype.line=void 0;Gn.prototype.ancestors=void 0;Gn.prototype.cause=void 0;Gn.prototype.fatal=void 0;Gn.prototype.place=void 0;Gn.prototype.ruleId=void 0;Gn.prototype.source=void 0;const gy={}.hasOwnProperty,xF=new Map,yF=/[A-Z]/g,bF=new Set(["table","tbody","thead","tfoot","tr"]),vF=new Set(["td","th"]),IC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function wF(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=RF(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=TF(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?my:lF,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=_C(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function _C(e,t,n){if(t.type==="element")return jF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return kF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return NF(e,t,n);if(t.type==="mdxjsEsm")return SF(e,t);if(t.type==="root")return CF(e,t,n);if(t.type==="text")return EF(e,t)}function jF(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=my,e.schema=o),e.ancestors.push(t);const i=FC(e,t.tagName,!1),c=AF(e,t);let u=yy(e,t);return bF.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!XM(d):!0})),MC(e,c,i,t),xy(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function kF(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}kc(e,t.position)}function SF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);kc(e,t.position)}function NF(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=my,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:FC(e,t.name,!0),c=PF(e,t),u=yy(e,t);return MC(e,c,i,t),xy(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function CF(e,t,n){const s={};return xy(s,yy(e,t)),e.create(t,e.Fragment,s,n)}function EF(e,t){return t.value}function MC(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function xy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function TF(e,t,n){return s;function s(o,i,c,u){const m=Array.isArray(c.children)?n:t;return u?m(i,c,u):m(i,c)}}function RF(e,t){return n;function n(s,o,i,c){const u=Array.isArray(i.children),d=hy(s);return t(o,i,c,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function AF(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&gy.call(t.properties,o)){const i=DF(e,o,t.properties[o]);if(i){const[c,u]=i;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&vF.has(t.tagName)?s=u:n[c]=u}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function PF(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const c=i.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else kc(e,t.position);else{const o=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const u=s.value.data.estree.body[0];u.type,i=e.evaluater.evaluateExpression(u.expression)}else kc(e,t.position);else i=s.value===null?!0:s.value;n[o]=i}return n}function yy(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:xF;for(;++s<t.children.length;){const i=t.children[s];let c;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const m=o.get(d)||0;c=d+"-"+m,o.set(d,m+1)}}const u=_C(e,i,c);u!==void 0&&n.push(u)}return n}function DF(e,t,n){const s=oF(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?qM(n):cF(n)),s.property==="style"){let o=typeof n=="object"?n:$F(e,String(n));return e.stylePropertyNameCase==="css"&&(o=LF(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?nF[s.property]||s.property:s.attribute,n]}}function $F(e,t){try{return hF(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new Gn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=IC+"#cannot-parse-style-attribute",o}}function FC(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,c;for(;++i<o.length;){const u=Oj(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(i&&u.type==="Literal"),optional:!1}:u}s=c}else s=Oj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return gy.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);kc(e)}function kc(e,t){const n=new Gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=IC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LF(e){const t={};let n;for(n in e)gy.call(e,n)&&(t[OF(n)]=e[n]);return t}function OF(e){let t=e.replace(yF,IF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function IF(e){return"-"+e.toLowerCase()}const _h={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},_F={};function MF(e,t){const n=_F,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return zC(e,s,o)}function zC(e,t,n){if(FF(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Wj(e.children,t,n)}return Array.isArray(e)?Wj(e,t,n):""}function Wj(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=zC(e[o],t,n);return s.join("")}function FF(e){return!!(e&&typeof e=="object")}const Kj=document.createElement("i");function by(e){const t="&"+e+";";Kj.innerHTML=t;const n=Kj.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ns(e,t,n,s){const o=e.length;let i=0,c;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);i<s.length;)c=s.slice(i,i+1e4),c.unshift(t,0),e.splice(...c),i+=1e4,t+=1e4}function Fr(e,t){return e.length>0?(Ns(e,e.length,0,t),e):t}const qj={}.hasOwnProperty;function zF(e){const t={};let n=-1;for(;++n<e.length;)BF(t,e[n]);return t}function BF(e,t){let n;for(n in t){const o=(qj.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let c;if(i)for(c in i){qj.call(o,c)||(o[c]=[]);const u=i[c];UF(o[c],Array.isArray(u)?u:u?[u]:[])}}}function UF(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ns(e,0,0,s)}function BC(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ei(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vs=Po(/[A-Za-z]/),Er=Po(/[\dA-Za-z]/),VF=Po(/[#-'*+\--9=?A-Z^-~]/);function Mg(e){return e!==null&&(e<32||e===127)}const Fg=Po(/\d/),HF=Po(/[\dA-Fa-f]/),WF=Po(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function fr(e){return e!==null&&(e<0||e===32)}function $t(e){return e===-2||e===-1||e===32}const KF=Po(new RegExp("\\p{P}|\\p{S}","u")),qF=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ji(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let c="";if(i===37&&Er(e.charCodeAt(n+1))&&Er(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(c=String.fromCharCode(i));else if(i>55295&&i<57344){const u=e.charCodeAt(n+1);i<56320&&u>56319&&u<57344?(c=String.fromCharCode(i,u),o=1):c="�"}else c=String.fromCharCode(i);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+o+1,c=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Ht(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let i=0;return c;function c(d){return $t(d)?(e.enter(n),u(d)):t(d)}function u(d){return $t(d)&&i++<o?(e.consume(d),u):(e.exit(n),t(d))}}const GF={tokenize:YF};function YF(e){const t=e.attempt(this.parser.constructs.contentInitial,s,o);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Ht(e,t,"linePrefix")}function o(u){return e.enter("paragraph"),i(u)}function i(u){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return lt(u)?(e.consume(u),e.exit("chunkText"),i):(e.consume(u),c)}}const QF={tokenize:JF},Gj={tokenize:XF};function JF(e){const t=this,n=[];let s=0,o,i,c;return u;function u(S){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,d,m)(S)}return m(S)}function d(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&E();const T=t.events.length;let A=T,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){R=t.events[A][1].end;break}k(s);let P=T;for(;P<t.events.length;)t.events[P][1].end={...R},P++;return Ns(t.events,A+1,0,t.events.slice(T)),t.events.length=P,m(S)}return u(S)}function m(S){if(s===n.length){if(!o)return y(S);if(o.currentConstruct&&o.currentConstruct.concrete)return C(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Gj,h,g)(S)}function h(S){return o&&E(),k(s),y(S)}function g(S){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(S)}function y(S){return t.containerState={},e.attempt(Gj,b,C)(S)}function b(S){return s++,n.push([t.currentConstruct,t.containerState]),y(S)}function C(S){if(S===null){o&&E(),k(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),j(S)}function j(S){if(S===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(S);return}return lt(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(S),j)}function v(S,T){const A=t.sliceStream(S);if(T&&A.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(A),t.parser.lazy[S.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<c&&(!o.events[R][1].end||o.events[R][1].end.offset>c))return;const P=t.events.length;let $=P,M,_;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(M){_=t.events[$][1].end;break}M=!0}for(k(s),R=P;R<t.events.length;)t.events[R][1].end={..._},R++;Ns(t.events,$+1,0,t.events.slice(P)),t.events.length=R}}function k(S){let T=n.length;for(;T-- >S;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=S}function E(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function XF(e,t,n){return Ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Yj(e){if(e===null||fr(e)||qF(e))return 1;if(KF(e))return 2}function vy(e,t,n){const s=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const zg={name:"attention",resolveAll:ZF,tokenize:e6};function ZF(e,t){let n=-1,s,o,i,c,u,d,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},y={...e[n][1].start};Qj(g,-d),Qj(y,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},i={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[s][1].end={...c.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Fr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Fr(m,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",i,t]]),m=Fr(m,vy(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Fr(m,[["exit",i,t],["enter",u,t],["exit",u,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Fr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Ns(e,s-1,n-s+3,m),n=s+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function e6(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=Yj(s);let i;return c;function c(d){return i=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===i)return e.consume(d),u;const m=e.exit("attentionSequence"),h=Yj(d),g=!h||h===2&&o||n.includes(d),y=!o||o===2&&h||n.includes(s);return m._open=!!(i===42?g:g&&(o||!y)),m._close=!!(i===42?y:y&&(h||!g)),t(d)}}function Qj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const t6={name:"autolink",tokenize:n6};function n6(e,t,n){let s=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(b){return vs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||Er(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,d):(b===43||b===45||b===46||Er(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function d(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Mg(b)?n(b):(e.consume(b),d)}function m(b){return b===64?(e.consume(b),h):VF(b)?(e.consume(b),m):n(b)}function h(b){return Er(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Er(b))&&s++<63){const C=b===45?y:g;return e.consume(b),C}return n(b)}}const cp={partial:!0,tokenize:r6};function r6(e,t,n){return s;function s(i){return $t(i)?Ht(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||lt(i)?t(i):n(i)}}const UC={continuation:{tokenize:o6},exit:a6,name:"blockQuote",tokenize:s6};function s6(e,t,n){const s=this;return o;function o(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),i}return n(c)}function i(c){return $t(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function o6(e,t,n){const s=this;return o;function o(c){return $t(c)?Ht(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):i(c)}function i(c){return e.attempt(UC,t,n)(c)}}function a6(e){e.exit("blockQuote")}const VC={name:"characterEscape",tokenize:i6};function i6(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return WF(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const HC={name:"characterReference",tokenize:l6};function l6(e,t,n){const s=this;let o=0,i,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),i=31,c=Er,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,c=HF,h):(e.enter("characterReferenceValue"),i=7,c=Fg,h(g))}function h(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===Er&&!by(s.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&o++<i?(e.consume(g),h):n(g)}}const Jj={partial:!0,tokenize:u6},Xj={concrete:!0,name:"codeFenced",tokenize:c6};function c6(e,t,n){const s=this,o={partial:!0,tokenize:A};let i=0,c=0,u;return d;function d(R){return m(R)}function m(R){const P=s.events[s.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(c++,e.consume(R),h):c<3?n(R):(e.exit("codeFencedFenceSequence"),$t(R)?Ht(e,g,"whitespace")(R):g(R))}function g(R){return R===null||lt(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(Jj,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):$t(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ht(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||lt(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(R))}function C(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),C)}function j(R){return e.attempt(o,T,v)(R)}function v(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return i>0&&$t(R)?Ht(e,E,"linePrefix",i+1)(R):E(R)}function E(R){return R===null||lt(R)?e.check(Jj,j,T)(R):(e.enter("codeFlowValue"),S(R))}function S(R){return R===null||lt(R)?(e.exit("codeFlowValue"),E(R)):(e.consume(R),S)}function T(R){return e.exit("codeFenced"),t(R)}function A(R,P,$){let M=0;return _;function _(F){return R.enter("lineEnding"),R.consume(F),R.exit("lineEnding"),D}function D(F){return R.enter("codeFencedFence"),$t(F)?Ht(R,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):V(F)}function V(F){return F===u?(R.enter("codeFencedFenceSequence"),K(F)):$(F)}function K(F){return F===u?(M++,R.consume(F),K):M>=c?(R.exit("codeFencedFenceSequence"),$t(F)?Ht(R,I,"whitespace")(F):I(F)):$(F)}function I(F){return F===null||lt(F)?(R.exit("codeFencedFence"),P(F)):$(F)}}}function u6(e,t,n){const s=this;return o;function o(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i)}function i(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Mh={name:"codeIndented",tokenize:f6},d6={partial:!0,tokenize:p6};function f6(e,t,n){const s=this;return o;function o(m){return e.enter("codeIndented"),Ht(e,i,"linePrefix",5)(m)}function i(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?c(m):n(m)}function c(m){return m===null?d(m):lt(m)?e.attempt(d6,c,d)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||lt(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function d(m){return e.exit("codeIndented"),t(m)}}function p6(e,t,n){const s=this;return o;function o(c){return s.parser.lazy[s.now().line]?n(c):lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):Ht(e,i,"linePrefix",5)(c)}function i(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):lt(c)?o(c):n(c)}}const m6={name:"codeText",previous:g6,resolve:h6,tokenize:x6};function h6(e){let t=e.length-4,n=3,s,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)o===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(o=s):(s===t||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),t-=s-o-2,s=o+2),o=void 0);return e}function g6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function x6(e,t,n){let s=0,o,i;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(i=e.enter("codeTextSequence"),o=0,h(g)):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||lt(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),o++,h):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(i.type="codeTextData",m(g))}}class y6{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&Bl(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Bl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Bl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Bl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Bl(this.left,n.reverse())}}}function Bl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function WC(e){const t={};let n=-1,s,o,i,c,u,d,m;const h=new y6(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,b6(h,n)),n=t[n],m=!0);else if(s[1]._container){for(i=n,o=void 0;i--;)if(c=h.get(i),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(h.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=i);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(s[1].end={...h.get(o)[1].start},u=h.slice(o,n),u.unshift(s),h.splice(o,n-o+1,u))}}return Ns(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function b6(e,t){const n=e.get(t)[1],s=e.get(t)[2];let o=t-1;const i=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,d=[],m={};let h,g,y=-1,b=n,C=0,j=0;const v=[j];for(;b;){for(;e.get(++o)[1]!==b;);i.push(o),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(j=y+1,v.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):v.pop(),y=v.length;y--;){const k=u.slice(v[y],v[y+1]),E=i.pop();d.push([E,E+k.length-1]),e.splice(E,2,k)}for(d.reverse(),y=-1;++y<d.length;)m[C+d[y][0]]=C+d[y][1],C+=d[y][1]-d[y][0]-1;return m}const v6={resolve:j6,tokenize:k6},w6={partial:!0,tokenize:S6};function j6(e){return WC(e),e}function k6(e,t){let n;return s;function s(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(u)}function o(u){return u===null?i(u):lt(u)?e.check(w6,c,i)(u):(e.consume(u),o)}function i(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function c(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function S6(e,t,n){const s=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ht(e,i,"linePrefix")}function i(c){if(c===null||lt(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function KC(e,t,n,s,o,i,c,u,d){const m=d||Number.POSITIVE_INFINITY;let h=0;return g;function g(k){return k===60?(e.enter(s),e.enter(o),e.enter(i),e.consume(k),e.exit(i),y):k===null||k===32||k===41||Mg(k)?n(k):(e.enter(s),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(o),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||lt(k)?n(k):(e.consume(k),k===92?C:b)}function C(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||fr(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,j):k===41?(e.consume(k),h--,j):k===null||k===32||k===40||Mg(k)?n(k):(e.consume(k),k===92?v:j)}function v(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function qC(e,t,n,s,o,i){const c=this;let u=0,d;return m;function m(b){return e.enter(s),e.enter(o),e.consume(b),e.exit(o),e.enter(i),h}function h(b){return u>999||b===null||b===91||b===93&&!d||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(i),e.enter(o),e.consume(b),e.exit(o),e.exit(s),t):lt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||lt(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),d||(d=!$t(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function GC(e,t,n,s,o,i){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(o),e.consume(y),e.exit(o),c=y===40?41:y,d):n(y)}function d(y){return y===c?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),t):(e.enter(i),m(y))}function m(y){return y===c?(e.exit(i),d(c)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Ht(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||lt(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===c||y===92?(e.consume(y),h):h(y)}}function lc(e,t){let n;return s;function s(o){return lt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):$t(o)?Ht(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const N6={name:"definition",tokenize:E6},C6={partial:!0,tokenize:T6};function E6(e,t,n){const s=this;let o;return i;function i(b){return e.enter("definition"),c(b)}function c(b){return qC.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return o=Ei(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),d):n(b)}function d(b){return fr(b)?lc(e,m)(b):m(b)}function m(b){return KC(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(C6,g,g)(b)}function g(b){return $t(b)?Ht(e,y,"whitespace")(b):y(b)}function y(b){return b===null||lt(b)?(e.exit("definition"),s.parser.defined.push(o),t(b)):n(b)}}function T6(e,t,n){return s;function s(u){return fr(u)?lc(e,o)(u):n(u)}function o(u){return GC(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function i(u){return $t(u)?Ht(e,c,"whitespace")(u):c(u)}function c(u){return u===null||lt(u)?t(u):n(u)}}const R6={name:"hardBreakEscape",tokenize:A6};function A6(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return lt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const P6={name:"headingAtx",resolve:D6,tokenize:$6};function D6(e,t){let n=e.length-2,s=3,o,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Ns(e,s,n-s+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function $6(e,t,n){let s=0;return o;function o(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||fr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),d(h)):h===null||lt(h)?(e.exit("atxHeading"),t(h)):$t(h)?Ht(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function d(h){return h===35?(e.consume(h),d):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||fr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const L6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zj=["pre","script","style","textarea"],O6={concrete:!0,name:"htmlFlow",resolveTo:M6,tokenize:F6},I6={partial:!0,tokenize:B6},_6={partial:!0,tokenize:z6};function M6(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function F6(e,t,n){const s=this;let o,i,c,u,d;return m;function m(U){return h(U)}function h(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),g}function g(U){return U===33?(e.consume(U),y):U===47?(e.consume(U),i=!0,j):U===63?(e.consume(U),o=3,s.interrupt?t:L):vs(U)?(e.consume(U),c=String.fromCharCode(U),v):n(U)}function y(U){return U===45?(e.consume(U),o=2,b):U===91?(e.consume(U),o=5,u=0,C):vs(U)?(e.consume(U),o=4,s.interrupt?t:L):n(U)}function b(U){return U===45?(e.consume(U),s.interrupt?t:L):n(U)}function C(U){const ue="CDATA[";return U===ue.charCodeAt(u++)?(e.consume(U),u===ue.length?s.interrupt?t:V:C):n(U)}function j(U){return vs(U)?(e.consume(U),c=String.fromCharCode(U),v):n(U)}function v(U){if(U===null||U===47||U===62||fr(U)){const ue=U===47,ge=c.toLowerCase();return!ue&&!i&&Zj.includes(ge)?(o=1,s.interrupt?t(U):V(U)):L6.includes(c.toLowerCase())?(o=6,ue?(e.consume(U),k):s.interrupt?t(U):V(U)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(U):i?E(U):S(U))}return U===45||Er(U)?(e.consume(U),c+=String.fromCharCode(U),v):n(U)}function k(U){return U===62?(e.consume(U),s.interrupt?t:V):n(U)}function E(U){return $t(U)?(e.consume(U),E):_(U)}function S(U){return U===47?(e.consume(U),_):U===58||U===95||vs(U)?(e.consume(U),T):$t(U)?(e.consume(U),S):_(U)}function T(U){return U===45||U===46||U===58||U===95||Er(U)?(e.consume(U),T):A(U)}function A(U){return U===61?(e.consume(U),R):$t(U)?(e.consume(U),A):S(U)}function R(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),d=U,P):$t(U)?(e.consume(U),R):$(U)}function P(U){return U===d?(e.consume(U),d=null,M):U===null||lt(U)?n(U):(e.consume(U),P)}function $(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||fr(U)?A(U):(e.consume(U),$)}function M(U){return U===47||U===62||$t(U)?S(U):n(U)}function _(U){return U===62?(e.consume(U),D):n(U)}function D(U){return U===null||lt(U)?V(U):$t(U)?(e.consume(U),D):n(U)}function V(U){return U===45&&o===2?(e.consume(U),q):U===60&&o===1?(e.consume(U),Z):U===62&&o===4?(e.consume(U),H):U===63&&o===3?(e.consume(U),L):U===93&&o===5?(e.consume(U),G):lt(U)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(I6,re,K)(U)):U===null||lt(U)?(e.exit("htmlFlowData"),K(U)):(e.consume(U),V)}function K(U){return e.check(_6,I,re)(U)}function I(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),F}function F(U){return U===null||lt(U)?K(U):(e.enter("htmlFlowData"),V(U))}function q(U){return U===45?(e.consume(U),L):V(U)}function Z(U){return U===47?(e.consume(U),c="",z):V(U)}function z(U){if(U===62){const ue=c.toLowerCase();return Zj.includes(ue)?(e.consume(U),H):V(U)}return vs(U)&&c.length<8?(e.consume(U),c+=String.fromCharCode(U),z):V(U)}function G(U){return U===93?(e.consume(U),L):V(U)}function L(U){return U===62?(e.consume(U),H):U===45&&o===2?(e.consume(U),L):V(U)}function H(U){return U===null||lt(U)?(e.exit("htmlFlowData"),re(U)):(e.consume(U),H)}function re(U){return e.exit("htmlFlow"),t(U)}}function z6(e,t,n){const s=this;return o;function o(c){return lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):n(c)}function i(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function B6(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(cp,t,n)}}const U6={name:"htmlText",tokenize:V6};function V6(e,t,n){const s=this;let o,i,c;return u;function u(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),d}function d(L){return L===33?(e.consume(L),m):L===47?(e.consume(L),A):L===63?(e.consume(L),S):vs(L)?(e.consume(L),$):n(L)}function m(L){return L===45?(e.consume(L),h):L===91?(e.consume(L),i=0,C):vs(L)?(e.consume(L),E):n(L)}function h(L){return L===45?(e.consume(L),b):n(L)}function g(L){return L===null?n(L):L===45?(e.consume(L),y):lt(L)?(c=g,Z(L)):(e.consume(L),g)}function y(L){return L===45?(e.consume(L),b):g(L)}function b(L){return L===62?q(L):L===45?y(L):g(L)}function C(L){const H="CDATA[";return L===H.charCodeAt(i++)?(e.consume(L),i===H.length?j:C):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),v):lt(L)?(c=j,Z(L)):(e.consume(L),j)}function v(L){return L===93?(e.consume(L),k):j(L)}function k(L){return L===62?q(L):L===93?(e.consume(L),k):j(L)}function E(L){return L===null||L===62?q(L):lt(L)?(c=E,Z(L)):(e.consume(L),E)}function S(L){return L===null?n(L):L===63?(e.consume(L),T):lt(L)?(c=S,Z(L)):(e.consume(L),S)}function T(L){return L===62?q(L):S(L)}function A(L){return vs(L)?(e.consume(L),R):n(L)}function R(L){return L===45||Er(L)?(e.consume(L),R):P(L)}function P(L){return lt(L)?(c=P,Z(L)):$t(L)?(e.consume(L),P):q(L)}function $(L){return L===45||Er(L)?(e.consume(L),$):L===47||L===62||fr(L)?M(L):n(L)}function M(L){return L===47?(e.consume(L),q):L===58||L===95||vs(L)?(e.consume(L),_):lt(L)?(c=M,Z(L)):$t(L)?(e.consume(L),M):q(L)}function _(L){return L===45||L===46||L===58||L===95||Er(L)?(e.consume(L),_):D(L)}function D(L){return L===61?(e.consume(L),V):lt(L)?(c=D,Z(L)):$t(L)?(e.consume(L),D):M(L)}function V(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),o=L,K):lt(L)?(c=V,Z(L)):$t(L)?(e.consume(L),V):(e.consume(L),I)}function K(L){return L===o?(e.consume(L),o=void 0,F):L===null?n(L):lt(L)?(c=K,Z(L)):(e.consume(L),K)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||fr(L)?M(L):(e.consume(L),I)}function F(L){return L===47||L===62||fr(L)?M(L):n(L)}function q(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function Z(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),z}function z(L){return $t(L)?Ht(e,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):G(L)}function G(L){return e.enter("htmlTextData"),c(L)}}const wy={name:"labelEnd",resolveAll:q6,resolveTo:G6,tokenize:Y6},H6={tokenize:Q6},W6={tokenize:J6},K6={tokenize:X6};function q6(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",t+=o}}return e.length!==n.length&&Ns(e,0,e.length,n),e}function G6(e,t){let n=e.length,s=0,o,i,c,u;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(c=n);const d={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[i][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",d,t],["enter",m,t]],u=Fr(u,e.slice(i+1,i+s+3)),u=Fr(u,[["enter",h,t]]),u=Fr(u,vy(t.parser.constructs.insideSpan.null,e.slice(i+s+4,c-3),t)),u=Fr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Fr(u,e.slice(c+1)),u=Fr(u,[["exit",d,t]]),Ns(e,i,e.length,u),e}function Y6(e,t,n){const s=this;let o=s.events.length,i,c;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){i=s.events[o][1];break}return u;function u(y){return i?i._inactive?g(y):(c=s.parser.defined.includes(Ei(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):n(y)}function d(y){return y===40?e.attempt(H6,h,c?h:g)(y):y===91?e.attempt(W6,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(K6,h,g)(y)}function h(y){return t(y)}function g(y){return i._balanced=!0,n(y)}}function Q6(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return fr(g)?lc(e,i)(g):i(g)}function i(g){return g===41?h(g):KC(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return fr(g)?lc(e,d)(g):h(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?GC(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return fr(g)?lc(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function J6(e,t,n){const s=this;return o;function o(u){return qC.call(s,e,i,c,"reference","referenceMarker","referenceString")(u)}function i(u){return s.parser.defined.includes(Ei(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function X6(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const Z6={name:"labelStartImage",resolveAll:wy.resolveAll,tokenize:ez};function ez(e,t,n){const s=this;return o;function o(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),i}function i(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),c):n(u)}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const tz={name:"labelStartLink",resolveAll:wy.resolveAll,tokenize:nz};function nz(e,t,n){const s=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),i}function i(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Fh={name:"lineEnding",tokenize:rz};function rz(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ht(e,t,"linePrefix")}}const _d={name:"thematicBreak",tokenize:sz};function sz(e,t,n){let s=0,o;return i;function i(m){return e.enter("thematicBreak"),c(m)}function c(m){return o=m,u(m)}function u(m){return m===o?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||lt(m))?(e.exit("thematicBreak"),t(m)):n(m)}function d(m){return m===o?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),$t(m)?Ht(e,u,"whitespace")(m):u(m))}}const lr={continuation:{tokenize:lz},exit:uz,name:"list",tokenize:iz},oz={partial:!0,tokenize:dz},az={partial:!0,tokenize:cz};function iz(e,t,n){const s=this,o=s.events[s.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return u;function u(b){const C=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Fg(b)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(_d,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(b)}return n(b)}function d(b){return Fg(b)&&++c<10?(e.consume(b),d):(!s.interrupt||c<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(cp,s.interrupt?n:h,e.attempt(oz,y,g))}function h(b){return s.containerState.initialBlankLine=!0,i++,y(b)}function g(b){return $t(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function lz(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(cp,o,i);function o(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ht(e,t,"listItemIndent",s.containerState.size+1)(u)}function i(u){return s.containerState.furtherBlankLines||!$t(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(az,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ht(e,e.attempt(lr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function cz(e,t,n){const s=this;return Ht(e,o,"listItemIndent",s.containerState.size+1);function o(i){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(i):n(i)}}function uz(e){e.exit(this.containerState.type)}function dz(e,t,n){const s=this;return Ht(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const c=s.events[s.events.length-1];return!$t(i)&&c&&c[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const e0={name:"setextUnderline",resolveTo:fz,tokenize:pz};function fz(e,t){let n=e.length,s,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",c,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function pz(e,t,n){const s=this;let o;return i;function i(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===o?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),$t(m)?Ht(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||lt(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const mz={tokenize:hz};function hz(e){const t=this,n=e.attempt(cp,s,e.attempt(this.parser.constructs.flowInitial,o,Ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(v6,o)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const gz={resolveAll:QC()},xz=YC("string"),yz=YC("text");function YC(e){return{resolveAll:QC(e==="text"?bz:void 0),tokenize:t};function t(n){const s=this,o=this.parser.constructs[e],i=n.attempt(o,c,u);return c;function c(h){return m(h)?i(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),d}function d(h){return m(h)?(n.exit("data"),i(h)):(n.consume(h),d)}function m(h){if(h===null)return!0;const g=o[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function QC(e){return t;function t(n,s){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,s):n}}function bz(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],o=t.sliceStream(s);let i=o.length,c=-1,u=0,d;for(;i--;){const m=o[i];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)d=!0,u++;else if(m!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||d||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?c:s.start._bufferIndex+c,_index:s.start._index+i,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const vz={42:lr,43:lr,45:lr,48:lr,49:lr,50:lr,51:lr,52:lr,53:lr,54:lr,55:lr,56:lr,57:lr,62:UC},wz={91:N6},jz={[-2]:Mh,[-1]:Mh,32:Mh},kz={35:P6,42:_d,45:[e0,_d],60:O6,61:e0,95:_d,96:Xj,126:Xj},Sz={38:HC,92:VC},Nz={[-5]:Fh,[-4]:Fh,[-3]:Fh,33:Z6,38:HC,42:zg,60:[t6,U6],91:tz,92:[R6,VC],93:wy,95:zg,96:m6},Cz={null:[zg,gz]},Ez={null:[42,95]},Tz={null:[]},Rz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Ez,contentInitial:wz,disable:Tz,document:vz,flow:kz,flowInitial:jz,insideSpan:Cz,string:Sz,text:Nz},Symbol.toStringTag,{value:"Module"}));function Az(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let c=[],u=[];const d={attempt:P(A),check:P(R),consume:E,enter:S,exit:T,interrupt:P(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,d);return t.resolveAll&&i.push(t),m;function g(D){return c=Fr(c,D),v(),c[c.length-1]!==null?[]:($(t,0),m.events=vy(i,m.events,m),m.events)}function y(D,V){return Dz(b(D),V)}function b(D){return Pz(c,D)}function C(){const{_bufferIndex:D,_index:V,line:K,column:I,offset:F}=s;return{_bufferIndex:D,_index:V,line:K,column:I,offset:F}}function j(D){o[D.line]=D.column,_()}function v(){let D;for(;s._index<c.length;){const V=c[s._index];if(typeof V=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<V.length;)k(V.charCodeAt(s._bufferIndex));else k(V)}}function k(D){h=h(D)}function E(D){lt(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,_()):D!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=D}function S(D,V){const K=V||{};return K.type=D,K.start=C(),m.events.push(["enter",K,m]),u.push(K),K}function T(D){const V=u.pop();return V.end=C(),m.events.push(["exit",V,m]),V}function A(D,V){$(D,V.from)}function R(D,V){V.restore()}function P(D,V){return K;function K(I,F,q){let Z,z,G,L;return Array.isArray(I)?re(I):"tokenize"in I?re([I]):H(I);function H(se){return ye;function ye(Se){const Te=Se!==null&&se[Se],Pe=Se!==null&&se.null,Ke=[...Array.isArray(Te)?Te:Te?[Te]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return re(Ke)(Se)}}function re(se){return Z=se,z=0,se.length===0?q:U(se[z])}function U(se){return ye;function ye(Se){return L=M(),G=se,se.partial||(m.currentConstruct=se),se.name&&m.parser.constructs.disable.null.includes(se.name)?ge():se.tokenize.call(V?Object.assign(Object.create(m),V):m,d,ue,ge)(Se)}}function ue(se){return D(G,L),F}function ge(se){return L.restore(),++z<Z.length?U(Z[z]):q}}}function $(D,V){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Ns(m.events,V,m.events.length-V,D.resolve(m.events.slice(V),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function M(){const D=C(),V=m.previous,K=m.currentConstruct,I=m.events.length,F=Array.from(u);return{from:I,restore:q};function q(){s=D,m.previous=V,m.currentConstruct=K,m.events.length=I,u=F,_()}}function _(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function Pz(e,t){const n=t.start._index,s=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let c;if(n===o)c=[e[n].slice(s,i)];else{if(c=e.slice(n,o),s>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(s):c.shift()}i>0&&c.push(e[o].slice(0,i))}return c}function Dz(e,t){let n=-1;const s=[];let o;for(;++n<e.length;){const i=e[n];let c;if(typeof i=="string")c=i;else switch(i){case-5:{c="\r";break}case-4:{c=`
|
|
557
|
+
`;break}case-3:{c=`\r
|
|
558
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&o)continue;c=" ";break}default:c=String.fromCharCode(i)}o=i===-2,s.push(c)}return s.join("")}function $z(e){const s={constructs:zF([Rz,...(e||{}).extensions||[]]),content:o(GF),defined:[],document:o(QF),flow:o(mz),lazy:{},string:o(xz),text:o(yz)};return s;function o(i){return c;function c(u){return Az(s,i,u)}}}function Lz(e){for(;!WC(e););return e}const t0=/[\0\t\n\r]/g;function Oz(){let e=1,t="",n=!0,s;return o;function o(i,c,u){const d=[];let m,h,g,y,b;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(c||void 0).decode(i)),g=0,t="",n&&(i.charCodeAt(0)===65279&&g++,n=void 0);g<i.length;){if(t0.lastIndex=g,m=t0.exec(i),y=m&&m.index!==void 0?m.index:i.length,b=i.charCodeAt(y),!m){t=i.slice(g);break}if(b===10&&g===y&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<y&&(d.push(i.slice(g,y)),e+=y-g),b){case 0:{d.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,d.push(-2);e++<h;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const Iz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function _z(e){return e.replace(Iz,Mz)}function Mz(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return BC(n.slice(i?2:1),i?16:10)}return by(n)||e}const JC={}.hasOwnProperty;function Fz(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),zz(n)(Lz($z(n).document().write(Oz()(e,t,!0))))}function zz(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ye),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(X),blockQuote:i(Pe),characterEscape:M,characterReference:M,codeFenced:i(Ke),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:i(Ke,c),codeText:i(ct,c),codeTextData:M,data:M,codeFlowValue:M,definition:i(et),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:i(ot),hardBreakEscape:i(Me),hardBreakTrailing:i(Me),htmlFlow:i(Ce,c),htmlFlowData:M,htmlText:i(Ce,c),htmlTextData:M,image:i(Ie),label:c,link:i(Ye),listItem:i(Ze),listItemValue:y,listOrdered:i(Fe,g),listUnordered:i(Fe),paragraph:i(Je),reference:U,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:i(X),strong:i(Ot),thematicBreak:i(dt)},exit:{atxHeading:d(),atxHeadingSequence:A,autolink:d(),autolinkEmail:Te,autolinkProtocol:Se,blockQuote:d(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:se,characterReference:ye,codeFenced:d(v),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:_,codeIndented:d(k),codeText:d(F),codeTextData:_,data:_,definition:d(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(V),hardBreakTrailing:d(V),htmlFlow:d(K),htmlFlowData:_,htmlText:d(I),htmlTextData:_,image:d(Z),label:G,labelText:z,lineEnding:D,link:d(q),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ue,resourceDestinationString:L,resourceTitleString:H,resource:re,setextHeading:d($),setextHeadingLineSequence:P,setextHeadingText:R,strong:d(),thematicBreak:d()}};XC(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let Y={type:"root",children:[]};const fe={stack:[Y],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},ne=[];let he=-1;for(;++he<le.length;)if(le[he][1].type==="listOrdered"||le[he][1].type==="listUnordered")if(le[he][0]==="enter")ne.push(he);else{const De=ne.pop();he=o(le,De,he)}for(he=-1;++he<le.length;){const De=t[le[he][0]];JC.call(De,le[he][1].type)&&De[le[he][1].type].call(Object.assign({sliceSerialize:le[he][2].sliceSerialize},fe),le[he][1])}if(fe.tokenStack.length>0){const De=fe.tokenStack[fe.tokenStack.length-1];(De[1]||n0).call(fe,void 0,De[0])}for(Y.position={start:mo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:mo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},he=-1;++he<t.transforms.length;)Y=t.transforms[he](Y)||Y;return Y}function o(le,Y,fe){let ne=Y-1,he=-1,De=!1,ut,ae,be,Le;for(;++ne<=fe;){const at=le[ne];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?he++:he--,Le=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(ut&&!Le&&!he&&!be&&(be=ne),Le=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Le=void 0}if(!he&&at[0]==="enter"&&at[1].type==="listItemPrefix"||he===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(ut){let Be=ne;for(ae=void 0;Be--;){const kt=le[Be];if(kt[1].type==="lineEnding"||kt[1].type==="lineEndingBlank"){if(kt[0]==="exit")continue;ae&&(le[ae][1].type="lineEndingBlank",De=!0),kt[1].type="lineEnding",ae=Be}else if(!(kt[1].type==="linePrefix"||kt[1].type==="blockQuotePrefix"||kt[1].type==="blockQuotePrefixWhitespace"||kt[1].type==="blockQuoteMarker"||kt[1].type==="listItemIndent"))break}be&&(!ae||be<ae)&&(ut._spread=!0),ut.end=Object.assign({},ae?le[ae][1].start:at[1].end),le.splice(ae||ne,0,["exit",ut,at[2]]),ne++,fe++}if(at[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};ut=Be,le.splice(ne,0,["enter",Be,at[2]]),ne++,fe++,be=void 0,Le=!0}}}return le[Y][1]._spread=De,fe}function i(le,Y){return fe;function fe(ne){u.call(this,le(ne),ne),Y&&Y.call(this,ne)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,Y,fe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Y,fe||void 0]),le.position={start:mo(Y.start),end:void 0}}function d(le){return Y;function Y(fe){le&&le.call(this,fe),m.call(this,fe)}}function m(le,Y){const fe=this.stack.pop(),ne=this.tokenStack.pop();if(ne)ne[0].type!==le.type&&(Y?Y.call(this,le,ne[0]):(ne[1]||n0).call(this,le,ne[0]));else throw new Error("Cannot close `"+le.type+"` ("+ic({start:le.start,end:le.end})+"): it’s not open");fe.position.end=mo(le.end)}function h(){return MF(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=le}function C(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/(\r?\n|\r)$/g,"")}function E(le){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=Ei(this.sliceSerialize(le)).toLowerCase()}function S(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function T(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function A(le){const Y=this.stack[this.stack.length-1];if(!Y.depth){const fe=this.sliceSerialize(le).length;Y.depth=fe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function P(le){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function M(le){const fe=this.stack[this.stack.length-1].children;let ne=fe[fe.length-1];(!ne||ne.type!=="text")&&(ne=yt(),ne.position={start:mo(le.start),end:void 0},fe.push(ne)),this.stack.push(ne)}function _(le){const Y=this.stack.pop();Y.value+=this.sliceSerialize(le),Y.position.end=mo(le.end)}function D(le){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=Y.children[Y.children.length-1];fe.position.end=mo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(M.call(this,le),_.call(this,le))}function V(){this.data.atHardBreak=!0}function K(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function I(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function F(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function Z(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function z(le){const Y=this.sliceSerialize(le),fe=this.stack[this.stack.length-2];fe.label=_z(Y),fe.identifier=Ei(Y).toLowerCase()}function G(){const le=this.stack[this.stack.length-1],Y=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ne=le.children;fe.children=ne}else fe.alt=Y}function L(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function H(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function re(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function ue(le){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=Ei(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ge(le){this.data.characterReferenceType=le.type}function se(le){const Y=this.sliceSerialize(le),fe=this.data.characterReferenceType;let ne;fe?(ne=BC(Y,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ne=by(Y);const he=this.stack[this.stack.length-1];he.value+=ne}function ye(le){const Y=this.stack.pop();Y.position.end=mo(le.end)}function Se(le){_.call(this,le);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(le)}function Te(le){_.call(this,le);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(le)}function Pe(){return{type:"blockquote",children:[]}}function Ke(){return{type:"code",lang:null,meta:null,value:""}}function ct(){return{type:"inlineCode",value:""}}function et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function Ye(){return{type:"link",title:null,url:"",children:[]}}function Fe(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Ze(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function Ot(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function mo(e){return{line:e.line,column:e.column,offset:e.offset}}function XC(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?XC(e,s):Bz(e,s)}}function Bz(e,t){let n;for(n in t)if(JC.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function n0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ic({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ic({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ic({start:t.start,end:t.end})+") is still open")}function Uz(e){const t=this;t.parser=n;function n(s){return Fz(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Vz(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Hz(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
559
|
+
`}]}function Wz(e,t){const n=t.value?t.value+`
|
|
560
|
+
`:"",s={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function Kz(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qz(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Gz(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=Ji(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let c,u=e.footnoteCounts.get(s);u===void 0?(u=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=i+1,u+=1,e.footnoteCounts.set(s,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function Yz(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Qz(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function ZC(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const c=o[o.length-1];return c&&c.type==="text"?c.value+=s:o.push({type:"text",value:s}),o}function Jz(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return ZC(e,t);const o={src:Ji(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function Xz(e,t){const n={src:Ji(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function Zz(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function eB(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return ZC(e,t);const o={href:Ji(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function tB(e,t){const n={href:Ji(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function nB(e,t,n){const s=e.all(t),o=n?rB(n):eE(t),i={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(o||u!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
|
|
561
|
+
`}),h.type==="element"&&h.tagName==="p"&&!o?c.push(...h.children):c.push(h)}const d=s[s.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
|
|
562
|
+
`});const m={type:"element",tagName:"li",properties:i,children:c};return e.patch(t,m),e.applyData(t,m)}function rB(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=eE(n[s])}return t}function eE(e){const t=e.spread;return t??e.children.length>1}function sB(e,t){const n={},s=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<s.length;){const c=s[o];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function oB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function iB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lB(e,t){const n=e.all(t),s=n.shift(),o=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),o.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=hy(t.children[1]),d=LC(t.children[t.children.length-1]);u&&d&&(c.position={start:u,end:d}),o.push(c)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function cB(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,u=c?c.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const g=t.children[d],y={},b=c?c[d]:void 0;b&&(y.align=b);let C={type:"element",tagName:i,properties:y,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),m.push(C)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function uB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const r0=9,s0=32;function dB(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const i=[];for(;s;)i.push(o0(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return i.push(o0(t.slice(o),o>0,!1)),i.join("")}function o0(e,t,n){let s=0,o=e.length;if(t){let i=e.codePointAt(s);for(;i===r0||i===s0;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(o-1);for(;i===r0||i===s0;)o--,i=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function fB(e,t){const n={type:"text",value:dB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const mB={blockquote:Vz,break:Hz,code:Wz,delete:Kz,emphasis:qz,footnoteReference:Gz,heading:Yz,html:Qz,imageReference:Jz,image:Xz,inlineCode:Zz,linkReference:eB,link:tB,listItem:nB,list:sB,paragraph:oB,root:aB,strong:iB,table:lB,tableCell:uB,tableRow:cB,text:fB,thematicBreak:pB,toml:gd,yaml:gd,definition:gd,footnoteDefinition:gd};function gd(){}const tE=-1,up=0,cc=1,df=2,jy=3,ky=4,Sy=5,Ny=6,nE=7,rE=8,a0=typeof self=="object"?self:globalThis,hB=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),s=o=>{if(e.has(o))return e.get(o);const[i,c]=t[o];switch(i){case up:case tE:return n(c,o);case cc:{const u=n([],o);for(const d of c)u.push(s(d));return u}case df:{const u=n({},o);for(const[d,m]of c)u[s(d)]=s(m);return u}case jy:return n(new Date(c),o);case ky:{const{source:u,flags:d}=c;return n(new RegExp(u,d),o)}case Sy:{const u=n(new Map,o);for(const[d,m]of c)u.set(s(d),s(m));return u}case Ny:{const u=n(new Set,o);for(const d of c)u.add(s(d));return u}case nE:{const{name:u,message:d}=c;return n(new a0[u](d),o)}case rE:return n(BigInt(c),o);case"BigInt":return n(Object(BigInt(c)),o);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:u}=new Uint8Array(c);return n(new DataView(u),c)}}return n(new a0[i](c),o)};return s},i0=e=>hB(new Map,e)(0),oi="",{toString:gB}={},{keys:xB}=Object,Ul=e=>{const t=typeof e;if(t!=="object"||!e)return[up,t];const n=gB.call(e).slice(8,-1);switch(n){case"Array":return[cc,oi];case"Object":return[df,oi];case"Date":return[jy,oi];case"RegExp":return[ky,oi];case"Map":return[Sy,oi];case"Set":return[Ny,oi];case"DataView":return[cc,n]}return n.includes("Array")?[cc,n]:n.includes("Error")?[nE,n]:[df,n]},xd=([e,t])=>e===up&&(t==="function"||t==="symbol"),yB=(e,t,n,s)=>{const o=(c,u)=>{const d=s.push(c)-1;return n.set(u,d),d},i=c=>{if(n.has(c))return n.get(c);let[u,d]=Ul(c);switch(u){case up:{let h=c;switch(d){case"bigint":u=rE,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return o([tE],c)}return o([u,h],c)}case cc:{if(d){let y=c;return d==="DataView"?y=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(c)),o([d,[...y]],c)}const h=[],g=o([u,h],c);for(const y of c)h.push(i(y));return g}case df:{if(d)switch(d){case"BigInt":return o([d,c.toString()],c);case"Boolean":case"Number":case"String":return o([d,c.valueOf()],c)}if(t&&"toJSON"in c)return i(c.toJSON());const h=[],g=o([u,h],c);for(const y of xB(c))(e||!xd(Ul(c[y])))&&h.push([i(y),i(c[y])]);return g}case jy:return o([u,c.toISOString()],c);case ky:{const{source:h,flags:g}=c;return o([u,{source:h,flags:g}],c)}case Sy:{const h=[],g=o([u,h],c);for(const[y,b]of c)(e||!(xd(Ul(y))||xd(Ul(b))))&&h.push([i(y),i(b)]);return g}case Ny:{const h=[],g=o([u,h],c);for(const y of c)(e||!xd(Ul(y)))&&h.push(i(y));return g}}const{message:m}=c;return o([u,{name:d,message:m}],c)};return i},l0=(e,{json:t,lossy:n}={})=>{const s=[];return yB(!(t||n),!!t,new Map,s)(e),s},ff=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?i0(l0(e,t)):structuredClone(e):(e,t)=>i0(l0(e,t));function bB(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function vB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function wB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||bB,s=e.options.footnoteBackLabel||vB,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=Ji(g.toLowerCase());let b=0;const C=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(d,b);typeof E=="string"&&(E={type:"text",value:E}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...C)}else h.push(...C);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ff(c),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
563
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
564
|
+
`}]}}const sE=(function(e){if(e==null)return NB;if(typeof e=="function")return dp(e);if(typeof e=="object")return Array.isArray(e)?jB(e):kB(e);if(typeof e=="string")return SB(e);throw new Error("Expected function, string, or object as test")});function jB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=sE(e[n]);return dp(s);function s(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function kB(e){const t=e;return dp(n);function n(s){const o=s;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function SB(e){return dp(t);function t(n){return n&&n.type===e}}function dp(e){return t;function t(n,s,o){return!!(CB(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function NB(){return!0}function CB(e){return e!==null&&typeof e=="object"&&"type"in e}const oE=[],EB=!0,c0=!1,TB="skip";function RB(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const i=sE(o),c=s?-1:1;u(e,void 0,[])();function u(d,m,h){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(d.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=oE,C,j,v;if((!t||i(d,m,h[h.length-1]||void 0))&&(b=AB(n(d,h)),b[0]===c0))return b;if("children"in d&&d.children){const k=d;if(k.children&&b[0]!==TB)for(j=(s?k.children.length:-1)+c,v=h.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(C=u(E,j,v)(),C[0]===c0)return C;j=typeof C[1]=="number"?C[1]:j+c}}return b}}}function AB(e){return Array.isArray(e)?e:typeof e=="number"?[EB,e]:e==null?oE:[e]}function aE(e,t,n,s){let o,i,c;typeof t=="function"&&typeof n!="function"?(i=void 0,c=t,o=n):(i=t,c=n,o=s),RB(e,i,u,o);function u(d,m){const h=m[m.length-1],g=h?h.children.indexOf(d):void 0;return c(d,g,h)}}const Bg={}.hasOwnProperty,PB={};function DB(e,t){const n=t||PB,s=new Map,o=new Map,i=new Map,c={...mB,...n.handlers},u={all:m,applyData:LB,definitionById:s,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:c,one:d,options:n,patch:$B,wrap:IB};return aE(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?s:o,y=String(h.identifier).toUpperCase();g.has(y)||g.set(y,h)}}),u;function d(h,g){const y=h.type,b=u.handlers[y];if(Bg.call(u.handlers,y)&&b)return b(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:j,...v}=h,k=ff(v);return k.children=u.all(h),k}return ff(h)}return(u.options.unknownHandler||OB)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const C=u.one(y[b],h);if(C){if(b&&y[b-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=u0(C.value)),!Array.isArray(C)&&C.type==="element")){const j=C.children[0];j&&j.type==="text"&&(j.value=u0(j.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function $B(e,t){e.position&&(t.position=gF(e))}function LB(e,t){let n=t;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&i&&Object.assign(n.properties,ff(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function OB(e,t){const n=t.data||{},s="value"in t&&!(Bg.call(n,"hProperties")||Bg.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function IB(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
565
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
566
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
567
|
+
`}),n}function u0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function d0(e,t){const n=DB(e,t),s=n.one(e,void 0),o=wB(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
568
|
+
`},o),i}function _B(e,t){return e&&"run"in e?async function(n,s){const o=d0(n,{file:s,...t});await e.run(o,s)}:function(n,s){return d0(n,{file:s,...e||t})}}function f0(e){if(e)throw e}var zh,p0;function MB(){if(p0)return zh;p0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},i=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var y;for(y in m);return typeof y>"u"||e.call(m,y)},c=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(s)return s(m,h).value}else return;return m[h]};return zh=function d(){var m,h,g,y,b,C,j=arguments[0],v=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},v=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});v<k;++v)if(m=arguments[v],m!=null)for(h in m)g=u(j,h),y=u(m,h),j!==y&&(E&&y&&(i(y)||(b=o(y)))?(b?(b=!1,C=g&&o(g)?g:[]):C=g&&i(g)?g:{},c(j,{name:h,newValue:d(E,C,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},zh}var FB=MB();const Bh=xf(FB);function Ug(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function zB(){const e=[],t={run:n,use:s};return t;function n(...o){let i=-1;const c=o.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);u(null,...o);function u(d,...m){const h=e[++i];let g=-1;if(d){c(d);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,h?BB(h,u)(...m):c(null,...m)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function BB(e,t){let n;return s;function s(...c){const u=e.length>c.length;let d;u&&c.push(o);try{d=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return o(h)}u||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(c,...u){n||(n=!0,t(c,...u))}function i(c){o(null,c)}}const ys={basename:UB,dirname:VB,extname:HB,join:WB,sep:"/"};function UB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Kc(e);let n=0,s=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,u=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else c<0&&(i=!0,c=o+1),u>-1&&(e.codePointAt(o)===t.codePointAt(u--)?u<0&&(s=o):(u=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function VB(e){if(Kc(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function HB(e){Kc(e);let t=e.length,n=-1,s=0,o=-1,i=0,c;for(;t--;){const u=e.codePointAt(t);if(u===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),u===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function WB(...e){let t=-1,n;for(;++t<e.length;)Kc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":KB(n)}function KB(e){Kc(e);const t=e.codePointAt(0)===47;let n=qB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function qB(e,t){let n="",s=0,o=-1,i=0,c=-1,u,d;for(;++c<=e.length;){if(c<e.length)u=e.codePointAt(c);else{if(u===47)break;u=47}if(u===47){if(!(o===c-1||i===1))if(o!==c-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),o=c,i=0;continue}}else if(n.length>0){n="",s=0,o=c,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,c):n=e.slice(o+1,c),s=c-o-1;o=c,i=0}else u===46&&i>-1?i++:i=-1}return n}function Kc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const GB={cwd:YB};function YB(){return"/"}function Vg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QB(e){if(typeof e=="string")e=new URL(e);else if(!Vg(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return JB(e)}function JB(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Uh=["history","path","basename","stem","extname","dirname"];class iE{constructor(t){let n;t?Vg(t)?n={path:t}:typeof t=="string"||XB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":GB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Uh.length;){const i=Uh[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Uh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ys.basename(this.path):void 0}set basename(t){Hh(t,"basename"),Vh(t,"basename"),this.path=ys.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ys.dirname(this.path):void 0}set dirname(t){m0(this.basename,"dirname"),this.path=ys.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ys.extname(this.path):void 0}set extname(t){if(Vh(t,"extname"),m0(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ys.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Vg(t)&&(t=QB(t)),Hh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ys.basename(this.path,this.extname):void 0}set stem(t){Hh(t,"stem"),Vh(t,"stem"),this.path=ys.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Gn(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Vh(e,t){if(e&&e.includes(ys.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ys.sep+"`")}function Hh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function m0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function XB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ZB=(function(e){const s=this.constructor.prototype,o=s[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),e8={}.hasOwnProperty;class Cy extends ZB{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=zB()}copy(){const t=new Cy;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Bh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(qh("data",this.frozen),this.namespace[t]=n,this):e8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(qh("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=yd(t),s=this.parser||this.Parser;return Wh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Wh("process",this.parser||this.Parser),Kh("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,c){const u=yd(t),d=s.parse(u);s.run(d,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,C=s.stringify(b,y);r8(C)?y.value=C:y.result=C,m(h,y)});function m(h,g){h||!g?c(h):i?i(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Wh("processSync",this.parser||this.Parser),Kh("processSync",this.compiler||this.Compiler),this.process(t,o),g0("processSync","process",n),s;function o(i,c){n=!0,f0(i),s=c}}run(t,n,s){h0(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(c,u){const d=yd(n);o.run(t,d,m);function m(h,g,y){const b=g||t;h?u(h):c?c(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,o;return this.run(t,n,i),g0("runSync","run",s),o;function i(c,u){f0(c),o=u,s=!0}}stringify(t,n){this.freeze();const s=yd(n),o=this.compiler||this.Compiler;return Kh("stringify",o),h0(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(qh("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;d(h,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(m.plugins),m.settings&&(o.settings=Bh(!0,o.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];i(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...C]=h;const j=s[y][1];Ug(j)&&Ug(b)&&(b=Bh(!0,j,b)),s[y]=[m,b,...C]}}}}const t8=new Cy().freeze();function Wh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Kh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function qh(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function h0(e){if(!Ug(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function g0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function yd(e){return n8(e)?e:new iE(e)}function n8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function r8(e){return typeof e=="string"||s8(e)}function s8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",x0=[],y0={allowDangerousHtml:!0},a8=/^(https?|ircs?|mailto|xmpp)$/i,i8=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function l8(e){const t=c8(e),n=u8(e);return d8(t.runSync(t.parse(n),n),e)}function c8(e){const t=e.rehypePlugins||x0,n=e.remarkPlugins||x0,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...y0}:y0;return t8().use(Uz).use(n).use(_B,s).use(t)}function u8(e){const t=e.children||"",n=new iE;return typeof t=="string"&&(n.value=t),n}function d8(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,i=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||f8;for(const h of i8)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+o8+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),aE(e,m),wF(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,g,y){if(h.type==="raw"&&y&&typeof g=="number")return c?y.children.splice(g,1):y.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let b;for(b in _h)if(Object.hasOwn(_h,b)&&Object.hasOwn(h.properties,b)){const C=h.properties[b],j=_h[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=d(String(C||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(h,g,y)),b&&y&&typeof g=="number")return u&&h.children?y.children.splice(g,1,...h.children):y.children.splice(g,1),g}}}function f8(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||a8.test(e.slice(0,t))?e:""}function xn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:we("prose-syntaur max-w-none",t),children:r.jsx(l8,{children:s})}):r.jsx("div",{className:"rounded-md border border-dashed border-border/80 bg-muted/30 px-3 py-4 text-sm text-muted-foreground",children:n})}function Wr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function p8(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{if(e)try{const d=await fetch(Wr(e));if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),Ac(d=>{d.type==="todos-updated"&&d.projectSlug===e&&u()}),{data:t,loading:s,error:i,refetch:u}}async function m8(e,t,n){await fetch(Wr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function h8(e,t,n){await fetch(`${Wr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function g8(e,t,n){await fetch(`${Wr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function x8(e,t,n){await fetch(`${Wr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function y8(e,t){await fetch(`${Wr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function b8(e,t){await fetch(`${Wr(e)}/${t}`,{method:"DELETE"})}async function v8(e,t,n){const s=await fetch(`${Wr(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}function lE(e,t,n){return`${Wr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function w8(e,t,n){for(const s of n){const o=await fetch(`${Wr(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function j8(e,t,n){const s=await fetch(lE(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function cE(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,c=new Error(i);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function k8(e,t){return await cE(`${Wr(e)}/promote`,t)}async function S8(e,t,n){await cE(`${Wr(e)}/${t}/move`,{to:n})}const b0=[{value:"open",icon:"○",label:"Open",color:"text-muted-foreground"},{value:"in_progress",icon:"◉",label:"In Progress",color:"text-status-in-progress-foreground"},{value:"completed",icon:"✓",label:"Completed",color:"text-status-completed-foreground"},{value:"blocked",icon:"✕",label:"Blocked",color:"text-status-blocked-foreground"}];function uE({status:e,onChange:t}){const[n,s]=p.useState(!1),o=p.useRef(null);p.useEffect(()=>{if(!n)return;function c(u){o.current&&!o.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const i=b0.find(c=>c.value===e);return r.jsxs("div",{className:"relative",ref:o,onClick:c=>c.stopPropagation(),children:[r.jsx("button",{onClick:()=>s(!n),className:`text-lg leading-none ${i.color} hover:opacity-70 transition`,title:i.label,children:i.icon}),n&&r.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:b0.filter(c=>c.value!==e).map(c=>r.jsxs("button",{onClick:()=>{t(c.value),s(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${c.color}`,children:[r.jsx("span",{className:"text-base leading-none",children:c.icon}),r.jsx("span",{children:c.label})]},c.value))})]})}function dE({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:o,onEndEdit:i,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:d,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:C,hotkeyRowProps:j,onDragOrigin:v,onDragStart:k,onDragEnd:E,isDragging:S}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:v,onDragStart:T=>k(T,e.id),onDragEnd:E,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${S?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(uE,{status:e.status,onChange:T=>y(e.id,T)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(fE,{description:e.description,status:e.status,editing:s,onBeginEdit:()=>o(e.id),onEndEdit:i,onSave:T=>c(e.id,T)}),e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(T=>`#${T}`).join(" ")}),e.session&&r.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(R8,{item:e})]}),r.jsx(pE,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>d(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Rr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:T=>b(T,e.id),children:["t:",e.id]}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:T=>b(T,e.id),children:r.jsx(Vd,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:T=>g(e.id,T),children:r.jsx(jf,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:T=>C(T,e.id,e.description),children:r.jsx(Tn,{className:"h-3 w-3"})})]})]})}function fE({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:o,onSave:i}){return n?r.jsx(N8,{initialValue:e,onSave:i,onExit:o}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:c=>{c.stopPropagation(),s()},title:"Click to edit",className:we("text-left text-sm rounded-sm transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",t==="completed"?"line-through text-muted-foreground":"text-foreground"),children:e})}function N8({initialValue:e,onSave:t,onExit:n}){const s=p.useRef(e),[o,i]=p.useState(e),[c,u]=p.useState(!1),[d,m]=p.useState(!1),h=p.useRef(null),g=p.useRef(!1);p.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=p.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=p.useCallback(async()=>{if(g.current)return;const j=o.trim();if(j.length===0){y();return}if(j===s.current){n();return}g.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[o,n,t,y]);function C(j){j.key==="Enter"?(j.preventDefault(),b()):j.key==="Escape"&&(j.preventDefault(),g.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:c,value:o,onClick:j=>j.stopPropagation(),onChange:j=>i(j.target.value),onKeyDown:C,onBlur:()=>void b(),className:we("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-sm text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",d&&"syntaur-input-shake",c&&"opacity-70")})}function C8(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function E8(e){const t=e.clipboardData,n=[];if(t.files&&t.files.length&&n.push(...Array.from(t.files)),!n.length&&t.items){for(const s of Array.from(t.items))if(s.kind==="file"){const o=s.getAsFile();o&&n.push(o)}}return n}function pE({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const o=e.attachments??[],[i,c]=p.useState(!1),[u,d]=p.useState(!1),m=p.useRef(null),h=p.useRef(null);p.useEffect(()=>{var y;i&&((y=h.current)==null||y.focus())},[i]);const g=p.useCallback(async y=>{if(y.length){d(!0);try{await n(y),c(!1)}finally{d(!1)}}},[n]);return r.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:y=>y.stopPropagation(),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(y=>r.jsx(T8,{att:y,url:t(e.id,y.id),onDelete:()=>void s(y.id)},y.id)),r.jsxs("button",{type:"button","data-no-drag":!0,title:"Attach files",onClick:()=>c(y=>!y),className:"inline-flex items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs text-muted-foreground hover:text-foreground hover:border-border transition",children:[r.jsx(Lk,{className:"h-3 w-3"}),o.length===0?"Attach":""]})]}),i&&r.jsxs("div",{ref:h,"data-no-drag":!0,tabIndex:0,role:"button","aria-label":"Add attachments: drop, paste, or click",onPaste:y=>{const b=E8(y);b.length&&(y.preventDefault(),g(b))},onDragOver:y=>{Array.from(y.dataTransfer.types).includes("Files")&&y.preventDefault()},onDrop:y=>{const b=Array.from(y.dataTransfer.files);b.length&&(y.preventDefault(),g(b))},onClick:()=>{var y;return(y=m.current)==null?void 0:y.click()},className:"mt-1 cursor-pointer rounded-md border border-dashed border-border/70 px-3 py-2 text-xs text-muted-foreground hover:border-border focus:outline-none focus:ring-2 focus:ring-ring/40",children:[u?"Uploading…":"Drop, paste (⌘V / Ctrl+V), or click to add files",r.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y=>{const b=Array.from(y.target.files??[]);y.target.value="",g(b)}})]})]})}function T8({att:e,url:t,onDelete:n}){return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-border/60 bg-background px-1.5 py-0.5 text-xs",children:[C8(e.mime)?r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:e.filename,children:r.jsx("img",{src:t,alt:e.filename,className:"h-6 w-6 rounded object-cover"})}):r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-foreground hover:text-primary",children:[r.jsx(Lk,{className:"h-3 w-3"}),r.jsx("span",{className:"block max-w-[160px] truncate",children:e.filename})]}),r.jsx("button",{type:"button",title:"Remove attachment",onClick:n,className:"text-muted-foreground/60 hover:text-destructive transition",children:r.jsx(dx,{className:"h-3 w-3"})})]})}function R8({item:e}){return!(e.branch||e.planDir||e.worktreePath||e.createdAt||e.updatedAt)?null:r.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[e.branch?r.jsx(ia,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-info-foreground/30 bg-info/30 px-1.5 py-0.5 text-[10px] font-mono text-info-foreground",children:[r.jsx(ox,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(ur,{children:e.branch})]})}):null,e.planDir?r.jsx(ia,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Vc(e.planDir)},className:"inline-flex items-center rounded-full border border-status-completed-foreground/40 bg-status-completed/30 p-1 text-status-completed-foreground hover:bg-status-completed/50","aria-label":"Copy plan directory path",children:r.jsx(Dk,{className:"h-2.5 w-2.5"})})}),r.jsxs(ur,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(ia,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(ur,{children:r.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?r.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?r.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?r.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const mE="__one_off__";function Ey({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o,defaultProject:i,defaultTitle:c,allowOneOff:u=!0}){const[d,m]=p.useState("new"),[h,g]=p.useState(!1),[y,b]=p.useState(null),[C,j]=p.useState(null),[v,k]=p.useState(null),[E,S]=p.useState(""),[T,A]=p.useState(""),[R,P]=p.useState(""),[$,M]=p.useState(""),[_,D]=p.useState(""),[V,K]=p.useState(""),[I,F]=p.useState(null),[q,Z]=p.useState(!1),z=t.length>1;p.useEffect(()=>{if(!e){m("new"),b(null),S(""),A(""),P(""),M(""),D(""),K(""),F(null);return}S(i??""),A(c??"");let ue=!1;return(async()=>{try{const ge=await fetch("/api/projects");if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const se=await ge.json();ue||j(se.filter(ye=>!ye.archived))}catch(ge){ue||k(ge instanceof Error?ge.message:String(ge))}})(),()=>{ue=!0}},[e,i,c]),p.useEffect(()=>{if(!_){F(null);return}let ue=!1;return Z(!0),(async()=>{try{const ge=await fetch(`/api/projects/${encodeURIComponent(_)}/assignments`);if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const se=await ge.json();ue||F(se)}catch{ue||F([])}finally{ue||Z(!1)}})(),()=>{ue=!0}},[_]);const G=p.useMemo(()=>C??[],[C]);async function L(ue){if(ue.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(z&&!T.trim()){b("Title is required when promoting multiple todos.");return}const ge=E===mE?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const ye={groups:n.groups,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await U(ye);return}const se={todoIds:t,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await re(se)}async function H(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!_||!V){b("Pick both project and assignment.");return}const ge={todoIds:t,mode:"to-assignment",target:{assignment:`${_}/${V}`}};await re(ge)}async function re(ue){g(!0),b(null);try{let ge;if(n.kind==="workspace")ge=await M3(n.workspace,ue);else if(n.kind==="project")ge=await k8(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");o(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}async function U(ue){g(!0),b(null);try{const ge=await F3(ue);o(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}return r.jsx(On,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(Rn,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsxs(An,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{children:["Convert the selected todo",t.length===1?"":"s"," to a new or existing assignment. Source todo",t.length===1?"":"s"," will be marked ",r.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),r.jsxs(NC,{value:d,onValueChange:ue=>m(ue),children:[r.jsxs(CC,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Dg,{value:"new",className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"New assignment"}),r.jsx(Dg,{value:"existing",className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"Existing assignment"})]}),r.jsx($g,{value:"new",children:r.jsxs("form",{onSubmit:L,className:"space-y-4",children:[r.jsx(ai,{label:"Target project",children:r.jsx(v0,{value:E,onChange:S,projects:G,error:v,disabled:h,allowOneOff:u})}),r.jsx(ai,{label:z?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>A(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ai,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>P(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(ai,{label:"Priority",children:r.jsxs("select",{value:$,onChange:ue=>M(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"—"}),r.jsx("option",{value:"low",children:"low"}),r.jsx("option",{value:"medium",children:"medium"}),r.jsx("option",{value:"high",children:"high"}),r.jsx("option",{value:"critical",children:"critical"})]})})]}),y?r.jsx(w0,{message:y}):null,r.jsx(j0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx($g,{value:"existing",children:r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsx(ai,{label:"Project",children:r.jsx(v0,{value:_,onChange:ue=>{D(ue),K("")},projects:G,error:v,disabled:h})}),r.jsx(ai,{label:q?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:V,onChange:ue=>K(ue.target.value),disabled:h||!_||q,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:_?"Select assignment...":"Pick a project first"}),(I??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(w0,{message:y}):null,r.jsx(j0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function ai({label:e,children:t}){return r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function v0({value:e,onChange:t,projects:n,error:s,disabled:o,allowOneOff:i}){return s?r.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",s]}):r.jsxs("select",{value:e,onChange:c=>t(c.target.value),disabled:o,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),i?r.jsx("option",{value:mE,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function w0({message:e}){return r.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function j0({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:e,disabled:t,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:t,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function hE({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o}){const[i,c]=p.useState("project"),[u,d]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(!1),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null);p.useEffect(()=>{if(!e){c("project"),d(""),h(""),C(null),v(null);return}let P=!1;return(async()=>{try{const $=await fetch("/api/projects");if(!$.ok)throw new Error(`HTTP ${$.status}`);const M=await $.json();P||E(M.filter(_=>!_.archived))}catch($){P||v($ instanceof Error?$.message:String($))}})(),()=>{P=!0}},[e]);const S=p.useMemo(()=>k?n.kind==="project"?k.filter(P=>P.slug!==n.projectId):k:[],[k,n]);function T(){if(i==="global")return{global:!0};if(i==="workspace"){const P=u.trim();return P?{workspace:P}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function A(P,$){try{return n.kind==="workspace"?await z3(n.workspace,P,$):await S8(n.projectId,P,$),{ok:!0}}catch(M){return{ok:!1,error:M instanceof Error?M.message:String(M)}}}async function R(P){P.preventDefault(),v(null);const $=T();if(typeof $=="string"){v($);return}y(!0),C(null);const M=[],_=[];for(const D of t){const V=await A(D,$);V.ok?M.push(D):_.push({id:D,error:V.error})}y(!1),o(),_.length===0?s(!1):C({succeeded:M,failed:_})}return r.jsx(On,{open:e,onOpenChange:P=>g?void 0:s(P),children:r.jsx(Rn,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(Zn,{children:[r.jsxs(An,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),r.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(Gh,{kind:"project",checked:i==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Gh,{kind:"workspace",checked:i==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Gh,{kind:"global",checked:i==="global",onChange:()=>c("global"),label:"Global"})]}),i==="project"?r.jsx(k0,{label:"Target project",children:r.jsxs("select",{value:m,onChange:P=>h(P.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),S.map(P=>r.jsxs("option",{value:P.slug,children:[P.title," (",P.slug,")"]},P.slug))]})}):null,i==="workspace"?r.jsx(k0,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:P=>d(P.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(A8,{message:j}):null,b?r.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground space-y-1",children:[r.jsxs("div",{className:"font-medium",children:["Moved ",b.succeeded.length," of ",t.length,"; ",b.failed.length," failed."]}),r.jsx("ul",{className:"text-xs space-y-0.5",children:b.failed.map(P=>r.jsxs("li",{children:["[t:",P.id,"] ",P.error]},P.id))})]}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:g,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:b?"Close":"Cancel"}),b===null?r.jsx("button",{type:"submit",disabled:g,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:g?"Moving...":"Move"}):null]})]})})})}function k0({label:e,children:t}){return r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Gh({kind:e,checked:t,onChange:n,label:s}){return r.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[r.jsx("input",{type:"radio",name:"move-target-kind",value:e,checked:t,onChange:n}),r.jsx("span",{children:s})]})}function A8({message:e}){return r.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function Ty({label:e,count:t,expanded:n,onToggle:s,isDropTarget:o=!1,onDragOver:i,onDragLeave:c,onDrop:u,children:d}){return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/40 transition",o&&"ring-2 ring-ring/30"),onDragOver:i,onDragLeave:c,onDrop:u,children:[r.jsxs("button",{type:"button",onClick:s,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[r.jsx(pr,{className:we("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:e}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&r.jsx("div",{className:"space-y-1 px-2 pb-2",children:d})]})}const gE=[{id:"open-blocked",label:"Open / Blocked",statuses:["open","blocked"],dropStatus:"open",defaultCollapsed:!1},{id:"in-progress",label:"In Progress",statuses:["in_progress"],dropStatus:"in_progress",defaultCollapsed:!1},{id:"done",label:"Done",statuses:["completed"],dropStatus:"completed",defaultCollapsed:!0}];function fp(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function Ry(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[fp(n.status)].push(n);return gE.map(n=>({config:n,items:t[n.id]}))}const xE="syntaur.todos.sections.collapsed.v1",S0=Object.fromEntries(gE.map(e=>[e.id,e.defaultCollapsed]));function Yh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(xE);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function P8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(xE,JSON.stringify(e))}catch{}}function Ay(e){const[t,n]=p.useState(()=>Yh()[e]??{});p.useEffect(()=>{n(Yh()[e]??{})},[e]);const s=p.useCallback(i=>t[i]??S0[i],[t]),o=p.useCallback(i=>{const c=Yh(),u=c[e]??{},d=u[i]??S0[i],m={...u,[i]:!d};c[e]=m,P8(c),n(m)},[e]);return{isCollapsed:s,toggle:o}}function D8({projectId:e}){const{data:t,loading:n,error:s,refetch:o}=p8(e),[i,c]=p.useState(""),[u,d]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(new Set),[S,T]=p.useState(!1),[A,R]=p.useState(!1),[P,$]=p.useState(null),M=p.useRef(null);Ro("list:todos");const _=Ay("project:"+e),[D,V]=p.useState(null),[K,I]=p.useState(null),F=p.useRef(null);async function q(Y,fe){Y.stopPropagation(),await Vc(fe)&&(C(fe),setTimeout(()=>C(ne=>ne===fe?null:ne),1500))}const Z=p.useMemo(()=>{if(!(t!=null&&t.items))return[];const Y=new Set;for(const fe of t.items)for(const ne of fe.tags)Y.add(ne);return Array.from(Y).sort()},[t]),z=p.useMemo(()=>{if(!(t!=null&&t.items))return[];let Y=t.items;if(i.trim()){const fe=i.toLowerCase();Y=Y.filter(ne=>ne.description.toLowerCase().includes(fe)||ne.tags.some(he=>he.toLowerCase().includes(fe))||ne.id.includes(fe))}return u&&(Y=Y.filter(fe=>fe.status===u)),m&&(Y=Y.filter(fe=>fe.tags.includes(m))),Y},[t,i,u,m]);p.useEffect(()=>{E(new Set)},[i,u,m,e]);const G=p.useMemo(()=>z.filter(Y=>k.has(Y.id)).length,[z,k]),L=z.length>0&&G===z.length,H=G>0&&!L;function re(Y){E(fe=>{const ne=new Set(fe);return ne.has(Y)?ne.delete(Y):ne.add(Y),ne})}function U(){E(Y=>{const fe=new Set(Y);if(L)for(const ne of z)fe.delete(ne.id);else for(const ne of z)fe.add(ne.id);return fe})}function ue(){E(new Set)}const ge=P?[P]:Array.from(k);function se(){E(new Set),$(null),o()}function ye(){E(new Set),o()}async function Se(){g.trim()&&(await m8(e,g.trim()),y(""),o())}async function Te(Y,fe,ne){Y.stopPropagation(),window.confirm(`Delete "${ne}"? This can't be undone.`)&&(await b8(e,fe),o())}async function Pe(Y,fe){switch(fe){case"open":await y8(e,Y);break;case"in_progress":await x8(e,Y);break;case"completed":await h8(e,Y);break;case"blocked":await g8(e,Y);break}o()}async function Ke(Y,fe){await v8(e,Y,fe),o()}async function ct(Y,fe){await w8(e,Y,fe),o()}async function et(Y,fe){await j8(e,Y,fe),o()}const ot=Ry(z),X=ot.filter(Y=>!_.isCollapsed(Y.config.id)).flatMap(Y=>Y.items),{hotkeyRowProps:Me}=$c(X,{scope:"list:todos",bindO:!1,onOpen:Y=>v(Y.id)});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Y;return(Y=M.current)==null?void 0:Y.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Ce,Ie]=ls(),Ye=Ce.get("focus");p.useEffect(()=>{if(!Ye||!(t!=null&&t.items))return;const Y=t.items.find(ne=>ne.id===Ye);if(!Y)return;const fe=fp(Y.status);_.isCollapsed(fe)&&_.toggle(fe)},[Ye,t==null?void 0:t.items]),p.useEffect(()=>{if(!Ye)return;const Y=document.querySelector(`[data-todo-id="${window.CSS.escape(Ye)}"]`);if(!Y)return;Y.scrollIntoView({block:"nearest"}),Y.classList.add("ring-2","ring-primary/60");const fe=window.setTimeout(()=>{Y.classList.remove("ring-2","ring-primary/60"),Ie(ne=>{const he=new URLSearchParams(ne);return he.delete("focus"),he},{replace:!0})},1500);return()=>window.clearTimeout(fe)},[Ye,X.length,Ie]);const Fe=D?(t==null?void 0:t.items.find(Y=>Y.id===D))??null:null;function Ze(Y,fe){const ne=F.current;if(ne!=null&&ne.closest(Li)){Y.preventDefault();return}Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",fe),V(fe)}function Je(){V(null),I(null)}function Ot(Y,fe){!Fe||fe.statuses.includes(Fe.status)||(Y.preventDefault(),Y.dataTransfer.dropEffect="move",I(fe.id))}function yt(Y,fe){K===fe.id&&!Y.currentTarget.contains(Y.relatedTarget)&&I(null)}function dt(Y,fe){Y.preventDefault();const ne=Fe;Je(),!(!ne||fe.statuses.includes(ne.status))&&Pe(ne.id,fe.dropStatus)}if(n)return r.jsx(xt,{label:"Loading todos..."});if(s)return r.jsx(Tt,{error:s});const le=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Fn,{label:"Open",value:le.open,icon:zr}),r.jsx(Fn,{label:"In Progress",value:le.in_progress,icon:zr,tone:"info"}),r.jsx(Fn,{label:"Blocked",value:le.blocked,icon:ux,tone:"warn"}),r.jsx(Fn,{label:"Total",value:le.total,icon:zr})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:Y=>y(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&Se(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:Se,disabled:!g.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:M,type:"text",placeholder:"Search...",value:i,onChange:Y=>c(Y.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:Y=>d(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),Z.length>0&&r.jsxs("select",{value:m,onChange:Y=>h(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),Z.map(Y=>r.jsxs("option",{value:Y,children:["#",Y]},Y))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{$(null),R(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:ue,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,z.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:L,ref:Y=>{Y&&(Y.indeterminate=H)},onChange:U,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",z.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Y=-1;return ot.map(({config:fe,items:ne})=>{const he=!_.isCollapsed(fe.id);return r.jsx(Ty,{label:fe.label,count:ne.length,expanded:he,onToggle:()=>_.toggle(fe.id),isDropTarget:K===fe.id,onDragOver:De=>Ot(De,fe),onDragLeave:De=>yt(De,fe),onDrop:De=>dt(De,fe),children:he&&ne.map(De=>(Y+=1,r.jsx(dE,{item:De,copiedId:b,selected:k.has(De.id),editing:j===De.id,onBeginEdit:ut=>v(ut),onEndEdit:()=>v(null),onPatchDescription:Ke,onAddAttachments:ct,onDeleteAttachment:et,attachmentUrl:(ut,ae)=>lE(e,ut,ae),onToggleSelected:ut=>re(ut),onMoveOne:(ut,ae)=>{ae.stopPropagation(),$(ut),R(!0)},onStatusChange:Pe,onCopyId:q,onDelete:Te,hotkeyRowProps:Me(Y),onDragOrigin:ut=>{F.current=ut.target},onDragStart:Ze,onDragEnd:Je,isDragging:D===De.id},De.id)))},fe.id)})})()}),r.jsx(Ey,{open:S,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ye}),r.jsx(hE,{open:A,selectedIds:ge,scope:{kind:"project",projectId:e},onOpenChange:Y=>{R(Y),Y||$(null)},onDone:se})]})}const $8={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},N0=new Set(["title"]);function yE({visibility:e,onChange:t}){const[n,s]=p.useState(!1);function o(c){if(N0.has(c))return;const d=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:d})}const i=e.hidden.length;return r.jsxs(On,{open:n,onOpenChange:s,children:[r.jsx(A$,{asChild:!0,children:r.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Show or hide table columns",children:[r.jsx(KA,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",i>0?` (${Ch.length-i}/${Ch.length})`:""]})]})}),r.jsxs(Rn,{className:"max-w-sm",children:[r.jsx(Zn,{children:r.jsx(An,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Ch.map(c=>{const u=e.hidden.includes(c),d=N0.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${d?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>o(c),disabled:d,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:$8[c]}),d?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const Ti={...bc,custom:!1},bE=`view-prefs.cache.v${bc.version}`;let Sc=L8(),ii=null;const Nc=new Set;let vE=0;function Py(){return++vE}function Dy(e){return e===vE}function L8(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(bE);if(!e)return null;const t=JSON.parse(e);return t.version!==bc.version?null:t}catch{return null}}function O8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(bE,JSON.stringify(e))}catch{}}function $y(e){Sc=e,O8(e);for(const t of Nc)t(e)}function Ly(e){if(!e||typeof e!="object")return Ti;const t=e;return t.version!==bc.version||!t.global||!t.projects?Ti:{version:bc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Oy(){if(ii)return ii;const e=Py();return ii=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Ly(t);return Dy(e)&&$y(n),ii=null,Sc??n}).catch(()=>(ii=null,Sc??Ti)),ii}function wE(e){const[t,n]=p.useState(()=>Sc??Ti);return p.useEffect(()=>{let s=!1;return Oy().then(o=>{s||n(o)}),Nc.add(n),()=>{s=!0,Nc.delete(n)}},[]),X1(t,e??null)}function I8(){const[e,t]=p.useState(()=>Sc??Ti);return p.useEffect(()=>{let n=!1;return Oy().then(s=>{n||t(s)}),Nc.add(t),()=>{n=!0,Nc.delete(t)}},[]),e}async function jE(e){const t=Py(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save view-prefs")}const s=Ly(await n.json());return Dy(t)&&$y(s),s}function kE(e){return jE({global:e})}function SE(e,t){return jE({projects:{[e]:t}})}async function _8(){const e=Py(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Ly(await t.json());return Dy(e)&&$y(n),n}const C0=80;function NE({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:o="Save view"}){const[i,c]=p.useState(n),[u,d]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{e&&(c(n),h(null),d(!1))},[e,n]);const g=i.trim(),y=g.length>0&&g.length<=C0;return r.jsx(On,{open:e,onOpenChange:t,children:r.jsx(Rn,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){d(!0),h(null);try{await s(g)}catch(C){h(C instanceof Error?C.message:String(C)),d(!1)}}},children:[r.jsx(Zn,{children:r.jsx(An,{children:o})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:C0,onChange:b=>c(b.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),m?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:m}):null]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:u,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!y||u,className:"shell-action shell-action--cta disabled:opacity-50",children:u?"Saving…":"Save"})]})]})})})}function CE({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:o,loading:i}=Mc(),[c,u]=p.useState(!1),d=p.useRef(null);p.useEffect(()=>{if(!c)return;function y(C){d.current&&!d.current.contains(C.target)&&u(!1)}function b(C){C.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=p.useMemo(()=>o.filter(y=>oN(y,e)),[o,e]),h=t?o.find(y=>y.id===t)??null:null,g=i?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("button",{type:"button",disabled:i,onClick:()=>u(y=>!y),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":c,title:"Saved views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:g}),r.jsx(pr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),c&&r.jsx("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:m.length===0?r.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),r.jsx("button",{type:"button",onClick:()=>{u(!1),s()},className:"shell-action w-full justify-center",children:"Save current view"})]}):m.map(y=>{const b=y.id===t;return r.jsxs("button",{type:"button",onClick:()=>{u(!1),n(y)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",b&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:b?r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const M8=new Set(["overview","assignments","todos","dependencies","knowledge"]),E0="__unknown_type__";function T0(){const{slug:e,workspace:t}=Bt(),n=fn(),s=zt();Ro("project"),Yt({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Yt({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:c,refetch:u}=iS(e),d=ha(),m=rp(),{data:h}=fa(),[g,y]=ls(),b=g.get("tab"),C=b&&M8.has(b)?b:"overview";function j(oe){y(Ue=>{const nt=new URLSearchParams(Ue);return oe==="overview"?nt.delete("tab"):nt.set("tab",oe),nt},{replace:!0})}const v=e?`p:${e}`:null,k=wE(v),[E,S]=p.useState(()=>Sh(k.defaultView)),[T,A]=p.useState(()=>ze(k.filters.status)),[R,P]=p.useState(()=>ze(k.filters.assignee)),[$,M]=p.useState(()=>ze(k.filters.priority)),[_,D]=p.useState(()=>ze(k.filters.type)),[V,K]=p.useState(()=>ze(k.filters.tags)),[I,F]=p.useState(null),[q,Z]=p.useState(()=>k.grouping),[z,G]=p.useState(()=>k.sortField),[L,H]=p.useState(()=>k.sortDirection),[re,U]=p.useState(()=>({collapsed:[]})),[ue,ge]=p.useState(()=>({hidden:[]})),[se,ye]=p.useState(()=>({hidden:[]})),[Se,Te]=p.useState(null),[Pe,Ke]=p.useState(!1),[ct,et]=p.useState(!1),{toast:ot,showToast:X,dismissToast:Me}=Ao(),Ce={kind:"project",slug:e??"",workspace:t??null},Ie=g.get("loadView"),{view:Ye,loading:Fe,error:Ze}=So(Ie),{view:Je,loading:Ot,error:yt}=So(Se),dt=p.useRef(null);p.useEffect(()=>{Se&&!Ot&&!yt&&!Je&&Te(null)},[Je,yt,Se,Ot]),p.useEffect(()=>{Te(null),dt.current=null,F(null)},[e,t]),p.useEffect(()=>{S(Sh(k.defaultView)),A(ze(k.filters.status)),P(ze(k.filters.assignee)),M(ze(k.filters.priority)),D(ze(k.filters.type)),K(ze(k.filters.tags)),Z(k.grouping),G(k.sortField),H(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const le=p.useCallback(oe=>{v&&SE(v,oe).catch(Ue=>{console.warn("Failed to persist project view prefs:",Ue)})},[v]),Y=p.useCallback(oe=>{S(oe),le({defaultView:oe})},[le]),fe=p.useCallback(oe=>{A(oe),le({filters:{status:oe}})},[le]),ne=p.useCallback(oe=>{P(oe),le({filters:{assignee:oe}})},[le]),he=p.useCallback(oe=>{M(oe),le({filters:{priority:oe}})},[le]),De=p.useCallback(oe=>{D(oe),le({filters:{type:oe}})},[le]),ut=p.useCallback(oe=>{K(oe),le({filters:{tags:oe}})},[le]),ae=p.useCallback(oe=>{Z(oe),le({grouping:oe})},[le]),be=p.useCallback(oe=>{G(oe),le({sortField:oe})},[le]),Le=p.useCallback(oe=>{H(oe),le({sortDirection:oe})},[le]),at=p.useCallback(()=>({viewMode:E,filters:{status:T,priority:$,type:_,assignee:R,tags:V,project:"all",activity:"all",dateRange:la(I)},sortField:z,sortDirection:L,listSectionVisibility:re,kanbanColumnVisibility:ue,tableColumnVisibility:se}),[E,T,$,_,R,V,I,z,L,re,ue,se]),Be=p.useCallback(oe=>{eC(oe,{setViewMode:Ue=>S(Sh(Ue)),setStatusFilter:fe,setPriorityFilter:he,setTypeFilter:De,setAssigneeFilter:ne,setTagsFilter:ut,setDateRange:F,setSortField:be,setSortDirection:Le,setListSectionVisibility:U,setKanbanColumnVisibility:ge,setTableColumnVisibility:ye}),Te(oe.id)},[fe,he,De,ne,ut,be,Le]),kt=p.useCallback(oe=>{Be(oe),dt.current=oe.id,y(Ue=>{const nt=new URLSearchParams(Ue);return nt.set("loadView",oe.id),nt},{replace:!0})},[Be,y]),St=p.useCallback(async oe=>{try{const Ue=Oi({name:oe,context:{workspace:t??null,projectSlug:e??null},state:at()}),nt=await Pi(Ue),bt=nt.views[nt.views.length-1];Te((bt==null?void 0:bt.id)??null),bt&&(dt.current=bt.id,y(tr=>{const qr=new URLSearchParams(tr);return qr.set("loadView",bt.id),qr},{replace:!0})),Ke(!1),et(!1),X(`Saved view "${oe}"`,"success")}catch(Ue){throw X(Ue instanceof Error?Ue.message:"Failed to save view","error"),Ue}},[at,y,X,e,t]),_t=p.useCallback(async()=>{if(!(!Se||!Je))try{const oe=ze(Je.config.filters.project)[0]??null,Ue=Oi({name:Je.name,context:{workspace:t??null,projectSlug:oe},state:at()}),nt=lf(Je.config,Ue.config,Ue.config);await ef(Se,{config:nt}),X("View updated","success")}catch(oe){X(oe instanceof Error?oe.message:"Failed to update view","error")}},[at,Je,Se,X,t]);p.useEffect(()=>{if(!Ie){dt.current=null;return}if(dt.current!==Ie&&(Se&&Se!==Ie&&Te(null),!Fe)){if(Ze){X("Couldn't load saved view — try again","error");return}if(Ye){if(dt.current=Ie,!oN(Ye,{kind:"project",slug:e??"",workspace:t??null})){s(nC(Ye),{replace:!0});return}Be(Ye),y(oe=>{const Ue=new URLSearchParams(oe);return Ue.delete("loadView"),Ue},{replace:!0});return}dt.current=Ie,X("Saved view no longer exists","error"),y(oe=>{const Ue=new URLSearchParams(oe);return Ue.delete("loadView"),Ue},{replace:!0})}},[Ie,Ye,Fe,Ze,Se,Be,y,X,s,e,t]);function pe(oe){z===oe?Le(L==="asc"?"desc":"asc"):(be(oe),Le("asc"))}const te=p.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(oe=>{const Ue=`${n}/projects/${o.slug}/assignments/${oe.slug}`;return[[oe.slug,Ue],[oe.title,Ue]]})):{},[o]);async function xe(oe){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:oe})}),u()}async function Oe(oe){try{const Ue=await fetch(`/api/projects/${e}/${oe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ue.ok){const nt=await Ue.json().catch(()=>null);X((nt==null?void 0:nt.error)||`HTTP ${Ue.status}`,"error");return}u(),X(oe?"Project archived":"Project restored","success")}catch(Ue){X(Ue instanceof Error?Ue.message:"Failed to update archive state","error")}}async function tt(oe){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:oe})}),u()}if(i)return r.jsx(xt,{label:"Loading project workspace…"});if(c||!o)return r.jsx(Tt,{error:c||"Project not found."});const ve=(()=>{const oe=new Set;for(const nt of o.assignments)nt.assignee&&oe.add(nt.assignee);const Ue=[{value:"__unassigned__",label:"Unassigned"}];for(const nt of Array.from(oe).sort())Ue.push({value:nt,label:nt});return Ue})(),Nt=Array.from(new Set(o.assignments.flatMap(oe=>oe.tags??[]))).sort().map(oe=>({value:oe,label:oe})),It=o.assignments.filter(oe=>e5(oe,{status:T,priority:$,type:_,assignee:R,tags:V,dateRange:la(I)})),en=Uc(It,z,L),jt=new Set(m.definitions.map(oe=>oe.id)),wn=q==="type"?[...m.definitions.map(oe=>({id:oe.id,title:Ni(m,oe.id),description:oe.description})),...It.some(oe=>!oe.type||!jt.has(oe.type))?[{id:E0,title:"Other",description:"Assignments with no recognized type."}]:[]]:aC(d.order).map(oe=>({id:oe,title:Bc(d,oe),description:np(oe)}));function Rt({field:oe,children:Ue}){const nt=z===oe;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>pe(oe),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ue,nt?L==="asc"?r.jsx(Ak,{className:"h-3 w-3"}):r.jsx(pr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),o.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>xe(null),title:"Clear manual status override and return to derived status",children:"Clear Override"}),r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value&&xe(oe.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),d.statuses.map(oe=>r.jsx("option",{value:oe.id,children:oe.label},oe.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>Oe(!o.archived),title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value==="_ungrouped"?tt(null):oe.target.value&&tt(oe.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(oe=>oe!==o.workspace).map(oe=>r.jsx("option",{value:oe,children:oe},oe)),o.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ee,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(bw,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(uy,{externalIds:o.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",zn(o.created),". Last source update ",Ur(o.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(Fn,{label:"Assignments",value:o.progress.total}),r.jsx(Fn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),r.jsx(Fn,{label:"Review",value:o.progress.review??0,tone:"info"}),r.jsx(Fn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),r.jsx(Fn,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(fy,{value:C,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Project Overview",children:r.jsx(xn,{content:o.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(oe=>!oe.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:d.statuses.map(oe=>({value:oe.id,label:oe.label})),value:T,onChange:fe}),r.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:ve,value:R,onChange:ne}),r.jsx(yn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:$,onChange:he}),r.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(oe=>({value:oe.id,label:Ni(m,oe.id)})),value:_,onChange:De}),r.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:Nt,value:V,onChange:ut}),r.jsx(sp,{className:"max-w-[190px]",value:I,onChange:F}),E==="kanban"&&r.jsxs("select",{value:q==="type"?"type":"status",onChange:oe=>ae(oe.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[r.jsx("option",{value:"status",children:"Group: Status"}),r.jsx("option",{value:"type",children:"Group: Type"})]}),r.jsx(ip,{value:E,onChange:oe=>Y(oe),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(CE,{scope:Ce,loadedViewId:Se,onApply:kt,onOpenSaveDialog:()=>{et(!1),Ke(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?_t():(et(!1),Ke(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Je?`Update ${Je.name}`:"Save current view",children:Je?`Update '${Je.name}'`:"Save view"}),Je?r.jsx("button",{type:"button",onClick:()=>{et(!0),Ke(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),children:It.length===0?r.jsx(Et,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ee,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(tp,{columns:wn,items:en,getItemId:oe=>oe.slug,getColumnId:oe=>q==="type"?oe.type&&jt.has(oe.type)?oe.type:E0:oe.status,dragDisabled:!0,renderCard:oe=>r.jsx(F8,{projectSlug:o.slug,assignment:oe}),emptyMessage:oe=>`No ${oe.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:oe=>ge(Ue=>({hidden:Ue.hidden.includes(oe)?Ue.hidden.filter(bt=>bt!==oe):[...Ue.hidden,oe]}))}):(()=>{const oe=new Set(se.hidden),Ue=nt=>nt==="title"||!oe.has(nt);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(yE,{visibility:se,onChange:ye})}),r.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Ue("title")?r.jsx(Rt,{field:"title",children:"Assignment"}):null,Ue("status")?r.jsx(Rt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ue("priority")?r.jsx(Rt,{field:"priority",children:"Priority"}):null,Ue("assignee")?r.jsx(Rt,{field:"assignee",children:"Assignee"}):null,Ue("dependencies")?r.jsx(Rt,{field:"dependencies",children:"Dependencies"}):null,Ue("created")?r.jsx(Rt,{field:"created",children:"Created"}):null,Ue("updated")?r.jsx(Rt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:en.map(nt=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ue("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ee,{to:`${n}/projects/${o.slug}/assignments/${nt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:nt.title})}):null,Ue("status")?r.jsx("td",{className:"py-4",children:r.jsx(bn,{status:nt.status,className:"max-w-[150px]"})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ga,{type:nt.type,compact:!0})}),Ue("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:nt.priority}):null,Ue("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:nt.assignee??"—"}):null,Ue("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:nt.dependsOn.length}):null,Ue("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:zn(nt.created)}):null,Ue("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:zn(nt.updated)}):null]},nt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(D8,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?r.jsx(He,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(HM,{definition:o.dependencyGraph,nodeRoutes:te})}):r.jsx(Et,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(He,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ee,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?r.jsx(Et,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:o.resources.map(oe=>r.jsxs(Ee,{to:`/projects/${o.slug}/resources/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.category," · ",oe.source]})]},oe.slug))})}),r.jsx(He,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Ee,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?r.jsx(Et,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:o.memories.map(oe=>r.jsxs(Ee,{to:`/projects/${o.slug}/memories/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.scope," · ",oe.source]})]},oe.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Progress Summary",children:r.jsx(cf,{progress:o.progress,showLegend:!0})}),r.jsx(He,{title:"Attention",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Blocked"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.blockedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.failedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.openQuestions})]})]})}),r.jsx(He,{title:"Quick Links",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(bw,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Ee,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(_A,{className:"h-4 w-4"}),"Review project rules"]}),r.jsxs("button",{type:"button",onClick:()=>j("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(ox,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?r.jsxs(He,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Ur(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),r.jsx(xa,{toast:ot,onDismiss:Me}),r.jsx(NE,{open:Pe,onOpenChange:oe=>{Ke(oe),oe||et(!1)},initialName:ct&&Je?`${Je.name} (copy)`:"",title:ct?"Save as new view":"Save view",onSubmit:St})]})}function F8({projectSlug:e,assignment:t}){const n=fn();return r.jsxs(Ee,{to:`${n}/projects/${e}/assignments/${t.slug}`,className:"vp-card block rounded-lg border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:t.id,children:[t.id.slice(0,8),r.jsx("span",{onClick:s=>{s.preventDefault(),s.stopPropagation()},children:r.jsx(Br,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",zn(t.updated)]})]}),r.jsx(bn,{status:t.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ga,{type:t.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:t.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:t.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[t.dependsOn.length," dependencies"]})]})]})}function EE({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:o}){const[i,c]=p.useState(!1),[u,d]=p.useState(!1);async function m(){var g;if(t||u)return;d(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const C=await y.json().catch(()=>null);throw new Error((C==null?void 0:C.error)??`HTTP ${y.status}`)}const b=await y.json().catch(()=>null);if(!b||typeof b.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:b.command,fallbackWarning:typeof b.fallbackWarning=="string"&&b.fallbackWarning?b.fallbackWarning:void 0}})();try{const y=typeof((g=navigator.clipboard)==null?void 0:g.write)=="function"&&typeof ClipboardItem<"u";let b;if(y)await navigator.clipboard.write([new ClipboardItem({"text/plain":h.then(C=>new Blob([C.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const C=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(C.command),b=C.fallbackWarning}c(!0),setTimeout(()=>c(!1),1500),b&&(o==null||o(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(C){b=C instanceof Error?C:new Error(String(C))}s==null||s(b)}finally{d(!1)}}return t?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:n??"Copy launch command unavailable","aria-label":"Copy launch command",children:r.jsx(vw,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:m,disabled:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded disabled:cursor-wait",title:i?"Copied!":"Copy launch command (cd + resume)","aria-label":"Copy launch command",children:i?r.jsx(Rr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(vw,{className:"h-3 w-3","aria-hidden":"true"})})}function Vl(e,t,n,s,o){let i=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(i+=`&mode=${encodeURIComponent(t)}`),n&&(i+=`&terminal=${encodeURIComponent(n)}`),s&&e.kind==="assignment"&&(i+=`&agent=${encodeURIComponent(s)}`),o!==void 0&&e.kind==="assignment"&&(i+=`&prompt=${encodeURIComponent(o)}`),i}function z8(e){return e.kind==="session"?{method:"POST",url:`/api/agent-sessions/${encodeURIComponent(e.id)}/worktree/recreate`}:e.projectSlug&&e.assignmentSlug?{method:"POST",url:`/api/projects/${encodeURIComponent(e.projectSlug)}/assignments/${encodeURIComponent(e.assignmentSlug)}/worktree/recreate`}:{method:"POST",url:`/api/assignments/${encodeURIComponent(e.id)}/worktree/recreate`}}function B8(e){if(!e.trim())return"Branch name is required.";if(/\s/.test(e))return"Branch name cannot contain whitespace.";if(/[\x00-\x1F\x7F~^:?*[\\]/.test(e))return"Branch name cannot contain any of: ~ ^ : ? * [ \\ or control characters.";if(e.startsWith("-"))return'Branch name cannot start with "-".';if(e.startsWith("/")||e.endsWith("/"))return'Branch name cannot start or end with "/".';if(e.endsWith("."))return'Branch name cannot end with ".".';if(e.includes(".."))return'Branch name cannot contain "..".';if(e.includes("@{"))return'Branch name cannot contain "@{".';if(e==="@")return'Branch name cannot be "@".';for(const t of e.split("/")){if(!t)return'Branch name cannot contain empty path segments (e.g. "a//b").';if(t.startsWith("."))return'Branch name segments cannot start with ".".';if(t.endsWith(".lock"))return'Branch name segments cannot end with ".lock".'}return null}async function TE(e,t,n,s){const o=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{reason:s}:{})}),i=await o.json().catch(()=>null);if(!o.ok)throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`);return i.assignment}async function RE(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),o=await s.json().catch(()=>null);if(!s.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${s.status}`);return o.assignment}async function U8(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}`,{method:"DELETE"}),s=await n.json().catch(()=>null);if(!n.ok)throw new Error((s==null?void 0:s.error)||`HTTP ${n.status}`)}function AE(e){return e.requiresReason||e.command==="block"}async function V8(e){const t=await fetch(`/api/projects/${e.projectSlug}/assignments/${e.assignmentSlug}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}async function H8(e){const t=await fetch(`/api/assignments/${e.id}/title`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title})}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.assignment}class Iy extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function _y(e){const t=await e.json().catch(()=>null);return new Iy((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function W8(e){const t=await fetch(`/api/projects/${e}/repository-candidates`),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.candidates}async function K8(e){const t=await fetch(`/api/assignments/${e}/repository-candidates`),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)||`HTTP ${t.status}`);return n.candidates}async function q8(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok)throw await _y(s);return(await s.json()).assignment}async function G8(e,t){const n=await fetch(`/api/assignments/${e}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await _y(n);return(await n.json()).assignment}async function Y8(e){const{url:t}=z8(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await _y(n);return await n.json()}async function pp(e){const t=await e.json().catch(()=>null);if(!e.ok)throw new Error((t==null?void 0:t.error)||`HTTP ${e.status}`);return t}async function Q8(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return pp(s)}async function J8(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return pp(n)}async function X8(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await pp(n)).sourceAssignments}async function Z8(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await pp(t)).sourceAssignments}function PE(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[o,i]=p.useState(null),[c,u]=p.useState(null),[d,m]=p.useState(null),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(null),[v,k]=p.useState(null);async function E(R,P,$,M){if(!e){t(!0);try{const _=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!_.ok){window.location.href=Vl(R,P,void 0,$,M);return}const D=await _.json();if(D.ok){window.location.href=Vl(R,P,void 0,$,M);return}if(D.reason==="workspace-path-invalid"){D.recreate?(m(D.recreate),g({target:R,mode:P,agentId:$,prompt:M})):u(D.message);return}s(D),i({target:R,mode:P,agentId:$,prompt:M})}catch(_){console.warn("preflight failed, firing without override:",_),window.location.href=Vl(R,P,void 0,$,M)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=Vl(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),s(null),i(null))}async function T(){if(!(!d||!h||y)){b(!0),j(null);try{const R=await Y8({kind:d.kind,id:d.id,projectSlug:d.projectSlug,assignmentSlug:d.assignmentSlug}),{target:P,mode:$,agentId:M,prompt:_}=h;m(null),g(null),window.location.href=Vl(P,$,void 0,M,_),!R.exact&&!R.alreadyExisted&&k(`Recreated from ${R.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(R){j(R instanceof Iy&&R.stderr?`${R.message}
|
|
569
|
+
${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const A=r.jsxs(r.Fragment,{children:[r.jsx(di,{open:n!==null,onOpenChange:R=>!R&&(s(null),i(null)),children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsxs(sa,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(oa,{children:[(n==null?void 0:n.terminal)==="cmux"?r.jsxs(r.Fragment,{children:["To use cmux, install ",r.jsx("strong",{children:"cmux.app"})," into"," ",r.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Ee,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),i(null)},children:"Settings"}),"."]})]}),r.jsxs(pi,{children:[r.jsx(hc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(vo,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(di,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsx(sa,{children:"Can't open in agent"}),r.jsxs(oa,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(pi,{children:r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(di,{open:d!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsx(sa,{children:"Worktree was deleted"}),r.jsxs(oa,{children:["The worktree at ",r.jsx("code",{children:d==null?void 0:d.deletedPath})," no longer exists. Recreate it",d!=null&&d.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:d.branch})]}):null," ","so this can open?"]})]}),C&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:C}),r.jsxs(pi,{children:[r.jsx(hc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(di,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsx(sa,{children:"Worktree recreated"}),r.jsx(oa,{children:v})]}),r.jsx(pi,{children:r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:A}}function DE({session:e,onMarkStopped:t}){const n=PE(),s={kind:"session",id:e.sessionId},o="size-3.5",i=we("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),c="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",u=!e.resumeSupported&&!e.forkSupported;return r.jsxs(r.Fragment,{children:[r.jsx(ia,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(gi,{className:o}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(ur,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(gi,{className:o}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(ur,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(gi,{className:o}),r.jsx("span",{children:"Resume"})]})}),r.jsx(ur,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(XA,{className:o}),r.jsx("span",{children:"Fork"})]})}),r.jsx(ur,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[r.jsx(cx,{className:o}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(ur,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})}),n.dialogs]})}async function eU(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function $E({sessions:e,loading:t,error:n,onError:s,onNotice:o}){return t&&!e?null:n&&!e?r.jsx(He,{title:"Agent Sessions",children:r.jsx(Et,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(He,{title:"Agent Sessions",children:r.jsx(Et,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(He,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(i=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(vf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:i.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:i.sessionId,children:[i.sessionId.slice(0,8),r.jsx(Br,{value:i.sessionId,onError:s}),r.jsx(EE,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:s,onNotice:o})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(bn,{status:i.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Ur(i.started)})]}),r.jsx(DE,{session:i,onMarkStopped:eU})]},i.sessionId))})})}const Qh="Cost / Usage";function LE({summary:e,error:t}){return t&&!e?r.jsx(He,{title:Qh,children:r.jsx(Et,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(He,{title:Qh,children:r.jsx(Et,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(He,{title:Qh,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(R0,{label:"Total cost",value:Ai(e.totalCost)}),r.jsx(R0,{label:"Total tokens",value:Ri(e.totalTokens)})]}),e.byModel.length>1?r.jsxs("div",{className:"space-y-1.5 border-t border-border pt-3",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"By model"}),r.jsx("div",{className:"space-y-1",children:e.byModel.map(n=>r.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(Rc,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate font-mono text-xs text-foreground",title:n.model,children:n.model})]}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Ri(n.totalTokens)," · ",Ai(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",e3(e.lastEventDay)]})]})}):null}function R0({label:e,value:t}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("p",{className:"text-lg font-semibold tabular-nums text-foreground",children:t})]})}function OE({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:o,onOpenChange:i}){const[c,u]=p.useState("");p.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const d=p.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,g=c.trim()||void 0;return r.jsx(On,{open:e,onOpenChange:y=>s?void 0:i(y),children:r.jsx(Rn,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),o(g)},children:[r.jsxs(Zn,{children:[r.jsx(An,{children:m}),r.jsx(Hr,{children:t.description})]}),t.warning?r.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:d}),r.jsx("textarea",{value:c,onChange:y=>u(y.target.value),autoFocus:!0,rows:4,disabled:s,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>i(!1),disabled:s,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:s,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h})]})]})})})}function ba({open:e,title:t,description:n,confirmLabel:s,cancelLabel:o="Cancel",loading:i=!1,destructive:c=!1,onConfirm:u,onOpenChange:d}){return r.jsx(di,{open:e,onOpenChange:m=>i?void 0:d(m),children:r.jsxs(ra,{children:[r.jsxs(fi,{children:[r.jsx(sa,{children:t}),r.jsx(oa,{children:n})]}),r.jsxs(pi,{children:[r.jsx(hc,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),r.jsx(vo,{disabled:i,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${c?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:m=>{m.preventDefault(),u()},children:i?"Working...":s})]})]})})}const tU=/^[a-z0-9][a-z0-9_-]*$/,IE=["first","last","none"];class _E extends Error{constructor(n,s){super(n);Xm(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const My={agents:[],custom:!1};let mi=null,li=null,pf=0;const Hg=new Set;function ME(e){mi=e;for(const t of Hg)t(e)}function nU(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.id!="string"||t.id.length===0||typeof t.label!="string"||typeof t.command!="string")return null;const n={id:t.id,label:t.label,command:t.command};return Array.isArray(t.args)&&t.args.every(s=>typeof s=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&IE.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),typeof t.model=="string"&&(n.model=t.model),typeof t.playbook=="string"&&(n.playbook=t.playbook),typeof t.launchPrompt=="string"&&(n.launchPrompt=t.launchPrompt),n}function Fy(e){if(!e||typeof e!="object")return My;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const o of n){const i=nU(o);i&&s.push(i)}return{agents:s,custom:t.custom===!0}}function rU(){if(mi)return Promise.resolve(mi);if(li)return li;const e=++pf;return li=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{li=null;const n=Fy(t);return e!==pf?mi??n:(mi=n,n)}).catch(()=>(li=null,My)),li}function FE(){const[e,t]=p.useState(()=>mi??My);return p.useEffect(()=>{let n=!1;return rU().then(s=>{n||t(s)}),Hg.add(t),()=>{n=!0,Hg.delete(t)}},[]),e}async function zE(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new _E(n,t==null?void 0:t.fieldErrors)}async function sU(e){++pf;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await zE(t);const n=Fy(await t.json());return ME(n),n}async function oU(){++pf;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await zE(e);const t=Fy(await e.json());return ME(t),t}const A0=/[A-Za-z0-9_-]/,aU=/^[a-z0-9]+(-[a-z0-9]+)*$/,P0=/(^|\s)@([A-Za-z0-9_-]+)/g,Wg="assignment";function BE(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&A0.test(e[s-1]);)s--;const o=s-1;if(o<0||e[o]!=="@"||o>0&&!/\s/.test(e[o-1]))return null;let i=n;for(;i<e.length&&A0.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function UE(e,t){const n=[Wg,...t.filter(c=>c!==Wg)],s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?o.push(c):u.includes(s)&&i.push(c)}return[...o,...i]}function VE(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function HE(e,t){const n=t instanceof Set?t:new Set(t),s=[];P0.lastIndex=0;let o;for(;(o=P0.exec(e))!==null;){const i=o[2];i!==Wg&&(aU.test(i)?n.has(i)||s.push(`Playbook "${i}" is not installed — "@${i}" will be left as literal text.`):s.push(`"@${i}" is not a valid playbook token — it will be left as literal text.`))}return s}const D0=2e3;function iU({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:o}){const[i,c]=p.useState(""),[u,d]=p.useState([]),[m,h]=p.useState(!1),[g,y]=p.useState(null),[b,C]=p.useState(0),[j,v]=p.useState(0),[k,E]=p.useState(!1),S=p.useRef(null);p.useEffect(()=>{if(!e)return;let I=!1;h(!0),y(null),E(!1);const F=new URLSearchParams({assignment:t});return n&&F.set("agent",n),fetch(`/api/launch/prompt?${F.toString()}`).then(async q=>{if(!q.ok){const Z=await q.json().catch(()=>null);throw new Error((Z==null?void 0:Z.error)??`HTTP ${q.status}`)}return await q.json()}).then(q=>{I||(c(q.template??""),d(q.knownPlaybookSlugs??[]),C((q.template??"").length))}).catch(q=>{I||y(q instanceof Error?q.message:String(q))}).finally(()=>{I||h(!1)}),()=>{I=!0}},[e,t,n]);const T=BE(i,b),A=T?UE(T.partial,u):[],R=e&&!m&&!k&&A.length>0,P=HE(i,u),$=i.length>D0;function M(I){c(I.target.value),C(I.target.selectionStart??I.target.value.length),v(0),E(!1)}function _(I){C(I.currentTarget.selectionStart??i.length),v(0)}function D(I){if(!T||!I)return;const F=VE(i,T,I);c(F.text),C(F.caret),v(0),requestAnimationFrame(()=>{const q=S.current;q&&(q.focus(),q.setSelectionRange(F.caret,F.caret))})}function V(I){R&&(I.key==="ArrowDown"?(I.preventDefault(),v(F=>Math.min(F+1,A.length-1))):I.key==="ArrowUp"?(I.preventDefault(),v(F=>Math.max(F-1,0))):(I.key==="Enter"||I.key==="Tab")&&(I.preventDefault(),D(A[j])))}function K(){$||m||(s(i),o(!1))}return r.jsx(On,{open:e,onOpenChange:o,children:r.jsxs(Rn,{onEscapeKeyDown:I=>{R&&(I.preventDefault(),E(!0))},children:[r.jsxs(Zn,{children:[r.jsx(An,{children:"Edit launch prompt"}),r.jsxs(Hr,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:S,value:i,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:M,onKeyDown:V,onKeyUp:_,onClick:_,className:we("w-full rounded-md border border-border/60 bg-background/90 p-3 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30 min-h-[80px] resize-y",$&&"border-error-foreground")}),R&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:A.map((I,F)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":F===j,onMouseDown:q=>{q.preventDefault(),D(I)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",F===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:I})]})},I))})]}),P.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:P.map(I=>r.jsx("li",{children:I},I))}),$&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",D0," characters (",i.length,")."]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||$||g!==null,onClick:K,children:"Launch"})]})]})})}function WE({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,c=PE(),[u,d]=p.useState(null),h=FE().agents,[g,y]=p.useState(null);p.useEffect(()=>{h.length!==0&&y(P=>P&&h.some(M=>M.id===P)?P:(h.find(M=>M.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,C=h.find(P=>P.id===g)??null,j=p.useRef(null),[v,k]=p.useState(!1);p.useEffect(()=>{if(!v)return;function P(M){j.current&&!j.current.contains(M.target)&&k(!1)}function $(M){M.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",P),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",$)}},[v]);function E(P){e.kind==="assignment"?d({agentId:P}):c.open(e,void 0,P)}const S=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",A=we("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(i)return r.jsxs("button",{type:"button",disabled:!0,title:T,className:A,"aria-disabled":!0,children:[r.jsx(gi,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const R=e.kind==="session"?"Open":"Open in agent";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative inline-flex",ref:j,children:[r.jsxs("div",{className:"inline-flex items-stretch",children:[r.jsxs("button",{type:"button",onClick:()=>E(g??void 0),disabled:c.pending,title:(o??S)+(b&&C?` (${C.label})`:""),className:we(A,b&&"rounded-r-none"),children:[r.jsx(gi,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(P=>!P),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:we(A,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(pr,{className:we("size-3.5 opacity-70 transition-transform",v&&"rotate-180")})})]}),v&&b&&r.jsxs("div",{role:"menu","aria-label":"Open with agent",className:"absolute right-0 top-full z-30 mt-1 min-w-[180px] overflow-hidden rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsx("div",{className:"px-2.5 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Open with agent"}),h.map(P=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":P.id===g,onClick:()=>{y(P.id),k(!1),E(P.id)},className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent",children:[r.jsx(Rr,{className:we("size-3.5 shrink-0",P.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:P.label}),P.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},P.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx(iU,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:P=>{c.open(e,void 0,u.agentId,P)},onOpenChange:P=>{P||d(null)}})]})}const Jh="w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";function KE({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:o="main",onCreated:i}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,d]=p.useState(!1),[m,h]=p.useState("new-branch"),[g,y]=p.useState(null),[b,C]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(!1),[S,T]=p.useState(""),[A,R]=p.useState([]),[P,$]=p.useState(!1),[M,_]=p.useState(null),[D,V]=p.useState(""),[K,I]=p.useState(null),[F,q]=p.useState(null),[Z,z]=p.useState(""),[G,L]=p.useState(s),[H,re]=p.useState(!1),[U,ue]=p.useState(null);p.useEffect(()=>{if(!u)return;let X=!1;return h("new-branch"),y(null),C(null),v(""),E(!1),T(""),R([]),$(!1),_(null),V(""),I(null),q(null),z(""),L(s),ue(null),(c.kind==="project-nested"?W8(c.projectSlug):K8(c.assignmentId)).then(Ie=>{if(!X)if(y(Ie),Ie.length===0)E(!0);else{const Ye=Ie.find(Ze=>Ze.source==="project"),Fe=Ie.find(Ze=>Ze.source==="sibling");v((Ye==null?void 0:Ye.path)??(Fe==null?void 0:Fe.path)??Ie[0].path)}}).catch(Ie=>{X||(C(Ie.message),y([]),E(!0))}),(c.kind==="project-nested"?X8(c.projectSlug,c.assignmentSlug):Z8(c.assignmentId)).then(Ie=>{X||I(Ie)}).catch(Ie=>{X||(q(Ie.message),I([]))}),()=>{X=!0}},[u,s,o,e,t,n]);const ge=m==="branch-off"?(K??[]).find(X=>X.id===Z)??null:null,se=m==="branch-off"?(ge==null?void 0:ge.repository)??"":k?S.trim():j;p.useEffect(()=>{if(!u||m!=="new-branch")return;if(!se){R([]),_(null),$(!1),V("");return}let X=!1;return $(!0),_(null),V(""),(c.kind==="project-nested"?Q8(c.projectSlug,c.assignmentSlug,se):J8(c.assignmentId,se)).then(Ce=>{if(X)return;R(Ce.branches);const Ie=(Ce.defaultBranch&&Ce.branches.includes(Ce.defaultBranch)?Ce.defaultBranch:Ce.branches.includes(o)?o:Ce.branches[0])??"";V(Ie),$(!1)}).catch(Ce=>{X||(R([]),_(Ce.message),$(!1))}),()=>{X=!0}},[u,m,se,o,e,t,n]);const ye=B8(G.trim()),Se=p.useMemo(()=>!se||!G.trim()?"":`${se.replace(/\/+$/,"")}/.worktrees/${G.trim()}`,[se,G]),Te=g!==null&&g.length===0,Pe=K!==null&&K.length===0,Ke=X=>{X!==m&&(h(X),z(""),ue(null),X==="branch-off"&&(V(""),R([]),_(null),$(!1)))},ct=X=>{z(X);const Me=(K??[]).find(Ce=>Ce.id===X);V((Me==null?void 0:Me.branch)??"")},et=H||ye!==null||!se||!D.trim()||(m==="new-branch"?g===null||P:K===null||!Z),ot=async()=>{re(!0),ue(null);try{const X={repository:se,branch:G.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await q8(c.projectSlug,c.assignmentSlug,X):await G8(c.assignmentId,X),d(!1),i()}catch(X){X instanceof Iy?ue({message:X.message,stderr:X.stderr}):X instanceof Error?ue({message:X.message}):ue({message:String(X)})}finally{re(!1)}};return r.jsxs(On,{open:u,onOpenChange:X=>H?void 0:d(X),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>d(!0),children:[r.jsx(JA,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(Rn,{children:[r.jsxs(Zn,{children:[r.jsx(An,{children:"Create worktree"}),r.jsxs(Hr,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:H,onClick:()=>Ke("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),r.jsx("button",{type:"button",disabled:H,onClick:()=>Ke("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),m==="new-branch"?r.jsxs(r.Fragment,{children:[Te?r.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-xs text-warning-foreground",children:["No repositories configured for this project. Enter a repo path below, or add a"," ",r.jsx("code",{children:"repositories:"})," list to ",r.jsx("code",{children:"project.md"}),"."]}):null,b?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load repository candidates: ",b]}):null,r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),r.jsx("select",{className:Jh,value:j,onChange:X=>v(X.target.value),disabled:H||g===null||k,children:(g??[]).map(X=>r.jsxs("option",{value:X.path,children:[X.path,X.source==="project"?" (project)":X.sourceAssignmentSlug?` (sibling — ${X.sourceAssignmentSlug})`:" (sibling)"]},`${X.source}:${X.path}`))}),Te?null:r.jsx("button",{type:"button",className:"justify-self-start text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:H,onClick:()=>E(X=>!X),children:k?"Use a listed repository":"Enter a custom repository path (advanced)"}),k?r.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:S,onChange:X=>T(X.target.value),disabled:H}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),r.jsx("select",{className:Jh,value:D,onChange:X=>V(X.target.value),disabled:H||P||A.length===0,children:P?r.jsx("option",{value:"",children:"Loading branches…"}):A.length===0?r.jsx("option",{value:"",children:M?"Could not load branches":se?"No branches found":"— pick a repository —"}):A.map(X=>r.jsx("option",{value:X,children:X},X))}),M?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",M]}):null]})]}):r.jsxs(r.Fragment,{children:[F?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:["Could not load assignments: ",F]}):null,Pe?r.jsx("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-xs text-warning-foreground",children:"No other assignments with a configured workspace to branch off. Create a worktree for one first, or use “New branch from repo”."}):r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Source assignment"}),r.jsxs("select",{className:Jh,value:Z,onChange:X=>ct(X.target.value),disabled:H||K===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(K??[]).map(X=>r.jsxs("option",{value:X.id,children:[X.title," (",X.branch,")"]},X.id))]})]}),ge?r.jsxs("div",{className:"grid gap-2 rounded-md border border-border/70 bg-muted/40 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Repository (from source)"}),r.jsx("code",{className:"break-all",children:ge.repository})]}),r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Parent branch (from source)"}),r.jsx("code",{children:ge.branch})]})]}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),r.jsx("input",{className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",value:G,onChange:X=>L(X.target.value),disabled:H}),ye?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ye}):null]}),r.jsxs("div",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),r.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:Se||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),U?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[r.jsx("div",{className:"font-medium",children:U.message}),U.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:U.stderr}):null]}):null]}),r.jsxs(Ar,{children:[r.jsx(D$,{disabled:H,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:et,onClick:()=>void ot(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:H?"Working…":"Create worktree"})]})]})]})}function lU(e){const t=e.split(`
|
|
570
|
+
`),n=t.findIndex(c=>/^##\s+Acceptance Criteria\s*$/i.test(c.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const o=t.slice(n+1,s).map(c=>c.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(c=>!!c).map(c=>({checked:c[1].toLowerCase()==="x",text:c[2].trim()})),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
571
|
+
`).replace(/\n{3,}/g,`
|
|
572
|
+
|
|
573
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function cU(e){const t=e.split(`
|
|
574
|
+
`),n=t.findIndex(c=>/^##\s+Todos\s*$/i.test(c.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const o=t.slice(n+1,s).join(`
|
|
575
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
576
|
+
|
|
577
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
578
|
+
`).replace(/\n{3,}/g,`
|
|
579
|
+
|
|
580
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function uU({projectSlug:e,dependencies:t,blockedReason:n}){const[s,o]=p.useState(!1);if(t.length===0)return null;const i=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=i.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(rx,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx(pr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[i.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(Ud,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[i.length," ",i.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(He,{title:"Dependencies",description:`${t.length-i.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>o(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ee,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(bn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(Bd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function dU({links:e}){const t=fn();if(e.length===0)return null;const n=e.filter(o=>!o.isReverse),s=e.filter(o=>o.isReverse);return r.jsx(He,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(o=>r.jsxs(Ee,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(Ek,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(bn,{status:o.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),r.jsx(Bd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),s.map(o=>r.jsxs(Ee,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(zd,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(bn,{status:o.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),r.jsx(Bd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function fU(e){const t=new Map;for(const s of e)t.set(s.id,{entry:s,replies:[]});const n=[];for(const s of e){const o=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(o):n.push(o)}return n}function pU(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function qE({projectSlug:e,assignmentSlug:t,entries:n}){const[s,o]=p.useState(n);p.useEffect(()=>{o(n)},[n]);const i=p.useMemo(()=>fU(s),[s]),[c,u]=p.useState(""),[d,m]=p.useState("note"),[h,g]=p.useState(!1),[y,b]=p.useState(null);async function C(v){var S;if(v.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:d,body:c,resolved:d==="question"?!1:void 0};o(T=>[...T,E]);try{const T=await fetch(pU(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:d})});if(!T.ok){const P=await T.text();throw new Error(P||`HTTP ${T.status}`)}const A=await T.json().catch(()=>null),R=(S=A==null?void 0:A.comment)==null?void 0:S.id;o(P=>P.map($=>$.id===k?{...$,id:R??$.id}:$)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),o(A=>A.filter(R=>R.id!==k))}finally{g(!1)}}async function j(v,k){o(E=>E.map(S=>S.id===v?{...S,resolved:k}:S));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,S=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!S.ok)throw new Error(`HTTP ${S.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),o(S=>S.map(T=>T.id===v?{...T,resolved:!k}:T))}}return r.jsx(He,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[i.map(v=>r.jsx(GE,{node:v,onToggleResolved:j,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:v=>u(v.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:d,onChange:v=>m(v.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function GE({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:o}=e,i=s.type==="question";return r.jsxs("div",{className:we("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:s.id}),r.jsx("span",{children:"·"}),r.jsx("span",{children:s.timestamp}),r.jsx("span",{children:"·"}),r.jsx("span",{className:"font-medium text-foreground",children:s.author}),r.jsx("span",{children:"·"}),r.jsx("span",{className:we("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",i&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),i?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:we("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(rx,{className:"h-3 w-3"}):r.jsx(BA,{className:"h-3 w-3"}),s.resolved?"resolved":"open"]}):null,s.replyTo?r.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[r.jsx(dP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(xn,{content:s.body}),o.length>0?r.jsx("div",{className:"space-y-2",children:o.map(c=>r.jsx(GE,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const mU=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function $0(){var ut,ae,be,Le,at,Be,kt,St,_t,pe;const{slug:e,aslug:t}=Bt(),n=zt(),s=fn(),[o,i]=ls(),[c,u]=p.useState(null),{toast:d,showToast:m,dismissToast:h}=Ao(),[g,y]=p.useState(null),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(!1),[A,R]=p.useState(!1),[P,$]=p.useState(0),M=o.get("tab")??"summary",_=ha(),{data:D,loading:V,error:K,refetch:I}=y3(e,t),{data:F}=iS(e),{data:q}=hx(),{data:Z,loading:z,error:G}=v3(e,t),{data:L,loading:H,error:re}=j3(e,t),U=p.useMemo(()=>{if(!D||!F)return[];const te=new Map(F.assignments.map(xe=>[xe.slug,xe]));return D.dependsOn.map(xe=>{const Oe=te.get(xe);return{slug:xe,title:(Oe==null?void 0:Oe.title)??xe,status:(Oe==null?void 0:Oe.status)??"pending",priority:(Oe==null?void 0:Oe.priority)??"medium",assignee:(Oe==null?void 0:Oe.assignee)??null}})},[D,F]),ue=U.filter(te=>te.status!=="completed"&&te.status!=="review");Ro("assignment");const ge=p.useMemo(()=>((F==null?void 0:F.assignments)??[]).map(te=>te.slug),[F]),se=t?ge.indexOf(t):-1,ye=se>0?ge[se-1]:null,Se=se>=0&&se<ge.length-1?ge[se+1]:null,Te=`${s}/projects/${e}/assignments/${t}`;Yt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Te}/edit`)}),Yt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Te}/plan/edit`)}),Yt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Te}/handoff/edit`)}),Yt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Te}/decision-record/edit`)}),Yt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Te}/scratchpad/edit`)}),Yt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ye,handler:()=>ye&&n(`${s}/projects/${e}/assignments/${ye}`)}),Yt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!Se,handler:()=>Se&&n(`${s}/projects/${e}/assignments/${Se}`)});const Pe=p.useMemo(()=>D?lU(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),Ke=p.useMemo(()=>cU(Pe.summaryBody),[Pe.summaryBody]),ct=Pe.acceptanceCriteria,et=ct.filter(te=>te.checked).length,ot=ct.length>0&&et===ct.length,X=p.useRef(ot),Me=p.useRef(!1);if(p.useEffect(()=>{if(D){if(!Me.current){X.current=ot,Me.current=!0;return}ot&&!X.current&&$(te=>te+1),X.current=ot}},[ot,D]),V)return r.jsx(xt,{label:"Loading assignment workspace…"});if(K||!D||!e||!t)return r.jsx(Tt,{error:K||"Assignment not found."});const Ce=e,Ie=t,Ye=ct.length>0?{checked:et,total:ct.length}:void 0,Fe=D.availableTransitions??[],Ze=Fe.filter(te=>!te.disabled&&te.targetStatus!==D.status),Je=mU.map(te=>Ze.find(xe=>xe.command===te)).find(Boolean)??Ze[0]??null,Ot=[];if(q!=null&&q.sessions)for(const te of q.sessions)for(const xe of te.windows)for(const Oe of xe.panes)((ut=Oe.assignment)==null?void 0:ut.project)===e&&((ae=Oe.assignment)==null?void 0:ae.slug)===t&&Ot.push({sessionName:te.name,command:Oe.command,urls:Oe.urls});async function yt(te){u(null);try{await RE(Ce,Ie,te),I()}catch(xe){u(xe.message)}}async function dt(te){u(null);try{const xe=await fetch(`/api/projects/${Ce}/assignments/${Ie}/${te?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!xe.ok){const Oe=await xe.json().catch(()=>null);throw new Error((Oe==null?void 0:Oe.error)||`HTTP ${xe.status}`)}I(),m(te?"Assignment archived":"Assignment restored","success")}catch(xe){u(xe.message)}}async function le(){R(!0);try{await U8(Ce,Ie),n(`${s}/projects/${Ce}`)}catch(te){u(te.message),R(!1),T(!1)}}async function Y(te,xe){u(null),y(te.command);try{return await TE(Ce,Ie,te,xe),I(),!0}catch(Oe){return u(Oe.message),!1}finally{y(null)}}function fe(te){if(AE(te)){C(te);return}Y(te)}async function ne(te,xe){v(null),E(te);try{const Oe=await fetch(`/api/projects/${Ce}/assignments/${Ie}/acceptance-criteria/${te}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:xe})}),tt=await Oe.json();if(!Oe.ok)throw new Error(tt.error||`HTTP ${Oe.status}`);I()}catch(Oe){v(Oe.message)}finally{E(null)}}const he=[...Ze.filter(te=>te!==Je).map(te=>({key:`transition-${te.command}`,label:te.label,onSelect:()=>fe(te),disabled:g===te.command})),...Fe.filter(te=>te.disabled||te.targetStatus===D.status).map(te=>({key:`transition-${te.command}`,label:te.label,disabled:!0,disabledReason:te.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:te.disabledReason??te.warning??te.description})),..._.statuses.map(te=>({key:`override-${te.id}`,label:`Override → ${te.label}`,onSelect:()=>yt(te.id),disabled:te.id===D.status,disabledReason:te.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:QA,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:pP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:ih,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Bd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:ZA,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:D.archived?"unarchive":"archive",label:D.archived?"Restore assignment":"Archive assignment",icon:D.archived?Fd:wf,onSelect:()=>dt(!D.archived)},{key:"delete",label:"Delete assignment",icon:Tn,destructive:!0,onSelect:()=>T(!0)}],De=(Je==null?void 0:Je.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(xa,{toast:d,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:D.status,progress:Ye}),D.phase&&D.phase!==D.status&&r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",title:"Phase dimension — how far along the work is, independent of blockage",children:["phase: ",D.phase]}),D.disposition&&D.disposition!=="active"&&r.jsx("span",{className:"rounded-full border border-warning-foreground/40 px-2 py-0.5 text-[11px] text-warning-foreground",title:"Disposition dimension — orthogonal to phase",children:D.disposition}),r.jsx(ga,{type:D.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:D.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",Wk(D.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(uy,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(WE,{target:{kind:"assignment",id:D.id},worktreePath:((be=D.workspace)==null?void 0:be.worktreePath)??null,repository:((Le=D.workspace)==null?void 0:Le.repository)??null}),!((at=D.workspace)!=null&&at.worktreePath)&&e&&t&&r.jsx(KE,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>I()}),Je&&r.jsx("button",{type:"button",title:Je.warning||Je.description,disabled:g===Je.command,onClick:()=>fe(Je),className:we("shell-action disabled:cursor-not-allowed disabled:opacity-50",Je.warning&&"border-warning-foreground/40",De&&P>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Je.command?"Working…":Je.label})},De?`review-${P}`:Je.command),r.jsx(ry,{items:he,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,D.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",D.blockedReason]}):null,D.override&&D.derived&&D.derived.derivedStatus!==D.status?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsxs("strong",{children:["Pinned to ",D.status]})," by ",D.override.source,D.override.reason?r.jsxs(r.Fragment,{children:[" — “",D.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:D.derived.derivedStatus})]}):null,(Be=D.derived)!=null&&Be.nextAction?r.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",D.derived.nextAction]}):null]}),D.derived&&(Object.keys(D.derived.customFacts??{}).length>0||(D.derived.attestations??[]).length>0)?r.jsx(He,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:r.jsxs("div",{className:"space-y-3",children:[Object.keys(D.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(D.derived.customFacts??{}).map(([te,xe])=>r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[te,": ",r.jsx("span",{className:"font-medium text-foreground",children:String(xe)})]},te))}),(D.derived.attestations??[]).map(te=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:te.fact}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",te.binds,")"]}),te.records.length===0?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):te.records.map(xe=>r.jsxs("span",{title:`${xe.verdict}${xe.note?` — ${xe.note}`:""}${xe.stale?" (stale — revision moved)":""} · ${xe.at}`,className:we("rounded-full border px-2 py-0.5 text-[11px]",xe.stale?"border-border/40 text-muted-foreground line-through":xe.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[xe.actor,": ",xe.verdict==="approved"?"approved":"changes",xe.stale?" (stale)":""]},xe.actor))]},te.fact))]})}):null,U.length>0&&r.jsx(uU,{projectSlug:e,dependencies:U,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(dU,{links:D.enrichedLinks}),D.referencedBy&&D.referencedBy.length>0&&r.jsx(He,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:D.referencedBy.map(te=>{const xe=te.sourceProjectSlug===null?`/assignments/${te.sourceId}`:`${s}/projects/${te.sourceProjectSlug}/assignments/${te.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:xe,className:"text-foreground hover:text-primary",children:te.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",te.mentions," mention",te.mentions===1?"":"s",")"]}),te.sourceProjectSlug===null?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},te.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(fy,{value:M,onValueChange:te=>i({tab:te}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[Pe.acceptanceCriteria.length>0?r.jsx(He,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,Pe.acceptanceCriteria.map((te,xe)=>{const Oe=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:te.checked,disabled:Oe,onChange:tt=>ne(xe,tt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":te.checked,children:te.text})]},`${xe}-${te.text}`)})]})}):null,Ke.hasSection?r.jsx(He,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(xn,{content:Ke.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(He,{title:"Assignment Summary",children:r.jsx(xn,{content:Ke.remaining,emptyState:Pe.acceptanceCriteria.length>0||Ke.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:D.plan?1:0,content:D.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(He,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(ih,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(bn,{status:D.plan.status})}),r.jsx(xn,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(Et,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(He,{title:"Scratchpad",actions:r.jsxs(Ee,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(ih,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(xn,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(Et,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((kt=D.handoff)==null?void 0:kt.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(He,{children:r.jsx(xn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(Et,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((St=D.progress)==null?void 0:St.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.progress&&D.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:D.progress.entries.map((te,xe)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:te.timestamp}),r.jsx(xn,{content:te.body})]},`${te.timestamp}-${xe}`))})}):r.jsx(Et,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((_t=D.comments)==null?void 0:_t.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(qE,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(Et,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((pe=D.decisionRecord)==null?void 0:pe.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(He,{children:r.jsx(xn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(Et,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(ho,{label:"ID",value:D.id,copyable:!0}),r.jsx(ho,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(ho,{label:"Assignee",value:D.assignee}),r.jsx(ho,{label:"Updated",value:`${Hk(D.updated)} · Created ${Vk(D.created)}`}),D.workspace.repository&&r.jsx(ho,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(ho,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(ho,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(ho,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((te,xe)=>r.jsx(hU,{entry:te},`${te.system}:${te.id}:${xe}`))]})}),Ot.length>0&&r.jsx(He,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:Ot.map((te,xe)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:te.command,children:te.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:te.sessionName,children:te.sessionName}),te.urls.map(Oe=>r.jsxs("a",{href:Oe,target:"_blank",rel:"noopener noreferrer",title:Oe,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[r.jsx("span",{className:"min-w-0 truncate",children:Oe.replace("http://localhost:",":")}),r.jsx(Mi,{className:"h-2.5 w-2.5 shrink-0"})]},Oe))]},xe))})}),r.jsx($E,{sessions:Z==null?void 0:Z.sessions,loading:z,error:G,onError:te=>m(te.message,"error"),onNotice:te=>m(te,"success")}),r.jsx(LE,{summary:L==null?void 0:L.summary,loading:H,error:re})]})]}),r.jsx(OE,{open:b!==null,action:b,assignmentTitle:D.title,loading:g===(b==null?void 0:b.command),onOpenChange:te=>{te||C(null)},onConfirm:async te=>{if(!b)return;await Y(b,te)&&C(null)}}),r.jsx(ba,{open:S,title:"Delete assignment?",description:`This will permanently delete "${D.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:A,onOpenChange:te=>{te||T(!1)},onConfirm:le})]})}function ho({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Br,{value:t})]})]})}function hU({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(Mi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function gU(){var R,P,$,M,_,D,V,K;const{id:e}=Bt(),[t,n]=ls(),s=t.get("tab")??"summary",{data:o,loading:i,error:c,refetch:u}=b3(e),{data:d,loading:m,error:h}=w3(e),{data:g,loading:y,error:b}=k3(o==null?void 0:o.slug),[C,j]=p.useState(!1),[v,k]=p.useState(null),{toast:E,showToast:S,dismissToast:T}=Ao();async function A(I){if(e){k(null);try{const F=await fetch(`/api/assignments/${e}/${I?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!F.ok){const q=await F.json().catch(()=>null);throw new Error((q==null?void 0:q.error)||`HTTP ${F.status}`)}u(),S(I?"Assignment archived":"Assignment restored","success")}catch(F){k(F instanceof Error?F.message:"Archive failed")}}}return i?r.jsx(xt,{}):c?r.jsx(Tt,{error:c}):o?r.jsxs("div",{className:"space-y-6",children:[r.jsx(xa,{toast:E,onDismiss:T}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),r.jsx(ga,{type:o.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),r.jsx(uy,{externalIds:o.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(WE,{target:{kind:"assignment",id:o.id},worktreePath:((R=o.workspace)==null?void 0:R.worktreePath)??null,repository:((P=o.workspace)==null?void 0:P.repository)??null,size:"compact"}),!(($=o.workspace)!=null&&$.worktreePath)&&r.jsx(KE,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[r.jsx(jf,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ee,{to:`/assignments/${o.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>A(!o.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:o.archived?"Restore this assignment":"Archive this assignment",children:[o.archived?r.jsx(Fd,{className:"h-3 w-3"}):r.jsx(wf,{className:"h-3 w-3"}),o.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:o.title}),o.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",o.blockedReason]}):null,v?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:v}):null]}),r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(go,{label:"ID",value:o.id,copyable:!0}),r.jsx(go,{label:"Priority",value:o.priority}),o.assignee&&r.jsx(go,{label:"Assignee",value:o.assignee}),r.jsx(go,{label:"Updated",value:`${Hk(o.updated)} · Created ${Vk(o.created)}`}),o.workspace.repository&&r.jsx(go,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&r.jsx(go,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&r.jsx(go,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&r.jsx(go,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((I,F)=>r.jsx(xU,{entry:I},`${I.system}:${I.id}:${F}`))]})}),o.referencedBy&&o.referencedBy.length>0?r.jsx(He,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(I=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ee,{to:I.sourceProjectSlug===null?`/assignments/${I.sourceId}`:`/projects/${I.sourceProjectSlug}/assignments/${I.sourceSlug}`,className:"text-foreground hover:text-primary",children:I.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",I.mentions," mention",I.mentions===1?"":"s",")"]})]},I.sourceId))})}):null,r.jsx($E,{sessions:d==null?void 0:d.sessions,loading:m,error:h,onError:I=>S(I.message,"error"),onNotice:I=>S(I,"success")}),r.jsx(LE,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(fy,{value:s,onValueChange:I=>n({tab:I}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Assignment",children:r.jsx(xn,{content:o.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((M=o.progress)==null?void 0:M.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.progress&&o.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:o.progress.entries.map((I,F)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:I.timestamp}),r.jsx(xn,{content:I.body})]},`${I.timestamp}-${F}`))})}):r.jsx(Et,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((_=o.comments)==null?void 0:_.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(qE,{projectSlug:null,assignmentSlug:o.id,entries:((D=o.comments)==null?void 0:D.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:o.plan?r.jsxs(He,{children:[r.jsx(xn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${o.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):r.jsx(Et,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:o.scratchpad?r.jsxs(He,{children:[r.jsx(xn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${o.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):r.jsx(Et,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((V=o.handoff)==null?void 0:V.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.handoff?r.jsxs(He,{children:[r.jsx(xn,{content:o.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${o.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):r.jsx(Et,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((K=o.decisionRecord)==null?void 0:K.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.decisionRecord?r.jsxs(He,{children:[r.jsx(xn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ee,{to:`/assignments/${o.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):r.jsx(Et,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(cy,{open:C,onOpenChange:j,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async I=>{const F=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:I})});if(!F.ok){const q=await F.json().catch(()=>({}));throw new Error(q.error||"Failed to move assignment")}u()}})]}):r.jsx(Tt,{error:"Assignment not found"})}function go({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Br,{value:t})]})]})}function xU({entry:e}){const t=e.url!=null&&e.url.length>0;return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e.system}),r.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?r.jsxs("a",{href:e.url??void 0,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ${e.system}:${e.id} in ${e.system}`,className:"flex items-center gap-1.5 min-w-0 text-primary hover:underline",children:[r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),r.jsx(Mi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function yU({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1,className:o}){const[i,c]=p.useState(!1),[u,d]=p.useState(null),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null),b=p.useId(),C=af(e),j=C.icon,v=p.useCallback(A=>{c(!1),A&&requestAnimationFrame(()=>{var R;(R=g.current)==null||R.focus()})},[]),k=p.useCallback(()=>{var R;const A=(R=g.current)==null?void 0:R.getBoundingClientRect();A&&d({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);p.useLayoutEffect(()=>{i&&k()},[i,k]),p.useEffect(()=>{if(!i)return;const A=()=>k();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[i,k]),p.useEffect(()=>{if(!i)return;const A=R=>{var $,M;const P=R.target;P&&(($=y.current)!=null&&$.contains(P)||(M=g.current)!=null&&M.contains(P)||v(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,v]),p.useEffect(()=>{i&&h(0)},[i,t.length]);function E(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),c(!0))}function S(A){if(t.length===0){A.key==="Escape"&&(A.preventDefault(),v(!0));return}if(A.key==="ArrowDown")A.preventDefault(),h(R=>(R+1)%t.length);else if(A.key==="ArrowUp")A.preventDefault(),h(R=>(R-1+t.length)%t.length);else if(A.key==="Home")A.preventDefault(),h(0);else if(A.key==="End")A.preventDefault(),h(t.length-1);else if(A.key==="Enter"){A.preventDefault();const R=t[m];R&&(n(R),v(!0))}else A.key==="Escape"&&(A.preventDefault(),v(!0))}function T(A){n(A),v(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?b:void 0,onClick:()=>{s||c(A=>!A)},onKeyDown:E,title:`Status: ${C.label}. Click to change.`,className:we(YN(e,o),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(j,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 truncate",children:C.label})]}),i&&u&&typeof document<"u"?Fs.createPortal(r.jsx("div",{ref:y,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:S,style:{position:"fixed",top:u.bottom+6,left:u.left,minWidth:Math.max(u.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((A,R)=>{const P=af(A.targetStatus),$=P.icon,M=R===m;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>h(R),onClick:()=>T(A),title:A.warning||A.description,className:we("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",M?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx($,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:A.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:P.label})]}),A.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:A.warning}):null]},`${A.command}:${A.targetStatus}`)})}),document.body):null]})}function YE({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[o,i]=p.useState(!1);return o?r.jsx(bU,{initialTitle:e,disabled:s,onSave:n,onExit:()=>i(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||i(!0)},className:we("text-left text-base font-semibold text-foreground transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",s&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),r.jsx(Ee,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:c=>c.stopPropagation(),className:"text-muted-foreground opacity-0 transition group-hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",children:r.jsx(Mi,{className:"h-3.5 w-3.5"})})]})}function bU({initialTitle:e,disabled:t,onSave:n,onExit:s}){const o=p.useRef(e),[i,c]=p.useState(e),[u,d]=p.useState(!1),[m,h]=p.useState(!1),g=p.useRef(null),y=p.useRef(!1);p.useEffect(()=>{const v=g.current;v&&(v.focus(),v.select())},[]);const b=p.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),C=p.useCallback(async()=>{if(y.current)return;const v=i.trim();if(v.length===0){b();return}if(v===o.current){s();return}y.current=!0,d(!0);try{await n(v)}catch{}finally{d(!1),s()}},[i,s,n,b]);function j(v){v.key==="Enter"?(v.preventDefault(),C()):v.key==="Escape"&&(v.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:i,onChange:v=>c(v.target.value),onKeyDown:j,onBlur:()=>void C(),className:we("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-base font-semibold text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",m&&"syntaur-input-shake",u&&"opacity-70")})}function QE(e){const t=zt(),n=p.useRef(null),s=p.useRef(!1),o=p.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),d=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||d||h},[]),i=p.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(Li)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const L0=/[A-Za-z0-9_-]/;function O0(e,t){const n=Math.max(0,Math.min(t,e.length)),s=vU(e,n);if(s)return s;let o=n;for(;o>0&&L0.test(e[o-1]);)o--;let i=n;for(;i<e.length&&L0.test(e[i]);)i++;const c=e.slice(o,n),u=e.slice(0,o),d=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(d)return{kind:"value",field:d[1].toLowerCase(),partial:c,tokenStart:o,tokenEnd:i};const m=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return m?{kind:"value",field:m[1].toLowerCase(),partial:c,tokenStart:o,tokenEnd:i}:{kind:"field",partial:c,tokenStart:o,tokenEnd:i}}function vU(e,t){let n=-1;for(let d=t-1;d>=0;d--)if(e[d]==='"'&&(d===0||e[d-1]!=="\\")){n=d;break}if(n<0)return null;for(let d=n+1;d<t;d++)if(e[d]==='"'&&e[d-1]!=="\\")return null;let s=t;for(;s<e.length&&!(e[s]==='"'&&e[s-1]!=="\\");)s++;const o=e.slice(n+1,t),c=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:c?c[1].toLowerCase():"",partial:o,tokenStart:n,tokenEnd:s<e.length?s+1:s}}function wU(e,t){const n=GN(t),s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?o.push(c):u.includes(s)&&i.push(c)}return[...o,...i]}function jU(e,t,n,s){const o=e.toLowerCase();let i=[];switch(o){case"status":i=[...n.statuses];break;case"priority":i=[...n.priorities];break;case"type":i=[...n.types];break;case"assignee":i=["none",...n.assignees];break;case"project":i=["none",...n.projects];break;case"tag":case"tags":i=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":i=["true","false"];break;default:{const u=s[o];(u==null?void 0:u.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const c=t.toLowerCase();return c===""?i:i.filter(u=>u.toLowerCase().startsWith(c))}function kU(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=eN(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const SU=180;function NU(e,t){const[n,s]=p.useState(e);return p.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function CU({value:e,onChange:t,onCompiled:n,registry:s,declarations:o,valueSources:i,placeholder:c="AQL query (e.g. status:active AND priority:high)",className:u}){const d=p.useRef(null),m=p.useRef(null),h=NU(e,SU),[g,y]=p.useState([]),[b,C]=p.useState([]),[j,v]=p.useState("field"),[k,E]=p.useState(-1),[S,T]=p.useState(!1),A=p.useRef(e.length);p.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const I=Vx(h,s);I.errors.length>0?(y(I.errors),n==null||n(null)):(y([]),n==null||n(I.query))},[h,s,n]);const R=p.useCallback((I,F)=>{const q=O0(I,F);if(!q){C([]),T(!1);return}if(q.kind==="field"){const Z=wU(q.partial,o);C(Z),v("field"),T(Z.length>0)}else{const Z=jU(q.field,q.partial,i,s);C(Z),v("value"),T(Z.length>0)}E(-1)},[o,i,s]),P=p.useCallback(I=>{const F=I.target.value,q=I.target.selectionStart??F.length;A.current=q,t(F),R(F,q)},[t,R]),$=p.useCallback(I=>{const F=d.current,q=(F==null?void 0:F.selectionStart)??A.current,Z=O0(e,q);if(!Z)return;const{text:z,caret:G}=kU(e,Z,I);t(z),T(!1),C([]),requestAnimationFrame(()=>{d.current&&(d.current.focus(),d.current.setSelectionRange(G,G),A.current=G)})},[e,t]),M=p.useCallback(I=>{if(!(!S||b.length===0))switch(I.key){case"ArrowDown":I.preventDefault(),E(F=>Math.min(F+1,b.length-1));break;case"ArrowUp":I.preventDefault(),E(F=>Math.max(F-1,-1));break;case"Enter":case"Tab":k>=0&&(I.preventDefault(),$(b[k]));break;case"Escape":T(!1),C([]);break}},[S,b,k,$]),_=p.useRef(null),D=p.useCallback(()=>{_.current=setTimeout(()=>T(!1),120)},[]);p.useEffect(()=>()=>{_.current!==null&&clearTimeout(_.current)},[]);const V=p.useCallback(()=>{var F;const I=((F=d.current)==null?void 0:F.selectionStart)??e.length;R(e,I)},[e,R]);p.useEffect(()=>{var I,F;S&&((F=(I=m.current)==null?void 0:I.querySelector('[aria-selected="true"]'))==null||F.scrollIntoView({block:"nearest"}))},[k,S]);const K=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:d,type:"text",value:e,onChange:P,onKeyDown:M,onBlur:D,onFocus:V,placeholder:c,"aria-label":"AQL query input","aria-expanded":S,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",K?"border-destructive focus:border-destructive focus:ring-2 focus:ring-destructive/30":"border-border/60 focus:border-primary focus:ring-2 focus:ring-ring/30"].join(" ")}),S&&b.length>0&&r.jsx("ul",{ref:m,role:"listbox","aria-label":j==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:b.map((I,F)=>r.jsx("li",{role:"option","aria-selected":F===k,onMouseDown:q=>{q.preventDefault(),$(I)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",F===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:I},I))}),K&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((I,F)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",I.pos,": ",I.message]},F))})]})}const I0=Ux;function bd(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function EU(e,t){return e.toString()===t.toString()}function _0(){const{workspace:e}=Bt(),t=fn(),n=zt(),s=p.useRef(null);Ro("list:assignments");const{data:o,loading:i,error:c,refetch:u}=Cf(),d=ha(),m=rp(),[h,g]=ls(),y=e?`w:${e}`:null,b=wE(y),C=p.useRef(void 0),j=p.useMemo(()=>aC(d.order),[d]),v=p.useMemo(()=>{const B={};for(const J of j)B[J]=Bc(d,J);return B},[j,d]),k=p.useMemo(()=>j.map(B=>({id:B,title:v[B]??B,description:np(B)})),[j,v]),E=p.useMemo(()=>m.definitions.map(B=>({id:B.id,title:Ni(m,B.id),description:B.description})),[m]),S="__unknown_type__",T=p.useMemo(()=>new Set(["all",...j]),[j]),A=h.get("view"),R=h.get("status"),P=h.get("stale"),$=A&&I0.includes(A)?A:"kanban";function M(B){if(!B)return[];const J=[];for(const me of B.split(",")){const _e=me.trim();!_e||_e==="all"||!T.has(_e)||J.includes(_e)||J.push(_e)}return J}const _=p.useCallback(B=>{g(J=>{const me=new URLSearchParams(J);return B==="kanban"?me.delete("view"):me.set("view",B),me})},[g]),[D,V]=p.useState(""),[K,I]=p.useState(()=>M(R)),[F,q]=p.useState(()=>ze(b.filters.priority)),[Z,z]=p.useState(()=>ze(b.filters.type)),[G,L]=p.useState(()=>ze(b.filters.assignee)),[H,re]=p.useState(()=>ze(b.filters.project)),[U,ue]=p.useState(()=>ze(b.filters.tags)),[ge,se]=p.useState(null),[ye,Se]=p.useState(()=>bd(P)),[Te,Pe]=p.useState(()=>sc({status:M(R),priority:ze(b.filters.priority),type:ze(b.filters.type),assignee:ze(b.filters.assignee),project:ze(b.filters.project),tags:ze(b.filters.tags),activity:bd(P)})),[Ke,ct]=p.useState(()=>b.sortField),[et,ot]=p.useState(()=>b.sortDirection),[X,Me]=p.useState(()=>({hidden:[]})),[Ce,Ie]=p.useState(()=>({hidden:[]})),[Ye,Fe]=p.useState(()=>b.grouping),Ze=Ye==="type"?"type":"status",[Je,Ot]=p.useState(()=>new Set),[yt,dt]=p.useState([]),{toast:le,showToast:Y,dismissToast:fe}=Ao(),[ne,he]=p.useState(null),[De,ut]=p.useState(null),[ae,be]=p.useState(null),[Le,at]=p.useState(null),[Be,kt]=p.useState(null),[St,_t]=p.useState(null),[pe,te]=p.useState(null),[xe,Oe]=p.useState(null),[tt,ve]=p.useState(null),[Nt,It]=p.useState(!1),[en,jt]=p.useState(!1),wn=e?{kind:"workspace",workspace:e}:{kind:"global"},Rt=h.get("loadView"),{view:oe,loading:Ue,error:nt}=So(Rt),{view:bt,loading:tr,error:qr}=So(tt),Ts=p.useRef(null);p.useEffect(()=>{dt((o==null?void 0:o.assignments)??[])},[o]),p.useEffect(()=>{tt&&!tr&&!qr&&!bt&&ve(null)},[bt,qr,tt,tr]),p.useEffect(()=>{ve(null),Ts.current=null,se(null),V("")},[e]);const qc=p.useRef({status:R,stale:P});p.useEffect(()=>{const B=M(R),J=bd(P);jO(B,K)||I(B),J!==ye&&Se(J);const me=qc.current,_e=me.status!==R||me.stale!==P;qc.current={status:R,stale:P},_e&&on({status:B,activity:J})},[ye,P,K,R]),p.useEffect(()=>{C.current===y&&g(B=>{const J=new URLSearchParams(B);return K.length===0?J.delete("status"):J.set("status",K.join(",")),ye==="all"?J.delete("stale"):ye==="stale"?J.set("stale","1"):J.set("stale","0"),EU(B,J)?B:J})},[ye,y,g,K]),p.useEffect(()=>{q(ze(b.filters.priority)),z(ze(b.filters.type)),L(ze(b.filters.assignee)),re(ze(b.filters.project)),ue(ze(b.filters.tags)),ct(b.sortField),ot(b.sortDirection),Fe(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),p.useEffect(()=>{if(C.current===y)return;let B=!1;return Oy().then(J=>{if(B||C.current===y)return;const me=X1(J,y),_e=me.defaultView,ft=ze(me.filters.status),vt=me.filters.activity??"all",Mt=new URLSearchParams(window.location.search);let hr=!1;const un=new URLSearchParams(Mt);Mt.get("view")===null&&_e!=="kanban"&&I0.includes(_e)&&(un.set("view",_e),hr=!0),Mt.get("status")===null&&ft.length>0&&(un.set("status",ft.join(",")),I(ft),hr=!0),Mt.get("stale")===null&&vt!=="all"&&(un.set("stale",vt==="stale"?"1":"0"),Se(vt),hr=!0),hr&&g(un,{replace:!0});const pn=M(un.get("status")),mn=un.get("stale")===null?vt:bd(un.get("stale"));Pe(sc({status:pn,priority:ze(me.filters.priority),type:ze(me.filters.type),assignee:ze(me.filters.assignee),project:ze(me.filters.project),tags:ze(me.filters.tags),activity:mn==="fresh"||mn==="stale"?mn:"all"})),queueMicrotask(()=>{C.current=y})}),()=>{B=!0}},[y]);const ht=p.useCallback(B=>{(y===null?kE(B):SE(y,B)).catch(me=>{console.warn("Failed to persist view prefs:",me)})},[y]),Gc=p.useCallback(B=>{_(B),ht({defaultView:B})},[_,ht]),tl=p.useRef(null);tl.current={status:K,priority:F,type:Z,assignee:G,project:H,tags:U,activity:ye,dateRange:ge,search:D};const Yc=p.useCallback((B={})=>{const J=tl.current;return{status:J.status,priority:J.priority,type:J.type,assignee:J.assignee,project:J.project,tags:J.tags,activity:J.activity,dateRange:la(J.dateRange),search:J.search,...B}},[]),on=p.useCallback((B={})=>{Pe(sc(Yc(B)))},[Yc]),Qc=p.useCallback(B=>{I(B),ht({filters:{status:B}}),on({status:B})},[ht,on]),Jc=p.useCallback(B=>{q(B),ht({filters:{priority:B}}),on({priority:B})},[ht,on]),Xc=p.useCallback(B=>{z(B),ht({filters:{type:B}}),on({type:B})},[ht,on]),bp=p.useCallback(B=>{L(B),ht({filters:{assignee:B}}),on({assignee:B})},[ht,on]),vp=p.useCallback(B=>{re(B),ht({filters:{project:B}}),on({project:B})},[ht,on]),tn=p.useCallback(B=>{ue(B),ht({filters:{tags:B}}),on({tags:B})},[ht,on]),wp=p.useCallback(B=>{Se(B),ht({filters:{activity:B}}),on({activity:B})},[ht,on]),nl=p.useCallback(B=>{V(B),on({search:B})},[on]),Zc=p.useCallback(B=>{se(B),on({dateRange:la(B)})},[on]),qs=p.useCallback(B=>{ct(B),ht({sortField:B})},[ht]),va=p.useCallback(B=>{ot(B),ht({sortDirection:B})},[ht]),eu=p.useCallback(B=>{Fe(B),ht({grouping:B})},[ht]),wa=p.useCallback(B=>{Pe(B);const J=oc(B);J&&(I(ze(J.status)),q(ze(J.priority)),z(ze(J.type)),L(ze(J.assignee)),re(ze(J.project)),ue(ze(J.tags)),V(J.search??""),Se(J.activity&&J.activity!=="all"?J.activity:"all"),se(op(J.dateRange)))},[]),cn=p.useMemo(()=>oc(Te)!==null,[Te]),ja=p.useCallback(()=>{const J=oc(Te)!==null?{status:K,priority:F,type:Z,assignee:G,project:H,tags:U,activity:ye,dateRange:la(ge),search:D}:{};return{viewMode:$,filters:{...J,query:Te},sortField:Ke,sortDirection:et,listSectionVisibility:{collapsed:[...Je]},kanbanColumnVisibility:X,tableColumnVisibility:Ce}},[$,Te,K,F,Z,G,H,U,ye,ge,D,Ke,et,Je,X,Ce]),Bn=p.useCallback(B=>{eC(B,{setViewMode:_,setQuery:Pe,setStatusFilter:J=>{I(J),ht({filters:{status:J}})},setPriorityFilter:J=>{q(J),ht({filters:{priority:J}})},setTypeFilter:J=>{z(J),ht({filters:{type:J}})},setAssigneeFilter:J=>{L(J),ht({filters:{assignee:J}})},setProjectFilter:J=>{re(J),ht({filters:{project:J}})},setTagsFilter:J=>{ue(J),ht({filters:{tags:J}})},setActivityFilter:J=>{Se(J),ht({filters:{activity:J}})},setDateRange:se,setSearch:V,setSortField:qs,setSortDirection:va,setListSectionVisibility:J=>Ot(new Set(J.collapsed)),setKanbanColumnVisibility:Me,setTableColumnVisibility:Ie}),ve(B.id)},[_,ht,qs,va]),jp=p.useCallback(B=>{Bn(B),Ts.current=B.id,g(J=>{const me=new URLSearchParams(J);return me.set("loadView",B.id),me},{replace:!0})},[Bn,g]),kp=p.useCallback(async B=>{try{const J=Oi({name:B,context:{workspace:e??null,projectSlug:null},state:ja()}),me=await Pi(J),_e=me.views[me.views.length-1];ve((_e==null?void 0:_e.id)??null),_e&&(Ts.current=_e.id,g(ft=>{const vt=new URLSearchParams(ft);return vt.set("loadView",_e.id),vt},{replace:!0})),It(!1),jt(!1),Y(`Saved view "${B}"`,"success")}catch(J){throw Y(J instanceof Error?J.message:"Failed to save view","error"),J}},[ja,g,Y,e]),Sp=p.useCallback(async()=>{if(!(!tt||!bt))try{const B=Oi({name:bt.name,context:{workspace:e??null,projectSlug:null},state:ja()}),J=lf(bt.config,B.config,B.config);await ef(tt,{config:J}),Y("View updated","success")}catch(B){Y(B instanceof Error?B.message:"Failed to update view","error")}},[ja,bt,tt,Y,e]);p.useEffect(()=>{if(!Rt){Ts.current=null;return}if(Ts.current!==Rt&&(tt&&tt!==Rt&&ve(null),!Ue)){if(nt){Y("Couldn't load saved view — try again","error");return}if(oe){Ts.current=Rt,Bn(oe),g(B=>{const J=new URLSearchParams(B);return J.delete("loadView"),J},{replace:!0});return}Ts.current=Rt,Y("Saved view no longer exists","error"),g(B=>{const J=new URLSearchParams(B);return J.delete("loadView"),J},{replace:!0})}},[Rt,oe,Ue,nt,tt,Bn,g,Y]);const Yn=p.useMemo(()=>yt.filter(B=>e?e==="_ungrouped"?B.projectWorkspace===null:B.projectWorkspace===e:!0),[yt,e]),ka=p.useMemo(()=>Array.from(new Set(Yn.map(B=>B.status))).sort(),[Yn]),Gs=p.useMemo(()=>Array.from(new Set(Yn.map(B=>B.priority))).sort(),[Yn]),Do=p.useMemo(()=>Array.from(new Set(Yn.map(B=>B.assignee??"__unassigned__"))).sort(),[Yn]),tu=p.useMemo(()=>Array.from(new Map(Yn.filter(B=>B.projectSlug!==null).map(B=>[B.projectSlug,B.projectTitle]))).sort(([,B],[,J])=>B.localeCompare(J)),[Yn]),nu=p.useMemo(()=>Array.from(new Set(Yn.flatMap(B=>B.tags??[]))).sort(),[Yn]),$o=p.useMemo(()=>qN(d.factDeclarations),[d.factDeclarations]),rl=p.useMemo(()=>Te.trim()===""?null:Vx(Te,$o).query,[Te,$o]),Jt=p.useMemo(()=>WN(yt,rl,{workspace:e}),[yt,rl,e]),Gr=p.useMemo(()=>Uc(Jt,Ke,et),[Jt,Ke,et]),sl=p.useMemo(()=>{if(Ye==="none")return[{id:"__all__",label:"All assignments",items:Jt}];if(Ye==="type"){const B=m.definitions.map(_e=>({id:_e.id,label:Ni(m,_e.id),items:Jt.filter(ft=>ft.type===_e.id)})),J=new Set(m.definitions.map(_e=>_e.id)),me=Jt.filter(_e=>!_e.type||!J.has(_e.type));return me.length>0&&B.push({id:S,label:"Other",items:me}),B}if(Ye==="priority")return["critical","high","medium","low"].map(J=>({id:J,label:J.charAt(0).toUpperCase()+J.slice(1),items:Jt.filter(me=>me.priority===J)}));if(Ye==="assignee")return Array.from(new Set(Jt.map(J=>J.assignee??"__unassigned__"))).sort().map(J=>({id:J,label:J==="__unassigned__"?"Unassigned":J,items:Jt.filter(me=>(me.assignee??"__unassigned__")===J)}));if(Ye==="project"){const B=new Map;for(const J of Jt){const me=J.projectSlug??"__standalone__",_e=J.projectTitle??"Standalone";B.has(me)||B.set(me,_e)}return Array.from(B.entries()).sort(([,J],[,me])=>J.localeCompare(me)).map(([J,me])=>({id:J,label:me,items:Jt.filter(_e=>(_e.projectSlug??"__standalone__")===J)}))}return j.map(B=>({id:B,label:v[B]??B,items:Jt.filter(J=>J.status===B)}))},[Ye,Jt,m,j,v]),ol=p.useMemo(()=>{const B=new Set(m.definitions.map(me=>me.id));return Jt.some(me=>!me.type||!B.has(me.type))?[...E,{id:S,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Jt]),{visibleItems:Pt,visibleIndexByKey:al}=p.useMemo(()=>{let B;if($==="table")B=Gr;else if($==="kanban"){const me=new Set(m.definitions.map(_e=>_e.id));Ze==="type"?B=[...m.definitions.flatMap(_e=>Jt.filter(ft=>ft.type===_e.id)),...Jt.filter(_e=>!_e.type||!me.has(_e.type))]:B=j.flatMap(_e=>Jt.filter(ft=>ft.status===_e))}else B=sl.flatMap(me=>me.items);const J=new Map;return B.forEach((me,_e)=>J.set(ln(me),_e)),{visibleItems:B,visibleIndexByKey:J}},[$,Gr,sl,Ze,m,Jt,j]),{hotkeyRowProps:Sa}=$c(Pt,{scope:"list:assignments",onOpen:B=>{if(B.projectSlug===null){n(`/assignments/${B.id}`);return}const J=B.projectWorkspace?`/w/${B.projectWorkspace}`:t;n(`${J}/projects/${B.projectSlug}/assignments/${B.slug}`)}});if(Yt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var B;return(B=s.current)==null?void 0:B.focus()}}),Yt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),i)return r.jsx(xt,{label:"Loading assignments board…"});if(c||!o)return r.jsx(Tt,{error:c||"Assignments board is unavailable."});async function Na({item:B,toColumnId:J,action:me,reason:_e}){he(ln(B));const ft=yt;dt(vt=>vt.map(Mt=>ln(Mt)===ln(B)?{...Mt,status:J,blockedReason:J==="blocked"?_e??Mt.blockedReason:null}:Mt));try{if(B.projectSlug===null){if(!me)throw new Error("Standalone assignments require a transition action, not status override.");const Mt=await fetch(`/api/assignments/${encodeURIComponent(B.id)}/transitions/${encodeURIComponent(me.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_e?{reason:_e}:{})});if(!Mt.ok)throw new Error((await Mt.json()).error??`HTTP ${Mt.status}`);const un=(await Mt.json()).assignment;dt(pn=>pn.map(mn=>ln(mn)===ln(B)?{...mn,status:un.status,blockedReason:un.blockedReason,availableTransitions:un.availableTransitions,updated:un.updated}:mn));return}const vt=me?await TE(B.projectSlug,B.slug,me,_e):await RE(B.projectSlug,B.slug,J);return dt(Mt=>Mt.map(hr=>ln(hr)===ln(B)?{...hr,status:vt.status,blockedReason:vt.blockedReason,availableTransitions:vt.availableTransitions,updated:vt.updated}:hr)),u(),!0}catch(vt){return dt(ft),Y(vt.message,"error"),!1}finally{he(null)}}async function Ys({item:B,toColumnId:J,action:me}){if(B.status===J)return;const _e=me??Hl(B,J);if(_e!=null&&_e.disabled){Y(_e.disabledReason||`Cannot move this assignment to ${J}.`,"error");return}if(_e&&AE(_e)){at({item:B,toColumnId:J,action:_e});return}await Na({item:B,toColumnId:J,action:_e})}async function Ca(B,J){if(J===B.title)return;const me=ln(B),_e=yt;dt(ft=>ft.map(vt=>ln(vt)===me?{...vt,title:J}:vt)),he(me);try{const ft=B.projectSlug===null?await H8({id:B.id,title:J}):await V8({projectSlug:B.projectSlug,assignmentSlug:B.slug,title:J});dt(vt=>vt.map(Mt=>ln(Mt)===me?{...Mt,title:ft.title,updated:ft.updated}:Mt)),u()}catch(ft){throw dt(_e),Y(ft.message,"error"),ft}finally{he(null)}}function ru(B){Ot(J=>{const me=new Set(J);return me.has(B)?me.delete(B):me.add(B),me})}function il(B){Ke===B?va(et==="asc"?"desc":"asc"):(qs(B),va("asc"))}const In=De?yt.find(B=>ln(B)===De)??null:null;function us(B,J){B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",J),ut(J)}function Pr(){ut(null),be(null)}function ds(B,J){if(!In)return;const me=Hl(In,J);In.status===J||me!=null&&me.disabled||(B.preventDefault(),B.dataTransfer.dropEffect="move",be(J))}function Lo(B,J){ae===J&&!B.currentTarget.contains(B.relatedTarget)&&be(null)}function Oo(B,J){if(B.preventDefault(),!In||In.status===J){Pr();return}Pr(),Ys({item:In,toColumnId:J})}function Un({field:B,children:J}){const me=Ke===B;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>il(B),className:"inline-flex items-center gap-1 hover:text-foreground",children:[J,me?et==="asc"?r.jsx(Ak,{className:"h-3 w-3"}):r.jsx(pr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Ee,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(iy,{children:[r.jsx(CU,{className:"w-full md:min-w-[320px] md:flex-1",value:Te,onChange:wa,registry:$o,declarations:d.factDeclarations,valueSources:{statuses:d.order,priorities:Gs,types:m.definitions.map(B=>B.id),assignees:Do.filter(B=>B!=="__unassigned__"),projects:tu.map(([B])=>B),tags:nu}}),cn?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(ap,{ref:s,value:D,onChange:cn?nl:()=>{},placeholder:"Search assignments or projects"}),r.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!cn,options:ka.map(B=>({value:B,label:v[B]??B})),value:K,onChange:Qc}),r.jsx(yn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!cn,options:Gs.map(B=>({value:B,label:B[0].toUpperCase()+B.slice(1)})),value:F,onChange:Jc}),r.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!cn,options:m.definitions.map(B=>({value:B.id,label:Ni(m,B.id)})),value:Z,onChange:Xc}),r.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!cn,options:[{value:"__unassigned__",label:"Unassigned"},...Do.filter(B=>B!=="__unassigned__").map(B=>({value:B,label:B}))],value:G,onChange:bp}),r.jsx(yn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!cn,options:[{value:"__standalone__",label:"Standalone"},...tu.map(([B,J])=>({value:B,label:J}))],value:H,onChange:vp}),r.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!cn,options:nu.map(B=>({value:B,label:B})),value:U,onChange:tn}),r.jsx(sp,{className:"max-w-[200px]",value:ge,onChange:cn?Zc:()=>{}}),r.jsxs("select",{value:ye,disabled:!cn,onChange:B=>wp(B.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:$==="kanban"?Ze:Ye,onChange:B=>eu(B.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:vO.map(B=>{const J=$==="kanban"&&B!=="status"&&B!=="type",me=B==="none"?"No grouping":`Group: ${B.charAt(0).toUpperCase()+B.slice(1)}`;return r.jsx("option",{value:B,disabled:J,children:J?`${me} (list only)`:me},B)})}),r.jsx(ip,{value:$,onChange:B=>Gc(B),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),$==="table"?r.jsx(yE,{visibility:Ce,onChange:Ie}):null,r.jsx(CE,{scope:wn,loadedViewId:tt,onApply:jp,onOpenSaveDialog:()=>{jt(!1),It(!0)}}),r.jsx("button",{type:"button",onClick:()=>{bt?Sp():(jt(!1),It(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:bt?`Update ${bt.name}`:"Save current view",children:bt?`Update '${bt.name}'`:"Save view"}),bt?r.jsx("button",{type:"button",onClick:()=>{jt(!0),It(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),o.assignments.length===0?r.jsx(Et,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ee,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(sx,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Jt.length===0?r.jsx(Et,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):$==="table"?(()=>{const B=new Set(Ce.hidden),J=me=>me==="title"||!B.has(me);return r.jsx(He,{title:`${Gr.length} assignment${Gr.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[J("title")?r.jsx(Un,{field:"title",children:"Assignment"}):null,J("status")?r.jsx(Un,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),J("priority")?r.jsx(Un,{field:"priority",children:"Priority"}):null,J("assignee")?r.jsx(Un,{field:"assignee",children:"Assignee"}):null,J("dependencies")?r.jsx(Un,{field:"dependencies",children:"Dependencies"}):null,J("created")?r.jsx(Un,{field:"created",children:"Created"}):null,J("updated")?r.jsx(Un,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gr.map((me,_e)=>r.jsxs(RU,{detailHref:jc(me),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Sa(_e),children:[J("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(YE,{title:me.title,detailHref:jc(me),onSave:ft=>Ca(me,ft),disabled:ne===ln(me)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:me.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:me.id,children:[me.id.slice(0,8),r.jsx(Br,{value:me.id})]})]}):null,J("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:me.status,disabled:ne===ln(me),onChange:ft=>Ys({item:me,toColumnId:ft.target.value}),className:we("appearance-none rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide outline-none","cursor-pointer bg-[length:12px] bg-[right_6px_center] bg-no-repeat pr-6",`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E")]`,(of[me.status]??of.pending).className,ne===ln(me)&&"animate-pulse opacity-60"),children:j.map(ft=>{const vt=me.status===ft?void 0:Hl(me,ft),Mt=(vt==null?void 0:vt.disabled)??!1;return r.jsx("option",{value:ft,disabled:Mt,title:Mt?(vt==null?void 0:vt.disabledReason)??void 0:void 0,children:v[ft]},ft)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ga,{type:me.type,compact:!0})}),J("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:me.priority}):null,J("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:me.assignee??"Unassigned"}):null,J("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:me.dependsOn.length}):null,J("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:zn(me.created)}):null,J("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:zn(me.updated)}):null]},ln(me)))})]})})})})():$==="list"?r.jsx("div",{className:"space-y-3",children:sl.map(({id:B,label:J,items:me})=>{var un;if(me.length===0&&!(In&&Ye==="status"))return null;const _e=!Je.has(B),ft=Ye==="status",vt=ft&&In?In.status!==B&&!((un=Hl(In,B))!=null&&un.disabled):!1,Mt=ft&&In?In.status!==B&&!vt:!1,hr=ft&&ae===B;return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/90 transition",hr&&vt&&"ring-2 ring-ring/30",Mt&&"border-dashed opacity-65"),onDragOver:ft?pn=>ds(pn,B):void 0,onDragLeave:ft?pn=>Lo(pn,B):void 0,onDrop:ft?pn=>Oo(pn,B):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>ru(B),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(pr,{className:`h-4 w-4 text-muted-foreground transition-transform ${_e?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:J}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:me.length})]}),_e&&me.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:me.map(pn=>{const mn=ln(pn),Io=De===mn,su=al.get(mn)??-1,Ea=ft;return r.jsx("div",{draggable:Ea,onDragStart:Ea?fs=>us(fs,mn):void 0,onDragEnd:Ea?Pr:void 0,...su>=0?Sa(su):{},className:we("transition",Ea&&"cursor-grab active:cursor-grabbing",Io&&"scale-[0.98] opacity-50"),children:r.jsx(M0,{assignment:pn,dragging:Io,transitioning:ne===mn,onPillSelect:fs=>void Ys({item:pn,toColumnId:fs.targetStatus,action:fs}),onRenameTitle:fs=>Ca(pn,fs)})},mn)})})]},B)})}):r.jsx(tp,{columns:Ze==="type"?ol:k,items:Jt,getItemId:ln,getColumnId:B=>Ze==="type"?B.type&&m.definitions.some(J=>J.id===B.type)?B.type:S:B.status,canDrop:({item:B,fromColumnId:J,toColumnId:me})=>{if(J===me)return{allowed:!0};const _e=Hl(B,me);return _e!=null&&_e.disabled?{allowed:!1,reason:_e.disabledReason||_e.description}:{allowed:!0,reason:_e?_e.warning||_e.description:`Move to ${me} (direct status change).`}},onMove:Ze==="type"?void 0:({item:B,toColumnId:J})=>Ys({item:B,toColumnId:J}),dragDisabled:Ze==="type",getExternalDragData:B=>B.projectSlug===null?{type:"standalone-assignment",id:B.id}:{type:"project-assignment",id:B.id},onCardContextMenu:(B,J)=>{J.preventDefault(),kt({item:B,anchor:{x:J.clientX,y:J.clientY}})},emptyMessage:B=>`No ${B.title.toLowerCase()} assignments.`,hiddenColumnIds:X.hidden,onHideColumn:B=>Me(J=>({hidden:J.hidden.includes(B)?J.hidden.filter(_e=>_e!==B):[...J.hidden,B]})),renderCard:(B,{dragging:J})=>{const me=al.get(ln(B))??-1;return r.jsx("div",{...me>=0?Sa(me):{},children:r.jsx(M0,{assignment:B,dragging:J,transitioning:ne===ln(B),onPillSelect:_e=>void Ys({item:B,toColumnId:_e.targetStatus,action:_e}),onRenameTitle:_e=>Ca(B,_e)})})}}),r.jsx(xa,{toast:le,onDismiss:fe}),r.jsx(NE,{open:Nt,onOpenChange:B=>{It(B),B||jt(!1)},initialName:en&&bt?`${bt.name} (copy)`:"",title:en?"Save as new view":"Save view",onSubmit:kp}),r.jsx(OE,{open:Le!==null,action:(Le==null?void 0:Le.action)??null,assignmentTitle:(Le==null?void 0:Le.item.title)??"Assignment",loading:ne===(Le?ln(Le.item):null),onOpenChange:B=>{B||at(null)},onConfirm:async B=>{if(!Le)return;const J=Le;await Na({item:J.item,toColumnId:J.toColumnId,action:J.action,reason:B})&&at(null)}}),r.jsx(iC,{anchor:(Be==null?void 0:Be.anchor)??null,items:Be?TU(Be.item,{onEdit:()=>{const B=Be.item,J=B.projectSlug===null?`/assignments/${B.id}`:`${B.projectWorkspace?`/w/${B.projectWorkspace}`:t}/projects/${B.projectSlug}/assignments/${B.slug}`;n(J)},onDelete:()=>_t(Be.item),onMove:()=>Oe(Be.item)}):[],onClose:()=>kt(null)}),r.jsx(ba,{open:St!==null,title:"Delete assignment?",description:St?`"${St.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:pe!==null,onOpenChange:B=>{!B&&pe===null&&_t(null)},onConfirm:async()=>{if(!St||St.projectSlug===null){_t(null);return}const B=ln(St);te(B);try{const J=await fetch(`/api/projects/${encodeURIComponent(St.projectSlug)}/assignments/${encodeURIComponent(St.slug)}`,{method:"DELETE"});if(!J.ok){const me=await J.json().catch(()=>({}));throw new Error(me.error||"Failed to delete assignment")}_t(null),u()}catch(J){alert(J instanceof Error?J.message:"Failed to delete assignment")}finally{te(null)}}}),r.jsx(cy,{open:xe!==null,onOpenChange:B=>{B||Oe(null)},currentWorkspace:(xe==null?void 0:xe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async B=>{if(!xe)return;const J=await fetch(`/api/assignments/${encodeURIComponent(xe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:B})});if(!J.ok){const me=await J.json().catch(()=>({}));throw new Error(me.error||"Failed to move assignment")}u()}})]})}function TU(e,t){const n=[{key:"edit",label:"Edit",icon:zi,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:Tn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:jf,onSelect:t.onMove}),n}function RU({detailHref:e,children:t,className:n,...s}){const o=QE(e);return r.jsx("tr",{...s,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function M0({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:o}){var d;const i=jc(e),c=!!(s&&o),u=QE(i);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:we("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(YE,{title:e.title,detailHref:i,onSave:o,disabled:n}):r.jsx(Ee,{to:i,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(d=e.id)==null?void 0:d.slice(0,8),e.id&&r.jsx(Br,{value:e.id})]})]}),c?r.jsx(yU,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n,className:"max-w-[150px]"}):r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ga,{type:e.type}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),r.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),r.jsx("span",{children:zn(e.updated)})]})]})}function Hl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function ln(e){return e.id||e.slug||"unknown"}function Kr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),o=n.split(`
|
|
581
|
+
`),i=[],c=new Map;let u=null,d=[];const m=()=>{u&&(i.push(u),c.set(u,d))};for(const h of o){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],d=[h];continue}u&&d.push(h)}return m(),{order:i,blocks:c,body:s}}function Xi(e){return`---
|
|
582
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
583
|
+
`)}
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
${e.body.replace(/^\n+/,"")}`}function Cn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const o=s[1].trim();return o==="null"?"":o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.slice(1,-1):o}function AU(e,t){return Cn(e,t)==="true"}function uc(e,t){const n=e.blocks.get(t);return n!=null&&n.length?n[0].trim().endsWith("[]")?[]:n.slice(1).map(s=>s.trim()).filter(s=>s.startsWith("- ")).map(s=>s.slice(2).trim()):[]}function PU(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":/^\d{4}-\d{2}-\d{2}T/.test(e)?`"${e}"`:/[:#{}[\],&*?|>!%@`]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function En(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${PU(n)}`])}function dc(e,t,n){if(e.blocks.has(t)||e.order.push(t),n.length===0){e.blocks.set(t,[`${t}: []`]);return}e.blocks.set(t,[`${t}:`,...n.map(s=>` - ${s}`)])}function fc(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function mp(e){const t=Kr(e);return{title:Cn(t,"title"),slug:Cn(t,"slug"),workspace:Cn(t,"workspace"),archived:AU(t,"archived"),archivedAt:Cn(t,"archivedAt"),archivedReason:Cn(t,"archivedReason"),tags:uc(t,"tags").join(", "),body:t.body}}function DU(e,t){const n=Kr(e),s={...mp(e),...t};return En(n,"title",s.title),En(n,"slug",s.slug),En(n,"workspace",s.workspace||null),En(n,"archived",s.archived),En(n,"archivedAt",s.archivedAt||null),En(n,"archivedReason",s.archivedReason||null),dc(n,"tags",fc(s.tags)),n.body=s.body,Xi(n)}function hp(e){const t=Kr(e);return{title:Cn(t,"title"),slug:Cn(t,"slug"),status:Cn(t,"status"),priority:Cn(t,"priority")||"medium",assignee:Cn(t,"assignee"),dependsOn:uc(t,"dependsOn").join(", "),links:uc(t,"links").join(", "),blockedReason:Cn(t,"blockedReason"),tags:uc(t,"tags").join(", "),body:t.body}}function $U(e,t){const n=Kr(e),s={...hp(e),...t};return En(n,"title",s.title),En(n,"slug",s.slug),En(n,"status",s.status),En(n,"priority",s.priority),En(n,"assignee",s.assignee||null),dc(n,"dependsOn",fc(s.dependsOn)),dc(n,"links",fc(s.links)),En(n,"blockedReason",s.blockedReason||null),dc(n,"tags",fc(s.tags)),n.body=s.body,Xi(n)}function gp(e){const t=Kr(e);return{assignment:Cn(t,"assignment"),status:Cn(t,"status"),body:t.body}}function LU(e,t){const n=Kr(e),s={...gp(e),...t};return En(n,"assignment",s.assignment),En(n,"status",s.status),n.body=s.body,Xi(n)}function xp(e){const t=Kr(e);return{assignment:Cn(t,"assignment"),body:t.body}}function OU(e,t){const n=Kr(e),s={...xp(e),...t};return En(n,"assignment",s.assignment),n.body=s.body,Xi(n)}function yp(e){const t=Kr(e);return{name:Cn(t,"name"),slug:Cn(t,"slug"),description:Cn(t,"description"),whenToUse:Cn(t,"when_to_use"),tags:uc(t,"tags").join(", "),body:t.body}}function IU(e,t){const n=Kr(e),s={...yp(e),...t};return En(n,"name",s.name),En(n,"slug",s.slug),En(n,"description",s.description||null),En(n,"when_to_use",s.whenToUse||null),dc(n,"tags",fc(s.tags)),n.body=s.body,Xi(n)}function zy(e){return{body:Kr(e).body}}function JE(e){return zy(e)}function XE(e,t){const n=Kr(e);return t.body!==void 0&&(n.body=t.body),Xi(n)}function _U(e,t){return XE(e,t)}function Gt(e,t,n){switch(e){case"project":return DU(t,n);case"assignment":return $U(t,n);case"plan":return LU(t,n);case"scratchpad":return OU(t,n);case"playbook":return IU(t,n);case"memory":return XE(t,n);case"resource":return _U(t,n);default:return t}}function Zi({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:o,error:i,title:c,description:u,onCancel:d,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=p.useState(e),[C,j]=p.useState(!1),[v,k]=p.useState("edit");p.useEffect(()=>{b(e)},[e]);const E=BU(t,y),S=y!==e,T=zU(t,y),A=S?"Unsaved changes":n==="create"?"Draft":"Saved",R=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:c}),r.jsx("span",{className:"rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:A})]}),u?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:u}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:d,className:"shell-action",children:[r.jsx(zd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"shell-action",children:[r.jsx(YA,{className:"h-4 w-4"}),r.jsx("span",{children:C?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:o||E.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(Sf,{className:"h-4 w-4"}),r.jsx("span",{children:o?"Saving…":"Save"})]})]})]}),i?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:i}):null,E.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:E.map(P=>r.jsx("li",{children:P},P))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${v==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${v==="preview"?"shell-action--cta":""}`,children:[r.jsx(yw,{className:"h-4 w-4"}),"Preview"]})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[r.jsx("div",{className:v==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:C?r.jsx("textarea",{value:y,onChange:P=>b(P.target.value),className:"min-h-[720px] w-full rounded-md border border-border/70 bg-background/90 p-4 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30",spellCheck:!1}):r.jsx(MU,{documentType:t,content:y,onChange:b,allowSlugEdit:g})})}),r.jsx("div",{className:v==="edit"?"hidden md:block":"",children:r.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(yw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(xn,{content:T,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function MU({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const i=mp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Wl,{children:[r.jsx(Ft,{label:"Project title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,d={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(d.slug=wr(u)),n(Gt(e,t,d))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:c=>n(Gt(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is the folder name and URL-safe identifier. It is locked after creation so links and file paths stay stable."})]})}),r.jsx(Ft,{label:"Tags",children:r.jsx("input",{value:i.tags,onChange:c=>n(Gt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(FU,{value:i.workspace,onChange:c=>n(Gt(e,t,{workspace:c}))})]}),r.jsx(Ft,{label:"Project body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const i=hp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Wl,{children:[r.jsx(Ft,{label:"Assignment title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,d={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(d.slug=wr(u)),n(Gt(e,t,d))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:c=>n(Gt(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the assignment folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is locked after creation because assignment paths and dependency references use it as a stable identifier."})]})}),r.jsx(Ft,{label:"Status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Gt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"review",children:"Review"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})}),r.jsx(Ft,{label:"Priority",children:r.jsxs("select",{value:i.priority,onChange:c=>n(Gt(e,t,{priority:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"low",children:"Low"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"critical",children:"Critical"})]})}),r.jsx(Ft,{label:"Assignee",children:r.jsx("input",{value:i.assignee,onChange:c=>n(Gt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(Ft,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:i.dependsOn,onChange:c=>n(Gt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(Ft,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:i.links,onChange:c=>n(Gt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(Ft,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:i.blockedReason,onChange:c=>n(Gt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:i.tags,onChange:c=>n(Gt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(Ft,{label:"Assignment body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const i=gp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Wl,{children:[r.jsx(Ft,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(Ft,{label:"Plan status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Gt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"draft",children:"Draft"}),r.jsx("option",{value:"approved",children:"Approved"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"})]})})]}),r.jsx(Ft,{label:"Plan body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const i=xp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Wl,{children:r.jsx(Ft,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(Ft,{label:"Scratchpad body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const i=e==="memory"?zy(t):JE(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ft,{label:c,children:r.jsx("textarea",{value:i.body,onChange:u=>n(Gt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const o=yp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Wl,{children:[r.jsx(Ft,{label:"Playbook name",children:r.jsx("input",{value:o.name,onChange:i=>{const c=i.target.value,u={name:c};s&&(o.slug===wr(o.name)||!o.slug.trim())&&(u.slug=wr(c)),n(Gt(e,t,u))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:o.slug,disabled:!s,onChange:i=>n(Gt(e,t,{slug:wr(i.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the filename. It is auto-generated from the name until you change it.":"The slug is locked after creation because it is the filename."})]})}),r.jsx(Ft,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:o.description,onChange:i=>n(Gt(e,t,{description:i.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:o.tags,onChange:i=>n(Gt(e,t,{tags:i.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(Ft,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:o.whenToUse,onChange:i=>n(Gt(e,t,{whenToUse:i.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(Ft,{label:"Playbook rules",children:r.jsx("textarea",{value:o.body,onChange:i=>n(Gt(e,t,{body:i.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Wl({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ft({label:e,children:t,className:n}){return r.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function FU({value:e,onChange:t}){const{data:n}=fa(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(Ft,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(o=>r.jsx("option",{value:o,children:o},o))]})})}function zU(e,t){switch(e){case"project":return mp(t).body;case"assignment":return hp(t).body;case"plan":return gp(t).body;case"scratchpad":return xp(t).body;case"playbook":return yp(t).body;case"memory":return zy(t).body;case"resource":return JE(t).body}}function BU(e,t){switch(e){case"project":{const n=mp(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Ed(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=hp(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Ed(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return gp(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return xp(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=yp(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Ed(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function F0(){const e=zt(),{workspace:t}=Bt(),n=fn(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,d]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
|
|
587
|
+
workspace: ${t}`)),o(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){d(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),d(!1);return}e(`${n}/projects/${C.slug}`)}catch(b){h(b.message),d(!1);return}d(!1)}return i?r.jsx(xt,{label:"Loading project template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Zi,{initialContent:s||"",documentType:"project",mode:"create",onSave:g,saving:u,error:m,title:"Create Project",description:"Projects hold the high-level objective, shared context, and human-authored overview. Put execution details in assignments instead of overloading project.md.",onCancel:()=>e(`${n}/projects`),helpTitle:"Project editing rules",helpBody:"Use this form for project intent, slug, tags, and overview content. If you ever need less common metadata, raw markdown mode still exposes the full file.",allowSlugEdit:!0})}function z0(){const{slug:e}=Bt(),t=fn(),n=zt(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,d]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{o(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}d(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),d(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(b){h(b.message),d(!1);return}d(!1)}return i?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Zi,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Assignment",description:"Assignments are the execution unit. Declare dependencies here, keep status pending until work starts, and use blocked later only for runtime obstacles.",onCancel:()=>n(e?`${t}/projects/${e}`:`${t}/projects`),helpTitle:"Assignment editing rules",helpBody:"Use structured fields for priority, assignee, dependencies, and tags. Status can be changed through lifecycle actions, kanban drag, or the status override.",allowSlugEdit:!0})}function B0(){const{workspace:e}=Bt(),t=fn(),n=zt(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,d]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{o(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;d(!0),h(null);try{const C=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await C.json();if(!C.ok){h(j.error||`HTTP ${C.status}`),d(!1);return}const v=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!v){h("Server did not return the new assignment id."),d(!1);return}n(`/assignments/${v}`)}catch(C){h(C.message),d(!1);return}d(!1)}return i?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Zi,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Standalone Assignment",description:e?`Standalone assignments live outside any project. This one will be tagged with workspaceGroup: ${e} so it appears in this workspace's views.`:"Standalone assignments live outside any project. Add a workspaceGroup to make them appear in workspace-filtered views.",onCancel:()=>n(`${t}/assignments`),helpTitle:"Standalone assignment editing rules",helpBody:"No project field is needed (it must remain null). Use workspaceGroup to group with other workspace work. Status, priority, and tags work the same as project-nested assignments.",allowSlugEdit:!0})}function el({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,documentType:i,helpTitle:c,helpBody:u}){const d=zt(),{data:m,loading:h,error:g}=lS(e),[y,b]=p.useState(!1),[C,j]=p.useState(null);async function v(k){b(!0),j(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}d(n)}catch(E){j(E.message),b(!1);return}b(!1)}return h?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(Tt,{error:g||`${s} is unavailable.`}):r.jsx(Zi,{initialContent:m.content,documentType:i,onSave:v,saving:y,error:C,title:s,description:o,onCancel:()=>d(n),helpTitle:c,helpBody:u})}function U0(){const{slug:e}=Bt(),t=fn(),n=e??"";return r.jsx(el,{loadUrl:`/api/projects/${n}/edit`,saveUrl:`/api/projects/${n}`,redirectTo:`${t}/projects/${n}`,title:"Edit Project",description:"Project edits change the human-authored source document. The structured form stays focused on title, slug, tags, and overview content.",documentType:"project",helpTitle:"Editable vs derived project fields",helpBody:"Project status remains derived from assignment state. If you need less common frontmatter fields, switch to raw markdown mode instead of expanding the structured form."})}function Xh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=o?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(el,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Assignment",description:"Edit assignment fields including status, priority, assignee, dependencies, and body.",documentType:"assignment",helpTitle:"Assignment editing",helpBody:"All fields are editable. Status can also be changed through lifecycle actions or kanban drag."})}function Zh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=o?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(el,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Plan",description:"Plans are separate from assignment status, so keep implementation steps here instead of overloading the assignment body.",documentType:"plan",helpTitle:"Plan status is separate",helpBody:"Plan status tracks the plan document itself. It does not replace the assignment lifecycle state."})}function eg(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=o?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(el,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Scratchpad",description:"Scratchpad is the assignment’s working memory surface for notes, experiments, and temporary context.",documentType:"scratchpad",helpTitle:"Scratchpad usage",helpBody:"Scratchpad is for transient notes. Keep canonical objective and lifecycle data in assignment.md and any active plan files (plan.md, plan-v2.md, ...)."})}function ZE({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,helpTitle:i,helpBody:c}){const u=zt(),{data:d,loading:m,error:h}=lS(e),[g,y]=p.useState(""),[b,C]=p.useState(""),[j,v]=p.useState(!1),[k,E]=p.useState(null);async function S(){v(!0),E(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),A=await T.json();if(!T.ok){E(A.error||`HTTP ${T.status}`),v(!1);return}u(n)}catch(T){E(T.message),v(!1);return}v(!1)}return m?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):h||!d?r.jsx(Tt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(He,{title:s,description:o,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>C(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:S,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(He,{title:"Current Document",children:r.jsx(xn,{content:d.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function tg(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=o?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(ZE,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Append Handoff Entry",description:"Add a new handoff without rewriting previous history.",helpTitle:"Append-only handoff history",helpBody:"Handoff log entries preserve the baton-passing trail between sessions and agents. Add a new entry instead of editing older ones."})}function ng(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=o?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(ZE,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Append Decision Entry",description:"Record a new decision and rationale without editing prior entries.",helpTitle:"Append-only decision history",helpBody:"Decision records should accumulate over time so the implementation rationale remains auditable and reviewable."})}function V0(){const{workspace:e}=Bt(),{data:t}=Cs(),{data:n,loading:s,error:o,refetch:i}=hx(),[c,u]=p.useState(!1),[d,m]=p.useState(""),[h,g]=p.useState(!1),y=Xn();p.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const S=decodeURIComponent(E[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(S)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const A=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(A)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=new Set(t.filter(S=>e==="_ungrouped"?S.workspace===null:S.workspace===e).map(S=>S.slug));return n.sessions.filter(S=>S.windows.some(T=>T.panes.some(A=>A.assignment&&A.assignment.project!==null&&E.has(A.assignment.project))))})();async function C(E){if(E.preventDefault(),!!d.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim()})}),m(""),u(!1),i()}catch{}}async function j(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),i()}finally{g(!1)}}async function v(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),i()}async function k(E){await fetch(`/api/servers/${encodeURIComponent(E)}/refresh`,{method:"POST"}),i()}return s?r.jsx(xt,{label:"Loading servers…"}):o?r.jsx(Tt,{error:o}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c?r.jsxs("form",{onSubmit:C,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:d,onChange:E=>m(E.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>u(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>u(!0),children:[r.jsx(Lt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(Ok,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(Et,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(E=>r.jsx(UU,{session:E,onRefresh:()=>k(E.name),onRemove:()=>v(E.name),onRefetch:i},E.name))})]}):r.jsx(r.Fragment,{children:r.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[r.jsx(gi,{className:"h-10 w-10 text-muted-foreground/40"}),r.jsx("p",{className:"text-sm font-medium text-foreground",children:"tmux is not installed"}),r.jsxs("p",{className:"max-w-md text-sm text-muted-foreground",children:["Server tracking requires tmux. Install it with ",r.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"brew install tmux"})," to get started."]})]})}):null}function UU({session:e,onRefresh:t,onRemove:n,onRefetch:s}){return r.jsxs("div",{className:"surface-panel","data-server-name":e.name,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(lx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e.alive?"border border-success-foreground/30 bg-success text-success-foreground":"border border-error-foreground/30 bg-error text-error-foreground"}`,children:e.alive?"alive":"dead"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:r.jsx(Ok,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&r.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(o=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",o.index,": ",o.name]}),r.jsx("div",{className:"space-y-1.5",children:o.panes.map(i=>r.jsx(VU,{pane:i,sessionName:e.name,windowIndex:o.index,onRefetch:s},`${o.index}:${i.index}`))})]},o.index))}),!e.alive&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(mP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function VU({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const o=fn(),i=e.cwd.replace(/^\/Users\/[^/]+/,"~");return r.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[r.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),r.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:i}),r.jsx(Br,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(ox,{className:"h-3 w-3"}),e.branch,e.worktree&&r.jsx("span",{className:"rounded bg-status-in-progress px-1 py-0.5 text-[10px] font-medium text-status-in-progress-foreground",children:"worktree"})]}),e.ports.length>0&&r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.urls.map(c=>r.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[c.replace("http://localhost:",":"),r.jsx(Mi,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ee,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${o}/projects/${e.assignment.project}/assignments/${e.assignment.slug}`,className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20",children:[r.jsx(rP,{className:"h-2.5 w-2.5"}),e.assignment.title,e.assignment.project===null?r.jsx("span",{className:"ml-1 rounded bg-muted px-1 py-0.5 text-[9px] uppercase tracking-wide text-muted-foreground",children:"Standalone"}):null]}):r.jsx("span",{className:"text-xs text-muted-foreground/40",children:"unlinked"})})]})}function e2(e){return e<60?`${e}s`:e<3600?`${Math.round(e/60)}m`:e<86400?`${Math.round(e/3600)}h`:`${Math.round(e/86400)}d`}function HU(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":e2(s)}function WU(e){switch(e){case"idle":return"bg-green-500/15 text-green-400 border-green-500/30";case"leased":return"bg-amber-500/15 text-amber-400 border-amber-500/30";case"retired":return"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}}function KU(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function H0(){const{data:e,loading:t,error:n,refetch:s}=cS(),[o,i]=p.useState(()=>Date.now()),[c,u]=p.useState(null),[d,m]=p.useState(!1);if(p.useEffect(()=>{const g=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(g)},[]),t)return r.jsx(xt,{label:"Loading inventories…"});if(n)return r.jsx(Tt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(Et,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(qU,{detail:g,now:o,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(ba,{open:c!==null,title:"Force release this lease?",description:c?`This will revoke lease ${c.lease.lease_id} and (if it's still the current holder) free member ${c.lease.member_id}. Any agent still using this lease will see a stale-lease error on its next CLI call.`:"",confirmLabel:"Force release",destructive:!0,loading:d,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function qU({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:o,active_leases:i}=e,c=o.filter(d=>d.status==="idle").length,u=o.filter(d=>d.status==="leased").length;return r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold",children:[r.jsx(kf,{className:"mr-2 inline h-4 w-4 text-muted-foreground"}),s.display_name??s.slug]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[r.jsx("code",{className:"font-mono",children:s.slug})," · kind=",s.kind," · default TTL=",e2(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",u," leased · ",o.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(d=>r.jsx(GU,{member:d},d.member_id))}),i.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),r.jsx("div",{className:"mt-2 space-y-2",children:i.map(d=>r.jsx(YU,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function GU({member:e}){const t=KU(e.metadata_json);return r.jsxs("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-mono",children:e.member_id}),r.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${WU(e.status)}`,children:e.status})]}),t&&r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:Object.entries(t).map(([n,s])=>r.jsxs("div",{className:"truncate",children:[r.jsx("span",{className:"font-mono",children:n}),"=",r.jsx("span",{className:"font-mono",children:String(s)})]},n))})]})}function YU({lease:e,now:t,onForceRelease:n}){return r.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/20 px-3 py-2 text-sm",children:[r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.lease_id.slice(0,8),"…"]}),r.jsx("span",{className:"font-mono",children:e.member_id}),e.requested_for&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["for ",e.requested_for]})]})}),r.jsxs("div",{className:"ml-3 flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(VA,{className:"h-3 w-3"}),HU(e.expires_at,t)]}),r.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 rounded border border-destructive/40 px-2 py-1 text-xs text-destructive hover:bg-destructive/10",children:[r.jsx(xP,{className:"h-3 w-3"}),"Force release"]})]})]})}const QU={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},xo="bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm";function W0(){const[e,t]=ls(),n=m3(e),s=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Cs(),{data:c}=fa(),{data:u}=uS(),[d,m]=p.useState(null),[h,g]=p.useState(!0),[y,b]=p.useState(null);p.useEffect(()=>{if(!e.get("window")){const v=pg({window:"30d",...n});o==="assignment"&&v.set("groupBy","assignment"),t(v,{replace:!0})}},[]);const C=oS({window:s,...n}).toString();p.useEffect(()=>{const v=new AbortController;g(!0),b(null);const k=C?`/api/usage?${C}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(k,{signal:v.signal}).then(async E=>{if(!E.ok){const S=await E.json().catch(()=>({}));throw new Error(S.error??`HTTP ${E.status}`)}return E.json()}).then(E=>{m(E),g(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(b(E instanceof Error?E.message:String(E)),g(!1))}),()=>v.abort()},[C,o]);function j(v,k=o){const E=pg(v);k==="assignment"&&E.set("groupBy","assignment"),t(E)}return r.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[r.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[r.jsx(Rc,{className:"w-6 h-6 text-amber-400"}),r.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Window"}),r.jsx("select",{value:s,onChange:v=>j({...n,window:v.target.value}),className:xo,children:Nf.map(v=>r.jsx("option",{value:v,children:QU[v]},v))})]}),s==="custom"?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Since"}),r.jsx("input",{type:"date",value:n.since??"",onChange:v=>j({...n,window:"custom",since:v.target.value||void 0}),className:xo})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n.until??"",onChange:v=>j({...n,window:"custom",until:v.target.value||void 0}),className:xo})]})]}):null,r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Workspace"}),r.jsxs("select",{value:n.workspace??"",onChange:v=>j({...n,workspace:v.target.value||void 0,project:void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),c!=null&&c.hasUngrouped?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,((c==null?void 0:c.workspaces)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:n.project??"",onChange:v=>j({...n,project:v.target.value||void 0,workspace:void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),(i??[]).map(v=>r.jsx("option",{value:v.slug,children:v.slug},v.slug))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Model"}),r.jsxs("select",{value:n.model??"",onChange:v=>j({...n,model:v.target.value||void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.models)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Tool"}),r.jsxs("select",{value:n.tool??"",onChange:v=>j({...n,tool:v.target.value||void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.tools)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:o,onChange:v=>j(n,v.target.value),className:xo,children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),d&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),d.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data for these filters. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),o==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:d.summary.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:v.projectSlug||"(unattributed)"}),o==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:v.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ri(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ai(v.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),d.daily.length===0?r.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),r.jsx("tbody",{children:d.daily.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:v.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.model}),r.jsx("td",{className:"px-3 py-2",children:v.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:v.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ri(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ai(v.total_cost)})]},k))})]})]})]})]})}function K0(){const{workspace:e}=Bt(),{data:t}=Cs(),{data:n,loading:s,error:o}=Ef(),[i,c]=p.useState(""),[u,d]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState("started_desc"),[b,C]=p.useState(0),[j,v]=p.useState(new Set),[k,E]=p.useState(!1),[S,T]=p.useState(null),[A,R]=p.useState(null),P=(n==null?void 0:n.sessions.some(I=>I.status==="active"))??!1;p.useEffect(()=>{if(!P)return;const I=window.setInterval(()=>C(F=>F+1),3e4);return()=>window.clearInterval(I)},[P]),p.useEffect(()=>{v(I=>{if(I.size===0)return I;const F=new Set((n==null?void 0:n.sessions.map(Z=>Z.sessionId))??[]),q=new Set([...I].filter(Z=>F.has(Z)));return q.size===I.size?I:q})},[n]);const $=p.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const I=i.trim().toLowerCase();return[...n.sessions.filter(q=>{var G;if(e&&t){const L=((G=t.find(H=>H.slug===q.projectSlug))==null?void 0:G.workspace)??null;if(e==="_ungrouped"){if(L!==null)return!1}else if(L!==e)return!1}const Z=XU(q.started);return u&&(!Z||Z<u)||m&&(!Z||Z>m)?!1:I?[q.projectSlug??"",q.assignmentSlug??"",q.agent,q.sessionId,q.path,q.description??"",q.transcriptPath??""].join(" ").toLowerCase().includes(I):!0})].sort((q,Z)=>ZU(q,Z,g))},[n,i,g,u,m,b,e,t]);function M(I){v(F=>{const q=new Set(F);return q.has(I)?q.delete(I):q.add(I),q})}function _(){j.size===$.length&&$.length>0?v(new Set):v(new Set($.map(I=>I.sessionId)))}async function D(I){T(null),E(!0);try{const F=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:I})}),q=await F.json().catch(()=>null);if(!F.ok)throw new Error((q==null?void 0:q.error)||`HTTP ${F.status}`);v(Z=>new Set([...Z].filter(z=>!I.includes(z)))),R(null)}catch(F){T(F.message)}finally{E(!1)}}async function V(I){try{const F=await fetch(`/api/agent-sessions/${encodeURIComponent(I)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!F.ok){const q=await F.json().catch(()=>null);T((q==null?void 0:q.error)||`Failed to mark session stopped: HTTP ${F.status}`)}}catch(F){T(F.message)}}if(s)return r.jsx(xt,{label:"Loading agent sessions..."});if(o)return r.jsx(Tt,{error:o});if(!n)return null;const K=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(iy,{children:[r.jsx(ap,{value:i,onChange:c,placeholder:"Search project, assignment, agent, session ID, path, or description"}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started From",r.jsx("input",{type:"date",value:u,onChange:I=>d(I.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started To",r.jsx("input",{type:"date",value:m,onChange:I=>h(I.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:I=>y(I.target.value),className:"editor-input max-w-[200px]",children:[r.jsx("option",{value:"started_desc",children:"Newest first"}),r.jsx("option",{value:"started_asc",children:"Oldest first"}),r.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),r.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),S?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:S}):null,j.size>0&&r.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>R({sessionIds:[...j],title:`Delete ${j.size} selected session${j.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:j.size===1?"Delete Session":"Delete Sessions"}),disabled:k,children:[r.jsx(Tn,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>v(new Set),children:"Clear Selection"})]}),K?$.length===0?r.jsx(Et,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):r.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[1280px] table-fixed text-sm",children:[r.jsxs("colgroup",{children:[r.jsx("col",{style:{width:"32px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"160px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"110px"}}),r.jsx("col",{style:{width:"130px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"40px"}})]}),r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[r.jsx("th",{className:"pb-2 pr-3",children:r.jsx("button",{onClick:_,className:"text-muted-foreground hover:text-foreground",children:j.size===$.length&&$.length>0?r.jsx(zr,{className:"h-4 w-4"}):r.jsx(cx,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:$.map(I=>r.jsx(JU,{session:I,selected:j.has(I.sessionId),onToggle:()=>M(I.sessionId),onDelete:()=>R({sessionIds:[I.sessionId],title:`Delete session ${I.sessionId.slice(0,8)}...?`,description:`Remove this ${I.agent} session record${I.assignmentSlug?` for ${I.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:V,onCopyError:T},I.sessionId))})]})}):r.jsx(Et,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(ba,{open:A!==null,title:(A==null?void 0:A.title)??"Delete session?",description:(A==null?void 0:A.description)??"",confirmLabel:(A==null?void 0:A.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:I=>{I||R(null)},onConfirm:async()=>{A&&await D(A.sessionIds)}})]})}function JU({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:o,onCopyError:i}){const c=fn(),u=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,d=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",m=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return r.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?r.jsx(zr,{className:"h-4 w-4"}):r.jsx(cx,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ee,{to:`${c}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:Sn(e.projectSlug),children:Sn(e.projectSlug)}):e.assignmentSlug?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wide text-muted-foreground",children:"Standalone"}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug&&e.assignmentSlug?r.jsx(Ee,{to:`${c}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:Sn(e.assignmentSlug),children:Sn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Ee,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.description?r.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(vf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:u}),r.jsx(Br,{value:e.sessionId}),r.jsx(EE,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>i(h.message),onNotice:h=>i(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Ur(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:d}),e.path&&r.jsx(Br,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx(Br,{value:e.transcriptPath})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(DE,{session:e,onMarkStopped:o}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})})]})}function XU(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${o}`}function vd(e){const t=Date.parse(e.started),n=e.ended?Date.parse(e.ended):Date.now();return Number.isNaN(t)||Number.isNaN(n)?0:Math.max(0,Math.floor((n-t)/6e4))}function ZU(e,t,n){switch(n){case"started_asc":return e.started.localeCompare(t.started);case"started_desc":return t.started.localeCompare(e.started);case"duration_asc":return vd(e)-vd(t);case"duration_desc":return vd(t)-vd(e);case"assignment_asc":return(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"")||(e.projectSlug??"").localeCompare(t.projectSlug??"");case"agent_asc":return e.agent.localeCompare(t.agent)||(e.assignmentSlug??"").localeCompare(t.assignmentSlug??"");default:return 0}}function e7(){const{data:e,loading:t,error:n,refetch:s}=gx(),[o,i]=p.useState(""),[c,u]=p.useState(null),[d,m]=p.useState(null),[h,g]=p.useState(null),y=p.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!o.trim())return e.playbooks;const j=o.toLowerCase();return e.playbooks.filter(v=>v.name.toLowerCase().includes(j)||v.description.toLowerCase().includes(j)||v.slug.toLowerCase().includes(j)||v.tags.some(k=>k.toLowerCase().includes(j)))},[e,o]);async function b(j,v,k){if(j.preventDefault(),j.stopPropagation(),!c){u(v);try{const E=k?"disable":"enable",S=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!S.ok){const T=await S.json().catch(()=>({}));throw new Error(T.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{u(null)}}}async function C(){if(d){g(d.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(d.slug)}`,{method:"DELETE"});if(!j.ok){const v=await j.json().catch(()=>({}));throw new Error(v.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(xt,{label:"Loading playbooks..."}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange:j=>i(j.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs(Ee,{to:"/playbooks/create",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Ee,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(Dk,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:"auto-generated"})]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[11px]",children:"~/.syntaur/playbooks/manifest.md"})," in your CLAUDE.md for agent context."]})]})]}),y.length===0?r.jsx(Et,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(Ee,{to:"/playbooks/create",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:y.map(j=>{const v=c===j.slug,k=[{key:"delete",label:"Delete",icon:Tn,destructive:!0,onSelect:()=>m({slug:j.slug,name:j.name})}];return r.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${j.enabled?"":"opacity-75"}`,children:[r.jsx("div",{className:"absolute right-3 top-3 z-10",children:r.jsx(ry,{items:k})}),r.jsxs(Ee,{to:`/playbooks/${j.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Tk,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:j.name}),j.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:j.description}):null]})]}),r.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.tags.slice(0,3).map(E=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(Ik,{className:"h-2.5 w-2.5"}),E]},E)),j.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",j.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":j.enabled,"aria-label":j.enabled?"Disable playbook":"Enable playbook",onClick:E=>b(E,j.slug,j.enabled),disabled:v,className:`absolute bottom-3 right-3 z-10 inline-flex h-5 w-9 items-center rounded-full border opacity-100 transition disabled:opacity-50 ${j.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${j.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},j.slug)})}),r.jsx(ba,{open:d!==null,title:"Delete playbook?",description:d?`"${d.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:C,onOpenChange:j=>{j||m(null)}})]})}function t7(){const{slug:e}=Bt(),t=zt(),{data:n,loading:s,error:o,refetch:i}=N3(e),[c,u]=p.useState(!1),[d,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(!1),[C,j]=p.useState(""),[v,k]=p.useState(!1),[E,S]=p.useState(null),T=e==="manifest";p.useEffect(()=>{y&&(j(e??""),S(null))},[y,e]);const A=wr(C),R=A.length>0&&Ed(A)&&A!=="manifest",P=A!==e;async function $(){if(!(!e||!R||!P)){k(!0),S(null);try{const D=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:A})});if(!D.ok){const V=await D.json().catch(()=>({}));throw new Error(V.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${A}`)}catch(D){S(D instanceof Error?D.message:"Failed to rename playbook")}finally{k(!1)}}}async function M(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function _(){if(!(!e||!n)){g(!0);try{const D=n.enabled?"disable":"enable",V=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!V.ok){const K=await V.json().catch(()=>({}));throw new Error(K.error||`Failed to ${D} playbook`)}i()}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(xt,{label:"Loading playbook..."}):o?r.jsx(Tt,{error:o}):n?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:T?"Playbook Manifest":n.name}),T?r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:"auto-generated"}):null]}),!T&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,T?r.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.syntaur/playbooks/manifest.md"})," ","in your CLAUDE.md for agent context."]}):null,!T&&n.whenToUse?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Ur(n.created)]}),r.jsxs("span",{children:["Updated ",Ur(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(D=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:[r.jsx(Ik,{className:"h-3 w-3"}),D]},D))}):null]}),T?null:r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),r.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:_,disabled:h,className:`inline-flex h-5 w-9 items-center rounded-full border transition disabled:opacity-50 ${n.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${n.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]}),r.jsxs(Ee,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(zi,{className:"h-3 w-3"}),"Edit"]}),r.jsxs("button",{type:"button",onClick:()=>b(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(bP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:M,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:n.body})}),r.jsx(On,{open:y,onOpenChange:D=>v?void 0:b(D),children:r.jsxs(Rn,{children:[r.jsxs(Zn,{children:[r.jsx(An,{children:"Rename playbook"}),r.jsx(Hr,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:C,onChange:D=>j(D.target.value),disabled:v,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),C&&A!==C?r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:A||"—"})]}):null,C&&!R?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:v,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:$,disabled:v||!R||!P,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function n7(){const e=zt(),[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(!1),[u,d]=p.useState(null);p.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),o(!1)}).catch(h=>{d(h.message),o(!1)})},[]);async function m(h){c(!0),d(null);try{const g=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){d(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){d(g.message),c(!1);return}c(!1)}return s?r.jsx(xt,{label:"Loading playbook template..."}):u&&!t?r.jsx(Tt,{error:u}):r.jsx(Zi,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:i,error:u,title:"Create Playbook",description:"Playbooks define rules and workflows for how agents should operate. Keep them short, imperative, and focused on a single concern.",onCancel:()=>e("/playbooks"),allowSlugEdit:!0})}function r7(){const{slug:e}=Bt(),t=zt(),[n,s]=p.useState(null),[o,i]=p.useState(!0),[c,u]=p.useState(!1),[d,m]=p.useState(null);p.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(g=>g.json()).then(g=>{s(g.content),i(!1)}).catch(g=>{m(g.message),i(!1)})},[e]);async function h(g){if(e){u(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),b=await y.json();if(!y.ok){m(b.error||`HTTP ${y.status}`),u(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),u(!1);return}u(!1)}}return o?r.jsx(xt,{label:"Loading playbook..."}):d&&!n?r.jsx(Tt,{error:d}):r.jsx(Zi,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function s7(){const{data:e,loading:t,error:n}=C3(),[s,o]=p.useState(""),[i,c]=p.useState("all"),[u,d]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.memories)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),C=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.scope!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(xt,{label:"Loading memories…"}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ee,{to:"/memories/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(Et,{title:g.length===0?"No memories yet":"No memories match these filters",description:g.length===0?"Memories capture patterns and learnings discovered while working in a project. Agents create them via /create-memory or you can add one manually.":"Clear the current filters or create a new memory.",actions:g.length===0?r.jsxs(Ee,{to:"/memories/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Memory"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ee,{to:`/projects/${v.projectSlug}/memories/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ee,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:zn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function o7(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:s,loading:o,error:i}=E3(e,t),[c,u]=p.useState(!1),[d,m]=p.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{m(!1)}}}return o?r.jsx(xt,{label:"Loading memory…"}):i?r.jsx(Tt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ee,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.scope?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",s.scope]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,s.sourceAssignment?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",s.sourceAssignment]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Ur(s.created)]}),r.jsxs("span",{children:["Updated ",Ur(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ee,{to:`/projects/${e}/memories/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(zi,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:s.body})})]}):null}function a7(){const e=zt(),[t]=ls(),n=t.get("project"),{data:s,loading:o,error:i}=Cs(),[c,u]=p.useState(n??""),[d,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[C,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!d.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/memories/${S.slug}`)}catch(E){j(E.message),b(!1)}}}return o?r.jsx(xt,{label:"Loading projects…"}):i?r.jsx(Tt,{error:i}):!s||s.length===0?r.jsx(Tt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Memories capture patterns and learnings discovered during work in a project. They are available to every assignment in that project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Memory"}),r.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function i7(){const{slug:e,itemSlug:t}=Bt();return r.jsx(el,{loadUrl:`/api/projects/${e}/memories/${t}/edit`,saveUrl:`/api/projects/${e}/memories/${t}`,redirectTo:`/projects/${e}/memories/${t}`,title:"Edit Memory",description:"Edit the body. The frontmatter (name, scope, source, related assignments) is preserved unchanged on save.",documentType:"memory",helpTitle:"Memory editing",helpBody:"Memory edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function l7(){const{data:e,loading:t,error:n}=T3(),[s,o]=p.useState(""),[i,c]=p.useState("all"),[u,d]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.resources)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),C=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.category!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(xt,{label:"Loading resources…"}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ee,{to:"/resources/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(Et,{title:g.length===0?"No resources yet":"No resources match these filters",description:g.length===0?"Resources are reference materials shared across a project — specs, requirements, links, or any reference content.":"Clear the current filters or create a new resource.",actions:g.length===0?r.jsxs(Ee,{to:"/resources/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Resource"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ee,{to:`/projects/${v.projectSlug}/resources/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ee,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:zn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function c7(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:s,loading:o,error:i}=R3(e,t),[c,u]=p.useState(!1),[d,m]=p.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{m(!1)}}}return o?r.jsx(xt,{label:"Loading resource…"}):i?r.jsx(Tt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ee,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.category?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",s.category]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Ur(s.created)]}),r.jsxs("span",{children:["Updated ",Ur(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ee,{to:`/projects/${e}/resources/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(zi,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:s.body})})]}):null}function u7(){const e=zt(),[t]=ls(),n=t.get("project"),{data:s,loading:o,error:i}=Cs(),[c,u]=p.useState(n??""),[d,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[C,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!d.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/resources/${S.slug}`)}catch(E){j(E.message),b(!1)}}}return o?r.jsx(xt,{label:"Loading projects…"}):i?r.jsx(Tt,{error:i}):!s||s.length===0?r.jsx(Tt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Resources are reference material — specs, requirements, links — shared across every assignment in a project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Resource"}),r.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function d7(){const{slug:e,itemSlug:t}=Bt();return r.jsx(el,{loadUrl:`/api/projects/${e}/resources/${t}/edit`,saveUrl:`/api/projects/${e}/resources/${t}`,redirectTo:`/projects/${e}/resources/${t}`,title:"Edit Resource",description:"Edit the body. The frontmatter (name, category, source, related assignments) is preserved unchanged on save.",documentType:"resource",helpTitle:"Resource editing",helpBody:"Resource edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function f7({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",o=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:i=>t(i.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":s}),r.jsx("input",{type:"text",value:e,onChange:i=>t(i.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":o})]})}const Kg=["projects","playbooks","todos","servers","config"];function p7(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Kg.includes(n)&&t.add(n);return t}function q0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function m7(){const[e,t]=p.useState(!0),[n,s]=p.useState(null),[o,i]=p.useState(""),[c,u]=p.useState(new Set(Kg)),[d,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(null),[C,j]=p.useState(null),v=p.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const P=await R.json();s(P),i(P.repo??""),u(p7(P.categories)),m(!1)}catch(R){j({type:"error",message:`Failed to load backup config: ${R instanceof Error?R.message:String(R)}`})}finally{t(!1)}},[]);p.useEffect(()=>{v()},[v]);function k(R){u(P=>{const $=new Set(P);return $.has(R)?$.delete(R):$.add(R),$}),m(!0)}async function E(){g(!0),j(null);try{const R=Array.from(c),P=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:R})}),$=await P.json();if(!P.ok)throw new Error($.error||`HTTP ${P.status}`);s($),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(R){j({type:"error",message:`Save failed: ${R instanceof Error?R.message:String(R)}`})}finally{g(!1)}}async function S(){b("push"),j(null);try{const R=await fetch("/api/backup/push",{method:"POST"}),P=await R.json();if(!R.ok||P.success===!1)throw new Error(P.error||P.message||`HTTP ${R.status}`);j({type:"success",message:P.message||"Backup complete."}),await v()}catch(R){j({type:"error",message:`Backup failed: ${R instanceof Error?R.message:String(R)}`})}finally{b(null)}}async function T(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),j(null);try{const P=await fetch("/api/backup/pull",{method:"POST"}),$=await P.json();if(!P.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${P.status}`);j({type:"success",message:$.message||"Restore complete."}),await v()}catch(P){j({type:"error",message:`Restore failed: ${P instanceof Error?P.message:String(P)}`})}finally{b(null)}}}if(e)return r.jsx(He,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const A=!!o.trim()&&c.size>0&&!y&&!d;return r.jsx(He,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:o,onChange:R=>{i(R.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Kg.map(R=>{const P=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${P?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${P?"bg-primary":"bg-muted-foreground/40"}`}),R]},R)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),q0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),q0((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:E,disabled:h||!d,children:[r.jsx(Sf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:S,disabled:!A,title:A?"Back up now":d?"Save config first":"Set repo and pick categories",children:[r.jsx(vP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!A,title:A?"Restore from backup":d?"Save config first":"Set repo and pick categories",children:[r.jsx(qA,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),d&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(HA,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Restore never overwrites ",r.jsx("code",{className:"rounded bg-muted px-1",children:"config.md"})," (would clobber backup settings). The agent sessions database is not backed up — only markdown files."]})]})]})})}function h7({open:e,affected:t,remaining:n,ruleReferences:s,headlineReferences:o,onResolve:i,onCancel:c}){var A,R;const[u,d]=p.useState(n.length>0?"remap":"delete"),[m,h]=p.useState(((A=n[0])==null?void 0:A.id)??""),[g,y]=p.useState(((R=n[0])==null?void 0:R.id)??""),[b,C]=p.useState(!1),j=t.count>0;p.useEffect(()=>{var P,$;e&&(d(n.length>0?"remap":"delete"),h(((P=n[0])==null?void 0:P.id)??""),y((($=n[0])==null?void 0:$.id)??""),C(!1))},[e,n]);const v=!o||g!==""&&g!==t.id,k=u==="remap"&&n.length>0&&m!==""&&m!==t.id||u==="delete"&&(!j||b)&&v;function E(){k&&(u==="remap"?i({id:t.id,mode:"remap",target:m},m):i({id:t.id,mode:"delete"},o?g:""))}const S=t.assignments.slice(0,10),T=t.count-S.length;return r.jsx(On,{open:e,onOpenChange:P=>P?void 0:c(),children:r.jsxs(Rn,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsxs(An,{children:['Delete status "',t.label,'"',j?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),r.jsx(Hr,{children:j?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),j&&r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[S.map(P=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:P.display})},`${P.projectSlug??"standalone"}/${P.assignmentSlug}`)),T>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",T," more not shown"]})]})}),s.length>0&&r.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-3",children:[r.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"Workflow rules referencing this status:"}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:s.map((P,$)=>r.jsxs("li",{children:[r.jsx("span",{className:"text-foreground",children:P.section}),r.jsx("span",{className:"mx-1",children:"·"}),P.detail]},$))}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:u==="remap"?"These will be remapped to the target status.":"Ladder rungs and transitions referencing this status will be removed"+(o?"; headline rules must be remapped below.":".")})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="remap",onChange:()=>d("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:j?"Remap to another status":"Remap rules to another status"}),r.jsxs("select",{value:m,onChange:P=>h(P.target.value),onClick:()=>d("remap"),disabled:u!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="delete",onChange:()=>d("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:j?"Delete these assignments":"Drop the referencing rules"}),r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:j?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),u==="delete"&&o&&r.jsxs("span",{className:"mt-2 block",children:[r.jsx("span",{className:"block text-xs font-medium",children:"Remap headline rules to"}),r.jsxs("select",{value:g,onChange:P=>y(P.target.value),disabled:n.length===0,className:"mt-1 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),r.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:"The headline projection cannot reference a deleted status, so it must point somewhere."})]}),u==="delete"&&j&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:b,onChange:P=>C(P.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:c,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:E,disabled:!k,className:`shell-action ${u==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:u==="remap"?j?`Remap ${t.count} → ${m||"..."}`:`Remap rules → ${m||"..."}`:j?`Delete ${t.count}`:"Drop rules"})]})]})})}function g7({open:e,references:t,onConfirm:n,onCancel:s}){return r.jsx(On,{open:e,onOpenChange:o=>o?void 0:s(),children:r.jsxs(Rn,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsx(An,{children:"Delete fact — referenced by derive rules"}),r.jsx(Hr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:o.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:o.when})]},i))})}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action bg-error text-error-foreground hover:opacity-90",children:"Confirm delete — rules will become invalid"})]})]})})}function x7(e){const t=Array.from(e.pendingResolutions.values()),s={statuses:e.statuses.map(o=>({id:o.id,label:o.label,...o.description?{description:o.description}:{},...o.color?{color:o.color}:{},...o.terminal?{terminal:!0}:{}})),order:e.order,resolutions:t};return e.transitions!==void 0&&(s.transitions=e.transitions),e.derive!==void 0&&(s.derive=e.derive),e.facts!==void 0&&(s.facts=e.facts),e.factRemovalAcks&&e.factRemovalAcks.length>0&&(s.factRemovalAcks=e.factRemovalAcks),{body:s,resolutions:t}}function y7(e,t,n){const s=[];t.phaseLadder.forEach((o,i)=>{o.phase===e&&s.push({section:"phaseLadder",detail:`phaseLadder rung ${i} ("${o.phase}")`})}),t.headline.parked===e&&s.push({section:"headline",detail:"headline.parked"}),t.headline.blocked===e&&s.push({section:"headline",detail:"headline.blocked"});for(const o of n)(o.from===e||o.to===e)&&s.push({section:"transitions",detail:`transition ${o.from} --${o.command}--> ${o.to}`});return s}function b7(e,t){return t.headline.parked===e||t.headline.blocked===e}function v7(e,t,n){return{phaseLadder:e.phaseLadder.map(s=>s.phase===t?{...s,phase:n}:s),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function w7(e,t,n){return e.map(s=>({...s,from:s.from===t?n:s.from,to:s.to===t?n:s.to}))}function j7(e,t,n){return{phaseLadder:e.phaseLadder.filter(s=>s.phase!==t),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function k7(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function S7(e,t){const n=new Map;t.forEach((o,i)=>{n.has(o)||n.set(o,i)});const s=t.length;return e.map((o,i)=>({s:o,originalIndex:i,r:n.get(o.id)??s})).sort((o,i)=>o.r-i.r||o.originalIndex-i.originalIndex).map(o=>o.s)}function G0(e,t){const n=new Map;for(const[s,o]of e.entries())t.has(o.id)||o.mode==="remap"&&!t.has(o.target)||n.set(s,o);return n}function N7(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:o,unbindAction:i}=To(),[c,u]=p.useState(null),[d,m]=p.useState(null),[h,g]=p.useState(!1),y=Object.values(t).some(S=>typeof S=="string"&&S.length>0);function b(S,T){m({type:S,message:T}),setTimeout(()=>m(null),2500)}function C(S){u({kind:S,combo:null,conflict:null,saving:!1,error:null})}function j(S){if(!c||S.key==="Escape")return;if(S.key==="Enter"&&c.combo){S.preventDefault(),v();return}if(S.key==="Enter")return;S.preventDefault(),S.stopPropagation();const T=dS(S.nativeEvent);if(!T)return;const A=s(T,c.kind);u({...c,combo:T,conflict:A,error:null})}async function v(){var S;if(c!=null&&c.combo){if((S=c.conflict)!=null&&S.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await o(c.kind,c.combo),u(null),b("success",`Bound ${Ml[c.kind]}`)}catch(T){u({...c,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(S){try{await i(S),b("success",`Cleared ${Ml[S]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await G$(),b("success","All hotkey bindings cleared")}catch(S){b("error",S instanceof Error?S.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(He,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(Us,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[d?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${d.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:d.message}):null,r.jsx("ul",{className:"space-y-2",children:Tf.map(S=>{var $,M;const T=n.find(_=>_.bindableKind===S),A=e[S],R=typeof t[S]=="string"&&!!t[S],P=(c==null?void 0:c.kind)===S;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(cg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(T==null?void 0:T.title)??Ml[S]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),A?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:ks(A)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${R?"text-primary":"text-muted-foreground"}`,children:R?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(S),children:A?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(S),"aria-label":`Restore default ${Ml[S]} binding`,children:[r.jsx(dx,{className:"h-3 w-3"}),"Restore default"]}):null]}),P?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:j,onBlur:()=>{(c==null?void 0:c.kind)===S&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:ks(c.combo)}),($=c.conflict)!=null&&$.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(M=c.conflict)!=null&&M.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Ml[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},S)})})]})}const C7={kanban:"Kanban",list:"List",table:"Table"},E7={comfortable:"Comfortable",compact:"Compact"},T7={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},R7={asc:"Ascending",desc:"Descending"};function A7(){const e=I8(),t=e.global,[n,s]=p.useState(!1),[o,i]=p.useState(null);function c(m,h){i({type:m,message:h}),setTimeout(()=>i(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await kE({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function d(){if(e.custom){s(!0);try{await _8(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(He,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:d,disabled:n,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:Ux.map(m=>r.jsx("button",{type:"button",onClick:()=>u("defaultView",m),disabled:n,"aria-pressed":t.defaultView===m,className:`px-3 py-1 text-xs ${t.defaultView===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:C7[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:bO.map(m=>r.jsx("button",{type:"button",onClick:()=>u("density",m),disabled:n,"aria-pressed":t.density===m,className:`px-3 py-1 text-xs ${t.density===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:E7[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),r.jsx("dd",{className:"mt-1.5",children:r.jsx("select",{value:t.sortField,onChange:m=>u("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:J1.map(m=>r.jsx("option",{value:m,children:T7[m]??m},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:yO.map(m=>r.jsx("button",{type:"button",onClick:()=>u("sortDirection",m),disabled:n,"aria-pressed":t.sortDirection===m,className:`px-3 py-1 text-xs ${t.sortDirection===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:R7[m]},m))})]})]})]})}function P7({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:o,className:i,wrapperClassName:c,singleLine:u,"aria-label":d}){const[m,h]=p.useState(0),[g,y]=p.useState(0),[b,C]=p.useState(!1),j=p.useRef(null),v=BE(e,m),k=v?UE(v.partial,n):[],E=!b&&k.length>0,S=Math.min(g,Math.max(0,k.length-1)),T=M=>u?M.replace(/[\r\n]+/g," "):M;function A(M){t(T(M.target.value)),h(M.target.selectionStart??M.target.value.length),y(0),C(!1)}function R(M){h(M.currentTarget.selectionStart??e.length)}function P(M){if(!v||!M)return;const _=VE(e,v,M);t(T(_.text)),h(_.caret),y(0),C(!0),requestAnimationFrame(()=>{const D=j.current;D&&(D.focus(),D.setSelectionRange(_.caret,_.caret))})}function $(M){E&&(M.key==="ArrowDown"?(M.preventDefault(),y(_=>Math.min(_+1,k.length-1))):M.key==="ArrowUp"?(M.preventDefault(),y(_=>Math.max(_-1,0))):M.key==="Enter"||M.key==="Tab"?(M.preventDefault(),P(k[S])):M.key==="Escape"&&(M.preventDefault(),C(!0)))}return r.jsxs("div",{className:we("relative",c),children:[r.jsx("textarea",{ref:j,value:e,rows:s,placeholder:o,"aria-label":d,onChange:A,onKeyDown:$,onKeyUp:R,onClick:R,className:i}),E&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:k.map((M,_)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":_===S,onMouseDown:D=>{D.preventDefault(),P(M)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",_===S&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:M})]})},M))})]})}const D7={first:"first",last:"last",none:"none"};function t2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Kl(e){return e.map(t=>({rowKey:t2(),id:t.id,originalId:t.id,isNew:!1,idEditable:!1,autoSlugFromLabel:!1,label:t.label,command:t.command,argsText:t.args?t.args.join(" "):"",promptArgPosition:t.promptArgPosition??"first",resolveFromShellAliases:t.resolveFromShellAliases??!1,default:t.default??!1,model:t.model??"",playbook:t.playbook??"",launchPrompt:t.launchPrompt??"",fieldErrors:{}}))}function $7(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},s=t.argsText.split(/[,\s]+/).filter(Boolean);return s.length>0&&(n.args=s),t.promptArgPosition!=="first"&&(n.promptArgPosition=t.promptArgPosition),t.resolveFromShellAliases&&(n.resolveFromShellAliases=!0),t.default&&(n.default=!0),t.model.trim()&&(n.model=t.model.trim()),t.playbook.trim()&&(n.playbook=t.playbook.trim()),t.launchPrompt.trim()&&(n.launchPrompt=t.launchPrompt),n})}function L7(e){if(e.length===0)return e;let t=-1;for(let n=0;n<e.length;n++)if(e[n].default){t=n;break}return e.map((n,s)=>({...n,default:t===-1?s===0:s===t}))}function O7(e,t){return!t||t.length===0?e:e.map((n,s)=>{const o={};for(const i of t){if(i.index!==void 0){i.index===s&&(o[i.field]=i.message);continue}if(i.id!==void 0){i.id===n.id&&(o[i.field]=i.message);continue}o[i.field]=i.message}return{...n,fieldErrors:o}})}function I7(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function _7(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],o=t[n];if(s.id!==o.id||s.label!==o.label||s.command!==o.command||s.argsText!==o.argsText||s.promptArgPosition!==o.promptArgPosition||s.resolveFromShellAliases!==o.resolveFromShellAliases||s.default!==o.default||s.model!==o.model||s.playbook!==o.playbook||s.launchPrompt!==o.launchPrompt)return!1}return!0}function M7({row:e,index:t,canRemove:n,playbooks:s,onPatch:o,onSetDefault:i,onRemove:c}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=Vf({id:e.rowKey}),C={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(T){const A={label:T};if(e.autoSlugFromLabel){const R=wr(T);R&&tU.test(R)?A.id=R:A.id=`agent-${t+1}`}o(A)}function v(T){o({id:T,autoSlugFromLabel:!1})}const k=T=>e.fieldErrors[T]?"border-error-foreground/60":"",E=p.useMemo(()=>s.map(T=>T.slug),[s]),S=p.useMemo(()=>HE(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:C,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...d,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Fi,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:T=>v(T.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:c,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:T=>j(T.target.value),className:`editor-input mt-0.5 w-full ${k("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:T=>o({command:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:T=>o({argsText:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:T=>o({promptArgPosition:T.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:IE.map(T=>r.jsx("option",{value:T,children:D7[T]},T))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),r.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:T=>o({model:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("model")}`}),e.fieldErrors.model&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),r.jsxs("div",{className:"col-span-full",children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),r.jsx(P7,{value:e.launchPrompt,onChange:T=>o({launchPrompt:T}),knownSlugs:E,singleLine:!0,rows:5,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",wrapperClassName:"mt-0.5",className:`editor-input w-full resize-y font-mono leading-relaxed min-h-[6rem] ${k("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),S.length>0&&!e.fieldErrors.launchPrompt&&r.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:S.map(T=>r.jsx("li",{children:T},T))})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:T=>o({resolveFromShellAliases:T.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function F7(){const e=FE(),t=gx(),n=p.useMemo(()=>{var $;return((($=t.data)==null?void 0:$.playbooks)??[]).filter(M=>M.enabled).map(M=>({slug:M.slug,name:M.name}))},[t.data]),[s,o]=p.useState(()=>Kl(e.agents)),[i,c]=p.useState(()=>Kl(e.agents)),[u,d]=p.useState(!1),[m,h]=p.useState(null),[g,y]=p.useState(null);p.useEffect(()=>{const $=Kl(e.agents);o($),c($),h(null)},[e.agents]);const b=p.useMemo(()=>!_7(s,i),[s,i]),C=If(ko(Ki,{activationConstraint:{distance:8}}),ko(Wi));function j($,M){y({type:$,message:M}),setTimeout(()=>y(null),2500)}function v($,M){o(_=>_.map(D=>D.rowKey===$?{...D,...M,fieldErrors:z7(D.fieldErrors,M)}:D))}function k($){o(M=>M.map(_=>({..._,default:_.rowKey===$})))}function E(){o($=>{const M=new Set($.map(F=>F.id)),_="new-agent";let D=_,V=1;for(;M.has(D);)V+=1,D=`${_}-${V}`;const K=V===1?"New Agent":`New Agent ${V}`,I={rowKey:t2(),id:D,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:K,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...$,I]})}function S($){o(M=>M.filter(_=>_.rowKey!==$))}async function T(){d(!0),h(null);try{const $=L7(s),M=$7($),_=await sU(M),D=Kl(_.agents);o(D),c(D),j("success","Agents saved")}catch($){if($ instanceof _E)h($.message),o(M=>O7(I7(M),$.fieldErrors)),j("error",$.message);else{const M=$ instanceof Error?$.message:"Failed to save";h(M),j("error",M)}}finally{d(!1)}}function A(){o(i),h(null)}async function R(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){d(!0),h(null);try{const $=await oU(),M=Kl($.agents);o(M),c(M),j("success","Reset to defaults")}catch($){const M=$ instanceof Error?$.message:"Failed to reset";h(M),j("error",M)}finally{d(!1)}}}function P($){const{active:M,over:_}=$;!_||M.id===_.id||o(D=>{const V=D.findIndex(I=>I.rowKey===M.id),K=D.findIndex(I=>I.rowKey===_.id);return V===-1||K===-1?D:qi(D,V,K)})}return r.jsxs(He,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:R,disabled:u,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[r.jsx(ax,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",r.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),g&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),m&&(!g||g.type!=="error")&&r.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:m}),r.jsx(Bf,{sensors:C,collisionDetection:_f,onDragEnd:P,children:r.jsx(Uf,{items:s.map($=>$.rowKey),strategy:Bx,children:r.jsx("div",{className:"space-y-2",children:s.map(($,M)=>r.jsx(M7,{row:$,index:M,canRemove:s.length>1,playbooks:n,onPatch:_=>v($.rowKey,_),onSetDefault:()=>k($.rowKey),onRemove:()=>S($.rowKey)},$.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:E,disabled:u,className:"shell-action text-xs",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:A,disabled:!b||u,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:T,disabled:!b||u,className:"shell-action text-xs",children:[r.jsx(Sf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function z7(e,t){if(Object.keys(e).length===0)return e;const n={...e};return"id"in t&&delete n.id,"label"in t&&delete n.label,"command"in t&&delete n.command,"argsText"in t&&delete n.args,"promptArgPosition"in t&&delete n.promptArgPosition,"resolveFromShellAliases"in t&&delete n.resolveFromShellAliases,"default"in t&&delete n.default,"model"in t&&delete n.model,"playbook"in t&&delete n.playbook,"launchPrompt"in t&&delete n.launchPrompt,n}const n2=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],mf={terminal:"terminal-app",custom:!1};let hi=null,ci=null,hf=0;const qg=new Set;function r2(e){hi=e;for(const t of qg)t(e)}function By(e){if(!e||typeof e!="object")return mf;const t=e;return{terminal:typeof t.terminal=="string"&&n2.includes(t.terminal)?t.terminal:mf.terminal,custom:t.custom===!0}}function B7(){if(hi)return Promise.resolve(hi);if(ci)return ci;const e=++hf;return ci=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ci=null;const n=By(t);return e!==hf?hi??n:(hi=n,n)}).catch(()=>(ci=null,mf)),ci}function U7(){const[e,t]=p.useState(()=>hi??mf);return p.useEffect(()=>{let n=!1;return B7().then(s=>{n||t(s)}),qg.add(t),()=>{n=!0,qg.delete(t)}},[]),e}async function V7(e){++hf;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const s=await t.json().catch(()=>null);throw new Error((s==null?void 0:s.error)??`HTTP ${t.status}`)}const n=By(await t.json());return r2(n),n}async function H7(){++hf;const e=await fetch("/api/config/terminal",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=By(await e.json());return r2(t),t}const wd={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function W7(){const{terminal:e,custom:t}=U7(),[n,s]=p.useState(!1),[o,i]=p.useState(null);function c(m){i(m),setTimeout(()=>i(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await V7(m),c({type:"success",message:`Terminal set to ${wd[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function d(){s(!0);try{const m=await H7();c({type:"success",message:`Reset to OS default (${wd[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(He,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${wd[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:n,type:"button",children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:n2.map(m=>r.jsx("option",{value:m,children:wd[m]},m))})]})]})}function ql(e){return e===Kd?"Ungrouped":e}function K7(){const{data:e,loading:t,error:n,refetch:s}=fa(),{hidden:o,custom:i,loading:c,error:u,reload:d}=s1(),[m,h]=p.useState(!1),[g,y]=p.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[Kd]:[]]:[];async function j(k,E){const S=E?o.filter(T=>T!==k):[...o,k];h(!0);try{await sL(S),b({type:"success",message:E?`Showing "${ql(k)}" in the left nav.`:`Hiding "${ql(k)}" from the left nav.`})}catch(T){b({type:"error",message:T instanceof Error?T.message:"Save failed."})}finally{h(!1)}}async function v(){h(!0);try{await oL(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(He,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:i?r.jsxs("button",{className:"shell-action text-xs",onClick:v,disabled:m,type:"button",children:[r.jsx(Us,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&d()},children:[r.jsx(Us,{className:"h-3 w-3"}),"Retry"]})]}):C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:C.map(k=>{const E=!tL(k,o);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:ql(k),children:[ql(k),k===Kd&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`Show "${ql(k)}" in the left nav`,onClick:()=>j(k,!E),disabled:m,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${E?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${E?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function q7(e){return Ag(e)}function Y0(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function G7(e){const t=new Map;for(let n=0;n<e.length;n++){const s=Y0(Ag(e.slice(0,n))),o=Y0(Ag(e.slice(0,n+1)));for(const[i,c]of o.entries()){const u=s.get(i)??0;if(c>u){t.set(n,i);break}}}return t}const Y7=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],Q7=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function J7(){return{name:"",type:"bool",binds:null}}function X7({rows:e,onChange:t,saving:n}){const s=G7(e),o=p.useCallback(()=>{t([...e,J7()])},[e,t]),i=p.useCallback((u,d,m)=>{t(e.map((h,g)=>g===u?{...h,[d]:m}:h))},[e,t]),c=p.useCallback(u=>{t(e.filter((d,m)=>m!==u))},[e,t]);return r.jsxs(He,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",children:[r.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Names must match ",r.jsx("code",{className:"font-mono",children:"^[a-z][a-zA-Z0-9]*"})," — start with a lowercase letter, then letters or numbers only (no spaces, hyphens, or underscores)."]}),r.jsxs("div",{className:"space-y-2",children:[e.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),e.map((u,d)=>{const m=s.get(d),h=u.type==="attestation";return r.jsxs("div",{className:`rounded-md border p-2 ${m?"border-error-foreground/40 bg-error/5":"border-border/60 bg-background/80"}`,children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[r.jsx("input",{type:"text",value:u.name,onChange:g=>i(d,"name",g.target.value),placeholder:"factName",disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm font-mono focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),r.jsx("select",{value:u.type,onChange:g=>{const y=g.target.value;t(e.map((b,C)=>C===d?{...b,type:y,binds:y==="attestation"?b.binds:null}:b))},disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:Y7.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}),h?r.jsx("select",{value:u.binds??"none",onChange:g=>i(d,"binds",g.target.value),disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:Q7.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}):r.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),m&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:r.jsx(Ud,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:m})]}),r.jsx("button",{type:"button",onClick:()=>c(d),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]}),m&&r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:m})]},d)})]}),r.jsxs("button",{type:"button",onClick:o,disabled:n,className:"mt-2 shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Lt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function s2(e,t=Zf){var s,o;if(e==="*")return null;const n=Wf(e);if(!n.ast)return((s=n.errors[0])==null?void 0:s.message)??"unparseable condition";try{return rc(n.ast,t),null}catch(i){if(i instanceof kr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function rg(e){if(e.values.length!==1)return null;const t=e.values[0];return{field:e.field,op:e.op,value:t.raw,valueType:t.type}}function Z7(e){if(e.kind==="atom"){const t=rg(e);return t?{outerJoin:"AND",groups:[{join:"AND",comparisons:[t]}]}:null}if(e.kind==="and"||e.kind==="or"){const t=e.kind==="and"?"AND":"OR",n=e.kind==="and"?"or":"and",s=e.kind==="and"?"OR":"AND",o=[];for(const i of e.children)if(i.kind==="atom"){const c=rg(i);if(!c)return null;o.push({join:s,comparisons:[c]})}else if(i.kind===n){const c=[];for(const u of i.children){if(u.kind!=="atom")return null;const d=rg(u);if(!d)return null;c.push(d)}o.push({join:s,comparisons:c})}else return null;return{outerJoin:t,groups:o}}return null}function Q0(e){const t=e.trim();if(t===""||t==="*")return null;const n=Wf(t);return n.ast?Z7(n.ast):null}const e9=/^[A-Za-z_][A-Za-z0-9_-]*$/;function t9(e){return e===""||!e9.test(e)||/^(and|or|not)$/i.test(e)}function n9(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function r9(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:t9(e.value)?n9(e.value):e.value}function s9(e){const t=r9(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function o9(e){return e.groups.map(n=>{const s=n.comparisons.map(s9).join(` ${n.join} `);return n.comparisons.length>1?`(${s})`:s}).join(` ${e.outerJoin} `)}function a9(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":s2(e,t)}function i9(e){return o5(s5(e))}function l9(e){const t=sy(e),n=[];for(const s of GN(e)){const o=t[s.toLowerCase()];o&&n.push({name:s,kind:o.kind})}return n}function o2(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function Gg(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function Gl(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:Gg(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:o2(t.kind)}:{field:"",op:":",value:""}]}]}}function a2({value:e,onChange:t,fieldOptions:n,registry:s,disabled:o}){const i=p.useMemo(()=>Q0(e),[e]),c=e.trim()===""||i!==null,[u,d]=p.useState(c?"builder":"raw"),[m,h]=p.useState(()=>i??Gl(n)),g=p.useRef(e);p.useEffect(()=>{if(e===g.current)return;const R=Q0(e);R&&h(R),!(e.trim()===""||R)&&u==="builder"&&d("raw"),g.current=e},[e]);const y=a9(e,s);function b(R){g.current=R,t(R)}function C(R){h(R),b(o9(R))}function j(R){C({outerJoin:R,groups:m.groups.map(P=>({...P,join:R==="AND"?"OR":"AND"}))})}function v(R,P,$){const M=m.groups.map((_,D)=>D===R?{..._,comparisons:_.comparisons.map((V,K)=>K===P?{...V,...$}:V)}:_);C({...m,groups:M})}function k(R){const P=Gl(n).groups[0].comparisons[0],$=m.groups.map((M,_)=>_===R?{...M,comparisons:[...M.comparisons,{...P}]}:M);C({...m,groups:$})}function E(R,P){let $=m.groups.map((M,_)=>_===R?{...M,comparisons:M.comparisons.filter((D,V)=>V!==P)}:M);$=$.filter(M=>M.comparisons.length>0),$.length===0&&($=Gl(n).groups),C({...m,groups:$})}function S(){const R=m.outerJoin==="AND"?"OR":"AND";C({...m,groups:[...m.groups,{join:R,comparisons:[Gl(n).groups[0].comparisons[0]]}]})}function T(){if(u==="builder"){d("raw");return}c&&(h(i??Gl(n)),d("builder"))}const A="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";return r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),r.jsxs("button",{type:"button",onClick:T,disabled:o||u==="raw"&&!c,title:u==="raw"&&!c?"Condition too complex for the builder — edit as raw AQL":u==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[u==="builder"?r.jsx(WA,{className:"h-3 w-3"}):r.jsx(oP,{className:"h-3 w-3"}),u==="builder"?"Raw AQL":"Builder"]})]}),u==="raw"?r.jsx("input",{type:"text",list:"aql-field-names",value:e,onChange:R=>b(R.target.value),disabled:o,placeholder:"e.g. planApproved:true AND implementationStarted:true",className:`${A} w-full font-mono`}):r.jsxs("div",{className:"space-y-2",children:[m.groups.map((R,P)=>r.jsxs("div",{children:[P>0&&r.jsxs("div",{className:"my-1 flex items-center gap-2",children:[r.jsx("span",{className:"h-px flex-1 bg-border/60"}),r.jsx("button",{type:"button",onClick:()=>j(m.outerJoin==="AND"?"OR":"AND"),disabled:o,className:"shell-action text-[10px] uppercase tracking-wide",children:m.outerJoin}),r.jsx("span",{className:"h-px flex-1 bg-border/60"})]}),r.jsxs("div",{className:"rounded-md border border-border/50 bg-background/60 p-2 space-y-1.5",children:[R.comparisons.map(($,M)=>{const _=n.find(K=>K.name===$.field),D=(_==null?void 0:_.kind)??"string",V=Gg(D);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[M>0&&r.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:R.join}),r.jsxs("select",{value:$.field,onChange:K=>{const I=n.find(Z=>Z.name===K.target.value),F=(I==null?void 0:I.kind)??"string",q=Gg(F);v(P,M,{field:K.target.value,op:q.includes($.op)?$.op:q[0],value:F==="bool"?"true":$.value,valueType:o2(F)})},disabled:o,className:`${A} font-mono`,children:[n.length===0&&r.jsx("option",{value:"",children:"(no fields)"}),!n.some(K=>K.name===$.field)&&$.field!==""&&r.jsx("option",{value:$.field,children:$.field}),n.map(K=>r.jsx("option",{value:K.name,children:K.name},K.name))]}),r.jsx("select",{value:$.op,onChange:K=>v(P,M,{op:K.target.value}),disabled:o,className:`${A} font-mono`,children:V.map(K=>r.jsx("option",{value:K,children:K},K))}),D==="bool"?r.jsxs("select",{value:$.value||"true",onChange:K=>v(P,M,{value:K.target.value}),disabled:o,className:`${A} font-mono`,children:[r.jsx("option",{value:"true",children:"true"}),r.jsx("option",{value:"false",children:"false"})]}):r.jsx("input",{type:"text",value:$.value,onChange:K=>v(P,M,{value:K.target.value}),disabled:o,placeholder:"value",className:`${A} w-24 font-mono`}),r.jsx("button",{type:"button",onClick:()=>E(P,M),disabled:o,className:"ml-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove condition",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]},M)}),r.jsxs("button",{type:"button",onClick:()=>k(P),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),R.join," condition"]})]})]},P)),r.jsxs("button",{type:"button",onClick:S,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),m.outerJoin," group"]})]}),r.jsx("datalist",{id:"aql-field-names",children:n.map(R=>r.jsx("option",{value:R.name},R.name))}),r.jsx("p",{className:"font-mono text-[11px] text-muted-foreground truncate",title:e,children:e.trim()===""?r.jsx("span",{className:"italic",children:"empty condition"}):e}),y&&r.jsx("p",{className:"text-xs text-error-foreground",children:y})]})}let J0=0;function gf(){return J0+=1,`dr_${J0}_${Math.random().toString(36).slice(2,8)}`}function sg(e){const t=[...e.disposition].sort((n,s)=>n.when===null&&s.when!==null?1:n.when!==null&&s.when===null?-1:0);return{phaseLadder:e.phaseLadder.map(n=>({rowKey:gf(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:gf(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function Yg(e){const t=e.phaseLadder.map(s=>s.next.trim()?{phase:s.phase,when:s.when,next:s.next.trim()}:{phase:s.phase,when:s.when}),n=e.disposition.map(s=>({when:s.when,is:s.is}));return{phaseLadder:t,disposition:n,headline:{terminal:"passthrough",active:"phase",parked:e.headline.parked,blocked:e.headline.blocked}}}function c9(e){return e.findIndex(t=>t.when.trim()==="*")}function i2(e,t,n){return t5(e,{statuses:t},s=>s2(s,n))}const X0=["active","blocked","parked"];function u9({value:e,deriveCustom:t,statuses:n,acceptedFacts:s,onChange:o,onReset:i,disabled:c}){const u=p.useMemo(()=>sy(s),[s]),d=p.useMemo(()=>l9(s),[s]),m=If(ko(Ki,{activationConstraint:{distance:8}}),ko(Wi,{coordinateGetter:Y1})),h=p.useMemo(()=>{try{return i2(Yg(e),n,u)}catch{return["derive rules are malformed"]}},[e,n,u]),g=c9(e.phaseLadder),y=g>=0?e.phaseLadder[g]:null,b=e.phaseLadder.filter((M,_)=>_!==g);function C(M,_){o({...e,phaseLadder:[...M?[M]:[],..._]})}function j(M,_){const D=e.phaseLadder.map(V=>V.rowKey===M?{...V,..._}:V);o({...e,phaseLadder:D})}function v(){var _;const M={rowKey:gf(),phase:((_=n[0])==null?void 0:_.id)??"",when:"",next:""};C(y,[...b,M])}function k(M){o({...e,phaseLadder:e.phaseLadder.filter(_=>_.rowKey!==M)})}function E(M){const{active:_,over:D}=M;if(!D||_.id===D.id)return;const V=b.findIndex(I=>I.rowKey===_.id),K=b.findIndex(I=>I.rowKey===D.id);V===-1||K===-1||C(y,qi(b,V,K))}function S(M,_){o({...e,disposition:e.disposition.map(D=>D.rowKey===M?{...D,..._}:D)})}function T(){const M={rowKey:gf(),when:"",is:"active"},_=e.disposition.findIndex(V=>V.when===null),D=[...e.disposition];_>=0?D.splice(_,0,M):D.push(M),o({...e,disposition:D})}function A(M){o({...e,disposition:e.disposition.filter(_=>_.rowKey!==M)})}function R(M,_){o({...e,headline:{...e.headline,[M]:_}})}const P="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function $(M,_,D){return r.jsxs("select",{value:M,onChange:V=>_(V.target.value),disabled:c,"aria-label":D,className:`${P} font-mono`,children:[!n.some(V=>V.id===M)&&M!==""&&r.jsx("option",{value:M,children:M}),n.map(V=>r.jsxs("option",{value:V.id,children:[V.label," (",V.id,")"]},V.id))]})}return r.jsxs(He,{title:"Derive Rules",description:"The phase ladder, disposition rules, and headline projection that map facts to a status. Highest matching rung wins — drag to reorder priority.",actions:t?r.jsxs("button",{type:"button",className:"shell-action text-xs inline-flex items-center gap-1",onClick:i,disabled:c,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to default rules"]}):void 0,children:[!t&&r.jsx("div",{className:"mb-3 rounded-md border border-border/60 bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:"Using built-in derive rules. Editing anything below switches to a custom configuration."}),h.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These derive rules won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:h.map((M,_)=>r.jsx("li",{children:M},_))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Phase ladder"}),y&&r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2 opacity-90",children:[r.jsx("span",{className:"mt-1 text-muted-foreground/40",children:r.jsx(Fi,{className:"h-4 w-4 opacity-30"})}),r.jsxs("div",{className:"min-w-[10rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase (catch-all, lowest priority)"}),$(y.phase,M=>j(y.rowKey,{phase:M}),"Catch-all phase"),r.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"matches everything"})]}),r.jsxs("div",{className:"min-w-[12rem] flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:y.next,onChange:M=>j(y.rowKey,{next:M.target.value}),disabled:c,className:`${P} w-full`})]})]}),r.jsx(Bf,{sensors:m,collisionDetection:_f,onDragEnd:E,children:r.jsx(Uf,{items:b.map(M=>M.rowKey),strategy:Bx,children:r.jsx("div",{className:"space-y-2",children:b.map(M=>r.jsx(d9,{rung:M,disabled:c,statusSelect:$,fieldOptions:d,registry:u,onUpdate:_=>j(M.rowKey,_),onRemove:()=>k(M.rowKey)},M.rowKey))})})}),r.jsxs("button",{type:"button",onClick:v,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add rung"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),r.jsx("div",{className:"space-y-2",children:e.disposition.map(M=>M.when===null?r.jsxs("div",{className:"surface-panel flex items-center gap-3 px-3 py-2",children:[r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"otherwise"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:M.is,onChange:_=>S(M.rowKey,{is:_.target.value}),disabled:c,className:`${P} font-mono`,children:X0.map(_=>r.jsx("option",{value:_,children:_},_))})]},M.rowKey):r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2",children:[r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(a2,{value:M.when,onChange:_=>S(M.rowKey,{when:_}),fieldOptions:d,registry:u,disabled:c})}),r.jsxs("div",{className:"flex items-center gap-2 pt-5",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:M.is,onChange:_=>S(M.rowKey,{is:_.target.value}),disabled:c,className:`${P} font-mono`,children:X0.map(_=>r.jsx("option",{value:_,children:_},_))}),r.jsx("button",{type:"button",onClick:()=>A(M.rowKey),disabled:c,className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove disposition rule",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]},M.rowKey))}),r.jsxs("button",{type:"button",onClick:T,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add disposition rule"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Headline projection"}),r.jsxs("div",{className:"surface-panel grid grid-cols-1 gap-3 px-3 py-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When parked, show"}),$(e.headline.parked,M=>R("parked",M),"Parked headline status")]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),$(e.headline.blocked,M=>R("blocked",M),"Blocked headline status")]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Terminal statuses: ",r.jsx("span",{className:"font-mono",children:"passthrough"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Active: ",r.jsx("span",{className:"font-mono",children:"phase"})]})]})]})]})}function d9({rung:e,disabled:t,statusSelect:n,fieldOptions:s,registry:o,onUpdate:i,onRemove:c}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=Vf({id:e.rowKey}),C={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};return r.jsxs("div",{ref:m,style:C,className:`surface-panel flex flex-wrap items-start gap-3 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:h,...u,...d,type:"button","aria-label":"Drag to reorder rung",className:"mt-1 cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Fi,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-[10rem] space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase"}),n(e.phase,j=>i({phase:j}),"Rung phase")]}),r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(a2,{value:e.when,onChange:j=>i({when:j}),fieldOptions:s,registry:o,disabled:t})}),r.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:e.next,onChange:j=>i({next:j.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),r.jsx("button",{type:"button",onClick:c,disabled:t,className:"mt-5 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove rung",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})}const f9=new Map([["pending:start","in_progress"],["pending:block","blocked"],["draft:shape","ready_for_planning"],["draft:start","in_progress"],["ready_for_planning:plan-ready","ready_to_implement"],["ready_for_planning:start","in_progress"],["ready_to_implement:implement","in_progress"],["in_progress:block","blocked"],["in_progress:review","review"],["in_progress:complete","completed"],["in_progress:fail","failed"],["blocked:unblock","in_progress"],["review:start","in_progress"],["review:complete","completed"],["review:fail","failed"],["completed:reopen","in_progress"],["failed:reopen","in_progress"]]);let Z0=0;function l2(){return Z0+=1,`tr_${Z0}_${Math.random().toString(36).slice(2,8)}`}function p9(e){return{rowKey:l2(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function ek(e){return e.map(p9)}function m9(e){const t={from:e.from,command:e.command,to:e.to};return e.label.trim()&&(t.label=e.label.trim()),e.description.trim()&&(t.description=e.description.trim()),e.requiresReason&&(t.requiresReason=!0),t}function h9(e){return e.map(m9)}function c2(){const e=[];for(const[t,n]of f9){const s=t.indexOf(":");e.push({from:t.slice(0,s),command:t.slice(s+1),to:n})}return e}function u2(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function tk(e){const t=[],n=new Map;for(const s of e){let o=n.get(s.from);o||(o={from:s.from,rows:[]},n.set(s.from,o),t.push(o)),o.rows.push(s)}return t}function d2(e,t){const n=[];for(const s of e)t.has(s.from)||n.push(`transition ${s.from} --${s.command}--> ${s.to}: "${s.from}" is not a defined status`),t.has(s.to)||n.push(`transition ${s.from} --${s.command}--> ${s.to}: "${s.to}" is not a defined status`);return n}function g9({value:e,customizing:t,statuses:n,knownCommands:s,onChange:o,onCustomize:i,disabled:c}){const u=p.useMemo(()=>new Set(n.map(S=>S.id)),[n]),d=p.useMemo(()=>{const S=new Map(n.map(T=>[T.id,T.label]));return T=>S.get(T)??T},[n]),[m,h]=p.useState(""),g="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";if(!t&&e.length===0){const S=u2(c2(),u),T=tk(S);return r.jsx(He,{title:"Transitions",description:"Which commands move an assignment between statuses. Showing the built-in defaults.",actions:r.jsx("button",{type:"button",onClick:i,disabled:c,className:"shell-action text-xs",children:"Customize defaults"}),children:T.length===0?r.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No built-in transitions apply to the current statuses."}):r.jsx("div",{className:"space-y-3",children:T.map(A=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsx("h4",{className:"mb-1 text-xs font-semibold text-foreground",children:d(A.from)}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:A.rows.map((R,P)=>r.jsxs("li",{children:[R.command," → ",d(R.to)," ",r.jsxs("span",{className:"opacity-60",children:["(",R.to,")"]})]},P))})]},A.from))})})}const y=d2(e,u),b=tk(e),C=n.filter(S=>!b.some(T=>T.from===S.id));function j(S,T){o(e.map(A=>A.rowKey===S?{...A,...T}:A))}function v(S){o(e.filter(T=>T.rowKey!==S))}function k(S){var A;const T={rowKey:l2(),from:S,command:s[0]??"",to:((A=n[0])==null?void 0:A.id)??"",label:"",description:"",requiresReason:!1};o([...e,T])}function E(){m&&(k(m),h(""))}return r.jsxs(He,{title:"Transitions",description:"Which commands move an assignment between statuses, grouped by the from-status.",children:[y.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These transitions won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:y.map((S,T)=>r.jsx("li",{children:S},T))})]}),r.jsx("div",{className:"space-y-3",children:b.map(S=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsxs("h4",{className:"mb-2 text-xs font-semibold text-foreground",children:[d(S.from)," ",r.jsxs("span",{className:"font-mono text-muted-foreground",children:["(",S.from,")"]})]}),r.jsx("div",{className:"space-y-2",children:S.rows.map(T=>r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("input",{type:"text",list:"transition-command-names",value:T.command,onChange:A=>j(T.rowKey,{command:A.target.value}),disabled:c,placeholder:"command",className:`${g} w-28 font-mono`}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsxs("select",{value:T.to,onChange:A=>j(T.rowKey,{to:A.target.value}),disabled:c,"aria-label":"Target status",className:`${g} font-mono`,children:[!u.has(T.to)&&T.to!==""&&r.jsx("option",{value:T.to,children:T.to}),n.map(A=>r.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.id))]}),r.jsx("input",{type:"text",value:T.label,onChange:A=>j(T.rowKey,{label:A.target.value}),disabled:c,placeholder:"label (optional)",className:`${g} w-32`}),r.jsx("input",{type:"text",value:T.description,onChange:A=>j(T.rowKey,{description:A.target.value}),disabled:c,placeholder:"description (optional)",className:`${g} w-40`}),r.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx("button",{type:"button",role:"switch","aria-checked":T.requiresReason,"aria-label":"Requires reason",onClick:()=>j(T.rowKey,{requiresReason:!T.requiresReason}),disabled:c,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${T.requiresReason?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${T.requiresReason?"translate-x-4":"translate-x-0"}`})}),"needs reason"]}),r.jsx("button",{type:"button",onClick:()=>v(T.rowKey),disabled:c,className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove transition",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]},T.rowKey))}),r.jsxs("button",{type:"button",onClick:()=>k(S.from),disabled:c,className:"mt-2 shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add transition"]})]},S.from))}),C.length>0&&r.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r.jsxs("select",{value:m,onChange:S=>h(S.target.value),disabled:c,"aria-label":"Add rules for status",className:`${g} font-mono`,children:[r.jsx("option",{value:"",children:"Add rules for status…"}),C.map(S=>r.jsxs("option",{value:S.id,children:[S.label," (",S.id,")"]},S.id))]}),r.jsxs("button",{type:"button",onClick:E,disabled:c||!m,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add status rules"]})]}),r.jsx("datalist",{id:"transition-command-names",children:s.map(S=>r.jsx("option",{value:S},S))})]})}function f2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function x9(e){const t=e.statuses.map(n=>({rowKey:f2(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return S7(t,e.order)}function y9({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:o,listeners:i,setNodeRef:c,setActivatorNodeRef:u,transform:d,transition:m,isDragging:h}=Vf({id:e.rowKey}),g={transform:rs.Transform.toString(d),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...o,...i,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Fi,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("input",{type:"text",value:e.id,readOnly:!0,"aria-label":"Status ID",className:"editor-input w-full text-sm cursor-not-allowed opacity-60"})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[10rem] flex-1",children:r.jsx("input",{type:"text",value:e.description,onChange:y=>n("description",y.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),r.jsx(f7,{value:e.color,onChange:y=>n("color",y),ariaLabel:`Color for ${e.label||e.id}`}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),r.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})}function b9(){var _t;const[e,t]=p.useState(!0),[n,s]=p.useState(null),[o,i]=p.useState(!1),[c,u]=p.useState([]),[d,m]=p.useState(!1),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(new Set),[v,k]=p.useState(new Map),[E,S]=p.useState({open:!1}),[T,A]=p.useState([]),[R,P]=p.useState([]),[$,M]=p.useState({open:!1}),[_,D]=p.useState(()=>sg(Ld)),[V,K]=p.useState(!1),[I,F]=p.useState(!1),[q,Z]=p.useState(!1),[z,G]=p.useState([]),[L,H]=p.useState(!1),[re,U]=p.useState([]),ue=If(ko(Ki,{activationConstraint:{distance:8}}),ko(Wi,{coordinateGetter:Y1})),{preset:ge,setPreset:se,resetPreset:ye}=mx(),[Se,Te]=p.useState(!1),[Pe,Ke]=p.useState(null);async function ct(pe){if(!(pe===ge||Se)){Te(!0),Ke(null);try{await se(pe),Ke({type:"success",message:"Theme updated"}),setTimeout(()=>Ke(null),2e3)}catch(te){Ke({type:"error",message:te instanceof Error?te.message:"Failed to save theme"})}finally{Te(!1)}}}async function et(){Te(!0),Ke(null);try{await ye(),Ke({type:"success",message:"Theme reset to default"}),setTimeout(()=>Ke(null),2e3)}catch(pe){Ke({type:"error",message:pe instanceof Error?pe.message:"Failed to reset theme"})}finally{Te(!1)}}const ot=p.useCallback(pe=>{const te=x9(pe);u(te),i(pe.custom),j(new Set(te.map(xe=>xe.id))),k(new Map),A(pe.rawFacts??[]),P([]),D(sg(pe.derive??Ld)),K(pe.deriveCustom??!1),F(!1),Z(!1),G(ek(pe.transitions??[])),H(pe.transitionsCustom??!1),U(pe.knownCommands??[]),b(!1)},[]),X=p.useCallback(async()=>{try{const pe=await fetch("/api/config/statuses");if(!pe.ok)throw new Error(`HTTP ${pe.status}`);const te=await pe.json();ot(te),s(null)}catch(pe){s(pe instanceof Error?pe.message:"Failed to load config")}finally{t(!1)}},[ot]);p.useEffect(()=>{X()},[X]);function Me(){setTimeout(()=>g(null),3e3)}const Ce=p.useMemo(()=>c.map(pe=>({id:pe.id,label:pe.label})),[c]),Ie=p.useMemo(()=>new Set(c.map(pe=>pe.id)),[c]),Ye=p.useMemo(()=>i9(T),[T]),Fe=p.useMemo(()=>sy(Ye),[Ye]),Ze=p.useMemo(()=>q7(T),[T]),Je=p.useMemo(()=>{try{return i2(Yg(_),c,Fe)}catch{return["derive rules are malformed"]}},[_,c,Fe]),Ot=p.useMemo(()=>L?d2(z,Ie):[],[z,L,Ie]),yt=Ze.length+Je.length+Ot.length,dt=p.useCallback(pe=>{A(pe),b(!0)},[]),le=p.useCallback(pe=>{D(pe),F(!0),Z(!1),K(!0),b(!0)},[]),Y=p.useCallback(()=>{D(sg(Ld)),Z(!0),F(!0),K(!1),b(!0)},[]),fe=p.useCallback(pe=>{G(pe),b(!0)},[]),ne=p.useCallback(()=>{G(pe=>pe.length>0?pe:ek(u2(c2(),Ie))),H(!0),b(!0)},[Ie]);async function he(pe=R){m(!0),g(null);try{const{body:te}=x7({statuses:c,order:c.map(ve=>ve.id),pendingResolutions:v,facts:T,factRemovalAcks:pe,derive:q?null:I?Yg(_):void 0,transitions:L?h9(z):void 0}),xe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)});if(!xe.ok){const ve=await xe.json().catch(()=>null);if(xe.status===409&&(ve==null?void 0:ve.error)==="unresolved-fact-references"&&ve.references){M({open:!0,references:ve.references}),m(!1);return}if((ve==null?void 0:ve.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(ve.problems??[]).join("; ")}`);if((ve==null?void 0:ve.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(ve.problems??[]).join("; ")}`);if((ve==null?void 0:ve.error)==="invalid-facts")throw new Error(`Invalid facts: ${(ve.problems??[]).join("; ")}`);if(xe.status===409&&(ve==null?void 0:ve.error)==="unresolved-orphans"){const Nt=Array.isArray(ve.unresolved)?ve.unresolved.map(It=>It.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Nt}. Click the trash icon on each row to choose remap or delete.`)}if(xe.status===409&&(ve==null?void 0:ve.error)==="concurrent-edit"){const Nt=ve.applied?` (${ve.applied.remapped} remapped, ${ve.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Nt}: ${ve.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await X();return}if(xe.status===500&&(ve==null?void 0:ve.error)==="config-write-failed"&&(ve!=null&&ve.applied)){const{remapped:Nt,deleted:It}=ve.applied,en=ve.message?`: ${ve.message}`:"";g({type:"error",message:`Resolutions applied (${Nt} remapped, ${It} deleted) but the status config write failed${en}. Click Save again to retry.`}),await X();return}throw(ve==null?void 0:ve.error)==="invalid-remap-target"?new Error(`Invalid remap target (${ve.reason}): ${ve.id} → ${ve.target}.`):(ve==null?void 0:ve.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(ve.ids??[]).join(", ")}`):(ve==null?void 0:ve.error)==="stale-resolution"?new Error(`Stale resolution for id "${ve.id??"?"}".`):(ve==null?void 0:ve.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${ve.message??"unknown"}`):(ve==null?void 0:ve.error)==="remap-write-failed"||(ve==null?void 0:ve.error)==="delete-failed"||(ve==null?void 0:ve.error)==="scan-failed"?new Error(`${ve.error}: ${ve.cause??"unknown"}`):new Error((ve==null?void 0:ve.error)??`Save failed (HTTP ${xe.status})`)}const Oe=await xe.json();ot(Oe),vj();const tt=Oe.applied?` (${Oe.applied.remapped} remapped, ${Oe.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${tt}`}),Me()}catch(te){g({type:"error",message:te instanceof Error?te.message:"Save failed"})}finally{m(!1)}}async function De(){m(!0),g(null);try{const pe=await fetch("/api/config/statuses",{method:"DELETE"});if(!pe.ok)throw new Error("Reset failed");const te=await pe.json();ot(te),vj(),g({type:"success",message:"Reset to defaults"}),Me()}catch(pe){g({type:"error",message:pe instanceof Error?pe.message:"Reset failed"})}finally{m(!1)}}function ut(pe,te,xe){u(Oe=>{const tt=[...Oe];return tt[pe]={...tt[pe],[te]:xe},tt}),b(!0)}function ae(){const pe=`status_${c.length+1}`;u(te=>[...te,{rowKey:f2(),id:pe,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function be(pe){u(te=>{const xe=te.filter(tt=>tt.id!==pe),Oe=new Set(xe.map(tt=>tt.id));return k(tt=>G0(tt,Oe)),xe}),b(!0)}async function Le(pe){const te=c[pe].id,xe=y7(te,_,z),Oe=b7(te,_);if(!C.has(te)){if(xe.length===0){be(te);return}S({open:!0,affected:{id:te,count:0,truncated:!1,assignments:[]},pendingId:te,ruleReferences:xe,headlineReferences:Oe});return}try{const tt=await fetch(`/api/config/statuses/affected/${encodeURIComponent(te)}`);if(!tt.ok)throw new Error(`HTTP ${tt.status}`);const ve=await tt.json();if(ve.count===0&&xe.length===0){be(te);return}S({open:!0,affected:ve,pendingId:te,ruleReferences:xe,headlineReferences:Oe})}catch(tt){g({type:"error",message:`Could not check affected assignments for "${te}": ${tt instanceof Error?tt.message:String(tt)}`})}}function at(pe,te){if(!E.open)return;const{pendingId:xe,affected:Oe,ruleReferences:tt}=E;if(xe!==pe.id){S({open:!1});return}if(!c.some(ve=>ve.id===xe)){g({type:"error",message:`Row for "${xe}" was already removed — modal action ignored.`}),S({open:!1});return}pe.mode==="remap"?(D(ve=>v7(ve,xe,te)),G(ve=>w7(ve,xe,te))):(D(ve=>j7(ve,xe,te)),G(ve=>k7(ve,xe))),tt.some(ve=>ve.section!=="transitions")&&(F(!0),K(!0)),u(ve=>{const Nt=ve.filter(en=>en.id!==xe),It=new Set(Nt.map(en=>en.id));return k(en=>{const jt=G0(en,It),wn=new Map(jt);return Oe.count>0&&wn.set(xe,pe),wn}),Nt}),b(!0),S({open:!1})}function Be(){if(!$.open)return;const pe=$.references.map(xe=>xe.factName),te=Array.from(new Set([...R,...pe]));P(te),M({open:!1}),he(te)}function kt(){S({open:!1})}function St(pe){const{active:te,over:xe}=pe;!xe||te.id===xe.id||(u(Oe=>{const tt=Oe.findIndex(Nt=>Nt.rowKey===te.id),ve=Oe.findIndex(Nt=>Nt.rowKey===xe.id);return tt===-1||ve===-1?Oe:qi(Oe,tt,ve)}),b(!0))}return e?r.jsx(xt,{label:"Loading settings..."}):n?r.jsx(Tt,{error:n}):r.jsx(ia,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:ge!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:et,disabled:Se,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[Pe&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${Pe.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:Pe.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Yk.map(pe=>{const te=pe.slug===ge;return r.jsxs("button",{type:"button",onClick:()=>ct(pe.slug),disabled:Se,"aria-pressed":te,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${te?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.amber}}),te&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(Rr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:pe.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:pe.description})]})]},pe.slug)})})]}),r.jsx(N7,{}),r.jsx(W7,{}),r.jsx(K7,{}),r.jsx(F7,{}),r.jsx(A7,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${o?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ax,{className:"h-4 w-4"}),o?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:De,disabled:d||!o&&!y,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(He,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:ae,children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(Bf,{sensors:ue,collisionDetection:_f,onDragEnd:St,children:r.jsx(Uf,{items:c.map(pe=>pe.rowKey),strategy:Bx,children:r.jsx("div",{className:"space-y-2",children:c.map((pe,te)=>r.jsx(y9,{row:pe,isSaved:C.has(pe.id),onUpdate:(xe,Oe)=>ut(te,xe,Oe),onRemove:()=>Le(te)},pe.rowKey))})})})}),r.jsx(u9,{value:_,deriveCustom:V,statuses:Ce,acceptedFacts:Ye,onChange:le,onReset:Y,disabled:d}),r.jsx(g9,{value:z,customizing:L,statuses:Ce,knownCommands:re,onChange:fe,onCustomize:ne,disabled:d}),r.jsx(X7,{rows:T,onChange:dt,saving:d}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:()=>void he(),disabled:d||!y||yt>0,children:[r.jsx(Sf,{className:"h-3.5 w-3.5"}),d?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),X()},disabled:d,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:yt>0?"Fix the highlighted errors to save":"Unsaved changes"})]})]}),r.jsx(m7,{}),E.open&&r.jsx(h7,{open:E.open,affected:{...E.affected,label:((_t=c.find(pe=>pe.id===E.affected.id))==null?void 0:_t.label)??E.affected.id},remaining:c.filter(pe=>pe.id!==E.affected.id&&C.has(pe.id)).map(pe=>({id:pe.id,label:pe.label})),ruleReferences:E.ruleReferences,headlineReferences:E.headlineReferences,onResolve:at,onCancel:kt}),r.jsx(g7,{open:$.open,references:$.open?$.references:[],onConfirm:Be,onCancel:()=>{M({open:!1}),m(!1)}})]})})}const Ms=e=>`${e.workspace}::${e.id}`;function nk(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function v9(){var ut;const{data:e,loading:t,error:n,refetch:s}=fS(),o=zt(),[i,c]=p.useState(""),u=p.useRef(null);Ro("list:todos");const[d,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(""),[C,j]=p.useState("_global"),[v,k]=p.useState(null),[E,S]=p.useState(null),[T,A]=p.useState(new Set),[R,P]=p.useState(!1),$=p.useRef(null),[M,_]=p.useState(null),D=Ay("all"),[V,K]=p.useState(null),[I,F]=p.useState(null),q=p.useRef(null);p.useEffect(()=>{let ae=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const Le=await be.json();ae||_(Le.filter(at=>!at.archived))}catch{}})(),()=>{ae=!0}},[]);async function Z(ae,be){ae.stopPropagation(),await Vc(be)&&(k(be),setTimeout(()=>k(Le=>Le===be?null:Le),1500))}const z=p.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const ae=[];for(const be of e.workspaces)for(const Le of be.items)ae.push({...Le,workspace:be.workspace});return ae},[e]),G=p.useMemo(()=>{const ae=new Set;for(const be of z)for(const Le of be.tags)ae.add(Le);return Array.from(ae).sort()},[z]),L=p.useMemo(()=>{let ae=z;if(i.trim()){const be=i.toLowerCase();ae=ae.filter(Le=>Le.description.toLowerCase().includes(be)||Le.tags.some(at=>at.toLowerCase().includes(be))||Le.id.includes(be))}return d&&(ae=ae.filter(be=>be.status===d)),h&&(ae=ae.filter(be=>be.tags.includes(h))),ae},[z,i,d,h]);p.useEffect(()=>{A(new Set),$.current=null},[i,d,h]);const H=p.useMemo(()=>L.filter(ae=>T.has(Ms(ae))),[L,T]),re=L.length>0&&H.length===L.length,U=H.length>0&&!re,ue=p.useMemo(()=>{if(H.length===0)return null;const ae=new Set(H.map(be=>be.workspace));return ae.size===1?[...ae][0]:null},[H]),ge=p.useMemo(()=>{if(!ue||!M)return;const ae=M.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,M]),se=((ut=H[0])==null?void 0:ut.description)??"",ye=p.useMemo(()=>{if(ue)return null;const ae=new Map;for(const be of H)ae.has(be.workspace)||ae.set(be.workspace,[]),ae.get(be.workspace).push(be.id);return Array.from(ae,([be,Le])=>({workspace:be,todoIds:Le}))},[H,ue]),Se=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ye??[]};function Te(ae,be,Le){const at=Ms(ae),Be=!!(Le&&"shiftKey"in Le&&Le.shiftKey),kt=$.current?Ze.findIndex(St=>Ms(St)===$.current):-1;if(Be&&kt!==-1){const St=Math.min(kt,be),_t=Math.max(kt,be);A(pe=>{const te=new Set(pe);for(let xe=St;xe<=_t;xe++){const Oe=Ze[xe];Oe&&te.add(Ms(Oe))}return te})}else A(St=>{const _t=new Set(St);return _t.has(at)?_t.delete(at):_t.add(at),_t});$.current=at}function Pe(){A(ae=>{const be=new Set(ae);if(re)for(const Le of L)be.delete(Ms(Le));else for(const Le of L)be.add(Ms(Le));return be})}function Ke(){A(new Set),$.current=null}function ct(ae){Ke(),s(),ae!=null&&ae.assignmentRef&&o(nk(ae.assignmentRef))}const et=p.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const ae={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)ae.open+=be.counts.open,ae.in_progress+=be.counts.in_progress,ae.completed+=be.counts.completed,ae.blocked+=be.counts.blocked,ae.total+=be.counts.total;return ae},[e]);async function ot(){y.trim()&&(await xx(C,y.trim()),b(""),s())}async function X(ae,be,Le){switch(Le){case"open":await gS(ae,be);break;case"in_progress":await hS(ae,be);break;case"completed":await pS(ae,be);break;case"blocked":await mS(ae,be);break}s()}async function Me(ae,be){await xS(ae,be),s()}async function Ce(ae,be,Le){await yS(ae,be,Le),s()}async function Ie(ae,be,Le){await bS(ae,be,Le),s()}async function Ye(ae,be,Le){await vS(ae,be,Le),s()}const Fe=Ry(L),Ze=Fe.filter(ae=>!D.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Je}=$c(Ze,{scope:"list:todos",bindO:!1,onOpen:ae=>S(Ms(ae))});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ae;return(ae=u.current)==null?void 0:ae.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[Ot,yt]=ls(),dt=Ot.get("focus");p.useEffect(()=>{if(!dt)return;const ae=z.find(Le=>Le.id===dt);if(!ae)return;const be=fp(ae.status);D.isCollapsed(be)&&D.toggle(be)},[dt,z]),p.useEffect(()=>{if(!dt)return;const ae=document.querySelector(`[data-todo-id="${CSS.escape(dt)}"]`);if(!ae)return;ae.scrollIntoView({block:"nearest"}),ae.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{ae.classList.remove("ring-2","ring-primary/60"),yt(Le=>{const at=new URLSearchParams(Le);return at.delete("focus"),at})},1500);return()=>window.clearTimeout(be)},[dt,Ze.length,yt]);const le=V?L.find(ae=>Ms(ae)===V)??null:null;function Y(ae,be){const Le=q.current;if(Le!=null&&Le.closest(Li)){ae.preventDefault();return}ae.dataTransfer.effectAllowed="move",ae.dataTransfer.setData("text/plain",be),K(be)}function fe(){K(null),F(null)}function ne(ae,be){!le||be.statuses.includes(le.status)||(ae.preventDefault(),ae.dataTransfer.dropEffect="move",F(be.id))}function he(ae,be){I===be.id&&!ae.currentTarget.contains(ae.relatedTarget)&&F(null)}function De(ae,be){ae.preventDefault();const Le=le;fe(),!(!Le||be.statuses.includes(Le.status))&&X(Le.workspace,Le.id,be.dropStatus)}return t?r.jsx(xt,{label:"Loading todos..."}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Fn,{label:"Open",value:et.open,icon:zr}),r.jsx(Fn,{label:"In Progress",value:et.in_progress,icon:ix,tone:"info"}),r.jsx(Fn,{label:"Blocked",value:et.blocked,icon:ux,tone:"warn"}),r.jsx(Fn,{label:"Completed",value:et.completed,icon:zr,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:C,onChange:ae=>j(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(ae=>ae.workspace!=="_global").map(ae=>r.jsx("option",{value:ae.workspace,children:ae.workspace},ae.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:ae=>b(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&ot(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ot,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:i,onChange:ae=>c(ae.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:d,onChange:ae=>m(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:h,onChange:ae=>g(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ae=>r.jsxs("option",{value:ae,children:["#",ae]},ae))]})]}),H.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[H.length," selected",ue?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:ue}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(H.map(ae=>ae.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>P(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:Ke,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:re,ref:ae=>{ae&&(ae.indeterminate=U)},onChange:Pe,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",L.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ae=-1;return Fe.map(({config:be,items:Le})=>{const at=!D.isCollapsed(be.id);return r.jsx(Ty,{label:be.label,count:Le.length,expanded:at,onToggle:()=>D.toggle(be.id),isDropTarget:I===be.id,onDragOver:Be=>ne(Be,be),onDragLeave:Be=>he(Be,be),onDrop:Be=>De(Be,be),children:at&&Le.map(Be=>{ae+=1;const kt=ae,St=Ms(Be),_t=T.has(St);return r.jsxs("div",{draggable:!0,"data-todo-id":Be.id,...Je(kt),onMouseDown:pe=>{q.current=pe.target},onDragStart:pe=>Y(pe,St),onDragEnd:fe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${_t?"ring-1 ring-foreground/20":""} ${V===St?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Be.id}`,title:"Select",checked:_t,onChange:()=>{},onClick:pe=>{pe.stopPropagation(),Te(Be,kt,pe)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(uE,{status:Be.status,onChange:pe=>X(Be.workspace,Be.id,pe)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(fE,{description:Be.description,status:Be.status,editing:E===St,onBeginEdit:()=>S(St),onEndEdit:()=>S(null),onSave:pe=>Ce(Be.workspace,Be.id,pe)}),Be.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Be.tags.map(pe=>`#${pe}`).join(" ")}),Be.linkedAssignmentRef?r.jsxs(Ee,{to:nk(Be.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:pe=>pe.stopPropagation(),children:[r.jsx(Ek,{className:"h-2.5 w-2.5"}),Be.linkedAssignmentRef.includes("/")?Be.linkedAssignmentRef:`oneoff:${Be.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(pE,{item:Be,attachmentUrl:(pe,te)=>yx(Be.workspace,pe,te),onAdd:pe=>Ie(Be.workspace,Be.id,pe),onDelete:pe=>Ye(Be.workspace,Be.id,pe)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Be.workspace!=="_global"&&r.jsx(Ee,{to:`/w/${Be.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:pe=>pe.stopPropagation(),children:Be.workspace})}),v===Be.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Rr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:pe=>Z(pe,Be.id),children:["t:",Be.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:pe=>Z(pe,Be.id),children:r.jsx(Vd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:pe=>{pe.stopPropagation(),Me(Be.workspace,Be.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Be.workspace}-${Be.id}`)})},be.id)})})()}),r.jsx(Ey,{open:R,selectedIds:H.map(ae=>ae.id),scope:Se,onOpenChange:P,onDone:ct,defaultProject:ge,defaultTitle:se,allowOneOff:!0})]})}const w9={open:{icon:"○",cls:"text-muted-foreground",label:"Open"},in_progress:{icon:"◉",cls:"text-status-in-progress-foreground",label:"In progress"},blocked:{icon:"✕",cls:"text-status-blocked-foreground",label:"Blocked"},completed:{icon:"✓",cls:"text-status-completed-foreground",label:"Completed"},mixed:{icon:"◐",cls:"text-muted-foreground",label:"Mixed"}};function j9({bundle:e}){const t=w9[e.derivedStatus.status],{counts:n}=e.derivedStatus;return r.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),r.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&r.jsx("span",{className:"font-medium",children:e.slug}),r.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),r.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&r.jsxs("div",{className:"text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Branch:"})," ",r.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Worktree:"})," ",r.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&r.jsxs("div",{className:"text-muted-foreground truncate",children:[r.jsx("span",{className:"font-medium",children:"Plan:"})," ",r.jsx("code",{className:"font-mono",children:e.planDir})]})]}),r.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(s=>r.jsxs("li",{className:s.status==="completed"?"line-through text-muted-foreground":"",children:[r.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",s.id]}),s.description]},s.id))})]})}function k9({bundles:e,title:t="Bundles"}){return e.length===0?null:r.jsxs("section",{className:"mb-6",children:[r.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>r.jsx(j9,{bundle:n},n.id))]})}function S9(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const d=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),Ac(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function N9(){const{workspace:e}=Bt(),t=e||"_global",{data:n,loading:s,error:o,refetch:i}=_3(t),{data:c}=S9(t),[u,d]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,C]=p.useState(""),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(new Set),[A,R]=p.useState(!1),[P,$]=p.useState(!1),[M,_]=p.useState(null),D=p.useRef(null);Ro("list:todos");const V=Ay("workspace:"+t),[K,I]=p.useState(null),[F,q]=p.useState(null),Z=p.useRef(null);async function z(ne,he){ne.stopPropagation(),await Vc(he)&&(v(he),setTimeout(()=>v(De=>De===he?null:De),1500))}const G=p.useMemo(()=>{if(!(n!=null&&n.items))return[];const ne=new Set;for(const he of n.items)for(const De of he.tags)ne.add(De);return Array.from(ne).sort()},[n]),L=p.useMemo(()=>{if(!(n!=null&&n.items))return[];let ne=n.items;if(u.trim()){const he=u.toLowerCase();ne=ne.filter(De=>De.description.toLowerCase().includes(he)||De.tags.some(ut=>ut.toLowerCase().includes(he))||De.id.includes(he))}return m&&(ne=ne.filter(he=>he.status===m)),g&&(ne=ne.filter(he=>he.tags.includes(g))),ne},[n,u,m,g]);p.useEffect(()=>{T(new Set)},[u,m,g,t]);const H=p.useMemo(()=>L.filter(ne=>S.has(ne.id)).length,[L,S]),re=L.length>0&&H===L.length,U=H>0&&!re;function ue(ne){T(he=>{const De=new Set(he);return De.has(ne)?De.delete(ne):De.add(ne),De})}function ge(){T(ne=>{const he=new Set(ne);if(re)for(const De of L)he.delete(De.id);else for(const De of L)he.add(De.id);return he})}function se(){T(new Set)}const ye=M?[M]:Array.from(S);function Se(){T(new Set),_(null),i()}function Te(){T(new Set),i()}async function Pe(){b.trim()&&(await xx(t,b.trim()),C(""),i())}async function Ke(ne,he,De){ne.stopPropagation(),window.confirm(`Delete "${De}"? This can't be undone.`)&&(await xS(t,he),i())}async function ct(ne,he){switch(he){case"open":await gS(t,ne);break;case"in_progress":await hS(t,ne);break;case"completed":await pS(t,ne);break;case"blocked":await mS(t,ne);break}i()}async function et(ne,he){await yS(t,ne,he),i()}async function ot(ne,he){await bS(t,ne,he),i()}async function X(ne,he){await vS(t,ne,he),i()}const Me=Ry(L),Ce=Me.filter(ne=>!V.isCollapsed(ne.config.id)).flatMap(ne=>ne.items),{hotkeyRowProps:Ie}=$c(Ce,{scope:"list:todos",bindO:!1,onOpen:ne=>E(ne.id)});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ne;return(ne=D.current)==null?void 0:ne.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[Ye,Fe]=ls(),Ze=Ye.get("focus");p.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const ne=n.items.find(De=>De.id===Ze);if(!ne)return;const he=fp(ne.status);V.isCollapsed(he)&&V.toggle(he)},[Ze,n==null?void 0:n.items]),p.useEffect(()=>{if(!Ze)return;const ne=document.querySelector(`[data-todo-id="${window.CSS.escape(Ze)}"]`);if(!ne)return;ne.scrollIntoView({block:"nearest"}),ne.classList.add("ring-2","ring-primary/60");const he=window.setTimeout(()=>{ne.classList.remove("ring-2","ring-primary/60"),Fe(De=>{const ut=new URLSearchParams(De);return ut.delete("focus"),ut})},1500);return()=>window.clearTimeout(he)},[Ze,Ce.length,Fe]);const Je=K?(n==null?void 0:n.items.find(ne=>ne.id===K))??null:null;function Ot(ne,he){const De=Z.current;if(De!=null&&De.closest(Li)){ne.preventDefault();return}ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("text/plain",he),I(he)}function yt(){I(null),q(null)}function dt(ne,he){!Je||he.statuses.includes(Je.status)||(ne.preventDefault(),ne.dataTransfer.dropEffect="move",q(he.id))}function le(ne,he){F===he.id&&!ne.currentTarget.contains(ne.relatedTarget)&&q(null)}function Y(ne,he){ne.preventDefault();const De=Je;yt(),!(!De||he.statuses.includes(De.status))&&ct(De.id,he.dropStatus)}if(s)return r.jsx(xt,{label:"Loading todos..."});if(o)return r.jsx(Tt,{error:o});const fe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Fn,{label:"Open",value:fe.open,icon:zr}),r.jsx(Fn,{label:"In Progress",value:fe.in_progress,icon:zr,tone:"info"}),r.jsx(Fn,{label:"Blocked",value:fe.blocked,icon:ux,tone:"warn"}),r.jsx(Fn,{label:"Total",value:fe.total,icon:zr})]}),c&&r.jsx(k9,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:ne=>C(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&Pe(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:Pe,disabled:!b.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:D,type:"text",placeholder:"Search...",value:u,onChange:ne=>d(ne.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:ne=>h(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:g,onChange:ne=>y(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ne=>r.jsxs("option",{value:ne,children:["#",ne]},ne))]})]}),S.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[S.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{_(null),$(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:se,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:re,ref:ne=>{ne&&(ne.indeterminate=U)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",L.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ne=-1;return Me.map(({config:he,items:De})=>{const ut=!V.isCollapsed(he.id);return r.jsx(Ty,{label:he.label,count:De.length,expanded:ut,onToggle:()=>V.toggle(he.id),isDropTarget:F===he.id,onDragOver:ae=>dt(ae,he),onDragLeave:ae=>le(ae,he),onDrop:ae=>Y(ae,he),children:ut&&De.map(ae=>(ne+=1,r.jsx(dE,{item:ae,copiedId:j,selected:S.has(ae.id),editing:k===ae.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:et,onAddAttachments:ot,onDeleteAttachment:X,attachmentUrl:(be,Le)=>yx(t,be,Le),onToggleSelected:be=>ue(be),onMoveOne:(be,Le)=>{Le.stopPropagation(),_(be),$(!0)},onStatusChange:ct,onCopyId:z,onDelete:Ke,hotkeyRowProps:Ie(ne),onDragOrigin:be=>{Z.current=be.target},onDragStart:Ot,onDragEnd:yt,isDragging:K===ae.id},ae.id)))},he.id)})})()}),r.jsx(Ey,{open:A,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:Te}),r.jsx(hE,{open:P,selectedIds:ye,scope:{kind:"workspace",workspace:t},onOpenChange:ne=>{$(ne),ne||_(null)},onDone:Se})]})}function p2(){const{views:e}=Mc();async function t(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=ZN(u,d.workspace).config,h=lf(d.config,m,d.config);await ef(i.id,{name:c,config:h})}async function n(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=oy(u,d.workspace).config,h=lf(d.config,m,d.config);await ef(i.id,{name:c,config:h})}async function s(i){await Pi({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await iI(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:o}}const rk=80,C9={kanban:"Kanban",list:"List",table:"Table"},E9={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function m2({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:o}){const i=!!s,c=ha(),u=rp(),{data:d}=Cs(),{data:m}=Cf(),[h,g]=p.useState(""),[y,b]=p.useState(ti.viewMode),[C,j]=p.useState([]),[v,k]=p.useState([]),[E,S]=p.useState([]),[T,A]=p.useState([]),[R,P]=p.useState([]),[$,M]=p.useState([]),[_,D]=p.useState("all"),[V,K]=p.useState(null),[I,F]=p.useState(""),[q,Z]=p.useState(ti.sortField),[z,G]=p.useState(ti.sortDirection),[L,H]=p.useState(!1),[re,U]=p.useState(null);function ue(){b(ti.viewMode),j([]),k([]),S([]),A([]),P([]),M([]),D("all"),K(null),F(""),Z(ti.sortField),G(ti.sortDirection)}p.useEffect(()=>{if(e)if(U(null),H(!1),s){const X=s.config.filters;g(s.name),b(s.config.viewMode),j(ze(X.status)),k(ze(X.priority)),S(ze(X.type)),A(ze(X.project)),P(ze(X.assignee)),M(ze(X.tags)),D(X.activity??"all"),K(op(X.dateRange)),F(X.search??""),Z(s.config.sortField),G(s.config.sortDirection)}else g(""),ue()},[e,s]);const ge=X=>Me=>X?X==="_ungrouped"?Me.projectWorkspace===null:Me.projectWorkspace===X:!0,se=p.useMemo(()=>{const X=Ce=>n?n==="_ungrouped"?Ce.workspace===null:Ce.workspace===n:!0,Me=(d??[]).filter(X);return[{value:"__standalone__",label:"No project"},...Me.map(Ce=>({value:Ce.slug,label:Ce.title}))]},[d,n]),ye=p.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ie of(m==null?void 0:m.assignments)??[])Me(Ie)&&Ie.assignee&&X.add(Ie.assignee);const Ce=[{value:"__unassigned__",label:"Unassigned"}];for(const Ie of Array.from(X).sort())Ce.push({value:Ie,label:Ie});return Ce},[m,n]),Se=p.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ce of(m==null?void 0:m.assignments)??[])if(Me(Ce))for(const Ie of Ce.tags??[])X.add(Ie);return Array.from(X).sort().map(Ce=>({value:Ce,label:Ce}))},[m,n]),Te=p.useMemo(()=>c.order.map(X=>({value:X,label:Bc(c,X)})),[c]),Pe=p.useMemo(()=>_5.map(X=>({value:X,label:X[0].toUpperCase()+X.slice(1)})),[]),Ke=p.useMemo(()=>u.definitions.map(X=>({value:X.id,label:Ni(u,X.id)})),[u]),ct=Ux.map(X=>({value:X,label:C9[X]})),et=h.trim(),ot=et.length>0&&et.length<=rk;return r.jsx(On,{open:e,onOpenChange:t,children:r.jsx(Rn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async X=>{if(X.preventDefault(),!ot||L)return;H(!0),U(null);const Me={viewMode:y,filters:{status:C,priority:v,type:E,project:T,assignee:R,tags:$,activity:_,dateRange:la(V),search:I},sortField:q,sortDirection:z};try{await o(et,Me)}catch(Ce){U(Ce instanceof Error?Ce.message:String(Ce)),H(!1)}},children:[r.jsx(Zn,{children:r.jsx(An,{children:i?"Edit view":"Create view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),r.jsx("input",{id:"create-view-name",type:"text",value:h,autoFocus:!0,required:!0,maxLength:rk,onChange:X=>g(X.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(ip,{value:y,onChange:X=>b(X),options:ct})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(xs,{label:"Status",children:r.jsx(yn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:Te,value:C,onChange:j})}),r.jsx(xs,{label:"Priority",children:r.jsx(yn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:Pe,value:v,onChange:k})}),r.jsx(xs,{label:"Type",children:r.jsx(yn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Ke,value:E,onChange:S})}),r.jsx(xs,{label:"Project",children:r.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:se,value:T,onChange:A})}),r.jsx(xs,{label:"Assignee",children:r.jsx(yn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ye,value:R,onChange:P})}),r.jsx(xs,{label:"Tags",children:r.jsx(yn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:Se,value:$,onChange:M})}),r.jsx(xs,{label:"Activity",children:r.jsxs("select",{value:_,onChange:X=>D(X.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]})}),r.jsx(xs,{label:"Date range",children:r.jsx(sp,{className:"w-full",value:V,onChange:K})}),r.jsx(xs,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:I,onChange:X=>F(X.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(xs,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:q,onChange:X=>Z(X.target.value),className:"editor-input w-full",children:J1.map(X=>r.jsx("option",{value:X,children:E9[X]??X},X))}),r.jsx("button",{type:"button",onClick:()=>G(X=>X==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:z==="asc"?"Ascending":"Descending",children:z==="asc"?"Asc":"Desc"})]})})]}),re?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:re}):null,r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,className:"shell-action",disabled:L,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:L,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||L,className:"shell-action shell-action--cta disabled:opacity-50",children:L?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function xs({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const T9={kanban:"Kanban",list:"List",table:"Table"},R9={assignment:"Assignment",session:"Session"},A9={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function sk(){const{workspace:e}=Bt(),{views:t,loading:n}=Mc(),{submitEdit:s,submitEditSession:o,duplicate:i,remove:c}=p2(),{toast:u,showToast:d,dismissToast:m}=Ao(),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(!1),[v,k]=p.useState(!1),[E,S]=p.useState(null);async function T(K,I){const{workspace:F,config:q}=ZN(I,e??null);try{await Pi({name:K,workspace:F,config:q}),j(!1),d(`Created view "${K}"`)}catch(Z){throw d(Z instanceof Error?Z.message:"Failed to create saved view"),Z}}async function A(K,I){const{workspace:F,config:q}=oy(I,e??null);try{await Pi({name:K,workspace:F,config:q,entityType:"session"}),k(!1),d(`Created session view "${K}"`)}catch(Z){throw d(Z instanceof Error?Z.message:"Failed to create session view"),Z}}async function R(K,I,F){try{await s(K,I,F),S(null),d(`Updated view "${I}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to update saved view"),q}}async function P(K,I,F){try{await o(K,I,F),S(null),d(`Updated session view "${I}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to update session view"),q}}async function $(K){try{await i(K),d(`Duplicated "${K.name}"`)}catch(I){d(I instanceof Error?I.message:"Failed to duplicate saved view")}}async function M(){if(h){b(!0);try{await c(h),g(null)}catch(K){d(K instanceof Error?K.message:"Failed to delete saved view")}finally{b(!1)}}}const _=r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create view"]}),D=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create session view"]}),V=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(uf,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,_]})}),n?r.jsx(xt,{label:"Loading saved views…"}):t.length===0?r.jsx(Et,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,_]})}):r.jsx(He,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(K=>r.jsx(P9,{view:K,onRequestDelete:()=>g(K),onRequestEdit:()=>S(K),onRequestDuplicate:()=>void $(K)},K.id))})}),r.jsx(m2,{open:C||!V&&E!==null,onOpenChange:K=>{K||(j(!1),V||S(null))},workspace:E&&!V?E.workspace:e??null,initialView:E&&!V?E:null,onSubmit:E&&!V?(K,I)=>R(E,K,I):T}),r.jsx(sC,{open:v||V&&E!==null,onOpenChange:K=>{K||(k(!1),V&&S(null))},workspace:E&&V?E.workspace:e??null,initialView:E&&V?E:null,onSubmit:E&&V?(K,I)=>P(E,K,I):A}),r.jsx(ba,{open:h!==null,title:"Delete saved view?",description:h?`Delete '${h.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:y,destructive:!0,onConfirm:M,onOpenChange:K=>{!K&&!y&&g(null)}}),r.jsx(xa,{toast:u,onDismiss:m})]})}function P9({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const o=zt(),i=()=>o(tC(e)),c=rC(e.config.filters),u=e.workspace?Sn(e.workspace):null,d=e.entityType??"assignment",m=d==="session",h=m?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`:null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 text-xs font-medium ${A9[d]??"bg-muted text-muted-foreground"}`,children:R9[d]??d}),!m&&r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:T9[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[c,h?` · ${h}`:""]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const D9={kanban:"Kanban",list:"List",table:"Table"};function ok(){const{id:e,workspace:t}=Bt(),n=zt(),{view:s,ready:o,error:i,refetch:c}=So(e),{submitEdit:u,duplicate:d,remove:m}=p2(),{toast:h,showToast:g,dismissToast:y}=Ao(),[b,C]=p.useState(!1),[j,v]=p.useState(!1),[k,E]=p.useState(!1);if(p.useEffect(()=>{!o||!s||(t??null)!==(s.workspace??null)&&n(tC(s),{replace:!0})},[o,s,t,n]),!o)return r.jsx(xt,{label:"Loading view…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(uf,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ee,{to:Id(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(zd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=s.workspace?Sn(s.workspace):null;async function T(P,$){const M=s;try{await u(M,P,$),C(!1),g(`Updated view "${P}"`)}catch(_){throw g(_ instanceof Error?_.message:"Failed to update saved view"),_}}async function A(){const P=s;try{await d(P),g(`Duplicated "${P.name}"`)}catch($){g($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function R(){const P=s;E(!0);try{await m(P),v(!1),n(Id(P.workspace))}catch($){g($ instanceof Error?$.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ee,{to:Id(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(zd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(uf,{title:s.name,description:rC(s.config.filters),actions:r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:D9[s.config.viewMode]}),S?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:S}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void A(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(nC(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>v(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(JN,{view:s}),b?r.jsx(m2,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(ba,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:R,onOpenChange:P=>{!P&&!k&&v(!1)}}),r.jsx(xa,{toast:h,onDismiss:y})]})}function $9(){return r.jsx(kA,{children:r.jsx(Q$,{children:r.jsx(XR,{children:r.jsxs(Ge,{element:r.jsx(NL,{}),children:[r.jsx(Ge,{path:"/",element:r.jsx(rM,{})}),r.jsx(Ge,{path:"/projects",element:r.jsx(Tj,{})}),r.jsx(Ge,{path:"/archive",element:r.jsx(yM,{})}),r.jsx(Ge,{path:"/assignments",element:r.jsx(_0,{})}),r.jsx(Ge,{path:"/assignments/new",element:r.jsx(B0,{})}),r.jsx(Ge,{path:"/assignments/:id",element:r.jsx(gU,{})}),r.jsx(Ge,{path:"/assignments/:id/edit",element:r.jsx(Xh,{})}),r.jsx(Ge,{path:"/assignments/:id/plan/edit",element:r.jsx(Zh,{})}),r.jsx(Ge,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(eg,{})}),r.jsx(Ge,{path:"/assignments/:id/handoff/edit",element:r.jsx(tg,{})}),r.jsx(Ge,{path:"/assignments/:id/decision-record/edit",element:r.jsx(ng,{})}),r.jsx(Ge,{path:"/servers",element:r.jsx(V0,{})}),r.jsx(Ge,{path:"/inventories",element:r.jsx(H0,{})}),r.jsx(Ge,{path:"/usage",element:r.jsx(W0,{})}),r.jsx(Ge,{path:"/agent-sessions",element:r.jsx(K0,{})}),r.jsx(Ge,{path:"/playbooks",element:r.jsx(e7,{})}),r.jsx(Ge,{path:"/playbooks/create",element:r.jsx(n7,{})}),r.jsx(Ge,{path:"/playbooks/:slug",element:r.jsx(t7,{})}),r.jsx(Ge,{path:"/playbooks/:slug/edit",element:r.jsx(r7,{})}),r.jsx(Ge,{path:"/memories",element:r.jsx(s7,{})}),r.jsx(Ge,{path:"/memories/new",element:r.jsx(a7,{})}),r.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(o7,{})}),r.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(i7,{})}),r.jsx(Ge,{path:"/resources",element:r.jsx(l7,{})}),r.jsx(Ge,{path:"/resources/new",element:r.jsx(u7,{})}),r.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(c7,{})}),r.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(d7,{})}),r.jsx(Ge,{path:"/todos",element:r.jsx(v9,{})}),r.jsx(Ge,{path:"/views",element:r.jsx(sk,{})}),r.jsx(Ge,{path:"/views/:id",element:r.jsx(ok,{})}),r.jsx(Ge,{path:"/help",element:r.jsx(oM,{})}),r.jsx(Ge,{path:"/settings",element:r.jsx(b9,{})}),r.jsx(Ge,{path:"/create/project",element:r.jsx(F0,{})}),r.jsx(Ge,{path:"/projects/:slug",element:r.jsx(T0,{})}),r.jsx(Ge,{path:"/projects/:slug/edit",element:r.jsx(U0,{})}),r.jsx(Ge,{path:"/projects/:slug/create/assignment",element:r.jsx(z0,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug",element:r.jsx($0,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Xh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Zh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(eg,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(tg,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(ng,{})}),r.jsx(Ge,{path:"/w/:workspace/projects",element:r.jsx(Tj,{})}),r.jsx(Ge,{path:"/w/:workspace/assignments",element:r.jsx(_0,{})}),r.jsx(Ge,{path:"/w/:workspace/assignments/new",element:r.jsx(B0,{})}),r.jsx(Ge,{path:"/w/:workspace/servers",element:r.jsx(V0,{})}),r.jsx(Ge,{path:"/w/:workspace/inventories",element:r.jsx(H0,{})}),r.jsx(Ge,{path:"/w/:workspace/usage",element:r.jsx(W0,{})}),r.jsx(Ge,{path:"/w/:workspace/agent-sessions",element:r.jsx(K0,{})}),r.jsx(Ge,{path:"/w/:workspace/todos",element:r.jsx(N9,{})}),r.jsx(Ge,{path:"/w/:workspace/views",element:r.jsx(sk,{})}),r.jsx(Ge,{path:"/w/:workspace/views/:id",element:r.jsx(ok,{})}),r.jsx(Ge,{path:"/w/:workspace/create/project",element:r.jsx(F0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug",element:r.jsx(T0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(U0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(z0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx($0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Xh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Zh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(eg,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(tg,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(ng,{})})]})})})})}a3();XT.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(i3,{children:r.jsx($9,{})})}));export{VM as _,O9 as a,xf as g};
|