syntaur 0.26.0 → 0.31.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/dashboard/dist/assets/{_basePickBy-jPItyrQO.js → _basePickBy-ku_fr_ud.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-pEwUwurC.js → _baseUniq-BfsrymUF.js} +1 -1
- package/dashboard/dist/assets/{arc-ZZtp507S.js → arc-CAIW_Q55.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-BNUerPqd.js → architectureDiagram-2XIMDMQ5-BSe-tJ6X.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-CQyovXFv.js → blockDiagram-WCTKOSBZ-BUj6C0-C.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-wNQ6EHeF.js → c4Diagram-IC4MRINW-mV-acLl-.js} +1 -1
- package/dashboard/dist/assets/channel-DSNNpVLB.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-ZaueC30R.js → chunk-4BX2VUAB-TStVwY56.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-BjsRB0t8.js → chunk-55IACEB6-XPX1tCrH.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-BHuSr-Tl.js → chunk-FMBD7UC4-Dm-0meIo.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-SHNJA0es.js → chunk-JSJVCQXG-BVhtvJFZ.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-JXFPjeo4.js → chunk-KX2RTZJC-C3r5FnmX.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-BiJqWT0B.js → chunk-NQ4KR5QH-DYjOE2Lm.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-DoXWBqP2.js → chunk-QZHKN3VN-CWpi_905.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-Dqtf_5it.js → chunk-WL4C6EOR-BLePb5II.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-CCzPEXaq.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-CCzPEXaq.js +1 -0
- package/dashboard/dist/assets/clone-D_RUHO8e.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-Cr6bkSKq.js → cose-bilkent-S5V4N54A-Bqz-BOZR.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-oXpXFuJQ.js → dagre-KLK3FWXG-ObXz616p.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-Bq_xdDbg.js → diagram-E7M64L7V-BmnMDa4P.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-N7Er4Dui.js → diagram-IFDJBPK2-DF97e8GZ.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-BU0Zm2Fn.js → diagram-P4PSJMXO-B89xgPXg.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-BSgZb5me.js → erDiagram-INFDFZHY-DLsFlh-n.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-Bn7pEu0U.js → flowDiagram-PKNHOUZH-BTOf6WXa.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-B8Xq9tyM.js → ganttDiagram-A5KZAMGK-Bf3qSpfJ.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-BoLUjYDa.js → gitGraphDiagram-K3NZZRJ6-TXYSfb6n.js} +1 -1
- package/dashboard/dist/assets/{graph-Pde_ni_y.js → graph-CX9dAzVP.js} +1 -1
- package/dashboard/dist/assets/index-BohN_jjP.css +1 -0
- package/dashboard/dist/assets/index-jQ0-J3SI.js +556 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-Brv2khjP.js → infoDiagram-LFFYTUFH-JqFsL_yV.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-D5hxQ0Ke.js → ishikawaDiagram-PHBUUO56-jA6-TFjI.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-CUevv5jA.js → journeyDiagram-4ABVD52K-QvSViLCF.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-Cf6XyrAC.js → kanban-definition-K7BYSVSG-CwD7Cohp.js} +1 -1
- package/dashboard/dist/assets/{layout-Bc8RP2w3.js → layout-upwYHmrE.js} +1 -1
- package/dashboard/dist/assets/{linear-Cd_XUbl7.js → linear-Caio4qd9.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-Bx8MuMEM.js → mermaid.core-GdFnPCS2.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-D_4Pl3Mu.js → mindmap-definition-YRQLILUH-gcJj2wQg.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-DRVbjwxO.js → pieDiagram-SKSYHLDU-D8HzHHsW.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-BciLlBMH.js → quadrantDiagram-337W2JSQ-Dw7trxdd.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-Bprwe8Z2.js → requirementDiagram-Z7DCOOCP-4TeVfDt_.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DI0t8Uiu.js → sankeyDiagram-WA2Y5GQK-BoK6HCj7.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-CpCLCs5J.js → sequenceDiagram-2WXFIKYE-Cfdz1JPT.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-V-1VCApT.js → stateDiagram-RAJIS63D-CTxzMaII.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BhvDlKAC.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-DCAo6tA7.js → timeline-definition-YZTLITO2-BQ6k-eeg.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-CKlbZ6Y_.js → treemap-KZPCXAKY-Dj58PW0M.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-CJSijre_.js → vennDiagram-LZ73GAT5-C_nMFV9L.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DXd1BBmK.js → xychartDiagram-JWTSCODW-BcsMJT15.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +1061 -349
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +6894 -4678
- package/dist/index.js.map +1 -1
- package/dist/launch/index.js +1191 -1181
- package/dist/launch/index.js.map +1 -1
- package/package.json +2 -1
- package/platforms/README.md +21 -0
- package/platforms/claude-code/skills/clear-assignment/SKILL.md +2 -2
- package/platforms/claude-code/skills/log-progress/SKILL.md +29 -48
- package/platforms/claude-code/skills/plan-assignment/SKILL.md +20 -1
- package/platforms/claude-code/skills/save-session-summary/SKILL.md +28 -29
- package/platforms/claude-code/skills/set-workspace/SKILL.md +25 -41
- package/platforms/codex/skills/clear-assignment/SKILL.md +2 -2
- package/platforms/codex/skills/log-progress/SKILL.md +29 -48
- package/platforms/codex/skills/plan-assignment/SKILL.md +20 -1
- package/platforms/codex/skills/save-session-summary/SKILL.md +28 -29
- package/platforms/codex/skills/set-workspace/SKILL.md +25 -41
- package/skills/clear-assignment/SKILL.md +2 -2
- package/skills/log-progress/SKILL.md +29 -48
- package/skills/plan-assignment/SKILL.md +20 -1
- package/skills/save-session-summary/SKILL.md +28 -29
- package/skills/set-workspace/SKILL.md +25 -41
- package/dashboard/dist/assets/channel-BYnzdl2x.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BnPZbM4g.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BnPZbM4g.js +0 -1
- package/dashboard/dist/assets/clone-DYNFxLr3.js +0 -1
- package/dashboard/dist/assets/index-7rNWNKq7.css +0 -1
- package/dashboard/dist/assets/index-Nc9kfSW-.js +0 -550
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-B6S2ctrX.js +0 -1
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
var e2=Object.defineProperty;var t2=(e,t,n)=>t in e?e2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xb=(e,t,n)=>t2(e,typeof t!="symbol"?t+"":t,n);function n2(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function s(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function Td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function HB(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 i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}),n}var rm={exports:{}},pl={},sm={exports:{}},ft={};/**
|
|
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 Qb;function r2(){if(Qb)return ft;Qb=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),x=Symbol.iterator;function y(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function w(M,Q,O){this.props=M,this.context=Q,this.refs=j,this.updater=O||b}w.prototype.isReactComponent={},w.prototype.setState=function(M,Q){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,Q,"setState")},w.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function k(){}k.prototype=w.prototype;function E(M,Q,O){this.props=M,this.context=Q,this.refs=j,this.updater=O||b}var N=E.prototype=new k;N.constructor=E,C(N,w.prototype),N.isPureReactComponent=!0;var P=Array.isArray,$=Object.prototype.hasOwnProperty,T={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function L(M,Q,O){var ue,ge={},V=null,oe=null;if(Q!=null)for(ue in Q.ref!==void 0&&(oe=Q.ref),Q.key!==void 0&&(V=""+Q.key),Q)$.call(Q,ue)&&!D.hasOwnProperty(ue)&&(ge[ue]=Q[ue]);var me=arguments.length-2;if(me===1)ge.children=O;else if(1<me){for(var ve=Array(me),ke=0;ke<me;ke++)ve[ke]=arguments[ke+2];ge.children=ve}if(M&&M.defaultProps)for(ue in me=M.defaultProps,me)ge[ue]===void 0&&(ge[ue]=me[ue]);return{$$typeof:e,type:M,key:V,ref:oe,props:ge,_owner:T.current}}function Y(M,Q){return{$$typeof:e,type:M.type,key:Q,ref:M.ref,props:M.props,_owner:M._owner}}function X(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function I(M){var Q={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(O){return Q[O]})}var U=/\/+/g;function ne(M,Q){return typeof M=="object"&&M!==null&&M.key!=null?I(""+M.key):Q.toString(36)}function F(M,Q,O,ue,ge){var V=typeof M;(V==="undefined"||V==="boolean")&&(M=null);var oe=!1;if(M===null)oe=!0;else switch(V){case"string":case"number":oe=!0;break;case"object":switch(M.$$typeof){case e:case t:oe=!0}}if(oe)return oe=M,ge=ge(oe),M=ue===""?"."+ne(oe,0):ue,P(ge)?(O="",M!=null&&(O=M.replace(U,"$&/")+"/"),F(ge,Q,O,"",function(ke){return ke})):ge!=null&&(X(ge)&&(ge=Y(ge,O+(!ge.key||oe&&oe.key===ge.key?"":(""+ge.key).replace(U,"$&/")+"/")+M)),Q.push(ge)),1;if(oe=0,ue=ue===""?".":ue+":",P(M))for(var me=0;me<M.length;me++){V=M[me];var ve=ue+ne(V,me);oe+=F(V,Q,O,ve,ge)}else if(ve=y(M),typeof ve=="function")for(M=ve.call(M),me=0;!(V=M.next()).done;)V=V.value,ve=ue+ne(V,me++),oe+=F(V,Q,O,ve,ge);else if(V==="object")throw Q=String(M),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return oe}function H(M,Q,O){if(M==null)return M;var ue=[],ge=0;return F(M,ue,"","",function(V){return Q.call(O,V,ge++)}),ue}function ee(M){if(M._status===-1){var Q=M._result;Q=Q(),Q.then(function(O){(M._status===0||M._status===-1)&&(M._status=1,M._result=O)},function(O){(M._status===0||M._status===-1)&&(M._status=2,M._result=O)}),M._status===-1&&(M._status=0,M._result=Q)}if(M._status===1)return M._result.default;throw M._result}var ce={current:null},_={transition:null},W={ReactCurrentDispatcher:ce,ReactCurrentBatchConfig:_,ReactCurrentOwner:T};function R(){throw Error("act(...) is not supported in production builds of React.")}return ft.Children={map:H,forEach:function(M,Q,O){H(M,function(){Q.apply(this,arguments)},O)},count:function(M){var Q=0;return H(M,function(){Q++}),Q},toArray:function(M){return H(M,function(Q){return Q})||[]},only:function(M){if(!X(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},ft.Component=w,ft.Fragment=n,ft.Profiler=i,ft.PureComponent=E,ft.StrictMode=s,ft.Suspense=p,ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,ft.act=R,ft.cloneElement=function(M,Q,O){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var ue=C({},M.props),ge=M.key,V=M.ref,oe=M._owner;if(Q!=null){if(Q.ref!==void 0&&(V=Q.ref,oe=T.current),Q.key!==void 0&&(ge=""+Q.key),M.type&&M.type.defaultProps)var me=M.type.defaultProps;for(ve in Q)$.call(Q,ve)&&!D.hasOwnProperty(ve)&&(ue[ve]=Q[ve]===void 0&&me!==void 0?me[ve]:Q[ve])}var ve=arguments.length-2;if(ve===1)ue.children=O;else if(1<ve){me=Array(ve);for(var ke=0;ke<ve;ke++)me[ke]=arguments[ke+2];ue.children=me}return{$$typeof:e,type:M.type,key:ge,ref:V,props:ue,_owner:oe}},ft.createContext=function(M){return M={$$typeof:c,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},ft.createElement=L,ft.createFactory=function(M){var Q=L.bind(null,M);return Q.type=M,Q},ft.createRef=function(){return{current:null}},ft.forwardRef=function(M){return{$$typeof:u,render:M}},ft.isValidElement=X,ft.lazy=function(M){return{$$typeof:h,_payload:{_status:-1,_result:M},_init:ee}},ft.memo=function(M,Q){return{$$typeof:m,type:M,compare:Q===void 0?null:Q}},ft.startTransition=function(M){var Q=_.transition;_.transition={};try{M()}finally{_.transition=Q}},ft.unstable_act=R,ft.useCallback=function(M,Q){return ce.current.useCallback(M,Q)},ft.useContext=function(M){return ce.current.useContext(M)},ft.useDebugValue=function(){},ft.useDeferredValue=function(M){return ce.current.useDeferredValue(M)},ft.useEffect=function(M,Q){return ce.current.useEffect(M,Q)},ft.useId=function(){return ce.current.useId()},ft.useImperativeHandle=function(M,Q,O){return ce.current.useImperativeHandle(M,Q,O)},ft.useInsertionEffect=function(M,Q){return ce.current.useInsertionEffect(M,Q)},ft.useLayoutEffect=function(M,Q){return ce.current.useLayoutEffect(M,Q)},ft.useMemo=function(M,Q){return ce.current.useMemo(M,Q)},ft.useReducer=function(M,Q,O){return ce.current.useReducer(M,Q,O)},ft.useRef=function(M){return ce.current.useRef(M)},ft.useState=function(M){return ce.current.useState(M)},ft.useSyncExternalStore=function(M,Q,O){return ce.current.useSyncExternalStore(M,Q,O)},ft.useTransition=function(){return ce.current.useTransition()},ft.version="18.3.1",ft}var Zb;function qh(){return Zb||(Zb=1,sm.exports=r2()),sm.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 ev;function s2(){if(ev)return pl;ev=1;var e=qh(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,p,m){var h,x={},y=null,b=null;m!==void 0&&(y=""+m),p.key!==void 0&&(y=""+p.key),p.ref!==void 0&&(b=p.ref);for(h in p)s.call(p,h)&&!l.hasOwnProperty(h)&&(x[h]=p[h]);if(u&&u.defaultProps)for(h in p=u.defaultProps,p)x[h]===void 0&&(x[h]=p[h]);return{$$typeof:t,type:u,key:y,ref:b,props:x,_owner:i.current}}return pl.Fragment=n,pl.jsx=c,pl.jsxs=c,pl}var tv;function o2(){return tv||(tv=1,rm.exports=s2()),rm.exports}var r=o2(),f=qh();const nn=Td(f),Mj=n2({__proto__:null,default:nn},[f]);var wu={},om={exports:{}},er={},im={exports:{}},am={};/**
|
|
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 nv;function i2(){return nv||(nv=1,(function(e){function t(_,W){var R=_.length;_.push(W);e:for(;0<R;){var M=R-1>>>1,Q=_[M];if(0<i(Q,W))_[M]=W,_[R]=Q,R=M;else break e}}function n(_){return _.length===0?null:_[0]}function s(_){if(_.length===0)return null;var W=_[0],R=_.pop();if(R!==W){_[0]=R;e:for(var M=0,Q=_.length,O=Q>>>1;M<O;){var ue=2*(M+1)-1,ge=_[ue],V=ue+1,oe=_[V];if(0>i(ge,R))V<Q&&0>i(oe,ge)?(_[M]=oe,_[V]=R,M=V):(_[M]=ge,_[ue]=R,M=ue);else if(V<Q&&0>i(oe,R))_[M]=oe,_[V]=R,M=V;else break e}}return W}function i(_,W){var R=_.sortIndex-W.sortIndex;return R!==0?R:_.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var p=[],m=[],h=1,x=null,y=3,b=!1,C=!1,j=!1,w=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 N(_){for(var W=n(m);W!==null;){if(W.callback===null)s(m);else if(W.startTime<=_)s(m),W.sortIndex=W.expirationTime,t(p,W);else break;W=n(m)}}function P(_){if(j=!1,N(_),!C)if(n(p)!==null)C=!0,ee($);else{var W=n(m);W!==null&&ce(P,W.startTime-_)}}function $(_,W){C=!1,j&&(j=!1,k(L),L=-1),b=!0;var R=y;try{for(N(W),x=n(p);x!==null&&(!(x.expirationTime>W)||_&&!I());){var M=x.callback;if(typeof M=="function"){x.callback=null,y=x.priorityLevel;var Q=M(x.expirationTime<=W);W=e.unstable_now(),typeof Q=="function"?x.callback=Q:x===n(p)&&s(p),N(W)}else s(p);x=n(p)}if(x!==null)var O=!0;else{var ue=n(m);ue!==null&&ce(P,ue.startTime-W),O=!1}return O}finally{x=null,y=R,b=!1}}var T=!1,D=null,L=-1,Y=5,X=-1;function I(){return!(e.unstable_now()-X<Y)}function U(){if(D!==null){var _=e.unstable_now();X=_;var W=!0;try{W=D(!0,_)}finally{W?ne():(T=!1,D=null)}}else T=!1}var ne;if(typeof E=="function")ne=function(){E(U)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,H=F.port2;F.port1.onmessage=U,ne=function(){H.postMessage(null)}}else ne=function(){w(U,0)};function ee(_){D=_,T||(T=!0,ne())}function ce(_,W){L=w(function(){_(e.unstable_now())},W)}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(_){_.callback=null},e.unstable_continueExecution=function(){C||b||(C=!0,ee($))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(_){switch(y){case 1:case 2:case 3:var W=3;break;default:W=y}var R=y;y=W;try{return _()}finally{y=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,W){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var R=y;y=_;try{return W()}finally{y=R}},e.unstable_scheduleCallback=function(_,W,R){var M=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?M+R:M):R=M,_){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=R+Q,_={id:h++,callback:W,priorityLevel:_,startTime:R,expirationTime:Q,sortIndex:-1},R>M?(_.sortIndex=R,t(m,_),n(p)===null&&_===n(m)&&(j?(k(L),L=-1):j=!0,ce(P,R-M))):(_.sortIndex=Q,t(p,_),C||b||(C=!0,ee($))),_},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(_){var W=y;return function(){var R=y;y=W;try{return _.apply(this,arguments)}finally{y=R}}}})(am)),am}var rv;function a2(){return rv||(rv=1,im.exports=i2()),im.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 sv;function l2(){if(sv)return er;sv=1;var e=qh(),t=a2();function n(o){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+o,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+o+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(o,a){c(o,a),c(o+"Capture",a)}function c(o,a){for(i[o]=a,o=0;o<a.length;o++)s.add(a[o])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=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={},x={};function y(o){return p.call(x,o)?!0:p.call(h,o)?!1:m.test(o)?x[o]=!0:(h[o]=!0,!1)}function b(o,a,d,g){if(d!==null&&d.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(o=o.toLowerCase().slice(0,5),o!=="data-"&&o!=="aria-");default:return!1}}function C(o,a,d,g){if(a===null||typeof a>"u"||b(o,a,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function j(o,a,d,g,v,S,A){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=g,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=o,this.type=a,this.sanitizeURL=S,this.removeEmptyString=A}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(o){w[o]=new j(o,0,!1,o,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(o){var a=o[0];w[a]=new j(a,1,!1,o[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(o){w[o]=new j(o,2,!1,o.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(o){w[o]=new j(o,2,!1,o,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(o){w[o]=new j(o,3,!1,o.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(o){w[o]=new j(o,3,!0,o,null,!1,!1)}),["capture","download"].forEach(function(o){w[o]=new j(o,4,!1,o,null,!1,!1)}),["cols","rows","size","span"].forEach(function(o){w[o]=new j(o,6,!1,o,null,!1,!1)}),["rowSpan","start"].forEach(function(o){w[o]=new j(o,5,!1,o.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(o){return o[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(o){var a=o.replace(k,E);w[a]=new j(a,1,!1,o,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(o){var a=o.replace(k,E);w[a]=new j(a,1,!1,o,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(o){var a=o.replace(k,E);w[a]=new j(a,1,!1,o,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!1,!1)}),w.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(o){w[o]=new j(o,1,!1,o.toLowerCase(),null,!0,!0)});function N(o,a,d,g){var v=w.hasOwnProperty(a)?w[a]:null;(v!==null?v.type!==0:g||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(C(a,d,v,g)&&(d=null),g||v===null?y(a)&&(d===null?o.removeAttribute(a):o.setAttribute(a,""+d)):v.mustUseProperty?o[v.propertyName]=d===null?v.type===3?!1:"":d:(a=v.attributeName,g=v.attributeNamespace,d===null?o.removeAttribute(a):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,g?o.setAttributeNS(g,a,d):o.setAttribute(a,d))))}var P=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$=Symbol.for("react.element"),T=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),X=Symbol.for("react.provider"),I=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),ce=Symbol.for("react.offscreen"),_=Symbol.iterator;function W(o){return o===null||typeof o!="object"?null:(o=_&&o[_]||o["@@iterator"],typeof o=="function"?o:null)}var R=Object.assign,M;function Q(o){if(M===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);M=a&&a[1]||""}return`
|
|
34
|
+
`+M+o}var O=!1;function ue(o,a){if(!o||O)return"";O=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(de){var g=de}Reflect.construct(o,[],a)}else{try{a.call()}catch(de){g=de}o.call(a.prototype)}else{try{throw Error()}catch(de){g=de}o()}}catch(de){if(de&&g&&typeof de.stack=="string"){for(var v=de.stack.split(`
|
|
35
|
+
`),S=g.stack.split(`
|
|
36
|
+
`),A=v.length-1,B=S.length-1;1<=A&&0<=B&&v[A]!==S[B];)B--;for(;1<=A&&0<=B;A--,B--)if(v[A]!==S[B]){if(A!==1||B!==1)do if(A--,B--,0>B||v[A]!==S[B]){var K=`
|
|
37
|
+
`+v[A].replace(" at new "," at ");return o.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",o.displayName)),K}while(1<=A&&0<=B);break}}}finally{O=!1,Error.prepareStackTrace=d}return(o=o?o.displayName||o.name:"")?Q(o):""}function ge(o){switch(o.tag){case 5:return Q(o.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return o=ue(o.type,!1),o;case 11:return o=ue(o.type.render,!1),o;case 1:return o=ue(o.type,!0),o;default:return""}}function V(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case D:return"Fragment";case T:return"Portal";case Y:return"Profiler";case L:return"StrictMode";case ne:return"Suspense";case F:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case I:return(o.displayName||"Context")+".Consumer";case X:return(o._context.displayName||"Context")+".Provider";case U:var a=o.render;return o=o.displayName,o||(o=a.displayName||a.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case H:return a=o.displayName||null,a!==null?a:V(o.type)||"Memo";case ee:a=o._payload,o=o._init;try{return V(o(a))}catch{}}return null}function oe(o){var a=o.type;switch(o.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=a.render,o=o.displayName||o.name||"",a.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(a);case 8:return a===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 a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function me(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function ve(o){var a=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function ke(o){var a=ve(o)?"checked":"value",d=Object.getOwnPropertyDescriptor(o.constructor.prototype,a),g=""+o[a];if(!o.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,S=d.set;return Object.defineProperty(o,a,{configurable:!0,get:function(){return v.call(this)},set:function(A){g=""+A,S.call(this,A)}}),Object.defineProperty(o,a,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){o._valueTracker=null,delete o[a]}}}}function he(o){o._valueTracker||(o._valueTracker=ke(o))}function Je(o){if(!o)return!1;var a=o._valueTracker;if(!a)return!0;var d=a.getValue(),g="";return o&&(g=ve(o)?o.checked?"true":"false":o.value),o=g,o!==d?(a.setValue(o),!0):!1}function Ye(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function ot(o,a){var d=a.checked;return R({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??o._wrapperState.initialChecked})}function G(o,a){var d=a.defaultValue==null?"":a.defaultValue,g=a.checked!=null?a.checked:a.defaultChecked;d=me(a.value!=null?a.value:d),o._wrapperState={initialChecked:g,initialValue:d,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Ie(o,a){a=a.checked,a!=null&&N(o,"checked",a,!1)}function Se(o,a){Ie(o,a);var d=me(a.value),g=a.type;if(d!=null)g==="number"?(d===0&&o.value===""||o.value!=d)&&(o.value=""+d):o.value!==""+d&&(o.value=""+d);else if(g==="submit"||g==="reset"){o.removeAttribute("value");return}a.hasOwnProperty("value")?Xe(o,a.type,d):a.hasOwnProperty("defaultValue")&&Xe(o,a.type,me(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(o.defaultChecked=!!a.defaultChecked)}function Oe(o,a,d){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var g=a.type;if(!(g!=="submit"&&g!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+o._wrapperState.initialValue,d||a===o.value||(o.value=a),o.defaultValue=a}d=o.name,d!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,d!==""&&(o.name=d)}function Xe(o,a,d){(a!=="number"||Ye(o.ownerDocument)!==o)&&(d==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+d&&(o.defaultValue=""+d))}var _e=Array.isArray;function nt(o,a,d,g){if(o=o.options,a){a={};for(var v=0;v<d.length;v++)a["$"+d[v]]=!0;for(d=0;d<o.length;d++)v=a.hasOwnProperty("$"+o[d].value),o[d].selected!==v&&(o[d].selected=v),v&&g&&(o[d].defaultSelected=!0)}else{for(d=""+me(d),a=null,v=0;v<o.length;v++){if(o[v].value===d){o[v].selected=!0,g&&(o[v].defaultSelected=!0);return}a!==null||o[v].disabled||(a=o[v])}a!==null&&(a.selected=!0)}}function Ke(o,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return R({},a,{value:void 0,defaultValue:void 0,children:""+o._wrapperState.initialValue})}function gt(o,a){var d=a.value;if(d==null){if(d=a.children,a=a.defaultValue,d!=null){if(a!=null)throw Error(n(92));if(_e(d)){if(1<d.length)throw Error(n(93));d=d[0]}a=d}a==null&&(a=""),d=a}o._wrapperState={initialValue:me(d)}}function Pt(o,a){var d=me(a.value),g=me(a.defaultValue);d!=null&&(d=""+d,d!==o.value&&(o.value=d),a.defaultValue==null&&o.defaultValue!==d&&(o.defaultValue=d)),g!=null&&(o.defaultValue=""+g)}function it(o){var a=o.textContent;a===o._wrapperState.initialValue&&a!==""&&a!==null&&(o.value=a)}function ie(o){switch(o){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 q(o,a){return o==null||o==="http://www.w3.org/1999/xhtml"?ie(a):o==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":o}var pe,Z=(function(o){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,d,g,v){MSApp.execUnsafeLocalFunction(function(){return o(a,d,g,v)})}:o})(function(o,a){if(o.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in o)o.innerHTML=a;else{for(pe=pe||document.createElement("div"),pe.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=pe.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;a.firstChild;)o.appendChild(a.firstChild)}});function ye(o,a){if(a){var d=o.firstChild;if(d&&d===o.lastChild&&d.nodeType===3){d.nodeValue=a;return}}o.textContent=a}var Re={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},lt=["Webkit","ms","Moz","O"];Object.keys(Re).forEach(function(o){lt.forEach(function(a){a=a+o.charAt(0).toUpperCase()+o.substring(1),Re[a]=Re[o]})});function te(o,a,d){return a==null||typeof a=="boolean"||a===""?"":d||typeof a!="number"||a===0||Re.hasOwnProperty(o)&&Re[o]?(""+a).trim():a+"px"}function be(o,a){o=o.style;for(var d in a)if(a.hasOwnProperty(d)){var g=d.indexOf("--")===0,v=te(d,a[d],g);d==="float"&&(d="cssFloat"),g?o.setProperty(d,v):o[d]=v}}var $e=R({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(o,a){if(a){if($e[o]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,o));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function Me(o,a){if(o.indexOf("-")===-1)return typeof a.is=="string";switch(o){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 bt=null;function Mt(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Gt=null,fe=null,Be=null;function Fe(o){if(o=Qa(o)){if(typeof Gt!="function")throw Error(n(280));var a=o.stateNode;a&&(a=Ic(a),Gt(o.stateNode,o.type,a))}}function Nt(o){fe?Be?Be.push(o):Be=[o]:fe=o}function $n(){if(fe){var o=fe,a=Be;if(Be=fe=null,Fe(o),a)for(o=0;o<a.length;o++)Fe(a[o])}}function Yt(o,a){return o(a)}function sn(){}var Wt=!1;function Gn(o,a,d){if(Wt)return o(a,d);Wt=!0;try{return Yt(o,a,d)}finally{Wt=!1,(fe!==null||Be!==null)&&(sn(),$n())}}function xt(o,a){var d=o.stateNode;if(d===null)return null;var g=Ic(d);if(g===null)return null;d=g[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(o=o.type,g=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!g;break e;default:o=!1}if(o)return null;if(d&&typeof d!="function")throw Error(n(231,a,typeof d));return d}var jn=!1;if(u)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){jn=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{jn=!1}function re(o,a,d,g,v,S,A,B,K){var de=Array.prototype.slice.call(arguments,3);try{a.apply(d,de)}catch(je){this.onError(je)}}var Ae=!1,Qe=null,Ft=!1,hn=null,Ct={onError:function(o){Ae=!0,Qe=o}};function kf(o,a,d,g,v,S,A,B,K){Ae=!1,Qe=null,re.apply(Ct,arguments)}function Aa(o,a,d,g,v,S,A,B,K){if(kf.apply(this,arguments),Ae){if(Ae){var de=Qe;Ae=!1,Qe=null}else throw Error(n(198));Ft||(Ft=!0,hn=de)}}function _r(o){var a=o,d=o;if(o.alternate)for(;a.return;)a=a.return;else{o=a;do a=o,(a.flags&4098)!==0&&(d=a.return),o=a.return;while(o)}return a.tag===3?d:null}function oi(o){if(o.tag===13){var a=o.memoizedState;if(a===null&&(o=o.alternate,o!==null&&(a=o.memoizedState)),a!==null)return a.dehydrated}return null}function ii(o){if(_r(o)!==o)throw Error(n(188))}function Da(o){var a=o.alternate;if(!a){if(a=_r(o),a===null)throw Error(n(188));return a!==o?null:o}for(var d=o,g=a;;){var v=d.return;if(v===null)break;var S=v.alternate;if(S===null){if(g=v.return,g!==null){d=g;continue}break}if(v.child===S.child){for(S=v.child;S;){if(S===d)return ii(v),o;if(S===g)return ii(v),a;S=S.sibling}throw Error(n(188))}if(d.return!==g.return)d=v,g=S;else{for(var A=!1,B=v.child;B;){if(B===d){A=!0,d=v,g=S;break}if(B===g){A=!0,g=v,d=S;break}B=B.sibling}if(!A){for(B=S.child;B;){if(B===d){A=!0,d=S,g=v;break}if(B===g){A=!0,g=S,d=v;break}B=B.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?o:a}function ai(o){return o=Da(o),o!==null?li(o):null}function li(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var a=li(o);if(a!==null)return a;o=o.sibling}return null}var ci=t.unstable_scheduleCallback,go=t.unstable_cancelCallback,Sf=t.unstable_shouldYield,ui=t.unstable_requestPaint,Lt=t.unstable_now,Nf=t.unstable_getCurrentPriorityLevel,$a=t.unstable_ImmediatePriority,xc=t.unstable_UserBlockingPriority,Bn=t.unstable_NormalPriority,Cf=t.unstable_LowPriority,yc=t.unstable_IdlePriority,di=null,br=null;function Ef(o){if(br&&typeof br.onCommitFiberRoot=="function")try{br.onCommitFiberRoot(di,o,void 0,(o.current.flags&128)===128)}catch{}}var jt=Math.clz32?Math.clz32:Tf,xo=Math.log,La=Math.LN2;function Tf(o){return o>>>=0,o===0?32:31-(xo(o)/La|0)|0}var fi=64,yo=4194304;function xs(o){switch(o&-o){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 o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function bo(o,a){var d=o.pendingLanes;if(d===0)return 0;var g=0,v=o.suspendedLanes,S=o.pingedLanes,A=d&268435455;if(A!==0){var B=A&~v;B!==0?g=xs(B):(S&=A,S!==0&&(g=xs(S)))}else A=d&~v,A!==0?g=xs(A):S!==0&&(g=xs(S));if(g===0)return 0;if(a!==0&&a!==g&&(a&v)===0&&(v=g&-g,S=a&-a,v>=S||v===16&&(S&4194240)!==0))return a;if((g&4)!==0&&(g|=d&16),a=o.entangledLanes,a!==0)for(o=o.entanglements,a&=g;0<a;)d=31-jt(a),v=1<<d,g|=o[d],a&=~v;return g}function vo(o,a){switch(o){case 1:case 2:case 4:return a+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 a+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 Oa(o,a){for(var d=o.suspendedLanes,g=o.pingedLanes,v=o.expirationTimes,S=o.pendingLanes;0<S;){var A=31-jt(S),B=1<<A,K=v[A];K===-1?((B&d)===0||(B&g)!==0)&&(v[A]=vo(B,a)):K<=a&&(o.expiredLanes|=B),S&=~B}}function Ia(o){return o=o.pendingLanes&-1073741825,o!==0?o:o&1073741824?1073741824:0}function bc(){var o=fi;return fi<<=1,(fi&4194240)===0&&(fi=64),o}function Ln(o){for(var a=[],d=0;31>d;d++)a.push(o);return a}function wo(o,a,d){o.pendingLanes|=a,a!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,a=31-jt(a),o[a]=d}function _a(o,a){var d=o.pendingLanes&~a;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=a,o.mutableReadLanes&=a,o.entangledLanes&=a,a=o.entanglements;var g=o.eventTimes;for(o=o.expirationTimes;0<d;){var v=31-jt(d),S=1<<v;a[v]=0,g[v]=-1,o[v]=-1,d&=~S}}function Ma(o,a){var d=o.entangledLanes|=a;for(o=o.entanglements;d;){var g=31-jt(d),v=1<<g;v&a|o[g]&a&&(o[g]|=a),d&=~v}}var Et=0;function vc(o){return o&=-o,1<o?4<o?(o&268435455)!==0?16:536870912:4:1}var Zr,z,ae,xe,De,ct=!1,pt=[],yt=null,cn=null,on=null,kn=new Map,Un=new Map,Mr=[],wc="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 jo(o,a){switch(o){case"focusin":case"focusout":yt=null;break;case"dragenter":case"dragleave":cn=null;break;case"mouseover":case"mouseout":on=null;break;case"pointerover":case"pointerout":kn.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Un.delete(a.pointerId)}}function vr(o,a,d,g,v,S){return o===null||o.nativeEvent!==S?(o={blockedOn:a,domEventName:d,eventSystemFlags:g,nativeEvent:S,targetContainers:[v]},a!==null&&(a=Qa(a),a!==null&&z(a)),o):(o.eventSystemFlags|=g,a=o.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),o)}function kC(o,a,d,g,v){switch(a){case"focusin":return yt=vr(yt,o,a,d,g,v),!0;case"dragenter":return cn=vr(cn,o,a,d,g,v),!0;case"mouseover":return on=vr(on,o,a,d,g,v),!0;case"pointerover":var S=v.pointerId;return kn.set(S,vr(kn.get(S)||null,o,a,d,g,v)),!0;case"gotpointercapture":return S=v.pointerId,Un.set(S,vr(Un.get(S)||null,o,a,d,g,v)),!0}return!1}function Ox(o){var a=ko(o.target);if(a!==null){var d=_r(a);if(d!==null){if(a=d.tag,a===13){if(a=oi(d),a!==null){o.blockedOn=a,De(o.priority,function(){ae(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){o.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}o.blockedOn=null}function jc(o){if(o.blockedOn!==null)return!1;for(var a=o.targetContainers;0<a.length;){var d=Rf(o.domEventName,o.eventSystemFlags,a[0],o.nativeEvent);if(d===null){d=o.nativeEvent;var g=new d.constructor(d.type,d);bt=g,d.target.dispatchEvent(g),bt=null}else return a=Qa(d),a!==null&&z(a),o.blockedOn=d,!1;a.shift()}return!0}function Ix(o,a,d){jc(o)&&d.delete(a)}function SC(){ct=!1,yt!==null&&jc(yt)&&(yt=null),cn!==null&&jc(cn)&&(cn=null),on!==null&&jc(on)&&(on=null),kn.forEach(Ix),Un.forEach(Ix)}function Fa(o,a){o.blockedOn===a&&(o.blockedOn=null,ct||(ct=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,SC)))}function za(o){function a(v){return Fa(v,o)}if(0<pt.length){Fa(pt[0],o);for(var d=1;d<pt.length;d++){var g=pt[d];g.blockedOn===o&&(g.blockedOn=null)}}for(yt!==null&&Fa(yt,o),cn!==null&&Fa(cn,o),on!==null&&Fa(on,o),kn.forEach(a),Un.forEach(a),d=0;d<Mr.length;d++)g=Mr[d],g.blockedOn===o&&(g.blockedOn=null);for(;0<Mr.length&&(d=Mr[0],d.blockedOn===null);)Ox(d),d.blockedOn===null&&Mr.shift()}var pi=P.ReactCurrentBatchConfig,kc=!0;function NC(o,a,d,g){var v=Et,S=pi.transition;pi.transition=null;try{Et=1,Pf(o,a,d,g)}finally{Et=v,pi.transition=S}}function CC(o,a,d,g){var v=Et,S=pi.transition;pi.transition=null;try{Et=4,Pf(o,a,d,g)}finally{Et=v,pi.transition=S}}function Pf(o,a,d,g){if(kc){var v=Rf(o,a,d,g);if(v===null)qf(o,a,g,Sc,d),jo(o,g);else if(kC(v,o,a,d,g))g.stopPropagation();else if(jo(o,g),a&4&&-1<wc.indexOf(o)){for(;v!==null;){var S=Qa(v);if(S!==null&&Zr(S),S=Rf(o,a,d,g),S===null&&qf(o,a,g,Sc,d),S===v)break;v=S}v!==null&&g.stopPropagation()}else qf(o,a,g,null,d)}}var Sc=null;function Rf(o,a,d,g){if(Sc=null,o=Mt(g),o=ko(o),o!==null)if(a=_r(o),a===null)o=null;else if(d=a.tag,d===13){if(o=oi(a),o!==null)return o;o=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;o=null}else a!==o&&(o=null);return Sc=o,null}function _x(o){switch(o){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(Nf()){case $a:return 1;case xc:return 4;case Bn:case Cf:return 16;case yc:return 536870912;default:return 16}default:return 16}}var Is=null,Af=null,Nc=null;function Mx(){if(Nc)return Nc;var o,a=Af,d=a.length,g,v="value"in Is?Is.value:Is.textContent,S=v.length;for(o=0;o<d&&a[o]===v[o];o++);var A=d-o;for(g=1;g<=A&&a[d-g]===v[S-g];g++);return Nc=v.slice(o,1<g?1-g:void 0)}function Cc(o){var a=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&a===13&&(o=13)):o=a,o===10&&(o=13),32<=o||o===13?o:0}function Ec(){return!0}function Fx(){return!1}function cr(o){function a(d,g,v,S,A){this._reactName=d,this._targetInst=v,this.type=g,this.nativeEvent=S,this.target=A,this.currentTarget=null;for(var B in o)o.hasOwnProperty(B)&&(d=o[B],this[B]=d?d(S):S[B]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Ec:Fx,this.isPropagationStopped=Fx,this}return R(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Ec)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Ec)},persist:function(){},isPersistent:Ec}),a}var mi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Df=cr(mi),Ba=R({},mi,{view:0,detail:0}),EC=cr(Ba),$f,Lf,Ua,Tc=R({},Ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:If,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==Ua&&(Ua&&o.type==="mousemove"?($f=o.screenX-Ua.screenX,Lf=o.screenY-Ua.screenY):Lf=$f=0,Ua=o),$f)},movementY:function(o){return"movementY"in o?o.movementY:Lf}}),zx=cr(Tc),TC=R({},Tc,{dataTransfer:0}),PC=cr(TC),RC=R({},Ba,{relatedTarget:0}),Of=cr(RC),AC=R({},mi,{animationName:0,elapsedTime:0,pseudoElement:0}),DC=cr(AC),$C=R({},mi,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),LC=cr($C),OC=R({},mi,{data:0}),Bx=cr(OC),IC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_C={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"},MC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function FC(o){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(o):(o=MC[o])?!!a[o]:!1}function If(){return FC}var zC=R({},Ba,{key:function(o){if(o.key){var a=IC[o.key]||o.key;if(a!=="Unidentified")return a}return o.type==="keypress"?(o=Cc(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?_C[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:If,charCode:function(o){return o.type==="keypress"?Cc(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Cc(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),BC=cr(zC),UC=R({},Tc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ux=cr(UC),VC=R({},Ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:If}),HC=cr(VC),WC=R({},mi,{propertyName:0,elapsedTime:0,pseudoElement:0}),KC=cr(WC),qC=R({},Tc,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),GC=cr(qC),YC=[9,13,27,32],_f=u&&"CompositionEvent"in window,Va=null;u&&"documentMode"in document&&(Va=document.documentMode);var JC=u&&"TextEvent"in window&&!Va,Vx=u&&(!_f||Va&&8<Va&&11>=Va),Hx=" ",Wx=!1;function Kx(o,a){switch(o){case"keyup":return YC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qx(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var hi=!1;function XC(o,a){switch(o){case"compositionend":return qx(a);case"keypress":return a.which!==32?null:(Wx=!0,Hx);case"textInput":return o=a.data,o===Hx&&Wx?null:o;default:return null}}function QC(o,a){if(hi)return o==="compositionend"||!_f&&Kx(o,a)?(o=Mx(),Nc=Af=Is=null,hi=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Vx&&a.locale!=="ko"?null:a.data;default:return null}}var ZC={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 Gx(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a==="input"?!!ZC[o.type]:a==="textarea"}function Yx(o,a,d,g){Nt(g),a=$c(a,"onChange"),0<a.length&&(d=new Df("onChange","change",null,d,g),o.push({event:d,listeners:a}))}var Ha=null,Wa=null;function eE(o){py(o,0)}function Pc(o){var a=vi(o);if(Je(a))return o}function tE(o,a){if(o==="change")return a}var Jx=!1;if(u){var Mf;if(u){var Ff="oninput"in document;if(!Ff){var Xx=document.createElement("div");Xx.setAttribute("oninput","return;"),Ff=typeof Xx.oninput=="function"}Mf=Ff}else Mf=!1;Jx=Mf&&(!document.documentMode||9<document.documentMode)}function Qx(){Ha&&(Ha.detachEvent("onpropertychange",Zx),Wa=Ha=null)}function Zx(o){if(o.propertyName==="value"&&Pc(Wa)){var a=[];Yx(a,Wa,o,Mt(o)),Gn(eE,a)}}function nE(o,a,d){o==="focusin"?(Qx(),Ha=a,Wa=d,Ha.attachEvent("onpropertychange",Zx)):o==="focusout"&&Qx()}function rE(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Pc(Wa)}function sE(o,a){if(o==="click")return Pc(a)}function oE(o,a){if(o==="input"||o==="change")return Pc(a)}function iE(o,a){return o===a&&(o!==0||1/o===1/a)||o!==o&&a!==a}var Fr=typeof Object.is=="function"?Object.is:iE;function Ka(o,a){if(Fr(o,a))return!0;if(typeof o!="object"||o===null||typeof a!="object"||a===null)return!1;var d=Object.keys(o),g=Object.keys(a);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var v=d[g];if(!p.call(a,v)||!Fr(o[v],a[v]))return!1}return!0}function ey(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function ty(o,a){var d=ey(o);o=0;for(var g;d;){if(d.nodeType===3){if(g=o+d.textContent.length,o<=a&&g>=a)return{node:d,offset:a-o};o=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=ey(d)}}function ny(o,a){return o&&a?o===a?!0:o&&o.nodeType===3?!1:a&&a.nodeType===3?ny(o,a.parentNode):"contains"in o?o.contains(a):o.compareDocumentPosition?!!(o.compareDocumentPosition(a)&16):!1:!1}function ry(){for(var o=window,a=Ye();a instanceof o.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)o=a.contentWindow;else break;a=Ye(o.document)}return a}function zf(o){var a=o&&o.nodeName&&o.nodeName.toLowerCase();return a&&(a==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||a==="textarea"||o.contentEditable==="true")}function aE(o){var a=ry(),d=o.focusedElem,g=o.selectionRange;if(a!==d&&d&&d.ownerDocument&&ny(d.ownerDocument.documentElement,d)){if(g!==null&&zf(d)){if(a=g.start,o=g.end,o===void 0&&(o=a),"selectionStart"in d)d.selectionStart=a,d.selectionEnd=Math.min(o,d.value.length);else if(o=(a=d.ownerDocument||document)&&a.defaultView||window,o.getSelection){o=o.getSelection();var v=d.textContent.length,S=Math.min(g.start,v);g=g.end===void 0?S:Math.min(g.end,v),!o.extend&&S>g&&(v=g,g=S,S=v),v=ty(d,S);var A=ty(d,g);v&&A&&(o.rangeCount!==1||o.anchorNode!==v.node||o.anchorOffset!==v.offset||o.focusNode!==A.node||o.focusOffset!==A.offset)&&(a=a.createRange(),a.setStart(v.node,v.offset),o.removeAllRanges(),S>g?(o.addRange(a),o.extend(A.node,A.offset)):(a.setEnd(A.node,A.offset),o.addRange(a)))}}for(a=[],o=d;o=o.parentNode;)o.nodeType===1&&a.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<a.length;d++)o=a[d],o.element.scrollLeft=o.left,o.element.scrollTop=o.top}}var lE=u&&"documentMode"in document&&11>=document.documentMode,gi=null,Bf=null,qa=null,Uf=!1;function sy(o,a,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Uf||gi==null||gi!==Ye(g)||(g=gi,"selectionStart"in g&&zf(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),qa&&Ka(qa,g)||(qa=g,g=$c(Bf,"onSelect"),0<g.length&&(a=new Df("onSelect","select",null,a,d),o.push({event:a,listeners:g}),a.target=gi)))}function Rc(o,a){var d={};return d[o.toLowerCase()]=a.toLowerCase(),d["Webkit"+o]="webkit"+a,d["Moz"+o]="moz"+a,d}var xi={animationend:Rc("Animation","AnimationEnd"),animationiteration:Rc("Animation","AnimationIteration"),animationstart:Rc("Animation","AnimationStart"),transitionend:Rc("Transition","TransitionEnd")},Vf={},oy={};u&&(oy=document.createElement("div").style,"AnimationEvent"in window||(delete xi.animationend.animation,delete xi.animationiteration.animation,delete xi.animationstart.animation),"TransitionEvent"in window||delete xi.transitionend.transition);function Ac(o){if(Vf[o])return Vf[o];if(!xi[o])return o;var a=xi[o],d;for(d in a)if(a.hasOwnProperty(d)&&d in oy)return Vf[o]=a[d];return o}var iy=Ac("animationend"),ay=Ac("animationiteration"),ly=Ac("animationstart"),cy=Ac("transitionend"),uy=new Map,dy="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 _s(o,a){uy.set(o,a),l(a,[o])}for(var Hf=0;Hf<dy.length;Hf++){var Wf=dy[Hf],cE=Wf.toLowerCase(),uE=Wf[0].toUpperCase()+Wf.slice(1);_s(cE,"on"+uE)}_s(iy,"onAnimationEnd"),_s(ay,"onAnimationIteration"),_s(ly,"onAnimationStart"),_s("dblclick","onDoubleClick"),_s("focusin","onFocus"),_s("focusout","onBlur"),_s(cy,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ga="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(" "),dE=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ga));function fy(o,a,d){var g=o.type||"unknown-event";o.currentTarget=d,Aa(g,a,void 0,o),o.currentTarget=null}function py(o,a){a=(a&4)!==0;for(var d=0;d<o.length;d++){var g=o[d],v=g.event;g=g.listeners;e:{var S=void 0;if(a)for(var A=g.length-1;0<=A;A--){var B=g[A],K=B.instance,de=B.currentTarget;if(B=B.listener,K!==S&&v.isPropagationStopped())break e;fy(v,B,de),S=K}else for(A=0;A<g.length;A++){if(B=g[A],K=B.instance,de=B.currentTarget,B=B.listener,K!==S&&v.isPropagationStopped())break e;fy(v,B,de),S=K}}}if(Ft)throw o=hn,Ft=!1,hn=null,o}function zt(o,a){var d=a[Zf];d===void 0&&(d=a[Zf]=new Set);var g=o+"__bubble";d.has(g)||(my(a,o,2,!1),d.add(g))}function Kf(o,a,d){var g=0;a&&(g|=4),my(d,o,g,a)}var Dc="_reactListening"+Math.random().toString(36).slice(2);function Ya(o){if(!o[Dc]){o[Dc]=!0,s.forEach(function(d){d!=="selectionchange"&&(dE.has(d)||Kf(d,!1,o),Kf(d,!0,o))});var a=o.nodeType===9?o:o.ownerDocument;a===null||a[Dc]||(a[Dc]=!0,Kf("selectionchange",!1,a))}}function my(o,a,d,g){switch(_x(a)){case 1:var v=NC;break;case 4:v=CC;break;default:v=Pf}d=v.bind(null,a,d,o),v=void 0,!jn||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),g?v!==void 0?o.addEventListener(a,d,{capture:!0,passive:v}):o.addEventListener(a,d,!0):v!==void 0?o.addEventListener(a,d,{passive:v}):o.addEventListener(a,d,!1)}function qf(o,a,d,g,v){var S=g;if((a&1)===0&&(a&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var B=g.stateNode.containerInfo;if(B===v||B.nodeType===8&&B.parentNode===v)break;if(A===4)for(A=g.return;A!==null;){var K=A.tag;if((K===3||K===4)&&(K=A.stateNode.containerInfo,K===v||K.nodeType===8&&K.parentNode===v))return;A=A.return}for(;B!==null;){if(A=ko(B),A===null)return;if(K=A.tag,K===5||K===6){g=S=A;continue e}B=B.parentNode}}g=g.return}Gn(function(){var de=S,je=Mt(d),Ne=[];e:{var we=uy.get(o);if(we!==void 0){var ze=Df,Ve=o;switch(o){case"keypress":if(Cc(d)===0)break e;case"keydown":case"keyup":ze=BC;break;case"focusin":Ve="focus",ze=Of;break;case"focusout":Ve="blur",ze=Of;break;case"beforeblur":case"afterblur":ze=Of;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ze=zx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ze=PC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ze=HC;break;case iy:case ay:case ly:ze=DC;break;case cy:ze=KC;break;case"scroll":ze=EC;break;case"wheel":ze=GC;break;case"copy":case"cut":case"paste":ze=LC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ze=Ux}var qe=(a&4)!==0,an=!qe&&o==="scroll",se=qe?we!==null?we+"Capture":null:we;qe=[];for(var J=de,le;J!==null;){le=J;var Pe=le.stateNode;if(le.tag===5&&Pe!==null&&(le=Pe,se!==null&&(Pe=xt(J,se),Pe!=null&&qe.push(Ja(J,Pe,le)))),an)break;J=J.return}0<qe.length&&(we=new ze(we,Ve,null,d,je),Ne.push({event:we,listeners:qe}))}}if((a&7)===0){e:{if(we=o==="mouseover"||o==="pointerover",ze=o==="mouseout"||o==="pointerout",we&&d!==bt&&(Ve=d.relatedTarget||d.fromElement)&&(ko(Ve)||Ve[ys]))break e;if((ze||we)&&(we=je.window===je?je:(we=je.ownerDocument)?we.defaultView||we.parentWindow:window,ze?(Ve=d.relatedTarget||d.toElement,ze=de,Ve=Ve?ko(Ve):null,Ve!==null&&(an=_r(Ve),Ve!==an||Ve.tag!==5&&Ve.tag!==6)&&(Ve=null)):(ze=null,Ve=de),ze!==Ve)){if(qe=zx,Pe="onMouseLeave",se="onMouseEnter",J="mouse",(o==="pointerout"||o==="pointerover")&&(qe=Ux,Pe="onPointerLeave",se="onPointerEnter",J="pointer"),an=ze==null?we:vi(ze),le=Ve==null?we:vi(Ve),we=new qe(Pe,J+"leave",ze,d,je),we.target=an,we.relatedTarget=le,Pe=null,ko(je)===de&&(qe=new qe(se,J+"enter",Ve,d,je),qe.target=le,qe.relatedTarget=an,Pe=qe),an=Pe,ze&&Ve)t:{for(qe=ze,se=Ve,J=0,le=qe;le;le=yi(le))J++;for(le=0,Pe=se;Pe;Pe=yi(Pe))le++;for(;0<J-le;)qe=yi(qe),J--;for(;0<le-J;)se=yi(se),le--;for(;J--;){if(qe===se||se!==null&&qe===se.alternate)break t;qe=yi(qe),se=yi(se)}qe=null}else qe=null;ze!==null&&hy(Ne,we,ze,qe,!1),Ve!==null&&an!==null&&hy(Ne,an,Ve,qe,!0)}}e:{if(we=de?vi(de):window,ze=we.nodeName&&we.nodeName.toLowerCase(),ze==="select"||ze==="input"&&we.type==="file")var Ge=tE;else if(Gx(we))if(Jx)Ge=oE;else{Ge=rE;var Ze=nE}else(ze=we.nodeName)&&ze.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Ge=sE);if(Ge&&(Ge=Ge(o,de))){Yx(Ne,Ge,d,je);break e}Ze&&Ze(o,we,de),o==="focusout"&&(Ze=we._wrapperState)&&Ze.controlled&&we.type==="number"&&Xe(we,"number",we.value)}switch(Ze=de?vi(de):window,o){case"focusin":(Gx(Ze)||Ze.contentEditable==="true")&&(gi=Ze,Bf=de,qa=null);break;case"focusout":qa=Bf=gi=null;break;case"mousedown":Uf=!0;break;case"contextmenu":case"mouseup":case"dragend":Uf=!1,sy(Ne,d,je);break;case"selectionchange":if(lE)break;case"keydown":case"keyup":sy(Ne,d,je)}var et;if(_f)e:{switch(o){case"compositionstart":var rt="onCompositionStart";break e;case"compositionend":rt="onCompositionEnd";break e;case"compositionupdate":rt="onCompositionUpdate";break e}rt=void 0}else hi?Kx(o,d)&&(rt="onCompositionEnd"):o==="keydown"&&d.keyCode===229&&(rt="onCompositionStart");rt&&(Vx&&d.locale!=="ko"&&(hi||rt!=="onCompositionStart"?rt==="onCompositionEnd"&&hi&&(et=Mx()):(Is=je,Af="value"in Is?Is.value:Is.textContent,hi=!0)),Ze=$c(de,rt),0<Ze.length&&(rt=new Bx(rt,o,null,d,je),Ne.push({event:rt,listeners:Ze}),et?rt.data=et:(et=qx(d),et!==null&&(rt.data=et)))),(et=JC?XC(o,d):QC(o,d))&&(de=$c(de,"onBeforeInput"),0<de.length&&(je=new Bx("onBeforeInput","beforeinput",null,d,je),Ne.push({event:je,listeners:de}),je.data=et))}py(Ne,a)})}function Ja(o,a,d){return{instance:o,listener:a,currentTarget:d}}function $c(o,a){for(var d=a+"Capture",g=[];o!==null;){var v=o,S=v.stateNode;v.tag===5&&S!==null&&(v=S,S=xt(o,d),S!=null&&g.unshift(Ja(o,S,v)),S=xt(o,a),S!=null&&g.push(Ja(o,S,v))),o=o.return}return g}function yi(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5);return o||null}function hy(o,a,d,g,v){for(var S=a._reactName,A=[];d!==null&&d!==g;){var B=d,K=B.alternate,de=B.stateNode;if(K!==null&&K===g)break;B.tag===5&&de!==null&&(B=de,v?(K=xt(d,S),K!=null&&A.unshift(Ja(d,K,B))):v||(K=xt(d,S),K!=null&&A.push(Ja(d,K,B)))),d=d.return}A.length!==0&&o.push({event:a,listeners:A})}var fE=/\r\n?/g,pE=/\u0000|\uFFFD/g;function gy(o){return(typeof o=="string"?o:""+o).replace(fE,`
|
|
38
|
+
`).replace(pE,"")}function Lc(o,a,d){if(a=gy(a),gy(o)!==a&&d)throw Error(n(425))}function Oc(){}var Gf=null,Yf=null;function Jf(o,a){return o==="textarea"||o==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Xf=typeof setTimeout=="function"?setTimeout:void 0,mE=typeof clearTimeout=="function"?clearTimeout:void 0,xy=typeof Promise=="function"?Promise:void 0,hE=typeof queueMicrotask=="function"?queueMicrotask:typeof xy<"u"?function(o){return xy.resolve(null).then(o).catch(gE)}:Xf;function gE(o){setTimeout(function(){throw o})}function Qf(o,a){var d=a,g=0;do{var v=d.nextSibling;if(o.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(g===0){o.removeChild(v),za(a);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=v}while(d);za(a)}function Ms(o){for(;o!=null;o=o.nextSibling){var a=o.nodeType;if(a===1||a===3)break;if(a===8){if(a=o.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return o}function yy(o){o=o.previousSibling;for(var a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="$"||d==="$!"||d==="$?"){if(a===0)return o;a--}else d==="/$"&&a++}o=o.previousSibling}return null}var bi=Math.random().toString(36).slice(2),es="__reactFiber$"+bi,Xa="__reactProps$"+bi,ys="__reactContainer$"+bi,Zf="__reactEvents$"+bi,xE="__reactListeners$"+bi,yE="__reactHandles$"+bi;function ko(o){var a=o[es];if(a)return a;for(var d=o.parentNode;d;){if(a=d[ys]||d[es]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(o=yy(o);o!==null;){if(d=o[es])return d;o=yy(o)}return a}o=d,d=o.parentNode}return null}function Qa(o){return o=o[es]||o[ys],!o||o.tag!==5&&o.tag!==6&&o.tag!==13&&o.tag!==3?null:o}function vi(o){if(o.tag===5||o.tag===6)return o.stateNode;throw Error(n(33))}function Ic(o){return o[Xa]||null}var ep=[],wi=-1;function Fs(o){return{current:o}}function Bt(o){0>wi||(o.current=ep[wi],ep[wi]=null,wi--)}function Ot(o,a){wi++,ep[wi]=o.current,o.current=a}var zs={},On=Fs(zs),Yn=Fs(!1),So=zs;function ji(o,a){var d=o.type.contextTypes;if(!d)return zs;var g=o.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===a)return g.__reactInternalMemoizedMaskedChildContext;var v={},S;for(S in d)v[S]=a[S];return g&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=a,o.__reactInternalMemoizedMaskedChildContext=v),v}function Jn(o){return o=o.childContextTypes,o!=null}function _c(){Bt(Yn),Bt(On)}function by(o,a,d){if(On.current!==zs)throw Error(n(168));Ot(On,a),Ot(Yn,d)}function vy(o,a,d){var g=o.stateNode;if(a=a.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var v in g)if(!(v in a))throw Error(n(108,oe(o)||"Unknown",v));return R({},d,g)}function Mc(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||zs,So=On.current,Ot(On,o),Ot(Yn,Yn.current),!0}function wy(o,a,d){var g=o.stateNode;if(!g)throw Error(n(169));d?(o=vy(o,a,So),g.__reactInternalMemoizedMergedChildContext=o,Bt(Yn),Bt(On),Ot(On,o)):Bt(Yn),Ot(Yn,d)}var bs=null,Fc=!1,tp=!1;function jy(o){bs===null?bs=[o]:bs.push(o)}function bE(o){Fc=!0,jy(o)}function Bs(){if(!tp&&bs!==null){tp=!0;var o=0,a=Et;try{var d=bs;for(Et=1;o<d.length;o++){var g=d[o];do g=g(!0);while(g!==null)}bs=null,Fc=!1}catch(v){throw bs!==null&&(bs=bs.slice(o+1)),ci($a,Bs),v}finally{Et=a,tp=!1}}return null}var ki=[],Si=0,zc=null,Bc=0,wr=[],jr=0,No=null,vs=1,ws="";function Co(o,a){ki[Si++]=Bc,ki[Si++]=zc,zc=o,Bc=a}function ky(o,a,d){wr[jr++]=vs,wr[jr++]=ws,wr[jr++]=No,No=o;var g=vs;o=ws;var v=32-jt(g)-1;g&=~(1<<v),d+=1;var S=32-jt(a)+v;if(30<S){var A=v-v%5;S=(g&(1<<A)-1).toString(32),g>>=A,v-=A,vs=1<<32-jt(a)+v|d<<v|g,ws=S+o}else vs=1<<S|d<<v|g,ws=o}function np(o){o.return!==null&&(Co(o,1),ky(o,1,0))}function rp(o){for(;o===zc;)zc=ki[--Si],ki[Si]=null,Bc=ki[--Si],ki[Si]=null;for(;o===No;)No=wr[--jr],wr[jr]=null,ws=wr[--jr],wr[jr]=null,vs=wr[--jr],wr[jr]=null}var ur=null,dr=null,Kt=!1,zr=null;function Sy(o,a){var d=Cr(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=o,a=o.deletions,a===null?(o.deletions=[d],o.flags|=16):a.push(d)}function Ny(o,a){switch(o.tag){case 5:var d=o.type;return a=a.nodeType!==1||d.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(o.stateNode=a,ur=o,dr=Ms(a.firstChild),!0):!1;case 6:return a=o.pendingProps===""||a.nodeType!==3?null:a,a!==null?(o.stateNode=a,ur=o,dr=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(d=No!==null?{id:vs,overflow:ws}:null,o.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=Cr(18,null,null,0),d.stateNode=a,d.return=o,o.child=d,ur=o,dr=null,!0):!1;default:return!1}}function sp(o){return(o.mode&1)!==0&&(o.flags&128)===0}function op(o){if(Kt){var a=dr;if(a){var d=a;if(!Ny(o,a)){if(sp(o))throw Error(n(418));a=Ms(d.nextSibling);var g=ur;a&&Ny(o,a)?Sy(g,d):(o.flags=o.flags&-4097|2,Kt=!1,ur=o)}}else{if(sp(o))throw Error(n(418));o.flags=o.flags&-4097|2,Kt=!1,ur=o}}}function Cy(o){for(o=o.return;o!==null&&o.tag!==5&&o.tag!==3&&o.tag!==13;)o=o.return;ur=o}function Uc(o){if(o!==ur)return!1;if(!Kt)return Cy(o),Kt=!0,!1;var a;if((a=o.tag!==3)&&!(a=o.tag!==5)&&(a=o.type,a=a!=="head"&&a!=="body"&&!Jf(o.type,o.memoizedProps)),a&&(a=dr)){if(sp(o))throw Ey(),Error(n(418));for(;a;)Sy(o,a),a=Ms(a.nextSibling)}if(Cy(o),o.tag===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(317));e:{for(o=o.nextSibling,a=0;o;){if(o.nodeType===8){var d=o.data;if(d==="/$"){if(a===0){dr=Ms(o.nextSibling);break e}a--}else d!=="$"&&d!=="$!"&&d!=="$?"||a++}o=o.nextSibling}dr=null}}else dr=ur?Ms(o.stateNode.nextSibling):null;return!0}function Ey(){for(var o=dr;o;)o=Ms(o.nextSibling)}function Ni(){dr=ur=null,Kt=!1}function ip(o){zr===null?zr=[o]:zr.push(o)}var vE=P.ReactCurrentBatchConfig;function Za(o,a,d){if(o=d.ref,o!==null&&typeof o!="function"&&typeof o!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,o));var v=g,S=""+o;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===S?a.ref:(a=function(A){var B=v.refs;A===null?delete B[S]:B[S]=A},a._stringRef=S,a)}if(typeof o!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,o))}return o}function Vc(o,a){throw o=Object.prototype.toString.call(a),Error(n(31,o==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":o))}function Ty(o){var a=o._init;return a(o._payload)}function Py(o){function a(se,J){if(o){var le=se.deletions;le===null?(se.deletions=[J],se.flags|=16):le.push(J)}}function d(se,J){if(!o)return null;for(;J!==null;)a(se,J),J=J.sibling;return null}function g(se,J){for(se=new Map;J!==null;)J.key!==null?se.set(J.key,J):se.set(J.index,J),J=J.sibling;return se}function v(se,J){return se=Ys(se,J),se.index=0,se.sibling=null,se}function S(se,J,le){return se.index=le,o?(le=se.alternate,le!==null?(le=le.index,le<J?(se.flags|=2,J):le):(se.flags|=2,J)):(se.flags|=1048576,J)}function A(se){return o&&se.alternate===null&&(se.flags|=2),se}function B(se,J,le,Pe){return J===null||J.tag!==6?(J=Xp(le,se.mode,Pe),J.return=se,J):(J=v(J,le),J.return=se,J)}function K(se,J,le,Pe){var Ge=le.type;return Ge===D?je(se,J,le.props.children,Pe,le.key):J!==null&&(J.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===ee&&Ty(Ge)===J.type)?(Pe=v(J,le.props),Pe.ref=Za(se,J,le),Pe.return=se,Pe):(Pe=pu(le.type,le.key,le.props,null,se.mode,Pe),Pe.ref=Za(se,J,le),Pe.return=se,Pe)}function de(se,J,le,Pe){return J===null||J.tag!==4||J.stateNode.containerInfo!==le.containerInfo||J.stateNode.implementation!==le.implementation?(J=Qp(le,se.mode,Pe),J.return=se,J):(J=v(J,le.children||[]),J.return=se,J)}function je(se,J,le,Pe,Ge){return J===null||J.tag!==7?(J=Lo(le,se.mode,Pe,Ge),J.return=se,J):(J=v(J,le),J.return=se,J)}function Ne(se,J,le){if(typeof J=="string"&&J!==""||typeof J=="number")return J=Xp(""+J,se.mode,le),J.return=se,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case $:return le=pu(J.type,J.key,J.props,null,se.mode,le),le.ref=Za(se,null,J),le.return=se,le;case T:return J=Qp(J,se.mode,le),J.return=se,J;case ee:var Pe=J._init;return Ne(se,Pe(J._payload),le)}if(_e(J)||W(J))return J=Lo(J,se.mode,le,null),J.return=se,J;Vc(se,J)}return null}function we(se,J,le,Pe){var Ge=J!==null?J.key:null;if(typeof le=="string"&&le!==""||typeof le=="number")return Ge!==null?null:B(se,J,""+le,Pe);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case $:return le.key===Ge?K(se,J,le,Pe):null;case T:return le.key===Ge?de(se,J,le,Pe):null;case ee:return Ge=le._init,we(se,J,Ge(le._payload),Pe)}if(_e(le)||W(le))return Ge!==null?null:je(se,J,le,Pe,null);Vc(se,le)}return null}function ze(se,J,le,Pe,Ge){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number")return se=se.get(le)||null,B(J,se,""+Pe,Ge);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case $:return se=se.get(Pe.key===null?le:Pe.key)||null,K(J,se,Pe,Ge);case T:return se=se.get(Pe.key===null?le:Pe.key)||null,de(J,se,Pe,Ge);case ee:var Ze=Pe._init;return ze(se,J,le,Ze(Pe._payload),Ge)}if(_e(Pe)||W(Pe))return se=se.get(le)||null,je(J,se,Pe,Ge,null);Vc(J,Pe)}return null}function Ve(se,J,le,Pe){for(var Ge=null,Ze=null,et=J,rt=J=0,Cn=null;et!==null&&rt<le.length;rt++){et.index>rt?(Cn=et,et=null):Cn=et.sibling;var kt=we(se,et,le[rt],Pe);if(kt===null){et===null&&(et=Cn);break}o&&et&&kt.alternate===null&&a(se,et),J=S(kt,J,rt),Ze===null?Ge=kt:Ze.sibling=kt,Ze=kt,et=Cn}if(rt===le.length)return d(se,et),Kt&&Co(se,rt),Ge;if(et===null){for(;rt<le.length;rt++)et=Ne(se,le[rt],Pe),et!==null&&(J=S(et,J,rt),Ze===null?Ge=et:Ze.sibling=et,Ze=et);return Kt&&Co(se,rt),Ge}for(et=g(se,et);rt<le.length;rt++)Cn=ze(et,se,rt,le[rt],Pe),Cn!==null&&(o&&Cn.alternate!==null&&et.delete(Cn.key===null?rt:Cn.key),J=S(Cn,J,rt),Ze===null?Ge=Cn:Ze.sibling=Cn,Ze=Cn);return o&&et.forEach(function(Js){return a(se,Js)}),Kt&&Co(se,rt),Ge}function qe(se,J,le,Pe){var Ge=W(le);if(typeof Ge!="function")throw Error(n(150));if(le=Ge.call(le),le==null)throw Error(n(151));for(var Ze=Ge=null,et=J,rt=J=0,Cn=null,kt=le.next();et!==null&&!kt.done;rt++,kt=le.next()){et.index>rt?(Cn=et,et=null):Cn=et.sibling;var Js=we(se,et,kt.value,Pe);if(Js===null){et===null&&(et=Cn);break}o&&et&&Js.alternate===null&&a(se,et),J=S(Js,J,rt),Ze===null?Ge=Js:Ze.sibling=Js,Ze=Js,et=Cn}if(kt.done)return d(se,et),Kt&&Co(se,rt),Ge;if(et===null){for(;!kt.done;rt++,kt=le.next())kt=Ne(se,kt.value,Pe),kt!==null&&(J=S(kt,J,rt),Ze===null?Ge=kt:Ze.sibling=kt,Ze=kt);return Kt&&Co(se,rt),Ge}for(et=g(se,et);!kt.done;rt++,kt=le.next())kt=ze(et,se,rt,kt.value,Pe),kt!==null&&(o&&kt.alternate!==null&&et.delete(kt.key===null?rt:kt.key),J=S(kt,J,rt),Ze===null?Ge=kt:Ze.sibling=kt,Ze=kt);return o&&et.forEach(function(ZE){return a(se,ZE)}),Kt&&Co(se,rt),Ge}function an(se,J,le,Pe){if(typeof le=="object"&&le!==null&&le.type===D&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case $:e:{for(var Ge=le.key,Ze=J;Ze!==null;){if(Ze.key===Ge){if(Ge=le.type,Ge===D){if(Ze.tag===7){d(se,Ze.sibling),J=v(Ze,le.props.children),J.return=se,se=J;break e}}else if(Ze.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===ee&&Ty(Ge)===Ze.type){d(se,Ze.sibling),J=v(Ze,le.props),J.ref=Za(se,Ze,le),J.return=se,se=J;break e}d(se,Ze);break}else a(se,Ze);Ze=Ze.sibling}le.type===D?(J=Lo(le.props.children,se.mode,Pe,le.key),J.return=se,se=J):(Pe=pu(le.type,le.key,le.props,null,se.mode,Pe),Pe.ref=Za(se,J,le),Pe.return=se,se=Pe)}return A(se);case T:e:{for(Ze=le.key;J!==null;){if(J.key===Ze)if(J.tag===4&&J.stateNode.containerInfo===le.containerInfo&&J.stateNode.implementation===le.implementation){d(se,J.sibling),J=v(J,le.children||[]),J.return=se,se=J;break e}else{d(se,J);break}else a(se,J);J=J.sibling}J=Qp(le,se.mode,Pe),J.return=se,se=J}return A(se);case ee:return Ze=le._init,an(se,J,Ze(le._payload),Pe)}if(_e(le))return Ve(se,J,le,Pe);if(W(le))return qe(se,J,le,Pe);Vc(se,le)}return typeof le=="string"&&le!==""||typeof le=="number"?(le=""+le,J!==null&&J.tag===6?(d(se,J.sibling),J=v(J,le),J.return=se,se=J):(d(se,J),J=Xp(le,se.mode,Pe),J.return=se,se=J),A(se)):d(se,J)}return an}var Ci=Py(!0),Ry=Py(!1),Hc=Fs(null),Wc=null,Ei=null,ap=null;function lp(){ap=Ei=Wc=null}function cp(o){var a=Hc.current;Bt(Hc),o._currentValue=a}function up(o,a,d){for(;o!==null;){var g=o.alternate;if((o.childLanes&a)!==a?(o.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),o===d)break;o=o.return}}function Ti(o,a){Wc=o,ap=Ei=null,o=o.dependencies,o!==null&&o.firstContext!==null&&((o.lanes&a)!==0&&(Xn=!0),o.firstContext=null)}function kr(o){var a=o._currentValue;if(ap!==o)if(o={context:o,memoizedValue:a,next:null},Ei===null){if(Wc===null)throw Error(n(308));Ei=o,Wc.dependencies={lanes:0,firstContext:o}}else Ei=Ei.next=o;return a}var Eo=null;function dp(o){Eo===null?Eo=[o]:Eo.push(o)}function Ay(o,a,d,g){var v=a.interleaved;return v===null?(d.next=d,dp(a)):(d.next=v.next,v.next=d),a.interleaved=d,js(o,g)}function js(o,a){o.lanes|=a;var d=o.alternate;for(d!==null&&(d.lanes|=a),d=o,o=o.return;o!==null;)o.childLanes|=a,d=o.alternate,d!==null&&(d.childLanes|=a),d=o,o=o.return;return d.tag===3?d.stateNode:null}var Us=!1;function fp(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dy(o,a){o=o.updateQueue,a.updateQueue===o&&(a.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function ks(o,a){return{eventTime:o,lane:a,tag:0,payload:null,callback:null,next:null}}function Vs(o,a,d){var g=o.updateQueue;if(g===null)return null;if(g=g.shared,(vt&2)!==0){var v=g.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),g.pending=a,js(o,d)}return v=g.interleaved,v===null?(a.next=a,dp(g)):(a.next=v.next,v.next=a),g.interleaved=a,js(o,d)}function Kc(o,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var g=a.lanes;g&=o.pendingLanes,d|=g,a.lanes=d,Ma(o,d)}}function $y(o,a){var d=o.updateQueue,g=o.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var v=null,S=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};S===null?v=S=A:S=S.next=A,d=d.next}while(d!==null);S===null?v=S=a:S=S.next=a}else v=S=a;d={baseState:g.baseState,firstBaseUpdate:v,lastBaseUpdate:S,shared:g.shared,effects:g.effects},o.updateQueue=d;return}o=d.lastBaseUpdate,o===null?d.firstBaseUpdate=a:o.next=a,d.lastBaseUpdate=a}function qc(o,a,d,g){var v=o.updateQueue;Us=!1;var S=v.firstBaseUpdate,A=v.lastBaseUpdate,B=v.shared.pending;if(B!==null){v.shared.pending=null;var K=B,de=K.next;K.next=null,A===null?S=de:A.next=de,A=K;var je=o.alternate;je!==null&&(je=je.updateQueue,B=je.lastBaseUpdate,B!==A&&(B===null?je.firstBaseUpdate=de:B.next=de,je.lastBaseUpdate=K))}if(S!==null){var Ne=v.baseState;A=0,je=de=K=null,B=S;do{var we=B.lane,ze=B.eventTime;if((g&we)===we){je!==null&&(je=je.next={eventTime:ze,lane:0,tag:B.tag,payload:B.payload,callback:B.callback,next:null});e:{var Ve=o,qe=B;switch(we=a,ze=d,qe.tag){case 1:if(Ve=qe.payload,typeof Ve=="function"){Ne=Ve.call(ze,Ne,we);break e}Ne=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=qe.payload,we=typeof Ve=="function"?Ve.call(ze,Ne,we):Ve,we==null)break e;Ne=R({},Ne,we);break e;case 2:Us=!0}}B.callback!==null&&B.lane!==0&&(o.flags|=64,we=v.effects,we===null?v.effects=[B]:we.push(B))}else ze={eventTime:ze,lane:we,tag:B.tag,payload:B.payload,callback:B.callback,next:null},je===null?(de=je=ze,K=Ne):je=je.next=ze,A|=we;if(B=B.next,B===null){if(B=v.shared.pending,B===null)break;we=B,B=we.next,we.next=null,v.lastBaseUpdate=we,v.shared.pending=null}}while(!0);if(je===null&&(K=Ne),v.baseState=K,v.firstBaseUpdate=de,v.lastBaseUpdate=je,a=v.shared.interleaved,a!==null){v=a;do A|=v.lane,v=v.next;while(v!==a)}else S===null&&(v.shared.lanes=0);Ro|=A,o.lanes=A,o.memoizedState=Ne}}function Ly(o,a,d){if(o=a.effects,a.effects=null,o!==null)for(a=0;a<o.length;a++){var g=o[a],v=g.callback;if(v!==null){if(g.callback=null,g=d,typeof v!="function")throw Error(n(191,v));v.call(g)}}}var el={},ts=Fs(el),tl=Fs(el),nl=Fs(el);function To(o){if(o===el)throw Error(n(174));return o}function pp(o,a){switch(Ot(nl,a),Ot(tl,o),Ot(ts,el),o=a.nodeType,o){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:q(null,"");break;default:o=o===8?a.parentNode:a,a=o.namespaceURI||null,o=o.tagName,a=q(a,o)}Bt(ts),Ot(ts,a)}function Pi(){Bt(ts),Bt(tl),Bt(nl)}function Oy(o){To(nl.current);var a=To(ts.current),d=q(a,o.type);a!==d&&(Ot(tl,o),Ot(ts,d))}function mp(o){tl.current===o&&(Bt(ts),Bt(tl))}var Jt=Fs(0);function Gc(o){for(var a=o;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var hp=[];function gp(){for(var o=0;o<hp.length;o++)hp[o]._workInProgressVersionPrimary=null;hp.length=0}var Yc=P.ReactCurrentDispatcher,xp=P.ReactCurrentBatchConfig,Po=0,Xt=null,gn=null,Sn=null,Jc=!1,rl=!1,sl=0,wE=0;function In(){throw Error(n(321))}function yp(o,a){if(a===null)return!1;for(var d=0;d<a.length&&d<o.length;d++)if(!Fr(o[d],a[d]))return!1;return!0}function bp(o,a,d,g,v,S){if(Po=S,Xt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Yc.current=o===null||o.memoizedState===null?NE:CE,o=d(g,v),rl){S=0;do{if(rl=!1,sl=0,25<=S)throw Error(n(301));S+=1,Sn=gn=null,a.updateQueue=null,Yc.current=EE,o=d(g,v)}while(rl)}if(Yc.current=Zc,a=gn!==null&&gn.next!==null,Po=0,Sn=gn=Xt=null,Jc=!1,a)throw Error(n(300));return o}function vp(){var o=sl!==0;return sl=0,o}function ns(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?Xt.memoizedState=Sn=o:Sn=Sn.next=o,Sn}function Sr(){if(gn===null){var o=Xt.alternate;o=o!==null?o.memoizedState:null}else o=gn.next;var a=Sn===null?Xt.memoizedState:Sn.next;if(a!==null)Sn=a,gn=o;else{if(o===null)throw Error(n(310));gn=o,o={memoizedState:gn.memoizedState,baseState:gn.baseState,baseQueue:gn.baseQueue,queue:gn.queue,next:null},Sn===null?Xt.memoizedState=Sn=o:Sn=Sn.next=o}return Sn}function ol(o,a){return typeof a=="function"?a(o):a}function wp(o){var a=Sr(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var g=gn,v=g.baseQueue,S=d.pending;if(S!==null){if(v!==null){var A=v.next;v.next=S.next,S.next=A}g.baseQueue=v=S,d.pending=null}if(v!==null){S=v.next,g=g.baseState;var B=A=null,K=null,de=S;do{var je=de.lane;if((Po&je)===je)K!==null&&(K=K.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),g=de.hasEagerState?de.eagerState:o(g,de.action);else{var Ne={lane:je,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};K===null?(B=K=Ne,A=g):K=K.next=Ne,Xt.lanes|=je,Ro|=je}de=de.next}while(de!==null&&de!==S);K===null?A=g:K.next=B,Fr(g,a.memoizedState)||(Xn=!0),a.memoizedState=g,a.baseState=A,a.baseQueue=K,d.lastRenderedState=g}if(o=d.interleaved,o!==null){v=o;do S=v.lane,Xt.lanes|=S,Ro|=S,v=v.next;while(v!==o)}else v===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function jp(o){var a=Sr(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=o;var g=d.dispatch,v=d.pending,S=a.memoizedState;if(v!==null){d.pending=null;var A=v=v.next;do S=o(S,A.action),A=A.next;while(A!==v);Fr(S,a.memoizedState)||(Xn=!0),a.memoizedState=S,a.baseQueue===null&&(a.baseState=S),d.lastRenderedState=S}return[S,g]}function Iy(){}function _y(o,a){var d=Xt,g=Sr(),v=a(),S=!Fr(g.memoizedState,v);if(S&&(g.memoizedState=v,Xn=!0),g=g.queue,kp(zy.bind(null,d,g,o),[o]),g.getSnapshot!==a||S||Sn!==null&&Sn.memoizedState.tag&1){if(d.flags|=2048,il(9,Fy.bind(null,d,g,v,a),void 0,null),Nn===null)throw Error(n(349));(Po&30)!==0||My(d,a,v)}return v}function My(o,a,d){o.flags|=16384,o={getSnapshot:a,value:d},a=Xt.updateQueue,a===null?(a={lastEffect:null,stores:null},Xt.updateQueue=a,a.stores=[o]):(d=a.stores,d===null?a.stores=[o]:d.push(o))}function Fy(o,a,d,g){a.value=d,a.getSnapshot=g,By(a)&&Uy(o)}function zy(o,a,d){return d(function(){By(a)&&Uy(o)})}function By(o){var a=o.getSnapshot;o=o.value;try{var d=a();return!Fr(o,d)}catch{return!0}}function Uy(o){var a=js(o,1);a!==null&&Hr(a,o,1,-1)}function Vy(o){var a=ns();return typeof o=="function"&&(o=o()),a.memoizedState=a.baseState=o,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ol,lastRenderedState:o},a.queue=o,o=o.dispatch=SE.bind(null,Xt,o),[a.memoizedState,o]}function il(o,a,d,g){return o={tag:o,create:a,destroy:d,deps:g,next:null},a=Xt.updateQueue,a===null?(a={lastEffect:null,stores:null},Xt.updateQueue=a,a.lastEffect=o.next=o):(d=a.lastEffect,d===null?a.lastEffect=o.next=o:(g=d.next,d.next=o,o.next=g,a.lastEffect=o)),o}function Hy(){return Sr().memoizedState}function Xc(o,a,d,g){var v=ns();Xt.flags|=o,v.memoizedState=il(1|a,d,void 0,g===void 0?null:g)}function Qc(o,a,d,g){var v=Sr();g=g===void 0?null:g;var S=void 0;if(gn!==null){var A=gn.memoizedState;if(S=A.destroy,g!==null&&yp(g,A.deps)){v.memoizedState=il(a,d,S,g);return}}Xt.flags|=o,v.memoizedState=il(1|a,d,S,g)}function Wy(o,a){return Xc(8390656,8,o,a)}function kp(o,a){return Qc(2048,8,o,a)}function Ky(o,a){return Qc(4,2,o,a)}function qy(o,a){return Qc(4,4,o,a)}function Gy(o,a){if(typeof a=="function")return o=o(),a(o),function(){a(null)};if(a!=null)return o=o(),a.current=o,function(){a.current=null}}function Yy(o,a,d){return d=d!=null?d.concat([o]):null,Qc(4,4,Gy.bind(null,a,o),d)}function Sp(){}function Jy(o,a){var d=Sr();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&yp(a,g[1])?g[0]:(d.memoizedState=[o,a],o)}function Xy(o,a){var d=Sr();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&yp(a,g[1])?g[0]:(o=o(),d.memoizedState=[o,a],o)}function Qy(o,a,d){return(Po&21)===0?(o.baseState&&(o.baseState=!1,Xn=!0),o.memoizedState=d):(Fr(d,a)||(d=bc(),Xt.lanes|=d,Ro|=d,o.baseState=!0),a)}function jE(o,a){var d=Et;Et=d!==0&&4>d?d:4,o(!0);var g=xp.transition;xp.transition={};try{o(!1),a()}finally{Et=d,xp.transition=g}}function Zy(){return Sr().memoizedState}function kE(o,a,d){var g=qs(o);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},eb(o))tb(a,d);else if(d=Ay(o,a,d,g),d!==null){var v=Hn();Hr(d,o,g,v),nb(d,a,g)}}function SE(o,a,d){var g=qs(o),v={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(eb(o))tb(a,v);else{var S=o.alternate;if(o.lanes===0&&(S===null||S.lanes===0)&&(S=a.lastRenderedReducer,S!==null))try{var A=a.lastRenderedState,B=S(A,d);if(v.hasEagerState=!0,v.eagerState=B,Fr(B,A)){var K=a.interleaved;K===null?(v.next=v,dp(a)):(v.next=K.next,K.next=v),a.interleaved=v;return}}catch{}finally{}d=Ay(o,a,v,g),d!==null&&(v=Hn(),Hr(d,o,g,v),nb(d,a,g))}}function eb(o){var a=o.alternate;return o===Xt||a!==null&&a===Xt}function tb(o,a){rl=Jc=!0;var d=o.pending;d===null?a.next=a:(a.next=d.next,d.next=a),o.pending=a}function nb(o,a,d){if((d&4194240)!==0){var g=a.lanes;g&=o.pendingLanes,d|=g,a.lanes=d,Ma(o,d)}}var Zc={readContext:kr,useCallback:In,useContext:In,useEffect:In,useImperativeHandle:In,useInsertionEffect:In,useLayoutEffect:In,useMemo:In,useReducer:In,useRef:In,useState:In,useDebugValue:In,useDeferredValue:In,useTransition:In,useMutableSource:In,useSyncExternalStore:In,useId:In,unstable_isNewReconciler:!1},NE={readContext:kr,useCallback:function(o,a){return ns().memoizedState=[o,a===void 0?null:a],o},useContext:kr,useEffect:Wy,useImperativeHandle:function(o,a,d){return d=d!=null?d.concat([o]):null,Xc(4194308,4,Gy.bind(null,a,o),d)},useLayoutEffect:function(o,a){return Xc(4194308,4,o,a)},useInsertionEffect:function(o,a){return Xc(4,2,o,a)},useMemo:function(o,a){var d=ns();return a=a===void 0?null:a,o=o(),d.memoizedState=[o,a],o},useReducer:function(o,a,d){var g=ns();return a=d!==void 0?d(a):a,g.memoizedState=g.baseState=a,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:a},g.queue=o,o=o.dispatch=kE.bind(null,Xt,o),[g.memoizedState,o]},useRef:function(o){var a=ns();return o={current:o},a.memoizedState=o},useState:Vy,useDebugValue:Sp,useDeferredValue:function(o){return ns().memoizedState=o},useTransition:function(){var o=Vy(!1),a=o[0];return o=jE.bind(null,o[1]),ns().memoizedState=o,[a,o]},useMutableSource:function(){},useSyncExternalStore:function(o,a,d){var g=Xt,v=ns();if(Kt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=a(),Nn===null)throw Error(n(349));(Po&30)!==0||My(g,a,d)}v.memoizedState=d;var S={value:d,getSnapshot:a};return v.queue=S,Wy(zy.bind(null,g,S,o),[o]),g.flags|=2048,il(9,Fy.bind(null,g,S,d,a),void 0,null),d},useId:function(){var o=ns(),a=Nn.identifierPrefix;if(Kt){var d=ws,g=vs;d=(g&~(1<<32-jt(g)-1)).toString(32)+d,a=":"+a+"R"+d,d=sl++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=wE++,a=":"+a+"r"+d.toString(32)+":";return o.memoizedState=a},unstable_isNewReconciler:!1},CE={readContext:kr,useCallback:Jy,useContext:kr,useEffect:kp,useImperativeHandle:Yy,useInsertionEffect:Ky,useLayoutEffect:qy,useMemo:Xy,useReducer:wp,useRef:Hy,useState:function(){return wp(ol)},useDebugValue:Sp,useDeferredValue:function(o){var a=Sr();return Qy(a,gn.memoizedState,o)},useTransition:function(){var o=wp(ol)[0],a=Sr().memoizedState;return[o,a]},useMutableSource:Iy,useSyncExternalStore:_y,useId:Zy,unstable_isNewReconciler:!1},EE={readContext:kr,useCallback:Jy,useContext:kr,useEffect:kp,useImperativeHandle:Yy,useInsertionEffect:Ky,useLayoutEffect:qy,useMemo:Xy,useReducer:jp,useRef:Hy,useState:function(){return jp(ol)},useDebugValue:Sp,useDeferredValue:function(o){var a=Sr();return gn===null?a.memoizedState=o:Qy(a,gn.memoizedState,o)},useTransition:function(){var o=jp(ol)[0],a=Sr().memoizedState;return[o,a]},useMutableSource:Iy,useSyncExternalStore:_y,useId:Zy,unstable_isNewReconciler:!1};function Br(o,a){if(o&&o.defaultProps){a=R({},a),o=o.defaultProps;for(var d in o)a[d]===void 0&&(a[d]=o[d]);return a}return a}function Np(o,a,d,g){a=o.memoizedState,d=d(g,a),d=d==null?a:R({},a,d),o.memoizedState=d,o.lanes===0&&(o.updateQueue.baseState=d)}var eu={isMounted:function(o){return(o=o._reactInternals)?_r(o)===o:!1},enqueueSetState:function(o,a,d){o=o._reactInternals;var g=Hn(),v=qs(o),S=ks(g,v);S.payload=a,d!=null&&(S.callback=d),a=Vs(o,S,v),a!==null&&(Hr(a,o,v,g),Kc(a,o,v))},enqueueReplaceState:function(o,a,d){o=o._reactInternals;var g=Hn(),v=qs(o),S=ks(g,v);S.tag=1,S.payload=a,d!=null&&(S.callback=d),a=Vs(o,S,v),a!==null&&(Hr(a,o,v,g),Kc(a,o,v))},enqueueForceUpdate:function(o,a){o=o._reactInternals;var d=Hn(),g=qs(o),v=ks(d,g);v.tag=2,a!=null&&(v.callback=a),a=Vs(o,v,g),a!==null&&(Hr(a,o,g,d),Kc(a,o,g))}};function rb(o,a,d,g,v,S,A){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(g,S,A):a.prototype&&a.prototype.isPureReactComponent?!Ka(d,g)||!Ka(v,S):!0}function sb(o,a,d){var g=!1,v=zs,S=a.contextType;return typeof S=="object"&&S!==null?S=kr(S):(v=Jn(a)?So:On.current,g=a.contextTypes,S=(g=g!=null)?ji(o,v):zs),a=new a(d,S),o.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=eu,o.stateNode=a,a._reactInternals=o,g&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=v,o.__reactInternalMemoizedMaskedChildContext=S),a}function ob(o,a,d,g){o=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,g),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,g),a.state!==o&&eu.enqueueReplaceState(a,a.state,null)}function Cp(o,a,d,g){var v=o.stateNode;v.props=d,v.state=o.memoizedState,v.refs={},fp(o);var S=a.contextType;typeof S=="object"&&S!==null?v.context=kr(S):(S=Jn(a)?So:On.current,v.context=ji(o,S)),v.state=o.memoizedState,S=a.getDerivedStateFromProps,typeof S=="function"&&(Np(o,a,S,d),v.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(a=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),a!==v.state&&eu.enqueueReplaceState(v,v.state,null),qc(o,d,v,g),v.state=o.memoizedState),typeof v.componentDidMount=="function"&&(o.flags|=4194308)}function Ri(o,a){try{var d="",g=a;do d+=ge(g),g=g.return;while(g);var v=d}catch(S){v=`
|
|
39
|
+
Error generating stack: `+S.message+`
|
|
40
|
+
`+S.stack}return{value:o,source:a,stack:v,digest:null}}function Ep(o,a,d){return{value:o,source:null,stack:d??null,digest:a??null}}function Tp(o,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var TE=typeof WeakMap=="function"?WeakMap:Map;function ib(o,a,d){d=ks(-1,d),d.tag=3,d.payload={element:null};var g=a.value;return d.callback=function(){au||(au=!0,Vp=g),Tp(o,a)},d}function ab(o,a,d){d=ks(-1,d),d.tag=3;var g=o.type.getDerivedStateFromError;if(typeof g=="function"){var v=a.value;d.payload=function(){return g(v)},d.callback=function(){Tp(o,a)}}var S=o.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(d.callback=function(){Tp(o,a),typeof g!="function"&&(Ws===null?Ws=new Set([this]):Ws.add(this));var A=a.stack;this.componentDidCatch(a.value,{componentStack:A!==null?A:""})}),d}function lb(o,a,d){var g=o.pingCache;if(g===null){g=o.pingCache=new TE;var v=new Set;g.set(a,v)}else v=g.get(a),v===void 0&&(v=new Set,g.set(a,v));v.has(d)||(v.add(d),o=UE.bind(null,o,a,d),a.then(o,o))}function cb(o){do{var a;if((a=o.tag===13)&&(a=o.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return o;o=o.return}while(o!==null);return null}function ub(o,a,d,g,v){return(o.mode&1)===0?(o===a?o.flags|=65536:(o.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=ks(-1,1),a.tag=2,Vs(d,a,1))),d.lanes|=1),o):(o.flags|=65536,o.lanes=v,o)}var PE=P.ReactCurrentOwner,Xn=!1;function Vn(o,a,d,g){a.child=o===null?Ry(a,null,d,g):Ci(a,o.child,d,g)}function db(o,a,d,g,v){d=d.render;var S=a.ref;return Ti(a,v),g=bp(o,a,d,g,S,v),d=vp(),o!==null&&!Xn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~v,Ss(o,a,v)):(Kt&&d&&np(a),a.flags|=1,Vn(o,a,g,v),a.child)}function fb(o,a,d,g,v){if(o===null){var S=d.type;return typeof S=="function"&&!Jp(S)&&S.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=S,pb(o,a,S,g,v)):(o=pu(d.type,null,g,a,a.mode,v),o.ref=a.ref,o.return=a,a.child=o)}if(S=o.child,(o.lanes&v)===0){var A=S.memoizedProps;if(d=d.compare,d=d!==null?d:Ka,d(A,g)&&o.ref===a.ref)return Ss(o,a,v)}return a.flags|=1,o=Ys(S,g),o.ref=a.ref,o.return=a,a.child=o}function pb(o,a,d,g,v){if(o!==null){var S=o.memoizedProps;if(Ka(S,g)&&o.ref===a.ref)if(Xn=!1,a.pendingProps=g=S,(o.lanes&v)!==0)(o.flags&131072)!==0&&(Xn=!0);else return a.lanes=o.lanes,Ss(o,a,v)}return Pp(o,a,d,g,v)}function mb(o,a,d){var g=a.pendingProps,v=g.children,S=o!==null?o.memoizedState:null;if(g.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ot(Di,fr),fr|=d;else{if((d&1073741824)===0)return o=S!==null?S.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:o,cachePool:null,transitions:null},a.updateQueue=null,Ot(Di,fr),fr|=o,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=S!==null?S.baseLanes:d,Ot(Di,fr),fr|=g}else S!==null?(g=S.baseLanes|d,a.memoizedState=null):g=d,Ot(Di,fr),fr|=g;return Vn(o,a,v,d),a.child}function hb(o,a){var d=a.ref;(o===null&&d!==null||o!==null&&o.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function Pp(o,a,d,g,v){var S=Jn(d)?So:On.current;return S=ji(a,S),Ti(a,v),d=bp(o,a,d,g,S,v),g=vp(),o!==null&&!Xn?(a.updateQueue=o.updateQueue,a.flags&=-2053,o.lanes&=~v,Ss(o,a,v)):(Kt&&g&&np(a),a.flags|=1,Vn(o,a,d,v),a.child)}function gb(o,a,d,g,v){if(Jn(d)){var S=!0;Mc(a)}else S=!1;if(Ti(a,v),a.stateNode===null)nu(o,a),sb(a,d,g),Cp(a,d,g,v),g=!0;else if(o===null){var A=a.stateNode,B=a.memoizedProps;A.props=B;var K=A.context,de=d.contextType;typeof de=="object"&&de!==null?de=kr(de):(de=Jn(d)?So:On.current,de=ji(a,de));var je=d.getDerivedStateFromProps,Ne=typeof je=="function"||typeof A.getSnapshotBeforeUpdate=="function";Ne||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==g||K!==de)&&ob(a,A,g,de),Us=!1;var we=a.memoizedState;A.state=we,qc(a,g,A,v),K=a.memoizedState,B!==g||we!==K||Yn.current||Us?(typeof je=="function"&&(Np(a,d,je,g),K=a.memoizedState),(B=Us||rb(a,d,B,g,we,K,de))?(Ne||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(a.flags|=4194308)):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=g,a.memoizedState=K),A.props=g,A.state=K,A.context=de,g=B):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),g=!1)}else{A=a.stateNode,Dy(o,a),B=a.memoizedProps,de=a.type===a.elementType?B:Br(a.type,B),A.props=de,Ne=a.pendingProps,we=A.context,K=d.contextType,typeof K=="object"&&K!==null?K=kr(K):(K=Jn(d)?So:On.current,K=ji(a,K));var ze=d.getDerivedStateFromProps;(je=typeof ze=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(B!==Ne||we!==K)&&ob(a,A,g,K),Us=!1,we=a.memoizedState,A.state=we,qc(a,g,A,v);var Ve=a.memoizedState;B!==Ne||we!==Ve||Yn.current||Us?(typeof ze=="function"&&(Np(a,d,ze,g),Ve=a.memoizedState),(de=Us||rb(a,d,de,g,we,Ve,K)||!1)?(je||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,Ve,K),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,Ve,K)),typeof A.componentDidUpdate=="function"&&(a.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof A.componentDidUpdate!="function"||B===o.memoizedProps&&we===o.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===o.memoizedProps&&we===o.memoizedState||(a.flags|=1024),a.memoizedProps=g,a.memoizedState=Ve),A.props=g,A.state=Ve,A.context=K,g=de):(typeof A.componentDidUpdate!="function"||B===o.memoizedProps&&we===o.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||B===o.memoizedProps&&we===o.memoizedState||(a.flags|=1024),g=!1)}return Rp(o,a,d,g,S,v)}function Rp(o,a,d,g,v,S){hb(o,a);var A=(a.flags&128)!==0;if(!g&&!A)return v&&wy(a,d,!1),Ss(o,a,S);g=a.stateNode,PE.current=a;var B=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return a.flags|=1,o!==null&&A?(a.child=Ci(a,o.child,null,S),a.child=Ci(a,null,B,S)):Vn(o,a,B,S),a.memoizedState=g.state,v&&wy(a,d,!0),a.child}function xb(o){var a=o.stateNode;a.pendingContext?by(o,a.pendingContext,a.pendingContext!==a.context):a.context&&by(o,a.context,!1),pp(o,a.containerInfo)}function yb(o,a,d,g,v){return Ni(),ip(v),a.flags|=256,Vn(o,a,d,g),a.child}var Ap={dehydrated:null,treeContext:null,retryLane:0};function Dp(o){return{baseLanes:o,cachePool:null,transitions:null}}function bb(o,a,d){var g=a.pendingProps,v=Jt.current,S=!1,A=(a.flags&128)!==0,B;if((B=A)||(B=o!==null&&o.memoizedState===null?!1:(v&2)!==0),B?(S=!0,a.flags&=-129):(o===null||o.memoizedState!==null)&&(v|=1),Ot(Jt,v&1),o===null)return op(a),o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null)?((a.mode&1)===0?a.lanes=1:o.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(A=g.children,o=g.fallback,S?(g=a.mode,S=a.child,A={mode:"hidden",children:A},(g&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=A):S=mu(A,g,0,null),o=Lo(o,g,d,null),S.return=a,o.return=a,S.sibling=o,a.child=S,a.child.memoizedState=Dp(d),a.memoizedState=Ap,o):$p(a,A));if(v=o.memoizedState,v!==null&&(B=v.dehydrated,B!==null))return RE(o,a,A,g,B,v,d);if(S){S=g.fallback,A=a.mode,v=o.child,B=v.sibling;var K={mode:"hidden",children:g.children};return(A&1)===0&&a.child!==v?(g=a.child,g.childLanes=0,g.pendingProps=K,a.deletions=null):(g=Ys(v,K),g.subtreeFlags=v.subtreeFlags&14680064),B!==null?S=Ys(B,S):(S=Lo(S,A,d,null),S.flags|=2),S.return=a,g.return=a,g.sibling=S,a.child=g,g=S,S=a.child,A=o.child.memoizedState,A=A===null?Dp(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},S.memoizedState=A,S.childLanes=o.childLanes&~d,a.memoizedState=Ap,g}return S=o.child,o=S.sibling,g=Ys(S,{mode:"visible",children:g.children}),(a.mode&1)===0&&(g.lanes=d),g.return=a,g.sibling=null,o!==null&&(d=a.deletions,d===null?(a.deletions=[o],a.flags|=16):d.push(o)),a.child=g,a.memoizedState=null,g}function $p(o,a){return a=mu({mode:"visible",children:a},o.mode,0,null),a.return=o,o.child=a}function tu(o,a,d,g){return g!==null&&ip(g),Ci(a,o.child,null,d),o=$p(a,a.pendingProps.children),o.flags|=2,a.memoizedState=null,o}function RE(o,a,d,g,v,S,A){if(d)return a.flags&256?(a.flags&=-257,g=Ep(Error(n(422))),tu(o,a,A,g)):a.memoizedState!==null?(a.child=o.child,a.flags|=128,null):(S=g.fallback,v=a.mode,g=mu({mode:"visible",children:g.children},v,0,null),S=Lo(S,v,A,null),S.flags|=2,g.return=a,S.return=a,g.sibling=S,a.child=g,(a.mode&1)!==0&&Ci(a,o.child,null,A),a.child.memoizedState=Dp(A),a.memoizedState=Ap,S);if((a.mode&1)===0)return tu(o,a,A,null);if(v.data==="$!"){if(g=v.nextSibling&&v.nextSibling.dataset,g)var B=g.dgst;return g=B,S=Error(n(419)),g=Ep(S,g,void 0),tu(o,a,A,g)}if(B=(A&o.childLanes)!==0,Xn||B){if(g=Nn,g!==null){switch(A&-A){case 4:v=2;break;case 16:v=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:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(g.suspendedLanes|A))!==0?0:v,v!==0&&v!==S.retryLane&&(S.retryLane=v,js(o,v),Hr(g,o,v,-1))}return Yp(),g=Ep(Error(n(421))),tu(o,a,A,g)}return v.data==="$?"?(a.flags|=128,a.child=o.child,a=VE.bind(null,o),v._reactRetry=a,null):(o=S.treeContext,dr=Ms(v.nextSibling),ur=a,Kt=!0,zr=null,o!==null&&(wr[jr++]=vs,wr[jr++]=ws,wr[jr++]=No,vs=o.id,ws=o.overflow,No=a),a=$p(a,g.children),a.flags|=4096,a)}function vb(o,a,d){o.lanes|=a;var g=o.alternate;g!==null&&(g.lanes|=a),up(o.return,a,d)}function Lp(o,a,d,g,v){var S=o.memoizedState;S===null?o.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:v}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=g,S.tail=d,S.tailMode=v)}function wb(o,a,d){var g=a.pendingProps,v=g.revealOrder,S=g.tail;if(Vn(o,a,g.children,d),g=Jt.current,(g&2)!==0)g=g&1|2,a.flags|=128;else{if(o!==null&&(o.flags&128)!==0)e:for(o=a.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&vb(o,d,a);else if(o.tag===19)vb(o,d,a);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===a)break e;for(;o.sibling===null;){if(o.return===null||o.return===a)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}g&=1}if(Ot(Jt,g),(a.mode&1)===0)a.memoizedState=null;else switch(v){case"forwards":for(d=a.child,v=null;d!==null;)o=d.alternate,o!==null&&Gc(o)===null&&(v=d),d=d.sibling;d=v,d===null?(v=a.child,a.child=null):(v=d.sibling,d.sibling=null),Lp(a,!1,v,d,S);break;case"backwards":for(d=null,v=a.child,a.child=null;v!==null;){if(o=v.alternate,o!==null&&Gc(o)===null){a.child=v;break}o=v.sibling,v.sibling=d,d=v,v=o}Lp(a,!0,d,null,S);break;case"together":Lp(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function nu(o,a){(a.mode&1)===0&&o!==null&&(o.alternate=null,a.alternate=null,a.flags|=2)}function Ss(o,a,d){if(o!==null&&(a.dependencies=o.dependencies),Ro|=a.lanes,(d&a.childLanes)===0)return null;if(o!==null&&a.child!==o.child)throw Error(n(153));if(a.child!==null){for(o=a.child,d=Ys(o,o.pendingProps),a.child=d,d.return=a;o.sibling!==null;)o=o.sibling,d=d.sibling=Ys(o,o.pendingProps),d.return=a;d.sibling=null}return a.child}function AE(o,a,d){switch(a.tag){case 3:xb(a),Ni();break;case 5:Oy(a);break;case 1:Jn(a.type)&&Mc(a);break;case 4:pp(a,a.stateNode.containerInfo);break;case 10:var g=a.type._context,v=a.memoizedProps.value;Ot(Hc,g._currentValue),g._currentValue=v;break;case 13:if(g=a.memoizedState,g!==null)return g.dehydrated!==null?(Ot(Jt,Jt.current&1),a.flags|=128,null):(d&a.child.childLanes)!==0?bb(o,a,d):(Ot(Jt,Jt.current&1),o=Ss(o,a,d),o!==null?o.sibling:null);Ot(Jt,Jt.current&1);break;case 19:if(g=(d&a.childLanes)!==0,(o.flags&128)!==0){if(g)return wb(o,a,d);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Ot(Jt,Jt.current),g)break;return null;case 22:case 23:return a.lanes=0,mb(o,a,d)}return Ss(o,a,d)}var jb,Op,kb,Sb;jb=function(o,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)o.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Op=function(){},kb=function(o,a,d,g){var v=o.memoizedProps;if(v!==g){o=a.stateNode,To(ts.current);var S=null;switch(d){case"input":v=ot(o,v),g=ot(o,g),S=[];break;case"select":v=R({},v,{value:void 0}),g=R({},g,{value:void 0}),S=[];break;case"textarea":v=Ke(o,v),g=Ke(o,g),S=[];break;default:typeof v.onClick!="function"&&typeof g.onClick=="function"&&(o.onclick=Oc)}at(d,g);var A;d=null;for(de in v)if(!g.hasOwnProperty(de)&&v.hasOwnProperty(de)&&v[de]!=null)if(de==="style"){var B=v[de];for(A in B)B.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(i.hasOwnProperty(de)?S||(S=[]):(S=S||[]).push(de,null));for(de in g){var K=g[de];if(B=v!=null?v[de]:void 0,g.hasOwnProperty(de)&&K!==B&&(K!=null||B!=null))if(de==="style")if(B){for(A in B)!B.hasOwnProperty(A)||K&&K.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in K)K.hasOwnProperty(A)&&B[A]!==K[A]&&(d||(d={}),d[A]=K[A])}else d||(S||(S=[]),S.push(de,d)),d=K;else de==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,B=B?B.__html:void 0,K!=null&&B!==K&&(S=S||[]).push(de,K)):de==="children"?typeof K!="string"&&typeof K!="number"||(S=S||[]).push(de,""+K):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(i.hasOwnProperty(de)?(K!=null&&de==="onScroll"&&zt("scroll",o),S||B===K||(S=[])):(S=S||[]).push(de,K))}d&&(S=S||[]).push("style",d);var de=S;(a.updateQueue=de)&&(a.flags|=4)}},Sb=function(o,a,d,g){d!==g&&(a.flags|=4)};function al(o,a){if(!Kt)switch(o.tailMode){case"hidden":a=o.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o.tail=null:d.sibling=null;break;case"collapsed":d=o.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?a||o.tail===null?o.tail=null:o.tail.sibling=null:g.sibling=null}}function _n(o){var a=o.alternate!==null&&o.alternate.child===o.child,d=0,g=0;if(a)for(var v=o.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags&14680064,g|=v.flags&14680064,v.return=o,v=v.sibling;else for(v=o.child;v!==null;)d|=v.lanes|v.childLanes,g|=v.subtreeFlags,g|=v.flags,v.return=o,v=v.sibling;return o.subtreeFlags|=g,o.childLanes=d,a}function DE(o,a,d){var g=a.pendingProps;switch(rp(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _n(a),null;case 1:return Jn(a.type)&&_c(),_n(a),null;case 3:return g=a.stateNode,Pi(),Bt(Yn),Bt(On),gp(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(o===null||o.child===null)&&(Uc(a)?a.flags|=4:o===null||o.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,zr!==null&&(Kp(zr),zr=null))),Op(o,a),_n(a),null;case 5:mp(a);var v=To(nl.current);if(d=a.type,o!==null&&a.stateNode!=null)kb(o,a,d,g,v),o.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!g){if(a.stateNode===null)throw Error(n(166));return _n(a),null}if(o=To(ts.current),Uc(a)){g=a.stateNode,d=a.type;var S=a.memoizedProps;switch(g[es]=a,g[Xa]=S,o=(a.mode&1)!==0,d){case"dialog":zt("cancel",g),zt("close",g);break;case"iframe":case"object":case"embed":zt("load",g);break;case"video":case"audio":for(v=0;v<Ga.length;v++)zt(Ga[v],g);break;case"source":zt("error",g);break;case"img":case"image":case"link":zt("error",g),zt("load",g);break;case"details":zt("toggle",g);break;case"input":G(g,S),zt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!S.multiple},zt("invalid",g);break;case"textarea":gt(g,S),zt("invalid",g)}at(d,S),v=null;for(var A in S)if(S.hasOwnProperty(A)){var B=S[A];A==="children"?typeof B=="string"?g.textContent!==B&&(S.suppressHydrationWarning!==!0&&Lc(g.textContent,B,o),v=["children",B]):typeof B=="number"&&g.textContent!==""+B&&(S.suppressHydrationWarning!==!0&&Lc(g.textContent,B,o),v=["children",""+B]):i.hasOwnProperty(A)&&B!=null&&A==="onScroll"&&zt("scroll",g)}switch(d){case"input":he(g),Oe(g,S,!0);break;case"textarea":he(g),it(g);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(g.onclick=Oc)}g=v,a.updateQueue=g,g!==null&&(a.flags|=4)}else{A=v.nodeType===9?v:v.ownerDocument,o==="http://www.w3.org/1999/xhtml"&&(o=ie(d)),o==="http://www.w3.org/1999/xhtml"?d==="script"?(o=A.createElement("div"),o.innerHTML="<script><\/script>",o=o.removeChild(o.firstChild)):typeof g.is=="string"?o=A.createElement(d,{is:g.is}):(o=A.createElement(d),d==="select"&&(A=o,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):o=A.createElementNS(o,d),o[es]=a,o[Xa]=g,jb(o,a,!1,!1),a.stateNode=o;e:{switch(A=Me(d,g),d){case"dialog":zt("cancel",o),zt("close",o),v=g;break;case"iframe":case"object":case"embed":zt("load",o),v=g;break;case"video":case"audio":for(v=0;v<Ga.length;v++)zt(Ga[v],o);v=g;break;case"source":zt("error",o),v=g;break;case"img":case"image":case"link":zt("error",o),zt("load",o),v=g;break;case"details":zt("toggle",o),v=g;break;case"input":G(o,g),v=ot(o,g),zt("invalid",o);break;case"option":v=g;break;case"select":o._wrapperState={wasMultiple:!!g.multiple},v=R({},g,{value:void 0}),zt("invalid",o);break;case"textarea":gt(o,g),v=Ke(o,g),zt("invalid",o);break;default:v=g}at(d,v),B=v;for(S in B)if(B.hasOwnProperty(S)){var K=B[S];S==="style"?be(o,K):S==="dangerouslySetInnerHTML"?(K=K?K.__html:void 0,K!=null&&Z(o,K)):S==="children"?typeof K=="string"?(d!=="textarea"||K!=="")&&ye(o,K):typeof K=="number"&&ye(o,""+K):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(i.hasOwnProperty(S)?K!=null&&S==="onScroll"&&zt("scroll",o):K!=null&&N(o,S,K,A))}switch(d){case"input":he(o),Oe(o,g,!1);break;case"textarea":he(o),it(o);break;case"option":g.value!=null&&o.setAttribute("value",""+me(g.value));break;case"select":o.multiple=!!g.multiple,S=g.value,S!=null?nt(o,!!g.multiple,S,!1):g.defaultValue!=null&&nt(o,!!g.multiple,g.defaultValue,!0);break;default:typeof v.onClick=="function"&&(o.onclick=Oc)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return _n(a),null;case 6:if(o&&a.stateNode!=null)Sb(o,a,o.memoizedProps,g);else{if(typeof g!="string"&&a.stateNode===null)throw Error(n(166));if(d=To(nl.current),To(ts.current),Uc(a)){if(g=a.stateNode,d=a.memoizedProps,g[es]=a,(S=g.nodeValue!==d)&&(o=ur,o!==null))switch(o.tag){case 3:Lc(g.nodeValue,d,(o.mode&1)!==0);break;case 5:o.memoizedProps.suppressHydrationWarning!==!0&&Lc(g.nodeValue,d,(o.mode&1)!==0)}S&&(a.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[es]=a,a.stateNode=g}return _n(a),null;case 13:if(Bt(Jt),g=a.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(Kt&&dr!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Ey(),Ni(),a.flags|=98560,S=!1;else if(S=Uc(a),g!==null&&g.dehydrated!==null){if(o===null){if(!S)throw Error(n(318));if(S=a.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[es]=a}else Ni(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_n(a),S=!1}else zr!==null&&(Kp(zr),zr=null),S=!0;if(!S)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=d,a):(g=g!==null,g!==(o!==null&&o.memoizedState!==null)&&g&&(a.child.flags|=8192,(a.mode&1)!==0&&(o===null||(Jt.current&1)!==0?xn===0&&(xn=3):Yp())),a.updateQueue!==null&&(a.flags|=4),_n(a),null);case 4:return Pi(),Op(o,a),o===null&&Ya(a.stateNode.containerInfo),_n(a),null;case 10:return cp(a.type._context),_n(a),null;case 17:return Jn(a.type)&&_c(),_n(a),null;case 19:if(Bt(Jt),S=a.memoizedState,S===null)return _n(a),null;if(g=(a.flags&128)!==0,A=S.rendering,A===null)if(g)al(S,!1);else{if(xn!==0||o!==null&&(o.flags&128)!==0)for(o=a.child;o!==null;){if(A=Gc(o),A!==null){for(a.flags|=128,al(S,!1),g=A.updateQueue,g!==null&&(a.updateQueue=g,a.flags|=4),a.subtreeFlags=0,g=d,d=a.child;d!==null;)S=d,o=g,S.flags&=14680066,A=S.alternate,A===null?(S.childLanes=0,S.lanes=o,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=A.childLanes,S.lanes=A.lanes,S.child=A.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=A.memoizedProps,S.memoizedState=A.memoizedState,S.updateQueue=A.updateQueue,S.type=A.type,o=A.dependencies,S.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),d=d.sibling;return Ot(Jt,Jt.current&1|2),a.child}o=o.sibling}S.tail!==null&&Lt()>$i&&(a.flags|=128,g=!0,al(S,!1),a.lanes=4194304)}else{if(!g)if(o=Gc(A),o!==null){if(a.flags|=128,g=!0,d=o.updateQueue,d!==null&&(a.updateQueue=d,a.flags|=4),al(S,!0),S.tail===null&&S.tailMode==="hidden"&&!A.alternate&&!Kt)return _n(a),null}else 2*Lt()-S.renderingStartTime>$i&&d!==1073741824&&(a.flags|=128,g=!0,al(S,!1),a.lanes=4194304);S.isBackwards?(A.sibling=a.child,a.child=A):(d=S.last,d!==null?d.sibling=A:a.child=A,S.last=A)}return S.tail!==null?(a=S.tail,S.rendering=a,S.tail=a.sibling,S.renderingStartTime=Lt(),a.sibling=null,d=Jt.current,Ot(Jt,g?d&1|2:d&1),a):(_n(a),null);case 22:case 23:return Gp(),g=a.memoizedState!==null,o!==null&&o.memoizedState!==null!==g&&(a.flags|=8192),g&&(a.mode&1)!==0?(fr&1073741824)!==0&&(_n(a),a.subtreeFlags&6&&(a.flags|=8192)):_n(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function $E(o,a){switch(rp(a),a.tag){case 1:return Jn(a.type)&&_c(),o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 3:return Pi(),Bt(Yn),Bt(On),gp(),o=a.flags,(o&65536)!==0&&(o&128)===0?(a.flags=o&-65537|128,a):null;case 5:return mp(a),null;case 13:if(Bt(Jt),o=a.memoizedState,o!==null&&o.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Ni()}return o=a.flags,o&65536?(a.flags=o&-65537|128,a):null;case 19:return Bt(Jt),null;case 4:return Pi(),null;case 10:return cp(a.type._context),null;case 22:case 23:return Gp(),null;case 24:return null;default:return null}}var ru=!1,Mn=!1,LE=typeof WeakSet=="function"?WeakSet:Set,Ue=null;function Ai(o,a){var d=o.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){en(o,a,g)}else d.current=null}function Ip(o,a,d){try{d()}catch(g){en(o,a,g)}}var Nb=!1;function OE(o,a){if(Gf=kc,o=ry(),zf(o)){if("selectionStart"in o)var d={start:o.selectionStart,end:o.selectionEnd};else e:{d=(d=o.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var v=g.anchorOffset,S=g.focusNode;g=g.focusOffset;try{d.nodeType,S.nodeType}catch{d=null;break e}var A=0,B=-1,K=-1,de=0,je=0,Ne=o,we=null;t:for(;;){for(var ze;Ne!==d||v!==0&&Ne.nodeType!==3||(B=A+v),Ne!==S||g!==0&&Ne.nodeType!==3||(K=A+g),Ne.nodeType===3&&(A+=Ne.nodeValue.length),(ze=Ne.firstChild)!==null;)we=Ne,Ne=ze;for(;;){if(Ne===o)break t;if(we===d&&++de===v&&(B=A),we===S&&++je===g&&(K=A),(ze=Ne.nextSibling)!==null)break;Ne=we,we=Ne.parentNode}Ne=ze}d=B===-1||K===-1?null:{start:B,end:K}}else d=null}d=d||{start:0,end:0}}else d=null;for(Yf={focusedElem:o,selectionRange:d},kc=!1,Ue=a;Ue!==null;)if(a=Ue,o=a.child,(a.subtreeFlags&1028)!==0&&o!==null)o.return=a,Ue=o;else for(;Ue!==null;){a=Ue;try{var Ve=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Ve!==null){var qe=Ve.memoizedProps,an=Ve.memoizedState,se=a.stateNode,J=se.getSnapshotBeforeUpdate(a.elementType===a.type?qe:Br(a.type,qe),an);se.__reactInternalSnapshotBeforeUpdate=J}break;case 3:var le=a.stateNode.containerInfo;le.nodeType===1?le.textContent="":le.nodeType===9&&le.documentElement&&le.removeChild(le.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Pe){en(a,a.return,Pe)}if(o=a.sibling,o!==null){o.return=a.return,Ue=o;break}Ue=a.return}return Ve=Nb,Nb=!1,Ve}function ll(o,a,d){var g=a.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var v=g=g.next;do{if((v.tag&o)===o){var S=v.destroy;v.destroy=void 0,S!==void 0&&Ip(a,d,S)}v=v.next}while(v!==g)}}function su(o,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&o)===o){var g=d.create;d.destroy=g()}d=d.next}while(d!==a)}}function _p(o){var a=o.ref;if(a!==null){var d=o.stateNode;switch(o.tag){case 5:o=d;break;default:o=d}typeof a=="function"?a(o):a.current=o}}function Cb(o){var a=o.alternate;a!==null&&(o.alternate=null,Cb(a)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(a=o.stateNode,a!==null&&(delete a[es],delete a[Xa],delete a[Zf],delete a[xE],delete a[yE])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Eb(o){return o.tag===5||o.tag===3||o.tag===4}function Tb(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Eb(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Mp(o,a,d){var g=o.tag;if(g===5||g===6)o=o.stateNode,a?d.nodeType===8?d.parentNode.insertBefore(o,a):d.insertBefore(o,a):(d.nodeType===8?(a=d.parentNode,a.insertBefore(o,d)):(a=d,a.appendChild(o)),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=Oc));else if(g!==4&&(o=o.child,o!==null))for(Mp(o,a,d),o=o.sibling;o!==null;)Mp(o,a,d),o=o.sibling}function Fp(o,a,d){var g=o.tag;if(g===5||g===6)o=o.stateNode,a?d.insertBefore(o,a):d.appendChild(o);else if(g!==4&&(o=o.child,o!==null))for(Fp(o,a,d),o=o.sibling;o!==null;)Fp(o,a,d),o=o.sibling}var Tn=null,Ur=!1;function Hs(o,a,d){for(d=d.child;d!==null;)Pb(o,a,d),d=d.sibling}function Pb(o,a,d){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(di,d)}catch{}switch(d.tag){case 5:Mn||Ai(d,a);case 6:var g=Tn,v=Ur;Tn=null,Hs(o,a,d),Tn=g,Ur=v,Tn!==null&&(Ur?(o=Tn,d=d.stateNode,o.nodeType===8?o.parentNode.removeChild(d):o.removeChild(d)):Tn.removeChild(d.stateNode));break;case 18:Tn!==null&&(Ur?(o=Tn,d=d.stateNode,o.nodeType===8?Qf(o.parentNode,d):o.nodeType===1&&Qf(o,d),za(o)):Qf(Tn,d.stateNode));break;case 4:g=Tn,v=Ur,Tn=d.stateNode.containerInfo,Ur=!0,Hs(o,a,d),Tn=g,Ur=v;break;case 0:case 11:case 14:case 15:if(!Mn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){v=g=g.next;do{var S=v,A=S.destroy;S=S.tag,A!==void 0&&((S&2)!==0||(S&4)!==0)&&Ip(d,a,A),v=v.next}while(v!==g)}Hs(o,a,d);break;case 1:if(!Mn&&(Ai(d,a),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(B){en(d,a,B)}Hs(o,a,d);break;case 21:Hs(o,a,d);break;case 22:d.mode&1?(Mn=(g=Mn)||d.memoizedState!==null,Hs(o,a,d),Mn=g):Hs(o,a,d);break;default:Hs(o,a,d)}}function Rb(o){var a=o.updateQueue;if(a!==null){o.updateQueue=null;var d=o.stateNode;d===null&&(d=o.stateNode=new LE),a.forEach(function(g){var v=HE.bind(null,o,g);d.has(g)||(d.add(g),g.then(v,v))})}}function Vr(o,a){var d=a.deletions;if(d!==null)for(var g=0;g<d.length;g++){var v=d[g];try{var S=o,A=a,B=A;e:for(;B!==null;){switch(B.tag){case 5:Tn=B.stateNode,Ur=!1;break e;case 3:Tn=B.stateNode.containerInfo,Ur=!0;break e;case 4:Tn=B.stateNode.containerInfo,Ur=!0;break e}B=B.return}if(Tn===null)throw Error(n(160));Pb(S,A,v),Tn=null,Ur=!1;var K=v.alternate;K!==null&&(K.return=null),v.return=null}catch(de){en(v,a,de)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)Ab(a,o),a=a.sibling}function Ab(o,a){var d=o.alternate,g=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:if(Vr(a,o),rs(o),g&4){try{ll(3,o,o.return),su(3,o)}catch(qe){en(o,o.return,qe)}try{ll(5,o,o.return)}catch(qe){en(o,o.return,qe)}}break;case 1:Vr(a,o),rs(o),g&512&&d!==null&&Ai(d,d.return);break;case 5:if(Vr(a,o),rs(o),g&512&&d!==null&&Ai(d,d.return),o.flags&32){var v=o.stateNode;try{ye(v,"")}catch(qe){en(o,o.return,qe)}}if(g&4&&(v=o.stateNode,v!=null)){var S=o.memoizedProps,A=d!==null?d.memoizedProps:S,B=o.type,K=o.updateQueue;if(o.updateQueue=null,K!==null)try{B==="input"&&S.type==="radio"&&S.name!=null&&Ie(v,S),Me(B,A);var de=Me(B,S);for(A=0;A<K.length;A+=2){var je=K[A],Ne=K[A+1];je==="style"?be(v,Ne):je==="dangerouslySetInnerHTML"?Z(v,Ne):je==="children"?ye(v,Ne):N(v,je,Ne,de)}switch(B){case"input":Se(v,S);break;case"textarea":Pt(v,S);break;case"select":var we=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!S.multiple;var ze=S.value;ze!=null?nt(v,!!S.multiple,ze,!1):we!==!!S.multiple&&(S.defaultValue!=null?nt(v,!!S.multiple,S.defaultValue,!0):nt(v,!!S.multiple,S.multiple?[]:"",!1))}v[Xa]=S}catch(qe){en(o,o.return,qe)}}break;case 6:if(Vr(a,o),rs(o),g&4){if(o.stateNode===null)throw Error(n(162));v=o.stateNode,S=o.memoizedProps;try{v.nodeValue=S}catch(qe){en(o,o.return,qe)}}break;case 3:if(Vr(a,o),rs(o),g&4&&d!==null&&d.memoizedState.isDehydrated)try{za(a.containerInfo)}catch(qe){en(o,o.return,qe)}break;case 4:Vr(a,o),rs(o);break;case 13:Vr(a,o),rs(o),v=o.child,v.flags&8192&&(S=v.memoizedState!==null,v.stateNode.isHidden=S,!S||v.alternate!==null&&v.alternate.memoizedState!==null||(Up=Lt())),g&4&&Rb(o);break;case 22:if(je=d!==null&&d.memoizedState!==null,o.mode&1?(Mn=(de=Mn)||je,Vr(a,o),Mn=de):Vr(a,o),rs(o),g&8192){if(de=o.memoizedState!==null,(o.stateNode.isHidden=de)&&!je&&(o.mode&1)!==0)for(Ue=o,je=o.child;je!==null;){for(Ne=Ue=je;Ue!==null;){switch(we=Ue,ze=we.child,we.tag){case 0:case 11:case 14:case 15:ll(4,we,we.return);break;case 1:Ai(we,we.return);var Ve=we.stateNode;if(typeof Ve.componentWillUnmount=="function"){g=we,d=we.return;try{a=g,Ve.props=a.memoizedProps,Ve.state=a.memoizedState,Ve.componentWillUnmount()}catch(qe){en(g,d,qe)}}break;case 5:Ai(we,we.return);break;case 22:if(we.memoizedState!==null){Lb(Ne);continue}}ze!==null?(ze.return=we,Ue=ze):Lb(Ne)}je=je.sibling}e:for(je=null,Ne=o;;){if(Ne.tag===5){if(je===null){je=Ne;try{v=Ne.stateNode,de?(S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(B=Ne.stateNode,K=Ne.memoizedProps.style,A=K!=null&&K.hasOwnProperty("display")?K.display:null,B.style.display=te("display",A))}catch(qe){en(o,o.return,qe)}}}else if(Ne.tag===6){if(je===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(qe){en(o,o.return,qe)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===o)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===o)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===o)break e;je===Ne&&(je=null),Ne=Ne.return}je===Ne&&(je=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Vr(a,o),rs(o),g&4&&Rb(o);break;case 21:break;default:Vr(a,o),rs(o)}}function rs(o){var a=o.flags;if(a&2){try{e:{for(var d=o.return;d!==null;){if(Eb(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var v=g.stateNode;g.flags&32&&(ye(v,""),g.flags&=-33);var S=Tb(o);Fp(o,S,v);break;case 3:case 4:var A=g.stateNode.containerInfo,B=Tb(o);Mp(o,B,A);break;default:throw Error(n(161))}}catch(K){en(o,o.return,K)}o.flags&=-3}a&4096&&(o.flags&=-4097)}function IE(o,a,d){Ue=o,Db(o)}function Db(o,a,d){for(var g=(o.mode&1)!==0;Ue!==null;){var v=Ue,S=v.child;if(v.tag===22&&g){var A=v.memoizedState!==null||ru;if(!A){var B=v.alternate,K=B!==null&&B.memoizedState!==null||Mn;B=ru;var de=Mn;if(ru=A,(Mn=K)&&!de)for(Ue=v;Ue!==null;)A=Ue,K=A.child,A.tag===22&&A.memoizedState!==null?Ob(v):K!==null?(K.return=A,Ue=K):Ob(v);for(;S!==null;)Ue=S,Db(S),S=S.sibling;Ue=v,ru=B,Mn=de}$b(o)}else(v.subtreeFlags&8772)!==0&&S!==null?(S.return=v,Ue=S):$b(o)}}function $b(o){for(;Ue!==null;){var a=Ue;if((a.flags&8772)!==0){var d=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:Mn||su(5,a);break;case 1:var g=a.stateNode;if(a.flags&4&&!Mn)if(d===null)g.componentDidMount();else{var v=a.elementType===a.type?d.memoizedProps:Br(a.type,d.memoizedProps);g.componentDidUpdate(v,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var S=a.updateQueue;S!==null&&Ly(a,S,g);break;case 3:var A=a.updateQueue;if(A!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=a.child.stateNode;break;case 1:d=a.child.stateNode}Ly(a,A,d)}break;case 5:var B=a.stateNode;if(d===null&&a.flags&4){d=B;var K=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":K.autoFocus&&d.focus();break;case"img":K.src&&(d.src=K.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var de=a.alternate;if(de!==null){var je=de.memoizedState;if(je!==null){var Ne=je.dehydrated;Ne!==null&&za(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Mn||a.flags&512&&_p(a)}catch(we){en(a,a.return,we)}}if(a===o){Ue=null;break}if(d=a.sibling,d!==null){d.return=a.return,Ue=d;break}Ue=a.return}}function Lb(o){for(;Ue!==null;){var a=Ue;if(a===o){Ue=null;break}var d=a.sibling;if(d!==null){d.return=a.return,Ue=d;break}Ue=a.return}}function Ob(o){for(;Ue!==null;){var a=Ue;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{su(4,a)}catch(K){en(a,d,K)}break;case 1:var g=a.stateNode;if(typeof g.componentDidMount=="function"){var v=a.return;try{g.componentDidMount()}catch(K){en(a,v,K)}}var S=a.return;try{_p(a)}catch(K){en(a,S,K)}break;case 5:var A=a.return;try{_p(a)}catch(K){en(a,A,K)}}}catch(K){en(a,a.return,K)}if(a===o){Ue=null;break}var B=a.sibling;if(B!==null){B.return=a.return,Ue=B;break}Ue=a.return}}var _E=Math.ceil,ou=P.ReactCurrentDispatcher,zp=P.ReactCurrentOwner,Nr=P.ReactCurrentBatchConfig,vt=0,Nn=null,un=null,Pn=0,fr=0,Di=Fs(0),xn=0,cl=null,Ro=0,iu=0,Bp=0,ul=null,Qn=null,Up=0,$i=1/0,Ns=null,au=!1,Vp=null,Ws=null,lu=!1,Ks=null,cu=0,dl=0,Hp=null,uu=-1,du=0;function Hn(){return(vt&6)!==0?Lt():uu!==-1?uu:uu=Lt()}function qs(o){return(o.mode&1)===0?1:(vt&2)!==0&&Pn!==0?Pn&-Pn:vE.transition!==null?(du===0&&(du=bc()),du):(o=Et,o!==0||(o=window.event,o=o===void 0?16:_x(o.type)),o)}function Hr(o,a,d,g){if(50<dl)throw dl=0,Hp=null,Error(n(185));wo(o,d,g),((vt&2)===0||o!==Nn)&&(o===Nn&&((vt&2)===0&&(iu|=d),xn===4&&Gs(o,Pn)),Zn(o,g),d===1&&vt===0&&(a.mode&1)===0&&($i=Lt()+500,Fc&&Bs()))}function Zn(o,a){var d=o.callbackNode;Oa(o,a);var g=bo(o,o===Nn?Pn:0);if(g===0)d!==null&&go(d),o.callbackNode=null,o.callbackPriority=0;else if(a=g&-g,o.callbackPriority!==a){if(d!=null&&go(d),a===1)o.tag===0?bE(_b.bind(null,o)):jy(_b.bind(null,o)),hE(function(){(vt&6)===0&&Bs()}),d=null;else{switch(vc(g)){case 1:d=$a;break;case 4:d=xc;break;case 16:d=Bn;break;case 536870912:d=yc;break;default:d=Bn}d=Wb(d,Ib.bind(null,o))}o.callbackPriority=a,o.callbackNode=d}}function Ib(o,a){if(uu=-1,du=0,(vt&6)!==0)throw Error(n(327));var d=o.callbackNode;if(Li()&&o.callbackNode!==d)return null;var g=bo(o,o===Nn?Pn:0);if(g===0)return null;if((g&30)!==0||(g&o.expiredLanes)!==0||a)a=fu(o,g);else{a=g;var v=vt;vt|=2;var S=Fb();(Nn!==o||Pn!==a)&&(Ns=null,$i=Lt()+500,Do(o,a));do try{zE();break}catch(B){Mb(o,B)}while(!0);lp(),ou.current=S,vt=v,un!==null?a=0:(Nn=null,Pn=0,a=xn)}if(a!==0){if(a===2&&(v=Ia(o),v!==0&&(g=v,a=Wp(o,v))),a===1)throw d=cl,Do(o,0),Gs(o,g),Zn(o,Lt()),d;if(a===6)Gs(o,g);else{if(v=o.current.alternate,(g&30)===0&&!ME(v)&&(a=fu(o,g),a===2&&(S=Ia(o),S!==0&&(g=S,a=Wp(o,S))),a===1))throw d=cl,Do(o,0),Gs(o,g),Zn(o,Lt()),d;switch(o.finishedWork=v,o.finishedLanes=g,a){case 0:case 1:throw Error(n(345));case 2:$o(o,Qn,Ns);break;case 3:if(Gs(o,g),(g&130023424)===g&&(a=Up+500-Lt(),10<a)){if(bo(o,0)!==0)break;if(v=o.suspendedLanes,(v&g)!==g){Hn(),o.pingedLanes|=o.suspendedLanes&v;break}o.timeoutHandle=Xf($o.bind(null,o,Qn,Ns),a);break}$o(o,Qn,Ns);break;case 4:if(Gs(o,g),(g&4194240)===g)break;for(a=o.eventTimes,v=-1;0<g;){var A=31-jt(g);S=1<<A,A=a[A],A>v&&(v=A),g&=~S}if(g=v,g=Lt()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*_E(g/1960))-g,10<g){o.timeoutHandle=Xf($o.bind(null,o,Qn,Ns),g);break}$o(o,Qn,Ns);break;case 5:$o(o,Qn,Ns);break;default:throw Error(n(329))}}}return Zn(o,Lt()),o.callbackNode===d?Ib.bind(null,o):null}function Wp(o,a){var d=ul;return o.current.memoizedState.isDehydrated&&(Do(o,a).flags|=256),o=fu(o,a),o!==2&&(a=Qn,Qn=d,a!==null&&Kp(a)),o}function Kp(o){Qn===null?Qn=o:Qn.push.apply(Qn,o)}function ME(o){for(var a=o;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var v=d[g],S=v.getSnapshot;v=v.value;try{if(!Fr(S(),v))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Gs(o,a){for(a&=~Bp,a&=~iu,o.suspendedLanes|=a,o.pingedLanes&=~a,o=o.expirationTimes;0<a;){var d=31-jt(a),g=1<<d;o[d]=-1,a&=~g}}function _b(o){if((vt&6)!==0)throw Error(n(327));Li();var a=bo(o,0);if((a&1)===0)return Zn(o,Lt()),null;var d=fu(o,a);if(o.tag!==0&&d===2){var g=Ia(o);g!==0&&(a=g,d=Wp(o,g))}if(d===1)throw d=cl,Do(o,0),Gs(o,a),Zn(o,Lt()),d;if(d===6)throw Error(n(345));return o.finishedWork=o.current.alternate,o.finishedLanes=a,$o(o,Qn,Ns),Zn(o,Lt()),null}function qp(o,a){var d=vt;vt|=1;try{return o(a)}finally{vt=d,vt===0&&($i=Lt()+500,Fc&&Bs())}}function Ao(o){Ks!==null&&Ks.tag===0&&(vt&6)===0&&Li();var a=vt;vt|=1;var d=Nr.transition,g=Et;try{if(Nr.transition=null,Et=1,o)return o()}finally{Et=g,Nr.transition=d,vt=a,(vt&6)===0&&Bs()}}function Gp(){fr=Di.current,Bt(Di)}function Do(o,a){o.finishedWork=null,o.finishedLanes=0;var d=o.timeoutHandle;if(d!==-1&&(o.timeoutHandle=-1,mE(d)),un!==null)for(d=un.return;d!==null;){var g=d;switch(rp(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&_c();break;case 3:Pi(),Bt(Yn),Bt(On),gp();break;case 5:mp(g);break;case 4:Pi();break;case 13:Bt(Jt);break;case 19:Bt(Jt);break;case 10:cp(g.type._context);break;case 22:case 23:Gp()}d=d.return}if(Nn=o,un=o=Ys(o.current,null),Pn=fr=a,xn=0,cl=null,Bp=iu=Ro=0,Qn=ul=null,Eo!==null){for(a=0;a<Eo.length;a++)if(d=Eo[a],g=d.interleaved,g!==null){d.interleaved=null;var v=g.next,S=d.pending;if(S!==null){var A=S.next;S.next=v,g.next=A}d.pending=g}Eo=null}return o}function Mb(o,a){do{var d=un;try{if(lp(),Yc.current=Zc,Jc){for(var g=Xt.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Jc=!1}if(Po=0,Sn=gn=Xt=null,rl=!1,sl=0,zp.current=null,d===null||d.return===null){xn=1,cl=a,un=null;break}e:{var S=o,A=d.return,B=d,K=a;if(a=Pn,B.flags|=32768,K!==null&&typeof K=="object"&&typeof K.then=="function"){var de=K,je=B,Ne=je.tag;if((je.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var we=je.alternate;we?(je.updateQueue=we.updateQueue,je.memoizedState=we.memoizedState,je.lanes=we.lanes):(je.updateQueue=null,je.memoizedState=null)}var ze=cb(A);if(ze!==null){ze.flags&=-257,ub(ze,A,B,S,a),ze.mode&1&&lb(S,de,a),a=ze,K=de;var Ve=a.updateQueue;if(Ve===null){var qe=new Set;qe.add(K),a.updateQueue=qe}else Ve.add(K);break e}else{if((a&1)===0){lb(S,de,a),Yp();break e}K=Error(n(426))}}else if(Kt&&B.mode&1){var an=cb(A);if(an!==null){(an.flags&65536)===0&&(an.flags|=256),ub(an,A,B,S,a),ip(Ri(K,B));break e}}S=K=Ri(K,B),xn!==4&&(xn=2),ul===null?ul=[S]:ul.push(S),S=A;do{switch(S.tag){case 3:S.flags|=65536,a&=-a,S.lanes|=a;var se=ib(S,K,a);$y(S,se);break e;case 1:B=K;var J=S.type,le=S.stateNode;if((S.flags&128)===0&&(typeof J.getDerivedStateFromError=="function"||le!==null&&typeof le.componentDidCatch=="function"&&(Ws===null||!Ws.has(le)))){S.flags|=65536,a&=-a,S.lanes|=a;var Pe=ab(S,B,a);$y(S,Pe);break e}}S=S.return}while(S!==null)}Bb(d)}catch(Ge){a=Ge,un===d&&d!==null&&(un=d=d.return);continue}break}while(!0)}function Fb(){var o=ou.current;return ou.current=Zc,o===null?Zc:o}function Yp(){(xn===0||xn===3||xn===2)&&(xn=4),Nn===null||(Ro&268435455)===0&&(iu&268435455)===0||Gs(Nn,Pn)}function fu(o,a){var d=vt;vt|=2;var g=Fb();(Nn!==o||Pn!==a)&&(Ns=null,Do(o,a));do try{FE();break}catch(v){Mb(o,v)}while(!0);if(lp(),vt=d,ou.current=g,un!==null)throw Error(n(261));return Nn=null,Pn=0,xn}function FE(){for(;un!==null;)zb(un)}function zE(){for(;un!==null&&!Sf();)zb(un)}function zb(o){var a=Hb(o.alternate,o,fr);o.memoizedProps=o.pendingProps,a===null?Bb(o):un=a,zp.current=null}function Bb(o){var a=o;do{var d=a.alternate;if(o=a.return,(a.flags&32768)===0){if(d=DE(d,a,fr),d!==null){un=d;return}}else{if(d=$E(d,a),d!==null){d.flags&=32767,un=d;return}if(o!==null)o.flags|=32768,o.subtreeFlags=0,o.deletions=null;else{xn=6,un=null;return}}if(a=a.sibling,a!==null){un=a;return}un=a=o}while(a!==null);xn===0&&(xn=5)}function $o(o,a,d){var g=Et,v=Nr.transition;try{Nr.transition=null,Et=1,BE(o,a,d,g)}finally{Nr.transition=v,Et=g}return null}function BE(o,a,d,g){do Li();while(Ks!==null);if((vt&6)!==0)throw Error(n(327));d=o.finishedWork;var v=o.finishedLanes;if(d===null)return null;if(o.finishedWork=null,o.finishedLanes=0,d===o.current)throw Error(n(177));o.callbackNode=null,o.callbackPriority=0;var S=d.lanes|d.childLanes;if(_a(o,S),o===Nn&&(un=Nn=null,Pn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||lu||(lu=!0,Wb(Bn,function(){return Li(),null})),S=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||S){S=Nr.transition,Nr.transition=null;var A=Et;Et=1;var B=vt;vt|=4,zp.current=null,OE(o,d),Ab(d,o),aE(Yf),kc=!!Gf,Yf=Gf=null,o.current=d,IE(d),ui(),vt=B,Et=A,Nr.transition=S}else o.current=d;if(lu&&(lu=!1,Ks=o,cu=v),S=o.pendingLanes,S===0&&(Ws=null),Ef(d.stateNode),Zn(o,Lt()),a!==null)for(g=o.onRecoverableError,d=0;d<a.length;d++)v=a[d],g(v.value,{componentStack:v.stack,digest:v.digest});if(au)throw au=!1,o=Vp,Vp=null,o;return(cu&1)!==0&&o.tag!==0&&Li(),S=o.pendingLanes,(S&1)!==0?o===Hp?dl++:(dl=0,Hp=o):dl=0,Bs(),null}function Li(){if(Ks!==null){var o=vc(cu),a=Nr.transition,d=Et;try{if(Nr.transition=null,Et=16>o?16:o,Ks===null)var g=!1;else{if(o=Ks,Ks=null,cu=0,(vt&6)!==0)throw Error(n(331));var v=vt;for(vt|=4,Ue=o.current;Ue!==null;){var S=Ue,A=S.child;if((Ue.flags&16)!==0){var B=S.deletions;if(B!==null){for(var K=0;K<B.length;K++){var de=B[K];for(Ue=de;Ue!==null;){var je=Ue;switch(je.tag){case 0:case 11:case 15:ll(8,je,S)}var Ne=je.child;if(Ne!==null)Ne.return=je,Ue=Ne;else for(;Ue!==null;){je=Ue;var we=je.sibling,ze=je.return;if(Cb(je),je===de){Ue=null;break}if(we!==null){we.return=ze,Ue=we;break}Ue=ze}}}var Ve=S.alternate;if(Ve!==null){var qe=Ve.child;if(qe!==null){Ve.child=null;do{var an=qe.sibling;qe.sibling=null,qe=an}while(qe!==null)}}Ue=S}}if((S.subtreeFlags&2064)!==0&&A!==null)A.return=S,Ue=A;else e:for(;Ue!==null;){if(S=Ue,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:ll(9,S,S.return)}var se=S.sibling;if(se!==null){se.return=S.return,Ue=se;break e}Ue=S.return}}var J=o.current;for(Ue=J;Ue!==null;){A=Ue;var le=A.child;if((A.subtreeFlags&2064)!==0&&le!==null)le.return=A,Ue=le;else e:for(A=J;Ue!==null;){if(B=Ue,(B.flags&2048)!==0)try{switch(B.tag){case 0:case 11:case 15:su(9,B)}}catch(Ge){en(B,B.return,Ge)}if(B===A){Ue=null;break e}var Pe=B.sibling;if(Pe!==null){Pe.return=B.return,Ue=Pe;break e}Ue=B.return}}if(vt=v,Bs(),br&&typeof br.onPostCommitFiberRoot=="function")try{br.onPostCommitFiberRoot(di,o)}catch{}g=!0}return g}finally{Et=d,Nr.transition=a}}return!1}function Ub(o,a,d){a=Ri(d,a),a=ib(o,a,1),o=Vs(o,a,1),a=Hn(),o!==null&&(wo(o,1,a),Zn(o,a))}function en(o,a,d){if(o.tag===3)Ub(o,o,d);else for(;a!==null;){if(a.tag===3){Ub(a,o,d);break}else if(a.tag===1){var g=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Ws===null||!Ws.has(g))){o=Ri(d,o),o=ab(a,o,1),a=Vs(a,o,1),o=Hn(),a!==null&&(wo(a,1,o),Zn(a,o));break}}a=a.return}}function UE(o,a,d){var g=o.pingCache;g!==null&&g.delete(a),a=Hn(),o.pingedLanes|=o.suspendedLanes&d,Nn===o&&(Pn&d)===d&&(xn===4||xn===3&&(Pn&130023424)===Pn&&500>Lt()-Up?Do(o,0):Bp|=d),Zn(o,a)}function Vb(o,a){a===0&&((o.mode&1)===0?a=1:(a=yo,yo<<=1,(yo&130023424)===0&&(yo=4194304)));var d=Hn();o=js(o,a),o!==null&&(wo(o,a,d),Zn(o,d))}function VE(o){var a=o.memoizedState,d=0;a!==null&&(d=a.retryLane),Vb(o,d)}function HE(o,a){var d=0;switch(o.tag){case 13:var g=o.stateNode,v=o.memoizedState;v!==null&&(d=v.retryLane);break;case 19:g=o.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(a),Vb(o,d)}var Hb;Hb=function(o,a,d){if(o!==null)if(o.memoizedProps!==a.pendingProps||Yn.current)Xn=!0;else{if((o.lanes&d)===0&&(a.flags&128)===0)return Xn=!1,AE(o,a,d);Xn=(o.flags&131072)!==0}else Xn=!1,Kt&&(a.flags&1048576)!==0&&ky(a,Bc,a.index);switch(a.lanes=0,a.tag){case 2:var g=a.type;nu(o,a),o=a.pendingProps;var v=ji(a,On.current);Ti(a,d),v=bp(null,a,g,o,v,d);var S=vp();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Jn(g)?(S=!0,Mc(a)):S=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,fp(a),v.updater=eu,a.stateNode=v,v._reactInternals=a,Cp(a,g,o,d),a=Rp(null,a,g,!0,S,d)):(a.tag=0,Kt&&S&&np(a),Vn(null,a,v,d),a=a.child),a;case 16:g=a.elementType;e:{switch(nu(o,a),o=a.pendingProps,v=g._init,g=v(g._payload),a.type=g,v=a.tag=KE(g),o=Br(g,o),v){case 0:a=Pp(null,a,g,o,d);break e;case 1:a=gb(null,a,g,o,d);break e;case 11:a=db(null,a,g,o,d);break e;case 14:a=fb(null,a,g,Br(g.type,o),d);break e}throw Error(n(306,g,""))}return a;case 0:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Br(g,v),Pp(o,a,g,v,d);case 1:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Br(g,v),gb(o,a,g,v,d);case 3:e:{if(xb(a),o===null)throw Error(n(387));g=a.pendingProps,S=a.memoizedState,v=S.element,Dy(o,a),qc(a,g,null,d);var A=a.memoizedState;if(g=A.element,S.isDehydrated)if(S={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},a.updateQueue.baseState=S,a.memoizedState=S,a.flags&256){v=Ri(Error(n(423)),a),a=yb(o,a,g,d,v);break e}else if(g!==v){v=Ri(Error(n(424)),a),a=yb(o,a,g,d,v);break e}else for(dr=Ms(a.stateNode.containerInfo.firstChild),ur=a,Kt=!0,zr=null,d=Ry(a,null,g,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Ni(),g===v){a=Ss(o,a,d);break e}Vn(o,a,g,d)}a=a.child}return a;case 5:return Oy(a),o===null&&op(a),g=a.type,v=a.pendingProps,S=o!==null?o.memoizedProps:null,A=v.children,Jf(g,v)?A=null:S!==null&&Jf(g,S)&&(a.flags|=32),hb(o,a),Vn(o,a,A,d),a.child;case 6:return o===null&&op(a),null;case 13:return bb(o,a,d);case 4:return pp(a,a.stateNode.containerInfo),g=a.pendingProps,o===null?a.child=Ci(a,null,g,d):Vn(o,a,g,d),a.child;case 11:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Br(g,v),db(o,a,g,v,d);case 7:return Vn(o,a,a.pendingProps,d),a.child;case 8:return Vn(o,a,a.pendingProps.children,d),a.child;case 12:return Vn(o,a,a.pendingProps.children,d),a.child;case 10:e:{if(g=a.type._context,v=a.pendingProps,S=a.memoizedProps,A=v.value,Ot(Hc,g._currentValue),g._currentValue=A,S!==null)if(Fr(S.value,A)){if(S.children===v.children&&!Yn.current){a=Ss(o,a,d);break e}}else for(S=a.child,S!==null&&(S.return=a);S!==null;){var B=S.dependencies;if(B!==null){A=S.child;for(var K=B.firstContext;K!==null;){if(K.context===g){if(S.tag===1){K=ks(-1,d&-d),K.tag=2;var de=S.updateQueue;if(de!==null){de=de.shared;var je=de.pending;je===null?K.next=K:(K.next=je.next,je.next=K),de.pending=K}}S.lanes|=d,K=S.alternate,K!==null&&(K.lanes|=d),up(S.return,d,a),B.lanes|=d;break}K=K.next}}else if(S.tag===10)A=S.type===a.type?null:S.child;else if(S.tag===18){if(A=S.return,A===null)throw Error(n(341));A.lanes|=d,B=A.alternate,B!==null&&(B.lanes|=d),up(A,d,a),A=S.sibling}else A=S.child;if(A!==null)A.return=S;else for(A=S;A!==null;){if(A===a){A=null;break}if(S=A.sibling,S!==null){S.return=A.return,A=S;break}A=A.return}S=A}Vn(o,a,v.children,d),a=a.child}return a;case 9:return v=a.type,g=a.pendingProps.children,Ti(a,d),v=kr(v),g=g(v),a.flags|=1,Vn(o,a,g,d),a.child;case 14:return g=a.type,v=Br(g,a.pendingProps),v=Br(g.type,v),fb(o,a,g,v,d);case 15:return pb(o,a,a.type,a.pendingProps,d);case 17:return g=a.type,v=a.pendingProps,v=a.elementType===g?v:Br(g,v),nu(o,a),a.tag=1,Jn(g)?(o=!0,Mc(a)):o=!1,Ti(a,d),sb(a,g,v),Cp(a,g,v,d),Rp(null,a,g,!0,o,d);case 19:return wb(o,a,d);case 22:return mb(o,a,d)}throw Error(n(156,a.tag))};function Wb(o,a){return ci(o,a)}function WE(o,a,d,g){this.tag=o,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cr(o,a,d,g){return new WE(o,a,d,g)}function Jp(o){return o=o.prototype,!(!o||!o.isReactComponent)}function KE(o){if(typeof o=="function")return Jp(o)?1:0;if(o!=null){if(o=o.$$typeof,o===U)return 11;if(o===H)return 14}return 2}function Ys(o,a){var d=o.alternate;return d===null?(d=Cr(o.tag,a,o.key,o.mode),d.elementType=o.elementType,d.type=o.type,d.stateNode=o.stateNode,d.alternate=o,o.alternate=d):(d.pendingProps=a,d.type=o.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=o.flags&14680064,d.childLanes=o.childLanes,d.lanes=o.lanes,d.child=o.child,d.memoizedProps=o.memoizedProps,d.memoizedState=o.memoizedState,d.updateQueue=o.updateQueue,a=o.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=o.sibling,d.index=o.index,d.ref=o.ref,d}function pu(o,a,d,g,v,S){var A=2;if(g=o,typeof o=="function")Jp(o)&&(A=1);else if(typeof o=="string")A=5;else e:switch(o){case D:return Lo(d.children,v,S,a);case L:A=8,v|=8;break;case Y:return o=Cr(12,d,a,v|2),o.elementType=Y,o.lanes=S,o;case ne:return o=Cr(13,d,a,v),o.elementType=ne,o.lanes=S,o;case F:return o=Cr(19,d,a,v),o.elementType=F,o.lanes=S,o;case ce:return mu(d,v,S,a);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case X:A=10;break e;case I:A=9;break e;case U:A=11;break e;case H:A=14;break e;case ee:A=16,g=null;break e}throw Error(n(130,o==null?o:typeof o,""))}return a=Cr(A,d,a,v),a.elementType=o,a.type=g,a.lanes=S,a}function Lo(o,a,d,g){return o=Cr(7,o,g,a),o.lanes=d,o}function mu(o,a,d,g){return o=Cr(22,o,g,a),o.elementType=ce,o.lanes=d,o.stateNode={isHidden:!1},o}function Xp(o,a,d){return o=Cr(6,o,null,a),o.lanes=d,o}function Qp(o,a,d){return a=Cr(4,o.children!==null?o.children:[],o.key,a),a.lanes=d,a.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},a}function qE(o,a,d,g,v){this.tag=a,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ln(0),this.expirationTimes=Ln(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ln(0),this.identifierPrefix=g,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Zp(o,a,d,g,v,S,A,B,K){return o=new qE(o,a,d,B,K),a===1?(a=1,S===!0&&(a|=8)):a=0,S=Cr(3,null,null,a),o.current=S,S.stateNode=o,S.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},fp(S),o}function GE(o,a,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:g==null?null:""+g,children:o,containerInfo:a,implementation:d}}function Kb(o){if(!o)return zs;o=o._reactInternals;e:{if(_r(o)!==o||o.tag!==1)throw Error(n(170));var a=o;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Jn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(o.tag===1){var d=o.type;if(Jn(d))return vy(o,d,a)}return a}function qb(o,a,d,g,v,S,A,B,K){return o=Zp(d,g,!0,o,v,S,A,B,K),o.context=Kb(null),d=o.current,g=Hn(),v=qs(d),S=ks(g,v),S.callback=a??null,Vs(d,S,v),o.current.lanes=v,wo(o,v,g),Zn(o,g),o}function hu(o,a,d,g){var v=a.current,S=Hn(),A=qs(v);return d=Kb(d),a.context===null?a.context=d:a.pendingContext=d,a=ks(S,A),a.payload={element:o},g=g===void 0?null:g,g!==null&&(a.callback=g),o=Vs(v,a,A),o!==null&&(Hr(o,v,A,S),Kc(o,v,A)),A}function gu(o){if(o=o.current,!o.child)return null;switch(o.child.tag){case 5:return o.child.stateNode;default:return o.child.stateNode}}function Gb(o,a){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var d=o.retryLane;o.retryLane=d!==0&&d<a?d:a}}function em(o,a){Gb(o,a),(o=o.alternate)&&Gb(o,a)}function YE(){return null}var Yb=typeof reportError=="function"?reportError:function(o){console.error(o)};function tm(o){this._internalRoot=o}xu.prototype.render=tm.prototype.render=function(o){var a=this._internalRoot;if(a===null)throw Error(n(409));hu(o,a,null,null)},xu.prototype.unmount=tm.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var a=o.containerInfo;Ao(function(){hu(null,o,null,null)}),a[ys]=null}};function xu(o){this._internalRoot=o}xu.prototype.unstable_scheduleHydration=function(o){if(o){var a=xe();o={blockedOn:null,target:o,priority:a};for(var d=0;d<Mr.length&&a!==0&&a<Mr[d].priority;d++);Mr.splice(d,0,o),d===0&&Ox(o)}};function nm(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function yu(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11&&(o.nodeType!==8||o.nodeValue!==" react-mount-point-unstable "))}function Jb(){}function JE(o,a,d,g,v){if(v){if(typeof g=="function"){var S=g;g=function(){var de=gu(A);S.call(de)}}var A=qb(a,g,o,0,null,!1,!1,"",Jb);return o._reactRootContainer=A,o[ys]=A.current,Ya(o.nodeType===8?o.parentNode:o),Ao(),A}for(;v=o.lastChild;)o.removeChild(v);if(typeof g=="function"){var B=g;g=function(){var de=gu(K);B.call(de)}}var K=Zp(o,0,!1,null,null,!1,!1,"",Jb);return o._reactRootContainer=K,o[ys]=K.current,Ya(o.nodeType===8?o.parentNode:o),Ao(function(){hu(a,K,d,g)}),K}function bu(o,a,d,g,v){var S=d._reactRootContainer;if(S){var A=S;if(typeof v=="function"){var B=v;v=function(){var K=gu(A);B.call(K)}}hu(a,A,o,v)}else A=JE(d,a,o,v,g);return gu(A)}Zr=function(o){switch(o.tag){case 3:var a=o.stateNode;if(a.current.memoizedState.isDehydrated){var d=xs(a.pendingLanes);d!==0&&(Ma(a,d|1),Zn(a,Lt()),(vt&6)===0&&($i=Lt()+500,Bs()))}break;case 13:Ao(function(){var g=js(o,1);if(g!==null){var v=Hn();Hr(g,o,1,v)}}),em(o,1)}},z=function(o){if(o.tag===13){var a=js(o,134217728);if(a!==null){var d=Hn();Hr(a,o,134217728,d)}em(o,134217728)}},ae=function(o){if(o.tag===13){var a=qs(o),d=js(o,a);if(d!==null){var g=Hn();Hr(d,o,a,g)}em(o,a)}},xe=function(){return Et},De=function(o,a){var d=Et;try{return Et=o,a()}finally{Et=d}},Gt=function(o,a,d){switch(a){case"input":if(Se(o,d),a=d.name,d.type==="radio"&&a!=null){for(d=o;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<d.length;a++){var g=d[a];if(g!==o&&g.form===o.form){var v=Ic(g);if(!v)throw Error(n(90));Je(g),Se(g,v)}}}break;case"textarea":Pt(o,d);break;case"select":a=d.value,a!=null&&nt(o,!!d.multiple,a,!1)}},Yt=qp,sn=Ao;var XE={usingClientEntryPoint:!1,Events:[Qa,vi,Ic,Nt,$n,qp]},fl={findFiberByHostInstance:ko,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},QE={bundleType:fl.bundleType,version:fl.version,rendererPackageName:fl.rendererPackageName,rendererConfig:fl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:P.ReactCurrentDispatcher,findHostInstanceByFiber:function(o){return o=ai(o),o===null?null:o.stateNode},findFiberByHostInstance:fl.findFiberByHostInstance||YE,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 vu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vu.isDisabled&&vu.supportsFiber)try{di=vu.inject(QE),br=vu}catch{}}return er.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=XE,er.createPortal=function(o,a){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nm(a))throw Error(n(200));return GE(o,a,null,d)},er.createRoot=function(o,a){if(!nm(o))throw Error(n(299));var d=!1,g="",v=Yb;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(v=a.onRecoverableError)),a=Zp(o,1,!1,null,null,d,!1,g,v),o[ys]=a.current,Ya(o.nodeType===8?o.parentNode:o),new tm(a)},er.findDOMNode=function(o){if(o==null)return null;if(o.nodeType===1)return o;var a=o._reactInternals;if(a===void 0)throw typeof o.render=="function"?Error(n(188)):(o=Object.keys(o).join(","),Error(n(268,o)));return o=ai(a),o=o===null?null:o.stateNode,o},er.flushSync=function(o){return Ao(o)},er.hydrate=function(o,a,d){if(!yu(a))throw Error(n(200));return bu(null,o,a,!0,d)},er.hydrateRoot=function(o,a,d){if(!nm(o))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,v=!1,S="",A=Yb;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),a=qb(a,null,o,1,d??null,v,!1,S,A),o[ys]=a.current,Ya(o),g)for(o=0;o<g.length;o++)d=g[o],v=d._getVersion,v=v(d._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[d,v]:a.mutableSourceEagerHydrationData.push(d,v);return new xu(a)},er.render=function(o,a,d){if(!yu(a))throw Error(n(200));return bu(null,o,a,!1,d)},er.unmountComponentAtNode=function(o){if(!yu(o))throw Error(n(40));return o._reactRootContainer?(Ao(function(){bu(null,null,o,!1,function(){o._reactRootContainer=null,o[ys]=null})}),!0):!1},er.unstable_batchedUpdates=qp,er.unstable_renderSubtreeIntoContainer=function(o,a,d,g){if(!yu(d))throw Error(n(200));if(o==null||o._reactInternals===void 0)throw Error(n(38));return bu(o,a,d,!1,g)},er.version="18.3.1-next-f1338f8080-20240426",er}var ov;function Fj(){if(ov)return om.exports;ov=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(),om.exports=l2(),om.exports}var iv;function c2(){if(iv)return wu;iv=1;var e=Fj();return wu.createRoot=e.createRoot,wu.hydrateRoot=e.hydrateRoot,wu}var u2=c2();/**
|
|
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 av="popstate";function lv(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function d2(e={}){function t(s,i){var m;let l=(m=i.state)==null?void 0:m.masked,{pathname:c,search:u,hash:p}=l||s.location;return ih("",{pathname:c,search:u,hash:p},i.state&&i.state.usr||null,i.state&&i.state.key||"default",l?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,i){return typeof i=="string"?i:zl(i)}return p2(t,n,null,e)}function Qt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Wr(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function f2(){return Math.random().toString(36).substring(2,10)}function cv(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 ih(e,t,n=null,s,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ga(t):t,state:n,key:t&&t.key||s||f2(),unstable_mask:i}}function zl({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 ga(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 p2(e,t,n,s={}){let{window:i=document.defaultView,v5Compat:l=!1}=s,c=i.history,u="POP",p=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function x(){u="POP";let w=h(),k=w==null?null:w-m;m=w,p&&p({action:u,location:j.location,delta:k})}function y(w,k){u="PUSH";let E=lv(w)?w:ih(j.location,w,k);m=h()+1;let N=cv(E,m),P=j.createHref(E.unstable_mask||E);try{c.pushState(N,"",P)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;i.location.assign(P)}l&&p&&p({action:u,location:j.location,delta:1})}function b(w,k){u="REPLACE";let E=lv(w)?w:ih(j.location,w,k);m=h();let N=cv(E,m),P=j.createHref(E.unstable_mask||E);c.replaceState(N,"",P),l&&p&&p({action:u,location:j.location,delta:0})}function C(w){return m2(w)}let j={get action(){return u},get location(){return e(i,c)},listen(w){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(av,x),p=w,()=>{i.removeEventListener(av,x),p=null}},createHref(w){return t(i,w)},createURL:C,encodeLocation(w){let k=C(w);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(w){return c.go(w)}};return j}function m2(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Qt(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:zl(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function zj(e,t,n="/"){return h2(e,t,n,!1)}function h2(e,t,n,s){let i=typeof t=="string"?ga(t):t,l=Rs(i.pathname||"/",n);if(l==null)return null;let c=Bj(e);g2(c);let u=null;for(let p=0;u==null&&p<c.length;++p){let m=E2(l);u=N2(c[p],m,s)}return u}function Bj(e,t=[],n=[],s="",i=!1){let l=(c,u,p=i,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)&&p)return;Qt(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 x=cs([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(Qt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),Bj(c.children,t,y,x,p)),!(c.path==null&&!c.index)&&t.push({path:x,score:k2(x,c.index),routesMeta:y})};return e.forEach((c,u)=>{var p;if(c.path===""||!((p=c.path)!=null&&p.includes("?")))l(c,u);else for(let m of Uj(c.path))l(c,u,!0,m)}),t}function Uj(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,i=n.endsWith("?"),l=n.replace(/\?$/,"");if(s.length===0)return i?[l,""]:[l];let c=Uj(s.join("/")),u=[];return u.push(...c.map(p=>p===""?l:[l,p].join("/"))),i&&u.push(...c),u.map(p=>e.startsWith("/")&&p===""?"/":p)}function g2(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:S2(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var x2=/^:[\w-]+$/,y2=3,b2=2,v2=1,w2=10,j2=-2,uv=e=>e==="*";function k2(e,t){let n=e.split("/"),s=n.length;return n.some(uv)&&(s+=j2),t&&(s+=b2),n.filter(i=>!uv(i)).reduce((i,l)=>i+(x2.test(l)?y2:l===""?v2:w2),s)}function S2(e,t){return e.length===t.length&&e.slice(0,-1).every((s,i)=>s===t[i])?e[e.length-1]-t[t.length-1]:0}function N2(e,t,n=!1){let{routesMeta:s}=e,i={},l="/",c=[];for(let u=0;u<s.length;++u){let p=s[u],m=u===s.length-1,h=l==="/"?t:t.slice(l.length)||"/",x=Zu({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!x&&m&&n&&!s[s.length-1].route.index&&(x=Zu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!x)return null;Object.assign(i,x.params),c.push({params:i,pathname:cs([l,x.pathname]),pathnameBase:A2(cs([l,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(l=cs([l,x.pathnameBase]))}return c}function Zu(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=C2(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let l=i[0],c=l.replace(/(.)\/+$/,"$1"),u=i.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:x},y)=>{if(h==="*"){let C=u[y]||"";c=l.slice(0,l.length-C.length).replace(/(.)\/+$/,"$1")}const b=u[y];return x&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:l,pathnameBase:c,pattern:e}}function C2(e,t=!1,n=!0){Wr(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,p,m,h)=>{if(s.push({paramName:u,isOptional:p!=null}),p){let x=h.charAt(m+c.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),s]}function E2(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Wr(!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 Rs(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 T2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function P2(e,t="/"){let{pathname:n,search:s="",hash:i=""}=typeof e=="string"?ga(e):e,l;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?l=dv(n.substring(1),"/"):l=dv(n,t)):l=t,{pathname:l,search:D2(s),hash:$2(i)}}function dv(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function lm(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 R2(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Vj(e){let t=R2(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Gh(e,t,n,s=!1){let i;typeof e=="string"?i=ga(e):(i={...e},Qt(!i.pathname||!i.pathname.includes("?"),lm("?","pathname","search",i)),Qt(!i.pathname||!i.pathname.includes("#"),lm("#","pathname","hash",i)),Qt(!i.search||!i.search.includes("#"),lm("#","search","hash",i)));let l=e===""||i.pathname==="",c=l?"/":i.pathname,u;if(c==null)u=n;else{let x=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),x-=1;i.pathname=y.join("/")}u=x>=0?t[x]:"/"}let p=P2(i,u),m=c&&c!=="/"&&c.endsWith("/"),h=(l||c===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var cs=e=>e.join("/").replace(/\/\/+/g,"/"),A2=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),D2=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$2=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,L2=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 O2(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function I2(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Hj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wj(e,t){let n=e;if(typeof n!="string"||!T2.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,i=!1;if(Hj)try{let l=new URL(window.location.href),c=n.startsWith("//")?new URL(l.protocol+n):new URL(n),u=Rs(c.pathname,t);c.origin===l.origin&&u!=null?n=u+c.search+c.hash:i=!0}catch{Wr(!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:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Kj=["POST","PUT","PATCH","DELETE"];new Set(Kj);var _2=["GET",...Kj];new Set(_2);var xa=f.createContext(null);xa.displayName="DataRouter";var Pd=f.createContext(null);Pd.displayName="DataRouterState";var M2=f.createContext(!1),qj=f.createContext({isTransitioning:!1});qj.displayName="ViewTransition";var F2=f.createContext(new Map);F2.displayName="Fetchers";var z2=f.createContext(null);z2.displayName="Await";var Lr=f.createContext(null);Lr.displayName="Navigation";var tc=f.createContext(null);tc.displayName="Location";var Jr=f.createContext({outlet:null,matches:[],isDataRoute:!1});Jr.displayName="Route";var Yh=f.createContext(null);Yh.displayName="RouteError";var Gj="REACT_ROUTER_ERROR",B2="REDIRECT",U2="ROUTE_ERROR_RESPONSE";function V2(e){if(e.startsWith(`${Gj}:${B2}:{`))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 H2(e){if(e.startsWith(`${Gj}:${U2}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new L2(t.status,t.statusText,t.data)}catch{}}function W2(e,{relative:t}={}){Qt(nc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Lr),{hash:i,pathname:l,search:c}=rc(e,{relative:t}),u=l;return n!=="/"&&(u=l==="/"?n:cs([n,l])),s.createHref({pathname:u,search:c,hash:i})}function nc(){return f.useContext(tc)!=null}function Wn(){return Qt(nc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(tc).location}var Yj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jj(e){f.useContext(Lr).static||f.useLayoutEffect(e)}function Dt(){let{isDataRoute:e}=f.useContext(Jr);return e?iT():K2()}function K2(){Qt(nc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(xa),{basename:t,navigator:n}=f.useContext(Lr),{matches:s}=f.useContext(Jr),{pathname:i}=Wn(),l=JSON.stringify(Vj(s)),c=f.useRef(!1);return Jj(()=>{c.current=!0}),f.useCallback((p,m={})=>{if(Wr(c.current,Yj),!c.current)return;if(typeof p=="number"){n.go(p);return}let h=Gh(p,JSON.parse(l),i,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:cs([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,l,i,e])}var q2=f.createContext(null);function G2(e){let t=f.useContext(Jr).outlet;return f.useMemo(()=>t&&f.createElement(q2.Provider,{value:e},t),[t,e])}function $t(){let{matches:e}=f.useContext(Jr),t=e[e.length-1];return t?t.params:{}}function rc(e,{relative:t}={}){let{matches:n}=f.useContext(Jr),{pathname:s}=Wn(),i=JSON.stringify(Vj(n));return f.useMemo(()=>Gh(e,JSON.parse(i),s,t==="path"),[e,i,s,t])}function Y2(e,t){return Xj(e,t)}function Xj(e,t,n){var w;Qt(nc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Lr),{matches:i}=f.useContext(Jr),l=i[i.length-1],c=l?l.params:{},u=l?l.pathname:"/",p=l?l.pathnameBase:"/",m=l&&l.route;{let k=m&&m.path||"";Zj(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=Wn(),x;if(t){let k=typeof t=="string"?ga(t):t;Qt(p==="/"||((w=k.pathname)==null?void 0:w.startsWith(p)),`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 "${p}" but pathname "${k.pathname}" was given in the \`location\` prop.`),x=k}else x=h;let y=x.pathname||"/",b=y;if(p!=="/"){let k=p.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=zj(e,{pathname:b});Wr(m||C!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Wr(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 "${x.pathname}${x.search}${x.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=eT(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:cs([p,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?p:cs([p,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),i,n);return t&&j?f.createElement(tc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...x},navigationType:"POP"}},j):j}function J2(){let e=oT(),t=O2(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)",i={padding:"0.5rem",backgroundColor:s},l={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=f.createElement(f.Fragment,null,f.createElement("p",null,"💿 Hey developer 👋"),f.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",f.createElement("code",{style:l},"ErrorBoundary")," or"," ",f.createElement("code",{style:l},"errorElement")," prop on your route.")),f.createElement(f.Fragment,null,f.createElement("h2",null,"Unexpected Application Error!"),f.createElement("h3",{style:{fontStyle:"italic"}},t),n?f.createElement("pre",{style:i},n):null,c)}var X2=f.createElement(J2,null),Qj=class extends f.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=H2(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(Jr.Provider,{value:this.props.routeContext},f.createElement(Yh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(Q2,{error:e},t):t}};Qj.contextType=M2;var cm=new WeakMap;function Q2({children:e,error:t}){let{basename:n}=f.useContext(Lr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=V2(t.digest);if(s){let i=cm.get(t);if(i)throw i;let l=Wj(s.location,n);if(Hj&&!cm.get(t))if(l.isExternal||s.reloadDocument)window.location.href=l.absoluteURL||l.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw cm.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${l.absoluteURL||l.to}`})}}return e}function Z2({routeContext:e,match:t,children:n}){let s=f.useContext(xa);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(Jr.Provider,{value:e},n)}function eT(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 i=e,l=s==null?void 0:s.errors;if(l!=null){let h=i.findIndex(x=>x.route.id&&(l==null?void 0:l[x.route.id])!==void 0);Qt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<i.length;h++){let x=i[h];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(u=h),x.route.id){let{loaderData:y,errors:b}=s,C=x.route.loader&&!y.hasOwnProperty(x.route.id)&&(!b||b[x.route.id]===void 0);if(x.route.lazy||C){n.isStatic&&(c=!0),u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}}let p=n==null?void 0:n.onError,m=s&&p?(h,x)=>{var y,b;p(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:I2(s.matches),errorInfo:x})}:void 0;return i.reduceRight((h,x,y)=>{let b,C=!1,j=null,w=null;s&&(b=l&&x.route.id?l[x.route.id]:void 0,j=x.route.errorElement||X2,c&&(u<0&&y===0?(Zj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,w=null):u===y&&(C=!0,w=x.route.hydrateFallbackElement||null)));let k=t.concat(i.slice(0,y+1)),E=()=>{let N;return b?N=j:C?N=w:x.route.Component?N=f.createElement(x.route.Component,null):x.route.element?N=x.route.element:N=h,f.createElement(Z2,{match:x,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:N})};return s&&(x.route.ErrorBoundary||x.route.errorElement||y===0)?f.createElement(Qj,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Jh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tT(e){let t=f.useContext(xa);return Qt(t,Jh(e)),t}function nT(e){let t=f.useContext(Pd);return Qt(t,Jh(e)),t}function rT(e){let t=f.useContext(Jr);return Qt(t,Jh(e)),t}function Xh(e){let t=rT(e),n=t.matches[t.matches.length-1];return Qt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sT(){return Xh("useRouteId")}function oT(){var s;let e=f.useContext(Yh),t=nT("useRouteError"),n=Xh("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function iT(){let{router:e}=tT("useNavigate"),t=Xh("useNavigate"),n=f.useRef(!1);return Jj(()=>{n.current=!0}),f.useCallback(async(i,l={})=>{Wr(n.current,Yj),n.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...l}))},[e,t])}var fv={};function Zj(e,t,n){!t&&!fv[e]&&(fv[e]=!0,Wr(!1,n))}f.memo(aT);function aT({routes:e,future:t,state:n,isStatic:s,onError:i}){return Xj(e,void 0,{state:n,isStatic:s,onError:i})}function lT(e){return G2(e.context)}function He(e){Qt(!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 cT({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:i,static:l=!1,unstable_useTransitions:c}){Qt(!nc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),p=f.useMemo(()=>({basename:u,navigator:i,static:l,unstable_useTransitions:c,future:{}}),[u,i,l,c]);typeof n=="string"&&(n=ga(n));let{pathname:m="/",search:h="",hash:x="",state:y=null,key:b="default",unstable_mask:C}=n,j=f.useMemo(()=>{let w=Rs(m,u);return w==null?null:{location:{pathname:w,search:h,hash:x,state:y,key:b,unstable_mask:C},navigationType:s}},[u,m,h,x,y,b,s,C]);return Wr(j!=null,`<Router basename="${u}"> is not able to match the URL "${m}${h}${x}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:f.createElement(Lr.Provider,{value:p},f.createElement(tc.Provider,{children:t,value:j}))}function uT({children:e,location:t}){return Y2(ah(e),t)}function ah(e,t=[]){let n=[];return f.Children.forEach(e,(s,i)=>{if(!f.isValidElement(s))return;let l=[...t,i];if(s.type===f.Fragment){n.push.apply(n,ah(s.props.children,l));return}Qt(s.type===He,`[${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>`),Qt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||l.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=ah(s.props.children,l)),n.push(c)}),n}var Fu="get",zu="application/x-www-form-urlencoded";function Rd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function dT(e){return Rd(e)&&e.tagName.toLowerCase()==="button"}function fT(e){return Rd(e)&&e.tagName.toLowerCase()==="form"}function pT(e){return Rd(e)&&e.tagName.toLowerCase()==="input"}function mT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function hT(e,t){return e.button===0&&(!t||t==="_self")&&!mT(e)}function lh(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(i=>[n,i]):[[n,s]])},[]))}function gT(e,t){let n=lh(e);return t&&t.forEach((s,i)=>{n.has(i)||t.getAll(i).forEach(l=>{n.append(i,l)})}),n}var ju=null;function xT(){if(ju===null)try{new FormData(document.createElement("form"),0),ju=!1}catch{ju=!0}return ju}var yT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function um(e){return e!=null&&!yT.has(e)?(Wr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${zu}"`),null):e}function bT(e,t){let n,s,i,l,c;if(fT(e)){let u=e.getAttribute("action");s=u?Rs(u,t):null,n=e.getAttribute("method")||Fu,i=um(e.getAttribute("enctype"))||zu,l=new FormData(e)}else if(dT(e)||pT(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 p=e.getAttribute("formaction")||u.getAttribute("action");if(s=p?Rs(p,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Fu,i=um(e.getAttribute("formenctype"))||um(u.getAttribute("enctype"))||zu,l=new FormData(u,e),!xT()){let{name:m,type:h,value:x}=e;if(h==="image"){let y=m?`${m}.`:"";l.append(`${y}x`,"0"),l.append(`${y}y`,"0")}else m&&l.append(m,x)}}else{if(Rd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Fu,s=null,i=zu,c=e}return l&&i==="text/plain"&&(c=l,l=void 0),{action:s,method:n.toLowerCase(),encType:i,formData:l,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Qh(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vT(e,t,n,s){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${s}`:i.pathname=`${i.pathname}.${s}`:i.pathname==="/"?i.pathname=`_root.${s}`:t&&Rs(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${s}`,i}async function wT(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 jT(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 kT(e,t,n){let s=await Promise.all(e.map(async i=>{let l=t.routes[i.route.id];if(l){let c=await wT(l,n);return c.links?c.links():[]}return[]}));return ET(s.flat(1).filter(jT).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function pv(e,t,n,s,i,l){let c=(p,m)=>n[m]?p.route.id!==n[m].route.id:!0,u=(p,m)=>{var h;return n[m].pathname!==p.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==p.params["*"]};return l==="assets"?t.filter((p,m)=>c(p,m)||u(p,m)):l==="data"?t.filter((p,m)=>{var x;let h=s.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(c(p,m)||u(p,m))return!0;if(p.route.shouldRevalidate){let y=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((x=n[0])==null?void 0:x.params)||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function ST(e,t,{includeHydrateFallback:n}={}){return NT(e.map(s=>{let i=t.routes[s.route.id];if(!i)return[];let l=[i.module];return i.clientActionModule&&(l=l.concat(i.clientActionModule)),i.clientLoaderModule&&(l=l.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(l=l.concat(i.hydrateFallbackModule)),i.imports&&(l=l.concat(i.imports)),l}).flat(1))}function NT(e){return[...new Set(e)]}function CT(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function ET(e,t){let n=new Set;return new Set(t),e.reduce((s,i)=>{let l=JSON.stringify(CT(i));return n.has(l)||(n.add(l),s.push({key:l,link:i})),s},[])}function e0(){let e=f.useContext(xa);return Qh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function TT(){let e=f.useContext(Pd);return Qh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Zh=f.createContext(void 0);Zh.displayName="FrameworkContext";function t0(){let e=f.useContext(Zh);return Qh(e,"You must render this element inside a <HydratedRouter> element"),e}function PT(e,t){let n=f.useContext(Zh),[s,i]=f.useState(!1),[l,c]=f.useState(!1),{onFocus:u,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:x}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(E=>{c(E.isIntersecting)})},w=new IntersectionObserver(j,{threshold:.5});return y.current&&w.observe(y.current),()=>{w.disconnect()}}},[e]),f.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{i(!0)},C=()=>{i(!1),c(!1)};return n?e!=="intent"?[l,y,{}]:[l,y,{onFocus:ml(u,b),onBlur:ml(p,C),onMouseEnter:ml(m,b),onMouseLeave:ml(h,C),onTouchStart:ml(x,b)}]:[!1,y,{}]}function ml(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function RT({page:e,...t}){let{router:n}=e0(),s=f.useMemo(()=>zj(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(DT,{page:e,matches:s,...t}):null}function AT(e){let{manifest:t,routeModules:n}=t0(),[s,i]=f.useState([]);return f.useEffect(()=>{let l=!1;return kT(e,t,n).then(c=>{l||i(c)}),()=>{l=!0}},[e,t,n]),s}function DT({page:e,matches:t,...n}){let s=Wn(),{future:i,manifest:l,routeModules:c}=t0(),{basename:u}=e0(),{loaderData:p,matches:m}=TT(),h=f.useMemo(()=>pv(e,t,m,l,s,"data"),[e,t,m,l,s]),x=f.useMemo(()=>pv(e,t,m,l,s,"assets"),[e,t,m,l,s]),y=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,w=!1;if(t.forEach(E=>{var P;let N=l.routes[E.route.id];!N||!N.hasLoader||(!h.some($=>$.route.id===E.route.id)&&E.route.id in p&&((P=c[E.route.id])!=null&&P.shouldRevalidate)||N.hasClientLoader?w=!0:j.add(E.route.id))}),j.size===0)return[];let k=vT(e,u,i.unstable_trailingSlashAwareDataRequests,"data");return w&&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,i.unstable_trailingSlashAwareDataRequests,p,s,l,h,t,e,c]),b=f.useMemo(()=>ST(x,l),[x,l]),C=AT(x);return f.createElement(f.Fragment,null,y.map(j=>f.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>f.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),C.map(({key:j,link:w})=>f.createElement("link",{key:j,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function $T(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var LT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{LT&&(window.__reactRouterVersion="7.13.1")}catch{}function OT({basename:e,children:t,unstable_useTransitions:n,window:s}){let i=f.useRef();i.current==null&&(i.current=d2({window:s,v5Compat:!0}));let l=i.current,[c,u]=f.useState({action:l.action,location:l.location}),p=f.useCallback(m=>{n===!1?u(m):f.startTransition(()=>u(m))},[n]);return f.useLayoutEffect(()=>l.listen(p),[l,p]),f.createElement(cT,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:l,unstable_useTransitions:n})}var n0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:i,reloadDocument:l,replace:c,unstable_mask:u,state:p,target:m,to:h,preventScrollReset:x,viewTransition:y,unstable_defaultShouldRevalidate:b,...C},j){let{basename:w,navigator:k,unstable_useTransitions:E}=f.useContext(Lr),N=typeof h=="string"&&n0.test(h),P=Wj(h,w);h=P.to;let $=W2(h,{relative:i}),T=Wn(),D=null;if(u){let H=Gh(u,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);w!=="/"&&(H.pathname=H.pathname==="/"?w:cs([w,H.pathname])),D=k.createHref(H)}let[L,Y,X]=PT(s,C),I=FT(h,{replace:c,unstable_mask:u,state:p,target:m,preventScrollReset:x,relative:i,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function U(H){t&&t(H),H.defaultPrevented||I(H)}let ne=!(P.isExternal||l),F=f.createElement("a",{...C,...X,href:(ne?D:void 0)||P.absoluteURL||$,onClick:ne?U:t,ref:$T(j,Y),target:m,"data-discover":!N&&n==="render"?"true":void 0});return L&&!N?f.createElement(f.Fragment,null,F,f.createElement(RT,{page:$})):F});Ce.displayName="Link";var IT=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:i=!1,style:l,to:c,viewTransition:u,children:p,...m},h){let x=rc(c,{relative:m.relative}),y=Wn(),b=f.useContext(Pd),{navigator:C,basename:j}=f.useContext(Lr),w=b!=null&&HT(x)&&u===!0,k=C.encodeLocation?C.encodeLocation(x).pathname:x.pathname,E=y.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&j&&(N=Rs(N,j)||N);const P=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let $=E===k||!i&&E.startsWith(k)&&E.charAt(P)==="/",T=N!=null&&(N===k||!i&&N.startsWith(k)&&N.charAt(k.length)==="/"),D={isActive:$,isPending:T,isTransitioning:w},L=$?t:void 0,Y;typeof s=="function"?Y=s(D):Y=[s,$?"active":null,T?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let X=typeof l=="function"?l(D):l;return f.createElement(Ce,{...m,"aria-current":L,className:Y,ref:h,style:X,to:c,viewTransition:u},typeof p=="function"?p(D):p)});IT.displayName="NavLink";var _T=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:i,state:l,method:c=Fu,action:u,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:x,unstable_defaultShouldRevalidate:y,...b},C)=>{let{unstable_useTransitions:j}=f.useContext(Lr),w=UT(),k=VT(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",N=typeof u=="string"&&n0.test(u),P=$=>{if(p&&p($),$.defaultPrevented)return;$.preventDefault();let T=$.nativeEvent.submitter,D=(T==null?void 0:T.getAttribute("formmethod"))||c,L=()=>w(T||$.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:i,state:l,relative:m,preventScrollReset:h,viewTransition:x,unstable_defaultShouldRevalidate:y});j&&n!==!1?f.startTransition(()=>L()):L()};return f.createElement("form",{ref:C,method:E,action:k,onSubmit:s?p:P,...b,"data-discover":!N&&e==="render"?"true":void 0})});_T.displayName="Form";function MT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function r0(e){let t=f.useContext(xa);return Qt(t,MT(e)),t}function FT(e,{target:t,replace:n,unstable_mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p,unstable_useTransitions:m}={}){let h=Dt(),x=Wn(),y=rc(e,{relative:c});return f.useCallback(b=>{if(hT(b,t)){b.preventDefault();let C=n!==void 0?n:zl(x)===zl(y),j=()=>h(e,{replace:C,unstable_mask:s,state:i,preventScrollReset:l,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:p});m?f.startTransition(()=>j()):j()}},[x,h,y,n,s,i,t,e,l,c,u,p,m])}function ms(e){Wr(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=f.useRef(lh(e)),n=f.useRef(!1),s=Wn(),i=f.useMemo(()=>gT(s.search,n.current?null:t.current),[s.search]),l=Dt(),c=f.useCallback((u,p)=>{const m=lh(typeof u=="function"?u(new URLSearchParams(i)):u);n.current=!0,l("?"+m,p)},[l,i]);return[i,c]}var zT=0,BT=()=>`__${String(++zT)}__`;function UT(){let{router:e}=r0("useSubmit"),{basename:t}=f.useContext(Lr),n=sT(),s=e.fetch,i=e.navigate;return f.useCallback(async(l,c={})=>{let{action:u,method:p,encType:m,formData:h,body:x}=bT(l,t);if(c.navigate===!1){let y=c.fetcherKey||BT();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:x,formMethod:c.method||p,formEncType:c.encType||m,flushSync:c.flushSync})}else await i(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:x,formMethod:c.method||p,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,i,t,n])}function VT(e,{relative:t}={}){let{basename:n}=f.useContext(Lr),s=f.useContext(Jr);Qt(s,"useFormAction must be used inside a RouteContext");let[i]=s.matches.slice(-1),l={...rc(e||".",{relative:t})},c=Wn();if(e==null){l.search=c.search;let u=new URLSearchParams(l.search),p=u.getAll("index");if(p.some(h=>h==="")){u.delete("index"),p.filter(x=>x).forEach(x=>u.append("index",x));let h=u.toString();l.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:cs([n,l.pathname])),zl(l)}function HT(e,{relative:t}={}){let n=f.useContext(qj);Qt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=r0("useViewTransitionState"),i=rc(e,{relative:t});if(!n.isTransitioning)return!1;let l=Rs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Rs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Zu(i.pathname,c)!=null||Zu(i.pathname,l)!=null}var Ts=Fj();const WT=Td(Ts);/**
|
|
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 KT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s0=(...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 qT={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 GT=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:i="",children:l,iconNode:c,...u},p)=>f.createElement("svg",{ref:p,...qT,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:s0("lucide",i),...u},[...c.map(([m,h])=>f.createElement(m,h)),...Array.isArray(l)?l:[l]]));/**
|
|
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 Le=(e,t)=>{const n=f.forwardRef(({className:s,...i},l)=>f.createElement(GT,{ref:l,iconNode:t,className:s0(`lucide-${KT(e)}`,s),...i}));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 Ad=Le("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 ed=Le("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 Dd=Le("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 td=Le("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 $d=Le("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 o0=Le("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 nd=Le("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 YT=Le("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 i0=Le("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 Ld=Le("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 JT=Le("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 uo=Le("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 Kr=Le("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 XT=Le("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 QT=Le("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 a0=Le("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 ch=Le("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 eg=Le("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 uh=Le("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 ZT=Le("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 eP=Le("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 tP=Le("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 nP=Le("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 rP=Le("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 Od=Le("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"}]]);/**
|
|
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 sP=Le("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"}]]);/**
|
|
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 l0=Le("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"}]]);/**
|
|
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 rd=Le("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"}]]);/**
|
|
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 oP=Le("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"}]]);/**
|
|
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 iP=Le("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"}]]);/**
|
|
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 ya=Le("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"}]]);/**
|
|
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 mv=Le("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"}]]);/**
|
|
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 aP=Le("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"}]]);/**
|
|
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 lP=Le("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"}]]);/**
|
|
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 c0=Le("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"}]]);/**
|
|
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 tg=Le("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"}]]);/**
|
|
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 cP=Le("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"}]]);/**
|
|
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 ng=Le("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"}]]);/**
|
|
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 uP=Le("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"}]]);/**
|
|
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 u0=Le("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"}]]);/**
|
|
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 dP=Le("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"}]]);/**
|
|
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 rg=Le("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 dh=Le("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"}]]);/**
|
|
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 d0=Le("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"}]]);/**
|
|
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 fP=Le("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"}]]);/**
|
|
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 pP=Le("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"}]]);/**
|
|
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 mP=Le("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"}]]);/**
|
|
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 hP=Le("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"}]]);/**
|
|
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 sg=Le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 gP=Le("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"}]]);/**
|
|
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 og=Le("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"}]]);/**
|
|
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 xP=Le("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"}]]);/**
|
|
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 dm=Le("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"}]]);/**
|
|
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 f0=Le("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"}]]);/**
|
|
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 ba=Le("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"}]]);/**
|
|
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 yP=Le("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 rn=Le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 p0=Le("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"}]]);/**
|
|
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 bP=Le("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"}]]);/**
|
|
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 vP=Le("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
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 io=Le("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"}]]);/**
|
|
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 Id=Le("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"}]]);/**
|
|
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 wP=Le("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"}]]);/**
|
|
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 fo=Le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 jP=Le("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"}]]);/**
|
|
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 kP=Le("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"}]]);/**
|
|
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 SP=Le("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"}]]);/**
|
|
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 NP=Le("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"}]]);/**
|
|
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 Ar=Le("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"}]]);/**
|
|
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 hv=Le("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"}]]);/**
|
|
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 ig=Le("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 CP=Le("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"}]]);/**
|
|
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 m0=Le("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"}]]);/**
|
|
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 Zi=Le("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 or=Le("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"}]]);/**
|
|
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 ag=Le("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"}]]);/**
|
|
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 EP=Le("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"}]]);/**
|
|
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 TP=Le("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"}]]);/**
|
|
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 _d=Le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function h0(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=h0(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function PP(){for(var e,t,n=0,s="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=h0(e))&&(s&&(s+=" "),s+=t);return s}const lg="-",RP=e=>{const t=DP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(lg);return u[0]===""&&u.length!==1&&u.shift(),g0(u,t)||AP(c)},getConflictingClassGroupIds:(c,u)=>{const p=n[c]||[];return u&&s[c]?[...p,...s[c]]:p}}},g0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),i=s?g0(e.slice(1),s):void 0;if(i)return i;if(t.validators.length===0)return;const l=e.join(lg);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},gv=/^\[(.+)\]$/,AP=e=>{if(gv.test(e)){const t=gv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},DP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return LP(Object.entries(e.classGroups),n).forEach(([l,c])=>{fh(c,s,l,t)}),s},fh=(e,t,n,s)=>{e.forEach(i=>{if(typeof i=="string"){const l=i===""?t:xv(t,i);l.classGroupId=n;return}if(typeof i=="function"){if($P(i)){fh(i(s),t,n,s);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([l,c])=>{fh(c,xv(t,l),n,s)})})},xv=(e,t)=>{let n=e;return t.split(lg).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},$P=e=>e.isThemeGetter,LP=(e,t)=>t?e.map(([n,s])=>{const i=s.map(l=>typeof l=="string"?t+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,u])=>[t+c,u])):l);return[n,i]}):e,OP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const i=(l,c)=>{n.set(l,c),t++,t>e&&(t=0,s=n,n=new Map)};return{get(l){let c=n.get(l);if(c!==void 0)return c;if((c=s.get(l))!==void 0)return i(l,c),c},set(l,c){n.has(l)?n.set(l,c):i(l,c)}}},x0="!",IP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,i=t[0],l=t.length,c=u=>{const p=[];let m=0,h=0,x;for(let w=0;w<u.length;w++){let k=u[w];if(m===0){if(k===i&&(s||u.slice(w,w+l)===t)){p.push(u.slice(h,w)),h=w+l;continue}if(k==="/"){x=w;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?u:u.substring(h),b=y.startsWith(x0),C=b?y.substring(1):y,j=x&&x>h?x-h:void 0;return{modifiers:p,hasImportantModifier:b,baseClassName:C,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},_P=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},MP=e=>({cache:OP(e.cacheSize),parseClassName:IP(e),...RP(e)}),FP=/\s+/,zP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:i}=t,l=[],c=e.trim().split(FP);let u="";for(let p=c.length-1;p>=0;p-=1){const m=c[p],{modifiers:h,hasImportantModifier:x,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 w=_P(h).join(":"),k=x?w+x0:w,E=k+j;if(l.includes(E))continue;l.push(E);const N=i(j,C);for(let P=0;P<N.length;++P){const $=N[P];l.push(k+$)}u=m+(u.length>0?" "+u:u)}return u};function BP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=y0(t))&&(s&&(s+=" "),s+=n);return s}const y0=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=y0(e[s]))&&(n&&(n+=" "),n+=t);return n};function UP(e,...t){let n,s,i,l=c;function c(p){const m=t.reduce((h,x)=>x(h),e());return n=MP(m),s=n.cache.get,i=n.cache.set,l=u,u(p)}function u(p){const m=s(p);if(m)return m;const h=zP(p,n);return i(p,h),h}return function(){return l(BP.apply(null,arguments))}}const Ut=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},b0=/^\[(?:([a-z-]+):)?(.+)\]$/i,VP=/^\d+\/\d+$/,HP=new Set(["px","full","screen"]),WP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,KP=/\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$/,qP=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GP=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YP=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Cs=e=>ea(e)||HP.has(e)||VP.test(e),Xs=e=>va(e,"length",rR),ea=e=>!!e&&!Number.isNaN(Number(e)),fm=e=>va(e,"number",ea),hl=e=>!!e&&Number.isInteger(Number(e)),JP=e=>e.endsWith("%")&&ea(e.slice(0,-1)),ut=e=>b0.test(e),Qs=e=>WP.test(e),XP=new Set(["length","size","percentage"]),QP=e=>va(e,XP,v0),ZP=e=>va(e,"position",v0),eR=new Set(["image","url"]),tR=e=>va(e,eR,oR),nR=e=>va(e,"",sR),gl=()=>!0,va=(e,t,n)=>{const s=b0.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},rR=e=>KP.test(e)&&!qP.test(e),v0=()=>!1,sR=e=>GP.test(e),oR=e=>YP.test(e),iR=()=>{const e=Ut("colors"),t=Ut("spacing"),n=Ut("blur"),s=Ut("brightness"),i=Ut("borderColor"),l=Ut("borderRadius"),c=Ut("borderSpacing"),u=Ut("borderWidth"),p=Ut("contrast"),m=Ut("grayscale"),h=Ut("hueRotate"),x=Ut("invert"),y=Ut("gap"),b=Ut("gradientColorStops"),C=Ut("gradientColorStopPositions"),j=Ut("inset"),w=Ut("margin"),k=Ut("opacity"),E=Ut("padding"),N=Ut("saturate"),P=Ut("scale"),$=Ut("sepia"),T=Ut("skew"),D=Ut("space"),L=Ut("translate"),Y=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",ut,t],U=()=>[ut,t],ne=()=>["",Cs,Xs],F=()=>["auto",ea,ut],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ee=()=>["solid","dashed","dotted","double","none"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",ut],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[ea,ut];return{cacheSize:500,separator:":",theme:{colors:[gl],spacing:[Cs,Xs],blur:["none","",Qs,ut],brightness:M(),borderColor:[e],borderRadius:["none","","full",Qs,ut],borderSpacing:U(),borderWidth:ne(),contrast:M(),grayscale:W(),hueRotate:M(),invert:W(),gap:U(),gradientColorStops:[e],gradientColorStopPositions:[JP,Xs],inset:I(),margin:I(),opacity:M(),padding:U(),saturate:M(),scale:M(),sepia:W(),skew:M(),space:U(),translate:U()},classGroups:{aspect:[{aspect:["auto","square","video",ut]}],container:["container"],columns:[{columns:[Qs]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:[...H(),ut]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],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",hl,ut]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ut]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",hl,ut]}],"grid-cols":[{"grid-cols":[gl]}],"col-start-end":[{col:["auto",{span:["full",hl,ut]},ut]}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":[gl]}],"row-start-end":[{row:["auto",{span:[hl,ut]},ut]}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ut]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ut]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"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:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ut,t]}],"min-w":[{"min-w":[ut,t,"min","max","fit"]}],"max-w":[{"max-w":[ut,t,"none","full","min","max","fit","prose",{screen:[Qs]},Qs]}],h:[{h:[ut,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ut,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ut,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ut,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Qs,Xs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fm]}],"font-family":[{font:[gl]}],"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",ut]}],"line-clamp":[{"line-clamp":["none",ea,fm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Cs,ut]}],"list-image":[{"list-image":["none",ut]}],"list-style-type":[{list:["none","disc","decimal",ut]}],"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:[...ee(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Cs,Xs]}],"underline-offset":[{"underline-offset":["auto",Cs,ut]}],"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:U()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ut]}],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",ut]}],"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:[...H(),ZP]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",QP]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tR]}],"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:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"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:[...ee(),"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:ee()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ee()]}],"outline-offset":[{"outline-offset":[Cs,ut]}],"outline-w":[{outline:[Cs,Xs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Cs,Xs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Qs,nR]}],"shadow-color":[{shadow:[gl]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...ce(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ce()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",Qs,ut]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[x]}],saturate:[{saturate:[N]}],sepia:[{sepia:[$]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[$]}],"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",ut]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",ut]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",ut]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[hl,ut]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ut]}],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",ut]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":U()}],"scroll-mx":[{"scroll-mx":U()}],"scroll-my":[{"scroll-my":U()}],"scroll-ms":[{"scroll-ms":U()}],"scroll-me":[{"scroll-me":U()}],"scroll-mt":[{"scroll-mt":U()}],"scroll-mr":[{"scroll-mr":U()}],"scroll-mb":[{"scroll-mb":U()}],"scroll-ml":[{"scroll-ml":U()}],"scroll-p":[{"scroll-p":U()}],"scroll-px":[{"scroll-px":U()}],"scroll-py":[{"scroll-py":U()}],"scroll-ps":[{"scroll-ps":U()}],"scroll-pe":[{"scroll-pe":U()}],"scroll-pt":[{"scroll-pt":U()}],"scroll-pr":[{"scroll-pr":U()}],"scroll-pb":[{"scroll-pb":U()}],"scroll-pl":[{"scroll-pl":U()}],"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",ut]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Cs,Xs,fm]}],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"]}}},aR=UP(iR);function Te(...e){return aR(PP(e))}function Dn(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 $r(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 w0(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function j0(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 k0(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 i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function sd(e){return e.toLocaleString("en-US")}function od(e){return`$${e.toFixed(4)}`}function lR(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,s,i]=t,l=new Date(Number(n),Number(s)-1,Number(i));return Number.isNaN(l.getTime())?e:l.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function yn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function S0(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function cR(e){let t=S0(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 N0(e,t){return cR(e)===t}function C0(e){let n=S0(e).split("/").filter(Boolean);const s=[];let i="Overview",l=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:yn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:i,breadcrumbs:s,projectSlug:l};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),i="Projects",n[1]&&(l=n[1],s.push({label:yn(n[1]),path:`${c}/projects/${n[1]}`}),i=yn(n[1])),n[2]==="edit")i="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")i="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:yn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),i=yn(n[3]),n[4]==="edit"?i="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?i="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?i="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?i="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(i="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",p=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:p}),s.push({label:yn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),i=yn(n[3]),n[4]==="edit"&&(i=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(i="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(i="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(i="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(i="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(i="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(i="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),i="Playbooks",n[1]==="create"?i="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:yn(n[1]),path:`/playbooks/${n[1]}`}),i="Edit Playbook"):n[1]&&(s.push({label:yn(n[1]),path:`/playbooks/${n[1]}`}),i=yn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),i="Memories",n[1]==="new"&&(i="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),i="Resources",n[1]==="new"&&(i="New Resource")):n[0]==="todos"?(i="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(i="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(i="View")):n[0]==="help"?(i="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(i="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(i="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:i,breadcrumbs:s,projectSlug:l}}function yv({items:e,onNavigate:t}){const n=Wn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const i=s.icon,l=N0(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{to:s.to,onClick:t,className:Te("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",l?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[r.jsx(i,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const E0=[{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)"}}],uR=E0.map(e=>e.slug),id="default";function T0(e){return typeof e=="string"&&uR.includes(e)}const P0={preset:id,custom:!1};let Tl=null,Oi=null;function cg(e){if(!e||typeof e!="object")return P0;const t=e;return{preset:T0(t.preset)?t.preset:id,custom:t.custom===!0}}function dR(){return Tl?Promise.resolve(Tl):Oi||(Oi=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=cg(e);return Tl=t,Oi=null,t}).catch(()=>(Oi=null,P0)),Oi)}async function fR(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=cg(await t.json());return Tl=n,n}async function pR(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=cg(await e.json());return Tl=t,t}const ph="syntaur-theme",Bu="syntaur-preset",R0=f.createContext(null);function mh(){try{const e=window.localStorage.getItem(ph);return e==="light"||e==="dark"?e:null}catch{return null}}function A0(){try{const e=window.localStorage.getItem(Bu);return T0(e)?e:id}catch{return id}}function D0(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function $0(e){document.documentElement.classList.toggle("dark",e==="dark")}function L0(e){document.documentElement.dataset.theme=e}function mR(){typeof document>"u"||($0(mh()??D0()),L0(A0()))}function hR({children:e}){const[t,n]=f.useState(()=>mh()),[s,i]=f.useState(()=>mh()??D0()),[l,c]=f.useState(()=>A0());f.useEffect(()=>{$0(s)},[s]),f.useEffect(()=>{L0(l)},[l]),f.useEffect(()=>{let h=!1;return dR().then(x=>{if(!h&&x.preset!==l){c(x.preset);try{window.localStorage.setItem(Bu,x.preset)}catch{}}}),()=>{h=!0}},[]),f.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),x=()=>{t||i(h.matches?"dark":"light")};return x(),h.addEventListener("change",x),()=>{h.removeEventListener("change",x)}},[t]);async function u(h){c(h);try{window.localStorage.setItem(Bu,h)}catch{}await fR(h)}async function p(){const h=await pR();c(h.preset);try{window.localStorage.setItem(Bu,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(ph,h),n(h),i(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(ph,h),n(h),i(h)},preset:l,setPreset:u,resetPreset:p};return r.jsx(R0.Provider,{value:m,children:e})}function ug(){const e=f.useContext(R0);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Uu=new Set;let nr=null,ta=null;function gR(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function O0(){nr&&(nr.readyState===WebSocket.OPEN||nr.readyState===WebSocket.CONNECTING)||(nr=new WebSocket(gR()),nr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Uu)n(t)}catch{}},nr.onclose=()=>{nr=null,ta&&clearTimeout(ta),ta=setTimeout(O0,2e3)},nr.onerror=()=>{nr==null||nr.close()})}function sc(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Uu.add(n),O0(),()=>{Uu.delete(n),Uu.size===0&&nr&&(ta&&clearTimeout(ta),ta=null,nr.close(),nr=null)}},[])}function Zt(e,t,n=!0,s=!1){const[i,l]=f.useState(null),[c,u]=f.useState(!0),[p,m]=f.useState(null),[h,x]=f.useState(0),y=n?e:null,b=f.useCallback(()=>{x(j=>j+1)},[]),C=f.useRef(y);return s&&C.current!==y&&(C.current=y,l(null),m(null)),f.useEffect(()=>{if(!y){u(!1),l(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async w=>{if(!w.ok){const k=await w.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${w.status}`)}return w.json()}).then(w=>{j||(l(w),u(!1))}).catch(w=>{j||(m(w.message),u(!1))}),()=>{j=!0}},[y,h]),sc(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:i,loading:c,error:p,refetch:b}}function Jo(e=!0){return Zt("/api/projects","projects",e)}function oc(){return Zt("/api/workspaces","projects")}function ln(){const{workspace:e}=$t();return e?`/w/${e}`:""}function xR(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 Zt(s,"overview")}function Md(e=!0){return Zt("/api/assignments","assignments",e)}function yR(e=!0){return Zt("/api/archived","assignments",e)}function I0(){return Zt("/api/help")}function _0(e){const t=e?`/api/projects/${e}`:null;return Zt(t,"project")}function bR(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return Zt(n,"assignment")}function vR(e){const t=e?`/api/assignments/${e}`:null;return Zt(t,"assignment")}function M0(e){return Zt(e)}function dg(e=!0){return Zt("/api/servers","servers",e)}function F0(){return Zt("/api/leases","inventories")}function z0(){return Zt("/api/agent-sessions","agent-sessions")}function wR(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return Zt(n,"agent-sessions")}function jR(e){const t=e?`/api/assignments/${e}/sessions`:null;return Zt(t,"agent-sessions")}function kR(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return Zt(n,void 0,!0,!0)}function SR(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return Zt(t,void 0,!0,!0)}function B0(e=!0){return Zt("/api/playbooks","playbooks",e)}function NR(e){const t=e?`/api/playbooks/${e}`:null;return Zt(t,"playbooks")}function CR(){return Zt("/api/memories","project")}function ER(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return Zt(n,"project")}function TR(){return Zt("/api/resources","project")}function PR(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return Zt(n,"project")}const Fd=["new-workspace","new-project","new-todo","new-assignment"];function RR(e){return typeof e=="string"&&Fd.includes(e)}const AR=["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","[","]"],DR=["mod","ctrl","alt","shift"];function rr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(rr).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(),i=n.slice(0,-1).map(u=>u.toLowerCase()),l=new Set,c=[];for(const u of DR)i.includes(u)&&!l.has(u)&&(c.push(u),l.add(u));for(const u of i)l.has(u)||(c.push(u),l.add(u));return[...c,s].join("+")}function $R(e){const t=rr(e);return t?AR.includes(t):!1}const LR={"new-workspace":rr("Mod+Shift+Alt+w"),"new-project":rr("Mod+Shift+Alt+p"),"new-todo":rr("Mod+Shift+Alt+t"),"new-assignment":rr("Mod+Shift+Alt+a")};function OR(e){const t={...LR};for(const n of Fd){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function zo(){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 IR(e){const t=e.split("+").map(i=>i.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(i=>i.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function ku(e,t){const n=IR(t);if(e.key.toLowerCase()!==n.key)return!1;const i=zo()?e.metaKey:e.ctrlKey;return!(n.mod&&!i||!n.mod&&!n.ctrl&&i||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 U0(e){const t=[],n=zo()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let i;s===" "||s==="Spacebar"?i="space":(s.length,i=s.toLowerCase());const l=i.length===1&&/^[a-z0-9]$/.test(i);e.shiftKey&&l&&t.push("shift");const c=[...t,i].join("+");return rr(c)}function us(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?zo()?"⌘":"Ctrl":s==="shift"?zo()?"⇧":"Shift":s==="alt"?zo()?"⌥":"Alt":s==="ctrl"?zo()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(zo()?"":"+")}function _R(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{i(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function V0(e=!0){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch("/api/todos");if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{i(!1)}},[]);return f.useEffect(()=>{if(!e){i(!1);return}u()},[u,e]),sc(p=>{e&&p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}async function fg(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 H0(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 W0(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 K0(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 q0(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function G0(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function Y0(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 pg(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function J0(e,t,n){for(const s of n){const i=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(!i.ok)throw new Error(await i.text().catch(()=>"")||`HTTP ${i.status}`)}}async function X0(e,t,n){const s=await fetch(pg(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function mg(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 i=null;try{i=s?JSON.parse(s):null}catch{}const l=(i==null?void 0:i.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function MR(e,t){return await mg(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function FR(e){return await mg("/api/todos/promote-bulk",e)}async function zR(e,t,n){await mg(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const BR=new Set(["/projects","/assignments","/servers","/todos"]);function Vu(e,t){return BR.has(e)?`${t}${e}`:e}const UR=[{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 VR(e){const t=[];for(const n of UR)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:Vu(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(i=>!!i),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:`${Vu("/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,i=Vu("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${i}?focus=${encodeURIComponent(n.id)}`})}return t}function mr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Hu(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function HR(e,t,n){const s=t?"disable":"enable",i=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.error||`Failed to ${s} playbook`)}n()}async function pm(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 bv(){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 vv(){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 mm(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 Oo(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
|
|
467
|
+
${t}: ${JSON.stringify(n)}
|
|
468
|
+
---
|
|
469
|
+
${e}`;const i=s[1],l=s[2],c=s[3],u=e.slice(s[0].length),p=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(l)?h=l.replace(m,`${t}: ${p}`):h=`${l}
|
|
470
|
+
${t}: ${p}`,`${i}${h}${c}${u}`}const WR=/^[a-z0-9][a-z0-9-]*$/;function KR(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:i,wsPrefix:l,refetchPlaybooks:c,navigate:u,toggleTheme:p}=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:WR,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,x)=>{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})`)}x.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:x}=await bv(),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,x)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=mr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");let j=await mm("/api/templates/project");j=Oo(j,"slug",C),j=Oo(j,"title",b),y&&y!=="_ungrouped"&&(j=Oo(j,"workspace",y));const w=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create project (HTTP ${w.status})`);const E=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??C}`:`/projects/${k.slug??C}`;x.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},x]=await Promise.all([bv(),vv()]),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 x){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 x=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await fg(x,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 vv(),x=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)x.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return x}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,x)=>{var N;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=mr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let P=await mm("/api/templates/assignment?standalone=1");P=Oo(P,"slug",C),P=Oo(P,"title",b);const $=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:P})}),T=await $.json().catch(()=>({}));if(!$.ok)throw new Error(T.error||`Failed to create assignment (HTTP ${$.status})`);const D=((N=T==null?void 0:T.assignment)==null?void 0:N.id)??(T==null?void 0:T.id);D?x.navigate(`/assignments/${D}`):x.navigate("/assignments");return}let j=await mm("/api/templates/assignment");j=Oo(j,"slug",C),j=Oo(j,"title",b);const w=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await w.json().catch(()=>({}));if(!w.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${w.status})`);const E=k.slug??C;x.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(`${l}/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(`${l}/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(`${l}/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 x=h.trim();x&&await pm("_ungrouped",x)}}}),l){const h=l.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 x=>{const y=x.trim();y&&await pm(h,y)}}})}n&&i&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${i}`,group:"Create",keywords:["new","create","todo","project",n,i],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const x=h.trim();x&&await pm(i,x)}}});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:()=>HR(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:()=>p()}),m}function qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function wv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zd(...e){return t=>{let n=!1;const s=e.map(i=>{const l=wv(i,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let i=0;i<s.length;i++){const l=s[i];typeof l=="function"?l():wv(e[i],null)}}}}function Fn(...e){return f.useCallback(zd(...e),e)}function qR(e,t){const n=f.createContext(t),s=l=>{const{children:c,...u}=l,p=f.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:p,children:c})};s.displayName=e+"Provider";function i(l){const c=f.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[s,i]}function Xo(e,t=[]){let n=[];function s(l,c){const u=f.createContext(c),p=n.length;n=[...n,c];const m=x=>{var k;const{scope:y,children:b,...C}=x,j=((k=y==null?void 0:y[e])==null?void 0:k[p])||u,w=f.useMemo(()=>C,Object.values(C));return r.jsx(j.Provider,{value:w,children:b})};m.displayName=l+"Provider";function h(x,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[p])||u,C=f.useContext(b);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${x}\` must be used within \`${l}\``)}return[m,h]}const i=()=>{const l=n.map(c=>f.createContext(c));return function(u){const p=(u==null?void 0:u[e])||l;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:p}}),[u,p])}};return i.scopeName=e,[s,GR(i,...t)]}function GR(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const c=s.reduce((u,{useScope:p,scopeName:m})=>{const x=p(l)[`__scope${m}`];return{...u,...x}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var ao=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},YR=Mj[" useId ".trim().toString()]||(()=>{}),JR=0;function na(e){const[t,n]=f.useState(YR());return ao(()=>{n(s=>s??String(JR++))},[e]),e||(t?`radix-${t}`:"")}var XR=Mj[" useInsertionEffect ".trim().toString()]||ao;function Bd({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[i,l,c]=QR({defaultProp:t,onChange:n}),u=e!==void 0,p=u?e:i;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const x=h.current;x!==u&&console.warn(`${s} is changing from ${x?"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=f.useCallback(h=>{var x;if(u){const y=ZR(h)?h(e):h;y!==e&&((x=c.current)==null||x.call(c,y))}else l(h)},[u,e,l,c]);return[p,m]}function QR({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),i=f.useRef(n),l=f.useRef(t);return XR(()=>{l.current=t},[t]),f.useEffect(()=>{var c;i.current!==n&&((c=l.current)==null||c.call(l,n),i.current=n)},[n,i]),[n,s,l]}function ZR(e){return typeof e=="function"}function eA(e){const t=tA(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(rA);if(p){const m=p.props.children,h=u.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function tA(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=oA(i),u=sA(l,i.props);return i.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(i,u)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nA=Symbol("radix.slottable");function rA(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nA}function sA(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...u)=>{const p=l(...u);return i(...u),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function oA(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var iA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mn=iA.reduce((e,t)=>{const n=eA(`Primitive.${t}`),s=f.forwardRef((i,l)=>{const{asChild:c,...u}=i,p=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(p,{...u,ref:l})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function aA(e,t){e&&Ts.flushSync(()=>e.dispatchEvent(t))}function Ko(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function lA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e);f.useEffect(()=>{const s=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var cA="DismissableLayer",hh="dismissableLayer.update",uA="dismissableLayer.pointerDownOutside",dA="dismissableLayer.focusOutside",jv,Q0=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hg=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...p}=e,m=f.useContext(Q0),[h,x]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),C=Fn(t,D=>x(D)),j=Array.from(m.layers),[w]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(w),E=h?j.indexOf(h):-1,N=m.layersWithOutsidePointerEventsDisabled.size>0,P=E>=k,$=mA(D=>{const L=D.target,Y=[...m.branches].some(X=>X.contains(L));!P||Y||(i==null||i(D),c==null||c(D),D.defaultPrevented||u==null||u())},y),T=hA(D=>{const L=D.target;[...m.branches].some(X=>X.contains(L))||(l==null||l(D),c==null||c(D),D.defaultPrevented||u==null||u())},y);return lA(D=>{E===m.layers.size-1&&(s==null||s(D),!D.defaultPrevented&&u&&(D.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(jv=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),kv(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=jv)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),kv())},[h,m]),f.useEffect(()=>{const D=()=>b({});return document.addEventListener(hh,D),()=>document.removeEventListener(hh,D)},[]),r.jsx(mn.div,{...p,ref:C,style:{pointerEvents:N?P?"auto":"none":void 0,...e.style},onFocusCapture:qt(e.onFocusCapture,T.onFocusCapture),onBlurCapture:qt(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:qt(e.onPointerDownCapture,$.onPointerDownCapture)})});hg.displayName=cA;var fA="DismissableLayerBranch",pA=f.forwardRef((e,t)=>{const n=f.useContext(Q0),s=f.useRef(null),i=Fn(t,s);return f.useEffect(()=>{const l=s.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),r.jsx(mn.div,{...e,ref:i})});pA.displayName=fA;function mA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e),s=f.useRef(!1),i=f.useRef(()=>{});return f.useEffect(()=>{const l=u=>{if(u.target&&!s.current){let p=function(){Z0(uA,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=p,t.addEventListener("click",i.current,{once:!0})):p()}else t.removeEventListener("click",i.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function hA(e,t=globalThis==null?void 0:globalThis.document){const n=Ko(e),s=f.useRef(!1);return f.useEffect(()=>{const i=l=>{l.target&&!s.current&&Z0(dA,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function kv(){const e=new CustomEvent(hh);document.dispatchEvent(e)}function Z0(e,t,n,{discrete:s}){const i=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),s?aA(i,l):i.dispatchEvent(l)}var hm="focusScope.autoFocusOnMount",gm="focusScope.autoFocusOnUnmount",Sv={bubbles:!1,cancelable:!0},gA="FocusScope",ek=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...c}=e,[u,p]=f.useState(null),m=Ko(i),h=Ko(l),x=f.useRef(null),y=Fn(t,j=>p(j)),b=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let j=function(N){if(b.paused||!u)return;const P=N.target;u.contains(P)?x.current=P:no(x.current,{select:!0})},w=function(N){if(b.paused||!u)return;const P=N.relatedTarget;P!==null&&(u.contains(P)||no(x.current,{select:!0}))},k=function(N){if(document.activeElement===document.body)for(const $ of N)$.removedNodes.length>0&&no(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",w);const E=new MutationObserver(k);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",w),E.disconnect()}}},[s,u,b.paused]),f.useEffect(()=>{if(u){Cv.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(hm,Sv);u.addEventListener(hm,m),u.dispatchEvent(k),k.defaultPrevented||(xA(jA(tk(u)),{select:!0}),document.activeElement===j&&no(u))}return()=>{u.removeEventListener(hm,m),setTimeout(()=>{const k=new CustomEvent(gm,Sv);u.addEventListener(gm,h),u.dispatchEvent(k),k.defaultPrevented||no(j??document.body,{select:!0}),u.removeEventListener(gm,h),Cv.remove(b)},0)}}},[u,m,h,b]);const C=f.useCallback(j=>{if(!n&&!s||b.paused)return;const w=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(w&&k){const E=j.currentTarget,[N,P]=yA(E);N&&P?!j.shiftKey&&k===P?(j.preventDefault(),n&&no(N,{select:!0})):j.shiftKey&&k===N&&(j.preventDefault(),n&&no(P,{select:!0})):k===E&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(mn.div,{tabIndex:-1,...c,ref:y,onKeyDown:C})});ek.displayName=gA;function xA(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(no(s,{select:t}),document.activeElement!==n)return}function yA(e){const t=tk(e),n=Nv(t,e),s=Nv(t.reverse(),e);return[n,s]}function tk(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const i=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||i?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Nv(e,t){for(const n of e)if(!bA(n,{upTo:t}))return n}function bA(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 vA(e){return e instanceof HTMLInputElement&&"select"in e}function no(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&vA(e)&&t&&e.select()}}var Cv=wA();function wA(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ev(e,t),e.unshift(t)},remove(t){var n;e=Ev(e,t),(n=e[0])==null||n.resume()}}}function Ev(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function jA(e){return e.filter(t=>t.tagName!=="A")}var kA="Portal",gg=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[i,l]=f.useState(!1);ao(()=>l(!0),[]);const c=n||i&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?WT.createPortal(r.jsx(mn.div,{...s,ref:t}),c):null});gg.displayName=kA;function SA(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var Qo=e=>{const{present:t,children:n}=e,s=NA(t),i=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),l=Fn(s.ref,CA(i));return typeof n=="function"||s.isPresent?f.cloneElement(i,{ref:l}):null};Qo.displayName="Presence";function NA(e){const[t,n]=f.useState(),s=f.useRef(null),i=f.useRef(e),l=f.useRef("none"),c=e?"mounted":"unmounted",[u,p]=SA(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=Su(s.current);l.current=u==="mounted"?m:"none"},[u]),ao(()=>{const m=s.current,h=i.current;if(h!==e){const y=l.current,b=Su(m);e?p("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?p("UNMOUNT"):p(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,p]),ao(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,x=b=>{const j=Su(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(p("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},y=b=>{b.target===t&&(l.current=Su(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",x),t.addEventListener("animationend",x),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",x),t.removeEventListener("animationend",x)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:f.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Su(e){return(e==null?void 0:e.animationName)||"none"}function CA(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var xm=0;function EA(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Tv()),document.body.insertAdjacentElement("beforeend",e[1]??Tv()),xm++,()=>{xm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xm--}},[])}function Tv(){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 is=function(){return is=Object.assign||function(t){for(var n,s=1,i=arguments.length;s<i;s++){n=arguments[s];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},is.apply(this,arguments)};function nk(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 i=0,s=Object.getOwnPropertySymbols(e);i<s.length;i++)t.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(e,s[i])&&(n[s[i]]=e[s[i]]);return n}function TA(e,t,n){if(n||arguments.length===2)for(var s=0,i=t.length,l;s<i;s++)(l||!(s in t))&&(l||(l=Array.prototype.slice.call(t,0,s)),l[s]=t[s]);return e.concat(l||Array.prototype.slice.call(t))}var Wu="right-scroll-bar-position",Ku="width-before-scroll-bar",PA="with-scroll-bars-hidden",RA="--removed-body-scroll-bar-size";function ym(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function AA(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var i=n.value;i!==s&&(n.value=s,n.callback(s,i))}}}})[0];return n.callback=t,n.facade}var DA=typeof window<"u"?f.useLayoutEffect:f.useEffect,Pv=new WeakMap;function $A(e,t){var n=AA(null,function(s){return e.forEach(function(i){return ym(i,s)})});return DA(function(){var s=Pv.get(n);if(s){var i=new Set(s),l=new Set(e),c=n.current;i.forEach(function(u){l.has(u)||ym(u,null)}),l.forEach(function(u){i.has(u)||ym(u,c)})}Pv.set(n,e)},[e]),n}function LA(e){return e}function OA(e,t){t===void 0&&(t=LA);var n=[],s=!1,i={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(l){var c=t(l,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(l){for(s=!0;n.length;){var c=n;n=[],c.forEach(l)}n={push:function(u){return l(u)},filter:function(){return n}}},assignMedium:function(l){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(l),c=n}var p=function(){var h=c;c=[],h.forEach(l)},m=function(){return Promise.resolve().then(p)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return i}function IA(e){e===void 0&&(e={});var t=OA(null);return t.options=is({async:!0,ssr:!1},e),t}var rk=function(e){var t=e.sideCar,n=nk(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 f.createElement(s,is({},n))};rk.isSideCarExport=!0;function _A(e,t){return e.useMedium(t),rk}var sk=IA(),bm=function(){},Ud=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:bm,onWheelCapture:bm,onTouchMoveCapture:bm}),i=s[0],l=s[1],c=e.forwardProps,u=e.children,p=e.className,m=e.removeScrollBar,h=e.enabled,x=e.shards,y=e.sideCar,b=e.noRelative,C=e.noIsolation,j=e.inert,w=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,N=e.gapMode,P=nk(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),$=y,T=$A([n,t]),D=is(is({},P),i);return f.createElement(f.Fragment,null,h&&f.createElement($,{sideCar:sk,removeScrollBar:m,shards:x,noRelative:b,noIsolation:C,inert:j,setCallbacks:l,allowPinchZoom:!!w,lockRef:n,gapMode:N}),c?f.cloneElement(f.Children.only(u),is(is({},D),{ref:T})):f.createElement(E,is({},D,{className:p,ref:T}),u))});Ud.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ud.classNames={fullWidth:Ku,zeroRight:Wu};var MA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=MA();return t&&e.setAttribute("nonce",t),e}function zA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function BA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var UA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=FA())&&(zA(t,n),BA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},VA=function(){var e=UA();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ok=function(){var e=VA(),t=function(n){var s=n.styles,i=n.dynamic;return e(s,i),null};return t},HA={left:0,top:0,right:0,gap:0},vm=function(e){return parseInt(e||"",10)||0},WA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[vm(n),vm(s),vm(i)]},KA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return HA;var t=WA(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])}},qA=ok(),ra="data-scroll-locked",GA=function(e,t,n,s){var i=e.left,l=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
471
|
+
.`.concat(PA,` {
|
|
472
|
+
overflow: hidden `).concat(s,`;
|
|
473
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
474
|
+
}
|
|
475
|
+
body[`).concat(ra,`] {
|
|
476
|
+
overflow: hidden `).concat(s,`;
|
|
477
|
+
overscroll-behavior: contain;
|
|
478
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
479
|
+
padding-left: `.concat(i,`px;
|
|
480
|
+
padding-top: `).concat(l,`px;
|
|
481
|
+
padding-right: `).concat(c,`px;
|
|
482
|
+
margin-left:0;
|
|
483
|
+
margin-top:0;
|
|
484
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
485
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.`).concat(Wu,` {
|
|
489
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.`).concat(Ku,` {
|
|
493
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.`).concat(Wu," .").concat(Wu,` {
|
|
497
|
+
right: 0 `).concat(s,`;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.`).concat(Ku," .").concat(Ku,` {
|
|
501
|
+
margin-right: 0 `).concat(s,`;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
body[`).concat(ra,`] {
|
|
505
|
+
`).concat(RA,": ").concat(u,`px;
|
|
506
|
+
}
|
|
507
|
+
`)},Rv=function(){var e=parseInt(document.body.getAttribute(ra)||"0",10);return isFinite(e)?e:0},YA=function(){f.useEffect(function(){return document.body.setAttribute(ra,(Rv()+1).toString()),function(){var e=Rv()-1;e<=0?document.body.removeAttribute(ra):document.body.setAttribute(ra,e.toString())}},[])},JA=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,i=s===void 0?"margin":s;YA();var l=f.useMemo(function(){return KA(i)},[i]);return f.createElement(qA,{styles:GA(l,!t,i,n?"":"!important")})},gh=!1;if(typeof window<"u")try{var Nu=Object.defineProperty({},"passive",{get:function(){return gh=!0,!0}});window.addEventListener("test",Nu,Nu),window.removeEventListener("test",Nu,Nu)}catch{gh=!1}var Ii=gh?{passive:!1}:!1,XA=function(e){return e.tagName==="TEXTAREA"},ik=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!XA(e)&&n[t]==="visible")},QA=function(e){return ik(e,"overflowY")},ZA=function(e){return ik(e,"overflowX")},Av=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var i=ak(e,s);if(i){var l=lk(e,s),c=l[1],u=l[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},e3=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},t3=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},ak=function(e,t){return e==="v"?QA(t):ZA(t)},lk=function(e,t){return e==="v"?e3(t):t3(t)},n3=function(e,t){return e==="h"&&t==="rtl"?-1:1},r3=function(e,t,n,s,i){var l=n3(e,window.getComputedStyle(t).direction),c=l*s,u=n.target,p=t.contains(u),m=!1,h=c>0,x=0,y=0;do{if(!u)break;var b=lk(e,u),C=b[0],j=b[1],w=b[2],k=j-w-l*C;(C||k)&&ak(e,u)&&(x+=k,y+=C);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!p&&u!==document.body||p&&(t.contains(u)||t===u));return(h&&Math.abs(x)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Cu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dv=function(e){return[e.deltaX,e.deltaY]},$v=function(e){return e&&"current"in e?e.current:e},s3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},o3=function(e){return`
|
|
508
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
509
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
510
|
+
`)},i3=0,_i=[];function a3(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),i=f.useState(i3++)[0],l=f.useState(ok)[0],c=f.useRef(e);f.useEffect(function(){c.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var j=TA([e.lockRef.current],(e.shards||[]).map($v),!0).filter(Boolean);return j.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),j.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(j,w){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Cu(j),E=n.current,N="deltaX"in j?j.deltaX:E[0]-k[0],P="deltaY"in j?j.deltaY:E[1]-k[1],$,T=j.target,D=Math.abs(N)>Math.abs(P)?"h":"v";if("touches"in j&&D==="h"&&T.type==="range")return!1;var L=window.getSelection(),Y=L&&L.anchorNode,X=Y?Y===T||Y.contains(T):!1;if(X)return!1;var I=Av(D,T);if(!I)return!0;if(I?$=D:($=D==="v"?"h":"v",I=Av(D,T)),!I)return!1;if(!s.current&&"changedTouches"in j&&(N||P)&&(s.current=$),!$)return!0;var U=s.current||$;return r3(U,w,j,U==="h"?N:P)},[]),p=f.useCallback(function(j){var w=j;if(!(!_i.length||_i[_i.length-1]!==l)){var k="deltaY"in w?Dv(w):Cu(w),E=t.current.filter(function($){return $.name===w.type&&($.target===w.target||w.target===$.shadowParent)&&s3($.delta,k)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var N=(c.current.shards||[]).map($v).filter(Boolean).filter(function($){return $.contains(w.target)}),P=N.length>0?u(w,N[0]):!c.current.noIsolation;P&&w.cancelable&&w.preventDefault()}}},[]),m=f.useCallback(function(j,w,k,E){var N={name:j,delta:w,target:k,should:E,shadowParent:l3(k)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(P){return P!==N})},1)},[]),h=f.useCallback(function(j){n.current=Cu(j),s.current=void 0},[]),x=f.useCallback(function(j){m(j.type,Dv(j),j.target,u(j,e.lockRef.current))},[]),y=f.useCallback(function(j){m(j.type,Cu(j),j.target,u(j,e.lockRef.current))},[]);f.useEffect(function(){return _i.push(l),e.setCallbacks({onScrollCapture:x,onWheelCapture:x,onTouchMoveCapture:y}),document.addEventListener("wheel",p,Ii),document.addEventListener("touchmove",p,Ii),document.addEventListener("touchstart",h,Ii),function(){_i=_i.filter(function(j){return j!==l}),document.removeEventListener("wheel",p,Ii),document.removeEventListener("touchmove",p,Ii),document.removeEventListener("touchstart",h,Ii)}},[]);var b=e.removeScrollBar,C=e.inert;return f.createElement(f.Fragment,null,C?f.createElement(l,{styles:o3(i)}):null,b?f.createElement(JA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function l3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const c3=_A(sk,a3);var ck=f.forwardRef(function(e,t){return f.createElement(Ud,is({},e,{ref:t,sideCar:c3}))});ck.classNames=Ud.classNames;var u3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Mi=new WeakMap,Eu=new WeakMap,Tu={},wm=0,uk=function(e){return e&&(e.host||uk(e.parentNode))},d3=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=uk(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})},f3=function(e,t,n,s){var i=d3(t,Array.isArray(e)?e:[e]);Tu[n]||(Tu[n]=new WeakMap);var l=Tu[n],c=[],u=new Set,p=new Set(i),m=function(x){!x||u.has(x)||(u.add(x),m(x.parentNode))};i.forEach(m);var h=function(x){!x||p.has(x)||Array.prototype.forEach.call(x.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),C=b!==null&&b!=="false",j=(Mi.get(y)||0)+1,w=(l.get(y)||0)+1;Mi.set(y,j),l.set(y,w),c.push(y),j===1&&C&&Eu.set(y,!0),w===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(),wm++,function(){c.forEach(function(x){var y=Mi.get(x)-1,b=l.get(x)-1;Mi.set(x,y),l.set(x,b),y||(Eu.has(x)||x.removeAttribute(s),Eu.delete(x)),b||x.removeAttribute(n)}),wm--,wm||(Mi=new WeakMap,Mi=new WeakMap,Eu=new WeakMap,Tu={})}},p3=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),i=u3(e);return i?(s.push.apply(s,Array.from(i.querySelectorAll("[aria-live], script"))),f3(s,i,n,"aria-hidden")):function(){return null}};function m3(e){const t=h3(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(x3);if(p){const m=p.props.children,h=u.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function h3(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=b3(i),u=y3(l,i.props);return i.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(i,u)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var g3=Symbol("radix.slottable");function x3(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===g3}function y3(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...u)=>{const p=l(...u);return i(...u),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function b3(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vd="Dialog",[dk,fk]=Xo(Vd),[v3,Xr]=dk(Vd),pk=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:i,onOpenChange:l,modal:c=!0}=e,u=f.useRef(null),p=f.useRef(null),[m,h]=Bd({prop:s,defaultProp:i??!1,onChange:l,caller:Vd});return r.jsx(v3,{scope:t,triggerRef:u,contentRef:p,contentId:na(),titleId:na(),descriptionId:na(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(x=>!x),[h]),modal:c,children:n})};pk.displayName=Vd;var mk="DialogTrigger",hk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Xr(mk,n),l=Fn(t,i.triggerRef);return r.jsx(mn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":bg(i.open),...s,ref:l,onClick:qt(e.onClick,i.onOpenToggle)})});hk.displayName=mk;var xg="DialogPortal",[w3,gk]=dk(xg,{forceMount:void 0}),xk=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:i}=e,l=Xr(xg,t);return r.jsx(w3,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:i,children:c})}))})};xk.displayName=xg;var ad="DialogOverlay",yk=f.forwardRef((e,t)=>{const n=gk(ad,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,l=Xr(ad,e.__scopeDialog);return l.modal?r.jsx(Qo,{present:s||l.open,children:r.jsx(k3,{...i,ref:t})}):null});yk.displayName=ad;var j3=m3("DialogOverlay.RemoveScroll"),k3=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Xr(ad,n);return r.jsx(ck,{as:j3,allowPinchZoom:!0,shards:[i.contentRef],children:r.jsx(mn.div,{"data-state":bg(i.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),qo="DialogContent",bk=f.forwardRef((e,t)=>{const n=gk(qo,e.__scopeDialog),{forceMount:s=n.forceMount,...i}=e,l=Xr(qo,e.__scopeDialog);return r.jsx(Qo,{present:s||l.open,children:l.modal?r.jsx(S3,{...i,ref:t}):r.jsx(N3,{...i,ref:t})})});bk.displayName=qo;var S3=f.forwardRef((e,t)=>{const n=Xr(qo,e.__scopeDialog),s=f.useRef(null),i=Fn(t,n.contentRef,s);return f.useEffect(()=>{const l=s.current;if(l)return p3(l)},[]),r.jsx(vk,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qt(e.onCloseAutoFocus,l=>{var c;l.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:qt(e.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&l.preventDefault()}),onFocusOutside:qt(e.onFocusOutside,l=>l.preventDefault())})}),N3=f.forwardRef((e,t)=>{const n=Xr(qo,e.__scopeDialog),s=f.useRef(!1),i=f.useRef(!1);return r.jsx(vk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,l),l.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),l.preventDefault()),s.current=!1,i.current=!1},onInteractOutside:l=>{var p,m;(p=e.onInteractOutside)==null||p.call(e,l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const c=l.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),vk=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:l,...c}=e,u=Xr(qo,n),p=f.useRef(null),m=Fn(t,p);return EA(),r.jsxs(r.Fragment,{children:[r.jsx(ek,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:i,onUnmountAutoFocus:l,children:r.jsx(hg,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":bg(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(E3,{titleId:u.titleId}),r.jsx(P3,{contentRef:p,descriptionId:u.descriptionId})]})]})}),yg="DialogTitle",wk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Xr(yg,n);return r.jsx(mn.h2,{id:i.titleId,...s,ref:t})});wk.displayName=yg;var jk="DialogDescription",kk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Xr(jk,n);return r.jsx(mn.p,{id:i.descriptionId,...s,ref:t})});kk.displayName=jk;var Sk="DialogClose",Nk=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,i=Xr(Sk,n);return r.jsx(mn.button,{type:"button",...s,ref:t,onClick:qt(e.onClick,()=>i.onOpenChange(!1))})});Nk.displayName=Sk;function bg(e){return e?"open":"closed"}var Ck="DialogTitleWarning",[C3,Ek]=qR(Ck,{contentName:qo,titleName:yg,docsSlug:"dialog"}),E3=({titleId:e})=>{const t=Ek(Ck),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
511
|
+
|
|
512
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
513
|
+
|
|
514
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return f.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},T3="DialogDescriptionWarning",P3=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ek(T3).contentName}}.`;return f.useEffect(()=>{var l;const i=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Tk=pk,Pk=hk,Rk=xk,vg=yk,wg=bk,jg=wk,kg=kk,Sg=Nk;const ir=Tk,R3=Pk,A3=Rk,D3=Sg,Ak=f.forwardRef(({className:e,...t},n)=>r.jsx(vg,{ref:n,className:Te("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));Ak.displayName=vg.displayName;const Kn=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(A3,{children:[r.jsx(Ak,{}),r.jsx(wg,{ref:s,className:Te("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})]}));Kn.displayName=wg.displayName;function Qr({className:e,...t}){return r.jsx("div",{className:Te("flex flex-col space-y-2 text-left",e),...t})}function $s({className:e,...t}){return r.jsx("div",{className:Te("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const qn=f.forwardRef(({className:e,...t},n)=>r.jsx(jg,{ref:n,className:Te("text-lg font-semibold tracking-tight text-foreground",e),...t}));qn.displayName=jg.displayName;const hs=f.forwardRef(({className:e,...t},n)=>r.jsx(kg,{ref:n,className:Te("text-sm leading-6 text-muted-foreground",e),...t}));hs.displayName=kg.displayName;const $3=-1,L3=-40;function jm(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,i=-2,l=0;for(let c=0;c<e.length;c++){const u=e[c];let p=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===i+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}l>0&&(n+=Math.max(L3,l*$3)),i=s,l=0,s++,p=!0;break}else l++,s++;if(!p)return-1/0}return n}const Lv={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Ng(e,t,n=50){const s=e.toLowerCase();if(!s)return t.slice(0,n).map(c=>({...c,score:0}));const l=t.map(c=>{var x;const u=jm(s,c.title.toLowerCase())*1,p=c.subtitle?jm(s,c.subtitle.toLowerCase())*.5:-1/0,m=(x=c.keywords)!=null&&x.length?jm(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,p,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return l.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:(Lv[c.type]??99)-(Lv[u.type]??99)),l.slice(0,n)}const O3={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function I3({entries:e}){const{paletteOpen:t,closePalette:n}=po(),s=Dt(),[i,l]=f.useState(""),[c,u]=f.useState(0),p=f.useRef(null),m=f.useMemo(()=>Ng(i,e,50),[i,e]);f.useEffect(()=>{u(0)},[i,t]),f.useEffect(()=>{t||l("")},[t]),f.useEffect(()=>{var b;const y=(b=p.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 x(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(ir,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs(Kn,{className:"max-w-xl p-0 gap-0",children:[r.jsx(qn,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:i,onChange:y=>l(y.target.value),onKeyDown:x,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:p,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:i?"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:O3[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 _3({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(XT,{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 M3({step:e,initialValue:t,disabled:n,onSubmit:s}){const[i,l]=f.useState(t??""),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{var C;(C=p.current)==null||C.focus()},[]);const m=i.trim(),h=e.required!==!1,x=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!x;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:p,type:"text",value:i,onChange:C=>{l(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&&x?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 F3({step:e,disabled:t,onSubmit:n}){const[s,i]=f.useState({phase:"loading"}),[l,c]=f.useState(""),[u,p]=f.useState(0),[m,h]=f.useState(0),x=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var j;(j=x.current)==null||j.focus()},[]),f.useEffect(()=>{let j=!1;return i({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(w=>{j||i({phase:"loaded",options:w})}).catch(w=>{if(j)return;const k=w instanceof Error?w.message:"Failed to load options";i({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=f.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(w=>({type:"option",title:w.label,subtitle:w.hint,keywords:[w.value],option:w}));return Ng(l,j,100)},[s,l]);f.useEffect(()=>{p(0)},[b.length]),f.useEffect(()=>{var w;const j=(w=y.current)==null?void 0:w.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(),p(w=>Math.min(b.length-1,w+1));else if(j.key==="ArrowUp")j.preventDefault(),p(w=>Math.max(0,w-1));else if(j.key==="Enter"){j.preventDefault();const w=b[u];w&&n(w.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:x,type:"text",value:l,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,w)=>{const k=w===u;return r.jsxs("button",{type:"button","data-picker-idx":w,onClick:()=>n(j.option.value),onMouseEnter:()=>p(w),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 z3({entries:e}){var ue,ge;const t=Dt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:i,bindAction:l,findConflict:c,pendingActionKind:u,consumePendingActionKind:p}=po(),[m,h]=f.useState(""),[x,y]=f.useState(0),[b,C]=f.useState(null),[j,w]=f.useState(""),[k,E]=f.useState(null),[N,P]=f.useState(null),[$,T]=f.useState(!1),[D,L]=f.useState(null),Y=f.useRef(null),X=f.useMemo(()=>e.map(V=>({type:V.group.toLowerCase(),title:V.title,subtitle:V.subtitle,keywords:V.keywords,action:V})),[e]),I=f.useMemo(()=>Ng(m,X,50),[m,X]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),C(null),w(""),E(null),P(null),T(!1),L(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const V=p();if(!V)return;const oe=e.find(me=>me.bindableKind===V);oe&&U(oe)},[n,u]),f.useEffect(()=>{var oe;const V=(oe=Y.current)==null?void 0:oe.querySelector(`[data-palette-idx="${x}"]`);V==null||V.scrollIntoView({block:"nearest"})},[x]);async function U(V){if(!$){if(V.flow&&V.flow.steps.length>0){E({action:V,stepIndex:0,values:{}}),L(null);return}if(V.requiresInput){C(V),w(""),L(null);return}if(V.run){T(!0),L(null);try{await V.run(),s()}catch(oe){L(oe instanceof Error?oe.message:"Action failed")}finally{T(!1)}}}}async function ne(V){if(!k)return;const oe=k.action.flow.steps[k.stepIndex],me={...k.values,[oe.id]:V};if(k.stepIndex+1<k.action.flow.steps.length){E({action:k.action,stepIndex:k.stepIndex+1,values:me});return}T(!0),L(null);try{await k.action.flow.submit(me,{navigate:t}),s()}catch(ve){L(ve instanceof Error?ve.message:"Action failed")}finally{T(!1)}}function F(){if(k&&!$){if(k.stepIndex===0){E(null),L(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),L(null)}}async function H(){if($||!(b!=null&&b.requiresInput))return;const V=j.trim();if(V){T(!0),L(null);try{await b.requiresInput.runWithInput(V),s()}catch(oe){L(oe instanceof Error?oe.message:"Action failed")}finally{T(!1)}}}function ee(V){if(V.key==="ArrowDown")V.preventDefault(),y(oe=>Math.min(I.length-1,oe+1));else if(V.key==="ArrowUp")V.preventDefault(),y(oe=>Math.max(0,oe-1));else if(V.key==="Enter"&&(V.metaKey||V.ctrlKey)){V.preventDefault();const oe=I[x];oe!=null&&oe.action.bindableKind&&P({action:oe.action,combo:null,conflict:null,saving:!1,error:null})}else if(V.key==="Enter"){V.preventDefault();const oe=I[x];oe&&U(oe.action)}}function ce(V){V.key==="Enter"?(V.preventDefault(),H()):V.key==="Escape"&&(V.preventDefault(),C(null),w(""))}function _(V){if(!N||V.key==="Escape"||V.key==="Enter"&&!N.combo)return;V.preventDefault(),V.stopPropagation();const oe=U0(V.nativeEvent);if(!oe)return;const me=c(oe,N.action.bindableKind);P({...N,combo:oe,conflict:me,error:null})}async function W(){var V;if(!(!N||!N.combo||!N.action.bindableKind)){if((V=N.conflict)!=null&&V.description){P({...N,error:`Reserved: ${N.conflict.description}`});return}P({...N,saving:!0,error:null});try{await l(N.action.bindableKind,N.combo),P(null)}catch(oe){P({...N,saving:!1,error:oe instanceof Error?oe.message:"Failed to save binding"})}}}const R=b!==null,M=k!==null,Q=N!==null,O=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(ir,{open:n,onOpenChange:V=>V?null:s(),children:r.jsxs(Kn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:V=>{if(!$){if(Q){V.preventDefault(),P(null);return}if(M){V.preventDefault(),F();return}R&&(V.preventDefault(),C(null),w(""),L(null))}},children:[r.jsx(qn,{className:"sr-only",children:"Actions palette"}),Q&&N?r.jsxs("div",{onKeyDown:_,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(dh,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",N.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:N.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:us(N.combo)}),(ue=N.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",N.conflict.description," (cannot bind)"]}):(ge=N.conflict)!=null&&ge.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',N.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."}),N.error?r.jsx("div",{className:"text-sm text-destructive",children:N.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:N.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void W(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:V=>{V.key==="Enter"&&W()}})]}):M&&O&&k?r.jsxs(r.Fragment,{children:[r.jsx(_3,{label:`${k.action.title} · ${O.label}`,onBack:F,disabled:$,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),O.kind==="text"?r.jsx(M3,{step:O,initialValue:k.values[O.id],disabled:$,onSubmit:ne}):r.jsx(F3,{step:O,disabled:$,onSubmit:ne}),D?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):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:$?"Running…":""})]})]}):R?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:V=>w(V.target.value),onKeyDown:ce,placeholder:b.requiresInput.placeholder,disabled:$,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"}),D?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):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:$?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:V=>h(V.target.value),onKeyDown:ee,placeholder:"Run an action: new project, new todo, toggle…",disabled:$,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"}),D?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:D}):null,r.jsx("div",{ref:Y,className:"max-h-[60vh] overflow-y-auto p-1",children:I.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"}):I.map((V,oe)=>{const me=oe===x,ve=V.action.bindableKind,ke=ve?i[ve]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":oe,onClick:()=>U(V.action),onMouseEnter:()=>y(oe),disabled:$,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${me?"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:V.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:V.action.title}),V.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:V.action.subtitle}):null,ke?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:us(ke)}):null,ve?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:he=>{he.preventDefault(),he.stopPropagation(),P({action:V.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 ${me?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(dh,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},V.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:$?"Running…":`${I.length} action${I.length===1?"":"s"}`})]})]})]})})}const B3=[{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 U3(e){const t=rr(e);return t?B3.find(n=>n.combo===t)??null:null}const xl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},V3={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},H3=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function Ov(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${us(t)} then ${us(n)}`}return us(e)}function W3(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:i}=po(),l=f.useMemo(()=>{const p=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&p.add(rr(m));return p},[s]),c=f.useMemo(()=>{if(!e)return new Map;const p=n(),m=new Map;for(const h of p){if(l.has(rr(h.keys)))continue;const x=m.get(h.scope)??[];x.push({keys:h.keys,description:h.description}),m.set(h.scope,x)}return m},[e,n,l]),u=f.useMemo(()=>{const p=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const x=i.find(y=>y.bindableKind===m);p.push({kind:m,combo:h,title:x?x.title:m})}return p},[s,i]);return r.jsx(ir,{open:e,onOpenChange:p=>p?null:t(),children:r.jsxs(Kn,{className:"max-w-2xl",children:[r.jsx(qn,{children:"Keyboard shortcuts"}),r.jsxs(hs,{children:["Press Esc to close. ",us("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:[H3.map(p=>{const m=c.get(p);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:V3[p]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,x)=>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:Ov(h.keys)})]},`${p}-${h.keys}-${x}`))})]},p)}),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(p=>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:p.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:Ov(p.combo)})]},`custom-${p.kind}`))})]}):null]})]})})}const Cg={bindings:{},custom:!1};let Pl=null,Fi=null;const xh=new Set;function Dk(e){Pl=e;for(const t of xh)t(e)}function Eg(e){if(!e||typeof e!="object")return Cg;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[s,i]of Object.entries(t.bindings)){if(!RR(s)||typeof i!="string"||i.trim()==="")continue;const l=rr(i);l&&(n[s]=l)}return{bindings:n,custom:t.custom===!0}}function K3(){return Pl?Promise.resolve(Pl):Fi||(Fi=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Eg(e);return Pl=t,Fi=null,t}).catch(()=>(Fi=null,Cg)),Fi)}function q3(){const[e,t]=f.useState(()=>Pl??Cg);return f.useEffect(()=>{let n=!1;return K3().then(s=>{n||t(s)}),xh.add(t),()=>{n=!0,xh.delete(t)}},[]),e}async function Iv(e){const t={};for(const i of Fd){const l=e[i];if(typeof l!="string")continue;const c=rr(l);c&&(t[i]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(i.error??"Failed to save hotkey bindings")}const s=Eg(await n.json());return Dk(s),s}async function G3(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Eg(await e.json());return Dk(t),t}const _v=1500;function Y3(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const $k=f.createContext(null);function J3({children:e}){const{toggleTheme:t}=ug(),n=Wn(),s=Dt(),i=Y3(n.pathname),[l,c]=f.useState(!1),u=Jo(l),p=Md(l),m=B0(l),h=dg(l),x=V0(l),y=f.useMemo(()=>{var nt,Ke,gt,Pt;const G=u.data??[],Ie=((nt=p.data)==null?void 0:nt.assignments)??[],Se=((Ke=m.data)==null?void 0:Ke.playbooks)??[],Oe=((gt=h.data)==null?void 0:gt.sessions)??[],_e=(((Pt=x.data)==null?void 0:Pt.workspaces)??[]).flatMap(it=>it.items.map(ie=>({...ie,workspace:it.workspace})));return VR({projects:G,assignments:Ie,playbooks:Se,servers:Oe,todos:_e,wsPrefix:i})},[u.data,p.data,m.data,h.data,x.data,i]),C=f.useMemo(()=>C0(n.pathname),[n.pathname]).projectSlug,j=f.useMemo(()=>{var G;return C?((G=u.data)==null?void 0:G.find(Ie=>Ie.slug===C))??null:null},[u.data,C]),w=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,E=f.useMemo(()=>{var G;return KR({playbooks:((G=m.data)==null?void 0:G.playbooks)??[],projectSlug:C,currentProjectTitle:w,currentProjectWorkspace:k,wsPrefix:i,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,C,w,k,i,s,t]),N=f.useRef(new Map),P=f.useRef(["global"]),$=f.useRef({phase:"idle"}),T=f.useRef(null),D=f.useRef(1),[L,Y]=f.useState(!1),[X,I]=f.useState(!1),[U,ne]=f.useState(!1),[F,H]=f.useState(null);f.useEffect(()=>{(L||U)&&c(!0)},[L,U]);const{bindings:ee}=q3(),ce=f.useMemo(()=>OR(ee),[ee]),_=f.useCallback(G=>{const Ie=D.current++;return N.current.set(Ie,{...G,id:Ie}),Ie},[]),W=f.useCallback(G=>{N.current.delete(G)},[]),R=f.useCallback(G=>{P.current.push(G)},[]),M=f.useCallback(G=>{const Ie=P.current;for(let Se=Ie.length-1;Se>=0;Se--)if(Ie[Se]===G){Ie.splice(Se,1);return}},[]),Q=f.useCallback(()=>Y(!0),[]),O=f.useCallback(()=>Y(!1),[]),ue=f.useCallback(()=>I(!0),[]),ge=f.useCallback(()=>I(!1),[]),V=f.useCallback(()=>ne(!0),[]),oe=f.useCallback(()=>{ne(!1),H(null)},[]),me=f.useCallback(()=>Array.from(N.current.values()),[]),ve=f.useCallback(()=>{let G=null;return H(Ie=>(G=Ie,null)),G},[]),ke=f.useCallback(G=>{H(G),ne(!0)},[]),he=f.useCallback((G,Ie)=>{const Se=rr(G);if(!Se)return null;if($R(Se)){const Oe=U3(Se);return{description:(Oe==null?void 0:Oe.description)??"Reserved built-in shortcut"}}for(const[Oe,Xe]of Object.entries(ce))if(!(Ie&&Oe===Ie)&&Xe===Se)return{kind:Oe};return null},[ce]),Je=f.useCallback(async(G,Ie)=>{const Se=rr(Ie);if(!Se)throw new Error("Empty combo");const Oe=he(Se,G);if(Oe){const _e=Oe.description?`Reserved: ${Oe.description}`:`Already bound to "${Oe.kind}"`;throw new Error(_e)}const Xe={...ee,[G]:Se};return await Iv(Xe),Se},[ee,he]),Ye=f.useCallback(async G=>{if(!ee[G])return;const Ie={...ee};delete Ie[G],await Iv(Ie)},[ee]);f.useEffect(()=>{$.current={phase:"idle"},T.current!==null&&(window.clearTimeout(T.current),T.current=null)},[n.pathname]),f.useEffect(()=>{function G(_e){if(!(_e instanceof HTMLElement))return!1;const nt=_e.tagName;return!!(nt==="INPUT"||nt==="TEXTAREA"||nt==="SELECT"||_e.isContentEditable||_e.closest('[role="combobox"], [role="textbox"]'))}function Ie(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Se(){const _e=P.current;return _e[_e.length-1]??"global"}function Oe(_e){return _e.scope==="global"?!0:_e.scope===Se()}function Xe(_e){const nt=ku(_e,"Mod+k"),Ke=ku(_e,"Mod+Shift+k"),gt=_e.key==="Escape",Pt=nt||Ke||gt;if(Ie()&&!Pt||G(_e.target)&&!Pt)return;const it=$.current;if(it.phase==="awaiting-second")if(Date.now()-it.startedAt>_v)$.current={phase:"idle"},T.current!==null&&(window.clearTimeout(T.current),T.current=null);else{const pe=Array.from(N.current.values());for(const Z of pe){if(!Oe(Z))continue;const ye=Z.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&ku(_e,ye[1])&&!(Z.when&&!Z.when())){_e.preventDefault(),$.current={phase:"idle"},T.current!==null&&(window.clearTimeout(T.current),T.current=null),Z.handler(_e);return}}$.current={phase:"idle"},T.current!==null&&(window.clearTimeout(T.current),T.current=null)}const ie=Array.from(N.current.values());for(const q of ie){if(!Oe(q))continue;const pe=q.keys.split(" ");if(pe.length===1&&ku(_e,pe[0])&&!(q.when&&!q.when())){_e.preventDefault(),q.handler(_e);return}}_e.key==="g"&&!_e.metaKey&&!_e.ctrlKey&&!_e.altKey&&!_e.shiftKey&&Array.from(N.current.values()).some(pe=>Oe(pe)&&pe.keys.startsWith("g "))&&(_e.preventDefault(),$.current={phase:"awaiting-second",startedAt:Date.now()},T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{$.current={phase:"idle"},T.current=null},_v))}return window.addEventListener("keydown",Xe),()=>{window.removeEventListener("keydown",Xe),T.current!==null&&(window.clearTimeout(T.current),T.current=null)}},[]),f.useEffect(()=>{const G=_({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>W(G)},[_,W,t]),f.useEffect(()=>{const G=_({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>W(G)},[_,W,ue]),f.useEffect(()=>{const G=_({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(L){O();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||Q()}});return()=>W(G)},[_,W,Q,O,L]),f.useEffect(()=>{const G=_({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(U){oe();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||V()}});return()=>W(G)},[_,W,V,oe,U]),f.useEffect(()=>{const Ie=[{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(Se=>_({keys:`g ${Se.suffix}`,scope:"global",description:Se.desc,handler:()=>s(Vu(Se.basePath,i))}));return()=>Ie.forEach(W)},[_,W,s,i]),f.useEffect(()=>{const G=[];for(const[Ie,Se]of Object.entries(ce)){if(!Se)continue;const Oe=E.find(_e=>_e.bindableKind===Ie),Xe=Oe?`Custom: ${Oe.title}`:`Custom: ${Ie}`;G.push(_({keys:Se,scope:"global",description:Xe,handler:()=>{H(Ie),ne(!0)}}))}return()=>G.forEach(W)},[_,W,ce,E]);const ot=f.useMemo(()=>({register:_,unregister:W,pushScope:R,popScope:M,openPalette:Q,closePalette:O,paletteOpen:L,openCheatsheet:ue,closeCheatsheet:ge,cheatsheetOpen:X,openActionsPalette:V,closeActionsPalette:oe,actionsPaletteOpen:U,listBindings:me,wsPrefix:i,paletteEntries:y,actionEntries:E,userBindings:ee,customBindings:ce,bindAction:Je,unbindAction:Ye,findConflict:he,openActionsPaletteWithAction:ke,pendingActionKind:F,consumePendingActionKind:ve}),[_,W,R,M,Q,O,L,ue,ge,X,V,oe,U,me,i,y,E,ee,ce,Je,Ye,he,ke,F,ve]);return r.jsxs($k.Provider,{value:ot,children:[e,r.jsx(I3,{entries:y}),r.jsx(z3,{entries:E}),r.jsx(W3,{})]})}function po(){const e=f.useContext($k);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Ht({keys:e,handler:t,scope:n="global",description:s,when:i,enabled:l=!0}){const{register:c,unregister:u}=po(),p=f.useRef(t),m=f.useRef(i);f.useEffect(()=>{p.current=t,m.current=i},[t,i]),f.useEffect(()=>{if(!l)return;const h=c({keys:e,handler:x=>p.current(x),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,l])}function mo(e){const{pushScope:t,popScope:n}=po();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function ic(e,t){const[n,s]=f.useState(e.length===0?-1:0),i=Wn();f.useEffect(()=>{s(e.length===0?-1:0)},[i.pathname]),f.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const p=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",p===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Ht({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))}),Ht({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Ht({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Ht({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 l=f.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:l}}function X3({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const i=ln(),{resolvedTheme:l,toggleTheme:c}=ug(),{openPalette:u}=po();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(gP,{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((p,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Ce,{to:p.path,className:"hover:text-foreground",children:p.label})]},p.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(fo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:us("Mod+k")})]}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ce,{className:"shell-action",to:`${i}/create/project`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ce,{className:"shell-action",to:`${i}/projects/${n}/create/assignment`,children:[r.jsx(rn,{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:[l==="dark"?r.jsx(CP,{className:"h-4 w-4"}):r.jsx(xP,{className:"h-4 w-4"}),r.jsx("span",{children:l==="dark"?"Light":"Dark"})]})]})]})})}const ld="_ungrouped",Q3=256;function Z3(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const i=s.trim();i.length!==0&&(i.length>Q3||/[\r\n]/.test(i)||t.has(i)||(t.add(i),n.push(i)))}return n}function eD(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function tD(e,t){return t.includes(e)}const Tg={hidden:[],custom:!1};let Ps=null,_o=null,Bl=0;const yh=new Set;function Lk(e){Ps=e;for(const t of yh)t(e)}function Pg(e){if(!e||typeof e!="object")return Tg;const t=e;return{hidden:Z3(t.hidden),custom:t.custom===!0}}function nD(){if(Ps)return Promise.resolve({value:Ps,ok:!0});if(_o)return _o;const e=++Bl;return _o=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{_o=null;const n=Pg(t);return e!==Bl?{value:Ps??n,ok:!0}:(Ps=n,{value:n,ok:!0})}).catch(()=>(_o=null,{value:Tg,ok:!1})),_o}function Ok(){const[e,t]=f.useState(()=>Ps??Tg),[n,s]=f.useState(()=>Ps===null),[i,l]=f.useState(!1),[c,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(Ps===null),nD().then(h=>{m||(t(h.value),s(!1),l(!h.ok))}),yh.add(t),()=>{m=!0,yh.delete(t)}},[c]);function p(){rD(),u(m=>m+1)}return{...e,loading:n,error:i,reload:p}}function rD(){Ps=null,_o=null,++Bl}async function sD(e){++Bl;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=Pg(await t.json());return Lk(n),n}async function oD(){++Bl;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=Pg(await e.json());return Lk(t),t}var iD=Symbol("radix.slottable");function aD(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=iD,t}var Ik="AlertDialog",[lD]=Xo(Ik,[fk]),Ls=fk(),_k=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ls(t);return r.jsx(Tk,{...s,...n,modal:!0})};_k.displayName=Ik;var cD="AlertDialogTrigger",uD=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Ls(n);return r.jsx(Pk,{...i,...s,ref:t})});uD.displayName=cD;var dD="AlertDialogPortal",Mk=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ls(t);return r.jsx(Rk,{...s,...n})};Mk.displayName=dD;var fD="AlertDialogOverlay",Fk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Ls(n);return r.jsx(vg,{...i,...s,ref:t})});Fk.displayName=fD;var sa="AlertDialogContent",[pD,mD]=lD(sa),hD=aD("AlertDialogContent"),zk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...i}=e,l=Ls(n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return r.jsx(C3,{contentName:sa,titleName:Bk,docsSlug:"alert-dialog",children:r.jsx(pD,{scope:n,cancelRef:p,children:r.jsxs(wg,{role:"alertdialog",...l,...i,ref:u,onOpenAutoFocus:qt(i.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=p.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(hD,{children:s}),r.jsx(xD,{contentRef:c})]})})})});zk.displayName=sa;var Bk="AlertDialogTitle",Uk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Ls(n);return r.jsx(jg,{...i,...s,ref:t})});Uk.displayName=Bk;var Vk="AlertDialogDescription",Hk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Ls(n);return r.jsx(kg,{...i,...s,ref:t})});Hk.displayName=Vk;var gD="AlertDialogAction",Wk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,i=Ls(n);return r.jsx(Sg,{...i,...s,ref:t})});Wk.displayName=gD;var Kk="AlertDialogCancel",qk=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:i}=mD(Kk,n),l=Ls(n),c=Fn(t,i);return r.jsx(Sg,{...l,...s,ref:c})});qk.displayName=Kk;var xD=({contentRef:e})=>{const t=`\`${sa}\` requires a description for the component to be accessible for screen reader users.
|
|
515
|
+
|
|
516
|
+
You can add a description to the \`${sa}\` by passing a \`${Vk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
517
|
+
|
|
518
|
+
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 \`${sa}\`. 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.
|
|
519
|
+
|
|
520
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return f.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},yD=_k,bD=Mk,Gk=Fk,Yk=zk,Jk=Wk,Xk=qk,Qk=Uk,Zk=Hk;const Gi=yD,vD=bD,eS=f.forwardRef(({className:e,...t},n)=>r.jsx(Gk,{ref:n,className:Te("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));eS.displayName=Gk.displayName;const Bo=f.forwardRef(({className:e,...t},n)=>r.jsxs(vD,{children:[r.jsx(eS,{}),r.jsx(Yk,{ref:n,className:Te("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})]}));Bo.displayName=Yk.displayName;function Yi({className:e,...t}){return r.jsx("div",{className:Te("flex flex-col space-y-2 text-left",e),...t})}function Ji({className:e,...t}){return r.jsx("div",{className:Te("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Uo=f.forwardRef(({className:e,...t},n)=>r.jsx(Qk,{ref:n,className:Te("text-lg font-semibold tracking-tight text-foreground",e),...t}));Uo.displayName=Qk.displayName;const Vo=f.forwardRef(({className:e,...t},n)=>r.jsx(Zk,{ref:n,className:Te("text-sm leading-6 text-muted-foreground",e),...t}));Vo.displayName=Zk.displayName;const so=f.forwardRef(({className:e,...t},n)=>r.jsx(Jk,{ref:n,className:Te(e),...t}));so.displayName=Jk.displayName;const Ul=f.forwardRef(({className:e,...t},n)=>r.jsx(Xk,{ref:n,className:Te(e),...t}));Ul.displayName=Xk.displayName;const wD=[{to:"/",label:"Overview",icon:l0},{to:"/playbooks",label:"Playbooks",icon:i0},{to:"/memories",label:"Memories",icon:JT},{to:"/resources",label:"Resources",icon:fP},{to:"/inventories",label:"Inventories",icon:Ld},{to:"/usage",label:"Usage",icon:Od},{to:"/todos",label:"Todos",icon:Ar},{to:"/views",label:"Saved Views",icon:d0},{to:"/archive",label:"Archive",icon:Dd}],jD=[{suffix:"/projects",label:"Projects",icon:tg},{suffix:"/assignments",label:"Assignments",icon:hP},{suffix:"/servers",label:"Servers",icon:og},{suffix:"/inventories",label:"Inventories",icon:Ld},{suffix:"/usage",label:"Usage",icon:Od},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Ad},{suffix:"/todos",label:"Todos",icon:Ar}],kD=[{to:"/help",label:"Help",icon:pP},{to:"/settings",label:"Settings",icon:SP}],Mv="syntaur.dashboard.sourceFirstNoticeDismissed";function SD({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:i}){const[l,c]=f.useState(!1);Ht({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:l,handler:()=>c(!1)});const[u,p]=f.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(Mv)==="1"}catch{return!1}});function m(){if(p(!0),!(typeof window>"u"))try{window.localStorage.setItem(Mv,"1")}catch{}}return 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(Fv,{sourceNoticeDismissed:u,onDismissSourceNotice:m,activeWorkspace:s})}),l?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(Ce,{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(_d,{className:"h-4 w-4"})})]}),r.jsx(Fv,{sourceNoticeDismissed:u,onDismissSourceNotice:m,activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(X3,{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:i})]})]})})}function Fv({sourceNoticeDismissed:e,onDismissSourceNotice:t,activeWorkspace:n,onNavigate:s}){const{data:i}=oc(),l=(i==null?void 0:i.workspaces)??[],c=(i==null?void 0:i.hasUngrouped)??!1,{hidden:u}=Ok(),p=Wn(),[m,h]=f.useState(new Set),[x,y]=f.useState(!1),[b,C]=f.useState(""),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(null),[$,T]=f.useState(!1),D=Dt();function L(U){h(ne=>{const F=new Set(ne);return F.has(U)?F.delete(U):F.add(U),F})}const Y=eD([...l,...c?[ld]:[]],u);async function X(U){if(k){T(!0);try{const ne=`/api/workspaces/${encodeURIComponent(k)}${U?"?cascade=true":""}`,F=await fetch(ne,{method:"DELETE"});if(F.status===409){const H=await F.json().catch(()=>({}));P((H==null?void 0:H.blockedBy)??{projects:[],standalones:[]});return}if(!F.ok){const H=await F.json().catch(()=>({}));throw new Error(H.error||"Failed to delete workspace")}E(null),P(null)}catch(ne){console.error(ne),alert(ne instanceof Error?ne.message:"Failed to delete workspace")}finally{T(!1)}}}async function I(U,ne){try{if(U.type==="project"){const F=await fetch(`/api/projects/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:ne})});if(!F.ok){const H=await F.json().catch(()=>({}));throw new Error(H.error||"Failed to move project")}return}if(U.type==="standalone-assignment"){const F=await fetch(`/api/assignments/${encodeURIComponent(U.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:ne})});if(!F.ok){const H=await F.json().catch(()=>({}));throw new Error(H.error||"Failed to move assignment")}return}if(U.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(F){console.error(F),alert(F instanceof Error?F.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(Ce,{to:"/",className:"inline-flex items-center gap-3",onClick:s,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(yv,{items:wD,onNavigate:s}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[Y.length===0&&!x&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),Y.map(U=>{const ne=U==="_ungrouped",F=ne?"Ungrouped":yn(U),H=ne?"/w/_ungrouped":`/w/${U}`,ee=m.has(U),ce=n===U||n===null&&ne&&p.pathname.startsWith("/w/_ungrouped"),_=j===U;return r.jsxs("div",{className:`rounded-md transition ${_?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:W=>{W.dataTransfer.types.includes("application/json")&&(W.preventDefault(),W.dataTransfer.dropEffect="move",w(U))},onDragLeave:W=>{W.currentTarget.contains(W.relatedTarget)||w(R=>R===U?null:R)},onDrop:async W=>{try{const R=W.dataTransfer.getData("application/json");if(!R)return;W.preventDefault();let M;try{M=JSON.parse(R)}catch{return}if(!(M!=null&&M.type)||!(M!=null&&M.id))return;await I(M,ne?null:U)}finally{w(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>L(U),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${ce?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(Kr,{className:`h-3 w-3 transition-transform ${ee?"-rotate-90":""}`}),F]}),ne?null:r.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),E(U),P(null)},title:`Delete workspace "${U}"`,"aria-label":`Delete workspace "${U}"`,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(or,{className:"h-3 w-3"})})]}),!ee&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:jD.map(W=>{const R=`${H}${W.suffix}`,M=N0(p.pathname,W.suffix)&&p.pathname.startsWith(H),Q=W.icon;return r.jsxs(Ce,{to:R,onClick:s,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${M?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(Q,{className:"h-4 w-4"}),r.jsx("span",{children:W.label})]},R)})})]},U)}),x?r.jsx("form",{className:"px-3 py-1.5",onSubmit:U=>{U.preventDefault();const ne=b.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");ne&&(y(!1),C(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:ne})}).then(()=>{s==null||s(),D(`/w/${ne}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:b,onChange:U=>C(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(y(!1),C(""))},onBlur:()=>{b.trim()||(y(!1),C(""))},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:()=>y(!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(rn,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(yv,{items:kD,onNavigate:s}),e?null:r.jsx("div",{className:"chrome-card",children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Source-first dashboard"}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:"Project and assignment markdown files stay authoritative. Derived files are read-only projections."})]}),r.jsx("button",{type:"button",onClick:t,className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-border/70 bg-background/80 text-muted-foreground transition hover:text-foreground","aria-label":"Dismiss source-first dashboard notice",children:r.jsx(_d,{className:"h-4 w-4"})})]})}),r.jsx(Gi,{open:k!==null,onOpenChange:U=>{$||U||(E(null),P(null))},children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsx(Uo,{children:N?"Workspace has references":"Delete workspace?"}),r.jsx(Vo,{children:N?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:k})," 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:k})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),N?r.jsxs("div",{className:"space-y-2 text-sm",children:[N.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",N.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:N.projects.map(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/projects/${U}`,className:"hover:underline",children:U})},U))})]}):null,N.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",N.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:N.standalones.map(U=>r.jsx("li",{children:r.jsx(Ce,{to:`/assignments/${U}`,className:"hover:underline",children:U})},U))})]}):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(Ji,{children:[r.jsx(Ul,{disabled:$,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),N?r.jsx(so,{disabled:$,onClick:U=>{U.preventDefault(),X(!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:$?"Working…":"Clear references and delete"}):r.jsx(so,{disabled:$,onClick:U=>{U.preventDefault(),X(!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:$?"Working…":"Delete"})]})]})})]})}function ND(){const e=Wn(),{workspace:t}=$t(),{title:n,breadcrumbs:s,projectSlug:i}=C0(e.pathname);return r.jsx(SD,{title:n,breadcrumbs:s,projectSlug:i,workspace:t??null,children:r.jsx(lT,{})})}function mt({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 wt({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 qu({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 We({title:e,description:t,children:n,className:s,actions:i}){return r.jsxs("section",{className:Te("surface-panel space-y-3",s),children:[e||i?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]}),i]}):null,n]})}function CD({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(We,{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(Ce,{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,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-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(qu,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const km={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."},Ho={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 ED(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function TD({hero:e,itemsById:t}){const n=ln();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:Ho.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:km.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(Ce,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:Ho.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,i=(s==null?void 0:s.assignmentTitle)??"",l=km[e.copyKey]??km[e.kind],c=ED(l,{total:e.total,title:i}),u=s?PD(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(Ce,{to:u,className:"shell-action shell-action--cta",children:["Open ",i||"assignment"]})})]})}function PD(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Rg=["kanban","list","table"],tS=["title","status","priority","assignee","dependencies","created","updated"],RD=["asc","desc"],AD=["comfortable","compact"],DD=["none","status","type","priority","assignee","project"],$D=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function tt(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const i=s.trim();!i||i==="all"||n.includes(i)||n.push(i)}return n}function LD(e,t){const n=tt(e),s=tt(t);return n.length===s.length&&n.every(i=>s.includes(i))}const OD={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Vl={version:1,global:OD,projects:{}};function Sm(e){return e==="table"?"table":"kanban"}function ID(e,t){return t?{...e,...t}:{...e}}function nS(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:ID(n.filters,s.filters)}:n}const Nm=["title","status","priority","assignee","dependencies","created","updated"],_D={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},zv="2026-05-21T00:00:00Z";function Cm(e,t,n){return{id:e,name:t,workspace:null,config:{viewMode:"list",filters:{..._D,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:zv,updatedAt:zv}}const oo={version:1,views:[Cm("default-recently-updated","Recently updated",{}),Cm("default-high-priority","High priority",{priority:"high"}),Cm("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 rS(e,t){const n=tt(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,i=e.filters.activity,l=typeof e.filters.search=="string"&&e.filters.search.trim().length>0;return s&&(!i||i==="all")&&!l}function sS(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?rS(e.config,t.slug):!1}}const oS=`syntaur.savedViews.cache.v${oo.version}`;let oa=MD(),Mo=null,Ag=null;const bh=new Set,cd=new Set;let iS=0;function aS(){return++iS}function vh(e){return e===iS}function MD(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(oS);if(!e)return null;const t=JSON.parse(e);return t.version!==oo.version?null:t}catch{return null}}function FD(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(oS,JSON.stringify(e))}catch{}}function lS(e){oa=e,Ag=null,FD(e);for(const t of bh)t(e);for(const t of cd)t(null)}function zD(e){Ag=e;for(const t of cd)t(e)}function cS(e){if(!e||typeof e!="object")return oo;const t=e;return t.version!==oo.version||!Array.isArray(t.views)||!t.dashboard?oo:t}function Bv(){if(Mo)return Mo;const e=aS();return Mo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=cS(t);return vh(e)&&lS(n),Mo=null,oa??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return vh(e)&&zD(n),Mo=null,oa??oo}),Mo}function Dg(){const[e,t]=f.useState(()=>oa??oo),[n,s]=f.useState(()=>oa===null),[i,l]=f.useState(!1),[c,u]=f.useState(()=>Ag);return f.useEffect(()=>{let m=!1;oa===null&&s(!0),Bv().then(y=>{m||(t(y),s(!1),l(!0))});const h=y=>{m||(t(y),s(!1),l(!0),u(null))},x=y=>{m||(u(y),s(!1),l(!0))};return bh.add(h),cd.add(x),()=>{m=!0,bh.delete(h),cd.delete(x)}},[]),{file:e,loading:n,ready:i,error:c,refetch:()=>{Mo=null,s(!0),u(null),l(!1),Bv()}}}function Hd(){const{file:e,loading:t}=Dg();return{views:e.views,loading:t}}function BD(){const{file:e,loading:t}=Dg();return{layout:e.dashboard,loading:t}}function Go(e){const{file:t,loading:n,ready:s,error:i,refetch:l}=Dg();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:i,refetch:l}:{view:null,loading:!1,ready:!0,error:null,refetch:l}}async function Wd(e,t,n){const s=aS(),i=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(!i.ok){const c=await i.json().catch(()=>({error:`HTTP ${i.status}`}));throw new Error(c.error??`HTTP ${i.status}`)}const l=cS(await i.json());return vh(s)&&lS(l),l}function Kd(e){return Wd("POST","/api/saved-views",e)}function $g(e,t){return Wd("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function UD(e){return Wd("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function VD(e){return Wd("PUT","/api/dashboard",{slots:e})}const HD=["top","right","bottom","left"],lo=Math.min,hr=Math.max,ud=Math.round,Pu=Math.floor,ds=e=>({x:e,y:e}),WD={left:"right",right:"left",bottom:"top",top:"bottom"};function wh(e,t,n){return hr(e,lo(t,n))}function As(e,t){return typeof e=="function"?e(t):e}function Ds(e){return e.split("-")[0]}function wa(e){return e.split("-")[1]}function Lg(e){return e==="x"?"y":"x"}function Og(e){return e==="y"?"height":"width"}function ls(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ig(e){return Lg(ls(e))}function KD(e,t,n){n===void 0&&(n=!1);const s=wa(e),i=Ig(e),l=Og(i);let c=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=dd(c)),[c,dd(c)]}function qD(e){const t=dd(e);return[jh(e),t,jh(t)]}function jh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Uv=["left","right"],Vv=["right","left"],GD=["top","bottom"],YD=["bottom","top"];function JD(e,t,n){switch(e){case"top":case"bottom":return n?t?Vv:Uv:t?Uv:Vv;case"left":case"right":return t?GD:YD;default:return[]}}function XD(e,t,n,s){const i=wa(e);let l=JD(Ds(e),n==="start",s);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(jh)))),l}function dd(e){const t=Ds(e);return WD[t]+e.slice(t.length)}function QD(e){return{top:0,right:0,bottom:0,left:0,...e}}function uS(e){return typeof e!="number"?QD(e):{top:e,right:e,bottom:e,left:e}}function fd(e){const{x:t,y:n,width:s,height:i}=e;return{width:s,height:i,top:n,left:t,right:t+s,bottom:n+i,x:t,y:n}}function Hv(e,t,n){let{reference:s,floating:i}=e;const l=ls(t),c=Ig(t),u=Og(c),p=Ds(t),m=l==="y",h=s.x+s.width/2-i.width/2,x=s.y+s.height/2-i.height/2,y=s[u]/2-i[u]/2;let b;switch(p){case"top":b={x:h,y:s.y-i.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:x};break;case"left":b={x:s.x-i.width,y:x};break;default:b={x:s.x,y:s.y}}switch(wa(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 ZD(e,t){var n;t===void 0&&(t={});const{x:s,y:i,platform:l,rects:c,elements:u,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:b=0}=As(t,e),C=uS(b),w=u[y?x==="floating"?"reference":"floating":x],k=fd(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(w)))==null||n?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:p})),E=x==="floating"?{x:s,y:i,width:c.floating.width,height:c.floating.height}:c.reference,N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),P=await(l.isElement==null?void 0:l.isElement(N))?await(l.getScale==null?void 0:l.getScale(N))||{x:1,y:1}:{x:1,y:1},$=fd(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:N,strategy:p}):E);return{top:(k.top-$.top+C.top)/P.y,bottom:($.bottom-k.bottom+C.bottom)/P.y,left:(k.left-$.left+C.left)/P.x,right:($.right-k.right+C.right)/P.x}}const e4=50,t4=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:ZD},p=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:x}=Hv(m,s,p),y=s,b=0;const C={};for(let j=0;j<l.length;j++){const w=l[j];if(!w)continue;const{name:k,fn:E}=w,{x:N,y:P,data:$,reset:T}=await E({x:h,y:x,initialPlacement:s,placement:y,strategy:i,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=N??h,x=P??x,C[k]={...C[k],...$},T&&b<e4&&(b++,typeof T=="object"&&(T.placement&&(y=T.placement),T.rects&&(m=T.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):T.rects),{x:h,y:x}=Hv(m,y,p)),j=-1)}return{x:h,y:x,placement:y,strategy:i,middlewareData:C}},n4=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:l,platform:c,elements:u,middlewareData:p}=t,{element:m,padding:h=0}=As(e,t)||{};if(m==null)return{};const x=uS(h),y={x:n,y:s},b=Ig(i),C=Og(b),j=await c.getDimensions(m),w=b==="y",k=w?"top":"left",E=w?"bottom":"right",N=w?"clientHeight":"clientWidth",P=l.reference[C]+l.reference[b]-y[b]-l.floating[C],$=y[b]-l.reference[b],T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let D=T?T[N]:0;(!D||!await(c.isElement==null?void 0:c.isElement(T)))&&(D=u.floating[N]||l.floating[C]);const L=P/2-$/2,Y=D/2-j[C]/2-1,X=lo(x[k],Y),I=lo(x[E],Y),U=X,ne=D-j[C]-I,F=D/2-j[C]/2+L,H=wh(U,F,ne),ee=!p.arrow&&wa(i)!=null&&F!==H&&l.reference[C]/2-(F<U?X:I)-j[C]/2<0,ce=ee?F<U?F-U:F-ne:0;return{[b]:y[b]+ce,data:{[b]:H,centerOffset:F-H-ce,...ee&&{alignmentOffset:ce}},reset:ee}}}),r4=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:i,middlewareData:l,rects:c,initialPlacement:u,platform:p,elements:m}=t,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...w}=As(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const k=Ds(i),E=ls(u),N=Ds(u)===u,P=await(p.isRTL==null?void 0:p.isRTL(m.floating)),$=y||(N||!j?[dd(u)]:qD(u)),T=C!=="none";!y&&T&&$.push(...XD(u,j,C,P));const D=[u,...$],L=await p.detectOverflow(t,w),Y=[];let X=((s=l.flip)==null?void 0:s.overflows)||[];if(h&&Y.push(L[k]),x){const F=KD(i,c,P);Y.push(L[F[0]],L[F[1]])}if(X=[...X,{placement:i,overflows:Y}],!Y.every(F=>F<=0)){var I,U;const F=(((I=l.flip)==null?void 0:I.index)||0)+1,H=D[F];if(H&&(!(x==="alignment"?E!==ls(H):!1)||X.every(_=>ls(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:F,overflows:X},reset:{placement:H}};let ee=(U=X.filter(ce=>ce.overflows[0]<=0).sort((ce,_)=>ce.overflows[1]-_.overflows[1])[0])==null?void 0:U.placement;if(!ee)switch(b){case"bestFit":{var ne;const ce=(ne=X.filter(_=>{if(T){const W=ls(_.placement);return W===E||W==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(W=>W>0).reduce((W,R)=>W+R,0)]).sort((_,W)=>_[1]-W[1])[0])==null?void 0:ne[0];ce&&(ee=ce);break}case"initialPlacement":ee=u;break}if(i!==ee)return{reset:{placement:ee}}}return{}}}};function Wv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kv(e){return HD.some(t=>e[t]>=0)}const s4=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:i="referenceHidden",...l}=As(e,t);switch(i){case"referenceHidden":{const c=await s.detectOverflow(t,{...l,elementContext:"reference"}),u=Wv(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Kv(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...l,altBoundary:!0}),u=Wv(c,n.floating);return{data:{escapedOffsets:u,escaped:Kv(u)}}}default:return{}}}}},dS=new Set(["left","top"]);async function o4(e,t){const{placement:n,platform:s,elements:i}=e,l=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Ds(n),u=wa(n),p=ls(n)==="y",m=dS.has(c)?-1:1,h=l&&p?-1:1,x=As(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),p?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const i4=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:l,placement:c,middlewareData:u}=t,p=await o4(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:i+p.x,y:l+p.y,data:{...p,placement:c}}}}},a4=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:p={fn:k=>{let{x:E,y:N}=k;return{x:E,y:N}}},...m}=As(e,t),h={x:n,y:s},x=await l.detectOverflow(t,m),y=ls(Ds(i)),b=Lg(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",N=C+x[k],P=C-x[E];C=wh(N,C,P)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",N=j+x[k],P=j-x[E];j=wh(N,j,P)}const w=p.fn({...t,[b]:C,[y]:j});return{...w,data:{x:w.x-n,y:w.y-s,enabled:{[b]:c,[y]:u}}}}}},l4=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:i,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:p=!0,crossAxis:m=!0}=As(e,t),h={x:n,y:s},x=ls(i),y=Lg(x);let b=h[y],C=h[x];const j=As(u,t),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(p){const N=y==="y"?"height":"width",P=l.reference[y]-l.floating[N]+w.mainAxis,$=l.reference[y]+l.reference[N]-w.mainAxis;b<P?b=P:b>$&&(b=$)}if(m){var k,E;const N=y==="y"?"width":"height",P=dS.has(Ds(i)),$=l.reference[x]-l.floating[N]+(P&&((k=c.offset)==null?void 0:k[x])||0)+(P?0:w.crossAxis),T=l.reference[x]+l.reference[N]+(P?0:((E=c.offset)==null?void 0:E[x])||0)-(P?w.crossAxis:0);C<$?C=$:C>T&&(C=T)}return{[y]:b,[x]:C}}}},c4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:i,rects:l,platform:c,elements:u}=t,{apply:p=()=>{},...m}=As(e,t),h=await c.detectOverflow(t,m),x=Ds(i),y=wa(i),b=ls(i)==="y",{width:C,height:j}=l.floating;let w,k;x==="top"||x==="bottom"?(w=x,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=x,w=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,N=C-h.left-h.right,P=lo(j-h[w],E),$=lo(C-h[k],N),T=!t.middlewareData.shift;let D=P,L=$;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=N),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(D=E),T&&!y){const X=hr(h.left,0),I=hr(h.right,0),U=hr(h.top,0),ne=hr(h.bottom,0);b?L=C-2*(X!==0||I!==0?X+I:hr(h.left,h.right)):D=j-2*(U!==0||ne!==0?U+ne:hr(h.top,h.bottom))}await p({...t,availableWidth:L,availableHeight:D});const Y=await c.getDimensions(u.floating);return C!==Y.width||j!==Y.height?{reset:{rects:!0}}:{}}}};function qd(){return typeof window<"u"}function ja(e){return fS(e)?(e.nodeName||"").toLowerCase():"#document"}function yr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function gs(e){var t;return(t=(fS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fS(e){return qd()?e instanceof Node||e instanceof yr(e).Node:!1}function qr(e){return qd()?e instanceof Element||e instanceof yr(e).Element:!1}function Os(e){return qd()?e instanceof HTMLElement||e instanceof yr(e).HTMLElement:!1}function qv(e){return!qd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yr(e).ShadowRoot}function ac(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=Gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&i!=="inline"&&i!=="contents"}function u4(e){return/^(table|td|th)$/.test(ja(e))}function Gd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const d4=/transform|translate|scale|rotate|perspective|filter/,f4=/paint|layout|strict|content/,Io=e=>!!e&&e!=="none";let Em;function _g(e){const t=qr(e)?Gr(e):e;return Io(t.transform)||Io(t.translate)||Io(t.scale)||Io(t.rotate)||Io(t.perspective)||!Mg()&&(Io(t.backdropFilter)||Io(t.filter))||d4.test(t.willChange||"")||f4.test(t.contain||"")}function p4(e){let t=co(e);for(;Os(t)&&!fa(t);){if(_g(t))return t;if(Gd(t))return null;t=co(t)}return null}function Mg(){return Em==null&&(Em=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Em}function fa(e){return/^(html|body|#document)$/.test(ja(e))}function Gr(e){return yr(e).getComputedStyle(e)}function Yd(e){return qr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function co(e){if(ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||qv(e)&&e.host||gs(e);return qv(t)?t.host:t}function pS(e){const t=co(e);return fa(t)?e.ownerDocument?e.ownerDocument.body:e.body:Os(t)&&ac(t)?t:pS(t)}function Hl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=pS(e),l=i===((s=e.ownerDocument)==null?void 0:s.body),c=yr(i);if(l){const u=kh(c);return t.concat(c,c.visualViewport||[],ac(i)?i:[],u&&n?Hl(u):[])}else return t.concat(i,Hl(i,[],n))}function kh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function mS(e){const t=Gr(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Os(e),l=i?e.offsetWidth:n,c=i?e.offsetHeight:s,u=ud(n)!==l||ud(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function Fg(e){return qr(e)?e:e.contextElement}function ia(e){const t=Fg(e);if(!Os(t))return ds(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:l}=mS(t);let c=(l?ud(n.width):n.width)/s,u=(l?ud(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const m4=ds(0);function hS(e){const t=yr(e);return!Mg()||!t.visualViewport?m4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function h4(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yr(e)?!1:t}function Yo(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=Fg(e);let c=ds(1);t&&(s?qr(s)&&(c=ia(s)):c=ia(e));const u=h4(l,n,s)?hS(l):ds(0);let p=(i.left+u.x)/c.x,m=(i.top+u.y)/c.y,h=i.width/c.x,x=i.height/c.y;if(l){const y=yr(l),b=s&&qr(s)?yr(s):s;let C=y,j=kh(C);for(;j&&s&&b!==C;){const w=ia(j),k=j.getBoundingClientRect(),E=Gr(j),N=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,P=k.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;p*=w.x,m*=w.y,h*=w.x,x*=w.y,p+=N,m+=P,C=yr(j),j=kh(C)}}return fd({width:h,height:x,x:p,y:m})}function Jd(e,t){const n=Yd(e).scrollLeft;return t?t.left+n:Yo(gs(e)).left+n}function gS(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Jd(e,n),i=n.top+t.scrollTop;return{x:s,y:i}}function g4(e){let{elements:t,rect:n,offsetParent:s,strategy:i}=e;const l=i==="fixed",c=gs(s),u=t?Gd(t.floating):!1;if(s===c||u&&l)return n;let p={scrollLeft:0,scrollTop:0},m=ds(1);const h=ds(0),x=Os(s);if((x||!x&&!l)&&((ja(s)!=="body"||ac(c))&&(p=Yd(s)),x)){const b=Yo(s);m=ia(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!x&&!l?gS(c,p):ds(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-p.scrollTop*m.y+h.y+y.y}}function x4(e){return Array.from(e.getClientRects())}function y4(e){const t=gs(e),n=Yd(e),s=e.ownerDocument.body,i=hr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=hr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Jd(e);const u=-n.scrollTop;return Gr(s).direction==="rtl"&&(c+=hr(t.clientWidth,s.clientWidth)-i),{width:i,height:l,x:c,y:u}}const Gv=25;function b4(e,t){const n=yr(e),s=gs(e),i=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,p=0;if(i){l=i.width,c=i.height;const h=Mg();(!h||h&&t==="fixed")&&(u=i.offsetLeft,p=i.offsetTop)}const m=Jd(s);if(m<=0){const h=s.ownerDocument,x=h.body,y=getComputedStyle(x),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-x.clientWidth-b);C<=Gv&&(l-=C)}else m<=Gv&&(l+=m);return{width:l,height:c,x:u,y:p}}function v4(e,t){const n=Yo(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,l=Os(e)?ia(e):ds(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,p=i*l.x,m=s*l.y;return{width:c,height:u,x:p,y:m}}function Yv(e,t,n){let s;if(t==="viewport")s=b4(e,n);else if(t==="document")s=y4(gs(e));else if(qr(t))s=v4(t,n);else{const i=hS(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return fd(s)}function xS(e,t){const n=co(e);return n===t||!qr(n)||fa(n)?!1:Gr(n).position==="fixed"||xS(n,t)}function w4(e,t){const n=t.get(e);if(n)return n;let s=Hl(e,[],!1).filter(u=>qr(u)&&ja(u)!=="body"),i=null;const l=Gr(e).position==="fixed";let c=l?co(e):e;for(;qr(c)&&!fa(c);){const u=Gr(c),p=_g(c);!p&&u.position==="fixed"&&(i=null),(l?!p&&!i:!p&&u.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ac(c)&&!p&&xS(e,c))?s=s.filter(h=>h!==c):i=u,c=co(c)}return t.set(e,s),s}function j4(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const c=[...n==="clippingAncestors"?Gd(t)?[]:w4(t,this._c):[].concat(n),s],u=Yv(t,c[0],i);let p=u.top,m=u.right,h=u.bottom,x=u.left;for(let y=1;y<c.length;y++){const b=Yv(t,c[y],i);p=hr(b.top,p),m=lo(b.right,m),h=lo(b.bottom,h),x=hr(b.left,x)}return{width:m-x,height:h-p,x,y:p}}function k4(e){const{width:t,height:n}=mS(e);return{width:t,height:n}}function S4(e,t,n){const s=Os(t),i=gs(t),l=n==="fixed",c=Yo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const p=ds(0);function m(){p.x=Jd(i)}if(s||!s&&!l)if((ja(t)!=="body"||ac(i))&&(u=Yd(t)),s){const b=Yo(t,!0,l,t);p.x=b.x+t.clientLeft,p.y=b.y+t.clientTop}else i&&m();l&&!s&&i&&m();const h=i&&!s&&!l?gS(i,u):ds(0),x=c.left+u.scrollLeft-p.x-h.x,y=c.top+u.scrollTop-p.y-h.y;return{x,y,width:c.width,height:c.height}}function Tm(e){return Gr(e).position==="static"}function Jv(e,t){if(!Os(e)||Gr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return gs(e)===n&&(n=n.ownerDocument.body),n}function yS(e,t){const n=yr(e);if(Gd(e))return n;if(!Os(e)){let i=co(e);for(;i&&!fa(i);){if(qr(i)&&!Tm(i))return i;i=co(i)}return n}let s=Jv(e,t);for(;s&&u4(s)&&Tm(s);)s=Jv(s,t);return s&&fa(s)&&Tm(s)&&!_g(s)?n:s||p4(e)||n}const N4=async function(e){const t=this.getOffsetParent||yS,n=this.getDimensions,s=await n(e.floating);return{reference:S4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function C4(e){return Gr(e).direction==="rtl"}const E4={convertOffsetParentRelativeRectToViewportRelativeRect:g4,getDocumentElement:gs,getClippingRect:j4,getOffsetParent:yS,getElementRects:N4,getClientRects:x4,getDimensions:k4,getScale:ia,isElement:qr,isRTL:C4};function bS(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function T4(e,t){let n=null,s;const i=gs(e);function l(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,p){u===void 0&&(u=!1),p===void 0&&(p=1),l();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Pu(x),j=Pu(i.clientWidth-(h+y)),w=Pu(i.clientHeight-(x+b)),k=Pu(h),N={rootMargin:-C+"px "+-j+"px "+-w+"px "+-k+"px",threshold:hr(0,lo(1,p))||1};let P=!0;function $(T){const D=T[0].intersectionRatio;if(D!==p){if(!P)return c();D?c(!1,D):s=setTimeout(()=>{c(!1,1e-7)},1e3)}D===1&&!bS(m,e.getBoundingClientRect())&&c(),P=!1}try{n=new IntersectionObserver($,{...N,root:i.ownerDocument})}catch{n=new IntersectionObserver($,N)}n.observe(e)}return c(!0),l}function P4(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:p=!1}=s,m=Fg(e),h=i||l?[...m?Hl(m):[],...t?Hl(t):[]]:[];h.forEach(k=>{i&&k.addEventListener("scroll",n,{passive:!0}),l&&k.addEventListener("resize",n)});const x=m&&u?T4(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 N;(N=b)==null||N.observe(t)})),n()}),m&&!p&&b.observe(m),t&&b.observe(t));let C,j=p?Yo(e):null;p&&w();function w(){const k=Yo(e);j&&!bS(j,k)&&n(),j=k,C=requestAnimationFrame(w)}return n(),()=>{var k;h.forEach(E=>{i&&E.removeEventListener("scroll",n),l&&E.removeEventListener("resize",n)}),x==null||x(),(k=b)==null||k.disconnect(),b=null,p&&cancelAnimationFrame(C)}}const R4=i4,A4=a4,D4=r4,$4=c4,L4=s4,Xv=n4,O4=l4,I4=(e,t,n)=>{const s=new Map,i={platform:E4,...n},l={...i.platform,_c:s};return t4(e,t,{...i,platform:l})};var _4=typeof document<"u",M4=function(){},Gu=_4?f.useLayoutEffect:M4;function pd(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,i;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(!pd(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const l=i[s];if(!(l==="_owner"&&e.$$typeof)&&!pd(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function vS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qv(e,t){const n=vS(e);return Math.round(t*n)/n}function Pm(e){const t=f.useRef(e);return Gu(()=>{t.current=e}),t}function F4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:p,open:m}=e,[h,x]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);pd(y,s)||b(s);const[C,j]=f.useState(null),[w,k]=f.useState(null),E=f.useCallback(_=>{_!==T.current&&(T.current=_,j(_))},[]),N=f.useCallback(_=>{_!==D.current&&(D.current=_,k(_))},[]),P=l||C,$=c||w,T=f.useRef(null),D=f.useRef(null),L=f.useRef(h),Y=p!=null,X=Pm(p),I=Pm(i),U=Pm(m),ne=f.useCallback(()=>{if(!T.current||!D.current)return;const _={placement:t,strategy:n,middleware:y};I.current&&(_.platform=I.current),I4(T.current,D.current,_).then(W=>{const R={...W,isPositioned:U.current!==!1};F.current&&!pd(L.current,R)&&(L.current=R,Ts.flushSync(()=>{x(R)}))})},[y,t,n,I,U]);Gu(()=>{m===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,x(_=>({..._,isPositioned:!1})))},[m]);const F=f.useRef(!1);Gu(()=>(F.current=!0,()=>{F.current=!1}),[]),Gu(()=>{if(P&&(T.current=P),$&&(D.current=$),P&&$){if(X.current)return X.current(P,$,ne);ne()}},[P,$,ne,X,Y]);const H=f.useMemo(()=>({reference:T,floating:D,setReference:E,setFloating:N}),[E,N]),ee=f.useMemo(()=>({reference:P,floating:$}),[P,$]),ce=f.useMemo(()=>{const _={position:n,left:0,top:0};if(!ee.floating)return _;const W=Qv(ee.floating,h.x),R=Qv(ee.floating,h.y);return u?{..._,transform:"translate("+W+"px, "+R+"px)",...vS(ee.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:R}},[n,u,ee.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:ne,refs:H,elements:ee,floatingStyles:ce}),[h,ne,H,ee,ce])}const z4=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Xv({element:s.current,padding:i}).fn(n):{}:s?Xv({element:s,padding:i}).fn(n):{}}}},B4=(e,t)=>{const n=R4(e);return{name:n.name,fn:n.fn,options:[e,t]}},U4=(e,t)=>{const n=A4(e);return{name:n.name,fn:n.fn,options:[e,t]}},V4=(e,t)=>({fn:O4(e).fn,options:[e,t]}),H4=(e,t)=>{const n=D4(e);return{name:n.name,fn:n.fn,options:[e,t]}},W4=(e,t)=>{const n=$4(e);return{name:n.name,fn:n.fn,options:[e,t]}},K4=(e,t)=>{const n=L4(e);return{name:n.name,fn:n.fn,options:[e,t]}},q4=(e,t)=>{const n=z4(e);return{name:n.name,fn:n.fn,options:[e,t]}};var G4="Arrow",wS=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:i=5,...l}=e;return r.jsx(mn.svg,{...l,ref:t,width:s,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});wS.displayName=G4;var Y4=wS;function J4(e){const[t,n]=f.useState(void 0);return ao(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const l=i[0];let c,u;if("borderBoxSize"in l){const p=l.borderBoxSize,m=Array.isArray(p)?p[0]:p;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 zg="Popper",[jS,kS]=Xo(zg),[X4,SS]=jS(zg),NS=e=>{const{__scopePopper:t,children:n}=e,[s,i]=f.useState(null);return r.jsx(X4,{scope:t,anchor:s,onAnchorChange:i,children:n})};NS.displayName=zg;var CS="PopperAnchor",ES=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...i}=e,l=SS(CS,n),c=f.useRef(null),u=Fn(t,c),p=f.useRef(null);return f.useEffect(()=>{const m=p.current;p.current=(s==null?void 0:s.current)||c.current,m!==p.current&&l.onAnchorChange(p.current)}),s?null:r.jsx(mn.div,{...i,ref:u})});ES.displayName=CS;var Bg="PopperContent",[Q4,Z4]=jS(Bg),TS=f.forwardRef((e,t)=>{var oe,me,ve,ke,he,Je;const{__scopePopper:n,side:s="bottom",sideOffset:i=0,align:l="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:x="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,w=SS(Bg,n),[k,E]=f.useState(null),N=Fn(t,Ye=>E(Ye)),[P,$]=f.useState(null),T=J4(P),D=(T==null?void 0:T.width)??0,L=(T==null?void 0:T.height)??0,Y=s+(l!=="center"?"-"+l:""),X=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},I=Array.isArray(m)?m:[m],U=I.length>0,ne={padding:X,boundary:I.filter(t$),altBoundary:U},{refs:F,floatingStyles:H,placement:ee,isPositioned:ce,middlewareData:_}=F4({strategy:"fixed",placement:Y,whileElementsMounted:(...Ye)=>P4(...Ye,{animationFrame:b==="always"}),elements:{reference:w.anchor},middleware:[B4({mainAxis:i+L,alignmentAxis:c}),p&&U4({mainAxis:!0,crossAxis:!1,limiter:x==="partial"?V4():void 0,...ne}),p&&H4({...ne}),W4({...ne,apply:({elements:Ye,rects:ot,availableWidth:G,availableHeight:Ie})=>{const{width:Se,height:Oe}=ot.reference,Xe=Ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${G}px`),Xe.setProperty("--radix-popper-available-height",`${Ie}px`),Xe.setProperty("--radix-popper-anchor-width",`${Se}px`),Xe.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),P&&q4({element:P,padding:u}),n$({arrowWidth:D,arrowHeight:L}),y&&K4({strategy:"referenceHidden",...ne})]}),[W,R]=AS(ee),M=Ko(C);ao(()=>{ce&&(M==null||M())},[ce,M]);const Q=(oe=_.arrow)==null?void 0:oe.x,O=(me=_.arrow)==null?void 0:me.y,ue=((ve=_.arrow)==null?void 0:ve.centerOffset)!==0,[ge,V]=f.useState();return ao(()=>{k&&V(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:ce?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(ke=_.transformOrigin)==null?void 0:ke.x,(he=_.transformOrigin)==null?void 0:he.y].join(" "),...((Je=_.hide)==null?void 0:Je.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Q4,{scope:n,placedSide:W,onArrowChange:$,arrowX:Q,arrowY:O,shouldHideArrow:ue,children:r.jsx(mn.div,{"data-side":W,"data-align":R,...j,ref:N,style:{...j.style,animation:ce?void 0:"none"}})})})});TS.displayName=Bg;var PS="PopperArrow",e$={top:"bottom",right:"left",bottom:"top",left:"right"},RS=f.forwardRef(function(t,n){const{__scopePopper:s,...i}=t,l=Z4(PS,s),c=e$[l.placedSide];return r.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:r.jsx(Y4,{...i,ref:n,style:{...i.style,display:"block"}})})});RS.displayName=PS;function t$(e){return e!==null}var n$=e=>({name:"transformOrigin",options:e,fn(t){var w,k,E;const{placement:n,rects:s,middlewareData:i}=t,c=((w=i.arrow)==null?void 0:w.centerOffset)!==0,u=c?0:e.arrowWidth,p=c?0:e.arrowHeight,[m,h]=AS(n),x={start:"0%",center:"50%",end:"100%"}[h],y=(((k=i.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=i.arrow)==null?void 0:E.y)??0)+p/2;let C="",j="";return m==="bottom"?(C=c?x:`${y}px`,j=`${-p}px`):m==="top"?(C=c?x:`${y}px`,j=`${s.floating.height+p}px`):m==="right"?(C=`${-p}px`,j=c?x:`${b}px`):m==="left"&&(C=`${s.floating.width+p}px`,j=c?x:`${b}px`),{data:{x:C,y:j}}}});function AS(e){const[t,n="center"]=e.split("-");return[t,n]}var r$=NS,s$=ES,o$=TS,i$=RS,a$=Symbol("radix.slottable");function l$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=a$,t}var c$=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"}),u$="VisuallyHidden",DS=f.forwardRef((e,t)=>r.jsx(mn.span,{...e,ref:t,style:{...c$,...e.style}}));DS.displayName=u$;var d$=DS,[Xd]=Xo("Tooltip",[kS]),Qd=kS(),$S="TooltipProvider",f$=700,Sh="tooltip.open",[p$,Ug]=Xd($S),LS=e=>{const{__scopeTooltip:t,delayDuration:n=f$,skipDelayDuration:s=300,disableHoverableContent:i=!1,children:l}=e,c=f.useRef(!0),u=f.useRef(!1),p=f.useRef(0);return f.useEffect(()=>{const m=p.current;return()=>window.clearTimeout(m)},[]),r.jsx(p$,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(p.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:i,children:l})};LS.displayName=$S;var Wl="Tooltip",[m$,lc]=Xd(Wl),OS=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:i,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=e,p=Ug(Wl,e.__scopeTooltip),m=Qd(t),[h,x]=f.useState(null),y=na(),b=f.useRef(0),C=c??p.disableHoverableContent,j=u??p.delayDuration,w=f.useRef(!1),[k,E]=Bd({prop:s,defaultProp:i??!1,onChange:D=>{D?(p.onOpen(),document.dispatchEvent(new CustomEvent(Sh))):p.onClose(),l==null||l(D)},caller:Wl}),N=f.useMemo(()=>k?w.current?"delayed-open":"instant-open":"closed",[k]),P=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w.current=!1,E(!0)},[E]),$=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{w.current=!0,E(!0),b.current=0},j)},[j,E]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(r$,{...m,children:r.jsx(m$,{scope:t,contentId:y,open:k,stateAttribute:N,trigger:h,onTriggerChange:x,onTriggerEnter:f.useCallback(()=>{p.isOpenDelayedRef.current?T():P()},[p.isOpenDelayedRef,T,P]),onTriggerLeave:f.useCallback(()=>{C?$():(window.clearTimeout(b.current),b.current=0)},[$,C]),onOpen:P,onClose:$,disableHoverableContent:C,children:n})})};OS.displayName=Wl;var Nh="TooltipTrigger",IS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=lc(Nh,n),l=Ug(Nh,n),c=Qd(n),u=f.useRef(null),p=Fn(t,u,i.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),x=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),r.jsx(s$,{asChild:!0,...c,children:r.jsx(mn.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...s,ref:p,onPointerMove:qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!l.isPointerInTransitRef.current&&(i.onTriggerEnter(),h.current=!0)}),onPointerLeave:qt(e.onPointerLeave,()=>{i.onTriggerLeave(),h.current=!1}),onPointerDown:qt(e.onPointerDown,()=>{i.open&&i.onClose(),m.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:qt(e.onFocus,()=>{m.current||i.onOpen()}),onBlur:qt(e.onBlur,i.onClose),onClick:qt(e.onClick,i.onClose)})})});IS.displayName=Nh;var Vg="TooltipPortal",[h$,g$]=Xd(Vg,{forceMount:void 0}),_S=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:i}=e,l=lc(Vg,t);return r.jsx(h$,{scope:t,forceMount:n,children:r.jsx(Qo,{present:n||l.open,children:r.jsx(gg,{asChild:!0,container:i,children:s})})})};_S.displayName=Vg;var pa="TooltipContent",MS=f.forwardRef((e,t)=>{const n=g$(pa,e.__scopeTooltip),{forceMount:s=n.forceMount,side:i="top",...l}=e,c=lc(pa,e.__scopeTooltip);return r.jsx(Qo,{present:s||c.open,children:c.disableHoverableContent?r.jsx(FS,{side:i,...l,ref:t}):r.jsx(x$,{side:i,...l,ref:t})})}),x$=f.forwardRef((e,t)=>{const n=lc(pa,e.__scopeTooltip),s=Ug(pa,e.__scopeTooltip),i=f.useRef(null),l=Fn(t,i),[c,u]=f.useState(null),{trigger:p,onClose:m}=n,h=i.current,{onPointerInTransitChange:x}=s,y=f.useCallback(()=>{u(null),x(!1)},[x]),b=f.useCallback((C,j)=>{const w=C.currentTarget,k={x:C.clientX,y:C.clientY},E=j$(k,w.getBoundingClientRect()),N=k$(k,E),P=S$(j.getBoundingClientRect()),$=C$([...N,...P]);u($),x(!0)},[x]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(p&&h){const C=w=>b(w,h),j=w=>b(w,p);return p.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{p.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[p,h,b,y]),f.useEffect(()=>{if(c){const C=j=>{const w=j.target,k={x:j.clientX,y:j.clientY},E=(p==null?void 0:p.contains(w))||(h==null?void 0:h.contains(w)),N=!N$(k,c);E?y():N&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[p,h,c,m,y]),r.jsx(FS,{...e,ref:l})}),[y$,b$]=Xd(Wl,{isInside:!1}),v$=l$("TooltipContent"),FS=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":i,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=e,p=lc(pa,n),m=Qd(n),{onClose:h}=p;return f.useEffect(()=>(document.addEventListener(Sh,h),()=>document.removeEventListener(Sh,h)),[h]),f.useEffect(()=>{if(p.trigger){const x=y=>{const b=y.target;b!=null&&b.contains(p.trigger)&&h()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[p.trigger,h]),r.jsx(hg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:x=>x.preventDefault(),onDismiss:h,children:r.jsxs(o$,{"data-state":p.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(v$,{children:s}),r.jsx(y$,{scope:n,isInside:!0,children:r.jsx(d$,{id:p.contentId,role:"tooltip",children:i||s})})]})})});MS.displayName=pa;var zS="TooltipArrow",w$=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,i=Qd(n);return b$(zS,n).isInside?null:r.jsx(i$,{...i,...s,ref:t})});w$.displayName=zS;function j$(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(n,s,i,l)){case l:return"left";case i:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function k$(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 S$(e){const{top:t,right:n,bottom:s,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:s},{x:i,y:s}]}function N$(e,t){const{x:n,y:s}=e;let i=!1;for(let l=0,c=t.length-1;l<t.length;c=l++){const u=t[l],p=t[c],m=u.x,h=u.y,x=p.x,y=p.y;h>s!=y>s&&n<(x-m)*(s-h)/(y-h)+m&&(i=!i)}return i}function C$(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),E$(t)}function E$(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const i=e[s];for(;t.length>=2;){const l=t[t.length-1],c=t[t.length-2];if((l.x-c.x)*(i.y-c.y)>=(l.y-c.y)*(i.x-c.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const i=e[s];for(;n.length>=2;){const l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(i.y-c.y)>=(l.y-c.y)*(i.x-c.x))n.pop();else break}n.push(i)}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 T$=LS,P$=OS,R$=IS,A$=_S,BS=MS;const Wo=T$,Pr=P$,Rr=R$,gr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(A$,{children:r.jsx(BS,{ref:s,sideOffset:t,className:Te("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})}));gr.displayName=BS.displayName;function Hg({items:e,align:t="end"}){const[n,s]=f.useState(!1),i=f.useRef(null);return f.useEffect(()=>{if(!n)return;function l(u){i.current&&!i.current.contains(u.target)&&s(!1)}function c(u){u.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c)}},[n]),e.length===0?null:r.jsxs("div",{className:"relative",ref:i,children:[r.jsx("button",{type:"button",onClick:()=>s(l=>!l),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(iP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:Te("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(Wo,{delayDuration:200,children:e.map(l=>{const c=l.icon,u=Te("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",l.disabled?"opacity-50 cursor-not-allowed":l.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),p=r.jsxs(r.Fragment,{children:[c?r.jsx(c,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:l.label})]});if(l.disabled){const m=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:u,children:p})});return l.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:m}),r.jsx(gr,{side:"left",children:l.disabledReason})]},l.key):r.jsx("div",{children:m},l.key)}return l.href?r.jsx(Ce,{to:l.href,className:u,onClick:()=>s(!1),children:p},l.key):r.jsx("button",{type:"button",className:u,onClick:()=>{var m;(m=l.onSelect)==null||m.call(l),s(!1)},children:p},l.key)})})})]})}function Zv(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const D$={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 $$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function L$(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function O$(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,i=Date.parse(s);if(Number.isNaN(i))return!1;if(t.preset){const u=D$[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-i>u:i>=n-u&&i<=n}const l=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!l&&!c?!0:!(l&&i<$$(l)||c&&i>L$(c))}function Wg(e,t,n={}){const{workspace:s,search:i,includeArchived:l}=n;if(e.archived===!0&&!l)return!1;const c=tt(t.status),u=tt(t.priority),p=tt(t.type),m=tt(t.assignee),h=tt(t.project),x=tt(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)||p.length&&!p.includes(e.type??"")||y==="stale"&&!Zv(e.updated)||y==="fresh"&&Zv(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(x.length){const b=e.tags??[];if(!x.some(C=>b.includes(C)))return!1}if(!O$(e,t.dateRange))return!1;if(i){const b=i.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function Kl(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const US={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:[],custom:!1};let Rl=null,Fo=null;function I$(){return Rl?Promise.resolve(Rl):Fo||(Fo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Rl=e,Fo=null,e)).catch(()=>(Fo=null,US)),Fo)}function Zo(){const[e,t]=f.useState(()=>Rl??US);return f.useEffect(()=>{I$().then(t)},[]),e}function ew(){Rl=null,Fo=null}function cc(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 tw={critical:0,high:1,medium:2,low:3};function Ru(e){return Date.parse(e??"")||0}function uc(e,t,n){return[...e].sort((i,l)=>{let c=0;switch(t){case"title":c=i.title.localeCompare(l.title);break;case"status":c=i.status.localeCompare(l.status);break;case"priority":c=(tw[i.priority]??99)-(tw[l.priority]??99);break;case"assignee":c=(i.assignee??"").localeCompare(l.assignee??"");break;case"dependencies":c=i.dependsOn.length-l.dependsOn.length;break;case"created":c=Ru(i.created)-Ru(l.created);break;case"updated":c=Ru(i.updated)-Ru(l.updated);break}return n==="asc"?c:-c})}function St({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 ma='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Zd({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:i,canDrop:l,onMove:c,getExternalDragData:u,onCardContextMenu:p,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:x,compact:y=!1,dragDisabled:b=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),j=f.useMemo(()=>e.filter(F=>!C.has(F.id)),[e,C]),w=f.useMemo(()=>e.filter(F=>C.has(F.id)),[e,C]),[k,E]=f.useState(null),[N,P]=f.useState(null),$=f.useRef(null),T=f.useMemo(()=>new Map(t.map(F=>[n(F),F])),[n,t]),D=f.useMemo(()=>j.map(F=>({column:F,items:t.filter(H=>s(H)===F.id)})),[j,s,t]),L=k?T.get(k)??null:null;function Y(F){if(!L)return{allowed:!1};const H=s(L);return(l==null?void 0:l({item:L,fromColumnId:H,toColumnId:F}))??{allowed:!0}}function X(){E(null),P(null)}function I(F,H,ee){if(b)return;const ce=(u==null?void 0:u(H))??null;!c&&!ce||(F.dataTransfer.effectAllowed="move",F.dataTransfer.setData("text/plain",ee),ce&&F.dataTransfer.setData("application/json",JSON.stringify(ce)),c&&E(ee))}function U(F,H,ee){b||!c||!L||!Y(H).allowed||(F.preventDefault(),F.dataTransfer.dropEffect="move",P(_=>(_==null?void 0:_.columnId)===H&&_.index===ee?_:{columnId:H,index:ee}))}async function ne(F,H,ee){var M;if(F.preventDefault(),b||!c||!L){X();return}const ce=s(L),W=(((M=D.find(Q=>Q.column.id===ce))==null?void 0:M.items)??[]).findIndex(Q=>n(Q)===n(L));if(!Y(H).allowed||W<0){X();return}if(ce===H&&(ee===W||ee===W+1)){X();return}try{await c({item:L,fromColumnId:ce,toColumnId:H,fromIndex:W,toIndex:ee})}finally{X()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[w.length>0&&x?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),w.map(F=>r.jsxs("button",{type:"button",onClick:()=>x(F.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${F.title}" column`,children:[F.title," ×"]},F.id))]}):null,r.jsx("div",{className:Te("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(200px,240px)]":"auto-cols-[minmax(260px,320px)]"),children:D.map(({column:F,items:H})=>{const ee=Y(F.id),ce=(N==null?void 0:N.columnId)===F.id;return r.jsxs("section",{className:Te("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",L&&!ee.allowed?"border-dashed opacity-65":"",L&&ee.allowed?"border-primary/30 bg-accent/30":"",ce?"ring-2 ring-ring/30":""),title:L&&!ee.allowed?ee.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:Te("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:F.title}),F.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:F.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:H.length}),x?r.jsx("button",{type:"button",onClick:()=>x(F.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 "${F.title}" column`,"aria-label":`Hide column ${F.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:_=>U(_,F.id,H.length),onDrop:_=>ne(_,F.id,H.length),children:[H.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(F):m}):r.jsx(_$,{active:(N==null?void 0:N.columnId)===F.id&&N.index===0,disabled:!!L&&!ee.allowed,children:typeof m=="function"?m(F):m}):null,H.map((_,W)=>{const R=n(_),M=k===R;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:Te("h-2 rounded-full transition",(N==null?void 0:N.columnId)===F.id&&N.index===W?"bg-primary/70":"bg-transparent"),onDragOver:Q=>U(Q,F.id,W),onDrop:Q=>ne(Q,F.id,W)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:Q=>{$.current=Q.target},onDragStart:Q=>{const O=$.current;if(O!=null&&O.closest(ma)){Q.preventDefault();return}I(Q,_,R)},onDragEnd:X,onContextMenu:Q=>{if(!p)return;const O=Q.target;O!=null&&O.closest(ma)||p(_,Q)},className:Te("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",M?"scale-[0.98] opacity-50":""),children:i(_,{dragging:M})})]},R)}),H.length>0&&!b?r.jsx("div",{className:Te("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(N==null?void 0:N.columnId)===F.id&&N.index===H.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",L&&!ee.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},F.id)})})]})}function _$({active:e,disabled:t,children:n}){return r.jsx("div",{className:Te("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 El="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Rm="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",M$="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",F$="border-status-review-foreground/30 bg-status-review text-status-review-foreground",z$="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",B$="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",U$="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",md={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:El,icon:ba},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:El,icon:tP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:El,icon:l0},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Rm,icon:yP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Rm,icon:sg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:M$,icon:ch},review:{label:"Review",description:"Ready for inspection or approval.",className:F$,icon:wP},completed:{label:"Completed",description:"Finished successfully.",className:z$,icon:eg},failed:{label:"Failed",description:"Could not be completed as planned.",className:B$,icon:ch},active:{label:"Active",description:"The project has active or review work in flight.",className:Rm,icon:uh},stopped:{label:"Stopped",description:"Session ended without completing.",className:El,icon:ZT},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:U$,icon:uh}};function hd(e){const t=md[e];return t||{className:El,icon:uh,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function VS(e,t){return Te("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)]",hd(e).className,t)}function pn({status:e,className:t,showIcon:n=!0,progress:s}){const i=hd(e),l=i.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,p=c?`${i.description} (${s.checked}/${s.total} criteria)`:i.description,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 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(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5"}):null;return r.jsxs("span",{title:p,className:VS(e,t),children:[m,r.jsx("span",{children:i.label})]})}function ef(e){var t;return((t=md[e])==null?void 0:t.description)??`Status: ${e}`}const HS={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 Yu=null,zi=null;function V$(){return Yu?Promise.resolve(Yu):zi||(zi=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Yu=e,zi=null,e)).catch(()=>(zi=null,HS)),zi)}function tf(){const[e,t]=f.useState(()=>Yu??HS);return f.useEffect(()=>{V$().then(t)},[]),e}function aa(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 H$(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ei({type:e,className:t,compact:n=!1}){const s=tf();if(!e)return null;const i=H$(s,e),l=(i==null?void 0:i.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=i!=null&&i.color?{backgroundColor:`color-mix(in oklch, ${i.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${i.color} 50%, transparent)`,color:i.color}:void 0;return r.jsx("span",{title:(i==null?void 0:i.description)??`Type: ${l}`,style:c,className:Te("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:l})}function Dr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:i}){const[l,c]=f.useState(!1);async function u(){if(!n)try{if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(e),c(!0),setTimeout(()=>c(!1),1500)}catch(p){i==null||i(p instanceof Error?p:new Error(String(p)))}}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(rd,{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:l?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:l?r.jsx(uo,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(rd,{className:"h-3 w-3","aria-hidden":"true"})})}function W$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function K$({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:i,compact:l=!1}){const c=Zo(),[u,p]=f.useState(()=>new Set(i.collapsed));f.useEffect(()=>{p(new Set(i.collapsed))},[i]);const m=h=>{p(x=>{const y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:Te("space-y-2",l?"space-y-1.5":"space-y-3"),children:t.map(h=>{const x=uc(e.filter(C=>C.status===h),n,s);if(x.length===0)return null;const y=!u.has(h),b=cc(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:Te("flex w-full items-center gap-2 text-left",l?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx(Kr,{className:Te("text-muted-foreground transition-transform",l?"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:Te("rounded-full border border-border/60 text-muted-foreground",l?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:x.length})]}),y&&r.jsx("ul",{className:Te("divide-y divide-border/40 border-t border-border/40",l?"text-xs":"text-sm"),children:x.map(C=>{const j=W$(C);return r.jsx("li",{children:r.jsxs(Ce,{to:j,className:Te("flex items-center gap-3 hover:bg-muted/40",l?"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:Dn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function q$(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function G$({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:i=!1}){const l=new Set(s.hidden);l.delete("title");const c=h=>!l.has(h),u=uc(e,t,n),p=i?"py-2 pr-3":"py-3 pr-4",m=i?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:Te("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:Te("font-medium",p),children:"Assignment"}):null,c("status")?r.jsx("th",{className:Te("font-medium",p),children:"Status"}):null,c("priority")?r.jsx("th",{className:Te("font-medium",p),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:Te("font-medium",p),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:Te("font-medium",p),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:Te("font-medium",p),children:"Created"}):null,c("updated")?r.jsx("th",{className:Te("font-medium",p),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const x=q$(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:p,children:[r.jsx(Ce,{to:x,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:p,children:r.jsx(pn,{status:h.status})}):null,c("priority")?r.jsx("td",{className:Te("capitalize text-muted-foreground",p),children:h.priority}):null,c("assignee")?r.jsx("td",{className:Te("text-muted-foreground",p),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:Te("text-muted-foreground",p),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:Te("text-muted-foreground",p),children:Dn(h.created)}):null,c("updated")?r.jsx("td",{className:Te("text-muted-foreground",p),children:Dn(h.updated)}):null]},y)})})]})})}function Y$(e,t,n){return e.filter(s=>Wg(s,t,{workspace:n,search:t.search}))}function WS({view:e,compact:t,emptyDescription:n}){const{data:s,loading:i,error:l}=Md(),c=Zo(),u=f.useMemo(()=>c.order.map(m=>({id:m,title:cc(c,m),description:ef(m)})),[c]),p=f.useMemo(()=>{if(!s)return[];const m=Y$(s.assignments,e.config.filters,e.workspace);return uc(m,e.config.sortField,e.config.sortDirection)},[s,e]);if(i&&!s)return r.jsx(mt,{label:"Loading assignments…"});if(l)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:l})]});if(p.length===0)return r.jsx(St,{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(Zd,{compact:t,dragDisabled:!0,columns:u,items:p,getItemId:m=>m.slug||m.id,getColumnId:m=>m.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:m=>t?r.jsx(J$,{item:m}):r.jsx(X$,{item:m})});case"list":return r.jsx(K$,{items:p,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(G$,{items:p,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function J$({item:e}){const t=Kl(e);return r.jsxs("div",{className:Te("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(Ce,{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(pn,{status:e.status})]}),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:Dn(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(Dr,{value:e.id})]}):null]})}function X$({item:e}){const t=Kl(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(Ce,{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(pn,{status:e.status})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ei,{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:Dn(e.updated)})]})]})}function Q$({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:i,refetch:l}=Go(e);return s?r.jsx(mt,{label:"Loading view…"}):i?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:i.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(WS,{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 Z$({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:Ho.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:Ho.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(eL,{session:t})},t.sessionId))})]})}function eL({session:e}){const t=ln(),[n,s]=f.useState(!1),i=tL(e,t),l=nL(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(Ce,{to:i,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:[l," · ",k0(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:Ho.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Dr,{value:e.path,label:Ho.recentSessionsCopyPathLabel,disabled:c,disabledReason:Ho.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function tL(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function nL(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}function rL(){const{data:e,loading:t,error:n}=z0();return t&&!e?r.jsx(mt,{label:"Loading sessions…"}):n?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 sessions"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]}):r.jsx(Z$,{sessions:(e==null?void 0:e.sessions)??[]})}const sL=5;function oL(){const{data:e,loading:t,error:n}=F0();if(t&&!e)return r.jsx(mt,{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 i=((e==null?void 0:e.inventories)??[]).slice(0,sL);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(Ce,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),i.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:i.map(l=>{const c=l.inventory,u=l.active_leases.length,p=l.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ce,{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,"/",p," leased"]})]})},c.slug)})})]})}const KS={"saved-view":{title:"Saved view",icon:d0,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(Q$,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ad,render:()=>f.createElement(rL)},inventories:{title:"Inventories",icon:Ld,render:()=>f.createElement(oL)}};function iL({slot:e,onReplace:t,onRemove:n}){if(e.widget===null)return r.jsx("div",{className:"flex min-h-[320px] items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",children:r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(rn,{className:"h-4 w-4"}),"Add widget"]})});const s=KS[e.widget.kind];if(!s)return r.jsx("div",{className:"min-h-[320px] overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",children:r.jsxs("div",{className:"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 i=s.icon;return r.jsxs("div",{className:"min-h-[320px] overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",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:[r.jsx(i,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(aL,{slot:e,fallback:s.title})})]}),r.jsx(Hg,{items:[{key:"replace",label:"Replace…",icon:bP,onSelect:t},{key:"remove",label:"Remove",icon:or,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:s.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function aL({slot:e,fallback:t}){var i,l;const n=((i=e.widget)==null?void 0:i.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Go(n);return((l=e.widget)==null?void 0:l.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const lL=["agent-sessions","inventories"];function cL({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:i}=Hd();function l(c){n(c),t(!1)}return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:"Add a widget"}),r.jsx(hs,{children:"Choose a built-in widget or one of your saved views."})]}),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:lL.map(c=>{const u=KS[c],p=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({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(p,{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"}),i?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(Ce,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsx("ul",{className:"max-h-72 divide-y divide-border/40 overflow-auto rounded-md border border-border/60",children:s.map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>l({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))}),!i&&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]})]})})}function uL(){const{data:e,error:t,refetch:n}=xR(),{data:s}=I0(),{layout:i}=BD(),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);mo("list:overview"),Ht({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const x=f.useCallback(w=>{p(w),c(!0)},[]),y=f.useCallback(async w=>{h(null);try{await VD(w)}catch(k){h(k instanceof Error?k.message:String(k))}},[]),b=f.useCallback(w=>{if(u===null)return;const k=i.slots.map((E,N)=>N===u?{...E,widget:w}:E);p(null),y(k)},[i.slots,u,y]),C=f.useCallback(w=>{const k=i.slots.map((E,N)=>N===w?{...E,widget:null}:E);y(k)},[i.slots,y]),j={};if(e)for(const w of Object.keys(e.segments))for(const k of e.segments[w].items)j[k.id]=k;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(TD,{hero:e.hero,itemsById:j}):t?r.jsx(wt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(CD,{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.jsx("div",{className:"grid grid-cols-1 gap-4 xl:grid-cols-2",children:i.slots.map((w,k)=>r.jsx(iL,{slot:w,index:k,onReplace:()=>x(k),onRemove:()=>C(k)},w.id))}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(og,{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(cL,{open:l,onOpenChange:w=>{c(w),w||p(null)},onSelect:b})]})}function dL({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 fL(){const{data:e,loading:t,error:n}=I0(),{openCheatsheet:s}=po();return t?r.jsx(mt,{label:"Loading help…"}):n||!e?r.jsx(wt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{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. ",us("Mod+k")," opens the command palette."]})]})}),r.jsx(We,{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(i=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:i},i))})}),r.jsx(We,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((i,l)=>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:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:i.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:i.detail}),i.command?r.jsx(qu,{command:i.command.command,description:i.command.description,example:i.command.example}):null,i.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open the related surface"}):null]})]})},i.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(We,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(i=>r.jsx(dL,{term:i.term,description:i.description},i.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(i=>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:i.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description})]},i.term))})]}),r.jsx(We,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(i=>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(pn,{status:i.status}),r.jsx("p",{className:"font-semibold text-foreground",children:i.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:i.useWhen})]},i.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(i=>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:i.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:i.files.map(l=>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:l},l))})]},i.label))})}),r.jsx(We,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(i=>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:i.label}),r.jsx(Ce,{className:"text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.description})]},i.label))})})]}),r.jsx(We,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(i=>r.jsx(qu,{command:i.command,description:i.description,example:i.example},i.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(i=>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:i.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.answer})]},i.question))})}),r.jsx(We,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((i,l)=>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:l+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:i.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:i.detail}),i.command?r.jsx(qu,{command:i.command.command,example:i.command.example}):null,i.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:i.href,children:"Open the related surface"}):null]})]})},i.title))})})]})]})}function Kg({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 nf=f.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(fo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:i=>t(i.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"})]}));nf.displayName="SearchInput";function rf({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:Te("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 pL={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"},nw=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function gd({progress:e,className:t,showLegend:n=!1}){const s=Zo(),i=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(p=>p!=="total")).map(p=>({key:p,className:pL[p]??nw[c++%nw.length]}))},[s.order,e]),l=i.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:Te("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"}):l.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${yn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.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:Te("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:yn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const mL=["pending","active","blocked","failed","completed"],qg=mL,hL=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function qS(e){return e&&e.length>0?e:[...hL]}function gL(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[i]=s.splice(t,1),l=t<n?n-1:n;return s.splice(Math.max(0,Math.min(l,s.length)),0,i),s}const xL=220,Au=8;function GS({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[i,l]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){l(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??xL,p=(c==null?void 0:c.offsetHeight)??0,m=Math.max(Au,window.innerWidth-u-Au),h=Math.max(Au,window.innerHeight-p-Au);l({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function p(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",p,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",p,!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:(i==null?void 0:i.left)??e.x,top:(i==null?void 0:i.top)??e.y,visibility:i?"visible":"hidden"},children:r.jsx(Wo,{delayDuration:200,children:t.map(c=>{const u=c.icon,p=Te("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:p,children:m})});return c.disabledReason?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:h}),r.jsx(gr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ce,{to:c.href,className:p,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:p,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const yL="__ungrouped__";function Gg({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:i="Move to workspace",description:l="Pick the workspace this item should belong to."}){const{data:c,loading:u}=oc(),[p,m]=f.useState(n),[h,x]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:yL,label:"Ungrouped",value:null}],[c]),j=!h&&p!==n;async function w(){if(j){x(!0),b(null);try{await s(p),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{x(!1)}}}return r.jsx(ir,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(Kn,{children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:i}),r.jsx(hs,{children:l})]}),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(sg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,N=k.value===p;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:Te("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":N?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:Te("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]}),N?r.jsx(uo,{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($s,{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:w,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function rw(){const{workspace:e}=$t(),t=ln(),n=Dt(),{data:s,loading:i,error:l,refetch:c}=Jo(),u=f.useRef(null);mo("list:projects");const[p,m]=f.useState(""),[h,x]=f.useState("all"),[y,b]=f.useState("all"),[C,j]=f.useState("updated"),[w,k]=ms(),E=w.get("view"),N=E==="table"||E==="kanban"?E:"cards",P=_=>{k(W=>{const R=new URLSearchParams(W);return _==="cards"?R.delete("view"):R.set("view",_),R})},[$,T]=f.useState({}),[D,L]=f.useState(null),[Y,X]=f.useState(null),I=f.useMemo(()=>s?s.filter(_=>{if(e){if(e==="_ungrouped"){if(_.workspace!==null)return!1}else if(_.workspace!==e)return!1}return h!=="all"&&_.status!==h||y!=="all"&&!_.tags.includes(y)?!1:p.trim()?`${_.title} ${_.tags.join(" ")} ${_.slug}`.toLowerCase().includes(p.toLowerCase()):!0}).sort((_,W)=>wL(_,W,C)):[],[s,p,h,y,C,e]),U=I.map(_=>`${_.slug}:${_.status}`).join("|");f.useEffect(()=>{T(jL(I))},[U,C]);const ne=f.useMemo(()=>{const _=new Map(I.map(W=>[W.slug,W]));return qg.flatMap(W=>($[W]??I.filter(M=>M.status===W).map(M=>M.slug)).map(M=>_.get(M)).filter(M=>!!M))},[I,$]),{visibleItems:F,visibleIndexByKey:H}=f.useMemo(()=>{const _=N==="kanban"?ne:I,W=new Map;return _.forEach((R,M)=>W.set(R.slug,M)),{visibleItems:_,visibleIndexByKey:W}},[N,I,ne]),{hotkeyRowProps:ee}=ic(F,{scope:"list:projects",onOpen:_=>n(`${t}/projects/${_.slug}`)});if(Ht({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var _;return(_=u.current)==null?void 0:_.focus()}}),Ht({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),i)return r.jsx(mt,{label:"Loading projects…"});if(l||!s)return r.jsx(wt,{error:l||"Project list is unavailable."});const ce=Array.from(new Set(s.flatMap(_=>_.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Kg,{children:[r.jsx(nf,{ref:u,value:p,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:_=>x(_.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:_=>b(_.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),ce.map(_=>r.jsx("option",{value:_,children:_},_))]}),r.jsxs("select",{value:C,onChange:_=>j(_.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(rf,{value:N,onChange:_=>P(_),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),I.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(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):N==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:I.map((_,W)=>r.jsxs(Ce,{to:`${t}/projects/${_.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...ee(W),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:_.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(_.updated)]})]}),r.jsx(pn,{status:_.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(gd,{progress:_.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:_.tags.map(R=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:R},R))}),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:_.needsAttention.blockedCount+_.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:_.progress.total})]})]})]})]},_.slug))}):N==="table"?r.jsx(We,{title:`${I.length} project${I.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:I.map((_,W)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...ee(W),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{to:`${t}/projects/${_.slug}`,className:"font-semibold text-foreground hover:text-primary",children:_.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:_.tags.map(R=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:R},R))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(pn,{status:_.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(gd,{progress:_.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:_.needsAttention.blockedCount+_.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(_.updated)})]},_.slug))})]})})}):r.jsx(Zd,{columns:vL,items:ne,getItemId:_=>_.slug,getColumnId:_=>_.status,canDrop:({fromColumnId:_,toColumnId:W})=>({allowed:!0,reason:_===W?void 0:"This will set a manual status override on the project."}),onMove:({item:_,fromColumnId:W,toColumnId:R,fromIndex:M,toIndex:Q})=>{if(W===R){const O=$[W]??I.filter(ue=>ue.status===W).map(ue=>ue.slug);T(ue=>({...ue,[W]:gL(O,M,Q)}));return}fetch(`/api/projects/${_.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:R})}).then(()=>{window.location.reload()})},getExternalDragData:_=>({type:"project",id:_.slug}),onCardContextMenu:(_,W)=>{W.preventDefault(),L({project:_,anchor:{x:W.clientX,y:W.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} projects.`,renderCard:(_,{dragging:W})=>{const R=H.get(_.slug)??-1;return r.jsx("div",{...R>=0?ee(R):{},children:r.jsx(kL,{project:_,dragging:W})})}}),r.jsx(GS,{anchor:(D==null?void 0:D.anchor)??null,items:D?[{key:"edit",label:"Edit",icon:ba,onSelect:()=>n(`${t}/projects/${D.project.slug}`)},{key:"move",label:"Move to workspace…",icon:$d,onSelect:()=>X(D.project)}]:[],onClose:()=>L(null)}),r.jsx(Gg,{open:Y!==null,onOpenChange:_=>{_||X(null)},currentWorkspace:(Y==null?void 0:Y.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!Y)return;const W=await fetch(`/api/projects/${encodeURIComponent(Y.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:_})});if(!W.ok){const R=await W.json().catch(()=>({}));throw new Error(R.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(rg,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",N==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const bL={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},vL=qg.map(e=>({id:e,title:bL[e],description:ef(e)}));function wL(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return sw(t)-sw(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function sw(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function jL(e){return Object.fromEntries(qg.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function kL({project:e,dragging:t}){const n=ln();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(Ce,{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 ",Dn(e.updated)]})]}),r.jsx(pn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(gd,{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 xd({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:Te("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]})}const SL=4e3;function ti(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),i=f.useCallback((l,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:l,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},SL)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:i,dismissToast:s}}function ni({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:Te("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 NL(){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(Dd,{className:"h-3 w-3"}),"Archived"]})}function ow(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function CL(){const{data:e,loading:t,error:n,refetch:s}=yR(),[i,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState({}),{toast:h,showToast:x,dismissToast:y}=ti();async function b(N,P,$){l(P),u(null);try{const T=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const D=await T.json().catch(()=>null);throw new Error((D==null?void 0:D.error)||`HTTP ${T.status}`)}s(),x($,"success")}catch(T){u(T instanceof Error?T.message:"Restore failed")}finally{l(null)}}function C(N){return b(`/api/projects/${N.slug}/unarchive`,`project:${N.slug}`,"Project restored")}function j(N){const P=N.projectSlug?`/api/projects/${N.projectSlug}/assignments/${N.slug}/unarchive`:`/api/assignments/${N.id}/unarchive`;return b(P,`assignment:${N.id}`,"Assignment restored")}if(t)return r.jsx(mt,{label:"Loading archived content…"});if(n)return r.jsx(wt,{error:n});const w=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=w.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ni,{toast:h,onDismiss:y}),r.jsx(xd,{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(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[w.length>0&&r.jsx(We,{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:w.map(N=>{const P=p[N.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($=>({...$,[N.slug]:!P})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":P,children:[P?r.jsx(Kr,{className:"h-4 w-4"}):r.jsx(QT,{className:"h-4 w-4"}),r.jsx(tg,{className:"h-4 w-4 text-muted-foreground"}),N.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",N.assignments.length," assignment",N.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",N.archivedAt?$r(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ce,{to:`/projects/${N.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(N),disabled:i===`project:${N.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(ed,{className:"h-3 w-3"}),"Restore"]})]})]}),P&&N.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:N.assignments.map($=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:ow($),className:"text-foreground hover:text-foreground/80",children:$.title}),r.jsx(pn,{status:$.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},$.id))})]},N.slug)})})}),k.length>0&&r.jsx(We,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(N=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Ce,{to:ow(N),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:N.title}),r.jsx(pn,{status:N.status,showIcon:!1}),r.jsx(NL,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.projectTitle??"Standalone"," · Archived"," ",N.archivedAt?$r(N.archivedAt):"with no timestamp",N.archivedReason?` · ${N.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(N),disabled:i===`assignment:${N.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(ed,{className:"h-3 w-3"}),"Restore"]})]},N.id))})})]})]})}const iw="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",aw="block min-w-0 truncate";function Yg({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:Te("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const i=`${n.system}:${n.id}`,l=`${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:Te(iw,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${i} in ${n.system}`,children:[r.jsx("span",{className:aw,children:i}),r.jsx(ya,{className:"h-2.5 w-2.5 shrink-0"})]},l):r.jsx("span",{className:iw,title:i,children:r.jsx("span",{className:aw,children:i})},l)})})}const EL={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 An({label:e,value:t,description:n,icon:s,tone:i="default",to:l}){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=Te(EL[i],l?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return l?r.jsx(Ce,{to:l,className:u,children:c}):r.jsx("article",{className:u,children:c})}function lw(e){const t=TL(e),n=f.forwardRef((s,i)=>{const{children:l,...c}=s,u=f.Children.toArray(l),p=u.find(RL);if(p){const m=p.props.children,h=u.map(x=>x===p?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:x);return r.jsx(t,{...c,ref:i,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:i,children:l})});return n.displayName=`${e}.Slot`,n}function TL(e){const t=f.forwardRef((n,s)=>{const{children:i,...l}=n;if(f.isValidElement(i)){const c=DL(i),u=AL(l,i.props);return i.type!==f.Fragment&&(u.ref=s?zd(s,c):c),f.cloneElement(i,u)}return f.Children.count(i)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var PL=Symbol("radix.slottable");function RL(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===PL}function AL(e,t){const n={...t};for(const s in t){const i=e[s],l=t[s];/^on[A-Z]/.test(s)?i&&l?n[s]=(...u)=>{const p=l(...u);return i(...u),p}:i&&(n[s]=i):s==="style"?n[s]={...i,...l}:s==="className"&&(n[s]=[i,l].filter(Boolean).join(" "))}return{...e,...n}}function DL(e){var s,i;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=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function $L(e){const t=e+"CollectionProvider",[n,s]=Xo(t),[i,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:w,children:k}=j,E=nn.useRef(null),N=nn.useRef(new Map).current;return r.jsx(i,{scope:w,itemMap:N,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",p=lw(u),m=nn.forwardRef((j,w)=>{const{scope:k,children:E}=j,N=l(u,k),P=Fn(w,N.collectionRef);return r.jsx(p,{ref:P,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",x="data-radix-collection-item",y=lw(h),b=nn.forwardRef((j,w)=>{const{scope:k,children:E,...N}=j,P=nn.useRef(null),$=Fn(w,P),T=l(h,k);return nn.useEffect(()=>(T.itemMap.set(P,{ref:P,...N}),()=>void T.itemMap.delete(P))),r.jsx(y,{[x]:"",ref:$,children:E})});b.displayName=h;function C(j){const w=l(e+"CollectionConsumer",j);return nn.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const N=Array.from(E.querySelectorAll(`[${x}]`));return Array.from(w.itemMap.values()).sort((T,D)=>N.indexOf(T.ref.current)-N.indexOf(D.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var LL=f.createContext(void 0);function YS(e){const t=f.useContext(LL);return e||t||"ltr"}var Am="rovingFocusGroup.onEntryFocus",OL={bubbles:!1,cancelable:!0},dc="RovingFocusGroup",[Ch,JS,IL]=$L(dc),[_L,XS]=Xo(dc,[IL]),[ML,FL]=_L(dc),QS=f.forwardRef((e,t)=>r.jsx(Ch.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Ch.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(zL,{...e,ref:t})})}));QS.displayName=dc;var zL=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:i=!1,dir:l,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:p,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...x}=e,y=f.useRef(null),b=Fn(t,y),C=YS(l),[j,w]=Bd({prop:c,defaultProp:u??null,onChange:p,caller:dc}),[k,E]=f.useState(!1),N=Ko(m),P=JS(n),$=f.useRef(!1),[T,D]=f.useState(0);return f.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(Am,N),()=>L.removeEventListener(Am,N)},[N]),r.jsx(ML,{scope:n,orientation:s,dir:C,loop:i,currentTabStopId:j,onItemFocus:f.useCallback(L=>w(L),[w]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>D(L=>L+1),[]),onFocusableItemRemove:f.useCallback(()=>D(L=>L-1),[]),children:r.jsx(mn.div,{tabIndex:k||T===0?-1:0,"data-orientation":s,...x,ref:b,style:{outline:"none",...e.style},onMouseDown:qt(e.onMouseDown,()=>{$.current=!0}),onFocus:qt(e.onFocus,L=>{const Y=!$.current;if(L.target===L.currentTarget&&Y&&!k){const X=new CustomEvent(Am,OL);if(L.currentTarget.dispatchEvent(X),!X.defaultPrevented){const I=P().filter(ee=>ee.focusable),U=I.find(ee=>ee.active),ne=I.find(ee=>ee.id===j),H=[U,ne,...I].filter(Boolean).map(ee=>ee.ref.current);t1(H,h)}}$.current=!1}),onBlur:qt(e.onBlur,()=>E(!1))})})}),ZS="RovingFocusGroupItem",e1=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:i=!1,tabStopId:l,children:c,...u}=e,p=na(),m=l||p,h=FL(ZS,n),x=h.currentTabStopId===m,y=JS(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return f.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(Ch.ItemSlot,{scope:n,id:m,focusable:s,active:i,children:r.jsx(mn.span,{tabIndex:x?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:qt(e.onMouseDown,w=>{s?h.onItemFocus(m):w.preventDefault()}),onFocus:qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:qt(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){h.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const k=VL(w,h.orientation,h.dir);if(k!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=y().filter(P=>P.focusable).map(P=>P.ref.current);if(k==="last")N.reverse();else if(k==="prev"||k==="next"){k==="prev"&&N.reverse();const P=N.indexOf(w.currentTarget);N=h.loop?HL(N,P+1):N.slice(P+1)}setTimeout(()=>t1(N))}}),children:typeof c=="function"?c({isCurrentTabStop:x,hasTabStop:j!=null}):c})})});e1.displayName=ZS;var BL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function UL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VL(e,t,n){const s=UL(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return BL[s]}function t1(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function HL(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var WL=QS,KL=e1,sf="Tabs",[qL]=Xo(sf,[XS]),n1=XS(),[GL,Jg]=qL(sf),r1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:i,defaultValue:l,orientation:c="horizontal",dir:u,activationMode:p="automatic",...m}=e,h=YS(u),[x,y]=Bd({prop:s,onChange:i,defaultProp:l??"",caller:sf});return r.jsx(GL,{scope:n,baseId:na(),value:x,onValueChange:y,orientation:c,dir:h,activationMode:p,children:r.jsx(mn.div,{dir:h,"data-orientation":c,...m,ref:t})})});r1.displayName=sf;var s1="TabsList",o1=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...i}=e,l=Jg(s1,n),c=n1(n);return r.jsx(WL,{asChild:!0,...c,orientation:l.orientation,dir:l.dir,loop:s,children:r.jsx(mn.div,{role:"tablist","aria-orientation":l.orientation,...i,ref:t})})});o1.displayName=s1;var i1="TabsTrigger",a1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:i=!1,...l}=e,c=Jg(i1,n),u=n1(n),p=u1(c.baseId,s),m=d1(c.baseId,s),h=s===c.value;return r.jsx(KL,{asChild:!0,...u,focusable:!i,active:h,children:r.jsx(mn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:p,...l,ref:t,onMouseDown:qt(e.onMouseDown,x=>{!i&&x.button===0&&x.ctrlKey===!1?c.onValueChange(s):x.preventDefault()}),onKeyDown:qt(e.onKeyDown,x=>{[" ","Enter"].includes(x.key)&&c.onValueChange(s)}),onFocus:qt(e.onFocus,()=>{const x=c.activationMode!=="manual";!h&&!i&&x&&c.onValueChange(s)})})})});a1.displayName=i1;var l1="TabsContent",c1=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:i,children:l,...c}=e,u=Jg(l1,n),p=u1(u.baseId,s),m=d1(u.baseId,s),h=s===u.value,x=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(Qo,{present:i||h,children:({present:y})=>r.jsx(mn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":p,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:x.current?"0s":void 0},children:y&&l})})});c1.displayName=l1;function u1(e,t){return`${e}-trigger-${t}`}function d1(e,t){return`${e}-content-${t}`}var f1=r1,p1=o1,Eh=a1,Th=c1;function Xg({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(f1,{value:e,onValueChange:t,className:s,children:[r.jsx(p1,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(i=>r.jsxs(Eh,{value:i.value,className:Te("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:i.label}),typeof i.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:i.count}):null]},i.value))}),n.map(i=>r.jsx(Th,{value:i.value,className:"pt-3",children:i.content},i.value))]})}const YL="modulepreload",JL=function(e){return"/"+e},cw={},XL=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),p=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));i=c(n.map(m=>{if(m=JL(m),m in cw)return;cw[m]=!0;const h=m.endsWith(".css"),x=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${x}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":YL,h||(y.as="script"),y.crossOrigin="",y.href=m,p&&y.setAttribute("nonce",p),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 l(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return i.then(c=>{for(const u of c||[])u.status==="rejected"&&l(u.reason);return t().catch(l)})};function QL({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[i,l]=f.useState(null),[c,u]=f.useState(!0),p=Dt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function x(){if(s.current)try{const y=(await XL(async()=>{const{default:j}=await import("./mermaid.core-GdFnPCS2.js").then(w=>w.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:ZL(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,eO(s.current,n,p),u(!1)}catch(y){h||(l(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),l(null),x(),()=>{h=!0}},[e,p,n,m]),i?r.jsxs("div",{className:Te("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: ",i]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:Te("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 ZL(e){const t=document.documentElement,n=x=>{const y=getComputedStyle(t).getPropertyValue(x).trim();return y?`oklch(${y})`:""},s=n("--card"),i=n("--card-foreground"),l=n("--border"),c=n("--primary"),u=n("--primary-foreground"),p=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:i,primaryBorderColor:l,secondaryColor:p,secondaryTextColor:i,secondaryBorderColor:l,tertiaryColor:p,tertiaryTextColor:m,tertiaryBorderColor:l,lineColor:e?m:l,textColor:i,mainBkg:s,nodeBkg:s,nodeTextColor:i,nodeBorder:l,clusterBkg:p,clusterBorder:l,edgeLabelBackground:s,titleColor:i,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:p,labelColor:i,errorBkgColor:h,errorTextColor:u}}function eO(e,t,n){var s;for(const i of e.querySelectorAll(".node")){const l=((s=i.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[l];if(!c)continue;i.style.cursor="pointer",i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",`Open ${l}`);const u=()=>n(c);i.addEventListener("click",u),i.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})}}function tO(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sO={};function uw(e,t){return(sO.jsx?rO:nO).test(e)}const oO=/[ \t\n\f\r]/g;function iO(e){return typeof e=="object"?e.type==="text"?dw(e.value):!1:dw(e)}function dw(e){return e.replace(oO,"")===""}class fc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}fc.prototype.normal={};fc.prototype.property={};fc.prototype.space=void 0;function m1(e,t){const n={},s={};for(const i of e)Object.assign(n,i.property),Object.assign(s,i.normal);return new fc(n,s,t)}function Ph(e){return e.toLowerCase()}class ar{constructor(t,n){this.attribute=n,this.property=t}}ar.prototype.attribute="";ar.prototype.booleanish=!1;ar.prototype.boolean=!1;ar.prototype.commaOrSpaceSeparated=!1;ar.prototype.commaSeparated=!1;ar.prototype.defined=!1;ar.prototype.mustUseProperty=!1;ar.prototype.number=!1;ar.prototype.overloadedBoolean=!1;ar.prototype.property="";ar.prototype.spaceSeparated=!1;ar.prototype.space=void 0;let aO=0;const dt=ri(),dn=ri(),Rh=ri(),Ee=ri(),It=ri(),la=ri(),pr=ri();function ri(){return 2**++aO}const Ah=Object.freeze(Object.defineProperty({__proto__:null,boolean:dt,booleanish:dn,commaOrSpaceSeparated:pr,commaSeparated:la,number:Ee,overloadedBoolean:Rh,spaceSeparated:It},Symbol.toStringTag,{value:"Module"})),Dm=Object.keys(Ah);class Qg extends ar{constructor(t,n,s,i){let l=-1;if(super(t,n),fw(this,"space",i),typeof s=="number")for(;++l<Dm.length;){const c=Dm[l];fw(this,Dm[l],(s&Ah[c])===Ah[c])}}}Qg.prototype.defined=!0;function fw(e,t,n){n&&(e[t]=n)}function ka(e){const t={},n={};for(const[s,i]of Object.entries(e.properties)){const l=new Qg(s,e.transform(e.attributes||{},s),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(l.mustUseProperty=!0),t[s]=l,n[Ph(s)]=s,n[Ph(l.attribute)]=s}return new fc(t,n,e.space)}const h1=ka({properties:{ariaActiveDescendant:null,ariaAtomic:dn,ariaAutoComplete:null,ariaBusy:dn,ariaChecked:dn,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:It,ariaCurrent:null,ariaDescribedBy:It,ariaDetails:null,ariaDisabled:dn,ariaDropEffect:It,ariaErrorMessage:null,ariaExpanded:dn,ariaFlowTo:It,ariaGrabbed:dn,ariaHasPopup:null,ariaHidden:dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:It,ariaLevel:Ee,ariaLive:null,ariaModal:dn,ariaMultiLine:dn,ariaMultiSelectable:dn,ariaOrientation:null,ariaOwns:It,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:dn,ariaReadOnly:dn,ariaRelevant:null,ariaRequired:dn,ariaRoleDescription:It,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:dn,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function g1(e,t){return t in e?e[t]:t}function x1(e,t){return g1(e,t.toLowerCase())}const lO=ka({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:la,acceptCharset:It,accessKey:It,action:null,allow:null,allowFullScreen:dt,allowPaymentRequest:dt,allowUserMedia:dt,alt:null,as:null,async:dt,autoCapitalize:null,autoComplete:It,autoFocus:dt,autoPlay:dt,blocking:It,capture:null,charSet:null,checked:dt,cite:null,className:It,cols:Ee,colSpan:null,content:null,contentEditable:dn,controls:dt,controlsList:It,coords:Ee|la,crossOrigin:null,data:null,dateTime:null,decoding:null,default:dt,defer:dt,dir:null,dirName:null,disabled:dt,download:Rh,draggable:dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:dt,formTarget:null,headers:It,height:Ee,hidden:Rh,high:Ee,href:null,hrefLang:null,htmlFor:It,httpEquiv:It,id:null,imageSizes:null,imageSrcSet:null,inert:dt,inputMode:null,integrity:null,is:null,isMap:dt,itemId:null,itemProp:It,itemRef:It,itemScope:dt,itemType:It,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:dt,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:dt,muted:dt,name:null,nonce:null,noModule:dt,noValidate:dt,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:dt,optimum:Ee,pattern:null,ping:It,placeholder:null,playsInline:dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:dt,referrerPolicy:null,rel:It,required:dt,reversed:dt,rows:Ee,rowSpan:Ee,sandbox:It,scope:null,scoped:dt,seamless:dt,selected:dt,shadowRootClonable:dt,shadowRootDelegatesFocus:dt,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:dt,useMap:null,value:dn,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:It,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:dt,declare:dt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:dt,noHref:dt,noShade:dt,noWrap:dt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:dn,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:dt,disableRemotePlayback:dt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:x1}),cO=ka({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:pr,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:It,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:la,g2:la,glyphName:la,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:pr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:It,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:pr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:pr,rev:pr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:pr,requiredFeatures:pr,requiredFonts:pr,requiredFormats:pr,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:pr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:pr,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:pr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:g1}),y1=ka({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()}}),b1=ka({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:x1}),v1=ka({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),uO={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"},dO=/[A-Z]/g,pw=/-[a-z]/g,fO=/^data[-\w.:]+$/i;function pO(e,t){const n=Ph(t);let s=t,i=ar;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&fO.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(pw,hO);s="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!pw.test(l)){let c=l.replace(dO,mO);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}i=Qg}return new i(s,t)}function mO(e){return"-"+e.toLowerCase()}function hO(e){return e.charAt(1).toUpperCase()}const gO=m1([h1,lO,y1,b1,v1],"html"),Zg=m1([h1,cO,y1,b1,v1],"svg");function xO(e){return e.join(" ").trim()}var Bi={},$m,mw;function yO(){if(mw)return $m;mw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,p=`
|
|
521
|
+
`,m="/",h="*",x="",y="comment",b="declaration";function C(w,k){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];k=k||{};var E=1,N=1;function P(F){var H=F.match(t);H&&(E+=H.length);var ee=F.lastIndexOf(p);N=~ee?F.length-ee:N+F.length}function $(){var F={line:E,column:N};return function(H){return H.position=new T(F),Y(),H}}function T(F){this.start=F,this.end={line:E,column:N},this.source=k.source}T.prototype.content=w;function D(F){var H=new Error(k.source+":"+E+":"+N+": "+F);if(H.reason=F,H.filename=k.source,H.line=E,H.column=N,H.source=w,!k.silent)throw H}function L(F){var H=F.exec(w);if(H){var ee=H[0];return P(ee),w=w.slice(ee.length),H}}function Y(){L(n)}function X(F){var H;for(F=F||[];H=I();)H!==!1&&F.push(H);return F}function I(){var F=$();if(!(m!=w.charAt(0)||h!=w.charAt(1))){for(var H=2;x!=w.charAt(H)&&(h!=w.charAt(H)||m!=w.charAt(H+1));)++H;if(H+=2,x===w.charAt(H-1))return D("End of comment missing");var ee=w.slice(2,H-2);return N+=2,P(ee),w=w.slice(H),N+=2,F({type:y,comment:ee})}}function U(){var F=$(),H=L(s);if(H){if(I(),!L(i))return D("property missing ':'");var ee=L(l),ce=F({type:b,property:j(H[0].replace(e,x)),value:ee?j(ee[0].replace(e,x)):x});return L(c),ce}}function ne(){var F=[];X(F);for(var H;H=U();)H!==!1&&(F.push(H),X(F));return F}return Y(),ne()}function j(w){return w?w.replace(u,x):x}return $m=C,$m}var hw;function bO(){if(hw)return Bi;hw=1;var e=Bi&&Bi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=n;const t=e(yO());function n(s,i){let l=null;if(!s||typeof s!="string")return l;const c=(0,t.default)(s),u=typeof i=="function";return c.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:h}=p;u?i(m,h,p):h&&(l=l||{},l[m]=h)}),l}return Bi}var yl={},gw;function vO(){if(gw)return yl;gw=1,Object.defineProperty(yl,"__esModule",{value:!0}),yl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},p=function(m,h){return h===void 0&&(h={}),l(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(i,u):m=m.replace(s,u),m.replace(t,c))};return yl.camelCase=p,yl}var bl,xw;function wO(){if(xw)return bl;xw=1;var e=bl&&bl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(bO()),n=vO();function s(i,l){var c={};return!i||typeof i!="string"||(0,t.default)(i,function(u,p){u&&p&&(c[(0,n.camelCase)(u,l)]=p)}),c}return s.default=s,bl=s,bl}var jO=wO();const kO=Td(jO),w1=j1("end"),ex=j1("start");function j1(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 SO(e){const t=ex(e),n=w1(e);if(t&&n)return{start:t,end:n}}function Al(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yw(e.position):"start"in e||"end"in e?yw(e):"line"in e||"column"in e?Dh(e):""}function Dh(e){return bw(e&&e.line)+":"+bw(e&&e.column)}function yw(e){return Dh(e&&e.start)+"-"+Dh(e&&e.end)}function bw(e){return e&&typeof e=="number"?e:1}class zn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let i="",l={},c=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?i=t:!l.cause&&t&&(c=!0,i=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?l.ruleId=s:(l.source=s.slice(0,p),l.ruleId=s.slice(p+1))}if(!l.place&&l.ancestors&&l.ancestors){const p=l.ancestors[l.ancestors.length-1];p&&(l.place=p.position)}const u=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=u?u.line:void 0,this.name=Al(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=c&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}zn.prototype.file="";zn.prototype.name="";zn.prototype.reason="";zn.prototype.message="";zn.prototype.stack="";zn.prototype.column=void 0;zn.prototype.line=void 0;zn.prototype.ancestors=void 0;zn.prototype.cause=void 0;zn.prototype.fatal=void 0;zn.prototype.place=void 0;zn.prototype.ruleId=void 0;zn.prototype.source=void 0;const tx={}.hasOwnProperty,NO=new Map,CO=/[A-Z]/g,EO=new Set(["table","tbody","thead","tfoot","tr"]),TO=new Set(["td","th"]),k1="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function PO(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=_O(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=IO(n,t.jsx,t.jsxs)}const i={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"?Zg:gO,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=S1(i,e,void 0);return l&&typeof l!="string"?l:i.create(e,i.Fragment,{children:l||void 0},void 0)}function S1(e,t,n){if(t.type==="element")return RO(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return AO(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return $O(e,t,n);if(t.type==="mdxjsEsm")return DO(e,t);if(t.type==="root")return LO(e,t,n);if(t.type==="text")return OO(e,t)}function RO(e,t,n){const s=e.schema;let i=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(i=Zg,e.schema=i),e.ancestors.push(t);const l=C1(e,t.tagName,!1),c=MO(e,t);let u=rx(e,t);return EO.has(t.tagName)&&(u=u.filter(function(p){return typeof p=="string"?!iO(p):!0})),N1(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function AO(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)}ql(e,t.position)}function DO(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ql(e,t.position)}function $O(e,t,n){const s=e.schema;let i=s;t.name==="svg"&&s.space==="html"&&(i=Zg,e.schema=i),e.ancestors.push(t);const l=t.name===null?e.Fragment:C1(e,t.name,!0),c=FO(e,t),u=rx(e,t);return N1(e,c,l,t),nx(c,u),e.ancestors.pop(),e.schema=s,e.create(t,l,c,n)}function LO(e,t,n){const s={};return nx(s,rx(e,t)),e.create(t,e.Fragment,s,n)}function OO(e,t){return t.value}function N1(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function nx(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function IO(e,t,n){return s;function s(i,l,c,u){const m=Array.isArray(c.children)?n:t;return u?m(l,c,u):m(l,c)}}function _O(e,t){return n;function n(s,i,l,c){const u=Array.isArray(l.children),p=ex(s);return t(i,l,c,u,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function MO(e,t){const n={};let s,i;for(i in t.properties)if(i!=="children"&&tx.call(t.properties,i)){const l=zO(e,i,t.properties[i]);if(l){const[c,u]=l;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&TO.has(t.tagName)?s=u:n[c]=u}}if(s){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function FO(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const l=s.data.estree.body[0];l.type;const c=l.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else ql(e,t.position);else{const i=s.name;let l;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,l=e.evaluater.evaluateExpression(u.expression)}else ql(e,t.position);else l=s.value===null?!0:s.value;n[i]=l}return n}function rx(e,t){const n=[];let s=-1;const i=e.passKeys?new Map:NO;for(;++s<t.children.length;){const l=t.children[s];let c;if(e.passKeys){const p=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(p){const m=i.get(p)||0;c=p+"-"+m,i.set(p,m+1)}}const u=S1(e,l,c);u!==void 0&&n.push(u)}return n}function zO(e,t,n){const s=pO(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?tO(n):xO(n)),s.property==="style"){let i=typeof n=="object"?n:BO(e,String(n));return e.stylePropertyNameCase==="css"&&(i=UO(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&s.space?uO[s.property]||s.property:s.attribute,n]}}function BO(e,t){try{return kO(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,i=new zn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=k1+"#cannot-parse-style-attribute",i}}function C1(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let l=-1,c;for(;++l<i.length;){const u=uw(i[l])?{type:"Identifier",name:i[l]}:{type:"Literal",value:i[l]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(l&&u.type==="Literal"),optional:!1}:u}s=c}else s=uw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const i=s.value;return tx.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(s);ql(e)}function ql(e,t){const n=new zn("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=k1+"#cannot-handle-mdx-estrees-without-createevaluater",n}function UO(e){const t={};let n;for(n in e)tx.call(e,n)&&(t[VO(n)]=e[n]);return t}function VO(e){let t=e.replace(CO,HO);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function HO(e){return"-"+e.toLowerCase()}const Lm={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"]},WO={};function KO(e,t){const n=WO,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return E1(e,s,i)}function E1(e,t,n){if(qO(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 vw(e.children,t,n)}return Array.isArray(e)?vw(e,t,n):""}function vw(e,t,n){const s=[];let i=-1;for(;++i<e.length;)s[i]=E1(e[i],t,n);return s.join("")}function qO(e){return!!(e&&typeof e=="object")}const ww=document.createElement("i");function sx(e){const t="&"+e+";";ww.innerHTML=t;const n=ww.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function fs(e,t,n,s){const i=e.length;let l=0,c;if(t<0?t=-t>i?0:i+t:t=t>i?i: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);l<s.length;)c=s.slice(l,l+1e4),c.unshift(t,0),e.splice(...c),l+=1e4,t+=1e4}function Tr(e,t){return e.length>0?(fs(e,e.length,0,t),e):t}const jw={}.hasOwnProperty;function GO(e){const t={};let n=-1;for(;++n<e.length;)YO(t,e[n]);return t}function YO(e,t){let n;for(n in t){const i=(jw.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let c;if(l)for(c in l){jw.call(i,c)||(i[c]=[]);const u=l[c];JO(i[c],Array.isArray(u)?u:u?[u]:[])}}}function JO(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);fs(e,0,0,s)}function T1(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 ca(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const as=ho(/[A-Za-z]/),xr=ho(/[\dA-Za-z]/),XO=ho(/[#-'*+\--9=?A-Z^-~]/);function $h(e){return e!==null&&(e<32||e===127)}const Lh=ho(/\d/),QO=ho(/[\dA-Fa-f]/),ZO=ho(/[!-/:-@[-`{-~]/);function st(e){return e!==null&&e<-2}function sr(e){return e!==null&&(e<0||e===32)}function Tt(e){return e===-2||e===-1||e===32}const eI=ho(new RegExp("\\p{P}|\\p{S}","u")),tI=ho(/\s/);function ho(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Sa(e){const t=[];let n=-1,s=0,i=0;for(;++n<e.length;){const l=e.charCodeAt(n);let c="";if(l===37&&xr(e.charCodeAt(n+1))&&xr(e.charCodeAt(n+2)))i=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(c=String.fromCharCode(l));else if(l>55295&&l<57344){const u=e.charCodeAt(n+1);l<56320&&u>56319&&u<57344?(c=String.fromCharCode(l,u),i=1):c="�"}else c=String.fromCharCode(l);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+i+1,c=""),i&&(n+=i,i=0)}return t.join("")+e.slice(s)}function _t(e,t,n,s){const i=s?s-1:Number.POSITIVE_INFINITY;let l=0;return c;function c(p){return Tt(p)?(e.enter(n),u(p)):t(p)}function u(p){return Tt(p)&&l++<i?(e.consume(p),u):(e.exit(n),t(p))}}const nI={tokenize:rI};function rI(e){const t=e.attempt(this.parser.constructs.contentInitial,s,i);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),_t(e,t,"linePrefix")}function i(u){return e.enter("paragraph"),l(u)}function l(u){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return st(u)?(e.consume(u),e.exit("chunkText"),l):(e.consume(u),c)}}const sI={tokenize:oI},kw={tokenize:iI};function oI(e){const t=this,n=[];let s=0,i,l,c;return u;function u(N){if(s<n.length){const P=n[s];return t.containerState=P[1],e.attempt(P[0].continuation,p,m)(N)}return m(N)}function p(N){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&E();const P=t.events.length;let $=P,T;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){T=t.events[$][1].end;break}k(s);let D=P;for(;D<t.events.length;)t.events[D][1].end={...T},D++;return fs(t.events,$+1,0,t.events.slice(P)),t.events.length=D,m(N)}return u(N)}function m(N){if(s===n.length){if(!i)return y(N);if(i.currentConstruct&&i.currentConstruct.concrete)return C(N);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kw,h,x)(N)}function h(N){return i&&E(),k(s),y(N)}function x(N){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(N)}function y(N){return t.containerState={},e.attempt(kw,b,C)(N)}function b(N){return s++,n.push([t.currentConstruct,t.containerState]),y(N)}function C(N){if(N===null){i&&E(),k(0),e.consume(N);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:l}),j(N)}function j(N){if(N===null){w(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return st(N)?(e.consume(N),w(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(N),j)}function w(N,P){const $=t.sliceStream(N);if(P&&$.push(null),N.previous=l,l&&(l.next=N),l=N,i.defineSkip(N.start),i.write($),t.parser.lazy[N.start.line]){let T=i.events.length;for(;T--;)if(i.events[T][1].start.offset<c&&(!i.events[T][1].end||i.events[T][1].end.offset>c))return;const D=t.events.length;let L=D,Y,X;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(Y){X=t.events[L][1].end;break}Y=!0}for(k(s),T=D;T<t.events.length;)t.events[T][1].end={...X},T++;fs(t.events,L+1,0,t.events.slice(D)),t.events.length=T}}function k(N){let P=n.length;for(;P-- >N;){const $=n[P];t.containerState=$[1],$[0].exit.call(t,e)}n.length=N}function E(){i.write([null]),l=void 0,i=void 0,t.containerState._closeFlow=void 0}}function iI(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Sw(e){if(e===null||sr(e)||tI(e))return 1;if(eI(e))return 2}function ox(e,t,n){const s=[];let i=-1;for(;++i<e.length;){const l=e[i].resolveAll;l&&!s.includes(l)&&(t=l(t,n),s.push(l))}return t}const Oh={name:"attention",resolveAll:aI,tokenize:lI};function aI(e,t){let n=-1,s,i,l,c,u,p,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;p=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 x={...e[s][1].end},y={...e[n][1].start};Nw(x,-p),Nw(y,p),c={type:p>1?"strongSequence":"emphasisSequence",start:x,end:{...e[s][1].end}},u={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},l={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},i={type:p>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=Tr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Tr(m,[["enter",i,t],["enter",c,t],["exit",c,t],["enter",l,t]]),m=Tr(m,ox(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Tr(m,[["exit",l,t],["enter",u,t],["exit",u,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Tr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,fs(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 lI(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,i=Sw(s);let l;return c;function c(p){return l=p,e.enter("attentionSequence"),u(p)}function u(p){if(p===l)return e.consume(p),u;const m=e.exit("attentionSequence"),h=Sw(p),x=!h||h===2&&i||n.includes(p),y=!i||i===2&&h||n.includes(s);return m._open=!!(l===42?x:x&&(i||!y)),m._close=!!(l===42?y:y&&(h||!x)),t(p)}}function Nw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const cI={name:"autolink",tokenize:uI};function uI(e,t,n){let s=0;return i;function i(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(b){return as(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||xr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,p):(b===43||b===45||b===46||xr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function p(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||$h(b)?n(b):(e.consume(b),p)}function m(b){return b===64?(e.consume(b),h):XO(b)?(e.consume(b),m):n(b)}function h(b){return xr(b)?x(b):n(b)}function x(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||xr(b))&&s++<63){const C=b===45?y:x;return e.consume(b),C}return n(b)}}const of={partial:!0,tokenize:dI};function dI(e,t,n){return s;function s(l){return Tt(l)?_t(e,i,"linePrefix")(l):i(l)}function i(l){return l===null||st(l)?t(l):n(l)}}const P1={continuation:{tokenize:pI},exit:mI,name:"blockQuote",tokenize:fI};function fI(e,t,n){const s=this;return i;function i(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"),l}return n(c)}function l(c){return Tt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function pI(e,t,n){const s=this;return i;function i(c){return Tt(c)?_t(e,l,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):l(c)}function l(c){return e.attempt(P1,t,n)(c)}}function mI(e){e.exit("blockQuote")}const R1={name:"characterEscape",tokenize:hI};function hI(e,t,n){return s;function s(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),i}function i(l){return ZO(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const A1={name:"characterReference",tokenize:gI};function gI(e,t,n){const s=this;let i=0,l,c;return u;function u(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),p}function p(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,c=xr,h(x))}function m(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,c=QO,h):(e.enter("characterReferenceValue"),l=7,c=Lh,h(x))}function h(x){if(x===59&&i){const y=e.exit("characterReferenceValue");return c===xr&&!sx(s.sliceSerialize(y))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(x)&&i++<l?(e.consume(x),h):n(x)}}const Cw={partial:!0,tokenize:yI},Ew={concrete:!0,name:"codeFenced",tokenize:xI};function xI(e,t,n){const s=this,i={partial:!0,tokenize:$};let l=0,c=0,u;return p;function p(T){return m(T)}function m(T){const D=s.events[s.events.length-1];return l=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,u=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(T)}function h(T){return T===u?(c++,e.consume(T),h):c<3?n(T):(e.exit("codeFencedFenceSequence"),Tt(T)?_t(e,x,"whitespace")(T):x(T))}function x(T){return T===null||st(T)?(e.exit("codeFencedFence"),s.interrupt?t(T):e.check(Cw,j,P)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===null||st(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(T)):Tt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_t(e,b,"whitespace")(T)):T===96&&T===u?n(T):(e.consume(T),y)}function b(T){return T===null||st(T)?x(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(T))}function C(T){return T===null||st(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(T)):T===96&&T===u?n(T):(e.consume(T),C)}function j(T){return e.attempt(i,P,w)(T)}function w(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),k}function k(T){return l>0&&Tt(T)?_t(e,E,"linePrefix",l+1)(T):E(T)}function E(T){return T===null||st(T)?e.check(Cw,j,P)(T):(e.enter("codeFlowValue"),N(T))}function N(T){return T===null||st(T)?(e.exit("codeFlowValue"),E(T)):(e.consume(T),N)}function P(T){return e.exit("codeFenced"),t(T)}function $(T,D,L){let Y=0;return X;function X(H){return T.enter("lineEnding"),T.consume(H),T.exit("lineEnding"),I}function I(H){return T.enter("codeFencedFence"),Tt(H)?_t(T,U,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):U(H)}function U(H){return H===u?(T.enter("codeFencedFenceSequence"),ne(H)):L(H)}function ne(H){return H===u?(Y++,T.consume(H),ne):Y>=c?(T.exit("codeFencedFenceSequence"),Tt(H)?_t(T,F,"whitespace")(H):F(H)):L(H)}function F(H){return H===null||st(H)?(T.exit("codeFencedFence"),D(H)):L(H)}}}function yI(e,t,n){const s=this;return i;function i(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Om={name:"codeIndented",tokenize:vI},bI={partial:!0,tokenize:wI};function vI(e,t,n){const s=this;return i;function i(m){return e.enter("codeIndented"),_t(e,l,"linePrefix",5)(m)}function l(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?p(m):st(m)?e.attempt(bI,c,p)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||st(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function p(m){return e.exit("codeIndented"),t(m)}}function wI(e,t,n){const s=this;return i;function i(c){return s.parser.lazy[s.now().line]?n(c):st(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):_t(e,l,"linePrefix",5)(c)}function l(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):st(c)?i(c):n(c)}}const jI={name:"codeText",previous:SI,resolve:kI,tokenize:NI};function kI(e){let t=e.length-4,n=3,s,i;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;)i===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(i=s):(s===t||e[s][1].type==="lineEnding")&&(e[i][1].type="codeTextData",s!==i+2&&(e[i][1].end=e[s-1][1].end,e.splice(i+2,s-i-2),t-=s-i-2,s=i+2),i=void 0);return e}function SI(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NI(e,t,n){let s=0,i,l;return c;function c(x){return e.enter("codeText"),e.enter("codeTextSequence"),u(x)}function u(x){return x===96?(e.consume(x),s++,u):(e.exit("codeTextSequence"),p(x))}function p(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),p):x===96?(l=e.enter("codeTextSequence"),i=0,h(x)):st(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(x))}function m(x){return x===null||x===32||x===96||st(x)?(e.exit("codeTextData"),p(x)):(e.consume(x),m)}function h(x){return x===96?(e.consume(x),i++,h):i===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(l.type="codeTextData",m(x))}}class CI{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 i=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return s&&vl(this.left,s),l.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),vl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vl(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);vl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vl(this.left,n.reverse())}}}function vl(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 D1(e){const t={};let n=-1,s,i,l,c,u,p,m;const h=new CI(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"&&(p=s[1]._tokenizer.events,l=0,l<p.length&&p[l][1].type==="lineEndingBlank"&&(l+=2),l<p.length&&p[l][1].type==="content"))for(;++l<p.length&&p[l][1].type!=="content";)p[l][1].type==="chunkText"&&(p[l][1]._isInFirstContentOfListItem=!0,l++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,EI(h,n)),n=t[n],m=!0);else if(s[1]._container){for(l=n,i=void 0;l--;)if(c=h.get(l),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(i&&(h.get(i)[1].type="lineEndingBlank"),c[1].type="lineEnding",i=l);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;i&&(s[1].end={...h.get(i)[1].start},u=h.slice(i,n),u.unshift(s),h.splice(i,n-i+1,u))}}return fs(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function EI(e,t){const n=e.get(t)[1],s=e.get(t)[2];let i=t-1;const l=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,p=[],m={};let h,x,y=-1,b=n,C=0,j=0;const w=[j];for(;b;){for(;e.get(++i)[1]!==b;);l.push(i),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),x&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),x=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,w.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):w.pop(),y=w.length;y--;){const k=u.slice(w[y],w[y+1]),E=l.pop();p.push([E,E+k.length-1]),e.splice(E,2,k)}for(p.reverse(),y=-1;++y<p.length;)m[C+p[y][0]]=C+p[y][1],C+=p[y][1]-p[y][0]-1;return m}const TI={resolve:RI,tokenize:AI},PI={partial:!0,tokenize:DI};function RI(e){return D1(e),e}function AI(e,t){let n;return s;function s(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(u)}function i(u){return u===null?l(u):st(u)?e.check(PI,c,l)(u):(e.consume(u),i)}function l(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,i}}function DI(e,t,n){const s=this;return i;function i(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),_t(e,l,"linePrefix")}function l(c){if(c===null||st(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 $1(e,t,n,s,i,l,c,u,p){const m=p||Number.POSITIVE_INFINITY;let h=0;return x;function x(k){return k===60?(e.enter(s),e.enter(i),e.enter(l),e.consume(k),e.exit(l),y):k===null||k===32||k===41||$h(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(l),e.consume(k),e.exit(l),e.exit(i),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||st(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||sr(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||$h(k)?n(k):(e.consume(k),k===92?w:j)}function w(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function L1(e,t,n,s,i,l){const c=this;let u=0,p;return m;function m(b){return e.enter(s),e.enter(i),e.consume(b),e.exit(i),e.enter(l),h}function h(b){return u>999||b===null||b===91||b===93&&!p||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(l),e.enter(i),e.consume(b),e.exit(i),e.exit(s),t):st(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),x(b))}function x(b){return b===null||b===91||b===93||st(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),p||(p=!Tt(b)),b===92?y:x)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,x):x(b)}}function O1(e,t,n,s,i,l){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(i),e.consume(y),e.exit(i),c=y===40?41:y,p):n(y)}function p(y){return y===c?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),t):(e.enter(l),m(y))}function m(y){return y===c?(e.exit(l),p(c)):y===null?n(y):st(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),_t(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||st(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?x:h)}function x(y){return y===c||y===92?(e.consume(y),h):h(y)}}function Dl(e,t){let n;return s;function s(i){return st(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,s):Tt(i)?_t(e,s,n?"linePrefix":"lineSuffix")(i):t(i)}}const $I={name:"definition",tokenize:OI},LI={partial:!0,tokenize:II};function OI(e,t,n){const s=this;let i;return l;function l(b){return e.enter("definition"),c(b)}function c(b){return L1.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return i=ca(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),p):n(b)}function p(b){return sr(b)?Dl(e,m)(b):m(b)}function m(b){return $1(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(LI,x,x)(b)}function x(b){return Tt(b)?_t(e,y,"whitespace")(b):y(b)}function y(b){return b===null||st(b)?(e.exit("definition"),s.parser.defined.push(i),t(b)):n(b)}}function II(e,t,n){return s;function s(u){return sr(u)?Dl(e,i)(u):n(u)}function i(u){return O1(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function l(u){return Tt(u)?_t(e,c,"whitespace")(u):c(u)}function c(u){return u===null||st(u)?t(u):n(u)}}const _I={name:"hardBreakEscape",tokenize:MI};function MI(e,t,n){return s;function s(l){return e.enter("hardBreakEscape"),e.consume(l),i}function i(l){return st(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const FI={name:"headingAtx",resolve:zI,tokenize:BI};function zI(e,t){let n=e.length-2,s=3,i,l;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&&(i={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},l={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},fs(e,s,n-s+1,[["enter",i,t],["enter",l,t],["exit",l,t],["exit",i,t]])),e}function BI(e,t,n){let s=0;return i;function i(h){return e.enter("atxHeading"),l(h)}function l(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||sr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),p(h)):h===null||st(h)?(e.exit("atxHeading"),t(h)):Tt(h)?_t(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function p(h){return h===35?(e.consume(h),p):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||sr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const UI=["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"],Tw=["pre","script","style","textarea"],VI={concrete:!0,name:"htmlFlow",resolveTo:KI,tokenize:qI},HI={partial:!0,tokenize:YI},WI={partial:!0,tokenize:GI};function KI(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 qI(e,t,n){const s=this;let i,l,c,u,p;return m;function m(O){return h(O)}function h(O){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(O),x}function x(O){return O===33?(e.consume(O),y):O===47?(e.consume(O),l=!0,j):O===63?(e.consume(O),i=3,s.interrupt?t:R):as(O)?(e.consume(O),c=String.fromCharCode(O),w):n(O)}function y(O){return O===45?(e.consume(O),i=2,b):O===91?(e.consume(O),i=5,u=0,C):as(O)?(e.consume(O),i=4,s.interrupt?t:R):n(O)}function b(O){return O===45?(e.consume(O),s.interrupt?t:R):n(O)}function C(O){const ue="CDATA[";return O===ue.charCodeAt(u++)?(e.consume(O),u===ue.length?s.interrupt?t:U:C):n(O)}function j(O){return as(O)?(e.consume(O),c=String.fromCharCode(O),w):n(O)}function w(O){if(O===null||O===47||O===62||sr(O)){const ue=O===47,ge=c.toLowerCase();return!ue&&!l&&Tw.includes(ge)?(i=1,s.interrupt?t(O):U(O)):UI.includes(c.toLowerCase())?(i=6,ue?(e.consume(O),k):s.interrupt?t(O):U(O)):(i=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(O):l?E(O):N(O))}return O===45||xr(O)?(e.consume(O),c+=String.fromCharCode(O),w):n(O)}function k(O){return O===62?(e.consume(O),s.interrupt?t:U):n(O)}function E(O){return Tt(O)?(e.consume(O),E):X(O)}function N(O){return O===47?(e.consume(O),X):O===58||O===95||as(O)?(e.consume(O),P):Tt(O)?(e.consume(O),N):X(O)}function P(O){return O===45||O===46||O===58||O===95||xr(O)?(e.consume(O),P):$(O)}function $(O){return O===61?(e.consume(O),T):Tt(O)?(e.consume(O),$):N(O)}function T(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(e.consume(O),p=O,D):Tt(O)?(e.consume(O),T):L(O)}function D(O){return O===p?(e.consume(O),p=null,Y):O===null||st(O)?n(O):(e.consume(O),D)}function L(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||sr(O)?$(O):(e.consume(O),L)}function Y(O){return O===47||O===62||Tt(O)?N(O):n(O)}function X(O){return O===62?(e.consume(O),I):n(O)}function I(O){return O===null||st(O)?U(O):Tt(O)?(e.consume(O),I):n(O)}function U(O){return O===45&&i===2?(e.consume(O),ee):O===60&&i===1?(e.consume(O),ce):O===62&&i===4?(e.consume(O),M):O===63&&i===3?(e.consume(O),R):O===93&&i===5?(e.consume(O),W):st(O)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(HI,Q,ne)(O)):O===null||st(O)?(e.exit("htmlFlowData"),ne(O)):(e.consume(O),U)}function ne(O){return e.check(WI,F,Q)(O)}function F(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),H}function H(O){return O===null||st(O)?ne(O):(e.enter("htmlFlowData"),U(O))}function ee(O){return O===45?(e.consume(O),R):U(O)}function ce(O){return O===47?(e.consume(O),c="",_):U(O)}function _(O){if(O===62){const ue=c.toLowerCase();return Tw.includes(ue)?(e.consume(O),M):U(O)}return as(O)&&c.length<8?(e.consume(O),c+=String.fromCharCode(O),_):U(O)}function W(O){return O===93?(e.consume(O),R):U(O)}function R(O){return O===62?(e.consume(O),M):O===45&&i===2?(e.consume(O),R):U(O)}function M(O){return O===null||st(O)?(e.exit("htmlFlowData"),Q(O)):(e.consume(O),M)}function Q(O){return e.exit("htmlFlow"),t(O)}}function GI(e,t,n){const s=this;return i;function i(c){return st(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),l):n(c)}function l(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function YI(e,t,n){return s;function s(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(of,t,n)}}const JI={name:"htmlText",tokenize:XI};function XI(e,t,n){const s=this;let i,l,c;return u;function u(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),p}function p(R){return R===33?(e.consume(R),m):R===47?(e.consume(R),$):R===63?(e.consume(R),N):as(R)?(e.consume(R),L):n(R)}function m(R){return R===45?(e.consume(R),h):R===91?(e.consume(R),l=0,C):as(R)?(e.consume(R),E):n(R)}function h(R){return R===45?(e.consume(R),b):n(R)}function x(R){return R===null?n(R):R===45?(e.consume(R),y):st(R)?(c=x,ce(R)):(e.consume(R),x)}function y(R){return R===45?(e.consume(R),b):x(R)}function b(R){return R===62?ee(R):R===45?y(R):x(R)}function C(R){const M="CDATA[";return R===M.charCodeAt(l++)?(e.consume(R),l===M.length?j:C):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),w):st(R)?(c=j,ce(R)):(e.consume(R),j)}function w(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?ee(R):R===93?(e.consume(R),k):j(R)}function E(R){return R===null||R===62?ee(R):st(R)?(c=E,ce(R)):(e.consume(R),E)}function N(R){return R===null?n(R):R===63?(e.consume(R),P):st(R)?(c=N,ce(R)):(e.consume(R),N)}function P(R){return R===62?ee(R):N(R)}function $(R){return as(R)?(e.consume(R),T):n(R)}function T(R){return R===45||xr(R)?(e.consume(R),T):D(R)}function D(R){return st(R)?(c=D,ce(R)):Tt(R)?(e.consume(R),D):ee(R)}function L(R){return R===45||xr(R)?(e.consume(R),L):R===47||R===62||sr(R)?Y(R):n(R)}function Y(R){return R===47?(e.consume(R),ee):R===58||R===95||as(R)?(e.consume(R),X):st(R)?(c=Y,ce(R)):Tt(R)?(e.consume(R),Y):ee(R)}function X(R){return R===45||R===46||R===58||R===95||xr(R)?(e.consume(R),X):I(R)}function I(R){return R===61?(e.consume(R),U):st(R)?(c=I,ce(R)):Tt(R)?(e.consume(R),I):Y(R)}function U(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),i=R,ne):st(R)?(c=U,ce(R)):Tt(R)?(e.consume(R),U):(e.consume(R),F)}function ne(R){return R===i?(e.consume(R),i=void 0,H):R===null?n(R):st(R)?(c=ne,ce(R)):(e.consume(R),ne)}function F(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||sr(R)?Y(R):(e.consume(R),F)}function H(R){return R===47||R===62||sr(R)?Y(R):n(R)}function ee(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function ce(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),_}function _(R){return Tt(R)?_t(e,W,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):W(R)}function W(R){return e.enter("htmlTextData"),c(R)}}const ix={name:"labelEnd",resolveAll:t_,resolveTo:n_,tokenize:r_},QI={tokenize:s_},ZI={tokenize:o_},e_={tokenize:i_};function t_(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 i=s.type==="labelImage"?4:2;s.type="data",t+=i}}return e.length!==n.length&&fs(e,0,e.length,n),e}function n_(e,t){let n=e.length,s=0,i,l,c,u;for(;n--;)if(i=e[n][1],l){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(l=n,i.type!=="labelLink")){s=2;break}}else i.type==="labelEnd"&&(c=n);const p={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[l+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",p,t],["enter",m,t]],u=Tr(u,e.slice(l+1,l+s+3)),u=Tr(u,[["enter",h,t]]),u=Tr(u,ox(t.parser.constructs.insideSpan.null,e.slice(l+s+4,c-3),t)),u=Tr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Tr(u,e.slice(c+1)),u=Tr(u,[["exit",p,t]]),fs(e,l,e.length,u),e}function r_(e,t,n){const s=this;let i=s.events.length,l,c;for(;i--;)if((s.events[i][1].type==="labelImage"||s.events[i][1].type==="labelLink")&&!s.events[i][1]._balanced){l=s.events[i][1];break}return u;function u(y){return l?l._inactive?x(y):(c=s.parser.defined.includes(ca(s.sliceSerialize({start:l.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),p):n(y)}function p(y){return y===40?e.attempt(QI,h,c?h:x)(y):y===91?e.attempt(ZI,h,c?m:x)(y):c?h(y):x(y)}function m(y){return e.attempt(e_,h,x)(y)}function h(y){return t(y)}function x(y){return l._balanced=!0,n(y)}}function s_(e,t,n){return s;function s(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),i}function i(x){return sr(x)?Dl(e,l)(x):l(x)}function l(x){return x===41?h(x):$1(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function c(x){return sr(x)?Dl(e,p)(x):h(x)}function u(x){return n(x)}function p(x){return x===34||x===39||x===40?O1(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):h(x)}function m(x){return sr(x)?Dl(e,h)(x):h(x)}function h(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function o_(e,t,n){const s=this;return i;function i(u){return L1.call(s,e,l,c,"reference","referenceMarker","referenceString")(u)}function l(u){return s.parser.defined.includes(ca(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function i_(e,t,n){return s;function s(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),i}function i(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const a_={name:"labelStartImage",resolveAll:ix.resolveAll,tokenize:l_};function l_(e,t,n){const s=this;return i;function i(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),l}function l(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 c_={name:"labelStartLink",resolveAll:ix.resolveAll,tokenize:u_};function u_(e,t,n){const s=this;return i;function i(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),l}function l(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Im={name:"lineEnding",tokenize:d_};function d_(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),_t(e,t,"linePrefix")}}const Ju={name:"thematicBreak",tokenize:f_};function f_(e,t,n){let s=0,i;return l;function l(m){return e.enter("thematicBreak"),c(m)}function c(m){return i=m,u(m)}function u(m){return m===i?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||st(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===i?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),Tt(m)?_t(e,u,"whitespace")(m):u(m))}}const tr={continuation:{tokenize:g_},exit:y_,name:"list",tokenize:h_},p_={partial:!0,tokenize:b_},m_={partial:!0,tokenize:x_};function h_(e,t,n){const s=this,i=s.events[s.events.length-1];let l=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[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:Lh(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(Ju,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(b)}return n(b)}function p(b){return Lh(b)&&++c<10?(e.consume(b),p):(!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(of,s.interrupt?n:h,e.attempt(p_,y,x))}function h(b){return s.containerState.initialBlankLine=!0,l++,y(b)}function x(b){return Tt(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=l+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function g_(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(of,i,l);function i(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,_t(e,t,"listItemIndent",s.containerState.size+1)(u)}function l(u){return s.containerState.furtherBlankLines||!Tt(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(m_,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,_t(e,e.attempt(tr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function x_(e,t,n){const s=this;return _t(e,i,"listItemIndent",s.containerState.size+1);function i(l){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(l):n(l)}}function y_(e){e.exit(this.containerState.type)}function b_(e,t,n){const s=this;return _t(e,i,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(l){const c=s.events[s.events.length-1];return!Tt(l)&&c&&c[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const Pw={name:"setextUnderline",resolveTo:v_,tokenize:w_};function v_(e,t){let n=e.length,s,i,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",l?(e.splice(i,0,["enter",c,t]),e.splice(l+1,0,["exit",e[s][1],t]),e[s][1].end={...e[l][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function w_(e,t,n){const s=this;let i;return l;function l(m){let h=s.events.length,x;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){x=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||x)?(e.enter("setextHeadingLine"),i=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===i?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),Tt(m)?_t(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||st(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const j_={tokenize:k_};function k_(e){const t=this,n=e.attempt(of,s,e.attempt(this.parser.constructs.flowInitial,i,_t(e,e.attempt(this.parser.constructs.flow,i,e.attempt(TI,i)),"linePrefix")));return n;function s(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const S_={resolveAll:_1()},N_=I1("string"),C_=I1("text");function I1(e){return{resolveAll:_1(e==="text"?E_:void 0),tokenize:t};function t(n){const s=this,i=this.parser.constructs[e],l=n.attempt(i,c,u);return c;function c(h){return m(h)?l(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),p}function p(h){return m(h)?(n.exit("data"),l(h)):(n.consume(h),p)}function m(h){if(h===null)return!0;const x=i[h];let y=-1;if(x)for(;++y<x.length;){const b=x[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function _1(e){return t;function t(n,s){let i=-1,l;for(;++i<=n.length;)l===void 0?n[i]&&n[i][1].type==="data"&&(l=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==l+2&&(n[l][1].end=n[i-1][1].end,n.splice(l+2,i-l-2),i=l+2),l=void 0);return e?e(n,s):n}}function E_(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],i=t.sliceStream(s);let l=i.length,c=-1,u=0,p;for(;l--;){const m=i[l];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)p=!0,u++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||p||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?c:s.start._bufferIndex+c,_index:s.start._index+l,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 T_={42:tr,43:tr,45:tr,48:tr,49:tr,50:tr,51:tr,52:tr,53:tr,54:tr,55:tr,56:tr,57:tr,62:P1},P_={91:$I},R_={[-2]:Om,[-1]:Om,32:Om},A_={35:FI,42:Ju,45:[Pw,Ju],60:VI,61:Pw,95:Ju,96:Ew,126:Ew},D_={38:A1,92:R1},$_={[-5]:Im,[-4]:Im,[-3]:Im,33:a_,38:A1,42:Oh,60:[cI,JI],91:c_,92:[_I,R1],93:ix,95:Oh,96:jI},L_={null:[Oh,S_]},O_={null:[42,95]},I_={null:[]},__=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:O_,contentInitial:P_,disable:I_,document:T_,flow:A_,flowInitial:R_,insideSpan:L_,string:D_,text:$_},Symbol.toStringTag,{value:"Module"}));function M_(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 i={},l=[];let c=[],u=[];const p={attempt:D($),check:D(T),consume:E,enter:N,exit:P,interrupt:D(T,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:x};let h=t.tokenize.call(m,p);return t.resolveAll&&l.push(t),m;function x(I){return c=Tr(c,I),w(),c[c.length-1]!==null?[]:(L(t,0),m.events=ox(l,m.events,m),m.events)}function y(I,U){return z_(b(I),U)}function b(I){return F_(c,I)}function C(){const{_bufferIndex:I,_index:U,line:ne,column:F,offset:H}=s;return{_bufferIndex:I,_index:U,line:ne,column:F,offset:H}}function j(I){i[I.line]=I.column,X()}function w(){let I;for(;s._index<c.length;){const U=c[s._index];if(typeof U=="string")for(I=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===I&&s._bufferIndex<U.length;)k(U.charCodeAt(s._bufferIndex));else k(U)}}function k(I){h=h(I)}function E(I){st(I)?(s.line++,s.column=1,s.offset+=I===-3?2:1,X()):I!==-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=I}function N(I,U){const ne=U||{};return ne.type=I,ne.start=C(),m.events.push(["enter",ne,m]),u.push(ne),ne}function P(I){const U=u.pop();return U.end=C(),m.events.push(["exit",U,m]),U}function $(I,U){L(I,U.from)}function T(I,U){U.restore()}function D(I,U){return ne;function ne(F,H,ee){let ce,_,W,R;return Array.isArray(F)?Q(F):"tokenize"in F?Q([F]):M(F);function M(V){return oe;function oe(me){const ve=me!==null&&V[me],ke=me!==null&&V.null,he=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return Q(he)(me)}}function Q(V){return ce=V,_=0,V.length===0?ee:O(V[_])}function O(V){return oe;function oe(me){return R=Y(),W=V,V.partial||(m.currentConstruct=V),V.name&&m.parser.constructs.disable.null.includes(V.name)?ge():V.tokenize.call(U?Object.assign(Object.create(m),U):m,p,ue,ge)(me)}}function ue(V){return I(W,R),H}function ge(V){return R.restore(),++_<ce.length?O(ce[_]):ee}}}function L(I,U){I.resolveAll&&!l.includes(I)&&l.push(I),I.resolve&&fs(m.events,U,m.events.length-U,I.resolve(m.events.slice(U),m)),I.resolveTo&&(m.events=I.resolveTo(m.events,m))}function Y(){const I=C(),U=m.previous,ne=m.currentConstruct,F=m.events.length,H=Array.from(u);return{from:F,restore:ee};function ee(){s=I,m.previous=U,m.currentConstruct=ne,m.events.length=F,u=H,X()}}function X(){s.line in i&&s.column<2&&(s.column=i[s.line],s.offset+=i[s.line]-1)}}function F_(e,t){const n=t.start._index,s=t.start._bufferIndex,i=t.end._index,l=t.end._bufferIndex;let c;if(n===i)c=[e[n].slice(s,l)];else{if(c=e.slice(n,i),s>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(s):c.shift()}l>0&&c.push(e[i].slice(0,l))}return c}function z_(e,t){let n=-1;const s=[];let i;for(;++n<e.length;){const l=e[n];let c;if(typeof l=="string")c=l;else switch(l){case-5:{c="\r";break}case-4:{c=`
|
|
522
|
+
`;break}case-3:{c=`\r
|
|
523
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&i)continue;c=" ";break}default:c=String.fromCharCode(l)}i=l===-2,s.push(c)}return s.join("")}function B_(e){const s={constructs:GO([__,...(e||{}).extensions||[]]),content:i(nI),defined:[],document:i(sI),flow:i(j_),lazy:{},string:i(N_),text:i(C_)};return s;function i(l){return c;function c(u){return M_(s,l,u)}}}function U_(e){for(;!D1(e););return e}const Rw=/[\0\t\n\r]/g;function V_(){let e=1,t="",n=!0,s;return i;function i(l,c,u){const p=[];let m,h,x,y,b;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(c||void 0).decode(l)),x=0,t="",n&&(l.charCodeAt(0)===65279&&x++,n=void 0);x<l.length;){if(Rw.lastIndex=x,m=Rw.exec(l),y=m&&m.index!==void 0?m.index:l.length,b=l.charCodeAt(y),!m){t=l.slice(x);break}if(b===10&&x===y&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),x<y&&(p.push(l.slice(x,y)),e+=y-x),b){case 0:{p.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,p.push(-2);e++<h;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}x=y+1}return u&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const H_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function W_(e){return e.replace(H_,K_)}function K_(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),l=i===120||i===88;return T1(n.slice(l?2:1),l?16:10)}return sx(n)||e}const M1={}.hasOwnProperty;function q_(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),G_(n)(U_(B_(n).document().write(V_()(e,t,!0))))}function G_(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(Xe),autolinkProtocol:Y,autolinkEmail:Y,atxHeading:l(G),blockQuote:l(ke),characterEscape:Y,characterReference:Y,codeFenced:l(he),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:l(he,c),codeText:l(Je,c),codeTextData:Y,data:Y,codeFlowValue:Y,definition:l(Ye),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:l(ot),hardBreakEscape:l(Ie),hardBreakTrailing:l(Ie),htmlFlow:l(Se,c),htmlFlowData:Y,htmlText:l(Se,c),htmlTextData:Y,image:l(Oe),label:c,link:l(Xe),listItem:l(nt),listItemValue:y,listOrdered:l(_e,x),listUnordered:l(_e),paragraph:l(Ke),reference:O,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:l(G),strong:l(gt),thematicBreak:l(it)},exit:{atxHeading:p(),atxHeadingSequence:$,autolink:p(),autolinkEmail:ve,autolinkProtocol:me,blockQuote:p(),characterEscapeValue:X,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:V,characterReference:oe,codeFenced:p(w),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:X,codeIndented:p(k),codeText:p(H),codeTextData:X,data:X,definition:p(),definitionDestinationString:P,definitionLabelString:E,definitionTitleString:N,emphasis:p(),hardBreakEscape:p(U),hardBreakTrailing:p(U),htmlFlow:p(ne),htmlFlowData:X,htmlText:p(F),htmlTextData:X,image:p(ce),label:W,labelText:_,lineEnding:I,link:p(ee),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:ue,resourceDestinationString:R,resourceTitleString:M,resource:Q,setextHeading:p(L),setextHeadingLineSequence:D,setextHeadingText:T,strong:p(),thematicBreak:p()}};F1(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ie){let q={type:"root",children:[]};const pe={stack:[q],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},Z=[];let ye=-1;for(;++ye<ie.length;)if(ie[ye][1].type==="listOrdered"||ie[ye][1].type==="listUnordered")if(ie[ye][0]==="enter")Z.push(ye);else{const Re=Z.pop();ye=i(ie,Re,ye)}for(ye=-1;++ye<ie.length;){const Re=t[ie[ye][0]];M1.call(Re,ie[ye][1].type)&&Re[ie[ye][1].type].call(Object.assign({sliceSerialize:ie[ye][2].sliceSerialize},pe),ie[ye][1])}if(pe.tokenStack.length>0){const Re=pe.tokenStack[pe.tokenStack.length-1];(Re[1]||Aw).call(pe,void 0,Re[0])}for(q.position={start:Zs(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Zs(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)q=t.transforms[ye](q)||q;return q}function i(ie,q,pe){let Z=q-1,ye=-1,Re=!1,lt,te,be,$e;for(;++Z<=pe;){const at=ie[Z];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?ye++:ye--,$e=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(lt&&!$e&&!ye&&!be&&(be=Z),$e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$e=void 0}if(!ye&&at[0]==="enter"&&at[1].type==="listItemPrefix"||ye===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(lt){let Me=Z;for(te=void 0;Me--;){const bt=ie[Me];if(bt[1].type==="lineEnding"||bt[1].type==="lineEndingBlank"){if(bt[0]==="exit")continue;te&&(ie[te][1].type="lineEndingBlank",Re=!0),bt[1].type="lineEnding",te=Me}else if(!(bt[1].type==="linePrefix"||bt[1].type==="blockQuotePrefix"||bt[1].type==="blockQuotePrefixWhitespace"||bt[1].type==="blockQuoteMarker"||bt[1].type==="listItemIndent"))break}be&&(!te||be<te)&&(lt._spread=!0),lt.end=Object.assign({},te?ie[te][1].start:at[1].end),ie.splice(te||Z,0,["exit",lt,at[2]]),Z++,pe++}if(at[1].type==="listItemPrefix"){const Me={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};lt=Me,ie.splice(Z,0,["enter",Me,at[2]]),Z++,pe++,be=void 0,$e=!0}}}return ie[q][1]._spread=Re,pe}function l(ie,q){return pe;function pe(Z){u.call(this,ie(Z),Z),q&&q.call(this,Z)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(ie,q,pe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([q,pe||void 0]),ie.position={start:Zs(q.start),end:void 0}}function p(ie){return q;function q(pe){ie&&ie.call(this,pe),m.call(this,pe)}}function m(ie,q){const pe=this.stack.pop(),Z=this.tokenStack.pop();if(Z)Z[0].type!==ie.type&&(q?q.call(this,ie,Z[0]):(Z[1]||Aw).call(this,ie,Z[0]));else throw new Error("Cannot close `"+ie.type+"` ("+Al({start:ie.start,end:ie.end})+"): it’s not open");pe.position.end=Zs(ie.end)}function h(){return KO(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function y(ie){if(this.data.expectingFirstListItemValue){const q=this.stack[this.stack.length-2];q.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.lang=ie}function C(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.meta=ie}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.value=ie.replace(/(\r?\n|\r)$/g,"")}function E(ie){const q=this.resume(),pe=this.stack[this.stack.length-1];pe.label=q,pe.identifier=ca(this.sliceSerialize(ie)).toLowerCase()}function N(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.title=ie}function P(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.url=ie}function $(ie){const q=this.stack[this.stack.length-1];if(!q.depth){const pe=this.sliceSerialize(ie).length;q.depth=pe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function D(ie){const q=this.stack[this.stack.length-1];q.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function Y(ie){const pe=this.stack[this.stack.length-1].children;let Z=pe[pe.length-1];(!Z||Z.type!=="text")&&(Z=Pt(),Z.position={start:Zs(ie.start),end:void 0},pe.push(Z)),this.stack.push(Z)}function X(ie){const q=this.stack.pop();q.value+=this.sliceSerialize(ie),q.position.end=Zs(ie.end)}function I(ie){const q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const pe=q.children[q.children.length-1];pe.position.end=Zs(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(q.type)&&(Y.call(this,ie),X.call(this,ie))}function U(){this.data.atHardBreak=!0}function ne(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.value=ie}function F(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.value=ie}function H(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.value=ie}function ee(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=q,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function ce(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const q=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=q,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function _(ie){const q=this.sliceSerialize(ie),pe=this.stack[this.stack.length-2];pe.label=W_(q),pe.identifier=ca(q).toLowerCase()}function W(){const ie=this.stack[this.stack.length-1],q=this.resume(),pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,pe.type==="link"){const Z=ie.children;pe.children=Z}else pe.alt=q}function R(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.url=ie}function M(){const ie=this.resume(),q=this.stack[this.stack.length-1];q.title=ie}function Q(){this.data.inReference=void 0}function O(){this.data.referenceType="collapsed"}function ue(ie){const q=this.resume(),pe=this.stack[this.stack.length-1];pe.label=q,pe.identifier=ca(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ge(ie){this.data.characterReferenceType=ie.type}function V(ie){const q=this.sliceSerialize(ie),pe=this.data.characterReferenceType;let Z;pe?(Z=T1(q,pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Z=sx(q);const ye=this.stack[this.stack.length-1];ye.value+=Z}function oe(ie){const q=this.stack.pop();q.position.end=Zs(ie.end)}function me(ie){X.call(this,ie);const q=this.stack[this.stack.length-1];q.url=this.sliceSerialize(ie)}function ve(ie){X.call(this,ie);const q=this.stack[this.stack.length-1];q.url="mailto:"+this.sliceSerialize(ie)}function ke(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function Je(){return{type:"inlineCode",value:""}}function Ye(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function G(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function Xe(){return{type:"link",title:null,url:"",children:[]}}function _e(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function nt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function Ke(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function Pt(){return{type:"text",value:""}}function it(){return{type:"thematicBreak"}}}function Zs(e){return{line:e.line,column:e.column,offset:e.offset}}function F1(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?F1(e,s):Y_(e,s)}}function Y_(e,t){let n;for(n in t)if(M1.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 Aw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Al({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Al({start:t.start,end:t.end})+") is still open")}function J_(e){const t=this;t.parser=n;function n(s){return q_(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function X_(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 Q_(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
524
|
+
`}]}function Z_(e,t){const n=t.value?t.value+`
|
|
525
|
+
`:"",s={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(s.className=["language-"+i[0]]);let l={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(l.data={meta:t.meta}),e.patch(t,l),l=e.applyData(t,l),l={type:"element",tagName:"pre",properties:{},children:[l]},e.patch(t,l),l}function eM(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tM(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nM(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),i=Sa(s.toLowerCase()),l=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=l+1,u+=1,e.footnoteCounts.set(s,u);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,m),e.applyData(t,m)}function rM(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 sM(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function z1(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 i=e.all(t),l=i[0];l&&l.type==="text"?l.value="["+l.value:i.unshift({type:"text",value:"["});const c=i[i.length-1];return c&&c.type==="text"?c.value+=s:i.push({type:"text",value:s}),i}function oM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return z1(e,t);const i={src:Sa(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,l),e.applyData(t,l)}function iM(e,t){const n={src:Sa(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 aM(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 lM(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return z1(e,t);const i={href:Sa(s.url||"")};s.title!==null&&s.title!==void 0&&(i.title=s.title);const l={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,l),e.applyData(t,l)}function cM(e,t){const n={href:Sa(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 uM(e,t,n){const s=e.all(t),i=n?dM(n):B1(t),l={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let x;h&&h.type==="element"&&h.tagName==="p"?x=h:(x={type:"element",tagName:"p",properties:{},children:[]},s.unshift(x)),x.children.length>0&&x.children.unshift({type:"text",value:" "}),x.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),l.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(i||u!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
|
|
526
|
+
`}),h.type==="element"&&h.tagName==="p"&&!i?c.push(...h.children):c.push(h)}const p=s[s.length-1];p&&(i||p.type!=="element"||p.tagName!=="p")&&c.push({type:"text",value:`
|
|
527
|
+
`});const m={type:"element",tagName:"li",properties:l,children:c};return e.patch(t,m),e.applyData(t,m)}function dM(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=B1(n[s])}return t}function B1(e){const t=e.spread;return t??e.children.length>1}function fM(e,t){const n={},s=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<s.length;){const c=s[i];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 l={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,l),e.applyData(t,l)}function pM(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mM(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function hM(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gM(e,t){const n=e.all(t),s=n.shift(),i=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),i.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=ex(t.children[1]),p=w1(t.children[t.children.length-1]);u&&p&&(c.position={start:u,end:p}),i.push(c)}const l={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,l),e.applyData(t,l)}function xM(e,t,n){const s=n?n.children:void 0,l=(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 p=-1;const m=[];for(;++p<u;){const x=t.children[p],y={},b=c?c[p]:void 0;b&&(y.align=b);let C={type:"element",tagName:l,properties:y,children:[]};x&&(C.children=e.all(x),e.patch(x,C),C=e.applyData(x,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 yM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Dw=9,$w=32;function bM(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),i=0;const l=[];for(;s;)l.push(Lw(t.slice(i,s.index),i>0,!0),s[0]),i=s.index+s[0].length,s=n.exec(t);return l.push(Lw(t.slice(i),i>0,!1)),l.join("")}function Lw(e,t,n){let s=0,i=e.length;if(t){let l=e.codePointAt(s);for(;l===Dw||l===$w;)s++,l=e.codePointAt(s)}if(n){let l=e.codePointAt(i-1);for(;l===Dw||l===$w;)i--,l=e.codePointAt(i-1)}return i>s?e.slice(s,i):""}function vM(e,t){const n={type:"text",value:bM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wM(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const jM={blockquote:X_,break:Q_,code:Z_,delete:eM,emphasis:tM,footnoteReference:nM,heading:rM,html:sM,imageReference:oM,image:iM,inlineCode:aM,linkReference:lM,link:cM,listItem:uM,list:fM,paragraph:pM,root:mM,strong:hM,table:gM,tableCell:yM,tableRow:xM,text:vM,thematicBreak:wM,toml:Du,yaml:Du,definition:Du,footnoteDefinition:Du};function Du(){}const U1=-1,af=0,$l=1,yd=2,ax=3,lx=4,cx=5,ux=6,V1=7,H1=8,Ow=typeof self=="object"?self:globalThis,kM=(e,t)=>{const n=(i,l)=>(e.set(l,i),i),s=i=>{if(e.has(i))return e.get(i);const[l,c]=t[i];switch(l){case af:case U1:return n(c,i);case $l:{const u=n([],i);for(const p of c)u.push(s(p));return u}case yd:{const u=n({},i);for(const[p,m]of c)u[s(p)]=s(m);return u}case ax:return n(new Date(c),i);case lx:{const{source:u,flags:p}=c;return n(new RegExp(u,p),i)}case cx:{const u=n(new Map,i);for(const[p,m]of c)u.set(s(p),s(m));return u}case ux:{const u=n(new Set,i);for(const p of c)u.add(s(p));return u}case V1:{const{name:u,message:p}=c;return n(new Ow[u](p),i)}case H1:return n(BigInt(c),i);case"BigInt":return n(Object(BigInt(c)),i);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 Ow[l](c),i)};return s},Iw=e=>kM(new Map,e)(0),Ui="",{toString:SM}={},{keys:NM}=Object,wl=e=>{const t=typeof e;if(t!=="object"||!e)return[af,t];const n=SM.call(e).slice(8,-1);switch(n){case"Array":return[$l,Ui];case"Object":return[yd,Ui];case"Date":return[ax,Ui];case"RegExp":return[lx,Ui];case"Map":return[cx,Ui];case"Set":return[ux,Ui];case"DataView":return[$l,n]}return n.includes("Array")?[$l,n]:n.includes("Error")?[V1,n]:[yd,n]},$u=([e,t])=>e===af&&(t==="function"||t==="symbol"),CM=(e,t,n,s)=>{const i=(c,u)=>{const p=s.push(c)-1;return n.set(u,p),p},l=c=>{if(n.has(c))return n.get(c);let[u,p]=wl(c);switch(u){case af:{let h=c;switch(p){case"bigint":u=H1,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);h=null;break;case"undefined":return i([U1],c)}return i([u,h],c)}case $l:{if(p){let y=c;return p==="DataView"?y=new Uint8Array(c.buffer):p==="ArrayBuffer"&&(y=new Uint8Array(c)),i([p,[...y]],c)}const h=[],x=i([u,h],c);for(const y of c)h.push(l(y));return x}case yd:{if(p)switch(p){case"BigInt":return i([p,c.toString()],c);case"Boolean":case"Number":case"String":return i([p,c.valueOf()],c)}if(t&&"toJSON"in c)return l(c.toJSON());const h=[],x=i([u,h],c);for(const y of NM(c))(e||!$u(wl(c[y])))&&h.push([l(y),l(c[y])]);return x}case ax:return i([u,c.toISOString()],c);case lx:{const{source:h,flags:x}=c;return i([u,{source:h,flags:x}],c)}case cx:{const h=[],x=i([u,h],c);for(const[y,b]of c)(e||!($u(wl(y))||$u(wl(b))))&&h.push([l(y),l(b)]);return x}case ux:{const h=[],x=i([u,h],c);for(const y of c)(e||!$u(wl(y)))&&h.push(l(y));return x}}const{message:m}=c;return i([u,{name:p,message:m}],c)};return l},_w=(e,{json:t,lossy:n}={})=>{const s=[];return CM(!(t||n),!!t,new Map,s)(e),s},bd=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Iw(_w(e,t)):structuredClone(e):(e,t)=>Iw(_w(e,t));function EM(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 TM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function PM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||EM,s=e.options.footnoteBackLabel||TM,i=e.options.footnoteLabel||"Footnotes",l=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const h=e.all(m),x=String(m.identifier).toUpperCase(),y=Sa(x.toLowerCase());let b=0;const C=[],j=e.footnoteCounts.get(x);for(;j!==void 0&&++b<=j;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(p,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(p,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=h[h.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.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:l,properties:{...bd(c),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
|
|
528
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
529
|
+
`}]}}const W1=(function(e){if(e==null)return $M;if(typeof e=="function")return lf(e);if(typeof e=="object")return Array.isArray(e)?RM(e):AM(e);if(typeof e=="string")return DM(e);throw new Error("Expected function, string, or object as test")});function RM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=W1(e[n]);return lf(s);function s(...i){let l=-1;for(;++l<t.length;)if(t[l].apply(this,i))return!0;return!1}}function AM(e){const t=e;return lf(n);function n(s){const i=s;let l;for(l in e)if(i[l]!==t[l])return!1;return!0}}function DM(e){return lf(t);function t(n){return n&&n.type===e}}function lf(e){return t;function t(n,s,i){return!!(LM(n)&&e.call(this,n,typeof s=="number"?s:void 0,i||void 0))}}function $M(){return!0}function LM(e){return e!==null&&typeof e=="object"&&"type"in e}const K1=[],OM=!0,Mw=!1,IM="skip";function _M(e,t,n,s){let i;typeof t=="function"&&typeof n!="function"?(s=n,n=t):i=t;const l=W1(i),c=s?-1:1;u(e,void 0,[])();function u(p,m,h){const x=p&&typeof p=="object"?p:{};if(typeof x.type=="string"){const b=typeof x.tagName=="string"?x.tagName:typeof x.name=="string"?x.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(p.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=K1,C,j,w;if((!t||l(p,m,h[h.length-1]||void 0))&&(b=MM(n(p,h)),b[0]===Mw))return b;if("children"in p&&p.children){const k=p;if(k.children&&b[0]!==IM)for(j=(s?k.children.length:-1)+c,w=h.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(C=u(E,j,w)(),C[0]===Mw)return C;j=typeof C[1]=="number"?C[1]:j+c}}return b}}}function MM(e){return Array.isArray(e)?e:typeof e=="number"?[OM,e]:e==null?K1:[e]}function q1(e,t,n,s){let i,l,c;typeof t=="function"&&typeof n!="function"?(l=void 0,c=t,i=n):(l=t,c=n,i=s),_M(e,l,u,i);function u(p,m){const h=m[m.length-1],x=h?h.children.indexOf(p):void 0;return c(p,x,h)}}const Ih={}.hasOwnProperty,FM={};function zM(e,t){const n=t||FM,s=new Map,i=new Map,l=new Map,c={...jM,...n.handlers},u={all:m,applyData:UM,definitionById:s,footnoteById:i,footnoteCounts:l,footnoteOrder:[],handlers:c,one:p,options:n,patch:BM,wrap:HM};return q1(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const x=h.type==="definition"?s:i,y=String(h.identifier).toUpperCase();x.has(y)||x.set(y,h)}}),u;function p(h,x){const y=h.type,b=u.handlers[y];if(Ih.call(u.handlers,y)&&b)return b(u,h,x);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:j,...w}=h,k=bd(w);return k.children=u.all(h),k}return bd(h)}return(u.options.unknownHandler||VM)(u,h,x)}function m(h){const x=[];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=Fw(C.value)),!Array.isArray(C)&&C.type==="element")){const j=C.children[0];j&&j.type==="text"&&(j.value=Fw(j.value))}Array.isArray(C)?x.push(...C):x.push(C)}}}return x}}function BM(e,t){e.position&&(t.position=SO(e))}function UM(e,t){let n=t;if(e&&e.data){const s=e.data.hName,i=e.data.hChildren,l=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"&&l&&Object.assign(n.properties,bd(l)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function VM(e,t){const n=t.data||{},s="value"in t&&!(Ih.call(n,"hProperties")||Ih.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 HM(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
530
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
531
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
532
|
+
`}),n}function Fw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function zw(e,t){const n=zM(e,t),s=n.one(e,void 0),i=PM(n),l=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return i&&l.children.push({type:"text",value:`
|
|
533
|
+
`},i),l}function WM(e,t){return e&&"run"in e?async function(n,s){const i=zw(n,{file:s,...t});await e.run(i,s)}:function(n,s){return zw(n,{file:s,...e||t})}}function Bw(e){if(e)throw e}var _m,Uw;function KM(){if(Uw)return _m;Uw=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},l=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),x=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!x)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 _m=function p(){var m,h,x,y,b,C,j=arguments[0],w=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},w=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});w<k;++w)if(m=arguments[w],m!=null)for(h in m)x=u(j,h),y=u(m,h),j!==y&&(E&&y&&(l(y)||(b=i(y)))?(b?(b=!1,C=x&&i(x)?x:[]):C=x&&l(x)?x:{},c(j,{name:h,newValue:p(E,C,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},_m}var qM=KM();const Mm=Td(qM);function _h(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 GM(){const e=[],t={run:n,use:s};return t;function n(...i){let l=-1;const c=i.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);u(null,...i);function u(p,...m){const h=e[++l];let x=-1;if(p){c(p);return}for(;++x<i.length;)(m[x]===null||m[x]===void 0)&&(m[x]=i[x]);i=m,h?YM(h,u)(...m):c(null,...m)}}function s(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function YM(e,t){let n;return s;function s(...c){const u=e.length>c.length;let p;u&&c.push(i);try{p=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return i(h)}u||(p&&p.then&&typeof p.then=="function"?p.then(l,i):p instanceof Error?i(p):l(p))}function i(c,...u){n||(n=!0,t(c,...u))}function l(c){i(null,c)}}const os={basename:JM,dirname:XM,extname:QM,join:ZM,sep:"/"};function JM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');pc(e);let n=0,s=-1,i=e.length,l;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else s<0&&(l=!0,s=i+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,u=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(l){n=i+1;break}}else c<0&&(l=!0,c=i+1),u>-1&&(e.codePointAt(i)===t.codePointAt(u--)?u<0&&(s=i):(u=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function XM(e){if(pc(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 QM(e){pc(e);let t=e.length,n=-1,s=0,i=-1,l=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?i<0?i=t:l!==1&&(l=1):i>-1&&(l=-1)}return i<0||n<0||l===0||l===1&&i===n-1&&i===s+1?"":e.slice(i,n)}function ZM(...e){let t=-1,n;for(;++t<e.length;)pc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":e5(n)}function e5(e){pc(e);const t=e.codePointAt(0)===47;let n=t5(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function t5(e,t){let n="",s=0,i=-1,l=0,c=-1,u,p;for(;++c<=e.length;){if(c<e.length)u=e.codePointAt(c);else{if(u===47)break;u=47}if(u===47){if(!(i===c-1||l===1))if(i!==c-1&&l===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),i=c,l=0;continue}}else if(n.length>0){n="",s=0,i=c,l=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(i+1,c):n=e.slice(i+1,c),s=c-i-1;i=c,l=0}else u===46&&l>-1?l++:l=-1}return n}function pc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const n5={cwd:r5};function r5(){return"/"}function Mh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function s5(e){if(typeof e=="string")e=new URL(e);else if(!Mh(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 o5(e)}function o5(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Fm=["history","path","basename","stem","extname","dirname"];class G1{constructor(t){let n;t?Mh(t)?n={path:t}:typeof t=="string"||i5(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":n5.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Fm.length;){const l=Fm[s];l in n&&n[l]!==void 0&&n[l]!==null&&(this[l]=l==="history"?[...n[l]]:n[l])}let i;for(i in n)Fm.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?os.basename(this.path):void 0}set basename(t){Bm(t,"basename"),zm(t,"basename"),this.path=os.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?os.dirname(this.path):void 0}set dirname(t){Vw(this.basename,"dirname"),this.path=os.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?os.extname(this.path):void 0}set extname(t){if(zm(t,"extname"),Vw(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=os.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Mh(t)&&(t=s5(t)),Bm(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?os.basename(this.path,this.extname):void 0}set stem(t){Bm(t,"stem"),zm(t,"stem"),this.path=os.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const i=this.message(t,n,s);throw i.fatal=!0,i}info(t,n,s){const i=this.message(t,n,s);return i.fatal=void 0,i}message(t,n,s){const i=new zn(t,n,s);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function zm(e,t){if(e&&e.includes(os.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+os.sep+"`")}function Bm(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Vw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function i5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const a5=(function(e){const s=this.constructor.prototype,i=s[e],l=function(){return i.apply(l,arguments)};return Object.setPrototypeOf(l,s),l}),l5={}.hasOwnProperty;class dx extends a5{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=GM()}copy(){const t=new dx;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Mm(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Hm("data",this.frozen),this.namespace[t]=n,this):l5.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Hm("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 i=n.call(t,...s);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Lu(t),s=this.parser||this.Parser;return Um("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Um("process",this.parser||this.Parser),Vm("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(l,c){const u=Lu(t),p=s.parse(u);s.run(p,u,function(h,x,y){if(h||!x||!y)return m(h);const b=x,C=s.stringify(b,y);d5(C)?y.value=C:y.result=C,m(h,y)});function m(h,x){h||!x?c(h):l?l(x):n(void 0,x)}}}processSync(t){let n=!1,s;return this.freeze(),Um("processSync",this.parser||this.Parser),Vm("processSync",this.compiler||this.Compiler),this.process(t,i),Ww("processSync","process",n),s;function i(l,c){n=!0,Bw(l),s=c}}run(t,n,s){Hw(t),this.freeze();const i=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?l(void 0,s):new Promise(l);function l(c,u){const p=Lu(n);i.run(t,p,m);function m(h,x,y){const b=x||t;h?u(h):c?c(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,i;return this.run(t,n,l),Ww("runSync","run",s),i;function l(c,u){Bw(c),i=u,s=!0}}stringify(t,n){this.freeze();const s=Lu(n),i=this.compiler||this.Compiler;return Vm("stringify",i),Hw(t),i(t,s)}use(t,...n){const s=this.attachers,i=this.namespace;if(Hm("use",this.frozen),t!=null)if(typeof t=="function")p(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 l(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...x]=m;p(h,x)}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&&(i.settings=Mm(!0,i.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const x=m[h];l(x)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,h){let x=-1,y=-1;for(;++x<s.length;)if(s[x][0]===m){y=x;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...C]=h;const j=s[y][1];_h(j)&&_h(b)&&(b=Mm(!0,j,b)),s[y]=[m,b,...C]}}}}const c5=new dx().freeze();function Um(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Vm(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hm(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 Hw(e){if(!_h(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ww(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Lu(e){return u5(e)?e:new G1(e)}function u5(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function d5(e){return typeof e=="string"||f5(e)}function f5(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const p5="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Kw=[],qw={allowDangerousHtml:!0},m5=/^(https?|ircs?|mailto|xmpp)$/i,h5=[{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 g5(e){const t=x5(e),n=y5(e);return b5(t.runSync(t.parse(n),n),e)}function x5(e){const t=e.rehypePlugins||Kw,n=e.remarkPlugins||Kw,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qw}:qw;return c5().use(J_).use(n).use(WM,s).use(t)}function y5(e){const t=e.children||"",n=new G1;return typeof t=="string"&&(n.value=t),n}function b5(e,t){const n=t.allowedElements,s=t.allowElement,i=t.components,l=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,p=t.urlTransform||v5;for(const h of h5)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+p5+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),q1(e,m),PO(e,{Fragment:r.Fragment,components:i,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,x,y){if(h.type==="raw"&&y&&typeof x=="number")return c?y.children.splice(x,1):y.children[x]={type:"text",value:h.value},x;if(h.type==="element"){let b;for(b in Lm)if(Object.hasOwn(Lm,b)&&Object.hasOwn(h.properties,b)){const C=h.properties[b],j=Lm[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=p(String(C||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):l?l.includes(h.tagName):!1;if(!b&&s&&typeof x=="number"&&(b=!s(h,x,y)),b&&y&&typeof x=="number")return u&&h.children?y.children.splice(x,1,...h.children):y.children.splice(x,1),x}}}function v5(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||s!==-1&&t>s||m5.test(e.slice(0,t))?e:""}function fn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:Te("prose-syntaur max-w-none",t),children:r.jsx(g5,{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 Or(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function w5(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{if(e)try{const p=await fetch(Or(e));if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch todos")}finally{i(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&p.projectSlug===e&&u()}),{data:t,loading:s,error:l,refetch:u}}async function j5(e,t,n){await fetch(Or(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function k5(e,t,n){await fetch(`${Or(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function S5(e,t,n){await fetch(`${Or(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function N5(e,t,n){await fetch(`${Or(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function C5(e,t){await fetch(`${Or(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function E5(e,t){await fetch(`${Or(e)}/${t}`,{method:"DELETE"})}async function T5(e,t,n){const s=await fetch(`${Or(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 Y1(e,t,n){return`${Or(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function P5(e,t,n){for(const s of n){const i=await fetch(`${Or(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(!i.ok)throw new Error(await i.text().catch(()=>"")||`HTTP ${i.status}`)}}async function R5(e,t,n){const s=await fetch(Y1(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function J1(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 i=null;try{i=s?JSON.parse(s):null}catch{}const l=(i==null?void 0:i.error)||s||`HTTP ${n.status}`,c=new Error(l);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function A5(e,t){return await J1(`${Or(e)}/promote`,t)}async function D5(e,t,n){await J1(`${Or(e)}/${t}/move`,{to:n})}const Gw=[{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 X1({status:e,onChange:t}){const[n,s]=f.useState(!1),i=f.useRef(null);f.useEffect(()=>{if(!n)return;function c(u){i.current&&!i.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const l=Gw.find(c=>c.value===e);return r.jsxs("div",{className:"relative",ref:i,onClick:c=>c.stopPropagation(),children:[r.jsx("button",{onClick:()=>s(!n),className:`text-lg leading-none ${l.color} hover:opacity-70 transition`,title:l.label,children:l.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:Gw.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 Q1({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:i,onEndEdit:l,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:p,attachmentUrl:m,onToggleSelected:h,onMoveOne:x,onStatusChange:y,onCopyId:b,onDelete:C,hotkeyRowProps:j,onDragOrigin:w,onDragStart:k,onDragEnd:E,isDragging:N}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:w,onDragStart:P=>k(P,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 ${N?"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:P=>h(e.id,P),onClick:P=>P.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(X1,{status:e.status,onChange:P=>y(e.id,P)})}),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(Z1,{description:e.description,status:e.status,editing:s,onBeginEdit:()=>i(e.id),onEndEdit:l,onSave:P=>c(e.id,P)}),e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(P=>`#${P}`).join(" ")}),e.session&&r.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(_5,{item:e})]}),r.jsx(eN,{item:e,attachmentUrl:m,onAdd:P=>u(e.id,P),onDelete:P=>p(e.id,P)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(uo,{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:P=>b(P,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:P=>b(P,e.id),children:r.jsx(rd,{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:P=>x(e.id,P),children:r.jsx($d,{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:P=>C(P,e.id,e.description),children:r.jsx(or,{className:"h-3 w-3"})})]})]})}function Z1({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:i,onSave:l}){return n?r.jsx($5,{initialValue:e,onSave:l,onExit:i}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:c=>{c.stopPropagation(),s()},title:"Click to edit",className:Te("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 $5({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[i,l]=f.useState(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),h=f.useRef(null),x=f.useRef(!1);f.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=f.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=f.useCallback(async()=>{if(x.current)return;const j=i.trim();if(j.length===0){y();return}if(j===s.current){n();return}x.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[i,n,t,y]);function C(j){j.key==="Enter"?(j.preventDefault(),b()):j.key==="Escape"&&(j.preventDefault(),x.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:c,value:i,onClick:j=>j.stopPropagation(),onChange:j=>l(j.target.value),onKeyDown:C,onBlur:()=>void b(),className:Te("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",p&&"syntaur-input-shake",c&&"opacity-70")})}function L5(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function O5(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 i=s.getAsFile();i&&n.push(i)}}return n}function eN({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const i=e.attachments??[],[l,c]=f.useState(!1),[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{var y;l&&((y=h.current)==null||y.focus())},[l]);const x=f.useCallback(async y=>{if(y.length){p(!0);try{await n(y),c(!1)}finally{p(!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:[i.map(y=>r.jsx(I5,{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(f0,{className:"h-3 w-3"}),i.length===0?"Attach":""]})]}),l&&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=O5(y);b.length&&(y.preventDefault(),x(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(),x(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="",x(b)}})]})]})}function I5({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:[L5(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(f0,{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(_d,{className:"h-3 w-3"})})]})}function _5({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(Wo,{delayDuration:120,children:r.jsxs(Pr,{children:[r.jsx(Rr,{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(ng,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(gr,{children:e.branch})]})}):null,e.planDir?r.jsx(Wo,{delayDuration:120,children:r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),navigator.clipboard.writeText(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(c0,{className:"h-2.5 w-2.5"})})}),r.jsxs(gr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(Wo,{delayDuration:120,children:r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(gr,{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 tN="__one_off__";function fx({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:i,defaultProject:l,defaultTitle:c,allowOneOff:u=!0}){const[p,m]=f.useState("new"),[h,x]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),[w,k]=f.useState(null),[E,N]=f.useState(""),[P,$]=f.useState(""),[T,D]=f.useState(""),[L,Y]=f.useState(""),[X,I]=f.useState(""),[U,ne]=f.useState(""),[F,H]=f.useState(null),[ee,ce]=f.useState(!1),_=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),N(""),$(""),D(""),Y(""),I(""),ne(""),H(null);return}N(l??""),$(c??"");let ue=!1;return(async()=>{try{const ge=await fetch("/api/projects");if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const V=await ge.json();ue||j(V.filter(oe=>!oe.archived))}catch(ge){ue||k(ge instanceof Error?ge.message:String(ge))}})(),()=>{ue=!0}},[e,l,c]),f.useEffect(()=>{if(!X){H(null);return}let ue=!1;return ce(!0),(async()=>{try{const ge=await fetch(`/api/projects/${encodeURIComponent(X)}/assignments`);if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const V=await ge.json();ue||H(V)}catch{ue||H([])}finally{ue||ce(!1)}})(),()=>{ue=!0}},[X]);const W=f.useMemo(()=>C??[],[C]);async function R(ue){if(ue.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(_&&!P.trim()){b("Title is required when promoting multiple todos.");return}const ge=E===tN?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const oe={groups:n.groups,mode:"new-assignment",target:ge,title:P.trim()||void 0,type:T.trim()||void 0,priority:L||void 0};await O(oe);return}const V={todoIds:t,mode:"new-assignment",target:ge,title:P.trim()||void 0,type:T.trim()||void 0,priority:L||void 0};await Q(V)}async function M(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!X||!U){b("Pick both project and assignment.");return}const ge={todoIds:t,mode:"to-assignment",target:{assignment:`${X}/${U}`}};await Q(ge)}async function Q(ue){x(!0),b(null);try{let ge;if(n.kind==="workspace")ge=await MR(n.workspace,ue);else if(n.kind==="project")ge=await A5(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");i(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{x(!1)}}async function O(ue){x(!0),b(null);try{const ge=await FR(ue);i(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{x(!1)}}return r.jsx(ir,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsxs(qn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(hs,{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(f1,{value:p,onValueChange:ue=>m(ue),children:[r.jsxs(p1,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Eh,{value:"new",className:Te("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(Eh,{value:"existing",className:Te("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(Th,{value:"new",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsx(Vi,{label:"Target project",children:r.jsx(Yw,{value:E,onChange:N,projects:W,error:w,disabled:h,allowOneOff:u})}),r.jsx(Vi,{label:_?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:P,onChange:ue=>$(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(Vi,{label:"Type",children:r.jsx("input",{type:"text",value:T,onChange:ue=>D(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(Vi,{label:"Priority",children:r.jsxs("select",{value:L,onChange:ue=>Y(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(Jw,{message:y}):null,r.jsx(Xw,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(Th,{value:"existing",children:r.jsxs("form",{onSubmit:M,className:"space-y-4",children:[r.jsx(Vi,{label:"Project",children:r.jsx(Yw,{value:X,onChange:ue=>{I(ue),ne("")},projects:W,error:w,disabled:h})}),r.jsx(Vi,{label:ee?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:U,onChange:ue=>ne(ue.target.value),disabled:h||!X||ee,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:X?"Select assignment...":"Pick a project first"}),(F??[]).map(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(Jw,{message:y}):null,r.jsx(Xw,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function Vi({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 Yw({value:e,onChange:t,projects:n,error:s,disabled:i,allowOneOff:l}){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:i,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),l?r.jsx("option",{value:tN,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function Jw({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 Xw({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs($s,{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 nN({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:i}){const[l,c]=f.useState("project"),[u,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(!1),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),p(""),h(""),C(null),w(null);return}let D=!1;return(async()=>{try{const L=await fetch("/api/projects");if(!L.ok)throw new Error(`HTTP ${L.status}`);const Y=await L.json();D||E(Y.filter(X=>!X.archived))}catch(L){D||w(L instanceof Error?L.message:String(L))}})(),()=>{D=!0}},[e]);const N=f.useMemo(()=>k?n.kind==="project"?k.filter(D=>D.slug!==n.projectId):k:[],[k,n]);function P(){if(l==="global")return{global:!0};if(l==="workspace"){const D=u.trim();return D?{workspace:D}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function $(D,L){try{return n.kind==="workspace"?await zR(n.workspace,D,L):await D5(n.projectId,D,L),{ok:!0}}catch(Y){return{ok:!1,error:Y instanceof Error?Y.message:String(Y)}}}async function T(D){D.preventDefault(),w(null);const L=P();if(typeof L=="string"){w(L);return}y(!0),C(null);const Y=[],X=[];for(const I of t){const U=await $(I,L);U.ok?Y.push(I):X.push({id:I,error:U.error})}y(!1),i(),X.length===0?s(!1):C({succeeded:Y,failed:X})}return r.jsx(ir,{open:e,onOpenChange:D=>x?void 0:s(D),children:r.jsx(Kn,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:T,className:"space-y-4",children:[r.jsxs(Qr,{children:[r.jsxs(qn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(hs,{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:x,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(Wm,{kind:"project",checked:l==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Wm,{kind:"workspace",checked:l==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Wm,{kind:"global",checked:l==="global",onChange:()=>c("global"),label:"Global"})]}),l==="project"?r.jsx(Qw,{label:"Target project",children:r.jsxs("select",{value:m,onChange:D=>h(D.target.value),disabled:x,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),N.map(D=>r.jsxs("option",{value:D.slug,children:[D.title," (",D.slug,")"]},D.slug))]})}):null,l==="workspace"?r.jsx(Qw,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:D=>p(D.target.value),disabled:x,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(M5,{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(D=>r.jsxs("li",{children:["[t:",D.id,"] ",D.error]},D.id))})]}):null,r.jsxs($s,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:x,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:b?"Close":"Cancel"}),b===null?r.jsx("button",{type:"submit",disabled:x,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:x?"Moving...":"Move"}):null]})]})})})}function Qw({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 Wm({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 M5({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 px({label:e,count:t,expanded:n,onToggle:s,isDropTarget:i=!1,onDragOver:l,onDragLeave:c,onDrop:u,children:p}){return r.jsxs("div",{className:Te("rounded-lg border border-border/60 bg-card/40 transition",i&&"ring-2 ring-ring/30"),onDragOver:l,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(Kr,{className:Te("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:p})]})}const rN=[{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 cf(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function mx(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[cf(n.status)].push(n);return rN.map(n=>({config:n,items:t[n.id]}))}const sN="syntaur.todos.sections.collapsed.v1",Zw=Object.fromEntries(rN.map(e=>[e.id,e.defaultCollapsed]));function Km(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(sN);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function F5(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(sN,JSON.stringify(e))}catch{}}function hx(e){const[t,n]=f.useState(()=>Km()[e]??{});f.useEffect(()=>{n(Km()[e]??{})},[e]);const s=f.useCallback(l=>t[l]??Zw[l],[t]),i=f.useCallback(l=>{const c=Km(),u=c[e]??{},p=u[l]??Zw[l],m={...u,[l]:!p};c[e]=m,F5(c),n(m)},[e]);return{isCollapsed:s,toggle:i}}function z5({projectId:e}){const{data:t,loading:n,error:s,refetch:i}=w5(e),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(""),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(new Set),[N,P]=f.useState(!1),[$,T]=f.useState(!1),[D,L]=f.useState(null),Y=f.useRef(null);mo("list:todos");const X=hx("project:"+e),[I,U]=f.useState(null),[ne,F]=f.useState(null),H=f.useRef(null);function ee(q,pe){q.stopPropagation(),navigator.clipboard.writeText(pe),C(pe),setTimeout(()=>C(Z=>Z===pe?null:Z),1500)}const ce=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const q=new Set;for(const pe of t.items)for(const Z of pe.tags)q.add(Z);return Array.from(q).sort()},[t]),_=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let q=t.items;if(l.trim()){const pe=l.toLowerCase();q=q.filter(Z=>Z.description.toLowerCase().includes(pe)||Z.tags.some(ye=>ye.toLowerCase().includes(pe))||Z.id.includes(pe))}return u&&(q=q.filter(pe=>pe.status===u)),m&&(q=q.filter(pe=>pe.tags.includes(m))),q},[t,l,u,m]);f.useEffect(()=>{E(new Set)},[l,u,m,e]);const W=f.useMemo(()=>_.filter(q=>k.has(q.id)).length,[_,k]),R=_.length>0&&W===_.length,M=W>0&&!R;function Q(q){E(pe=>{const Z=new Set(pe);return Z.has(q)?Z.delete(q):Z.add(q),Z})}function O(){E(q=>{const pe=new Set(q);if(R)for(const Z of _)pe.delete(Z.id);else for(const Z of _)pe.add(Z.id);return pe})}function ue(){E(new Set)}const ge=D?[D]:Array.from(k);function V(){E(new Set),L(null),i()}function oe(){E(new Set),i()}async function me(){x.trim()&&(await j5(e,x.trim()),y(""),i())}async function ve(q,pe,Z){q.stopPropagation(),window.confirm(`Delete "${Z}"? This can't be undone.`)&&(await E5(e,pe),i())}async function ke(q,pe){switch(pe){case"open":await C5(e,q);break;case"in_progress":await N5(e,q);break;case"completed":await k5(e,q);break;case"blocked":await S5(e,q);break}i()}async function he(q,pe){await T5(e,q,pe),i()}async function Je(q,pe){await P5(e,q,pe),i()}async function Ye(q,pe){await R5(e,q,pe),i()}const ot=mx(_),G=ot.filter(q=>!X.isCollapsed(q.config.id)).flatMap(q=>q.items),{hotkeyRowProps:Ie}=ic(G,{scope:"list:todos",bindO:!1,onOpen:q=>w(q.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var q;return(q=Y.current)==null?void 0:q.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[Se,Oe]=ms(),Xe=Se.get("focus");f.useEffect(()=>{if(!Xe||!(t!=null&&t.items))return;const q=t.items.find(Z=>Z.id===Xe);if(!q)return;const pe=cf(q.status);X.isCollapsed(pe)&&X.toggle(pe)},[Xe,t==null?void 0:t.items]),f.useEffect(()=>{if(!Xe)return;const q=document.querySelector(`[data-todo-id="${window.CSS.escape(Xe)}"]`);if(!q)return;q.scrollIntoView({block:"nearest"}),q.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{q.classList.remove("ring-2","ring-primary/60"),Oe(Z=>{const ye=new URLSearchParams(Z);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(pe)},[Xe,G.length,Oe]);const _e=I?(t==null?void 0:t.items.find(q=>q.id===I))??null:null;function nt(q,pe){const Z=H.current;if(Z!=null&&Z.closest(ma)){q.preventDefault();return}q.dataTransfer.effectAllowed="move",q.dataTransfer.setData("text/plain",pe),U(pe)}function Ke(){U(null),F(null)}function gt(q,pe){!_e||pe.statuses.includes(_e.status)||(q.preventDefault(),q.dataTransfer.dropEffect="move",F(pe.id))}function Pt(q,pe){ne===pe.id&&!q.currentTarget.contains(q.relatedTarget)&&F(null)}function it(q,pe){q.preventDefault();const Z=_e;Ke(),!(!Z||pe.statuses.includes(Z.status))&&ke(Z.id,pe.dropStatus)}if(n)return r.jsx(mt,{label:"Loading todos..."});if(s)return r.jsx(wt,{error:s});const ie=(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(An,{label:"Open",value:ie.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:ie.in_progress,icon:Ar,tone:"info"}),r.jsx(An,{label:"Blocked",value:ie.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Total",value:ie.total,icon:Ar})]}),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:x,onChange:q=>y(q.target.value),onKeyDown:q=>q.key==="Enter"&&me(),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:me,disabled:!x.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(rn,{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(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:Y,type:"text",placeholder:"Search...",value:l,onChange:q=>c(q.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:q=>p(q.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"})]}),ce.length>0&&r.jsxs("select",{value:m,onChange:q=>h(q.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"}),ce.map(q=>r.jsxs("option",{value:q,children:["#",q]},q))]})]}),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:()=>P(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{L(null),T(!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,_.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:R,ref:q=>{q&&(q.indeterminate=M)},onChange:O,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",_.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let q=-1;return ot.map(({config:pe,items:Z})=>{const ye=!X.isCollapsed(pe.id);return r.jsx(px,{label:pe.label,count:Z.length,expanded:ye,onToggle:()=>X.toggle(pe.id),isDropTarget:ne===pe.id,onDragOver:Re=>gt(Re,pe),onDragLeave:Re=>Pt(Re,pe),onDrop:Re=>it(Re,pe),children:ye&&Z.map(Re=>(q+=1,r.jsx(Q1,{item:Re,copiedId:b,selected:k.has(Re.id),editing:j===Re.id,onBeginEdit:lt=>w(lt),onEndEdit:()=>w(null),onPatchDescription:he,onAddAttachments:Je,onDeleteAttachment:Ye,attachmentUrl:(lt,te)=>Y1(e,lt,te),onToggleSelected:lt=>Q(lt),onMoveOne:(lt,te)=>{te.stopPropagation(),L(lt),T(!0)},onStatusChange:ke,onCopyId:ee,onDelete:ve,hotkeyRowProps:Ie(q),onDragOrigin:lt=>{H.current=lt.target},onDragStart:nt,onDragEnd:Ke,isDragging:I===Re.id},Re.id)))},pe.id)})})()}),r.jsx(fx,{open:N,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:P,onDone:oe}),r.jsx(nN,{open:$,selectedIds:ge,scope:{kind:"project",projectId:e},onOpenChange:q=>{T(q),q||L(null)},onDone:V})]})}const B5={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},ej=new Set(["title"]);function oN({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function i(c){if(ej.has(c))return;const p=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:p})}const l=e.hidden.length;return r.jsxs(ir,{open:n,onOpenChange:s,children:[r.jsx(R3,{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(sP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",l>0?` (${Nm.length-l}/${Nm.length})`:""]})]})}),r.jsxs(Kn,{className:"max-w-sm",children:[r.jsx(Qr,{children:r.jsx(qn,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Nm.map(c=>{const u=e.hidden.includes(c),p=ej.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${p?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>i(c),disabled:p,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:B5[c]}),p?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const ua={...Vl,custom:!1},iN=`view-prefs.cache.v${Vl.version}`;let Gl=U5(),Hi=null;const Yl=new Set;let aN=0;function gx(){return++aN}function xx(e){return e===aN}function U5(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(iN);if(!e)return null;const t=JSON.parse(e);return t.version!==Vl.version?null:t}catch{return null}}function V5(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(iN,JSON.stringify(e))}catch{}}function yx(e){Gl=e,V5(e);for(const t of Yl)t(e)}function bx(e){if(!e||typeof e!="object")return ua;const t=e;return t.version!==Vl.version||!t.global||!t.projects?ua:{version:Vl.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function vx(){if(Hi)return Hi;const e=gx();return Hi=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=bx(t);return xx(e)&&yx(n),Hi=null,Gl??n}).catch(()=>(Hi=null,Gl??ua)),Hi}function lN(e){const[t,n]=f.useState(()=>Gl??ua);return f.useEffect(()=>{let s=!1;return vx().then(i=>{s||n(i)}),Yl.add(n),()=>{s=!0,Yl.delete(n)}},[]),nS(t,e??null)}function H5(){const[e,t]=f.useState(()=>Gl??ua);return f.useEffect(()=>{let n=!1;return vx().then(s=>{n||t(s)}),Yl.add(t),()=>{n=!0,Yl.delete(t)}},[]),e}async function cN(e){const t=gx(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const i=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(i.error??"Failed to save view-prefs")}const s=bx(await n.json());return xx(t)&&yx(s),s}function uN(e){return cN({global:e})}function dN(e,t){return cN({projects:{[e]:t}})}async function W5(){const e=gx(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=bx(await t.json());return xx(e)&&yx(n),n}const tj=80;function fN({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:i="Save view"}){const[l,c]=f.useState(n),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(c(n),h(null),p(!1))},[e,n]);const x=l.trim(),y=x.length>0&&x.length<=tj;return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsx(Kn,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){p(!0),h(null);try{await s(x)}catch(C){h(C instanceof Error?C.message:String(C)),p(!1)}}},children:[r.jsx(Qr,{children:r.jsx(qn,{children:i})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:l,autoFocus:!0,required:!0,maxLength:tj,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($s,{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 pN({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:i,loading:l}=Hd(),[c,u]=f.useState(!1),p=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(C){p.current&&!p.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=f.useMemo(()=>i.filter(y=>sS(y,e)),[i,e]),h=t?i.find(y=>y.id===t)??null:null,x=l?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:p,children:[r.jsxs("button",{type:"button",disabled:l,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:x}),r.jsx(Kr,{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:Te("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(uo,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const K5={__unassigned__:"Unassigned",__standalone__:"No project"};function Rn({options:e,value:t,onChange:n,allLabel:s="Any",className:i,disabled:l,ariaLabel:c}){const[u,p]=f.useState(!1),m=f.useRef(null),h=f.useRef(null),x=f.useRef([]),y=f.useMemo(()=>{const E=new Set(e.map(P=>P.value)),N=t.filter(P=>!E.has(P)).map(P=>({value:P,label:K5[P]??P}));return[...e,...N]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function E(N){m.current&&!m.current.contains(N.target)&&p(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),f.useEffect(()=>{var E;u&&((E=x.current[0])==null||E.focus())},[u]);const C=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(N=>N.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(N=>N!==E):[...t,E])}function w(E){var P;const N=Math.max(0,Math.min(E,y.length-1));(P=x.current[N])==null||P.focus()}function k(E){var T;const N=x.current,P=document.activeElement,$=N.findIndex(D=>D===P);E.key==="ArrowDown"?(E.preventDefault(),w($<0?0:$+1)):E.key==="ArrowUp"?(E.preventDefault(),w($<0?y.length-1:$-1)):E.key==="Home"?(E.preventDefault(),w(0)):E.key==="End"?(E.preventDefault(),w(y.length-1)):E.key==="Escape"&&(E.preventDefault(),p(!1),(T=h.current)==null||T.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:l,"aria-haspopup":"menu","aria-expanded":u,"aria-label":c,onClick:()=>p(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),p(!0))},className:Te("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",i),children:[r.jsx("span",{className:"truncate",children:C}),r.jsx(Kr,{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,N)=>{const P=b.has(E.value);return r.jsxs("button",{ref:$=>{x.current[N]=$},type:"button",role:"menuitemcheckbox","aria-checked":P,tabIndex:-1,onClick:()=>j(E.value),className:Te("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",P?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{className:Te("flex h-4 w-4 shrink-0 items-center justify-center rounded border",P?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:P?r.jsx(uo,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const nj={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"},q5=["updated","created"];function wx({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[i,l]=f.useState(!1),c=f.useRef(null),u=(e==null?void 0:e.field)??"updated",p=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=f.useState(p);f.useEffect(()=>h(p),[p]),f.useEffect(()=>{if(!i)return;function k(N){c.current&&!c.current.contains(N.target)&&l(!1)}function E(N){N.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[i]);const x=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!x||!e?"Any date":e.preset?`${u}: ${nj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[x,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 w(k,E){const N={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...N,[k]:E})}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":i,"aria-label":s,onClick:()=>l(k=>!k),className:Te("editor-input inline-flex items-center justify-between gap-1.5 text-left",x&&"border-foreground/40 text-foreground",n),children:[r.jsx("span",{className:"truncate",children:y}),r.jsx(Kr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),i?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:q5.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:Te("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(qm,{label:"Any date",selected:!x,onClick:j}),$D.map(k=>r.jsx(qm,{label:nj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>C(k)},k)),r.jsx(qm,{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=>w("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=>w("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function qm({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:Te("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(uo,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const G5=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search"]);function Y5(e,t){const n={};for(const[s,i]of Object.entries(e))G5.has(s)||(n[s]=i);return{...n,...t}}function jx(e,t,n){return{...e,viewMode:t.viewMode,filters:Y5(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function J5(e,t){var m;const n={},s=tt(e.status);s.length&&(n.status=s);const i=tt(e.type);i.length&&(n.type=i);const l=tt(e.priority);l.length&&(n.priority=l);const c=tt(e.assignee);c.length&&(n.assignee=c);const u=tt(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const h=tt(e.project);h.length&&(n.project=h)}e.activity&&e.activity!=="all"&&(n.activity=e.activity),e.dateRange&&(n.dateRange=e.dateRange);const p=(m=e.search)==null?void 0:m.trim();return p&&(n.search=p),n}function Jl(e){const t={viewMode:e.state.viewMode,filters:J5(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 Wi={viewMode:"kanban",sortField:"updated",sortDirection:"desc"};function mN(e,t){const{config:n}=Jl({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:[]}}});return{workspace:t,config:n}}function Xl(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 hN(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function gN(e,t){var s,i,l,c,u,p,m,h,x,y,b,C,j,w;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(i=t.setStatusFilter)==null||i.call(t,tt(n.filters.status)),(l=t.setTypeFilter)==null||l.call(t,tt(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,tt(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,tt(n.filters.assignee)),(p=t.setProjectFilter)==null||p.call(t,tt(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,tt(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,hN(n.filters.dateRange)),(x=t.setSearch)==null||x.call(t,n.filters.search??""),t.setActivityFilter){const k=n.filters.activity??"all";t.setActivityFilter(k==="fresh"||k==="stale"?k:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(b=t.setSortDirection)==null||b.call(t,n.sortDirection),(C=t.setListSectionVisibility)==null||C.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(j=t.setKanbanColumnVisibility)==null||j.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(w=t.setTableColumnVisibility)==null||w.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Xu(e){return e?`/w/${e}/views`:"/views"}function xN(e){return`${Xu(e.workspace)}/${encodeURIComponent(e.id)}`}function yN(e){const t=e.workspace?`/w/${e.workspace}`:"",n=tt(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&rS(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const X5=["critical","high","medium","low"],Q5={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 Z5(e){if(e.preset)return`${e.field} ${Q5[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function bN(e){var s;const t=[];for(const i of["status","priority","type","assignee","project","tags"]){const l=tt(e[i]);l.length&&t.push(`${i}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&t.push(`activity=${e.activity}`),e.dateRange&&t.push(Z5(e.dateRange));const n=(s=e.search)==null?void 0:s.trim();return n&&t.push(`search="${n}"`),t.join(" · ")||"no filters"}const eF=new Set(["overview","assignments","todos","dependencies","knowledge"]),rj="__unknown_type__";function sj(){const{slug:e,workspace:t}=$t(),n=ln(),s=Dt();mo("project"),Ht({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Ht({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:i,loading:l,error:c,refetch:u}=_0(e),p=Zo(),m=tf(),{data:h}=oc(),[x,y]=ms(),b=x.get("tab"),C=b&&eF.has(b)?b:"overview";function j(re){y(Ae=>{const Qe=new URLSearchParams(Ae);return re==="overview"?Qe.delete("tab"):Qe.set("tab",re),Qe},{replace:!0})}const w=e?`p:${e}`:null,k=lN(w),[E,N]=f.useState(()=>Sm(k.defaultView)),[P,$]=f.useState(()=>tt(k.filters.status)),[T,D]=f.useState(()=>tt(k.filters.assignee)),[L,Y]=f.useState(()=>tt(k.filters.priority)),[X,I]=f.useState(()=>tt(k.filters.type)),[U,ne]=f.useState(()=>tt(k.filters.tags)),[F,H]=f.useState(null),[ee,ce]=f.useState(()=>k.grouping),[_,W]=f.useState(()=>k.sortField),[R,M]=f.useState(()=>k.sortDirection),[Q,O]=f.useState(()=>({collapsed:[]})),[ue,ge]=f.useState(()=>({hidden:[]})),[V,oe]=f.useState(()=>({hidden:[]})),[me,ve]=f.useState(null),[ke,he]=f.useState(!1),[Je,Ye]=f.useState(!1),{toast:ot,showToast:G,dismissToast:Ie}=ti(),Se={kind:"project",slug:e??"",workspace:t??null},Oe=x.get("loadView"),{view:Xe,loading:_e,error:nt}=Go(Oe),{view:Ke,loading:gt,error:Pt}=Go(me),it=f.useRef(null);f.useEffect(()=>{me&&!gt&&!Pt&&!Ke&&ve(null)},[Ke,Pt,me,gt]),f.useEffect(()=>{ve(null),it.current=null,H(null)},[e,t]),f.useEffect(()=>{N(Sm(k.defaultView)),$(tt(k.filters.status)),D(tt(k.filters.assignee)),Y(tt(k.filters.priority)),I(tt(k.filters.type)),ne(tt(k.filters.tags)),ce(k.grouping),W(k.sortField),M(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 ie=f.useCallback(re=>{w&&dN(w,re).catch(Ae=>{console.warn("Failed to persist project view prefs:",Ae)})},[w]),q=f.useCallback(re=>{N(re),ie({defaultView:re})},[ie]),pe=f.useCallback(re=>{$(re),ie({filters:{status:re}})},[ie]),Z=f.useCallback(re=>{D(re),ie({filters:{assignee:re}})},[ie]),ye=f.useCallback(re=>{Y(re),ie({filters:{priority:re}})},[ie]),Re=f.useCallback(re=>{I(re),ie({filters:{type:re}})},[ie]),lt=f.useCallback(re=>{ne(re),ie({filters:{tags:re}})},[ie]),te=f.useCallback(re=>{ce(re),ie({grouping:re})},[ie]),be=f.useCallback(re=>{W(re),ie({sortField:re})},[ie]),$e=f.useCallback(re=>{M(re),ie({sortDirection:re})},[ie]),at=f.useCallback(()=>({viewMode:E,filters:{status:P,priority:L,type:X,assignee:T,tags:U,project:"all",activity:"all",dateRange:Xl(F)},sortField:_,sortDirection:R,listSectionVisibility:Q,kanbanColumnVisibility:ue,tableColumnVisibility:V}),[E,P,L,X,T,U,F,_,R,Q,ue,V]),Me=f.useCallback(re=>{gN(re,{setViewMode:Ae=>N(Sm(Ae)),setStatusFilter:pe,setPriorityFilter:ye,setTypeFilter:Re,setAssigneeFilter:Z,setTagsFilter:lt,setDateRange:H,setSortField:be,setSortDirection:$e,setListSectionVisibility:O,setKanbanColumnVisibility:ge,setTableColumnVisibility:oe}),ve(re.id)},[pe,ye,Re,Z,lt,be,$e]),bt=f.useCallback(re=>{Me(re),it.current=re.id,y(Ae=>{const Qe=new URLSearchParams(Ae);return Qe.set("loadView",re.id),Qe},{replace:!0})},[Me,y]),Mt=f.useCallback(async re=>{try{const Ae=Jl({name:re,context:{workspace:t??null,projectSlug:e??null},state:at()}),Qe=await Kd(Ae),Ft=Qe.views[Qe.views.length-1];ve((Ft==null?void 0:Ft.id)??null),Ft&&(it.current=Ft.id,y(hn=>{const Ct=new URLSearchParams(hn);return Ct.set("loadView",Ft.id),Ct},{replace:!0})),he(!1),Ye(!1),G(`Saved view "${re}"`,"success")}catch(Ae){throw G(Ae instanceof Error?Ae.message:"Failed to save view","error"),Ae}},[at,y,G,e,t]),Gt=f.useCallback(async()=>{if(!(!me||!Ke))try{const re=tt(Ke.config.filters.project)[0]??null,Ae=Jl({name:Ke.name,context:{workspace:t??null,projectSlug:re},state:at()}),Qe=jx(Ke.config,Ae.config,Ae.config);await $g(me,{config:Qe}),G("View updated","success")}catch(re){G(re instanceof Error?re.message:"Failed to update view","error")}},[at,Ke,me,G,t]);f.useEffect(()=>{if(!Oe){it.current=null;return}if(it.current!==Oe&&(me&&me!==Oe&&ve(null),!_e)){if(nt){G("Couldn't load saved view — try again","error");return}if(Xe){if(it.current=Oe,!sS(Xe,{kind:"project",slug:e??"",workspace:t??null})){s(yN(Xe),{replace:!0});return}Me(Xe),y(re=>{const Ae=new URLSearchParams(re);return Ae.delete("loadView"),Ae},{replace:!0});return}it.current=Oe,G("Saved view no longer exists","error"),y(re=>{const Ae=new URLSearchParams(re);return Ae.delete("loadView"),Ae},{replace:!0})}},[Oe,Xe,_e,nt,me,Me,y,G,s,e,t]);function fe(re){_===re?$e(R==="asc"?"desc":"asc"):(be(re),$e("asc"))}const Be=f.useMemo(()=>i?Object.fromEntries(i.assignments.flatMap(re=>{const Ae=`${n}/projects/${i.slug}/assignments/${re.slug}`;return[[re.slug,Ae],[re.title,Ae]]})):{},[i]);async function Fe(re){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:re})}),u()}async function Nt(re){try{const Ae=await fetch(`/api/projects/${e}/${re?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ae.ok){const Qe=await Ae.json().catch(()=>null);G((Qe==null?void 0:Qe.error)||`HTTP ${Ae.status}`,"error");return}u(),G(re?"Project archived":"Project restored","success")}catch(Ae){G(Ae instanceof Error?Ae.message:"Failed to update archive state","error")}}async function $n(re){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:re})}),u()}if(l)return r.jsx(mt,{label:"Loading project workspace…"});if(c||!i)return r.jsx(wt,{error:c||"Project not found."});const Yt=(()=>{const re=new Set;for(const Qe of i.assignments)Qe.assignee&&re.add(Qe.assignee);const Ae=[{value:"__unassigned__",label:"Unassigned"}];for(const Qe of Array.from(re).sort())Ae.push({value:Qe,label:Qe});return Ae})(),sn=Array.from(new Set(i.assignments.flatMap(re=>re.tags??[]))).sort().map(re=>({value:re,label:re})),Wt=i.assignments.filter(re=>Wg(re,{status:P,priority:L,type:X,assignee:T,tags:U,dateRange:Xl(F)})),Gn=uc(Wt,_,R),xt=new Set(m.definitions.map(re=>re.id)),jn=ee==="type"?[...m.definitions.map(re=>({id:re.id,title:aa(m,re.id),description:re.description})),...Wt.some(re=>!re.type||!xt.has(re.type))?[{id:rj,title:"Other",description:"Assignments with no recognized type."}]:[]]:qS(p.order).map(re=>({id:re,title:cc(p,re),description:ef(re)}));function Rt({field:re,children:Ae}){const Qe=_===re;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>fe(re),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ae,Qe?R==="asc"?r.jsx(a0,{className:"h-3 w-3"}):r.jsx(Kr,{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(pn,{status:i.status}),i.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Fe(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:re=>{re.target.value&&Fe(re.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),p.statuses.map(re=>r.jsx("option",{value:re.id,children:re.label},re.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>Nt(!i.archived),title:i.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:i.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:re=>{re.target.value==="_ungrouped"?$n(null):re.target.value&&$n(re.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(re=>re!==i.workspace).map(re=>r.jsx("option",{value:re,children:re},re)),i.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ce,{className:"shell-action",to:`${n}/projects/${i.slug}/edit`,children:[r.jsx(hv,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${i.slug}/create/assignment`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Yg,{externalIds:i.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Dn(i.created),". Last source update ",$r(i.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(An,{label:"Assignments",value:i.progress.total}),r.jsx(An,{label:"In Progress",value:i.progress.in_progress??0,tone:"info"}),r.jsx(An,{label:"Review",value:i.progress.review??0,tone:"info"}),r.jsx(An,{label:"Blocked",value:i.progress.blocked??0,tone:"warn"}),r.jsx(An,{label:"Completed",value:i.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Xg,{value:C,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Project Overview",children:r.jsx(fn,{content:i.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:i.assignments.filter(re=>!re.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{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(Rn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:p.statuses.map(re=>({value:re.id,label:re.label})),value:P,onChange:pe}),r.jsx(Rn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Yt,value:T,onChange:Z}),r.jsx(Rn,{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:L,onChange:ye}),r.jsx(Rn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(re=>({value:re.id,label:aa(m,re.id)})),value:X,onChange:Re}),r.jsx(Rn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:sn,value:U,onChange:lt}),r.jsx(wx,{className:"max-w-[190px]",value:F,onChange:H}),E==="kanban"&&r.jsxs("select",{value:ee==="type"?"type":"status",onChange:re=>te(re.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(rf,{value:E,onChange:re=>q(re),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(pN,{scope:Se,loadedViewId:me,onApply:bt,onOpenSaveDialog:()=>{Ye(!1),he(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ke?Gt():(Ye(!1),he(!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:Ke?`Update ${Ke.name}`:"Save current view",children:Ke?`Update '${Ke.name}'`:"Save view"}),Ke?r.jsx("button",{type:"button",onClick:()=>{Ye(!0),he(!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:Wt.length===0?r.jsx(St,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${i.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(Zd,{columns:jn,items:Gn,getItemId:re=>re.slug,getColumnId:re=>ee==="type"?re.type&&xt.has(re.type)?re.type:rj:re.status,dragDisabled:!0,renderCard:re=>r.jsx(tF,{projectSlug:i.slug,assignment:re}),emptyMessage:re=>`No ${re.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:re=>ge(Ae=>({hidden:Ae.hidden.includes(re)?Ae.hidden.filter(Ft=>Ft!==re):[...Ae.hidden,re]}))}):(()=>{const re=new Set(V.hidden),Ae=Qe=>Qe==="title"||!re.has(Qe);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(oN,{visibility:V,onChange:oe})}),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:[Ae("title")?r.jsx(Rt,{field:"title",children:"Assignment"}):null,Ae("status")?r.jsx(Rt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ae("priority")?r.jsx(Rt,{field:"priority",children:"Priority"}):null,Ae("assignee")?r.jsx(Rt,{field:"assignee",children:"Assignee"}):null,Ae("dependencies")?r.jsx(Rt,{field:"dependencies",children:"Dependencies"}):null,Ae("created")?r.jsx(Rt,{field:"created",children:"Created"}):null,Ae("updated")?r.jsx(Rt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gn.map(Qe=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ae("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ce,{to:`${n}/projects/${i.slug}/assignments/${Qe.slug}`,className:"font-semibold text-foreground hover:text-primary",children:Qe.title})}):null,Ae("status")?r.jsx("td",{className:"py-4",children:r.jsx(pn,{status:Qe.status})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ei,{type:Qe.type,compact:!0})}),Ae("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:Qe.priority}):null,Ae("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Qe.assignee??"—"}):null,Ae("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Qe.dependsOn.length}):null,Ae("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(Qe.created)}):null,Ae("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(Qe.updated)}):null]},Qe.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(z5,{projectId:i.slug})},{value:"dependencies",label:"Dependencies",content:i.dependencyGraph?r.jsx(We,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(QL,{definition:i.dependencyGraph,nodeRoutes:Be})}):r.jsx(St,{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(We,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ce,{className:"shell-action",to:`/resources/new?project=${i.slug}`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:i.resources.length===0?r.jsx(St,{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:i.resources.map(re=>r.jsxs(Ce,{to:`/projects/${i.slug}/resources/${re.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:re.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[re.category," · ",re.source]})]},re.slug))})}),r.jsx(We,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Ce,{className:"shell-action",to:`/memories/new?project=${i.slug}`,children:[r.jsx(rn,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:i.memories.length===0?r.jsx(St,{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:i.memories.map(re=>r.jsxs(Ce,{to:`/projects/${i.slug}/memories/${re.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:re.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[re.scope," · ",re.source]})]},re.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Progress Summary",children:r.jsx(gd,{progress:i.progress,showLegend:!0})}),r.jsx(We,{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:i.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:i.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:i.needsAttention.openQuestions})]})]})}),r.jsx(We,{title:"Quick Links",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${i.slug}/edit`,children:[r.jsx(hv,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${i.slug}/create/assignment`,children:[r.jsx(rn,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(YT,{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(ng,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),i.archived?r.jsxs(We,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",i.archivedAt?$r(i.archivedAt):"with no timestamp recorded","."]}),i.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:i.archivedReason}):null]}):null]})]}),r.jsx(ni,{toast:ot,onDismiss:Ie}),r.jsx(fN,{open:ke,onOpenChange:re=>{he(re),re||Ye(!1)},initialName:Je&&Ke?`${Ke.name} (copy)`:"",title:Je?"Save as new view":"Save view",onSubmit:Mt})]})}function tF({projectSlug:e,assignment:t}){const n=ln();return r.jsxs(Ce,{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(Dr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Dn(t.updated)]})]}),r.jsx(pn,{status:t.status})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ei,{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 jl(e,t,n){let s=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(s+=`&mode=${encodeURIComponent(t)}`),n&&(s+=`&terminal=${encodeURIComponent(n)}`),s}function nF(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 rF(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 vN(e,t,n,s){const i=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{reason:s}:{})}),l=await i.json().catch(()=>null);if(!i.ok)throw new Error((l==null?void 0:l.error)||`HTTP ${i.status}`);return l.assignment}async function wN(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})}),i=await s.json().catch(()=>null);if(!s.ok)throw new Error((i==null?void 0:i.error)||`HTTP ${s.status}`);return i.assignment}async function sF(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 jN(e){return e.requiresReason||e.command==="block"}async function oF(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 iF(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 kx extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function Sx(e){const t=await e.json().catch(()=>null);return new kx((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function aF(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 lF(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 cF(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 Sx(s);return(await s.json()).assignment}async function uF(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 Sx(n);return(await n.json()).assignment}async function dF(e){const{url:t}=nF(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await Sx(n);return await n.json()}async function uf(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 fF(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return uf(s)}async function pF(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return uf(n)}async function mF(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await uf(n)).sourceAssignments}async function hF(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await uf(t)).sourceAssignments}function kN(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[i,l]=f.useState(null),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(null),[w,k]=f.useState(null);async function E(T,D){if(!e){t(!0);try{const L=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:T.kind,id:T.id}})});if(!L.ok){window.location.href=jl(T,D);return}const Y=await L.json();if(Y.ok){window.location.href=jl(T,D);return}if(Y.reason==="workspace-path-invalid"){Y.recreate?(m(Y.recreate),x({target:T,mode:D})):u(Y.message);return}s(Y),l({target:T,mode:D})}catch(L){console.warn("preflight failed, firing without override:",L),window.location.href=jl(T,D)}finally{t(!1)}}}function N(){!n||!i||(window.location.href=jl(i.target,i.mode,n.suggestedFallback),s(null),l(null))}async function P(){if(!(!p||!h||y)){b(!0),j(null);try{const T=await dF({kind:p.kind,id:p.id,projectSlug:p.projectSlug,assignmentSlug:p.assignmentSlug}),{target:D,mode:L}=h;m(null),x(null),window.location.href=jl(D,L),!T.exact&&!T.alreadyExisted&&k(`Recreated from ${T.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(T){j(T instanceof kx&&T.stderr?`${T.message}
|
|
534
|
+
${T.stderr}`:T instanceof Error?T.message:String(T))}finally{b(!1)}}}const $=r.jsxs(r.Fragment,{children:[r.jsx(Gi,{open:n!==null,onOpenChange:T=>!T&&(s(null),l(null)),children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsxs(Uo,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(Vo,{children:["Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Ce,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),l(null)},children:"Settings"}),"."]})]}),r.jsxs(Ji,{children:[r.jsx(Ul,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(so,{className:"shell-action mt-0 shell-action--cta",onClick:T=>{T.preventDefault(),N()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(Gi,{open:c!==null,onOpenChange:T=>!T&&u(null),children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsx(Uo,{children:"Can't open in agent"}),r.jsxs(Vo,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(Ji,{children:r.jsx(so,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(Gi,{open:p!==null,onOpenChange:T=>{!T&&!y&&(m(null),x(null),j(null))},children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsx(Uo,{children:"Worktree was deleted"}),r.jsxs(Vo,{children:["The worktree at ",r.jsx("code",{children:p==null?void 0:p.deletedPath})," no longer exists. Recreate it",p!=null&&p.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:p.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(Ji,{children:[r.jsx(Ul,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(so,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:T=>{T.preventDefault(),P()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(Gi,{open:w!==null,onOpenChange:T=>!T&&k(null),children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsx(Uo,{children:"Worktree recreated"}),r.jsx(Vo,{children:w})]}),r.jsx(Ji,{children:r.jsx(so,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:$}}function SN({session:e,onMarkStopped:t}){const n=kN(),s={kind:"session",id:e.sessionId},i="size-3.5",l=Te("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(Wo,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:l,children:[r.jsx(Zi,{className:i}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(gr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:l,children:[r.jsx(Zi,{className:i}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(gr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(Zi,{className:i}),r.jsx("span",{children:"Resume"})]})}),r.jsx(gr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(uP,{className:i}),r.jsx("span",{children:"Fork"})]})}),r.jsx(gr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsxs("button",{type:"button",className:l,onClick:()=>t(e.sessionId),children:[r.jsx(ig,{className:i}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(gr,{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 gF(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function NN({sessions:e,loading:t,error:n}){return t&&!e?null:n&&!e?r.jsx(We,{title:"Agent Sessions",children:r.jsx(St,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(We,{title:"Agent Sessions",children:r.jsx(St,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(We,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(s=>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(Ad,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:s.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:s.sessionId,children:[s.sessionId.slice(0,8),r.jsx(Dr,{value:s.sessionId})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(pn,{status:s.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:$r(s.started)})]}),r.jsx(SN,{session:s,onMarkStopped:gF})]},s.sessionId))})})}const Gm="Cost / Usage";function CN({summary:e,error:t}){return t&&!e?r.jsx(We,{title:Gm,children:r.jsx(St,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(We,{title:Gm,children:r.jsx(St,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(We,{title:Gm,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(oj,{label:"Total cost",value:od(e.totalCost)}),r.jsx(oj,{label:"Total tokens",value:sd(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(Od,{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:[sd(n.totalTokens)," · ",od(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",lR(e.lastEventDay)]})]})}):null}function oj({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 EN({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:i,onOpenChange:l}){const[c,u]=f.useState("");f.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const p=f.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,x=c.trim()||void 0;return r.jsx(ir,{open:e,onOpenChange:y=>s?void 0:l(y),children:r.jsx(Kn,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),i(x)},children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:m}),r.jsx(hs,{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:p}),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($s,{children:[r.jsx("button",{type:"button",onClick:()=>l(!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 si({open:e,title:t,description:n,confirmLabel:s,cancelLabel:i="Cancel",loading:l=!1,destructive:c=!1,onConfirm:u,onOpenChange:p}){return r.jsx(Gi,{open:e,onOpenChange:m=>l?void 0:p(m),children:r.jsxs(Bo,{children:[r.jsxs(Yi,{children:[r.jsx(Uo,{children:t}),r.jsx(Vo,{children:n})]}),r.jsxs(Ji,{children:[r.jsx(Ul,{disabled:l,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:i}),r.jsx(so,{disabled:l,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:l?"Working...":s})]})]})})}function TN({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:i}){const l=e.kind==="assignment"&&!t&&!n,c=kN(),u=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",p="Set a workspace path first — see the Workspace Before Code playbook",m=Te("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");return l?r.jsxs("button",{type:"button",disabled:!0,title:p,className:m,"aria-disabled":!0,children:[r.jsx(Zi,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{type:"button",onClick:()=>void c.open(e),disabled:c.pending,title:i??u,className:m,children:[r.jsx(Zi,{className:"size-3.5"}),r.jsx("span",{children:e.kind==="session"?"Open":"Open in agent"})]}),c.dialogs]})}const Ym="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 PN({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:i="main",onCreated:l}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,p]=f.useState(!1),[m,h]=f.useState("new-branch"),[x,y]=f.useState(null),[b,C]=f.useState(null),[j,w]=f.useState(""),[k,E]=f.useState(!1),[N,P]=f.useState(""),[$,T]=f.useState([]),[D,L]=f.useState(!1),[Y,X]=f.useState(null),[I,U]=f.useState(""),[ne,F]=f.useState(null),[H,ee]=f.useState(null),[ce,_]=f.useState(""),[W,R]=f.useState(s),[M,Q]=f.useState(!1),[O,ue]=f.useState(null);f.useEffect(()=>{if(!u)return;let G=!1;return h("new-branch"),y(null),C(null),w(""),E(!1),P(""),T([]),L(!1),X(null),U(""),F(null),ee(null),_(""),R(s),ue(null),(c.kind==="project-nested"?aF(c.projectSlug):lF(c.assignmentId)).then(Oe=>{if(!G)if(y(Oe),Oe.length===0)E(!0);else{const Xe=Oe.find(nt=>nt.source==="project"),_e=Oe.find(nt=>nt.source==="sibling");w((Xe==null?void 0:Xe.path)??(_e==null?void 0:_e.path)??Oe[0].path)}}).catch(Oe=>{G||(C(Oe.message),y([]),E(!0))}),(c.kind==="project-nested"?mF(c.projectSlug,c.assignmentSlug):hF(c.assignmentId)).then(Oe=>{G||F(Oe)}).catch(Oe=>{G||(ee(Oe.message),F([]))}),()=>{G=!0}},[u,s,i,e,t,n]);const ge=m==="branch-off"?(ne??[]).find(G=>G.id===ce)??null:null,V=m==="branch-off"?(ge==null?void 0:ge.repository)??"":k?N.trim():j;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!V){T([]),X(null),L(!1),U("");return}let G=!1;return L(!0),X(null),U(""),(c.kind==="project-nested"?fF(c.projectSlug,c.assignmentSlug,V):pF(c.assignmentId,V)).then(Se=>{if(G)return;T(Se.branches);const Oe=(Se.defaultBranch&&Se.branches.includes(Se.defaultBranch)?Se.defaultBranch:Se.branches.includes(i)?i:Se.branches[0])??"";U(Oe),L(!1)}).catch(Se=>{G||(T([]),X(Se.message),L(!1))}),()=>{G=!0}},[u,m,V,i,e,t,n]);const oe=rF(W.trim()),me=f.useMemo(()=>!V||!W.trim()?"":`${V.replace(/\/+$/,"")}/.worktrees/${W.trim()}`,[V,W]),ve=x!==null&&x.length===0,ke=ne!==null&&ne.length===0,he=G=>{G!==m&&(h(G),_(""),ue(null),G==="branch-off"&&(U(""),T([]),X(null),L(!1)))},Je=G=>{_(G);const Ie=(ne??[]).find(Se=>Se.id===G);U((Ie==null?void 0:Ie.branch)??"")},Ye=M||oe!==null||!V||!I.trim()||(m==="new-branch"?x===null||D:ne===null||!ce),ot=async()=>{Q(!0),ue(null);try{const G={repository:V,branch:W.trim(),parentBranch:I.trim()};c.kind==="project-nested"?await cF(c.projectSlug,c.assignmentSlug,G):await uF(c.assignmentId,G),p(!1),l()}catch(G){G instanceof kx?ue({message:G.message,stderr:G.stderr}):G instanceof Error?ue({message:G.message}):ue({message:String(G)})}finally{Q(!1)}};return r.jsxs(ir,{open:u,onOpenChange:G=>M?void 0:p(G),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>p(!0),children:[r.jsx(cP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(Kn,{children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:"Create worktree"}),r.jsxs(hs,{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:M,onClick:()=>he("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:M,onClick:()=>he("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:[ve?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:Ym,value:j,onChange:G=>w(G.target.value),disabled:M||x===null||k,children:(x??[]).map(G=>r.jsxs("option",{value:G.path,children:[G.path,G.source==="project"?" (project)":G.sourceAssignmentSlug?` (sibling — ${G.sourceAssignmentSlug})`:" (sibling)"]},`${G.source}:${G.path}`))}),ve?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:M,onClick:()=>E(G=>!G),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:N,onChange:G=>P(G.target.value),disabled:M}):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:Ym,value:I,onChange:G=>U(G.target.value),disabled:M||D||$.length===0,children:D?r.jsx("option",{value:"",children:"Loading branches…"}):$.length===0?r.jsx("option",{value:"",children:Y?"Could not load branches":V?"No branches found":"— pick a repository —"}):$.map(G=>r.jsx("option",{value:G,children:G},G))}),Y?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",Y]}):null]})]}):r.jsxs(r.Fragment,{children:[H?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: ",H]}):null,ke?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:Ym,value:ce,onChange:G=>Je(G.target.value),disabled:M||ne===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(ne??[]).map(G=>r.jsxs("option",{value:G.id,children:[G.title," (",G.branch,")"]},G.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:W,onChange:G=>R(G.target.value),disabled:M}),oe?r.jsx("span",{className:"text-[11px] text-error-foreground",children:oe}):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:me||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),O?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:O.message}),O.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:O.stderr}):null]}):null]}),r.jsxs($s,{children:[r.jsx(D3,{disabled:M,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:Ye,onClick:()=>void ot(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:M?"Working…":"Create worktree"})]})]})]})}function xF(e){const t=e.split(`
|
|
535
|
+
`),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 i=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()})),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
536
|
+
`).replace(/\n{3,}/g,`
|
|
537
|
+
|
|
538
|
+
`).trim();return{acceptanceCriteria:i,summaryBody:l}}function yF(e){const t=e.split(`
|
|
539
|
+
`),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 i=t.slice(n+1,s).join(`
|
|
540
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
541
|
+
|
|
542
|
+
`).trim(),l=[...t.slice(0,n),...t.slice(s)].join(`
|
|
543
|
+
`).replace(/\n{3,}/g,`
|
|
544
|
+
|
|
545
|
+
`).trim();return{hasSection:!0,todosMarkdown:i,remaining:l}}function bF({projectSlug:e,dependencies:t,blockedReason:n}){const[s,i]=f.useState(!1);if(t.length===0)return null;const l=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=l.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>i(!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(eg,{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(Kr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[l.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(ch,{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:[l.length," ",l.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(We,{title:"Dependencies",description:`${t.length-l.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>i(!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(Ce,{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(pn,{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(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function vF({links:e}){const t=ln();if(e.length===0)return null;const n=e.filter(i=>!i.isReverse),s=e.filter(i=>i.isReverse);return r.jsx(We,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(i=>r.jsxs(Ce,{to:`${t}/projects/${i.projectSlug}/assignments/${i.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(o0,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:i.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${i.slug}`)),s.map(i=>r.jsxs(Ce,{to:`${t}/projects/${i.projectSlug}/assignments/${i.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(td,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(pn,{status:i.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:i.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:i.slug})]}),r.jsx(nd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${i.slug}`))]})})}function wF(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 i=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(i):n.push(i)}return n}function jF(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function RN({projectSlug:e,assignmentSlug:t,entries:n}){const[s,i]=f.useState(n);f.useEffect(()=>{i(n)},[n]);const l=f.useMemo(()=>wF(s),[s]),[c,u]=f.useState(""),[p,m]=f.useState("note"),[h,x]=f.useState(!1),[y,b]=f.useState(null);async function C(w){var N;if(w.preventDefault(),!c.trim())return;x(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:p,body:c,resolved:p==="question"?!1:void 0};i(P=>[...P,E]);try{const P=await fetch(jF(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:p})});if(!P.ok){const D=await P.text();throw new Error(D||`HTTP ${P.status}`)}const $=await P.json().catch(()=>null),T=(N=$==null?void 0:$.comment)==null?void 0:N.id;i(D=>D.map(L=>L.id===k?{...L,id:T??L.id}:L)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(P){b(P instanceof Error?P.message:String(P)),i($=>$.filter(T=>T.id!==k))}finally{x(!1)}}async function j(w,k){i(E=>E.map(N=>N.id===w?{...N,resolved:k}:N));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(w)}/resolved`,N=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!N.ok)throw new Error(`HTTP ${N.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),i(N=>N.map(P=>P.id===w?{...P,resolved:!k}:P))}}return r.jsx(We,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[l.map(w=>r.jsx(AN,{node:w,onToggleResolved:j,depth:0},w.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:w=>u(w.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:p,onChange:w=>m(w.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 AN({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:i}=e,l=s.type==="question";return r.jsxs("div",{className:Te("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:Te("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",l&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),l?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:Te("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(eg,{className:"h-3 w-3"}):r.jsx(eP,{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(vP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(fn,{content:s.body}),i.length>0?r.jsx("div",{className:"space-y-2",children:i.map(c=>r.jsx(AN,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const kF=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function ij(){var lt,te,be,$e,at,Me,bt,Mt,Gt;const{slug:e,aslug:t}=$t(),n=Dt(),s=ln(),[i,l]=ms(),[c,u]=f.useState(null),{toast:p,showToast:m,dismissToast:h}=ti(),[x,y]=f.useState(null),[b,C]=f.useState(null),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(!1),[$,T]=f.useState(!1),[D,L]=f.useState(0),Y=i.get("tab")??"summary",X=Zo(),{data:I,loading:U,error:ne,refetch:F}=bR(e,t),{data:H}=_0(e),{data:ee}=dg(),{data:ce,loading:_,error:W}=wR(e,t),{data:R,loading:M,error:Q}=kR(e,t),O=f.useMemo(()=>{if(!I||!H)return[];const fe=new Map(H.assignments.map(Be=>[Be.slug,Be]));return I.dependsOn.map(Be=>{const Fe=fe.get(Be);return{slug:Be,title:(Fe==null?void 0:Fe.title)??Be,status:(Fe==null?void 0:Fe.status)??"pending",priority:(Fe==null?void 0:Fe.priority)??"medium",assignee:(Fe==null?void 0:Fe.assignee)??null}})},[I,H]),ue=O.filter(fe=>fe.status!=="completed"&&fe.status!=="review");mo("assignment");const ge=f.useMemo(()=>((H==null?void 0:H.assignments)??[]).map(fe=>fe.slug),[H]),V=t?ge.indexOf(t):-1,oe=V>0?ge[V-1]:null,me=V>=0&&V<ge.length-1?ge[V+1]:null,ve=`${s}/projects/${e}/assignments/${t}`;Ht({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${ve}/edit`)}),Ht({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${ve}/plan/edit`)}),Ht({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${ve}/handoff/edit`)}),Ht({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${ve}/decision-record/edit`)}),Ht({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${ve}/scratchpad/edit`)}),Ht({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!oe,handler:()=>oe&&n(`${s}/projects/${e}/assignments/${oe}`)}),Ht({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!me,handler:()=>me&&n(`${s}/projects/${e}/assignments/${me}`)});const ke=f.useMemo(()=>I?xF(I.body):{acceptanceCriteria:[],summaryBody:""},[I]),he=f.useMemo(()=>yF(ke.summaryBody),[ke.summaryBody]),Je=ke.acceptanceCriteria,Ye=Je.filter(fe=>fe.checked).length,ot=Je.length>0&&Ye===Je.length,G=f.useRef(ot),Ie=f.useRef(!1);if(f.useEffect(()=>{if(I){if(!Ie.current){G.current=ot,Ie.current=!0;return}ot&&!G.current&&L(fe=>fe+1),G.current=ot}},[ot,I]),U)return r.jsx(mt,{label:"Loading assignment workspace…"});if(ne||!I||!e||!t)return r.jsx(wt,{error:ne||"Assignment not found."});const Se=e,Oe=t,Xe=Je.length>0?{checked:Ye,total:Je.length}:void 0,_e=I.availableTransitions??[],nt=_e.filter(fe=>!fe.disabled&&fe.targetStatus!==I.status),Ke=kF.map(fe=>nt.find(Be=>Be.command===fe)).find(Boolean)??nt[0]??null,gt=[];if(ee!=null&&ee.sessions)for(const fe of ee.sessions)for(const Be of fe.windows)for(const Fe of Be.panes)((lt=Fe.assignment)==null?void 0:lt.project)===e&&((te=Fe.assignment)==null?void 0:te.slug)===t&>.push({sessionName:fe.name,command:Fe.command,urls:Fe.urls});async function Pt(fe){u(null);try{await wN(Se,Oe,fe),F()}catch(Be){u(Be.message)}}async function it(fe){u(null);try{const Be=await fetch(`/api/projects/${Se}/assignments/${Oe}/${fe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const Fe=await Be.json().catch(()=>null);throw new Error((Fe==null?void 0:Fe.error)||`HTTP ${Be.status}`)}F(),m(fe?"Assignment archived":"Assignment restored","success")}catch(Be){u(Be.message)}}async function ie(){T(!0);try{await sF(Se,Oe),n(`${s}/projects/${Se}`)}catch(fe){u(fe.message),T(!1),P(!1)}}async function q(fe,Be){u(null),y(fe.command);try{return await vN(Se,Oe,fe,Be),F(),!0}catch(Fe){return u(Fe.message),!1}finally{y(null)}}function pe(fe){if(jN(fe)){C(fe);return}q(fe)}async function Z(fe,Be){w(null),E(fe);try{const Fe=await fetch(`/api/projects/${Se}/assignments/${Oe}/acceptance-criteria/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Be})}),Nt=await Fe.json();if(!Fe.ok)throw new Error(Nt.error||`HTTP ${Fe.status}`);F()}catch(Fe){w(Fe.message)}finally{E(null)}}const ye=[...nt.filter(fe=>fe!==Ke).map(fe=>({key:`transition-${fe.command}`,label:fe.label,onSelect:()=>pe(fe),disabled:x===fe.command})),..._e.filter(fe=>fe.disabled||fe.targetStatus===I.status).map(fe=>({key:`transition-${fe.command}`,label:fe.label,disabled:!0,disabledReason:fe.targetStatus===I.status?`Already ${I.status.replace(/_/g," ")}`:fe.disabledReason??fe.warning??fe.description})),...X.statuses.map(fe=>({key:`override-${fe.id}`,label:`Override → ${fe.label}`,onSelect:()=>Pt(fe.id),disabled:fe.id===I.status,disabledReason:fe.id===I.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:lP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:jP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:dm,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:nd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:dP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:I.archived?"unarchive":"archive",label:I.archived?"Restore assignment":"Archive assignment",icon:I.archived?ed:Dd,onSelect:()=>it(!I.archived)},{key:"delete",label:"Delete assignment",icon:or,destructive:!0,onSelect:()=>P(!0)}],Re=(Ke==null?void 0:Ke.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(ni,{toast:p,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(pn,{status:I.status,progress:Xe}),r.jsx(ei,{type:I.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:I.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",k0(I.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(Yg,{externalIds:I.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:I.id},worktreePath:((be=I.workspace)==null?void 0:be.worktreePath)??null,repository:(($e=I.workspace)==null?void 0:$e.repository)??null}),!((at=I.workspace)!=null&&at.worktreePath)&&e&&t&&r.jsx(PN,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>F()}),Ke&&r.jsx("button",{type:"button",title:Ke.warning||Ke.description,disabled:x===Ke.command,onClick:()=>pe(Ke),className:Te("shell-action disabled:cursor-not-allowed disabled:opacity-50",Ke.warning&&"border-warning-foreground/40",Re&&D>0&&"send-to-review-glow"),children:r.jsx("span",{children:x===Ke.command?"Working…":Ke.label})},Re?`review-${D}`:Ke.command),r.jsx(Hg,{items:ye,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,I.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:"})," ",I.blockedReason]}):null]}),O.length>0&&r.jsx(bF,{projectSlug:e,dependencies:O,blockedReason:I.blockedReason}),I.enrichedLinks&&I.enrichedLinks.length>0&&r.jsx(vF,{links:I.enrichedLinks}),I.referencedBy&&I.referencedBy.length>0&&r.jsx(We,{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:I.referencedBy.map(fe=>{const Be=fe.sourceProjectSlug===null?`/assignments/${fe.sourceId}`:`${s}/projects/${fe.sourceProjectSlug}/assignments/${fe.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:Be,className:"text-foreground hover:text-primary",children:fe.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",fe.mentions," mention",fe.mentions===1?"":"s",")"]}),fe.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]},fe.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Xg,{value:Y,onValueChange:fe=>l({tab:fe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[ke.acceptanceCriteria.length>0?r.jsx(We,{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,ke.acceptanceCriteria.map((fe,Be)=>{const Fe=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:fe.checked,disabled:Fe,onChange:Nt=>Z(Be,Nt.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":fe.checked,children:fe.text})]},`${Be}-${fe.text}`)})]})}):null,he.hasSection?r.jsx(We,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(fn,{content:he.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(We,{title:"Assignment Summary",children:r.jsx(fn,{content:he.remaining,emptyState:ke.acceptanceCriteria.length>0||he.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:I.plan?1:0,content:I.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(We,{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(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(dm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(pn,{status:I.plan.status})}),r.jsx(fn,{content:I.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(St,{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:I.scratchpad?1:0,content:I.scratchpad?r.jsx(We,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(dm,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(fn,{content:I.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(St,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((Me=I.handoff)==null?void 0:Me.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:I.handoff?r.jsx(We,{children:r.jsx(fn,{content:I.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(St,{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:((bt=I.progress)==null?void 0:bt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:I.progress&&I.progress.entries.length>0?r.jsx(We,{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:I.progress.entries.map((fe,Be)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:fe.timestamp}),r.jsx(fn,{content:fe.body})]},`${fe.timestamp}-${Be}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((Mt=I.comments)==null?void 0:Mt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:I.comments&&I.comments.entries.length>0?r.jsx(RN,{projectSlug:e,assignmentSlug:t,entries:I.comments.entries}):r.jsx(St,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((Gt=I.decisionRecord)==null?void 0:Gt.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:I.decisionRecord?r.jsx(We,{children:r.jsx(fn,{content:I.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(eo,{label:"ID",value:I.id,copyable:!0}),r.jsx(eo,{label:"Priority",value:I.priority}),I.assignee&&r.jsx(eo,{label:"Assignee",value:I.assignee}),r.jsx(eo,{label:"Updated",value:`${j0(I.updated)} · Created ${w0(I.created)}`}),I.workspace.repository&&r.jsx(eo,{label:"Repository",value:I.workspace.repository,copyable:!0}),I.workspace.worktreePath&&r.jsx(eo,{label:"Worktree",value:I.workspace.worktreePath,copyable:!0}),I.workspace.branch&&r.jsx(eo,{label:"Branch",value:I.workspace.branch,copyable:!0}),I.workspace.parentBranch&&r.jsx(eo,{label:"Parent branch",value:I.workspace.parentBranch,copyable:!0}),I.externalIds.map((fe,Be)=>r.jsx(SF,{entry:fe},`${fe.system}:${fe.id}:${Be}`))]})}),gt.length>0&&r.jsx(We,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:gt.map((fe,Be)=>r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:fe.command}),r.jsx("span",{className:"text-xs text-muted-foreground",children:fe.sessionName}),fe.urls.map(Fe=>r.jsxs("a",{href:Fe,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[Fe.replace("http://localhost:",":"),r.jsx(ya,{className:"h-2.5 w-2.5"})]},Fe))]},Be))})}),r.jsx(NN,{sessions:ce==null?void 0:ce.sessions,loading:_,error:W}),r.jsx(CN,{summary:R==null?void 0:R.summary,loading:M,error:Q})]})]}),r.jsx(EN,{open:b!==null,action:b,assignmentTitle:I.title,loading:x===(b==null?void 0:b.command),onOpenChange:fe=>{fe||C(null)},onConfirm:async fe=>{if(!b)return;await q(b,fe)&&C(null)}}),r.jsx(si,{open:N,title:"Delete assignment?",description:`This will permanently delete "${I.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:$,onOpenChange:fe=>{fe||P(!1)},onConfirm:ie})]})}function eo({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(Dr,{value:t})]})]})}function SF({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(ya,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function NF(){var T,D,L,Y,X,I,U,ne;const{id:e}=$t(),[t,n]=ms(),s=t.get("tab")??"summary",{data:i,loading:l,error:c,refetch:u}=vR(e),{data:p,loading:m,error:h}=jR(e),{data:x,loading:y,error:b}=SR(i==null?void 0:i.slug),[C,j]=f.useState(!1),[w,k]=f.useState(null),{toast:E,showToast:N,dismissToast:P}=ti();async function $(F){if(e){k(null);try{const H=await fetch(`/api/assignments/${e}/${F?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!H.ok){const ee=await H.json().catch(()=>null);throw new Error((ee==null?void 0:ee.error)||`HTTP ${H.status}`)}u(),N(F?"Assignment archived":"Assignment restored","success")}catch(H){k(H instanceof Error?H.message:"Archive failed")}}}return l?r.jsx(mt,{}):c?r.jsx(wt,{error:c}):i?r.jsxs("div",{className:"space-y-6",children:[r.jsx(ni,{toast:E,onDismiss:P}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(pn,{status:i.status}),r.jsx(ei,{type:i.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:i.id}),r.jsx(Yg,{externalIds:i.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(TN,{target:{kind:"assignment",id:i.id},worktreePath:((T=i.workspace)==null?void 0:T.worktreePath)??null,repository:((D=i.workspace)==null?void 0:D.repository)??null,size:"compact"}),!((L=i.workspace)!=null&&L.worktreePath)&&r.jsx(PN,{assignmentId:i.id,defaultBranch:`syntaur/${i.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($d,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ce,{to:`/assignments/${i.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:()=>$(!i.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:i.archived?"Restore this assignment":"Archive this assignment",children:[i.archived?r.jsx(ed,{className:"h-3 w-3"}):r.jsx(Dd,{className:"h-3 w-3"}),i.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:i.title}),i.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",i.blockedReason]}):null,w?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:w}):null]}),r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(to,{label:"ID",value:i.id,copyable:!0}),r.jsx(to,{label:"Priority",value:i.priority}),i.assignee&&r.jsx(to,{label:"Assignee",value:i.assignee}),r.jsx(to,{label:"Updated",value:`${j0(i.updated)} · Created ${w0(i.created)}`}),i.workspace.repository&&r.jsx(to,{label:"Repository",value:i.workspace.repository,copyable:!0}),i.workspace.worktreePath&&r.jsx(to,{label:"Worktree",value:i.workspace.worktreePath,copyable:!0}),i.workspace.branch&&r.jsx(to,{label:"Branch",value:i.workspace.branch,copyable:!0}),i.workspace.parentBranch&&r.jsx(to,{label:"Parent branch",value:i.workspace.parentBranch,copyable:!0}),i.externalIds.map((F,H)=>r.jsx(CF,{entry:F},`${F.system}:${F.id}:${H}`))]})}),i.referencedBy&&i.referencedBy.length>0?r.jsx(We,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:i.referencedBy.map(F=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:F.sourceProjectSlug===null?`/assignments/${F.sourceId}`:`/projects/${F.sourceProjectSlug}/assignments/${F.sourceSlug}`,className:"text-foreground hover:text-primary",children:F.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",F.mentions," mention",F.mentions===1?"":"s",")"]})]},F.sourceId))})}):null,r.jsx(NN,{sessions:p==null?void 0:p.sessions,loading:m,error:h}),r.jsx(CN,{summary:x==null?void 0:x.summary,loading:y,error:b}),r.jsx(Xg,{value:s,onValueChange:F=>n({tab:F}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Assignment",children:r.jsx(fn,{content:i.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((Y=i.progress)==null?void 0:Y.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.progress&&i.progress.entries.length>0?r.jsx(We,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:i.progress.entries.map((F,H)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:F.timestamp}),r.jsx(fn,{content:F.body})]},`${F.timestamp}-${H}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((X=i.comments)==null?void 0:X.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(RN,{projectSlug:null,assignmentSlug:i.id,entries:((I=i.comments)==null?void 0:I.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:i.plan?r.jsxs(We,{children:[r.jsx(fn,{content:i.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(St,{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:i.scratchpad?r.jsxs(We,{children:[r.jsx(fn,{content:i.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(St,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((U=i.handoff)==null?void 0:U.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.handoff?r.jsxs(We,{children:[r.jsx(fn,{content:i.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((ne=i.decisionRecord)==null?void 0:ne.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:i.decisionRecord?r.jsxs(We,{children:[r.jsx(fn,{content:i.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Ce,{to:`/assignments/${i.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(St,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(Gg,{open:C,onOpenChange:j,currentWorkspace:i.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async F=>{const H=await fetch(`/api/assignments/${encodeURIComponent(i.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:F})});if(!H.ok){const ee=await H.json().catch(()=>({}));throw new Error(ee.error||"Failed to move assignment")}u()}})]}):r.jsx(wt,{error:"Assignment not found"})}function to({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(Dr,{value:t})]})]})}function CF({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(ya,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function EF({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1}){const[i,l]=f.useState(!1),[c,u]=f.useState(null),[p,m]=f.useState(0),h=f.useRef(null),x=f.useRef(null),y=f.useId(),b=hd(e),C=b.icon,j=f.useCallback(P=>{l(!1),P&&requestAnimationFrame(()=>{var $;($=h.current)==null||$.focus()})},[]),w=f.useCallback(()=>{var $;const P=($=h.current)==null?void 0:$.getBoundingClientRect();P&&u({top:P.top,left:P.left,width:P.width,bottom:P.bottom})},[]);f.useLayoutEffect(()=>{i&&w()},[i,w]),f.useEffect(()=>{if(!i)return;const P=()=>w();return window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[i,w]),f.useEffect(()=>{if(!i)return;const P=$=>{var D,L;const T=$.target;T&&((D=x.current)!=null&&D.contains(T)||(L=h.current)!=null&&L.contains(T)||j(!1))};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[i,j]),f.useEffect(()=>{i&&m(0)},[i,t.length]);function k(P){(P.key==="Enter"||P.key===" "||P.key==="ArrowDown")&&(P.preventDefault(),l(!0))}function E(P){if(t.length===0){P.key==="Escape"&&(P.preventDefault(),j(!0));return}if(P.key==="ArrowDown")P.preventDefault(),m($=>($+1)%t.length);else if(P.key==="ArrowUp")P.preventDefault(),m($=>($-1+t.length)%t.length);else if(P.key==="Home")P.preventDefault(),m(0);else if(P.key==="End")P.preventDefault(),m(t.length-1);else if(P.key==="Enter"){P.preventDefault();const $=t[p];$&&(n($),j(!0))}else P.key==="Escape"&&(P.preventDefault(),j(!0))}function N(P){n(P),j(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:h,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?y:void 0,onClick:()=>{s||l(P=>!P)},onKeyDown:k,title:`Status: ${b.label}. Click to change.`,className:Te(VS(e),"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(C,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:b.label})]}),i&&c&&typeof document<"u"?Ts.createPortal(r.jsx("div",{ref:x,id:y,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:E,style:{position:"fixed",top:c.bottom+6,left:c.left,minWidth:Math.max(c.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((P,$)=>{const T=hd(P.targetStatus),D=T.icon,L=$===p;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>m($),onClick:()=>N(P),title:P.warning||P.description,className:Te("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",L?"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(D,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:P.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:T.label})]}),P.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:P.warning}):null]},`${P.command}:${P.targetStatus}`)})}),document.body):null]})}function DN({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[i,l]=f.useState(!1);return i?r.jsx(TF,{initialTitle:e,disabled:s,onSave:n,onExit:()=>l(!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||l(!0)},className:Te("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(Ce,{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(ya,{className:"h-3.5 w-3.5"})})]})}function TF({initialTitle:e,disabled:t,onSave:n,onExit:s}){const i=f.useRef(e),[l,c]=f.useState(e),[u,p]=f.useState(!1),[m,h]=f.useState(!1),x=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const w=x.current;w&&(w.focus(),w.select())},[]);const b=f.useCallback(()=>{var w;h(!0),window.setTimeout(()=>h(!1),260),(w=x.current)==null||w.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const w=l.trim();if(w.length===0){b();return}if(w===i.current){s();return}y.current=!0,p(!0);try{await n(w)}catch{}finally{p(!1),s()}},[l,s,n,b]);function j(w){w.key==="Enter"?(w.preventDefault(),C()):w.key==="Escape"&&(w.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:x,type:"text","data-no-drag":!0,disabled:t||u,value:l,onChange:w=>c(w.target.value),onKeyDown:j,onBlur:()=>void C(),className:Te("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 $N(e){const t=Dt(),n=f.useRef(null),s=f.useRef(!1),i=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),p=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||p||h},[]),l=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(ma)||t(e)},[t,e]);return{containerRef:n,onMouseDown:i,onClick:l}}const aj=Rg;function lj(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function PF(e,t){return e.toString()===t.toString()}function cj(){const{workspace:e}=$t(),t=ln(),n=Dt(),s=f.useRef(null);mo("list:assignments");const{data:i,loading:l,error:c,refetch:u}=Md(),p=Zo(),m=tf(),[h,x]=ms(),y=e?`w:${e}`:null,b=lN(y),C=f.useRef(void 0),j=f.useMemo(()=>qS(p.order),[p]),w=f.useMemo(()=>{const z={};for(const ae of j)z[ae]=cc(p,ae);return z},[j,p]),k=f.useMemo(()=>j.map(z=>({id:z,title:w[z]??z,description:ef(z)})),[j,w]),E=f.useMemo(()=>m.definitions.map(z=>({id:z.id,title:aa(m,z.id),description:z.description})),[m]),N="__unknown_type__",P=f.useMemo(()=>new Set(["all",...j]),[j]),$=h.get("view"),T=h.get("status"),D=h.get("stale"),L=$&&aj.includes($)?$:"kanban";function Y(z){if(!z)return[];const ae=[];for(const xe of z.split(",")){const De=xe.trim();!De||De==="all"||!P.has(De)||ae.includes(De)||ae.push(De)}return ae}const X=f.useCallback(z=>{x(ae=>{const xe=new URLSearchParams(ae);return z==="kanban"?xe.delete("view"):xe.set("view",z),xe})},[x]),[I,U]=f.useState(""),[ne,F]=f.useState(()=>Y(T)),[H,ee]=f.useState(()=>tt(b.filters.priority)),[ce,_]=f.useState(()=>tt(b.filters.type)),[W,R]=f.useState(()=>tt(b.filters.assignee)),[M,Q]=f.useState(()=>tt(b.filters.project)),[O,ue]=f.useState(()=>tt(b.filters.tags)),[ge,V]=f.useState(null),[oe,me]=f.useState(()=>lj(D)),[ve,ke]=f.useState(()=>b.sortField),[he,Je]=f.useState(()=>b.sortDirection),[Ye,ot]=f.useState(()=>({hidden:[]})),[G,Ie]=f.useState(()=>({hidden:[]})),[Se,Oe]=f.useState(()=>b.grouping),Xe=Se==="type"?"type":"status",[_e,nt]=f.useState(()=>new Set),[Ke,gt]=f.useState([]),{toast:Pt,showToast:it,dismissToast:ie}=ti(),[q,pe]=f.useState(null),[Z,ye]=f.useState(null),[Re,lt]=f.useState(null),[te,be]=f.useState(null),[$e,at]=f.useState(null),[Me,bt]=f.useState(null),[Mt,Gt]=f.useState(null),[fe,Be]=f.useState(null),[Fe,Nt]=f.useState(null),[$n,Yt]=f.useState(!1),[sn,Wt]=f.useState(!1),Gn=e?{kind:"workspace",workspace:e}:{kind:"global"},xt=h.get("loadView"),{view:jn,loading:Rt,error:re}=Go(xt),{view:Ae,loading:Qe,error:Ft}=Go(Fe),hn=f.useRef(null);f.useEffect(()=>{gt((i==null?void 0:i.assignments)??[])},[i]),f.useEffect(()=>{Fe&&!Qe&&!Ft&&!Ae&&Nt(null)},[Ae,Ft,Fe,Qe]),f.useEffect(()=>{Nt(null),hn.current=null,V(null),U("")},[e]),f.useEffect(()=>{const z=Y(T);LD(z,ne)||F(z);const ae=lj(D);ae!==oe&&me(ae)},[oe,D,ne,T]),f.useEffect(()=>{C.current===y&&x(z=>{const ae=new URLSearchParams(z);return ne.length===0?ae.delete("status"):ae.set("status",ne.join(",")),oe==="all"?ae.delete("stale"):oe==="stale"?ae.set("stale","1"):ae.set("stale","0"),PF(z,ae)?z:ae})},[oe,y,x,ne]),f.useEffect(()=>{ee(tt(b.filters.priority)),_(tt(b.filters.type)),R(tt(b.filters.assignee)),Q(tt(b.filters.project)),ue(tt(b.filters.tags)),ke(b.sortField),Je(b.sortDirection),Oe(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),f.useEffect(()=>{if(C.current===y)return;let z=!1;return vx().then(ae=>{if(z||C.current===y)return;const xe=nS(ae,y),De=xe.defaultView,ct=tt(xe.filters.status),pt=xe.filters.activity??"all",yt=new URLSearchParams(window.location.search);let cn=!1;const on=new URLSearchParams(yt);yt.get("view")===null&&De!=="kanban"&&aj.includes(De)&&(on.set("view",De),cn=!0),yt.get("status")===null&&ct.length>0&&(on.set("status",ct.join(",")),F(ct),cn=!0),yt.get("stale")===null&&pt!=="all"&&(on.set("stale",pt==="stale"?"1":"0"),me(pt),cn=!0),cn&&x(on,{replace:!0}),queueMicrotask(()=>{C.current=y})}),()=>{z=!0}},[y]);const Ct=f.useCallback(z=>{(y===null?uN(z):dN(y,z)).catch(xe=>{console.warn("Failed to persist view prefs:",xe)})},[y]),kf=f.useCallback(z=>{X(z),Ct({defaultView:z})},[X,Ct]),Aa=f.useCallback(z=>{F(z),Ct({filters:{status:z}})},[Ct]),_r=f.useCallback(z=>{ee(z),Ct({filters:{priority:z}})},[Ct]),oi=f.useCallback(z=>{_(z),Ct({filters:{type:z}})},[Ct]),ii=f.useCallback(z=>{R(z),Ct({filters:{assignee:z}})},[Ct]),Da=f.useCallback(z=>{Q(z),Ct({filters:{project:z}})},[Ct]),ai=f.useCallback(z=>{ue(z),Ct({filters:{tags:z}})},[Ct]),li=f.useCallback(z=>{me(z),Ct({filters:{activity:z}})},[Ct]),ci=f.useCallback(z=>{ke(z),Ct({sortField:z})},[Ct]),go=f.useCallback(z=>{Je(z),Ct({sortDirection:z})},[Ct]),Sf=f.useCallback(z=>{Oe(z),Ct({grouping:z})},[Ct]),ui=f.useCallback(()=>({viewMode:L,filters:{status:ne,priority:H,type:ce,assignee:W,project:M,tags:O,activity:oe,dateRange:Xl(ge),search:I},sortField:ve,sortDirection:he,listSectionVisibility:{collapsed:[..._e]},kanbanColumnVisibility:Ye,tableColumnVisibility:G}),[L,ne,H,ce,W,M,O,oe,ge,I,ve,he,_e,Ye,G]),Lt=f.useCallback(z=>{gN(z,{setViewMode:X,setStatusFilter:Aa,setPriorityFilter:_r,setTypeFilter:oi,setAssigneeFilter:ii,setProjectFilter:Da,setTagsFilter:ai,setActivityFilter:li,setDateRange:V,setSearch:U,setSortField:ci,setSortDirection:go,setListSectionVisibility:ae=>nt(new Set(ae.collapsed)),setKanbanColumnVisibility:ot,setTableColumnVisibility:Ie}),Nt(z.id)},[X,Aa,_r,oi,ii,Da,ai,li,ci,go]),Nf=f.useCallback(z=>{Lt(z),hn.current=z.id,x(ae=>{const xe=new URLSearchParams(ae);return xe.set("loadView",z.id),xe},{replace:!0})},[Lt,x]),$a=f.useCallback(async z=>{try{const ae=Jl({name:z,context:{workspace:e??null,projectSlug:null},state:ui()}),xe=await Kd(ae),De=xe.views[xe.views.length-1];Nt((De==null?void 0:De.id)??null),De&&(hn.current=De.id,x(ct=>{const pt=new URLSearchParams(ct);return pt.set("loadView",De.id),pt},{replace:!0})),Yt(!1),Wt(!1),it(`Saved view "${z}"`,"success")}catch(ae){throw it(ae instanceof Error?ae.message:"Failed to save view","error"),ae}},[ui,x,it,e]),xc=f.useCallback(async()=>{if(!(!Fe||!Ae))try{const z=Jl({name:Ae.name,context:{workspace:e??null,projectSlug:null},state:ui()}),ae=jx(Ae.config,z.config,z.config);await $g(Fe,{config:ae}),it("View updated","success")}catch(z){it(z instanceof Error?z.message:"Failed to update view","error")}},[ui,Ae,Fe,it,e]);f.useEffect(()=>{if(!xt){hn.current=null;return}if(hn.current!==xt&&(Fe&&Fe!==xt&&Nt(null),!Rt)){if(re){it("Couldn't load saved view — try again","error");return}if(jn){hn.current=xt,Lt(jn),x(z=>{const ae=new URLSearchParams(z);return ae.delete("loadView"),ae},{replace:!0});return}hn.current=xt,it("Saved view no longer exists","error"),x(z=>{const ae=new URLSearchParams(z);return ae.delete("loadView"),ae},{replace:!0})}},[xt,jn,Rt,re,Fe,Lt,x,it]);const Bn=f.useMemo(()=>Ke.filter(z=>e?e==="_ungrouped"?z.projectWorkspace===null:z.projectWorkspace===e:!0),[Ke,e]),Cf=f.useMemo(()=>Array.from(new Set(Bn.map(z=>z.status))).sort(),[Bn]),yc=f.useMemo(()=>Array.from(new Set(Bn.map(z=>z.priority))).sort(),[Bn]),di=f.useMemo(()=>Array.from(new Set(Bn.map(z=>z.assignee??"__unassigned__"))).sort(),[Bn]),br=f.useMemo(()=>Array.from(new Map(Bn.filter(z=>z.projectSlug!==null).map(z=>[z.projectSlug,z.projectTitle]))).sort(([,z],[,ae])=>z.localeCompare(ae)),[Bn]),Ef=f.useMemo(()=>Array.from(new Set(Bn.flatMap(z=>z.tags??[]))).sort(),[Bn]),jt=f.useMemo(()=>Ke.filter(z=>Wg(z,{status:ne,priority:H,type:ce,assignee:W,project:M,tags:O,activity:oe,dateRange:Xl(ge)},{workspace:e,search:I})),[oe,Ke,I,ne,H,ce,W,M,O,ge,e]),xo=f.useMemo(()=>uc(jt,ve,he),[jt,ve,he]),La=f.useMemo(()=>{if(Se==="none")return[{id:"__all__",label:"All assignments",items:jt}];if(Se==="type"){const z=m.definitions.map(De=>({id:De.id,label:aa(m,De.id),items:jt.filter(ct=>ct.type===De.id)})),ae=new Set(m.definitions.map(De=>De.id)),xe=jt.filter(De=>!De.type||!ae.has(De.type));return xe.length>0&&z.push({id:N,label:"Other",items:xe}),z}if(Se==="priority")return["critical","high","medium","low"].map(ae=>({id:ae,label:ae.charAt(0).toUpperCase()+ae.slice(1),items:jt.filter(xe=>xe.priority===ae)}));if(Se==="assignee")return Array.from(new Set(jt.map(ae=>ae.assignee??"__unassigned__"))).sort().map(ae=>({id:ae,label:ae==="__unassigned__"?"Unassigned":ae,items:jt.filter(xe=>(xe.assignee??"__unassigned__")===ae)}));if(Se==="project"){const z=new Map;for(const ae of jt){const xe=ae.projectSlug??"__standalone__",De=ae.projectTitle??"Standalone";z.has(xe)||z.set(xe,De)}return Array.from(z.entries()).sort(([,ae],[,xe])=>ae.localeCompare(xe)).map(([ae,xe])=>({id:ae,label:xe,items:jt.filter(De=>(De.projectSlug??"__standalone__")===ae)}))}return j.map(z=>({id:z,label:w[z]??z,items:jt.filter(ae=>ae.status===z)}))},[Se,jt,m,j,w]),Tf=f.useMemo(()=>{const z=new Set(m.definitions.map(xe=>xe.id));return jt.some(xe=>!xe.type||!z.has(xe.type))?[...E,{id:N,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,jt]),{visibleItems:fi,visibleIndexByKey:yo}=f.useMemo(()=>{let z;if(L==="table")z=xo;else if(L==="kanban"){const xe=new Set(m.definitions.map(De=>De.id));Xe==="type"?z=[...m.definitions.flatMap(De=>jt.filter(ct=>ct.type===De.id)),...jt.filter(De=>!De.type||!xe.has(De.type))]:z=j.flatMap(De=>jt.filter(ct=>ct.status===De))}else z=La.flatMap(xe=>xe.items);const ae=new Map;return z.forEach((xe,De)=>ae.set(tn(xe),De)),{visibleItems:z,visibleIndexByKey:ae}},[L,xo,La,Xe,m,jt,j]),{hotkeyRowProps:xs}=ic(fi,{scope:"list:assignments",onOpen:z=>{if(z.projectSlug===null){n(`/assignments/${z.id}`);return}const ae=z.projectWorkspace?`/w/${z.projectWorkspace}`:t;n(`${ae}/projects/${z.projectSlug}/assignments/${z.slug}`)}});if(Ht({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var z;return(z=s.current)==null?void 0:z.focus()}}),Ht({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),l)return r.jsx(mt,{label:"Loading assignments board…"});if(c||!i)return r.jsx(wt,{error:c||"Assignments board is unavailable."});async function bo({item:z,toColumnId:ae,action:xe,reason:De}){pe(tn(z));const ct=Ke;gt(pt=>pt.map(yt=>tn(yt)===tn(z)?{...yt,status:ae,blockedReason:ae==="blocked"?De??yt.blockedReason:null}:yt));try{if(z.projectSlug===null){if(!xe)throw new Error("Standalone assignments require a transition action, not status override.");const yt=await fetch(`/api/assignments/${encodeURIComponent(z.id)}/transitions/${encodeURIComponent(xe.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(De?{reason:De}:{})});if(!yt.ok)throw new Error((await yt.json()).error??`HTTP ${yt.status}`);const on=(await yt.json()).assignment;gt(kn=>kn.map(Un=>tn(Un)===tn(z)?{...Un,status:on.status,blockedReason:on.blockedReason,availableTransitions:on.availableTransitions,updated:on.updated}:Un));return}const pt=xe?await vN(z.projectSlug,z.slug,xe,De):await wN(z.projectSlug,z.slug,ae);return gt(yt=>yt.map(cn=>tn(cn)===tn(z)?{...cn,status:pt.status,blockedReason:pt.blockedReason,availableTransitions:pt.availableTransitions,updated:pt.updated}:cn)),u(),!0}catch(pt){return gt(ct),it(pt.message,"error"),!1}finally{pe(null)}}async function vo({item:z,toColumnId:ae,action:xe}){if(z.status===ae)return;const De=xe??kl(z,ae);if(De!=null&&De.disabled){it(De.disabledReason||`Cannot move this assignment to ${ae}.`,"error");return}if(De&&jN(De)){be({item:z,toColumnId:ae,action:De});return}await bo({item:z,toColumnId:ae,action:De})}async function Oa(z,ae){if(ae===z.title)return;const xe=tn(z),De=Ke;gt(ct=>ct.map(pt=>tn(pt)===xe?{...pt,title:ae}:pt)),pe(xe);try{const ct=z.projectSlug===null?await iF({id:z.id,title:ae}):await oF({projectSlug:z.projectSlug,assignmentSlug:z.slug,title:ae});gt(pt=>pt.map(yt=>tn(yt)===xe?{...yt,title:ct.title,updated:ct.updated}:yt)),u()}catch(ct){throw gt(De),it(ct.message,"error"),ct}finally{pe(null)}}function Ia(z){nt(ae=>{const xe=new Set(ae);return xe.has(z)?xe.delete(z):xe.add(z),xe})}function bc(z){ve===z?go(he==="asc"?"desc":"asc"):(ci(z),go("asc"))}const Ln=Z?Ke.find(z=>tn(z)===Z)??null:null;function wo(z,ae){z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",ae),ye(ae)}function _a(){ye(null),lt(null)}function Ma(z,ae){if(!Ln)return;const xe=kl(Ln,ae);Ln.status===ae||xe!=null&&xe.disabled||(z.preventDefault(),z.dataTransfer.dropEffect="move",lt(ae))}function Et(z,ae){Re===ae&&!z.currentTarget.contains(z.relatedTarget)&<(null)}function vc(z,ae){if(z.preventDefault(),!Ln||Ln.status===ae){_a();return}_a(),vo({item:Ln,toColumnId:ae})}function Zr({field:z,children:ae}){const xe=ve===z;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>bc(z),className:"inline-flex items-center gap-1 hover:text-foreground",children:[ae,xe?he==="asc"?r.jsx(a0,{className:"h-3 w-3"}):r.jsx(Kr,{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(Ce,{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(rn,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Kg,{children:[r.jsx(nf,{ref:s,value:I,onChange:U,placeholder:"Search assignments or projects"}),r.jsx(Rn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",options:Cf.map(z=>({value:z,label:w[z]??z})),value:ne,onChange:Aa}),r.jsx(Rn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",options:yc.map(z=>({value:z,label:z[0].toUpperCase()+z.slice(1)})),value:H,onChange:_r}),r.jsx(Rn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",options:m.definitions.map(z=>({value:z.id,label:aa(m,z.id)})),value:ce,onChange:oi}),r.jsx(Rn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",options:[{value:"__unassigned__",label:"Unassigned"},...di.filter(z=>z!=="__unassigned__").map(z=>({value:z,label:z}))],value:W,onChange:ii}),r.jsx(Rn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",options:[{value:"__standalone__",label:"Standalone"},...br.map(([z,ae])=>({value:z,label:ae}))],value:M,onChange:Da}),r.jsx(Rn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",options:Ef.map(z=>({value:z,label:z})),value:O,onChange:ai}),r.jsx(wx,{className:"max-w-[200px]",value:ge,onChange:V}),r.jsxs("select",{value:oe,onChange:z=>li(z.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:L==="kanban"?Xe:Se,onChange:z=>Sf(z.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:DD.map(z=>{const ae=L==="kanban"&&z!=="status"&&z!=="type",xe=z==="none"?"No grouping":`Group: ${z.charAt(0).toUpperCase()+z.slice(1)}`;return r.jsx("option",{value:z,disabled:ae,children:ae?`${xe} (list only)`:xe},z)})}),r.jsx(rf,{value:L,onChange:z=>kf(z),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),L==="table"?r.jsx(oN,{visibility:G,onChange:Ie}):null,r.jsx(pN,{scope:Gn,loadedViewId:Fe,onApply:Nf,onOpenSaveDialog:()=>{Wt(!1),Yt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Ae?xc():(Wt(!1),Yt(!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:Ae?`Update ${Ae.name}`:"Save current view",children:Ae?`Update '${Ae.name}'`:"Save view"}),Ae?r.jsx("button",{type:"button",onClick:()=>{Wt(!0),Yt(!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]}),i.assignments.length===0?r.jsx(St,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(tg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):jt.length===0?r.jsx(St,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):L==="table"?(()=>{const z=new Set(G.hidden),ae=xe=>xe==="title"||!z.has(xe);return r.jsx(We,{title:`${xo.length} assignment${xo.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:[ae("title")?r.jsx(Zr,{field:"title",children:"Assignment"}):null,ae("status")?r.jsx(Zr,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),ae("priority")?r.jsx(Zr,{field:"priority",children:"Priority"}):null,ae("assignee")?r.jsx(Zr,{field:"assignee",children:"Assignee"}):null,ae("dependencies")?r.jsx(Zr,{field:"dependencies",children:"Dependencies"}):null,ae("created")?r.jsx(Zr,{field:"created",children:"Created"}):null,ae("updated")?r.jsx(Zr,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:xo.map((xe,De)=>r.jsxs(AF,{detailHref:Kl(xe),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...xs(De),children:[ae("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(DN,{title:xe.title,detailHref:Kl(xe),onSave:ct=>Oa(xe,ct),disabled:q===tn(xe)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:xe.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:xe.id,children:[xe.id.slice(0,8),r.jsx(Dr,{value:xe.id})]})]}):null,ae("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:xe.status,disabled:q===tn(xe),onChange:ct=>vo({item:xe,toColumnId:ct.target.value}),className:Te("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")]`,(md[xe.status]??md.pending).className,q===tn(xe)&&"animate-pulse opacity-60"),children:j.map(ct=>{const pt=xe.status===ct?void 0:kl(xe,ct),yt=(pt==null?void 0:pt.disabled)??!1;return r.jsx("option",{value:ct,disabled:yt,title:yt?(pt==null?void 0:pt.disabledReason)??void 0:void 0,children:w[ct]},ct)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ei,{type:xe.type,compact:!0})}),ae("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:xe.priority}):null,ae("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.assignee??"Unassigned"}):null,ae("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:xe.dependsOn.length}):null,ae("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Dn(xe.created)}):null,ae("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Dn(xe.updated)}):null]},tn(xe)))})]})})})})():L==="list"?r.jsx("div",{className:"space-y-3",children:La.map(({id:z,label:ae,items:xe})=>{var on;if(xe.length===0&&!(Ln&&Se==="status"))return null;const De=!_e.has(z),ct=Se==="status",pt=ct&&Ln?Ln.status!==z&&!((on=kl(Ln,z))!=null&&on.disabled):!1,yt=ct&&Ln?Ln.status!==z&&!pt:!1,cn=ct&&Re===z;return r.jsxs("div",{className:Te("rounded-lg border border-border/60 bg-card/90 transition",cn&&pt&&"ring-2 ring-ring/30",yt&&"border-dashed opacity-65"),onDragOver:ct?kn=>Ma(kn,z):void 0,onDragLeave:ct?kn=>Et(kn,z):void 0,onDrop:ct?kn=>vc(kn,z):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Ia(z),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(Kr,{className:`h-4 w-4 text-muted-foreground transition-transform ${De?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:ae}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:xe.length})]}),De&&xe.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:xe.map(kn=>{const Un=tn(kn),Mr=Z===Un,wc=yo.get(Un)??-1,jo=ct;return r.jsx("div",{draggable:jo,onDragStart:jo?vr=>wo(vr,Un):void 0,onDragEnd:jo?_a:void 0,...wc>=0?xs(wc):{},className:Te("transition",jo&&"cursor-grab active:cursor-grabbing",Mr&&"scale-[0.98] opacity-50"),children:r.jsx(uj,{assignment:kn,dragging:Mr,transitioning:q===Un,onPillSelect:vr=>void vo({item:kn,toColumnId:vr.targetStatus,action:vr}),onRenameTitle:vr=>Oa(kn,vr)})},Un)})})]},z)})}):r.jsx(Zd,{columns:Xe==="type"?Tf:k,items:jt,getItemId:tn,getColumnId:z=>Xe==="type"?z.type&&m.definitions.some(ae=>ae.id===z.type)?z.type:N:z.status,canDrop:({item:z,fromColumnId:ae,toColumnId:xe})=>{if(ae===xe)return{allowed:!0};const De=kl(z,xe);return De!=null&&De.disabled?{allowed:!1,reason:De.disabledReason||De.description}:{allowed:!0,reason:De?De.warning||De.description:`Move to ${xe} (direct status change).`}},onMove:Xe==="type"?void 0:({item:z,toColumnId:ae})=>vo({item:z,toColumnId:ae}),dragDisabled:Xe==="type",getExternalDragData:z=>z.projectSlug===null?{type:"standalone-assignment",id:z.id}:{type:"project-assignment",id:z.id},onCardContextMenu:(z,ae)=>{ae.preventDefault(),at({item:z,anchor:{x:ae.clientX,y:ae.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} assignments.`,hiddenColumnIds:Ye.hidden,onHideColumn:z=>ot(ae=>({hidden:ae.hidden.includes(z)?ae.hidden.filter(De=>De!==z):[...ae.hidden,z]})),renderCard:(z,{dragging:ae})=>{const xe=yo.get(tn(z))??-1;return r.jsx("div",{...xe>=0?xs(xe):{},children:r.jsx(uj,{assignment:z,dragging:ae,transitioning:q===tn(z),onPillSelect:De=>void vo({item:z,toColumnId:De.targetStatus,action:De}),onRenameTitle:De=>Oa(z,De)})})}}),r.jsx(ni,{toast:Pt,onDismiss:ie}),r.jsx(fN,{open:$n,onOpenChange:z=>{Yt(z),z||Wt(!1)},initialName:sn&&Ae?`${Ae.name} (copy)`:"",title:sn?"Save as new view":"Save view",onSubmit:$a}),r.jsx(EN,{open:te!==null,action:(te==null?void 0:te.action)??null,assignmentTitle:(te==null?void 0:te.item.title)??"Assignment",loading:q===(te?tn(te.item):null),onOpenChange:z=>{z||be(null)},onConfirm:async z=>{if(!te)return;const ae=te;await bo({item:ae.item,toColumnId:ae.toColumnId,action:ae.action,reason:z})&&be(null)}}),r.jsx(GS,{anchor:($e==null?void 0:$e.anchor)??null,items:$e?RF($e.item,{onEdit:()=>{const z=$e.item,ae=z.projectSlug===null?`/assignments/${z.id}`:`${z.projectWorkspace?`/w/${z.projectWorkspace}`:t}/projects/${z.projectSlug}/assignments/${z.slug}`;n(ae)},onDelete:()=>bt($e.item),onMove:()=>Be($e.item)}):[],onClose:()=>at(null)}),r.jsx(si,{open:Me!==null,title:"Delete assignment?",description:Me?`"${Me.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:Mt!==null,onOpenChange:z=>{!z&&Mt===null&&bt(null)},onConfirm:async()=>{if(!Me||Me.projectSlug===null){bt(null);return}const z=tn(Me);Gt(z);try{const ae=await fetch(`/api/projects/${encodeURIComponent(Me.projectSlug)}/assignments/${encodeURIComponent(Me.slug)}`,{method:"DELETE"});if(!ae.ok){const xe=await ae.json().catch(()=>({}));throw new Error(xe.error||"Failed to delete assignment")}bt(null),u()}catch(ae){alert(ae instanceof Error?ae.message:"Failed to delete assignment")}finally{Gt(null)}}}),r.jsx(Gg,{open:fe!==null,onOpenChange:z=>{z||Be(null)},currentWorkspace:(fe==null?void 0:fe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async z=>{if(!fe)return;const ae=await fetch(`/api/assignments/${encodeURIComponent(fe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:z})});if(!ae.ok){const xe=await ae.json().catch(()=>({}));throw new Error(xe.error||"Failed to move assignment")}u()}})]})}function RF(e,t){const n=[{key:"edit",label:"Edit",icon:ba,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:or,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:$d,onSelect:t.onMove}),n}function AF({detailHref:e,children:t,className:n,...s}){const i=$N(e);return r.jsx("tr",{...s,ref:i.containerRef,className:n,onMouseDown:i.onMouseDown,onClick:i.onClick,children:t})}function uj({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:i}){var p;const l=Kl(e),c=!!(s&&i),u=$N(l);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:Te("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(DN,{title:e.title,detailHref:l,onSave:i,disabled:n}):r.jsx(Ce,{to:l,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:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&r.jsx(Dr,{value:e.id})]})]}),c?r.jsx(EF,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n}):r.jsx(pn,{status:e.status})]}),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(ei,{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:Dn(e.updated)})]})]})}function kl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function tn(e){return e.id||e.slug||"unknown"}function Ir(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),i=n.split(`
|
|
546
|
+
`),l=[],c=new Map;let u=null,p=[];const m=()=>{u&&(l.push(u),c.set(u,p))};for(const h of i){const x=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(x&&!h.startsWith(" ")){m(),u=x[1],p=[h];continue}u&&p.push(h)}return m(),{order:l,blocks:c,body:s}}function Na(e){return`---
|
|
547
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
548
|
+
`)}
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
${e.body.replace(/^\n+/,"")}`}function vn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const i=s[1].trim();return i==="null"?"":i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'")?i.slice(1,-1):i}function DF(e,t){return vn(e,t)==="true"}function Ll(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 $F(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 wn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${$F(n)}`])}function Ol(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 Il(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function df(e){const t=Ir(e);return{title:vn(t,"title"),slug:vn(t,"slug"),workspace:vn(t,"workspace"),archived:DF(t,"archived"),archivedAt:vn(t,"archivedAt"),archivedReason:vn(t,"archivedReason"),tags:Ll(t,"tags").join(", "),body:t.body}}function LF(e,t){const n=Ir(e),s={...df(e),...t};return wn(n,"title",s.title),wn(n,"slug",s.slug),wn(n,"workspace",s.workspace||null),wn(n,"archived",s.archived),wn(n,"archivedAt",s.archivedAt||null),wn(n,"archivedReason",s.archivedReason||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Na(n)}function ff(e){const t=Ir(e);return{title:vn(t,"title"),slug:vn(t,"slug"),status:vn(t,"status"),priority:vn(t,"priority")||"medium",assignee:vn(t,"assignee"),dependsOn:Ll(t,"dependsOn").join(", "),links:Ll(t,"links").join(", "),blockedReason:vn(t,"blockedReason"),tags:Ll(t,"tags").join(", "),body:t.body}}function OF(e,t){const n=Ir(e),s={...ff(e),...t};return wn(n,"title",s.title),wn(n,"slug",s.slug),wn(n,"status",s.status),wn(n,"priority",s.priority),wn(n,"assignee",s.assignee||null),Ol(n,"dependsOn",Il(s.dependsOn)),Ol(n,"links",Il(s.links)),wn(n,"blockedReason",s.blockedReason||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Na(n)}function pf(e){const t=Ir(e);return{assignment:vn(t,"assignment"),status:vn(t,"status"),body:t.body}}function IF(e,t){const n=Ir(e),s={...pf(e),...t};return wn(n,"assignment",s.assignment),wn(n,"status",s.status),n.body=s.body,Na(n)}function mf(e){const t=Ir(e);return{assignment:vn(t,"assignment"),body:t.body}}function _F(e,t){const n=Ir(e),s={...mf(e),...t};return wn(n,"assignment",s.assignment),n.body=s.body,Na(n)}function hf(e){const t=Ir(e);return{name:vn(t,"name"),slug:vn(t,"slug"),description:vn(t,"description"),whenToUse:vn(t,"when_to_use"),tags:Ll(t,"tags").join(", "),body:t.body}}function MF(e,t){const n=Ir(e),s={...hf(e),...t};return wn(n,"name",s.name),wn(n,"slug",s.slug),wn(n,"description",s.description||null),wn(n,"when_to_use",s.whenToUse||null),Ol(n,"tags",Il(s.tags)),n.body=s.body,Na(n)}function Nx(e){return{body:Ir(e).body}}function LN(e){return Nx(e)}function ON(e,t){const n=Ir(e);return t.body!==void 0&&(n.body=t.body),Na(n)}function FF(e,t){return ON(e,t)}function Vt(e,t,n){switch(e){case"project":return LF(t,n);case"assignment":return OF(t,n);case"plan":return IF(t,n);case"scratchpad":return _F(t,n);case"playbook":return MF(t,n);case"memory":return ON(t,n);case"resource":return FF(t,n);default:return t}}function Ca({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:i,error:l,title:c,description:u,onCancel:p,helpTitle:m,helpBody:h,allowSlugEdit:x=!1}){const[y,b]=f.useState(e),[C,j]=f.useState(!1),[w,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const E=VF(t,y),N=y!==e,P=UF(t,y),$=N?"Unsaved changes":n==="create"?"Draft":"Saved",T=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:$})]}),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:p,className:"shell-action",children:[r.jsx(td,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),T?r.jsxs("button",{type:"button",onClick:()=>j(D=>!D),className:"shell-action",children:[r.jsx(aP,{className:"h-4 w-4"}),r.jsx("span",{children:C?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:i||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(Id,{className:"h-4 w-4"}),r.jsx("span",{children:i?"Saving…":"Save"})]})]})]}),l?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:l}):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(D=>r.jsx("li",{children:D},D))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${w==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${w==="preview"?"shell-action--cta":""}`,children:[r.jsx(mv,{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:w==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:C?r.jsx("textarea",{value:y,onChange:D=>b(D.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(zF,{documentType:t,content:y,onChange:b,allowSlugEdit:x})})}),r.jsx("div",{className:w==="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(mv,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(fn,{content:P,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function zF({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const l=df(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===mr(l.title)||!l.slug.trim())&&(p.slug=mr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug:mr(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(At,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(BF,{value:l.workspace,onChange:c=>n(Vt(e,t,{workspace:c}))})]}),r.jsx(At,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=ff(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:c=>{const u=c.target.value,p={title:u};s&&(l.slug===mr(l.title)||!l.slug.trim())&&(p.slug=mr(u)),n(Vt(e,t,p))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:c=>n(Vt(e,t,{slug:mr(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(At,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(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(At,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:c=>n(Vt(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(At,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:c=>n(Vt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(At,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:c=>n(Vt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(At,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:c=>n(Vt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(At,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:c=>n(Vt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(At,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:c=>n(Vt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(At,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=pf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(At,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:c=>n(Vt(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(At,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=mf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Sl,{children:r.jsx(At,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(At,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:c=>n(Vt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?Nx(t):LN(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(At,{label:c,children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(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 i=hf(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Sl,{children:[r.jsx(At,{label:"Playbook name",children:r.jsx("input",{value:i.name,onChange:l=>{const c=l.target.value,u={name:c};s&&(i.slug===mr(i.name)||!i.slug.trim())&&(u.slug=mr(c)),n(Vt(e,t,u))},className:"editor-input"})}),r.jsx(At,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:l=>n(Vt(e,t,{slug:mr(l.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(At,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:i.description,onChange:l=>n(Vt(e,t,{description:l.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(At,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:i.tags,onChange:l=>n(Vt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(At,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:i.whenToUse,onChange:l=>n(Vt(e,t,{whenToUse:l.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(At,{label:"Playbook rules",children:r.jsx("textarea",{value:i.body,onChange:l=>n(Vt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Sl({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function At({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 BF({value:e,onChange:t}){const{data:n}=oc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(At,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:i=>t(i.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(i=>r.jsx("option",{value:i,children:i},i))]})})}function UF(e,t){switch(e){case"project":return df(t).body;case"assignment":return ff(t).body;case"plan":return pf(t).body;case"scratchpad":return mf(t).body;case"playbook":return hf(t).body;case"memory":return Nx(t).body;case"resource":return LN(t).body}}function VF(e,t){switch(e){case"project":{const n=df(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Hu(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=ff(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Hu(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return pf(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return mf(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=hf(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Hu(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function dj(){const e=Dt(),{workspace:t}=$t(),n=ln(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
|
|
552
|
+
workspace: ${t}`)),i(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function x(y){p(!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}`),p(!1);return}e(`${n}/projects/${C.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(mt,{label:"Loading project template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ca,{initialContent:s||"",documentType:"project",mode:"create",onSave:x,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 fj(){const{slug:e}=$t(),t=ln(),n=Dt(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{i(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function x(y){if(!e){h("Project slug is required.");return}p(!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}`),p(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(b){h(b.message),p(!1);return}p(!1)}return l?r.jsx(mt,{label:"Loading assignment template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ca,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:x,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 pj(){const{workspace:e}=$t(),t=ln(),n=Dt(),[s,i]=f.useState(null),[l,c]=f.useState(!0),[u,p]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{i(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function x(y){var b;p(!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}`),p(!1);return}const w=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!w){h("Server did not return the new assignment id."),p(!1);return}n(`/assignments/${w}`)}catch(C){h(C.message),p(!1);return}p(!1)}return l?r.jsx(mt,{label:"Loading assignment template…"}):m&&!s?r.jsx(wt,{error:m}):r.jsx(Ca,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:x,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 Ea({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:i,documentType:l,helpTitle:c,helpBody:u}){const p=Dt(),{data:m,loading:h,error:x}=M0(e),[y,b]=f.useState(!1),[C,j]=f.useState(null);async function w(k){b(!0),j(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}p(n)}catch(E){j(E.message),b(!1);return}b(!1)}return h?r.jsx(mt,{label:`Loading ${s.toLowerCase()}…`}):x||!m?r.jsx(wt,{error:x||`${s} is unavailable.`}):r.jsx(Ca,{initialContent:m.content,documentType:l,onSave:w,saving:y,error:C,title:s,description:i,onCancel:()=>p(n),helpTitle:c,helpBody:u})}function mj(){const{slug:e}=$t(),t=ln(),n=e??"";return r.jsx(Ea,{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 Jm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),i=!!n,l=i?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=i?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=i?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(Ea,{loadUrl:l,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 Xm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),i=!!n,l=i?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=i?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=i?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(Ea,{loadUrl:l,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 Qm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),i=!!n,l=i?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=i?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=i?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(Ea,{loadUrl:l,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 IN({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:i,helpTitle:l,helpBody:c}){const u=Dt(),{data:p,loading:m,error:h}=M0(e),[x,y]=f.useState(""),[b,C]=f.useState(""),[j,w]=f.useState(!1),[k,E]=f.useState(null);async function N(){w(!0),E(null);try{const P=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:x,body:b})}),$=await P.json();if(!P.ok){E($.error||`HTTP ${P.status}`),w(!1);return}u(n)}catch(P){E(P.message),w(!1);return}w(!1)}return m?r.jsx(mt,{label:`Loading ${s.toLowerCase()}…`}):h||!p?r.jsx(wt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(We,{title:s,description:i,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:x,onChange:P=>y(P.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:P=>C(P.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:N,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(We,{title:"Current Document",children:r.jsx(fn,{content:p.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Zm(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),i=!!n,l=i?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=i?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=i?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(IN,{loadUrl:l,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 eh(){const{slug:e,aslug:t,id:n}=$t(),s=ln(),i=!!n,l=i?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=i?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=i?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(IN,{loadUrl:l,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 hj(){const{workspace:e}=$t(),{data:t}=Jo(),{data:n,loading:s,error:i,refetch:l}=dg(),[c,u]=f.useState(!1),[p,m]=f.useState(""),[h,x]=f.useState(!1),y=Wn();f.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const N=decodeURIComponent(E[1]),P=document.querySelector(`[data-server-name="${window.CSS.escape(N)}"]`);if(!P)return;P.scrollIntoView({block:"nearest"}),P.classList.add("ring-2","ring-primary/60");const $=window.setTimeout(()=>P.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout($)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=new Set(t.filter(N=>e==="_ungrouped"?N.workspace===null:N.workspace===e).map(N=>N.slug));return n.sessions.filter(N=>N.windows.some(P=>P.panes.some($=>$.assignment&&$.assignment.project!==null&&E.has($.assignment.project))))})();async function C(E){if(E.preventDefault(),!!p.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:p.trim()})}),m(""),u(!1),l()}catch{}}async function j(){x(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),l()}finally{x(!1)}}async function w(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),l()}async function k(E){await fetch(`/api/servers/${encodeURIComponent(E)}/refresh`,{method:"POST"}),l()}return s?r.jsx(mt,{label:"Loading servers…"}):i?r.jsx(wt,{error:i}):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:p,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(rn,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(p0,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(St,{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(HF,{session:E,onRefresh:()=>k(E.name),onRemove:()=>w(E.name),onRefetch:l},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(Zi,{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 HF({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(og,{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(p0,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(or,{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(i=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",i.index,": ",i.name]}),r.jsx("div",{className:"space-y-1.5",children:i.panes.map(l=>r.jsx(WF,{pane:l,sessionName:e.name,windowIndex:i.index,onRefetch:s},`${i.index}:${l.index}`))})]},i.index))}),!e.alive&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(kP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function WF({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const i=ln(),l=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:l}),r.jsx(Dr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(ng,{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(ya,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ce,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${i}/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(mP,{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 _N(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 KF(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":_N(s)}function qF(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 GF(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function gj(){const{data:e,loading:t,error:n,refetch:s}=F0(),[i,l]=f.useState(()=>Date.now()),[c,u]=f.useState(null),[p,m]=f.useState(!1);if(f.useEffect(()=>{const x=window.setInterval(()=>l(Date.now()),1e3);return()=>window.clearInterval(x)},[]),t)return r.jsx(mt,{label:"Loading inventories…"});if(n)return r.jsx(wt,{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(St,{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 x=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!x.ok){const y=await x.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${x.status}`)}s(),u(null)}catch(x){window.alert(x instanceof Error?`Force release failed: ${x.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(x=>r.jsx(YF,{detail:x,now:i,onForceRelease:y=>u({slug:x.inventory.slug,lease:y})},x.inventory.slug))}),r.jsx(si,{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:p,onConfirm:h,onOpenChange:x=>{x||u(null)}})]})}function YF({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:i,active_leases:l}=e,c=i.filter(p=>p.status==="idle").length,u=i.filter(p=>p.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(Ld,{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=",_N(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",u," leased · ",i.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:i.map(p=>r.jsx(JF,{member:p},p.member_id))}),l.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:l.map(p=>r.jsx(XF,{lease:p,now:t,onForceRelease:()=>n(p)},p.lease_id))})]})]})}function JF({member:e}){const t=GF(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 ${qF(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 XF({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(nP,{className:"h-3 w-3"}),KF(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(NP,{className:"h-3 w-3"}),"Force release"]})]})]})}function QF(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function ZF(){return new Date().toISOString().slice(0,10)}function xj(){const[e,t]=f.useState(QF()),[n,s]=f.useState(ZF()),[i,l]=f.useState(""),[c,u]=f.useState("project"),[p,m]=f.useState(null),[h,x]=f.useState(!0),[y,b]=f.useState(null),[C,j]=f.useState([]);return f.useEffect(()=>{const w=new AbortController;x(!0),b(null);const k=new URLSearchParams({since:e,until:n,groupBy:c});return i&&k.set("project",i),fetch(`/api/usage?${k.toString()}`,{signal:w.signal}).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{if(m(E),!i){const N=new Set;for(const P of E.daily)P.project_slug&&N.add(P.project_slug);j([...N].sort())}x(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(b(E instanceof Error?E.message:String(E)),x(!1))}),()=>{w.abort()}},[e,n,i,c]),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(Od,{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:"Since"}),r.jsx("input",{type:"date",value:e,onChange:w=>t(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),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,onChange:w=>s(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),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:i,onChange:w=>l(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"",children:"All"}),C.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),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:c,onChange:w=>u(w.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",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]}),p&&!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"}),p.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data in this window. 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"}),c==="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:p.summary.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:w.projectSlug||"(unattributed)"}),c==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:w.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:sd(w.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:od(w.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),p.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:p.daily.map((w,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:w.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:w.model}),r.jsx("td",{className:"px-3 py-2",children:w.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:w.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:sd(w.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:od(w.total_cost)})]},k))})]})]})]})]})}function yj(){const{workspace:e}=$t(),{data:t}=Jo(),{data:n,loading:s,error:i}=z0(),[l,c]=f.useState(""),[u,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState("started_desc"),[b,C]=f.useState(0),[j,w]=f.useState(new Set),[k,E]=f.useState(!1),[N,P]=f.useState(null),[$,T]=f.useState(null),D=(n==null?void 0:n.sessions.some(F=>F.status==="active"))??!1;f.useEffect(()=>{if(!D)return;const F=window.setInterval(()=>C(H=>H+1),3e4);return()=>window.clearInterval(F)},[D]),f.useEffect(()=>{w(F=>{if(F.size===0)return F;const H=new Set((n==null?void 0:n.sessions.map(ce=>ce.sessionId))??[]),ee=new Set([...F].filter(ce=>H.has(ce)));return ee.size===F.size?F:ee})},[n]);const L=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const F=l.trim().toLowerCase();return[...n.sessions.filter(ee=>{var W;if(e&&t){const R=((W=t.find(M=>M.slug===ee.projectSlug))==null?void 0:W.workspace)??null;if(e==="_ungrouped"){if(R!==null)return!1}else if(R!==e)return!1}const ce=t6(ee.started);return u&&(!ce||ce<u)||m&&(!ce||ce>m)?!1:F?[ee.projectSlug??"",ee.assignmentSlug??"",ee.agent,ee.sessionId,ee.path,ee.description??"",ee.transcriptPath??""].join(" ").toLowerCase().includes(F):!0})].sort((ee,ce)=>n6(ee,ce,x))},[n,l,x,u,m,b,e,t]);function Y(F){w(H=>{const ee=new Set(H);return ee.has(F)?ee.delete(F):ee.add(F),ee})}function X(){j.size===L.length&&L.length>0?w(new Set):w(new Set(L.map(F=>F.sessionId)))}async function I(F){P(null),E(!0);try{const H=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:F})}),ee=await H.json().catch(()=>null);if(!H.ok)throw new Error((ee==null?void 0:ee.error)||`HTTP ${H.status}`);w(ce=>new Set([...ce].filter(_=>!F.includes(_)))),T(null)}catch(H){P(H.message)}finally{E(!1)}}async function U(F){try{const H=await fetch(`/api/agent-sessions/${encodeURIComponent(F)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!H.ok){const ee=await H.json().catch(()=>null);P((ee==null?void 0:ee.error)||`Failed to mark session stopped: HTTP ${H.status}`)}}catch(H){P(H.message)}}if(s)return r.jsx(mt,{label:"Loading agent sessions..."});if(i)return r.jsx(wt,{error:i});if(!n)return null;const ne=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Kg,{children:[r.jsx(nf,{value:l,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:F=>p(F.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:F=>h(F.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:x,onChange:F=>y(F.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"})]})]}),N?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:N}):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:()=>T({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(or,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>w(new Set),children:"Clear Selection"})]}),ne?L.length===0?r.jsx(St,{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:X,className:"text-muted-foreground hover:text-foreground",children:j.size===L.length&&L.length>0?r.jsx(Ar,{className:"h-4 w-4"}):r.jsx(ig,{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:L.map(F=>r.jsx(e6,{session:F,selected:j.has(F.sessionId),onToggle:()=>Y(F.sessionId),onDelete:()=>T({sessionIds:[F.sessionId],title:`Delete session ${F.sessionId.slice(0,8)}...?`,description:`Remove this ${F.agent} session record${F.assignmentSlug?` for ${F.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:U},F.sessionId))})]})}):r.jsx(St,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(si,{open:$!==null,title:($==null?void 0:$.title)??"Delete session?",description:($==null?void 0:$.description)??"",confirmLabel:($==null?void 0:$.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:F=>{F||T(null)},onConfirm:async()=>{$&&await I($.sessionIds)}})]})}function e6({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:i}){const l=ln(),c=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,u=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",p=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(Ar,{className:"h-4 w-4"}):r.jsx(ig,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ce,{to:`${l}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:yn(e.projectSlug),children:yn(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(Ce,{to:`${l}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:yn(e.assignmentSlug),children:yn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Ce,{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(Ad,{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:c}),r.jsx(Dr,{value:e.sessionId})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:$r(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:u}),e.path&&r.jsx(Dr,{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:p}),r.jsx(Dr,{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(SN,{session:e,onMarkStopped:i}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(or,{className:"h-3.5 w-3.5"})})]})})]})}function t6(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"),i=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${i}`}function Ou(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 n6(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 Ou(e)-Ou(t);case"duration_desc":return Ou(t)-Ou(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 r6(){const{data:e,loading:t,error:n,refetch:s}=B0(),[i,l]=f.useState(""),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!i.trim())return e.playbooks;const j=i.toLowerCase();return e.playbooks.filter(w=>w.name.toLowerCase().includes(j)||w.description.toLowerCase().includes(j)||w.slug.toLowerCase().includes(j)||w.tags.some(k=>k.toLowerCase().includes(j)))},[e,i]);async function b(j,w,k){if(j.preventDefault(),j.stopPropagation(),!c){u(w);try{const E=k?"disable":"enable",N=await fetch(`/api/playbooks/${encodeURIComponent(w)}/${E}`,{method:"POST"});if(!N.ok){const P=await N.json().catch(()=>({}));throw new Error(P.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(p){x(p.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(p.slug)}`,{method:"DELETE"});if(!j.ok){const w=await j.json().catch(()=>({}));throw new Error(w.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{x(null)}}}return t?r.jsx(mt,{label:"Loading playbooks..."}):n?r.jsx(wt,{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(fo,{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:i,onChange:j=>l(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(Ce,{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(rn,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Ce,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(c0,{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(St,{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(Ce,{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(rn,{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 w=c===j.slug,k=[{key:"delete",label:"Delete",icon:or,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(Hg,{items:k})}),r.jsxs(Ce,{to:`/playbooks/${j.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(i0,{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(m0,{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:w,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(si,{open:p!==null,title:"Delete playbook?",description:p?`"${p.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 s6(){const{slug:e}=$t(),t=Dt(),{data:n,loading:s,error:i,refetch:l}=NR(e),[c,u]=f.useState(!1),[p,m]=f.useState(!1),[h,x]=f.useState(!1),[y,b]=f.useState(!1),[C,j]=f.useState(""),[w,k]=f.useState(!1),[E,N]=f.useState(null),P=e==="manifest";f.useEffect(()=>{y&&(j(e??""),N(null))},[y,e]);const $=mr(C),T=$.length>0&&Hu($)&&$!=="manifest",D=$!==e;async function L(){if(!(!e||!T||!D)){k(!0),N(null);try{const I=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:$})});if(!I.ok){const U=await I.json().catch(()=>({}));throw new Error(U.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${$}`)}catch(I){N(I instanceof Error?I.message:"Failed to rename playbook")}finally{k(!1)}}}async function Y(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function X(){if(!(!e||!n)){x(!0);try{const I=n.enabled?"disable":"enable",U=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${I}`,{method:"POST"});if(!U.ok){const ne=await U.json().catch(()=>({}));throw new Error(ne.error||`Failed to ${I} playbook`)}l()}catch(I){console.error(I),alert(I instanceof Error?I.message:"Failed to update playbook")}finally{x(!1)}}}return s?r.jsx(mt,{label:"Loading playbook..."}):i?r.jsx(wt,{error:i}):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:P?"Playbook Manifest":n.name}),P?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]}),!P&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,P?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,!P&&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 ",$r(n.created)]}),r.jsxs("span",{children:["Updated ",$r(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(I=>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(m0,{className:"h-3 w-3"}),I]},I))}):null]}),P?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:X,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(Ce,{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(ba,{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(EP,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:Y,disabled:p,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:p?"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(or,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(fn,{content:n.body})}),r.jsx(ir,{open:y,onOpenChange:I=>w?void 0:b(I),children:r.jsxs(Kn,{children:[r.jsxs(Qr,{children:[r.jsx(qn,{children:"Rename playbook"}),r.jsx(hs,{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:I=>j(I.target.value),disabled:w,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&&$!==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:$||"—"})]}):null,C&&!T?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($s,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:w,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:L,disabled:w||!T||!D,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Renaming…":"Rename"})]})]})})]}):null}function o6(){const e=Dt(),[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(!1),[u,p]=f.useState(null);f.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),i(!1)}).catch(h=>{p(h.message),i(!1)})},[]);async function m(h){c(!0),p(null);try{const x=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await x.json();if(!x.ok){p(y.error||`HTTP ${x.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(x){p(x.message),c(!1);return}c(!1)}return s?r.jsx(mt,{label:"Loading playbook template..."}):u&&!t?r.jsx(wt,{error:u}):r.jsx(Ca,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:l,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 i6(){const{slug:e}=$t(),t=Dt(),[n,s]=f.useState(null),[i,l]=f.useState(!0),[c,u]=f.useState(!1),[p,m]=f.useState(null);f.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(x=>x.json()).then(x=>{s(x.content),l(!1)}).catch(x=>{m(x.message),l(!1)})},[e]);async function h(x){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:x})}),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 i?r.jsx(mt,{label:"Loading playbook..."}):p&&!n?r.jsx(wt,{error:p}):r.jsx(Ca,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:p,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function a6(){const{data:e,loading:t,error:n}=CR(),[s,i]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),x=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(x.map(w=>w.projectSlug))).sort(),[x]),b=f.useMemo(()=>Array.from(new Set(x.map(w=>w.scope).filter(Boolean))).sort(),[x]),C=f.useMemo(()=>Array.from(new Set(x.map(w=>w.source).filter(Boolean))).sort(),[x]),j=f.useMemo(()=>x.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.scope!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[x,s,l,u,m]);return t?r.jsx(mt,{label:"Loading memories…"}):n?r.jsx(wt,{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(fo,{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:w=>i(w.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:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(Ce,{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(rn,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(St,{title:x.length===0?"No memories yet":"No memories match these filters",description:x.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:x.length===0?r.jsxs(Ce,{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(rn,{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(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}/memories/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Dn(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function l6(){const{slug:e,itemSlug:t}=$t(),n=Dt(),{data:s,loading:i,error:l}=ER(e,t),[c,u]=f.useState(!1),[p,m]=f.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 i?r.jsx(mt,{label:"Loading memory…"}):l?r.jsx(wt,{error:l}):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(Ce,{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 ",$r(s.created)]}),r.jsxs("span",{children:["Updated ",$r(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(x=>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:x},x))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{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(ba,{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:p,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:p?"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(or,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(fn,{content:s.body})})]}):null}function c6(){const e=Dt(),[t]=ms(),n=t.get("project"),{data:s,loading:i,error:l}=Jo(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,x]=f.useState(""),[y,b]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.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:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${N.projectSlug}/memories/${N.slug}`)}catch(E){j(E.message),b(!1)}}}return i?r.jsx(mt,{label:"Loading projects…"}):l?r.jsx(wt,{error:l}):!s||s.length===0?r.jsx(wt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,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:p,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=>x(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||!p.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 u6(){const{slug:e,itemSlug:t}=$t();return r.jsx(Ea,{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 d6(){const{data:e,loading:t,error:n}=TR(),[s,i]=f.useState(""),[l,c]=f.useState("all"),[u,p]=f.useState("all"),[m,h]=f.useState("all"),x=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(x.map(w=>w.projectSlug))).sort(),[x]),b=f.useMemo(()=>Array.from(new Set(x.map(w=>w.category).filter(Boolean))).sort(),[x]),C=f.useMemo(()=>Array.from(new Set(x.map(w=>w.source).filter(Boolean))).sort(),[x]),j=f.useMemo(()=>x.filter(w=>{if(l!=="all"&&w.projectSlug!==l||u!=="all"&&w.category!==u||m!=="all"&&w.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!w.name.toLowerCase().includes(k)&&!w.slug.toLowerCase().includes(k)&&!w.projectTitle.toLowerCase().includes(k))return!1}return!0}),[x,s,l,u,m]);return t?r.jsx(mt,{label:"Loading resources…"}):n?r.jsx(wt,{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(fo,{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:w=>i(w.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:l,onChange:w=>c(w.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(w=>r.jsx("option",{value:w,children:w},w))]}),r.jsxs("select",{value:m,onChange:w=>h(w.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(w=>r.jsx("option",{value:w,children:w},w))]})]}),r.jsxs(Ce,{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(rn,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(St,{title:x.length===0?"No resources yet":"No resources match these filters",description:x.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:x.length===0?r.jsxs(Ce,{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(rn,{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(w=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}/resources/${w.slug}`,className:"font-semibold text-foreground hover:text-primary",children:w.name||w.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Ce,{to:`/projects/${w.projectSlug}`,className:"hover:text-foreground hover:underline",children:w.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:w.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Dn(w.updated)})]},`${w.projectSlug}/${w.slug}`))})]})})]})}function f6(){const{slug:e,itemSlug:t}=$t(),n=Dt(),{data:s,loading:i,error:l}=PR(e,t),[c,u]=f.useState(!1),[p,m]=f.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 i?r.jsx(mt,{label:"Loading resource…"}):l?r.jsx(wt,{error:l}):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(Ce,{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 ",$r(s.created)]}),r.jsxs("span",{children:["Updated ",$r(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{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(ba,{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:p,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:p?"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(or,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(fn,{content:s.body})})]}):null}function p6(){const e=Dt(),[t]=ms(),n=t.get("project"),{data:s,loading:i,error:l}=Jo(),[c,u]=f.useState(n??""),[p,m]=f.useState(""),[h,x]=f.useState(""),[y,b]=f.useState(!1),[C,j]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function w(k){if(k.preventDefault(),!(!c||!p.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:p.trim(),body:h||void 0})}),N=await E.json();if(!E.ok){j(N.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${N.projectSlug}/resources/${N.slug}`)}catch(E){j(E.message),b(!1)}}}return i?r.jsx(mt,{label:"Loading projects…"}):l?r.jsx(wt,{error:l}):!s||s.length===0?r.jsx(wt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:w,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:p,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=>x(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||!p.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 m6(){const{slug:e,itemSlug:t}=$t();return r.jsx(Ea,{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 h6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>s=>{t.forEach(i=>i(s))},t)}const gf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ta(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Cx(e){return"nodeType"in e}function lr(e){var t,n;return e?Ta(e)?e:Cx(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Ex(e){const{Document:t}=lr(e);return e instanceof t}function mc(e){return Ta(e)?!1:e instanceof lr(e).HTMLElement}function MN(e){return e instanceof lr(e).SVGElement}function Pa(e){return e?Ta(e)?e.document:Cx(e)?Ex(e)?e:mc(e)||MN(e)?e.ownerDocument:document:document:document}const ps=gf?f.useLayoutEffect:f.useEffect;function Tx(e){const t=f.useRef(e);return ps(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}function g6(){const e=f.useRef(null),t=f.useCallback((s,i)=>{e.current=setInterval(s,i)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Ql(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return ps(()=>{n.current!==e&&(n.current=e)},t),n}function hc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function vd(e){const t=Tx(e),n=f.useRef(null),s=f.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,s]}function Fh(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let th={};function gc(e,t){return f.useMemo(()=>{if(t)return t;const n=th[e]==null?0:th[e]+1;return th[e]=n,e+"-"+n},[e,t])}function FN(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];return s.reduce((l,c)=>{const u=Object.entries(c);for(const[p,m]of u){const h=l[p];h!=null&&(l[p]=h+e*m)}return l},{...t})}}const da=FN(1),Zl=FN(-1);function x6(e){return"clientX"in e&&"clientY"in e}function Px(e){if(!e)return!1;const{KeyboardEvent:t}=lr(e.target);return t&&e instanceof t}function y6(e){if(!e)return!1;const{TouchEvent:t}=lr(e.target);return t&&e instanceof t}function zh(e){if(y6(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 x6(e)?{x:e.clientX,y:e.clientY}:null}const ha=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[ha.Translate.toString(e),ha.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),bj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function b6(e){return e.matches(bj)?e:e.querySelector(bj)}const v6={display:"none"};function w6(e){let{id:t,value:n}=e;return nn.createElement("div",{id:t,style:v6},n)}function j6(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const i={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 nn.createElement("div",{id:t,style:i,role:"status","aria-live":s,"aria-atomic":!0},n)}function k6(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const zN=f.createContext(null);function S6(e){const t=f.useContext(zN);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function N6(){const[e]=f.useState(()=>new Set),t=f.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[f.useCallback(s=>{let{type:i,event:l}=s;e.forEach(c=>{var u;return(u=c[i])==null?void 0:u.call(c,l)})},[e]),t]}const C6={draggable:`
|
|
553
|
+
To pick up a draggable item, press the space bar.
|
|
554
|
+
While dragging, use the arrow keys to move the item.
|
|
555
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
556
|
+
`},E6={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 T6(e){let{announcements:t=E6,container:n,hiddenTextDescribedById:s,screenReaderInstructions:i=C6}=e;const{announce:l,announcement:c}=k6(),u=gc("DndLiveRegion"),[p,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),S6(f.useMemo(()=>({onDragStart(x){let{active:y}=x;l(t.onDragStart({active:y}))},onDragMove(x){let{active:y,over:b}=x;t.onDragMove&&l(t.onDragMove({active:y,over:b}))},onDragOver(x){let{active:y,over:b}=x;l(t.onDragOver({active:y,over:b}))},onDragEnd(x){let{active:y,over:b}=x;l(t.onDragEnd({active:y,over:b}))},onDragCancel(x){let{active:y,over:b}=x;l(t.onDragCancel({active:y,over:b}))}}),[l,t])),!p)return null;const h=nn.createElement(nn.Fragment,null,nn.createElement(w6,{id:s,value:i.draggable}),nn.createElement(j6,{id:u,announcement:c}));return n?Ts.createPortal(h,n):h}var bn;(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"})(bn||(bn={}));function wd(){}function jd(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function BN(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const Yr=Object.freeze({x:0,y:0});function UN(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function VN(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function P6(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function vj(e){let{left:t,top:n,height:s,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+s},{x:t+i,y:n+s}]}function HN(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function wj(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 WN=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=wj(t,t.left,t.top),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=UN(wj(p),i);l.push({id:u,data:{droppableContainer:c,value:m}})}}return l.sort(VN)},R6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=vj(t),l=[];for(const c of s){const{id:u}=c,p=n.get(u);if(p){const m=vj(p),h=i.reduce((y,b,C)=>y+UN(m[C],b),0),x=Number((h/4).toFixed(4));l.push({id:u,data:{droppableContainer:c,value:x}})}}return l.sort(VN)};function A6(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),l=Math.min(t.top+t.height,e.top+e.height),c=i-s,u=l-n;if(s<i&&n<l){const p=t.width*t.height,m=e.width*e.height,h=c*u,x=h/(p+m-h);return Number(x.toFixed(4))}return 0}const D6=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const i=[];for(const l of s){const{id:c}=l,u=n.get(c);if(u){const p=A6(u,t);p>0&&i.push({id:c,data:{droppableContainer:l,value:p}})}}return i.sort(P6)};function $6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function KN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Yr}function L6(e){return function(n){for(var s=arguments.length,i=new Array(s>1?s-1:0),l=1;l<s;l++)i[l-1]=arguments[l];return i.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 O6=L6(1);function I6(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 _6(e,t,n){const s=I6(t);if(!s)return e;const{scaleX:i,scaleY:l,x:c,y:u}=s,p=e.left-c-(1-i)*parseFloat(n),m=e.top-u-(1-l)*parseFloat(n.slice(n.indexOf(" ")+1)),h=i?e.width/i:e.width,x=l?e.height/l:e.height;return{width:h,height:x,top:m,right:p+h,bottom:m+x,left:p}}const M6={ignoreTransform:!1};function Ra(e,t){t===void 0&&(t=M6);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=lr(e).getComputedStyle(e);m&&(n=_6(n,m,h))}const{top:s,left:i,width:l,height:c,bottom:u,right:p}=n;return{top:s,left:i,width:l,height:c,bottom:u,right:p}}function jj(e){return Ra(e,{ignoreTransform:!0})}function F6(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function z6(e,t){return t===void 0&&(t=lr(e).getComputedStyle(e)),t.position==="fixed"}function B6(e,t){t===void 0&&(t=lr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const l=t[i];return typeof l=="string"?n.test(l):!1})}function xf(e,t){const n=[];function s(i){if(t!=null&&n.length>=t||!i)return n;if(Ex(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!mc(i)||MN(i)||n.includes(i))return n;const l=lr(e).getComputedStyle(i);return i!==e&&B6(i,l)&&n.push(i),z6(i,l)?n:s(i.parentNode)}return e?s(e):n}function qN(e){const[t]=xf(e,1);return t??null}function nh(e){return!gf||!e?null:Ta(e)?e:Cx(e)?Ex(e)||e===Pa(e).scrollingElement?window:mc(e)?e:null:null}function GN(e){return Ta(e)?e.scrollX:e.scrollLeft}function YN(e){return Ta(e)?e.scrollY:e.scrollTop}function Bh(e){return{x:GN(e),y:YN(e)}}var En;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(En||(En={}));function JN(e){return!gf||!e?!1:e===document.scrollingElement}function XN(e){const t={x:0,y:0},n=JN(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,l=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:i,isLeft:l,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const U6={x:.2,y:.2};function V6(e,t,n,s,i){let{top:l,left:c,right:u,bottom:p}=n;s===void 0&&(s=10),i===void 0&&(i=U6);const{isTop:m,isBottom:h,isLeft:x,isRight:y}=XN(e),b={x:0,y:0},C={x:0,y:0},j={height:t.height*i.y,width:t.width*i.x};return!m&&l<=t.top+j.height?(b.y=En.Backward,C.y=s*Math.abs((t.top+j.height-l)/j.height)):!h&&p>=t.bottom-j.height&&(b.y=En.Forward,C.y=s*Math.abs((t.bottom-j.height-p)/j.height)),!y&&u>=t.right-j.width?(b.x=En.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!x&&c<=t.left+j.width&&(b.x=En.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function H6(e){if(e===document.scrollingElement){const{innerWidth:l,innerHeight:c}=window;return{top:0,left:0,right:l,bottom:c,width:l,height:c}}const{top:t,left:n,right:s,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:i,width:e.clientWidth,height:e.clientHeight}}function QN(e){return e.reduce((t,n)=>da(t,Bh(n)),Yr)}function W6(e){return e.reduce((t,n)=>t+GN(n),0)}function K6(e){return e.reduce((t,n)=>t+YN(n),0)}function q6(e,t){if(t===void 0&&(t=Ra),!e)return;const{top:n,left:s,bottom:i,right:l}=t(e);qN(e)&&(i<=0||l<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const G6=[["x",["left","right"],W6],["y",["top","bottom"],K6]];class Rx{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=xf(n),i=QN(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[l,c,u]of G6)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=u(s),h=i[l]-m;return this.rect[p]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class _l{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 i;(i=this.target)==null||i.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function Y6(e){const{EventTarget:t}=lr(e);return e instanceof t?e:Pa(e)}function rh(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 Er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Er||(Er={}));function kj(e){e.preventDefault()}function J6(e){e.stopPropagation()}var ht;(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"})(ht||(ht={}));const ZN={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},X6=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class yf{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 _l(Pa(n)),this.windowListeners=new _l(lr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Er.Resize,this.handleCancel),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&q6(s),n(Yr)}handleKeyDown(t){if(Px(t)){const{active:n,context:s,options:i}=this.props,{keyboardCodes:l=ZN,coordinateGetter:c=X6,scrollBehavior:u="smooth"}=i,{code:p}=t;if(l.end.includes(p)){this.handleEnd(t);return}if(l.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:Yr;this.referenceCoordinates||(this.referenceCoordinates=h);const x=c(t,{active:n,context:s.current,currentCoordinates:h});if(x){const y=Zl(x,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const w=t.code,{isTop:k,isRight:E,isLeft:N,isBottom:P,maxScroll:$,minScroll:T}=XN(j),D=H6(j),L={x:Math.min(w===ht.Right?D.right-D.width/2:D.right,Math.max(w===ht.Right?D.left:D.left+D.width/2,x.x)),y:Math.min(w===ht.Down?D.bottom-D.height/2:D.bottom,Math.max(w===ht.Down?D.top:D.top+D.height/2,x.y))},Y=w===ht.Right&&!E||w===ht.Left&&!N,X=w===ht.Down&&!P||w===ht.Up&&!k;if(Y&&L.x!==x.x){const I=j.scrollLeft+y.x,U=w===ht.Right&&I<=$.x||w===ht.Left&&I>=T.x;if(U&&!y.y){j.scrollTo({left:I,behavior:u});return}U?b.x=j.scrollLeft-I:b.x=w===ht.Right?j.scrollLeft-$.x:j.scrollLeft-T.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(X&&L.y!==x.y){const I=j.scrollTop+y.y,U=w===ht.Down&&I<=$.y||w===ht.Up&&I>=T.y;if(U&&!y.x){j.scrollTo({top:I,behavior:u});return}U?b.y=j.scrollTop-I:b.y=w===ht.Down?j.scrollTop-$.y:j.scrollTop-T.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,da(Zl(x,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()}}yf.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=ZN,onActivation:i}=t,{active:l}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=l.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function Sj(e){return!!(e&&"distance"in e)}function Nj(e){return!!(e&&"delay"in e)}class Ax{constructor(t,n,s){var i;s===void 0&&(s=Y6(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:l}=t,{target:c}=l;this.props=t,this.events=n,this.document=Pa(c),this.documentListeners=new _l(this.document),this.listeners=new _l(s),this.windowListeners=new _l(lr(c)),this.initialCoordinates=(i=zh(l))!=null?i:Yr,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(Er.Resize,this.handleCancel),this.windowListeners.add(Er.DragStart,kj),this.windowListeners.add(Er.VisibilityChange,this.handleCancel),this.windowListeners.add(Er.ContextMenu,kj),this.documentListeners.add(Er.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Nj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Sj(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:i}=this.props;i(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Er.Click,J6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:i,props:l}=this,{onMove:c,options:{activationConstraint:u}}=l;if(!i)return;const p=(n=zh(t))!=null?n:Yr,m=Zl(i,p);if(!s&&u){if(Sj(u)){if(u.tolerance!=null&&rh(m,u.tolerance))return this.handleCancel();if(rh(m,u.distance))return this.handleStart()}if(Nj(u)&&rh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(p)}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===ht.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Q6={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bf extends Ax{constructor(t){const{event:n}=t,s=Pa(n.target);super(t,Q6,s)}}bf.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 Z6={move:{name:"mousemove"},end:{name:"mouseup"}};var Uh;(function(e){e[e.RightClick=2]="RightClick"})(Uh||(Uh={}));class ez extends Ax{constructor(t){super(t,Z6,Pa(t.event.target))}}ez.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Uh.RightClick?!1:(s==null||s({event:n}),!0)}}];const sh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class tz extends Ax{constructor(t){super(t,sh)}static setup(){return window.addEventListener(sh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(sh.move.name,t)};function t(){}}}tz.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:i}=n;return i.length>1?!1:(s==null||s({event:n}),!0)}}];var Ml;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ml||(Ml={}));var kd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(kd||(kd={}));function nz(e){let{acceleration:t,activator:n=Ml.Pointer,canScroll:s,draggingRect:i,enabled:l,interval:c=5,order:u=kd.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:h,delta:x,threshold:y}=e;const b=sz({delta:x,disabled:!l}),[C,j]=g6(),w=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case Ml.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Ml.DraggableRect:return i}},[n,i,p]),N=f.useRef(null),P=f.useCallback(()=>{const T=N.current;if(!T)return;const D=w.current.x*k.current.x,L=w.current.y*k.current.y;T.scrollBy(D,L)},[]),$=f.useMemo(()=>u===kd.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!l||!m.length||!E){j();return}for(const T of $){if((s==null?void 0:s(T))===!1)continue;const D=m.indexOf(T),L=h[D];if(!L)continue;const{direction:Y,speed:X}=V6(T,L,E,t,y);for(const I of["x","y"])b[I][Y[I]]||(X[I]=0,Y[I]=0);if(X.x>0||X.y>0){j(),N.current=T,C(P,c),w.current=X,k.current=Y;return}}w.current={x:0,y:0},k.current={x:0,y:0},j()},[t,P,s,j,l,c,JSON.stringify(E),JSON.stringify(b),C,m,$,h,JSON.stringify(y)])}const rz={x:{[En.Backward]:!1,[En.Forward]:!1},y:{[En.Backward]:!1,[En.Forward]:!1}};function sz(e){let{delta:t,disabled:n}=e;const s=Fh(t);return hc(i=>{if(n||!s||!i)return rz;const l={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[En.Backward]:i.x[En.Backward]||l.x===-1,[En.Forward]:i.x[En.Forward]||l.x===1},y:{[En.Backward]:i.y[En.Backward]||l.y===-1,[En.Forward]:i.y[En.Forward]||l.y===1}}},[n,t,s])}function oz(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return hc(i=>{var l;return t==null?null:(l=s??i)!=null?l:null},[s,t])}function iz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:i}=s,l=i.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...l]},[]),[e,t])}var ec;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ec||(ec={}));var Vh;(function(e){e.Optimized="optimized"})(Vh||(Vh={}));const Cj=new Map;function az(e,t){let{dragging:n,dependencies:s,config:i}=t;const[l,c]=f.useState(null),{frequency:u,measure:p,strategy:m}=i,h=f.useRef(e),x=w(),y=Ql(x),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(N=>!E.includes(N))))},[y]),C=f.useRef(null),j=hc(k=>{if(x&&!n)return Cj;if(!k||k===Cj||h.current!==e||l!=null){const E=new Map;for(let N of e){if(!N)continue;if(l&&l.length>0&&!l.includes(N.id)&&N.rect.current){E.set(N.id,N.rect.current);continue}const P=N.node.current,$=P?new Rx(p(P),P):null;N.rect.current=$,$&&E.set(N.id,$)}return E}return k},[e,l,n,x,p]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{x||b()},[n,x]),f.useEffect(()=>{l&&l.length>0&&c(null)},[JSON.stringify(l)]),f.useEffect(()=>{x||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,x,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:l!=null};function w(){switch(m){case ec.Always:return!1;case ec.BeforeDragging:return n;default:return!n}}}function eC(e,t){return hc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function lz(e,t){return eC(e,t)}function cz(e){let{callback:t,disabled:n}=e;const s=Tx(t),i=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:l}=window;return new l(s)},[s,n]);return f.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function vf(e){let{callback:t,disabled:n}=e;const s=Tx(t),i=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:l}=window;return new l(s)},[n]);return f.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function uz(e){return new Rx(Ra(e),e)}function Ej(e,t,n){t===void 0&&(t=uz);const[s,i]=f.useState(null);function l(){i(p=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=p??n)!=null?m:null}const h=t(e);return JSON.stringify(p)===JSON.stringify(h)?p:h})}const c=cz({callback(p){if(e)for(const m of p){const{type:h,target:x}=m;if(h==="childList"&&x instanceof HTMLElement&&x.contains(e)){l();break}}}}),u=vf({callback:l});return ps(()=>{l(),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 dz(e){const t=eC(e);return KN(e,t)}const Tj=[];function fz(e){const t=f.useRef(e),n=hc(s=>e?s&&s!==Tj&&e&&t.current&&e.parentNode===t.current.parentNode?s:xf(e):Tj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function pz(e){const[t,n]=f.useState(null),s=f.useRef(e),i=f.useCallback(l=>{const c=nh(l.target);c&&n(u=>u?(u.set(c,Bh(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const l=s.current;if(e!==l){c(l);const u=e.map(p=>{const m=nh(p);return m?(m.addEventListener("scroll",i,{passive:!0}),[m,Bh(m)]):null}).filter(p=>p!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(l)};function c(u){u.forEach(p=>{const m=nh(p);m==null||m.removeEventListener("scroll",i)})}},[i,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((l,c)=>da(l,c),Yr):QN(e):Yr,[e,t])}function Pj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==Yr;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Zl(e,n.current):Yr}function mz(e){f.useEffect(()=>{if(!gf)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 hz(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:i,handler:l}=s;return n[i]=c=>{l(c,t)},n},{}),[e,t])}function tC(e){return f.useMemo(()=>e?F6(e):null,[e])}const Rj=[];function gz(e,t){t===void 0&&(t=Ra);const[n]=e,s=tC(n?lr(n):null),[i,l]=f.useState(Rj);function c(){l(()=>e.length?e.map(p=>JN(p)?s:new Rx(t(p),p)):Rj)}const u=vf({callback:c});return ps(()=>{u==null||u.disconnect(),c(),e.forEach(p=>u==null?void 0:u.observe(p))},[e]),i}function xz(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return mc(t)?t:e}function yz(e){let{measure:t}=e;const[n,s]=f.useState(null),i=f.useCallback(m=>{for(const{target:h}of m)if(mc(h)){s(x=>{const y=t(h);return x?{...x,width:y.width,height:y.height}:y});break}},[t]),l=vf({callback:i}),c=f.useCallback(m=>{const h=xz(m);l==null||l.disconnect(),h&&(l==null||l.observe(h)),s(h?t(h):null)},[t,l]),[u,p]=vd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:p}),[n,u,p])}const bz=[{sensor:bf,options:{}},{sensor:yf,options:{}}],vz={current:{}},Qu={draggable:{measure:jj},droppable:{measure:jj,strategy:ec.WhileDragging,frequency:Vh.Optimized},dragOverlay:{measure:Ra}};class Fl 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 wz={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Fl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Qu,measureDroppableContainers:wd,windowRect:null,measuringScheduled:!1},jz={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:wd,draggableNodes:new Map,over:null,measureDroppableContainers:wd},wf=f.createContext(jz),nC=f.createContext(wz);function kz(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Fl}}}function Sz(e,t){switch(t.type){case bn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case bn.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 bn.DragEnd:case bn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case bn.RegisterDroppable:{const{element:n}=t,{id:s}=n,i=new Fl(e.droppable.containers);return i.set(s,n),{...e,droppable:{...e.droppable,containers:i}}}case bn.SetDroppableDisabled:{const{id:n,key:s,disabled:i}=t,l=e.droppable.containers.get(n);if(!l||s!==l.key)return e;const c=new Fl(e.droppable.containers);return c.set(n,{...l,disabled:i}),{...e,droppable:{...e.droppable,containers:c}}}case bn.UnregisterDroppable:{const{id:n,key:s}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const l=new Fl(e.droppable.containers);return l.delete(n),{...e,droppable:{...e.droppable,containers:l}}}default:return e}}function Nz(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:i}=f.useContext(wf),l=Fh(s),c=Fh(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&l&&c!=null){if(!Px(l)||document.activeElement===l.target)return;const u=i.get(c);if(!u)return;const{activatorNode:p,node:m}=u;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[p.current,m.current]){if(!h)continue;const x=b6(h);if(x){x.focus();break}}})}},[s,t,i,c,l]),null}function Cz(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((i,l)=>l({transform:i,...s}),n):n}function Ez(e){return f.useMemo(()=>({draggable:{...Qu.draggable,...e==null?void 0:e.draggable},droppable:{...Qu.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Qu.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 Tz(e){let{activeNode:t,measure:n,initialRect:s,config:i=!0}=e;const l=f.useRef(!1),{x:c,y:u}=typeof i=="boolean"?{x:i,y:i}:i;ps(()=>{if(!c&&!u||!t){l.current=!1;return}if(l.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),x=KN(h,s);if(c||(x.x=0),u||(x.y=0),l.current=!0,Math.abs(x.x)>0||Math.abs(x.y)>0){const y=qN(m);y&&y.scrollBy({top:x.y,left:x.x})}},[t,c,u,s,n])}const rC=f.createContext({...Yr,scaleX:1,scaleY:1});var ro;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ro||(ro={}));const sC=f.memo(function(t){var n,s,i,l;let{id:c,accessibility:u,autoScroll:p=!0,children:m,sensors:h=bz,collisionDetection:x=D6,measuring:y,modifiers:b,...C}=t;const j=f.useReducer(Sz,void 0,kz),[w,k]=j,[E,N]=N6(),[P,$]=f.useState(ro.Uninitialized),T=P===ro.Initialized,{draggable:{active:D,nodes:L,translate:Y},droppable:{containers:X}}=w,I=D!=null?L.get(D):null,U=f.useRef({initial:null,translated:null}),ne=f.useMemo(()=>{var Be;return D!=null?{id:D,data:(Be=I==null?void 0:I.data)!=null?Be:vz,rect:U}:null},[D,I]),F=f.useRef(null),[H,ee]=f.useState(null),[ce,_]=f.useState(null),W=Ql(C,Object.values(C)),R=gc("DndDescribedBy",c),M=f.useMemo(()=>X.getEnabled(),[X]),Q=Ez(y),{droppableRects:O,measureDroppableContainers:ue,measuringScheduled:ge}=az(M,{dragging:T,dependencies:[Y.x,Y.y],config:Q.droppable}),V=oz(L,D),oe=f.useMemo(()=>ce?zh(ce):null,[ce]),me=fe(),ve=lz(V,Q.draggable.measure);Tz({activeNode:D!=null?L.get(D):null,config:me.layoutShiftCompensation,initialRect:ve,measure:Q.draggable.measure});const ke=Ej(V,Q.draggable.measure,ve),he=Ej(V?V.parentElement:null),Je=f.useRef({activatorEvent:null,active:null,activeNode:V,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:X,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=X.getNodeFor((n=Je.current.over)==null?void 0:n.id),ot=yz({measure:Q.dragOverlay.measure}),G=(s=ot.nodeRef.current)!=null?s:V,Ie=T?(i=ot.rect)!=null?i:ke:null,Se=!!(ot.nodeRef.current&&ot.rect),Oe=dz(Se?null:ke),Xe=tC(G?lr(G):null),_e=fz(T?Ye??V:null),nt=gz(_e),Ke=Cz(b,{transform:{x:Y.x-Oe.x,y:Y.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:ce,active:ne,activeNodeRect:ke,containerNodeRect:he,draggingNodeRect:Ie,over:Je.current.over,overlayNodeRect:ot.rect,scrollableAncestors:_e,scrollableAncestorRects:nt,windowRect:Xe}),gt=oe?da(oe,Y):null,Pt=pz(_e),it=Pj(Pt),ie=Pj(Pt,[ke]),q=da(Ke,it),pe=Ie?O6(Ie,Ke):null,Z=ne&&pe?x({active:ne,collisionRect:pe,droppableRects:O,droppableContainers:M,pointerCoordinates:gt}):null,ye=HN(Z,"id"),[Re,lt]=f.useState(null),te=Se?Ke:da(Ke,ie),be=$6(te,(l=Re==null?void 0:Re.rect)!=null?l:null,ke),$e=f.useRef(null),at=f.useCallback((Be,Fe)=>{let{sensor:Nt,options:$n}=Fe;if(F.current==null)return;const Yt=L.get(F.current);if(!Yt)return;const sn=Be.nativeEvent,Wt=new Nt({active:F.current,activeNode:Yt,event:sn,options:$n,context:Je,onAbort(xt){if(!L.get(xt))return;const{onDragAbort:Rt}=W.current,re={id:xt};Rt==null||Rt(re),E({type:"onDragAbort",event:re})},onPending(xt,jn,Rt,re){if(!L.get(xt))return;const{onDragPending:Qe}=W.current,Ft={id:xt,constraint:jn,initialCoordinates:Rt,offset:re};Qe==null||Qe(Ft),E({type:"onDragPending",event:Ft})},onStart(xt){const jn=F.current;if(jn==null)return;const Rt=L.get(jn);if(!Rt)return;const{onDragStart:re}=W.current,Ae={activatorEvent:sn,active:{id:jn,data:Rt.data,rect:U}};Ts.unstable_batchedUpdates(()=>{re==null||re(Ae),$(ro.Initializing),k({type:bn.DragStart,initialCoordinates:xt,active:jn}),E({type:"onDragStart",event:Ae}),ee($e.current),_(sn)})},onMove(xt){k({type:bn.DragMove,coordinates:xt})},onEnd:Gn(bn.DragEnd),onCancel:Gn(bn.DragCancel)});$e.current=Wt;function Gn(xt){return async function(){const{active:Rt,collisions:re,over:Ae,scrollAdjustedTranslate:Qe}=Je.current;let Ft=null;if(Rt&&Qe){const{cancelDrop:hn}=W.current;Ft={activatorEvent:sn,active:Rt,collisions:re,delta:Qe,over:Ae},xt===bn.DragEnd&&typeof hn=="function"&&await Promise.resolve(hn(Ft))&&(xt=bn.DragCancel)}F.current=null,Ts.unstable_batchedUpdates(()=>{k({type:xt}),$(ro.Uninitialized),lt(null),ee(null),_(null),$e.current=null;const hn=xt===bn.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const Ct=W.current[hn];Ct==null||Ct(Ft),E({type:hn,event:Ft})}})}}},[L]),Me=f.useCallback((Be,Fe)=>(Nt,$n)=>{const Yt=Nt.nativeEvent,sn=L.get($n);if(F.current!==null||!sn||Yt.dndKit||Yt.defaultPrevented)return;const Wt={active:sn};Be(Nt,Fe.options,Wt)===!0&&(Yt.dndKit={capturedBy:Fe.sensor},F.current=$n,at(Nt,Fe))},[L,at]),bt=iz(h,Me);mz(h),ps(()=>{ke&&P===ro.Initializing&&$(ro.Initialized)},[ke,P]),f.useEffect(()=>{const{onDragMove:Be}=W.current,{active:Fe,activatorEvent:Nt,collisions:$n,over:Yt}=Je.current;if(!Fe||!Nt)return;const sn={active:Fe,activatorEvent:Nt,collisions:$n,delta:{x:q.x,y:q.y},over:Yt};Ts.unstable_batchedUpdates(()=>{Be==null||Be(sn),E({type:"onDragMove",event:sn})})},[q.x,q.y]),f.useEffect(()=>{const{active:Be,activatorEvent:Fe,collisions:Nt,droppableContainers:$n,scrollAdjustedTranslate:Yt}=Je.current;if(!Be||F.current==null||!Fe||!Yt)return;const{onDragOver:sn}=W.current,Wt=$n.get(ye),Gn=Wt&&Wt.rect.current?{id:Wt.id,rect:Wt.rect.current,data:Wt.data,disabled:Wt.disabled}:null,xt={active:Be,activatorEvent:Fe,collisions:Nt,delta:{x:Yt.x,y:Yt.y},over:Gn};Ts.unstable_batchedUpdates(()=>{lt(Gn),sn==null||sn(xt),E({type:"onDragOver",event:xt})})},[ye]),ps(()=>{Je.current={activatorEvent:ce,active:ne,activeNode:V,collisionRect:pe,collisions:Z,droppableRects:O,draggableNodes:L,draggingNode:G,draggingNodeRect:Ie,droppableContainers:X,over:Re,scrollableAncestors:_e,scrollAdjustedTranslate:q},U.current={initial:Ie,translated:pe}},[ne,V,Z,pe,L,G,Ie,O,X,Re,_e,q]),nz({...me,delta:Y,draggingRect:pe,pointerCoordinates:gt,scrollableAncestors:_e,scrollableAncestorRects:nt});const Mt=f.useMemo(()=>({active:ne,activeNode:V,activeNodeRect:ke,activatorEvent:ce,collisions:Z,containerNodeRect:he,dragOverlay:ot,draggableNodes:L,droppableContainers:X,droppableRects:O,over:Re,measureDroppableContainers:ue,scrollableAncestors:_e,scrollableAncestorRects:nt,measuringConfiguration:Q,measuringScheduled:ge,windowRect:Xe}),[ne,V,ke,ce,Z,he,ot,L,X,O,Re,ue,_e,nt,Q,ge,Xe]),Gt=f.useMemo(()=>({activatorEvent:ce,activators:bt,active:ne,activeNodeRect:ke,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:L,over:Re,measureDroppableContainers:ue}),[ce,bt,ne,ke,k,R,L,Re,ue]);return nn.createElement(zN.Provider,{value:N},nn.createElement(wf.Provider,{value:Gt},nn.createElement(nC.Provider,{value:Mt},nn.createElement(rC.Provider,{value:be},m)),nn.createElement(Nz,{disabled:(u==null?void 0:u.restoreFocus)===!1})),nn.createElement(T6,{...u,hiddenTextDescribedById:R}));function fe(){const Be=(H==null?void 0:H.autoScrollEnabled)===!1,Fe=typeof p=="object"?p.enabled===!1:p===!1,Nt=T&&!Be&&!Fe;return typeof p=="object"?{...p,enabled:Nt}:{enabled:Nt}}}),Pz=f.createContext(null),Aj="button",Rz="Draggable";function Az(e){let{id:t,data:n,disabled:s=!1,attributes:i}=e;const l=gc(Rz),{activators:c,activatorEvent:u,active:p,activeNodeRect:m,ariaDescribedById:h,draggableNodes:x,over:y}=f.useContext(wf),{role:b=Aj,roleDescription:C="draggable",tabIndex:j=0}=i??{},w=(p==null?void 0:p.id)===t,k=f.useContext(w?rC:Pz),[E,N]=vd(),[P,$]=vd(),T=hz(c,t),D=Ql(n);ps(()=>(x.set(t,{id:t,key:l,node:E,activatorNode:P,data:D}),()=>{const Y=x.get(t);Y&&Y.key===l&&x.delete(t)}),[x,t]);const L=f.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":w&&b===Aj?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,w,C,h.draggable]);return{active:p,activatorEvent:u,activeNodeRect:m,attributes:L,isDragging:w,listeners:s?void 0:T,node:E,over:y,setNodeRef:N,setActivatorNodeRef:$,transform:k}}function Dz(){return f.useContext(nC)}const $z="Droppable",Lz={timeout:25};function Oz(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:i}=e;const l=gc($z),{active:c,dispatch:u,over:p,measureDroppableContainers:m}=f.useContext(wf),h=f.useRef({disabled:n}),x=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:w}={...Lz,...i},k=Ql(j??s),E=f.useCallback(()=>{if(!x.current){x.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},w)},[w]),N=vf({callback:E,disabled:C||!c}),P=f.useCallback((L,Y)=>{N&&(Y&&(N.unobserve(Y),x.current=!1),L&&N.observe(L))},[N]),[$,T]=vd(P),D=Ql(t);return f.useEffect(()=>{!N||!$.current||(N.disconnect(),x.current=!1,N.observe($.current))},[$,N]),f.useEffect(()=>(u({type:bn.RegisterDroppable,element:{id:s,key:l,disabled:n,node:$,rect:y,data:D}}),()=>u({type:bn.UnregisterDroppable,key:l,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:bn.SetDroppableDisabled,id:s,key:l,disabled:n}),h.current.disabled=n)},[s,l,n,u]),{active:c,rect:y,isOver:(p==null?void 0:p.id)===s,node:$,over:p,setNodeRef:T}}function jf(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function Iz(e,t){return e.reduce((n,s,i)=>{const l=t.get(s);return l&&(n[i]=l),n},Array(e.length))}function Iu(e){return e!==null&&e>=0}function _z(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 Mz(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const oC=e=>{let{rects:t,activeIndex:n,overIndex:s,index:i}=e;const l=jf(t,s,n),c=t[i],u=l[i];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},_u={scaleX:1,scaleY:1},iC=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:i,rects:l,overIndex:c}=e;const u=(t=l[n])!=null?t:s;if(!u)return null;if(i===n){const m=l[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,..._u}:null}const p=Fz(l,i,n);return i>n&&i<=c?{x:0,y:-u.height-p,..._u}:i<n&&i>=c?{x:0,y:u.height+p,..._u}:{x:0,y:0,..._u}};function Fz(e,t,n){const s=e[t],i=e[t-1],l=e[t+1];return s?n<t?i?s.top-(i.top+i.height):l?l.top-(s.top+s.height):0:l?l.top-(s.top+s.height):i?s.top-(i.top+i.height):0:0}const aC="Sortable",lC=nn.createContext({activeIndex:-1,containerId:aC,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:oC,disabled:{draggable:!1,droppable:!1}});function cC(e){let{children:t,id:n,items:s,strategy:i=oC,disabled:l=!1}=e;const{active:c,dragOverlay:u,droppableRects:p,over:m,measureDroppableContainers:h}=Dz(),x=gc(aC,n),y=u.rect!==null,b=f.useMemo(()=>s.map(T=>typeof T=="object"&&"id"in T?T.id:T),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,w=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!_z(b,k.current),N=w!==-1&&j===-1||E,P=Mz(l);ps(()=>{E&&C&&h(b)},[E,b,C,h]),f.useEffect(()=>{k.current=b},[b]);const $=f.useMemo(()=>({activeIndex:j,containerId:x,disabled:P,disableTransforms:N,items:b,overIndex:w,useDragOverlay:y,sortedRects:Iz(b,p),strategy:i}),[j,x,P.draggable,P.droppable,N,b,w,p,y,i]);return nn.createElement(lC.Provider,{value:$},t)}const zz=e=>{let{id:t,items:n,activeIndex:s,overIndex:i}=e;return jf(n,s,i).indexOf(t)},Bz=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:i,items:l,newIndex:c,previousItems:u,previousContainerId:p,transition:m}=e;return!m||!s||u!==l&&i===c?!1:n?!0:c!==i&&t===p},Uz={duration:200,easing:"ease"},uC="transform",Vz=ha.Transition.toString({property:uC,duration:0,easing:"linear"}),Hz={roleDescription:"sortable"};function Wz(e){let{disabled:t,index:n,node:s,rect:i}=e;const[l,c]=f.useState(null),u=f.useRef(n);return ps(()=>{if(!t&&n!==u.current&&s.current){const p=i.current;if(p){const m=Ra(s.current,{ignoreTransform:!0}),h={x:p.left-m.left,y:p.top-m.top,scaleX:p.width/m.width,scaleY:p.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,i]),f.useEffect(()=>{l&&c(null)},[l]),l}function dC(e){let{animateLayoutChanges:t=Bz,attributes:n,disabled:s,data:i,getNewIndex:l=zz,id:c,strategy:u,resizeObserverConfig:p,transition:m=Uz}=e;const{items:h,containerId:x,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:w,useDragOverlay:k,strategy:E}=f.useContext(lC),N=Kz(s,b),P=h.indexOf(c),$=f.useMemo(()=>({sortable:{containerId:x,index:P,items:h},...i}),[x,i,P,h]),T=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:D,node:L,isOver:Y,setNodeRef:X}=Oz({id:c,data:$,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...p}}),{active:I,activatorEvent:U,activeNodeRect:ne,attributes:F,setNodeRef:H,listeners:ee,isDragging:ce,over:_,setActivatorNodeRef:W,transform:R}=Az({id:c,data:$,attributes:{...Hz,...n},disabled:N.draggable}),M=h6(X,H),Q=!!I,O=Q&&!C&&Iu(y)&&Iu(w),ue=!k&&ce,ge=ue&&O?R:null,oe=O?ge??(u??E)({rects:j,activeNodeRect:ne,activeIndex:y,overIndex:w,index:P}):null,me=Iu(y)&&Iu(w)?l({id:c,items:h,activeIndex:y,overIndex:w}):P,ve=I==null?void 0:I.id,ke=f.useRef({activeId:ve,items:h,newIndex:me,containerId:x}),he=h!==ke.current.items,Je=t({active:I,containerId:x,isDragging:ce,isSorting:Q,id:c,index:P,items:h,newIndex:ke.current.newIndex,previousItems:ke.current.items,previousContainerId:ke.current.containerId,transition:m,wasDragging:ke.current.activeId!=null}),Ye=Wz({disabled:!Je,index:P,node:L,rect:D});return f.useEffect(()=>{Q&&ke.current.newIndex!==me&&(ke.current.newIndex=me),x!==ke.current.containerId&&(ke.current.containerId=x),h!==ke.current.items&&(ke.current.items=h)},[Q,me,x,h]),f.useEffect(()=>{if(ve===ke.current.activeId)return;if(ve!=null&&ke.current.activeId==null){ke.current.activeId=ve;return}const G=setTimeout(()=>{ke.current.activeId=ve},50);return()=>clearTimeout(G)},[ve]),{active:I,activeIndex:y,attributes:F,data:$,rect:D,index:P,newIndex:me,items:h,isOver:Y,isSorting:Q,isDragging:ce,listeners:ee,node:L,overIndex:w,over:_,setNodeRef:M,setActivatorNodeRef:W,setDroppableNodeRef:X,setDraggableNodeRef:H,transform:Ye??oe,transition:ot()};function ot(){if(Ye||he&&ke.current.newIndex===P)return Vz;if(!(ue&&!Px(U)||!m)&&(Q||Je))return ha.Transition.toString({...m,property:uC})}}function Kz(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 Sd(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 qz=[ht.Down,ht.Right,ht.Up,ht.Left],Gz=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:i,droppableContainers:l,over:c,scrollableAncestors:u}}=t;if(qz.includes(e.code)){if(e.preventDefault(),!n||!s)return;const p=[];l.getEnabled().forEach(x=>{if(!x||x!=null&&x.disabled)return;const y=i.get(x.id);if(y)switch(e.code){case ht.Down:s.top<y.top&&p.push(x);break;case ht.Up:s.top>y.top&&p.push(x);break;case ht.Left:s.left>y.left&&p.push(x);break;case ht.Right:s.left<y.left&&p.push(x);break}});const m=R6({collisionRect:s,droppableRects:i,droppableContainers:p});let h=HN(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const x=l.get(n.id),y=l.get(h),b=y?i.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&x&&y){const w=xf(C).some((T,D)=>u[D]!==T),k=fC(x,y),E=Yz(x,y),N=w||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},P={x:b.left,y:b.top};return N.x&&N.y?P:Zl(P,N)}}}};function fC(e,t){return!Sd(e)||!Sd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Yz(e,t){return!Sd(e)||!Sd(t)||!fC(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Jz({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",i=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:l=>t(l.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:l=>t(l.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":i})]})}const Hh=["projects","playbooks","todos","servers","config"];function Xz(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Hh.includes(n)&&t.add(n);return t}function Dj(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function Qz(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[i,l]=f.useState(""),[c,u]=f.useState(new Set(Hh)),[p,m]=f.useState(!1),[h,x]=f.useState(!1),[y,b]=f.useState(null),[C,j]=f.useState(null),w=f.useCallback(async()=>{try{const T=await fetch("/api/backup");if(!T.ok)throw new Error(`HTTP ${T.status}`);const D=await T.json();s(D),l(D.repo??""),u(Xz(D.categories)),m(!1)}catch(T){j({type:"error",message:`Failed to load backup config: ${T instanceof Error?T.message:String(T)}`})}finally{t(!1)}},[]);f.useEffect(()=>{w()},[w]);function k(T){u(D=>{const L=new Set(D);return L.has(T)?L.delete(T):L.add(T),L}),m(!0)}async function E(){x(!0),j(null);try{const T=Array.from(c),D=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:i.trim()||null,categories:T})}),L=await D.json();if(!D.ok)throw new Error(L.error||`HTTP ${D.status}`);s(L),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(T){j({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{x(!1)}}async function N(){b("push"),j(null);try{const T=await fetch("/api/backup/push",{method:"POST"}),D=await T.json();if(!T.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${T.status}`);j({type:"success",message:D.message||"Backup complete."}),await w()}catch(T){j({type:"error",message:`Backup failed: ${T instanceof Error?T.message:String(T)}`})}finally{b(null)}}async function P(){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 D=await fetch("/api/backup/pull",{method:"POST"}),L=await D.json();if(!D.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${D.status}`);j({type:"success",message:L.message||"Restore complete."}),await w()}catch(D){j({type:"error",message:`Restore failed: ${D instanceof Error?D.message:String(D)}`})}finally{b(null)}}}if(e)return r.jsx(We,{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 $=!!i.trim()&&c.size>0&&!y&&!p;return r.jsx(We,{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:i,onChange:T=>{l(T.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:Hh.map(T=>{const D=c.has(T);return r.jsxs("button",{type:"button",onClick:()=>k(T),className:`shell-action text-xs ${D?"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 ${D?"bg-primary":"bg-muted-foreground/40"}`}),T]},T)})})]}),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: "}),Dj((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),Dj((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||!p,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:N,disabled:!$,title:$?"Back up now":p?"Save config first":"Set repo and pick categories",children:[r.jsx(TP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:P,disabled:!$,title:$?"Restore from backup":p?"Save config first":"Set repo and pick categories",children:[r.jsx(oP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),p&&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(rP,{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 Zz({open:e,affected:t,remaining:n,onResolve:s,onCancel:i}){var j;const[l,c]=f.useState(n.length>0?"remap":"delete"),[u,p]=f.useState(((j=n[0])==null?void 0:j.id)??""),[m,h]=f.useState(!1);f.useEffect(()=>{var w;e&&(c(n.length>0?"remap":"delete"),p(((w=n[0])==null?void 0:w.id)??""),h(!1))},[e,n]);const x=l==="remap"&&n.length>0&&u!==""&&u!==t.id||l==="delete"&&m;function y(){x&&s(l==="remap"?{id:t.id,mode:"remap",target:u}:{id:t.id,mode:"delete"})}const b=t.assignments.slice(0,10),C=t.count-b.length;return r.jsx(ir,{open:e,onOpenChange:w=>w?void 0:i(),children:r.jsxs(Kn,{className:"max-w-xl",children:[r.jsxs(Qr,{children:[r.jsxs(qn,{children:['Delete status "',t.label,'" — ',t.count," assignment",t.count===1?"":"s"," reference it"]}),r.jsx(hs,{children:"Choose how to resolve the affected assignments before this status is removed from the workflow."})]}),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:[b.map(w=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:w.display})},`${w.projectSlug??"standalone"}/${w.assignmentSlug}`)),C>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),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:l==="remap",onChange:()=>c("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:"Remap to another status"}),r.jsxs("select",{value:u,onChange:w=>p(w.target.value),onClick:()=>c("remap"),disabled:l!=="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(w=>r.jsxs("option",{value:w.id,children:[w.label," (",w.id,")"]},w.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:l==="delete",onChange:()=>c("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:"Delete these assignments"}),r.jsxs("span",{className:"block text-xs text-muted-foreground mt-1",children:["Permanently removes ",t.count," assignment",t.count===1?"":"s"," from disk. This cannot be undone."]}),l==="delete"&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:w=>h(w.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs($s,{children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:y,disabled:!x,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?`Remap ${t.count} → ${u||"..."}`:`Delete ${t.count}`})]})]})})}function eB(e){const t=Array.from(e.pendingResolutions.values());return{body:{statuses:e.statuses.map(s=>({id:s.id,label:s.label,...s.description?{description:s.description}:{},...s.color?{color:s.color}:{},...s.terminal?{terminal:!0}:{}})),order:e.order,transitions:[],resolutions:t},resolutions:t}}function tB(e,t){const n=new Map;t.forEach((i,l)=>{n.has(i)||n.set(i,l)});const s=t.length;return e.map((i,l)=>({s:i,originalIndex:l,r:n.get(i.id)??s})).sort((i,l)=>i.r-l.r||i.originalIndex-l.originalIndex).map(i=>i.s)}function $j(e,t){const n=new Map;for(const[s,i]of e.entries())t.has(i.id)||i.mode==="remap"&&!t.has(i.target)||n.set(s,i);return n}function nB(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:i,unbindAction:l}=po(),[c,u]=f.useState(null),[p,m]=f.useState(null),[h,x]=f.useState(!1),y=Object.values(t).some(N=>typeof N=="string"&&N.length>0);function b(N,P){m({type:N,message:P}),setTimeout(()=>m(null),2500)}function C(N){u({kind:N,combo:null,conflict:null,saving:!1,error:null})}function j(N){if(!c||N.key==="Escape")return;if(N.key==="Enter"&&c.combo){N.preventDefault(),w();return}if(N.key==="Enter")return;N.preventDefault(),N.stopPropagation();const P=U0(N.nativeEvent);if(!P)return;const $=s(P,c.kind);u({...c,combo:P,conflict:$,error:null})}async function w(){var N;if(c!=null&&c.combo){if((N=c.conflict)!=null&&N.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await i(c.kind,c.combo),u(null),b("success",`Bound ${xl[c.kind]}`)}catch(P){u({...c,saving:!1,error:P instanceof Error?P.message:"Failed to save"})}}}async function k(N){try{await l(N),b("success",`Cleared ${xl[N]} binding`)}catch(P){b("error",P instanceof Error?P.message:"Failed to clear binding")}}async function E(){if(!h){x(!0);try{await G3(),b("success","All hotkey bindings cleared")}catch(N){b("error",N instanceof Error?N.message:"Failed to reset bindings")}finally{x(!1)}}}return r.jsxs(We,{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(io,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[p?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}):null,r.jsx("ul",{className:"space-y-2",children:Fd.map(N=>{var L,Y;const P=n.find(X=>X.bindableKind===N),$=e[N],T=typeof t[N]=="string"&&!!t[N],D=(c==null?void 0:c.kind)===N;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(dh,{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:(P==null?void 0:P.title)??xl[N]}),P!=null&&P.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:P.subtitle}):null]}),$?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:us($)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${T?"text-primary":"text-muted-foreground"}`,children:T?"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(N),children:$?"Rebind":"Bind"}),T?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(N),"aria-label":`Restore default ${xl[N]} binding`,children:[r.jsx(_d,{className:"h-3 w-3"}),"Restore default"]}):null]}),D?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)===N&&!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:us(c.combo)}),(L=c.conflict)!=null&&L.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(Y=c.conflict)!=null&&Y.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',xl[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]},N)})})]})}const rB={kanban:"Kanban",list:"List",table:"Table"},sB={comfortable:"Comfortable",compact:"Compact"},oB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},iB={asc:"Ascending",desc:"Descending"};function aB(){const e=H5(),t=e.global,[n,s]=f.useState(!1),[i,l]=f.useState(null);function c(m,h){l({type:m,message:h}),setTimeout(()=>l(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await uN({[m]:h}),c("success","Saved")}catch(x){c("error",x instanceof Error?x.message:"Failed to save")}finally{s(!1)}}}async function p(){if(e.custom){s(!0);try{await W5(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(We,{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:p,disabled:n,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[i&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.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:Rg.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:rB[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:AD.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:sB[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:tS.map(m=>r.jsx("option",{value:m,children:oB[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:RD.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:iB[m]},m))})]})]})]})}const lB=/^[a-z0-9][a-z0-9_-]*$/,pC=["first","last","none"];class mC extends Error{constructor(n,s){super(n);Xb(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Dx={agents:[],custom:!1};let Xi=null,Ki=null,Nd=0;const Wh=new Set;function hC(e){Xi=e;for(const t of Wh)t(e)}function cB(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"&&pC.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),n}function $x(e){if(!e||typeof e!="object")return Dx;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const i of n){const l=cB(i);l&&s.push(l)}return{agents:s,custom:t.custom===!0}}function uB(){if(Xi)return Promise.resolve(Xi);if(Ki)return Ki;const e=++Nd;return Ki=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Ki=null;const n=$x(t);return e!==Nd?Xi??n:(Xi=n,n)}).catch(()=>(Ki=null,Dx)),Ki}function dB(){const[e,t]=f.useState(()=>Xi??Dx);return f.useEffect(()=>{let n=!1;return uB().then(s=>{n||t(s)}),Wh.add(t),()=>{n=!0,Wh.delete(t)}},[]),e}async function gC(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new mC(n,t==null?void 0:t.fieldErrors)}async function fB(e){++Nd;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await gC(t);const n=$x(await t.json());return hC(n),n}async function pB(){++Nd;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await gC(e);const t=$x(await e.json());return hC(t),t}const mB={first:"first",last:"last",none:"none"};function xC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Nl(e){return e.map(t=>({rowKey:xC(),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,fieldErrors:{}}))}function hB(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),n})}function gB(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 xB(e,t){return!t||t.length===0?e:e.map((n,s)=>{const i={};for(const l of t){if(l.index!==void 0){l.index===s&&(i[l.field]=l.message);continue}if(l.id!==void 0){l.id===n.id&&(i[l.field]=l.message);continue}i[l.field]=l.message}return{...n,fieldErrors:i}})}function yB(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function bB(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],i=t[n];if(s.id!==i.id||s.label!==i.label||s.command!==i.command||s.argsText!==i.argsText||s.promptArgPosition!==i.promptArgPosition||s.resolveFromShellAliases!==i.resolveFromShellAliases||s.default!==i.default)return!1}return!0}function vB({row:e,index:t,canRemove:n,onPatch:s,onSetDefault:i,onRemove:l}){const{attributes:c,listeners:u,setNodeRef:p,setActivatorNodeRef:m,transform:h,transition:x,isDragging:y}=dC({id:e.rowKey}),b={transform:ha.Transform.toString(h),transition:x,zIndex:y?50:void 0,position:y?"relative":void 0};function C(k){const E={label:k};if(e.autoSlugFromLabel){const N=mr(k);N&&lB.test(N)?E.id=N:E.id=`agent-${t+1}`}s(E)}function j(k){s({id:k,autoSlugFromLabel:!1})}const w=k=>e.fieldErrors[k]?"border-error-foreground/60":"";return r.jsxs("div",{ref:p,style:b,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:m,...c,...u,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(u0,{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:k=>j(k.target.value),className:`editor-input w-32 font-mono text-xs ${w("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:l,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(or,{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:k=>C(k.target.value),className:`editor-input mt-0.5 w-full ${w("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:k=>s({command:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("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:k=>s({argsText:k.target.value}),className:`editor-input mt-0.5 w-full font-mono ${w("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:k=>s({promptArgPosition:k.target.value}),className:`editor-input mt-0.5 w-full ${w("promptArgPosition")}`,children:pC.map(k=>r.jsx("option",{value:k,children:mB[k]},k))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),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:k=>s({resolveFromShellAliases:k.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 wB(){const e=dB(),[t,n]=f.useState(()=>Nl(e.agents)),[s,i]=f.useState(()=>Nl(e.agents)),[l,c]=f.useState(!1),[u,p]=f.useState(null),[m,h]=f.useState(null);f.useEffect(()=>{const T=Nl(e.agents);n(T),i(T),p(null)},[e.agents]);const x=f.useMemo(()=>!bB(t,s),[t,s]),y=BN(jd(bf,{activationConstraint:{distance:8}}),jd(yf));function b(T,D){h({type:T,message:D}),setTimeout(()=>h(null),2500)}function C(T,D){n(L=>L.map(Y=>Y.rowKey===T?{...Y,...D,fieldErrors:jB(Y.fieldErrors,D)}:Y))}function j(T){n(D=>D.map(L=>({...L,default:L.rowKey===T})))}function w(){n(T=>{const D=new Set(T.map(ne=>ne.id)),L="new-agent";let Y=L,X=1;for(;D.has(Y);)X+=1,Y=`${L}-${X}`;const I=X===1?"New Agent":`New Agent ${X}`,U={rowKey:xC(),id:Y,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:I,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,fieldErrors:{}};return[...T,U]})}function k(T){n(D=>D.filter(L=>L.rowKey!==T))}async function E(){c(!0),p(null);try{const T=gB(t),D=hB(T),L=await fB(D),Y=Nl(L.agents);n(Y),i(Y),b("success","Agents saved")}catch(T){if(T instanceof mC)p(T.message),n(D=>xB(yB(D),T.fieldErrors)),b("error",T.message);else{const D=T instanceof Error?T.message:"Failed to save";p(D),b("error",D)}}finally{c(!1)}}function N(){n(s),p(null)}async function P(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){c(!0),p(null);try{const T=await pB(),D=Nl(T.agents);n(D),i(D),b("success","Reset to defaults")}catch(T){const D=T instanceof Error?T.message:"Failed to reset";p(D),b("error",D)}finally{c(!1)}}}function $(T){const{active:D,over:L}=T;!L||D.id===L.id||n(Y=>{const X=Y.findIndex(U=>U.rowKey===D.id),I=Y.findIndex(U=>U.rowKey===L.id);return X===-1||I===-1?Y:jf(Y,X,I)})}return r.jsxs(We,{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:P,disabled:l,children:[r.jsx(io,{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(rg,{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"}),"."]})]}),m&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${m.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:m.message}),u&&(!m||m.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:u}),r.jsx(sC,{sensors:y,collisionDetection:WN,onDragEnd:$,children:r.jsx(cC,{items:t.map(T=>T.rowKey),strategy:iC,children:r.jsx("div",{className:"space-y-2",children:t.map((T,D)=>r.jsx(vB,{row:T,index:D,canRemove:t.length>1,onPatch:L=>C(T.rowKey,L),onSetDefault:()=>j(T.rowKey),onRemove:()=>k(T.rowKey)},T.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:w,disabled:l,className:"shell-action text-xs",children:[r.jsx(rn,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:!x||l,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:E,disabled:!x||l,className:"shell-action text-xs",children:[r.jsx(Id,{className:"h-3 w-3"}),"Save"]})]})]})]})}function jB(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,n}const yC=["terminal-app","iterm","ghostty","alacritty","warp","kitty"],Cd={terminal:"terminal-app",custom:!1};let Qi=null,qi=null,Ed=0;const Kh=new Set;function bC(e){Qi=e;for(const t of Kh)t(e)}function Lx(e){if(!e||typeof e!="object")return Cd;const t=e;return{terminal:typeof t.terminal=="string"&&yC.includes(t.terminal)?t.terminal:Cd.terminal,custom:t.custom===!0}}function kB(){if(Qi)return Promise.resolve(Qi);if(qi)return qi;const e=++Ed;return qi=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{qi=null;const n=Lx(t);return e!==Ed?Qi??n:(Qi=n,n)}).catch(()=>(qi=null,Cd)),qi}function SB(){const[e,t]=f.useState(()=>Qi??Cd);return f.useEffect(()=>{let n=!1;return kB().then(s=>{n||t(s)}),Kh.add(t),()=>{n=!0,Kh.delete(t)}},[]),e}async function NB(e){++Ed;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=Lx(await t.json());return bC(n),n}async function CB(){++Ed;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=Lx(await e.json());return bC(t),t}const Mu={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty"};function EB(){const{terminal:e,custom:t}=SB(),[n,s]=f.useState(!1),[i,l]=f.useState(null);function c(m){l(m),setTimeout(()=>l(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await NB(m),c({type:"success",message:`Terminal set to ${Mu[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function p(){s(!0);try{const m=await CB();c({type:"success",message:`Reset to OS default (${Mu[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(We,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${Mu[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:p,disabled:n,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[i&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.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:yC.map(m=>r.jsx("option",{value:m,children:Mu[m]},m))})]})]})}function Cl(e){return e===ld?"Ungrouped":e}function TB(){const{data:e,loading:t,error:n,refetch:s}=oc(),{hidden:i,custom:l,loading:c,error:u,reload:p}=Ok(),[m,h]=f.useState(!1),[x,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[ld]:[]]:[];async function j(k,E){const N=E?i.filter(P=>P!==k):[...i,k];h(!0);try{await sD(N),b({type:"success",message:E?`Showing "${Cl(k)}" in the left nav.`:`Hiding "${Cl(k)}" from the left nav.`})}catch(P){b({type:"error",message:P instanceof Error?P.message:"Save failed."})}finally{h(!1)}}async function w(){h(!0);try{await oD(),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(We,{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:l?r.jsxs("button",{className:"shell-action text-xs",onClick:w,disabled:m,type:"button",children:[r.jsx(io,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[x&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${x.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:x.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&&p()},children:[r.jsx(io,{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=!tD(k,i);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:Cl(k),children:[Cl(k),k===ld&&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 "${Cl(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 vC(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function oh(e){const t=e.statuses.map(n=>({rowKey:vC(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return tB(t,e.order)}function PB({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:i,listeners:l,setNodeRef:c,setActivatorNodeRef:u,transform:p,transition:m,isDragging:h}=dC({id:e.rowKey}),x={transform:ha.Transform.toString(p),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:x,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,...i,...l,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(u0,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Pr,{children:[r.jsx(Rr,{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(gr,{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(Jz,{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(Pr,{children:[r.jsx(Rr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(gr,{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(or,{className:"h-3.5 w-3.5"})})]})}function RB(){var ge;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[i,l]=f.useState(!1),[c,u]=f.useState([]),[p,m]=f.useState(!1),[h,x]=f.useState(null),[y,b]=f.useState(!1),[C,j]=f.useState(new Set),[w,k]=f.useState(new Map),[E,N]=f.useState({open:!1}),P=BN(jd(bf,{activationConstraint:{distance:8}}),jd(yf,{coordinateGetter:Gz})),{preset:$,setPreset:T,resetPreset:D}=ug(),[L,Y]=f.useState(!1),[X,I]=f.useState(null);async function U(V){if(!(V===$||L)){Y(!0),I(null);try{await T(V),I({type:"success",message:"Theme updated"}),setTimeout(()=>I(null),2e3)}catch(oe){I({type:"error",message:oe instanceof Error?oe.message:"Failed to save theme"})}finally{Y(!1)}}}async function ne(){Y(!0),I(null);try{await D(),I({type:"success",message:"Theme reset to default"}),setTimeout(()=>I(null),2e3)}catch(V){I({type:"error",message:V instanceof Error?V.message:"Failed to reset theme"})}finally{Y(!1)}}const F=f.useCallback(async()=>{try{const V=await fetch("/api/config/statuses");if(!V.ok)throw new Error(`HTTP ${V.status}`);const oe=await V.json(),me=oh(oe);u(me),l(oe.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),s(null)}catch(V){s(V instanceof Error?V.message:"Failed to load config")}finally{t(!1)}},[]);f.useEffect(()=>{F()},[F]);function H(){setTimeout(()=>x(null),3e3)}async function ee(){m(!0),x(null);try{const{body:V}=eB({statuses:c,order:c.map(he=>he.id),pendingResolutions:w}),oe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V)});if(!oe.ok){const he=await oe.json().catch(()=>null);if(oe.status===409&&(he==null?void 0:he.error)==="unresolved-orphans"){const Je=Array.isArray(he.unresolved)?he.unresolved.map(Ye=>Ye.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Je}. Click the trash icon on each row to choose remap or delete.`)}if(oe.status===409&&(he==null?void 0:he.error)==="concurrent-edit"){const Je=he.applied?` (${he.applied.remapped} remapped, ${he.applied.deleted} deleted before the conflict)`:"";x({type:"error",message:`Concurrent edit detected${Je}: ${he.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await F();return}if(oe.status===500&&(he==null?void 0:he.error)==="config-write-failed"&&(he!=null&&he.applied)){const{remapped:Je,deleted:Ye}=he.applied,ot=he.message?`: ${he.message}`:"";x({type:"error",message:`Resolutions applied (${Je} remapped, ${Ye} deleted) but the status config write failed${ot}. Click Save again to retry.`}),await F();return}throw(he==null?void 0:he.error)==="invalid-remap-target"?new Error(`Invalid remap target (${he.reason}): ${he.id} → ${he.target}.`):(he==null?void 0:he.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(he.ids??[]).join(", ")}`):(he==null?void 0:he.error)==="stale-resolution"?new Error(`Stale resolution for id "${he.id??"?"}".`):(he==null?void 0:he.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${he.message??"unknown"}`):(he==null?void 0:he.error)==="remap-write-failed"||(he==null?void 0:he.error)==="delete-failed"||(he==null?void 0:he.error)==="scan-failed"?new Error(`${he.error}: ${he.cause??"unknown"}`):new Error((he==null?void 0:he.error)??`Save failed (HTTP ${oe.status})`)}const me=await oe.json(),ve=oh(me);u(ve),l(me.custom),j(new Set(ve.map(he=>he.id))),k(new Map),b(!1),ew();const ke=me.applied?` (${me.applied.remapped} remapped, ${me.applied.deleted} deleted)`:"";x({type:"success",message:`Status config saved${ke}`}),H()}catch(V){x({type:"error",message:V instanceof Error?V.message:"Save failed"})}finally{m(!1)}}async function ce(){m(!0),x(null);try{const V=await fetch("/api/config/statuses",{method:"DELETE"});if(!V.ok)throw new Error("Reset failed");const oe=await V.json(),me=oh(oe);u(me),l(oe.custom),j(new Set(me.map(ve=>ve.id))),k(new Map),b(!1),ew(),x({type:"success",message:"Reset to defaults"}),H()}catch(V){x({type:"error",message:V instanceof Error?V.message:"Reset failed"})}finally{m(!1)}}function _(V,oe,me){u(ve=>{const ke=[...ve];return ke[V]={...ke[V],[oe]:me},ke}),b(!0)}function W(){const V=`status_${c.length+1}`;u(oe=>[...oe,{rowKey:vC(),id:V,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function R(V){u(oe=>{const me=oe.filter(ke=>ke.id!==V),ve=new Set(me.map(ke=>ke.id));return k(ke=>$j(ke,ve)),me}),b(!0)}async function M(V){const oe=c[V].id;if(!C.has(oe)){R(oe);return}try{const me=await fetch(`/api/config/statuses/affected/${encodeURIComponent(oe)}`);if(!me.ok)throw new Error(`HTTP ${me.status}`);const ve=await me.json();if(ve.count===0){R(oe);return}N({open:!0,affected:ve,pendingId:oe})}catch(me){x({type:"error",message:`Could not check affected assignments for "${oe}": ${me instanceof Error?me.message:String(me)}`})}}function Q(V){if(!E.open)return;const{pendingId:oe}=E;if(oe!==V.id){N({open:!1});return}if(!c.some(me=>me.id===oe)){x({type:"error",message:`Row for "${oe}" was already removed — modal action ignored.`}),N({open:!1});return}u(me=>{const ve=me.filter(he=>he.id!==oe),ke=new Set(ve.map(he=>he.id));return k(he=>{const Je=$j(he,ke),Ye=new Map(Je);return Ye.set(oe,V),Ye}),ve}),b(!0),N({open:!1})}function O(){N({open:!1})}function ue(V){const{active:oe,over:me}=V;!me||oe.id===me.id||(u(ve=>{const ke=ve.findIndex(Je=>Je.rowKey===oe.id),he=ve.findIndex(Je=>Je.rowKey===me.id);return ke===-1||he===-1?ve:jf(ve,ke,he)}),b(!0))}return e?r.jsx(mt,{label:"Loading settings..."}):n?r.jsx(wt,{error:n}):r.jsx(Wo,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(We,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:$!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:ne,disabled:L,children:[r.jsx(io,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[X&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${X.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:X.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:E0.map(V=>{const oe=V.slug===$;return r.jsxs("button",{type:"button",onClick:()=>U(V.slug),disabled:L,"aria-pressed":oe,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${oe?"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:V.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:V.swatches.amber}}),oe&&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(uo,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:V.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:V.description})]})]},V.slug)})})]}),r.jsx(nB,{}),r.jsx(EB,{}),r.jsx(TB,{}),r.jsx(wB,{}),r.jsx(aB,{}),r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${i?"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(rg,{className:"h-4 w-4"}),i?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:ce,disabled:p||!i&&!y,children:[r.jsx(io,{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(We,{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:W,children:[r.jsx(rn,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(sC,{sensors:P,collisionDetection:WN,onDragEnd:ue,children:r.jsx(cC,{items:c.map(V=>V.rowKey),strategy:iC,children:r.jsx("div",{className:"space-y-2",children:c.map((V,oe)=>r.jsx(PB,{row:V,isSaved:C.has(V.id),onUpdate:(me,ve)=>_(oe,me,ve),onRemove:()=>M(oe)},V.rowKey))})})})}),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",onClick:ee,disabled:p||!y,children:[r.jsx(Id,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),F()},disabled:p,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]})]}),r.jsx(Qz,{}),E.open&&r.jsx(Zz,{open:E.open,affected:{...E.affected,label:((ge=c.find(V=>V.id===E.affected.id))==null?void 0:ge.label)??E.affected.id},remaining:c.filter(V=>V.id!==E.affected.id&&C.has(V.id)).map(V=>({id:V.id,label:V.label})),onResolve:Q,onCancel:O})]})})}const Es=e=>`${e.workspace}::${e.id}`;function Lj(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function AB(){var lt;const{data:e,loading:t,error:n,refetch:s}=V0(),i=Dt(),[l,c]=f.useState(""),u=f.useRef(null);mo("list:todos");const[p,m]=f.useState(""),[h,x]=f.useState(""),[y,b]=f.useState(""),[C,j]=f.useState("_global"),[w,k]=f.useState(null),[E,N]=f.useState(null),[P,$]=f.useState(new Set),[T,D]=f.useState(!1),L=f.useRef(null),[Y,X]=f.useState(null),I=hx("all"),[U,ne]=f.useState(null),[F,H]=f.useState(null),ee=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const $e=await be.json();te||X($e.filter(at=>!at.archived))}catch{}})(),()=>{te=!0}},[]);function ce(te,be){te.stopPropagation(),navigator.clipboard.writeText(be),k(be),setTimeout(()=>k($e=>$e===be?null:$e),1500)}const _=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const be of e.workspaces)for(const $e of be.items)te.push({...$e,workspace:be.workspace});return te},[e]),W=f.useMemo(()=>{const te=new Set;for(const be of _)for(const $e of be.tags)te.add($e);return Array.from(te).sort()},[_]),R=f.useMemo(()=>{let te=_;if(l.trim()){const be=l.toLowerCase();te=te.filter($e=>$e.description.toLowerCase().includes(be)||$e.tags.some(at=>at.toLowerCase().includes(be))||$e.id.includes(be))}return p&&(te=te.filter(be=>be.status===p)),h&&(te=te.filter(be=>be.tags.includes(h))),te},[_,l,p,h]);f.useEffect(()=>{$(new Set),L.current=null},[l,p,h]);const M=f.useMemo(()=>R.filter(te=>P.has(Es(te))),[R,P]),Q=R.length>0&&M.length===R.length,O=M.length>0&&!Q,ue=f.useMemo(()=>{if(M.length===0)return null;const te=new Set(M.map(be=>be.workspace));return te.size===1?[...te][0]:null},[M]),ge=f.useMemo(()=>{if(!ue||!Y)return;const te=Y.filter(be=>be.workspace===ue);return te.length===1?te[0].slug:void 0},[ue,Y]),V=((lt=M[0])==null?void 0:lt.description)??"",oe=f.useMemo(()=>{if(ue)return null;const te=new Map;for(const be of M)te.has(be.workspace)||te.set(be.workspace,[]),te.get(be.workspace).push(be.id);return Array.from(te,([be,$e])=>({workspace:be,todoIds:$e}))},[M,ue]),me=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:oe??[]};function ve(te,be,$e){const at=Es(te),Me=!!($e&&"shiftKey"in $e&&$e.shiftKey),bt=L.current?nt.findIndex(Mt=>Es(Mt)===L.current):-1;if(Me&&bt!==-1){const Mt=Math.min(bt,be),Gt=Math.max(bt,be);$(fe=>{const Be=new Set(fe);for(let Fe=Mt;Fe<=Gt;Fe++){const Nt=nt[Fe];Nt&&Be.add(Es(Nt))}return Be})}else $(Mt=>{const Gt=new Set(Mt);return Gt.has(at)?Gt.delete(at):Gt.add(at),Gt});L.current=at}function ke(){$(te=>{const be=new Set(te);if(Q)for(const $e of R)be.delete(Es($e));else for(const $e of R)be.add(Es($e));return be})}function he(){$(new Set),L.current=null}function Je(te){he(),s(),te!=null&&te.assignmentRef&&i(Lj(te.assignmentRef))}const Ye=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const te={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)te.open+=be.counts.open,te.in_progress+=be.counts.in_progress,te.completed+=be.counts.completed,te.blocked+=be.counts.blocked,te.total+=be.counts.total;return te},[e]);async function ot(){y.trim()&&(await fg(C,y.trim()),b(""),s())}async function G(te,be,$e){switch($e){case"open":await q0(te,be);break;case"in_progress":await K0(te,be);break;case"completed":await H0(te,be);break;case"blocked":await W0(te,be);break}s()}async function Ie(te,be){await G0(te,be),s()}async function Se(te,be,$e){await Y0(te,be,$e),s()}async function Oe(te,be,$e){await J0(te,be,$e),s()}async function Xe(te,be,$e){await X0(te,be,$e),s()}const _e=mx(R),nt=_e.filter(te=>!I.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Ke}=ic(nt,{scope:"list:todos",bindO:!1,onOpen:te=>N(Es(te))});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var te;return(te=u.current)==null?void 0:te.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[gt,Pt]=ms(),it=gt.get("focus");f.useEffect(()=>{if(!it)return;const te=_.find($e=>$e.id===it);if(!te)return;const be=cf(te.status);I.isCollapsed(be)&&I.toggle(be)},[it,_]),f.useEffect(()=>{if(!it)return;const te=document.querySelector(`[data-todo-id="${CSS.escape(it)}"]`);if(!te)return;te.scrollIntoView({block:"nearest"}),te.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{te.classList.remove("ring-2","ring-primary/60"),Pt($e=>{const at=new URLSearchParams($e);return at.delete("focus"),at})},1500);return()=>window.clearTimeout(be)},[it,nt.length,Pt]);const ie=U?R.find(te=>Es(te)===U)??null:null;function q(te,be){const $e=ee.current;if($e!=null&&$e.closest(ma)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",be),ne(be)}function pe(){ne(null),H(null)}function Z(te,be){!ie||be.statuses.includes(ie.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",H(be.id))}function ye(te,be){F===be.id&&!te.currentTarget.contains(te.relatedTarget)&&H(null)}function Re(te,be){te.preventDefault();const $e=ie;pe(),!(!$e||be.statuses.includes($e.status))&&G($e.workspace,$e.id,be.dropStatus)}return t?r.jsx(mt,{label:"Loading todos..."}):n?r.jsx(wt,{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(An,{label:"Open",value:Ye.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:Ye.in_progress,icon:sg,tone:"info"}),r.jsx(An,{label:"Blocked",value:Ye.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Completed",value:Ye.completed,icon:Ar,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:te=>j(te.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(te=>te.workspace!=="_global").map(te=>r.jsx("option",{value:te.workspace,children:te.workspace},te.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:te=>b(te.target.value),onKeyDown:te=>te.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(rn,{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(fo,{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:l,onChange:te=>c(te.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:p,onChange:te=>m(te.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"})]}),W.length>0&&r.jsxs("select",{value:h,onChange:te=>x(te.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"}),W.map(te=>r.jsxs("option",{value:te,children:["#",te]},te))]})]}),M.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:[M.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(M.map(te=>te.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>D(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:he,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,R.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:Q,ref:te=>{te&&(te.indeterminate=O)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",R.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let te=-1;return _e.map(({config:be,items:$e})=>{const at=!I.isCollapsed(be.id);return r.jsx(px,{label:be.label,count:$e.length,expanded:at,onToggle:()=>I.toggle(be.id),isDropTarget:F===be.id,onDragOver:Me=>Z(Me,be),onDragLeave:Me=>ye(Me,be),onDrop:Me=>Re(Me,be),children:at&&$e.map(Me=>{te+=1;const bt=te,Mt=Es(Me),Gt=P.has(Mt);return r.jsxs("div",{draggable:!0,"data-todo-id":Me.id,...Ke(bt),onMouseDown:fe=>{ee.current=fe.target},onDragStart:fe=>q(fe,Mt),onDragEnd:pe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${Gt?"ring-1 ring-foreground/20":""} ${U===Mt?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Me.id}`,title:"Select",checked:Gt,onChange:()=>{},onClick:fe=>{fe.stopPropagation(),ve(Me,bt,fe)},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(X1,{status:Me.status,onChange:fe=>G(Me.workspace,Me.id,fe)})}),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(Z1,{description:Me.description,status:Me.status,editing:E===Mt,onBeginEdit:()=>N(Mt),onEndEdit:()=>N(null),onSave:fe=>Se(Me.workspace,Me.id,fe)}),Me.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Me.tags.map(fe=>`#${fe}`).join(" ")}),Me.linkedAssignmentRef?r.jsxs(Ce,{to:Lj(Me.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:fe=>fe.stopPropagation(),children:[r.jsx(o0,{className:"h-2.5 w-2.5"}),Me.linkedAssignmentRef.includes("/")?Me.linkedAssignmentRef:`oneoff:${Me.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(eN,{item:Me,attachmentUrl:(fe,Be)=>pg(Me.workspace,fe,Be),onAdd:fe=>Oe(Me.workspace,Me.id,fe),onDelete:fe=>Xe(Me.workspace,Me.id,fe)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Me.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${Me.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:fe=>fe.stopPropagation(),children:Me.workspace})}),w===Me.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(uo,{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:fe=>ce(fe,Me.id),children:["t:",Me.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:fe=>ce(fe,Me.id),children:r.jsx(rd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:fe=>{fe.stopPropagation(),Ie(Me.workspace,Me.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Me.workspace}-${Me.id}`)})},be.id)})})()}),r.jsx(fx,{open:T,selectedIds:M.map(te=>te.id),scope:me,onOpenChange:D,onDone:Je,defaultProject:ge,defaultTitle:V,allowOneOff:!0})]})}const DB={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 $B({bundle:e}){const t=DB[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 LB({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($B,{bundle:n},n.id))]})}function OB(e){const[t,n]=f.useState(null),[s,i]=f.useState(!0),[l,c]=f.useState(null),u=f.useCallback(async()=>{try{const p=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!p.ok)throw new Error(`HTTP ${p.status}`);n(await p.json()),c(null)}catch(p){c(p instanceof Error?p.message:"Failed to fetch bundles")}finally{i(!1)}},[e]);return f.useEffect(()=>{u()},[u]),sc(p=>{p.type==="todos-updated"&&!p.projectSlug&&u()}),{data:t,loading:s,error:l,refetch:u}}function IB(){const{workspace:e}=$t(),t=e||"_global",{data:n,loading:s,error:i,refetch:l}=_R(t),{data:c}=OB(t),[u,p]=f.useState(""),[m,h]=f.useState(""),[x,y]=f.useState(""),[b,C]=f.useState(""),[j,w]=f.useState(null),[k,E]=f.useState(null),[N,P]=f.useState(new Set),[$,T]=f.useState(!1),[D,L]=f.useState(!1),[Y,X]=f.useState(null),I=f.useRef(null);mo("list:todos");const U=hx("workspace:"+t),[ne,F]=f.useState(null),[H,ee]=f.useState(null),ce=f.useRef(null);function _(Z,ye){Z.stopPropagation(),navigator.clipboard.writeText(ye),w(ye),setTimeout(()=>w(Re=>Re===ye?null:Re),1500)}const W=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const Z=new Set;for(const ye of n.items)for(const Re of ye.tags)Z.add(Re);return Array.from(Z).sort()},[n]),R=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let Z=n.items;if(u.trim()){const ye=u.toLowerCase();Z=Z.filter(Re=>Re.description.toLowerCase().includes(ye)||Re.tags.some(lt=>lt.toLowerCase().includes(ye))||Re.id.includes(ye))}return m&&(Z=Z.filter(ye=>ye.status===m)),x&&(Z=Z.filter(ye=>ye.tags.includes(x))),Z},[n,u,m,x]);f.useEffect(()=>{P(new Set)},[u,m,x,t]);const M=f.useMemo(()=>R.filter(Z=>N.has(Z.id)).length,[R,N]),Q=R.length>0&&M===R.length,O=M>0&&!Q;function ue(Z){P(ye=>{const Re=new Set(ye);return Re.has(Z)?Re.delete(Z):Re.add(Z),Re})}function ge(){P(Z=>{const ye=new Set(Z);if(Q)for(const Re of R)ye.delete(Re.id);else for(const Re of R)ye.add(Re.id);return ye})}function V(){P(new Set)}const oe=Y?[Y]:Array.from(N);function me(){P(new Set),X(null),l()}function ve(){P(new Set),l()}async function ke(){b.trim()&&(await fg(t,b.trim()),C(""),l())}async function he(Z,ye,Re){Z.stopPropagation(),window.confirm(`Delete "${Re}"? This can't be undone.`)&&(await G0(t,ye),l())}async function Je(Z,ye){switch(ye){case"open":await q0(t,Z);break;case"in_progress":await K0(t,Z);break;case"completed":await H0(t,Z);break;case"blocked":await W0(t,Z);break}l()}async function Ye(Z,ye){await Y0(t,Z,ye),l()}async function ot(Z,ye){await J0(t,Z,ye),l()}async function G(Z,ye){await X0(t,Z,ye),l()}const Ie=mx(R),Se=Ie.filter(Z=>!U.isCollapsed(Z.config.id)).flatMap(Z=>Z.items),{hotkeyRowProps:Oe}=ic(Se,{scope:"list:todos",bindO:!1,onOpen:Z=>E(Z.id)});Ht({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Z;return(Z=I.current)==null?void 0:Z.focus()}}),Ht({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>l()});const[Xe,_e]=ms(),nt=Xe.get("focus");f.useEffect(()=>{if(!nt||!(n!=null&&n.items))return;const Z=n.items.find(Re=>Re.id===nt);if(!Z)return;const ye=cf(Z.status);U.isCollapsed(ye)&&U.toggle(ye)},[nt,n==null?void 0:n.items]),f.useEffect(()=>{if(!nt)return;const Z=document.querySelector(`[data-todo-id="${window.CSS.escape(nt)}"]`);if(!Z)return;Z.scrollIntoView({block:"nearest"}),Z.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{Z.classList.remove("ring-2","ring-primary/60"),_e(Re=>{const lt=new URLSearchParams(Re);return lt.delete("focus"),lt})},1500);return()=>window.clearTimeout(ye)},[nt,Se.length,_e]);const Ke=ne?(n==null?void 0:n.items.find(Z=>Z.id===ne))??null:null;function gt(Z,ye){const Re=ce.current;if(Re!=null&&Re.closest(ma)){Z.preventDefault();return}Z.dataTransfer.effectAllowed="move",Z.dataTransfer.setData("text/plain",ye),F(ye)}function Pt(){F(null),ee(null)}function it(Z,ye){!Ke||ye.statuses.includes(Ke.status)||(Z.preventDefault(),Z.dataTransfer.dropEffect="move",ee(ye.id))}function ie(Z,ye){H===ye.id&&!Z.currentTarget.contains(Z.relatedTarget)&&ee(null)}function q(Z,ye){Z.preventDefault();const Re=Ke;Pt(),!(!Re||ye.statuses.includes(Re.status))&&Je(Re.id,ye.dropStatus)}if(s)return r.jsx(mt,{label:"Loading todos..."});if(i)return r.jsx(wt,{error:i});const pe=(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(An,{label:"Open",value:pe.open,icon:Ar}),r.jsx(An,{label:"In Progress",value:pe.in_progress,icon:Ar,tone:"info"}),r.jsx(An,{label:"Blocked",value:pe.blocked,icon:ag,tone:"warn"}),r.jsx(An,{label:"Total",value:pe.total,icon:Ar})]}),c&&r.jsx(LB,{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:Z=>C(Z.target.value),onKeyDown:Z=>Z.key==="Enter"&&ke(),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:ke,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(rn,{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(fo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:I,type:"text",placeholder:"Search...",value:u,onChange:Z=>p(Z.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:Z=>h(Z.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"})]}),W.length>0&&r.jsxs("select",{value:x,onChange:Z=>y(Z.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"}),W.map(Z=>r.jsxs("option",{value:Z,children:["#",Z]},Z))]})]}),N.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:[N.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:()=>{X(null),L(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:V,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,R.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:Q,ref:Z=>{Z&&(Z.indeterminate=O)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",R.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Z=-1;return Ie.map(({config:ye,items:Re})=>{const lt=!U.isCollapsed(ye.id);return r.jsx(px,{label:ye.label,count:Re.length,expanded:lt,onToggle:()=>U.toggle(ye.id),isDropTarget:H===ye.id,onDragOver:te=>it(te,ye),onDragLeave:te=>ie(te,ye),onDrop:te=>q(te,ye),children:lt&&Re.map(te=>(Z+=1,r.jsx(Q1,{item:te,copiedId:j,selected:N.has(te.id),editing:k===te.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:Ye,onAddAttachments:ot,onDeleteAttachment:G,attachmentUrl:(be,$e)=>pg(t,be,$e),onToggleSelected:be=>ue(be),onMoveOne:(be,$e)=>{$e.stopPropagation(),X(be),L(!0)},onStatusChange:Je,onCopyId:_,onDelete:he,hotkeyRowProps:Oe(Z),onDragOrigin:be=>{ce.current=be.target},onDragStart:gt,onDragEnd:Pt,isDragging:ne===te.id},te.id)))},ye.id)})})()}),r.jsx(fx,{open:$,selectedIds:Array.from(N),scope:{kind:"workspace",workspace:t},onOpenChange:T,onDone:ve}),r.jsx(nN,{open:D,selectedIds:oe,scope:{kind:"workspace",workspace:t},onOpenChange:Z=>{L(Z),Z||X(null)},onDone:me})]})}function wC(){const{views:e}=Hd();async function t(i,l,c){const u=e.find(h=>h.id===i.id)??i,p=mN(c,u.workspace).config,m=jx(u.config,p,u.config);await $g(i.id,{name:l,config:m})}async function n(i){await Kd({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config})}async function s(i){await UD(i.id)}return{submitEdit:t,duplicate:n,remove:s}}const Oj=80,_B={kanban:"Kanban",list:"List",table:"Table"},MB={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function jC({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:i}){const l=!!s,c=Zo(),u=tf(),{data:p}=Jo(),{data:m}=Md(),[h,x]=f.useState(""),[y,b]=f.useState(Wi.viewMode),[C,j]=f.useState([]),[w,k]=f.useState([]),[E,N]=f.useState([]),[P,$]=f.useState([]),[T,D]=f.useState([]),[L,Y]=f.useState([]),[X,I]=f.useState("all"),[U,ne]=f.useState(null),[F,H]=f.useState(""),[ee,ce]=f.useState(Wi.sortField),[_,W]=f.useState(Wi.sortDirection),[R,M]=f.useState(!1),[Q,O]=f.useState(null);function ue(){b(Wi.viewMode),j([]),k([]),N([]),$([]),D([]),Y([]),I("all"),ne(null),H(""),ce(Wi.sortField),W(Wi.sortDirection)}f.useEffect(()=>{if(e)if(O(null),M(!1),s){const G=s.config.filters;x(s.name),b(s.config.viewMode),j(tt(G.status)),k(tt(G.priority)),N(tt(G.type)),$(tt(G.project)),D(tt(G.assignee)),Y(tt(G.tags)),I(G.activity??"all"),ne(hN(G.dateRange)),H(G.search??""),ce(s.config.sortField),W(s.config.sortDirection)}else x(""),ue()},[e,s]);const ge=G=>Ie=>G?G==="_ungrouped"?Ie.projectWorkspace===null:Ie.projectWorkspace===G:!0,V=f.useMemo(()=>{const G=Se=>n?n==="_ungrouped"?Se.workspace===null:Se.workspace===n:!0,Ie=(p??[]).filter(G);return[{value:"__standalone__",label:"No project"},...Ie.map(Se=>({value:Se.slug,label:Se.title}))]},[p,n]),oe=f.useMemo(()=>{const G=new Set,Ie=ge(n);for(const Oe of(m==null?void 0:m.assignments)??[])Ie(Oe)&&Oe.assignee&&G.add(Oe.assignee);const Se=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(G).sort())Se.push({value:Oe,label:Oe});return Se},[m,n]),me=f.useMemo(()=>{const G=new Set,Ie=ge(n);for(const Se of(m==null?void 0:m.assignments)??[])if(Ie(Se))for(const Oe of Se.tags??[])G.add(Oe);return Array.from(G).sort().map(Se=>({value:Se,label:Se}))},[m,n]),ve=f.useMemo(()=>c.order.map(G=>({value:G,label:cc(c,G)})),[c]),ke=f.useMemo(()=>X5.map(G=>({value:G,label:G[0].toUpperCase()+G.slice(1)})),[]),he=f.useMemo(()=>u.definitions.map(G=>({value:G.id,label:aa(u,G.id)})),[u]),Je=Rg.map(G=>({value:G,label:_B[G]})),Ye=h.trim(),ot=Ye.length>0&&Ye.length<=Oj;return r.jsx(ir,{open:e,onOpenChange:t,children:r.jsx(Kn,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async G=>{if(G.preventDefault(),!ot||R)return;M(!0),O(null);const Ie={viewMode:y,filters:{status:C,priority:w,type:E,project:P,assignee:T,tags:L,activity:X,dateRange:Xl(U),search:F},sortField:ee,sortDirection:_};try{await i(Ye,Ie)}catch(Se){O(Se instanceof Error?Se.message:String(Se)),M(!1)}},children:[r.jsx(Qr,{children:r.jsx(qn,{children:l?"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:Oj,onChange:G=>x(G.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(rf,{value:y,onChange:G=>b(G),options:Je})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ss,{label:"Status",children:r.jsx(Rn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:ve,value:C,onChange:j})}),r.jsx(ss,{label:"Priority",children:r.jsx(Rn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ke,value:w,onChange:k})}),r.jsx(ss,{label:"Type",children:r.jsx(Rn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:he,value:E,onChange:N})}),r.jsx(ss,{label:"Project",children:r.jsx(Rn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:P,onChange:$})}),r.jsx(ss,{label:"Assignee",children:r.jsx(Rn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:oe,value:T,onChange:D})}),r.jsx(ss,{label:"Tags",children:r.jsx(Rn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:me,value:L,onChange:Y})}),r.jsx(ss,{label:"Activity",children:r.jsxs("select",{value:X,onChange:G=>I(G.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(ss,{label:"Date range",children:r.jsx(wx,{className:"w-full",value:U,onChange:ne})}),r.jsx(ss,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:F,onChange:G=>H(G.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ss,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:ee,onChange:G=>ce(G.target.value),className:"editor-input w-full",children:tS.map(G=>r.jsx("option",{value:G,children:MB[G]},G))}),r.jsx("button",{type:"button",onClick:()=>W(G=>G==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:_==="asc"?"Ascending":"Descending",children:_==="asc"?"Asc":"Desc"})]})})]}),Q?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Q}):null,r.jsxs($s,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,className:"shell-action",disabled:R,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:R,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":l?"Save changes":"Create view"})]})]})]})})})}function ss({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 FB={kanban:"Kanban",list:"List",table:"Table"};function Ij(){const{workspace:e}=$t(),{views:t,loading:n}=Hd(),{submitEdit:s,duplicate:i,remove:l}=wC(),{toast:c,showToast:u,dismissToast:p}=ti(),[m,h]=f.useState(null),[x,y]=f.useState(!1),[b,C]=f.useState(!1),[j,w]=f.useState(null);async function k(T,D){const{workspace:L,config:Y}=mN(D,e??null);try{await Kd({name:T,workspace:L,config:Y}),C(!1),u(`Created view "${T}"`)}catch(X){throw u(X instanceof Error?X.message:"Failed to create saved view"),X}}async function E(T,D,L){try{await s(T,D,L),w(null),u(`Updated view "${D}"`)}catch(Y){throw u(Y instanceof Error?Y.message:"Failed to update saved view"),Y}}async function N(T){try{await i(T),u(`Duplicated "${T.name}"`)}catch(D){u(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function P(){if(m){y(!0);try{await l(m),h(null)}catch(T){u(T instanceof Error?T.message:"Failed to delete saved view")}finally{y(!1)}}}const $=r.jsxs("button",{type:"button",onClick:()=>C(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(rn,{className:"h-4 w-4"}),"Create view"]});return r.jsxs("div",{className:"space-y-4",children:[r.jsx(xd,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:$}),n?r.jsx(mt,{label:"Loading saved views…"}):t.length===0?r.jsx(St,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:$}):r.jsx(We,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(T=>r.jsx(zB,{view:T,onRequestDelete:()=>h(T),onRequestEdit:()=>w(T),onRequestDuplicate:()=>void N(T)},T.id))})}),r.jsx(jC,{open:b||j!==null,onOpenChange:T=>{T||(C(!1),w(null))},workspace:j?j.workspace:e??null,initialView:j,onSubmit:j?(T,D)=>E(j,T,D):k}),r.jsx(si,{open:m!==null,title:"Delete saved view?",description:m?`Delete '${m.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:x,destructive:!0,onConfirm:P,onOpenChange:T=>{!T&&!x&&h(null)}}),r.jsx(ni,{toast:c,onDismiss:p})]})}function zB({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const i=Dt(),l=()=>i(xN(e)),c=bN(e.config.filters),u=e.workspace?yn(e.workspace):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:l,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 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:FB[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.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:l,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 BB={kanban:"Kanban",list:"List",table:"Table"};function _j(){const{id:e,workspace:t}=$t(),n=Dt(),{view:s,ready:i,error:l,refetch:c}=Go(e),{submitEdit:u,duplicate:p,remove:m}=wC(),{toast:h,showToast:x,dismissToast:y}=ti(),[b,C]=f.useState(!1),[j,w]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!i||!s||(t??null)!==(s.workspace??null)&&n(xN(s),{replace:!0})},[i,s,t,n]),!i)return r.jsx(mt,{label:"Loading view…"});if(l)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:l.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(xd,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:Xu(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(td,{className:"h-4 w-4"})," Back to Saved Views"]})]});const N=s.workspace?yn(s.workspace):null;async function P(D,L){const Y=s;try{await u(Y,D,L),C(!1),x(`Updated view "${D}"`)}catch(X){throw x(X instanceof Error?X.message:"Failed to update saved view"),X}}async function $(){const D=s;try{await p(D),x(`Duplicated "${D.name}"`)}catch(L){x(L instanceof Error?L.message:"Failed to duplicate saved view")}}async function T(){const D=s;E(!0);try{await m(D),w(!1),n(Xu(D.workspace))}catch(L){x(L instanceof Error?L.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ce,{to:Xu(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(td,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(xd,{title:s.name,description:bN(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:BB[s.config.viewMode]}),N?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:N}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void $(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(yN(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>w(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(WS,{view:s}),b?r.jsx(jC,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:P}):null,r.jsx(si,{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:T,onOpenChange:D=>{!D&&!k&&w(!1)}}),r.jsx(ni,{toast:h,onDismiss:y})]})}function UB(){return r.jsx(OT,{children:r.jsx(J3,{children:r.jsx(uT,{children:r.jsxs(He,{element:r.jsx(ND,{}),children:[r.jsx(He,{path:"/",element:r.jsx(uL,{})}),r.jsx(He,{path:"/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/archive",element:r.jsx(CL,{})}),r.jsx(He,{path:"/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/assignments/:id",element:r.jsx(NF,{})}),r.jsx(He,{path:"/assignments/:id/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/assignments/:id/plan/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/assignments/:id/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/assignments/:id/decision-record/edit",element:r.jsx(eh,{})}),r.jsx(He,{path:"/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/playbooks",element:r.jsx(r6,{})}),r.jsx(He,{path:"/playbooks/create",element:r.jsx(o6,{})}),r.jsx(He,{path:"/playbooks/:slug",element:r.jsx(s6,{})}),r.jsx(He,{path:"/playbooks/:slug/edit",element:r.jsx(i6,{})}),r.jsx(He,{path:"/memories",element:r.jsx(a6,{})}),r.jsx(He,{path:"/memories/new",element:r.jsx(c6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(l6,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(u6,{})}),r.jsx(He,{path:"/resources",element:r.jsx(d6,{})}),r.jsx(He,{path:"/resources/new",element:r.jsx(p6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(f6,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(m6,{})}),r.jsx(He,{path:"/todos",element:r.jsx(AB,{})}),r.jsx(He,{path:"/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/views/:id",element:r.jsx(_j,{})}),r.jsx(He,{path:"/help",element:r.jsx(fL,{})}),r.jsx(He,{path:"/settings",element:r.jsx(RB,{})}),r.jsx(He,{path:"/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(ij,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(eh,{})}),r.jsx(He,{path:"/w/:workspace/projects",element:r.jsx(rw,{})}),r.jsx(He,{path:"/w/:workspace/assignments",element:r.jsx(cj,{})}),r.jsx(He,{path:"/w/:workspace/assignments/new",element:r.jsx(pj,{})}),r.jsx(He,{path:"/w/:workspace/servers",element:r.jsx(hj,{})}),r.jsx(He,{path:"/w/:workspace/inventories",element:r.jsx(gj,{})}),r.jsx(He,{path:"/w/:workspace/usage",element:r.jsx(xj,{})}),r.jsx(He,{path:"/w/:workspace/agent-sessions",element:r.jsx(yj,{})}),r.jsx(He,{path:"/w/:workspace/todos",element:r.jsx(IB,{})}),r.jsx(He,{path:"/w/:workspace/views",element:r.jsx(Ij,{})}),r.jsx(He,{path:"/w/:workspace/views/:id",element:r.jsx(_j,{})}),r.jsx(He,{path:"/w/:workspace/create/project",element:r.jsx(dj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug",element:r.jsx(sj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(mj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(fj,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(ij,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Jm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(Xm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Qm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Zm,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(eh,{})})]})})})})}mR();u2.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(hR,{children:r.jsx(UB,{})})}));export{XL as _,HB as a,Td as g};
|