syntaur 0.55.1 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-DIHDuMKZ.js → _basePickBy-BboQhTYn.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-DdoY-meB.js → _baseUniq-C6ARYdEJ.js} +1 -1
- package/dashboard/dist/assets/{arc-BQ0d8jWa.js → arc-D76wUYJ-.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-G7j98lj4.js → architectureDiagram-2XIMDMQ5-eoW8_dbN.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-ZufoK2Vf.js → blockDiagram-WCTKOSBZ--XxaNbBK.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-BD1q04gi.js → c4Diagram-IC4MRINW-D2B-NJq6.js} +1 -1
- package/dashboard/dist/assets/channel-BPykMjmL.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-laHJ5e6M.js → chunk-4BX2VUAB-CY34rkdT.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-vugHo86n.js → chunk-55IACEB6-CLXE1Ejn.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-uYEErEfW.js → chunk-FMBD7UC4-D00VtmIk.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-sONfVqmj.js → chunk-JSJVCQXG-_EITJTaI.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-Cdp0hOuK.js → chunk-KX2RTZJC-DrqZI_kX.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-eOKhRe70.js → chunk-NQ4KR5QH-DnYhUmZY.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-BnAHYxL5.js → chunk-QZHKN3VN-CqCcFoFI.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-AP91qlj3.js → chunk-WL4C6EOR-Bwx5h46l.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-z8L393gl.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-z8L393gl.js +1 -0
- package/dashboard/dist/assets/clone--rMJOGpf.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CBeQigsM.js → cose-bilkent-S5V4N54A-QUZroYuH.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-Cgic159r.js → dagre-KLK3FWXG-D8hYiZ7i.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-7nkbIxvu.js → diagram-E7M64L7V-Cl_n980P.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-DvM5M3fg.js → diagram-IFDJBPK2-01DdmzmS.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-DOvoIAgX.js → diagram-P4PSJMXO-GcqkAPB2.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-CKzsTtLZ.js → erDiagram-INFDFZHY-DQnXbhhn.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-DjJvVw0S.js → flowDiagram-PKNHOUZH-DSmXtiZK.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-BlKUEIDZ.js → ganttDiagram-A5KZAMGK-BLyt9LDp.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-CD8uhQ3i.js → gitGraphDiagram-K3NZZRJ6-FWlr0I_j.js} +1 -1
- package/dashboard/dist/assets/{graph-BARSMOR1.js → graph-Czw8ZNXY.js} +1 -1
- package/dashboard/dist/assets/index-EntCfH3I.css +1 -0
- package/dashboard/dist/assets/index-zHNBGpC7.js +602 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-B1fgVPe-.js → infoDiagram-LFFYTUFH-CygGWMzd.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Qbij3q8f.js → ishikawaDiagram-PHBUUO56-39XaFufR.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-C88gUC3u.js → journeyDiagram-4ABVD52K-DCMzi84v.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-BvtgZ4bH.js → kanban-definition-K7BYSVSG-RSNF4GmM.js} +1 -1
- package/dashboard/dist/assets/{layout-CP_h2sGj.js → layout-AOYFASCy.js} +1 -1
- package/dashboard/dist/assets/{linear-CJFguXhD.js → linear-Bf-cRRMe.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-B_i0YYrl.js → mermaid.core-7QJzPWTu.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-DFE12FYM.js → mindmap-definition-YRQLILUH-Ck4L1K7y.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-CGEdJrr5.js → pieDiagram-SKSYHLDU-BHEH_9Yh.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-D-kdhwoV.js → quadrantDiagram-337W2JSQ-DScQHhsU.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-BBUDctiO.js → requirementDiagram-Z7DCOOCP-DLmxwUdt.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-BJz2scyH.js → sankeyDiagram-WA2Y5GQK-B6OZtKmg.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-C4JCchCY.js → sequenceDiagram-2WXFIKYE-woFPqQIY.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-CQyJ0pwB.js → stateDiagram-RAJIS63D-Db9HV_HG.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DZsj07hg.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-BgMghCXE.js → timeline-definition-YZTLITO2-CGVOTXAD.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-D5Nh6cA1.js → treemap-KZPCXAKY-CGmqtjaL.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-xLpKzIkS.js → vennDiagram-LZ73GAT5-DAuyqqKn.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DZaLadME.js → xychartDiagram-JWTSCODW--uOFgr6-.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +290 -23
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +290 -23
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +25 -0
- package/dist/launch/index.js +187 -1
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-Cos6AwFg.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-0nGn6D8t.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-0nGn6D8t.js +0 -1
- package/dashboard/dist/assets/clone-DfeUNde6.js +0 -1
- package/dashboard/dist/assets/index-BJ38AwFL.js +0 -602
- package/dashboard/dist/assets/index-BcoJBSvO.css +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-B9MsrKVy.js +0 -1
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
var PR=Object.defineProperty;var DR=(e,t,n)=>t in e?PR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hh=(e,t,n)=>DR(e,typeof t!="symbol"?t+"":t,n);function $R(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(s,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function $f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gH(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})}),n}var gh={exports:{}},Kl={},xh={exports:{}},gt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Aw;function LR(){if(Aw)return gt;Aw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(H){return H===null||typeof H!="object"?null:(H=g&&H[g]||H["@@iterator"],typeof H=="function"?H:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,w={};function v(H,Z,U){this.props=H,this.context=Z,this.refs=w,this.updater=U||b}v.prototype.isReactComponent={},v.prototype.setState=function(H,Z){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,Z,"setState")},v.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(H,Z,U){this.props=H,this.context=Z,this.refs=w,this.updater=U||b}var S=E.prototype=new k;S.constructor=E,C(S,v.prototype),S.isPureReactComponent=!0;var T=Array.isArray,I=Object.prototype.hasOwnProperty,R={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function $(H,Z,U){var oe,ue={},re=null,xe=null;if(Z!=null)for(oe in Z.ref!==void 0&&(xe=Z.ref),Z.key!==void 0&&(re=""+Z.key),Z)I.call(Z,oe)&&!P.hasOwnProperty(oe)&&(ue[oe]=Z[oe]);var ke=arguments.length-2;if(ke===1)ue.children=U;else if(1<ke){for(var Pe=Array(ke),De=0;De<ke;De++)Pe[De]=arguments[De+2];ue.children=Pe}if(H&&H.defaultProps)for(oe in ke=H.defaultProps,ke)ue[oe]===void 0&&(ue[oe]=ke[oe]);return{$$typeof:e,type:H,key:re,ref:xe,props:ue,_owner:R.current}}function L(H,Z){return{$$typeof:e,type:H.type,key:Z,ref:H.ref,props:H.props,_owner:H._owner}}function F(H){return typeof H=="object"&&H!==null&&H.$$typeof===e}function A(H){var Z={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(U){return Z[U]})}var z=/\/+/g;function V(H,Z){return typeof H=="object"&&H!==null&&H.key!=null?A(""+H.key):Z.toString(36)}function O(H,Z,U,oe,ue){var re=typeof H;(re==="undefined"||re==="boolean")&&(H=null);var xe=!1;if(H===null)xe=!0;else switch(re){case"string":case"number":xe=!0;break;case"object":switch(H.$$typeof){case e:case t:xe=!0}}if(xe)return xe=H,ue=ue(xe),H=oe===""?"."+V(xe,0):oe,T(ue)?(U="",H!=null&&(U=H.replace(z,"$&/")+"/"),O(ue,Z,U,"",function(De){return De})):ue!=null&&(F(ue)&&(ue=L(ue,U+(!ue.key||xe&&xe.key===ue.key?"":(""+ue.key).replace(z,"$&/")+"/")+H)),Z.push(ue)),1;if(xe=0,oe=oe===""?".":oe+":",T(H))for(var ke=0;ke<H.length;ke++){re=H[ke];var Pe=oe+V(re,ke);xe+=O(re,Z,U,Pe,ue)}else if(Pe=y(H),typeof Pe=="function")for(H=Pe.call(H),ke=0;!(re=H.next()).done;)re=re.value,Pe=oe+V(re,ke++),xe+=O(re,Z,U,Pe,ue);else if(re==="object")throw Z=String(H),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return xe}function B(H,Z,U){if(H==null)return H;var oe=[],ue=0;return O(H,oe,"","",function(re){return Z.call(U,re,ue++)}),oe}function K(H){if(H._status===-1){var Z=H._result;Z=Z(),Z.then(function(U){(H._status===0||H._status===-1)&&(H._status=1,H._result=U)},function(U){(H._status===0||H._status===-1)&&(H._status=2,H._result=U)}),H._status===-1&&(H._status=0,H._result=Z)}if(H._status===1)return H._result.default;throw H._result}var q={current:null},_={transition:null},G={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:_,ReactCurrentOwner:R};function D(){throw Error("act(...) is not supported in production builds of React.")}return gt.Children={map:B,forEach:function(H,Z,U){B(H,function(){Z.apply(this,arguments)},U)},count:function(H){var Z=0;return B(H,function(){Z++}),Z},toArray:function(H){return B(H,function(Z){return Z})||[]},only:function(H){if(!F(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},gt.Component=v,gt.Fragment=n,gt.Profiler=o,gt.PureComponent=E,gt.StrictMode=s,gt.Suspense=d,gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G,gt.act=D,gt.cloneElement=function(H,Z,U){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var oe=C({},H.props),ue=H.key,re=H.ref,xe=H._owner;if(Z!=null){if(Z.ref!==void 0&&(re=Z.ref,xe=R.current),Z.key!==void 0&&(ue=""+Z.key),H.type&&H.type.defaultProps)var ke=H.type.defaultProps;for(Pe in Z)I.call(Z,Pe)&&!P.hasOwnProperty(Pe)&&(oe[Pe]=Z[Pe]===void 0&&ke!==void 0?ke[Pe]:Z[Pe])}var Pe=arguments.length-2;if(Pe===1)oe.children=U;else if(1<Pe){ke=Array(Pe);for(var De=0;De<Pe;De++)ke[De]=arguments[De+2];oe.children=ke}return{$$typeof:e,type:H.type,key:ue,ref:re,props:oe,_owner:xe}},gt.createContext=function(H){return H={$$typeof:l,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:i,_context:H},H.Consumer=H},gt.createElement=$,gt.createFactory=function(H){var Z=$.bind(null,H);return Z.type=H,Z},gt.createRef=function(){return{current:null}},gt.forwardRef=function(H){return{$$typeof:u,render:H}},gt.isValidElement=F,gt.lazy=function(H){return{$$typeof:h,_payload:{_status:-1,_result:H},_init:K}},gt.memo=function(H,Z){return{$$typeof:m,type:H,compare:Z===void 0?null:Z}},gt.startTransition=function(H){var Z=_.transition;_.transition={};try{H()}finally{_.transition=Z}},gt.unstable_act=D,gt.useCallback=function(H,Z){return q.current.useCallback(H,Z)},gt.useContext=function(H){return q.current.useContext(H)},gt.useDebugValue=function(){},gt.useDeferredValue=function(H){return q.current.useDeferredValue(H)},gt.useEffect=function(H,Z){return q.current.useEffect(H,Z)},gt.useId=function(){return q.current.useId()},gt.useImperativeHandle=function(H,Z,U){return q.current.useImperativeHandle(H,Z,U)},gt.useInsertionEffect=function(H,Z){return q.current.useInsertionEffect(H,Z)},gt.useLayoutEffect=function(H,Z){return q.current.useLayoutEffect(H,Z)},gt.useMemo=function(H,Z){return q.current.useMemo(H,Z)},gt.useReducer=function(H,Z,U){return q.current.useReducer(H,Z,U)},gt.useRef=function(H){return q.current.useRef(H)},gt.useState=function(H){return q.current.useState(H)},gt.useSyncExternalStore=function(H,Z,U){return q.current.useSyncExternalStore(H,Z,U)},gt.useTransition=function(){return q.current.useTransition()},gt.version="18.3.1",gt}var Pw;function jx(){return Pw||(Pw=1,xh.exports=LR()),xh.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 Dw;function IR(){if(Dw)return Kl;Dw=1;var e=jx(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(u,d,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(b=d.ref);for(h in d)s.call(d,h)&&!i.hasOwnProperty(h)&&(g[h]=d[h]);if(u&&u.defaultProps)for(h in d=u.defaultProps,d)g[h]===void 0&&(g[h]=d[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:o.current}}return Kl.Fragment=n,Kl.jsx=l,Kl.jsxs=l,Kl}var $w;function OR(){return $w||($w=1,gh.exports=IR()),gh.exports}var r=OR(),f=jx();const Dt=$f(f),Mk=$R({__proto__:null,default:Dt},[f]);var md={},yh={exports:{}},ar={},bh={exports:{}},vh={};/**
|
|
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 Lw;function _R(){return Lw||(Lw=1,(function(e){function t(_,G){var D=_.length;_.push(G);e:for(;0<D;){var H=D-1>>>1,Z=_[H];if(0<o(Z,G))_[H]=G,_[D]=Z,D=H;else break e}}function n(_){return _.length===0?null:_[0]}function s(_){if(_.length===0)return null;var G=_[0],D=_.pop();if(D!==G){_[0]=D;e:for(var H=0,Z=_.length,U=Z>>>1;H<U;){var oe=2*(H+1)-1,ue=_[oe],re=oe+1,xe=_[re];if(0>o(ue,D))re<Z&&0>o(xe,ue)?(_[H]=xe,_[re]=D,H=re):(_[H]=ue,_[oe]=D,H=oe);else if(re<Z&&0>o(xe,D))_[H]=xe,_[re]=D,H=re;else break e}}return G}function o(_,G){var D=_.sortIndex-G.sortIndex;return D!==0?D:_.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var d=[],m=[],h=1,g=null,y=3,b=!1,C=!1,w=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(_){for(var G=n(m);G!==null;){if(G.callback===null)s(m);else if(G.startTime<=_)s(m),G.sortIndex=G.expirationTime,t(d,G);else break;G=n(m)}}function T(_){if(w=!1,S(_),!C)if(n(d)!==null)C=!0,K(I);else{var G=n(m);G!==null&&q(T,G.startTime-_)}}function I(_,G){C=!1,w&&(w=!1,k($),$=-1),b=!0;var D=y;try{for(S(G),g=n(d);g!==null&&(!(g.expirationTime>G)||_&&!A());){var H=g.callback;if(typeof H=="function"){g.callback=null,y=g.priorityLevel;var Z=H(g.expirationTime<=G);G=e.unstable_now(),typeof Z=="function"?g.callback=Z:g===n(d)&&s(d),S(G)}else s(d);g=n(d)}if(g!==null)var U=!0;else{var oe=n(m);oe!==null&&q(T,oe.startTime-G),U=!1}return U}finally{g=null,y=D,b=!1}}var R=!1,P=null,$=-1,L=5,F=-1;function A(){return!(e.unstable_now()-F<L)}function z(){if(P!==null){var _=e.unstable_now();F=_;var G=!0;try{G=P(!0,_)}finally{G?V():(R=!1,P=null)}}else R=!1}var V;if(typeof E=="function")V=function(){E(z)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,B=O.port2;O.port1.onmessage=z,V=function(){B.postMessage(null)}}else V=function(){v(z,0)};function K(_){P=_,R||(R=!0,V())}function q(_,G){$=v(function(){_(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(_){_.callback=null},e.unstable_continueExecution=function(){C||b||(C=!0,K(I))},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"):L=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(_){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var D=y;y=G;try{return _()}finally{y=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,G){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var D=y;y=_;try{return G()}finally{y=D}},e.unstable_scheduleCallback=function(_,G,D){var H=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?H+D:H):D=H,_){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=D+Z,_={id:h++,callback:G,priorityLevel:_,startTime:D,expirationTime:Z,sortIndex:-1},D>H?(_.sortIndex=D,t(m,_),n(d)===null&&_===n(m)&&(w?(k($),$=-1):w=!0,q(T,D-H))):(_.sortIndex=Z,t(d,_),C||b||(C=!0,K(I))),_},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(_){var G=y;return function(){var D=y;y=G;try{return _.apply(this,arguments)}finally{y=D}}}})(vh)),vh}var Iw;function MR(){return Iw||(Iw=1,bh.exports=_R()),bh.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 Ow;function FR(){if(Ow)return ar;Ow=1;var e=jx(),t=MR();function n(a){for(var c="https://reactjs.org/docs/error-decoder.html?invariant="+a,p=1;p<arguments.length;p++)c+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function i(a,c){l(a,c),l(a+"Capture",c)}function l(a,c){for(o[a]=c,a=0;a<c.length;a++)s.add(c[a])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(a){return d.call(g,a)?!0:d.call(h,a)?!1:m.test(a)?g[a]=!0:(h[a]=!0,!1)}function b(a,c,p,x){if(p!==null&&p.type===0)return!1;switch(typeof c){case"function":case"symbol":return!0;case"boolean":return x?!1:p!==null?!p.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function C(a,c,p,x){if(c===null||typeof c>"u"||b(a,c,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!c;case 4:return c===!1;case 5:return isNaN(c);case 6:return isNaN(c)||1>c}return!1}function w(a,c,p,x,j,N,M){this.acceptsBooleans=c===2||c===3||c===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=a,this.type=c,this.sanitizeURL=N,this.removeEmptyString=M}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){v[a]=new w(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var c=a[0];v[c]=new w(c,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){v[a]=new w(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){v[a]=new w(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){v[a]=new w(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){v[a]=new w(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){v[a]=new w(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){v[a]=new w(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){v[a]=new w(a,5,!1,a.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var c=a.replace(k,E);v[c]=new w(c,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var c=a.replace(k,E);v[c]=new w(c,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var c=a.replace(k,E);v[c]=new w(c,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){v[a]=new w(a,1,!1,a.toLowerCase(),null,!1,!1)}),v.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){v[a]=new w(a,1,!1,a.toLowerCase(),null,!0,!0)});function S(a,c,p,x){var j=v.hasOwnProperty(c)?v[c]:null;(j!==null?j.type!==0:x||!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(C(c,p,j,x)&&(p=null),x||j===null?y(c)&&(p===null?a.removeAttribute(c):a.setAttribute(c,""+p)):j.mustUseProperty?a[j.propertyName]=p===null?j.type===3?!1:"":p:(c=j.attributeName,x=j.attributeNamespace,p===null?a.removeAttribute(c):(j=j.type,p=j===3||j===4&&p===!0?"":""+p,x?a.setAttributeNS(x,c,p):a.setAttribute(c,p))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),R=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),A=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),_=Symbol.iterator;function G(a){return a===null||typeof a!="object"?null:(a=_&&a[_]||a["@@iterator"],typeof a=="function"?a:null)}var D=Object.assign,H;function Z(a){if(H===void 0)try{throw Error()}catch(p){var c=p.stack.trim().match(/\n( *(at )?)/);H=c&&c[1]||""}return`
|
|
34
|
+
`+H+a}var U=!1;function oe(a,c){if(!a||U)return"";U=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(c)if(c=function(){throw Error()},Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(pe){var x=pe}Reflect.construct(a,[],c)}else{try{c.call()}catch(pe){x=pe}a.call(c.prototype)}else{try{throw Error()}catch(pe){x=pe}a()}}catch(pe){if(pe&&x&&typeof pe.stack=="string"){for(var j=pe.stack.split(`
|
|
35
|
+
`),N=x.stack.split(`
|
|
36
|
+
`),M=j.length-1,Y=N.length-1;1<=M&&0<=Y&&j[M]!==N[Y];)Y--;for(;1<=M&&0<=Y;M--,Y--)if(j[M]!==N[Y]){if(M!==1||Y!==1)do if(M--,Y--,0>Y||j[M]!==N[Y]){var Q=`
|
|
37
|
+
`+j[M].replace(" at new "," at ");return a.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",a.displayName)),Q}while(1<=M&&0<=Y);break}}}finally{U=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?Z(a):""}function ue(a){switch(a.tag){case 5:return Z(a.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return a=oe(a.type,!1),a;case 11:return a=oe(a.type.render,!1),a;case 1:return a=oe(a.type,!0),a;default:return""}}function re(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case P:return"Fragment";case R:return"Portal";case L:return"Profiler";case $:return"StrictMode";case V:return"Suspense";case O:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case A:return(a.displayName||"Context")+".Consumer";case F:return(a._context.displayName||"Context")+".Provider";case z:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case B:return c=a.displayName||null,c!==null?c:re(a.type)||"Memo";case K:c=a._payload,a=a._init;try{return re(a(c))}catch{}}return null}function xe(a){var c=a.type;switch(a.tag){case 24:return"Cache";case 9:return(c.displayName||"Context")+".Consumer";case 10:return(c._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=c.render,a=a.displayName||a.name||"",c.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return c;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return re(c);case 8:return c===$?"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 c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c}return null}function ke(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Pe(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function De(a){var c=Pe(a)?"checked":"value",p=Object.getOwnPropertyDescriptor(a.constructor.prototype,c),x=""+a[c];if(!a.hasOwnProperty(c)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var j=p.get,N=p.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return j.call(this)},set:function(M){x=""+M,N.call(this,M)}}),Object.defineProperty(a,c,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(M){x=""+M},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function Xe(a){a._valueTracker||(a._valueTracker=De(a))}function st(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var p=c.getValue(),x="";return a&&(x=Pe(a)?a.checked?"true":"false":a.value),a=x,a!==p?(c.setValue(a),!0):!1}function Ze(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function ot(a,c){var p=c.checked;return D({},c,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??a._wrapperState.initialChecked})}function le(a,c){var p=c.defaultValue==null?"":c.defaultValue,x=c.checked!=null?c.checked:c.defaultChecked;p=ke(c.value!=null?c.value:p),a._wrapperState={initialChecked:x,initialValue:p,controlled:c.type==="checkbox"||c.type==="radio"?c.checked!=null:c.value!=null}}function Re(a,c){c=c.checked,c!=null&&S(a,"checked",c,!1)}function Se(a,c){Re(a,c);var p=ke(c.value),x=c.type;if(p!=null)x==="number"?(p===0&&a.value===""||a.value!=p)&&(a.value=""+p):a.value!==""+p&&(a.value=""+p);else if(x==="submit"||x==="reset"){a.removeAttribute("value");return}c.hasOwnProperty("value")?ze(a,c.type,p):c.hasOwnProperty("defaultValue")&&ze(a,c.type,ke(c.defaultValue)),c.checked==null&&c.defaultChecked!=null&&(a.defaultChecked=!!c.defaultChecked)}function Oe(a,c,p){if(c.hasOwnProperty("value")||c.hasOwnProperty("defaultValue")){var x=c.type;if(!(x!=="submit"&&x!=="reset"||c.value!==void 0&&c.value!==null))return;c=""+a._wrapperState.initialValue,p||c===a.value||(a.value=c),a.defaultValue=c}p=a.name,p!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,p!==""&&(a.name=p)}function ze(a,c,p){(c!=="number"||Ze(a.ownerDocument)!==a)&&(p==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+p&&(a.defaultValue=""+p))}var et=Array.isArray;function _e(a,c,p,x){if(a=a.options,c){c={};for(var j=0;j<p.length;j++)c["$"+p[j]]=!0;for(p=0;p<a.length;p++)j=c.hasOwnProperty("$"+a[p].value),a[p].selected!==j&&(a[p].selected=j),j&&x&&(a[p].defaultSelected=!0)}else{for(p=""+ke(p),c=null,j=0;j<a.length;j++){if(a[j].value===p){a[j].selected=!0,x&&(a[j].defaultSelected=!0);return}c!==null||a[j].disabled||(c=a[j])}c!==null&&(c.selected=!0)}}function qe(a,c){if(c.dangerouslySetInnerHTML!=null)throw Error(n(91));return D({},c,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Lt(a,c){var p=c.value;if(p==null){if(p=c.children,c=c.defaultValue,p!=null){if(c!=null)throw Error(n(92));if(et(p)){if(1<p.length)throw Error(n(93));p=p[0]}c=p}c==null&&(c=""),p=c}a._wrapperState={initialValue:ke(p)}}function bt(a,c){var p=ke(c.value),x=ke(c.defaultValue);p!=null&&(p=""+p,p!==a.value&&(a.value=p),c.defaultValue==null&&a.defaultValue!==p&&(a.defaultValue=p)),x!=null&&(a.defaultValue=""+x)}function ut(a){var c=a.textContent;c===a._wrapperState.initialValue&&c!==""&&c!==null&&(a.value=c)}function ae(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function X(a,c){return a==null||a==="http://www.w3.org/1999/xhtml"?ae(c):a==="http://www.w3.org/2000/svg"&&c==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var he,ne=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(c,p,x,j){MSApp.execUnsafeLocalFunction(function(){return a(c,p,x,j)})}:a})(function(a,c){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=c;else{for(he=he||document.createElement("div"),he.innerHTML="<svg>"+c.valueOf().toString()+"</svg>",c=he.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;c.firstChild;)a.appendChild(c.firstChild)}});function ye(a,c){if(c){var p=a.firstChild;if(p&&p===a.lastChild&&p.nodeType===3){p.nodeValue=c;return}}a.textContent=c}var Ee={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},ve=["Webkit","ms","Moz","O"];Object.keys(Ee).forEach(function(a){ve.forEach(function(c){c=c+a.charAt(0).toUpperCase()+a.substring(1),Ee[c]=Ee[a]})});function ee(a,c,p){return c==null||typeof c=="boolean"||c===""?"":p||typeof c!="number"||c===0||Ee.hasOwnProperty(a)&&Ee[a]?(""+c).trim():c+"px"}function fe(a,c){a=a.style;for(var p in c)if(c.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=ee(p,c[p],x);p==="float"&&(p="cssFloat"),x?a.setProperty(p,j):a[p]=j}}var Ne=D({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 He(a,c){if(c){if(Ne[a]&&(c.children!=null||c.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(c.dangerouslySetInnerHTML!=null){if(c.children!=null)throw Error(n(60));if(typeof c.dangerouslySetInnerHTML!="object"||!("__html"in c.dangerouslySetInnerHTML))throw Error(n(61))}if(c.style!=null&&typeof c.style!="object")throw Error(n(62))}}function ce(a,c){if(a.indexOf("-")===-1)return typeof c.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pt=null;function xt(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var St=null,at=null,me=null;function Me(a){if(a=Pl(a)){if(typeof St!="function")throw Error(n(280));var c=a.stateNode;c&&(c=Ru(c),St(a.stateNode,a.type,c))}}function Ye(a){at?me?me.push(a):me=[a]:at=a}function It(){if(at){var a=at,c=me;if(me=at=null,Me(a),c)for(a=0;a<c.length;a++)Me(c[a])}}function Xt(a,c){return a(c)}function dn(){}var Gt=!1;function qn(a,c,p){if(Gt)return a(c,p);Gt=!0;try{return Xt(a,c,p)}finally{Gt=!1,(at!==null||me!==null)&&(dn(),It())}}function Et(a,c){var p=a.stateNode;if(p===null)return null;var x=Ru(p);if(x===null)return null;p=x[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(a=a.type,x=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!x;break e;default:a=!1}if(a)return null;if(p&&typeof p!="function")throw Error(n(231,c,typeof p));return p}var Fn=!1;if(u)try{var Tt={};Object.defineProperty(Tt,"passive",{get:function(){Fn=!0}}),window.addEventListener("test",Tt,Tt),window.removeEventListener("test",Tt,Tt)}catch{Fn=!1}function se(a,c,p,x,j,N,M,Y,Q){var pe=Array.prototype.slice.call(arguments,3);try{c.apply(p,pe)}catch(je){this.onError(je)}}var Be=!1,tt=null,yt=!1,er=null,Kr={onError:function(a){Be=!0,tt=a}};function As(a,c,p,x,j,N,M,Y,Q){Be=!1,tt=null,se.apply(Kr,arguments)}function lu(a,c,p,x,j,N,M,Y,Q){if(As.apply(this,arguments),Be){if(Be){var pe=tt;Be=!1,tt=null}else throw Error(n(198));yt||(yt=!0,er=pe)}}function ht(a){var c=a,p=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(p=c.return),a=c.return;while(a)}return c.tag===3?p:null}function cu(a){if(a.tag===13){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function fl(a){if(ht(a)!==a)throw Error(n(188))}function uu(a){var c=a.alternate;if(!c){if(c=ht(a),c===null)throw Error(n(188));return c!==a?null:a}for(var p=a,x=c;;){var j=p.return;if(j===null)break;var N=j.alternate;if(N===null){if(x=j.return,x!==null){p=x;continue}break}if(j.child===N.child){for(N=j.child;N;){if(N===p)return fl(j),a;if(N===x)return fl(j),c;N=N.sibling}throw Error(n(188))}if(p.return!==x.return)p=j,x=N;else{for(var M=!1,Y=j.child;Y;){if(Y===p){M=!0,p=j,x=N;break}if(Y===x){M=!0,x=j,p=N;break}Y=Y.sibling}if(!M){for(Y=N.child;Y;){if(Y===p){M=!0,p=N,x=j;break}if(Y===x){M=!0,x=N,p=j;break}Y=Y.sibling}if(!M)throw Error(n(189))}}if(p.alternate!==x)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?a:c}function rn(a){return a=uu(a),a!==null?du(a):null}function du(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var c=du(a);if(c!==null)return c;a=a.sibling}return null}var fu=t.unstable_scheduleCallback,pu=t.unstable_cancelCallback,Op=t.unstable_shouldYield,_p=t.unstable_requestPaint,Zt=t.unstable_now,Mp=t.unstable_getCurrentPriorityLevel,pl=t.unstable_ImmediatePriority,mu=t.unstable_UserBlockingPriority,Xs=t.unstable_NormalPriority,Ca=t.unstable_LowPriority,hu=t.unstable_IdlePriority,Ea=null,an=null;function Ta(a){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(Ea,a,void 0,(a.current.flags&128)===128)}catch{}}var zn=Math.clz32?Math.clz32:Bp,Fp=Math.log,zp=Math.LN2;function Bp(a){return a>>>=0,a===0?32:31-(Fp(a)/zp|0)|0}var Gn=64,Ra=4194304;function Zs(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function _o(a,c){var p=a.pendingLanes;if(p===0)return 0;var x=0,j=a.suspendedLanes,N=a.pingedLanes,M=p&268435455;if(M!==0){var Y=M&~j;Y!==0?x=Zs(Y):(N&=M,N!==0&&(x=Zs(N)))}else M=p&~j,M!==0?x=Zs(M):N!==0&&(x=Zs(N));if(x===0)return 0;if(c!==0&&c!==x&&(c&j)===0&&(j=x&-x,N=c&-c,j>=N||j===16&&(N&4194240)!==0))return c;if((x&4)!==0&&(x|=p&16),c=a.entangledLanes,c!==0)for(a=a.entanglements,c&=x;0<c;)p=31-zn(c),j=1<<p,x|=a[p],c&=~j;return x}function gu(a,c){switch(a){case 1:case 2:case 4:return c+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 c+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 xu(a,c){for(var p=a.suspendedLanes,x=a.pingedLanes,j=a.expirationTimes,N=a.pendingLanes;0<N;){var M=31-zn(N),Y=1<<M,Q=j[M];Q===-1?((Y&p)===0||(Y&x)!==0)&&(j[M]=gu(Y,c)):Q<=c&&(a.expiredLanes|=Y),N&=~Y}}function Mo(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function ml(){var a=Gn;return Gn<<=1,(Gn&4194240)===0&&(Gn=64),a}function Yt(a){for(var c=[],p=0;31>p;p++)c.push(a);return c}function qr(a,c,p){a.pendingLanes|=c,c!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,c=31-zn(c),a[c]=p}function hl(a,c){var p=a.pendingLanes&~c;a.pendingLanes=c,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=c,a.mutableReadLanes&=c,a.entangledLanes&=c,c=a.entanglements;var x=a.eventTimes;for(a=a.expirationTimes;0<p;){var j=31-zn(p),N=1<<j;c[j]=0,x[j]=-1,a[j]=-1,p&=~N}}function gl(a,c){var p=a.entangledLanes|=c;for(a=a.entanglements;p;){var x=31-zn(p),j=1<<x;j&c|a[x]&c&&(a[x]|=c),p&=~j}}var Pt=0;function xl(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Aa,Pa,Ps,yl,bl,Fo=!1,Da=[],us=null,ln=null,ds=null,Ds=new Map,zo=new Map,fs=[],Up="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 ps(a,c){switch(a){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":ln=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":Ds.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":zo.delete(c.pointerId)}}function W(a,c,p,x,j,N){return a===null||a.nativeEvent!==N?(a={blockedOn:c,domEventName:p,eventSystemFlags:x,nativeEvent:N,targetContainers:[j]},c!==null&&(c=Pl(c),c!==null&&Pa(c)),a):(a.eventSystemFlags|=x,c=a.targetContainers,j!==null&&c.indexOf(j)===-1&&c.push(j),a)}function J(a,c,p,x,j){switch(c){case"focusin":return us=W(us,a,c,p,x,j),!0;case"dragenter":return ln=W(ln,a,c,p,x,j),!0;case"mouseover":return ds=W(ds,a,c,p,x,j),!0;case"pointerover":var N=j.pointerId;return Ds.set(N,W(Ds.get(N)||null,a,c,p,x,j)),!0;case"gotpointercapture":return N=j.pointerId,zo.set(N,W(zo.get(N)||null,a,c,p,x,j)),!0}return!1}function ge(a){var c=Bo(a.target);if(c!==null){var p=ht(c);if(p!==null){if(c=p.tag,c===13){if(c=cu(p),c!==null){a.blockedOn=c,bl(a.priority,function(){Ps(p)});return}}else if(c===3&&p.stateNode.current.memoizedState.isDehydrated){a.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Le(a){if(a.blockedOn!==null)return!1;for(var c=a.targetContainers;0<c.length;){var p=Ar(a.domEventName,a.eventSystemFlags,c[0],a.nativeEvent);if(p===null){p=a.nativeEvent;var x=new p.constructor(p.type,p);pt=x,p.target.dispatchEvent(x),pt=null}else return c=Pl(p),c!==null&&Pa(c),a.blockedOn=p,!1;c.shift()}return!0}function ct(a,c,p){Le(a)&&p.delete(c)}function Rt(){Fo=!1,us!==null&&Le(us)&&(us=null),ln!==null&&Le(ln)&&(ln=null),ds!==null&&Le(ds)&&(ds=null),Ds.forEach(ct),zo.forEach(ct)}function Nt(a,c){a.blockedOn===c&&(a.blockedOn=null,Fo||(Fo=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rt)))}function Rn(a){function c(j){return Nt(j,a)}if(0<Da.length){Nt(Da[0],a);for(var p=1;p<Da.length;p++){var x=Da[p];x.blockedOn===a&&(x.blockedOn=null)}}for(us!==null&&Nt(us,a),ln!==null&&Nt(ln,a),ds!==null&&Nt(ds,a),Ds.forEach(c),zo.forEach(c),p=0;p<fs.length;p++)x=fs[p],x.blockedOn===a&&(x.blockedOn=null);for(;0<fs.length&&(p=fs[0],p.blockedOn===null);)ge(p),p.blockedOn===null&&fs.shift()}var fn=T.ReactCurrentBatchConfig,sn=!0;function mr(a,c,p,x){var j=Pt,N=fn.transition;fn.transition=null;try{Pt=1,La(a,c,p,x)}finally{Pt=j,fn.transition=N}}function $a(a,c,p,x){var j=Pt,N=fn.transition;fn.transition=null;try{Pt=4,La(a,c,p,x)}finally{Pt=j,fn.transition=N}}function La(a,c,p,x){if(sn){var j=Ar(a,c,p,x);if(j===null)om(a,c,x,$s,p),ps(a,x);else if(J(j,a,c,p,x))x.stopPropagation();else if(ps(a,x),c&4&&-1<Up.indexOf(a)){for(;j!==null;){var N=Pl(j);if(N!==null&&Aa(N),N=Ar(a,c,p,x),N===null&&om(a,c,x,$s,p),N===j)break;j=N}j!==null&&x.stopPropagation()}else om(a,c,x,null,p)}}var $s=null;function Ar(a,c,p,x){if($s=null,a=xt(x),a=Bo(a),a!==null)if(c=ht(a),c===null)a=null;else if(p=c.tag,p===13){if(a=cu(c),a!==null)return a;a=null}else if(p===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;a=null}else c!==a&&(a=null);return $s=a,null}function gb(a){switch(a){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Mp()){case pl:return 1;case mu:return 4;case Xs:case Ca:return 16;case hu:return 536870912;default:return 16}default:return 16}}var eo=null,Wp=null,yu=null;function xb(){if(yu)return yu;var a,c=Wp,p=c.length,x,j="value"in eo?eo.value:eo.textContent,N=j.length;for(a=0;a<p&&c[a]===j[a];a++);var M=p-a;for(x=1;x<=M&&c[p-x]===j[N-x];x++);return yu=j.slice(a,1<x?1-x:void 0)}function bu(a){var c=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&c===13&&(a=13)):a=c,a===10&&(a=13),32<=a||a===13?a:0}function vu(){return!0}function yb(){return!1}function hr(a){function c(p,x,j,N,M){this._reactName=p,this._targetInst=j,this.type=x,this.nativeEvent=N,this.target=M,this.currentTarget=null;for(var Y in a)a.hasOwnProperty(Y)&&(p=a[Y],this[Y]=p?p(N):N[Y]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?vu:yb,this.isPropagationStopped=yb,this}return D(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=vu)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=vu)},persist:function(){},isPersistent:vu}),c}var Ia={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hp=hr(Ia),vl=D({},Ia,{view:0,detail:0}),sT=hr(vl),Vp,Kp,wl,wu=D({},vl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gp,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==wl&&(wl&&a.type==="mousemove"?(Vp=a.screenX-wl.screenX,Kp=a.screenY-wl.screenY):Kp=Vp=0,wl=a),Vp)},movementY:function(a){return"movementY"in a?a.movementY:Kp}}),bb=hr(wu),oT=D({},wu,{dataTransfer:0}),aT=hr(oT),iT=D({},vl,{relatedTarget:0}),qp=hr(iT),lT=D({},Ia,{animationName:0,elapsedTime:0,pseudoElement:0}),cT=hr(lT),uT=D({},Ia,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),dT=hr(uT),fT=D({},Ia,{data:0}),vb=hr(fT),pT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mT={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"},hT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gT(a){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(a):(a=hT[a])?!!c[a]:!1}function Gp(){return gT}var xT=D({},vl,{key:function(a){if(a.key){var c=pT[a.key]||a.key;if(c!=="Unidentified")return c}return a.type==="keypress"?(a=bu(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?mT[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gp,charCode:function(a){return a.type==="keypress"?bu(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?bu(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),yT=hr(xT),bT=D({},wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wb=hr(bT),vT=D({},vl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gp}),wT=hr(vT),jT=D({},Ia,{propertyName:0,elapsedTime:0,pseudoElement:0}),kT=hr(jT),ST=D({},wu,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),NT=hr(ST),CT=[9,13,27,32],Yp=u&&"CompositionEvent"in window,jl=null;u&&"documentMode"in document&&(jl=document.documentMode);var ET=u&&"TextEvent"in window&&!jl,jb=u&&(!Yp||jl&&8<jl&&11>=jl),kb=" ",Sb=!1;function Nb(a,c){switch(a){case"keyup":return CT.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cb(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Oa=!1;function TT(a,c){switch(a){case"compositionend":return Cb(c);case"keypress":return c.which!==32?null:(Sb=!0,kb);case"textInput":return a=c.data,a===kb&&Sb?null:a;default:return null}}function RT(a,c){if(Oa)return a==="compositionend"||!Yp&&Nb(a,c)?(a=xb(),yu=Wp=eo=null,Oa=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return jb&&c.locale!=="ko"?null:c.data;default:return null}}var AT={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 Eb(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c==="input"?!!AT[a.type]:c==="textarea"}function Tb(a,c,p,x){Ye(x),c=Cu(c,"onChange"),0<c.length&&(p=new Hp("onChange","change",null,p,x),a.push({event:p,listeners:c}))}var kl=null,Sl=null;function PT(a){Kb(a,0)}function ju(a){var c=Ba(a);if(st(c))return a}function DT(a,c){if(a==="change")return c}var Rb=!1;if(u){var Jp;if(u){var Qp="oninput"in document;if(!Qp){var Ab=document.createElement("div");Ab.setAttribute("oninput","return;"),Qp=typeof Ab.oninput=="function"}Jp=Qp}else Jp=!1;Rb=Jp&&(!document.documentMode||9<document.documentMode)}function Pb(){kl&&(kl.detachEvent("onpropertychange",Db),Sl=kl=null)}function Db(a){if(a.propertyName==="value"&&ju(Sl)){var c=[];Tb(c,Sl,a,xt(a)),qn(PT,c)}}function $T(a,c,p){a==="focusin"?(Pb(),kl=c,Sl=p,kl.attachEvent("onpropertychange",Db)):a==="focusout"&&Pb()}function LT(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return ju(Sl)}function IT(a,c){if(a==="click")return ju(c)}function OT(a,c){if(a==="input"||a==="change")return ju(c)}function _T(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var Gr=typeof Object.is=="function"?Object.is:_T;function Nl(a,c){if(Gr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var p=Object.keys(a),x=Object.keys(c);if(p.length!==x.length)return!1;for(x=0;x<p.length;x++){var j=p[x];if(!d.call(c,j)||!Gr(a[j],c[j]))return!1}return!0}function $b(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Lb(a,c){var p=$b(a);a=0;for(var x;p;){if(p.nodeType===3){if(x=a+p.textContent.length,a<=c&&x>=c)return{node:p,offset:c-a};a=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=$b(p)}}function Ib(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?Ib(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function Ob(){for(var a=window,c=Ze();c instanceof a.HTMLIFrameElement;){try{var p=typeof c.contentWindow.location.href=="string"}catch{p=!1}if(p)a=c.contentWindow;else break;c=Ze(a.document)}return c}function Xp(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c&&(c==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||c==="textarea"||a.contentEditable==="true")}function MT(a){var c=Ob(),p=a.focusedElem,x=a.selectionRange;if(c!==p&&p&&p.ownerDocument&&Ib(p.ownerDocument.documentElement,p)){if(x!==null&&Xp(p)){if(c=x.start,a=x.end,a===void 0&&(a=c),"selectionStart"in p)p.selectionStart=c,p.selectionEnd=Math.min(a,p.value.length);else if(a=(c=p.ownerDocument||document)&&c.defaultView||window,a.getSelection){a=a.getSelection();var j=p.textContent.length,N=Math.min(x.start,j);x=x.end===void 0?N:Math.min(x.end,j),!a.extend&&N>x&&(j=x,x=N,N=j),j=Lb(p,N);var M=Lb(p,x);j&&M&&(a.rangeCount!==1||a.anchorNode!==j.node||a.anchorOffset!==j.offset||a.focusNode!==M.node||a.focusOffset!==M.offset)&&(c=c.createRange(),c.setStart(j.node,j.offset),a.removeAllRanges(),N>x?(a.addRange(c),a.extend(M.node,M.offset)):(c.setEnd(M.node,M.offset),a.addRange(c)))}}for(c=[],a=p;a=a.parentNode;)a.nodeType===1&&c.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<c.length;p++)a=c[p],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var FT=u&&"documentMode"in document&&11>=document.documentMode,_a=null,Zp=null,Cl=null,em=!1;function _b(a,c,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;em||_a==null||_a!==Ze(x)||(x=_a,"selectionStart"in x&&Xp(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),Cl&&Nl(Cl,x)||(Cl=x,x=Cu(Zp,"onSelect"),0<x.length&&(c=new Hp("onSelect","select",null,c,p),a.push({event:c,listeners:x}),c.target=_a)))}function ku(a,c){var p={};return p[a.toLowerCase()]=c.toLowerCase(),p["Webkit"+a]="webkit"+c,p["Moz"+a]="moz"+c,p}var Ma={animationend:ku("Animation","AnimationEnd"),animationiteration:ku("Animation","AnimationIteration"),animationstart:ku("Animation","AnimationStart"),transitionend:ku("Transition","TransitionEnd")},tm={},Mb={};u&&(Mb=document.createElement("div").style,"AnimationEvent"in window||(delete Ma.animationend.animation,delete Ma.animationiteration.animation,delete Ma.animationstart.animation),"TransitionEvent"in window||delete Ma.transitionend.transition);function Su(a){if(tm[a])return tm[a];if(!Ma[a])return a;var c=Ma[a],p;for(p in c)if(c.hasOwnProperty(p)&&p in Mb)return tm[a]=c[p];return a}var Fb=Su("animationend"),zb=Su("animationiteration"),Bb=Su("animationstart"),Ub=Su("transitionend"),Wb=new Map,Hb="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 to(a,c){Wb.set(a,c),i(c,[a])}for(var nm=0;nm<Hb.length;nm++){var rm=Hb[nm],zT=rm.toLowerCase(),BT=rm[0].toUpperCase()+rm.slice(1);to(zT,"on"+BT)}to(Fb,"onAnimationEnd"),to(zb,"onAnimationIteration"),to(Bb,"onAnimationStart"),to("dblclick","onDoubleClick"),to("focusin","onFocus"),to("focusout","onBlur"),to(Ub,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var El="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(" "),UT=new Set("cancel close invalid load scroll toggle".split(" ").concat(El));function Vb(a,c,p){var x=a.type||"unknown-event";a.currentTarget=p,lu(x,c,void 0,a),a.currentTarget=null}function Kb(a,c){c=(c&4)!==0;for(var p=0;p<a.length;p++){var x=a[p],j=x.event;x=x.listeners;e:{var N=void 0;if(c)for(var M=x.length-1;0<=M;M--){var Y=x[M],Q=Y.instance,pe=Y.currentTarget;if(Y=Y.listener,Q!==N&&j.isPropagationStopped())break e;Vb(j,Y,pe),N=Q}else for(M=0;M<x.length;M++){if(Y=x[M],Q=Y.instance,pe=Y.currentTarget,Y=Y.listener,Q!==N&&j.isPropagationStopped())break e;Vb(j,Y,pe),N=Q}}}if(yt)throw a=er,yt=!1,er=null,a}function Ut(a,c){var p=c[dm];p===void 0&&(p=c[dm]=new Set);var x=a+"__bubble";p.has(x)||(qb(c,a,2,!1),p.add(x))}function sm(a,c,p){var x=0;c&&(x|=4),qb(p,a,x,c)}var Nu="_reactListening"+Math.random().toString(36).slice(2);function Tl(a){if(!a[Nu]){a[Nu]=!0,s.forEach(function(p){p!=="selectionchange"&&(UT.has(p)||sm(p,!1,a),sm(p,!0,a))});var c=a.nodeType===9?a:a.ownerDocument;c===null||c[Nu]||(c[Nu]=!0,sm("selectionchange",!1,c))}}function qb(a,c,p,x){switch(gb(c)){case 1:var j=mr;break;case 4:j=$a;break;default:j=La}p=j.bind(null,c,p,a),j=void 0,!Fn||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(j=!0),x?j!==void 0?a.addEventListener(c,p,{capture:!0,passive:j}):a.addEventListener(c,p,!0):j!==void 0?a.addEventListener(c,p,{passive:j}):a.addEventListener(c,p,!1)}function om(a,c,p,x,j){var N=x;if((c&1)===0&&(c&2)===0&&x!==null)e:for(;;){if(x===null)return;var M=x.tag;if(M===3||M===4){var Y=x.stateNode.containerInfo;if(Y===j||Y.nodeType===8&&Y.parentNode===j)break;if(M===4)for(M=x.return;M!==null;){var Q=M.tag;if((Q===3||Q===4)&&(Q=M.stateNode.containerInfo,Q===j||Q.nodeType===8&&Q.parentNode===j))return;M=M.return}for(;Y!==null;){if(M=Bo(Y),M===null)return;if(Q=M.tag,Q===5||Q===6){x=N=M;continue e}Y=Y.parentNode}}x=x.return}qn(function(){var pe=N,je=xt(p),Ce=[];e:{var we=Wb.get(a);if(we!==void 0){var Ue=Hp,Ge=a;switch(a){case"keypress":if(bu(p)===0)break e;case"keydown":case"keyup":Ue=yT;break;case"focusin":Ge="focus",Ue=qp;break;case"focusout":Ge="blur",Ue=qp;break;case"beforeblur":case"afterblur":Ue=qp;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ue=bb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ue=aT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ue=wT;break;case Fb:case zb:case Bb:Ue=cT;break;case Ub:Ue=kT;break;case"scroll":Ue=sT;break;case"wheel":Ue=NT;break;case"copy":case"cut":case"paste":Ue=dT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ue=wb}var Je=(c&4)!==0,cn=!Je&&a==="scroll",ie=Je?we!==null?we+"Capture":null:we;Je=[];for(var te=pe,de;te!==null;){de=te;var $e=de.stateNode;if(de.tag===5&&$e!==null&&(de=$e,ie!==null&&($e=Et(te,ie),$e!=null&&Je.push(Rl(te,$e,de)))),cn)break;te=te.return}0<Je.length&&(we=new Ue(we,Ge,null,p,je),Ce.push({event:we,listeners:Je}))}}if((c&7)===0){e:{if(we=a==="mouseover"||a==="pointerover",Ue=a==="mouseout"||a==="pointerout",we&&p!==pt&&(Ge=p.relatedTarget||p.fromElement)&&(Bo(Ge)||Ge[Ls]))break e;if((Ue||we)&&(we=je.window===je?je:(we=je.ownerDocument)?we.defaultView||we.parentWindow:window,Ue?(Ge=p.relatedTarget||p.toElement,Ue=pe,Ge=Ge?Bo(Ge):null,Ge!==null&&(cn=ht(Ge),Ge!==cn||Ge.tag!==5&&Ge.tag!==6)&&(Ge=null)):(Ue=null,Ge=pe),Ue!==Ge)){if(Je=bb,$e="onMouseLeave",ie="onMouseEnter",te="mouse",(a==="pointerout"||a==="pointerover")&&(Je=wb,$e="onPointerLeave",ie="onPointerEnter",te="pointer"),cn=Ue==null?we:Ba(Ue),de=Ge==null?we:Ba(Ge),we=new Je($e,te+"leave",Ue,p,je),we.target=cn,we.relatedTarget=de,$e=null,Bo(je)===pe&&(Je=new Je(ie,te+"enter",Ge,p,je),Je.target=de,Je.relatedTarget=cn,$e=Je),cn=$e,Ue&&Ge)t:{for(Je=Ue,ie=Ge,te=0,de=Je;de;de=Fa(de))te++;for(de=0,$e=ie;$e;$e=Fa($e))de++;for(;0<te-de;)Je=Fa(Je),te--;for(;0<de-te;)ie=Fa(ie),de--;for(;te--;){if(Je===ie||ie!==null&&Je===ie.alternate)break t;Je=Fa(Je),ie=Fa(ie)}Je=null}else Je=null;Ue!==null&&Gb(Ce,we,Ue,Je,!1),Ge!==null&&cn!==null&&Gb(Ce,cn,Ge,Je,!0)}}e:{if(we=pe?Ba(pe):window,Ue=we.nodeName&&we.nodeName.toLowerCase(),Ue==="select"||Ue==="input"&&we.type==="file")var Qe=DT;else if(Eb(we))if(Rb)Qe=OT;else{Qe=LT;var nt=$T}else(Ue=we.nodeName)&&Ue.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Qe=IT);if(Qe&&(Qe=Qe(a,pe))){Tb(Ce,Qe,p,je);break e}nt&&nt(a,we,pe),a==="focusout"&&(nt=we._wrapperState)&&nt.controlled&&we.type==="number"&&ze(we,"number",we.value)}switch(nt=pe?Ba(pe):window,a){case"focusin":(Eb(nt)||nt.contentEditable==="true")&&(_a=nt,Zp=pe,Cl=null);break;case"focusout":Cl=Zp=_a=null;break;case"mousedown":em=!0;break;case"contextmenu":case"mouseup":case"dragend":em=!1,_b(Ce,p,je);break;case"selectionchange":if(FT)break;case"keydown":case"keyup":_b(Ce,p,je)}var rt;if(Yp)e:{switch(a){case"compositionstart":var it="onCompositionStart";break e;case"compositionend":it="onCompositionEnd";break e;case"compositionupdate":it="onCompositionUpdate";break e}it=void 0}else Oa?Nb(a,p)&&(it="onCompositionEnd"):a==="keydown"&&p.keyCode===229&&(it="onCompositionStart");it&&(jb&&p.locale!=="ko"&&(Oa||it!=="onCompositionStart"?it==="onCompositionEnd"&&Oa&&(rt=xb()):(eo=je,Wp="value"in eo?eo.value:eo.textContent,Oa=!0)),nt=Cu(pe,it),0<nt.length&&(it=new vb(it,a,null,p,je),Ce.push({event:it,listeners:nt}),rt?it.data=rt:(rt=Cb(p),rt!==null&&(it.data=rt)))),(rt=ET?TT(a,p):RT(a,p))&&(pe=Cu(pe,"onBeforeInput"),0<pe.length&&(je=new vb("onBeforeInput","beforeinput",null,p,je),Ce.push({event:je,listeners:pe}),je.data=rt))}Kb(Ce,c)})}function Rl(a,c,p){return{instance:a,listener:c,currentTarget:p}}function Cu(a,c){for(var p=c+"Capture",x=[];a!==null;){var j=a,N=j.stateNode;j.tag===5&&N!==null&&(j=N,N=Et(a,p),N!=null&&x.unshift(Rl(a,N,j)),N=Et(a,c),N!=null&&x.push(Rl(a,N,j))),a=a.return}return x}function Fa(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function Gb(a,c,p,x,j){for(var N=c._reactName,M=[];p!==null&&p!==x;){var Y=p,Q=Y.alternate,pe=Y.stateNode;if(Q!==null&&Q===x)break;Y.tag===5&&pe!==null&&(Y=pe,j?(Q=Et(p,N),Q!=null&&M.unshift(Rl(p,Q,Y))):j||(Q=Et(p,N),Q!=null&&M.push(Rl(p,Q,Y)))),p=p.return}M.length!==0&&a.push({event:c,listeners:M})}var WT=/\r\n?/g,HT=/\u0000|\uFFFD/g;function Yb(a){return(typeof a=="string"?a:""+a).replace(WT,`
|
|
38
|
+
`).replace(HT,"")}function Eu(a,c,p){if(c=Yb(c),Yb(a)!==c&&p)throw Error(n(425))}function Tu(){}var am=null,im=null;function lm(a,c){return a==="textarea"||a==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var cm=typeof setTimeout=="function"?setTimeout:void 0,VT=typeof clearTimeout=="function"?clearTimeout:void 0,Jb=typeof Promise=="function"?Promise:void 0,KT=typeof queueMicrotask=="function"?queueMicrotask:typeof Jb<"u"?function(a){return Jb.resolve(null).then(a).catch(qT)}:cm;function qT(a){setTimeout(function(){throw a})}function um(a,c){var p=c,x=0;do{var j=p.nextSibling;if(a.removeChild(p),j&&j.nodeType===8)if(p=j.data,p==="/$"){if(x===0){a.removeChild(j),Rn(c);return}x--}else p!=="$"&&p!=="$?"&&p!=="$!"||x++;p=j}while(p);Rn(c)}function no(a){for(;a!=null;a=a.nextSibling){var c=a.nodeType;if(c===1||c===3)break;if(c===8){if(c=a.data,c==="$"||c==="$!"||c==="$?")break;if(c==="/$")return null}}return a}function Qb(a){a=a.previousSibling;for(var c=0;a;){if(a.nodeType===8){var p=a.data;if(p==="$"||p==="$!"||p==="$?"){if(c===0)return a;c--}else p==="/$"&&c++}a=a.previousSibling}return null}var za=Math.random().toString(36).slice(2),ms="__reactFiber$"+za,Al="__reactProps$"+za,Ls="__reactContainer$"+za,dm="__reactEvents$"+za,GT="__reactListeners$"+za,YT="__reactHandles$"+za;function Bo(a){var c=a[ms];if(c)return c;for(var p=a.parentNode;p;){if(c=p[Ls]||p[ms]){if(p=c.alternate,c.child!==null||p!==null&&p.child!==null)for(a=Qb(a);a!==null;){if(p=a[ms])return p;a=Qb(a)}return c}a=p,p=a.parentNode}return null}function Pl(a){return a=a[ms]||a[Ls],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function Ba(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function Ru(a){return a[Al]||null}var fm=[],Ua=-1;function ro(a){return{current:a}}function Wt(a){0>Ua||(a.current=fm[Ua],fm[Ua]=null,Ua--)}function Ft(a,c){Ua++,fm[Ua]=a.current,a.current=c}var so={},Bn=ro(so),tr=ro(!1),Uo=so;function Wa(a,c){var p=a.type.contextTypes;if(!p)return so;var x=a.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===c)return x.__reactInternalMemoizedMaskedChildContext;var j={},N;for(N in p)j[N]=c[N];return x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=c,a.__reactInternalMemoizedMaskedChildContext=j),j}function nr(a){return a=a.childContextTypes,a!=null}function Au(){Wt(tr),Wt(Bn)}function Xb(a,c,p){if(Bn.current!==so)throw Error(n(168));Ft(Bn,c),Ft(tr,p)}function Zb(a,c,p){var x=a.stateNode;if(c=c.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in c))throw Error(n(108,xe(a)||"Unknown",j));return D({},p,x)}function Pu(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||so,Uo=Bn.current,Ft(Bn,a),Ft(tr,tr.current),!0}function ev(a,c,p){var x=a.stateNode;if(!x)throw Error(n(169));p?(a=Zb(a,c,Uo),x.__reactInternalMemoizedMergedChildContext=a,Wt(tr),Wt(Bn),Ft(Bn,a)):Wt(tr),Ft(tr,p)}var Is=null,Du=!1,pm=!1;function tv(a){Is===null?Is=[a]:Is.push(a)}function JT(a){Du=!0,tv(a)}function oo(){if(!pm&&Is!==null){pm=!0;var a=0,c=Pt;try{var p=Is;for(Pt=1;a<p.length;a++){var x=p[a];do x=x(!0);while(x!==null)}Is=null,Du=!1}catch(j){throw Is!==null&&(Is=Is.slice(a+1)),fu(pl,oo),j}finally{Pt=c,pm=!1}}return null}var Ha=[],Va=0,$u=null,Lu=0,Pr=[],Dr=0,Wo=null,Os=1,_s="";function Ho(a,c){Ha[Va++]=Lu,Ha[Va++]=$u,$u=a,Lu=c}function nv(a,c,p){Pr[Dr++]=Os,Pr[Dr++]=_s,Pr[Dr++]=Wo,Wo=a;var x=Os;a=_s;var j=32-zn(x)-1;x&=~(1<<j),p+=1;var N=32-zn(c)+j;if(30<N){var M=j-j%5;N=(x&(1<<M)-1).toString(32),x>>=M,j-=M,Os=1<<32-zn(c)+j|p<<j|x,_s=N+a}else Os=1<<N|p<<j|x,_s=a}function mm(a){a.return!==null&&(Ho(a,1),nv(a,1,0))}function hm(a){for(;a===$u;)$u=Ha[--Va],Ha[Va]=null,Lu=Ha[--Va],Ha[Va]=null;for(;a===Wo;)Wo=Pr[--Dr],Pr[Dr]=null,_s=Pr[--Dr],Pr[Dr]=null,Os=Pr[--Dr],Pr[Dr]=null}var gr=null,xr=null,Jt=!1,Yr=null;function rv(a,c){var p=Or(5,null,null,0);p.elementType="DELETED",p.stateNode=c,p.return=a,c=a.deletions,c===null?(a.deletions=[p],a.flags|=16):c.push(p)}function sv(a,c){switch(a.tag){case 5:var p=a.type;return c=c.nodeType!==1||p.toLowerCase()!==c.nodeName.toLowerCase()?null:c,c!==null?(a.stateNode=c,gr=a,xr=no(c.firstChild),!0):!1;case 6:return c=a.pendingProps===""||c.nodeType!==3?null:c,c!==null?(a.stateNode=c,gr=a,xr=null,!0):!1;case 13:return c=c.nodeType!==8?null:c,c!==null?(p=Wo!==null?{id:Os,overflow:_s}:null,a.memoizedState={dehydrated:c,treeContext:p,retryLane:1073741824},p=Or(18,null,null,0),p.stateNode=c,p.return=a,a.child=p,gr=a,xr=null,!0):!1;default:return!1}}function gm(a){return(a.mode&1)!==0&&(a.flags&128)===0}function xm(a){if(Jt){var c=xr;if(c){var p=c;if(!sv(a,c)){if(gm(a))throw Error(n(418));c=no(p.nextSibling);var x=gr;c&&sv(a,c)?rv(x,p):(a.flags=a.flags&-4097|2,Jt=!1,gr=a)}}else{if(gm(a))throw Error(n(418));a.flags=a.flags&-4097|2,Jt=!1,gr=a}}}function ov(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;gr=a}function Iu(a){if(a!==gr)return!1;if(!Jt)return ov(a),Jt=!0,!1;var c;if((c=a.tag!==3)&&!(c=a.tag!==5)&&(c=a.type,c=c!=="head"&&c!=="body"&&!lm(a.type,a.memoizedProps)),c&&(c=xr)){if(gm(a))throw av(),Error(n(418));for(;c;)rv(a,c),c=no(c.nextSibling)}if(ov(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,c=0;a;){if(a.nodeType===8){var p=a.data;if(p==="/$"){if(c===0){xr=no(a.nextSibling);break e}c--}else p!=="$"&&p!=="$!"&&p!=="$?"||c++}a=a.nextSibling}xr=null}}else xr=gr?no(a.stateNode.nextSibling):null;return!0}function av(){for(var a=xr;a;)a=no(a.nextSibling)}function Ka(){xr=gr=null,Jt=!1}function ym(a){Yr===null?Yr=[a]:Yr.push(a)}var QT=T.ReactCurrentBatchConfig;function Dl(a,c,p){if(a=p.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(n(309));var x=p.stateNode}if(!x)throw Error(n(147,a));var j=x,N=""+a;return c!==null&&c.ref!==null&&typeof c.ref=="function"&&c.ref._stringRef===N?c.ref:(c=function(M){var Y=j.refs;M===null?delete Y[N]:Y[N]=M},c._stringRef=N,c)}if(typeof a!="string")throw Error(n(284));if(!p._owner)throw Error(n(290,a))}return a}function Ou(a,c){throw a=Object.prototype.toString.call(c),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a))}function iv(a){var c=a._init;return c(a._payload)}function lv(a){function c(ie,te){if(a){var de=ie.deletions;de===null?(ie.deletions=[te],ie.flags|=16):de.push(te)}}function p(ie,te){if(!a)return null;for(;te!==null;)c(ie,te),te=te.sibling;return null}function x(ie,te){for(ie=new Map;te!==null;)te.key!==null?ie.set(te.key,te):ie.set(te.index,te),te=te.sibling;return ie}function j(ie,te){return ie=mo(ie,te),ie.index=0,ie.sibling=null,ie}function N(ie,te,de){return ie.index=de,a?(de=ie.alternate,de!==null?(de=de.index,de<te?(ie.flags|=2,te):de):(ie.flags|=2,te)):(ie.flags|=1048576,te)}function M(ie){return a&&ie.alternate===null&&(ie.flags|=2),ie}function Y(ie,te,de,$e){return te===null||te.tag!==6?(te=ch(de,ie.mode,$e),te.return=ie,te):(te=j(te,de),te.return=ie,te)}function Q(ie,te,de,$e){var Qe=de.type;return Qe===P?je(ie,te,de.props.children,$e,de.key):te!==null&&(te.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===K&&iv(Qe)===te.type)?($e=j(te,de.props),$e.ref=Dl(ie,te,de),$e.return=ie,$e):($e=ad(de.type,de.key,de.props,null,ie.mode,$e),$e.ref=Dl(ie,te,de),$e.return=ie,$e)}function pe(ie,te,de,$e){return te===null||te.tag!==4||te.stateNode.containerInfo!==de.containerInfo||te.stateNode.implementation!==de.implementation?(te=uh(de,ie.mode,$e),te.return=ie,te):(te=j(te,de.children||[]),te.return=ie,te)}function je(ie,te,de,$e,Qe){return te===null||te.tag!==7?(te=Xo(de,ie.mode,$e,Qe),te.return=ie,te):(te=j(te,de),te.return=ie,te)}function Ce(ie,te,de){if(typeof te=="string"&&te!==""||typeof te=="number")return te=ch(""+te,ie.mode,de),te.return=ie,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case I:return de=ad(te.type,te.key,te.props,null,ie.mode,de),de.ref=Dl(ie,null,te),de.return=ie,de;case R:return te=uh(te,ie.mode,de),te.return=ie,te;case K:var $e=te._init;return Ce(ie,$e(te._payload),de)}if(et(te)||G(te))return te=Xo(te,ie.mode,de,null),te.return=ie,te;Ou(ie,te)}return null}function we(ie,te,de,$e){var Qe=te!==null?te.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return Qe!==null?null:Y(ie,te,""+de,$e);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case I:return de.key===Qe?Q(ie,te,de,$e):null;case R:return de.key===Qe?pe(ie,te,de,$e):null;case K:return Qe=de._init,we(ie,te,Qe(de._payload),$e)}if(et(de)||G(de))return Qe!==null?null:je(ie,te,de,$e,null);Ou(ie,de)}return null}function Ue(ie,te,de,$e,Qe){if(typeof $e=="string"&&$e!==""||typeof $e=="number")return ie=ie.get(de)||null,Y(te,ie,""+$e,Qe);if(typeof $e=="object"&&$e!==null){switch($e.$$typeof){case I:return ie=ie.get($e.key===null?de:$e.key)||null,Q(te,ie,$e,Qe);case R:return ie=ie.get($e.key===null?de:$e.key)||null,pe(te,ie,$e,Qe);case K:var nt=$e._init;return Ue(ie,te,de,nt($e._payload),Qe)}if(et($e)||G($e))return ie=ie.get(de)||null,je(te,ie,$e,Qe,null);Ou(te,$e)}return null}function Ge(ie,te,de,$e){for(var Qe=null,nt=null,rt=te,it=te=0,Dn=null;rt!==null&&it<de.length;it++){rt.index>it?(Dn=rt,rt=null):Dn=rt.sibling;var At=we(ie,rt,de[it],$e);if(At===null){rt===null&&(rt=Dn);break}a&&rt&&At.alternate===null&&c(ie,rt),te=N(At,te,it),nt===null?Qe=At:nt.sibling=At,nt=At,rt=Dn}if(it===de.length)return p(ie,rt),Jt&&Ho(ie,it),Qe;if(rt===null){for(;it<de.length;it++)rt=Ce(ie,de[it],$e),rt!==null&&(te=N(rt,te,it),nt===null?Qe=rt:nt.sibling=rt,nt=rt);return Jt&&Ho(ie,it),Qe}for(rt=x(ie,rt);it<de.length;it++)Dn=Ue(rt,ie,it,de[it],$e),Dn!==null&&(a&&Dn.alternate!==null&&rt.delete(Dn.key===null?it:Dn.key),te=N(Dn,te,it),nt===null?Qe=Dn:nt.sibling=Dn,nt=Dn);return a&&rt.forEach(function(ho){return c(ie,ho)}),Jt&&Ho(ie,it),Qe}function Je(ie,te,de,$e){var Qe=G(de);if(typeof Qe!="function")throw Error(n(150));if(de=Qe.call(de),de==null)throw Error(n(151));for(var nt=Qe=null,rt=te,it=te=0,Dn=null,At=de.next();rt!==null&&!At.done;it++,At=de.next()){rt.index>it?(Dn=rt,rt=null):Dn=rt.sibling;var ho=we(ie,rt,At.value,$e);if(ho===null){rt===null&&(rt=Dn);break}a&&rt&&ho.alternate===null&&c(ie,rt),te=N(ho,te,it),nt===null?Qe=ho:nt.sibling=ho,nt=ho,rt=Dn}if(At.done)return p(ie,rt),Jt&&Ho(ie,it),Qe;if(rt===null){for(;!At.done;it++,At=de.next())At=Ce(ie,At.value,$e),At!==null&&(te=N(At,te,it),nt===null?Qe=At:nt.sibling=At,nt=At);return Jt&&Ho(ie,it),Qe}for(rt=x(ie,rt);!At.done;it++,At=de.next())At=Ue(rt,ie,it,At.value,$e),At!==null&&(a&&At.alternate!==null&&rt.delete(At.key===null?it:At.key),te=N(At,te,it),nt===null?Qe=At:nt.sibling=At,nt=At);return a&&rt.forEach(function(AR){return c(ie,AR)}),Jt&&Ho(ie,it),Qe}function cn(ie,te,de,$e){if(typeof de=="object"&&de!==null&&de.type===P&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case I:e:{for(var Qe=de.key,nt=te;nt!==null;){if(nt.key===Qe){if(Qe=de.type,Qe===P){if(nt.tag===7){p(ie,nt.sibling),te=j(nt,de.props.children),te.return=ie,ie=te;break e}}else if(nt.elementType===Qe||typeof Qe=="object"&&Qe!==null&&Qe.$$typeof===K&&iv(Qe)===nt.type){p(ie,nt.sibling),te=j(nt,de.props),te.ref=Dl(ie,nt,de),te.return=ie,ie=te;break e}p(ie,nt);break}else c(ie,nt);nt=nt.sibling}de.type===P?(te=Xo(de.props.children,ie.mode,$e,de.key),te.return=ie,ie=te):($e=ad(de.type,de.key,de.props,null,ie.mode,$e),$e.ref=Dl(ie,te,de),$e.return=ie,ie=$e)}return M(ie);case R:e:{for(nt=de.key;te!==null;){if(te.key===nt)if(te.tag===4&&te.stateNode.containerInfo===de.containerInfo&&te.stateNode.implementation===de.implementation){p(ie,te.sibling),te=j(te,de.children||[]),te.return=ie,ie=te;break e}else{p(ie,te);break}else c(ie,te);te=te.sibling}te=uh(de,ie.mode,$e),te.return=ie,ie=te}return M(ie);case K:return nt=de._init,cn(ie,te,nt(de._payload),$e)}if(et(de))return Ge(ie,te,de,$e);if(G(de))return Je(ie,te,de,$e);Ou(ie,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,te!==null&&te.tag===6?(p(ie,te.sibling),te=j(te,de),te.return=ie,ie=te):(p(ie,te),te=ch(de,ie.mode,$e),te.return=ie,ie=te),M(ie)):p(ie,te)}return cn}var qa=lv(!0),cv=lv(!1),_u=ro(null),Mu=null,Ga=null,bm=null;function vm(){bm=Ga=Mu=null}function wm(a){var c=_u.current;Wt(_u),a._currentValue=c}function jm(a,c,p){for(;a!==null;){var x=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,x!==null&&(x.childLanes|=c)):x!==null&&(x.childLanes&c)!==c&&(x.childLanes|=c),a===p)break;a=a.return}}function Ya(a,c){Mu=a,bm=Ga=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&c)!==0&&(rr=!0),a.firstContext=null)}function $r(a){var c=a._currentValue;if(bm!==a)if(a={context:a,memoizedValue:c,next:null},Ga===null){if(Mu===null)throw Error(n(308));Ga=a,Mu.dependencies={lanes:0,firstContext:a}}else Ga=Ga.next=a;return c}var Vo=null;function km(a){Vo===null?Vo=[a]:Vo.push(a)}function uv(a,c,p,x){var j=c.interleaved;return j===null?(p.next=p,km(c)):(p.next=j.next,j.next=p),c.interleaved=p,Ms(a,x)}function Ms(a,c){a.lanes|=c;var p=a.alternate;for(p!==null&&(p.lanes|=c),p=a,a=a.return;a!==null;)a.childLanes|=c,p=a.alternate,p!==null&&(p.childLanes|=c),p=a,a=a.return;return p.tag===3?p.stateNode:null}var ao=!1;function Sm(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dv(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function Fs(a,c){return{eventTime:a,lane:c,tag:0,payload:null,callback:null,next:null}}function io(a,c,p){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(Ct&2)!==0){var j=x.pending;return j===null?c.next=c:(c.next=j.next,j.next=c),x.pending=c,Ms(a,p)}return j=x.interleaved,j===null?(c.next=c,km(x)):(c.next=j.next,j.next=c),x.interleaved=c,Ms(a,p)}function Fu(a,c,p){if(c=c.updateQueue,c!==null&&(c=c.shared,(p&4194240)!==0)){var x=c.lanes;x&=a.pendingLanes,p|=x,c.lanes=p,gl(a,p)}}function fv(a,c){var p=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,N=null;if(p=p.firstBaseUpdate,p!==null){do{var M={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};N===null?j=N=M:N=N.next=M,p=p.next}while(p!==null);N===null?j=N=c:N=N.next=c}else j=N=c;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:N,shared:x.shared,effects:x.effects},a.updateQueue=p;return}a=p.lastBaseUpdate,a===null?p.firstBaseUpdate=c:a.next=c,p.lastBaseUpdate=c}function zu(a,c,p,x){var j=a.updateQueue;ao=!1;var N=j.firstBaseUpdate,M=j.lastBaseUpdate,Y=j.shared.pending;if(Y!==null){j.shared.pending=null;var Q=Y,pe=Q.next;Q.next=null,M===null?N=pe:M.next=pe,M=Q;var je=a.alternate;je!==null&&(je=je.updateQueue,Y=je.lastBaseUpdate,Y!==M&&(Y===null?je.firstBaseUpdate=pe:Y.next=pe,je.lastBaseUpdate=Q))}if(N!==null){var Ce=j.baseState;M=0,je=pe=Q=null,Y=N;do{var we=Y.lane,Ue=Y.eventTime;if((x&we)===we){je!==null&&(je=je.next={eventTime:Ue,lane:0,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null});e:{var Ge=a,Je=Y;switch(we=c,Ue=p,Je.tag){case 1:if(Ge=Je.payload,typeof Ge=="function"){Ce=Ge.call(Ue,Ce,we);break e}Ce=Ge;break e;case 3:Ge.flags=Ge.flags&-65537|128;case 0:if(Ge=Je.payload,we=typeof Ge=="function"?Ge.call(Ue,Ce,we):Ge,we==null)break e;Ce=D({},Ce,we);break e;case 2:ao=!0}}Y.callback!==null&&Y.lane!==0&&(a.flags|=64,we=j.effects,we===null?j.effects=[Y]:we.push(Y))}else Ue={eventTime:Ue,lane:we,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},je===null?(pe=je=Ue,Q=Ce):je=je.next=Ue,M|=we;if(Y=Y.next,Y===null){if(Y=j.shared.pending,Y===null)break;we=Y,Y=we.next,we.next=null,j.lastBaseUpdate=we,j.shared.pending=null}}while(!0);if(je===null&&(Q=Ce),j.baseState=Q,j.firstBaseUpdate=pe,j.lastBaseUpdate=je,c=j.shared.interleaved,c!==null){j=c;do M|=j.lane,j=j.next;while(j!==c)}else N===null&&(j.shared.lanes=0);Go|=M,a.lanes=M,a.memoizedState=Ce}}function pv(a,c,p){if(a=c.effects,c.effects=null,a!==null)for(c=0;c<a.length;c++){var x=a[c],j=x.callback;if(j!==null){if(x.callback=null,x=p,typeof j!="function")throw Error(n(191,j));j.call(x)}}}var $l={},hs=ro($l),Ll=ro($l),Il=ro($l);function Ko(a){if(a===$l)throw Error(n(174));return a}function Nm(a,c){switch(Ft(Il,c),Ft(Ll,a),Ft(hs,$l),a=c.nodeType,a){case 9:case 11:c=(c=c.documentElement)?c.namespaceURI:X(null,"");break;default:a=a===8?c.parentNode:c,c=a.namespaceURI||null,a=a.tagName,c=X(c,a)}Wt(hs),Ft(hs,c)}function Ja(){Wt(hs),Wt(Ll),Wt(Il)}function mv(a){Ko(Il.current);var c=Ko(hs.current),p=X(c,a.type);c!==p&&(Ft(Ll,a),Ft(hs,p))}function Cm(a){Ll.current===a&&(Wt(hs),Wt(Ll))}var en=ro(0);function Bu(a){for(var c=a;c!==null;){if(c.tag===13){var p=c.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return c}else if(c.tag===19&&c.memoizedProps.revealOrder!==void 0){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Em=[];function Tm(){for(var a=0;a<Em.length;a++)Em[a]._workInProgressVersionPrimary=null;Em.length=0}var Uu=T.ReactCurrentDispatcher,Rm=T.ReactCurrentBatchConfig,qo=0,tn=null,wn=null,An=null,Wu=!1,Ol=!1,_l=0,XT=0;function Un(){throw Error(n(321))}function Am(a,c){if(c===null)return!1;for(var p=0;p<c.length&&p<a.length;p++)if(!Gr(a[p],c[p]))return!1;return!0}function Pm(a,c,p,x,j,N){if(qo=N,tn=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Uu.current=a===null||a.memoizedState===null?nR:rR,a=p(x,j),Ol){N=0;do{if(Ol=!1,_l=0,25<=N)throw Error(n(301));N+=1,An=wn=null,c.updateQueue=null,Uu.current=sR,a=p(x,j)}while(Ol)}if(Uu.current=Ku,c=wn!==null&&wn.next!==null,qo=0,An=wn=tn=null,Wu=!1,c)throw Error(n(300));return a}function Dm(){var a=_l!==0;return _l=0,a}function gs(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return An===null?tn.memoizedState=An=a:An=An.next=a,An}function Lr(){if(wn===null){var a=tn.alternate;a=a!==null?a.memoizedState:null}else a=wn.next;var c=An===null?tn.memoizedState:An.next;if(c!==null)An=c,wn=a;else{if(a===null)throw Error(n(310));wn=a,a={memoizedState:wn.memoizedState,baseState:wn.baseState,baseQueue:wn.baseQueue,queue:wn.queue,next:null},An===null?tn.memoizedState=An=a:An=An.next=a}return An}function Ml(a,c){return typeof c=="function"?c(a):c}function $m(a){var c=Lr(),p=c.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=a;var x=wn,j=x.baseQueue,N=p.pending;if(N!==null){if(j!==null){var M=j.next;j.next=N.next,N.next=M}x.baseQueue=j=N,p.pending=null}if(j!==null){N=j.next,x=x.baseState;var Y=M=null,Q=null,pe=N;do{var je=pe.lane;if((qo&je)===je)Q!==null&&(Q=Q.next={lane:0,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),x=pe.hasEagerState?pe.eagerState:a(x,pe.action);else{var Ce={lane:je,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null};Q===null?(Y=Q=Ce,M=x):Q=Q.next=Ce,tn.lanes|=je,Go|=je}pe=pe.next}while(pe!==null&&pe!==N);Q===null?M=x:Q.next=Y,Gr(x,c.memoizedState)||(rr=!0),c.memoizedState=x,c.baseState=M,c.baseQueue=Q,p.lastRenderedState=x}if(a=p.interleaved,a!==null){j=a;do N=j.lane,tn.lanes|=N,Go|=N,j=j.next;while(j!==a)}else j===null&&(p.lanes=0);return[c.memoizedState,p.dispatch]}function Lm(a){var c=Lr(),p=c.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=a;var x=p.dispatch,j=p.pending,N=c.memoizedState;if(j!==null){p.pending=null;var M=j=j.next;do N=a(N,M.action),M=M.next;while(M!==j);Gr(N,c.memoizedState)||(rr=!0),c.memoizedState=N,c.baseQueue===null&&(c.baseState=N),p.lastRenderedState=N}return[N,x]}function hv(){}function gv(a,c){var p=tn,x=Lr(),j=c(),N=!Gr(x.memoizedState,j);if(N&&(x.memoizedState=j,rr=!0),x=x.queue,Im(bv.bind(null,p,x,a),[a]),x.getSnapshot!==c||N||An!==null&&An.memoizedState.tag&1){if(p.flags|=2048,Fl(9,yv.bind(null,p,x,j,c),void 0,null),Pn===null)throw Error(n(349));(qo&30)!==0||xv(p,c,j)}return j}function xv(a,c,p){a.flags|=16384,a={getSnapshot:c,value:p},c=tn.updateQueue,c===null?(c={lastEffect:null,stores:null},tn.updateQueue=c,c.stores=[a]):(p=c.stores,p===null?c.stores=[a]:p.push(a))}function yv(a,c,p,x){c.value=p,c.getSnapshot=x,vv(c)&&wv(a)}function bv(a,c,p){return p(function(){vv(c)&&wv(a)})}function vv(a){var c=a.getSnapshot;a=a.value;try{var p=c();return!Gr(a,p)}catch{return!0}}function wv(a){var c=Ms(a,1);c!==null&&Zr(c,a,1,-1)}function jv(a){var c=gs();return typeof a=="function"&&(a=a()),c.memoizedState=c.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ml,lastRenderedState:a},c.queue=a,a=a.dispatch=tR.bind(null,tn,a),[c.memoizedState,a]}function Fl(a,c,p,x){return a={tag:a,create:c,destroy:p,deps:x,next:null},c=tn.updateQueue,c===null?(c={lastEffect:null,stores:null},tn.updateQueue=c,c.lastEffect=a.next=a):(p=c.lastEffect,p===null?c.lastEffect=a.next=a:(x=p.next,p.next=a,a.next=x,c.lastEffect=a)),a}function kv(){return Lr().memoizedState}function Hu(a,c,p,x){var j=gs();tn.flags|=a,j.memoizedState=Fl(1|c,p,void 0,x===void 0?null:x)}function Vu(a,c,p,x){var j=Lr();x=x===void 0?null:x;var N=void 0;if(wn!==null){var M=wn.memoizedState;if(N=M.destroy,x!==null&&Am(x,M.deps)){j.memoizedState=Fl(c,p,N,x);return}}tn.flags|=a,j.memoizedState=Fl(1|c,p,N,x)}function Sv(a,c){return Hu(8390656,8,a,c)}function Im(a,c){return Vu(2048,8,a,c)}function Nv(a,c){return Vu(4,2,a,c)}function Cv(a,c){return Vu(4,4,a,c)}function Ev(a,c){if(typeof c=="function")return a=a(),c(a),function(){c(null)};if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function Tv(a,c,p){return p=p!=null?p.concat([a]):null,Vu(4,4,Ev.bind(null,c,a),p)}function Om(){}function Rv(a,c){var p=Lr();c=c===void 0?null:c;var x=p.memoizedState;return x!==null&&c!==null&&Am(c,x[1])?x[0]:(p.memoizedState=[a,c],a)}function Av(a,c){var p=Lr();c=c===void 0?null:c;var x=p.memoizedState;return x!==null&&c!==null&&Am(c,x[1])?x[0]:(a=a(),p.memoizedState=[a,c],a)}function Pv(a,c,p){return(qo&21)===0?(a.baseState&&(a.baseState=!1,rr=!0),a.memoizedState=p):(Gr(p,c)||(p=ml(),tn.lanes|=p,Go|=p,a.baseState=!0),c)}function ZT(a,c){var p=Pt;Pt=p!==0&&4>p?p:4,a(!0);var x=Rm.transition;Rm.transition={};try{a(!1),c()}finally{Pt=p,Rm.transition=x}}function Dv(){return Lr().memoizedState}function eR(a,c,p){var x=fo(a);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},$v(a))Lv(c,p);else if(p=uv(a,c,p,x),p!==null){var j=Jn();Zr(p,a,x,j),Iv(p,c,x)}}function tR(a,c,p){var x=fo(a),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if($v(a))Lv(c,j);else{var N=a.alternate;if(a.lanes===0&&(N===null||N.lanes===0)&&(N=c.lastRenderedReducer,N!==null))try{var M=c.lastRenderedState,Y=N(M,p);if(j.hasEagerState=!0,j.eagerState=Y,Gr(Y,M)){var Q=c.interleaved;Q===null?(j.next=j,km(c)):(j.next=Q.next,Q.next=j),c.interleaved=j;return}}catch{}finally{}p=uv(a,c,j,x),p!==null&&(j=Jn(),Zr(p,a,x,j),Iv(p,c,x))}}function $v(a){var c=a.alternate;return a===tn||c!==null&&c===tn}function Lv(a,c){Ol=Wu=!0;var p=a.pending;p===null?c.next=c:(c.next=p.next,p.next=c),a.pending=c}function Iv(a,c,p){if((p&4194240)!==0){var x=c.lanes;x&=a.pendingLanes,p|=x,c.lanes=p,gl(a,p)}}var Ku={readContext:$r,useCallback:Un,useContext:Un,useEffect:Un,useImperativeHandle:Un,useInsertionEffect:Un,useLayoutEffect:Un,useMemo:Un,useReducer:Un,useRef:Un,useState:Un,useDebugValue:Un,useDeferredValue:Un,useTransition:Un,useMutableSource:Un,useSyncExternalStore:Un,useId:Un,unstable_isNewReconciler:!1},nR={readContext:$r,useCallback:function(a,c){return gs().memoizedState=[a,c===void 0?null:c],a},useContext:$r,useEffect:Sv,useImperativeHandle:function(a,c,p){return p=p!=null?p.concat([a]):null,Hu(4194308,4,Ev.bind(null,c,a),p)},useLayoutEffect:function(a,c){return Hu(4194308,4,a,c)},useInsertionEffect:function(a,c){return Hu(4,2,a,c)},useMemo:function(a,c){var p=gs();return c=c===void 0?null:c,a=a(),p.memoizedState=[a,c],a},useReducer:function(a,c,p){var x=gs();return c=p!==void 0?p(c):c,x.memoizedState=x.baseState=c,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:c},x.queue=a,a=a.dispatch=eR.bind(null,tn,a),[x.memoizedState,a]},useRef:function(a){var c=gs();return a={current:a},c.memoizedState=a},useState:jv,useDebugValue:Om,useDeferredValue:function(a){return gs().memoizedState=a},useTransition:function(){var a=jv(!1),c=a[0];return a=ZT.bind(null,a[1]),gs().memoizedState=a,[c,a]},useMutableSource:function(){},useSyncExternalStore:function(a,c,p){var x=tn,j=gs();if(Jt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=c(),Pn===null)throw Error(n(349));(qo&30)!==0||xv(x,c,p)}j.memoizedState=p;var N={value:p,getSnapshot:c};return j.queue=N,Sv(bv.bind(null,x,N,a),[a]),x.flags|=2048,Fl(9,yv.bind(null,x,N,p,c),void 0,null),p},useId:function(){var a=gs(),c=Pn.identifierPrefix;if(Jt){var p=_s,x=Os;p=(x&~(1<<32-zn(x)-1)).toString(32)+p,c=":"+c+"R"+p,p=_l++,0<p&&(c+="H"+p.toString(32)),c+=":"}else p=XT++,c=":"+c+"r"+p.toString(32)+":";return a.memoizedState=c},unstable_isNewReconciler:!1},rR={readContext:$r,useCallback:Rv,useContext:$r,useEffect:Im,useImperativeHandle:Tv,useInsertionEffect:Nv,useLayoutEffect:Cv,useMemo:Av,useReducer:$m,useRef:kv,useState:function(){return $m(Ml)},useDebugValue:Om,useDeferredValue:function(a){var c=Lr();return Pv(c,wn.memoizedState,a)},useTransition:function(){var a=$m(Ml)[0],c=Lr().memoizedState;return[a,c]},useMutableSource:hv,useSyncExternalStore:gv,useId:Dv,unstable_isNewReconciler:!1},sR={readContext:$r,useCallback:Rv,useContext:$r,useEffect:Im,useImperativeHandle:Tv,useInsertionEffect:Nv,useLayoutEffect:Cv,useMemo:Av,useReducer:Lm,useRef:kv,useState:function(){return Lm(Ml)},useDebugValue:Om,useDeferredValue:function(a){var c=Lr();return wn===null?c.memoizedState=a:Pv(c,wn.memoizedState,a)},useTransition:function(){var a=Lm(Ml)[0],c=Lr().memoizedState;return[a,c]},useMutableSource:hv,useSyncExternalStore:gv,useId:Dv,unstable_isNewReconciler:!1};function Jr(a,c){if(a&&a.defaultProps){c=D({},c),a=a.defaultProps;for(var p in a)c[p]===void 0&&(c[p]=a[p]);return c}return c}function _m(a,c,p,x){c=a.memoizedState,p=p(x,c),p=p==null?c:D({},c,p),a.memoizedState=p,a.lanes===0&&(a.updateQueue.baseState=p)}var qu={isMounted:function(a){return(a=a._reactInternals)?ht(a)===a:!1},enqueueSetState:function(a,c,p){a=a._reactInternals;var x=Jn(),j=fo(a),N=Fs(x,j);N.payload=c,p!=null&&(N.callback=p),c=io(a,N,j),c!==null&&(Zr(c,a,j,x),Fu(c,a,j))},enqueueReplaceState:function(a,c,p){a=a._reactInternals;var x=Jn(),j=fo(a),N=Fs(x,j);N.tag=1,N.payload=c,p!=null&&(N.callback=p),c=io(a,N,j),c!==null&&(Zr(c,a,j,x),Fu(c,a,j))},enqueueForceUpdate:function(a,c){a=a._reactInternals;var p=Jn(),x=fo(a),j=Fs(p,x);j.tag=2,c!=null&&(j.callback=c),c=io(a,j,x),c!==null&&(Zr(c,a,x,p),Fu(c,a,x))}};function Ov(a,c,p,x,j,N,M){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(x,N,M):c.prototype&&c.prototype.isPureReactComponent?!Nl(p,x)||!Nl(j,N):!0}function _v(a,c,p){var x=!1,j=so,N=c.contextType;return typeof N=="object"&&N!==null?N=$r(N):(j=nr(c)?Uo:Bn.current,x=c.contextTypes,N=(x=x!=null)?Wa(a,j):so),c=new c(p,N),a.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=qu,a.stateNode=c,c._reactInternals=a,x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=j,a.__reactInternalMemoizedMaskedChildContext=N),c}function Mv(a,c,p,x){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(p,x),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(p,x),c.state!==a&&qu.enqueueReplaceState(c,c.state,null)}function Mm(a,c,p,x){var j=a.stateNode;j.props=p,j.state=a.memoizedState,j.refs={},Sm(a);var N=c.contextType;typeof N=="object"&&N!==null?j.context=$r(N):(N=nr(c)?Uo:Bn.current,j.context=Wa(a,N)),j.state=a.memoizedState,N=c.getDerivedStateFromProps,typeof N=="function"&&(_m(a,c,N,p),j.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(c=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),c!==j.state&&qu.enqueueReplaceState(j,j.state,null),zu(a,p,j,x),j.state=a.memoizedState),typeof j.componentDidMount=="function"&&(a.flags|=4194308)}function Qa(a,c){try{var p="",x=c;do p+=ue(x),x=x.return;while(x);var j=p}catch(N){j=`
|
|
39
|
+
Error generating stack: `+N.message+`
|
|
40
|
+
`+N.stack}return{value:a,source:c,stack:j,digest:null}}function Fm(a,c,p){return{value:a,source:null,stack:p??null,digest:c??null}}function zm(a,c){try{console.error(c.value)}catch(p){setTimeout(function(){throw p})}}var oR=typeof WeakMap=="function"?WeakMap:Map;function Fv(a,c,p){p=Fs(-1,p),p.tag=3,p.payload={element:null};var x=c.value;return p.callback=function(){ed||(ed=!0,th=x),zm(a,c)},p}function zv(a,c,p){p=Fs(-1,p),p.tag=3;var x=a.type.getDerivedStateFromError;if(typeof x=="function"){var j=c.value;p.payload=function(){return x(j)},p.callback=function(){zm(a,c)}}var N=a.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(p.callback=function(){zm(a,c),typeof x!="function"&&(co===null?co=new Set([this]):co.add(this));var M=c.stack;this.componentDidCatch(c.value,{componentStack:M!==null?M:""})}),p}function Bv(a,c,p){var x=a.pingCache;if(x===null){x=a.pingCache=new oR;var j=new Set;x.set(c,j)}else j=x.get(c),j===void 0&&(j=new Set,x.set(c,j));j.has(p)||(j.add(p),a=bR.bind(null,a,c,p),c.then(a,a))}function Uv(a){do{var c;if((c=a.tag===13)&&(c=a.memoizedState,c=c!==null?c.dehydrated!==null:!0),c)return a;a=a.return}while(a!==null);return null}function Wv(a,c,p,x,j){return(a.mode&1)===0?(a===c?a.flags|=65536:(a.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(c=Fs(-1,1),c.tag=2,io(p,c,1))),p.lanes|=1),a):(a.flags|=65536,a.lanes=j,a)}var aR=T.ReactCurrentOwner,rr=!1;function Yn(a,c,p,x){c.child=a===null?cv(c,null,p,x):qa(c,a.child,p,x)}function Hv(a,c,p,x,j){p=p.render;var N=c.ref;return Ya(c,j),x=Pm(a,c,p,x,N,j),p=Dm(),a!==null&&!rr?(c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~j,zs(a,c,j)):(Jt&&p&&mm(c),c.flags|=1,Yn(a,c,x,j),c.child)}function Vv(a,c,p,x,j){if(a===null){var N=p.type;return typeof N=="function"&&!lh(N)&&N.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(c.tag=15,c.type=N,Kv(a,c,N,x,j)):(a=ad(p.type,null,x,c,c.mode,j),a.ref=c.ref,a.return=c,c.child=a)}if(N=a.child,(a.lanes&j)===0){var M=N.memoizedProps;if(p=p.compare,p=p!==null?p:Nl,p(M,x)&&a.ref===c.ref)return zs(a,c,j)}return c.flags|=1,a=mo(N,x),a.ref=c.ref,a.return=c,c.child=a}function Kv(a,c,p,x,j){if(a!==null){var N=a.memoizedProps;if(Nl(N,x)&&a.ref===c.ref)if(rr=!1,c.pendingProps=x=N,(a.lanes&j)!==0)(a.flags&131072)!==0&&(rr=!0);else return c.lanes=a.lanes,zs(a,c,j)}return Bm(a,c,p,x,j)}function qv(a,c,p){var x=c.pendingProps,j=x.children,N=a!==null?a.memoizedState:null;if(x.mode==="hidden")if((c.mode&1)===0)c.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ft(Za,yr),yr|=p;else{if((p&1073741824)===0)return a=N!==null?N.baseLanes|p:p,c.lanes=c.childLanes=1073741824,c.memoizedState={baseLanes:a,cachePool:null,transitions:null},c.updateQueue=null,Ft(Za,yr),yr|=a,null;c.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=N!==null?N.baseLanes:p,Ft(Za,yr),yr|=x}else N!==null?(x=N.baseLanes|p,c.memoizedState=null):x=p,Ft(Za,yr),yr|=x;return Yn(a,c,j,p),c.child}function Gv(a,c){var p=c.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(c.flags|=512,c.flags|=2097152)}function Bm(a,c,p,x,j){var N=nr(p)?Uo:Bn.current;return N=Wa(c,N),Ya(c,j),p=Pm(a,c,p,x,N,j),x=Dm(),a!==null&&!rr?(c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~j,zs(a,c,j)):(Jt&&x&&mm(c),c.flags|=1,Yn(a,c,p,j),c.child)}function Yv(a,c,p,x,j){if(nr(p)){var N=!0;Pu(c)}else N=!1;if(Ya(c,j),c.stateNode===null)Yu(a,c),_v(c,p,x),Mm(c,p,x,j),x=!0;else if(a===null){var M=c.stateNode,Y=c.memoizedProps;M.props=Y;var Q=M.context,pe=p.contextType;typeof pe=="object"&&pe!==null?pe=$r(pe):(pe=nr(p)?Uo:Bn.current,pe=Wa(c,pe));var je=p.getDerivedStateFromProps,Ce=typeof je=="function"||typeof M.getSnapshotBeforeUpdate=="function";Ce||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Y!==x||Q!==pe)&&Mv(c,M,x,pe),ao=!1;var we=c.memoizedState;M.state=we,zu(c,x,M,j),Q=c.memoizedState,Y!==x||we!==Q||tr.current||ao?(typeof je=="function"&&(_m(c,p,je,x),Q=c.memoizedState),(Y=ao||Ov(c,p,Y,x,we,Q,pe))?(Ce||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(c.flags|=4194308)):(typeof M.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=x,c.memoizedState=Q),M.props=x,M.state=Q,M.context=pe,x=Y):(typeof M.componentDidMount=="function"&&(c.flags|=4194308),x=!1)}else{M=c.stateNode,dv(a,c),Y=c.memoizedProps,pe=c.type===c.elementType?Y:Jr(c.type,Y),M.props=pe,Ce=c.pendingProps,we=M.context,Q=p.contextType,typeof Q=="object"&&Q!==null?Q=$r(Q):(Q=nr(p)?Uo:Bn.current,Q=Wa(c,Q));var Ue=p.getDerivedStateFromProps;(je=typeof Ue=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(Y!==Ce||we!==Q)&&Mv(c,M,x,Q),ao=!1,we=c.memoizedState,M.state=we,zu(c,x,M,j);var Ge=c.memoizedState;Y!==Ce||we!==Ge||tr.current||ao?(typeof Ue=="function"&&(_m(c,p,Ue,x),Ge=c.memoizedState),(pe=ao||Ov(c,p,pe,x,we,Ge,Q)||!1)?(je||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(x,Ge,Q),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(x,Ge,Q)),typeof M.componentDidUpdate=="function"&&(c.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof M.componentDidUpdate!="function"||Y===a.memoizedProps&&we===a.memoizedState||(c.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Y===a.memoizedProps&&we===a.memoizedState||(c.flags|=1024),c.memoizedProps=x,c.memoizedState=Ge),M.props=x,M.state=Ge,M.context=Q,x=pe):(typeof M.componentDidUpdate!="function"||Y===a.memoizedProps&&we===a.memoizedState||(c.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||Y===a.memoizedProps&&we===a.memoizedState||(c.flags|=1024),x=!1)}return Um(a,c,p,x,N,j)}function Um(a,c,p,x,j,N){Gv(a,c);var M=(c.flags&128)!==0;if(!x&&!M)return j&&ev(c,p,!1),zs(a,c,N);x=c.stateNode,aR.current=c;var Y=M&&typeof p.getDerivedStateFromError!="function"?null:x.render();return c.flags|=1,a!==null&&M?(c.child=qa(c,a.child,null,N),c.child=qa(c,null,Y,N)):Yn(a,c,Y,N),c.memoizedState=x.state,j&&ev(c,p,!0),c.child}function Jv(a){var c=a.stateNode;c.pendingContext?Xb(a,c.pendingContext,c.pendingContext!==c.context):c.context&&Xb(a,c.context,!1),Nm(a,c.containerInfo)}function Qv(a,c,p,x,j){return Ka(),ym(j),c.flags|=256,Yn(a,c,p,x),c.child}var Wm={dehydrated:null,treeContext:null,retryLane:0};function Hm(a){return{baseLanes:a,cachePool:null,transitions:null}}function Xv(a,c,p){var x=c.pendingProps,j=en.current,N=!1,M=(c.flags&128)!==0,Y;if((Y=M)||(Y=a!==null&&a.memoizedState===null?!1:(j&2)!==0),Y?(N=!0,c.flags&=-129):(a===null||a.memoizedState!==null)&&(j|=1),Ft(en,j&1),a===null)return xm(c),a=c.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((c.mode&1)===0?c.lanes=1:a.data==="$!"?c.lanes=8:c.lanes=1073741824,null):(M=x.children,a=x.fallback,N?(x=c.mode,N=c.child,M={mode:"hidden",children:M},(x&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=M):N=id(M,x,0,null),a=Xo(a,x,p,null),N.return=c,a.return=c,N.sibling=a,c.child=N,c.child.memoizedState=Hm(p),c.memoizedState=Wm,a):Vm(c,M));if(j=a.memoizedState,j!==null&&(Y=j.dehydrated,Y!==null))return iR(a,c,M,x,Y,j,p);if(N){N=x.fallback,M=c.mode,j=a.child,Y=j.sibling;var Q={mode:"hidden",children:x.children};return(M&1)===0&&c.child!==j?(x=c.child,x.childLanes=0,x.pendingProps=Q,c.deletions=null):(x=mo(j,Q),x.subtreeFlags=j.subtreeFlags&14680064),Y!==null?N=mo(Y,N):(N=Xo(N,M,p,null),N.flags|=2),N.return=c,x.return=c,x.sibling=N,c.child=x,x=N,N=c.child,M=a.child.memoizedState,M=M===null?Hm(p):{baseLanes:M.baseLanes|p,cachePool:null,transitions:M.transitions},N.memoizedState=M,N.childLanes=a.childLanes&~p,c.memoizedState=Wm,x}return N=a.child,a=N.sibling,x=mo(N,{mode:"visible",children:x.children}),(c.mode&1)===0&&(x.lanes=p),x.return=c,x.sibling=null,a!==null&&(p=c.deletions,p===null?(c.deletions=[a],c.flags|=16):p.push(a)),c.child=x,c.memoizedState=null,x}function Vm(a,c){return c=id({mode:"visible",children:c},a.mode,0,null),c.return=a,a.child=c}function Gu(a,c,p,x){return x!==null&&ym(x),qa(c,a.child,null,p),a=Vm(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function iR(a,c,p,x,j,N,M){if(p)return c.flags&256?(c.flags&=-257,x=Fm(Error(n(422))),Gu(a,c,M,x)):c.memoizedState!==null?(c.child=a.child,c.flags|=128,null):(N=x.fallback,j=c.mode,x=id({mode:"visible",children:x.children},j,0,null),N=Xo(N,j,M,null),N.flags|=2,x.return=c,N.return=c,x.sibling=N,c.child=x,(c.mode&1)!==0&&qa(c,a.child,null,M),c.child.memoizedState=Hm(M),c.memoizedState=Wm,N);if((c.mode&1)===0)return Gu(a,c,M,null);if(j.data==="$!"){if(x=j.nextSibling&&j.nextSibling.dataset,x)var Y=x.dgst;return x=Y,N=Error(n(419)),x=Fm(N,x,void 0),Gu(a,c,M,x)}if(Y=(M&a.childLanes)!==0,rr||Y){if(x=Pn,x!==null){switch(M&-M){case 4:j=2;break;case 16:j=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:j=32;break;case 536870912:j=268435456;break;default:j=0}j=(j&(x.suspendedLanes|M))!==0?0:j,j!==0&&j!==N.retryLane&&(N.retryLane=j,Ms(a,j),Zr(x,a,j,-1))}return ih(),x=Fm(Error(n(421))),Gu(a,c,M,x)}return j.data==="$?"?(c.flags|=128,c.child=a.child,c=vR.bind(null,a),j._reactRetry=c,null):(a=N.treeContext,xr=no(j.nextSibling),gr=c,Jt=!0,Yr=null,a!==null&&(Pr[Dr++]=Os,Pr[Dr++]=_s,Pr[Dr++]=Wo,Os=a.id,_s=a.overflow,Wo=c),c=Vm(c,x.children),c.flags|=4096,c)}function Zv(a,c,p){a.lanes|=c;var x=a.alternate;x!==null&&(x.lanes|=c),jm(a.return,c,p)}function Km(a,c,p,x,j){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:x,tail:p,tailMode:j}:(N.isBackwards=c,N.rendering=null,N.renderingStartTime=0,N.last=x,N.tail=p,N.tailMode=j)}function ew(a,c,p){var x=c.pendingProps,j=x.revealOrder,N=x.tail;if(Yn(a,c,x.children,p),x=en.current,(x&2)!==0)x=x&1|2,c.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Zv(a,p,c);else if(a.tag===19)Zv(a,p,c);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===c)break e;for(;a.sibling===null;){if(a.return===null||a.return===c)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}x&=1}if(Ft(en,x),(c.mode&1)===0)c.memoizedState=null;else switch(j){case"forwards":for(p=c.child,j=null;p!==null;)a=p.alternate,a!==null&&Bu(a)===null&&(j=p),p=p.sibling;p=j,p===null?(j=c.child,c.child=null):(j=p.sibling,p.sibling=null),Km(c,!1,j,p,N);break;case"backwards":for(p=null,j=c.child,c.child=null;j!==null;){if(a=j.alternate,a!==null&&Bu(a)===null){c.child=j;break}a=j.sibling,j.sibling=p,p=j,j=a}Km(c,!0,p,null,N);break;case"together":Km(c,!1,null,null,void 0);break;default:c.memoizedState=null}return c.child}function Yu(a,c){(c.mode&1)===0&&a!==null&&(a.alternate=null,c.alternate=null,c.flags|=2)}function zs(a,c,p){if(a!==null&&(c.dependencies=a.dependencies),Go|=c.lanes,(p&c.childLanes)===0)return null;if(a!==null&&c.child!==a.child)throw Error(n(153));if(c.child!==null){for(a=c.child,p=mo(a,a.pendingProps),c.child=p,p.return=c;a.sibling!==null;)a=a.sibling,p=p.sibling=mo(a,a.pendingProps),p.return=c;p.sibling=null}return c.child}function lR(a,c,p){switch(c.tag){case 3:Jv(c),Ka();break;case 5:mv(c);break;case 1:nr(c.type)&&Pu(c);break;case 4:Nm(c,c.stateNode.containerInfo);break;case 10:var x=c.type._context,j=c.memoizedProps.value;Ft(_u,x._currentValue),x._currentValue=j;break;case 13:if(x=c.memoizedState,x!==null)return x.dehydrated!==null?(Ft(en,en.current&1),c.flags|=128,null):(p&c.child.childLanes)!==0?Xv(a,c,p):(Ft(en,en.current&1),a=zs(a,c,p),a!==null?a.sibling:null);Ft(en,en.current&1);break;case 19:if(x=(p&c.childLanes)!==0,(a.flags&128)!==0){if(x)return ew(a,c,p);c.flags|=128}if(j=c.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),Ft(en,en.current),x)break;return null;case 22:case 23:return c.lanes=0,qv(a,c,p)}return zs(a,c,p)}var tw,qm,nw,rw;tw=function(a,c){for(var p=c.child;p!==null;){if(p.tag===5||p.tag===6)a.appendChild(p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===c)break;for(;p.sibling===null;){if(p.return===null||p.return===c)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},qm=function(){},nw=function(a,c,p,x){var j=a.memoizedProps;if(j!==x){a=c.stateNode,Ko(hs.current);var N=null;switch(p){case"input":j=ot(a,j),x=ot(a,x),N=[];break;case"select":j=D({},j,{value:void 0}),x=D({},x,{value:void 0}),N=[];break;case"textarea":j=qe(a,j),x=qe(a,x),N=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(a.onclick=Tu)}He(p,x);var M;p=null;for(pe in j)if(!x.hasOwnProperty(pe)&&j.hasOwnProperty(pe)&&j[pe]!=null)if(pe==="style"){var Y=j[pe];for(M in Y)Y.hasOwnProperty(M)&&(p||(p={}),p[M]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(o.hasOwnProperty(pe)?N||(N=[]):(N=N||[]).push(pe,null));for(pe in x){var Q=x[pe];if(Y=j!=null?j[pe]:void 0,x.hasOwnProperty(pe)&&Q!==Y&&(Q!=null||Y!=null))if(pe==="style")if(Y){for(M in Y)!Y.hasOwnProperty(M)||Q&&Q.hasOwnProperty(M)||(p||(p={}),p[M]="");for(M in Q)Q.hasOwnProperty(M)&&Y[M]!==Q[M]&&(p||(p={}),p[M]=Q[M])}else p||(N||(N=[]),N.push(pe,p)),p=Q;else pe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Y=Y?Y.__html:void 0,Q!=null&&Y!==Q&&(N=N||[]).push(pe,Q)):pe==="children"?typeof Q!="string"&&typeof Q!="number"||(N=N||[]).push(pe,""+Q):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(o.hasOwnProperty(pe)?(Q!=null&&pe==="onScroll"&&Ut("scroll",a),N||Y===Q||(N=[])):(N=N||[]).push(pe,Q))}p&&(N=N||[]).push("style",p);var pe=N;(c.updateQueue=pe)&&(c.flags|=4)}},rw=function(a,c,p,x){p!==x&&(c.flags|=4)};function zl(a,c){if(!Jt)switch(a.tailMode){case"hidden":c=a.tail;for(var p=null;c!==null;)c.alternate!==null&&(p=c),c=c.sibling;p===null?a.tail=null:p.sibling=null;break;case"collapsed":p=a.tail;for(var x=null;p!==null;)p.alternate!==null&&(x=p),p=p.sibling;x===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:x.sibling=null}}function Wn(a){var c=a.alternate!==null&&a.alternate.child===a.child,p=0,x=0;if(c)for(var j=a.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags&14680064,x|=j.flags&14680064,j.return=a,j=j.sibling;else for(j=a.child;j!==null;)p|=j.lanes|j.childLanes,x|=j.subtreeFlags,x|=j.flags,j.return=a,j=j.sibling;return a.subtreeFlags|=x,a.childLanes=p,c}function cR(a,c,p){var x=c.pendingProps;switch(hm(c),c.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(c),null;case 1:return nr(c.type)&&Au(),Wn(c),null;case 3:return x=c.stateNode,Ja(),Wt(tr),Wt(Bn),Tm(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(a===null||a.child===null)&&(Iu(c)?c.flags|=4:a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Yr!==null&&(sh(Yr),Yr=null))),qm(a,c),Wn(c),null;case 5:Cm(c);var j=Ko(Il.current);if(p=c.type,a!==null&&c.stateNode!=null)nw(a,c,p,x,j),a.ref!==c.ref&&(c.flags|=512,c.flags|=2097152);else{if(!x){if(c.stateNode===null)throw Error(n(166));return Wn(c),null}if(a=Ko(hs.current),Iu(c)){x=c.stateNode,p=c.type;var N=c.memoizedProps;switch(x[ms]=c,x[Al]=N,a=(c.mode&1)!==0,p){case"dialog":Ut("cancel",x),Ut("close",x);break;case"iframe":case"object":case"embed":Ut("load",x);break;case"video":case"audio":for(j=0;j<El.length;j++)Ut(El[j],x);break;case"source":Ut("error",x);break;case"img":case"image":case"link":Ut("error",x),Ut("load",x);break;case"details":Ut("toggle",x);break;case"input":le(x,N),Ut("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!N.multiple},Ut("invalid",x);break;case"textarea":Lt(x,N),Ut("invalid",x)}He(p,N),j=null;for(var M in N)if(N.hasOwnProperty(M)){var Y=N[M];M==="children"?typeof Y=="string"?x.textContent!==Y&&(N.suppressHydrationWarning!==!0&&Eu(x.textContent,Y,a),j=["children",Y]):typeof Y=="number"&&x.textContent!==""+Y&&(N.suppressHydrationWarning!==!0&&Eu(x.textContent,Y,a),j=["children",""+Y]):o.hasOwnProperty(M)&&Y!=null&&M==="onScroll"&&Ut("scroll",x)}switch(p){case"input":Xe(x),Oe(x,N,!0);break;case"textarea":Xe(x),ut(x);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(x.onclick=Tu)}x=j,c.updateQueue=x,x!==null&&(c.flags|=4)}else{M=j.nodeType===9?j:j.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=ae(p)),a==="http://www.w3.org/1999/xhtml"?p==="script"?(a=M.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof x.is=="string"?a=M.createElement(p,{is:x.is}):(a=M.createElement(p),p==="select"&&(M=a,x.multiple?M.multiple=!0:x.size&&(M.size=x.size))):a=M.createElementNS(a,p),a[ms]=c,a[Al]=x,tw(a,c,!1,!1),c.stateNode=a;e:{switch(M=ce(p,x),p){case"dialog":Ut("cancel",a),Ut("close",a),j=x;break;case"iframe":case"object":case"embed":Ut("load",a),j=x;break;case"video":case"audio":for(j=0;j<El.length;j++)Ut(El[j],a);j=x;break;case"source":Ut("error",a),j=x;break;case"img":case"image":case"link":Ut("error",a),Ut("load",a),j=x;break;case"details":Ut("toggle",a),j=x;break;case"input":le(a,x),j=ot(a,x),Ut("invalid",a);break;case"option":j=x;break;case"select":a._wrapperState={wasMultiple:!!x.multiple},j=D({},x,{value:void 0}),Ut("invalid",a);break;case"textarea":Lt(a,x),j=qe(a,x),Ut("invalid",a);break;default:j=x}He(p,j),Y=j;for(N in Y)if(Y.hasOwnProperty(N)){var Q=Y[N];N==="style"?fe(a,Q):N==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&ne(a,Q)):N==="children"?typeof Q=="string"?(p!=="textarea"||Q!=="")&&ye(a,Q):typeof Q=="number"&&ye(a,""+Q):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(o.hasOwnProperty(N)?Q!=null&&N==="onScroll"&&Ut("scroll",a):Q!=null&&S(a,N,Q,M))}switch(p){case"input":Xe(a),Oe(a,x,!1);break;case"textarea":Xe(a),ut(a);break;case"option":x.value!=null&&a.setAttribute("value",""+ke(x.value));break;case"select":a.multiple=!!x.multiple,N=x.value,N!=null?_e(a,!!x.multiple,N,!1):x.defaultValue!=null&&_e(a,!!x.multiple,x.defaultValue,!0);break;default:typeof j.onClick=="function"&&(a.onclick=Tu)}switch(p){case"button":case"input":case"select":case"textarea":x=!!x.autoFocus;break e;case"img":x=!0;break e;default:x=!1}}x&&(c.flags|=4)}c.ref!==null&&(c.flags|=512,c.flags|=2097152)}return Wn(c),null;case 6:if(a&&c.stateNode!=null)rw(a,c,a.memoizedProps,x);else{if(typeof x!="string"&&c.stateNode===null)throw Error(n(166));if(p=Ko(Il.current),Ko(hs.current),Iu(c)){if(x=c.stateNode,p=c.memoizedProps,x[ms]=c,(N=x.nodeValue!==p)&&(a=gr,a!==null))switch(a.tag){case 3:Eu(x.nodeValue,p,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Eu(x.nodeValue,p,(a.mode&1)!==0)}N&&(c.flags|=4)}else x=(p.nodeType===9?p:p.ownerDocument).createTextNode(x),x[ms]=c,c.stateNode=x}return Wn(c),null;case 13:if(Wt(en),x=c.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Jt&&xr!==null&&(c.mode&1)!==0&&(c.flags&128)===0)av(),Ka(),c.flags|=98560,N=!1;else if(N=Iu(c),x!==null&&x.dehydrated!==null){if(a===null){if(!N)throw Error(n(318));if(N=c.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[ms]=c}else Ka(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Wn(c),N=!1}else Yr!==null&&(sh(Yr),Yr=null),N=!0;if(!N)return c.flags&65536?c:null}return(c.flags&128)!==0?(c.lanes=p,c):(x=x!==null,x!==(a!==null&&a.memoizedState!==null)&&x&&(c.child.flags|=8192,(c.mode&1)!==0&&(a===null||(en.current&1)!==0?jn===0&&(jn=3):ih())),c.updateQueue!==null&&(c.flags|=4),Wn(c),null);case 4:return Ja(),qm(a,c),a===null&&Tl(c.stateNode.containerInfo),Wn(c),null;case 10:return wm(c.type._context),Wn(c),null;case 17:return nr(c.type)&&Au(),Wn(c),null;case 19:if(Wt(en),N=c.memoizedState,N===null)return Wn(c),null;if(x=(c.flags&128)!==0,M=N.rendering,M===null)if(x)zl(N,!1);else{if(jn!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(M=Bu(a),M!==null){for(c.flags|=128,zl(N,!1),x=M.updateQueue,x!==null&&(c.updateQueue=x,c.flags|=4),c.subtreeFlags=0,x=p,p=c.child;p!==null;)N=p,a=x,N.flags&=14680066,M=N.alternate,M===null?(N.childLanes=0,N.lanes=a,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=M.childLanes,N.lanes=M.lanes,N.child=M.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=M.memoizedProps,N.memoizedState=M.memoizedState,N.updateQueue=M.updateQueue,N.type=M.type,a=M.dependencies,N.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),p=p.sibling;return Ft(en,en.current&1|2),c.child}a=a.sibling}N.tail!==null&&Zt()>ei&&(c.flags|=128,x=!0,zl(N,!1),c.lanes=4194304)}else{if(!x)if(a=Bu(M),a!==null){if(c.flags|=128,x=!0,p=a.updateQueue,p!==null&&(c.updateQueue=p,c.flags|=4),zl(N,!0),N.tail===null&&N.tailMode==="hidden"&&!M.alternate&&!Jt)return Wn(c),null}else 2*Zt()-N.renderingStartTime>ei&&p!==1073741824&&(c.flags|=128,x=!0,zl(N,!1),c.lanes=4194304);N.isBackwards?(M.sibling=c.child,c.child=M):(p=N.last,p!==null?p.sibling=M:c.child=M,N.last=M)}return N.tail!==null?(c=N.tail,N.rendering=c,N.tail=c.sibling,N.renderingStartTime=Zt(),c.sibling=null,p=en.current,Ft(en,x?p&1|2:p&1),c):(Wn(c),null);case 22:case 23:return ah(),x=c.memoizedState!==null,a!==null&&a.memoizedState!==null!==x&&(c.flags|=8192),x&&(c.mode&1)!==0?(yr&1073741824)!==0&&(Wn(c),c.subtreeFlags&6&&(c.flags|=8192)):Wn(c),null;case 24:return null;case 25:return null}throw Error(n(156,c.tag))}function uR(a,c){switch(hm(c),c.tag){case 1:return nr(c.type)&&Au(),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return Ja(),Wt(tr),Wt(Bn),Tm(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 5:return Cm(c),null;case 13:if(Wt(en),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Ka()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return Wt(en),null;case 4:return Ja(),null;case 10:return wm(c.type._context),null;case 22:case 23:return ah(),null;case 24:return null;default:return null}}var Ju=!1,Hn=!1,dR=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Xa(a,c){var p=a.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){on(a,c,x)}else p.current=null}function Gm(a,c,p){try{p()}catch(x){on(a,c,x)}}var sw=!1;function fR(a,c){if(am=sn,a=Ob(),Xp(a)){if("selectionStart"in a)var p={start:a.selectionStart,end:a.selectionEnd};else e:{p=(p=a.ownerDocument)&&p.defaultView||window;var x=p.getSelection&&p.getSelection();if(x&&x.rangeCount!==0){p=x.anchorNode;var j=x.anchorOffset,N=x.focusNode;x=x.focusOffset;try{p.nodeType,N.nodeType}catch{p=null;break e}var M=0,Y=-1,Q=-1,pe=0,je=0,Ce=a,we=null;t:for(;;){for(var Ue;Ce!==p||j!==0&&Ce.nodeType!==3||(Y=M+j),Ce!==N||x!==0&&Ce.nodeType!==3||(Q=M+x),Ce.nodeType===3&&(M+=Ce.nodeValue.length),(Ue=Ce.firstChild)!==null;)we=Ce,Ce=Ue;for(;;){if(Ce===a)break t;if(we===p&&++pe===j&&(Y=M),we===N&&++je===x&&(Q=M),(Ue=Ce.nextSibling)!==null)break;Ce=we,we=Ce.parentNode}Ce=Ue}p=Y===-1||Q===-1?null:{start:Y,end:Q}}else p=null}p=p||{start:0,end:0}}else p=null;for(im={focusedElem:a,selectionRange:p},sn=!1,Ve=c;Ve!==null;)if(c=Ve,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,Ve=a;else for(;Ve!==null;){c=Ve;try{var Ge=c.alternate;if((c.flags&1024)!==0)switch(c.tag){case 0:case 11:case 15:break;case 1:if(Ge!==null){var Je=Ge.memoizedProps,cn=Ge.memoizedState,ie=c.stateNode,te=ie.getSnapshotBeforeUpdate(c.elementType===c.type?Je:Jr(c.type,Je),cn);ie.__reactInternalSnapshotBeforeUpdate=te}break;case 3:var de=c.stateNode.containerInfo;de.nodeType===1?de.textContent="":de.nodeType===9&&de.documentElement&&de.removeChild(de.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch($e){on(c,c.return,$e)}if(a=c.sibling,a!==null){a.return=c.return,Ve=a;break}Ve=c.return}return Ge=sw,sw=!1,Ge}function Bl(a,c,p){var x=c.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&a)===a){var N=j.destroy;j.destroy=void 0,N!==void 0&&Gm(c,p,N)}j=j.next}while(j!==x)}}function Qu(a,c){if(c=c.updateQueue,c=c!==null?c.lastEffect:null,c!==null){var p=c=c.next;do{if((p.tag&a)===a){var x=p.create;p.destroy=x()}p=p.next}while(p!==c)}}function Ym(a){var c=a.ref;if(c!==null){var p=a.stateNode;switch(a.tag){case 5:a=p;break;default:a=p}typeof c=="function"?c(a):c.current=a}}function ow(a){var c=a.alternate;c!==null&&(a.alternate=null,ow(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&(delete c[ms],delete c[Al],delete c[dm],delete c[GT],delete c[YT])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function aw(a){return a.tag===5||a.tag===3||a.tag===4}function iw(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||aw(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Jm(a,c,p){var x=a.tag;if(x===5||x===6)a=a.stateNode,c?p.nodeType===8?p.parentNode.insertBefore(a,c):p.insertBefore(a,c):(p.nodeType===8?(c=p.parentNode,c.insertBefore(a,p)):(c=p,c.appendChild(a)),p=p._reactRootContainer,p!=null||c.onclick!==null||(c.onclick=Tu));else if(x!==4&&(a=a.child,a!==null))for(Jm(a,c,p),a=a.sibling;a!==null;)Jm(a,c,p),a=a.sibling}function Qm(a,c,p){var x=a.tag;if(x===5||x===6)a=a.stateNode,c?p.insertBefore(a,c):p.appendChild(a);else if(x!==4&&(a=a.child,a!==null))for(Qm(a,c,p),a=a.sibling;a!==null;)Qm(a,c,p),a=a.sibling}var In=null,Qr=!1;function lo(a,c,p){for(p=p.child;p!==null;)lw(a,c,p),p=p.sibling}function lw(a,c,p){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(Ea,p)}catch{}switch(p.tag){case 5:Hn||Xa(p,c);case 6:var x=In,j=Qr;In=null,lo(a,c,p),In=x,Qr=j,In!==null&&(Qr?(a=In,p=p.stateNode,a.nodeType===8?a.parentNode.removeChild(p):a.removeChild(p)):In.removeChild(p.stateNode));break;case 18:In!==null&&(Qr?(a=In,p=p.stateNode,a.nodeType===8?um(a.parentNode,p):a.nodeType===1&&um(a,p),Rn(a)):um(In,p.stateNode));break;case 4:x=In,j=Qr,In=p.stateNode.containerInfo,Qr=!0,lo(a,c,p),In=x,Qr=j;break;case 0:case 11:case 14:case 15:if(!Hn&&(x=p.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){j=x=x.next;do{var N=j,M=N.destroy;N=N.tag,M!==void 0&&((N&2)!==0||(N&4)!==0)&&Gm(p,c,M),j=j.next}while(j!==x)}lo(a,c,p);break;case 1:if(!Hn&&(Xa(p,c),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(Y){on(p,c,Y)}lo(a,c,p);break;case 21:lo(a,c,p);break;case 22:p.mode&1?(Hn=(x=Hn)||p.memoizedState!==null,lo(a,c,p),Hn=x):lo(a,c,p);break;default:lo(a,c,p)}}function cw(a){var c=a.updateQueue;if(c!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new dR),c.forEach(function(x){var j=wR.bind(null,a,x);p.has(x)||(p.add(x),x.then(j,j))})}}function Xr(a,c){var p=c.deletions;if(p!==null)for(var x=0;x<p.length;x++){var j=p[x];try{var N=a,M=c,Y=M;e:for(;Y!==null;){switch(Y.tag){case 5:In=Y.stateNode,Qr=!1;break e;case 3:In=Y.stateNode.containerInfo,Qr=!0;break e;case 4:In=Y.stateNode.containerInfo,Qr=!0;break e}Y=Y.return}if(In===null)throw Error(n(160));lw(N,M,j),In=null,Qr=!1;var Q=j.alternate;Q!==null&&(Q.return=null),j.return=null}catch(pe){on(j,c,pe)}}if(c.subtreeFlags&12854)for(c=c.child;c!==null;)uw(c,a),c=c.sibling}function uw(a,c){var p=a.alternate,x=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Xr(c,a),xs(a),x&4){try{Bl(3,a,a.return),Qu(3,a)}catch(Je){on(a,a.return,Je)}try{Bl(5,a,a.return)}catch(Je){on(a,a.return,Je)}}break;case 1:Xr(c,a),xs(a),x&512&&p!==null&&Xa(p,p.return);break;case 5:if(Xr(c,a),xs(a),x&512&&p!==null&&Xa(p,p.return),a.flags&32){var j=a.stateNode;try{ye(j,"")}catch(Je){on(a,a.return,Je)}}if(x&4&&(j=a.stateNode,j!=null)){var N=a.memoizedProps,M=p!==null?p.memoizedProps:N,Y=a.type,Q=a.updateQueue;if(a.updateQueue=null,Q!==null)try{Y==="input"&&N.type==="radio"&&N.name!=null&&Re(j,N),ce(Y,M);var pe=ce(Y,N);for(M=0;M<Q.length;M+=2){var je=Q[M],Ce=Q[M+1];je==="style"?fe(j,Ce):je==="dangerouslySetInnerHTML"?ne(j,Ce):je==="children"?ye(j,Ce):S(j,je,Ce,pe)}switch(Y){case"input":Se(j,N);break;case"textarea":bt(j,N);break;case"select":var we=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!N.multiple;var Ue=N.value;Ue!=null?_e(j,!!N.multiple,Ue,!1):we!==!!N.multiple&&(N.defaultValue!=null?_e(j,!!N.multiple,N.defaultValue,!0):_e(j,!!N.multiple,N.multiple?[]:"",!1))}j[Al]=N}catch(Je){on(a,a.return,Je)}}break;case 6:if(Xr(c,a),xs(a),x&4){if(a.stateNode===null)throw Error(n(162));j=a.stateNode,N=a.memoizedProps;try{j.nodeValue=N}catch(Je){on(a,a.return,Je)}}break;case 3:if(Xr(c,a),xs(a),x&4&&p!==null&&p.memoizedState.isDehydrated)try{Rn(c.containerInfo)}catch(Je){on(a,a.return,Je)}break;case 4:Xr(c,a),xs(a);break;case 13:Xr(c,a),xs(a),j=a.child,j.flags&8192&&(N=j.memoizedState!==null,j.stateNode.isHidden=N,!N||j.alternate!==null&&j.alternate.memoizedState!==null||(eh=Zt())),x&4&&cw(a);break;case 22:if(je=p!==null&&p.memoizedState!==null,a.mode&1?(Hn=(pe=Hn)||je,Xr(c,a),Hn=pe):Xr(c,a),xs(a),x&8192){if(pe=a.memoizedState!==null,(a.stateNode.isHidden=pe)&&!je&&(a.mode&1)!==0)for(Ve=a,je=a.child;je!==null;){for(Ce=Ve=je;Ve!==null;){switch(we=Ve,Ue=we.child,we.tag){case 0:case 11:case 14:case 15:Bl(4,we,we.return);break;case 1:Xa(we,we.return);var Ge=we.stateNode;if(typeof Ge.componentWillUnmount=="function"){x=we,p=we.return;try{c=x,Ge.props=c.memoizedProps,Ge.state=c.memoizedState,Ge.componentWillUnmount()}catch(Je){on(x,p,Je)}}break;case 5:Xa(we,we.return);break;case 22:if(we.memoizedState!==null){pw(Ce);continue}}Ue!==null?(Ue.return=we,Ve=Ue):pw(Ce)}je=je.sibling}e:for(je=null,Ce=a;;){if(Ce.tag===5){if(je===null){je=Ce;try{j=Ce.stateNode,pe?(N=j.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(Y=Ce.stateNode,Q=Ce.memoizedProps.style,M=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,Y.style.display=ee("display",M))}catch(Je){on(a,a.return,Je)}}}else if(Ce.tag===6){if(je===null)try{Ce.stateNode.nodeValue=pe?"":Ce.memoizedProps}catch(Je){on(a,a.return,Je)}}else if((Ce.tag!==22&&Ce.tag!==23||Ce.memoizedState===null||Ce===a)&&Ce.child!==null){Ce.child.return=Ce,Ce=Ce.child;continue}if(Ce===a)break e;for(;Ce.sibling===null;){if(Ce.return===null||Ce.return===a)break e;je===Ce&&(je=null),Ce=Ce.return}je===Ce&&(je=null),Ce.sibling.return=Ce.return,Ce=Ce.sibling}}break;case 19:Xr(c,a),xs(a),x&4&&cw(a);break;case 21:break;default:Xr(c,a),xs(a)}}function xs(a){var c=a.flags;if(c&2){try{e:{for(var p=a.return;p!==null;){if(aw(p)){var x=p;break e}p=p.return}throw Error(n(160))}switch(x.tag){case 5:var j=x.stateNode;x.flags&32&&(ye(j,""),x.flags&=-33);var N=iw(a);Qm(a,N,j);break;case 3:case 4:var M=x.stateNode.containerInfo,Y=iw(a);Jm(a,Y,M);break;default:throw Error(n(161))}}catch(Q){on(a,a.return,Q)}a.flags&=-3}c&4096&&(a.flags&=-4097)}function pR(a,c,p){Ve=a,dw(a)}function dw(a,c,p){for(var x=(a.mode&1)!==0;Ve!==null;){var j=Ve,N=j.child;if(j.tag===22&&x){var M=j.memoizedState!==null||Ju;if(!M){var Y=j.alternate,Q=Y!==null&&Y.memoizedState!==null||Hn;Y=Ju;var pe=Hn;if(Ju=M,(Hn=Q)&&!pe)for(Ve=j;Ve!==null;)M=Ve,Q=M.child,M.tag===22&&M.memoizedState!==null?mw(j):Q!==null?(Q.return=M,Ve=Q):mw(j);for(;N!==null;)Ve=N,dw(N),N=N.sibling;Ve=j,Ju=Y,Hn=pe}fw(a)}else(j.subtreeFlags&8772)!==0&&N!==null?(N.return=j,Ve=N):fw(a)}}function fw(a){for(;Ve!==null;){var c=Ve;if((c.flags&8772)!==0){var p=c.alternate;try{if((c.flags&8772)!==0)switch(c.tag){case 0:case 11:case 15:Hn||Qu(5,c);break;case 1:var x=c.stateNode;if(c.flags&4&&!Hn)if(p===null)x.componentDidMount();else{var j=c.elementType===c.type?p.memoizedProps:Jr(c.type,p.memoizedProps);x.componentDidUpdate(j,p.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var N=c.updateQueue;N!==null&&pv(c,N,x);break;case 3:var M=c.updateQueue;if(M!==null){if(p=null,c.child!==null)switch(c.child.tag){case 5:p=c.child.stateNode;break;case 1:p=c.child.stateNode}pv(c,M,p)}break;case 5:var Y=c.stateNode;if(p===null&&c.flags&4){p=Y;var Q=c.memoizedProps;switch(c.type){case"button":case"input":case"select":case"textarea":Q.autoFocus&&p.focus();break;case"img":Q.src&&(p.src=Q.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(c.memoizedState===null){var pe=c.alternate;if(pe!==null){var je=pe.memoizedState;if(je!==null){var Ce=je.dehydrated;Ce!==null&&Rn(Ce)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Hn||c.flags&512&&Ym(c)}catch(we){on(c,c.return,we)}}if(c===a){Ve=null;break}if(p=c.sibling,p!==null){p.return=c.return,Ve=p;break}Ve=c.return}}function pw(a){for(;Ve!==null;){var c=Ve;if(c===a){Ve=null;break}var p=c.sibling;if(p!==null){p.return=c.return,Ve=p;break}Ve=c.return}}function mw(a){for(;Ve!==null;){var c=Ve;try{switch(c.tag){case 0:case 11:case 15:var p=c.return;try{Qu(4,c)}catch(Q){on(c,p,Q)}break;case 1:var x=c.stateNode;if(typeof x.componentDidMount=="function"){var j=c.return;try{x.componentDidMount()}catch(Q){on(c,j,Q)}}var N=c.return;try{Ym(c)}catch(Q){on(c,N,Q)}break;case 5:var M=c.return;try{Ym(c)}catch(Q){on(c,M,Q)}}}catch(Q){on(c,c.return,Q)}if(c===a){Ve=null;break}var Y=c.sibling;if(Y!==null){Y.return=c.return,Ve=Y;break}Ve=c.return}}var mR=Math.ceil,Xu=T.ReactCurrentDispatcher,Xm=T.ReactCurrentOwner,Ir=T.ReactCurrentBatchConfig,Ct=0,Pn=null,pn=null,On=0,yr=0,Za=ro(0),jn=0,Ul=null,Go=0,Zu=0,Zm=0,Wl=null,sr=null,eh=0,ei=1/0,Bs=null,ed=!1,th=null,co=null,td=!1,uo=null,nd=0,Hl=0,nh=null,rd=-1,sd=0;function Jn(){return(Ct&6)!==0?Zt():rd!==-1?rd:rd=Zt()}function fo(a){return(a.mode&1)===0?1:(Ct&2)!==0&&On!==0?On&-On:QT.transition!==null?(sd===0&&(sd=ml()),sd):(a=Pt,a!==0||(a=window.event,a=a===void 0?16:gb(a.type)),a)}function Zr(a,c,p,x){if(50<Hl)throw Hl=0,nh=null,Error(n(185));qr(a,p,x),((Ct&2)===0||a!==Pn)&&(a===Pn&&((Ct&2)===0&&(Zu|=p),jn===4&&po(a,On)),or(a,x),p===1&&Ct===0&&(c.mode&1)===0&&(ei=Zt()+500,Du&&oo()))}function or(a,c){var p=a.callbackNode;xu(a,c);var x=_o(a,a===Pn?On:0);if(x===0)p!==null&&pu(p),a.callbackNode=null,a.callbackPriority=0;else if(c=x&-x,a.callbackPriority!==c){if(p!=null&&pu(p),c===1)a.tag===0?JT(gw.bind(null,a)):tv(gw.bind(null,a)),KT(function(){(Ct&6)===0&&oo()}),p=null;else{switch(xl(x)){case 1:p=pl;break;case 4:p=mu;break;case 16:p=Xs;break;case 536870912:p=hu;break;default:p=Xs}p=Sw(p,hw.bind(null,a))}a.callbackPriority=c,a.callbackNode=p}}function hw(a,c){if(rd=-1,sd=0,(Ct&6)!==0)throw Error(n(327));var p=a.callbackNode;if(ti()&&a.callbackNode!==p)return null;var x=_o(a,a===Pn?On:0);if(x===0)return null;if((x&30)!==0||(x&a.expiredLanes)!==0||c)c=od(a,x);else{c=x;var j=Ct;Ct|=2;var N=yw();(Pn!==a||On!==c)&&(Bs=null,ei=Zt()+500,Jo(a,c));do try{xR();break}catch(Y){xw(a,Y)}while(!0);vm(),Xu.current=N,Ct=j,pn!==null?c=0:(Pn=null,On=0,c=jn)}if(c!==0){if(c===2&&(j=Mo(a),j!==0&&(x=j,c=rh(a,j))),c===1)throw p=Ul,Jo(a,0),po(a,x),or(a,Zt()),p;if(c===6)po(a,x);else{if(j=a.current.alternate,(x&30)===0&&!hR(j)&&(c=od(a,x),c===2&&(N=Mo(a),N!==0&&(x=N,c=rh(a,N))),c===1))throw p=Ul,Jo(a,0),po(a,x),or(a,Zt()),p;switch(a.finishedWork=j,a.finishedLanes=x,c){case 0:case 1:throw Error(n(345));case 2:Qo(a,sr,Bs);break;case 3:if(po(a,x),(x&130023424)===x&&(c=eh+500-Zt(),10<c)){if(_o(a,0)!==0)break;if(j=a.suspendedLanes,(j&x)!==x){Jn(),a.pingedLanes|=a.suspendedLanes&j;break}a.timeoutHandle=cm(Qo.bind(null,a,sr,Bs),c);break}Qo(a,sr,Bs);break;case 4:if(po(a,x),(x&4194240)===x)break;for(c=a.eventTimes,j=-1;0<x;){var M=31-zn(x);N=1<<M,M=c[M],M>j&&(j=M),x&=~N}if(x=j,x=Zt()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*mR(x/1960))-x,10<x){a.timeoutHandle=cm(Qo.bind(null,a,sr,Bs),x);break}Qo(a,sr,Bs);break;case 5:Qo(a,sr,Bs);break;default:throw Error(n(329))}}}return or(a,Zt()),a.callbackNode===p?hw.bind(null,a):null}function rh(a,c){var p=Wl;return a.current.memoizedState.isDehydrated&&(Jo(a,c).flags|=256),a=od(a,c),a!==2&&(c=sr,sr=p,c!==null&&sh(c)),a}function sh(a){sr===null?sr=a:sr.push.apply(sr,a)}function hR(a){for(var c=a;;){if(c.flags&16384){var p=c.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var x=0;x<p.length;x++){var j=p[x],N=j.getSnapshot;j=j.value;try{if(!Gr(N(),j))return!1}catch{return!1}}}if(p=c.child,c.subtreeFlags&16384&&p!==null)p.return=c,c=p;else{if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function po(a,c){for(c&=~Zm,c&=~Zu,a.suspendedLanes|=c,a.pingedLanes&=~c,a=a.expirationTimes;0<c;){var p=31-zn(c),x=1<<p;a[p]=-1,c&=~x}}function gw(a){if((Ct&6)!==0)throw Error(n(327));ti();var c=_o(a,0);if((c&1)===0)return or(a,Zt()),null;var p=od(a,c);if(a.tag!==0&&p===2){var x=Mo(a);x!==0&&(c=x,p=rh(a,x))}if(p===1)throw p=Ul,Jo(a,0),po(a,c),or(a,Zt()),p;if(p===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=c,Qo(a,sr,Bs),or(a,Zt()),null}function oh(a,c){var p=Ct;Ct|=1;try{return a(c)}finally{Ct=p,Ct===0&&(ei=Zt()+500,Du&&oo())}}function Yo(a){uo!==null&&uo.tag===0&&(Ct&6)===0&&ti();var c=Ct;Ct|=1;var p=Ir.transition,x=Pt;try{if(Ir.transition=null,Pt=1,a)return a()}finally{Pt=x,Ir.transition=p,Ct=c,(Ct&6)===0&&oo()}}function ah(){yr=Za.current,Wt(Za)}function Jo(a,c){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==-1&&(a.timeoutHandle=-1,VT(p)),pn!==null)for(p=pn.return;p!==null;){var x=p;switch(hm(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&Au();break;case 3:Ja(),Wt(tr),Wt(Bn),Tm();break;case 5:Cm(x);break;case 4:Ja();break;case 13:Wt(en);break;case 19:Wt(en);break;case 10:wm(x.type._context);break;case 22:case 23:ah()}p=p.return}if(Pn=a,pn=a=mo(a.current,null),On=yr=c,jn=0,Ul=null,Zm=Zu=Go=0,sr=Wl=null,Vo!==null){for(c=0;c<Vo.length;c++)if(p=Vo[c],x=p.interleaved,x!==null){p.interleaved=null;var j=x.next,N=p.pending;if(N!==null){var M=N.next;N.next=j,x.next=M}p.pending=x}Vo=null}return a}function xw(a,c){do{var p=pn;try{if(vm(),Uu.current=Ku,Wu){for(var x=tn.memoizedState;x!==null;){var j=x.queue;j!==null&&(j.pending=null),x=x.next}Wu=!1}if(qo=0,An=wn=tn=null,Ol=!1,_l=0,Xm.current=null,p===null||p.return===null){jn=1,Ul=c,pn=null;break}e:{var N=a,M=p.return,Y=p,Q=c;if(c=On,Y.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var pe=Q,je=Y,Ce=je.tag;if((je.mode&1)===0&&(Ce===0||Ce===11||Ce===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 Ue=Uv(M);if(Ue!==null){Ue.flags&=-257,Wv(Ue,M,Y,N,c),Ue.mode&1&&Bv(N,pe,c),c=Ue,Q=pe;var Ge=c.updateQueue;if(Ge===null){var Je=new Set;Je.add(Q),c.updateQueue=Je}else Ge.add(Q);break e}else{if((c&1)===0){Bv(N,pe,c),ih();break e}Q=Error(n(426))}}else if(Jt&&Y.mode&1){var cn=Uv(M);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Wv(cn,M,Y,N,c),ym(Qa(Q,Y));break e}}N=Q=Qa(Q,Y),jn!==4&&(jn=2),Wl===null?Wl=[N]:Wl.push(N),N=M;do{switch(N.tag){case 3:N.flags|=65536,c&=-c,N.lanes|=c;var ie=Fv(N,Q,c);fv(N,ie);break e;case 1:Y=Q;var te=N.type,de=N.stateNode;if((N.flags&128)===0&&(typeof te.getDerivedStateFromError=="function"||de!==null&&typeof de.componentDidCatch=="function"&&(co===null||!co.has(de)))){N.flags|=65536,c&=-c,N.lanes|=c;var $e=zv(N,Y,c);fv(N,$e);break e}}N=N.return}while(N!==null)}vw(p)}catch(Qe){c=Qe,pn===p&&p!==null&&(pn=p=p.return);continue}break}while(!0)}function yw(){var a=Xu.current;return Xu.current=Ku,a===null?Ku:a}function ih(){(jn===0||jn===3||jn===2)&&(jn=4),Pn===null||(Go&268435455)===0&&(Zu&268435455)===0||po(Pn,On)}function od(a,c){var p=Ct;Ct|=2;var x=yw();(Pn!==a||On!==c)&&(Bs=null,Jo(a,c));do try{gR();break}catch(j){xw(a,j)}while(!0);if(vm(),Ct=p,Xu.current=x,pn!==null)throw Error(n(261));return Pn=null,On=0,jn}function gR(){for(;pn!==null;)bw(pn)}function xR(){for(;pn!==null&&!Op();)bw(pn)}function bw(a){var c=kw(a.alternate,a,yr);a.memoizedProps=a.pendingProps,c===null?vw(a):pn=c,Xm.current=null}function vw(a){var c=a;do{var p=c.alternate;if(a=c.return,(c.flags&32768)===0){if(p=cR(p,c,yr),p!==null){pn=p;return}}else{if(p=uR(p,c),p!==null){p.flags&=32767,pn=p;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{jn=6,pn=null;return}}if(c=c.sibling,c!==null){pn=c;return}pn=c=a}while(c!==null);jn===0&&(jn=5)}function Qo(a,c,p){var x=Pt,j=Ir.transition;try{Ir.transition=null,Pt=1,yR(a,c,p,x)}finally{Ir.transition=j,Pt=x}return null}function yR(a,c,p,x){do ti();while(uo!==null);if((Ct&6)!==0)throw Error(n(327));p=a.finishedWork;var j=a.finishedLanes;if(p===null)return null;if(a.finishedWork=null,a.finishedLanes=0,p===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var N=p.lanes|p.childLanes;if(hl(a,N),a===Pn&&(pn=Pn=null,On=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||td||(td=!0,Sw(Xs,function(){return ti(),null})),N=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||N){N=Ir.transition,Ir.transition=null;var M=Pt;Pt=1;var Y=Ct;Ct|=4,Xm.current=null,fR(a,p),uw(p,a),MT(im),sn=!!am,im=am=null,a.current=p,pR(p),_p(),Ct=Y,Pt=M,Ir.transition=N}else a.current=p;if(td&&(td=!1,uo=a,nd=j),N=a.pendingLanes,N===0&&(co=null),Ta(p.stateNode),or(a,Zt()),c!==null)for(x=a.onRecoverableError,p=0;p<c.length;p++)j=c[p],x(j.value,{componentStack:j.stack,digest:j.digest});if(ed)throw ed=!1,a=th,th=null,a;return(nd&1)!==0&&a.tag!==0&&ti(),N=a.pendingLanes,(N&1)!==0?a===nh?Hl++:(Hl=0,nh=a):Hl=0,oo(),null}function ti(){if(uo!==null){var a=xl(nd),c=Ir.transition,p=Pt;try{if(Ir.transition=null,Pt=16>a?16:a,uo===null)var x=!1;else{if(a=uo,uo=null,nd=0,(Ct&6)!==0)throw Error(n(331));var j=Ct;for(Ct|=4,Ve=a.current;Ve!==null;){var N=Ve,M=N.child;if((Ve.flags&16)!==0){var Y=N.deletions;if(Y!==null){for(var Q=0;Q<Y.length;Q++){var pe=Y[Q];for(Ve=pe;Ve!==null;){var je=Ve;switch(je.tag){case 0:case 11:case 15:Bl(8,je,N)}var Ce=je.child;if(Ce!==null)Ce.return=je,Ve=Ce;else for(;Ve!==null;){je=Ve;var we=je.sibling,Ue=je.return;if(ow(je),je===pe){Ve=null;break}if(we!==null){we.return=Ue,Ve=we;break}Ve=Ue}}}var Ge=N.alternate;if(Ge!==null){var Je=Ge.child;if(Je!==null){Ge.child=null;do{var cn=Je.sibling;Je.sibling=null,Je=cn}while(Je!==null)}}Ve=N}}if((N.subtreeFlags&2064)!==0&&M!==null)M.return=N,Ve=M;else e:for(;Ve!==null;){if(N=Ve,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Bl(9,N,N.return)}var ie=N.sibling;if(ie!==null){ie.return=N.return,Ve=ie;break e}Ve=N.return}}var te=a.current;for(Ve=te;Ve!==null;){M=Ve;var de=M.child;if((M.subtreeFlags&2064)!==0&&de!==null)de.return=M,Ve=de;else e:for(M=te;Ve!==null;){if(Y=Ve,(Y.flags&2048)!==0)try{switch(Y.tag){case 0:case 11:case 15:Qu(9,Y)}}catch(Qe){on(Y,Y.return,Qe)}if(Y===M){Ve=null;break e}var $e=Y.sibling;if($e!==null){$e.return=Y.return,Ve=$e;break e}Ve=Y.return}}if(Ct=j,oo(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(Ea,a)}catch{}x=!0}return x}finally{Pt=p,Ir.transition=c}}return!1}function ww(a,c,p){c=Qa(p,c),c=Fv(a,c,1),a=io(a,c,1),c=Jn(),a!==null&&(qr(a,1,c),or(a,c))}function on(a,c,p){if(a.tag===3)ww(a,a,p);else for(;c!==null;){if(c.tag===3){ww(c,a,p);break}else if(c.tag===1){var x=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(co===null||!co.has(x))){a=Qa(p,a),a=zv(c,a,1),c=io(c,a,1),a=Jn(),c!==null&&(qr(c,1,a),or(c,a));break}}c=c.return}}function bR(a,c,p){var x=a.pingCache;x!==null&&x.delete(c),c=Jn(),a.pingedLanes|=a.suspendedLanes&p,Pn===a&&(On&p)===p&&(jn===4||jn===3&&(On&130023424)===On&&500>Zt()-eh?Jo(a,0):Zm|=p),or(a,c)}function jw(a,c){c===0&&((a.mode&1)===0?c=1:(c=Ra,Ra<<=1,(Ra&130023424)===0&&(Ra=4194304)));var p=Jn();a=Ms(a,c),a!==null&&(qr(a,c,p),or(a,p))}function vR(a){var c=a.memoizedState,p=0;c!==null&&(p=c.retryLane),jw(a,p)}function wR(a,c){var p=0;switch(a.tag){case 13:var x=a.stateNode,j=a.memoizedState;j!==null&&(p=j.retryLane);break;case 19:x=a.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(c),jw(a,p)}var kw;kw=function(a,c,p){if(a!==null)if(a.memoizedProps!==c.pendingProps||tr.current)rr=!0;else{if((a.lanes&p)===0&&(c.flags&128)===0)return rr=!1,lR(a,c,p);rr=(a.flags&131072)!==0}else rr=!1,Jt&&(c.flags&1048576)!==0&&nv(c,Lu,c.index);switch(c.lanes=0,c.tag){case 2:var x=c.type;Yu(a,c),a=c.pendingProps;var j=Wa(c,Bn.current);Ya(c,p),j=Pm(null,c,x,a,j,p);var N=Dm();return c.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(c.tag=1,c.memoizedState=null,c.updateQueue=null,nr(x)?(N=!0,Pu(c)):N=!1,c.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,Sm(c),j.updater=qu,c.stateNode=j,j._reactInternals=c,Mm(c,x,a,p),c=Um(null,c,x,!0,N,p)):(c.tag=0,Jt&&N&&mm(c),Yn(null,c,j,p),c=c.child),c;case 16:x=c.elementType;e:{switch(Yu(a,c),a=c.pendingProps,j=x._init,x=j(x._payload),c.type=x,j=c.tag=kR(x),a=Jr(x,a),j){case 0:c=Bm(null,c,x,a,p);break e;case 1:c=Yv(null,c,x,a,p);break e;case 11:c=Hv(null,c,x,a,p);break e;case 14:c=Vv(null,c,x,Jr(x.type,a),p);break e}throw Error(n(306,x,""))}return c;case 0:return x=c.type,j=c.pendingProps,j=c.elementType===x?j:Jr(x,j),Bm(a,c,x,j,p);case 1:return x=c.type,j=c.pendingProps,j=c.elementType===x?j:Jr(x,j),Yv(a,c,x,j,p);case 3:e:{if(Jv(c),a===null)throw Error(n(387));x=c.pendingProps,N=c.memoizedState,j=N.element,dv(a,c),zu(c,x,null,p);var M=c.memoizedState;if(x=M.element,N.isDehydrated)if(N={element:x,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},c.updateQueue.baseState=N,c.memoizedState=N,c.flags&256){j=Qa(Error(n(423)),c),c=Qv(a,c,x,p,j);break e}else if(x!==j){j=Qa(Error(n(424)),c),c=Qv(a,c,x,p,j);break e}else for(xr=no(c.stateNode.containerInfo.firstChild),gr=c,Jt=!0,Yr=null,p=cv(c,null,x,p),c.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ka(),x===j){c=zs(a,c,p);break e}Yn(a,c,x,p)}c=c.child}return c;case 5:return mv(c),a===null&&xm(c),x=c.type,j=c.pendingProps,N=a!==null?a.memoizedProps:null,M=j.children,lm(x,j)?M=null:N!==null&&lm(x,N)&&(c.flags|=32),Gv(a,c),Yn(a,c,M,p),c.child;case 6:return a===null&&xm(c),null;case 13:return Xv(a,c,p);case 4:return Nm(c,c.stateNode.containerInfo),x=c.pendingProps,a===null?c.child=qa(c,null,x,p):Yn(a,c,x,p),c.child;case 11:return x=c.type,j=c.pendingProps,j=c.elementType===x?j:Jr(x,j),Hv(a,c,x,j,p);case 7:return Yn(a,c,c.pendingProps,p),c.child;case 8:return Yn(a,c,c.pendingProps.children,p),c.child;case 12:return Yn(a,c,c.pendingProps.children,p),c.child;case 10:e:{if(x=c.type._context,j=c.pendingProps,N=c.memoizedProps,M=j.value,Ft(_u,x._currentValue),x._currentValue=M,N!==null)if(Gr(N.value,M)){if(N.children===j.children&&!tr.current){c=zs(a,c,p);break e}}else for(N=c.child,N!==null&&(N.return=c);N!==null;){var Y=N.dependencies;if(Y!==null){M=N.child;for(var Q=Y.firstContext;Q!==null;){if(Q.context===x){if(N.tag===1){Q=Fs(-1,p&-p),Q.tag=2;var pe=N.updateQueue;if(pe!==null){pe=pe.shared;var je=pe.pending;je===null?Q.next=Q:(Q.next=je.next,je.next=Q),pe.pending=Q}}N.lanes|=p,Q=N.alternate,Q!==null&&(Q.lanes|=p),jm(N.return,p,c),Y.lanes|=p;break}Q=Q.next}}else if(N.tag===10)M=N.type===c.type?null:N.child;else if(N.tag===18){if(M=N.return,M===null)throw Error(n(341));M.lanes|=p,Y=M.alternate,Y!==null&&(Y.lanes|=p),jm(M,p,c),M=N.sibling}else M=N.child;if(M!==null)M.return=N;else for(M=N;M!==null;){if(M===c){M=null;break}if(N=M.sibling,N!==null){N.return=M.return,M=N;break}M=M.return}N=M}Yn(a,c,j.children,p),c=c.child}return c;case 9:return j=c.type,x=c.pendingProps.children,Ya(c,p),j=$r(j),x=x(j),c.flags|=1,Yn(a,c,x,p),c.child;case 14:return x=c.type,j=Jr(x,c.pendingProps),j=Jr(x.type,j),Vv(a,c,x,j,p);case 15:return Kv(a,c,c.type,c.pendingProps,p);case 17:return x=c.type,j=c.pendingProps,j=c.elementType===x?j:Jr(x,j),Yu(a,c),c.tag=1,nr(x)?(a=!0,Pu(c)):a=!1,Ya(c,p),_v(c,x,j),Mm(c,x,j,p),Um(null,c,x,!0,a,p);case 19:return ew(a,c,p);case 22:return qv(a,c,p)}throw Error(n(156,c.tag))};function Sw(a,c){return fu(a,c)}function jR(a,c,p,x){this.tag=a,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(a,c,p,x){return new jR(a,c,p,x)}function lh(a){return a=a.prototype,!(!a||!a.isReactComponent)}function kR(a){if(typeof a=="function")return lh(a)?1:0;if(a!=null){if(a=a.$$typeof,a===z)return 11;if(a===B)return 14}return 2}function mo(a,c){var p=a.alternate;return p===null?(p=Or(a.tag,c,a.key,a.mode),p.elementType=a.elementType,p.type=a.type,p.stateNode=a.stateNode,p.alternate=a,a.alternate=p):(p.pendingProps=c,p.type=a.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=a.flags&14680064,p.childLanes=a.childLanes,p.lanes=a.lanes,p.child=a.child,p.memoizedProps=a.memoizedProps,p.memoizedState=a.memoizedState,p.updateQueue=a.updateQueue,c=a.dependencies,p.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},p.sibling=a.sibling,p.index=a.index,p.ref=a.ref,p}function ad(a,c,p,x,j,N){var M=2;if(x=a,typeof a=="function")lh(a)&&(M=1);else if(typeof a=="string")M=5;else e:switch(a){case P:return Xo(p.children,j,N,c);case $:M=8,j|=8;break;case L:return a=Or(12,p,c,j|2),a.elementType=L,a.lanes=N,a;case V:return a=Or(13,p,c,j),a.elementType=V,a.lanes=N,a;case O:return a=Or(19,p,c,j),a.elementType=O,a.lanes=N,a;case q:return id(p,j,N,c);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case F:M=10;break e;case A:M=9;break e;case z:M=11;break e;case B:M=14;break e;case K:M=16,x=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return c=Or(M,p,c,j),c.elementType=a,c.type=x,c.lanes=N,c}function Xo(a,c,p,x){return a=Or(7,a,x,c),a.lanes=p,a}function id(a,c,p,x){return a=Or(22,a,x,c),a.elementType=q,a.lanes=p,a.stateNode={isHidden:!1},a}function ch(a,c,p){return a=Or(6,a,null,c),a.lanes=p,a}function uh(a,c,p){return c=Or(4,a.children!==null?a.children:[],a.key,c),c.lanes=p,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}function SR(a,c,p,x,j){this.tag=c,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Yt(0),this.expirationTimes=Yt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Yt(0),this.identifierPrefix=x,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function dh(a,c,p,x,j,N,M,Y,Q){return a=new SR(a,c,p,Y,Q),c===1?(c=1,N===!0&&(c|=8)):c=0,N=Or(3,null,null,c),a.current=N,N.stateNode=a,N.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sm(N),a}function NR(a,c,p){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:x==null?null:""+x,children:a,containerInfo:c,implementation:p}}function Nw(a){if(!a)return so;a=a._reactInternals;e:{if(ht(a)!==a||a.tag!==1)throw Error(n(170));var c=a;do{switch(c.tag){case 3:c=c.stateNode.context;break e;case 1:if(nr(c.type)){c=c.stateNode.__reactInternalMemoizedMergedChildContext;break e}}c=c.return}while(c!==null);throw Error(n(171))}if(a.tag===1){var p=a.type;if(nr(p))return Zb(a,p,c)}return c}function Cw(a,c,p,x,j,N,M,Y,Q){return a=dh(p,x,!0,a,j,N,M,Y,Q),a.context=Nw(null),p=a.current,x=Jn(),j=fo(p),N=Fs(x,j),N.callback=c??null,io(p,N,j),a.current.lanes=j,qr(a,j,x),or(a,x),a}function ld(a,c,p,x){var j=c.current,N=Jn(),M=fo(j);return p=Nw(p),c.context===null?c.context=p:c.pendingContext=p,c=Fs(N,M),c.payload={element:a},x=x===void 0?null:x,x!==null&&(c.callback=x),a=io(j,c,M),a!==null&&(Zr(a,j,M,N),Fu(a,j,M)),M}function cd(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function Ew(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<c?p:c}}function fh(a,c){Ew(a,c),(a=a.alternate)&&Ew(a,c)}function CR(){return null}var Tw=typeof reportError=="function"?reportError:function(a){console.error(a)};function ph(a){this._internalRoot=a}ud.prototype.render=ph.prototype.render=function(a){var c=this._internalRoot;if(c===null)throw Error(n(409));ld(a,c,null,null)},ud.prototype.unmount=ph.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var c=a.containerInfo;Yo(function(){ld(null,a,null,null)}),c[Ls]=null}};function ud(a){this._internalRoot=a}ud.prototype.unstable_scheduleHydration=function(a){if(a){var c=yl();a={blockedOn:null,target:a,priority:c};for(var p=0;p<fs.length&&c!==0&&c<fs[p].priority;p++);fs.splice(p,0,a),p===0&&ge(a)}};function mh(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function dd(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function Rw(){}function ER(a,c,p,x,j){if(j){if(typeof x=="function"){var N=x;x=function(){var pe=cd(M);N.call(pe)}}var M=Cw(c,x,a,0,null,!1,!1,"",Rw);return a._reactRootContainer=M,a[Ls]=M.current,Tl(a.nodeType===8?a.parentNode:a),Yo(),M}for(;j=a.lastChild;)a.removeChild(j);if(typeof x=="function"){var Y=x;x=function(){var pe=cd(Q);Y.call(pe)}}var Q=dh(a,0,!1,null,null,!1,!1,"",Rw);return a._reactRootContainer=Q,a[Ls]=Q.current,Tl(a.nodeType===8?a.parentNode:a),Yo(function(){ld(c,Q,p,x)}),Q}function fd(a,c,p,x,j){var N=p._reactRootContainer;if(N){var M=N;if(typeof j=="function"){var Y=j;j=function(){var Q=cd(M);Y.call(Q)}}ld(c,M,a,j)}else M=ER(p,c,a,j,x);return cd(M)}Aa=function(a){switch(a.tag){case 3:var c=a.stateNode;if(c.current.memoizedState.isDehydrated){var p=Zs(c.pendingLanes);p!==0&&(gl(c,p|1),or(c,Zt()),(Ct&6)===0&&(ei=Zt()+500,oo()))}break;case 13:Yo(function(){var x=Ms(a,1);if(x!==null){var j=Jn();Zr(x,a,1,j)}}),fh(a,1)}},Pa=function(a){if(a.tag===13){var c=Ms(a,134217728);if(c!==null){var p=Jn();Zr(c,a,134217728,p)}fh(a,134217728)}},Ps=function(a){if(a.tag===13){var c=fo(a),p=Ms(a,c);if(p!==null){var x=Jn();Zr(p,a,c,x)}fh(a,c)}},yl=function(){return Pt},bl=function(a,c){var p=Pt;try{return Pt=a,c()}finally{Pt=p}},St=function(a,c,p){switch(c){case"input":if(Se(a,p),c=p.name,p.type==="radio"&&c!=null){for(p=a;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+c)+'][type="radio"]'),c=0;c<p.length;c++){var x=p[c];if(x!==a&&x.form===a.form){var j=Ru(x);if(!j)throw Error(n(90));st(x),Se(x,j)}}}break;case"textarea":bt(a,p);break;case"select":c=p.value,c!=null&&_e(a,!!p.multiple,c,!1)}},Xt=oh,dn=Yo;var TR={usingClientEntryPoint:!1,Events:[Pl,Ba,Ru,Ye,It,oh]},Vl={findFiberByHostInstance:Bo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},RR={bundleType:Vl.bundleType,version:Vl.version,rendererPackageName:Vl.rendererPackageName,rendererConfig:Vl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=rn(a),a===null?null:a.stateNode},findFiberByHostInstance:Vl.findFiberByHostInstance||CR,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 pd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!pd.isDisabled&&pd.supportsFiber)try{Ea=pd.inject(RR),an=pd}catch{}}return ar.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=TR,ar.createPortal=function(a,c){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mh(c))throw Error(n(200));return NR(a,c,null,p)},ar.createRoot=function(a,c){if(!mh(a))throw Error(n(299));var p=!1,x="",j=Tw;return c!=null&&(c.unstable_strictMode===!0&&(p=!0),c.identifierPrefix!==void 0&&(x=c.identifierPrefix),c.onRecoverableError!==void 0&&(j=c.onRecoverableError)),c=dh(a,1,!1,null,null,p,!1,x,j),a[Ls]=c.current,Tl(a.nodeType===8?a.parentNode:a),new ph(c)},ar.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var c=a._reactInternals;if(c===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=rn(c),a=a===null?null:a.stateNode,a},ar.flushSync=function(a){return Yo(a)},ar.hydrate=function(a,c,p){if(!dd(c))throw Error(n(200));return fd(null,a,c,!0,p)},ar.hydrateRoot=function(a,c,p){if(!mh(a))throw Error(n(405));var x=p!=null&&p.hydratedSources||null,j=!1,N="",M=Tw;if(p!=null&&(p.unstable_strictMode===!0&&(j=!0),p.identifierPrefix!==void 0&&(N=p.identifierPrefix),p.onRecoverableError!==void 0&&(M=p.onRecoverableError)),c=Cw(c,null,a,1,p??null,j,!1,N,M),a[Ls]=c.current,Tl(a),x)for(a=0;a<x.length;a++)p=x[a],j=p._getVersion,j=j(p._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[p,j]:c.mutableSourceEagerHydrationData.push(p,j);return new ud(c)},ar.render=function(a,c,p){if(!dd(c))throw Error(n(200));return fd(null,a,c,!1,p)},ar.unmountComponentAtNode=function(a){if(!dd(a))throw Error(n(40));return a._reactRootContainer?(Yo(function(){fd(null,null,a,!1,function(){a._reactRootContainer=null,a[Ls]=null})}),!0):!1},ar.unstable_batchedUpdates=oh,ar.unstable_renderSubtreeIntoContainer=function(a,c,p,x){if(!dd(p))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return fd(a,c,p,!1,x)},ar.version="18.3.1-next-f1338f8080-20240426",ar}var _w;function Fk(){if(_w)return yh.exports;_w=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(),yh.exports=FR(),yh.exports}var Mw;function zR(){if(Mw)return md;Mw=1;var e=Fk();return md.createRoot=e.createRoot,md.hydrateRoot=e.hydrateRoot,md}var BR=zR();/**
|
|
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 Fw="popstate";function zw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function UR(e={}){function t(s,o){var m;let i=(m=o.state)==null?void 0:m.masked,{pathname:l,search:u,hash:d}=i||s.location;return kg("",{pathname:l,search:u,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,o){return typeof o=="string"?o:Sc(o)}return HR(t,n,null,e)}function nn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function es(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function WR(){return Math.random().toString(36).substring(2,10)}function Bw(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 kg(e,t,n=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ki(t):t,state:n,key:t&&t.key||s||WR(),unstable_mask:o}}function Sc({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 Ki(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 HR(e,t,n,s={}){let{window:o=document.defaultView,v5Compat:i=!1}=s,l=o.history,u="POP",d=null,m=h();m==null&&(m=0,l.replaceState({...l.state,idx:m},""));function h(){return(l.state||{idx:null}).idx}function g(){u="POP";let v=h(),k=v==null?null:v-m;m=v,d&&d({action:u,location:w.location,delta:k})}function y(v,k){u="PUSH";let E=zw(v)?v:kg(w.location,v,k);m=h()+1;let S=Bw(E,m),T=w.createHref(E.unstable_mask||E);try{l.pushState(S,"",T)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;o.location.assign(T)}i&&d&&d({action:u,location:w.location,delta:1})}function b(v,k){u="REPLACE";let E=zw(v)?v:kg(w.location,v,k);m=h();let S=Bw(E,m),T=w.createHref(E.unstable_mask||E);l.replaceState(S,"",T),i&&d&&d({action:u,location:w.location,delta:0})}function C(v){return VR(v)}let w={get action(){return u},get location(){return e(o,l)},listen(v){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(Fw,g),d=v,()=>{o.removeEventListener(Fw,g),d=null}},createHref(v){return t(o,v)},createURL:C,encodeLocation(v){let k=C(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return l.go(v)}};return w}function VR(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),nn(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:Sc(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function zk(e,t,n="/"){return KR(e,t,n,!1)}function KR(e,t,n,s){let o=typeof t=="string"?Ki(t):t,i=qs(o.pathname||"/",n);if(i==null)return null;let l=Bk(e);qR(l);let u=null;for(let d=0;u==null&&d<l.length;++d){let m=sA(i);u=nA(l[d],m,s)}return u}function Bk(e,t=[],n=[],s="",o=!1){let i=(l,u,d=o,m)=>{let h={relativePath:m===void 0?l.path||"":m,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&d)return;nn(h.relativePath.startsWith(s),`Absolute route path "${h.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(s.length)}let g=ks([s,h.relativePath]),y=n.concat(h);l.children&&l.children.length>0&&(nn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),Bk(l.children,t,y,g,d)),!(l.path==null&&!l.index)&&t.push({path:g,score:eA(g,l.index),routesMeta:y})};return e.forEach((l,u)=>{var d;if(l.path===""||!((d=l.path)!=null&&d.includes("?")))i(l,u);else for(let m of Uk(l.path))i(l,u,!0,m)}),t}function Uk(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return o?[i,""]:[i];let l=Uk(s.join("/")),u=[];return u.push(...l.map(d=>d===""?i:[i,d].join("/"))),o&&u.push(...l),u.map(d=>e.startsWith("/")&&d===""?"/":d)}function qR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:tA(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var GR=/^:[\w-]+$/,YR=3,JR=2,QR=1,XR=10,ZR=-2,Uw=e=>e==="*";function eA(e,t){let n=e.split("/"),s=n.length;return n.some(Uw)&&(s+=ZR),t&&(s+=JR),n.filter(o=>!Uw(o)).reduce((o,i)=>o+(GR.test(i)?YR:i===""?QR:XR),s)}function tA(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function nA(e,t,n=!1){let{routesMeta:s}=e,o={},i="/",l=[];for(let u=0;u<s.length;++u){let d=s[u],m=u===s.length-1,h=i==="/"?t:t.slice(i.length)||"/",g=ef({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},h),y=d.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=ef({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},h)),!g)return null;Object.assign(o,g.params),l.push({params:o,pathname:ks([i,g.pathname]),pathnameBase:lA(ks([i,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(i=ks([i,g.pathnameBase]))}return l}function ef(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=rA(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],l=i.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let C=u[y]||"";l=i.slice(0,i.length-C.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:i,pathnameBase:l,pattern:e}}function rA(e,t=!1,n=!0){es(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,d,m,h)=>{if(s.push({paramName:u,isOptional:d!=null}),d){let g=h.charAt(m+l.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function sA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return es(!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 qs(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 oA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function aA(e,t="/"){let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Ki(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=Ww(n.substring(1),"/"):i=Ww(n,t)):i=t,{pathname:i,search:cA(s),hash:uA(o)}}function Ww(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function wh(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 iA(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Wk(e){let t=iA(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function kx(e,t,n,s=!1){let o;typeof e=="string"?o=Ki(e):(o={...e},nn(!o.pathname||!o.pathname.includes("?"),wh("?","pathname","search",o)),nn(!o.pathname||!o.pathname.includes("#"),wh("#","pathname","hash",o)),nn(!o.search||!o.search.includes("#"),wh("#","search","hash",o)));let i=e===""||o.pathname==="",l=i?"/":o.pathname,u;if(l==null)u=n;else{let g=t.length-1;if(!s&&l.startsWith("..")){let y=l.split("/");for(;y[0]==="..";)y.shift(),g-=1;o.pathname=y.join("/")}u=g>=0?t[g]:"/"}let d=aA(o,u),m=l&&l!=="/"&&l.endsWith("/"),h=(i||l===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(m||h)&&(d.pathname+="/"),d}var ks=e=>e.join("/").replace(/\/\/+/g,"/"),lA=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),cA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,uA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,dA=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 fA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function pA(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Hk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Vk(e,t){let n=e;if(typeof n!="string"||!oA.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,o=!1;if(Hk)try{let i=new URL(window.location.href),l=n.startsWith("//")?new URL(i.protocol+n):new URL(n),u=qs(l.pathname,t);l.origin===i.origin&&u!=null?n=u+l.search+l.hash:o=!0}catch{es(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Kk=["POST","PUT","PATCH","DELETE"];new Set(Kk);var mA=["GET",...Kk];new Set(mA);var qi=f.createContext(null);qi.displayName="DataRouter";var Lf=f.createContext(null);Lf.displayName="DataRouterState";var hA=f.createContext(!1),qk=f.createContext({isTransitioning:!1});qk.displayName="ViewTransition";var gA=f.createContext(new Map);gA.displayName="Fetchers";var xA=f.createContext(null);xA.displayName="Await";var Ur=f.createContext(null);Ur.displayName="Navigation";var zc=f.createContext(null);zc.displayName="Location";var as=f.createContext({outlet:null,matches:[],isDataRoute:!1});as.displayName="Route";var Sx=f.createContext(null);Sx.displayName="RouteError";var Gk="REACT_ROUTER_ERROR",yA="REDIRECT",bA="ROUTE_ERROR_RESPONSE";function vA(e){if(e.startsWith(`${Gk}:${yA}:{`))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 wA(e){if(e.startsWith(`${Gk}:${bA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new dA(t.status,t.statusText,t.data)}catch{}}function jA(e,{relative:t}={}){nn(Bc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Ur),{hash:o,pathname:i,search:l}=Uc(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:ks([n,i])),s.createHref({pathname:u,search:l,hash:o})}function Bc(){return f.useContext(zc)!=null}function Qn(){return nn(Bc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(zc).location}var Yk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Jk(e){f.useContext(Ur).static||f.useLayoutEffect(e)}function _t(){let{isDataRoute:e}=f.useContext(as);return e?_A():kA()}function kA(){nn(Bc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(qi),{basename:t,navigator:n}=f.useContext(Ur),{matches:s}=f.useContext(as),{pathname:o}=Qn(),i=JSON.stringify(Wk(s)),l=f.useRef(!1);return Jk(()=>{l.current=!0}),f.useCallback((d,m={})=>{if(es(l.current,Yk),!l.current)return;if(typeof d=="number"){n.go(d);return}let h=kx(d,JSON.parse(i),o,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ks([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,i,o,e])}var SA=f.createContext(null);function NA(e){let t=f.useContext(as).outlet;return f.useMemo(()=>t&&f.createElement(SA.Provider,{value:e},t),[t,e])}function Mt(){let{matches:e}=f.useContext(as),t=e[e.length-1];return t?t.params:{}}function Uc(e,{relative:t}={}){let{matches:n}=f.useContext(as),{pathname:s}=Qn(),o=JSON.stringify(Wk(n));return f.useMemo(()=>kx(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function CA(e,t){return Qk(e,t)}function Qk(e,t,n){var v;nn(Bc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Ur),{matches:o}=f.useContext(as),i=o[o.length-1],l=i?i.params:{},u=i?i.pathname:"/",d=i?i.pathnameBase:"/",m=i&&i.route;{let k=m&&m.path||"";Zk(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=Qn(),g;if(t){let k=typeof t=="string"?Ki(t):t;nn(d==="/"||((v=k.pathname)==null?void 0:v.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(d!=="/"){let k=d.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=zk(e,{pathname:b});es(m||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),es(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=PA(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:ks([d,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?d:ks([d,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,n);return t&&w?f.createElement(zc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},w):w}function EA(){let e=OA(),t=fA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=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:i},"ErrorBoundary")," or"," ",f.createElement("code",{style:i},"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:o},n):null,l)}var TA=f.createElement(EA,null),Xk=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=wA(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(as.Provider,{value:this.props.routeContext},f.createElement(Sx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(RA,{error:e},t):t}};Xk.contextType=hA;var jh=new WeakMap;function RA({children:e,error:t}){let{basename:n}=f.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=vA(t.digest);if(s){let o=jh.get(t);if(o)throw o;let i=Vk(s.location,n);if(Hk&&!jh.get(t))if(i.isExternal||s.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw jh.set(t,l),l}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function AA({routeContext:e,match:t,children:n}){let s=f.useContext(qi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(as.Provider,{value:e},n)}function PA(e,t=[],n){let s=n==null?void 0:n.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,i=s==null?void 0:s.errors;if(i!=null){let h=o.findIndex(g=>g.route.id&&(i==null?void 0:i[g.route.id])!==void 0);nn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let l=!1,u=-1;if(n&&s){l=s.renderFallback;for(let h=0;h<o.length;h++){let g=o[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,C=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||C){n.isStatic&&(l=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let d=n==null?void 0:n.onError,m=s&&d?(h,g)=>{var y,b;d(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:pA(s.matches),errorInfo:g})}:void 0;return o.reduceRight((h,g,y)=>{let b,C=!1,w=null,v=null;s&&(b=i&&g.route.id?i[g.route.id]:void 0,w=g.route.errorElement||TA,l&&(u<0&&y===0?(Zk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,v=null):u===y&&(C=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,y+1)),E=()=>{let S;return b?S=w:C?S=v:g.route.Component?S=f.createElement(g.route.Component,null):g.route.element?S=g.route.element:S=h,f.createElement(AA,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(Xk,{location:s.location,revalidation:s.revalidation,component:w,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Nx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function DA(e){let t=f.useContext(qi);return nn(t,Nx(e)),t}function $A(e){let t=f.useContext(Lf);return nn(t,Nx(e)),t}function LA(e){let t=f.useContext(as);return nn(t,Nx(e)),t}function Cx(e){let t=LA(e),n=t.matches[t.matches.length-1];return nn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function IA(){return Cx("useRouteId")}function OA(){var s;let e=f.useContext(Sx),t=$A("useRouteError"),n=Cx("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function _A(){let{router:e}=DA("useNavigate"),t=Cx("useNavigate"),n=f.useRef(!1);return Jk(()=>{n.current=!0}),f.useCallback(async(o,i={})=>{es(n.current,Yk),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var Hw={};function Zk(e,t,n){!t&&!Hw[e]&&(Hw[e]=!0,es(!1,n))}f.memo(MA);function MA({routes:e,future:t,state:n,isStatic:s,onError:o}){return Qk(e,void 0,{state:n,isStatic:s,onError:o})}function FA(e){return NA(e.context)}function Ke(e){nn(!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 zA({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:o,static:i=!1,unstable_useTransitions:l}){nn(!Bc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),d=f.useMemo(()=>({basename:u,navigator:o,static:i,unstable_useTransitions:l,future:{}}),[u,o,i,l]);typeof n=="string"&&(n=Ki(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:C}=n,w=f.useMemo(()=>{let v=qs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:C},navigationType:s}},[u,m,h,g,y,b,s,C]);return es(w!=null,`<Router basename="${u}"> is not able to match the URL "${m}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:f.createElement(Ur.Provider,{value:d},f.createElement(zc.Provider,{children:t,value:w}))}function BA({children:e,location:t}){return CA(Sg(e),t)}function Sg(e,t=[]){let n=[];return f.Children.forEach(e,(s,o)=>{if(!f.isValidElement(s))return;let i=[...t,o];if(s.type===f.Fragment){n.push.apply(n,Sg(s.props.children,i));return}nn(s.type===Ke,`[${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>`),nn(!s.props.index||!s.props.children,"An index route cannot have child routes.");let l={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(l.children=Sg(s.props.children,i)),n.push(l)}),n}var Id="get",Od="application/x-www-form-urlencoded";function If(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function UA(e){return If(e)&&e.tagName.toLowerCase()==="button"}function WA(e){return If(e)&&e.tagName.toLowerCase()==="form"}function HA(e){return If(e)&&e.tagName.toLowerCase()==="input"}function VA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function KA(e,t){return e.button===0&&(!t||t==="_self")&&!VA(e)}function Ng(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(o=>[n,o]):[[n,s]])},[]))}function qA(e,t){let n=Ng(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var hd=null;function GA(){if(hd===null)try{new FormData(document.createElement("form"),0),hd=!1}catch{hd=!0}return hd}var YA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function kh(e){return e!=null&&!YA.has(e)?(es(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Od}"`),null):e}function JA(e,t){let n,s,o,i,l;if(WA(e)){let u=e.getAttribute("action");s=u?qs(u,t):null,n=e.getAttribute("method")||Id,o=kh(e.getAttribute("enctype"))||Od,i=new FormData(e)}else if(UA(e)||HA(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||u.getAttribute("action");if(s=d?qs(d,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Id,o=kh(e.getAttribute("formenctype"))||kh(u.getAttribute("enctype"))||Od,i=new FormData(u,e),!GA()){let{name:m,type:h,value:g}=e;if(h==="image"){let y=m?`${m}.`:"";i.append(`${y}x`,"0"),i.append(`${y}y`,"0")}else m&&i.append(m,g)}}else{if(If(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Id,s=null,o=Od,l=e}return i&&o==="text/plain"&&(l=i,i=void 0),{action:s,method:n.toLowerCase(),encType:o,formData:i,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ex(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function QA(e,t,n,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&qs(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${s}`,o}async function XA(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 ZA(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 eP(e,t,n){let s=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let l=await XA(i,n);return l.links?l.links():[]}return[]}));return sP(s.flat(1).filter(ZA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Vw(e,t,n,s,o,i){let l=(d,m)=>n[m]?d.route.id!==n[m].route.id:!0,u=(d,m)=>{var h;return n[m].pathname!==d.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,m)=>l(d,m)||u(d,m)):i==="data"?t.filter((d,m)=>{var g;let h=s.routes[d.route.id];if(!h||!h.hasLoader)return!1;if(l(d,m)||u(d,m))return!0;if(d.route.shouldRevalidate){let y=d.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function tP(e,t,{includeHydrateFallback:n}={}){return nP(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let i=[o.module];return o.clientActionModule&&(i=i.concat(o.clientActionModule)),o.clientLoaderModule&&(i=i.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(i=i.concat(o.hydrateFallbackModule)),o.imports&&(i=i.concat(o.imports)),i}).flat(1))}function nP(e){return[...new Set(e)]}function rP(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function sP(e,t){let n=new Set;return new Set(t),e.reduce((s,o)=>{let i=JSON.stringify(rP(o));return n.has(i)||(n.add(i),s.push({key:i,link:o})),s},[])}function eS(){let e=f.useContext(qi);return Ex(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function oP(){let e=f.useContext(Lf);return Ex(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Tx=f.createContext(void 0);Tx.displayName="FrameworkContext";function tS(){let e=f.useContext(Tx);return Ex(e,"You must render this element inside a <HydratedRouter> element"),e}function aP(e,t){let n=f.useContext(Tx),[s,o]=f.useState(!1),[i,l]=f.useState(!1),{onFocus:u,onBlur:d,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let w=k=>{k.forEach(E=>{l(E.isIntersecting)})},v=new IntersectionObserver(w,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.disconnect()}}},[e]),f.useEffect(()=>{if(s){let w=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(w)}}},[s]);let b=()=>{o(!0)},C=()=>{o(!1),l(!1)};return n?e!=="intent"?[i,y,{}]:[i,y,{onFocus:ql(u,b),onBlur:ql(d,C),onMouseEnter:ql(m,b),onMouseLeave:ql(h,C),onTouchStart:ql(g,b)}]:[!1,y,{}]}function ql(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function iP({page:e,...t}){let{router:n}=eS(),s=f.useMemo(()=>zk(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(cP,{page:e,matches:s,...t}):null}function lP(e){let{manifest:t,routeModules:n}=tS(),[s,o]=f.useState([]);return f.useEffect(()=>{let i=!1;return eP(e,t,n).then(l=>{i||o(l)}),()=>{i=!0}},[e,t,n]),s}function cP({page:e,matches:t,...n}){let s=Qn(),{future:o,manifest:i,routeModules:l}=tS(),{basename:u}=eS(),{loaderData:d,matches:m}=oP(),h=f.useMemo(()=>Vw(e,t,m,i,s,"data"),[e,t,m,i,s]),g=f.useMemo(()=>Vw(e,t,m,i,s,"assets"),[e,t,m,i,s]),y=f.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,v=!1;if(t.forEach(E=>{var T;let S=i.routes[E.route.id];!S||!S.hasLoader||(!h.some(I=>I.route.id===E.route.id)&&E.route.id in d&&((T=l[E.route.id])!=null&&T.shouldRevalidate)||S.hasClientLoader?v=!0:w.add(E.route.id))}),w.size===0)return[];let k=QA(e,u,o.unstable_trailingSlashAwareDataRequests,"data");return v&&w.size>0&&k.searchParams.set("_routes",t.filter(E=>w.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[u,o.unstable_trailingSlashAwareDataRequests,d,s,i,h,t,e,l]),b=f.useMemo(()=>tP(g,i),[g,i]),C=lP(g);return f.createElement(f.Fragment,null,y.map(w=>f.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),b.map(w=>f.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),C.map(({key:w,link:v})=>f.createElement("link",{key:w,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function uP(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var dP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{dP&&(window.__reactRouterVersion="7.13.1")}catch{}function fP({basename:e,children:t,unstable_useTransitions:n,window:s}){let o=f.useRef();o.current==null&&(o.current=UR({window:s,v5Compat:!0}));let i=o.current,[l,u]=f.useState({action:i.action,location:i.location}),d=f.useCallback(m=>{n===!1?u(m):f.startTransition(()=>u(m))},[n]);return f.useLayoutEffect(()=>i.listen(d),[i,d]),f.createElement(zA,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:i,unstable_useTransitions:n})}var nS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:o,reloadDocument:i,replace:l,unstable_mask:u,state:d,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...C},w){let{basename:v,navigator:k,unstable_useTransitions:E}=f.useContext(Ur),S=typeof h=="string"&&nS.test(h),T=Vk(h,v);h=T.to;let I=jA(h,{relative:o}),R=Qn(),P=null;if(u){let B=kx(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(B.pathname=B.pathname==="/"?v:ks([v,B.pathname])),P=k.createHref(B)}let[$,L,F]=aP(s,C),A=gP(h,{replace:l,unstable_mask:u,state:d,target:m,preventScrollReset:g,relative:o,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function z(B){t&&t(B),B.defaultPrevented||A(B)}let V=!(T.isExternal||i),O=f.createElement("a",{...C,...F,href:(V?P:void 0)||T.absoluteURL||I,onClick:V?z:t,ref:uP(w,L),target:m,"data-discover":!S&&n==="render"?"true":void 0});return $&&!S?f.createElement(f.Fragment,null,O,f.createElement(iP,{page:I})):O});Te.displayName="Link";var pP=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:o=!1,style:i,to:l,viewTransition:u,children:d,...m},h){let g=Uc(l,{relative:m.relative}),y=Qn(),b=f.useContext(Lf),{navigator:C,basename:w}=f.useContext(Ur),v=b!=null&&wP(g)&&u===!0,k=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,E=y.pathname,S=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),S=S?S.toLowerCase():null,k=k.toLowerCase()),S&&w&&(S=qs(S,w)||S);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let I=E===k||!o&&E.startsWith(k)&&E.charAt(T)==="/",R=S!=null&&(S===k||!o&&S.startsWith(k)&&S.charAt(k.length)==="/"),P={isActive:I,isPending:R,isTransitioning:v},$=I?t:void 0,L;typeof s=="function"?L=s(P):L=[s,I?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let F=typeof i=="function"?i(P):i;return f.createElement(Te,{...m,"aria-current":$,className:L,ref:h,style:F,to:l,viewTransition:u},typeof d=="function"?d(P):d)});pP.displayName="NavLink";var mP=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:o,state:i,method:l=Id,action:u,onSubmit:d,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},C)=>{let{unstable_useTransitions:w}=f.useContext(Ur),v=bP(),k=vP(u,{relative:m}),E=l.toLowerCase()==="get"?"get":"post",S=typeof u=="string"&&nS.test(u),T=I=>{if(d&&d(I),I.defaultPrevented)return;I.preventDefault();let R=I.nativeEvent.submitter,P=(R==null?void 0:R.getAttribute("formmethod"))||l,$=()=>v(R||I.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:o,state:i,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});w&&n!==!1?f.startTransition(()=>$()):$()};return f.createElement("form",{ref:C,method:E,action:k,onSubmit:s?d:T,...b,"data-discover":!S&&e==="render"?"true":void 0})});mP.displayName="Form";function hP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function rS(e){let t=f.useContext(qi);return nn(t,hP(e)),t}function gP(e,{target:t,replace:n,unstable_mask:s,state:o,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let h=_t(),g=Qn(),y=Uc(e,{relative:l});return f.useCallback(b=>{if(KA(b,t)){b.preventDefault();let C=n!==void 0?n:Sc(g)===Sc(y),w=()=>h(e,{replace:C,unstable_mask:s,state:o,preventScrollReset:i,relative:l,viewTransition:u,unstable_defaultShouldRevalidate:d});m?f.startTransition(()=>w()):w()}},[g,h,y,n,s,o,t,e,i,l,u,d,m])}function is(e){es(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(Ng(e)),n=f.useRef(!1),s=Qn(),o=f.useMemo(()=>qA(s.search,n.current?null:t.current),[s.search]),i=_t(),l=f.useCallback((u,d)=>{const m=Ng(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,i("?"+m,d)},[i,o]);return[o,l]}var xP=0,yP=()=>`__${String(++xP)}__`;function bP(){let{router:e}=rS("useSubmit"),{basename:t}=f.useContext(Ur),n=IA(),s=e.fetch,o=e.navigate;return f.useCallback(async(i,l={})=>{let{action:u,method:d,encType:m,formData:h,body:g}=JA(i,t);if(l.navigate===!1){let y=l.fetcherKey||yP();await s(y,n,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:h,body:g,formMethod:l.method||d,formEncType:l.encType||m,flushSync:l.flushSync})}else await o(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:h,body:g,formMethod:l.method||d,formEncType:l.encType||m,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[s,o,t,n])}function vP(e,{relative:t}={}){let{basename:n}=f.useContext(Ur),s=f.useContext(as);nn(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),i={...Uc(e||".",{relative:t})},l=Qn();if(e==null){i.search=l.search;let u=new URLSearchParams(i.search),d=u.getAll("index");if(d.some(h=>h==="")){u.delete("index"),d.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();i.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:ks([n,i.pathname])),Sc(i)}function wP(e,{relative:t}={}){let n=f.useContext(qk);nn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=rS("useViewTransitionState"),o=Uc(e,{relative:t});if(!n.isTransitioning)return!1;let i=qs(n.currentLocation.pathname,s)||n.currentLocation.pathname,l=qs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return ef(o.pathname,l)!=null||ef(o.pathname,i)!=null}var Hs=Fk();const jP=$f(Hs);/**
|
|
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 kP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sS=(...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 SP={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 NP=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:l,...u},d)=>f.createElement("svg",{ref:d,...SP,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:sS("lucide",o),...u},[...l.map(([m,h])=>f.createElement(m,h)),...Array.isArray(i)?i:[i]]));/**
|
|
67
|
+
* @license lucide-react v0.460.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Ie=(e,t)=>{const n=f.forwardRef(({className:s,...o},i)=>f.createElement(NP,{ref:i,iconNode:t,className:sS(`lucide-${kP(e)}`,s),...o}));return n.displayName=`${e}`,n};/**
|
|
72
|
+
* @license lucide-react v0.460.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const Of=Ie("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 tf=Ie("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 _f=Ie("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 nf=Ie("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 Mf=Ie("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 oS=Ie("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 rf=Ie("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 CP=Ie("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
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 EP=Ie("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"}]]);/**
|
|
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 aS=Ie("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"}]]);/**
|
|
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 Ff=Ie("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"}]]);/**
|
|
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 TP=Ie("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"}]]);/**
|
|
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 iS=Ie("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
|
|
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 Tr=Ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
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 fr=Ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
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 RP=Ie("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
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 lS=Ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
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 cS=Ie("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
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 sf=Ie("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"}]]);/**
|
|
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 Rx=Ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
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 Cg=Ie("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
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 AP=Ie("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
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 PP=Ie("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
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 DP=Ie("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
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 $P=Ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
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 LP=Ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
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 IP=Ie("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
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 Wc=Ie("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"}]]);/**
|
|
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=Ie("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"}]]);/**
|
|
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 uS=Ie("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"}]]);/**
|
|
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 of=Ie("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"}]]);/**
|
|
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 _P=Ie("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"}]]);/**
|
|
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 MP=Ie("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"}]]);/**
|
|
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 Gi=Ie("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"}]]);/**
|
|
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 Kw=Ie("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"}]]);/**
|
|
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 FP=Ie("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"}]]);/**
|
|
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 zP=Ie("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"}]]);/**
|
|
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 dS=Ie("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"}]]);/**
|
|
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 Ax=Ie("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"}]]);/**
|
|
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 BP=Ie("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"}]]);/**
|
|
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 Px=Ie("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"}]]);/**
|
|
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 UP=Ie("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"}]]);/**
|
|
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 Yi=Ie("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"}]]);/**
|
|
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 WP=Ie("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"}]]);/**
|
|
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 HP=Ie("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
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 Dx=Ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 Eg=Ie("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"}]]);/**
|
|
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 fS=Ie("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"}]]);/**
|
|
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 VP=Ie("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"}]]);/**
|
|
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 KP=Ie("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"}]]);/**
|
|
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 qP=Ie("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"}]]);/**
|
|
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 GP=Ie("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"}]]);/**
|
|
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 YP=Ie("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
|
|
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 $x=Ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 JP=Ie("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
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 QP=Ie("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"}]]);/**
|
|
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 Lx=Ie("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"}]]);/**
|
|
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 XP=Ie("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"}]]);/**
|
|
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 Sh=Ie("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"}]]);/**
|
|
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 pS=Ie("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"}]]);/**
|
|
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 Ji=Ie("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"}]]);/**
|
|
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 ZP=Ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 jt=Ie("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 mS=Ie("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"}]]);/**
|
|
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 e3=Ie("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"}]]);/**
|
|
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 t3=Ie("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
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 Cs=Ie("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"}]]);/**
|
|
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 zf=Ie("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"}]]);/**
|
|
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 n3=Ie("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"}]]);/**
|
|
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 Do=Ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
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 r3=Ie("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"}]]);/**
|
|
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 s3=Ie("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"}]]);/**
|
|
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 o3=Ie("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
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 a3=Ie("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"}]]);/**
|
|
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 i3=Ie("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"}]]);/**
|
|
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 Fr=Ie("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"}]]);/**
|
|
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 qw=Ie("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"}]]);/**
|
|
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 Gw=Ie("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
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 Ix=Ie("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
467
|
+
* @license lucide-react v0.460.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const l3=Ie("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"}]]);/**
|
|
472
|
+
* @license lucide-react v0.460.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const hS=Ie("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"}]]);/**
|
|
477
|
+
* @license lucide-react v0.460.0 - ISC
|
|
478
|
+
*
|
|
479
|
+
* This source code is licensed under the ISC license.
|
|
480
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
481
|
+
*/const Si=Ie("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
482
|
+
* @license lucide-react v0.460.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const yn=Ie("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"}]]);/**
|
|
487
|
+
* @license lucide-react v0.460.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const Ox=Ie("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"}]]);/**
|
|
492
|
+
* @license lucide-react v0.460.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const c3=Ie("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"}]]);/**
|
|
497
|
+
* @license lucide-react v0.460.0 - ISC
|
|
498
|
+
*
|
|
499
|
+
* This source code is licensed under the ISC license.
|
|
500
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
501
|
+
*/const u3=Ie("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"}]]);/**
|
|
502
|
+
* @license lucide-react v0.460.0 - ISC
|
|
503
|
+
*
|
|
504
|
+
* This source code is licensed under the ISC license.
|
|
505
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
506
|
+
*/const d3=Ie("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
507
|
+
* @license lucide-react v0.460.0 - ISC
|
|
508
|
+
*
|
|
509
|
+
* This source code is licensed under the ISC license.
|
|
510
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
511
|
+
*/const Hc=Ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function gS(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=gS(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function f3(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=gS(e))&&(s&&(s+=" "),s+=t);return s}const _x="-",p3=e=>{const t=h3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const u=l.split(_x);return u[0]===""&&u.length!==1&&u.shift(),xS(u,t)||m3(l)},getConflictingClassGroupIds:(l,u)=>{const d=n[l]||[];return u&&s[l]?[...d,...s[l]]:d}}},xS=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?xS(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(_x);return(l=t.validators.find(({validator:u})=>u(i)))==null?void 0:l.classGroupId},Yw=/^\[(.+)\]$/,m3=e=>{if(Yw.test(e)){const t=Yw.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},h3=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return x3(Object.entries(e.classGroups),n).forEach(([i,l])=>{Tg(l,s,i,t)}),s},Tg=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Jw(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(g3(o)){Tg(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,l])=>{Tg(l,Jw(t,i),n,s)})})},Jw=(e,t)=>{let n=e;return t.split(_x).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},g3=e=>e.isThemeGetter,x3=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([l,u])=>[t+l,u])):i);return[n,o]}):e,y3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,l)=>{n.set(i,l),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let l=n.get(i);if(l!==void 0)return l;if((l=s.get(i))!==void 0)return o(i,l),l},set(i,l){n.has(i)?n.set(i,l):o(i,l)}}},yS="!",b3=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,l=u=>{const d=[];let m=0,h=0,g;for(let v=0;v<u.length;v++){let k=u[v];if(m===0){if(k===o&&(s||u.slice(v,v+i)===t)){d.push(u.slice(h,v)),h=v+i;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=d.length===0?u:u.substring(h),b=y.startsWith(yS),C=b?y.substring(1):y,w=g&&g>h?g-h:void 0;return{modifiers:d,hasImportantModifier:b,baseClassName:C,maybePostfixModifierPosition:w}};return n?u=>n({className:u,parseClassName:l}):l},v3=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},w3=e=>({cache:y3(e.cacheSize),parseClassName:b3(e),...p3(e)}),j3=/\s+/,k3=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],l=e.trim().split(j3);let u="";for(let d=l.length-1;d>=0;d-=1){const m=l[d],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let C=!!b,w=s(C?y.substring(0,b):y);if(!w){if(!C){u=m+(u.length>0?" "+u:u);continue}if(w=s(y),!w){u=m+(u.length>0?" "+u:u);continue}C=!1}const v=v3(h).join(":"),k=g?v+yS:v,E=k+w;if(i.includes(E))continue;i.push(E);const S=o(w,C);for(let T=0;T<S.length;++T){const I=S[T];i.push(k+I)}u=m+(u.length>0?" "+u:u)}return u};function S3(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=bS(t))&&(s&&(s+=" "),s+=n);return s}const bS=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=bS(e[s]))&&(n&&(n+=" "),n+=t);return n};function N3(e,...t){let n,s,o,i=l;function l(d){const m=t.reduce((h,g)=>g(h),e());return n=w3(m),s=n.cache.get,o=n.cache.set,i=u,u(d)}function u(d){const m=s(d);if(m)return m;const h=k3(d,n);return o(d,h),h}return function(){return i(S3.apply(null,arguments))}}const Ht=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},vS=/^\[(?:([a-z-]+):)?(.+)\]$/i,C3=/^\d+\/\d+$/,E3=new Set(["px","full","screen"]),T3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,R3=/\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$/,A3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,D3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Us=e=>Ni(e)||E3.has(e)||C3.test(e),go=e=>Qi(e,"length",z3),Ni=e=>!!e&&!Number.isNaN(Number(e)),Nh=e=>Qi(e,"number",Ni),Gl=e=>!!e&&Number.isInteger(Number(e)),$3=e=>e.endsWith("%")&&Ni(e.slice(0,-1)),dt=e=>vS.test(e),xo=e=>T3.test(e),L3=new Set(["length","size","percentage"]),I3=e=>Qi(e,L3,wS),O3=e=>Qi(e,"position",wS),_3=new Set(["image","url"]),M3=e=>Qi(e,_3,U3),F3=e=>Qi(e,"",B3),Yl=()=>!0,Qi=(e,t,n)=>{const s=vS.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},z3=e=>R3.test(e)&&!A3.test(e),wS=()=>!1,B3=e=>P3.test(e),U3=e=>D3.test(e),W3=()=>{const e=Ht("colors"),t=Ht("spacing"),n=Ht("blur"),s=Ht("brightness"),o=Ht("borderColor"),i=Ht("borderRadius"),l=Ht("borderSpacing"),u=Ht("borderWidth"),d=Ht("contrast"),m=Ht("grayscale"),h=Ht("hueRotate"),g=Ht("invert"),y=Ht("gap"),b=Ht("gradientColorStops"),C=Ht("gradientColorStopPositions"),w=Ht("inset"),v=Ht("margin"),k=Ht("opacity"),E=Ht("padding"),S=Ht("saturate"),T=Ht("scale"),I=Ht("sepia"),R=Ht("skew"),P=Ht("space"),$=Ht("translate"),L=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",dt,t],z=()=>[dt,t],V=()=>["",Us,go],O=()=>["auto",Ni,dt],B=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],q=()=>["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"],G=()=>["","0",dt],D=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[Ni,dt];return{cacheSize:500,separator:":",theme:{colors:[Yl],spacing:[Us,go],blur:["none","",xo,dt],brightness:H(),borderColor:[e],borderRadius:["none","","full",xo,dt],borderSpacing:z(),borderWidth:V(),contrast:H(),grayscale:G(),hueRotate:H(),invert:G(),gap:z(),gradientColorStops:[e],gradientColorStopPositions:[$3,go],inset:A(),margin:A(),opacity:H(),padding:z(),saturate:H(),scale:H(),sepia:G(),skew:H(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[xo]}],"break-after":[{"break-after":D()}],"break-before":[{"break-before":D()}],"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:[...B(),dt]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Gl,dt]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Gl,dt]}],"grid-cols":[{"grid-cols":[Yl]}],"col-start-end":[{col:["auto",{span:["full",Gl,dt]},dt]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[Yl]}],"row-start-end":[{row:["auto",{span:[Gl,dt]},dt]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dt]}],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:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dt,t]}],"min-w":[{"min-w":[dt,t,"min","max","fit"]}],"max-w":[{"max-w":[dt,t,"none","full","min","max","fit","prose",{screen:[xo]},xo]}],h:[{h:[dt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",xo,go]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Nh]}],"font-family":[{font:[Yl]}],"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",dt]}],"line-clamp":[{"line-clamp":["none",Ni,Nh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Us,dt]}],"list-image":[{"list-image":["none",dt]}],"list-style-type":[{list:["none","disc","decimal",dt]}],"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:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Us,go]}],"underline-offset":[{"underline-offset":["auto",Us,dt]}],"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:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dt]}],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",dt]}],"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:[...B(),O3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",I3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...K(),"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:K()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[Us,dt]}],"outline-w":[{outline:[Us,go]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Us,go]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",xo,F3]}],"shadow-color":[{shadow:[Yl]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",xo,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[S]}],sepia:[{sepia:[I]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[I]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",dt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Gl,dt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",dt]}],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",dt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"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",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Us,go,Nh]}],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"]}}},H3=N3(W3);function be(...e){return H3(f3(e))}function Mn(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 Br(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 jS(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function kS(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 SS(e){if(!e)return"—";const t=new Date(e);if(Number.isNaN(t.getTime()))return e;const n=Math.floor((Date.now()-t.getTime())/1e3);if(n<60)return"just now";const s=Math.floor(n/60);if(s<60)return`${s}m ago`;const o=Math.floor(s/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Mi(e){return e.toLocaleString("en-US")}function Fi(e){return`$${e.toFixed(4)}`}function V3(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,s,o]=t,i=new Date(Number(n),Number(s)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function kn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function NS(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function K3(e){let t=NS(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":t.startsWith("/workflow")?"/workflow":null}function CS(e,t){return K3(e)===t}function ES(e){let n=NS(e).split("/").filter(Boolean);const s=[];let o="Overview",i=null,l="";if(n[0]==="w"&&n[1]&&(l=`/w/${n[1]}`,s.push({label:kn(n[1]),path:`${l}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:s,projectSlug:i};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${l}/projects`}),o="Projects",n[1]&&(i=n[1],s.push({label:kn(n[1]),path:`${l}/projects/${n[1]}`}),o=kn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:kn(n[3]),path:`${l}/projects/${n[1]}/assignments/${n[3]}`}),o=kn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",d=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:d}),s.push({label:kn(n[3]),path:`${l}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=kn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",s.push({label:"Servers",path:`${l}/servers`})):n[0]==="inventories"?(o="Inventories",s.push({label:"Inventories",path:`${l}/inventories`})):n[0]==="usage"?(o="Usage",s.push({label:"Usage",path:`${l}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",s.push({label:"Agent Sessions",path:`${l}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",s.push({label:"Assignments",path:`${l}/assignments`})):n[0]==="archive"?(o="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:kn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(s.push({label:kn(n[1]),path:`/playbooks/${n[1]}`}),o=kn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",s.push({label:"Todos",path:`${l}/todos`})):n[0]==="views"?(o="Saved Views",s.push({label:"Saved Views",path:`${l}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",s.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",s.push({label:"Create Project",path:`${l}/create/project`}));return{title:o,breadcrumbs:s,projectSlug:i}}function Qw({items:e,onNavigate:t}){const n=Qn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const o=s.icon,i=CS(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Te,{to:s.to,onClick:t,className:be("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",i?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[r.jsx(o,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const TS=[{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)"}}],q3=TS.map(e=>e.slug),af="default";function RS(e){return typeof e=="string"&&q3.includes(e)}const AS={preset:af,custom:!1};let ic=null,ni=null;function Mx(e){if(!e||typeof e!="object")return AS;const t=e;return{preset:RS(t.preset)?t.preset:af,custom:t.custom===!0}}function G3(){return ic?Promise.resolve(ic):ni||(ni=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Mx(e);return ic=t,ni=null,t}).catch(()=>(ni=null,AS)),ni)}async function Y3(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=Mx(await t.json());return ic=n,n}async function J3(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Mx(await e.json());return ic=t,t}const Rg="syntaur-theme",_d="syntaur-preset",PS=f.createContext(null);function Ag(){try{const e=window.localStorage.getItem(Rg);return e==="light"||e==="dark"?e:null}catch{return null}}function DS(){try{const e=window.localStorage.getItem(_d);return RS(e)?e:af}catch{return af}}function $S(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function LS(e){document.documentElement.classList.toggle("dark",e==="dark")}function IS(e){document.documentElement.dataset.theme=e}function Q3(){typeof document>"u"||(LS(Ag()??$S()),IS(DS()))}function X3({children:e}){const[t,n]=f.useState(()=>Ag()),[s,o]=f.useState(()=>Ag()??$S()),[i,l]=f.useState(()=>DS());f.useEffect(()=>{LS(s)},[s]),f.useEffect(()=>{IS(i)},[i]),f.useEffect(()=>{let h=!1;return G3().then(g=>{if(!h&&g.preset!==i){l(g.preset);try{window.localStorage.setItem(_d,g.preset)}catch{}}}),()=>{h=!0}},[]),f.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{t||o(h.matches?"dark":"light")};return g(),h.addEventListener("change",g),()=>{h.removeEventListener("change",g)}},[t]);async function u(h){l(h);try{window.localStorage.setItem(_d,h)}catch{}await Y3(h)}async function d(){const h=await J3();l(h.preset);try{window.localStorage.setItem(_d,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(Rg,h),n(h),o(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(Rg,h),n(h),o(h)},preset:i,setPreset:u,resetPreset:d};return r.jsx(PS.Provider,{value:m,children:e})}function Fx(){const e=f.useContext(PS);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Md=new Set;let lr=null,Ci=null;function Z3(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function OS(){lr&&(lr.readyState===WebSocket.OPEN||lr.readyState===WebSocket.CONNECTING)||(lr=new WebSocket(Z3()),lr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Md)n(t)}catch{}},lr.onclose=()=>{lr=null,Ci&&clearTimeout(Ci),Ci=setTimeout(OS,2e3)},lr.onerror=()=>{lr==null||lr.close()})}function Xi(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Md.add(n),OS(),()=>{Md.delete(n),Md.size===0&&lr&&(Ci&&clearTimeout(Ci),Ci=null,lr.close(),lr=null)}},[])}const Bf=["7d","30d","90d","all","custom"],_S="30d",eD=/^\d{4}-\d{2}-\d{2}$/,Vc=["project","workspace","model","tool"],tD={"7d":7,"30d":30,"90d":90};function lc(e){if(typeof e!="string"||!eD.test(e))return!1;const[t,n,s]=e.split("-").map(Number);if(n<1||n>12||s<1||s>31)return!1;const o=new Date(Date.UTC(t,n-1,s));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===s}function Xw(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${s}`}function nD(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function rD(e,t=new Date){const n=e.window??_S;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const s=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:Xw(nD(s,-(tD[n]-1))),until:Xw(s)}}function sD(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!Bf.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const s of["since","until"])n[s]!==void 0&&!lc(n[s])&&t.push(`invalid ${s}: ${String(n[s])} (expected YYYY-MM-DD)`);for(const s of Vc)n[s]!==void 0&&(typeof n[s]!="string"||n[s].length===0)&&t.push(`invalid ${s}: must be a non-empty string`);return lc(n.since)&&lc(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Kc(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Bf.includes(n.window)&&(t.window=n.window),lc(n.since)&&(t.since=n.since),lc(n.until)&&(t.until=n.until);for(const s of Vc)typeof n[s]=="string"&&n[s].length>0&&(t[s]=n[s]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function Pg(e){const t=Kc(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const s of Vc)t[s]&&n.set(s,t[s]);return n}function oD(e){const t={};for(const n of["window","since","until",...Vc]){const s=e.get(n);s!==null&&(t[n]=s)}return Kc(t)}function MS(e,t=new Date){const n=Kc(e),{since:s,until:o}=rD(n,t),i=new URLSearchParams;s&&i.set("since",s),o&&i.set("until",o);for(const l of Vc)n[l]&&i.set(l,n[l]);return i}const aD={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function Zw(e){const t=Kc(e),n=t.window??_S,s=[];return s.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:aD[n]),t.workspace&&s.push(`workspace: ${t.workspace}`),t.project&&s.push(`project: ${t.project}`),t.model&&s.push(`model: ${t.model}`),t.tool&&s.push(`tool: ${t.tool}`),s.join(" · ")}function qt(e,t,n=!0,s=!1){const[o,i]=f.useState(null),[l,u]=f.useState(!0),[d,m]=f.useState(null),[h,g]=f.useState(0),y=n?e:null,b=f.useCallback(()=>{g(w=>w+1)},[]),C=f.useRef(y);return s&&C.current!==y&&(C.current=y,i(null),m(null)),f.useEffect(()=>{if(!y){u(!1),i(null);return}let w=!1;return u(!0),m(null),fetch(y).then(async v=>{if(!v.ok){const k=await v.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{w||(i(v),u(!1))}).catch(v=>{w||(m(v.message),u(!1))}),()=>{w=!0}},[y,h]),Xi(w=>{!t||!y||((w.type==="project-updated"||w.type==="assignment-updated")&&b(),w.type==="servers-updated"&&t==="servers"&&b(),w.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&b(),w.type==="playbooks-updated"&&t==="playbooks"&&b(),w.type==="leases-updated"&&t==="inventories"&&b())}),{data:o,loading:l,error:d,refetch:b}}function Ts(e=!0){return qt("/api/projects","projects",e)}function ba(){return qt("/api/workspaces","projects")}function un(){const{workspace:e}=Mt();return e?`/w/${e}`:""}function iD(e={}){const t=new URLSearchParams;typeof e.staleLimit=="number"&&Number.isFinite(e.staleLimit)&&t.set("staleLimit",String(e.staleLimit)),typeof e.staleOffset=="number"&&Number.isFinite(e.staleOffset)&&t.set("staleOffset",String(e.staleOffset));const n=t.toString(),s=n?`/api/overview?${n}`:"/api/overview";return qt(s,"overview")}function Uf(e=!0){return qt("/api/assignments","assignments",e)}function lD(e=!0){return qt("/api/archived","assignments",e)}function FS(){return qt("/api/help")}function zS(e){const t=e?`/api/projects/${e}`:null;return qt(t,"project")}function cD(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return qt(n,"assignment")}function uD(e){const t=e?`/api/assignments/${e}`:null;return qt(t,"assignment")}function BS(e){return qt(e)}function zx(e=!0){return qt("/api/servers","servers",e)}function US(){return qt("/api/leases","inventories")}function Wf(){return qt("/api/agent-sessions","agent-sessions")}function dD(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return qt(n,"agent-sessions")}function fD(e){const t=e?`/api/assignments/${e}/sessions`:null;return qt(t,"agent-sessions")}function pD(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return qt(n,void 0,!0,!0)}function mD(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return qt(t,void 0,!0,!0)}function Bx(e=!0){return qt("/api/playbooks","playbooks",e)}function hD(e){const t=MS(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return qt(n,void 0,!0,!0)}function WS(e=!0){return qt("/api/usage/facets",void 0,e)}function gD(e){const t=e?`/api/playbooks/${e}`:null;return qt(t,"playbooks")}function xD(){return qt("/api/memories","project")}function yD(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return qt(n,"project")}function bD(){return qt("/api/resources","project")}function vD(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return qt(n,"project")}const Hf=["new-workspace","new-project","new-todo","new-assignment"];function wD(e){return typeof e=="string"&&Hf.includes(e)}const jD=["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","[","]"],kD=["mod","ctrl","alt","shift"];function ur(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(ur).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(u=>u.toLowerCase()),i=new Set,l=[];for(const u of kD)o.includes(u)&&!i.has(u)&&(l.push(u),i.add(u));for(const u of o)i.has(u)||(l.push(u),i.add(u));return[...l,s].join("+")}function SD(e){const t=ur(e);return t?jD.includes(t):!1}const ND={"new-workspace":ur("Mod+Shift+Alt+w"),"new-project":ur("Mod+Shift+Alt+p"),"new-todo":ur("Mod+Shift+Alt+t"),"new-assignment":ur("Mod+Shift+Alt+a")};function CD(e){const t={...ND};for(const n of Hf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function aa(){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 ED(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",s=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:s.has("mod"),shift:s.has("shift"),alt:s.has("alt"),ctrl:s.has("ctrl")}}function gd(e,t){const n=ED(t);if(e.key.toLowerCase()!==n.key)return!1;const o=aa()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function HS(e){const t=[],n=aa()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let o;s===" "||s==="Spacebar"?o="space":(s.length,o=s.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const l=[...t,o].join("+");return ur(l)}function Ss(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?aa()?"⌘":"Ctrl":s==="shift"?aa()?"⇧":"Shift":s==="alt"?aa()?"⌥":"Alt":s==="ctrl"?aa()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(aa()?"":"+")}function TD(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,l]=f.useState(null),u=f.useCallback(async()=>{try{const d=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),l(null)}catch(d){l(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Xi(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function VS(e=!0){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,l]=f.useState(null),u=f.useCallback(async()=>{try{const d=await fetch("/api/todos");if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),l(null)}catch(d){l(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[]);return f.useEffect(()=>{if(!e){o(!1);return}u()},[u,e]),Xi(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}async function Ux(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 KS(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 qS(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 GS(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 YS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function JS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function QS(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 Wx(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function XS(e,t,n){for(const s of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function ZS(e,t,n){const s=await fetch(Wx(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Hx(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,l=new Error(i);throw l.status=n.status,l}return n.json().catch(()=>({}))}async function RD(e,t){return await Hx(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function AD(e){return await Hx("/api/todos/promote-bulk",e)}async function PD(e,t,n){await Hx(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const Vf=["assignment","project","todo","server","playbook"],fa={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},e1=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],Dg="all",t1=/^[a-z][a-z0-9]*$/;function Vx(e){return typeof e=="string"&&Vf.includes(e)}function DD(e){return e==="all"||Vx(e)}function $D(e){if(!e||typeof e!="object")return ID();const t=e,n=DD(t.defaultScope)?t.defaultScope:fa.defaultScope,s=typeof t.externalIds=="boolean"?t.externalIds:fa.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,l]of Object.entries(t.aliases))t1.test(i)&&i!==Dg&&!e1.includes(i)&&Vx(l)&&(o[i]=l)}else o={...fa.aliases};return{defaultScope:n,aliases:o,externalIds:s}}function LD(e){if(!e||typeof e!="object")return{ok:!1,errors:["aliases must be an object"]};const t=[];for(const[n,s]of Object.entries(e))t1.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===Dg&&t.push(`alias key "${Dg}" is reserved (the "search everything" escape)`),e1.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),Vx(s)||t.push(`alias "${n}" must map to one of: ${Vf.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function ID(){return{defaultScope:fa.defaultScope,aliases:{...fa.aliases},externalIds:fa.externalIds}}const Kx={search:fa,custom:!1};let yi=null,ri=null,lf=0;const $g=new Set;function n1(e){yi=e;for(const t of $g)t(e)}function qx(e){if(!e||typeof e!="object")return Kx;const t=e;return{search:$D(t.search),custom:t.custom===!0}}function OD(){if(yi)return Promise.resolve(yi);if(ri)return ri;const e=++lf;return ri=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ri=null;const n=qx(t);return e!==lf?yi??n:(yi=n,n)}).catch(()=>(ri=null,Kx)),ri}function Gx(){const[e,t]=f.useState(()=>yi??Kx);return f.useEffect(()=>{let n=!1;return OD().then(s=>{n||t(s)}),$g.add(t),()=>{n=!0,$g.delete(t)}},[]),e}async function _D(e){var s;++lf;const t=await fetch("/api/config/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>null);throw new Error(((s=o==null?void 0:o.errors)==null?void 0:s.join("; "))??(o==null?void 0:o.error)??`HTTP ${t.status}`)}const n=qx(await t.json());return n1(n),n}async function MD(){++lf;const e=await fetch("/api/config/search",{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=qx(await e.json());return n1(t),t}const FD=new Set(["/projects","/assignments","/servers","/todos"]);function Fd(e,t){return FD.has(e)?`${t}${e}`:e}const zD=[{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-workflow",title:"Workflow",basePath:"/workflow",keywords:["statuses","transitions","derive","facts"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function BD(e){if(!(e!=null&&e.length))return[];const t=[];for(const n of e)n.id&&(t.push(n.id),n.system&&t.push(`${n.system}:${n.id}`));return t}function UD(e){const t=[],n=e.externalIds!==!1,s=i=>n?BD(i):[],o=i=>n?i:void 0;for(const i of zD)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Fd(i.basePath,e.wsPrefix)});for(const i of e.projects??[]){const l=i.workspace?`/w/${i.workspace}`:"";t.push({type:"project",id:`project-${i.slug}`,title:i.title,subtitle:i.slug,keywords:[...i.tags??[],...s(i.externalIds)],route:`${l}/projects/${i.slug}`,tags:i.tags,project:i.slug,externalIds:o(i.externalIds)}),t.push({type:"todo",id:`project-todos-${i.slug}`,title:`${i.title} todos`,subtitle:`${i.slug} · project`,keywords:[...i.tags??[],"project","todos"],route:`${l}/projects/${i.slug}?tab=todos`})}for(const i of e.assignments??[]){const l=i.projectWorkspace?`/w/${i.projectWorkspace}`:"";t.push({type:"assignment",id:i.projectSlug===null?`assignment-standalone-${i.id}`:`assignment-${i.projectSlug}-${i.slug}`,title:i.title,subtitle:`${i.projectTitle} · ${i.status}`,keywords:[i.projectSlug??"standalone",i.assignee??"",...s(i.externalIds)].filter(u=>!!u),route:i.projectSlug===null?`/assignments/${i.id}`:`${l}/projects/${i.projectSlug}/assignments/${i.slug}`,status:i.status,tags:i.tags,assignee:i.assignee,assignmentType:i.type,project:i.projectSlug,externalIds:o(i.externalIds)})}for(const i of e.playbooks??[])t.push({type:"playbook",id:`playbook-${i.slug}`,title:i.name,subtitle:i.description,keywords:i.tags,route:`/playbooks/${i.slug}`,tags:i.tags});for(const i of e.servers??[])t.push({type:"server",id:`server-${i.name}`,title:i.name,subtitle:i.alive?"alive":"dead",route:`${Fd("/servers",e.wsPrefix)}#server-${encodeURIComponent(i.name)}`});for(const i of e.todos??[]){const l=i.workspace&&i.workspace!=="_ungrouped"?`/w/${i.workspace}`:e.wsPrefix,u=Fd("/todos",l);t.push({type:"todo",id:`todo-${i.id}`,title:i.description,subtitle:i.status,keywords:i.tags,route:`${u}?focus=${encodeURIComponent(i.id)}`,status:i.status,tags:i.tags})}return t}function vr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function zd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function WD(e,t,n){const s=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${s}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${s} playbook`)}n()}async function Ch(e,t){const n=await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t})});if(!n.ok){const s=await n.json().catch(()=>({}));throw new Error(s.error||`Failed to create todo (HTTP ${n.status})`)}}async function ej(){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 tj(){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 Eh(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 Zo(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
|
|
512
|
+
${t}: ${JSON.stringify(n)}
|
|
513
|
+
---
|
|
514
|
+
${e}`;const o=s[1],i=s[2],l=s[3],u=e.slice(s[0].length),d=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(i)?h=i.replace(m,`${t}: ${d}`):h=`${i}
|
|
515
|
+
${t}: ${d}`,`${o}${h}${l}${u}`}const HD=/^[a-z0-9][a-z0-9-]*$/;function VD(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:l,navigate:u,toggleTheme:d}=e,m=[];if(m.push({id:"new-workspace",title:"New Workspace",subtitle:"Create a Syntaur workspace",group:"Create",keywords:["new","create","workspace"],bindableKind:"new-workspace",flow:{steps:[{kind:"text",id:"name",label:"Workspace name",placeholder:"lowercase, hyphenated (e.g. acme-app)",required:!0,pattern:{regex:HD,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,g)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!b.ok){const C=await b.json().catch(()=>({}));throw new Error(C.error||`Failed to create workspace (HTTP ${b.status})`)}g.navigate(`/w/${y}/projects`)}}}),m.push({id:"new-project",title:"New Project",subtitle:"Create a project (pick workspace)",group:"Create",keywords:["new","create","project"],bindableKind:"new-project",flow:{steps:[{kind:"picker",id:"workspace",label:"Workspace",emptyMessage:'No workspaces yet — create one with "New Workspace"',loadOptions:async()=>{const{workspaces:h,hasUngrouped:g}=await ej(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,g)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=vr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");let w=await Eh("/api/templates/project");w=Zo(w,"slug",C),w=Zo(w,"title",b),y&&y!=="_ungrouped"&&(w=Zo(w,"workspace",y));const v=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create project (HTTP ${v.status})`);const E=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??C}`:`/projects/${k.slug??C}`;g.navigate(E)}}}),m.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:h},g]=await Promise.all([ej(),tj()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});for(const b of g){const C=b.workspace??"_ungrouped";y.push({value:C,label:`${b.title}`,hint:`project · ${b.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const g=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await Ux(g,y)}}}),m.push({id:"new-assignment",title:"New Assignment",subtitle:"Pick standalone or a project",group:"Create",keywords:["new","create","assignment"],bindableKind:"new-assignment",flow:{steps:[{kind:"picker",id:"project",label:"Project",loadOptions:async()=>{const h=await tj(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var S;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=vr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await Eh("/api/templates/assignment?standalone=1");T=Zo(T,"slug",C),T=Zo(T,"title",b);const I=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await I.json().catch(()=>({}));if(!I.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${I.status})`);const P=((S=R==null?void 0:R.assignment)==null?void 0:S.id)??(R==null?void 0:R.id);P?g.navigate(`/assignments/${P}`):g.navigate("/assignments");return}let w=await Eh("/api/templates/assignment");w=Zo(w,"slug",C),w=Zo(w,"title",b);const v=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${v.status})`);const E=k.slug??C;g.navigate(`/projects/${y}/assignments/${E}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>u(`${i}/create/project`)}),m.push({id:"create-standalone-assignment",title:"New Standalone Assignment (editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","assignment","standalone","one-off","editor"],run:()=>u(`${i}/assignments/new`)}),n&&m.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${s??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>u(`${i}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>u("/playbooks/create")}),m.push({id:"create-todo-global",title:"New Todo (global, quick)",subtitle:"Ungrouped, single-step",group:"Create",keywords:["new","create","todo","global","ungrouped","quick"],requiresInput:{placeholder:"Describe the todo…",runWithInput:async h=>{const g=h.trim();g&&await Ch("_ungrouped",g)}}}),i){const h=i.replace(/^\/w\//,"");m.push({id:`create-todo-workspace-${h}`,title:`New Todo in workspace ${h}`,subtitle:h,group:"Create",keywords:["new","create","todo","workspace",h],requiresInput:{placeholder:`Describe the todo for workspace ${h}…`,runWithInput:async g=>{const y=g.trim();y&&await Ch(h,y)}}})}n&&o&&m.push({id:`create-todo-project-${n}`,title:`New Todo in project ${s??n}`,subtitle:`${n} · workspace ${o}`,group:"Create",keywords:["new","create","todo","project",n,o],requiresInput:{placeholder:`Describe the todo for project ${s??n}…`,runWithInput:async h=>{const g=h.trim();g&&await Ch(o,g)}}});for(const h of t)m.push({id:`toggle-playbook-${h.slug}`,title:`Toggle Playbook: ${h.name}`,subtitle:h.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",h.slug,...h.tags??[]],run:()=>WD(h.slug,h.enabled,l)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>d()}),m}const KD=["low","medium","high","critical"],Kf={status:{kind:"enum"},priority:{kind:"ordinal",order:KD},type:{kind:"enum"},assignee:{kind:"string",noneSentinel:!0},project:{kind:"string",noneSentinel:!0},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},archived:{kind:"bool"},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title},created:{kind:"timestamp"},updated:{kind:"timestamp"},completedat:{kind:"timestamp",get:e=>e.completedAt},statusage:{kind:"duration",get:e=>e.statusAge},phase:{kind:"enum"},disposition:{kind:"enum"},phaseage:{kind:"duration",get:e=>e.phaseAge},hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},progressstaledays:{kind:"duration",get:e=>e.progressStaleDays},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function qD(e,t){return e[t.toLowerCase()]??null}function wr(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class jr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function r1(e){const[t,n,s]=e.split("-").map(l=>parseInt(l,10)),o=new Date(t,n-1,s).getTime(),i=new Date(t,n-1,s+1).getTime();return[o,i]}function Lg(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.length>0){const t=Date.parse(e);return Number.isNaN(t)?null:t}return null}function cc(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:null}return null}function Th(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function GD(e){return e==null||e===""}function Bd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>GD(wr(e,t,o)):o=>Th(wr(e,t,o),n.raw);case"substring":return o=>{const i=wr(e,t,o);return typeof i=="string"&&i.toLowerCase().includes(n.raw.toLowerCase())};case"bool":{const o=n.raw.toLowerCase();if(o!=="true"&&o!=="false")throw new jr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return l=>{const u=wr(e,t,l),d=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return d!==null&&d===i}}case"number":{const o=n.num??cc(n.raw);if(o===null)throw new jr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>cc(wr(e,t,i))===o}case"ordinal":return o=>Th(wr(e,t,o),n.raw);case"list":return o=>{const i=wr(e,t,o);return Array.isArray(i)&&i.some(l=>Th(l,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=r1(n.raw);return l=>{const u=Lg(wr(e,t,l));return u!==null&&u>=o&&u<i}}throw new jr([{pos:n.pos,message:`Field "${t}" is a timestamp — use a comparison (e.g. ${t} > -36h) or an absolute date (${t}:2026-06-01)`}])}case"duration":throw new jr([{pos:s,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function YD(e,t,n,s){const o=(i,l)=>{switch(n){case"<":return i<l;case">":return i>l;case"<=":return i<=l;case">=":return i>=l;case"=":return i===l;case"!=":return i!==l;default:return!1}};switch(e.kind){case"number":{const i=s.num??cc(s.raw);if(i===null)throw new jr([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return l=>{const u=cc(wr(e,t,l));return u!==null&&o(u,i)}}case"ordinal":{const i=e.order??[],l=i.findIndex(u=>u.toLowerCase()===s.raw.toLowerCase());if(l<0)throw new jr([{pos:s.pos,message:`"${s.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return u=>{const d=wr(e,t,u),m=typeof d=="string"?i.findIndex(h=>h.toLowerCase()===d.toLowerCase()):-1;return m>=0&&o(m,l)}}case"timestamp":{if(s.type==="duration"){const l=(s.sign===0?-1:s.sign??-1)*(s.num??0);return(u,d)=>{const m=Lg(wr(e,t,u));return m!==null&&o(m,d.now+l)}}if(s.type==="date"){const[i,l]=r1(s.raw);return u=>{const d=Lg(wr(e,t,u));if(d===null)return!1;switch(n){case"<":return d<i;case"<=":return d<l;case">":return d>=l;case">=":return d>=i;case"=":return d>=i&&d<l;case"!=":return d<i||d>=l;default:return!1}}}throw new jr([{pos:s.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(s.type!=="duration")throw new jr([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=s.num??0;return l=>{const u=cc(wr(e,t,l));return u!==null&&o(u,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Bd(e,t,s,s.pos);if(n==="!="){const i=Bd(e,t,s,s.pos);return(l,u)=>!i(l,u)}throw new jr([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Bd(e,t,s,s.pos);return n==="="?i:(l,u)=>!i(l,u)}throw new jr([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function JD(e,t){const n=qD(t,e.field);if(!n)throw new jr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(o=>Bd(n,e.field,o,e.pos));return s.length===1?s[0]:(o,i)=>s.some(l=>l(o,i))}return YD(n,e.field,e.op,e.values[0])}function uc(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return JD(e,t);case"not":{const n=uc(e.child,t);return(s,o)=>!n(s,o)}case"and":{const n=e.children.map(s=>uc(s,t));return(s,o)=>n.every(i=>i(s,o))}case"or":{const n=e.children.map(s=>uc(s,t));return(s,o)=>n.some(i=>i(s,o))}}}class ia extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const QD={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},XD=/[A-Za-z_]/,ZD=/[A-Za-z0-9_-]/,e$=/^\d{4}-\d{2}-\d{2}/;function qf(e){const t=[];let n=0;const s=(o,i)=>{let l=n;for(;l<e.length&&/\d/.test(e[l]);)l++;const u=e.slice(n,l);let d="";for(;l<e.length&&/[a-z]/i.test(e[l]);)d+=e[l],l++;if(n=l,d.length>0){const m=QD[d.toLowerCase()];if(m===void 0)throw new ia(o,`Unknown duration unit "${d}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(o,l),pos:o,num:parseInt(u,10)*m,sign:i}}return i!==0?{type:"NUMBER",text:e.slice(o,l),pos:o,num:i*parseInt(u,10)}:{type:"NUMBER",text:u,pos:o,num:parseInt(u,10)}};for(;n<e.length;){const o=e[n],i=n;if(o===" "||o===" "||o===`
|
|
516
|
+
`||o==="\r"){n++;continue}if(o==="("){t.push({type:"LPAREN",text:o,pos:i}),n++;continue}if(o===")"){t.push({type:"RPAREN",text:o,pos:i}),n++;continue}if(o===","){t.push({type:"COMMA",text:o,pos:i}),n++;continue}if(o===":"){t.push({type:"COLON",text:o,pos:i}),n++;continue}if(o==="*"){t.push({type:"STAR",text:o,pos:i}),n++;continue}if(o==="<"||o===">"){e[n+1]==="="?(t.push({type:"OP",text:o+"=",pos:i}),n+=2):(t.push({type:"OP",text:o,pos:i}),n++);continue}if(o==="!"){if(e[n+1]==="="){t.push({type:"OP",text:"!=",pos:i}),n+=2;continue}throw new ia(i,'Unexpected "!" (did you mean "!="?)')}if(o==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:i});continue}if(o==='"'||o==="'"){const l=o;let u=n+1,d="";for(;u<e.length&&e[u]!==l;)e[u]==="\\"&&u+1<e.length?(d+=e[u+1],u+=2):(d+=e[u],u++);if(u>=e.length)throw new ia(i,"Unterminated string literal");t.push({type:"STRING",text:d,pos:i}),n=u+1;continue}if(o==="-"||o==="+"){if(/\d/.test(e[n+1]??"")){const l=o==="-"?-1:1;n++,t.push(s(i,l));continue}if(o==="-"){t.push({type:"MINUS",text:"-",pos:i}),n++;continue}throw new ia(i,'Unexpected "+"')}if(/\d/.test(o)){const l=e.slice(n).match(e$);if(l){t.push({type:"DATE",text:l[0],pos:i}),n+=l[0].length;continue}t.push(s(i,0));continue}if(XD.test(o)){let l=n+1;for(;l<e.length&&ZD.test(e[l]);)l++;const u=e.slice(n,l),d=u.toLowerCase();d==="and"?t.push({type:"AND",text:u,pos:i}):d==="or"?t.push({type:"OR",text:u,pos:i}):d==="not"?t.push({type:"NOT",text:u,pos:i}):t.push({type:"IDENT",text:u,pos:i}),n=l;continue}throw new ia(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class ta extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const t$=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),n$=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class r${constructor(t){hh(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const s=this.peek();if(s.type!==t)throw new ta(s.pos,`Expected ${n}, got "${s.text||s.type}"`);return this.next()}parseQuery(){if(this.peek().type==="EOF")return{kind:"all"};const t=this.orExpr(),n=this.peek();if(n.type!=="EOF")throw new ta(n.pos,`Unexpected "${n.text}" — unbalanced parentheses or stray token`);return t}orExpr(){const t=[this.andExpr()];for(;this.peek().type==="OR";)this.next(),t.push(this.andExpr());return t.length===1?t[0]:{kind:"or",children:t}}andExpr(){const t=[this.unary()];for(;;){const n=this.peek();if(n.type==="AND")this.next(),t.push(this.unary());else if(n$.has(n.type))t.push(this.unary());else break}return t.length===1?t[0]:{kind:"and",children:t}}unary(){const t=this.peek();if(t.type==="NOT")return this.next(),{kind:"not",child:this.unary()};if(t.type==="MINUS"){this.next();const n=this.peek();if(n.type!=="IDENT")throw new ta(n.pos,'Expected a field atom after "-" negation');return{kind:"not",child:this.atom()}}return this.primary()}primary(){const t=this.peek();if(t.type==="LPAREN"){this.next();const n=this.orExpr();return this.expect("RPAREN",'")"'),n}if(t.type==="STAR")return this.next(),{kind:"all"};if(t.type==="IDENT")return this.atom();throw new ta(t.pos,`Expected a field, "(", "*", or NOT — got "${t.text||"end of query"}"`)}atom(){const t=this.expect("IDENT","a field name"),n=this.peek();if(n.type==="COLON"){this.next();const s=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:s,pos:t.pos}}if(n.type==="OP"){this.next();const s=this.value();return{kind:"atom",field:t.text,op:n.text,values:[s],pos:t.pos}}throw new ta(n.pos,`Expected ":" or a comparison operator after field "${t.text}"`)}valueOrList(){if(this.peek().type==="LPAREN"){this.next();const t=[this.value()];for(;this.peek().type==="COMMA";)this.next(),t.push(this.value());return this.expect("RPAREN",'")" to close the value list'),t}return[this.value()]}value(){const t=this.peek();if(!t$.has(t.type))throw new ta(t.pos,`Expected a value, got "${t.text||t.type}"`);switch(this.next(),t.type){case"STRING":return{type:"string",raw:t.text,pos:t.pos};case"NUMBER":return{type:"number",raw:t.text,num:t.num,pos:t.pos};case"DATE":return{type:"date",raw:t.text,pos:t.pos};case"DURATION":return{type:"duration",raw:t.text,num:t.num,sign:t.sign??0,pos:t.pos};default:return{type:"word",raw:t.text,pos:t.pos}}}}function Gf(e){try{const t=qf(e);return{ast:new r$(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ia||t instanceof ta)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function zi(e,t=Kf){const n=Gf(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:uc(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof jr)return{query:null,errors:s.errors};throw s}}function Qt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function nj(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Yf(...e){return t=>{let n=!1;const s=e.map(o=>{const i=nj(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<s.length;o++){const i=s[o];typeof i=="function"?i():nj(e[o],null)}}}}function Vn(...e){return f.useCallback(Yf(...e),e)}function s$(e,t){const n=f.createContext(t),s=i=>{const{children:l,...u}=i,d=f.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:d,children:l})};s.displayName=e+"Provider";function o(i){const l=f.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function va(e,t=[]){let n=[];function s(i,l){const u=f.createContext(l),d=n.length;n=[...n,l];const m=g=>{var k;const{scope:y,children:b,...C}=g,w=((k=y==null?void 0:y[e])==null?void 0:k[d])||u,v=f.useMemo(()=>C,Object.values(C));return r.jsx(w.Provider,{value:v,children:b})};m.displayName=i+"Provider";function h(g,y){var w;const b=((w=y==null?void 0:y[e])==null?void 0:w[d])||u,C=f.useContext(b);if(C)return C;if(l!==void 0)return l;throw new Error(`\`${g}\` must be used within \`${i}\``)}return[m,h]}const o=()=>{const i=n.map(l=>f.createContext(l));return function(u){const d=(u==null?void 0:u[e])||i;return f.useMemo(()=>({[`__scope${e}`]:{...u,[e]:d}}),[u,d])}};return o.scopeName=e,[s,o$(o,...t)]}function o$(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const l=s.reduce((u,{useScope:d,scopeName:m})=>{const g=d(i)[`__scope${m}`];return{...u,...g}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var Co=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},a$=Mk[" useId ".trim().toString()]||(()=>{}),i$=0;function Ei(e){const[t,n]=f.useState(a$());return Co(()=>{n(s=>s??String(i$++))},[e]),e||(t?`radix-${t}`:"")}var l$=Mk[" useInsertionEffect ".trim().toString()]||Co;function Jf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,l]=c$({defaultProp:t,onChange:n}),u=e!==void 0,d=u?e:o;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const g=h.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,s])}const m=f.useCallback(h=>{var g;if(u){const y=u$(h)?h(e):h;y!==e&&((g=l.current)==null||g.call(l,y))}else i(h)},[u,e,i,l]);return[d,m]}function c$({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),o=f.useRef(n),i=f.useRef(t);return l$(()=>{i.current=t},[t]),f.useEffect(()=>{var l;o.current!==n&&((l=i.current)==null||l.call(i,n),o.current=n)},[n,o]),[n,s,i]}function u$(e){return typeof e=="function"}function d$(e){const t=f$(e),n=f.forwardRef((s,o)=>{const{children:i,...l}=s,u=f.Children.toArray(i),d=u.find(m$);if(d){const m=d.props.children,h=u.map(g=>g===d?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...l,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function f$(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const l=g$(o),u=h$(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Yf(s,l):l),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var p$=Symbol("radix.slottable");function m$(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===p$}function h$(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function g$(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var x$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=x$.reduce((e,t)=>{const n=d$(`Primitive.${t}`),s=f.forwardRef((o,i)=>{const{asChild:l,...u}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...u,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function y$(e,t){e&&Hs.flushSync(()=>e.dispatchEvent(t))}function ga(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 b$(e,t=globalThis==null?void 0:globalThis.document){const n=ga(e);f.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var v$="DismissableLayer",Ig="dismissableLayer.update",w$="dismissableLayer.pointerDownOutside",j$="dismissableLayer.focusOutside",rj,s1=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yx=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:l,onDismiss:u,...d}=e,m=f.useContext(s1),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),C=Vn(t,P=>g(P)),w=Array.from(m.layers),[v]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=w.indexOf(v),E=h?w.indexOf(h):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,I=N$(P=>{const $=P.target,L=[...m.branches].some(F=>F.contains($));!T||L||(o==null||o(P),l==null||l(P),P.defaultPrevented||u==null||u())},y),R=C$(P=>{const $=P.target;[...m.branches].some(F=>F.contains($))||(i==null||i(P),l==null||l(P),P.defaultPrevented||u==null||u())},y);return b$(P=>{E===m.layers.size-1&&(s==null||s(P),!P.defaultPrevented&&u&&(P.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(rj=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),sj(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=rj)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),sj())},[h,m]),f.useEffect(()=>{const P=()=>b({});return document.addEventListener(Ig,P),()=>document.removeEventListener(Ig,P)},[]),r.jsx(vn.div,{...d,ref:C,style:{pointerEvents:S?T?"auto":"none":void 0,...e.style},onFocusCapture:Qt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Qt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Qt(e.onPointerDownCapture,I.onPointerDownCapture)})});Yx.displayName=v$;var k$="DismissableLayerBranch",S$=f.forwardRef((e,t)=>{const n=f.useContext(s1),s=f.useRef(null),o=Vn(t,s);return f.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(vn.div,{...e,ref:o})});S$.displayName=k$;function N$(e,t=globalThis==null?void 0:globalThis.document){const n=ga(e),s=f.useRef(!1),o=f.useRef(()=>{});return f.useEffect(()=>{const i=u=>{if(u.target&&!s.current){let d=function(){o1(w$,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function C$(e,t=globalThis==null?void 0:globalThis.document){const n=ga(e),s=f.useRef(!1);return f.useEffect(()=>{const o=i=>{i.target&&!s.current&&o1(j$,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function sj(){const e=new CustomEvent(Ig);document.dispatchEvent(e)}function o1(e,t,n,{discrete:s}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?y$(o,i):o.dispatchEvent(i)}var Rh="focusScope.autoFocusOnMount",Ah="focusScope.autoFocusOnUnmount",oj={bubbles:!1,cancelable:!0},E$="FocusScope",a1=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...l}=e,[u,d]=f.useState(null),m=ga(o),h=ga(i),g=f.useRef(null),y=Vn(t,w=>d(w)),b=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(s){let w=function(S){if(b.paused||!u)return;const T=S.target;u.contains(T)?g.current=T:jo(g.current,{select:!0})},v=function(S){if(b.paused||!u)return;const T=S.relatedTarget;T!==null&&(u.contains(T)||jo(g.current,{select:!0}))},k=function(S){if(document.activeElement===document.body)for(const I of S)I.removedNodes.length>0&&jo(u)};document.addEventListener("focusin",w),document.addEventListener("focusout",v);const E=new MutationObserver(k);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",v),E.disconnect()}}},[s,u,b.paused]),f.useEffect(()=>{if(u){ij.add(b);const w=document.activeElement;if(!u.contains(w)){const k=new CustomEvent(Rh,oj);u.addEventListener(Rh,m),u.dispatchEvent(k),k.defaultPrevented||(T$($$(i1(u)),{select:!0}),document.activeElement===w&&jo(u))}return()=>{u.removeEventListener(Rh,m),setTimeout(()=>{const k=new CustomEvent(Ah,oj);u.addEventListener(Ah,h),u.dispatchEvent(k),k.defaultPrevented||jo(w??document.body,{select:!0}),u.removeEventListener(Ah,h),ij.remove(b)},0)}}},[u,m,h,b]);const C=f.useCallback(w=>{if(!n&&!s||b.paused)return;const v=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,k=document.activeElement;if(v&&k){const E=w.currentTarget,[S,T]=R$(E);S&&T?!w.shiftKey&&k===T?(w.preventDefault(),n&&jo(S,{select:!0})):w.shiftKey&&k===S&&(w.preventDefault(),n&&jo(T,{select:!0})):k===E&&w.preventDefault()}},[n,s,b.paused]);return r.jsx(vn.div,{tabIndex:-1,...l,ref:y,onKeyDown:C})});a1.displayName=E$;function T$(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(jo(s,{select:t}),document.activeElement!==n)return}function R$(e){const t=i1(e),n=aj(t,e),s=aj(t.reverse(),e);return[n,s]}function i1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function aj(e,t){for(const n of e)if(!A$(n,{upTo:t}))return n}function A$(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 P$(e){return e instanceof HTMLInputElement&&"select"in e}function jo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&P$(e)&&t&&e.select()}}var ij=D$();function D$(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=lj(e,t),e.unshift(t)},remove(t){var n;e=lj(e,t),(n=e[0])==null||n.resume()}}}function lj(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function $$(e){return e.filter(t=>t.tagName!=="A")}var L$="Portal",Jx=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[o,i]=f.useState(!1);Co(()=>i(!0),[]);const l=n||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return l?jP.createPortal(r.jsx(vn.div,{...s,ref:t}),l):null});Jx.displayName=L$;function I$(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var wa=e=>{const{present:t,children:n}=e,s=O$(t),o=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=Vn(s.ref,_$(o));return typeof n=="function"||s.isPresent?f.cloneElement(o,{ref:i}):null};wa.displayName="Presence";function O$(e){const[t,n]=f.useState(),s=f.useRef(null),o=f.useRef(e),i=f.useRef("none"),l=e?"mounted":"unmounted",[u,d]=I$(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=xd(s.current);i.current=u==="mounted"?m:"none"},[u]),Co(()=>{const m=s.current,h=o.current;if(h!==e){const y=i.current,b=xd(m);e?d("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?d("UNMOUNT"):d(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),Co(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const w=xd(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&w&&(d("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",m=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},y=b=>{b.target===t&&(i.current=xd(s.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{h.clearTimeout(m),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:f.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function xd(e){return(e==null?void 0:e.animationName)||"none"}function _$(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ph=0;function M$(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cj()),document.body.insertAdjacentElement("beforeend",e[1]??cj()),Ph++,()=>{Ph===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ph--}},[])}function cj(){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 vs=function(){return vs=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},vs.apply(this,arguments)};function l1(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function F$(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,i;s<o;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var Ud="right-scroll-bar-position",Wd="width-before-scroll-bar",z$="with-scroll-bars-hidden",B$="--removed-body-scroll-bar-size";function Dh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function U$(e,t){var n=f.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var W$=typeof window<"u"?f.useLayoutEffect:f.useEffect,uj=new WeakMap;function H$(e,t){var n=U$(null,function(s){return e.forEach(function(o){return Dh(o,s)})});return W$(function(){var s=uj.get(n);if(s){var o=new Set(s),i=new Set(e),l=n.current;o.forEach(function(u){i.has(u)||Dh(u,null)}),i.forEach(function(u){o.has(u)||Dh(u,l)})}uj.set(n,e)},[e]),n}function V$(e){return e}function K$(e,t){t===void 0&&(t=V$);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var l=t(i,s);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(i){for(s=!0;n.length;){var l=n;n=[],l.forEach(i)}n={push:function(u){return i(u)},filter:function(){return n}}},assignMedium:function(i){s=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(i),l=n}var d=function(){var h=l;l=[],h.forEach(i)},m=function(){return Promise.resolve().then(d)};m(),n={push:function(h){l.push(h),m()},filter:function(h){return l=l.filter(h),n}}}};return o}function q$(e){e===void 0&&(e={});var t=K$(null);return t.options=vs({async:!0,ssr:!1},e),t}var c1=function(e){var t=e.sideCar,n=l1(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,vs({},n))};c1.isSideCarExport=!0;function G$(e,t){return e.useMedium(t),c1}var u1=q$(),$h=function(){},Qf=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:$h,onWheelCapture:$h,onTouchMoveCapture:$h}),o=s[0],i=s[1],l=e.forwardProps,u=e.children,d=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,C=e.noIsolation,w=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,S=e.gapMode,T=l1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=y,R=H$([n,t]),P=vs(vs({},T),o);return f.createElement(f.Fragment,null,h&&f.createElement(I,{sideCar:u1,removeScrollBar:m,shards:g,noRelative:b,noIsolation:C,inert:w,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:S}),l?f.cloneElement(f.Children.only(u),vs(vs({},P),{ref:R})):f.createElement(E,vs({},P,{className:d,ref:R}),u))});Qf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qf.classNames={fullWidth:Wd,zeroRight:Ud};var Y$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function J$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Y$();return t&&e.setAttribute("nonce",t),e}function Q$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function X$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Z$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=J$())&&(Q$(t,n),X$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},eL=function(){var e=Z$();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},d1=function(){var e=eL(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},tL={left:0,top:0,right:0,gap:0},Lh=function(e){return parseInt(e||"",10)||0},nL=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Lh(n),Lh(s),Lh(o)]},rL=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return tL;var t=nL(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])}},sL=d1(),Ti="data-scroll-locked",oL=function(e,t,n,s){var o=e.left,i=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
517
|
+
.`.concat(z$,` {
|
|
518
|
+
overflow: hidden `).concat(s,`;
|
|
519
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
520
|
+
}
|
|
521
|
+
body[`).concat(Ti,`] {
|
|
522
|
+
overflow: hidden `).concat(s,`;
|
|
523
|
+
overscroll-behavior: contain;
|
|
524
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
525
|
+
padding-left: `.concat(o,`px;
|
|
526
|
+
padding-top: `).concat(i,`px;
|
|
527
|
+
padding-right: `).concat(l,`px;
|
|
528
|
+
margin-left:0;
|
|
529
|
+
margin-top:0;
|
|
530
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
531
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.`).concat(Ud,` {
|
|
535
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.`).concat(Wd,` {
|
|
539
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.`).concat(Ud," .").concat(Ud,` {
|
|
543
|
+
right: 0 `).concat(s,`;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.`).concat(Wd," .").concat(Wd,` {
|
|
547
|
+
margin-right: 0 `).concat(s,`;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
body[`).concat(Ti,`] {
|
|
551
|
+
`).concat(B$,": ").concat(u,`px;
|
|
552
|
+
}
|
|
553
|
+
`)},dj=function(){var e=parseInt(document.body.getAttribute(Ti)||"0",10);return isFinite(e)?e:0},aL=function(){f.useEffect(function(){return document.body.setAttribute(Ti,(dj()+1).toString()),function(){var e=dj()-1;e<=0?document.body.removeAttribute(Ti):document.body.setAttribute(Ti,e.toString())}},[])},iL=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;aL();var i=f.useMemo(function(){return rL(o)},[o]);return f.createElement(sL,{styles:oL(i,!t,o,n?"":"!important")})},Og=!1;if(typeof window<"u")try{var yd=Object.defineProperty({},"passive",{get:function(){return Og=!0,!0}});window.addEventListener("test",yd,yd),window.removeEventListener("test",yd,yd)}catch{Og=!1}var si=Og?{passive:!1}:!1,lL=function(e){return e.tagName==="TEXTAREA"},f1=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!lL(e)&&n[t]==="visible")},cL=function(e){return f1(e,"overflowY")},uL=function(e){return f1(e,"overflowX")},fj=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=p1(e,s);if(o){var i=m1(e,s),l=i[1],u=i[2];if(l>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},dL=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},fL=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},p1=function(e,t){return e==="v"?cL(t):uL(t)},m1=function(e,t){return e==="v"?dL(t):fL(t)},pL=function(e,t){return e==="h"&&t==="rtl"?-1:1},mL=function(e,t,n,s,o){var i=pL(e,window.getComputedStyle(t).direction),l=i*s,u=n.target,d=t.contains(u),m=!1,h=l>0,g=0,y=0;do{if(!u)break;var b=m1(e,u),C=b[0],w=b[1],v=b[2],k=w-v-i*C;(C||k)&&p1(e,u)&&(g+=k,y+=C);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!d&&u!==document.body||d&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},bd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},pj=function(e){return[e.deltaX,e.deltaY]},mj=function(e){return e&&"current"in e?e.current:e},hL=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gL=function(e){return`
|
|
554
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
555
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
556
|
+
`)},xL=0,oi=[];function yL(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),o=f.useState(xL++)[0],i=f.useState(d1)[0],l=f.useRef(e);f.useEffect(function(){l.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=F$([e.lockRef.current],(e.shards||[]).map(mj),!0).filter(Boolean);return w.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=f.useCallback(function(w,v){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!l.current.allowPinchZoom;var k=bd(w),E=n.current,S="deltaX"in w?w.deltaX:E[0]-k[0],T="deltaY"in w?w.deltaY:E[1]-k[1],I,R=w.target,P=Math.abs(S)>Math.abs(T)?"h":"v";if("touches"in w&&P==="h"&&R.type==="range")return!1;var $=window.getSelection(),L=$&&$.anchorNode,F=L?L===R||L.contains(R):!1;if(F)return!1;var A=fj(P,R);if(!A)return!0;if(A?I=P:(I=P==="v"?"h":"v",A=fj(P,R)),!A)return!1;if(!s.current&&"changedTouches"in w&&(S||T)&&(s.current=I),!I)return!0;var z=s.current||I;return mL(z,v,w,z==="h"?S:T)},[]),d=f.useCallback(function(w){var v=w;if(!(!oi.length||oi[oi.length-1]!==i)){var k="deltaY"in v?pj(v):bd(v),E=t.current.filter(function(I){return I.name===v.type&&(I.target===v.target||v.target===I.shadowParent)&&hL(I.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var S=(l.current.shards||[]).map(mj).filter(Boolean).filter(function(I){return I.contains(v.target)}),T=S.length>0?u(v,S[0]):!l.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=f.useCallback(function(w,v,k,E){var S={name:w,delta:v,target:k,should:E,shadowParent:bL(k)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(T){return T!==S})},1)},[]),h=f.useCallback(function(w){n.current=bd(w),s.current=void 0},[]),g=f.useCallback(function(w){m(w.type,pj(w),w.target,u(w,e.lockRef.current))},[]),y=f.useCallback(function(w){m(w.type,bd(w),w.target,u(w,e.lockRef.current))},[]);f.useEffect(function(){return oi.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",d,si),document.addEventListener("touchmove",d,si),document.addEventListener("touchstart",h,si),function(){oi=oi.filter(function(w){return w!==i}),document.removeEventListener("wheel",d,si),document.removeEventListener("touchmove",d,si),document.removeEventListener("touchstart",h,si)}},[]);var b=e.removeScrollBar,C=e.inert;return f.createElement(f.Fragment,null,C?f.createElement(i,{styles:gL(o)}):null,b?f.createElement(iL,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function bL(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vL=G$(u1,yL);var h1=f.forwardRef(function(e,t){return f.createElement(Qf,vs({},e,{ref:t,sideCar:vL}))});h1.classNames=Qf.classNames;var wL=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ai=new WeakMap,vd=new WeakMap,wd={},Ih=0,g1=function(e){return e&&(e.host||g1(e.parentNode))},jL=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=g1(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})},kL=function(e,t,n,s){var o=jL(t,Array.isArray(e)?e:[e]);wd[n]||(wd[n]=new WeakMap);var i=wd[n],l=[],u=new Set,d=new Set(o),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};o.forEach(m);var h=function(g){!g||d.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),C=b!==null&&b!=="false",w=(ai.get(y)||0)+1,v=(i.get(y)||0)+1;ai.set(y,w),i.set(y,v),l.push(y),w===1&&C&&vd.set(y,!0),v===1&&y.setAttribute(n,"true"),C||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),Ih++,function(){l.forEach(function(g){var y=ai.get(g)-1,b=i.get(g)-1;ai.set(g,y),i.set(g,b),y||(vd.has(g)||g.removeAttribute(s),vd.delete(g)),b||g.removeAttribute(n)}),Ih--,Ih||(ai=new WeakMap,ai=new WeakMap,vd=new WeakMap,wd={})}},SL=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=wL(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),kL(s,o,n,"aria-hidden")):function(){return null}};function NL(e){const t=CL(e),n=f.forwardRef((s,o)=>{const{children:i,...l}=s,u=f.Children.toArray(i),d=u.find(TL);if(d){const m=d.props.children,h=u.map(g=>g===d?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...l,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function CL(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const l=AL(o),u=RL(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Yf(s,l):l),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EL=Symbol("radix.slottable");function TL(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EL}function RL(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function AL(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xf="Dialog",[x1,y1]=va(Xf),[PL,ls]=x1(Xf),b1=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:l=!0}=e,u=f.useRef(null),d=f.useRef(null),[m,h]=Jf({prop:s,defaultProp:o??!1,onChange:i,caller:Xf});return r.jsx(PL,{scope:t,triggerRef:u,contentRef:d,contentId:Ei(),titleId:Ei(),descriptionId:Ei(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:l,children:n})};b1.displayName=Xf;var v1="DialogTrigger",w1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(v1,n),i=Vn(t,o.triggerRef);return r.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Zx(o.open),...s,ref:i,onClick:Qt(e.onClick,o.onOpenToggle)})});w1.displayName=v1;var Qx="DialogPortal",[DL,j1]=x1(Qx,{forceMount:void 0}),k1=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=ls(Qx,t);return r.jsx(DL,{scope:t,forceMount:n,children:f.Children.map(s,l=>r.jsx(wa,{present:n||i.open,children:r.jsx(Jx,{asChild:!0,container:o,children:l})}))})};k1.displayName=Qx;var cf="DialogOverlay",S1=f.forwardRef((e,t)=>{const n=j1(cf,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=ls(cf,e.__scopeDialog);return i.modal?r.jsx(wa,{present:s||i.open,children:r.jsx(LL,{...o,ref:t})}):null});S1.displayName=cf;var $L=NL("DialogOverlay.RemoveScroll"),LL=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(cf,n);return r.jsx(h1,{as:$L,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(vn.div,{"data-state":Zx(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),xa="DialogContent",N1=f.forwardRef((e,t)=>{const n=j1(xa,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=ls(xa,e.__scopeDialog);return r.jsx(wa,{present:s||i.open,children:i.modal?r.jsx(IL,{...o,ref:t}):r.jsx(OL,{...o,ref:t})})});N1.displayName=xa;var IL=f.forwardRef((e,t)=>{const n=ls(xa,e.__scopeDialog),s=f.useRef(null),o=Vn(t,n.contentRef,s);return f.useEffect(()=>{const i=s.current;if(i)return SL(i)},[]),r.jsx(C1,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qt(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Qt(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0;(l.button===2||u)&&i.preventDefault()}),onFocusOutside:Qt(e.onFocusOutside,i=>i.preventDefault())})}),OL=f.forwardRef((e,t)=>{const n=ls(xa,e.__scopeDialog),s=f.useRef(!1),o=f.useRef(!1);return r.jsx(C1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var l,u;(l=e.onCloseAutoFocus)==null||l.call(e,i),i.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:i=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=i.target;((m=n.triggerRef.current)==null?void 0:m.contains(l))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),C1=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...l}=e,u=ls(xa,n),d=f.useRef(null),m=Vn(t,d);return M$(),r.jsxs(r.Fragment,{children:[r.jsx(a1,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx(Yx,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Zx(u.open),...l,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(ML,{titleId:u.titleId}),r.jsx(zL,{contentRef:d,descriptionId:u.descriptionId})]})]})}),Xx="DialogTitle",E1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(Xx,n);return r.jsx(vn.h2,{id:o.titleId,...s,ref:t})});E1.displayName=Xx;var T1="DialogDescription",R1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(T1,n);return r.jsx(vn.p,{id:o.descriptionId,...s,ref:t})});R1.displayName=T1;var A1="DialogClose",P1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(A1,n);return r.jsx(vn.button,{type:"button",...s,ref:t,onClick:Qt(e.onClick,()=>o.onOpenChange(!1))})});P1.displayName=A1;function Zx(e){return e?"open":"closed"}var D1="DialogTitleWarning",[_L,$1]=s$(D1,{contentName:xa,titleName:Xx,docsSlug:"dialog"}),ML=({titleId:e})=>{const t=$1(D1),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
557
|
+
|
|
558
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
559
|
+
|
|
560
|
+
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},FL="DialogDescriptionWarning",zL=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$1(FL).contentName}}.`;return f.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},L1=b1,I1=w1,O1=k1,ey=S1,ty=N1,ny=E1,ry=R1,sy=P1;const Ln=L1,BL=I1,UL=O1,WL=sy,_1=f.forwardRef(({className:e,...t},n)=>r.jsx(ey,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));_1.displayName=ey.displayName;const En=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(UL,{children:[r.jsx(_1,{}),r.jsx(ty,{ref:s,className:be("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})]}));En.displayName=ty.displayName;function Xn({className:e,...t}){return r.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function Rr({className:e,...t}){return r.jsx("div",{className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Tn=f.forwardRef(({className:e,...t},n)=>r.jsx(ny,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));Tn.displayName=ny.displayName;const Wr=f.forwardRef(({className:e,...t},n)=>r.jsx(ry,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));Wr.displayName=ry.displayName;const HL=-1,VL=-40;function Oh(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,o=-2,i=0;for(let l=0;l<e.length;l++){const u=e[l];let d=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===o+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}i>0&&(n+=Math.max(VL,i*HL)),o=s,i=0,s++,d=!0;break}else i++,s++;if(!d)return-1/0}return n}const hj={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function oy(e,t,n=50){const s=e.toLowerCase();if(!s)return t.slice(0,n).map(l=>({...l,score:0}));const i=t.map(l=>{var g;const u=Oh(s,l.title.toLowerCase())*1,d=l.subtitle?Oh(s,l.subtitle.toLowerCase())*.5:-1/0,m=(g=l.keywords)!=null&&g.length?Oh(s,l.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,d,m);return{...l,score:h}}).filter(l=>l.score>-1/0);return i.sort((l,u)=>u.score!==l.score?u.score-l.score:l.title.length!==u.title.length?l.title.length-u.title.length:l.title!==u.title?l.title<u.title?-1:1:(hj[l.type]??99)-(hj[u.type]??99)),i.slice(0,n)}const KL={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},gj=Symbol("absent");function jd(e){return e.replace(/\s+/g," ").trim()}const xj=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function qL(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function GL(e){const t=e.externalIds;return Array.isArray(t)?t.filter(n=>{const s=n==null?void 0:n.system;return typeof s=="string"&&s.toLowerCase()==="jira"}).map(n=>String(n.id)).join(" "):""}const Nc={kind:{kind:"enum",get:e=>e.type},status:{kind:"enum"},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},assignee:{kind:"string",noneSentinel:!0,get:e=>"assignee"in e?e.assignee:gj},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:gj},externalid:{kind:"substring",get:qL},jira:{kind:"substring",get:GL},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function YL(e,t=KL,n){const s=(n==null?void 0:n.defaultScope)??"all",o=e.match(/^\s*all:\s*/i),i=o!==null,l=i?e.slice(o[0].length):e,u=QL(l,t),d={aqlExpr:u.aqlExpr,fuzzy:u.fuzzy};if(s!=="all"&&!i&&e.trim()!==""&&!JL(u.aqlExpr)){const m=`kind:${s}`;d.aqlExpr=u.aqlExpr?u.explicit?`${m} (${u.aqlExpr})`:`${m} ${u.aqlExpr}`:m}return d}function JL(e){if(!e)return!1;let t;try{t=qf(e)}catch{return!1}for(let n=0;n<t.length-1;n++)if(t[n].type==="IDENT"&&t[n].text.toLowerCase()==="kind"&&t[n+1].type==="COLON")return!0;return!1}function QL(e,t){let n;try{n=qf(e)}catch(g){if(g instanceof ia)return{aqlExpr:"",fuzzy:jd(e),explicit:!1};throw g}const s=n.length,o=(g,y)=>e.slice(n[g].pos,y<s?n[y].pos:e.length);let i=!1;for(let g=0;g<s;g++){const y=n[g];if(y.type==="OR"||y.type==="LPAREN"&&(g===0||n[g-1].type!=="COLON")){i=!0;break}}if(i){const g=jd(e4(e,n,s,t));return zi(g,Nc).query?{aqlExpr:g,fuzzy:"",explicit:!0}:{aqlExpr:"",fuzzy:jd(e),explicit:!0}}const l=[],u=[];let d=0,m=0;const h=g=>{if(g>m){const y=jd(o(m,g));y&&u.push(y)}};for(;d<s-1;){const g=XL(n,d,t);if(g){h(d),l.push(g.atom),d=g.end,m=d;continue}const y=ZL(n,d,s);if(y!==null){const b=o(d,y).trim();if(zi(b,Nc).query){h(d),l.push(b),d=y,m=d;continue}d=y;continue}d++}return h(s-1),{aqlExpr:l.join(" "),fuzzy:u.join(" "),explicit:!1}}function XL(e,t,n){var u;let s=t,o="";e[s].type==="MINUS"?(o="-",s++):e[s].type==="NOT"&&(o="NOT ",s++);const i=e[s];if(!i||i.type!=="IDENT")return null;const l=n[i.text.toLowerCase()];return!l||((u=e[s+1])==null?void 0:u.type)!=="COLON"?null:{atom:`${o}kind:${l}`,end:s+2}}function ZL(e,t,n){let s=t;(e[s].type==="MINUS"||e[s].type==="NOT")&&s++;const o=e[s];if(!o||o.type!=="IDENT"||!Object.prototype.hasOwnProperty.call(Nc,o.text.toLowerCase()))return null;const i=e[s+1];if(!i)return null;if(i.type==="COLON"){const l=e[s+2];if(!l)return null;if(l.type==="LPAREN"){let u=0;for(let d=s+2;d<n;d++)if(e[d].type==="LPAREN")u++;else if(e[d].type==="RPAREN"){if(u--,u===0)return d+1}else if(e[d].type==="EOF")return null;return null}return xj.has(l.type)?s+3:null}if(i.type==="OP"){const l=e[s+2];return l&&xj.has(l.type)?s+3:null}return null}function e4(e,t,n,s){var l;let o="",i=0;for(let u=0;u<n;u++){const d=t[u];d.type==="IDENT"&&Object.prototype.hasOwnProperty.call(s,d.text.toLowerCase())&&((l=t[u+1])==null?void 0:l.type)==="COLON"&&(o+=e.slice(i,d.pos)+`kind:${s[d.text.toLowerCase()]} `,i=t[u+1].pos+1)}return o+=e.slice(i),o}const ay=["kanban","list","table"],M1=["title","status","priority","assignee","dependencies","created","updated"],t4=["asc","desc"],n4=["comfortable","compact"],r4=["none","status","type","priority","assignee","project"],s4=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function Fe(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const o=s.trim();!o||o==="all"||n.includes(o)||n.push(o)}return n}function o4(e,t){const n=Fe(e),s=Fe(t);return n.length===s.length&&n.every(o=>s.includes(o))}const a4={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Cc={version:1,global:a4,projects:{}};function _h(e){return e==="table"?"table":"kanban"}function i4(e,t){return t?{...e,...t}:{...e}}function F1(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:i4(n.filters,s.filters)}:n}const l4=/^[A-Za-z_][A-Za-z0-9_-]*$/,c4=new Set(["and","or","not"]);function iy(e){return l4.test(e)&&!c4.has(e.toLowerCase())?e:z1(e)}function z1(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const B1="__unassigned__",U1="__standalone__",u4={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function d4(e){return e.startsWith("older_")?"<":">="}const ly=["status","type","priority","assignee","project","tags"],f4=["created","updated"];function p4(e){var i;const t={};for(const l of ly){const u=Fe(e[l]);u.length&&(t[l]=u)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let s=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const l=m4(o);if(l)s||(s=l);else{const u=h4(o);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function m4(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function h4(e){if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return null;const s={field:e.field};return t&&(s.from=t),n&&(s.to=n),s}function dc(e){const t=p4(e),n=[];for(const s of ly){const o=t[s]??[];o.length&&n.push(g4(s,o))}return t.search&&n.push(`search:${z1(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...y4(t.dateRange)),n.join(" AND ")}function g4(e,t){const n=t.map(s=>x4(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function x4(e,t){return e==="assignee"&&t===B1||e==="project"&&t===U1?"none":iy(t)}function y4(e){if(e.preset)return[`${e.field} ${d4(e.preset)} -${u4[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function fc(e){const t=Gf(e);if(!t.ast)return null;const n=b4(t.ast);if(n===null)return null;const s={},o=new Set,i=new Map;for(const l of n){const u=v4(l);if(!u)return null;switch(u.kind){case"value":{if(o.has(u.field))return null;o.add(u.field),s[u.field]=u.values;break}case"search":{if(o.has("search"))return null;o.add("search"),s.search=u.text;break}case"activity":{if(o.has("activity"))return null;o.add("activity"),s.activity=u.activity;break}case"datePreset":{const d=`date:${u.field}`;if(o.has(d)||i.has(u.field))return null;o.add(d),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const d=`date:${u.field}`;if(o.has(d))return null;const m=i.get(u.field)??{};if(u.bound==="from"){if(m.from!==void 0)return null;m.from=u.date}else{if(m.to!==void 0)return null;m.to=u.date}i.set(u.field,m);break}}}if(i.size>1)return null;for(const[l,u]of i){if(s.dateRange)return null;const d={field:l};u.from!==void 0&&(d.from=u.from),u.to!==void 0&&(d.to=u.to),s.dateRange=d}return s}function b4(e){if(e.kind==="all")return[];if(e.kind==="atom")return[e];if(e.kind==="and"){const t=[];for(const n of e.children){if(n.kind!=="atom")return null;t.push(n)}return t}return null}function v4(e){const t=e.field.toLowerCase();if(e.op===":"){if(ly.includes(t)){const o=t,i=[];for(const l of e.values){const u=N4(o,l);if(u===null)return null;i.push(u)}return i.length===0?null:{kind:"value",field:o,values:i}}return t==="search"?e.values.length!==1?null:{kind:"search",text:e.values[0].raw}:null}if(!f4.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?w4(n,e.op,s):s.type==="date"?e.op===">="?{kind:"dateBound",field:n,bound:"from",date:s.raw}:e.op==="<="?{kind:"dateBound",field:n,bound:"to",date:s.raw}:null:null}function w4(e,t,n){if(n.sign!==-1)return null;const s=j4(n.raw);if(e==="updated"){if(t==="<"&&s==="7d")return{kind:"activity",activity:"stale"};if(t===">="&&s==="7d")return{kind:"activity",activity:"fresh"}}const o=S4(t,s);return o?{kind:"datePreset",field:e,preset:o}:null}function j4(e){return e.replace(/^[-+]/,"")}const k4={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function S4(e,t){return e!==">="&&e!=="<"?null:k4[e][t]??null}function N4(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?B1:e==="project"&&n.toLowerCase()==="none"?U1:n}const C4=new Set(["status","type","tag","assignee","externalid"]),Mh=new Set(["IDENT","STRING","NUMBER","DATE","DURATION","STAR"]),yj=8;function E4(e,t,n){var C,w,v,k,E;let s;try{s=qf(e)}catch{return[]}const o=s.length,i=S=>{const T=S+1<o?s[S+1].pos:e.length;return s[S].pos+e.slice(s[S].pos,T).replace(/\s+$/,"").length};let l=-1;for(let S=0;S<o-1;S++)if(t>s[S].pos&&t<=i(S)){l=S;break}let u=l>=0?l-1:-1;if(l<0)for(let S=0;S<o-1&&i(S)<=t;S++)u=S;let d=null,m=null,h="";if(l>=0&&s[l].type==="COLON"&&((C=s[l-1])==null?void 0:C.type)==="IDENT"?(d=s[l-1].text.toLowerCase(),m=[t,t]):l>=0&&Mh.has(s[l].type)&&((w=s[l-1])==null?void 0:w.type)==="COLON"&&((v=s[l-2])==null?void 0:v.type)==="IDENT"?(d=s[l-2].text.toLowerCase(),m=[s[l].pos,i(l)],h=s[l].text):l<0&&u>=0&&s[u].type==="COLON"&&((k=s[u-1])==null?void 0:k.type)==="IDENT"&&(d=s[u-1].text.toLowerCase(),m=[t,t]),d!==null){if(!C4.has(d))return[];const S=n.values[d]??[],T=h.toLowerCase(),I=[];for(const R of S)if(!(T&&!R.toLowerCase().startsWith(T))&&R.toLowerCase()!==T&&(I.push({label:R,insert:iy(R),replace:m,kind:"value"}),I.length>=yj))break;return I}if(l>=0&&!Mh.has(s[l].type))return[];if(l>=0&&s[l].type==="IDENT"&&((E=s[l+1])==null?void 0:E.type)==="COLON")return[];if(u>=0){const S=s[u].type;if(!(S==="AND"||S==="OR"||S==="NOT"||S==="MINUS"||S==="LPAREN"||S==="RPAREN"||Mh.has(S)))return[]}const g=(l>=0?s[l].text:"").toLowerCase(),y=l>=0?[s[l].pos,i(l)]:[t,t],b=[];for(const[S,T]of Object.entries(n.aliases))g&&!S.toLowerCase().startsWith(g)||b.push({label:`${S}: (${T})`,insert:`${S}:`,replace:y,kind:"prefix"});for(const S of n.fields)g&&!S.toLowerCase().startsWith(g)||b.push({label:`${S}:`,insert:`${S}:`,replace:y,kind:"field"});return b.slice(0,yj)}const Hd={phaseLadder:[{phase:"draft",when:"*",next:"Fill in the objective and acceptance criteria"},{phase:"ready_for_planning",when:"hasRealObjective:true AND acRealTotal > 0",next:"Write a plan and get it approved"},{phase:"ready_to_implement",when:"planApproved:true",next:"Start implementing"},{phase:"in_progress",when:"planApproved:true AND implementationStarted:true",next:"Finish acceptance criteria, then request review"},{phase:"review",when:"acAllChecked:true OR reviewRequested:true",next:"Complete, or address review feedback"}],disposition:[{when:"parked:true",is:"parked"},{when:"blocked:true",is:"blocked"},{when:null,is:"active"}],headline:{terminal:"passthrough",parked:"parked",blocked:"blocked",active:"phase"}};function T4(e,t,n=()=>null){const s=[],o=new Set(t.statuses.map(u=>u.id));e.phaseLadder.length===0&&s.push("phaseLadder must have at least one rung");for(const u of e.phaseLadder){o.has(u.phase)||s.push(`phaseLadder rung "${u.phase}" is not a defined status id`);const d=u.when==="*"?null:n(u.when);d&&s.push(`phaseLadder rung "${u.phase}": invalid condition — ${d}`)}const i=new Set(["active","blocked","parked"]);for(const u of e.disposition)if(i.has(u.is)||s.push(`disposition "${u.is}" is not valid (expected active, blocked, or parked — terminal is never a rule)`),u.when!==null){const d=n(u.when);d&&s.push(`disposition rule "${u.is}": invalid condition — ${d}`)}const l=e.disposition.map((u,d)=>u.when===null?d:-1).filter(u=>u>=0);l.length===0?s.push("disposition rules must end with an `else:` arm (a rule with when: null)"):l.length>1?s.push("disposition rules must have exactly one `else:` arm (when: null)"):l[0]!==e.disposition.length-1&&s.push("the `else:` arm (when: null) must be the LAST disposition rule — rules after it are unreachable");for(const u of["parked","blocked"])o.has(e.headline[u])||s.push(`headline.${u} → "${e.headline[u]}" is not a defined status id (add the definition or run migrate-derive)`);return s}const W1={statuses:[{id:"pending",label:"Pending"},{id:"in_progress",label:"In Progress"},{id:"blocked",label:"Blocked"},{id:"review",label:"Review"},{id:"completed",label:"Completed"},{id:"failed",label:"Failed"}],order:["pending","in_progress","blocked","review","completed","failed"],transitions:[],transitionsCustom:!1,custom:!1,derive:Hd,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let pc=null,na=null;function R4(){return pc?Promise.resolve(pc):na||(na=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(pc=e,na=null,e)).catch(()=>(na=null,W1)),na)}function cs(){const[e,t]=f.useState(()=>pc??W1);return f.useEffect(()=>{R4().then(t)},[]),e}function bj(){pc=null,na=null}function Eo(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 H1={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 Vd=null,ii=null;function A4(){return Vd?Promise.resolve(Vd):ii||(ii=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Vd=e,ii=null,e)).catch(()=>(ii=null,H1)),ii)}function qc(){const[e,t]=f.useState(()=>Vd??H1);return f.useEffect(()=>{A4().then(t)},[]),e}function Ri(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 P4(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}const D4={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function $4({entries:e}){const{paletteOpen:t,closePalette:n}=$o(),s=_t(),[o,i]=f.useState(""),[l,u]=f.useState(0),[d,m]=f.useState(0),[h,g]=f.useState(!0),[y,b]=f.useState(0),C=f.useRef(null),w=f.useRef(null),{search:v}=Gx(),k=cs(),E=qc(),{aqlExpr:S,fuzzy:T}=f.useMemo(()=>YL(o,v.aliases,{defaultScope:v.defaultScope}),[o,v.aliases,v.defaultScope]),I=f.useMemo(()=>{const z=new Set,V=new Set,O=new Set;for(const K of e){for(const q of K.tags??[])z.add(q);K.assignee&&V.add(K.assignee);for(const q of K.externalIds??[])q.id&&(O.add(q.id),q.system&&O.add(`${q.system}:${q.id}`))}const B=Object.keys(Nc);return{aliases:v.aliases,fields:v.externalIds?B:B.filter(K=>K!=="jira"&&K!=="externalid"),values:{status:k.statuses.map(K=>K.id),type:E.definitions.map(K=>K.id),tag:[...z],assignee:[...V],externalid:v.externalIds?[...O]:[]}}},[e,v.aliases,v.externalIds,k.statuses,E.definitions]),R=f.useMemo(()=>E4(o,d,I),[o,d,I]),P=h&&R.length>0&&o.trim()!=="",$=f.useMemo(()=>{let z=e,V=T;if(S){const O=zi(S,Nc);if(O.query){const B=Date.now(),{predicate:K}=O.query;z=e.filter(q=>K(q,{now:B}))}else V=o}return oy(V,z,50)},[e,S,T,o]);f.useEffect(()=>{u(0)},[o,t]),f.useEffect(()=>{b(0)},[R]),f.useEffect(()=>{t||(i(""),m(0),g(!0))},[t]),f.useEffect(()=>{var V;const z=(V=C.current)==null?void 0:V.querySelector(`[data-palette-idx="${l}"]`);z==null||z.scrollIntoView({block:"nearest"})},[l]);function L(z){s(z.route),n()}function F(z){const V=o.slice(0,z.replace[0])+z.insert+o.slice(z.replace[1]),O=z.replace[0]+z.insert.length;i(V),m(O),requestAnimationFrame(()=>{const B=w.current;B&&(B.focus(),B.setSelectionRange(O,O))})}function A(z){if(P){if(z.key==="Tab"||z.key==="ArrowRight"&&d>=o.length){z.preventDefault();const V=R[y];V&&F(V);return}if(z.key==="ArrowDown"){z.preventDefault(),b(V=>Math.min(R.length-1,V+1));return}if(z.key==="ArrowUp"){z.preventDefault(),b(V=>Math.max(0,V-1));return}if(z.key==="Enter"){z.preventDefault();const V=$[l];V&&L(V);return}return}if(z.key==="ArrowDown")z.preventDefault(),u(V=>Math.min($.length-1,V+1));else if(z.key==="ArrowUp")z.preventDefault(),u(V=>Math.max(0,V-1));else if(z.key==="Enter"){z.preventDefault();const V=$[l];V&&L(V)}}return r.jsx(Ln,{open:t,onOpenChange:z=>z?null:n(),children:r.jsxs(En,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:z=>{P&&(z.preventDefault(),g(!1))},children:[r.jsx(Tn,{className:"sr-only",children:"Command palette"}),r.jsxs("div",{className:"relative",children:[r.jsx("input",{ref:w,autoFocus:!0,type:"text",value:o,onChange:z=>{i(z.target.value),m(z.target.selectionStart??z.target.value.length),g(!0)},onSelect:z=>m(z.currentTarget.selectionStart??0),onKeyDown:A,placeholder:"Search… try a: p: jira:PROJ-123 tag:backend",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"}),P?r.jsx("div",{className:"absolute left-0 right-0 top-full z-50 max-h-64 overflow-y-auto border-b border-border/70 bg-background shadow-lg",children:R.map((z,V)=>{const O=V===y;return r.jsxs("button",{type:"button",onMouseDown:B=>{B.preventDefault(),F(z)},onMouseEnter:()=>b(V),className:`flex w-full items-center justify-between gap-3 px-4 py-1.5 text-left text-sm ${O?"bg-accent text-accent-foreground":"text-foreground"}`,children:[r.jsx("code",{className:"truncate",children:z.label}),r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:z.kind})]},`${z.kind}-${z.insert}-${V}`)})}):null]}),S?r.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Filtering"})," ",r.jsx("code",{className:"text-foreground",children:S}),T?r.jsxs("span",{children:[" · ranking “",T,"”"]}):null]}):o.trim()===""?r.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-medium",children:"Prefixes"})," ",Object.keys(v.aliases).map(z=>r.jsxs("code",{className:"mr-1",children:[z,":"]},z))," · ",r.jsx("code",{children:"status:"})," ",r.jsx("code",{children:"tag:"})," ",r.jsx("code",{children:"assignee:"})," ",r.jsx("code",{children:"type:"})," ",v.externalIds?r.jsx("code",{children:"jira:"}):null]}):null,r.jsx("div",{ref:C,className:"max-h-[60vh] overflow-y-auto p-1",children:$.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):$.map((z,V)=>{const O=V===l;return r.jsxs("button",{type:"button","data-palette-idx":V,onClick:()=>L(z),onMouseEnter:()=>u(V),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${O?"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:D4[z.type]??z.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:z.title}),z.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:z.subtitle}):null]},z.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.jsx("span",{children:P?"⇥/→ accept · ↑↓ suggestions · Esc close":"↑↓ navigate · ↵ open · Esc close"}),r.jsxs("span",{children:[$.length," result",$.length===1?"":"s"]})]})]})})}function L4({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(RP,{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 I4({step:e,initialValue:t,disabled:n,onSubmit:s}){const[o,i]=f.useState(t??""),[l,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var C;(C=d.current)==null||C.focus()},[]);const m=o.trim(),h=e.required!==!1,g=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!g;function b(C){if(C.key==="Enter"){if(C.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:d,type:"text",value:o,onChange:C=>{i(C.target.value),u(!1)},onKeyDown:b,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),l&&e.pattern&&g?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function O4({step:e,disabled:t,onSubmit:n}){const[s,o]=f.useState({phase:"loading"}),[i,l]=f.useState(""),[u,d]=f.useState(0),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null);f.useEffect(()=>{var w;(w=g.current)==null||w.focus()},[]),f.useEffect(()=>{let w=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(v=>{w||o({phase:"loaded",options:v})}).catch(v=>{if(w)return;const k=v instanceof Error?v.message:"Failed to load options";o({phase:"error",message:k})}),()=>{w=!0}},[e,m]);const b=f.useMemo(()=>{if(s.phase!=="loaded")return[];const w=s.options.map(v=>({type:"option",title:v.label,subtitle:v.hint,keywords:[v.value],option:v}));return oy(i,w,100)},[s,i]);f.useEffect(()=>{d(0)},[b.length]),f.useEffect(()=>{var v;const w=(v=y.current)==null?void 0:v.querySelector(`[data-picker-idx="${u}"]`);w==null||w.scrollIntoView({block:"nearest"})},[u]);function C(w){if(s.phase==="loaded"){if(w.key==="ArrowDown")w.preventDefault(),d(v=>Math.min(b.length-1,v+1));else if(w.key==="ArrowUp")w.preventDefault(),d(v=>Math.max(0,v-1));else if(w.key==="Enter"){w.preventDefault();const v=b[u];v&&n(v.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:i,onChange:w=>l(w.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(w=>w+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((w,v)=>{const k=v===u;return r.jsxs("button",{type:"button","data-picker-idx":v,onClick:()=>n(w.option.value),onMouseEnter:()=>d(v),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:w.option.label}),w.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:w.option.hint}):null]},w.option.value)})})]})}function _4({entries:e}){var oe,ue;const t=_t(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:o,bindAction:i,findConflict:l,pendingActionKind:u,consumePendingActionKind:d}=$o(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,C]=f.useState(null),[w,v]=f.useState(""),[k,E]=f.useState(null),[S,T]=f.useState(null),[I,R]=f.useState(!1),[P,$]=f.useState(null),L=f.useRef(null),F=f.useMemo(()=>e.map(re=>({type:re.group.toLowerCase(),title:re.title,subtitle:re.subtitle,keywords:re.keywords,action:re})),[e]),A=f.useMemo(()=>oy(m,F,50),[m,F]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),C(null),v(""),E(null),T(null),R(!1),$(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const re=d();if(!re)return;const xe=e.find(ke=>ke.bindableKind===re);xe&&z(xe)},[n,u]),f.useEffect(()=>{var xe;const re=(xe=L.current)==null?void 0:xe.querySelector(`[data-palette-idx="${g}"]`);re==null||re.scrollIntoView({block:"nearest"})},[g]);async function z(re){if(!I){if(re.flow&&re.flow.steps.length>0){E({action:re,stepIndex:0,values:{}}),$(null);return}if(re.requiresInput){C(re),v(""),$(null);return}if(re.run){R(!0),$(null);try{await re.run(),s()}catch(xe){$(xe instanceof Error?xe.message:"Action failed")}finally{R(!1)}}}}async function V(re){if(!k)return;const xe=k.action.flow.steps[k.stepIndex],ke={...k.values,[xe.id]:re};if(k.stepIndex+1<k.action.flow.steps.length){E({action:k.action,stepIndex:k.stepIndex+1,values:ke});return}R(!0),$(null);try{await k.action.flow.submit(ke,{navigate:t}),s()}catch(Pe){$(Pe instanceof Error?Pe.message:"Action failed")}finally{R(!1)}}function O(){if(k&&!I){if(k.stepIndex===0){E(null),$(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),$(null)}}async function B(){if(I||!(b!=null&&b.requiresInput))return;const re=w.trim();if(re){R(!0),$(null);try{await b.requiresInput.runWithInput(re),s()}catch(xe){$(xe instanceof Error?xe.message:"Action failed")}finally{R(!1)}}}function K(re){if(re.key==="ArrowDown")re.preventDefault(),y(xe=>Math.min(A.length-1,xe+1));else if(re.key==="ArrowUp")re.preventDefault(),y(xe=>Math.max(0,xe-1));else if(re.key==="Enter"&&(re.metaKey||re.ctrlKey)){re.preventDefault();const xe=A[g];xe!=null&&xe.action.bindableKind&&T({action:xe.action,combo:null,conflict:null,saving:!1,error:null})}else if(re.key==="Enter"){re.preventDefault();const xe=A[g];xe&&z(xe.action)}}function q(re){re.key==="Enter"?(re.preventDefault(),B()):re.key==="Escape"&&(re.preventDefault(),C(null),v(""))}function _(re){if(!S||re.key==="Escape"||re.key==="Enter"&&!S.combo)return;re.preventDefault(),re.stopPropagation();const xe=HS(re.nativeEvent);if(!xe)return;const ke=l(xe,S.action.bindableKind);T({...S,combo:xe,conflict:ke,error:null})}async function G(){var re;if(!(!S||!S.combo||!S.action.bindableKind)){if((re=S.conflict)!=null&&re.description){T({...S,error:`Reserved: ${S.conflict.description}`});return}T({...S,saving:!0,error:null});try{await i(S.action.bindableKind,S.combo),T(null)}catch(xe){T({...S,saving:!1,error:xe instanceof Error?xe.message:"Failed to save binding"})}}}const D=b!==null,H=k!==null,Z=S!==null,U=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(Ln,{open:n,onOpenChange:re=>re?null:s(),children:r.jsxs(En,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:re=>{if(!I){if(Z){re.preventDefault(),T(null);return}if(H){re.preventDefault(),O();return}D&&(re.preventDefault(),C(null),v(""),$(null))}},children:[r.jsx(Tn,{className:"sr-only",children:"Actions palette"}),Z&&S?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(Eg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",S.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:S.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:Ss(S.combo)}),(oe=S.conflict)!=null&&oe.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(ue=S.conflict)!=null&&ue.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',S.conflict.kind,'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),S.error?r.jsx("div",{className:"text-sm text-destructive",children:S.error}):null]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),r.jsx("span",{children:S.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void G(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:re=>{re.key==="Enter"&&G()}})]}):H&&U&&k?r.jsxs(r.Fragment,{children:[r.jsx(L4,{label:`${k.action.title} · ${U.label}`,onBack:O,disabled:I,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),U.kind==="text"?r.jsx(I4,{step:U,initialValue:k.values[U.id],disabled:I,onSubmit:V}):r.jsx(O4,{step:U,disabled:I,onSubmit:V}),P?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:I?"Running…":""})]})]}):D?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:w,onChange:re=>v(re.target.value),onKeyDown:q,placeholder:b.requiresInput.placeholder,disabled:I,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:I?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:re=>h(re.target.value),onKeyDown:K,placeholder:"Run an action: new project, new todo, toggle…",disabled:I,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsx("div",{ref:L,className:"max-h-[60vh] overflow-y-auto p-1",children:A.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"}):A.map((re,xe)=>{const ke=xe===g,Pe=re.action.bindableKind,De=Pe?o[Pe]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":xe,onClick:()=>z(re.action),onMouseEnter:()=>y(xe),disabled:I,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${ke?"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:re.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:re.action.title}),re.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:re.action.subtitle}):null,De?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:Ss(De)}):null,Pe?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Xe=>{Xe.preventDefault(),Xe.stopPropagation(),T({action:re.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 ${ke?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(Eg,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},re.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:I?"Running…":`${A.length} action${A.length===1?"":"s"}`})]})]})]})})}const M4=[{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 F4(e){const t=ur(e);return t?M4.find(n=>n.combo===t)??null:null}const Jl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},z4={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},B4=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function vj(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${Ss(t)} then ${Ss(n)}`}return Ss(e)}function U4(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:o}=$o(),i=f.useMemo(()=>{const d=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&d.add(ur(m));return d},[s]),l=f.useMemo(()=>{if(!e)return new Map;const d=n(),m=new Map;for(const h of d){if(i.has(ur(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,i]),u=f.useMemo(()=>{const d=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=o.find(y=>y.bindableKind===m);d.push({kind:m,combo:h,title:g?g.title:m})}return d},[s,o]);return r.jsx(Ln,{open:e,onOpenChange:d=>d?null:t(),children:r.jsxs(En,{className:"max-w-2xl",children:[r.jsx(Tn,{children:"Keyboard shortcuts"}),r.jsxs(Wr,{children:["Press Esc to close. ",Ss("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:[B4.map(d=>{const m=l.get(d);return!m||m.length===0?null:r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:z4[d]}),r.jsx("ul",{className:"space-y-1",children:m.map((h,g)=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:h.description}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:vj(h.keys)})]},`${d}-${h.keys}-${g}`))})]},d)}),u.length>0?r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),r.jsx("ul",{className:"space-y-1",children:u.map(d=>r.jsxs("li",{className:"flex items-center justify-between gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-1.5 text-sm",children:[r.jsx("span",{className:"text-foreground",children:d.title}),r.jsx("kbd",{className:"shrink-0 rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-muted-foreground",children:vj(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const cy={bindings:{},custom:!1};let mc=null,li=null;const _g=new Set;function V1(e){mc=e;for(const t of _g)t(e)}function uy(e){if(!e||typeof e!="object")return cy;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[s,o]of Object.entries(t.bindings)){if(!wD(s)||typeof o!="string"||o.trim()==="")continue;const i=ur(o);i&&(n[s]=i)}return{bindings:n,custom:t.custom===!0}}function W4(){return mc?Promise.resolve(mc):li||(li=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=uy(e);return mc=t,li=null,t}).catch(()=>(li=null,cy)),li)}function H4(){const[e,t]=f.useState(()=>mc??cy);return f.useEffect(()=>{let n=!1;return W4().then(s=>{n||t(s)}),_g.add(t),()=>{n=!0,_g.delete(t)}},[]),e}async function wj(e){const t={};for(const o of Hf){const i=e[o];if(typeof i!="string")continue;const l=ur(i);l&&(t[o]=l)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save hotkey bindings")}const s=uy(await n.json());return V1(s),s}async function V4(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=uy(await e.json());return V1(t),t}const jj=1500;function K4(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const K1=f.createContext(null);function q4({children:e}){const{toggleTheme:t}=Fx(),n=Qn(),s=_t(),o=K4(n.pathname),[i,l]=f.useState(!1),u=Ts(i),d=Uf(i),m=Bx(i),h=zx(i),g=VS(i),{search:y}=Gx(),b=f.useMemo(()=>{var qe,Lt,bt,ut;const Re=u.data??[],Se=((qe=d.data)==null?void 0:qe.assignments)??[],Oe=((Lt=m.data)==null?void 0:Lt.playbooks)??[],ze=((bt=h.data)==null?void 0:bt.sessions)??[],_e=(((ut=g.data)==null?void 0:ut.workspaces)??[]).flatMap(ae=>ae.items.map(X=>({...X,workspace:ae.workspace})));return UD({projects:Re,assignments:Se,playbooks:Oe,servers:ze,todos:_e,wsPrefix:o,externalIds:y.externalIds})},[u.data,d.data,m.data,h.data,g.data,o,y.externalIds]),w=f.useMemo(()=>ES(n.pathname),[n.pathname]).projectSlug,v=f.useMemo(()=>{var Re;return w?((Re=u.data)==null?void 0:Re.find(Se=>Se.slug===w))??null:null},[u.data,w]),k=(v==null?void 0:v.title)??null,E=(v==null?void 0:v.workspace)??null,S=f.useMemo(()=>{var Re;return VD({playbooks:((Re=m.data)==null?void 0:Re.playbooks)??[],projectSlug:w,currentProjectTitle:k,currentProjectWorkspace:E,wsPrefix:o,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,w,k,E,o,s,t]),T=f.useRef(new Map),I=f.useRef(["global"]),R=f.useRef({phase:"idle"}),P=f.useRef(null),$=f.useRef(1),[L,F]=f.useState(!1),[A,z]=f.useState(!1),[V,O]=f.useState(!1),[B,K]=f.useState(null);f.useEffect(()=>{(L||V)&&l(!0)},[L,V]);const{bindings:q}=H4(),_=f.useMemo(()=>CD(q),[q]),G=f.useCallback(Re=>{const Se=$.current++;return T.current.set(Se,{...Re,id:Se}),Se},[]),D=f.useCallback(Re=>{T.current.delete(Re)},[]),H=f.useCallback(Re=>{I.current.push(Re)},[]),Z=f.useCallback(Re=>{const Se=I.current;for(let Oe=Se.length-1;Oe>=0;Oe--)if(Se[Oe]===Re){Se.splice(Oe,1);return}},[]),U=f.useCallback(()=>F(!0),[]),oe=f.useCallback(()=>F(!1),[]),ue=f.useCallback(()=>z(!0),[]),re=f.useCallback(()=>z(!1),[]),xe=f.useCallback(()=>O(!0),[]),ke=f.useCallback(()=>{O(!1),K(null)},[]),Pe=f.useCallback(()=>Array.from(T.current.values()),[]),De=f.useCallback(()=>{let Re=null;return K(Se=>(Re=Se,null)),Re},[]),Xe=f.useCallback(Re=>{K(Re),O(!0)},[]),st=f.useCallback((Re,Se)=>{const Oe=ur(Re);if(!Oe)return null;if(SD(Oe)){const ze=F4(Oe);return{description:(ze==null?void 0:ze.description)??"Reserved built-in shortcut"}}for(const[ze,et]of Object.entries(_))if(!(Se&&ze===Se)&&et===Oe)return{kind:ze};return null},[_]),Ze=f.useCallback(async(Re,Se)=>{const Oe=ur(Se);if(!Oe)throw new Error("Empty combo");const ze=st(Oe,Re);if(ze){const _e=ze.description?`Reserved: ${ze.description}`:`Already bound to "${ze.kind}"`;throw new Error(_e)}const et={...q,[Re]:Oe};return await wj(et),Oe},[q,st]),ot=f.useCallback(async Re=>{if(!q[Re])return;const Se={...q};delete Se[Re],await wj(Se)},[q]);f.useEffect(()=>{R.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[n.pathname]),f.useEffect(()=>{function Re(_e){if(!(_e instanceof HTMLElement))return!1;const qe=_e.tagName;return!!(qe==="INPUT"||qe==="TEXTAREA"||qe==="SELECT"||_e.isContentEditable||_e.closest('[role="combobox"], [role="textbox"]'))}function Se(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Oe(){const _e=I.current;return _e[_e.length-1]??"global"}function ze(_e){return _e.scope==="global"?!0:_e.scope===Oe()}function et(_e){const qe=gd(_e,"Mod+k"),Lt=gd(_e,"Mod+Shift+k"),bt=_e.key==="Escape",ut=qe||Lt||bt;if(Se()&&!ut||Re(_e.target)&&!ut)return;const ae=R.current;if(ae.phase==="awaiting-second")if(Date.now()-ae.startedAt>jj)R.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null);else{const ne=Array.from(T.current.values());for(const ye of ne){if(!ze(ye))continue;const Ee=ye.keys.split(" ");if(!(Ee.length!==2||Ee[0]!=="g")&&gd(_e,Ee[1])&&!(ye.when&&!ye.when())){_e.preventDefault(),R.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null),ye.handler(_e);return}}R.current={phase:"idle"},P.current!==null&&(window.clearTimeout(P.current),P.current=null)}const X=Array.from(T.current.values());for(const he of X){if(!ze(he))continue;const ne=he.keys.split(" ");if(ne.length===1&&gd(_e,ne[0])&&!(he.when&&!he.when())){_e.preventDefault(),he.handler(_e);return}}_e.key==="g"&&!_e.metaKey&&!_e.ctrlKey&&!_e.altKey&&!_e.shiftKey&&Array.from(T.current.values()).some(ne=>ze(ne)&&ne.keys.startsWith("g "))&&(_e.preventDefault(),R.current={phase:"awaiting-second",startedAt:Date.now()},P.current!==null&&window.clearTimeout(P.current),P.current=window.setTimeout(()=>{R.current={phase:"idle"},P.current=null},jj))}return window.addEventListener("keydown",et),()=>{window.removeEventListener("keydown",et),P.current!==null&&(window.clearTimeout(P.current),P.current=null)}},[]),f.useEffect(()=>{const Re=G({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>D(Re)},[G,D,t]),f.useEffect(()=>{const Re=G({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>D(Re)},[G,D,ue]),f.useEffect(()=>{const Re=G({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(L){oe();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||U()}});return()=>D(Re)},[G,D,U,oe,L]),f.useEffect(()=>{const Re=G({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(V){ke();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||xe()}});return()=>D(Re)},[G,D,xe,ke,V]),f.useEffect(()=>{const Se=[{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(Oe=>G({keys:`g ${Oe.suffix}`,scope:"global",description:Oe.desc,handler:()=>s(Fd(Oe.basePath,o))}));return()=>Se.forEach(D)},[G,D,s,o]),f.useEffect(()=>{const Re=[];for(const[Se,Oe]of Object.entries(_)){if(!Oe)continue;const ze=S.find(_e=>_e.bindableKind===Se),et=ze?`Custom: ${ze.title}`:`Custom: ${Se}`;Re.push(G({keys:Oe,scope:"global",description:et,handler:()=>{K(Se),O(!0)}}))}return()=>Re.forEach(D)},[G,D,_,S]);const le=f.useMemo(()=>({register:G,unregister:D,pushScope:H,popScope:Z,openPalette:U,closePalette:oe,paletteOpen:L,openCheatsheet:ue,closeCheatsheet:re,cheatsheetOpen:A,openActionsPalette:xe,closeActionsPalette:ke,actionsPaletteOpen:V,listBindings:Pe,wsPrefix:o,paletteEntries:b,actionEntries:S,userBindings:q,customBindings:_,bindAction:Ze,unbindAction:ot,findConflict:st,openActionsPaletteWithAction:Xe,pendingActionKind:B,consumePendingActionKind:De}),[G,D,H,Z,U,oe,L,ue,re,A,xe,ke,V,Pe,o,b,S,q,_,Ze,ot,st,Xe,B,De]);return r.jsxs(K1.Provider,{value:le,children:[e,r.jsx($4,{entries:b}),r.jsx(_4,{entries:S}),r.jsx(U4,{})]})}function $o(){const e=f.useContext(K1);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Kt({keys:e,handler:t,scope:n="global",description:s,when:o,enabled:i=!0}){const{register:l,unregister:u}=$o(),d=f.useRef(t),m=f.useRef(o);f.useEffect(()=>{d.current=t,m.current=o},[t,o]),f.useEffect(()=>{if(!i)return;const h=l({keys:e,handler:g=>d.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[l,u,e,n,s,i])}function Lo(e){const{pushScope:t,popScope:n}=$o();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Gc(e,t){const[n,s]=f.useState(e.length===0?-1:0),o=Qn();f.useEffect(()=>{s(e.length===0?-1:0)},[o.pathname]),f.useEffect(()=>{s(l=>e.length===0?-1:Math.min(Math.max(0,l),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const d=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",d===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Kt({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(l=>e.length===0?-1:Math.min(e.length-1,l<0?0:l+1))}),Kt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(l=>e.length===0?-1:Math.max(0,l<0?0:l-1))}),Kt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Kt({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const i=f.useCallback(l=>({"data-hotkey-row-index":l,"data-hotkey-selected":l===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function G4({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const o=un(),{resolvedTheme:i,toggleTheme:l}=Fx(),{openPalette:u}=$o();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(QP,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?r.jsxs("nav",{className:"flex items-center gap-1.5 text-xs font-medium uppercase tracking-[0.1em] text-muted-foreground",children:[t.slice(0,-1).map((d,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Te,{to:d.path,className:"hover:text-foreground",children:d.label})]},d.path)),r.jsx("span",{children:"/"})]}):null,r.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:u,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(Do,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:Ss("Mod+k")})]}),r.jsx(Te,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Te,{className:"shell-action",to:`${o}/create/project`,children:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Te,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}):null,r.jsxs("button",{type:"button",onClick:l,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?r.jsx(l3,{className:"h-4 w-4"}):r.jsx(XP,{className:"h-4 w-4"}),r.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const uf="_ungrouped",Y4=256;function J4(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const s of e){if(typeof s!="string")continue;const o=s.trim();o.length!==0&&(o.length>Y4||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function Q4(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function X4(e,t){return t.includes(e)}const dy={hidden:[],custom:!1};let Vs=null,ra=null,Ec=0;const Mg=new Set;function q1(e){Vs=e;for(const t of Mg)t(e)}function fy(e){if(!e||typeof e!="object")return dy;const t=e;return{hidden:J4(t.hidden),custom:t.custom===!0}}function Z4(){if(Vs)return Promise.resolve({value:Vs,ok:!0});if(ra)return ra;const e=++Ec;return ra=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ra=null;const n=fy(t);return e!==Ec?{value:Vs??n,ok:!0}:(Vs=n,{value:n,ok:!0})}).catch(()=>(ra=null,{value:dy,ok:!1})),ra}function G1(){const[e,t]=f.useState(()=>Vs??dy),[n,s]=f.useState(()=>Vs===null),[o,i]=f.useState(!1),[l,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(Vs===null),Z4().then(h=>{m||(t(h.value),s(!1),i(!h.ok))}),Mg.add(t),()=>{m=!0,Mg.delete(t)}},[l]);function d(){eI(),u(m=>m+1)}return{...e,loading:n,error:o,reload:d}}function eI(){Vs=null,ra=null,++Ec}async function tI(e){++Ec;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=fy(await t.json());return q1(n),n}async function nI(){++Ec;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=fy(await e.json());return q1(t),t}var rI=Symbol("radix.slottable");function sI(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=rI,t}var Y1="AlertDialog",[oI]=va(Y1,[y1]),Js=y1(),J1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Js(t);return r.jsx(L1,{...s,...n,modal:!0})};J1.displayName=Y1;var aI="AlertDialogTrigger",iI=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Js(n);return r.jsx(I1,{...o,...s,ref:t})});iI.displayName=aI;var lI="AlertDialogPortal",Q1=e=>{const{__scopeAlertDialog:t,...n}=e,s=Js(t);return r.jsx(O1,{...s,...n})};Q1.displayName=lI;var cI="AlertDialogOverlay",X1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Js(n);return r.jsx(ey,{...o,...s,ref:t})});X1.displayName=cI;var Ai="AlertDialogContent",[uI,dI]=oI(Ai),fI=sI("AlertDialogContent"),Z1=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,i=Js(n),l=f.useRef(null),u=Vn(t,l),d=f.useRef(null);return r.jsx(_L,{contentName:Ai,titleName:eN,docsSlug:"alert-dialog",children:r.jsx(uI,{scope:n,cancelRef:d,children:r.jsxs(ty,{role:"alertdialog",...i,...o,ref:u,onOpenAutoFocus:Qt(o.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=d.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(fI,{children:s}),r.jsx(mI,{contentRef:l})]})})})});Z1.displayName=Ai;var eN="AlertDialogTitle",tN=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Js(n);return r.jsx(ny,{...o,...s,ref:t})});tN.displayName=eN;var nN="AlertDialogDescription",rN=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Js(n);return r.jsx(ry,{...o,...s,ref:t})});rN.displayName=nN;var pI="AlertDialogAction",sN=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Js(n);return r.jsx(sy,{...o,...s,ref:t})});sN.displayName=pI;var oN="AlertDialogCancel",aN=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=dI(oN,n),i=Js(n),l=Vn(t,o);return r.jsx(sy,{...i,...s,ref:l})});aN.displayName=oN;var mI=({contentRef:e})=>{const t=`\`${Ai}\` requires a description for the component to be accessible for screen reader users.
|
|
561
|
+
|
|
562
|
+
You can add a description to the \`${Ai}\` by passing a \`${nN}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
563
|
+
|
|
564
|
+
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 \`${Ai}\`. 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.
|
|
565
|
+
|
|
566
|
+
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},hI=J1,gI=Q1,iN=X1,lN=Z1,cN=sN,uN=aN,dN=tN,fN=rN;const bi=hI,xI=gI,pN=f.forwardRef(({className:e,...t},n)=>r.jsx(iN,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));pN.displayName=iN.displayName;const la=f.forwardRef(({className:e,...t},n)=>r.jsxs(xI,{children:[r.jsx(pN,{}),r.jsx(lN,{ref:n,className:be("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})]}));la.displayName=lN.displayName;function vi({className:e,...t}){return r.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function wi({className:e,...t}){return r.jsx("div",{className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const ca=f.forwardRef(({className:e,...t},n)=>r.jsx(dN,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));ca.displayName=dN.displayName;const ua=f.forwardRef(({className:e,...t},n)=>r.jsx(fN,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));ua.displayName=fN.displayName;const So=f.forwardRef(({className:e,...t},n)=>r.jsx(cN,{ref:n,className:be(e),...t}));So.displayName=cN.displayName;const Tc=f.forwardRef(({className:e,...t},n)=>r.jsx(uN,{ref:n,className:be(e),...t}));Tc.displayName=uN.displayName;const yI=[{to:"/",label:"Overview",icon:uS},{to:"/playbooks",label:"Playbooks",icon:aS},{to:"/memories",label:"Memories",icon:TP},{to:"/resources",label:"Resources",icon:VP},{to:"/inventories",label:"Inventories",icon:Ff},{to:"/schedules",label:"Schedules",icon:iS},{to:"/usage",label:"Usage",icon:Wc},{to:"/todos",label:"Todos",icon:Fr},{to:"/views",label:"Saved Views",icon:fS},{to:"/archive",label:"Archive",icon:_f}],bI=[{suffix:"/projects",label:"Projects",icon:Ax},{suffix:"/assignments",label:"Assignments",icon:GP},{suffix:"/servers",label:"Servers",icon:Lx},{suffix:"/inventories",label:"Inventories",icon:Ff},{suffix:"/usage",label:"Usage",icon:Wc},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Of},{suffix:"/todos",label:"Todos",icon:Fr}],vI=[{to:"/help",label:"Help",icon:KP},{to:"/workflow",label:"Workflow",icon:d3},{to:"/settings",label:"Settings",icon:a3}];function wI({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:o}){const[i,l]=f.useState(!1);return Kt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>l(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(kj,{activeWorkspace:s})}),i?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Te,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>l(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>l(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx(Hc,{className:"h-4 w-4"})})]}),r.jsx(kj,{activeWorkspace:s,onNavigate:()=>l(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(G4,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>l(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:o})]})]})})}function kj({activeWorkspace:e,onNavigate:t}){const{data:n}=ba(),s=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=G1(),l=Qn(),[u,d]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,C]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(!1),I=_t();function R(F){d(A=>{const z=new Set(A);return z.has(F)?z.delete(F):z.add(F),z})}const P=Q4([...s,...o?[uf]:[]],i);async function $(F){if(w){T(!0);try{const A=`/api/workspaces/${encodeURIComponent(w)}${F?"?cascade=true":""}`,z=await fetch(A,{method:"DELETE"});if(z.status===409){const V=await z.json().catch(()=>({}));E((V==null?void 0:V.blockedBy)??{projects:[],standalones:[]});return}if(!z.ok){const V=await z.json().catch(()=>({}));throw new Error(V.error||"Failed to delete workspace")}v(null),E(null)}catch(A){console.error(A),alert(A instanceof Error?A.message:"Failed to delete workspace")}finally{T(!1)}}}async function L(F,A){try{if(F.type==="project"){const z=await fetch(`/api/projects/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:A})});if(!z.ok){const V=await z.json().catch(()=>({}));throw new Error(V.error||"Failed to move project")}return}if(F.type==="standalone-assignment"){const z=await fetch(`/api/assignments/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:A})});if(!z.ok){const V=await z.json().catch(()=>({}));throw new Error(V.error||"Failed to move assignment")}return}if(F.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(z){console.error(z),alert(z instanceof Error?z.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(Te,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:r.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),r.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),r.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),r.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(Qw,{items:yI,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[P.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),P.map(F=>{const A=F==="_ungrouped",z=A?"Ungrouped":kn(F),V=A?"/w/_ungrouped":`/w/${F}`,O=u.has(F),B=e===F||e===null&&A&&l.pathname.startsWith("/w/_ungrouped"),K=b===F;return r.jsxs("div",{className:`rounded-md transition ${K?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:q=>{q.dataTransfer.types.includes("application/json")&&(q.preventDefault(),q.dataTransfer.dropEffect="move",C(F))},onDragLeave:q=>{q.currentTarget.contains(q.relatedTarget)||C(_=>_===F?null:_)},onDrop:async q=>{try{const _=q.dataTransfer.getData("application/json");if(!_)return;q.preventDefault();let G;try{G=JSON.parse(_)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await L(G,A?null:F)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(F),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${B?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(fr,{className:`h-3 w-3 transition-transform ${O?"-rotate-90":""}`}),z]}),A?null:r.jsx("button",{type:"button",onClick:q=>{q.stopPropagation(),v(F),E(null)},title:`Delete workspace "${F}"`,"aria-label":`Delete workspace "${F}"`,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(yn,{className:"h-3 w-3"})})]}),!O&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:bI.map(q=>{const _=`${V}${q.suffix}`,G=CS(l.pathname,q.suffix)&&l.pathname.startsWith(V),D=q.icon;return r.jsxs(Te,{to:_,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${G?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(D,{className:"h-4 w-4"}),r.jsx("span",{children:q.label})]},_)})})]},F)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:F=>{F.preventDefault();const A=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");A&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:A})}).then(()=>{t==null||t(),I(`/w/${A}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:F=>y(F.target.value),onKeyDown:F=>{F.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(jt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(Qw,{items:vI,onNavigate:t}),r.jsx(bi,{open:w!==null,onOpenChange:F=>{S||F||(v(null),E(null))},children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsx(ca,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(ua,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:w})," 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:w})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(F=>r.jsx("li",{children:r.jsx(Te,{to:`/projects/${F}`,className:"hover:underline",children:F})},F))})]}):null,k.standalones.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",k.standalones.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.standalones.map(F=>r.jsx("li",{children:r.jsx(Te,{to:`/assignments/${F}`,className:"hover:underline",children:F})},F))})]}):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(wi,{children:[r.jsx(Tc,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(So,{disabled:S,onClick:F=>{F.preventDefault(),$(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Clear references and delete"}):r.jsx(So,{disabled:S,onClick:F=>{F.preventDefault(),$(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Delete"})]})]})})]})}function jI(){const e=Qn(),{workspace:t}=Mt(),{title:n,breadcrumbs:s,projectSlug:o}=ES(e.pathname);return r.jsx(wI,{title:n,breadcrumbs:s,projectSlug:o,workspace:t??null,children:r.jsx(FA,{})})}function kI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>s=>{t.forEach(o=>o(s))},t)}const Zf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Zi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function py(e){return"nodeType"in e}function Zn(e){var t,n;return e?Zi(e)?e:py(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function my(e){const{Document:t}=Zn(e);return e instanceof t}function Yc(e){return Zi(e)?!1:e instanceof Zn(e).HTMLElement}function mN(e){return e instanceof Zn(e).SVGElement}function el(e){return e?Zi(e)?e.document:py(e)?my(e)?e:Yc(e)||mN(e)?e.ownerDocument:document:document:document}const ts=Zf?f.useLayoutEffect:f.useEffect;function ep(e){const t=f.useRef(e);return ts(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function SI(){const e=f.useRef(null),t=f.useCallback((s,o)=>{e.current=setInterval(s,o)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Rc(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return ts(()=>{n.current!==e&&(n.current=e)},t),n}function Jc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function df(e){const t=ep(e),n=f.useRef(null),s=f.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,s]}function ff(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let Fh={};function Qc(e,t){return f.useMemo(()=>{if(t)return t;const n=Fh[e]==null?0:Fh[e]+1;return Fh[e]=n,e+"-"+n},[e,t])}function hN(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return s.reduce((i,l)=>{const u=Object.entries(l);for(const[d,m]of u){const h=i[d];h!=null&&(i[d]=h+e*m)}return i},{...t})}}const Pi=hN(1),Ac=hN(-1);function NI(e){return"clientX"in e&&"clientY"in e}function tp(e){if(!e)return!1;const{KeyboardEvent:t}=Zn(e.target);return t&&e instanceof t}function CI(e){if(!e)return!1;const{TouchEvent:t}=Zn(e.target);return t&&e instanceof t}function pf(e){if(CI(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 NI(e)?{x:e.clientX,y:e.clientY}:null}const ns=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[ns.Translate.toString(e),ns.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),Sj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function EI(e){return e.matches(Sj)?e:e.querySelector(Sj)}const TI={display:"none"};function RI(e){let{id:t,value:n}=e;return Dt.createElement("div",{id:t,style:TI},n)}function AI(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Dt.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function PI(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const gN=f.createContext(null);function DI(e){const t=f.useContext(gN);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function $I(){const[e]=f.useState(()=>new Set),t=f.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[f.useCallback(s=>{let{type:o,event:i}=s;e.forEach(l=>{var u;return(u=l[o])==null?void 0:u.call(l,i)})},[e]),t]}const LI={draggable:`
|
|
567
|
+
To pick up a draggable item, press the space bar.
|
|
568
|
+
While dragging, use the arrow keys to move the item.
|
|
569
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
570
|
+
`},II={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 OI(e){let{announcements:t=II,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=LI}=e;const{announce:i,announcement:l}=PI(),u=Qc("DndLiveRegion"),[d,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),DI(f.useMemo(()=>({onDragStart(g){let{active:y}=g;i(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&i(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;i(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;i(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;i(t.onDragCancel({active:y,over:b}))}}),[i,t])),!d)return null;const h=Dt.createElement(Dt.Fragment,null,Dt.createElement(RI,{id:s,value:o.draggable}),Dt.createElement(AI,{id:u,announcement:l}));return n?Hs.createPortal(h,n):h}var Sn;(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"})(Sn||(Sn={}));function mf(){}function To(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function np(){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 rs=Object.freeze({x:0,y:0});function xN(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _I(e,t){const n=pf(e);if(!n)return"0 0";const s={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return s.x+"% "+s.y+"%"}function yN(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function MI(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function Nj(e){let{left:t,top:n,height:s,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+s},{x:t+o,y:n+s}]}function bN(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Cj(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 rp=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=Cj(t,t.left,t.top),i=[];for(const l of s){const{id:u}=l,d=n.get(u);if(d){const m=xN(Cj(d),o);i.push({id:u,data:{droppableContainer:l,value:m}})}}return i.sort(yN)},FI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=Nj(t),i=[];for(const l of s){const{id:u}=l,d=n.get(u);if(d){const m=Nj(d),h=o.reduce((y,b,C)=>y+xN(m[C],b),0),g=Number((h/4).toFixed(4));i.push({id:u,data:{droppableContainer:l,value:g}})}}return i.sort(yN)};function zI(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-s,u=i-n;if(s<o&&n<i){const d=t.width*t.height,m=e.width*e.height,h=l*u,g=h/(d+m-h);return Number(g.toFixed(4))}return 0}const BI=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=[];for(const i of s){const{id:l}=i,u=n.get(l);if(u){const d=zI(u,t);d>0&&o.push({id:l,data:{droppableContainer:i,value:d}})}}return o.sort(MI)};function UI(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function vN(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rs}function WI(e){return function(n){for(var s=arguments.length,o=new Array(s>1?s-1:0),i=1;i<s;i++)o[i-1]=arguments[i];return o.reduce((l,u)=>({...l,top:l.top+e*u.y,bottom:l.bottom+e*u.y,left:l.left+e*u.x,right:l.right+e*u.x}),{...n})}}const HI=WI(1);function wN(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 VI(e,t,n){const s=wN(t);if(!s)return e;const{scaleX:o,scaleY:i,x:l,y:u}=s,d=e.left-l-(1-o)*parseFloat(n),m=e.top-u-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=o?e.width/o:e.width,g=i?e.height/i:e.height;return{width:h,height:g,top:m,right:d+h,bottom:m+g,left:d}}const KI={ignoreTransform:!1};function tl(e,t){t===void 0&&(t=KI);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=Zn(e).getComputedStyle(e);m&&(n=VI(n,m,h))}const{top:s,left:o,width:i,height:l,bottom:u,right:d}=n;return{top:s,left:o,width:i,height:l,bottom:u,right:d}}function Ej(e){return tl(e,{ignoreTransform:!0})}function qI(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function GI(e,t){return t===void 0&&(t=Zn(e).getComputedStyle(e)),t.position==="fixed"}function YI(e,t){t===void 0&&(t=Zn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function sp(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(my(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Yc(o)||mN(o)||n.includes(o))return n;const i=Zn(e).getComputedStyle(o);return o!==e&&YI(o,i)&&n.push(o),GI(o,i)?n:s(o.parentNode)}return e?s(e):n}function jN(e){const[t]=sp(e,1);return t??null}function zh(e){return!Zf||!e?null:Zi(e)?e:py(e)?my(e)||e===el(e).scrollingElement?window:Yc(e)?e:null:null}function kN(e){return Zi(e)?e.scrollX:e.scrollLeft}function SN(e){return Zi(e)?e.scrollY:e.scrollTop}function Fg(e){return{x:kN(e),y:SN(e)}}var $n;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})($n||($n={}));function NN(e){return!Zf||!e?!1:e===document.scrollingElement}function CN(e){const t={x:0,y:0},n=NN(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,l=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:o,isLeft:i,isBottom:l,isRight:u,maxScroll:s,minScroll:t}}const JI={x:.2,y:.2};function QI(e,t,n,s,o){let{top:i,left:l,right:u,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=JI);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=CN(e),b={x:0,y:0},C={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!m&&i<=t.top+w.height?(b.y=$n.Backward,C.y=s*Math.abs((t.top+w.height-i)/w.height)):!h&&d>=t.bottom-w.height&&(b.y=$n.Forward,C.y=s*Math.abs((t.bottom-w.height-d)/w.height)),!y&&u>=t.right-w.width?(b.x=$n.Forward,C.x=s*Math.abs((t.right-w.width-u)/w.width)):!g&&l<=t.left+w.width&&(b.x=$n.Backward,C.x=s*Math.abs((t.left+w.width-l)/w.width)),{direction:b,speed:C}}function XI(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:l}=window;return{top:0,left:0,right:i,bottom:l,width:i,height:l}}const{top:t,left:n,right:s,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:o,width:e.clientWidth,height:e.clientHeight}}function EN(e){return e.reduce((t,n)=>Pi(t,Fg(n)),rs)}function ZI(e){return e.reduce((t,n)=>t+kN(n),0)}function eO(e){return e.reduce((t,n)=>t+SN(n),0)}function TN(e,t){if(t===void 0&&(t=tl),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);jN(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const tO=[["x",["left","right"],ZI],["y",["top","bottom"],eO]];class hy{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=sp(n),o=EN(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,l,u]of tO)for(const d of l)Object.defineProperty(this,d,{get:()=>{const m=u(s),h=o[i]-m;return this.rect[d]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class hc{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var o;(o=this.target)==null||o.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function nO(e){const{EventTarget:t}=Zn(e);return e instanceof t?e:el(e)}function Bh(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 _r;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(_r||(_r={}));function Tj(e){e.preventDefault()}function rO(e){e.stopPropagation()}var vt;(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"})(vt||(vt={}));const RN={start:[vt.Space,vt.Enter],cancel:[vt.Esc],end:[vt.Space,vt.Enter,vt.Tab]},sO=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case vt.Right:return{...n,x:n.x+25};case vt.Left:return{...n,x:n.x-25};case vt.Down:return{...n,y:n.y+25};case vt.Up:return{...n,y:n.y-25}}};class nl{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 hc(el(n)),this.windowListeners=new hc(Zn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(_r.Resize,this.handleCancel),this.windowListeners.add(_r.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(_r.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&TN(s),n(rs)}handleKeyDown(t){if(tp(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=RN,coordinateGetter:l=sO,scrollBehavior:u="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:rs;this.referenceCoordinates||(this.referenceCoordinates=h);const g=l(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=Ac(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const w of C){const v=t.code,{isTop:k,isRight:E,isLeft:S,isBottom:T,maxScroll:I,minScroll:R}=CN(w),P=XI(w),$={x:Math.min(v===vt.Right?P.right-P.width/2:P.right,Math.max(v===vt.Right?P.left:P.left+P.width/2,g.x)),y:Math.min(v===vt.Down?P.bottom-P.height/2:P.bottom,Math.max(v===vt.Down?P.top:P.top+P.height/2,g.y))},L=v===vt.Right&&!E||v===vt.Left&&!S,F=v===vt.Down&&!T||v===vt.Up&&!k;if(L&&$.x!==g.x){const A=w.scrollLeft+y.x,z=v===vt.Right&&A<=I.x||v===vt.Left&&A>=R.x;if(z&&!y.y){w.scrollTo({left:A,behavior:u});return}z?b.x=w.scrollLeft-A:b.x=v===vt.Right?w.scrollLeft-I.x:w.scrollLeft-R.x,b.x&&w.scrollBy({left:-b.x,behavior:u});break}else if(F&&$.y!==g.y){const A=w.scrollTop+y.y,z=v===vt.Down&&A<=I.y||v===vt.Up&&A>=R.y;if(z&&!y.x){w.scrollTo({top:A,behavior:u});return}z?b.y=w.scrollTop-A:b.y=v===vt.Down?w.scrollTop-I.y:w.scrollTop-R.y,b.y&&w.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,Pi(Ac(g,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}nl.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=RN,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(s.start.includes(l)){const u=i.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Rj(e){return!!(e&&"distance"in e)}function Aj(e){return!!(e&&"delay"in e)}class gy{constructor(t,n,s){var o;s===void 0&&(s=nO(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:l}=i;this.props=t,this.events=n,this.document=el(l),this.documentListeners=new hc(this.document),this.listeners=new hc(s),this.windowListeners=new hc(Zn(l)),this.initialCoordinates=(o=pf(i))!=null?o:rs,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(_r.Resize,this.handleCancel),this.windowListeners.add(_r.DragStart,Tj),this.windowListeners.add(_r.VisibilityChange,this.handleCancel),this.windowListeners.add(_r.ContextMenu,Tj),this.documentListeners.add(_r.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Aj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Rj(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(_r.Click,rO,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(_r.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:l,options:{activationConstraint:u}}=i;if(!o)return;const d=(n=pf(t))!=null?n:rs,m=Ac(o,d);if(!s&&u){if(Rj(u)){if(u.tolerance!=null&&Bh(m,u.tolerance))return this.handleCancel();if(Bh(m,u.distance))return this.handleStart()}if(Aj(u)&&Bh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),l(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===vt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const oO={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rl extends gy{constructor(t){const{event:n}=t,s=el(n.target);super(t,oO,s)}}rl.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 aO={move:{name:"mousemove"},end:{name:"mouseup"}};var zg;(function(e){e[e.RightClick=2]="RightClick"})(zg||(zg={}));class iO extends gy{constructor(t){super(t,aO,el(t.event.target))}}iO.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===zg.RightClick?!1:(s==null||s({event:n}),!0)}}];const Uh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class lO extends gy{constructor(t){super(t,Uh)}static setup(){return window.addEventListener(Uh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Uh.move.name,t)};function t(){}}}lO.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:o}=n;return o.length>1?!1:(s==null||s({event:n}),!0)}}];var gc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(gc||(gc={}));var hf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(hf||(hf={}));function cO(e){let{acceleration:t,activator:n=gc.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:l=5,order:u=hf.TreeOrder,pointerCoordinates:d,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=dO({delta:g,disabled:!i}),[C,w]=SI(),v=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case gc.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case gc.DraggableRect:return o}},[n,o,d]),S=f.useRef(null),T=f.useCallback(()=>{const R=S.current;if(!R)return;const P=v.current.x*k.current.x,$=v.current.y*k.current.y;R.scrollBy(P,$)},[]),I=f.useMemo(()=>u===hf.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!i||!m.length||!E){w();return}for(const R of I){if((s==null?void 0:s(R))===!1)continue;const P=m.indexOf(R),$=h[P];if(!$)continue;const{direction:L,speed:F}=QI(R,$,E,t,y);for(const A of["x","y"])b[A][L[A]]||(F[A]=0,L[A]=0);if(F.x>0||F.y>0){w(),S.current=R,C(T,l),v.current=F,k.current=L;return}}v.current={x:0,y:0},k.current={x:0,y:0},w()},[t,T,s,w,i,l,JSON.stringify(E),JSON.stringify(b),C,m,I,h,JSON.stringify(y)])}const uO={x:{[$n.Backward]:!1,[$n.Forward]:!1},y:{[$n.Backward]:!1,[$n.Forward]:!1}};function dO(e){let{delta:t,disabled:n}=e;const s=ff(t);return Jc(o=>{if(n||!s||!o)return uO;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[$n.Backward]:o.x[$n.Backward]||i.x===-1,[$n.Forward]:o.x[$n.Forward]||i.x===1},y:{[$n.Backward]:o.y[$n.Backward]||i.y===-1,[$n.Forward]:o.y[$n.Forward]||i.y===1}}},[n,t,s])}function fO(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Jc(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function pO(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,s)}));return[...n,...i]},[]),[e,t])}var Pc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pc||(Pc={}));var Bg;(function(e){e.Optimized="optimized"})(Bg||(Bg={}));const Pj=new Map;function mO(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,l]=f.useState(null),{frequency:u,measure:d,strategy:m}=o,h=f.useRef(e),g=v(),y=Rc(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&l(E=>E===null?k:E.concat(k.filter(S=>!E.includes(S))))},[y]),C=f.useRef(null),w=Jc(k=>{if(g&&!n)return Pj;if(!k||k===Pj||h.current!==e||i!=null){const E=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){E.set(S.id,S.rect.current);continue}const T=S.node.current,I=T?new hy(d(T),T):null;S.rect.current=I,I&&E.set(S.id,I)}return E}return k},[e,i,n,g,d]);return f.useEffect(()=>{h.current=e},[e]),f.useEffect(()=>{g||b()},[n,g]),f.useEffect(()=>{i&&i.length>0&&l(null)},[JSON.stringify(i)]),f.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:w,measureDroppableContainers:b,measuringScheduled:i!=null};function v(){switch(m){case Pc.Always:return!1;case Pc.BeforeDragging:return n;default:return!n}}}function xy(e,t){return Jc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function hO(e,t){return xy(e,t)}function gO(e){let{callback:t,disabled:n}=e;const s=ep(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return f.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function op(e){let{callback:t,disabled:n}=e;const s=ep(t),o=f.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return f.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function xO(e){return new hy(tl(e),e)}function Dj(e,t,n){t===void 0&&(t=xO);const[s,o]=f.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=d??n)!=null?m:null}const h=t(e);return JSON.stringify(d)===JSON.stringify(h)?d:h})}const l=gO({callback(d){if(e)for(const m of d){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){i();break}}}}),u=op({callback:i});return ts(()=>{i(),e?(u==null||u.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),l==null||l.disconnect())},[e]),s}function yO(e){const t=xy(e);return vN(e,t)}const $j=[];function bO(e){const t=f.useRef(e),n=Jc(s=>e?s&&s!==$j&&e&&t.current&&e.parentNode===t.current.parentNode?s:sp(e):$j,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function vO(e){const[t,n]=f.useState(null),s=f.useRef(e),o=f.useCallback(i=>{const l=zh(i.target);l&&n(u=>u?(u.set(l,Fg(l)),new Map(u)):null)},[]);return f.useEffect(()=>{const i=s.current;if(e!==i){l(i);const u=e.map(d=>{const m=zh(d);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Fg(m)]):null}).filter(d=>d!=null);n(u.length?new Map(u):null),s.current=e}return()=>{l(e),l(i)};function l(u){u.forEach(d=>{const m=zh(d);m==null||m.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,l)=>Pi(i,l),rs):EN(e):rs,[e,t])}function Lj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==rs;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?Ac(e,n.current):rs}function wO(e){f.useEffect(()=>{if(!Zf)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 jO(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=l=>{i(l,t)},n},{}),[e,t])}function AN(e){return f.useMemo(()=>e?qI(e):null,[e])}const Ij=[];function kO(e,t){t===void 0&&(t=tl);const[n]=e,s=AN(n?Zn(n):null),[o,i]=f.useState(Ij);function l(){i(()=>e.length?e.map(d=>NN(d)?s:new hy(t(d),d)):Ij)}const u=op({callback:l});return ts(()=>{u==null||u.disconnect(),l(),e.forEach(d=>u==null?void 0:u.observe(d))},[e]),o}function PN(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Yc(t)?t:e}function SO(e){let{measure:t}=e;const[n,s]=f.useState(null),o=f.useCallback(m=>{for(const{target:h}of m)if(Yc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),i=op({callback:o}),l=f.useCallback(m=>{const h=PN(m);i==null||i.disconnect(),h&&(i==null||i.observe(h)),s(h?t(h):null)},[t,i]),[u,d]=df(l);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:d}),[n,u,d])}const NO=[{sensor:rl,options:{}},{sensor:nl,options:{}}],CO={current:{}},Kd={draggable:{measure:Ej},droppable:{measure:Ej,strategy:Pc.WhileDragging,frequency:Bg.Optimized},dragOverlay:{measure:tl}};class xc 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 EO={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new xc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Kd,measureDroppableContainers:mf,windowRect:null,measuringScheduled:!1},DN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mf,draggableNodes:new Map,over:null,measureDroppableContainers:mf},Xc=f.createContext(DN),$N=f.createContext(EO);function TO(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new xc}}}function RO(e,t){switch(t.type){case Sn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Sn.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 Sn.DragEnd:case Sn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Sn.RegisterDroppable:{const{element:n}=t,{id:s}=n,o=new xc(e.droppable.containers);return o.set(s,n),{...e,droppable:{...e.droppable,containers:o}}}case Sn.SetDroppableDisabled:{const{id:n,key:s,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const l=new xc(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case Sn.UnregisterDroppable:{const{id:n,key:s}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new xc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function AO(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=f.useContext(Xc),i=ff(s),l=ff(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&i&&l!=null){if(!tp(i)||document.activeElement===i.target)return;const u=o.get(l);if(!u)return;const{activatorNode:d,node:m}=u;if(!d.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[d.current,m.current]){if(!h)continue;const g=EI(h);if(g){g.focus();break}}})}},[s,t,o,l,i]),null}function LN(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function PO(e){return f.useMemo(()=>({draggable:{...Kd.draggable,...e==null?void 0:e.draggable},droppable:{...Kd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Kd.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 DO(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=f.useRef(!1),{x:l,y:u}=typeof o=="boolean"?{x:o,y:o}:o;ts(()=>{if(!l&&!u||!t){i.current=!1;return}if(i.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=vN(h,s);if(l||(g.x=0),u||(g.y=0),i.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=jN(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,l,u,s,n])}const ap=f.createContext({...rs,scaleX:1,scaleY:1});var ko;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ko||(ko={}));const ip=f.memo(function(t){var n,s,o,i;let{id:l,accessibility:u,autoScroll:d=!0,children:m,sensors:h=NO,collisionDetection:g=BI,measuring:y,modifiers:b,...C}=t;const w=f.useReducer(RO,void 0,TO),[v,k]=w,[E,S]=$I(),[T,I]=f.useState(ko.Uninitialized),R=T===ko.Initialized,{draggable:{active:P,nodes:$,translate:L},droppable:{containers:F}}=v,A=P!=null?$.get(P):null,z=f.useRef({initial:null,translated:null}),V=f.useMemo(()=>{var me;return P!=null?{id:P,data:(me=A==null?void 0:A.data)!=null?me:CO,rect:z}:null},[P,A]),O=f.useRef(null),[B,K]=f.useState(null),[q,_]=f.useState(null),G=Rc(C,Object.values(C)),D=Qc("DndDescribedBy",l),H=f.useMemo(()=>F.getEnabled(),[F]),Z=PO(y),{droppableRects:U,measureDroppableContainers:oe,measuringScheduled:ue}=mO(H,{dragging:R,dependencies:[L.x,L.y],config:Z.droppable}),re=fO($,P),xe=f.useMemo(()=>q?pf(q):null,[q]),ke=at(),Pe=hO(re,Z.draggable.measure);DO({activeNode:P!=null?$.get(P):null,config:ke.layoutShiftCompensation,initialRect:Pe,measure:Z.draggable.measure});const De=Dj(re,Z.draggable.measure,Pe),Xe=Dj(re?re.parentElement:null),st=f.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:U,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ze=F.getNodeFor((n=st.current.over)==null?void 0:n.id),ot=SO({measure:Z.dragOverlay.measure}),le=(s=ot.nodeRef.current)!=null?s:re,Re=R?(o=ot.rect)!=null?o:De:null,Se=!!(ot.nodeRef.current&&ot.rect),Oe=yO(Se?null:De),ze=AN(le?Zn(le):null),et=bO(R?Ze??re:null),_e=kO(et),qe=LN(b,{transform:{x:L.x-Oe.x,y:L.y-Oe.y,scaleX:1,scaleY:1},activatorEvent:q,active:V,activeNodeRect:De,containerNodeRect:Xe,draggingNodeRect:Re,over:st.current.over,overlayNodeRect:ot.rect,scrollableAncestors:et,scrollableAncestorRects:_e,windowRect:ze}),Lt=xe?Pi(xe,L):null,bt=vO(et),ut=Lj(bt),ae=Lj(bt,[De]),X=Pi(qe,ut),he=Re?HI(Re,qe):null,ne=V&&he?g({active:V,collisionRect:he,droppableRects:U,droppableContainers:H,pointerCoordinates:Lt}):null,ye=bN(ne,"id"),[Ee,ve]=f.useState(null),ee=Se?qe:Pi(qe,ae),fe=UI(ee,(i=Ee==null?void 0:Ee.rect)!=null?i:null,De),Ne=f.useRef(null),He=f.useCallback((me,Me)=>{let{sensor:Ye,options:It}=Me;if(O.current==null)return;const Xt=$.get(O.current);if(!Xt)return;const dn=me.nativeEvent,Gt=new Ye({active:O.current,activeNode:Xt,event:dn,options:It,context:st,onAbort(Et){if(!$.get(Et))return;const{onDragAbort:Tt}=G.current,se={id:Et};Tt==null||Tt(se),E({type:"onDragAbort",event:se})},onPending(Et,Fn,Tt,se){if(!$.get(Et))return;const{onDragPending:tt}=G.current,yt={id:Et,constraint:Fn,initialCoordinates:Tt,offset:se};tt==null||tt(yt),E({type:"onDragPending",event:yt})},onStart(Et){const Fn=O.current;if(Fn==null)return;const Tt=$.get(Fn);if(!Tt)return;const{onDragStart:se}=G.current,Be={activatorEvent:dn,active:{id:Fn,data:Tt.data,rect:z}};Hs.unstable_batchedUpdates(()=>{se==null||se(Be),I(ko.Initializing),k({type:Sn.DragStart,initialCoordinates:Et,active:Fn}),E({type:"onDragStart",event:Be}),K(Ne.current),_(dn)})},onMove(Et){k({type:Sn.DragMove,coordinates:Et})},onEnd:qn(Sn.DragEnd),onCancel:qn(Sn.DragCancel)});Ne.current=Gt;function qn(Et){return async function(){const{active:Tt,collisions:se,over:Be,scrollAdjustedTranslate:tt}=st.current;let yt=null;if(Tt&&tt){const{cancelDrop:er}=G.current;yt={activatorEvent:dn,active:Tt,collisions:se,delta:tt,over:Be},Et===Sn.DragEnd&&typeof er=="function"&&await Promise.resolve(er(yt))&&(Et=Sn.DragCancel)}O.current=null,Hs.unstable_batchedUpdates(()=>{k({type:Et}),I(ko.Uninitialized),ve(null),K(null),_(null),Ne.current=null;const er=Et===Sn.DragEnd?"onDragEnd":"onDragCancel";if(yt){const Kr=G.current[er];Kr==null||Kr(yt),E({type:er,event:yt})}})}}},[$]),ce=f.useCallback((me,Me)=>(Ye,It)=>{const Xt=Ye.nativeEvent,dn=$.get(It);if(O.current!==null||!dn||Xt.dndKit||Xt.defaultPrevented)return;const Gt={active:dn};me(Ye,Me.options,Gt)===!0&&(Xt.dndKit={capturedBy:Me.sensor},O.current=It,He(Ye,Me))},[$,He]),pt=pO(h,ce);wO(h),ts(()=>{De&&T===ko.Initializing&&I(ko.Initialized)},[De,T]),f.useEffect(()=>{const{onDragMove:me}=G.current,{active:Me,activatorEvent:Ye,collisions:It,over:Xt}=st.current;if(!Me||!Ye)return;const dn={active:Me,activatorEvent:Ye,collisions:It,delta:{x:X.x,y:X.y},over:Xt};Hs.unstable_batchedUpdates(()=>{me==null||me(dn),E({type:"onDragMove",event:dn})})},[X.x,X.y]),f.useEffect(()=>{const{active:me,activatorEvent:Me,collisions:Ye,droppableContainers:It,scrollAdjustedTranslate:Xt}=st.current;if(!me||O.current==null||!Me||!Xt)return;const{onDragOver:dn}=G.current,Gt=It.get(ye),qn=Gt&&Gt.rect.current?{id:Gt.id,rect:Gt.rect.current,data:Gt.data,disabled:Gt.disabled}:null,Et={active:me,activatorEvent:Me,collisions:Ye,delta:{x:Xt.x,y:Xt.y},over:qn};Hs.unstable_batchedUpdates(()=>{ve(qn),dn==null||dn(Et),E({type:"onDragOver",event:Et})})},[ye]),ts(()=>{st.current={activatorEvent:q,active:V,activeNode:re,collisionRect:he,collisions:ne,droppableRects:U,draggableNodes:$,draggingNode:le,draggingNodeRect:Re,droppableContainers:F,over:Ee,scrollableAncestors:et,scrollAdjustedTranslate:X},z.current={initial:Re,translated:he}},[V,re,ne,he,$,le,Re,U,F,Ee,et,X]),cO({...ke,delta:L,draggingRect:he,pointerCoordinates:Lt,scrollableAncestors:et,scrollableAncestorRects:_e});const xt=f.useMemo(()=>({active:V,activeNode:re,activeNodeRect:De,activatorEvent:q,collisions:ne,containerNodeRect:Xe,dragOverlay:ot,draggableNodes:$,droppableContainers:F,droppableRects:U,over:Ee,measureDroppableContainers:oe,scrollableAncestors:et,scrollableAncestorRects:_e,measuringConfiguration:Z,measuringScheduled:ue,windowRect:ze}),[V,re,De,q,ne,Xe,ot,$,F,U,Ee,oe,et,_e,Z,ue,ze]),St=f.useMemo(()=>({activatorEvent:q,activators:pt,active:V,activeNodeRect:De,ariaDescribedById:{draggable:D},dispatch:k,draggableNodes:$,over:Ee,measureDroppableContainers:oe}),[q,pt,V,De,k,D,$,Ee,oe]);return Dt.createElement(gN.Provider,{value:S},Dt.createElement(Xc.Provider,{value:St},Dt.createElement($N.Provider,{value:xt},Dt.createElement(ap.Provider,{value:fe},m)),Dt.createElement(AO,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Dt.createElement(OI,{...u,hiddenTextDescribedById:D}));function at(){const me=(B==null?void 0:B.autoScrollEnabled)===!1,Me=typeof d=="object"?d.enabled===!1:d===!1,Ye=R&&!me&&!Me;return typeof d=="object"?{...d,enabled:Ye}:{enabled:Ye}}}),$O=f.createContext(null),Oj="button",LO="Draggable";function IO(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Qc(LO),{activators:l,activatorEvent:u,active:d,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(Xc),{role:b=Oj,roleDescription:C="draggable",tabIndex:w=0}=o??{},v=(d==null?void 0:d.id)===t,k=f.useContext(v?ap:$O),[E,S]=df(),[T,I]=df(),R=jO(l,t),P=Rc(n);ts(()=>(g.set(t,{id:t,key:i,node:E,activatorNode:T,data:P}),()=>{const L=g.get(t);L&&L.key===i&&g.delete(t)}),[g,t]);const $=f.useMemo(()=>({role:b,tabIndex:w,"aria-disabled":s,"aria-pressed":v&&b===Oj?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,w,v,C,h.draggable]);return{active:d,activatorEvent:u,activeNodeRect:m,attributes:$,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:S,setActivatorNodeRef:I,transform:k}}function IN(){return f.useContext($N)}const OO="Droppable",_O={timeout:25};function MO(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Qc(OO),{active:l,dispatch:u,over:d,measureDroppableContainers:m}=f.useContext(Xc),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:C,updateMeasurementsFor:w,timeout:v}={..._O,...o},k=Rc(w??s),E=f.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},v)},[v]),S=op({callback:E,disabled:C||!l}),T=f.useCallback(($,L)=>{S&&(L&&(S.unobserve(L),g.current=!1),$&&S.observe($))},[S]),[I,R]=df(T),P=Rc(t);return f.useEffect(()=>{!S||!I.current||(S.disconnect(),g.current=!1,S.observe(I.current))},[I,S]),f.useEffect(()=>(u({type:Sn.RegisterDroppable,element:{id:s,key:i,disabled:n,node:I,rect:y,data:P}}),()=>u({type:Sn.UnregisterDroppable,key:i,id:s})),[s]),f.useEffect(()=>{n!==h.current.disabled&&(u({type:Sn.SetDroppableDisabled,id:s,key:i,disabled:n}),h.current.disabled=n)},[s,i,n,u]),{active:l,rect:y,isOver:(d==null?void 0:d.id)===s,node:I,over:d,setNodeRef:R}}function FO(e){let{animation:t,children:n}=e;const[s,o]=f.useState(null),[i,l]=f.useState(null),u=ff(n);return!n&&!s&&u&&o(u),ts(()=>{if(!i)return;const d=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(d==null||m==null){o(null);return}Promise.resolve(t(m,i)).then(()=>{o(null)})},[t,s,i]),Dt.createElement(Dt.Fragment,null,n,s?f.cloneElement(s,{ref:l}):null)}const zO={x:0,y:0,scaleX:1,scaleY:1};function BO(e){let{children:t}=e;return Dt.createElement(Xc.Provider,{value:DN},Dt.createElement(ap.Provider,{value:zO},t))}const UO={position:"fixed",touchAction:"none"},WO=e=>tp(e)?"transform 250ms ease":void 0,HO=f.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:o,children:i,className:l,rect:u,style:d,transform:m,transition:h=WO}=e;if(!u)return null;const g=o?m:{...m,scaleX:1,scaleY:1},y={...UO,width:u.width,height:u.height,top:u.top,left:u.left,transform:ns.Transform.toString(g),transformOrigin:o&&s?_I(s,u):void 0,transition:typeof h=="function"?h(s):h,...d};return Dt.createElement(n,{className:l,style:y,ref:t},i)}),VO=e=>t=>{let{active:n,dragOverlay:s}=t;const o={},{styles:i,className:l}=e;if(i!=null&&i.active)for(const[u,d]of Object.entries(i.active))d!==void 0&&(o[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,d));if(i!=null&&i.dragOverlay)for(const[u,d]of Object.entries(i.dragOverlay))d!==void 0&&s.node.style.setProperty(u,d);return l!=null&&l.active&&n.node.classList.add(l.active),l!=null&&l.dragOverlay&&s.node.classList.add(l.dragOverlay),function(){for(const[d,m]of Object.entries(o))n.node.style.setProperty(d,m);l!=null&&l.active&&n.node.classList.remove(l.active)}},KO=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:ns.Transform.toString(t)},{transform:ns.Transform.toString(n)}]},qO={duration:250,easing:"ease",keyframes:KO,sideEffects:VO({styles:{active:{opacity:"0"}}})};function GO(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:o}=e;return ep((i,l)=>{if(t===null)return;const u=n.get(i);if(!u)return;const d=u.node.current;if(!d)return;const m=PN(l);if(!m)return;const{transform:h}=Zn(l).getComputedStyle(l),g=wN(h);if(!g)return;const y=typeof t=="function"?t:YO(t);return TN(d,o.draggable.measure),y({active:{id:i,data:u.data,node:d,rect:o.draggable.measure(d)},draggableNodes:n,dragOverlay:{node:l,rect:o.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:o,transform:g})})}function YO(e){const{duration:t,easing:n,sideEffects:s,keyframes:o}={...qO,...e};return i=>{let{active:l,dragOverlay:u,transform:d,...m}=i;if(!t)return;const h={x:u.rect.left-l.rect.left,y:u.rect.top-l.rect.top},g={scaleX:d.scaleX!==1?l.rect.width*d.scaleX/u.rect.width:1,scaleY:d.scaleY!==1?l.rect.height*d.scaleY/u.rect.height:1},y={x:d.x-h.x,y:d.y-h.y,...g},b=o({...m,active:l,dragOverlay:u,transform:{initial:d,final:y}}),[C]=b,w=b[b.length-1];if(JSON.stringify(C)===JSON.stringify(w))return;const v=s==null?void 0:s({active:l,dragOverlay:u,...m}),k=u.node.animate(b,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{v==null||v(),E()}})}}let _j=0;function JO(e){return f.useMemo(()=>{if(e!=null)return _j++,_j},[e])}const QO=Dt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:o,transition:i,modifiers:l,wrapperElement:u="div",className:d,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggableNodes:C,droppableContainers:w,dragOverlay:v,over:k,measuringConfiguration:E,scrollableAncestors:S,scrollableAncestorRects:T,windowRect:I}=IN(),R=f.useContext(ap),P=JO(g==null?void 0:g.id),$=LN(l,{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:T,transform:R,windowRect:I}),L=xy(y),F=GO({config:s,draggableNodes:C,droppableContainers:w,measuringConfiguration:E}),A=L?v.setRef:void 0;return Dt.createElement(BO,null,Dt.createElement(FO,{animation:F},g&&P?Dt.createElement(HO,{key:P,id:g.id,ref:A,as:u,activatorEvent:h,adjustScale:t,className:d,transition:i,rect:L,style:{zIndex:m,...o},transform:$},n):null))});function sl(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function XO(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function kd(e){return e!==null&&e>=0}function ZO(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 e5(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const yy=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=sl(t,s,n),l=t[o],u=i[o];return!u||!l?null:{x:u.left-l.left,y:u.top-l.top,scaleX:u.width/l.width,scaleY:u.height/l.height}},Sd={scaleX:1,scaleY:1},by=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:o,rects:i,overIndex:l}=e;const u=(t=i[n])!=null?t:s;if(!u)return null;if(o===n){const m=i[l];return m?{x:0,y:n<l?m.top+m.height-(u.top+u.height):m.top-u.top,...Sd}:null}const d=t5(i,o,n);return o>n&&o<=l?{x:0,y:-u.height-d,...Sd}:o<n&&o>=l?{x:0,y:u.height+d,...Sd}:{x:0,y:0,...Sd}};function t5(e,t,n){const s=e[t],o=e[t-1],i=e[t+1];return s?n<t?o?s.top-(o.top+o.height):i?i.top-(s.top+s.height):0:i?i.top-(s.top+s.height):o?s.top-(o.top+o.height):0:0}const ON="Sortable",_N=Dt.createContext({activeIndex:-1,containerId:ON,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:yy,disabled:{draggable:!1,droppable:!1}});function lp(e){let{children:t,id:n,items:s,strategy:o=yy,disabled:i=!1}=e;const{active:l,dragOverlay:u,droppableRects:d,over:m,measureDroppableContainers:h}=IN(),g=Qc(ON,n),y=u.rect!==null,b=f.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),C=l!=null,w=l?b.indexOf(l.id):-1,v=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!ZO(b,k.current),S=v!==-1&&w===-1||E,T=e5(i);ts(()=>{E&&C&&h(b)},[E,b,C,h]),f.useEffect(()=>{k.current=b},[b]);const I=f.useMemo(()=>({activeIndex:w,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:v,useDragOverlay:y,sortedRects:XO(b,d),strategy:o}),[w,g,T.draggable,T.droppable,S,b,v,d,y,o]);return Dt.createElement(_N.Provider,{value:I},t)}const n5=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return sl(n,s,o).indexOf(t)},r5=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:l,previousItems:u,previousContainerId:d,transition:m}=e;return!m||!s||u!==i&&o===l?!1:n?!0:l!==o&&t===d},s5={duration:200,easing:"ease"},MN="transform",o5=ns.Transition.toString({property:MN,duration:0,easing:"linear"}),a5={roleDescription:"sortable"};function i5(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,l]=f.useState(null),u=f.useRef(n);return ts(()=>{if(!t&&n!==u.current&&s.current){const d=o.current;if(d){const m=tl(s.current,{ignoreTransform:!0}),h={x:d.left-m.left,y:d.top-m.top,scaleX:d.width/m.width,scaleY:d.height/m.height};(h.x||h.y)&&l(h)}}n!==u.current&&(u.current=n)},[t,n,s,o]),f.useEffect(()=>{i&&l(null)},[i]),i}function cp(e){let{animateLayoutChanges:t=r5,attributes:n,disabled:s,data:o,getNewIndex:i=n5,id:l,strategy:u,resizeObserverConfig:d,transition:m=s5}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:w,overIndex:v,useDragOverlay:k,strategy:E}=f.useContext(_N),S=l5(s,b),T=h.indexOf(l),I=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...o}),[g,o,T,h]),R=f.useMemo(()=>h.slice(h.indexOf(l)),[h,l]),{rect:P,node:$,isOver:L,setNodeRef:F}=MO({id:l,data:I,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:A,activatorEvent:z,activeNodeRect:V,attributes:O,setNodeRef:B,listeners:K,isDragging:q,over:_,setActivatorNodeRef:G,transform:D}=IO({id:l,data:I,attributes:{...a5,...n},disabled:S.draggable}),H=kI(F,B),Z=!!A,U=Z&&!C&&kd(y)&&kd(v),oe=!k&&q,ue=oe&&U?D:null,xe=U?ue??(u??E)({rects:w,activeNodeRect:V,activeIndex:y,overIndex:v,index:T}):null,ke=kd(y)&&kd(v)?i({id:l,items:h,activeIndex:y,overIndex:v}):T,Pe=A==null?void 0:A.id,De=f.useRef({activeId:Pe,items:h,newIndex:ke,containerId:g}),Xe=h!==De.current.items,st=t({active:A,containerId:g,isDragging:q,isSorting:Z,id:l,index:T,items:h,newIndex:De.current.newIndex,previousItems:De.current.items,previousContainerId:De.current.containerId,transition:m,wasDragging:De.current.activeId!=null}),Ze=i5({disabled:!st,index:T,node:$,rect:P});return f.useEffect(()=>{Z&&De.current.newIndex!==ke&&(De.current.newIndex=ke),g!==De.current.containerId&&(De.current.containerId=g),h!==De.current.items&&(De.current.items=h)},[Z,ke,g,h]),f.useEffect(()=>{if(Pe===De.current.activeId)return;if(Pe!=null&&De.current.activeId==null){De.current.activeId=Pe;return}const le=setTimeout(()=>{De.current.activeId=Pe},50);return()=>clearTimeout(le)},[Pe]),{active:A,activeIndex:y,attributes:O,data:I,rect:P,index:T,newIndex:ke,items:h,isOver:L,isSorting:Z,isDragging:q,listeners:K,node:$,overIndex:v,over:_,setNodeRef:H,setActivatorNodeRef:G,setDroppableNodeRef:F,setDraggableNodeRef:B,transform:Ze??xe,transition:ot()};function ot(){if(Ze||Xe&&De.current.newIndex===T)return o5;if(!(oe&&!tp(z)||!m)&&(Z||st))return ns.Transition.toString({...m,property:MN})}}function l5(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 gf(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 c5=[vt.Down,vt.Right,vt.Up,vt.Left],FN=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:o,droppableContainers:i,over:l,scrollableAncestors:u}}=t;if(c5.includes(e.code)){if(e.preventDefault(),!n||!s)return;const d=[];i.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=o.get(g.id);if(y)switch(e.code){case vt.Down:s.top<y.top&&d.push(g);break;case vt.Up:s.top>y.top&&d.push(g);break;case vt.Left:s.left>y.left&&d.push(g);break;case vt.Right:s.left<y.left&&d.push(g);break}});const m=FI({collisionRect:s,droppableRects:o,droppableContainers:d});let h=bN(m,"id");if(h===(l==null?void 0:l.id)&&m.length>1&&(h=m[1].id),h!=null){const g=i.get(n.id),y=i.get(h),b=y?o.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const v=sp(C).some((R,P)=>u[P]!==R),k=zN(g,y),E=u5(g,y),S=v||!k?{x:0,y:0}:{x:E?s.width-b.width:0,y:E?s.height-b.height:0},T={x:b.left,y:b.top};return S.x&&S.y?T:Ac(T,S)}}}};function zN(e,t){return!gf(e)||!gf(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function u5(e,t){return!gf(e)||!gf(t)||!zN(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}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 kt({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 qd({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:o}){return r.jsxs("section",{className:be("surface-panel space-y-3",s),children:[e||o?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function d5({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(Te,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,o)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(qd,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const Wh={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."},pa={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 f5(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function p5({hero:e,itemsById:t}){const n=un();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:pa.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:Wh.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(Te,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:pa.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,o=(s==null?void 0:s.assignmentTitle)??"",i=Wh[e.copyKey]??Wh[e.kind],l=f5(i,{total:e.total,title:o}),u=s?m5(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:l}),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(Te,{to:u,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function m5(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Hh=["title","status","priority","assignee","dependencies","created","updated"],Dc=24,BN=60;function h5(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=Dc&&Number.isInteger(t.h)&&t.h>=1&&t.h<=BN}const g5={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Mj="2026-05-21T00:00:00Z";function Vh(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...g5,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Mj,updatedAt:Mj}}const No={version:1,views:[Vh("default-recently-updated","Recently updated",{}),Vh("default-high-priority","High priority",{priority:"high"}),Vh("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 UN(e,t){const n=Fe(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,l=e.filters.query,u=typeof l=="string"&&l.trim().length>0&&fc(l)===null;return s&&(!o||o==="all")&&!i&&!u}function WN(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?UN(e.config,t.slug):!1}}const HN=`syntaur.savedViews.cache.v${No.version}`;let Di=x5(),sa=null,vy=null;const Ug=new Set,xf=new Set;let VN=0;function KN(){return++VN}function Wg(e){return e===VN}function x5(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(HN);if(!e)return null;const t=JSON.parse(e);return t.version!==No.version?null:t}catch{return null}}function y5(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(HN,JSON.stringify(e))}catch{}}function qN(e){Di=e,vy=null,y5(e);for(const t of Ug)t(e);for(const t of xf)t(null)}function b5(e){vy=e;for(const t of xf)t(e)}function GN(e){if(!e||typeof e!="object")return No;const t=e;return t.version!==No.version||!Array.isArray(t.views)||!t.dashboard?No:t}function Fj(){if(sa)return sa;const e=KN();return sa=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=GN(t);return Wg(e)&&qN(n),sa=null,Di??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Wg(e)&&b5(n),sa=null,Di??No}),sa}function wy(){const[e,t]=f.useState(()=>Di??No),[n,s]=f.useState(()=>Di===null),[o,i]=f.useState(!1),[l,u]=f.useState(()=>vy);return f.useEffect(()=>{let m=!1;Di===null&&s(!0),Fj().then(y=>{m||(t(y),s(!1),i(!0))});const h=y=>{m||(t(y),s(!1),i(!0),u(null))},g=y=>{m||(u(y),s(!1),i(!0))};return Ug.add(h),xf.add(g),()=>{m=!0,Ug.delete(h),xf.delete(g)}},[]),{file:e,loading:n,ready:o,error:l,refetch:()=>{sa=null,s(!0),u(null),i(!1),Fj()}}}function Zc(){const{file:e,loading:t}=wy();return{views:e.views,loading:t}}function YN(){const{file:e,loading:t}=wy();return{layout:e.dashboard,loading:t}}function Ro(e){const{file:t,loading:n,ready:s,error:o,refetch:i}=wy();return e?{view:t.views.find(u=>u.id===e)??null,loading:n,ready:s,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function up(e,t,n){const s=KN(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const l=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(l.error??`HTTP ${o.status}`)}const i=GN(await o.json());return Wg(s)&&qN(i),i}function Bi(e){return up("POST","/api/saved-views",e)}function yf(e,t){return up("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function v5(e){return up("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Hg(e){return up("PUT","/api/dashboard",{slots:e})}const w5=["top","right","bottom","left"],Ao=Math.min,kr=Math.max,bf=Math.round,Nd=Math.floor,Ns=e=>({x:e,y:e}),j5={left:"right",right:"left",bottom:"top",top:"bottom"};function Vg(e,t,n){return kr(e,Ao(t,n))}function Gs(e,t){return typeof e=="function"?e(t):e}function Ys(e){return e.split("-")[0]}function ol(e){return e.split("-")[1]}function jy(e){return e==="x"?"y":"x"}function ky(e){return e==="y"?"height":"width"}function js(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Sy(e){return jy(js(e))}function k5(e,t,n){n===void 0&&(n=!1);const s=ol(e),o=Sy(e),i=ky(o);let l=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=vf(l)),[l,vf(l)]}function S5(e){const t=vf(e);return[Kg(e),t,Kg(t)]}function Kg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const zj=["left","right"],Bj=["right","left"],N5=["top","bottom"],C5=["bottom","top"];function E5(e,t,n){switch(e){case"top":case"bottom":return n?t?Bj:zj:t?zj:Bj;case"left":case"right":return t?N5:C5;default:return[]}}function T5(e,t,n,s){const o=ol(e);let i=E5(Ys(e),n==="start",s);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Kg)))),i}function vf(e){const t=Ys(e);return j5[t]+e.slice(t.length)}function R5(e){return{top:0,right:0,bottom:0,left:0,...e}}function JN(e){return typeof e!="number"?R5(e):{top:e,right:e,bottom:e,left:e}}function wf(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Uj(e,t,n){let{reference:s,floating:o}=e;const i=js(t),l=Sy(t),u=ky(l),d=Ys(t),m=i==="y",h=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,y=s[u]/2-o[u]/2;let b;switch(d){case"top":b={x:h,y:s.y-o.height};break;case"bottom":b={x:h,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y:g};break;case"left":b={x:s.x-o.width,y:g};break;default:b={x:s.x,y:s.y}}switch(ol(t)){case"start":b[l]-=y*(n&&m?-1:1);break;case"end":b[l]+=y*(n&&m?-1:1);break}return b}async function A5(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:l,elements:u,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Gs(t,e),C=JN(b),v=u[y?g==="floating"?"reference":"floating":g],k=wf(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:d})),E=g==="floating"?{x:s,y:o,width:l.floating.width,height:l.floating.height}:l.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},I=wf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:S,strategy:d}):E);return{top:(k.top-I.top+C.top)/T.y,bottom:(I.bottom-k.bottom+C.bottom)/T.y,left:(k.left-I.left+C.left)/T.x,right:(I.right-k.right+C.right)/T.x}}const P5=50,D5=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:A5},d=await(l.isRTL==null?void 0:l.isRTL(t));let m=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:g}=Uj(m,s,d),y=s,b=0;const C={};for(let w=0;w<i.length;w++){const v=i[w];if(!v)continue;const{name:k,fn:E}=v,{x:S,y:T,data:I,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:o,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=S??h,g=T??g,C[k]={...C[k],...I},R&&b<P5&&(b++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(m=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:h,y:g}=Uj(m,y,d)),w=-1)}return{x:h,y:g,placement:y,strategy:o,middlewareData:C}},$5=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:l,elements:u,middlewareData:d}=t,{element:m,padding:h=0}=Gs(e,t)||{};if(m==null)return{};const g=JN(h),y={x:n,y:s},b=Sy(o),C=ky(b),w=await l.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",S=v?"clientHeight":"clientWidth",T=i.reference[C]+i.reference[b]-y[b]-i.floating[C],I=y[b]-i.reference[b],R=await(l.getOffsetParent==null?void 0:l.getOffsetParent(m));let P=R?R[S]:0;(!P||!await(l.isElement==null?void 0:l.isElement(R)))&&(P=u.floating[S]||i.floating[C]);const $=T/2-I/2,L=P/2-w[C]/2-1,F=Ao(g[k],L),A=Ao(g[E],L),z=F,V=P-w[C]-A,O=P/2-w[C]/2+$,B=Vg(z,O,V),K=!d.arrow&&ol(o)!=null&&O!==B&&i.reference[C]/2-(O<z?F:A)-w[C]/2<0,q=K?O<z?O-z:O-V:0;return{[b]:y[b]+q,data:{[b]:B,centerOffset:O-B-q,...K&&{alignmentOffset:q}},reset:K}}}),L5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:l,initialPlacement:u,platform:d,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:w=!0,...v}=Gs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Ys(o),E=js(u),S=Ys(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(m.floating)),I=y||(S||!w?[vf(u)]:S5(u)),R=C!=="none";!y&&R&&I.push(...T5(u,w,C,T));const P=[u,...I],$=await d.detectOverflow(t,v),L=[];let F=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&L.push($[k]),g){const O=k5(o,l,T);L.push($[O[0]],$[O[1]])}if(F=[...F,{placement:o,overflows:L}],!L.every(O=>O<=0)){var A,z;const O=(((A=i.flip)==null?void 0:A.index)||0)+1,B=P[O];if(B&&(!(g==="alignment"?E!==js(B):!1)||F.every(_=>js(_.placement)===E?_.overflows[0]>0:!0)))return{data:{index:O,overflows:F},reset:{placement:B}};let K=(z=F.filter(q=>q.overflows[0]<=0).sort((q,_)=>q.overflows[1]-_.overflows[1])[0])==null?void 0:z.placement;if(!K)switch(b){case"bestFit":{var V;const q=(V=F.filter(_=>{if(R){const G=js(_.placement);return G===E||G==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(G=>G>0).reduce((G,D)=>G+D,0)]).sort((_,G)=>_[1]-G[1])[0])==null?void 0:V[0];q&&(K=q);break}case"initialPlacement":K=u;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function Wj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Hj(e){return w5.some(t=>e[t]>=0)}const I5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=Gs(e,t);switch(o){case"referenceHidden":{const l=await s.detectOverflow(t,{...i,elementContext:"reference"}),u=Wj(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Hj(u)}}}case"escaped":{const l=await s.detectOverflow(t,{...i,altBoundary:!0}),u=Wj(l,n.floating);return{data:{escapedOffsets:u,escaped:Hj(u)}}}default:return{}}}}},QN=new Set(["left","top"]);async function O5(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),l=Ys(n),u=ol(n),d=js(n)==="y",m=QN.has(l)?-1:1,h=i&&d?-1:1,g=Gs(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),d?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const _5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:l,middlewareData:u}=t,d=await O5(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:l}}}}},M5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...m}=Gs(e,t),h={x:n,y:s},g=await i.detectOverflow(t,m),y=js(Ys(o)),b=jy(y);let C=h[b],w=h[y];if(l){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",S=C+g[k],T=C-g[E];C=Vg(S,C,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",S=w+g[k],T=w-g[E];w=Vg(S,w,T)}const v=d.fn({...t,[b]:C,[y]:w});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:l,[y]:u}}}}}},F5=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:m=!0}=Gs(e,t),h={x:n,y:s},g=js(o),y=jy(g);let b=h[y],C=h[g];const w=Gs(u,t),v=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const S=y==="y"?"height":"width",T=i.reference[y]-i.floating[S]+v.mainAxis,I=i.reference[y]+i.reference[S]-v.mainAxis;b<T?b=T:b>I&&(b=I)}if(m){var k,E;const S=y==="y"?"width":"height",T=QN.has(Ys(o)),I=i.reference[g]-i.floating[S]+(T&&((k=l.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=i.reference[g]+i.reference[S]+(T?0:((E=l.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);C<I?C=I:C>R&&(C=R)}return{[y]:b,[g]:C}}}},z5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:l,elements:u}=t,{apply:d=()=>{},...m}=Gs(e,t),h=await l.detectOverflow(t,m),g=Ys(o),y=ol(o),b=js(o)==="y",{width:C,height:w}=i.floating;let v,k;g==="top"||g==="bottom"?(v=g,k=y===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,v=y==="end"?"top":"bottom");const E=w-h.top-h.bottom,S=C-h.left-h.right,T=Ao(w-h[v],E),I=Ao(C-h[k],S),R=!t.middlewareData.shift;let P=T,$=I;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(P=E),R&&!y){const F=kr(h.left,0),A=kr(h.right,0),z=kr(h.top,0),V=kr(h.bottom,0);b?$=C-2*(F!==0||A!==0?F+A:kr(h.left,h.right)):P=w-2*(z!==0||V!==0?z+V:kr(h.top,h.bottom))}await d({...t,availableWidth:$,availableHeight:P});const L=await l.getDimensions(u.floating);return C!==L.width||w!==L.height?{reset:{rects:!0}}:{}}}};function dp(){return typeof window<"u"}function al(e){return XN(e)?(e.nodeName||"").toLowerCase():"#document"}function Er(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rs(e){var t;return(t=(XN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function XN(e){return dp()?e instanceof Node||e instanceof Er(e).Node:!1}function ss(e){return dp()?e instanceof Element||e instanceof Er(e).Element:!1}function Qs(e){return dp()?e instanceof HTMLElement||e instanceof Er(e).HTMLElement:!1}function Vj(e){return!dp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Er(e).ShadowRoot}function eu(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=os(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function B5(e){return/^(table|td|th)$/.test(al(e))}function fp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const U5=/transform|translate|scale|rotate|perspective|filter/,W5=/paint|layout|strict|content/,ea=e=>!!e&&e!=="none";let Kh;function Ny(e){const t=ss(e)?os(e):e;return ea(t.transform)||ea(t.translate)||ea(t.scale)||ea(t.rotate)||ea(t.perspective)||!Cy()&&(ea(t.backdropFilter)||ea(t.filter))||U5.test(t.willChange||"")||W5.test(t.contain||"")}function H5(e){let t=Po(e);for(;Qs(t)&&!Ui(t);){if(Ny(t))return t;if(fp(t))return null;t=Po(t)}return null}function Cy(){return Kh==null&&(Kh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Kh}function Ui(e){return/^(html|body|#document)$/.test(al(e))}function os(e){return Er(e).getComputedStyle(e)}function pp(e){return ss(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Po(e){if(al(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vj(e)&&e.host||Rs(e);return Vj(t)?t.host:t}function ZN(e){const t=Po(e);return Ui(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qs(t)&&eu(t)?t:ZN(t)}function $c(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ZN(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),l=Er(o);if(i){const u=qg(l);return t.concat(l,l.visualViewport||[],eu(o)?o:[],u&&n?$c(u):[])}else return t.concat(o,$c(o,[],n))}function qg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eC(e){const t=os(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Qs(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:s,u=bf(n)!==i||bf(s)!==l;return u&&(n=i,s=l),{width:n,height:s,$:u}}function Ey(e){return ss(e)?e:e.contextElement}function $i(e){const t=Ey(e);if(!Qs(t))return Ns(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=eC(t);let l=(i?bf(n.width):n.width)/s,u=(i?bf(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const V5=Ns(0);function tC(e){const t=Er(e);return!Cy()||!t.visualViewport?V5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function K5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Er(e)?!1:t}function ya(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ey(e);let l=Ns(1);t&&(s?ss(s)&&(l=$i(s)):l=$i(e));const u=K5(i,n,s)?tC(i):Ns(0);let d=(o.left+u.x)/l.x,m=(o.top+u.y)/l.y,h=o.width/l.x,g=o.height/l.y;if(i){const y=Er(i),b=s&&ss(s)?Er(s):s;let C=y,w=qg(C);for(;w&&s&&b!==C;){const v=$i(w),k=w.getBoundingClientRect(),E=os(w),S=k.left+(w.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(w.clientTop+parseFloat(E.paddingTop))*v.y;d*=v.x,m*=v.y,h*=v.x,g*=v.y,d+=S,m+=T,C=Er(w),w=qg(C)}}return wf({width:h,height:g,x:d,y:m})}function mp(e,t){const n=pp(e).scrollLeft;return t?t.left+n:ya(Rs(e)).left+n}function nC(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-mp(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function q5(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",l=Rs(s),u=t?fp(t.floating):!1;if(s===l||u&&i)return n;let d={scrollLeft:0,scrollTop:0},m=Ns(1);const h=Ns(0),g=Qs(s);if((g||!g&&!i)&&((al(s)!=="body"||eu(l))&&(d=pp(s)),g)){const b=ya(s);m=$i(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=l&&!g&&!i?nC(l,d):Ns(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-d.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-d.scrollTop*m.y+h.y+y.y}}function G5(e){return Array.from(e.getClientRects())}function Y5(e){const t=Rs(e),n=pp(e),s=e.ownerDocument.body,o=kr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=kr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+mp(e);const u=-n.scrollTop;return os(s).direction==="rtl"&&(l+=kr(t.clientWidth,s.clientWidth)-o),{width:o,height:i,x:l,y:u}}const Kj=25;function J5(e,t){const n=Er(e),s=Rs(e),o=n.visualViewport;let i=s.clientWidth,l=s.clientHeight,u=0,d=0;if(o){i=o.width,l=o.height;const h=Cy();(!h||h&&t==="fixed")&&(u=o.offsetLeft,d=o.offsetTop)}const m=mp(s);if(m<=0){const h=s.ownerDocument,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=Kj&&(i-=C)}else m<=Kj&&(i+=m);return{width:i,height:l,x:u,y:d}}function Q5(e,t){const n=ya(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qs(e)?$i(e):Ns(1),l=e.clientWidth*i.x,u=e.clientHeight*i.y,d=o*i.x,m=s*i.y;return{width:l,height:u,x:d,y:m}}function qj(e,t,n){let s;if(t==="viewport")s=J5(e,n);else if(t==="document")s=Y5(Rs(e));else if(ss(t))s=Q5(t,n);else{const o=tC(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return wf(s)}function rC(e,t){const n=Po(e);return n===t||!ss(n)||Ui(n)?!1:os(n).position==="fixed"||rC(n,t)}function X5(e,t){const n=t.get(e);if(n)return n;let s=$c(e,[],!1).filter(u=>ss(u)&&al(u)!=="body"),o=null;const i=os(e).position==="fixed";let l=i?Po(e):e;for(;ss(l)&&!Ui(l);){const u=os(l),d=Ny(l);!d&&u.position==="fixed"&&(o=null),(i?!d&&!o:!d&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||eu(l)&&!d&&rC(e,l))?s=s.filter(h=>h!==l):o=u,l=Po(l)}return t.set(e,s),s}function Z5(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const l=[...n==="clippingAncestors"?fp(t)?[]:X5(t,this._c):[].concat(n),s],u=qj(t,l[0],o);let d=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<l.length;y++){const b=qj(t,l[y],o);d=kr(b.top,d),m=Ao(b.right,m),h=Ao(b.bottom,h),g=kr(b.left,g)}return{width:m-g,height:h-d,x:g,y:d}}function e_(e){const{width:t,height:n}=eC(e);return{width:t,height:n}}function t_(e,t,n){const s=Qs(t),o=Rs(t),i=n==="fixed",l=ya(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Ns(0);function m(){d.x=mp(o)}if(s||!s&&!i)if((al(t)!=="body"||eu(o))&&(u=pp(t)),s){const b=ya(t,!0,i,t);d.x=b.x+t.clientLeft,d.y=b.y+t.clientTop}else o&&m();i&&!s&&o&&m();const h=o&&!s&&!i?nC(o,u):Ns(0),g=l.left+u.scrollLeft-d.x-h.x,y=l.top+u.scrollTop-d.y-h.y;return{x:g,y,width:l.width,height:l.height}}function qh(e){return os(e).position==="static"}function Gj(e,t){if(!Qs(e)||os(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rs(e)===n&&(n=n.ownerDocument.body),n}function sC(e,t){const n=Er(e);if(fp(e))return n;if(!Qs(e)){let o=Po(e);for(;o&&!Ui(o);){if(ss(o)&&!qh(o))return o;o=Po(o)}return n}let s=Gj(e,t);for(;s&&B5(s)&&qh(s);)s=Gj(s,t);return s&&Ui(s)&&qh(s)&&!Ny(s)?n:s||H5(e)||n}const n_=async function(e){const t=this.getOffsetParent||sC,n=this.getDimensions,s=await n(e.floating);return{reference:t_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function r_(e){return os(e).direction==="rtl"}const s_={convertOffsetParentRelativeRectToViewportRelativeRect:q5,getDocumentElement:Rs,getClippingRect:Z5,getOffsetParent:sC,getElementRects:n_,getClientRects:G5,getDimensions:e_,getScale:$i,isElement:ss,isRTL:r_};function oC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function o_(e,t){let n=null,s;const o=Rs(e);function i(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=Nd(g),w=Nd(o.clientWidth-(h+y)),v=Nd(o.clientHeight-(g+b)),k=Nd(h),S={rootMargin:-C+"px "+-w+"px "+-v+"px "+-k+"px",threshold:kr(0,Ao(1,d))||1};let T=!0;function I(R){const P=R[0].intersectionRatio;if(P!==d){if(!T)return l();P?l(!1,P):s=setTimeout(()=>{l(!1,1e-7)},1e3)}P===1&&!oC(m,e.getBoundingClientRect())&&l(),T=!1}try{n=new IntersectionObserver(I,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,S)}n.observe(e)}return l(!0),i}function a_(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,m=Ey(e),h=o||i?[...m?$c(m):[],...t?$c(t):[]]:[];h.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const g=m&&u?o_(m,n):null;let y=-1,b=null;l&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var S;(S=b)==null||S.observe(t)})),n()}),m&&!d&&b.observe(m),t&&b.observe(t));let C,w=d?ya(e):null;d&&v();function v(){const k=ya(e);w&&!oC(w,k)&&n(),w=k,C=requestAnimationFrame(v)}return n(),()=>{var k;h.forEach(E=>{o&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,d&&cancelAnimationFrame(C)}}const i_=_5,l_=M5,c_=L5,u_=z5,d_=I5,Yj=$5,f_=F5,p_=(e,t,n)=>{const s=new Map,o={platform:s_,...n},i={...o.platform,_c:s};return D5(e,t,{...o,platform:i})};var m_=typeof document<"u",h_=function(){},Gd=m_?f.useLayoutEffect:h_;function jf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!jf(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!jf(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function aC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jj(e,t){const n=aC(e);return Math.round(t*n)/n}function Gh(e){const t=f.useRef(e);return Gd(()=>{t.current=e}),t}function g_(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:i,floating:l}={},transform:u=!0,whileElementsMounted:d,open:m}=e,[h,g]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);jf(y,s)||b(s);const[C,w]=f.useState(null),[v,k]=f.useState(null),E=f.useCallback(_=>{_!==R.current&&(R.current=_,w(_))},[]),S=f.useCallback(_=>{_!==P.current&&(P.current=_,k(_))},[]),T=i||C,I=l||v,R=f.useRef(null),P=f.useRef(null),$=f.useRef(h),L=d!=null,F=Gh(d),A=Gh(o),z=Gh(m),V=f.useCallback(()=>{if(!R.current||!P.current)return;const _={placement:t,strategy:n,middleware:y};A.current&&(_.platform=A.current),p_(R.current,P.current,_).then(G=>{const D={...G,isPositioned:z.current!==!1};O.current&&!jf($.current,D)&&($.current=D,Hs.flushSync(()=>{g(D)}))})},[y,t,n,A,z]);Gd(()=>{m===!1&&$.current.isPositioned&&($.current.isPositioned=!1,g(_=>({..._,isPositioned:!1})))},[m]);const O=f.useRef(!1);Gd(()=>(O.current=!0,()=>{O.current=!1}),[]),Gd(()=>{if(T&&(R.current=T),I&&(P.current=I),T&&I){if(F.current)return F.current(T,I,V);V()}},[T,I,V,F,L]);const B=f.useMemo(()=>({reference:R,floating:P,setReference:E,setFloating:S}),[E,S]),K=f.useMemo(()=>({reference:T,floating:I}),[T,I]),q=f.useMemo(()=>{const _={position:n,left:0,top:0};if(!K.floating)return _;const G=Jj(K.floating,h.x),D=Jj(K.floating,h.y);return u?{..._,transform:"translate("+G+"px, "+D+"px)",...aC(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:D}},[n,u,K.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:V,refs:B,elements:K,floatingStyles:q}),[h,V,B,K,q])}const x_=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Yj({element:s.current,padding:o}).fn(n):{}:s?Yj({element:s,padding:o}).fn(n):{}}}},y_=(e,t)=>{const n=i_(e);return{name:n.name,fn:n.fn,options:[e,t]}},b_=(e,t)=>{const n=l_(e);return{name:n.name,fn:n.fn,options:[e,t]}},v_=(e,t)=>({fn:f_(e).fn,options:[e,t]}),w_=(e,t)=>{const n=c_(e);return{name:n.name,fn:n.fn,options:[e,t]}},j_=(e,t)=>{const n=u_(e);return{name:n.name,fn:n.fn,options:[e,t]}},k_=(e,t)=>{const n=d_(e);return{name:n.name,fn:n.fn,options:[e,t]}},S_=(e,t)=>{const n=x_(e);return{name:n.name,fn:n.fn,options:[e,t]}};var N_="Arrow",iC=f.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...i}=e;return r.jsx(vn.svg,{...i,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});iC.displayName=N_;var C_=iC;function E_(e){const[t,n]=f.useState(void 0);return Co(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,u;if("borderBoxSize"in i){const d=i.borderBoxSize,m=Array.isArray(d)?d[0]:d;l=m.inlineSize,u=m.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Ty="Popper",[lC,cC]=va(Ty),[T_,uC]=lC(Ty),dC=e=>{const{__scopePopper:t,children:n}=e,[s,o]=f.useState(null);return r.jsx(T_,{scope:t,anchor:s,onAnchorChange:o,children:n})};dC.displayName=Ty;var fC="PopperAnchor",pC=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=uC(fC,n),l=f.useRef(null),u=Vn(t,l),d=f.useRef(null);return f.useEffect(()=>{const m=d.current;d.current=(s==null?void 0:s.current)||l.current,m!==d.current&&i.onAnchorChange(d.current)}),s?null:r.jsx(vn.div,{...o,ref:u})});pC.displayName=fC;var Ry="PopperContent",[R_,A_]=lC(Ry),mC=f.forwardRef((e,t)=>{var xe,ke,Pe,De,Xe,st;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...w}=e,v=uC(Ry,n),[k,E]=f.useState(null),S=Vn(t,Ze=>E(Ze)),[T,I]=f.useState(null),R=E_(T),P=(R==null?void 0:R.width)??0,$=(R==null?void 0:R.height)??0,L=s+(i!=="center"?"-"+i:""),F=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},A=Array.isArray(m)?m:[m],z=A.length>0,V={padding:F,boundary:A.filter(D_),altBoundary:z},{refs:O,floatingStyles:B,placement:K,isPositioned:q,middlewareData:_}=g_({strategy:"fixed",placement:L,whileElementsMounted:(...Ze)=>a_(...Ze,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[y_({mainAxis:o+$,alignmentAxis:l}),d&&b_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?v_():void 0,...V}),d&&w_({...V}),j_({...V,apply:({elements:Ze,rects:ot,availableWidth:le,availableHeight:Re})=>{const{width:Se,height:Oe}=ot.reference,ze=Ze.floating.style;ze.setProperty("--radix-popper-available-width",`${le}px`),ze.setProperty("--radix-popper-available-height",`${Re}px`),ze.setProperty("--radix-popper-anchor-width",`${Se}px`),ze.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),T&&S_({element:T,padding:u}),$_({arrowWidth:P,arrowHeight:$}),y&&k_({strategy:"referenceHidden",...V})]}),[G,D]=xC(K),H=ga(C);Co(()=>{q&&(H==null||H())},[q,H]);const Z=(xe=_.arrow)==null?void 0:xe.x,U=(ke=_.arrow)==null?void 0:ke.y,oe=((Pe=_.arrow)==null?void 0:Pe.centerOffset)!==0,[ue,re]=f.useState();return Co(()=>{k&&re(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(De=_.transformOrigin)==null?void 0:De.x,(Xe=_.transformOrigin)==null?void 0:Xe.y].join(" "),...((st=_.hide)==null?void 0:st.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(R_,{scope:n,placedSide:G,onArrowChange:I,arrowX:Z,arrowY:U,shouldHideArrow:oe,children:r.jsx(vn.div,{"data-side":G,"data-align":D,...w,ref:S,style:{...w.style,animation:q?void 0:"none"}})})})});mC.displayName=Ry;var hC="PopperArrow",P_={top:"bottom",right:"left",bottom:"top",left:"right"},gC=f.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=A_(hC,s),l=P_[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(C_,{...o,ref:n,style:{...o.style,display:"block"}})})});gC.displayName=hC;function D_(e){return e!==null}var $_=e=>({name:"transformOrigin",options:e,fn(t){var v,k,E;const{placement:n,rects:s,middlewareData:o}=t,l=((v=o.arrow)==null?void 0:v.centerOffset)!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[m,h]=xC(n),g={start:"0%",center:"50%",end:"100%"}[h],y=(((k=o.arrow)==null?void 0:k.x)??0)+u/2,b=(((E=o.arrow)==null?void 0:E.y)??0)+d/2;let C="",w="";return m==="bottom"?(C=l?g:`${y}px`,w=`${-d}px`):m==="top"?(C=l?g:`${y}px`,w=`${s.floating.height+d}px`):m==="right"?(C=`${-d}px`,w=l?g:`${b}px`):m==="left"&&(C=`${s.floating.width+d}px`,w=l?g:`${b}px`),{data:{x:C,y:w}}}});function xC(e){const[t,n="center"]=e.split("-");return[t,n]}var L_=dC,I_=pC,O_=mC,__=gC,M_=Symbol("radix.slottable");function F_(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=M_,t}var z_=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"}),B_="VisuallyHidden",yC=f.forwardRef((e,t)=>r.jsx(vn.span,{...e,ref:t,style:{...z_,...e.style}}));yC.displayName=B_;var U_=yC,[hp]=va("Tooltip",[cC]),gp=cC(),bC="TooltipProvider",W_=700,Gg="tooltip.open",[H_,Ay]=hp(bC),vC=e=>{const{__scopeTooltip:t,delayDuration:n=W_,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,l=f.useRef(!0),u=f.useRef(!1),d=f.useRef(0);return f.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),r.jsx(H_,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:o,children:i})};vC.displayName=bC;var Lc="Tooltip",[V_,tu]=hp(Lc),wC=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:l,delayDuration:u}=e,d=Ay(Lc,e.__scopeTooltip),m=gp(t),[h,g]=f.useState(null),y=Ei(),b=f.useRef(0),C=l??d.disableHoverableContent,w=u??d.delayDuration,v=f.useRef(!1),[k,E]=Jf({prop:s,defaultProp:o??!1,onChange:P=>{P?(d.onOpen(),document.dispatchEvent(new CustomEvent(Gg))):d.onClose(),i==null||i(P)},caller:Lc}),S=f.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,E(!0)},[E]),I=f.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),R=f.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,E(!0),b.current=0},w)},[w,E]);return f.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(L_,{...m,children:r.jsx(V_,{scope:t,contentId:y,open:k,stateAttribute:S,trigger:h,onTriggerChange:g,onTriggerEnter:f.useCallback(()=>{d.isOpenDelayedRef.current?R():T()},[d.isOpenDelayedRef,R,T]),onTriggerLeave:f.useCallback(()=>{C?I():(window.clearTimeout(b.current),b.current=0)},[I,C]),onOpen:T,onClose:I,disableHoverableContent:C,children:n})})};wC.displayName=Lc;var Yg="TooltipTrigger",jC=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=tu(Yg,n),i=Ay(Yg,n),l=gp(n),u=f.useRef(null),d=Vn(t,u,o.onTriggerChange),m=f.useRef(!1),h=f.useRef(!1),g=f.useCallback(()=>m.current=!1,[]);return f.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(I_,{asChild:!0,...l,children:r.jsx(vn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:d,onPointerMove:Qt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:Qt(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:Qt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Qt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:Qt(e.onBlur,o.onClose),onClick:Qt(e.onClick,o.onClose)})})});jC.displayName=Yg;var Py="TooltipPortal",[K_,q_]=hp(Py,{forceMount:void 0}),kC=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=tu(Py,t);return r.jsx(K_,{scope:t,forceMount:n,children:r.jsx(wa,{present:n||i.open,children:r.jsx(Jx,{asChild:!0,container:o,children:s})})})};kC.displayName=Py;var Wi="TooltipContent",SC=f.forwardRef((e,t)=>{const n=q_(Wi,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,l=tu(Wi,e.__scopeTooltip);return r.jsx(wa,{present:s||l.open,children:l.disableHoverableContent?r.jsx(NC,{side:o,...i,ref:t}):r.jsx(G_,{side:o,...i,ref:t})})}),G_=f.forwardRef((e,t)=>{const n=tu(Wi,e.__scopeTooltip),s=Ay(Wi,e.__scopeTooltip),o=f.useRef(null),i=Vn(t,o),[l,u]=f.useState(null),{trigger:d,onClose:m}=n,h=o.current,{onPointerInTransitChange:g}=s,y=f.useCallback(()=>{u(null),g(!1)},[g]),b=f.useCallback((C,w)=>{const v=C.currentTarget,k={x:C.clientX,y:C.clientY},E=Z_(k,v.getBoundingClientRect()),S=eM(k,E),T=tM(w.getBoundingClientRect()),I=rM([...S,...T]);u(I),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(d&&h){const C=v=>b(v,h),w=v=>b(v,d);return d.addEventListener("pointerleave",C),h.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",w)}}},[d,h,b,y]),f.useEffect(()=>{if(l){const C=w=>{const v=w.target,k={x:w.clientX,y:w.clientY},E=(d==null?void 0:d.contains(v))||(h==null?void 0:h.contains(v)),S=!nM(k,l);E?y():S&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[d,h,l,m,y]),r.jsx(NC,{...e,ref:i})}),[Y_,J_]=hp(Lc,{isInside:!1}),Q_=F_("TooltipContent"),NC=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:l,...u}=e,d=tu(Wi,n),m=gp(n),{onClose:h}=d;return f.useEffect(()=>(document.addEventListener(Gg,h),()=>document.removeEventListener(Gg,h)),[h]),f.useEffect(()=>{if(d.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(d.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]),r.jsx(Yx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:l,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(O_,{"data-state":d.stateAttribute,...m,...u,ref:t,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(Q_,{children:s}),r.jsx(Y_,{scope:n,isInside:!0,children:r.jsx(U_,{id:d.contentId,role:"tooltip",children:o||s})})]})})});SC.displayName=Wi;var CC="TooltipArrow",X_=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=gp(n);return J_(CC,n).isInside?null:r.jsx(__,{...o,...s,ref:t})});X_.displayName=CC;function Z_(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,o,i)){case i:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function eM(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 tM(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function nM(e,t){const{x:n,y:s}=e;let o=!1;for(let i=0,l=t.length-1;i<t.length;l=i++){const u=t[i],d=t[l],m=u.x,h=u.y,g=d.x,y=d.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(o=!o)}return o}function rM(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),sM(t)}function sM(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const i=t[t.length-1],l=t[t.length-2];if((i.x-l.x)*(o.y-l.y)>=(i.y-l.y)*(o.x-l.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const i=n[n.length-1],l=n[n.length-2];if((i.x-l.x)*(o.y-l.y)>=(i.y-l.y)*(o.x-l.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var oM=vC,aM=wC,iM=jC,lM=kC,EC=SC;const ma=oM,Sr=aM,Nr=iM,cr=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(lM,{children:r.jsx(EC,{ref:s,sideOffset:t,className:be("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})}));cr.displayName=EC.displayName;function Dy({items:e,align:t="end"}){const[n,s]=f.useState(!1),[o,i]=f.useState(null),l=f.useRef(null);if(f.useEffect(()=>{if(!n){i(null);return}function d(h){l.current&&!l.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(d,m){const h=d.icon,g=be("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",d.disabled?"opacity-50 cursor-not-allowed":d.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?d.active?r.jsx(Tr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:d.label})]});if(d.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return d.disabledReason?r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:C}),r.jsx(cr,{side:"left",children:d.disabledReason})]},d.key):r.jsx("div",{children:C},d.key)}return d.href?r.jsx(Te,{to:d.href,className:g,onClick:()=>s(!1),children:b},d.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var C;(C=d.onSelect)==null||C.call(d),s(!1)},children:b},d.key)}return r.jsxs("div",{className:"relative",ref:l,children:[r.jsx("button",{type:"button",onClick:()=>s(d=>!d),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(MP,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:be("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(ma,{delayDuration:200,children:e.map(d=>{if(d.submenu&&d.submenu.length>0){const m=d.icon,h=o===d.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:be("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>i(h?null:d.key),children:[m?r.jsx(m,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 flex-1 truncate",children:d.label}),h?r.jsx(fr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(lS,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?d.submenu.map(g=>u(g,!0)):null]},d.key)}return u(d,!1)})})})]})}function Qj(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const cM={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 uM(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function dM(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function fM(e,t,n=Date.now()){if(!t)return!0;const s=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(s);if(Number.isNaN(o))return!1;if(t.preset){const u=cM[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-o>u:o>=n-u&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,l=t.to&&t.to.length>0?t.to:void 0;return!i&&!l?!0:!(i&&o<uM(i)||l&&o>dM(l))}function pM(e,t,n={}){const{workspace:s,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const l=Fe(t.status),u=Fe(t.priority),d=Fe(t.type),m=Fe(t.assignee),h=Fe(t.project),g=Fe(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(l.length&&!l.includes(e.status)||u.length&&!u.includes(e.priority)||d.length&&!d.includes(e.type??"")||y==="stale"&&!Qj(e.updated)||y==="fresh"&&Qj(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!fM(e,t.dateRange))return!1;if(o){const b=o.trim().toLowerCase();if(b&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(b))return!1}return!0}function Ic(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const Xj={critical:0,high:1,medium:2,low:3};function Cd(e){return Date.parse(e??"")||0}function nu(e,t,n){return[...e].sort((o,i)=>{let l=0;switch(t){case"title":l=o.title.localeCompare(i.title);break;case"status":l=o.status.localeCompare(i.status);break;case"priority":l=(Xj[o.priority]??99)-(Xj[i.priority]??99);break;case"assignee":l=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":l=o.dependsOn.length-i.dependsOn.length;break;case"created":l=Cd(o.created)-Cd(i.created);break;case"updated":l=Cd(o.updated)-Cd(i.updated);break}return n==="asc"?l:-l})}function mM(e){const t=`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`;return{...e.facts??{},status:e.status,phase:e.phase,disposition:e.disposition,priority:e.priority,type:e.type,assignee:e.assignee,project:e.projectSlug,tags:e.tags,archived:e.archived,title:e.title,created:e.created,updated:e.updated,completedAt:e.completedAt,statusAge:e.statusAge,phaseAge:e.phaseAge,searchText:t}}function TC(e,t,n={}){const{workspace:s,includeArchived:o=!1,now:i=Date.now()}=n,l={now:i};return e.filter(u=>{if(u.archived===!0&&!o)return!1;if(s){if(s==="_ungrouped"){if(u.projectWorkspace!=null)return!1}else if(u.projectWorkspace!==s)return!1}if(!t)return!0;const d=mM(u);return t.predicate(d,l)})}const xp={hasrealobjective:{kind:"bool",get:e=>e.hasRealObjective},acrealtotal:{kind:"number",get:e=>e.acRealTotal},acrealchecked:{kind:"number",get:e=>e.acRealChecked},acallchecked:{kind:"bool",get:e=>e.acAllChecked},planexists:{kind:"bool",get:e=>e.planExists},planapproved:{kind:"bool",get:e=>e.planApproved},workspaceset:{kind:"bool",get:e=>e.workspaceSet},implementationstarted:{kind:"bool",get:e=>e.implementationStarted},depssatisfied:{kind:"bool",get:e=>e.depsSatisfied},unresolvedquestions:{kind:"number",get:e=>e.unresolvedQuestions},blocked:{kind:"bool"},parked:{kind:"bool"},reviewrequested:{kind:"bool",get:e=>e.reviewRequested},pinned:{kind:"bool"}};function yp(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},s=e.type==="attestation"?[n.fact,n.approved,n.changesRequested,n.by,n.approvedBy].map(o=>o.toLowerCase()):[n.fact.toLowerCase()];return{storageKey:t,exports:n,registryKeys:s}}function hM(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const s=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(s))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:s,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:s,type:"attestation",binds:i})}}return t}function Jg(e){const t=[],n=new Map;for(const s of Object.keys(xp))n.set(s,"built-in");for(const s of Object.keys(Kf))n.set(s,"built-in");for(const s of e??[]){const o=((s==null?void 0:s.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(s==null?void 0:s.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(s.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${s.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const m=(s.binds??"none").toString().trim()||"none";if(m!=="plan"&&m!=="commit"&&m!=="none"){t.push(`fact "${o}": invalid binds "${s.binds}" — expected plan, commit, or none`);continue}}const u=yp(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,d=u.find(m=>n.has(m));if(d!==void 0){const m=n.get(d);m==="built-in"?t.push(`fact "${o}": exported field "${d}" collides with a built-in field`):m===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${d}" collides with fact "${m}"`);continue}for(const m of u)n.set(m,o)}return t}function gM(e){const t=new Set([...Object.keys(xp),...Object.keys(Kf)]),n=[];for(const s of e){const o=yp(s).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(s)}}return n}function RC(e,t){const n=yp(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:s=>s[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:s=>s[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:s=>s[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:s=>s[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:s=>s[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:s=>s[n.exports.fact]}}function $y(e){const t={...xp};for(const n of e)RC(t,n);return t}function AC(e){const t={...Kf};for(const n of e)RC(t,n);return t}function PC(e){const t=["status","priority","type","assignee","project","tag","tags","archived","title","search","created","updated","completedAt","statusAge","phase","disposition","phaseAge","hasRealObjective","acRealTotal","acRealChecked","acAllChecked","planExists","planApproved","workspaceSet","implementationStarted","depsSatisfied","unresolvedQuestions","progressStaleDays","blocked","parked","reviewRequested","pinned"],n=[];for(const s of e){const o=yp(s);s.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function wt({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 Hi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function bp({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:o,canDrop:i,onMove:l,getExternalDragData:u,onCardContextMenu:d,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const C=f.useMemo(()=>new Set(h??[]),[h]),w=f.useMemo(()=>e.filter(O=>!C.has(O.id)),[e,C]),v=f.useMemo(()=>e.filter(O=>C.has(O.id)),[e,C]),[k,E]=f.useState(null),[S,T]=f.useState(null),I=f.useRef(null),R=f.useMemo(()=>new Map(t.map(O=>[n(O),O])),[n,t]),P=f.useMemo(()=>w.map(O=>({column:O,items:t.filter(B=>s(B)===O.id)})),[w,s,t]),$=k?R.get(k)??null:null;function L(O){if(!$)return{allowed:!1};const B=s($);return(i==null?void 0:i({item:$,fromColumnId:B,toColumnId:O}))??{allowed:!0}}function F(){E(null),T(null)}function A(O,B,K){if(b)return;const q=(u==null?void 0:u(B))??null;!l&&!q||(O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("text/plain",K),q&&O.dataTransfer.setData("application/json",JSON.stringify(q)),l&&E(K))}function z(O,B,K){b||!l||!$||!L(B).allowed||(O.preventDefault(),O.dataTransfer.dropEffect="move",T(_=>(_==null?void 0:_.columnId)===B&&_.index===K?_:{columnId:B,index:K}))}async function V(O,B,K){var H;if(O.preventDefault(),b||!l||!$){F();return}const q=s($),G=(((H=P.find(Z=>Z.column.id===q))==null?void 0:H.items)??[]).findIndex(Z=>n(Z)===n($));if(!L(B).allowed||G<0){F();return}if(q===B&&(K===G||K===G+1)){F();return}try{await l({item:$,fromColumnId:q,toColumnId:B,fromIndex:G,toIndex:K})}finally{F()}}return r.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[v.length>0&&g?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Hidden:"}),v.map(O=>r.jsxs("button",{type:"button",onClick:()=>g(O.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${O.title}" column`,children:[O.title," ×"]},O.id))]}):null,r.jsx("div",{className:be("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:P.map(({column:O,items:B})=>{const K=L(O.id),q=(S==null?void 0:S.columnId)===O.id;return r.jsxs("section",{className:be("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",$&&!K.allowed?"border-dashed opacity-65":"",$&&K.allowed?"border-primary/30 bg-accent/30":"",q?"ring-2 ring-ring/30":""),title:$&&!K.allowed?K.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:be("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:O.title}),O.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:O.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:B.length}),g?r.jsx("button",{type:"button",onClick:()=>g(O.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 "${O.title}" column`,"aria-label":`Hide column ${O.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:_=>z(_,O.id,B.length),onDrop:_=>V(_,O.id,B.length),children:[B.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(O):m}):r.jsx(xM,{active:(S==null?void 0:S.columnId)===O.id&&S.index===0,disabled:!!$&&!K.allowed,children:typeof m=="function"?m(O):m}):null,B.map((_,G)=>{const D=n(_),H=k===D;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:be("h-2 rounded-full transition",(S==null?void 0:S.columnId)===O.id&&S.index===G?"bg-primary/70":"bg-transparent"),onDragOver:Z=>z(Z,O.id,G),onDrop:Z=>V(Z,O.id,G)}),r.jsx("div",{draggable:!b&&!!(l||u),onMouseDown:Z=>{I.current=Z.target},onDragStart:Z=>{const U=I.current;if(U!=null&&U.closest(Hi)){Z.preventDefault();return}A(Z,_,D)},onDragEnd:F,onContextMenu:Z=>{if(!d)return;const U=Z.target;U!=null&&U.closest(Hi)||d(_,Z)},className:be("transition",!b&&(l||u)?"cursor-grab active:cursor-grabbing":"",H?"scale-[0.98] opacity-50":""),children:o(_,{dragging:H})})]},D)}),B.length>0&&!b?r.jsx("div",{className:be("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(S==null?void 0:S.columnId)===O.id&&S.index===B.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",$&&!K.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},O.id)})})]})}function xM({active:e,disabled:t,children:n}){return r.jsx("div",{className:be("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 Ks="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Li="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",DC="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",Qg="border-status-review-foreground/30 bg-status-review text-status-review-foreground",$C="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",LC="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",IC="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Yd=Ks,yM={draft:Ks,pending:Ks,ready_for_planning:Ks,ready_to_implement:Li,in_progress:Li,blocked:DC,review:Qg,code_review:Qg,completed:$C,failed:LC,active:Li,stopped:Ks,archived:IC};function bM(e){return yM[e]??Yd}const vM={slate:Yd,gray:Yd,grey:Yd};function OC(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function wM(e){let t=e.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6||/[^0-9a-fA-F]/.test(t)?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function jM(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const s=wM(n);if(s){const{r:o,g:i,b:l}=s;return{className:"",style:{backgroundColor:`rgba(${o}, ${i}, ${l}, 0.15)`,borderColor:`rgba(${o}, ${i}, ${l}, 0.4)`,color:n}}}}else{const s=vM[n.toLowerCase()];if(s)return{className:s}}return{className:bM(e)}}function Oc(e,t){const n=e.find(i=>i.id===t),{className:s,style:o}=jM(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??OC(t),className:s,style:o,iconName:n==null?void 0:n.icon}}function Xg(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function _C(e){const t=new Map(e.statuses.map(l=>[l.id,l])),n=e.order.length>0?e.order:e.statuses.map(l=>l.id),s=new Set,o=[],i=(l,u)=>{s.has(l)||(s.add(l),o.push({id:l,label:(u==null?void 0:u.label)??OC(l),terminal:Xg(u??{id:l})}))};for(const l of n)i(l,t.get(l));for(const l of e.statuses)i(l.id,l);return o}const MC={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Ks,icon:Ji},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Ks,icon:DP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Ks,icon:uS},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Li,icon:ZP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Li,icon:$x},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:DC,icon:sf},review:{label:"Review",description:"Ready for inspection or approval.",className:Qg,icon:n3},completed:{label:"Completed",description:"Finished successfully.",className:$C,icon:Rx},failed:{label:"Failed",description:"Could not be completed as planned.",className:LC,icon:sf},active:{label:"Active",description:"The project has active or review work in flight.",className:Li,icon:Cg},stopped:{label:"Stopped",description:"Session ended without completing.",className:Ks,icon:AP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:IC,icon:Cg}},FC="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)]";function Zg(e){var t;return((t=MC[e])==null?void 0:t.icon)??Cg}function bn({status:e,className:t,showIcon:n=!0,progress:s}){var b;const o=cs(),i=Oc(o.statuses,e),l=Zg(e),u=i.label,d=((b=o.statuses.find(C=>C.id===e))==null?void 0:b.description)??ru(e),m=s&&s.total>0,h=m?Math.min(1,Math.max(0,s.checked/s.total)):0,g=m?`${u} — ${d} (${s.checked}/${s.total} criteria)`:`${u} — ${d}`,y=n?m?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-h)})]}),r.jsx(l,{className:"h-2.5 w-2.5"})]}):r.jsx(l,{className:"h-3.5 w-3.5 shrink-0"}):null;return r.jsxs("span",{title:g,className:be(FC,i.className,t),style:i.style,children:[y,r.jsx("span",{className:"min-w-0 truncate",children:u})]})}function ru(e){var t;return((t=MC[e])==null?void 0:t.description)??`Status: ${e}`}function ja({type:e,className:t,compact:n=!1}){const s=qc();if(!e)return null;const o=P4(s,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),l=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return r.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:l,className:be("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!l&&"border-border/60 text-muted-foreground",t),children:i})}async function su(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return kM(e)}function kM(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function zr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:o}){const[i,l]=f.useState(!1);async function u(){n||(await su(e)?(l(!0),setTimeout(()=>l(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(of,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?r.jsx(Tr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(of,{className:"h-3 w-3","aria-hidden":"true"})})}function SM(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function NM({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:o,compact:i=!1}){const l=cs(),[u,d]=f.useState(()=>new Set(o.collapsed));f.useEffect(()=>{d(new Set(o.collapsed))},[o]);const m=h=>{d(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:be("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=nu(e.filter(C=>C.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=Eo(l,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:be("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx(fr,{className:be("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:be("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:g.length})]}),y&&r.jsx("ul",{className:be("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:g.map(C=>{const w=SM(C);return r.jsx("li",{children:r.jsxs(Te,{to:w,className:be("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Mn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function CM(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function EM({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:o=!1}){const i=new Set(s.hidden);i.delete("title");const l=h=>!i.has(h),u=nu(e,t,n),d=o?"py-2 pr-3":"py-3 pr-4",m=o?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:be("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[l("title")?r.jsx("th",{className:be("font-medium",d),children:"Assignment"}):null,l("status")?r.jsx("th",{className:be("font-medium",d),children:"Status"}):null,l("priority")?r.jsx("th",{className:be("font-medium",d),children:"Priority"}):null,l("assignee")?r.jsx("th",{className:be("font-medium",d),children:"Assignee"}):null,l("dependencies")?r.jsx("th",{className:be("font-medium",d),children:"Dependencies"}):null,l("created")?r.jsx("th",{className:be("font-medium",d),children:"Created"}):null,l("updated")?r.jsx("th",{className:be("font-medium",d),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=CM(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[l("title")?r.jsxs("td",{className:d,children:[r.jsx(Te,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,l("status")?r.jsx("td",{className:d,children:r.jsx(bn,{status:h.status,className:"max-w-[150px]"})}):null,l("priority")?r.jsx("td",{className:be("capitalize text-muted-foreground",d),children:h.priority}):null,l("assignee")?r.jsx("td",{className:be("text-muted-foreground",d),children:h.assignee??"Unassigned"}):null,l("dependencies")?r.jsx("td",{className:be("text-muted-foreground",d),children:h.dependsOn.length}):null,l("created")?r.jsx("td",{className:be("text-muted-foreground",d),children:Mn(h.created)}):null,l("updated")?r.jsx("td",{className:be("text-muted-foreground",d),children:Mn(h.updated)}):null]},y)})})]})})}function zC({view:e,compact:t,emptyDescription:n}){const{data:s,loading:o,error:i}=Uf(),l=cs(),u=f.useMemo(()=>l.order.map(h=>({id:h,title:Eo(l,h),description:ru(h)})),[l]),d=f.useMemo(()=>AC(l.factDeclarations),[l.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??dc(e.config.filters);let g=null;h.trim()!==""&&(g=zi(h,d).query);const y=TC(s.assignments,g,{workspace:e.workspace});return nu(y,e.config.sortField,e.config.sortDirection)},[s,e,d]);if(o&&!s)return r.jsx(mt,{label:"Loading assignments…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(m.length===0)return r.jsx(wt,{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(bp,{compact:t,dragDisabled:!0,columns:u,items:m,getItemId:h=>h.slug||h.id,getColumnId:h=>h.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:h=>t?r.jsx(TM,{item:h}):r.jsx(RM,{item:h})});case"list":return r.jsx(NM,{items:m,statusOrder:l.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(EM,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function TM({item:e}){const t=Ic(e);return r.jsxs("div",{className:be("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(Te,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Mn(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(zr,{value:e.id})]}):null]})}function RM({item:e}){const t=Ic(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(Te,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ja,{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:Mn(e.updated)})]})]})}function AM({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:o,refetch:i}=Ro(e);return s?r.jsx(mt,{label:"Loading view…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),r.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(zC,{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 BC({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:pa.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:pa.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(PM,{session:t})},t.sessionId))})]})}function PM({session:e}){const t=un(),[n,s]=f.useState(!1),o=DM(e,t),i=$M(e),l=!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(Te,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",SS(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:pa.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(zr,{value:e.path,label:pa.recentSessionsCopyPathLabel,disabled:l,disabledReason:pa.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function DM(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function $M(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const LM={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 oa(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function IM(e,t,n=Date.now()){const s=oa(e);if(t.preset){const l=LM[t.preset];return l?t.preset.startsWith("older_")?s<n-l:s>=n-l:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&s<o||i!==null&&Number.isFinite(i)&&s>i)}function OM(e,t,n=Date.now()){const{dateRange:s,project:o,agent:i,sessionStatus:l}=t,u=new Set(o??[]),d=new Set(i??[]),m=new Set(l??[]);return e.filter(h=>{if(s&&!IM(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(d.size>0&&!Array.from(d).some(y=>y.toLowerCase()===h.agent.toLowerCase()))return!1;if(m.size>0){let g=!1;for(const y of m){switch(y){case"active":h.status==="active"&&(g=!0);break;case"ended":(h.status==="completed"||h.status==="stopped")&&(g=!0);break;case"tracked":g=!0;break}if(g)break}if(!g)return!1}return!0})}function _M(e,t,n){return[...e].sort((o,i)=>{let l=0;switch(t){case"started":l=oa(o.started)-oa(i.started);break;case"lastActivity":l=oa(o.updatedAt)-oa(i.updatedAt);break;case"projectName":{const u=o.projectSlug??"",d=i.projectSlug??"";l=u.localeCompare(d);break}case"agentName":l=o.agent.localeCompare(i.agent);break;default:l=oa(o.started)-oa(i.started);break}return n==="asc"?l:-l})}function MM(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function FM({view:e,emptyDescription:t}){const{data:n,loading:s,error:o}=Wf(),i=f.useMemo(()=>{if(!n)return[];const l=n.sessions??[],{config:u}=e,d=u.filters,m={dateRange:d.dateRange?{...d.dateRange,field:"started"}:void 0,project:Fe(d.project),agent:Fe(d.agent),sessionStatus:Fe(d.sessionStatus),limit:u.limit};let h=OM(l,m);return h=_M(h,u.sortField,u.sortDirection),h=MM(h,u.limit),h},[n,e]);return s&&!n?r.jsx(mt,{label:"Loading sessions…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?r.jsx(wt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(BC,{sessions:i})}function zM({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:o}=Zc(),[i,l]=f.useState(!1),u=f.useRef(null),d=f.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);f.useEffect(()=>{if(!i)return;function g(b){u.current&&!u.current.contains(b.target)&&l(!1)}function y(b){b.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[i]);const m=e?s.find(g=>g.id===e)??null:null,h=o?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:o,onClick:()=>l(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(fr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[r.jsxs("button",{type:"button",onClick:()=>{l(!1),t(null)},className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:r.jsx(Tr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),d.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{l(!1),t(g.id)},className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",y&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?r.jsx(Tr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:g.name})]},g.id)})]}),r.jsx("div",{className:"my-1 border-t border-border/40"}),r.jsxs("button",{type:"button",onClick:()=>{l(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[r.jsx(jt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const BM={__unassigned__:"Unassigned",__standalone__:"No project"};function xn({options:e,value:t,onChange:n,allLabel:s="Any",className:o,disabled:i,ariaLabel:l}){const[u,d]=f.useState(!1),m=f.useRef(null),h=f.useRef(null),g=f.useRef([]),y=f.useMemo(()=>{const E=new Set(e.map(T=>T.value)),S=t.filter(T=>!E.has(T)).map(T=>({value:T,label:BM[T]??T}));return[...e,...S]},[e,t]),b=f.useMemo(()=>new Set(t),[t]);f.useEffect(()=>{if(!u)return;function E(S){m.current&&!m.current.contains(S.target)&&d(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),f.useEffect(()=>{var E;u&&((E=g.current[0])==null||E.focus())},[u]);const C=f.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(S=>S.value===t[0]);return E?E.label:t[0]}return`${t.length} selected`},[t,y,s]);function w(E){n(b.has(E)?t.filter(S=>S!==E):[...t,E])}function v(E){var T;const S=Math.max(0,Math.min(E,y.length-1));(T=g.current[S])==null||T.focus()}function k(E){var R;const S=g.current,T=document.activeElement,I=S.findIndex(P=>P===T);E.key==="ArrowDown"?(E.preventDefault(),v(I<0?0:I+1)):E.key==="ArrowUp"?(E.preventDefault(),v(I<0?y.length-1:I-1)):E.key==="Home"?(E.preventDefault(),v(0)):E.key==="End"?(E.preventDefault(),v(y.length-1)):E.key==="Escape"&&(E.preventDefault(),d(!1),(R=h.current)==null||R.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:i,"aria-haspopup":"menu","aria-expanded":u,"aria-label":l,onClick:()=>d(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),d(!0))},className:be("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[r.jsx("span",{className:"truncate",children:C}),r.jsx(fr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":l,onKeyDown:k,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(E=>E.value)),children:"Select all"}),r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((E,S)=>{const T=b.has(E.value);return r.jsxs("button",{ref:I=>{g.current[S]=I},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>w(E.value),className:be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",T?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{className:be("flex h-4 w-4 shrink-0 items-center justify-center rounded border",T?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:T?r.jsx(Tr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const Zj={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"},UM=["updated","created"];function vp({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[o,i]=f.useState(!1),l=f.useRef(null),u=(e==null?void 0:e.field)??"updated",d=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=f.useState(d);f.useEffect(()=>h(d),[d]),f.useEffect(()=>{if(!o)return;function k(S){l.current&&!l.current.contains(S.target)&&i(!1)}function E(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[o]);const g=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${Zj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[g,e,u]);function b(k){t(e?{...e,field:k}:{field:k,preset:"",from:"",to:""})}function C(k){h(!1),t({field:u,preset:k,from:"",to:""})}function w(){h(!1),t(null)}function v(k,E){const S={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[k]:E})}return r.jsxs("div",{className:"relative",ref:l,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":s,onClick:()=>i(k=>!k),className:be("editor-input inline-flex items-center justify-between gap-1.5 text-left",g&&"border-foreground/40 text-foreground",n),children:[r.jsx("span",{className:"truncate",children:y}),r.jsx(fr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?r.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[r.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:UM.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:be("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(Yh,{label:"Any date",selected:!g,onClick:w}),s4.map(k=>r.jsx(Yh,{label:Zj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>C(k)},k)),r.jsx(Yh,{label:"Custom range…",selected:m,onClick:()=>{h(!0),t({field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),m?r.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",r.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:k=>v("from",k.target.value),className:"editor-input w-40"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",r.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:k=>v("to",k.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function Yh({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:be("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(Tr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const WM=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function HM(e,t){const n={};for(const[s,o]of Object.entries(e))WM.has(s)||(n[s]=o);return{...n,...t}}function kf(e,t,n){return{...e,viewMode:t.viewMode,filters:HM(e.filters,t.filters),sortField:t.sortField,sortDirection:t.sortDirection,limit:t.limit,listSectionVisibility:{collapsed:[...n.listSectionVisibility.collapsed]},kanbanColumnVisibility:{hidden:[...n.kanbanColumnVisibility.hidden]},tableColumnVisibility:{hidden:[...n.tableColumnVisibility.hidden]}}}function VM(e,t){var y,b;const n={},s=Fe(e.status);s.length&&(n.status=s);const o=Fe(e.type);o.length&&(n.type=o);const i=Fe(e.priority);i.length&&(n.priority=i);const l=Fe(e.assignee);l.length&&(n.assignee=l);const u=Fe(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const C=Fe(e.project);C.length&&(n.project=C)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const d=Fe(e.sessionStatus);d.length&&(n.sessionStatus=d);const m=Fe(e.agent);m.length&&(n.agent=m),e.dateRange&&(n.dateRange=e.dateRange);const h=(y=e.search)==null?void 0:y.trim();h&&(n.search=h);const g=(b=e.query)==null?void 0:b.trim();return g&&(n.query=g),n}function Vi(e){const t={viewMode:e.state.viewMode,filters:VM(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 ci={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},Ed={sortField:"started",sortDirection:"desc"};function UC(e,t){const{config:n}=Vi({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:e.viewMode,filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function Ly(e,t){const{config:n}=Vi({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),s={...n};return e.limit!==void 0&&e.limit>0&&(s.limit=e.limit),{workspace:t,config:s}}function ha(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 wp(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function WC(e,t){var s,o,i,l,u,d,m,h,g,y,b,C,w,v,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,Fe(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,Fe(n.filters.type)),(l=t.setPriorityFilter)==null||l.call(t,Fe(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,Fe(n.filters.assignee)),(d=t.setProjectFilter)==null||d.call(t,Fe(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,Fe(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,wp(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??dc(n.filters)),t.setActivityFilter){const E=n.filters.activity??"all";t.setActivityFilter(E==="fresh"||E==="stale"?E:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(C=t.setSortDirection)==null||C.call(t,n.sortDirection),(w=t.setListSectionVisibility)==null||w.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(v=t.setKanbanColumnVisibility)==null||v.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Jd(e){return e?`/w/${e}/views`:"/views"}function HC(e){return`${Jd(e.workspace)}/${encodeURIComponent(e.id)}`}function VC(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Fe(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&UN(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const KM=["critical","high","medium","low"],qM={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 GM(e){if(e.preset)return`${e.field} ${qM[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function KC(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&fc(t)===null)return`query: ${t}`;const n=[];for(const l of["status","priority","type","assignee","project","tags"]){const u=Fe(e[l]);u.length&&n.push(`${l}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(GM(e.dateRange));const s=(i=e.search)==null?void 0:i.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const e0=80,YM=["started","lastActivity","projectName","agentName"],JM={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},QM=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function qC({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const o=!!n,{data:i}=Ts(),{data:l}=Wf(),[u,d]=f.useState(""),[m,h]=f.useState([]),[g,y]=f.useState([]),[b,C]=f.useState([]),[w,v]=f.useState(null),[k,E]=f.useState(Ed.sortField),[S,T]=f.useState(Ed.sortDirection),[I,R]=f.useState(""),[P,$]=f.useState(!1),[L,F]=f.useState(null);function A(){h([]),y([]),C([]),v(null),E(Ed.sortField),T(Ed.sortDirection),R("")}f.useEffect(()=>{if(e)if(F(null),$(!1),n){const _=n.config.filters;d(n.name),h(Fe(_.project)),y(Fe(_.agent)),C(Fe(_.sessionStatus)),v(wp(_.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else d(""),A()},[e,n]);const z=f.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(G=>({value:G.slug,label:G.title}))],[i]),V=f.useMemo(()=>{const _=new Set;for(const G of(l==null?void 0:l.sessions)??[])G.agent&&_.add(G.agent);return Array.from(_).sort().map(G=>({value:G,label:G}))},[l]),O=u.trim(),B=O.length>0&&O.length<=e0,K=I.trim()===""?void 0:parseInt(I.trim(),10),q=I.trim()===""||Number.isFinite(K)&&K!==void 0&&K>0&&K<=500;return r.jsx(Ln,{open:e,onOpenChange:t,children:r.jsx(En,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async _=>{if(_.preventDefault(),!B||!q||P)return;$(!0),F(null);const G=ha(w),D=G?{...G,field:"started"}:void 0,H={filters:{project:m,agent:g,sessionStatus:b,dateRange:D},sortField:k,sortDirection:S,limit:K};try{await s(O,H)}catch(Z){F(Z instanceof Error?Z.message:String(Z)),$(!1)}},children:[r.jsx(Xn,{children:r.jsx(Tn,{children:o?"Edit session view":"Create session view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),r.jsx("input",{id:"create-session-view-name",type:"text",value:u,autoFocus:!0,required:!0,maxLength:e0,onChange:_=>d(_.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ui,{label:"Date range (session start)",children:r.jsx(vp,{className:"w-full",value:w,onChange:v})}),r.jsx(ui,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:z,value:m,onChange:h})}),r.jsx(ui,{label:"Agent",children:r.jsx(xn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:V,value:g,onChange:y})}),r.jsx(ui,{label:"Session status",children:r.jsx(xn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:QM,value:b,onChange:C})}),r.jsx(ui,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:_=>E(_.target.value),className:"editor-input w-full",children:YM.map(_=>r.jsx("option",{value:_,children:JM[_]??_},_))}),r.jsx("button",{type:"button",onClick:()=>T(_=>_==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),r.jsxs(ui,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:I,onChange:_=>R(_.target.value),placeholder:"No limit",className:"editor-input w-full"}),q?null:r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),L?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:L}):null,r.jsxs(Rr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:A,className:"shell-action",disabled:P,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:P,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!B||!q||P,className:"shell-action shell-action--cta disabled:opacity-50",children:P?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function ui({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 XM=4e3;function Io(){const[e,t]=f.useState(null),n=f.useRef(null),s=f.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),o=f.useCallback((i,l="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:l}),n.current=setTimeout(()=>{t(null),n.current=null},XM)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:s}}function ka({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:be("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 Jh({title:e,message:t,onPickAnother:n}){return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:e}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?r.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function ZM({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:o,error:i}=Wf(),{view:l,loading:u,ready:d}=Ro(e??null),{layout:m}=YN(),{showToast:h}=Io(),[g,y]=f.useState(!1),b=f.useCallback(async v=>{if(!t)return;const k=m.slots.map(E=>E.id===t?{...E,widget:v?{kind:"agent-sessions",viewId:v}:{kind:"agent-sessions"}}:E);try{await Hg(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function C(v,k){const{workspace:E,config:S}=Ly(k,null);try{const I=(await Bi({name:v,workspace:E,config:S,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");I&&await b(I.id),y(!1),h(`Created session view "${v}"`)}catch(T){throw h(T instanceof Error?T.message:"Failed to create session view"),T}}let w;return e?u&&!d?w=r.jsx(mt,{label:"Loading view…"}):l?l.entityType!=="session"?w=r.jsx(Jh,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):w=r.jsx(FM,{view:l,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):w=r.jsx(Jh,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!s?w=r.jsx(mt,{label:"Loading sessions…"}):i?w=r.jsx(Jh,{title:"Couldn't load sessions",message:i}):w=r.jsx(BC,{sessions:(s==null?void 0:s.sessions)??[]}),r.jsxs("div",{className:"space-y-2",children:[t?r.jsx("div",{className:"flex items-center justify-between gap-2",children:r.jsx(zM,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,w,r.jsx(qC,{open:g,onOpenChange:y,workspace:null,onSubmit:C})]})}const eF=5;function tF(){const{data:e,loading:t,error:n}=US();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 o=((e==null?void 0:e.inventories)??[]).slice(0,eF);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(Te,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const l=i.inventory,u=i.active_leases.length,d=i.members.length,m=l.display_name??l.slug;return r.jsx("li",{children:r.jsxs(Te,{to:`/inventories/${encodeURIComponent(l.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",d," leased"]})]})},l.slug)})})]})}function nF(e){let t=0,n=0;for(const s of e.daily)t+=s.total_tokens,n+=s.total_cost;return{tokens:t,cost:n}}function t0({filters:e,metric:t}){const n=e??{},{data:s,loading:o,error:i}=hD(n),l=t==="cost"?"Spend":"Token Usage",u=`/usage?${Pg(n).toString()}`;let d;if(o&&!s)d=r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!s)d=r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!s||s.daily.length===0)d=r.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:m,cost:h}=nF(s),g=t==="cost"?{label:"Total spend",value:Fi(h)}:{label:"Total tokens",value:Mi(m)},y=t==="cost"?{label:"Tokens",value:Mi(m)}:{label:"Spend",value:Fi(h)};d=r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(n0,{label:g.label,value:g.value,emphasize:!0}),r.jsx(n0,{label:y.label,value:y.value})]})}return r.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",title:Zw(n),children:Zw(n)})]}),r.jsx(Te,{to:u,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),r.jsx("div",{className:"px-4 py-4",children:d})]})}function n0({label:e,value:t,emphasize:n}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const rF={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function sF(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const di="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function r0({config:e,open:t,onSave:n,onCancel:s}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Ts(),{data:l}=ba(),{data:u}=WS(t),[d,m]=f.useState("30d"),[h,g]=f.useState(""),[y,b]=f.useState(""),[C,w]=f.useState(""),[v,k]=f.useState(""),[E,S]=f.useState(""),[T,I]=f.useState(""),[R,P]=f.useState(!1),[$,L]=f.useState(null);f.useEffect(()=>{if(!t)return;const B=sF(e);m(B.window??"30d"),g(B.since??""),b(B.until??""),w(B.project??""),k(B.workspace??""),S(B.model??""),I(B.tool??""),P(!1),L(null)},[t,e]);function F(){return Kc({window:d,since:d==="custom"?h:void 0,until:d==="custom"?y:void 0,project:C||void 0,workspace:v||void 0,model:E||void 0,tool:T||void 0})}async function A(B){if(B.preventDefault(),R)return;const K=F(),q=sD(K);if(!q.ok){L(q.errors.join("; "));return}P(!0),L(null);const _=e.kind==="token-usage"?{kind:"token-usage",filters:K}:e.kind==="spend"?{kind:"spend",filters:K}:e;try{await n(_)}catch(G){L(G instanceof Error?G.message:String(G)),P(!1)}}const z=(i==null?void 0:i.map(B=>B.slug))??[],V=(l==null?void 0:l.workspaces)??[],O=(l==null?void 0:l.hasUngrouped)??!1;return r.jsx(Ln,{open:t,onOpenChange:B=>{B||s()},children:r.jsx(En,{className:"max-w-md",children:r.jsxs("form",{onSubmit:A,children:[r.jsx(Xn,{children:r.jsx(Tn,{children:o})}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:Bf.map(B=>r.jsx("button",{type:"button",onClick:()=>m(B),className:"rounded px-2.5 py-1 text-sm border "+(B===d?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:rF[B]},B))})]}),d==="custom"?r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Since"}),r.jsx("input",{type:"date",value:h,onChange:B=>g(B.target.value),className:di})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Until"}),r.jsx("input",{type:"date",value:y,onChange:B=>b(B.target.value),className:di})]})]}):null,r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),r.jsxs("select",{value:v,onChange:B=>{k(B.target.value),B.target.value&&w("")},className:di,children:[r.jsx("option",{value:"",children:"All workspaces"}),O?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,V.map(B=>r.jsx("option",{value:B,children:B},B))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Project"}),r.jsxs("select",{value:C,onChange:B=>{w(B.target.value),B.target.value&&k("")},className:di,children:[r.jsx("option",{value:"",children:"All projects"}),z.map(B=>r.jsx("option",{value:B,children:B},B))]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Model"}),r.jsxs("select",{value:E,onChange:B=>S(B.target.value),className:di,children:[r.jsx("option",{value:"",children:"All models"}),((u==null?void 0:u.models)??[]).map(B=>r.jsx("option",{value:B,children:B},B))]})]}),r.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Tool"}),r.jsxs("select",{value:T,onChange:B=>I(B.target.value),className:di,children:[r.jsx("option",{value:"",children:"All tools"}),((u==null?void 0:u.tools)??[]).map(B=>r.jsx("option",{value:B,children:B},B))]})]})]}),$?r.jsx("p",{className:"text-xs text-destructive",role:"alert",children:$}):null]}),r.jsxs(Rr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:s,disabled:R,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:R,className:"shell-action shell-action--cta",children:R?"Saving…":"Save"})]})]})})})}const Iy={"saved-view":{title:"Saved view",icon:fS,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(AM,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Of,render:(e,t)=>e.kind!=="agent-sessions"?null:f.createElement(ZM,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Ff,render:()=>f.createElement(tF)},"token-usage":{title:"Token Usage",icon:HP,render:e=>e.kind!=="token-usage"?null:f.createElement(t0,{filters:e.filters,metric:"tokens"}),ConfigEditor:r0},spend:{title:"Spend",icon:Wc,render:e=>e.kind!=="spend"?null:f.createElement(t0,{filters:e.filters,metric:"cost"}),ConfigEditor:r0}},GC=50,ex=16,oF=2,da=6,Sf=11,tx={w:6,h:2};function Qd(e,t,n){return Math.min(Math.max(e,t),n)}const aF=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function iF(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of aF)if(e>=t.minWidth)return t.columns;return 1}function Xd(e,t){return t<=0?1:Qd(Math.round(e/Dc*t),1,t)}function nx(e){if(h5(e))return e;switch(e){case"small":return{w:8,h:da};case"wide":return{w:16,h:da};case"tall":return{w:8,h:Sf};case"large":return{w:16,h:Sf};default:return{w:8,h:da}}}function lF(e,t){return t>0?Math.round(e/t):0}function cF(e,t=GC){return Math.round(e/t)}const uF=[{label:"Third",w:8,h:da},{label:"Half",w:12,h:da},{label:"Two-thirds",w:16,h:da},{label:"Full",w:24,h:da},{label:"Half tall",w:12,h:Sf},{label:"Full tall",w:24,h:Sf}];function dF({slot:e,activeColumns:t,colWidthPx:n,onReplace:s,onRemove:o,onRemoveSlot:i,onResize:l,onConfigChange:u}){const[d,m]=f.useState(!1),[h,g]=f.useState(null),y=f.useRef(null),{attributes:b,listeners:C,setNodeRef:w,setActivatorNodeRef:v,transform:k,transition:E,isDragging:S}=cp({id:e.id}),T=nx(e.size),I=h?h.renderW:Xd(T.w,t),R=h?h.h:T.h,P={transform:ns.Translate.toString(k),transition:E,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${I}`,gridRow:`span ${R}`};function $(K){y.current=null;try{K.currentTarget.releasePointerCapture(K.pointerId)}catch{}g(null)}function L(K){return{onPointerDown:q=>{if(y.current)return;q.preventDefault(),q.stopPropagation(),q.currentTarget.setPointerCapture(q.pointerId);const _=Xd(T.w,t);y.current={pointerId:q.pointerId,startX:q.clientX,startY:q.clientY,startRenderW:_,startH:T.h,axis:K,lastRenderW:_,lastH:T.h},g({renderW:_,h:T.h})},onPointerMove:q=>{const _=y.current;if(!_||q.pointerId!==_.pointerId)return;let G=_.startRenderW,D=_.startH;(_.axis==="w"||_.axis==="both")&&(G=Qd(_.startRenderW+lF(q.clientX-_.startX,n),1,t)),(_.axis==="h"||_.axis==="both")&&(D=Qd(_.startH+cF(q.clientY-_.startY),oF,BN)),_.lastRenderW=G,_.lastH=D,g({renderW:G,h:D})},onPointerUp:q=>{const _=y.current;if(!_||q.pointerId!==_.pointerId)return;const G=nx(e.size),H={w:_.axis==="h"?G.w:Qd(Math.round(_.lastRenderW/t*Dc),1,Dc),h:_.lastH};$(q),(H.w!==G.w||H.h!==G.h)&&l(H)},onPointerCancel:q=>{const _=y.current;_&&q.pointerId===_.pointerId&&$(q)},onLostPointerCapture:q=>{const _=y.current;_&&q.pointerId===_.pointerId&&$(q)}}}const F="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",A=r.jsxs(r.Fragment,{children:[t>1?r.jsx("div",{"aria-hidden":"true",className:be(F,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),...L("w")}):null,r.jsx("div",{"aria-hidden":"true",className:be(F,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),...L("h")}),t>1?r.jsx("div",{"aria-hidden":"true",className:be(F,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),...L("both")}):null]}),z=r.jsx("button",{ref:v,...b,...C,type:"button","aria-label":"Drag to reorder widget",className:"touch-none cursor-grab text-muted-foreground/40 transition hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 active:cursor-grabbing",children:r.jsx(Yi,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return r.jsxs("div",{ref:w,style:{...P,gridColumn:`span ${Xd(tx.w,t)}`,gridRow:`span ${tx.h}`},className:be("relative flex items-center justify-center rounded-lg border border-dashed border-border bg-card/40 p-3 shadow-sm transition-colors hover:border-primary/40 hover:bg-card/60",S&&"opacity-0"),children:[r.jsx("div",{className:"absolute left-2 top-2",children:z}),r.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:K=>K.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:r.jsx(yn,{className:"h-4 w-4"})}),r.jsxs("button",{type:"button",onClick:s,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(jt,{className:"h-4 w-4"}),"Add widget"]})]});const V=Iy[e.widget.kind];if(!V)return r.jsxs("div",{ref:w,style:P,className:be("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[r.jsxs("div",{className:"flex items-start gap-2",children:[z,r.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]}),A]});const O=V.icon,B=V.ConfigEditor;return r.jsxs("div",{ref:w,style:P,className:be("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[r.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[z,r.jsx(O,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(pF,{slot:e,fallback:V.title})})]}),r.jsx(Dy,{items:[{key:"replace",label:"Replace…",icon:e3,onSelect:s},...V.ConfigEditor?[{key:"configure",label:"Configure…",icon:o3,onSelect:()=>m(!0)}]:[],{key:"size",label:"Size",icon:JP,submenu:uF.map(K=>({key:`size-${K.label}`,label:K.label,active:T.w===K.w&&T.h===K.h,onSelect:()=>l({w:K.w,h:K.h})}))},{key:"remove",label:"Remove",icon:yn,destructive:!0,onSelect:o}]})]}),r.jsx("div",{children:V.render(e.widget,{slotId:e.id,onPickAnother:s})}),B?r.jsx(B,{config:e.widget,open:d,onSave:async K=>{await u(K),m(!1)},onCancel:()=>m(!1)}):null,A]})}function fF({slot:e,activeColumns:t,colWidthPx:n}){const s=e.widget?Iy[e.widget.kind]:null,o=s==null?void 0:s.icon,i=e.widget===null?"Empty widget slot":(s==null?void 0:s.title)??`Unknown widget kind: ${e.widget.kind}`,l=e.widget===null?tx:nx(e.size),u=Xd(l.w,t),d=n>0?u*n+(u-1)*ex:void 0;return r.jsx("div",{"aria-hidden":"true",className:"min-w-[200px] rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",style:{width:d?`${Math.max(d,200)}px`:void 0},children:r.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(Yi,{className:"h-4 w-4","aria-hidden":"true"}),o?r.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,r.jsx("span",{className:"min-w-0 flex-1 truncate",children:i})]})})}function pF({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:s}=Ro(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const mF=["agent-sessions","inventories","token-usage","spend"];function hF({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:o}=Zc();function i(l){n(l),t(!1)}return r.jsx(Ln,{open:e,onOpenChange:t,children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:"Add a widget"}),r.jsx(Wr,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:mF.map(l=>{const u=Iy[l],d=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:l}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(d,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},l)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Te,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsxs("div",{className:"space-y-3",children:[s.some(l=>l.entityType!=="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(l=>l.entityType!=="session").map(l=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:l.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:l.name}),l.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: ${l.workspace}`,children:l.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:l.config.viewMode})]})},l.id))})]}),s.some(l=>l.entityType==="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(l=>l.entityType==="session").map(l=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:l.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:l.name}),l.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: ${l.workspace}`,children:l.workspace}):null]})},l.id))})]})]}),!o&&s.some(l=>l.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const gF=(e,{currentCoordinates:t,context:n})=>{var g;const s=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();const o=n.over??n.active,i=(g=o==null?void 0:o.data.current)==null?void 0:g.sortable,l=i==null?void 0:i.items;if(!o||!l)return t;const u=l.indexOf(o.id);if(u===-1)return t;const d=l[u+s],m=d===void 0?null:n.droppableRects.get(d),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function xF(e){const t=new Set(e.map(o=>o.id));let n=-1;for(const o of t){const i=/^slot-(\d+)$/.exec(o);if(i){const l=parseInt(i[1],10);l>n&&(n=l)}}let s=n+1;for(;t.has(`slot-${s}`);)s++;return`slot-${s}`}function yF(e,t){const n={id:xF(e),widget:null};return[...e,n]}function bF(e,t){return e.filter(n=>n.id!==t)}function vF(){const{data:e,error:t,refetch:n}=iD(),{data:s}=FS(),{layout:o}=YN(),[i,l]=f.useState(!1),[u,d]=f.useState(null),[m,h]=f.useState(null),[g,y]=f.useState(o.slots),[b,C]=f.useState(null),w=f.useRef(null),[v,k]=f.useState(Dc),[E,S]=f.useState(0);f.useEffect(()=>{const q=w.current;if(!q)return;const _=new ResizeObserver(G=>{for(const D of G){const H=D.contentRect.width,Z=iF(H),U=Z>0?(H-(Z-1)*ex)/Z:0;k(Z),S(U)}});return _.observe(q),()=>_.disconnect()},[]),f.useEffect(()=>{y(o.slots)},[o.slots]);const T=np(To(rl,{activationConstraint:{distance:8}}),To(nl,{coordinateGetter:gF}));Lo("list:overview"),Kt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const I=f.useCallback(q=>{d(q),l(!0)},[]),R=f.useCallback(async(q,_)=>{h(null),y(q);try{await Hg(q)}catch(G){y(_),h(G instanceof Error?G.message:String(G))}},[]),P=f.useCallback(q=>{if(u===null)return;const _=g.map((G,D)=>D===u?{...G,widget:q}:G);d(null),R(_,g)},[g,u,R]),$=f.useCallback(q=>{const _=g.map((G,D)=>D===q?{...G,widget:null,size:void 0}:G);R(_,g)},[g,R]),L=f.useCallback(q=>{const _=bF(g,q);R(_,g)},[g,R]),F=f.useCallback(()=>{const q=yF(g);R(q,g)},[g,R]),A=f.useCallback((q,_)=>{const G=g.map((D,H)=>H===q?{...D,size:_}:D);R(G,g)},[g,R]),z=f.useCallback(q=>{const{active:_,over:G}=q;if(C(null),!G||_.id===G.id)return;const D=g.findIndex(U=>U.id===_.id),H=g.findIndex(U=>U.id===G.id);if(D===-1||H===-1)return;const Z=sl(g,D,H);R(Z,g)},[g,R]),V=f.useCallback(q=>{C(String(q.active.id))},[]),O=g.find(q=>q.id===b)??null,B=f.useCallback(async(q,_)=>{const G=g,D=g.map((H,Z)=>Z===q?{...H,widget:_}:H);h(null),y(D);try{await Hg(D)}catch(H){y(G);const Z=H instanceof Error?H.message:String(H);throw h(Z),H instanceof Error?H:new Error(Z)}},[g]),K={};if(e)for(const q of Object.keys(e.segments))for(const _ of e.segments[q].items)K[_.id]=_;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(p5,{hero:e.hero,itemsById:K}):t?r.jsx(kt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(d5,{help:s}):null,m?r.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:["Couldn't save dashboard layout: ",m]}):null,r.jsxs(ip,{sensors:T,collisionDetection:rp,onDragStart:V,onDragCancel:()=>C(null),onDragEnd:z,children:[r.jsx(lp,{items:g.map(q=>q.id),strategy:yy,children:r.jsx("div",{ref:w,style:{display:"grid",gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`,gridAutoRows:`${GC}px`,gridAutoFlow:"dense",gap:`${ex}px`},children:g.map((q,_)=>r.jsx(dF,{slot:q,index:_,activeColumns:v,colWidthPx:E,onReplace:()=>I(_),onRemove:()=>$(_),onRemoveSlot:()=>L(q.id),onResize:G=>A(_,G),onConfigChange:G=>B(_,G)},q.id))})}),r.jsx(QO,{dropAnimation:null,children:O?r.jsx(fF,{slot:O,activeColumns:v,colWidthPx:E}):null})]}),r.jsxs("button",{type:"button",onClick:F,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(jt,{className:"h-4 w-4"}),"Add slot"]}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Lx,{className:"h-3 w-3","aria-hidden":"true"}),r.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,r.jsx(hF,{open:i,onOpenChange:q=>{l(q),q||d(null)},onSelect:P})]})}function wF({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 jF(){const{data:e,loading:t,error:n}=FS(),{openCheatsheet:s}=$o();return t?r.jsx(mt,{label:"Loading help…"}):n||!e?r.jsx(kt,{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. ",Ss("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(o=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),r.jsx(We,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(qd,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?r.jsx(Te,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(We,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>r.jsx(wF,{term:o.term,description:o.description},o.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),r.jsx(We,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),r.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),r.jsx(We,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx(Te,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),r.jsx(We,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>r.jsx(qd,{command:o.command,description:o.description,example:o.example},o.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(We,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),r.jsx(We,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(qd,{command:o.command.command,example:o.command.example}):null,o.href?r.jsx(Te,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Oy({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 jp=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(Do,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));jp.displayName="SearchInput";function kp({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:be("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 kF={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"},s0=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function Nf({progress:e,className:t,showLegend:n=!1}){const s=cs(),o=f.useMemo(()=>{let l=0;return(s.order.length>0?s.order:Object.keys(e).filter(d=>d!=="total")).map(d=>({key:d,className:kF[d]??s0[l++%s0.length]}))},[s.order,e]),i=o.filter(l=>(e[l.key]??0)>0);return r.jsxs("div",{className:be("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):i.map(l=>r.jsx("div",{className:l.className,style:{width:`${(e[l.key]??0)/e.total*100}%`},title:`${kn(l.key)}: ${e[l.key]??0}`},l.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.map(l=>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:be("h-2 w-2 rounded-full",l.className)}),r.jsx("span",{children:kn(l.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[l.key]??0})]},l.key))}):null]})}const SF=["pending","active","blocked","failed","completed"],_y=SF,NF=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function YC(e){return e&&e.length>0?e:[...NF]}function CF(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[o]=s.splice(t,1),i=t<n?n-1:n;return s.splice(Math.max(0,Math.min(i,s.length)),0,o),s}const EF=220,Td=8;function JC({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[o,i]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){i(null);return}const l=s.current,u=(l==null?void 0:l.offsetWidth)??EF,d=(l==null?void 0:l.offsetHeight)??0,m=Math.max(Td,window.innerWidth-u-Td),h=Math.max(Td,window.innerHeight-d-Td);i({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function l(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function d(){n()}return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),document.addEventListener("contextmenu",l),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",l),window.removeEventListener("scroll",d,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:r.jsx(ma,{delayDuration:200,children:t.map(l=>{const u=l.icon,d=be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",l.disabled?"cursor-not-allowed opacity-50":l.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:l.label})]});if(l.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:d,children:m})});return l.disabledReason?r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:h}),r.jsx(cr,{side:"left",children:l.disabledReason})]},l.key):r.jsx("div",{children:h},l.key)}return l.href?r.jsx(Te,{to:l.href,className:d,onClick:()=>n(),children:m},l.key):r.jsx("button",{type:"button",className:d,onClick:()=>{var h;(h=l.onSelect)==null||h.call(l),n()},children:m},l.key)})})})}const TF="__ungrouped__";function My({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:l,loading:u}=ba(),[d,m]=f.useState(n),[h,g]=f.useState(!1),[y,b]=f.useState(null);f.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=f.useMemo(()=>[...((l==null?void 0:l.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:TF,label:"Ungrouped",value:null}],[l]),w=!h&&d!==n;async function v(){if(w){g(!0),b(null);try{await s(d),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(Ln,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(En,{children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:o}),r.jsx(Wr,{children:i})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx($x,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,S=k.value===d;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:be("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:be("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?r.jsx(Tr,{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(Rr,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:v,disabled:!w,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function o0(){const{workspace:e}=Mt(),t=un(),n=_t(),{data:s,loading:o,error:i,refetch:l}=Ts(),u=f.useRef(null);Lo("list:projects");const[d,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[C,w]=f.useState("updated"),[v,k]=is(),E=v.get("view"),S=E==="table"||E==="kanban"?E:"cards",T=_=>{k(G=>{const D=new URLSearchParams(G);return _==="cards"?D.delete("view"):D.set("view",_),D})},[I,R]=f.useState({}),[P,$]=f.useState(null),[L,F]=f.useState(null),A=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:d.trim()?`${_.title} ${_.tags.join(" ")} ${_.slug}`.toLowerCase().includes(d.toLowerCase()):!0}).sort((_,G)=>PF(_,G,C)):[],[s,d,h,y,C,e]),z=A.map(_=>`${_.slug}:${_.status}`).join("|");f.useEffect(()=>{R(DF(A))},[z,C]);const V=f.useMemo(()=>{const _=new Map(A.map(G=>[G.slug,G]));return _y.flatMap(G=>(I[G]??A.filter(H=>H.status===G).map(H=>H.slug)).map(H=>_.get(H)).filter(H=>!!H))},[A,I]),{visibleItems:O,visibleIndexByKey:B}=f.useMemo(()=>{const _=S==="kanban"?V:A,G=new Map;return _.forEach((D,H)=>G.set(D.slug,H)),{visibleItems:_,visibleIndexByKey:G}},[S,A,V]),{hotkeyRowProps:K}=Gc(O,{scope:"list:projects",onOpen:_=>n(`${t}/projects/${_.slug}`)});if(Kt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var _;return(_=u.current)==null?void 0:_.focus()}}),Kt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>l()}),o)return r.jsx(mt,{label:"Loading projects…"});if(i||!s)return r.jsx(kt,{error:i||"Project list is unavailable."});const q=Array.from(new Set(s.flatMap(_=>_.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Oy,{children:[r.jsx(jp,{ref:u,value:d,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:_=>g(_.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"}),q.map(_=>r.jsx("option",{value:_,children:_},_))]}),r.jsxs("select",{value:C,onChange:_=>w(_.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(kp,{value:S,onChange:_=>T(_),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),A.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(Te,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Te,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(wt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Te,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):S==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:A.map((_,G)=>r.jsxs(Te,{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",...K(G),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:_.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Mn(_.updated)]})]}),r.jsx(bn,{status:_.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(Nf,{progress:_.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:_.tags.map(D=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:D},D))}),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))}):S==="table"?r.jsx(We,{title:`${A.length} project${A.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:A.map((_,G)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...K(G),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Te,{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(D=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:D},D))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(bn,{status:_.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(Nf,{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:Mn(_.updated)})]},_.slug))})]})})}):r.jsx(bp,{columns:AF,items:V,getItemId:_=>_.slug,getColumnId:_=>_.status,canDrop:({fromColumnId:_,toColumnId:G})=>({allowed:!0,reason:_===G?void 0:"This will set a manual status override on the project."}),onMove:({item:_,fromColumnId:G,toColumnId:D,fromIndex:H,toIndex:Z})=>{if(G===D){const U=I[G]??A.filter(oe=>oe.status===G).map(oe=>oe.slug);R(oe=>({...oe,[G]:CF(U,H,Z)}));return}fetch(`/api/projects/${_.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:D})}).then(()=>{window.location.reload()})},getExternalDragData:_=>({type:"project",id:_.slug}),onCardContextMenu:(_,G)=>{G.preventDefault(),$({project:_,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:_=>`No ${_.title.toLowerCase()} projects.`,renderCard:(_,{dragging:G})=>{const D=B.get(_.slug)??-1;return r.jsx("div",{...D>=0?K(D):{},children:r.jsx($F,{project:_,dragging:G})})}}),r.jsx(JC,{anchor:(P==null?void 0:P.anchor)??null,items:P?[{key:"edit",label:"Edit",icon:Ji,onSelect:()=>n(`${t}/projects/${P.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Mf,onSelect:()=>F(P.project)}]:[],onClose:()=>$(null)}),r.jsx(My,{open:L!==null,onOpenChange:_=>{_||F(null)},currentWorkspace:(L==null?void 0:L.workspace)??null,title:"Move project to workspace",onSubmit:async _=>{if(!L)return;const G=await fetch(`/api/projects/${encodeURIComponent(L.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:_})});if(!G.ok){const D=await G.json().catch(()=>({}));throw new Error(D.error||"Failed to move project")}l()}}),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(Dx,{className:"mt-0.5 h-4 w-4"}),r.jsxs("p",{children:["Project status is derived from assignment state by default.",S==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const RF={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},AF=_y.map(e=>({id:e,title:RF[e],description:ru(e)}));function PF(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return a0(t)-a0(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function a0(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function DF(e){return Object.fromEntries(_y.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function $F({project:e,dragging:t}){const n=un();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(Te,{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 ",Mn(e.updated)]})]}),r.jsx(bn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(Nf,{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 Cf({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:be("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function LF(){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(_f,{className:"h-3 w-3"}),"Archived"]})}function i0(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function IF(){const{data:e,loading:t,error:n,refetch:s}=lD(),[o,i]=f.useState(null),[l,u]=f.useState(null),[d,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=Io();async function b(S,T,I){i(T),u(null);try{const R=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const P=await R.json().catch(()=>null);throw new Error((P==null?void 0:P.error)||`HTTP ${R.status}`)}s(),g(I,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{i(null)}}function C(S){return b(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function w(S){const T=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return b(T,`assignment:${S.id}`,"Assignment restored")}if(t)return r.jsx(mt,{label:"Loading archived content…"});if(n)return r.jsx(kt,{error:n});const v=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=v.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ka,{toast:h,onDismiss:y}),r.jsx(Cf,{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."}),l?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:l}):null,E?r.jsx(wt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[v.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:v.map(S=>{const T=d[S.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(I=>({...I,[S.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(fr,{className:"h-4 w-4"}):r.jsx(lS,{className:"h-4 w-4"}),r.jsx(Ax,{className:"h-4 w-4 text-muted-foreground"}),S.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Br(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Te,{to:`/projects/${S.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(S),disabled:o===`project:${S.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(tf,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&S.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(I=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Te,{to:i0(I),className:"text-foreground hover:text-foreground/80",children:I.title}),r.jsx(bn,{status:I.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:I.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},I.id))})]},S.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(S=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Te,{to:i0(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),r.jsx(bn,{status:S.status,showIcon:!1}),r.jsx(LF,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Br(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>w(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(tf,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const l0="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",c0="block min-w-0 truncate";function Fy({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:be("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:be(l0,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[r.jsx("span",{className:c0,children:o}),r.jsx(Gi,{className:"h-2.5 w-2.5 shrink-0"})]},i):r.jsx("span",{className:l0,title:o,children:r.jsx("span",{className:c0,children:o})},i)})})}const OF={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 _n({label:e,value:t,description:n,icon:s,tone:o="default",to:i}){const l=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=be(OF[o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?r.jsx(Te,{to:i,className:u,children:l}):r.jsx("article",{className:u,children:l})}function u0(e){const t=_F(e),n=f.forwardRef((s,o)=>{const{children:i,...l}=s,u=f.Children.toArray(i),d=u.find(FF);if(d){const m=d.props.children,h=u.map(g=>g===d?f.Children.count(m)>1?f.Children.only(null):f.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...l,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...l,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function _F(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const l=BF(o),u=zF(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Yf(s,l):l),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var MF=Symbol("radix.slottable");function FF(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===MF}function zF(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function BF(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function UF(e){const t=e+"CollectionProvider",[n,s]=va(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=w=>{const{scope:v,children:k}=w,E=Dt.useRef(null),S=Dt.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:S,collectionRef:E,children:k})};l.displayName=t;const u=e+"CollectionSlot",d=u0(u),m=Dt.forwardRef((w,v)=>{const{scope:k,children:E}=w,S=i(u,k),T=Vn(v,S.collectionRef);return r.jsx(d,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=u0(h),b=Dt.forwardRef((w,v)=>{const{scope:k,children:E,...S}=w,T=Dt.useRef(null),I=Vn(v,T),R=i(h,k);return Dt.useEffect(()=>(R.itemMap.set(T,{ref:T,...S}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:I,children:E})});b.displayName=h;function C(w){const v=i(e+"CollectionConsumer",w);return Dt.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const S=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,P)=>S.indexOf(R.ref.current)-S.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:l,Slot:m,ItemSlot:b},C,s]}var WF=f.createContext(void 0);function QC(e){const t=f.useContext(WF);return e||t||"ltr"}var Qh="rovingFocusGroup.onEntryFocus",HF={bubbles:!1,cancelable:!0},ou="RovingFocusGroup",[rx,XC,VF]=UF(ou),[KF,ZC]=va(ou,[VF]),[qF,GF]=KF(ou),eE=f.forwardRef((e,t)=>r.jsx(rx.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(rx.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(YF,{...e,ref:t})})}));eE.displayName=ou;var YF=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:l,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=f.useRef(null),b=Vn(t,y),C=QC(i),[w,v]=Jf({prop:l,defaultProp:u??null,onChange:d,caller:ou}),[k,E]=f.useState(!1),S=ga(m),T=XC(n),I=f.useRef(!1),[R,P]=f.useState(0);return f.useEffect(()=>{const $=y.current;if($)return $.addEventListener(Qh,S),()=>$.removeEventListener(Qh,S)},[S]),r.jsx(qF,{scope:n,orientation:s,dir:C,loop:o,currentTabStopId:w,onItemFocus:f.useCallback($=>v($),[v]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>P($=>$+1),[]),onFocusableItemRemove:f.useCallback(()=>P($=>$-1),[]),children:r.jsx(vn.div,{tabIndex:k||R===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Qt(e.onMouseDown,()=>{I.current=!0}),onFocus:Qt(e.onFocus,$=>{const L=!I.current;if($.target===$.currentTarget&&L&&!k){const F=new CustomEvent(Qh,HF);if($.currentTarget.dispatchEvent(F),!F.defaultPrevented){const A=T().filter(K=>K.focusable),z=A.find(K=>K.active),V=A.find(K=>K.id===w),B=[z,V,...A].filter(Boolean).map(K=>K.ref.current);rE(B,h)}}I.current=!1}),onBlur:Qt(e.onBlur,()=>E(!1))})})}),tE="RovingFocusGroupItem",nE=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:l,...u}=e,d=Ei(),m=i||d,h=GF(tE,n),g=h.currentTabStopId===m,y=XC(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:w}=h;return f.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(rx.ItemSlot,{scope:n,id:m,focusable:s,active:o,children:r.jsx(vn.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:Qt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Qt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Qt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=XF(v,h.orientation,h.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=y().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")S.reverse();else if(k==="prev"||k==="next"){k==="prev"&&S.reverse();const T=S.indexOf(v.currentTarget);S=h.loop?ZF(S,T+1):S.slice(T+1)}setTimeout(()=>rE(S))}}),children:typeof l=="function"?l({isCurrentTabStop:g,hasTabStop:w!=null}):l})})});nE.displayName=tE;var JF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function QF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function XF(e,t,n){const s=QF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return JF[s]}function rE(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function ZF(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var e6=eE,t6=nE,Sp="Tabs",[n6]=va(Sp,[ZC]),sE=ZC(),[r6,zy]=n6(Sp),oE=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:l="horizontal",dir:u,activationMode:d="automatic",...m}=e,h=QC(u),[g,y]=Jf({prop:s,onChange:o,defaultProp:i??"",caller:Sp});return r.jsx(r6,{scope:n,baseId:Ei(),value:g,onValueChange:y,orientation:l,dir:h,activationMode:d,children:r.jsx(vn.div,{dir:h,"data-orientation":l,...m,ref:t})})});oE.displayName=Sp;var aE="TabsList",iE=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=zy(aE,n),l=sE(n);return r.jsx(e6,{asChild:!0,...l,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(vn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});iE.displayName=aE;var lE="TabsTrigger",cE=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,l=zy(lE,n),u=sE(n),d=fE(l.baseId,s),m=pE(l.baseId,s),h=s===l.value;return r.jsx(t6,{asChild:!0,...u,focusable:!o,active:h,children:r.jsx(vn.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":m,"data-state":h?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...i,ref:t,onMouseDown:Qt(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?l.onValueChange(s):g.preventDefault()}),onKeyDown:Qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&l.onValueChange(s)}),onFocus:Qt(e.onFocus,()=>{const g=l.activationMode!=="manual";!h&&!o&&g&&l.onValueChange(s)})})})});cE.displayName=lE;var uE="TabsContent",dE=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...l}=e,u=zy(uE,n),d=fE(u.baseId,s),m=pE(u.baseId,s),h=s===u.value,g=f.useRef(h);return f.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(wa,{present:o||h,children:({present:y})=>r.jsx(vn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!y,id:m,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&i})})});dE.displayName=uE;function fE(e,t){return`${e}-trigger-${t}`}function pE(e,t){return`${e}-content-${t}`}var mE=oE,hE=iE,sx=cE,ox=dE;function Np({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(mE,{value:e,onValueChange:t,className:s,children:[r.jsx(hE,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(o=>r.jsxs(sx,{value:o.value,className:be("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[r.jsx("span",{children:o.label}),typeof o.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:o.count}):null,o.problemCount&&o.problemCount>0?r.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,title:`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,children:o.problemCount}):null]},o.value))}),n.map(o=>r.jsx(ox,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const s6="modulepreload",o6=function(e){return"/"+e},d0={},a6=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let l=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=l(n.map(m=>{if(m=o6(m),m in d0)return;d0[m]=!0;const h=m.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const y=document.createElement("link");if(y.rel=h?"stylesheet":s6,h||(y.as="script"),y.crossOrigin="",y.href=m,d&&y.setAttribute("nonce",d),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function i(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return o.then(l=>{for(const u of l||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function i6({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[o,i]=f.useState(null),[l,u]=f.useState(!0),d=_t(),m=document.documentElement.classList.contains("dark")?"dark":"default";return f.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await a6(async()=>{const{default:w}=await import("./mermaid.core-7QJzPWTu.js").then(v=>v.bF);return{default:w}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:l6(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,c6(s.current,n,d),u(!1)}catch(y){h||(i(y instanceof Error?y.message:"Failed to render graph"),u(!1))}}return u(!0),i(null),g(),()=>{h=!0}},[e,d,n,m]),o?r.jsxs("div",{className:be("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:be("rounded-lg border border-border bg-card p-4",t),children:[l&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function l6(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).trim();return y?`oklch(${y})`:""},s=n("--card"),o=n("--card-foreground"),i=n("--border"),l=n("--primary"),u=n("--primary-foreground"),d=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:o,primaryBorderColor:i,secondaryColor:d,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:d,tertiaryTextColor:m,tertiaryBorderColor:i,lineColor:e?m:i,textColor:o,mainBkg:s,nodeBkg:s,nodeTextColor:o,nodeBorder:i,clusterBkg:d,clusterBorder:i,edgeLabelBackground:s,titleColor:o,activeTaskBkgColor:l,activeTaskBorderColor:l,altBackground:d,labelColor:o,errorBkgColor:h,errorTextColor:u}}function c6(e,t,n){var s;for(const o of e.querySelectorAll(".node")){const i=((s=o.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",l=t[i];if(!l)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const u=()=>n(l);o.addEventListener("click",u),o.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u())})}}function u6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const d6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,f6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,p6={};function f0(e,t){return(p6.jsx?f6:d6).test(e)}const m6=/[ \t\n\f\r]/g;function h6(e){return typeof e=="object"?e.type==="text"?p0(e.value):!1:p0(e)}function p0(e){return e.replace(m6,"")===""}class au{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}au.prototype.normal={};au.prototype.property={};au.prototype.space=void 0;function gE(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new au(n,s,t)}function ax(e){return e.toLowerCase()}class pr{constructor(t,n){this.attribute=n,this.property=t}}pr.prototype.attribute="";pr.prototype.booleanish=!1;pr.prototype.boolean=!1;pr.prototype.commaOrSpaceSeparated=!1;pr.prototype.commaSeparated=!1;pr.prototype.defined=!1;pr.prototype.mustUseProperty=!1;pr.prototype.number=!1;pr.prototype.overloadedBoolean=!1;pr.prototype.property="";pr.prototype.spaceSeparated=!1;pr.prototype.space=void 0;let g6=0;const ft=Sa(),hn=Sa(),ix=Sa(),Ae=Sa(),zt=Sa(),Ii=Sa(),br=Sa();function Sa(){return 2**++g6}const lx=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:br,commaSeparated:Ii,number:Ae,overloadedBoolean:ix,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Xh=Object.keys(lx);class By extends pr{constructor(t,n,s,o){let i=-1;if(super(t,n),m0(this,"space",o),typeof s=="number")for(;++i<Xh.length;){const l=Xh[i];m0(this,Xh[i],(s&lx[l])===lx[l])}}}By.prototype.defined=!0;function m0(e,t,n){n&&(e[t]=n)}function il(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new By(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[ax(s)]=s,n[ax(i.attribute)]=s}return new au(t,n,e.space)}const xE=il({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:zt,ariaCurrent:null,ariaDescribedBy:zt,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:zt,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:zt,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:zt,ariaLevel:Ae,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:zt,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:hn,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function yE(e,t){return t in e?e[t]:t}function bE(e,t){return yE(e,t.toLowerCase())}const x6=il({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ii,acceptCharset:zt,accessKey:zt,action:null,allow:null,allowFullScreen:ft,allowPaymentRequest:ft,allowUserMedia:ft,alt:null,as:null,async:ft,autoCapitalize:null,autoComplete:zt,autoFocus:ft,autoPlay:ft,blocking:zt,capture:null,charSet:null,checked:ft,cite:null,className:zt,cols:Ae,colSpan:null,content:null,contentEditable:hn,controls:ft,controlsList:zt,coords:Ae|Ii,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:ix,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:zt,height:Ae,hidden:ix,high:Ae,href:null,hrefLang:null,htmlFor:zt,httpEquiv:zt,id:null,imageSizes:null,imageSrcSet:null,inert:ft,inputMode:null,integrity:null,is:null,isMap:ft,itemId:null,itemProp:zt,itemRef:zt,itemScope:ft,itemType:zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ft,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:ft,muted:ft,name:null,nonce:null,noModule:ft,noValidate:ft,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:ft,optimum:Ae,pattern:null,ping:zt,placeholder:null,playsInline:ft,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ft,referrerPolicy:null,rel:zt,required:ft,reversed:ft,rows:Ae,rowSpan:Ae,sandbox:zt,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:hn,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ft,declare:ft,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:bE}),y6=il({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:br,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:zt,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:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,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:Ii,g2:Ii,glyphName:Ii,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:br,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,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:Ae,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:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:br,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:br,rev:br,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:br,requiredFeatures:br,requiredFonts:br,requiredFormats:br,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:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:br,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:br,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:br,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:yE}),vE=il({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()}}),wE=il({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bE}),jE=il({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),b6={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"},v6=/[A-Z]/g,h0=/-[a-z]/g,w6=/^data[-\w.:]+$/i;function j6(e,t){const n=ax(t);let s=t,o=pr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&w6.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(h0,S6);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!h0.test(i)){let l=i.replace(v6,k6);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=By}return new o(s,t)}function k6(e){return"-"+e.toLowerCase()}function S6(e){return e.charAt(1).toUpperCase()}const N6=gE([xE,x6,vE,wE,jE],"html"),Uy=gE([xE,y6,vE,wE,jE],"svg");function C6(e){return e.join(" ").trim()}var fi={},Zh,g0;function E6(){if(g0)return Zh;g0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
|
|
571
|
+
`,m="/",h="*",g="",y="comment",b="declaration";function C(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var E=1,S=1;function T(O){var B=O.match(t);B&&(E+=B.length);var K=O.lastIndexOf(d);S=~K?O.length-K:S+O.length}function I(){var O={line:E,column:S};return function(B){return B.position=new R(O),L(),B}}function R(O){this.start=O,this.end={line:E,column:S},this.source=k.source}R.prototype.content=v;function P(O){var B=new Error(k.source+":"+E+":"+S+": "+O);if(B.reason=O,B.filename=k.source,B.line=E,B.column=S,B.source=v,!k.silent)throw B}function $(O){var B=O.exec(v);if(B){var K=B[0];return T(K),v=v.slice(K.length),B}}function L(){$(n)}function F(O){var B;for(O=O||[];B=A();)B!==!1&&O.push(B);return O}function A(){var O=I();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var B=2;g!=v.charAt(B)&&(h!=v.charAt(B)||m!=v.charAt(B+1));)++B;if(B+=2,g===v.charAt(B-1))return P("End of comment missing");var K=v.slice(2,B-2);return S+=2,T(K),v=v.slice(B),S+=2,O({type:y,comment:K})}}function z(){var O=I(),B=$(s);if(B){if(A(),!$(o))return P("property missing ':'");var K=$(i),q=O({type:b,property:w(B[0].replace(e,g)),value:K?w(K[0].replace(e,g)):g});return $(l),q}}function V(){var O=[];F(O);for(var B;B=z();)B!==!1&&(O.push(B),F(O));return O}return L(),V()}function w(v){return v?v.replace(u,g):g}return Zh=C,Zh}var x0;function T6(){if(x0)return fi;x0=1;var e=fi&&fi.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(fi,"__esModule",{value:!0}),fi.default=n;const t=e(E6());function n(s,o){let i=null;if(!s||typeof s!="string")return i;const l=(0,t.default)(s),u=typeof o=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;u?o(m,h,d):h&&(i=i||{},i[m]=h)}),i}return fi}var Ql={},y0;function R6(){if(y0)return Ql;y0=1,Object.defineProperty(Ql,"__esModule",{value:!0}),Ql.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(m){return!m||n.test(m)||e.test(m)},l=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},d=function(m,h){return h===void 0&&(h={}),i(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(o,u):m=m.replace(s,u),m.replace(t,l))};return Ql.camelCase=d,Ql}var Xl,b0;function A6(){if(b0)return Xl;b0=1;var e=Xl&&Xl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(T6()),n=R6();function s(o,i){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(u,d){u&&d&&(l[(0,n.camelCase)(u,i)]=d)}),l}return s.default=s,Xl=s,Xl}var P6=A6();const D6=$f(P6),kE=SE("end"),Wy=SE("start");function SE(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 $6(e){const t=Wy(e),n=kE(e);if(t&&n)return{start:t,end:n}}function yc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?v0(e.position):"start"in e||"end"in e?v0(e):"line"in e||"column"in e?cx(e):""}function cx(e){return w0(e&&e.line)+":"+w0(e&&e.column)}function v0(e){return cx(e&&e.start)+"-"+cx(e&&e.end)}function w0(e){return e&&typeof e=="number"?e:1}class Kn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",i={},l=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(l=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?i.ruleId=s:(i.source=s.slice(0,d),i.ruleId=s.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const u=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=u?u.line:void 0,this.name=yc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=l&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Kn.prototype.file="";Kn.prototype.name="";Kn.prototype.reason="";Kn.prototype.message="";Kn.prototype.stack="";Kn.prototype.column=void 0;Kn.prototype.line=void 0;Kn.prototype.ancestors=void 0;Kn.prototype.cause=void 0;Kn.prototype.fatal=void 0;Kn.prototype.place=void 0;Kn.prototype.ruleId=void 0;Kn.prototype.source=void 0;const Hy={}.hasOwnProperty,L6=new Map,I6=/[A-Z]/g,O6=new Set(["table","tbody","thead","tfoot","tr"]),_6=new Set(["td","th"]),NE="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function M6(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=K6(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=V6(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Uy:N6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=CE(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function CE(e,t,n){if(t.type==="element")return F6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return z6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return U6(e,t,n);if(t.type==="mdxjsEsm")return B6(e,t);if(t.type==="root")return W6(e,t,n);if(t.type==="text")return H6(e,t)}function F6(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=Uy,e.schema=o),e.ancestors.push(t);const i=TE(e,t.tagName,!1),l=q6(e,t);let u=Ky(e,t);return O6.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!h6(d):!0})),EE(e,l,i,t),Vy(l,u),e.ancestors.pop(),e.schema=s,e.create(t,i,l,n)}function z6(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)}_c(e,t.position)}function B6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);_c(e,t.position)}function U6(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=Uy,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:TE(e,t.name,!0),l=G6(e,t),u=Ky(e,t);return EE(e,l,i,t),Vy(l,u),e.ancestors.pop(),e.schema=s,e.create(t,i,l,n)}function W6(e,t,n){const s={};return Vy(s,Ky(e,t)),e.create(t,e.Fragment,s,n)}function H6(e,t){return t.value}function EE(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Vy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function V6(e,t,n){return s;function s(o,i,l,u){const m=Array.isArray(l.children)?n:t;return u?m(i,l,u):m(i,l)}}function K6(e,t){return n;function n(s,o,i,l){const u=Array.isArray(i.children),d=Wy(s);return t(o,i,l,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function q6(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&Hy.call(t.properties,o)){const i=Y6(e,o,t.properties[o]);if(i){const[l,u]=i;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&_6.has(t.tagName)?s=u:n[l]=u}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function G6(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const l=i.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else _c(e,t.position);else{const o=s.name;let i;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const u=s.value.data.estree.body[0];u.type,i=e.evaluater.evaluateExpression(u.expression)}else _c(e,t.position);else i=s.value===null?!0:s.value;n[o]=i}return n}function Ky(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:L6;for(;++s<t.children.length;){const i=t.children[s];let l;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const m=o.get(d)||0;l=d+"-"+m,o.set(d,m+1)}}const u=CE(e,i,l);u!==void 0&&n.push(u)}return n}function Y6(e,t,n){const s=j6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?u6(n):C6(n)),s.property==="style"){let o=typeof n=="object"?n:J6(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Q6(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?b6[s.property]||s.property:s.attribute,n]}}function J6(e,t){try{return D6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new Kn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=NE+"#cannot-parse-style-attribute",o}}function TE(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,l;for(;++i<o.length;){const u=f0(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(i&&u.type==="Literal"),optional:!1}:u}s=l}else s=f0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return Hy.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);_c(e)}function _c(e,t){const n=new Kn("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=NE+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q6(e){const t={};let n;for(n in e)Hy.call(e,n)&&(t[X6(n)]=e[n]);return t}function X6(e){let t=e.replace(I6,Z6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Z6(e){return"-"+e.toLowerCase()}const eg={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"]},ez={};function tz(e,t){const n=ez,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return RE(e,s,o)}function RE(e,t,n){if(nz(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 j0(e.children,t,n)}return Array.isArray(e)?j0(e,t,n):""}function j0(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=RE(e[o],t,n);return s.join("")}function nz(e){return!!(e&&typeof e=="object")}const k0=document.createElement("i");function qy(e){const t="&"+e+";";k0.innerHTML=t;const n=k0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Es(e,t,n,s){const o=e.length;let i=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,s.length<1e4)l=Array.from(s),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);i<s.length;)l=s.slice(i,i+1e4),l.unshift(t,0),e.splice(...l),i+=1e4,t+=1e4}function Mr(e,t){return e.length>0?(Es(e,e.length,0,t),e):t}const S0={}.hasOwnProperty;function rz(e){const t={};let n=-1;for(;++n<e.length;)sz(t,e[n]);return t}function sz(e,t){let n;for(n in t){const o=(S0.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let l;if(i)for(l in i){S0.call(o,l)||(o[l]=[]);const u=i[l];oz(o[l],Array.isArray(u)?u:u?[u]:[])}}}function oz(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Es(e,0,0,s)}function AE(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 Oi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ws=Oo(/[A-Za-z]/),Cr=Oo(/[\dA-Za-z]/),az=Oo(/[#-'*+\--9=?A-Z^-~]/);function ux(e){return e!==null&&(e<32||e===127)}const dx=Oo(/\d/),iz=Oo(/[\dA-Fa-f]/),lz=Oo(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function dr(e){return e!==null&&(e<0||e===32)}function $t(e){return e===-2||e===-1||e===32}const cz=Oo(new RegExp("\\p{P}|\\p{S}","u")),uz=Oo(/\s/);function Oo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ll(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let l="";if(i===37&&Cr(e.charCodeAt(n+1))&&Cr(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(l=String.fromCharCode(i));else if(i>55295&&i<57344){const u=e.charCodeAt(n+1);i<56320&&u>56319&&u<57344?(l=String.fromCharCode(i,u),o=1):l="�"}else l=String.fromCharCode(i);l&&(t.push(e.slice(s,n),encodeURIComponent(l)),s=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Bt(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let i=0;return l;function l(d){return $t(d)?(e.enter(n),u(d)):t(d)}function u(d){return $t(d)&&i++<o?(e.consume(d),u):(e.exit(n),t(d))}}const dz={tokenize:fz};function fz(e){const t=e.attempt(this.parser.constructs.contentInitial,s,o);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Bt(e,t,"linePrefix")}function o(u){return e.enter("paragraph"),i(u)}function i(u){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return lt(u)?(e.consume(u),e.exit("chunkText"),i):(e.consume(u),l)}}const pz={tokenize:mz},N0={tokenize:hz};function mz(e){const t=this,n=[];let s=0,o,i,l;return u;function u(S){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,d,m)(S)}return m(S)}function d(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&E();const T=t.events.length;let I=T,R;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){R=t.events[I][1].end;break}k(s);let P=T;for(;P<t.events.length;)t.events[P][1].end={...R},P++;return Es(t.events,I+1,0,t.events.slice(T)),t.events.length=P,m(S)}return u(S)}function m(S){if(s===n.length){if(!o)return y(S);if(o.currentConstruct&&o.currentConstruct.concrete)return C(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(N0,h,g)(S)}function h(S){return o&&E(),k(s),y(S)}function g(S){return t.parser.lazy[t.now().line]=s!==n.length,l=t.now().offset,C(S)}function y(S){return t.containerState={},e.attempt(N0,b,C)(S)}function b(S){return s++,n.push([t.currentConstruct,t.containerState]),y(S)}function C(S){if(S===null){o&&E(),k(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),w(S)}function w(S){if(S===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(S);return}return lt(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(S),w)}function v(S,T){const I=t.sliceStream(S);if(T&&I.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(I),t.parser.lazy[S.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<l&&(!o.events[R][1].end||o.events[R][1].end.offset>l))return;const P=t.events.length;let $=P,L,F;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(L){F=t.events[$][1].end;break}L=!0}for(k(s),R=P;R<t.events.length;)t.events[R][1].end={...F},R++;Es(t.events,$+1,0,t.events.slice(P)),t.events.length=R}}function k(S){let T=n.length;for(;T-- >S;){const I=n[T];t.containerState=I[1],I[0].exit.call(t,e)}n.length=S}function E(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function hz(e,t,n){return Bt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function C0(e){if(e===null||dr(e)||uz(e))return 1;if(cz(e))return 2}function Gy(e,t,n){const s=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!s.includes(i)&&(t=i(t,n),s.push(i))}return t}const fx={name:"attention",resolveAll:gz,tokenize:xz};function gz(e,t){let n=-1,s,o,i,l,u,d,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},y={...e[n][1].start};E0(g,-d),E0(y,d),l={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},i={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...l.start},end:{...u.end}},e[s][1].end={...l.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Mr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Mr(m,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",i,t]]),m=Mr(m,Gy(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Mr(m,[["exit",i,t],["enter",u,t],["exit",u,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Mr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Es(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 xz(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=C0(s);let i;return l;function l(d){return i=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===i)return e.consume(d),u;const m=e.exit("attentionSequence"),h=C0(d),g=!h||h===2&&o||n.includes(d),y=!o||o===2&&h||n.includes(s);return m._open=!!(i===42?g:g&&(o||!y)),m._close=!!(i===42?y:y&&(h||!g)),t(d)}}function E0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const yz={name:"autolink",tokenize:bz};function bz(e,t,n){let s=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(b){return ws(b)?(e.consume(b),l):b===64?n(b):m(b)}function l(b){return b===43||b===45||b===46||Cr(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,d):(b===43||b===45||b===46||Cr(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function d(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||ux(b)?n(b):(e.consume(b),d)}function m(b){return b===64?(e.consume(b),h):az(b)?(e.consume(b),m):n(b)}function h(b){return Cr(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Cr(b))&&s++<63){const C=b===45?y:g;return e.consume(b),C}return n(b)}}const Cp={partial:!0,tokenize:vz};function vz(e,t,n){return s;function s(i){return $t(i)?Bt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||lt(i)?t(i):n(i)}}const PE={continuation:{tokenize:jz},exit:kz,name:"blockQuote",tokenize:wz};function wz(e,t,n){const s=this;return o;function o(l){if(l===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),i}return n(l)}function i(l){return $t(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function jz(e,t,n){const s=this;return o;function o(l){return $t(l)?Bt(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):i(l)}function i(l){return e.attempt(PE,t,n)(l)}}function kz(e){e.exit("blockQuote")}const DE={name:"characterEscape",tokenize:Sz};function Sz(e,t,n){return s;function s(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return lz(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const $E={name:"characterReference",tokenize:Nz};function Nz(e,t,n){const s=this;let o=0,i,l;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),i=31,l=Cr,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,l=iz,h):(e.enter("characterReferenceValue"),i=7,l=dx,h(g))}function h(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return l===Cr&&!qy(s.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&o++<i?(e.consume(g),h):n(g)}}const T0={partial:!0,tokenize:Ez},R0={concrete:!0,name:"codeFenced",tokenize:Cz};function Cz(e,t,n){const s=this,o={partial:!0,tokenize:I};let i=0,l=0,u;return d;function d(R){return m(R)}function m(R){const P=s.events[s.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(l++,e.consume(R),h):l<3?n(R):(e.exit("codeFencedFenceSequence"),$t(R)?Bt(e,g,"whitespace")(R):g(R))}function g(R){return R===null||lt(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(T0,w,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):$t(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Bt(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||lt(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(R))}function C(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),C)}function w(R){return e.attempt(o,T,v)(R)}function v(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return i>0&&$t(R)?Bt(e,E,"linePrefix",i+1)(R):E(R)}function E(R){return R===null||lt(R)?e.check(T0,w,T)(R):(e.enter("codeFlowValue"),S(R))}function S(R){return R===null||lt(R)?(e.exit("codeFlowValue"),E(R)):(e.consume(R),S)}function T(R){return e.exit("codeFenced"),t(R)}function I(R,P,$){let L=0;return F;function F(B){return R.enter("lineEnding"),R.consume(B),R.exit("lineEnding"),A}function A(B){return R.enter("codeFencedFence"),$t(B)?Bt(R,z,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):z(B)}function z(B){return B===u?(R.enter("codeFencedFenceSequence"),V(B)):$(B)}function V(B){return B===u?(L++,R.consume(B),V):L>=l?(R.exit("codeFencedFenceSequence"),$t(B)?Bt(R,O,"whitespace")(B):O(B)):$(B)}function O(B){return B===null||lt(B)?(R.exit("codeFencedFence"),P(B)):$(B)}}}function Ez(e,t,n){const s=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i)}function i(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}const tg={name:"codeIndented",tokenize:Rz},Tz={partial:!0,tokenize:Az};function Rz(e,t,n){const s=this;return o;function o(m){return e.enter("codeIndented"),Bt(e,i,"linePrefix",5)(m)}function i(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?l(m):n(m)}function l(m){return m===null?d(m):lt(m)?e.attempt(Tz,l,d)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||lt(m)?(e.exit("codeFlowValue"),l(m)):(e.consume(m),u)}function d(m){return e.exit("codeIndented"),t(m)}}function Az(e,t,n){const s=this;return o;function o(l){return s.parser.lazy[s.now().line]?n(l):lt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):Bt(e,i,"linePrefix",5)(l)}function i(l){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):lt(l)?o(l):n(l)}}const Pz={name:"codeText",previous:$z,resolve:Dz,tokenize:Lz};function Dz(e){let t=e.length-4,n=3,s,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)o===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(o=s):(s===t||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),t-=s-o-2,s=o+2),o=void 0);return e}function $z(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Lz(e,t,n){let s=0,o,i;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(i=e.enter("codeTextSequence"),o=0,h(g)):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||lt(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),o++,h):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(i.type="codeTextData",m(g))}}class Iz{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&Zl(this.left,s),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Zl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Zl(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);Zl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Zl(this.left,n.reverse())}}}function Zl(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 LE(e){const t={};let n=-1,s,o,i,l,u,d,m;const h=new Iz(e);for(;++n<h.length;){for(;n in t;)n=t[n];if(s=h.get(n),n&&s[1].type==="chunkFlow"&&h.get(n-1)[1].type==="listItemPrefix"&&(d=s[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,Oz(h,n)),n=t[n],m=!0);else if(s[1]._container){for(i=n,o=void 0;i--;)if(l=h.get(i),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(h.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=i);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(s[1].end={...h.get(o)[1].start},u=h.slice(o,n),u.unshift(s),h.splice(o,n-o+1,u))}}return Es(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function Oz(e,t){const n=e.get(t)[1],s=e.get(t)[2];let o=t-1;const i=[];let l=n._tokenizer;l||(l=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,d=[],m={};let h,g,y=-1,b=n,C=0,w=0;const v=[w];for(;b;){for(;e.get(++o)[1]!==b;);i.push(o),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),g&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(h),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(w=y+1,v.push(w),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):v.pop(),y=v.length;y--;){const k=u.slice(v[y],v[y+1]),E=i.pop();d.push([E,E+k.length-1]),e.splice(E,2,k)}for(d.reverse(),y=-1;++y<d.length;)m[C+d[y][0]]=C+d[y][1],C+=d[y][1]-d[y][0]-1;return m}const _z={resolve:Fz,tokenize:zz},Mz={partial:!0,tokenize:Bz};function Fz(e){return LE(e),e}function zz(e,t){let n;return s;function s(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(u)}function o(u){return u===null?i(u):lt(u)?e.check(Mz,l,i)(u):(e.consume(u),o)}function i(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function Bz(e,t,n){const s=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Bt(e,i,"linePrefix")}function i(l){if(l===null||lt(l))return n(l);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(l):e.interrupt(s.parser.constructs.flow,n,t)(l)}}function IE(e,t,n,s,o,i,l,u,d){const m=d||Number.POSITIVE_INFINITY;let h=0;return g;function g(k){return k===60?(e.enter(s),e.enter(o),e.enter(i),e.consume(k),e.exit(i),y):k===null||k===32||k===41||ux(k)?n(k):(e.enter(s),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),w(k))}function y(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(o),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||lt(k)?n(k):(e.consume(k),k===92?C:b)}function C(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function w(k){return!h&&(k===null||k===41||dr(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,w):k===41?(e.consume(k),h--,w):k===null||k===32||k===40||ux(k)?n(k):(e.consume(k),k===92?v:w)}function v(k){return k===40||k===41||k===92?(e.consume(k),w):w(k)}}function OE(e,t,n,s,o,i){const l=this;let u=0,d;return m;function m(b){return e.enter(s),e.enter(o),e.consume(b),e.exit(o),e.enter(i),h}function h(b){return u>999||b===null||b===91||b===93&&!d||b===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(e.exit(i),e.enter(o),e.consume(b),e.exit(o),e.exit(s),t):lt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||lt(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),d||(d=!$t(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function _E(e,t,n,s,o,i){let l;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(o),e.consume(y),e.exit(o),l=y===40?41:y,d):n(y)}function d(y){return y===l?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),t):(e.enter(i),m(y))}function m(y){return y===l?(e.exit(i),d(l)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Bt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===l||y===null||lt(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===l||y===92?(e.consume(y),h):h(y)}}function bc(e,t){let n;return s;function s(o){return lt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):$t(o)?Bt(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const Uz={name:"definition",tokenize:Hz},Wz={partial:!0,tokenize:Vz};function Hz(e,t,n){const s=this;let o;return i;function i(b){return e.enter("definition"),l(b)}function l(b){return OE.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return o=Oi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),d):n(b)}function d(b){return dr(b)?bc(e,m)(b):m(b)}function m(b){return IE(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(Wz,g,g)(b)}function g(b){return $t(b)?Bt(e,y,"whitespace")(b):y(b)}function y(b){return b===null||lt(b)?(e.exit("definition"),s.parser.defined.push(o),t(b)):n(b)}}function Vz(e,t,n){return s;function s(u){return dr(u)?bc(e,o)(u):n(u)}function o(u){return _E(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function i(u){return $t(u)?Bt(e,l,"whitespace")(u):l(u)}function l(u){return u===null||lt(u)?t(u):n(u)}}const Kz={name:"hardBreakEscape",tokenize:qz};function qz(e,t,n){return s;function s(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return lt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Gz={name:"headingAtx",resolve:Yz,tokenize:Jz};function Yz(e,t){let n=e.length-2,s=3,o,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Es(e,s,n-s+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function Jz(e,t,n){let s=0;return o;function o(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),l(h)}function l(h){return h===35&&s++<6?(e.consume(h),l):h===null||dr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),d(h)):h===null||lt(h)?(e.exit("atxHeading"),t(h)):$t(h)?Bt(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function d(h){return h===35?(e.consume(h),d):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||dr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const Qz=["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"],A0=["pre","script","style","textarea"],Xz={concrete:!0,name:"htmlFlow",resolveTo:tB,tokenize:nB},Zz={partial:!0,tokenize:sB},eB={partial:!0,tokenize:rB};function tB(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 nB(e,t,n){const s=this;let o,i,l,u,d;return m;function m(U){return h(U)}function h(U){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(U),g}function g(U){return U===33?(e.consume(U),y):U===47?(e.consume(U),i=!0,w):U===63?(e.consume(U),o=3,s.interrupt?t:D):ws(U)?(e.consume(U),l=String.fromCharCode(U),v):n(U)}function y(U){return U===45?(e.consume(U),o=2,b):U===91?(e.consume(U),o=5,u=0,C):ws(U)?(e.consume(U),o=4,s.interrupt?t:D):n(U)}function b(U){return U===45?(e.consume(U),s.interrupt?t:D):n(U)}function C(U){const oe="CDATA[";return U===oe.charCodeAt(u++)?(e.consume(U),u===oe.length?s.interrupt?t:z:C):n(U)}function w(U){return ws(U)?(e.consume(U),l=String.fromCharCode(U),v):n(U)}function v(U){if(U===null||U===47||U===62||dr(U)){const oe=U===47,ue=l.toLowerCase();return!oe&&!i&&A0.includes(ue)?(o=1,s.interrupt?t(U):z(U)):Qz.includes(l.toLowerCase())?(o=6,oe?(e.consume(U),k):s.interrupt?t(U):z(U)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(U):i?E(U):S(U))}return U===45||Cr(U)?(e.consume(U),l+=String.fromCharCode(U),v):n(U)}function k(U){return U===62?(e.consume(U),s.interrupt?t:z):n(U)}function E(U){return $t(U)?(e.consume(U),E):F(U)}function S(U){return U===47?(e.consume(U),F):U===58||U===95||ws(U)?(e.consume(U),T):$t(U)?(e.consume(U),S):F(U)}function T(U){return U===45||U===46||U===58||U===95||Cr(U)?(e.consume(U),T):I(U)}function I(U){return U===61?(e.consume(U),R):$t(U)?(e.consume(U),I):S(U)}function R(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(e.consume(U),d=U,P):$t(U)?(e.consume(U),R):$(U)}function P(U){return U===d?(e.consume(U),d=null,L):U===null||lt(U)?n(U):(e.consume(U),P)}function $(U){return U===null||U===34||U===39||U===47||U===60||U===61||U===62||U===96||dr(U)?I(U):(e.consume(U),$)}function L(U){return U===47||U===62||$t(U)?S(U):n(U)}function F(U){return U===62?(e.consume(U),A):n(U)}function A(U){return U===null||lt(U)?z(U):$t(U)?(e.consume(U),A):n(U)}function z(U){return U===45&&o===2?(e.consume(U),K):U===60&&o===1?(e.consume(U),q):U===62&&o===4?(e.consume(U),H):U===63&&o===3?(e.consume(U),D):U===93&&o===5?(e.consume(U),G):lt(U)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Zz,Z,V)(U)):U===null||lt(U)?(e.exit("htmlFlowData"),V(U)):(e.consume(U),z)}function V(U){return e.check(eB,O,Z)(U)}function O(U){return e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),B}function B(U){return U===null||lt(U)?V(U):(e.enter("htmlFlowData"),z(U))}function K(U){return U===45?(e.consume(U),D):z(U)}function q(U){return U===47?(e.consume(U),l="",_):z(U)}function _(U){if(U===62){const oe=l.toLowerCase();return A0.includes(oe)?(e.consume(U),H):z(U)}return ws(U)&&l.length<8?(e.consume(U),l+=String.fromCharCode(U),_):z(U)}function G(U){return U===93?(e.consume(U),D):z(U)}function D(U){return U===62?(e.consume(U),H):U===45&&o===2?(e.consume(U),D):z(U)}function H(U){return U===null||lt(U)?(e.exit("htmlFlowData"),Z(U)):(e.consume(U),H)}function Z(U){return e.exit("htmlFlow"),t(U)}}function rB(e,t,n){const s=this;return o;function o(l){return lt(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),i):n(l)}function i(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}function sB(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Cp,t,n)}}const oB={name:"htmlText",tokenize:aB};function aB(e,t,n){const s=this;let o,i,l;return u;function u(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),d}function d(D){return D===33?(e.consume(D),m):D===47?(e.consume(D),I):D===63?(e.consume(D),S):ws(D)?(e.consume(D),$):n(D)}function m(D){return D===45?(e.consume(D),h):D===91?(e.consume(D),i=0,C):ws(D)?(e.consume(D),E):n(D)}function h(D){return D===45?(e.consume(D),b):n(D)}function g(D){return D===null?n(D):D===45?(e.consume(D),y):lt(D)?(l=g,q(D)):(e.consume(D),g)}function y(D){return D===45?(e.consume(D),b):g(D)}function b(D){return D===62?K(D):D===45?y(D):g(D)}function C(D){const H="CDATA[";return D===H.charCodeAt(i++)?(e.consume(D),i===H.length?w:C):n(D)}function w(D){return D===null?n(D):D===93?(e.consume(D),v):lt(D)?(l=w,q(D)):(e.consume(D),w)}function v(D){return D===93?(e.consume(D),k):w(D)}function k(D){return D===62?K(D):D===93?(e.consume(D),k):w(D)}function E(D){return D===null||D===62?K(D):lt(D)?(l=E,q(D)):(e.consume(D),E)}function S(D){return D===null?n(D):D===63?(e.consume(D),T):lt(D)?(l=S,q(D)):(e.consume(D),S)}function T(D){return D===62?K(D):S(D)}function I(D){return ws(D)?(e.consume(D),R):n(D)}function R(D){return D===45||Cr(D)?(e.consume(D),R):P(D)}function P(D){return lt(D)?(l=P,q(D)):$t(D)?(e.consume(D),P):K(D)}function $(D){return D===45||Cr(D)?(e.consume(D),$):D===47||D===62||dr(D)?L(D):n(D)}function L(D){return D===47?(e.consume(D),K):D===58||D===95||ws(D)?(e.consume(D),F):lt(D)?(l=L,q(D)):$t(D)?(e.consume(D),L):K(D)}function F(D){return D===45||D===46||D===58||D===95||Cr(D)?(e.consume(D),F):A(D)}function A(D){return D===61?(e.consume(D),z):lt(D)?(l=A,q(D)):$t(D)?(e.consume(D),A):L(D)}function z(D){return D===null||D===60||D===61||D===62||D===96?n(D):D===34||D===39?(e.consume(D),o=D,V):lt(D)?(l=z,q(D)):$t(D)?(e.consume(D),z):(e.consume(D),O)}function V(D){return D===o?(e.consume(D),o=void 0,B):D===null?n(D):lt(D)?(l=V,q(D)):(e.consume(D),V)}function O(D){return D===null||D===34||D===39||D===60||D===61||D===96?n(D):D===47||D===62||dr(D)?L(D):(e.consume(D),O)}function B(D){return D===47||D===62||dr(D)?L(D):n(D)}function K(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):n(D)}function q(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),_}function _(D){return $t(D)?Bt(e,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):G(D)}function G(D){return e.enter("htmlTextData"),l(D)}}const Yy={name:"labelEnd",resolveAll:uB,resolveTo:dB,tokenize:fB},iB={tokenize:pB},lB={tokenize:mB},cB={tokenize:hB};function uB(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",t+=o}}return e.length!==n.length&&Es(e,0,e.length,n),e}function dB(e,t){let n=e.length,s=0,o,i,l,u;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(l=n);const d={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[i][1].start},end:{...e[l][1].end}},h={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[l-2][1].start}};return u=[["enter",d,t],["enter",m,t]],u=Mr(u,e.slice(i+1,i+s+3)),u=Mr(u,[["enter",h,t]]),u=Mr(u,Gy(t.parser.constructs.insideSpan.null,e.slice(i+s+4,l-3),t)),u=Mr(u,[["exit",h,t],e[l-2],e[l-1],["exit",m,t]]),u=Mr(u,e.slice(l+1)),u=Mr(u,[["exit",d,t]]),Es(e,i,e.length,u),e}function fB(e,t,n){const s=this;let o=s.events.length,i,l;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){i=s.events[o][1];break}return u;function u(y){return i?i._inactive?g(y):(l=s.parser.defined.includes(Oi(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),d):n(y)}function d(y){return y===40?e.attempt(iB,h,l?h:g)(y):y===91?e.attempt(lB,h,l?m:g)(y):l?h(y):g(y)}function m(y){return e.attempt(cB,h,g)(y)}function h(y){return t(y)}function g(y){return i._balanced=!0,n(y)}}function pB(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return dr(g)?bc(e,i)(g):i(g)}function i(g){return g===41?h(g):IE(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return dr(g)?bc(e,d)(g):h(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?_E(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return dr(g)?bc(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function mB(e,t,n){const s=this;return o;function o(u){return OE.call(s,e,i,l,"reference","referenceMarker","referenceString")(u)}function i(u){return s.parser.defined.includes(Oi(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function hB(e,t,n){return s;function s(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const gB={name:"labelStartImage",resolveAll:Yy.resolveAll,tokenize:xB};function xB(e,t,n){const s=this;return o;function o(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),i}function i(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),l):n(u)}function l(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const yB={name:"labelStartLink",resolveAll:Yy.resolveAll,tokenize:bB};function bB(e,t,n){const s=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),i}function i(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const ng={name:"lineEnding",tokenize:vB};function vB(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Bt(e,t,"linePrefix")}}const Zd={name:"thematicBreak",tokenize:wB};function wB(e,t,n){let s=0,o;return i;function i(m){return e.enter("thematicBreak"),l(m)}function l(m){return o=m,u(m)}function u(m){return m===o?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||lt(m))?(e.exit("thematicBreak"),t(m)):n(m)}function d(m){return m===o?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),$t(m)?Bt(e,u,"whitespace")(m):u(m))}}const ir={continuation:{tokenize:NB},exit:EB,name:"list",tokenize:SB},jB={partial:!0,tokenize:TB},kB={partial:!0,tokenize:CB};function SB(e,t,n){const s=this,o=s.events[s.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=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:dx(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(Zd,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(b)}return n(b)}function d(b){return dx(b)&&++l<10?(e.consume(b),d):(!s.interrupt||l<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(Cp,s.interrupt?n:h,e.attempt(jB,y,g))}function h(b){return s.containerState.initialBlankLine=!0,i++,y(b)}function g(b){return $t(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function NB(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Cp,o,i);function o(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Bt(e,t,"listItemIndent",s.containerState.size+1)(u)}function i(u){return s.containerState.furtherBlankLines||!$t(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,l(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(kB,t,l)(u))}function l(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Bt(e,e.attempt(ir,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function CB(e,t,n){const s=this;return Bt(e,o,"listItemIndent",s.containerState.size+1);function o(i){const l=s.events[s.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===s.containerState.size?t(i):n(i)}}function EB(e){e.exit(this.containerState.type)}function TB(e,t,n){const s=this;return Bt(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const l=s.events[s.events.length-1];return!$t(i)&&l&&l[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const P0={name:"setextUnderline",resolveTo:RB,tokenize:AB};function RB(e,t){let n=e.length,s,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const l={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",l,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=l,e.push(["exit",l,t]),e}function AB(e,t,n){const s=this;let o;return i;function i(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=m,l(m)):n(m)}function l(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===o?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),$t(m)?Bt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||lt(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const PB={tokenize:DB};function DB(e){const t=this,n=e.attempt(Cp,s,e.attempt(this.parser.constructs.flowInitial,o,Bt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(_z,o)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $B={resolveAll:FE()},LB=ME("string"),IB=ME("text");function ME(e){return{resolveAll:FE(e==="text"?OB:void 0),tokenize:t};function t(n){const s=this,o=this.parser.constructs[e],i=n.attempt(o,l,u);return l;function l(h){return m(h)?i(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),d}function d(h){return m(h)?(n.exit("data"),i(h)):(n.consume(h),d)}function m(h){if(h===null)return!0;const g=o[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function FE(e){return t;function t(n,s){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,s):n}}function OB(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],o=t.sliceStream(s);let i=o.length,l=-1,u=0,d;for(;i--;){const m=o[i];if(typeof m=="string"){for(l=m.length;m.charCodeAt(l-1)===32;)u++,l--;if(l)break;l=-1}else if(m===-2)d=!0,u++;else if(m!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||d||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?l:s.start._bufferIndex+l,_index:s.start._index+i,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const _B={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:PE},MB={91:Uz},FB={[-2]:tg,[-1]:tg,32:tg},zB={35:Gz,42:Zd,45:[P0,Zd],60:Xz,61:P0,95:Zd,96:R0,126:R0},BB={38:$E,92:DE},UB={[-5]:ng,[-4]:ng,[-3]:ng,33:gB,38:$E,42:fx,60:[yz,oB],91:yB,92:[Kz,DE],93:Yy,95:fx,96:Pz},WB={null:[fx,$B]},HB={null:[42,95]},VB={null:[]},KB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:HB,contentInitial:MB,disable:VB,document:_B,flow:zB,flowInitial:FB,insideSpan:WB,string:BB,text:UB},Symbol.toStringTag,{value:"Module"}));function qB(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let l=[],u=[];const d={attempt:P(I),check:P(R),consume:E,enter:S,exit:T,interrupt:P(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:w,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,d);return t.resolveAll&&i.push(t),m;function g(A){return l=Mr(l,A),v(),l[l.length-1]!==null?[]:($(t,0),m.events=Gy(i,m.events,m),m.events)}function y(A,z){return YB(b(A),z)}function b(A){return GB(l,A)}function C(){const{_bufferIndex:A,_index:z,line:V,column:O,offset:B}=s;return{_bufferIndex:A,_index:z,line:V,column:O,offset:B}}function w(A){o[A.line]=A.column,F()}function v(){let A;for(;s._index<l.length;){const z=l[s._index];if(typeof z=="string")for(A=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===A&&s._bufferIndex<z.length;)k(z.charCodeAt(s._bufferIndex));else k(z)}}function k(A){h=h(A)}function E(A){lt(A)?(s.line++,s.column=1,s.offset+=A===-3?2:1,F()):A!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===l[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=A}function S(A,z){const V=z||{};return V.type=A,V.start=C(),m.events.push(["enter",V,m]),u.push(V),V}function T(A){const z=u.pop();return z.end=C(),m.events.push(["exit",z,m]),z}function I(A,z){$(A,z.from)}function R(A,z){z.restore()}function P(A,z){return V;function V(O,B,K){let q,_,G,D;return Array.isArray(O)?Z(O):"tokenize"in O?Z([O]):H(O);function H(re){return xe;function xe(ke){const Pe=ke!==null&&re[ke],De=ke!==null&&re.null,Xe=[...Array.isArray(Pe)?Pe:Pe?[Pe]:[],...Array.isArray(De)?De:De?[De]:[]];return Z(Xe)(ke)}}function Z(re){return q=re,_=0,re.length===0?K:U(re[_])}function U(re){return xe;function xe(ke){return D=L(),G=re,re.partial||(m.currentConstruct=re),re.name&&m.parser.constructs.disable.null.includes(re.name)?ue():re.tokenize.call(z?Object.assign(Object.create(m),z):m,d,oe,ue)(ke)}}function oe(re){return A(G,D),B}function ue(re){return D.restore(),++_<q.length?U(q[_]):K}}}function $(A,z){A.resolveAll&&!i.includes(A)&&i.push(A),A.resolve&&Es(m.events,z,m.events.length-z,A.resolve(m.events.slice(z),m)),A.resolveTo&&(m.events=A.resolveTo(m.events,m))}function L(){const A=C(),z=m.previous,V=m.currentConstruct,O=m.events.length,B=Array.from(u);return{from:O,restore:K};function K(){s=A,m.previous=z,m.currentConstruct=V,m.events.length=O,u=B,F()}}function F(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function GB(e,t){const n=t.start._index,s=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(s,i)];else{if(l=e.slice(n,o),s>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(s):l.shift()}i>0&&l.push(e[o].slice(0,i))}return l}function YB(e,t){let n=-1;const s=[];let o;for(;++n<e.length;){const i=e[n];let l;if(typeof i=="string")l=i;else switch(i){case-5:{l="\r";break}case-4:{l=`
|
|
572
|
+
`;break}case-3:{l=`\r
|
|
573
|
+
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(i)}o=i===-2,s.push(l)}return s.join("")}function JB(e){const s={constructs:rz([KB,...(e||{}).extensions||[]]),content:o(dz),defined:[],document:o(pz),flow:o(PB),lazy:{},string:o(LB),text:o(IB)};return s;function o(i){return l;function l(u){return qB(s,i,u)}}}function QB(e){for(;!LE(e););return e}const D0=/[\0\t\n\r]/g;function XB(){let e=1,t="",n=!0,s;return o;function o(i,l,u){const d=[];let m,h,g,y,b;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(l||void 0).decode(i)),g=0,t="",n&&(i.charCodeAt(0)===65279&&g++,n=void 0);g<i.length;){if(D0.lastIndex=g,m=D0.exec(i),y=m&&m.index!==void 0?m.index:i.length,b=i.charCodeAt(y),!m){t=i.slice(g);break}if(b===10&&g===y&&s)d.push(-3),s=void 0;else switch(s&&(d.push(-5),s=void 0),g<y&&(d.push(i.slice(g,y)),e+=y-g),b){case 0:{d.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,d.push(-2);e++<h;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&d.push(-5),t&&d.push(t),d.push(null)),d}}const ZB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function e8(e){return e.replace(ZB,t8)}function t8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return AE(n.slice(i?2:1),i?16:10)}return qy(n)||e}const zE={}.hasOwnProperty;function n8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),r8(n)(QB(JB(n).document().write(XB()(e,t,!0))))}function r8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ze),autolinkProtocol:L,autolinkEmail:L,atxHeading:i(le),blockQuote:i(De),characterEscape:L,characterReference:L,codeFenced:i(Xe),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:i(Xe,l),codeText:i(st,l),codeTextData:L,data:L,codeFlowValue:L,definition:i(Ze),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:i(ot),hardBreakEscape:i(Re),hardBreakTrailing:i(Re),htmlFlow:i(Se,l),htmlFlowData:L,htmlText:i(Se,l),htmlTextData:L,image:i(Oe),label:l,link:i(ze),listItem:i(_e),listItemValue:y,listOrdered:i(et,g),listUnordered:i(et),paragraph:i(qe),reference:U,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:i(le),strong:i(Lt),thematicBreak:i(ut)},exit:{atxHeading:d(),atxHeadingSequence:I,autolink:d(),autolinkEmail:Pe,autolinkProtocol:ke,blockQuote:d(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:re,characterReference:xe,codeFenced:d(v),codeFencedFence:w,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:F,codeIndented:d(k),codeText:d(B),codeTextData:F,data:F,definition:d(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(z),hardBreakTrailing:d(z),htmlFlow:d(V),htmlFlowData:F,htmlText:d(O),htmlTextData:F,image:d(q),label:G,labelText:_,lineEnding:A,link:d(K),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:oe,resourceDestinationString:D,resourceTitleString:H,resource:Z,setextHeading:d($),setextHeadingLineSequence:P,setextHeadingText:R,strong:d(),thematicBreak:d()}};BE(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ae){let X={type:"root",children:[]};const he={stack:[X],tokenStack:[],config:t,enter:u,exit:m,buffer:l,resume:h,data:n},ne=[];let ye=-1;for(;++ye<ae.length;)if(ae[ye][1].type==="listOrdered"||ae[ye][1].type==="listUnordered")if(ae[ye][0]==="enter")ne.push(ye);else{const Ee=ne.pop();ye=o(ae,Ee,ye)}for(ye=-1;++ye<ae.length;){const Ee=t[ae[ye][0]];zE.call(Ee,ae[ye][1].type)&&Ee[ae[ye][1].type].call(Object.assign({sliceSerialize:ae[ye][2].sliceSerialize},he),ae[ye][1])}if(he.tokenStack.length>0){const Ee=he.tokenStack[he.tokenStack.length-1];(Ee[1]||$0).call(he,void 0,Ee[0])}for(X.position={start:yo(ae.length>0?ae[0][1].start:{line:1,column:1,offset:0}),end:yo(ae.length>0?ae[ae.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)X=t.transforms[ye](X)||X;return X}function o(ae,X,he){let ne=X-1,ye=-1,Ee=!1,ve,ee,fe,Ne;for(;++ne<=he;){const He=ae[ne];switch(He[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{He[0]==="enter"?ye++:ye--,Ne=void 0;break}case"lineEndingBlank":{He[0]==="enter"&&(ve&&!Ne&&!ye&&!fe&&(fe=ne),Ne=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ne=void 0}if(!ye&&He[0]==="enter"&&He[1].type==="listItemPrefix"||ye===-1&&He[0]==="exit"&&(He[1].type==="listUnordered"||He[1].type==="listOrdered")){if(ve){let ce=ne;for(ee=void 0;ce--;){const pt=ae[ce];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;ee&&(ae[ee][1].type="lineEndingBlank",Ee=!0),pt[1].type="lineEnding",ee=ce}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}fe&&(!ee||fe<ee)&&(ve._spread=!0),ve.end=Object.assign({},ee?ae[ee][1].start:He[1].end),ae.splice(ee||ne,0,["exit",ve,He[2]]),ne++,he++}if(He[1].type==="listItemPrefix"){const ce={type:"listItem",_spread:!1,start:Object.assign({},He[1].start),end:void 0};ve=ce,ae.splice(ne,0,["enter",ce,He[2]]),ne++,he++,fe=void 0,Ne=!0}}}return ae[X][1]._spread=Ee,he}function i(ae,X){return he;function he(ne){u.call(this,ae(ne),ne),X&&X.call(this,ne)}}function l(){this.stack.push({type:"fragment",children:[]})}function u(ae,X,he){this.stack[this.stack.length-1].children.push(ae),this.stack.push(ae),this.tokenStack.push([X,he||void 0]),ae.position={start:yo(X.start),end:void 0}}function d(ae){return X;function X(he){ae&&ae.call(this,he),m.call(this,he)}}function m(ae,X){const he=this.stack.pop(),ne=this.tokenStack.pop();if(ne)ne[0].type!==ae.type&&(X?X.call(this,ae,ne[0]):(ne[1]||$0).call(this,ae,ne[0]));else throw new Error("Cannot close `"+ae.type+"` ("+yc({start:ae.start,end:ae.end})+"): it’s not open");he.position.end=yo(ae.end)}function h(){return tz(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(ae){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize(ae),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.lang=ae}function C(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.meta=ae}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.value=ae.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.value=ae.replace(/(\r?\n|\r)$/g,"")}function E(ae){const X=this.resume(),he=this.stack[this.stack.length-1];he.label=X,he.identifier=Oi(this.sliceSerialize(ae)).toLowerCase()}function S(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.title=ae}function T(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.url=ae}function I(ae){const X=this.stack[this.stack.length-1];if(!X.depth){const he=this.sliceSerialize(ae).length;X.depth=he}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function P(ae){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize(ae).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function L(ae){const he=this.stack[this.stack.length-1].children;let ne=he[he.length-1];(!ne||ne.type!=="text")&&(ne=bt(),ne.position={start:yo(ae.start),end:void 0},he.push(ne)),this.stack.push(ne)}function F(ae){const X=this.stack.pop();X.value+=this.sliceSerialize(ae),X.position.end=yo(ae.end)}function A(ae){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=X.children[X.children.length-1];he.position.end=yo(ae.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(X.type)&&(L.call(this,ae),F.call(this,ae))}function z(){this.data.atHardBreak=!0}function V(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.value=ae}function O(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.value=ae}function B(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.value=ae}function K(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=X,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function q(){const ae=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";ae.type+="Reference",ae.referenceType=X,delete ae.url,delete ae.title}else delete ae.identifier,delete ae.label;this.data.referenceType=void 0}function _(ae){const X=this.sliceSerialize(ae),he=this.stack[this.stack.length-2];he.label=e8(X),he.identifier=Oi(X).toLowerCase()}function G(){const ae=this.stack[this.stack.length-1],X=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const ne=ae.children;he.children=ne}else he.alt=X}function D(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.url=ae}function H(){const ae=this.resume(),X=this.stack[this.stack.length-1];X.title=ae}function Z(){this.data.inReference=void 0}function U(){this.data.referenceType="collapsed"}function oe(ae){const X=this.resume(),he=this.stack[this.stack.length-1];he.label=X,he.identifier=Oi(this.sliceSerialize(ae)).toLowerCase(),this.data.referenceType="full"}function ue(ae){this.data.characterReferenceType=ae.type}function re(ae){const X=this.sliceSerialize(ae),he=this.data.characterReferenceType;let ne;he?(ne=AE(X,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ne=qy(X);const ye=this.stack[this.stack.length-1];ye.value+=ne}function xe(ae){const X=this.stack.pop();X.position.end=yo(ae.end)}function ke(ae){F.call(this,ae);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize(ae)}function Pe(ae){F.call(this,ae);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize(ae)}function De(){return{type:"blockquote",children:[]}}function Xe(){return{type:"code",lang:null,meta:null,value:""}}function st(){return{type:"inlineCode",value:""}}function Ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function le(){return{type:"heading",depth:0,children:[]}}function Re(){return{type:"break"}}function Se(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function et(ae){return{type:"list",ordered:ae.type==="listOrdered",start:null,spread:ae._spread,children:[]}}function _e(ae){return{type:"listItem",spread:ae._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function Lt(){return{type:"strong",children:[]}}function bt(){return{type:"text",value:""}}function ut(){return{type:"thematicBreak"}}}function yo(e){return{line:e.line,column:e.column,offset:e.offset}}function BE(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?BE(e,s):s8(e,s)}}function s8(e,t){let n;for(n in t)if(zE.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 $0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yc({start:t.start,end:t.end})+") is still open")}function o8(e){const t=this;t.parser=n;function n(s){return n8(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function a8(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 i8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
574
|
+
`}]}function l8(e,t){const n=t.value?t.value+`
|
|
575
|
+
`:"",s={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function c8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function u8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function d8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=ll(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let l,u=e.footnoteCounts.get(s);u===void 0?(u=0,e.footnoteOrder.push(s),l=e.footnoteOrder.length):l=i+1,u+=1,e.footnoteCounts.set(s,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function f8(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 p8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function UE(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&l.type==="text"?l.value+=s:o.push({type:"text",value:s}),o}function m8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return UE(e,t);const o={src:ll(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function h8(e,t){const n={src:ll(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 g8(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 x8(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return UE(e,t);const o={href:ll(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function y8(e,t){const n={href:ll(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 b8(e,t,n){const s=e.all(t),o=n?v8(n):WE(t),i={},l=[];if(typeof t.checked=="boolean"){const h=s[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(o||u!==0||h.type!=="element"||h.tagName!=="p")&&l.push({type:"text",value:`
|
|
576
|
+
`}),h.type==="element"&&h.tagName==="p"&&!o?l.push(...h.children):l.push(h)}const d=s[s.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&l.push({type:"text",value:`
|
|
577
|
+
`});const m={type:"element",tagName:"li",properties:i,children:l};return e.patch(t,m),e.applyData(t,m)}function v8(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=WE(n[s])}return t}function WE(e){const t=e.spread;return t??e.children.length>1}function w8(e,t){const n={},s=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<s.length;){const l=s[o];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function j8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function S8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function N8(e,t){const n=e.all(t),s=n.shift(),o=[];if(s){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],l),o.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Wy(t.children[1]),d=kE(t.children[t.children.length-1]);u&&d&&(l.position={start:u,end:d}),o.push(l)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function C8(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const g=t.children[d],y={},b=l?l[d]:void 0;b&&(y.align=b);let C={type:"element",tagName:i,properties:y,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),m.push(C)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function E8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const L0=9,I0=32;function T8(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const i=[];for(;s;)i.push(O0(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return i.push(O0(t.slice(o),o>0,!1)),i.join("")}function O0(e,t,n){let s=0,o=e.length;if(t){let i=e.codePointAt(s);for(;i===L0||i===I0;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(o-1);for(;i===L0||i===I0;)o--,i=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function R8(e,t){const n={type:"text",value:T8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function A8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const P8={blockquote:a8,break:i8,code:l8,delete:c8,emphasis:u8,footnoteReference:d8,heading:f8,html:p8,imageReference:m8,image:h8,inlineCode:g8,linkReference:x8,link:y8,listItem:b8,list:w8,paragraph:j8,root:k8,strong:S8,table:N8,tableCell:E8,tableRow:C8,text:R8,thematicBreak:A8,toml:Rd,yaml:Rd,definition:Rd,footnoteDefinition:Rd};function Rd(){}const HE=-1,Ep=0,vc=1,Ef=2,Jy=3,Qy=4,Xy=5,Zy=6,VE=7,KE=8,_0=typeof self=="object"?self:globalThis,D8=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),s=o=>{if(e.has(o))return e.get(o);const[i,l]=t[o];switch(i){case Ep:case HE:return n(l,o);case vc:{const u=n([],o);for(const d of l)u.push(s(d));return u}case Ef:{const u=n({},o);for(const[d,m]of l)u[s(d)]=s(m);return u}case Jy:return n(new Date(l),o);case Qy:{const{source:u,flags:d}=l;return n(new RegExp(u,d),o)}case Xy:{const u=n(new Map,o);for(const[d,m]of l)u.set(s(d),s(m));return u}case Zy:{const u=n(new Set,o);for(const d of l)u.add(s(d));return u}case VE:{const{name:u,message:d}=l;return n(new _0[u](d),o)}case KE:return n(BigInt(l),o);case"BigInt":return n(Object(BigInt(l)),o);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}}return n(new _0[i](l),o)};return s},M0=e=>D8(new Map,e)(0),pi="",{toString:$8}={},{keys:L8}=Object,ec=e=>{const t=typeof e;if(t!=="object"||!e)return[Ep,t];const n=$8.call(e).slice(8,-1);switch(n){case"Array":return[vc,pi];case"Object":return[Ef,pi];case"Date":return[Jy,pi];case"RegExp":return[Qy,pi];case"Map":return[Xy,pi];case"Set":return[Zy,pi];case"DataView":return[vc,n]}return n.includes("Array")?[vc,n]:n.includes("Error")?[VE,n]:[Ef,n]},Ad=([e,t])=>e===Ep&&(t==="function"||t==="symbol"),I8=(e,t,n,s)=>{const o=(l,u)=>{const d=s.push(l)-1;return n.set(u,d),d},i=l=>{if(n.has(l))return n.get(l);let[u,d]=ec(l);switch(u){case Ep:{let h=l;switch(d){case"bigint":u=KE,h=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return o([HE],l)}return o([u,h],l)}case vc:{if(d){let y=l;return d==="DataView"?y=new Uint8Array(l.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(l)),o([d,[...y]],l)}const h=[],g=o([u,h],l);for(const y of l)h.push(i(y));return g}case Ef:{if(d)switch(d){case"BigInt":return o([d,l.toString()],l);case"Boolean":case"Number":case"String":return o([d,l.valueOf()],l)}if(t&&"toJSON"in l)return i(l.toJSON());const h=[],g=o([u,h],l);for(const y of L8(l))(e||!Ad(ec(l[y])))&&h.push([i(y),i(l[y])]);return g}case Jy:return o([u,l.toISOString()],l);case Qy:{const{source:h,flags:g}=l;return o([u,{source:h,flags:g}],l)}case Xy:{const h=[],g=o([u,h],l);for(const[y,b]of l)(e||!(Ad(ec(y))||Ad(ec(b))))&&h.push([i(y),i(b)]);return g}case Zy:{const h=[],g=o([u,h],l);for(const y of l)(e||!Ad(ec(y)))&&h.push(i(y));return g}}const{message:m}=l;return o([u,{name:d,message:m}],l)};return i},F0=(e,{json:t,lossy:n}={})=>{const s=[];return I8(!(t||n),!!t,new Map,s)(e),s},Tf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?M0(F0(e,t)):structuredClone(e):(e,t)=>M0(F0(e,t));function O8(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 _8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function M8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||O8,s=e.options.footnoteBackLabel||_8,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=ll(g.toLowerCase());let b=0;const C=[],w=e.footnoteCounts.get(g);for(;w!==void 0&&++b<=w;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(d,b);typeof E=="string"&&(E={type:"text",value:E}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(d,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...C)}else h.push(...C);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Tf(l),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
578
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
579
|
+
`}]}}const qE=(function(e){if(e==null)return U8;if(typeof e=="function")return Tp(e);if(typeof e=="object")return Array.isArray(e)?F8(e):z8(e);if(typeof e=="string")return B8(e);throw new Error("Expected function, string, or object as test")});function F8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=qE(e[n]);return Tp(s);function s(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function z8(e){const t=e;return Tp(n);function n(s){const o=s;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function B8(e){return Tp(t);function t(n){return n&&n.type===e}}function Tp(e){return t;function t(n,s,o){return!!(W8(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function U8(){return!0}function W8(e){return e!==null&&typeof e=="object"&&"type"in e}const GE=[],H8=!0,z0=!1,V8="skip";function K8(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const i=qE(o),l=s?-1:1;u(e,void 0,[])();function u(d,m,h){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(d.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=GE,C,w,v;if((!t||i(d,m,h[h.length-1]||void 0))&&(b=q8(n(d,h)),b[0]===z0))return b;if("children"in d&&d.children){const k=d;if(k.children&&b[0]!==V8)for(w=(s?k.children.length:-1)+l,v=h.concat(k);w>-1&&w<k.children.length;){const E=k.children[w];if(C=u(E,w,v)(),C[0]===z0)return C;w=typeof C[1]=="number"?C[1]:w+l}}return b}}}function q8(e){return Array.isArray(e)?e:typeof e=="number"?[H8,e]:e==null?GE:[e]}function YE(e,t,n,s){let o,i,l;typeof t=="function"&&typeof n!="function"?(i=void 0,l=t,o=n):(i=t,l=n,o=s),K8(e,i,u,o);function u(d,m){const h=m[m.length-1],g=h?h.children.indexOf(d):void 0;return l(d,g,h)}}const px={}.hasOwnProperty,G8={};function Y8(e,t){const n=t||G8,s=new Map,o=new Map,i=new Map,l={...P8,...n.handlers},u={all:m,applyData:Q8,definitionById:s,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:l,one:d,options:n,patch:J8,wrap:Z8};return YE(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?s:o,y=String(h.identifier).toUpperCase();g.has(y)||g.set(y,h)}}),u;function d(h,g){const y=h.type,b=u.handlers[y];if(px.call(u.handlers,y)&&b)return b(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:w,...v}=h,k=Tf(v);return k.children=u.all(h),k}return Tf(h)}return(u.options.unknownHandler||X8)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const C=u.one(y[b],h);if(C){if(b&&y[b-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=B0(C.value)),!Array.isArray(C)&&C.type==="element")){const w=C.children[0];w&&w.type==="text"&&(w.value=B0(w.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function J8(e,t){e.position&&(t.position=$6(e))}function Q8(e,t){let n=t;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const l="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:l}}n.type==="element"&&i&&Object.assign(n.properties,Tf(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function X8(e,t){const n=t.data||{},s="value"in t&&!(px.call(n,"hProperties")||px.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 Z8(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
580
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
581
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
582
|
+
`}),n}function B0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function U0(e,t){const n=Y8(e,t),s=n.one(e,void 0),o=M8(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
583
|
+
`},o),i}function eU(e,t){return e&&"run"in e?async function(n,s){const o=U0(n,{file:s,...t});await e.run(o,s)}:function(n,s){return U0(n,{file:s,...e||t})}}function W0(e){if(e)throw e}var rg,H0;function tU(){if(H0)return rg;H0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},i=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var y;for(y in m);return typeof y>"u"||e.call(m,y)},l=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 rg=function d(){var m,h,g,y,b,C,w=arguments[0],v=1,k=arguments.length,E=!1;for(typeof w=="boolean"&&(E=w,w=arguments[1]||{},v=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});v<k;++v)if(m=arguments[v],m!=null)for(h in m)g=u(w,h),y=u(m,h),w!==y&&(E&&y&&(i(y)||(b=o(y)))?(b?(b=!1,C=g&&o(g)?g:[]):C=g&&i(g)?g:{},l(w,{name:h,newValue:d(E,C,y)})):typeof y<"u"&&l(w,{name:h,newValue:y}));return w},rg}var nU=tU();const sg=$f(nU);function mx(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 rU(){const e=[],t={run:n,use:s};return t;function n(...o){let i=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...o);function u(d,...m){const h=e[++i];let g=-1;if(d){l(d);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,h?sU(h,u)(...m):l(null,...m)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function sU(e,t){let n;return s;function s(...l){const u=e.length>l.length;let d;u&&l.push(o);try{d=e.apply(this,l)}catch(m){const h=m;if(u&&n)throw h;return o(h)}u||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(l,...u){n||(n=!0,t(l,...u))}function i(l){o(null,l)}}const bs={basename:oU,dirname:aU,extname:iU,join:lU,sep:"/"};function oU(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');iu(e);let n=0,s=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let l=-1,u=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else l<0&&(i=!0,l=o+1),u>-1&&(e.codePointAt(o)===t.codePointAt(u--)?u<0&&(s=o):(u=-1,s=l));return n===s?s=l:s<0&&(s=e.length),e.slice(n,s)}function aU(e){if(iu(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 iU(e){iu(e);let t=e.length,n=-1,s=0,o=-1,i=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){s=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function lU(...e){let t=-1,n;for(;++t<e.length;)iu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":cU(n)}function cU(e){iu(e);const t=e.codePointAt(0)===47;let n=uU(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function uU(e,t){let n="",s=0,o=-1,i=0,l=-1,u,d;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(o===l-1||i===1))if(o!==l-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),o=l,i=0;continue}}else if(n.length>0){n="",s=0,o=l,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),s=l-o-1;o=l,i=0}else u===46&&i>-1?i++:i=-1}return n}function iu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const dU={cwd:fU};function fU(){return"/"}function hx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function pU(e){if(typeof e=="string")e=new URL(e);else if(!hx(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 mU(e)}function mU(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const og=["history","path","basename","stem","extname","dirname"];class JE{constructor(t){let n;t?hx(t)?n={path:t}:typeof t=="string"||hU(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":dU.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<og.length;){const i=og[s];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)og.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?bs.basename(this.path):void 0}set basename(t){ig(t,"basename"),ag(t,"basename"),this.path=bs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?bs.dirname(this.path):void 0}set dirname(t){V0(this.basename,"dirname"),this.path=bs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?bs.extname(this.path):void 0}set extname(t){if(ag(t,"extname"),V0(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=bs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){hx(t)&&(t=pU(t)),ig(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?bs.basename(this.path,this.extname):void 0}set stem(t){ig(t,"stem"),ag(t,"stem"),this.path=bs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Kn(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ag(e,t){if(e&&e.includes(bs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+bs.sep+"`")}function ig(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function V0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function hU(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const gU=(function(e){const s=this.constructor.prototype,o=s[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),xU={}.hasOwnProperty;class eb extends gU{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=rU()}copy(){const t=new eb;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(sg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(ug("data",this.frozen),this.namespace[t]=n,this):xU.call(this.namespace,t)&&this.namespace[t]||void 0:t?(ug("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Pd(t),s=this.parser||this.Parser;return lg("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),lg("process",this.parser||this.Parser),cg("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,l){const u=Pd(t),d=s.parse(u);s.run(d,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,C=s.stringify(b,y);vU(C)?y.value=C:y.result=C,m(h,y)});function m(h,g){h||!g?l(h):i?i(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),lg("processSync",this.parser||this.Parser),cg("processSync",this.compiler||this.Compiler),this.process(t,o),q0("processSync","process",n),s;function o(i,l){n=!0,W0(i),s=l}}run(t,n,s){K0(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(l,u){const d=Pd(n);o.run(t,d,m);function m(h,g,y){const b=g||t;h?u(h):l?l(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,o;return this.run(t,n,i),q0("runSync","run",s),o;function i(l,u){W0(l),o=u,s=!0}}stringify(t,n){this.freeze();const s=Pd(n),o=this.compiler||this.Compiler;return cg("stringify",o),K0(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(ug("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;d(h,g)}else l(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function l(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(m.plugins),m.settings&&(o.settings=sg(!0,o.settings,m.settings))}function u(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];i(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function d(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...C]=h;const w=s[y][1];mx(w)&&mx(b)&&(b=sg(!0,w,b)),s[y]=[m,b,...C]}}}}const yU=new eb().freeze();function lg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function cg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function ug(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 K0(e){if(!mx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function q0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pd(e){return bU(e)?e:new JE(e)}function bU(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function vU(e){return typeof e=="string"||wU(e)}function wU(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const jU="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",G0=[],Y0={allowDangerousHtml:!0},kU=/^(https?|ircs?|mailto|xmpp)$/i,SU=[{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 NU(e){const t=CU(e),n=EU(e);return TU(t.runSync(t.parse(n),n),e)}function CU(e){const t=e.rehypePlugins||G0,n=e.remarkPlugins||G0,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Y0}:Y0;return yU().use(o8).use(n).use(eU,s).use(t)}function EU(e){const t=e.children||"",n=new JE;return typeof t=="string"&&(n.value=t),n}function TU(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,i=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||RU;for(const h of SU)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+jU+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),YE(e,m),M6(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,g,y){if(h.type==="raw"&&y&&typeof g=="number")return l?y.children.splice(g,1):y.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let b;for(b in eg)if(Object.hasOwn(eg,b)&&Object.hasOwn(h.properties,b)){const C=h.properties[b],w=eg[b];(w===null||w.includes(h.tagName))&&(h.properties[b]=d(String(C||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(h,g,y)),b&&y&&typeof g=="number")return u&&h.children?y.children.splice(g,1,...h.children):y.children.splice(g,1),g}}}function RU(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||kU.test(e.slice(0,t))?e:""}function gn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:be("prose-syntaur max-w-none",t),children:r.jsx(NU,{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 Hr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function AU(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,l]=f.useState(null),u=f.useCallback(async()=>{if(e)try{const d=await fetch(Hr(e));if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),l(null)}catch(d){l(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Xi(d=>{d.type==="todos-updated"&&d.projectSlug===e&&u()}),{data:t,loading:s,error:i,refetch:u}}async function PU(e,t,n){await fetch(Hr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function DU(e,t,n){await fetch(`${Hr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function $U(e,t,n){await fetch(`${Hr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function LU(e,t,n){await fetch(`${Hr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function IU(e,t){await fetch(`${Hr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function OU(e,t){await fetch(`${Hr(e)}/${t}`,{method:"DELETE"})}async function _U(e,t,n){const s=await fetch(`${Hr(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 QE(e,t,n){return`${Hr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function MU(e,t,n){for(const s of n){const o=await fetch(`${Hr(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function FU(e,t,n){const s=await fetch(QE(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function XE(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,l=new Error(i);throw l.status=n.status,l}return n.json().catch(()=>({}))}async function zU(e,t){return await XE(`${Hr(e)}/promote`,t)}async function BU(e,t,n){await XE(`${Hr(e)}/${t}/move`,{to:n})}const J0=[{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 ZE({status:e,onChange:t}){const[n,s]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>{if(!n)return;function l(u){o.current&&!o.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[n]);const i=J0.find(l=>l.value===e);return r.jsxs("div",{className:"relative",ref:o,onClick:l=>l.stopPropagation(),children:[r.jsx("button",{onClick:()=>s(!n),className:`text-lg leading-none ${i.color} hover:opacity-70 transition`,title:i.label,children:i.icon}),n&&r.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:J0.filter(l=>l.value!==e).map(l=>r.jsxs("button",{onClick:()=>{t(l.value),s(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${l.color}`,children:[r.jsx("span",{className:"text-base leading-none",children:l.icon}),r.jsx("span",{children:l.label})]},l.value))})]})}function e2({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:o,onEndEdit:i,onPatchDescription:l,onAddAttachments:u,onDeleteAttachment:d,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:C,hotkeyRowProps:w,onDragOrigin:v,onDragStart:k,onDragEnd:E,isDragging:S}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...w??{},onMouseDown:v,onDragStart:T=>k(T,e.id),onDragEnd:E,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${S?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(ZE,{status:e.status,onChange:T=>y(e.id,T)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(t2,{description:e.description,status:e.status,editing:s,onBeginEdit:()=>o(e.id),onEndEdit:i,onSave:T=>l(e.id,T)}),e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(T=>`#${T}`).join(" ")}),e.session&&r.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(KU,{item:e})]}),r.jsx(n2,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>d(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Tr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:T=>b(T,e.id),children:["t:",e.id]}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:T=>b(T,e.id),children:r.jsx(of,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:T=>g(e.id,T),children:r.jsx(Mf,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:T=>C(T,e.id,e.description),children:r.jsx(yn,{className:"h-3 w-3"})})]})]})}function t2({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:o,onSave:i}){return n?r.jsx(UU,{initialValue:e,onSave:i,onExit:o}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:l=>{l.stopPropagation(),s()},title:"Click to edit",className:be("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 UU({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[o,i]=f.useState(e),[l,u]=f.useState(!1),[d,m]=f.useState(!1),h=f.useRef(null),g=f.useRef(!1);f.useEffect(()=>{const w=h.current;w&&(w.focus(),w.select())},[]);const y=f.useCallback(()=>{var w;m(!0),window.setTimeout(()=>m(!1),260),(w=h.current)==null||w.focus()},[]),b=f.useCallback(async()=>{if(g.current)return;const w=o.trim();if(w.length===0){y();return}if(w===s.current){n();return}g.current=!0,u(!0);try{await t(w)}catch{}finally{u(!1),n()}},[o,n,t,y]);function C(w){w.key==="Enter"?(w.preventDefault(),b()):w.key==="Escape"&&(w.preventDefault(),g.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:l,value:o,onClick:w=>w.stopPropagation(),onChange:w=>i(w.target.value),onKeyDown:C,onBlur:()=>void b(),className:be("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-sm text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",d&&"syntaur-input-shake",l&&"opacity-70")})}function WU(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function HU(e){const t=e.clipboardData,n=[];if(t.files&&t.files.length&&n.push(...Array.from(t.files)),!n.length&&t.items){for(const s of Array.from(t.items))if(s.kind==="file"){const o=s.getAsFile();o&&n.push(o)}}return n}function n2({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const o=e.attachments??[],[i,l]=f.useState(!1),[u,d]=f.useState(!1),m=f.useRef(null),h=f.useRef(null);f.useEffect(()=>{var y;i&&((y=h.current)==null||y.focus())},[i]);const g=f.useCallback(async y=>{if(y.length){d(!0);try{await n(y),l(!1)}finally{d(!1)}}},[n]);return r.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:y=>y.stopPropagation(),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(y=>r.jsx(VU,{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:()=>l(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(pS,{className:"h-3 w-3"}),o.length===0?"Attach":""]})]}),i&&r.jsxs("div",{ref:h,"data-no-drag":!0,tabIndex:0,role:"button","aria-label":"Add attachments: drop, paste, or click",onPaste:y=>{const b=HU(y);b.length&&(y.preventDefault(),g(b))},onDragOver:y=>{Array.from(y.dataTransfer.types).includes("Files")&&y.preventDefault()},onDrop:y=>{const b=Array.from(y.dataTransfer.files);b.length&&(y.preventDefault(),g(b))},onClick:()=>{var y;return(y=m.current)==null?void 0:y.click()},className:"mt-1 cursor-pointer rounded-md border border-dashed border-border/70 px-3 py-2 text-xs text-muted-foreground hover:border-border focus:outline-none focus:ring-2 focus:ring-ring/40",children:[u?"Uploading…":"Drop, paste (⌘V / Ctrl+V), or click to add files",r.jsx("input",{ref:m,type:"file",multiple:!0,className:"hidden",onChange:y=>{const b=Array.from(y.target.files??[]);y.target.value="",g(b)}})]})]})}function VU({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:[WU(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(pS,{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(Hc,{className:"h-3 w-3"})})]})}function KU({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(ma,{delayDuration:120,children:r.jsxs(Sr,{children:[r.jsx(Nr,{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(Px,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(cr,{children:e.branch})]})}):null,e.planDir?r.jsx(ma,{delayDuration:120,children:r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),su(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(dS,{className:"h-2.5 w-2.5"})})}),r.jsxs(cr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(ma,{delayDuration:120,children:r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(cr,{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 r2="__one_off__";function tb({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o,defaultProject:i,defaultTitle:l,allowOneOff:u=!0}){const[d,m]=f.useState("new"),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,w]=f.useState(null),[v,k]=f.useState(null),[E,S]=f.useState(""),[T,I]=f.useState(""),[R,P]=f.useState(""),[$,L]=f.useState(""),[F,A]=f.useState(""),[z,V]=f.useState(""),[O,B]=f.useState(null),[K,q]=f.useState(!1),_=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),S(""),I(""),P(""),L(""),A(""),V(""),B(null);return}S(i??""),I(l??"");let oe=!1;return(async()=>{try{const ue=await fetch("/api/projects");if(!ue.ok)throw new Error(`HTTP ${ue.status}`);const re=await ue.json();oe||w(re.filter(xe=>!xe.archived))}catch(ue){oe||k(ue instanceof Error?ue.message:String(ue))}})(),()=>{oe=!0}},[e,i,l]),f.useEffect(()=>{if(!F){B(null);return}let oe=!1;return q(!0),(async()=>{try{const ue=await fetch(`/api/projects/${encodeURIComponent(F)}/assignments`);if(!ue.ok)throw new Error(`HTTP ${ue.status}`);const re=await ue.json();oe||B(re)}catch{oe||B([])}finally{oe||q(!1)}})(),()=>{oe=!0}},[F]);const G=f.useMemo(()=>C??[],[C]);async function D(oe){if(oe.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(_&&!T.trim()){b("Title is required when promoting multiple todos.");return}const ue=E===r2?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const xe={groups:n.groups,mode:"new-assignment",target:ue,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await U(xe);return}const re={todoIds:t,mode:"new-assignment",target:ue,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await Z(re)}async function H(oe){if(oe.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!F||!z){b("Pick both project and assignment.");return}const ue={todoIds:t,mode:"to-assignment",target:{assignment:`${F}/${z}`}};await Z(ue)}async function Z(oe){g(!0),b(null);try{let ue;if(n.kind==="workspace")ue=await RD(n.workspace,oe);else if(n.kind==="project")ue=await zU(n.projectId,oe);else throw new Error("Aggregate scope requires runBulkMutation.");o(ue),s(!1)}catch(ue){b(ue instanceof Error?ue.message:String(ue))}finally{g(!1)}}async function U(oe){g(!0),b(null);try{const ue=await AD(oe);o(ue),s(!1)}catch(ue){b(ue instanceof Error?ue.message:String(ue))}finally{g(!1)}}return r.jsx(Ln,{open:e,onOpenChange:oe=>h?void 0:s(oe),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Xn,{children:[r.jsxs(Tn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Wr,{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(mE,{value:d,onValueChange:oe=>m(oe),children:[r.jsxs(hE,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(sx,{value:"new",className:be("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(sx,{value:"existing",className:be("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(ox,{value:"new",children:r.jsxs("form",{onSubmit:D,className:"space-y-4",children:[r.jsx(mi,{label:"Target project",children:r.jsx(Q0,{value:E,onChange:S,projects:G,error:v,disabled:h,allowOneOff:u})}),r.jsx(mi,{label:_?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:oe=>I(oe.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(mi,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:oe=>P(oe.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(mi,{label:"Priority",children:r.jsxs("select",{value:$,onChange:oe=>L(oe.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(X0,{message:y}):null,r.jsx(Z0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(ox,{value:"existing",children:r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsx(mi,{label:"Project",children:r.jsx(Q0,{value:F,onChange:oe=>{A(oe),V("")},projects:G,error:v,disabled:h})}),r.jsx(mi,{label:K?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:z,onChange:oe=>V(oe.target.value),disabled:h||!F||K,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:F?"Select assignment...":"Pick a project first"}),(O??[]).map(oe=>r.jsxs("option",{value:oe.slug,children:[oe.title," (",oe.status,")"]},oe.slug))]})}),y?r.jsx(X0,{message:y}):null,r.jsx(Z0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function mi({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 Q0({value:e,onChange:t,projects:n,error:s,disabled:o,allowOneOff:i}){return s?r.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",s]}):r.jsxs("select",{value:e,onChange:l=>t(l.target.value),disabled:o,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),i?r.jsx("option",{value:r2,children:"One-off (no project)"}):null,n.map(l=>r.jsxs("option",{value:l.slug,children:[l.title," (",l.slug,")"]},l.slug))]})}function X0({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 Z0({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Rr,{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 s2({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o}){const[i,l]=f.useState("project"),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(!1),[b,C]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null);f.useEffect(()=>{if(!e){l("project"),d(""),h(""),C(null),v(null);return}let P=!1;return(async()=>{try{const $=await fetch("/api/projects");if(!$.ok)throw new Error(`HTTP ${$.status}`);const L=await $.json();P||E(L.filter(F=>!F.archived))}catch($){P||v($ instanceof Error?$.message:String($))}})(),()=>{P=!0}},[e]);const S=f.useMemo(()=>k?n.kind==="project"?k.filter(P=>P.slug!==n.projectId):k:[],[k,n]);function T(){if(i==="global")return{global:!0};if(i==="workspace"){const P=u.trim();return P?{workspace:P}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function I(P,$){try{return n.kind==="workspace"?await PD(n.workspace,P,$):await BU(n.projectId,P,$),{ok:!0}}catch(L){return{ok:!1,error:L instanceof Error?L.message:String(L)}}}async function R(P){P.preventDefault(),v(null);const $=T();if(typeof $=="string"){v($);return}y(!0),C(null);const L=[],F=[];for(const A of t){const z=await I(A,$);z.ok?L.push(A):F.push({id:A,error:z.error})}y(!1),o(),F.length===0?s(!1):C({succeeded:L,failed:F})}return r.jsx(Ln,{open:e,onOpenChange:P=>g?void 0:s(P),children:r.jsx(En,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(Xn,{children:[r.jsxs(Tn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Wr,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),r.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(dg,{kind:"project",checked:i==="project",onChange:()=>l("project"),label:"Project"}),r.jsx(dg,{kind:"workspace",checked:i==="workspace",onChange:()=>l("workspace"),label:"Workspace"}),r.jsx(dg,{kind:"global",checked:i==="global",onChange:()=>l("global"),label:"Global"})]}),i==="project"?r.jsx(ek,{label:"Target project",children:r.jsxs("select",{value:m,onChange:P=>h(P.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),S.map(P=>r.jsxs("option",{value:P.slug,children:[P.title," (",P.slug,")"]},P.slug))]})}):null,i==="workspace"?r.jsx(ek,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:P=>d(P.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,w?r.jsx(qU,{message:w}):null,b?r.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground space-y-1",children:[r.jsxs("div",{className:"font-medium",children:["Moved ",b.succeeded.length," of ",t.length,"; ",b.failed.length," failed."]}),r.jsx("ul",{className:"text-xs space-y-0.5",children:b.failed.map(P=>r.jsxs("li",{children:["[t:",P.id,"] ",P.error]},P.id))})]}):null,r.jsxs(Rr,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:g,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:b?"Close":"Cancel"}),b===null?r.jsx("button",{type:"submit",disabled:g,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:g?"Moving...":"Move"}):null]})]})})})}function ek({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 dg({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 qU({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 nb({label:e,count:t,expanded:n,onToggle:s,isDropTarget:o=!1,onDragOver:i,onDragLeave:l,onDrop:u,children:d}){return r.jsxs("div",{className:be("rounded-lg border border-border/60 bg-card/40 transition",o&&"ring-2 ring-ring/30"),onDragOver:i,onDragLeave:l,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(fr,{className:be("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:e}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&r.jsx("div",{className:"space-y-1 px-2 pb-2",children:d})]})}const o2=[{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 Rp(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function rb(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Rp(n.status)].push(n);return o2.map(n=>({config:n,items:t[n.id]}))}const a2="syntaur.todos.sections.collapsed.v1",tk=Object.fromEntries(o2.map(e=>[e.id,e.defaultCollapsed]));function fg(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(a2);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function GU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(a2,JSON.stringify(e))}catch{}}function sb(e){const[t,n]=f.useState(()=>fg()[e]??{});f.useEffect(()=>{n(fg()[e]??{})},[e]);const s=f.useCallback(i=>t[i]??tk[i],[t]),o=f.useCallback(i=>{const l=fg(),u=l[e]??{},d=u[i]??tk[i],m={...u,[i]:!d};l[e]=m,GU(l),n(m)},[e]);return{isCollapsed:s,toggle:o}}function YU({projectId:e}){const{data:t,loading:n,error:s,refetch:o}=AU(e),[i,l]=f.useState(""),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(new Set),[S,T]=f.useState(!1),[I,R]=f.useState(!1),[P,$]=f.useState(null),L=f.useRef(null);Lo("list:todos");const F=sb("project:"+e),[A,z]=f.useState(null),[V,O]=f.useState(null),B=f.useRef(null);async function K(X,he){X.stopPropagation(),await su(he)&&(C(he),setTimeout(()=>C(ne=>ne===he?null:ne),1500))}const q=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const X=new Set;for(const he of t.items)for(const ne of he.tags)X.add(ne);return Array.from(X).sort()},[t]),_=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let X=t.items;if(i.trim()){const he=i.toLowerCase();X=X.filter(ne=>ne.description.toLowerCase().includes(he)||ne.tags.some(ye=>ye.toLowerCase().includes(he))||ne.id.includes(he))}return u&&(X=X.filter(he=>he.status===u)),m&&(X=X.filter(he=>he.tags.includes(m))),X},[t,i,u,m]);f.useEffect(()=>{E(new Set)},[i,u,m,e]);const G=f.useMemo(()=>_.filter(X=>k.has(X.id)).length,[_,k]),D=_.length>0&&G===_.length,H=G>0&&!D;function Z(X){E(he=>{const ne=new Set(he);return ne.has(X)?ne.delete(X):ne.add(X),ne})}function U(){E(X=>{const he=new Set(X);if(D)for(const ne of _)he.delete(ne.id);else for(const ne of _)he.add(ne.id);return he})}function oe(){E(new Set)}const ue=P?[P]:Array.from(k);function re(){E(new Set),$(null),o()}function xe(){E(new Set),o()}async function ke(){g.trim()&&(await PU(e,g.trim()),y(""),o())}async function Pe(X,he,ne){X.stopPropagation(),window.confirm(`Delete "${ne}"? This can't be undone.`)&&(await OU(e,he),o())}async function De(X,he){switch(he){case"open":await IU(e,X);break;case"in_progress":await LU(e,X);break;case"completed":await DU(e,X);break;case"blocked":await $U(e,X);break}o()}async function Xe(X,he){await _U(e,X,he),o()}async function st(X,he){await MU(e,X,he),o()}async function Ze(X,he){await FU(e,X,he),o()}const ot=rb(_),le=ot.filter(X=>!F.isCollapsed(X.config.id)).flatMap(X=>X.items),{hotkeyRowProps:Re}=Gc(le,{scope:"list:todos",bindO:!1,onOpen:X=>v(X.id)});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var X;return(X=L.current)==null?void 0:X.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Se,Oe]=is(),ze=Se.get("focus");f.useEffect(()=>{if(!ze||!(t!=null&&t.items))return;const X=t.items.find(ne=>ne.id===ze);if(!X)return;const he=Rp(X.status);F.isCollapsed(he)&&F.toggle(he)},[ze,t==null?void 0:t.items]),f.useEffect(()=>{if(!ze)return;const X=document.querySelector(`[data-todo-id="${window.CSS.escape(ze)}"]`);if(!X)return;X.scrollIntoView({block:"nearest"}),X.classList.add("ring-2","ring-primary/60");const he=window.setTimeout(()=>{X.classList.remove("ring-2","ring-primary/60"),Oe(ne=>{const ye=new URLSearchParams(ne);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(he)},[ze,le.length,Oe]);const et=A?(t==null?void 0:t.items.find(X=>X.id===A))??null:null;function _e(X,he){const ne=B.current;if(ne!=null&&ne.closest(Hi)){X.preventDefault();return}X.dataTransfer.effectAllowed="move",X.dataTransfer.setData("text/plain",he),z(he)}function qe(){z(null),O(null)}function Lt(X,he){!et||he.statuses.includes(et.status)||(X.preventDefault(),X.dataTransfer.dropEffect="move",O(he.id))}function bt(X,he){V===he.id&&!X.currentTarget.contains(X.relatedTarget)&&O(null)}function ut(X,he){X.preventDefault();const ne=et;qe(),!(!ne||he.statuses.includes(ne.status))&&De(ne.id,he.dropStatus)}if(n)return r.jsx(mt,{label:"Loading todos..."});if(s)return r.jsx(kt,{error:s});const ae=(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(_n,{label:"Open",value:ae.open,icon:Fr}),r.jsx(_n,{label:"In Progress",value:ae.in_progress,icon:Fr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:ae.blocked,icon:Ox,tone:"warn"}),r.jsx(_n,{label:"Total",value:ae.total,icon:Fr})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:X=>y(X.target.value),onKeyDown:X=>X.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:!g.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(jt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:L,type:"text",placeholder:"Search...",value:i,onChange:X=>l(X.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:X=>d(X.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"})]}),q.length>0&&r.jsxs("select",{value:m,onChange:X=>h(X.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"}),q.map(X=>r.jsxs("option",{value:X,children:["#",X]},X))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{$(null),R(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:oe,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:D,ref:X=>{X&&(X.indeterminate=H)},onChange:U,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 X=-1;return ot.map(({config:he,items:ne})=>{const ye=!F.isCollapsed(he.id);return r.jsx(nb,{label:he.label,count:ne.length,expanded:ye,onToggle:()=>F.toggle(he.id),isDropTarget:V===he.id,onDragOver:Ee=>Lt(Ee,he),onDragLeave:Ee=>bt(Ee,he),onDrop:Ee=>ut(Ee,he),children:ye&&ne.map(Ee=>(X+=1,r.jsx(e2,{item:Ee,copiedId:b,selected:k.has(Ee.id),editing:w===Ee.id,onBeginEdit:ve=>v(ve),onEndEdit:()=>v(null),onPatchDescription:Xe,onAddAttachments:st,onDeleteAttachment:Ze,attachmentUrl:(ve,ee)=>QE(e,ve,ee),onToggleSelected:ve=>Z(ve),onMoveOne:(ve,ee)=>{ee.stopPropagation(),$(ve),R(!0)},onStatusChange:De,onCopyId:K,onDelete:Pe,hotkeyRowProps:Re(X),onDragOrigin:ve=>{B.current=ve.target},onDragStart:_e,onDragEnd:qe,isDragging:A===Ee.id},Ee.id)))},he.id)})})()}),r.jsx(tb,{open:S,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:xe}),r.jsx(s2,{open:I,selectedIds:ue,scope:{kind:"project",projectId:e},onOpenChange:X=>{R(X),X||$(null)},onDone:re})]})}const JU={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},nk=new Set(["title"]);function i2({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function o(l){if(nk.has(l))return;const d=e.hidden.includes(l)?e.hidden.filter(m=>m!==l):[...e.hidden,l];t({hidden:d})}const i=e.hidden.length;return r.jsxs(Ln,{open:n,onOpenChange:s,children:[r.jsx(BL,{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(OP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",i>0?` (${Hh.length-i}/${Hh.length})`:""]})]})}),r.jsxs(En,{className:"max-w-sm",children:[r.jsx(Xn,{children:r.jsx(Tn,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Hh.map(l=>{const u=e.hidden.includes(l),d=nk.has(l);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${d?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>o(l),disabled:d,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:JU[l]}),d?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},l)})})]})]})}const _i={...Cc,custom:!1},l2=`view-prefs.cache.v${Cc.version}`;let Mc=QU(),hi=null;const Fc=new Set;let c2=0;function ob(){return++c2}function ab(e){return e===c2}function QU(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(l2);if(!e)return null;const t=JSON.parse(e);return t.version!==Cc.version?null:t}catch{return null}}function XU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(l2,JSON.stringify(e))}catch{}}function ib(e){Mc=e,XU(e);for(const t of Fc)t(e)}function lb(e){if(!e||typeof e!="object")return _i;const t=e;return t.version!==Cc.version||!t.global||!t.projects?_i:{version:Cc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function cb(){if(hi)return hi;const e=ob();return hi=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=lb(t);return ab(e)&&ib(n),hi=null,Mc??n}).catch(()=>(hi=null,Mc??_i)),hi}function u2(e){const[t,n]=f.useState(()=>Mc??_i);return f.useEffect(()=>{let s=!1;return cb().then(o=>{s||n(o)}),Fc.add(n),()=>{s=!0,Fc.delete(n)}},[]),F1(t,e??null)}function ZU(){const[e,t]=f.useState(()=>Mc??_i);return f.useEffect(()=>{let n=!1;return cb().then(s=>{n||t(s)}),Fc.add(t),()=>{n=!0,Fc.delete(t)}},[]),e}async function d2(e){const t=ob(),n=await fetch("/api/view-prefs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save view-prefs")}const s=lb(await n.json());return ab(t)&&ib(s),s}function f2(e){return d2({global:e})}function p2(e,t){return d2({projects:{[e]:t}})}async function e7(){const e=ob(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=lb(await t.json());return ab(e)&&ib(n),n}const rk=80;function m2({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:o="Save view"}){const[i,l]=f.useState(n),[u,d]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(l(n),h(null),d(!1))},[e,n]);const g=i.trim(),y=g.length>0&&g.length<=rk;return r.jsx(Ln,{open:e,onOpenChange:t,children:r.jsx(En,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){d(!0),h(null);try{await s(g)}catch(C){h(C instanceof Error?C.message:String(C)),d(!1)}}},children:[r.jsx(Xn,{children:r.jsx(Tn,{children:o})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:rk,onChange:b=>l(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(Rr,{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 h2({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:o,loading:i}=Zc(),[l,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{if(!l)return;function y(C){d.current&&!d.current.contains(C.target)&&u(!1)}function b(C){C.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[l]);const m=f.useMemo(()=>o.filter(y=>WN(y,e)),[o,e]),h=t?o.find(y=>y.id===t)??null:null,g=i?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("button",{type:"button",disabled:i,onClick:()=>u(y=>!y),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":l,title:"Saved views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:g}),r.jsx(fr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),l&&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:be("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(Tr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const t7=new Set(["overview","assignments","todos","dependencies","knowledge"]),sk="__unknown_type__";function ok(){const{slug:e,workspace:t}=Mt(),n=un(),s=_t();Lo("project"),Kt({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Kt({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:l,refetch:u}=zS(e),d=cs(),m=qc(),{data:h}=ba(),[g,y]=is(),b=g.get("tab"),C=b&&t7.has(b)?b:"overview";function w(se){y(Be=>{const tt=new URLSearchParams(Be);return se==="overview"?tt.delete("tab"):tt.set("tab",se),tt},{replace:!0})}const v=e?`p:${e}`:null,k=u2(v),[E,S]=f.useState(()=>_h(k.defaultView)),[T,I]=f.useState(()=>Fe(k.filters.status)),[R,P]=f.useState(()=>Fe(k.filters.assignee)),[$,L]=f.useState(()=>Fe(k.filters.priority)),[F,A]=f.useState(()=>Fe(k.filters.type)),[z,V]=f.useState(()=>Fe(k.filters.tags)),[O,B]=f.useState(null),[K,q]=f.useState(()=>k.grouping),[_,G]=f.useState(()=>k.sortField),[D,H]=f.useState(()=>k.sortDirection),[Z,U]=f.useState(()=>({collapsed:[]})),[oe,ue]=f.useState(()=>({hidden:[]})),[re,xe]=f.useState(()=>({hidden:[]})),[ke,Pe]=f.useState(null),[De,Xe]=f.useState(!1),[st,Ze]=f.useState(!1),{toast:ot,showToast:le,dismissToast:Re}=Io(),Se={kind:"project",slug:e??"",workspace:t??null},Oe=g.get("loadView"),{view:ze,loading:et,error:_e}=Ro(Oe),{view:qe,loading:Lt,error:bt}=Ro(ke),ut=f.useRef(null);f.useEffect(()=>{ke&&!Lt&&!bt&&!qe&&Pe(null)},[qe,bt,ke,Lt]),f.useEffect(()=>{Pe(null),ut.current=null,B(null)},[e,t]),f.useEffect(()=>{S(_h(k.defaultView)),I(Fe(k.filters.status)),P(Fe(k.filters.assignee)),L(Fe(k.filters.priority)),A(Fe(k.filters.type)),V(Fe(k.filters.tags)),q(k.grouping),G(k.sortField),H(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const ae=f.useCallback(se=>{v&&p2(v,se).catch(Be=>{console.warn("Failed to persist project view prefs:",Be)})},[v]),X=f.useCallback(se=>{S(se),ae({defaultView:se})},[ae]),he=f.useCallback(se=>{I(se),ae({filters:{status:se}})},[ae]),ne=f.useCallback(se=>{P(se),ae({filters:{assignee:se}})},[ae]),ye=f.useCallback(se=>{L(se),ae({filters:{priority:se}})},[ae]),Ee=f.useCallback(se=>{A(se),ae({filters:{type:se}})},[ae]),ve=f.useCallback(se=>{V(se),ae({filters:{tags:se}})},[ae]),ee=f.useCallback(se=>{q(se),ae({grouping:se})},[ae]),fe=f.useCallback(se=>{G(se),ae({sortField:se})},[ae]),Ne=f.useCallback(se=>{H(se),ae({sortDirection:se})},[ae]),He=f.useCallback(()=>({viewMode:E,filters:{status:T,priority:$,type:F,assignee:R,tags:z,project:"all",activity:"all",dateRange:ha(O)},sortField:_,sortDirection:D,listSectionVisibility:Z,kanbanColumnVisibility:oe,tableColumnVisibility:re}),[E,T,$,F,R,z,O,_,D,Z,oe,re]),ce=f.useCallback(se=>{WC(se,{setViewMode:Be=>S(_h(Be)),setStatusFilter:he,setPriorityFilter:ye,setTypeFilter:Ee,setAssigneeFilter:ne,setTagsFilter:ve,setDateRange:B,setSortField:fe,setSortDirection:Ne,setListSectionVisibility:U,setKanbanColumnVisibility:ue,setTableColumnVisibility:xe}),Pe(se.id)},[he,ye,Ee,ne,ve,fe,Ne]),pt=f.useCallback(se=>{ce(se),ut.current=se.id,y(Be=>{const tt=new URLSearchParams(Be);return tt.set("loadView",se.id),tt},{replace:!0})},[ce,y]),xt=f.useCallback(async se=>{try{const Be=Vi({name:se,context:{workspace:t??null,projectSlug:e??null},state:He()}),tt=await Bi(Be),yt=tt.views[tt.views.length-1];Pe((yt==null?void 0:yt.id)??null),yt&&(ut.current=yt.id,y(er=>{const Kr=new URLSearchParams(er);return Kr.set("loadView",yt.id),Kr},{replace:!0})),Xe(!1),Ze(!1),le(`Saved view "${se}"`,"success")}catch(Be){throw le(Be instanceof Error?Be.message:"Failed to save view","error"),Be}},[He,y,le,e,t]),St=f.useCallback(async()=>{if(!(!ke||!qe))try{const se=Fe(qe.config.filters.project)[0]??null,Be=Vi({name:qe.name,context:{workspace:t??null,projectSlug:se},state:He()}),tt=kf(qe.config,Be.config,Be.config);await yf(ke,{config:tt}),le("View updated","success")}catch(se){le(se instanceof Error?se.message:"Failed to update view","error")}},[He,qe,ke,le,t]);f.useEffect(()=>{if(!Oe){ut.current=null;return}if(ut.current!==Oe&&(ke&&ke!==Oe&&Pe(null),!et)){if(_e){le("Couldn't load saved view — try again","error");return}if(ze){if(ut.current=Oe,!WN(ze,{kind:"project",slug:e??"",workspace:t??null})){s(VC(ze),{replace:!0});return}ce(ze),y(se=>{const Be=new URLSearchParams(se);return Be.delete("loadView"),Be},{replace:!0});return}ut.current=Oe,le("Saved view no longer exists","error"),y(se=>{const Be=new URLSearchParams(se);return Be.delete("loadView"),Be},{replace:!0})}},[Oe,ze,et,_e,ke,ce,y,le,s,e,t]);function at(se){_===se?Ne(D==="asc"?"desc":"asc"):(fe(se),Ne("asc"))}const me=f.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(se=>{const Be=`${n}/projects/${o.slug}/assignments/${se.slug}`;return[[se.slug,Be],[se.title,Be]]})):{},[o]);async function Me(se){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:se})}),u()}async function Ye(se){try{const Be=await fetch(`/api/projects/${e}/${se?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const tt=await Be.json().catch(()=>null);le((tt==null?void 0:tt.error)||`HTTP ${Be.status}`,"error");return}u(),le(se?"Project archived":"Project restored","success")}catch(Be){le(Be instanceof Error?Be.message:"Failed to update archive state","error")}}async function It(se){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:se})}),u()}if(i)return r.jsx(mt,{label:"Loading project workspace…"});if(l||!o)return r.jsx(kt,{error:l||"Project not found."});const Xt=(()=>{const se=new Set;for(const tt of o.assignments)tt.assignee&&se.add(tt.assignee);const Be=[{value:"__unassigned__",label:"Unassigned"}];for(const tt of Array.from(se).sort())Be.push({value:tt,label:tt});return Be})(),dn=Array.from(new Set(o.assignments.flatMap(se=>se.tags??[]))).sort().map(se=>({value:se,label:se})),Gt=o.assignments.filter(se=>pM(se,{status:T,priority:$,type:F,assignee:R,tags:z,dateRange:ha(O)})),qn=nu(Gt,_,D),Et=new Set(m.definitions.map(se=>se.id)),Fn=K==="type"?[...m.definitions.map(se=>({id:se.id,title:Ri(m,se.id),description:se.description})),...Gt.some(se=>!se.type||!Et.has(se.type))?[{id:sk,title:"Other",description:"Assignments with no recognized type."}]:[]]:YC(d.order).map(se=>({id:se,title:Eo(d,se),description:ru(se)}));function Tt({field:se,children:Be}){const tt=_===se;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>at(se),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Be,tt?D==="asc"?r.jsx(cS,{className:"h-3 w-3"}):r.jsx(fr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),o.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Me(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:se=>{se.target.value&&Me(se.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),d.statuses.map(se=>r.jsx("option",{value:se.id,children:se.label},se.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>Ye(!o.archived),title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:se=>{se.target.value==="_ungrouped"?It(null):se.target.value&&It(se.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(se=>se!==o.workspace).map(se=>r.jsx("option",{value:se,children:se},se)),o.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Te,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(qw,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Te,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(Fy,{externalIds:o.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Mn(o.created),". Last source update ",Br(o.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(_n,{label:"Assignments",value:o.progress.total}),r.jsx(_n,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),r.jsx(_n,{label:"Review",value:o.progress.review??0,tone:"info"}),r.jsx(_n,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),r.jsx(_n,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Np,{value:C,onValueChange:w,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Project Overview",children:r.jsx(gn,{content:o.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(se=>!se.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(xn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:d.statuses.map(se=>({value:se.id,label:se.label})),value:T,onChange:he}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Xt,value:R,onChange:ne}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:$,onChange:ye}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(se=>({value:se.id,label:Ri(m,se.id)})),value:F,onChange:Ee}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:z,onChange:ve}),r.jsx(vp,{className:"max-w-[190px]",value:O,onChange:B}),E==="kanban"&&r.jsxs("select",{value:K==="type"?"type":"status",onChange:se=>ee(se.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(kp,{value:E,onChange:se=>X(se),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(h2,{scope:Se,loadedViewId:ke,onApply:pt,onOpenSaveDialog:()=>{Ze(!1),Xe(!0)}}),r.jsx("button",{type:"button",onClick:()=>{qe?St():(Ze(!1),Xe(!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:qe?`Update ${qe.name}`:"Save current view",children:qe?`Update '${qe.name}'`:"Save view"}),qe?r.jsx("button",{type:"button",onClick:()=>{Ze(!0),Xe(!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:Gt.length===0?r.jsx(wt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Te,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(bp,{columns:Fn,items:qn,getItemId:se=>se.slug,getColumnId:se=>K==="type"?se.type&&Et.has(se.type)?se.type:sk:se.status,dragDisabled:!0,renderCard:se=>r.jsx(n7,{projectSlug:o.slug,assignment:se}),emptyMessage:se=>`No ${se.title.toLowerCase()} assignments.`,hiddenColumnIds:oe.hidden,onHideColumn:se=>ue(Be=>({hidden:Be.hidden.includes(se)?Be.hidden.filter(yt=>yt!==se):[...Be.hidden,se]}))}):(()=>{const se=new Set(re.hidden),Be=tt=>tt==="title"||!se.has(tt);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(i2,{visibility:re,onChange:xe})}),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:[Be("title")?r.jsx(Tt,{field:"title",children:"Assignment"}):null,Be("status")?r.jsx(Tt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Be("priority")?r.jsx(Tt,{field:"priority",children:"Priority"}):null,Be("assignee")?r.jsx(Tt,{field:"assignee",children:"Assignee"}):null,Be("dependencies")?r.jsx(Tt,{field:"dependencies",children:"Dependencies"}):null,Be("created")?r.jsx(Tt,{field:"created",children:"Created"}):null,Be("updated")?r.jsx(Tt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:qn.map(tt=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Be("title")?r.jsx("td",{className:"py-4",children:r.jsx(Te,{to:`${n}/projects/${o.slug}/assignments/${tt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:tt.title})}):null,Be("status")?r.jsx("td",{className:"py-4",children:r.jsx(bn,{status:tt.status,className:"max-w-[150px]"})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ja,{type:tt.type,compact:!0})}),Be("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:tt.priority}):null,Be("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.assignee??"—"}):null,Be("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.dependsOn.length}):null,Be("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(tt.created)}):null,Be("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(tt.updated)}):null]},tt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(YU,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?r.jsx(We,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(i6,{definition:o.dependencyGraph,nodeRoutes:me})}):r.jsx(wt,{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(Te,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?r.jsx(wt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:o.resources.map(se=>r.jsxs(Te,{to:`/projects/${o.slug}/resources/${se.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:se.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[se.category," · ",se.source]})]},se.slug))})}),r.jsx(We,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Te,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[r.jsx(jt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?r.jsx(wt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:o.memories.map(se=>r.jsxs(Te,{to:`/projects/${o.slug}/memories/${se.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:se.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[se.scope," · ",se.source]})]},se.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Progress Summary",children:r.jsx(Nf,{progress:o.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:o.needsAttention.blockedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.failedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.openQuestions})]})]})}),r.jsx(We,{title:"Quick Links",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(qw,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(jt,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(EP,{className:"h-4 w-4"}),"Review project rules"]}),r.jsxs("button",{type:"button",onClick:()=>w("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Px,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?r.jsxs(We,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Br(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),r.jsx(ka,{toast:ot,onDismiss:Re}),r.jsx(m2,{open:De,onOpenChange:se=>{Xe(se),se||Ze(!1)},initialName:st&&qe?`${qe.name} (copy)`:"",title:st?"Save as new view":"Save view",onSubmit:xt})]})}function n7({projectSlug:e,assignment:t}){const n=un();return r.jsxs(Te,{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(zr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Mn(t.updated)]})]}),r.jsx(bn,{status:t.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ja,{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 g2({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:o}){const[i,l]=f.useState(!1),[u,d]=f.useState(!1);async function m(){var g;if(t||u)return;d(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const C=await y.json().catch(()=>null);throw new Error((C==null?void 0:C.error)??`HTTP ${y.status}`)}const b=await y.json().catch(()=>null);if(!b||typeof b.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:b.command,fallbackWarning:typeof b.fallbackWarning=="string"&&b.fallbackWarning?b.fallbackWarning:void 0}})();try{const y=typeof((g=navigator.clipboard)==null?void 0:g.write)=="function"&&typeof ClipboardItem<"u";let b;if(y)await navigator.clipboard.write([new ClipboardItem({"text/plain":h.then(C=>new Blob([C.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const C=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(C.command),b=C.fallbackWarning}l(!0),setTimeout(()=>l(!1),1500),b&&(o==null||o(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(C){b=C instanceof Error?C:new Error(String(C))}s==null||s(b)}finally{d(!1)}}return t?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:n??"Copy launch command unavailable","aria-label":"Copy launch command",children:r.jsx(Gw,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:m,disabled:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded disabled:cursor-wait",title:i?"Copied!":"Copy launch command (cd + resume)","aria-label":"Copy launch command",children:i?r.jsx(Tr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Gw,{className:"h-3 w-3","aria-hidden":"true"})})}function tc(e,t,n,s,o){let i=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(i+=`&mode=${encodeURIComponent(t)}`),n&&(i+=`&terminal=${encodeURIComponent(n)}`),s&&e.kind==="assignment"&&(i+=`&agent=${encodeURIComponent(s)}`),o!==void 0&&e.kind==="assignment"&&(i+=`&prompt=${encodeURIComponent(o)}`),i}function r7(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 s7(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 x2(e,t,n,s){const o=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s?{reason:s}:{})}),i=await o.json().catch(()=>null);if(!o.ok)throw new Error((i==null?void 0:i.error)||`HTTP ${o.status}`);return i.assignment}async function y2(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),o=await s.json().catch(()=>null);if(!s.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${s.status}`);return o.assignment}async function o7(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 b2(e){return e.requiresReason||e.command==="block"}async function a7(e,t,n){const s=await fetch(`/api/assignments/${e}/transitions/${t.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n?{reason:n}:{})}),o=await s.json().catch(()=>null);if(!s.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${s.status}`);return o.assignment}async function i7(e,t){const n=await fetch(`/api/assignments/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})}),s=await n.json().catch(()=>null);if(!n.ok)throw new Error((s==null?void 0:s.error)||`HTTP ${n.status}`);return s.assignment}async function l7(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 c7(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 ub extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function db(e){const t=await e.json().catch(()=>null);return new ub((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function u7(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 d7(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 f7(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 db(s);return(await s.json()).assignment}async function p7(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 db(n);return(await n.json()).assignment}async function m7(e){const{url:t}=r7(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await db(n);return await n.json()}async function Ap(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 h7(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Ap(s)}async function g7(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Ap(n)}async function x7(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Ap(n)).sourceAssignments}async function y7(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Ap(t)).sourceAssignments}function v2(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[o,i]=f.useState(null),[l,u]=f.useState(null),[d,m]=f.useState(null),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,w]=f.useState(null),[v,k]=f.useState(null);async function E(R,P,$,L){if(!e){t(!0);try{const F=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!F.ok){window.location.href=tc(R,P,void 0,$,L);return}const A=await F.json();if(A.ok){window.location.href=tc(R,P,void 0,$,L);return}if(A.reason==="workspace-path-invalid"){A.recreate?(m(A.recreate),g({target:R,mode:P,agentId:$,prompt:L})):u(A.message);return}s(A),i({target:R,mode:P,agentId:$,prompt:L})}catch(F){console.warn("preflight failed, firing without override:",F),window.location.href=tc(R,P,void 0,$,L)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=tc(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),s(null),i(null))}async function T(){if(!(!d||!h||y)){b(!0),w(null);try{const R=await m7({kind:d.kind,id:d.id,projectSlug:d.projectSlug,assignmentSlug:d.assignmentSlug}),{target:P,mode:$,agentId:L,prompt:F}=h;m(null),g(null),window.location.href=tc(P,$,void 0,L,F),!R.exact&&!R.alreadyExisted&&k(`Recreated from ${R.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(R){w(R instanceof ub&&R.stderr?`${R.message}
|
|
584
|
+
${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const I=r.jsxs(r.Fragment,{children:[r.jsx(bi,{open:n!==null,onOpenChange:R=>!R&&(s(null),i(null)),children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsxs(ca,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(ua,{children:[(n==null?void 0:n.terminal)==="cmux"?r.jsxs(r.Fragment,{children:["To use cmux, install ",r.jsx("strong",{children:"cmux.app"})," into"," ",r.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Te,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),i(null)},children:"Settings"}),"."]})]}),r.jsxs(wi,{children:[r.jsx(Tc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(So,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(bi,{open:l!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsx(ca,{children:"Can't open in agent"}),r.jsxs(ua,{children:[l," Set a valid worktree or repository, then try again."]})]}),r.jsx(wi,{children:r.jsx(So,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(bi,{open:d!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),w(null))},children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsx(ca,{children:"Worktree was deleted"}),r.jsxs(ua,{children:["The worktree at ",r.jsx("code",{children:d==null?void 0:d.deletedPath})," no longer exists. Recreate it",d!=null&&d.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:d.branch})]}):null," ","so this can open?"]})]}),C&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:C}),r.jsxs(wi,{children:[r.jsx(Tc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(So,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(bi,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsx(ca,{children:"Worktree recreated"}),r.jsx(ua,{children:v})]}),r.jsx(wi,{children:r.jsx(So,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:I}}function w2({session:e,onMarkStopped:t}){const n=v2(),s={kind:"session",id:e.sessionId},o="size-3.5",i=be("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),l="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(ma,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:l,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(Si,{className:o}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(cr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:l,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(Si,{className:o}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(cr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(Si,{className:o}),r.jsx("span",{children:"Resume"})]})}),r.jsx(cr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(UP,{className:o}),r.jsx("span",{children:"Fork"})]})}),r.jsx(cr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[r.jsx(Ix,{className:o}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(cr,{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 b7(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function j2({sessions:e,loading:t,error:n,onError:s,onNotice:o}){return t&&!e?null:n&&!e?r.jsx(We,{title:"Agent Sessions",children:r.jsx(wt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(We,{title:"Agent Sessions",children:r.jsx(wt,{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(i=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Of,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:i.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:i.sessionId,children:[i.sessionId.slice(0,8),r.jsx(zr,{value:i.sessionId,onError:s}),r.jsx(g2,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:s,onNotice:o})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(bn,{status:i.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Br(i.started)})]}),r.jsx(w2,{session:i,onMarkStopped:b7})]},i.sessionId))})})}const pg="Cost / Usage";function k2({summary:e,error:t}){return t&&!e?r.jsx(We,{title:pg,children:r.jsx(wt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(We,{title:pg,children:r.jsx(wt,{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:pg,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ak,{label:"Total cost",value:Fi(e.totalCost)}),r.jsx(ak,{label:"Total tokens",value:Mi(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(Wc,{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:[Mi(n.totalTokens)," · ",Fi(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",V3(e.lastEventDay)]})]})}):null}function ak({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 S2({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:o,onOpenChange:i}){const[l,u]=f.useState("");f.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const d=f.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,g=l.trim()||void 0;return r.jsx(Ln,{open:e,onOpenChange:y=>s?void 0:i(y),children:r.jsx(En,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),o(g)},children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:m}),r.jsx(Wr,{children:t.description})]}),t.warning?r.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:d}),r.jsx("textarea",{value:l,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(Rr,{children:[r.jsx("button",{type:"button",onClick:()=>i(!1),disabled:s,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:s,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h})]})]})})})}function Na({open:e,title:t,description:n,confirmLabel:s,cancelLabel:o="Cancel",loading:i=!1,destructive:l=!1,onConfirm:u,onOpenChange:d}){return r.jsx(bi,{open:e,onOpenChange:m=>i?void 0:d(m),children:r.jsxs(la,{children:[r.jsxs(vi,{children:[r.jsx(ca,{children:t}),r.jsx(ua,{children:n})]}),r.jsxs(wi,{children:[r.jsx(Tc,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),r.jsx(So,{disabled:i,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${l?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:m=>{m.preventDefault(),u()},children:i?"Working...":s})]})]})})}const v7=/^[a-z0-9][a-z0-9_-]*$/,N2=["first","last","none"];class C2 extends Error{constructor(n,s){super(n);hh(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const fb={agents:[],custom:!1};let ji=null,gi=null,Rf=0;const gx=new Set;function E2(e){ji=e;for(const t of gx)t(e)}function w7(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"&&N2.includes(t.promptArgPosition)&&(n.promptArgPosition=t.promptArgPosition),typeof t.resolveFromShellAliases=="boolean"&&(n.resolveFromShellAliases=t.resolveFromShellAliases),typeof t.default=="boolean"&&(n.default=t.default),typeof t.model=="string"&&(n.model=t.model),typeof t.playbook=="string"&&(n.playbook=t.playbook),typeof t.launchPrompt=="string"&&(n.launchPrompt=t.launchPrompt),n}function pb(e){if(!e||typeof e!="object")return fb;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const o of n){const i=w7(o);i&&s.push(i)}return{agents:s,custom:t.custom===!0}}function j7(){if(ji)return Promise.resolve(ji);if(gi)return gi;const e=++Rf;return gi=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{gi=null;const n=pb(t);return e!==Rf?ji??n:(ji=n,n)}).catch(()=>(gi=null,fb)),gi}function T2(){const[e,t]=f.useState(()=>ji??fb);return f.useEffect(()=>{let n=!1;return j7().then(s=>{n||t(s)}),gx.add(t),()=>{n=!0,gx.delete(t)}},[]),e}async function R2(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new C2(n,t==null?void 0:t.fieldErrors)}async function k7(e){++Rf;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await R2(t);const n=pb(await t.json());return E2(n),n}async function S7(){++Rf;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await R2(e);const t=pb(await e.json());return E2(t),t}const ik=/[A-Za-z0-9_-]/,N7=/^[a-z0-9]+(-[a-z0-9]+)*$/,lk=/(^|\s)@([A-Za-z0-9_-]+)/g,xx="assignment";function A2(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&ik.test(e[s-1]);)s--;const o=s-1;if(o<0||e[o]!=="@"||o>0&&!/\s/.test(e[o-1]))return null;let i=n;for(;i<e.length&&ik.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function P2(e,t){const n=[xx,...t.filter(l=>l!==xx)],s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const l of n){const u=l.toLowerCase();u.startsWith(s)?o.push(l):u.includes(s)&&i.push(l)}return[...o,...i]}function D2(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function $2(e,t){const n=t instanceof Set?t:new Set(t),s=[];lk.lastIndex=0;let o;for(;(o=lk.exec(e))!==null;){const i=o[2];i!==xx&&(N7.test(i)?n.has(i)||s.push(`Playbook "${i}" is not installed — "@${i}" will be left as literal text.`):s.push(`"@${i}" is not a valid playbook token — it will be left as literal text.`))}return s}const ck=2e3;function C7({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:o}){const[i,l]=f.useState(""),[u,d]=f.useState([]),[m,h]=f.useState(!1),[g,y]=f.useState(null),[b,C]=f.useState(0),[w,v]=f.useState(0),[k,E]=f.useState(!1),S=f.useRef(null);f.useEffect(()=>{if(!e)return;let O=!1;h(!0),y(null),E(!1);const B=new URLSearchParams({assignment:t});return n&&B.set("agent",n),fetch(`/api/launch/prompt?${B.toString()}`).then(async K=>{if(!K.ok){const q=await K.json().catch(()=>null);throw new Error((q==null?void 0:q.error)??`HTTP ${K.status}`)}return await K.json()}).then(K=>{O||(l(K.template??""),d(K.knownPlaybookSlugs??[]),C((K.template??"").length))}).catch(K=>{O||y(K instanceof Error?K.message:String(K))}).finally(()=>{O||h(!1)}),()=>{O=!0}},[e,t,n]);const T=A2(i,b),I=T?P2(T.partial,u):[],R=e&&!m&&!k&&I.length>0,P=$2(i,u),$=i.length>ck;function L(O){l(O.target.value),C(O.target.selectionStart??O.target.value.length),v(0),E(!1)}function F(O){C(O.currentTarget.selectionStart??i.length),v(0)}function A(O){if(!T||!O)return;const B=D2(i,T,O);l(B.text),C(B.caret),v(0),E(!0),requestAnimationFrame(()=>{const K=S.current;K&&(K.focus(),K.setSelectionRange(B.caret,B.caret))})}function z(O){R&&(O.key==="ArrowDown"?(O.preventDefault(),v(B=>Math.min(B+1,I.length-1))):O.key==="ArrowUp"?(O.preventDefault(),v(B=>Math.max(B-1,0))):(O.key==="Enter"||O.key==="Tab")&&(O.preventDefault(),A(I[w])))}function V(){$||m||(s(i),o(!1))}return r.jsx(Ln,{open:e,onOpenChange:o,children:r.jsxs(En,{onEscapeKeyDown:O=>{R&&(O.preventDefault(),E(!0))},children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:"Edit launch prompt"}),r.jsxs(Wr,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:S,value:i,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:L,onKeyDown:z,onKeyUp:F,onClick:F,className:be("w-full rounded-md border border-border/60 bg-background/90 p-3 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30 min-h-[80px] resize-y",$&&"border-error-foreground")}),R&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:I.map((O,B)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":B===w,onMouseDown:K=>{K.preventDefault(),A(O)},className:be("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",B===w&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:O})]})},O))})]}),P.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:P.map(O=>r.jsx("li",{children:O},O))}),$&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",ck," characters (",i.length,")."]}),r.jsxs(Rr,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||$||g!==null,onClick:V,children:"Launch"})]})]})})}function L2({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,l=v2(),[u,d]=f.useState(null),h=T2().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y(P=>P&&h.some(L=>L.id===P)?P:(h.find(L=>L.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,C=h.find(P=>P.id===g)??null,w=f.useRef(null),[v,k]=f.useState(!1);f.useEffect(()=>{if(!v)return;function P(L){w.current&&!w.current.contains(L.target)&&k(!1)}function $(L){L.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",P),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",$)}},[v]);function E(P){var $,L;if(e.kind==="assignment"){const F=h.find(z=>z.id===P)??h.find(z=>z.default)??h[0];!!(($=F==null?void 0:F.launchPrompt)!=null&&$.trim())||!!((L=F==null?void 0:F.playbook)!=null&&L.trim())?l.open(e,void 0,P):d({agentId:P})}else l.open(e,void 0,P)}const S=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",I=be("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(i)return r.jsxs("button",{type:"button",disabled:!0,title:T,className:I,"aria-disabled":!0,children:[r.jsx(Si,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const R=e.kind==="session"?"Open":"Open in agent";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative inline-flex",ref:w,children:[r.jsxs("div",{className:"inline-flex items-stretch",children:[r.jsxs("button",{type:"button",onClick:()=>E(g??void 0),disabled:l.pending,title:(o??S)+(b&&C?` (${C.label})`:""),className:be(I,b&&"rounded-r-none"),children:[r.jsx(Si,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(P=>!P),disabled:l.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:be(I,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(fr,{className:be("size-3.5 opacity-70 transition-transform",v&&"rotate-180")})})]}),v&&b&&r.jsxs("div",{role:"menu","aria-label":"Open with agent",className:"absolute right-0 top-full z-30 mt-1 min-w-[180px] overflow-hidden rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsx("div",{className:"px-2.5 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Open with agent"}),h.map(P=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":P.id===g,onClick:()=>{y(P.id),k(!1),E(P.id)},className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent",children:[r.jsx(Tr,{className:be("size-3.5 shrink-0",P.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:P.label}),P.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},P.id))]})]}),l.dialogs,e.kind==="assignment"&&u&&r.jsx(C7,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:P=>{l.open(e,void 0,u.agentId,P)},onOpenChange:P=>{P||d(null)}})]})}const mg="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 I2({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:o="main",onCreated:i}){const l=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,d]=f.useState(!1),[m,h]=f.useState("new-branch"),[g,y]=f.useState(null),[b,C]=f.useState(null),[w,v]=f.useState(""),[k,E]=f.useState(!1),[S,T]=f.useState(""),[I,R]=f.useState([]),[P,$]=f.useState(!1),[L,F]=f.useState(null),[A,z]=f.useState(""),[V,O]=f.useState(null),[B,K]=f.useState(null),[q,_]=f.useState(""),[G,D]=f.useState(s),[H,Z]=f.useState(!1),[U,oe]=f.useState(null);f.useEffect(()=>{if(!u)return;let le=!1;return h("new-branch"),y(null),C(null),v(""),E(!1),T(""),R([]),$(!1),F(null),z(""),O(null),K(null),_(""),D(s),oe(null),(l.kind==="project-nested"?u7(l.projectSlug):d7(l.assignmentId)).then(Oe=>{if(!le)if(y(Oe),Oe.length===0)E(!0);else{const ze=Oe.find(_e=>_e.source==="project"),et=Oe.find(_e=>_e.source==="sibling");v((ze==null?void 0:ze.path)??(et==null?void 0:et.path)??Oe[0].path)}}).catch(Oe=>{le||(C(Oe.message),y([]),E(!0))}),(l.kind==="project-nested"?x7(l.projectSlug,l.assignmentSlug):y7(l.assignmentId)).then(Oe=>{le||O(Oe)}).catch(Oe=>{le||(K(Oe.message),O([]))}),()=>{le=!0}},[u,s,o,e,t,n]);const ue=m==="branch-off"?(V??[]).find(le=>le.id===q)??null:null,re=m==="branch-off"?(ue==null?void 0:ue.repository)??"":k?S.trim():w;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!re){R([]),F(null),$(!1),z("");return}let le=!1;return $(!0),F(null),z(""),(l.kind==="project-nested"?h7(l.projectSlug,l.assignmentSlug,re):g7(l.assignmentId,re)).then(Se=>{if(le)return;R(Se.branches);const Oe=(Se.defaultBranch&&Se.branches.includes(Se.defaultBranch)?Se.defaultBranch:Se.branches.includes(o)?o:Se.branches[0])??"";z(Oe),$(!1)}).catch(Se=>{le||(R([]),F(Se.message),$(!1))}),()=>{le=!0}},[u,m,re,o,e,t,n]);const xe=s7(G.trim()),ke=f.useMemo(()=>!re||!G.trim()?"":`${re.replace(/\/+$/,"")}/.worktrees/${G.trim()}`,[re,G]),Pe=g!==null&&g.length===0,De=V!==null&&V.length===0,Xe=le=>{le!==m&&(h(le),_(""),oe(null),le==="branch-off"&&(z(""),R([]),F(null),$(!1)))},st=le=>{_(le);const Re=(V??[]).find(Se=>Se.id===le);z((Re==null?void 0:Re.branch)??"")},Ze=H||xe!==null||!re||!A.trim()||(m==="new-branch"?g===null||P:V===null||!q),ot=async()=>{Z(!0),oe(null);try{const le={repository:re,branch:G.trim(),parentBranch:A.trim()};l.kind==="project-nested"?await f7(l.projectSlug,l.assignmentSlug,le):await p7(l.assignmentId,le),d(!1),i()}catch(le){le instanceof ub?oe({message:le.message,stderr:le.stderr}):le instanceof Error?oe({message:le.message}):oe({message:String(le)})}finally{Z(!1)}};return r.jsxs(Ln,{open:u,onOpenChange:le=>H?void 0:d(le),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>d(!0),children:[r.jsx(BP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(En,{children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:"Create worktree"}),r.jsxs(Wr,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:H,onClick:()=>Xe("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),r.jsx("button",{type:"button",disabled:H,onClick:()=>Xe("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:[Pe?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:mg,value:w,onChange:le=>v(le.target.value),disabled:H||g===null||k,children:(g??[]).map(le=>r.jsxs("option",{value:le.path,children:[le.path,le.source==="project"?" (project)":le.sourceAssignmentSlug?` (sibling — ${le.sourceAssignmentSlug})`:" (sibling)"]},`${le.source}:${le.path}`))}),Pe?null:r.jsx("button",{type:"button",className:"justify-self-start text-[11px] text-muted-foreground underline underline-offset-2 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:H,onClick:()=>E(le=>!le),children:k?"Use a listed repository":"Enter a custom repository path (advanced)"}),k?r.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:S,onChange:le=>T(le.target.value),disabled:H}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),r.jsx("select",{className:mg,value:A,onChange:le=>z(le.target.value),disabled:H||P||I.length===0,children:P?r.jsx("option",{value:"",children:"Loading branches…"}):I.length===0?r.jsx("option",{value:"",children:L?"Could not load branches":re?"No branches found":"— pick a repository —"}):I.map(le=>r.jsx("option",{value:le,children:le},le))}),L?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",L]}):null]})]}):r.jsxs(r.Fragment,{children:[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 assignments: ",B]}):null,De?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:mg,value:q,onChange:le=>st(le.target.value),disabled:H||V===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(V??[]).map(le=>r.jsxs("option",{value:le.id,children:[le.title," (",le.branch,")"]},le.id))]})]}),ue?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:ue.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:ue.branch})]})]}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),r.jsx("input",{className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",value:G,onChange:le=>D(le.target.value),disabled:H}),xe?r.jsx("span",{className:"text-[11px] text-error-foreground",children:xe}):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:ke||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),U?r.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[r.jsx("div",{className:"font-medium",children:U.message}),U.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:U.stderr}):null]}):null]}),r.jsxs(Rr,{children:[r.jsx(WL,{disabled:H,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:Ze,onClick:()=>void ot(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:H?"Working…":"Create worktree"})]})]})]})}function E7(e){const t=e.split(`
|
|
585
|
+
`),n=t.findIndex(l=>/^##\s+Acceptance Criteria\s*$/i.test(l.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let s=t.length;for(let l=n+1;l<t.length;l+=1)if(/^#{1,2}\s+\S/.test(t[l].trim())){s=l;break}const o=t.slice(n+1,s).map(l=>l.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(l=>!!l).map(l=>({checked:l[1].toLowerCase()==="x",text:l[2].trim()})),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
586
|
+
`).replace(/\n{3,}/g,`
|
|
587
|
+
|
|
588
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function T7(e){const t=e.split(`
|
|
589
|
+
`),n=t.findIndex(l=>/^##\s+Todos\s*$/i.test(l.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let s=t.length;for(let l=n+1;l<t.length;l+=1)if(/^#{1,2}\s+\S/.test(t[l].trim())){s=l;break}const o=t.slice(n+1,s).join(`
|
|
590
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
591
|
+
|
|
592
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
593
|
+
`).replace(/\n{3,}/g,`
|
|
594
|
+
|
|
595
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function R7({projectSlug:e,dependencies:t,blockedReason:n}){const[s,o]=f.useState(!1);if(t.length===0)return null;const i=t.filter(u=>u.status!=="completed"&&u.status!=="review"),l=i.length===0;return l&&!s?r.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(Rx,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx(fr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[i.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(sf,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[i.length," ",i.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(We,{title:"Dependencies",description:`${t.length-i.length} of ${t.length} resolved`,actions:l?r.jsx("button",{type:"button",onClick:()=>o(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Te,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(bn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx(rf,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function A7({links:e}){const t=un();if(e.length===0)return null;const n=e.filter(o=>!o.isReverse),s=e.filter(o=>o.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(o=>r.jsxs(Te,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(oS,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(bn,{status:o.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),r.jsx(rf,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),s.map(o=>r.jsxs(Te,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(nf,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),r.jsx(bn,{status:o.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),r.jsx(rf,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function P7(e){const t=new Map;for(const s of e)t.set(s.id,{entry:s,replies:[]});const n=[];for(const s of e){const o=t.get(s.id);s.replyTo&&t.has(s.replyTo)?t.get(s.replyTo).replies.push(o):n.push(o)}return n}function D7(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function O2({projectSlug:e,assignmentSlug:t,entries:n}){const[s,o]=f.useState(n);f.useEffect(()=>{o(n)},[n]);const i=f.useMemo(()=>P7(s),[s]),[l,u]=f.useState(""),[d,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function C(v){var S;if(v.preventDefault(),!l.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:d,body:l,resolved:d==="question"?!1:void 0};o(T=>[...T,E]);try{const T=await fetch(D7(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:l,type:d})});if(!T.ok){const P=await T.text();throw new Error(P||`HTTP ${T.status}`)}const I=await T.json().catch(()=>null),R=(S=I==null?void 0:I.comment)==null?void 0:S.id;o(P=>P.map($=>$.id===k?{...$,id:R??$.id}:$)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),o(I=>I.filter(R=>R.id!==k))}finally{g(!1)}}async function w(v,k){o(E=>E.map(S=>S.id===v?{...S,resolved:k}:S));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,S=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!S.ok)throw new Error(`HTTP ${S.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),o(S=>S.map(T=>T.id===v?{...T,resolved:!k}:T))}}return r.jsx(We,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[i.map(v=>r.jsx(_2,{node:v,onToggleResolved:w,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:l,onChange:v=>u(v.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:d,onChange:v=>m(v.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!l.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function _2({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:o}=e,i=s.type==="question";return r.jsxs("div",{className:be("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:be("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",i&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),i?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:be("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(Rx,{className:"h-3 w-3"}):r.jsx(PP,{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(t3,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(gn,{content:s.body}),o.length>0?r.jsx("div",{className:"space-y-2",children:o.map(l=>r.jsx(_2,{node:l,depth:t+1,onToggleResolved:n},l.entry.id))}):null]})}const $7=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function uk(){var ve,ee,fe,Ne,He,ce,pt,xt,St,at;const{slug:e,aslug:t}=Mt(),n=_t(),s=un(),[o,i]=is(),[l,u]=f.useState(null),{toast:d,showToast:m,dismissToast:h}=Io(),[g,y]=f.useState(null),[b,C]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(!1),[I,R]=f.useState(!1),[P,$]=f.useState(0),L=o.get("tab")??"summary",F=cs(),{data:A,loading:z,error:V,refetch:O}=cD(e,t),{data:B}=zS(e),{data:K}=zx(),{data:q,loading:_,error:G}=dD(e,t),{data:D,loading:H,error:Z}=pD(e,t),U=f.useMemo(()=>{if(!A||!B)return[];const me=new Map(B.assignments.map(Me=>[Me.slug,Me]));return A.dependsOn.map(Me=>{const Ye=me.get(Me);return{slug:Me,title:(Ye==null?void 0:Ye.title)??Me,status:(Ye==null?void 0:Ye.status)??"pending",priority:(Ye==null?void 0:Ye.priority)??"medium",assignee:(Ye==null?void 0:Ye.assignee)??null}})},[A,B]),oe=U.filter(me=>me.status!=="completed"&&me.status!=="review");Lo("assignment");const ue=f.useMemo(()=>((B==null?void 0:B.assignments)??[]).map(me=>me.slug),[B]),re=t?ue.indexOf(t):-1,xe=re>0?ue[re-1]:null,ke=re>=0&&re<ue.length-1?ue[re+1]:null,Pe=`${s}/projects/${e}/assignments/${t}`;Kt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Pe}/edit`)}),Kt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Pe}/plan/edit`)}),Kt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Pe}/handoff/edit`)}),Kt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Pe}/decision-record/edit`)}),Kt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Pe}/scratchpad/edit`)}),Kt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!xe,handler:()=>xe&&n(`${s}/projects/${e}/assignments/${xe}`)}),Kt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!ke,handler:()=>ke&&n(`${s}/projects/${e}/assignments/${ke}`)});const De=f.useMemo(()=>A?E7(A.body):{acceptanceCriteria:[],summaryBody:""},[A]),Xe=f.useMemo(()=>T7(De.summaryBody),[De.summaryBody]),st=De.acceptanceCriteria,Ze=st.filter(me=>me.checked).length,ot=st.length>0&&Ze===st.length,le=f.useRef(ot),Re=f.useRef(!1);if(f.useEffect(()=>{if(A){if(!Re.current){le.current=ot,Re.current=!0;return}ot&&!le.current&&$(me=>me+1),le.current=ot}},[ot,A]),z)return r.jsx(mt,{label:"Loading assignment workspace…"});if(V||!A||!e||!t)return r.jsx(kt,{error:V||"Assignment not found."});const Se=e,Oe=t,ze=st.length>0?{checked:Ze,total:st.length}:void 0,et=A.availableTransitions??[],_e=et.filter(me=>!me.disabled&&me.targetStatus!==A.status),qe=$7.map(me=>_e.find(Me=>Me.command===me)).find(Boolean)??_e[0]??null,Lt=[];if(K!=null&&K.sessions)for(const me of K.sessions)for(const Me of me.windows)for(const Ye of Me.panes)((ve=Ye.assignment)==null?void 0:ve.project)===e&&((ee=Ye.assignment)==null?void 0:ee.slug)===t&&Lt.push({sessionName:me.name,command:Ye.command,urls:Ye.urls});async function bt(me){u(null);try{await y2(Se,Oe,me),O()}catch(Me){u(Me.message)}}async function ut(me){u(null);try{const Me=await fetch(`/api/projects/${Se}/assignments/${Oe}/${me?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Me.ok){const Ye=await Me.json().catch(()=>null);throw new Error((Ye==null?void 0:Ye.error)||`HTTP ${Me.status}`)}O(),m(me?"Assignment archived":"Assignment restored","success")}catch(Me){u(Me.message)}}async function ae(){R(!0);try{await o7(Se,Oe),n(`${s}/projects/${Se}`)}catch(me){u(me.message),R(!1),T(!1)}}async function X(me,Me){u(null),y(me.command);try{return await x2(Se,Oe,me,Me),O(),!0}catch(Ye){return u(Ye.message),!1}finally{y(null)}}function he(me){if(b2(me)){C(me);return}X(me)}async function ne(me,Me){v(null),E(me);try{const Ye=await fetch(`/api/projects/${Se}/assignments/${Oe}/acceptance-criteria/${me}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Me})}),It=await Ye.json();if(!Ye.ok)throw new Error(It.error||`HTTP ${Ye.status}`);O()}catch(Ye){v(Ye.message)}finally{E(null)}}const ye=[..._e.filter(me=>me!==qe).map(me=>({key:`transition-${me.command}`,label:me.label,onSelect:()=>he(me),disabled:g===me.command})),...et.filter(me=>me.disabled||me.targetStatus===A.status).map(me=>({key:`transition-${me.command}`,label:me.label,disabled:!0,disabledReason:me.targetStatus===A.status?`Already ${A.status.replace(/_/g," ")}`:me.disabledReason??me.warning??me.description})),...F.statuses.map(me=>({key:`override-${me.id}`,label:`Override → ${me.label}`,onSelect:()=>bt(me.id),disabled:me.id===A.status,disabledReason:me.id===A.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:zP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:r3,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Sh,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:rf,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:WP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:A.archived?"unarchive":"archive",label:A.archived?"Restore assignment":"Archive assignment",icon:A.archived?tf:_f,onSelect:()=>ut(!A.archived)},{key:"delete",label:"Delete assignment",icon:yn,destructive:!0,onSelect:()=>T(!0)}],Ee=(qe==null?void 0:qe.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(ka,{toast:d,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:A.status,progress:ze}),A.phase&&A.phase!==A.status&&r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",title:"Phase dimension — how far along the work is, independent of blockage",children:["phase: ",A.phase]}),A.disposition&&A.disposition!=="active"&&r.jsx("span",{className:"rounded-full border border-warning-foreground/40 px-2 py-0.5 text-[11px] text-warning-foreground",title:"Disposition dimension — orthogonal to phase",children:A.disposition}),r.jsx(ja,{type:A.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:A.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",SS(A.updated)]}),oe.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",oe.length," unmet dep",oe.length===1?"":"s"]}),r.jsx(Fy,{externalIds:A.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(L2,{target:{kind:"assignment",id:A.id},worktreePath:((fe=A.workspace)==null?void 0:fe.worktreePath)??null,repository:((Ne=A.workspace)==null?void 0:Ne.repository)??null}),!((He=A.workspace)!=null&&He.worktreePath)&&e&&t&&r.jsx(I2,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>O()}),qe&&r.jsx("button",{type:"button",title:qe.warning||qe.description,disabled:g===qe.command,onClick:()=>he(qe),className:be("shell-action disabled:cursor-not-allowed disabled:opacity-50",qe.warning&&"border-warning-foreground/40",Ee&&P>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===qe.command?"Working…":qe.label})},Ee?`review-${P}`:qe.command),r.jsx(Dy,{items:ye,align:"end"})]})]}),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,A.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:"})," ",A.blockedReason]}):null,A.override&&A.derived&&A.derived.derivedStatus!==A.status?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsxs("strong",{children:["Pinned to ",A.status]})," by ",A.override.source,A.override.reason?r.jsxs(r.Fragment,{children:[" — “",A.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:A.derived.derivedStatus})]}):null,(ce=A.derived)!=null&&ce.nextAction?r.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",A.derived.nextAction]}):null]}),A.derived&&(Object.keys(A.derived.customFacts??{}).length>0||(A.derived.attestations??[]).length>0)?r.jsx(We,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:r.jsxs("div",{className:"space-y-3",children:[Object.keys(A.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(A.derived.customFacts??{}).map(([me,Me])=>r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[me,": ",r.jsx("span",{className:"font-medium text-foreground",children:String(Me)})]},me))}),(A.derived.attestations??[]).map(me=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:me.fact}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",me.binds,")"]}),me.records.length===0?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):me.records.map(Me=>r.jsxs("span",{title:`${Me.verdict}${Me.note?` — ${Me.note}`:""}${Me.stale?" (stale — revision moved)":""} · ${Me.at}`,className:be("rounded-full border px-2 py-0.5 text-[11px]",Me.stale?"border-border/40 text-muted-foreground line-through":Me.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[Me.actor,": ",Me.verdict==="approved"?"approved":"changes",Me.stale?" (stale)":""]},Me.actor))]},me.fact))]})}):null,U.length>0&&r.jsx(R7,{projectSlug:e,dependencies:U,blockedReason:A.blockedReason}),A.enrichedLinks&&A.enrichedLinks.length>0&&r.jsx(A7,{links:A.enrichedLinks}),A.referencedBy&&A.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:A.referencedBy.map(me=>{const Me=me.sourceProjectSlug===null?`/assignments/${me.sourceId}`:`${s}/projects/${me.sourceProjectSlug}/assignments/${me.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Te,{to:Me,className:"text-foreground hover:text-primary",children:me.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",me.mentions," mention",me.mentions===1?"":"s",")"]}),me.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]},me.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Np,{value:L,onValueChange:me=>i({tab:me}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[De.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:[w?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:w}):null,De.acceptanceCriteria.map((me,Me)=>{const Ye=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:me.checked,disabled:Ye,onChange:It=>ne(Me,It.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":me.checked,children:me.text})]},`${Me}-${me.text}`)})]})}):null,Xe.hasSection?r.jsx(We,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(gn,{content:Xe.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(We,{title:"Assignment Summary",children:r.jsx(gn,{content:Xe.remaining,emptyState:De.acceptanceCriteria.length>0||Xe.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:A.plan?1:0,content:A.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(Te,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(Sh,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(bn,{status:A.plan.status})}),r.jsx(gn,{content:A.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(wt,{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:A.scratchpad?1:0,content:A.scratchpad?r.jsx(We,{title:"Scratchpad",actions:r.jsxs(Te,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(Sh,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(gn,{content:A.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(wt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((pt=A.handoff)==null?void 0:pt.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:A.handoff?r.jsx(We,{children:r.jsx(gn,{content:A.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(wt,{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:((xt=A.progress)==null?void 0:xt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:A.progress&&A.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:A.progress.entries.map((me,Me)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:me.timestamp}),r.jsx(gn,{content:me.body})]},`${me.timestamp}-${Me}`))})}):r.jsx(wt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((St=A.comments)==null?void 0:St.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:A.comments&&A.comments.entries.length>0?r.jsx(O2,{projectSlug:e,assignmentSlug:t,entries:A.comments.entries}):r.jsx(wt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((at=A.decisionRecord)==null?void 0:at.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:A.decisionRecord?r.jsx(We,{children:r.jsx(gn,{content:A.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(wt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(bo,{label:"ID",value:A.id,copyable:!0}),r.jsx(bo,{label:"Priority",value:A.priority}),A.assignee&&r.jsx(bo,{label:"Assignee",value:A.assignee}),r.jsx(bo,{label:"Updated",value:`${kS(A.updated)} · Created ${jS(A.created)}`}),A.workspace.repository&&r.jsx(bo,{label:"Repository",value:A.workspace.repository,copyable:!0}),A.workspace.worktreePath&&r.jsx(bo,{label:"Worktree",value:A.workspace.worktreePath,copyable:!0}),A.workspace.branch&&r.jsx(bo,{label:"Branch",value:A.workspace.branch,copyable:!0}),A.workspace.parentBranch&&r.jsx(bo,{label:"Parent branch",value:A.workspace.parentBranch,copyable:!0}),A.externalIds.map((me,Me)=>r.jsx(L7,{entry:me},`${me.system}:${me.id}:${Me}`))]})}),Lt.length>0&&r.jsx(We,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:Lt.map((me,Me)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:me.command,children:me.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:me.sessionName,children:me.sessionName}),me.urls.map(Ye=>r.jsxs("a",{href:Ye,target:"_blank",rel:"noopener noreferrer",title:Ye,className:"inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[r.jsx("span",{className:"min-w-0 truncate",children:Ye.replace("http://localhost:",":")}),r.jsx(Gi,{className:"h-2.5 w-2.5 shrink-0"})]},Ye))]},Me))})}),r.jsx(j2,{sessions:q==null?void 0:q.sessions,loading:_,error:G,onError:me=>m(me.message,"error"),onNotice:me=>m(me,"success")}),r.jsx(k2,{summary:D==null?void 0:D.summary,loading:H,error:Z})]})]}),r.jsx(S2,{open:b!==null,action:b,assignmentTitle:A.title,loading:g===(b==null?void 0:b.command),onOpenChange:me=>{me||C(null)},onConfirm:async me=>{if(!b)return;await X(b,me)&&C(null)}}),r.jsx(Na,{open:S,title:"Delete assignment?",description:`This will permanently delete "${A.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:I,onOpenChange:me=>{me||T(!1)},onConfirm:ae})]})}function bo({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(zr,{value:t})]})]})}function L7({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(Gi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function I7(){var R,P,$,L,F,A,z,V;const{id:e}=Mt(),[t,n]=is(),s=t.get("tab")??"summary",{data:o,loading:i,error:l,refetch:u}=uD(e),{data:d,loading:m,error:h}=fD(e),{data:g,loading:y,error:b}=mD(o==null?void 0:o.slug),[C,w]=f.useState(!1),[v,k]=f.useState(null),{toast:E,showToast:S,dismissToast:T}=Io();async function I(O){if(e){k(null);try{const B=await fetch(`/api/assignments/${e}/${O?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!B.ok){const K=await B.json().catch(()=>null);throw new Error((K==null?void 0:K.error)||`HTTP ${B.status}`)}u(),S(O?"Assignment archived":"Assignment restored","success")}catch(B){k(B instanceof Error?B.message:"Archive failed")}}}return i?r.jsx(mt,{}):l?r.jsx(kt,{error:l}):o?r.jsxs("div",{className:"space-y-6",children:[r.jsx(ka,{toast:E,onDismiss:T}),r.jsxs("header",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),r.jsx(ja,{type:o.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),r.jsx(Fy,{externalIds:o.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(L2,{target:{kind:"assignment",id:o.id},worktreePath:((R=o.workspace)==null?void 0:R.worktreePath)??null,repository:((P=o.workspace)==null?void 0:P.repository)??null,size:"compact"}),!(($=o.workspace)!=null&&$.worktreePath)&&r.jsx(I2,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>w(!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(Mf,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Te,{to:`/assignments/${o.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>I(!o.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:o.archived?"Restore this assignment":"Archive this assignment",children:[o.archived?r.jsx(tf,{className:"h-3 w-3"}):r.jsx(_f,{className:"h-3 w-3"}),o.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:o.title}),o.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",o.blockedReason]}):null,v?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:v}):null]}),o.referencedBy&&o.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:o.referencedBy.map(O=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Te,{to:O.sourceProjectSlug===null?`/assignments/${O.sourceId}`:`/projects/${O.sourceProjectSlug}/assignments/${O.sourceSlug}`,className:"text-foreground hover:text-primary",children:O.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",O.mentions," mention",O.mentions===1?"":"s",")"]})]},O.sourceId))})}):null,r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(Np,{value:s,onValueChange:O=>n({tab:O}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(We,{title:"Assignment",children:r.jsx(gn,{content:o.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((L=o.progress)==null?void 0:L.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.progress&&o.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:o.progress.entries.map((O,B)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:O.timestamp}),r.jsx(gn,{content:O.body})]},`${O.timestamp}-${B}`))})}):r.jsx(wt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((F=o.comments)==null?void 0:F.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(O2,{projectSlug:null,assignmentSlug:o.id,entries:((A=o.comments)==null?void 0:A.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:o.plan?r.jsxs(We,{children:[r.jsx(gn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):r.jsx(wt,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:o.scratchpad?r.jsxs(We,{children:[r.jsx(gn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):r.jsx(wt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((z=o.handoff)==null?void 0:z.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.handoff?r.jsxs(We,{children:[r.jsx(gn,{content:o.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):r.jsx(wt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((V=o.decisionRecord)==null?void 0:V.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.decisionRecord?r.jsxs(We,{children:[r.jsx(gn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):r.jsx(wt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(We,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(vo,{label:"ID",value:o.id,copyable:!0}),r.jsx(vo,{label:"Priority",value:o.priority}),o.assignee&&r.jsx(vo,{label:"Assignee",value:o.assignee}),r.jsx(vo,{label:"Updated",value:`${kS(o.updated)} · Created ${jS(o.created)}`}),o.workspace.repository&&r.jsx(vo,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&r.jsx(vo,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&r.jsx(vo,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&r.jsx(vo,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((O,B)=>r.jsx(O7,{entry:O},`${O.system}:${O.id}:${B}`))]})}),r.jsx(j2,{sessions:d==null?void 0:d.sessions,loading:m,error:h,onError:O=>S(O.message,"error"),onNotice:O=>S(O,"success")}),r.jsx(k2,{summary:g==null?void 0:g.summary,loading:y,error:b})]})]}),r.jsx(My,{open:C,onOpenChange:w,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async O=>{const B=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:O})});if(!B.ok){const K=await B.json().catch(()=>({}));throw new Error(K.error||"Failed to move assignment")}u()}})]}):r.jsx(kt,{error:"Assignment not found"})}function vo({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(zr,{value:t})]})]})}function O7({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(Gi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function _7({currentStatus:e,availableTransitions:t,onSelect:n,overrideTargets:s,onOverride:o,disabled:i=!1,className:l}){const[u,d]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(0),b=f.useRef(null),C=f.useRef(null),w=f.useId(),v=cs(),k=Oc(v.statuses,e),E=Zg(e),S=s??[],T=t.length+S.length,I=f.useCallback(A=>{d(!1),A&&requestAnimationFrame(()=>{var z;(z=b.current)==null||z.focus()})},[]),R=f.useCallback(()=>{var z;const A=(z=b.current)==null?void 0:z.getBoundingClientRect();A&&h({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);f.useLayoutEffect(()=>{u&&R()},[u,R]),f.useEffect(()=>{if(!u)return;const A=()=>R();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[u,R]),f.useEffect(()=>{if(!u)return;const A=z=>{var O,B;const V=z.target;V&&((O=C.current)!=null&&O.contains(V)||(B=b.current)!=null&&B.contains(V)||I(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[u,I]),f.useEffect(()=>{u&&y(0)},[u,T]);function P(A){return!A.disabled&&A.id!==e}function $(A){if(A<t.length){const V=t[A];V&&(n(V),I(!0));return}const z=S[A-t.length];z&&P(z)&&(o==null||o(z.id),I(!0))}function L(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),d(!0))}function F(A){if(T===0){A.key==="Escape"&&(A.preventDefault(),I(!0));return}A.key==="ArrowDown"?(A.preventDefault(),y(z=>(z+1)%T)):A.key==="ArrowUp"?(A.preventDefault(),y(z=>(z-1+T)%T)):A.key==="Home"?(A.preventDefault(),y(0)):A.key==="End"?(A.preventDefault(),y(T-1)):A.key==="Enter"?(A.preventDefault(),$(g)):A.key==="Escape"&&(A.preventDefault(),I(!0))}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:b,type:"button","data-no-drag":!0,disabled:i,"aria-haspopup":"menu","aria-expanded":u,"aria-controls":u?w:void 0,onClick:()=>{i||d(A=>!A)},onKeyDown:L,title:`Status: ${k.label}. Click to change.`,style:k.style,className:be(FC,k.className,l,"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",i&&"cursor-not-allowed opacity-60"),children:[r.jsx(E,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 truncate",children:k.label})]}),u&&m&&typeof document<"u"?Hs.createPortal(r.jsx("div",{ref:C,id:w,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:F,style:{position:"fixed",top:m.bottom+6,left:m.left,minWidth:Math.max(m.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:T===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No status changes available from this status."}):r.jsxs(r.Fragment,{children:[t.map((A,z)=>{const V=Zg(A.targetStatus),O=z===g;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>y(z),onClick:()=>$(z),title:A.warning||A.description,className:be("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",O?"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(V,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:A.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:Eo(v,A.targetStatus)})]}),A.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:A.warning}):null]},`${A.command}:${A.targetStatus}`)}),S.length>0&&t.length>0?r.jsx("div",{className:"my-1 border-t border-border/60",role:"separator"}):null,S.map((A,z)=>{const V=t.length+z,O=V===g,B=!P(A),K=Oc(v.statuses,A.id);return r.jsx("button",{type:"button",role:"menuitem","data-no-drag":!0,disabled:B,onMouseEnter:()=>y(V),onClick:()=>$(V),title:B?A.disabledReason??(A.id===e?"Already in this status":void 0):`Set status to ${A.label}`,className:be("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm transition",B?"cursor-not-allowed text-muted-foreground/60":O?"bg-foreground/5":"hover:bg-foreground/5"),children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{"aria-hidden":"true",className:be("h-2.5 w-2.5 flex-shrink-0 rounded-full border border-border/40",K.style?void 0:K.className),style:K.style?{backgroundColor:K.style.color}:void 0}),r.jsxs("span",{className:"truncate",children:["Override → ",A.label]})]})},`override-${A.id}`)})]})}),document.body):null]})}function M2({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[o,i]=f.useState(!1);return o?r.jsx(M7,{initialTitle:e,disabled:s,onSave:n,onExit:()=>i(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||i(!0)},className:be("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(Te,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:l=>l.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(Gi,{className:"h-3.5 w-3.5"})})]})}function M7({initialTitle:e,disabled:t,onSave:n,onExit:s}){const o=f.useRef(e),[i,l]=f.useState(e),[u,d]=f.useState(!1),[m,h]=f.useState(!1),g=f.useRef(null),y=f.useRef(!1);f.useEffect(()=>{const v=g.current;v&&(v.focus(),v.select())},[]);const b=f.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),C=f.useCallback(async()=>{if(y.current)return;const v=i.trim();if(v.length===0){b();return}if(v===o.current){s();return}y.current=!0,d(!0);try{await n(v)}catch{}finally{d(!1),s()}},[i,s,n,b]);function w(v){v.key==="Enter"?(v.preventDefault(),C()):v.key==="Escape"&&(v.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:i,onChange:v=>l(v.target.value),onKeyDown:w,onBlur:()=>void C(),className:be("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 F2(e){const t=_t(),n=f.useRef(null),s=f.useRef(!1),o=f.useCallback(()=>{const l=n.current,u=!!(l!=null&&l.querySelector('[aria-expanded="true"]')),d=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(l!=null&&l.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||d||h},[]),i=f.useCallback(l=>{if(s.current)return;const u=l.target;!u||u.closest(Hi)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const dk=/[A-Za-z0-9_-]/;function fk(e,t){const n=Math.max(0,Math.min(t,e.length)),s=F7(e,n);if(s)return s;let o=n;for(;o>0&&dk.test(e[o-1]);)o--;let i=n;for(;i<e.length&&dk.test(e[i]);)i++;const l=e.slice(o,n),u=e.slice(0,o),d=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(d)return{kind:"value",field:d[1].toLowerCase(),partial:l,tokenStart:o,tokenEnd:i};const m=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return m?{kind:"value",field:m[1].toLowerCase(),partial:l,tokenStart:o,tokenEnd:i}:{kind:"field",partial:l,tokenStart:o,tokenEnd:i}}function F7(e,t){let n=-1;for(let d=t-1;d>=0;d--)if(e[d]==='"'&&(d===0||e[d-1]!=="\\")){n=d;break}if(n<0)return null;for(let d=n+1;d<t;d++)if(e[d]==='"'&&e[d-1]!=="\\")return null;let s=t;for(;s<e.length&&!(e[s]==='"'&&e[s-1]!=="\\");)s++;const o=e.slice(n+1,t),l=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:l?l[1].toLowerCase():"",partial:o,tokenStart:n,tokenEnd:s<e.length?s+1:s}}function z7(e,t){const n=PC(t),s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const l of n){const u=l.toLowerCase();u.startsWith(s)?o.push(l):u.includes(s)&&i.push(l)}return[...o,...i]}function B7(e,t,n,s){const o=e.toLowerCase();let i=[];switch(o){case"status":i=[...n.statuses];break;case"priority":i=[...n.priorities];break;case"type":i=[...n.types];break;case"assignee":i=["none",...n.assignees];break;case"project":i=["none",...n.projects];break;case"tag":case"tags":i=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":i=["true","false"];break;default:{const u=s[o];(u==null?void 0:u.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const l=t.toLowerCase();return l===""?i:i.filter(u=>u.toLowerCase().startsWith(l))}function U7(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=iy(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const W7=180;function H7(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function V7({value:e,onChange:t,onCompiled:n,registry:s,declarations:o,valueSources:i,placeholder:l="AQL query (e.g. status:active AND priority:high)",className:u}){const d=f.useRef(null),m=f.useRef(null),h=H7(e,W7),[g,y]=f.useState([]),[b,C]=f.useState([]),[w,v]=f.useState("field"),[k,E]=f.useState(-1),[S,T]=f.useState(!1),I=f.useRef(e.length);f.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const O=zi(h,s);O.errors.length>0?(y(O.errors),n==null||n(null)):(y([]),n==null||n(O.query))},[h,s,n]);const R=f.useCallback((O,B)=>{const K=fk(O,B);if(!K){C([]),T(!1);return}if(K.kind==="field"){const q=z7(K.partial,o);C(q),v("field"),T(q.length>0)}else{const q=B7(K.field,K.partial,i,s);C(q),v("value"),T(q.length>0)}E(-1)},[o,i,s]),P=f.useCallback(O=>{const B=O.target.value,K=O.target.selectionStart??B.length;I.current=K,t(B),R(B,K)},[t,R]),$=f.useCallback(O=>{const B=d.current,K=(B==null?void 0:B.selectionStart)??I.current,q=fk(e,K);if(!q)return;const{text:_,caret:G}=U7(e,q,O);t(_),T(!1),C([]),requestAnimationFrame(()=>{d.current&&(d.current.focus(),d.current.setSelectionRange(G,G),I.current=G)})},[e,t]),L=f.useCallback(O=>{if(!(!S||b.length===0))switch(O.key){case"ArrowDown":O.preventDefault(),E(B=>Math.min(B+1,b.length-1));break;case"ArrowUp":O.preventDefault(),E(B=>Math.max(B-1,-1));break;case"Enter":case"Tab":k>=0&&(O.preventDefault(),$(b[k]));break;case"Escape":T(!1),C([]);break}},[S,b,k,$]),F=f.useRef(null),A=f.useCallback(()=>{F.current=setTimeout(()=>T(!1),120)},[]);f.useEffect(()=>()=>{F.current!==null&&clearTimeout(F.current)},[]);const z=f.useCallback(()=>{var B;const O=((B=d.current)==null?void 0:B.selectionStart)??e.length;R(e,O)},[e,R]);f.useEffect(()=>{var O,B;S&&((B=(O=m.current)==null?void 0:O.querySelector('[aria-selected="true"]'))==null||B.scrollIntoView({block:"nearest"}))},[k,S]);const V=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:d,type:"text",value:e,onChange:P,onKeyDown:L,onBlur:A,onFocus:z,placeholder:l,"aria-label":"AQL query input","aria-expanded":S,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",V?"border-destructive focus:border-destructive focus:ring-2 focus:ring-destructive/30":"border-border/60 focus:border-primary focus:ring-2 focus:ring-ring/30"].join(" ")}),S&&b.length>0&&r.jsx("ul",{ref:m,role:"listbox","aria-label":w==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:b.map((O,B)=>r.jsx("li",{role:"option","aria-selected":B===k,onMouseDown:K=>{K.preventDefault(),$(O)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",B===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:O},O))}),V&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((O,B)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",O.pos,": ",O.message]},B))})]})}const pk=ay;function Dd(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function K7(e,t){return e.toString()===t.toString()}function mk(){const{workspace:e}=Mt(),t=un(),n=_t(),s=f.useRef(null);Lo("list:assignments");const{data:o,loading:i,error:l,refetch:u}=Uf(),d=cs(),m=qc(),[h,g]=is(),y=e?`w:${e}`:null,b=u2(y),C=f.useRef(void 0),w=f.useMemo(()=>YC(d.order),[d]),v=f.useMemo(()=>{const W={};for(const J of w)W[J]=Eo(d,J);return W},[w,d]),k=f.useMemo(()=>w.map(W=>({id:W,title:v[W]??W,description:ru(W)})),[w,v]),E=f.useMemo(()=>m.definitions.map(W=>({id:W.id,title:Ri(m,W.id),description:W.description})),[m]),S="__unknown_type__",T=f.useMemo(()=>new Set(["all",...w]),[w]),I=h.get("view"),R=h.get("status"),P=h.get("stale"),$=I&&pk.includes(I)?I:"kanban";function L(W){if(!W)return[];const J=[];for(const ge of W.split(",")){const Le=ge.trim();!Le||Le==="all"||!T.has(Le)||J.includes(Le)||J.push(Le)}return J}const F=f.useCallback(W=>{g(J=>{const ge=new URLSearchParams(J);return W==="kanban"?ge.delete("view"):ge.set("view",W),ge})},[g]),[A,z]=f.useState(""),[V,O]=f.useState(()=>L(R)),[B,K]=f.useState(()=>Fe(b.filters.priority)),[q,_]=f.useState(()=>Fe(b.filters.type)),[G,D]=f.useState(()=>Fe(b.filters.assignee)),[H,Z]=f.useState(()=>Fe(b.filters.project)),[U,oe]=f.useState(()=>Fe(b.filters.tags)),[ue,re]=f.useState(null),[xe,ke]=f.useState(()=>Dd(P)),[Pe,De]=f.useState(()=>dc({status:L(R),priority:Fe(b.filters.priority),type:Fe(b.filters.type),assignee:Fe(b.filters.assignee),project:Fe(b.filters.project),tags:Fe(b.filters.tags),activity:Dd(P)})),[Xe,st]=f.useState(()=>b.sortField),[Ze,ot]=f.useState(()=>b.sortDirection),[le,Re]=f.useState(()=>({hidden:[]})),[Se,Oe]=f.useState(()=>({hidden:[]})),[ze,et]=f.useState(()=>b.grouping),_e=ze==="type"?"type":"status",[qe,Lt]=f.useState(()=>new Set),[bt,ut]=f.useState([]),{toast:ae,showToast:X,dismissToast:he}=Io(),[ne,ye]=f.useState(null),[Ee,ve]=f.useState(null),[ee,fe]=f.useState(null),[Ne,He]=f.useState(null),[ce,pt]=f.useState(null),[xt,St]=f.useState(null),[at,me]=f.useState(null),[Me,Ye]=f.useState(null),[It,Xt]=f.useState(null),[dn,Gt]=f.useState(!1),[qn,Et]=f.useState(!1),Fn=e?{kind:"workspace",workspace:e}:{kind:"global"},Tt=h.get("loadView"),{view:se,loading:Be,error:tt}=Ro(Tt),{view:yt,loading:er,error:Kr}=Ro(It),As=f.useRef(null);f.useEffect(()=>{ut((o==null?void 0:o.assignments)??[])},[o]),f.useEffect(()=>{It&&!er&&!Kr&&!yt&&Xt(null)},[yt,Kr,It,er]),f.useEffect(()=>{Xt(null),As.current=null,re(null),z("")},[e]);const lu=f.useRef({status:R,stale:P});f.useEffect(()=>{const W=L(R),J=Dd(P);o4(W,V)||O(W),J!==xe&&ke(J);const ge=lu.current,Le=ge.status!==R||ge.stale!==P;lu.current={status:R,stale:P},Le&&rn({status:W,activity:J})},[xe,P,V,R]),f.useEffect(()=>{C.current===y&&g(W=>{const J=new URLSearchParams(W);return V.length===0?J.delete("status"):J.set("status",V.join(",")),xe==="all"?J.delete("stale"):xe==="stale"?J.set("stale","1"):J.set("stale","0"),K7(W,J)?W:J})},[xe,y,g,V]),f.useEffect(()=>{K(Fe(b.filters.priority)),_(Fe(b.filters.type)),D(Fe(b.filters.assignee)),Z(Fe(b.filters.project)),oe(Fe(b.filters.tags)),st(b.sortField),ot(b.sortDirection),et(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 W=!1;return cb().then(J=>{if(W||C.current===y)return;const ge=F1(J,y),Le=ge.defaultView,ct=Fe(ge.filters.status),Rt=ge.filters.activity??"all",Nt=new URLSearchParams(window.location.search);let Rn=!1;const fn=new URLSearchParams(Nt);Nt.get("view")===null&&Le!=="kanban"&&pk.includes(Le)&&(fn.set("view",Le),Rn=!0),Nt.get("status")===null&&ct.length>0&&(fn.set("status",ct.join(",")),O(ct),Rn=!0),Nt.get("stale")===null&&Rt!=="all"&&(fn.set("stale",Rt==="stale"?"1":"0"),ke(Rt),Rn=!0),Rn&&g(fn,{replace:!0});const sn=L(fn.get("status")),mr=fn.get("stale")===null?Rt:Dd(fn.get("stale"));De(dc({status:sn,priority:Fe(ge.filters.priority),type:Fe(ge.filters.type),assignee:Fe(ge.filters.assignee),project:Fe(ge.filters.project),tags:Fe(ge.filters.tags),activity:mr==="fresh"||mr==="stale"?mr:"all"})),queueMicrotask(()=>{C.current=y})}),()=>{W=!0}},[y]);const ht=f.useCallback(W=>{(y===null?f2(W):p2(y,W)).catch(ge=>{console.warn("Failed to persist view prefs:",ge)})},[y]),cu=f.useCallback(W=>{F(W),ht({defaultView:W})},[F,ht]),fl=f.useRef(null);fl.current={status:V,priority:B,type:q,assignee:G,project:H,tags:U,activity:xe,dateRange:ue,search:A};const uu=f.useCallback((W={})=>{const J=fl.current;return{status:J.status,priority:J.priority,type:J.type,assignee:J.assignee,project:J.project,tags:J.tags,activity:J.activity,dateRange:ha(J.dateRange),search:J.search,...W}},[]),rn=f.useCallback((W={})=>{De(dc(uu(W)))},[uu]),du=f.useCallback(W=>{O(W),ht({filters:{status:W}}),rn({status:W})},[ht,rn]),fu=f.useCallback(W=>{K(W),ht({filters:{priority:W}}),rn({priority:W})},[ht,rn]),pu=f.useCallback(W=>{_(W),ht({filters:{type:W}}),rn({type:W})},[ht,rn]),Op=f.useCallback(W=>{D(W),ht({filters:{assignee:W}}),rn({assignee:W})},[ht,rn]),_p=f.useCallback(W=>{Z(W),ht({filters:{project:W}}),rn({project:W})},[ht,rn]),Zt=f.useCallback(W=>{oe(W),ht({filters:{tags:W}}),rn({tags:W})},[ht,rn]),Mp=f.useCallback(W=>{ke(W),ht({filters:{activity:W}}),rn({activity:W})},[ht,rn]),pl=f.useCallback(W=>{z(W),rn({search:W})},[rn]),mu=f.useCallback(W=>{re(W),rn({dateRange:ha(W)})},[rn]),Xs=f.useCallback(W=>{st(W),ht({sortField:W})},[ht]),Ca=f.useCallback(W=>{ot(W),ht({sortDirection:W})},[ht]),hu=f.useCallback(W=>{et(W),ht({grouping:W})},[ht]),Ea=f.useCallback(W=>{De(W);const J=fc(W);J&&(O(Fe(J.status)),K(Fe(J.priority)),_(Fe(J.type)),D(Fe(J.assignee)),Z(Fe(J.project)),oe(Fe(J.tags)),z(J.search??""),ke(J.activity&&J.activity!=="all"?J.activity:"all"),re(wp(J.dateRange)))},[]),an=f.useMemo(()=>fc(Pe)!==null,[Pe]),Ta=f.useCallback(()=>{const J=fc(Pe)!==null?{status:V,priority:B,type:q,assignee:G,project:H,tags:U,activity:xe,dateRange:ha(ue),search:A}:{};return{viewMode:$,filters:{...J,query:Pe},sortField:Xe,sortDirection:Ze,listSectionVisibility:{collapsed:[...qe]},kanbanColumnVisibility:le,tableColumnVisibility:Se}},[$,Pe,V,B,q,G,H,U,xe,ue,A,Xe,Ze,qe,le,Se]),zn=f.useCallback(W=>{WC(W,{setViewMode:F,setQuery:De,setStatusFilter:J=>{O(J),ht({filters:{status:J}})},setPriorityFilter:J=>{K(J),ht({filters:{priority:J}})},setTypeFilter:J=>{_(J),ht({filters:{type:J}})},setAssigneeFilter:J=>{D(J),ht({filters:{assignee:J}})},setProjectFilter:J=>{Z(J),ht({filters:{project:J}})},setTagsFilter:J=>{oe(J),ht({filters:{tags:J}})},setActivityFilter:J=>{ke(J),ht({filters:{activity:J}})},setDateRange:re,setSearch:z,setSortField:Xs,setSortDirection:Ca,setListSectionVisibility:J=>Lt(new Set(J.collapsed)),setKanbanColumnVisibility:Re,setTableColumnVisibility:Oe}),Xt(W.id)},[F,ht,Xs,Ca]),Fp=f.useCallback(W=>{zn(W),As.current=W.id,g(J=>{const ge=new URLSearchParams(J);return ge.set("loadView",W.id),ge},{replace:!0})},[zn,g]),zp=f.useCallback(async W=>{try{const J=Vi({name:W,context:{workspace:e??null,projectSlug:null},state:Ta()}),ge=await Bi(J),Le=ge.views[ge.views.length-1];Xt((Le==null?void 0:Le.id)??null),Le&&(As.current=Le.id,g(ct=>{const Rt=new URLSearchParams(ct);return Rt.set("loadView",Le.id),Rt},{replace:!0})),Gt(!1),Et(!1),X(`Saved view "${W}"`,"success")}catch(J){throw X(J instanceof Error?J.message:"Failed to save view","error"),J}},[Ta,g,X,e]),Bp=f.useCallback(async()=>{if(!(!It||!yt))try{const W=Vi({name:yt.name,context:{workspace:e??null,projectSlug:null},state:Ta()}),J=kf(yt.config,W.config,W.config);await yf(It,{config:J}),X("View updated","success")}catch(W){X(W instanceof Error?W.message:"Failed to update view","error")}},[Ta,yt,It,X,e]);f.useEffect(()=>{if(!Tt){As.current=null;return}if(As.current!==Tt&&(It&&It!==Tt&&Xt(null),!Be)){if(tt){X("Couldn't load saved view — try again","error");return}if(se){As.current=Tt,zn(se),g(W=>{const J=new URLSearchParams(W);return J.delete("loadView"),J},{replace:!0});return}As.current=Tt,X("Saved view no longer exists","error"),g(W=>{const J=new URLSearchParams(W);return J.delete("loadView"),J},{replace:!0})}},[Tt,se,Be,tt,It,zn,g,X]);const Gn=f.useMemo(()=>bt.filter(W=>e?e==="_ungrouped"?W.projectWorkspace===null:W.projectWorkspace===e:!0),[bt,e]),Ra=f.useMemo(()=>Array.from(new Set(Gn.map(W=>W.status))).sort(),[Gn]),Zs=f.useMemo(()=>Array.from(new Set(Gn.map(W=>W.priority))).sort(),[Gn]),_o=f.useMemo(()=>Array.from(new Set(Gn.map(W=>W.assignee??"__unassigned__"))).sort(),[Gn]),gu=f.useMemo(()=>Array.from(new Map(Gn.filter(W=>W.projectSlug!==null).map(W=>[W.projectSlug,W.projectTitle]))).sort(([,W],[,J])=>W.localeCompare(J)),[Gn]),xu=f.useMemo(()=>Array.from(new Set(Gn.flatMap(W=>W.tags??[]))).sort(),[Gn]),Mo=f.useMemo(()=>AC(d.factDeclarations),[d.factDeclarations]),ml=f.useMemo(()=>Pe.trim()===""?null:zi(Pe,Mo).query,[Pe,Mo]),Yt=f.useMemo(()=>TC(bt,ml,{workspace:e}),[bt,ml,e]),qr=f.useMemo(()=>nu(Yt,Xe,Ze),[Yt,Xe,Ze]),hl=f.useMemo(()=>{if(ze==="none")return[{id:"__all__",label:"All assignments",items:Yt}];if(ze==="type"){const W=m.definitions.map(Le=>({id:Le.id,label:Ri(m,Le.id),items:Yt.filter(ct=>ct.type===Le.id)})),J=new Set(m.definitions.map(Le=>Le.id)),ge=Yt.filter(Le=>!Le.type||!J.has(Le.type));return ge.length>0&&W.push({id:S,label:"Other",items:ge}),W}if(ze==="priority")return["critical","high","medium","low"].map(J=>({id:J,label:J.charAt(0).toUpperCase()+J.slice(1),items:Yt.filter(ge=>ge.priority===J)}));if(ze==="assignee")return Array.from(new Set(Yt.map(J=>J.assignee??"__unassigned__"))).sort().map(J=>({id:J,label:J==="__unassigned__"?"Unassigned":J,items:Yt.filter(ge=>(ge.assignee??"__unassigned__")===J)}));if(ze==="project"){const W=new Map;for(const J of Yt){const ge=J.projectSlug??"__standalone__",Le=J.projectTitle??"Standalone";W.has(ge)||W.set(ge,Le)}return Array.from(W.entries()).sort(([,J],[,ge])=>J.localeCompare(ge)).map(([J,ge])=>({id:J,label:ge,items:Yt.filter(Le=>(Le.projectSlug??"__standalone__")===J)}))}return w.map(W=>({id:W,label:v[W]??W,items:Yt.filter(J=>J.status===W)}))},[ze,Yt,m,w,v]),gl=f.useMemo(()=>{const W=new Set(m.definitions.map(ge=>ge.id));return Yt.some(ge=>!ge.type||!W.has(ge.type))?[...E,{id:S,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Yt]),{visibleItems:Pt,visibleIndexByKey:xl}=f.useMemo(()=>{let W;if($==="table")W=qr;else if($==="kanban"){const ge=new Set(m.definitions.map(Le=>Le.id));_e==="type"?W=[...m.definitions.flatMap(Le=>Yt.filter(ct=>ct.type===Le.id)),...Yt.filter(Le=>!Le.type||!ge.has(Le.type))]:W=w.flatMap(Le=>Yt.filter(ct=>ct.status===Le))}else W=hl.flatMap(ge=>ge.items);const J=new Map;return W.forEach((ge,Le)=>J.set(mn(ge),Le)),{visibleItems:W,visibleIndexByKey:J}},[$,qr,hl,_e,m,Yt,w]),{hotkeyRowProps:Aa}=Gc(Pt,{scope:"list:assignments",onOpen:W=>{if(W.projectSlug===null){n(`/assignments/${W.id}`);return}const J=W.projectWorkspace?`/w/${W.projectWorkspace}`:t;n(`${J}/projects/${W.projectSlug}/assignments/${W.slug}`)}});if(Kt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var W;return(W=s.current)==null?void 0:W.focus()}}),Kt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),i)return r.jsx(mt,{label:"Loading assignments board…"});if(l||!o)return r.jsx(kt,{error:l||"Assignments board is unavailable."});async function Pa({item:W,toColumnId:J,action:ge,reason:Le}){if(!ge){const Rt=d.statuses.find(Nt=>Nt.id===J);if(Xg(Rt??{id:J}))return X(`Reach “${Eo(d,J)}” through its complete/fail transition.`,"error"),!1}ye(mn(W));const ct=bt;ut(Rt=>Rt.map(Nt=>mn(Nt)===mn(W)?{...Nt,status:J,blockedReason:J==="blocked"?Le??Nt.blockedReason:null}:Nt));try{const Rt=W.projectSlug===null?ge?await a7(W.id,ge,Le):await i7(W.id,J):ge?await x2(W.projectSlug,W.slug,ge,Le):await y2(W.projectSlug,W.slug,J);return ut(Nt=>Nt.map(Rn=>mn(Rn)===mn(W)?{...Rn,status:Rt.status,blockedReason:Rt.blockedReason,availableTransitions:Rt.availableTransitions,updated:Rt.updated}:Rn)),u(),!0}catch(Rt){return ut(ct),X(Rt.message,"error"),!1}finally{ye(null)}}async function Ps({item:W,toColumnId:J,action:ge}){if(W.status===J)return;const Le=ge??nc(W,J);if(Le!=null&&Le.disabled){X(Le.disabledReason||`Cannot move this assignment to ${J}.`,"error");return}if(Le&&b2(Le)){He({item:W,toColumnId:J,action:Le});return}await Pa({item:W,toColumnId:J,action:Le})}function yl(W){return _C(d).map(J=>J.id===W.status?{id:J.id,label:J.label,disabled:!0,disabledReason:"Already in this status"}:J.terminal&&!W.availableTransitions.find(Le=>Le.targetStatus===J.id&&!Le.disabled)?{id:J.id,label:J.label,disabled:!0,disabledReason:`Reach ${J.label} via its transition when available`}:{id:J.id,label:J.label})}function bl(W,J){Ps({item:W,toColumnId:J})}async function Fo(W,J){if(J===W.title)return;const ge=mn(W),Le=bt;ut(ct=>ct.map(Rt=>mn(Rt)===ge?{...Rt,title:J}:Rt)),ye(ge);try{const ct=W.projectSlug===null?await c7({id:W.id,title:J}):await l7({projectSlug:W.projectSlug,assignmentSlug:W.slug,title:J});ut(Rt=>Rt.map(Nt=>mn(Nt)===ge?{...Nt,title:ct.title,updated:ct.updated}:Nt)),u()}catch(ct){throw ut(Le),X(ct.message,"error"),ct}finally{ye(null)}}function Da(W){Lt(J=>{const ge=new Set(J);return ge.has(W)?ge.delete(W):ge.add(W),ge})}function us(W){Xe===W?Ca(Ze==="asc"?"desc":"asc"):(Xs(W),Ca("asc"))}const ln=Ee?bt.find(W=>mn(W)===Ee)??null:null;function ds(W,J){W.dataTransfer.effectAllowed="move",W.dataTransfer.setData("text/plain",J),ve(J)}function Ds(){ve(null),fe(null)}function zo(W,J){if(!ln)return;const ge=nc(ln,J);ln.status===J||ge!=null&&ge.disabled||(W.preventDefault(),W.dataTransfer.dropEffect="move",fe(J))}function fs(W,J){ee===J&&!W.currentTarget.contains(W.relatedTarget)&&fe(null)}function Up(W,J){if(W.preventDefault(),!ln||ln.status===J){Ds();return}Ds(),Ps({item:ln,toColumnId:J})}function ps({field:W,children:J}){const ge=Xe===W;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>us(W),className:"inline-flex items-center gap-1 hover:text-foreground",children:[J,ge?Ze==="asc"?r.jsx(cS,{className:"h-3 w-3"}):r.jsx(fr,{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(Te,{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(jt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Oy,{children:[r.jsx(V7,{className:"w-full md:min-w-[320px] md:flex-1",value:Pe,onChange:Ea,registry:Mo,declarations:d.factDeclarations,valueSources:{statuses:d.order,priorities:Zs,types:m.definitions.map(W=>W.id),assignees:_o.filter(W=>W!=="__unassigned__"),projects:gu.map(([W])=>W),tags:xu}}),an?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(jp,{ref:s,value:A,onChange:an?pl:()=>{},placeholder:"Search assignments or projects"}),r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:Ra.map(W=>({value:W,label:v[W]??W})),value:V,onChange:du}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:Zs.map(W=>({value:W,label:W[0].toUpperCase()+W.slice(1)})),value:B,onChange:fu}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(W=>({value:W.id,label:Ri(m,W.id)})),value:q,onChange:pu}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},..._o.filter(W=>W!=="__unassigned__").map(W=>({value:W,label:W}))],value:G,onChange:Op}),r.jsx(xn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...gu.map(([W,J])=>({value:W,label:J}))],value:H,onChange:_p}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:xu.map(W=>({value:W,label:W})),value:U,onChange:Zt}),r.jsx(vp,{className:"max-w-[200px]",value:ue,onChange:an?mu:()=>{}}),r.jsxs("select",{value:xe,disabled:!an,onChange:W=>Mp(W.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:$==="kanban"?_e:ze,onChange:W=>hu(W.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:r4.map(W=>{const J=$==="kanban"&&W!=="status"&&W!=="type",ge=W==="none"?"No grouping":`Group: ${W.charAt(0).toUpperCase()+W.slice(1)}`;return r.jsx("option",{value:W,disabled:J,children:J?`${ge} (list only)`:ge},W)})}),r.jsx(kp,{value:$,onChange:W=>cu(W),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),$==="table"?r.jsx(i2,{visibility:Se,onChange:Oe}):null,r.jsx(h2,{scope:Fn,loadedViewId:It,onApply:Fp,onOpenSaveDialog:()=>{Et(!1),Gt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{yt?Bp():(Et(!1),Gt(!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:yt?`Update ${yt.name}`:"Save current view",children:yt?`Update '${yt.name}'`:"Save view"}),yt?r.jsx("button",{type:"button",onClick:()=>{Et(!0),Gt(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),o.assignments.length===0?r.jsx(wt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Te,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(Ax,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Yt.length===0?r.jsx(wt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):$==="table"?(()=>{const W=new Set(Se.hidden),J=ge=>ge==="title"||!W.has(ge);return r.jsx(We,{title:`${qr.length} assignment${qr.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[J("title")?r.jsx(ps,{field:"title",children:"Assignment"}):null,J("status")?r.jsx(ps,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),J("priority")?r.jsx(ps,{field:"priority",children:"Priority"}):null,J("assignee")?r.jsx(ps,{field:"assignee",children:"Assignee"}):null,J("dependencies")?r.jsx(ps,{field:"dependencies",children:"Dependencies"}):null,J("created")?r.jsx(ps,{field:"created",children:"Created"}):null,J("updated")?r.jsx(ps,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:qr.map((ge,Le)=>r.jsxs(G7,{detailHref:Ic(ge),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Aa(Le),children:[J("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(M2,{title:ge.title,detailHref:Ic(ge),onSave:ct=>Fo(ge,ct),disabled:ne===mn(ge)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:ge.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:ge.id,children:[ge.id.slice(0,8),r.jsx(zr,{value:ge.id})]})]}):null,J("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:ge.status,disabled:ne===mn(ge),onChange:ct=>Ps({item:ge,toColumnId:ct.target.value}),className:be("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")]`,Oc(d.statuses,ge.status).className,ne===mn(ge)&&"animate-pulse opacity-60"),style:Oc(d.statuses,ge.status).style,children:w.map(ct=>{const Rt=ge.status===ct,Nt=Rt?void 0:nc(ge,ct),Rn=d.statuses.find($a=>$a.id===ct),fn=!Rt&&Xg(Rn??{id:ct})&&!Nt,sn=((Nt==null?void 0:Nt.disabled)??!1)||fn,mr=fn?`Reach ${v[ct]??ct} via its transition when available`:(Nt==null?void 0:Nt.disabledReason)??void 0;return r.jsx("option",{value:ct,disabled:sn,title:sn?mr:void 0,children:v[ct]},ct)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ja,{type:ge.type,compact:!0})}),J("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:ge.priority}):null,J("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ge.assignee??"Unassigned"}):null,J("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ge.dependsOn.length}):null,J("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Mn(ge.created)}):null,J("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(ge.updated)}):null]},mn(ge)))})]})})})})():$==="list"?r.jsx("div",{className:"space-y-3",children:hl.map(({id:W,label:J,items:ge})=>{var fn;if(ge.length===0&&!(ln&&ze==="status"))return null;const Le=!qe.has(W),ct=ze==="status",Rt=ct&&ln?ln.status!==W&&!((fn=nc(ln,W))!=null&&fn.disabled):!1,Nt=ct&&ln?ln.status!==W&&!Rt:!1,Rn=ct&&ee===W;return r.jsxs("div",{className:be("rounded-lg border border-border/60 bg-card/90 transition",Rn&&Rt&&"ring-2 ring-ring/30",Nt&&"border-dashed opacity-65"),onDragOver:ct?sn=>zo(sn,W):void 0,onDragLeave:ct?sn=>fs(sn,W):void 0,onDrop:ct?sn=>Up(sn,W):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Da(W),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(fr,{className:`h-4 w-4 text-muted-foreground transition-transform ${Le?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:J}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:ge.length})]}),Le&&ge.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:ge.map(sn=>{const mr=mn(sn),$a=Ee===mr,La=xl.get(mr)??-1,$s=ct;return r.jsx("div",{draggable:$s,onDragStart:$s?Ar=>ds(Ar,mr):void 0,onDragEnd:$s?Ds:void 0,...La>=0?Aa(La):{},className:be("transition",$s&&"cursor-grab active:cursor-grabbing",$a&&"scale-[0.98] opacity-50"),children:r.jsx(hk,{assignment:sn,dragging:$a,transitioning:ne===mr,onPillSelect:Ar=>void Ps({item:sn,toColumnId:Ar.targetStatus,action:Ar}),overrideTargets:yl(sn),onOverride:Ar=>bl(sn,Ar),onRenameTitle:Ar=>Fo(sn,Ar)})},mr)})})]},W)})}):r.jsx(bp,{columns:_e==="type"?gl:k,items:Yt,getItemId:mn,getColumnId:W=>_e==="type"?W.type&&m.definitions.some(J=>J.id===W.type)?W.type:S:W.status,canDrop:({item:W,fromColumnId:J,toColumnId:ge})=>{if(J===ge)return{allowed:!0};const Le=nc(W,ge);return Le!=null&&Le.disabled?{allowed:!1,reason:Le.disabledReason||Le.description}:{allowed:!0,reason:Le?Le.warning||Le.description:`Move to ${ge} (direct status change).`}},onMove:_e==="type"?void 0:({item:W,toColumnId:J})=>Ps({item:W,toColumnId:J}),dragDisabled:_e==="type",getExternalDragData:W=>W.projectSlug===null?{type:"standalone-assignment",id:W.id}:{type:"project-assignment",id:W.id},onCardContextMenu:(W,J)=>{J.preventDefault(),pt({item:W,anchor:{x:J.clientX,y:J.clientY}})},emptyMessage:W=>`No ${W.title.toLowerCase()} assignments.`,hiddenColumnIds:le.hidden,onHideColumn:W=>Re(J=>({hidden:J.hidden.includes(W)?J.hidden.filter(Le=>Le!==W):[...J.hidden,W]})),renderCard:(W,{dragging:J})=>{const ge=xl.get(mn(W))??-1;return r.jsx("div",{...ge>=0?Aa(ge):{},children:r.jsx(hk,{assignment:W,dragging:J,transitioning:ne===mn(W),onPillSelect:Le=>void Ps({item:W,toColumnId:Le.targetStatus,action:Le}),overrideTargets:yl(W),onOverride:Le=>bl(W,Le),onRenameTitle:Le=>Fo(W,Le)})})}}),r.jsx(ka,{toast:ae,onDismiss:he}),r.jsx(m2,{open:dn,onOpenChange:W=>{Gt(W),W||Et(!1)},initialName:qn&&yt?`${yt.name} (copy)`:"",title:qn?"Save as new view":"Save view",onSubmit:zp}),r.jsx(S2,{open:Ne!==null,action:(Ne==null?void 0:Ne.action)??null,assignmentTitle:(Ne==null?void 0:Ne.item.title)??"Assignment",loading:ne===(Ne?mn(Ne.item):null),onOpenChange:W=>{W||He(null)},onConfirm:async W=>{if(!Ne)return;const J=Ne;await Pa({item:J.item,toColumnId:J.toColumnId,action:J.action,reason:W})&&He(null)}}),r.jsx(JC,{anchor:(ce==null?void 0:ce.anchor)??null,items:ce?q7(ce.item,{onEdit:()=>{const W=ce.item,J=W.projectSlug===null?`/assignments/${W.id}`:`${W.projectWorkspace?`/w/${W.projectWorkspace}`:t}/projects/${W.projectSlug}/assignments/${W.slug}`;n(J)},onDelete:()=>St(ce.item),onMove:()=>Ye(ce.item)}):[],onClose:()=>pt(null)}),r.jsx(Na,{open:xt!==null,title:"Delete assignment?",description:xt?`"${xt.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:at!==null,onOpenChange:W=>{!W&&at===null&&St(null)},onConfirm:async()=>{if(!xt||xt.projectSlug===null){St(null);return}const W=mn(xt);me(W);try{const J=await fetch(`/api/projects/${encodeURIComponent(xt.projectSlug)}/assignments/${encodeURIComponent(xt.slug)}`,{method:"DELETE"});if(!J.ok){const ge=await J.json().catch(()=>({}));throw new Error(ge.error||"Failed to delete assignment")}St(null),u()}catch(J){alert(J instanceof Error?J.message:"Failed to delete assignment")}finally{me(null)}}}),r.jsx(My,{open:Me!==null,onOpenChange:W=>{W||Ye(null)},currentWorkspace:(Me==null?void 0:Me.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async W=>{if(!Me)return;const J=await fetch(`/api/assignments/${encodeURIComponent(Me.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:W})});if(!J.ok){const ge=await J.json().catch(()=>({}));throw new Error(ge.error||"Failed to move assignment")}u()}})]})}function q7(e,t){const n=[{key:"edit",label:"Edit",icon:Ji,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:yn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Mf,onSelect:t.onMove}),n}function G7({detailHref:e,children:t,className:n,...s}){const o=F2(e);return r.jsx("tr",{...s,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function hk({assignment:e,dragging:t,transitioning:n,onPillSelect:s,overrideTargets:o,onOverride:i,onRenameTitle:l}){var h;const u=Ic(e),d=!!(s&&l),m=F2(u);return r.jsxs("div",{ref:d?m.containerRef:void 0,className:be("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",d&&"cursor-pointer"),onMouseDown:d?m.onMouseDown:void 0,onClick:d?m.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:[d?r.jsx(M2,{title:e.title,detailHref:u,onSave:l,disabled:n}):r.jsx(Te,{to:u,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:[(h=e.id)==null?void 0:h.slice(0,8),e.id&&r.jsx(zr,{value:e.id})]})]}),d?r.jsx(_7,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,overrideTargets:o,onOverride:i,disabled:n,className:"max-w-[150px]"}):r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ja,{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:Mn(e.updated)})]})]})}function nc(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function mn(e){return e.id||e.slug||"unknown"}function Vr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),o=n.split(`
|
|
596
|
+
`),i=[],l=new Map;let u=null,d=[];const m=()=>{u&&(i.push(u),l.set(u,d))};for(const h of o){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],d=[h];continue}u&&d.push(h)}return m(),{order:i,blocks:l,body:s}}function cl(e){return`---
|
|
597
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
598
|
+
`)}
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
${e.body.replace(/^\n+/,"")}`}function Nn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const o=s[1].trim();return o==="null"?"":o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.slice(1,-1):o}function Y7(e,t){return Nn(e,t)==="true"}function wc(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 J7(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 Cn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${J7(n)}`])}function jc(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 kc(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Pp(e){const t=Vr(e);return{title:Nn(t,"title"),slug:Nn(t,"slug"),workspace:Nn(t,"workspace"),archived:Y7(t,"archived"),archivedAt:Nn(t,"archivedAt"),archivedReason:Nn(t,"archivedReason"),tags:wc(t,"tags").join(", "),body:t.body}}function Q7(e,t){const n=Vr(e),s={...Pp(e),...t};return Cn(n,"title",s.title),Cn(n,"slug",s.slug),Cn(n,"workspace",s.workspace||null),Cn(n,"archived",s.archived),Cn(n,"archivedAt",s.archivedAt||null),Cn(n,"archivedReason",s.archivedReason||null),jc(n,"tags",kc(s.tags)),n.body=s.body,cl(n)}function Dp(e){const t=Vr(e);return{title:Nn(t,"title"),slug:Nn(t,"slug"),status:Nn(t,"status"),priority:Nn(t,"priority")||"medium",assignee:Nn(t,"assignee"),dependsOn:wc(t,"dependsOn").join(", "),links:wc(t,"links").join(", "),blockedReason:Nn(t,"blockedReason"),tags:wc(t,"tags").join(", "),body:t.body}}function X7(e,t){const n=Vr(e),s={...Dp(e),...t};return Cn(n,"title",s.title),Cn(n,"slug",s.slug),Cn(n,"status",s.status),Cn(n,"priority",s.priority),Cn(n,"assignee",s.assignee||null),jc(n,"dependsOn",kc(s.dependsOn)),jc(n,"links",kc(s.links)),Cn(n,"blockedReason",s.blockedReason||null),jc(n,"tags",kc(s.tags)),n.body=s.body,cl(n)}function $p(e){const t=Vr(e);return{assignment:Nn(t,"assignment"),status:Nn(t,"status"),body:t.body}}function Z7(e,t){const n=Vr(e),s={...$p(e),...t};return Cn(n,"assignment",s.assignment),Cn(n,"status",s.status),n.body=s.body,cl(n)}function Lp(e){const t=Vr(e);return{assignment:Nn(t,"assignment"),body:t.body}}function e9(e,t){const n=Vr(e),s={...Lp(e),...t};return Cn(n,"assignment",s.assignment),n.body=s.body,cl(n)}function Ip(e){const t=Vr(e);return{name:Nn(t,"name"),slug:Nn(t,"slug"),description:Nn(t,"description"),whenToUse:Nn(t,"when_to_use"),tags:wc(t,"tags").join(", "),body:t.body}}function t9(e,t){const n=Vr(e),s={...Ip(e),...t};return Cn(n,"name",s.name),Cn(n,"slug",s.slug),Cn(n,"description",s.description||null),Cn(n,"when_to_use",s.whenToUse||null),jc(n,"tags",kc(s.tags)),n.body=s.body,cl(n)}function mb(e){return{body:Vr(e).body}}function z2(e){return mb(e)}function B2(e,t){const n=Vr(e);return t.body!==void 0&&(n.body=t.body),cl(n)}function n9(e,t){return B2(e,t)}function Vt(e,t,n){switch(e){case"project":return Q7(t,n);case"assignment":return X7(t,n);case"plan":return Z7(t,n);case"scratchpad":return e9(t,n);case"playbook":return t9(t,n);case"memory":return B2(t,n);case"resource":return n9(t,n);default:return t}}function ul({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:o,error:i,title:l,description:u,onCancel:d,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=f.useState(e),[C,w]=f.useState(!1),[v,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const E=a9(t,y),S=y!==e,T=o9(t,y),I=S?"Unsaved changes":n==="create"?"Draft":"Saved",R=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:l}),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:I})]}),u?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:u}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:d,className:"shell-action",children:[r.jsx(nf,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>w(P=>!P),className:"shell-action",children:[r.jsx(FP,{className:"h-4 w-4"}),r.jsx("span",{children:C?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:o||E.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(zf,{className:"h-4 w-4"}),r.jsx("span",{children:o?"Saving…":"Save"})]})]})]}),i?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:i}):null,E.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:E.map(P=>r.jsx("li",{children:P},P))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${v==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${v==="preview"?"shell-action--cta":""}`,children:[r.jsx(Kw,{className:"h-4 w-4"}),"Preview"]})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[r.jsx("div",{className:v==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:C?r.jsx("textarea",{value:y,onChange:P=>b(P.target.value),className:"min-h-[720px] w-full rounded-md border border-border/70 bg-background/90 p-4 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30",spellCheck:!1}):r.jsx(r9,{documentType:t,content:y,onChange:b,allowSlugEdit:g})})}),r.jsx("div",{className:v==="edit"?"hidden md:block":"",children:r.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(gn,{content:T,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function r9({documentType:e,content:t,onChange:n,allowSlugEdit:s}){const o=cs();if(e==="project"){const l=Pp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(rc,{children:[r.jsx(Ot,{label:"Project title",children:r.jsx("input",{value:l.title,onChange:u=>{const d=u.target.value,m={title:d};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(m.slug=vr(d)),n(Vt(e,t,m))},className:"editor-input"})}),r.jsx(Ot,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:u=>n(Vt(e,t,{slug:vr(u.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(Ot,{label:"Tags",children:r.jsx("input",{value:l.tags,onChange:u=>n(Vt(e,t,{tags:u.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(s9,{value:l.workspace,onChange:u=>n(Vt(e,t,{workspace:u}))})]}),r.jsx(Ot,{label:"Project body",children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const l=Dp(t),u=_C(o),d=!u.some(m=>m.id===l.status);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(rc,{children:[r.jsx(Ot,{label:"Assignment title",children:r.jsx("input",{value:l.title,onChange:m=>{const h=m.target.value,g={title:h};s&&(l.slug===vr(l.title)||!l.slug.trim())&&(g.slug=vr(h)),n(Vt(e,t,g))},className:"editor-input"})}),r.jsx(Ot,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:l.slug,disabled:!s,onChange:m=>n(Vt(e,t,{slug:vr(m.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(Ot,{label:"Status",children:r.jsxs("select",{value:l.status,onChange:m=>n(Vt(e,t,{status:m.target.value})),className:"editor-input",children:[d?r.jsx("option",{value:l.status,children:Eo(o,l.status)}):null,u.map(m=>r.jsx("option",{value:m.id,children:m.label},m.id))]})}),r.jsx(Ot,{label:"Priority",children:r.jsxs("select",{value:l.priority,onChange:m=>n(Vt(e,t,{priority:m.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(Ot,{label:"Assignee",children:r.jsx("input",{value:l.assignee,onChange:m=>n(Vt(e,t,{assignee:m.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(Ot,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:l.dependsOn,onChange:m=>n(Vt(e,t,{dependsOn:m.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(Ot,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:l.links,onChange:m=>n(Vt(e,t,{links:m.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(Ot,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:l.blockedReason,onChange:m=>n(Vt(e,t,{blockedReason:m.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(Ot,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:l.tags,onChange:m=>n(Vt(e,t,{tags:m.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(Ot,{label:"Assignment body",children:r.jsx("textarea",{value:l.body,onChange:m=>n(Vt(e,t,{body:m.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const l=$p(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(rc,{children:[r.jsx(Ot,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(Ot,{label:"Plan status",children:r.jsxs("select",{value:l.status,onChange:u=>n(Vt(e,t,{status:u.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(Ot,{label:"Plan body",children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const l=Lp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(rc,{children:r.jsx(Ot,{label:"Assignment",children:r.jsx("input",{value:l.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(Ot,{label:"Scratchpad body",children:r.jsx("textarea",{value:l.body,onChange:u=>n(Vt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const l=e==="memory"?mb(t):z2(t),u=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ot,{label:u,children:r.jsx("textarea",{value:l.body,onChange:d=>n(Vt(e,t,{body:d.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=Ip(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(rc,{children:[r.jsx(Ot,{label:"Playbook name",children:r.jsx("input",{value:i.name,onChange:l=>{const u=l.target.value,d={name:u};s&&(i.slug===vr(i.name)||!i.slug.trim())&&(d.slug=vr(u)),n(Vt(e,t,d))},className:"editor-input"})}),r.jsx(Ot,{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:vr(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(Ot,{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(Ot,{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(Ot,{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(Ot,{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 rc({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ot({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 s9({value:e,onChange:t}){const{data:n}=ba(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(Ot,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(o=>r.jsx("option",{value:o,children:o},o))]})})}function o9(e,t){switch(e){case"project":return Pp(t).body;case"assignment":return Dp(t).body;case"plan":return $p(t).body;case"scratchpad":return Lp(t).body;case"playbook":return Ip(t).body;case"memory":return mb(t).body;case"resource":return z2(t).body}}function a9(e,t){switch(e){case"project":{const n=Pp(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!zd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Dp(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!zd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return $p(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Lp(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Ip(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!zd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function gk(){const e=_t(),{workspace:t}=Mt(),n=un(),[s,o]=f.useState(null),[i,l]=f.useState(!0),[u,d]=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
|
|
602
|
+
workspace: ${t}`)),o(b),l(!1)}).catch(y=>{h(y.message),l(!1)})},[t]);async function g(y){d(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),d(!1);return}e(`${n}/projects/${C.slug}`)}catch(b){h(b.message),d(!1);return}d(!1)}return i?r.jsx(mt,{label:"Loading project template…"}):m&&!s?r.jsx(kt,{error:m}):r.jsx(ul,{initialContent:s||"",documentType:"project",mode:"create",onSave:g,saving:u,error:m,title:"Create Project",description:"Projects hold the high-level objective, shared context, and human-authored overview. Put execution details in assignments instead of overloading project.md.",onCancel:()=>e(`${n}/projects`),helpTitle:"Project editing rules",helpBody:"Use this form for project intent, slug, tags, and overview content. If you ever need less common metadata, raw markdown mode still exposes the full file.",allowSlugEdit:!0})}function xk(){const{slug:e}=Mt(),t=un(),n=_t(),[s,o]=f.useState(null),[i,l]=f.useState(!0),[u,d]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{o(y.content),l(!1)}).catch(y=>{h(y.message),l(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}d(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),d(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(b){h(b.message),d(!1);return}d(!1)}return i?r.jsx(mt,{label:"Loading assignment template…"}):m&&!s?r.jsx(kt,{error:m}):r.jsx(ul,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Assignment",description:"Assignments are the execution unit. Declare dependencies here, keep status pending until work starts, and use blocked later only for runtime obstacles.",onCancel:()=>n(e?`${t}/projects/${e}`:`${t}/projects`),helpTitle:"Assignment editing rules",helpBody:"Use structured fields for priority, assignee, dependencies, and tags. Status can be changed through lifecycle actions, kanban drag, or the status override.",allowSlugEdit:!0})}function yk(){const{workspace:e}=Mt(),t=un(),n=_t(),[s,o]=f.useState(null),[i,l]=f.useState(!0),[u,d]=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=>{o(b.content),l(!1)}).catch(b=>{h(b.message),l(!1)})},[e]);async function g(y){var b;d(!0),h(null);try{const C=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),w=await C.json();if(!C.ok){h(w.error||`HTTP ${C.status}`),d(!1);return}const v=(b=w==null?void 0:w.assignment)==null?void 0:b.id;if(!v){h("Server did not return the new assignment id."),d(!1);return}n(`/assignments/${v}`)}catch(C){h(C.message),d(!1);return}d(!1)}return i?r.jsx(mt,{label:"Loading assignment template…"}):m&&!s?r.jsx(kt,{error:m}):r.jsx(ul,{initialContent:s||"",documentType:"assignment",mode:"create",onSave:g,saving:u,error:m,title:"Create Standalone Assignment",description:e?`Standalone assignments live outside any project. This one will be tagged with workspaceGroup: ${e} so it appears in this workspace's views.`:"Standalone assignments live outside any project. Add a workspaceGroup to make them appear in workspace-filtered views.",onCancel:()=>n(`${t}/assignments`),helpTitle:"Standalone assignment editing rules",helpBody:"No project field is needed (it must remain null). Use workspaceGroup to group with other workspace work. Status, priority, and tags work the same as project-nested assignments.",allowSlugEdit:!0})}function dl({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,documentType:i,helpTitle:l,helpBody:u}){const d=_t(),{data:m,loading:h,error:g}=BS(e),[y,b]=f.useState(!1),[C,w]=f.useState(null);async function v(k){b(!0),w(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),S=await E.json();if(!E.ok){w(S.error||`HTTP ${E.status}`),b(!1);return}d(n)}catch(E){w(E.message),b(!1);return}b(!1)}return h?r.jsx(mt,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(kt,{error:g||`${s} is unavailable.`}):r.jsx(ul,{initialContent:m.content,documentType:i,onSave:v,saving:y,error:C,title:s,description:o,onCancel:()=>d(n),helpTitle:l,helpBody:u})}function bk(){const{slug:e}=Mt(),t=un(),n=e??"";return r.jsx(dl,{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 hg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,l=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=o?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(dl,{loadUrl:i,saveUrl:l,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 gg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,l=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=o?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(dl,{loadUrl:i,saveUrl:l,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 xg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,l=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=o?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(dl,{loadUrl:i,saveUrl:l,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 U2({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,helpTitle:i,helpBody:l}){const u=_t(),{data:d,loading:m,error:h}=BS(e),[g,y]=f.useState(""),[b,C]=f.useState(""),[w,v]=f.useState(!1),[k,E]=f.useState(null);async function S(){v(!0),E(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),I=await T.json();if(!T.ok){E(I.error||`HTTP ${T.status}`),v(!1);return}u(n)}catch(T){E(T.message),v(!1);return}v(!1)}return m?r.jsx(mt,{label:`Loading ${s.toLowerCase()}…`}):h||!d?r.jsx(kt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(We,{title:s,description:o,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>C(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:S,disabled:w||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Appending…":"Append Entry"})]})]})}),r.jsx(We,{title:"Current Document",children:r.jsx(gn,{content:d.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function yg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,l=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=o?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(U2,{loadUrl:i,saveUrl:l,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 bg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,l=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=o?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(U2,{loadUrl:i,saveUrl:l,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 vk(){const{workspace:e}=Mt(),{data:t}=Ts(),{data:n,loading:s,error:o,refetch:i}=zx(),[l,u]=f.useState(!1),[d,m]=f.useState(""),[h,g]=f.useState(!1),y=Qn();f.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const S=decodeURIComponent(E[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(S)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const I=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(I)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=new Set(t.filter(S=>e==="_ungrouped"?S.workspace===null:S.workspace===e).map(S=>S.slug));return n.sessions.filter(S=>S.windows.some(T=>T.panes.some(I=>I.assignment&&I.assignment.project!==null&&E.has(I.assignment.project))))})();async function C(E){if(E.preventDefault(),!!d.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim()})}),m(""),u(!1),i()}catch{}}async function w(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),i()}finally{g(!1)}}async function v(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),i()}async function k(E){await fetch(`/api/servers/${encodeURIComponent(E)}/refresh`,{method:"POST"}),i()}return s?r.jsx(mt,{label:"Loading servers…"}):o?r.jsx(kt,{error:o}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l?r.jsxs("form",{onSubmit:C,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:d,onChange:E=>m(E.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>u(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>u(!0),children:[r.jsx(jt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:w,disabled:h,children:[r.jsx(mS,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(wt,{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(i9,{session:E,onRefresh:()=>k(E.name),onRemove:()=>v(E.name),onRefetch:i},E.name))})]}):r.jsx(r.Fragment,{children:r.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[r.jsx(Si,{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 i9({session:e,onRefresh:t,onRemove:n,onRefetch:s}){return r.jsxs("div",{className:"surface-panel","data-server-name":e.name,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Lx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e.alive?"border border-success-foreground/30 bg-success text-success-foreground":"border border-error-foreground/30 bg-error text-error-foreground"}`,children:e.alive?"alive":"dead"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:r.jsx(mS,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&r.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(o=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",o.index,": ",o.name]}),r.jsx("div",{className:"space-y-1.5",children:o.panes.map(i=>r.jsx(l9,{pane:i,sessionName:e.name,windowIndex:o.index,onRefetch:s},`${o.index}:${i.index}`))})]},o.index))}),!e.alive&&r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(s3,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function l9({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const o=un(),i=e.cwd.replace(/^\/Users\/[^/]+/,"~");return r.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[r.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),r.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:i}),r.jsx(zr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(Px,{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(l=>r.jsxs("a",{href:l,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:[l.replace("http://localhost:",":"),r.jsx(Gi,{className:"h-2.5 w-2.5"})]},l))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Te,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${o}/projects/${e.assignment.project}/assignments/${e.assignment.slug}`,className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20",children:[r.jsx(qP,{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 W2(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 c9(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":W2(s)}function u9(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 d9(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function wk(){const{data:e,loading:t,error:n,refetch:s}=US(),[o,i]=f.useState(()=>Date.now()),[l,u]=f.useState(null),[d,m]=f.useState(!1);if(f.useEffect(()=>{const g=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(g)},[]),t)return r.jsx(mt,{label:"Loading inventories…"});if(n)return r.jsx(kt,{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(wt,{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(l){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(l.slug)}/force-release/${encodeURIComponent(l.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(f9,{detail:g,now:o,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(Na,{open:l!==null,title:"Force release this lease?",description:l?`This will revoke lease ${l.lease.lease_id} and (if it's still the current holder) free member ${l.lease.member_id}. Any agent still using this lease will see a stale-lease error on its next CLI call.`:"",confirmLabel:"Force release",destructive:!0,loading:d,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function f9({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:o,active_leases:i}=e,l=o.filter(d=>d.status==="idle").length,u=o.filter(d=>d.status==="leased").length;return r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold",children:[r.jsx(Ff,{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=",W2(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[l," idle · ",u," leased · ",o.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(d=>r.jsx(p9,{member:d},d.member_id))}),i.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),r.jsx("div",{className:"mt-2 space-y-2",children:i.map(d=>r.jsx(m9,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function p9({member:e}){const t=d9(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 ${u9(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 m9({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($P,{className:"h-3 w-3"}),c9(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(i3,{className:"h-3 w-3"}),"Force release"]})]})]})}function h9(e){switch(e.kind){case"at":return`at ${e.at}`;case"in":return`in ${Math.round((e.durationMs??0)/1e3)}s`;case"cron":return`cron ${e.expr}${e.tz?` (${e.tz})`:""}`;case"after-reset":return`after ${e.provider} reset`;case"when-status":return`when ${e.assignmentId??"this"} → ${e.status}`;case"when-plan-lands":return`when ${e.assignmentId??"this"} plan lands`;default:return e.kind}}async function g9(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function x9(e){const t=await fetch("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`);return n.schedule}async function y9(e){const t=await fetch(`/api/schedules/${encodeURIComponent(e)}/cancel`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`)}}function b9(){const[e,t]=f.useState(null),[n,s]=f.useState(!0),[o,i]=f.useState(null),l=f.useCallback(async()=>{try{t(await g9()),i(null)}catch(u){i(u instanceof Error?u.message:"Failed to fetch schedules")}finally{s(!1)}},[]);return f.useEffect(()=>{l()},[l]),Xi(u=>{u.type==="schedules-updated"&&l()}),{data:e,loading:n,error:o,refetch:l}}const v9=[{value:"cron",label:"Cron expression"},{value:"at",label:"At a timestamp"},{value:"in",label:"After a delay"},{value:"after-reset",label:"After quota reset"},{value:"when-status",label:"When assignment reaches status"},{value:"when-plan-lands",label:"When plan lands"}];function w9({open:e,onOpenChange:t,onCreated:n}){const[s,o]=f.useState(""),[i,l]=f.useState("claude"),[u,d]=f.useState("cron"),[m,h]=f.useState(!0),[g,y]=f.useState(""),[b,C]=f.useState(""),[w,v]=f.useState("0 3 * * *"),[k,E]=f.useState(""),[S,T]=f.useState(""),[I,R]=f.useState("5"),[P,$]=f.useState("claude"),[L,F]=f.useState(""),[A,z]=f.useState("rolling-5h"),[V,O]=f.useState("ready_to_implement"),[B,K]=f.useState(""),[q,_]=f.useState(!1),[G,D]=f.useState(null);if(!e)return null;function H(){switch(u){case"cron":return{kind:u,expr:w,...k?{tz:k}:{}};case"at":return{kind:u,at:S};case"in":return{kind:u,durationMs:Math.round(Number(I)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:u,provider:P,anchor:{windowStartIso:L||new Date().toISOString(),windowKind:A}};case"when-status":return{kind:u,status:V,...B?{assignmentId:B}:{}};case"when-plan-lands":return{kind:u,...B?{assignmentId:B}:{}}}}async function Z(){_(!0),D(null);try{const ue={assignmentId:s.trim(),agentId:i.trim(),trigger:H(),unattended:m,terminalPreference:g.trim()||null,promptTemplate:b.trim()||null};if(!ue.assignmentId)throw new Error("Assignment id is required");await x9(ue),n(),t(!1)}catch(ue){D(ue instanceof Error?ue.message:"Create failed")}finally{_(!1)}}const U="w-full rounded border bg-background px-2 py-1 text-sm",oe="block text-xs font-medium text-muted-foreground";return r.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:r.jsxs("div",{className:"max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-lg border bg-card p-5",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"New schedule"}),r.jsx("button",{type:"button",onClick:()=>t(!1),className:"text-muted-foreground hover:text-foreground",children:r.jsx(Hc,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Assignment id / slug"}),r.jsx("input",{className:U,value:s,onChange:ue=>o(ue.target.value),placeholder:"scheduled-agents"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Agent"}),r.jsx("input",{className:U,value:i,onChange:ue=>l(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Terminal (optional)"}),r.jsx("input",{className:U,value:g,onChange:ue=>y(ue.target.value),placeholder:"default"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Trigger"}),r.jsx("select",{className:U,value:u,onChange:ue=>d(ue.target.value),children:v9.map(ue=>r.jsx("option",{value:ue.value,children:ue.label},ue.value))})]}),u==="cron"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Cron expr"}),r.jsx("input",{className:U,value:w,onChange:ue=>v(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Timezone (optional)"}),r.jsx("input",{className:U,value:k,onChange:ue=>E(ue.target.value),placeholder:"local"})]})]}),u==="at"&&r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"ISO timestamp"}),r.jsx("input",{className:U,value:S,onChange:ue=>T(ue.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),u==="in"&&r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Delay (hours)"}),r.jsx("input",{className:U,type:"number",value:I,onChange:ue=>R(ue.target.value)})]}),u==="after-reset"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Provider"}),r.jsxs("select",{className:U,value:P,onChange:ue=>$(ue.target.value),children:[r.jsx("option",{value:"claude",children:"claude"}),r.jsx("option",{value:"codex",children:"codex"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Window kind"}),r.jsxs("select",{className:U,value:A,onChange:ue=>z(ue.target.value),children:[r.jsx("option",{value:"rolling-5h",children:"rolling-5h"}),r.jsx("option",{value:"weekly",children:"weekly"})]})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:oe,children:"Window start (optional ISO)"}),r.jsx("input",{className:U,value:L,onChange:ue=>F(ue.target.value),placeholder:"now"})]})]}),u==="when-status"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Status"}),r.jsx("input",{className:U,value:V,onChange:ue=>O(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Watch assignment (optional)"}),r.jsx("input",{className:U,value:B,onChange:ue=>K(ue.target.value),placeholder:"this assignment"})]})]}),u==="when-plan-lands"&&r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Watch assignment (optional)"}),r.jsx("input",{className:U,value:B,onChange:ue=>K(ue.target.value),placeholder:"this assignment"})]}),r.jsxs("div",{children:[r.jsx("label",{className:oe,children:"Prompt template (optional)"}),r.jsx("input",{className:U,value:b,onChange:ue=>C(ue.target.value),placeholder:"plan @assignment"})]}),r.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:m,onChange:ue=>h(ue.target.checked)}),"Unattended (hard limits + kill switch apply)"]}),G&&r.jsx("p",{className:"text-sm text-destructive",children:G})]}),r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"rounded border px-3 py-1 text-sm",children:"Cancel"}),r.jsx("button",{type:"button",onClick:Z,disabled:q,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:q?"Creating…":"Create"})]})]})})}const j9=new Set(["completed","failed","launch_failed","cancelled","killed"]);function k9(e){return e==="running"?"bg-green-500/15 text-green-400 border-green-500/30":e==="eligible"?"bg-blue-500/15 text-blue-400 border-blue-500/30":e==="held"?"bg-amber-500/15 text-amber-400 border-amber-500/30":e==="launch_failed"||e==="failed"||e==="killed"?"bg-red-500/15 text-red-400 border-red-500/30":"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}function S9(){const{data:e,loading:t,error:n,refetch:s}=b9(),[o,i]=f.useState(!1);if(t)return r.jsx(mt,{label:"Loading schedules…"});if(n)return r.jsx(kt,{title:"Could not load schedules",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});async function l(u){try{await y9(u.id),s()}catch(d){window.alert(d instanceof Error?`Cancel failed: ${d.message}`:"Cancel failed")}}return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Schedules"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Run work on an assignment unattended — on a clock, after a quota reset, or when an assignment reaches a status. The scheduler tick is the sole authority; this page calls the same CLI verbs."})]}),r.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-sm text-primary-foreground",children:[r.jsx(jt,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?r.jsx(wt,{title:"No schedules yet",description:"Create one above, or with `syntaur schedule create --assignment <id> --cron '0 3 * * *'`."}):r.jsx("div",{className:"grid gap-2",children:e.map(u=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(iS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-mono text-sm",children:u.assignmentId}),r.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${k9(u.attempt.state)}`,children:u.attempt.state}),!u.unattended&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"interactive"})]}),r.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[h9(u.trigger)," · agent ",r.jsx("code",{className:"font-mono",children:u.agentId}),u.attempt.lastError&&r.jsxs("span",{className:"text-destructive",children:[" · ",u.attempt.lastError]})]})]}),!j9.has(u.attempt.state)&&r.jsxs("button",{type:"button",onClick:()=>l(u),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(CP,{className:"h-3 w-3"}),"Cancel"]})]},u.id))}),r.jsx(w9,{open:o,onOpenChange:i,onCreated:s})]})}const N9={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},wo="bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm";function jk(){const[e,t]=is(),n=oD(e),s=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Ts(),{data:l}=ba(),{data:u}=WS(),[d,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null);f.useEffect(()=>{if(!e.get("window")){const v=Pg({window:"30d",...n});o==="assignment"&&v.set("groupBy","assignment"),t(v,{replace:!0})}},[]);const C=MS({window:s,...n}).toString();f.useEffect(()=>{const v=new AbortController;g(!0),b(null);const k=C?`/api/usage?${C}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(k,{signal:v.signal}).then(async E=>{if(!E.ok){const S=await E.json().catch(()=>({}));throw new Error(S.error??`HTTP ${E.status}`)}return E.json()}).then(E=>{m(E),g(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(b(E instanceof Error?E.message:String(E)),g(!1))}),()=>v.abort()},[C,o]);function w(v,k=o){const E=Pg(v);k==="assignment"&&E.set("groupBy","assignment"),t(E)}return r.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[r.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[r.jsx(Wc,{className:"w-6 h-6 text-amber-400"}),r.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Window"}),r.jsx("select",{value:s,onChange:v=>w({...n,window:v.target.value}),className:wo,children:Bf.map(v=>r.jsx("option",{value:v,children:N9[v]},v))})]}),s==="custom"?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Since"}),r.jsx("input",{type:"date",value:n.since??"",onChange:v=>w({...n,window:"custom",since:v.target.value||void 0}),className:wo})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n.until??"",onChange:v=>w({...n,window:"custom",until:v.target.value||void 0}),className:wo})]})]}):null,r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Workspace"}),r.jsxs("select",{value:n.workspace??"",onChange:v=>w({...n,workspace:v.target.value||void 0,project:void 0}),className:wo,children:[r.jsx("option",{value:"",children:"All"}),l!=null&&l.hasUngrouped?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,((l==null?void 0:l.workspaces)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:n.project??"",onChange:v=>w({...n,project:v.target.value||void 0,workspace:void 0}),className:wo,children:[r.jsx("option",{value:"",children:"All"}),(i??[]).map(v=>r.jsx("option",{value:v.slug,children:v.slug},v.slug))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Model"}),r.jsxs("select",{value:n.model??"",onChange:v=>w({...n,model:v.target.value||void 0}),className:wo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.models)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Tool"}),r.jsxs("select",{value:n.tool??"",onChange:v=>w({...n,tool:v.target.value||void 0}),className:wo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.tools)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:o,onChange:v=>w(n,v.target.value),className:wo,children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),d&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),d.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data for these filters. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),o==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:d.summary.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:v.projectSlug||"(unattributed)"}),o==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:v.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Mi(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Fi(v.totalCost)}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.lastEventDay})]},k))})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),d.daily.length===0?r.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),r.jsx("tbody",{children:d.daily.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2 tabular-nums",children:v.day}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.tool}),r.jsx("td",{className:"px-3 py-2 text-zinc-400",children:v.model}),r.jsx("td",{className:"px-3 py-2",children:v.project_slug||"–"}),r.jsx("td",{className:"px-3 py-2",children:v.assignment_slug||"–"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Mi(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Fi(v.total_cost)})]},k))})]})]})]})]})}function kk(){const{workspace:e}=Mt(),{data:t}=Ts(),{data:n,loading:s,error:o}=Wf(),[i,l]=f.useState(""),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,C]=f.useState(0),[w,v]=f.useState(new Set),[k,E]=f.useState(!1),[S,T]=f.useState(null),[I,R]=f.useState(null),P=(n==null?void 0:n.sessions.some(O=>O.status==="active"))??!1;f.useEffect(()=>{if(!P)return;const O=window.setInterval(()=>C(B=>B+1),3e4);return()=>window.clearInterval(O)},[P]),f.useEffect(()=>{v(O=>{if(O.size===0)return O;const B=new Set((n==null?void 0:n.sessions.map(q=>q.sessionId))??[]),K=new Set([...O].filter(q=>B.has(q)));return K.size===O.size?O:K})},[n]);const $=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const O=i.trim().toLowerCase();return[...n.sessions.filter(K=>{var G;if(e&&t){const D=((G=t.find(H=>H.slug===K.projectSlug))==null?void 0:G.workspace)??null;if(e==="_ungrouped"){if(D!==null)return!1}else if(D!==e)return!1}const q=E9(K.started);return u&&(!q||q<u)||m&&(!q||q>m)?!1:O?[K.projectSlug??"",K.assignmentSlug??"",K.agent,K.sessionId,K.path,K.description??"",K.transcriptPath??""].join(" ").toLowerCase().includes(O):!0})].sort((K,q)=>T9(K,q,g))},[n,i,g,u,m,b,e,t]);function L(O){v(B=>{const K=new Set(B);return K.has(O)?K.delete(O):K.add(O),K})}function F(){w.size===$.length&&$.length>0?v(new Set):v(new Set($.map(O=>O.sessionId)))}async function A(O){T(null),E(!0);try{const B=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:O})}),K=await B.json().catch(()=>null);if(!B.ok)throw new Error((K==null?void 0:K.error)||`HTTP ${B.status}`);v(q=>new Set([...q].filter(_=>!O.includes(_)))),R(null)}catch(B){T(B.message)}finally{E(!1)}}async function z(O){try{const B=await fetch(`/api/agent-sessions/${encodeURIComponent(O)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!B.ok){const K=await B.json().catch(()=>null);T((K==null?void 0:K.error)||`Failed to mark session stopped: HTTP ${B.status}`)}}catch(B){T(B.message)}}if(s)return r.jsx(mt,{label:"Loading agent sessions..."});if(o)return r.jsx(kt,{error:o});if(!n)return null;const V=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Oy,{children:[r.jsx(jp,{value:i,onChange:l,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:O=>d(O.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:O=>h(O.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:O=>y(O.target.value),className:"editor-input max-w-[200px]",children:[r.jsx("option",{value:"started_desc",children:"Newest first"}),r.jsx("option",{value:"started_asc",children:"Oldest first"}),r.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),r.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),S?r.jsx("div",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:S}):null,w.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:[w.size," session",w.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>R({sessionIds:[...w],title:`Delete ${w.size} selected session${w.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:w.size===1?"Delete Session":"Delete Sessions"}),disabled:k,children:[r.jsx(yn,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>v(new Set),children:"Clear Selection"})]}),V?$.length===0?r.jsx(wt,{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:F,className:"text-muted-foreground hover:text-foreground",children:w.size===$.length&&$.length>0?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(Ix,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:$.map(O=>r.jsx(C9,{session:O,selected:w.has(O.sessionId),onToggle:()=>L(O.sessionId),onDelete:()=>R({sessionIds:[O.sessionId],title:`Delete session ${O.sessionId.slice(0,8)}...?`,description:`Remove this ${O.agent} session record${O.assignmentSlug?` for ${O.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:z,onCopyError:T},O.sessionId))})]})}):r.jsx(wt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(Na,{open:I!==null,title:(I==null?void 0:I.title)??"Delete session?",description:(I==null?void 0:I.description)??"",confirmLabel:(I==null?void 0:I.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:O=>{O||R(null)},onConfirm:async()=>{I&&await A(I.sessionIds)}})]})}function C9({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:o,onCopyError:i}){const l=un(),u=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,d=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",m=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return r.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(Ix,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Te,{to:`${l}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:kn(e.projectSlug),children:kn(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(Te,{to:`${l}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:kn(e.assignmentSlug),children:kn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Te,{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(Of,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:u}),r.jsx(zr,{value:e.sessionId}),r.jsx(g2,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>i(h.message),onNotice:h=>i(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Br(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:d}),e.path&&r.jsx(zr,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx(zr,{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(w2,{session:e,onMarkStopped:o}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})})]})}function E9(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${s}-${o}`}function $d(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 T9(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 $d(e)-$d(t);case"duration_desc":return $d(t)-$d(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 R9(){const{data:e,loading:t,error:n,refetch:s}=Bx(),[o,i]=f.useState(""),[l,u]=f.useState(null),[d,m]=f.useState(null),[h,g]=f.useState(null),y=f.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!o.trim())return e.playbooks;const w=o.toLowerCase();return e.playbooks.filter(v=>v.name.toLowerCase().includes(w)||v.description.toLowerCase().includes(w)||v.slug.toLowerCase().includes(w)||v.tags.some(k=>k.toLowerCase().includes(w)))},[e,o]);async function b(w,v,k){if(w.preventDefault(),w.stopPropagation(),!l){u(v);try{const E=k?"disable":"enable",S=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!S.ok){const T=await S.json().catch(()=>({}));throw new Error(T.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{u(null)}}}async function C(){if(d){g(d.slug);try{const w=await fetch(`/api/playbooks/${encodeURIComponent(d.slug)}`,{method:"DELETE"});if(!w.ok){const v=await w.json().catch(()=>({}));throw new Error(v.error||"Failed to delete playbook")}m(null),s()}catch(w){console.error(w),alert(w instanceof Error?w.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(mt,{label:"Loading playbooks..."}):n?r.jsx(kt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange:w=>i(w.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(Te,{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(jt,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Te,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(dS,{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(wt,{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(Te,{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(jt,{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(w=>{const v=l===w.slug,k=[{key:"delete",label:"Delete",icon:yn,destructive:!0,onSelect:()=>m({slug:w.slug,name:w.name})}];return r.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${w.enabled?"":"opacity-75"}`,children:[r.jsx("div",{className:"absolute right-3 top-3 z-10",children:r.jsx(Dy,{items:k})}),r.jsxs(Te,{to:`/playbooks/${w.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(aS,{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:w.name}),w.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:w.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:[w.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(hS,{className:"h-2.5 w-2.5"}),E]},E)),w.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",w.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":w.enabled,"aria-label":w.enabled?"Disable playbook":"Enable playbook",onClick:E=>b(E,w.slug,w.enabled),disabled:v,className:`absolute bottom-3 right-3 z-10 inline-flex h-5 w-9 items-center rounded-full border opacity-100 transition disabled:opacity-50 ${w.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 ${w.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},w.slug)})}),r.jsx(Na,{open:d!==null,title:"Delete playbook?",description:d?`"${d.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:C,onOpenChange:w=>{w||m(null)}})]})}function A9(){const{slug:e}=Mt(),t=_t(),{data:n,loading:s,error:o,refetch:i}=gD(e),[l,u]=f.useState(!1),[d,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(!1),[C,w]=f.useState(""),[v,k]=f.useState(!1),[E,S]=f.useState(null),T=e==="manifest";f.useEffect(()=>{y&&(w(e??""),S(null))},[y,e]);const I=vr(C),R=I.length>0&&zd(I)&&I!=="manifest",P=I!==e;async function $(){if(!(!e||!R||!P)){k(!0),S(null);try{const A=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:I})});if(!A.ok){const z=await A.json().catch(()=>({}));throw new Error(z.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${I}`)}catch(A){S(A instanceof Error?A.message:"Failed to rename playbook")}finally{k(!1)}}}async function L(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function F(){if(!(!e||!n)){g(!0);try{const A=n.enabled?"disable":"enable",z=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${A}`,{method:"POST"});if(!z.ok){const V=await z.json().catch(()=>({}));throw new Error(V.error||`Failed to ${A} playbook`)}i()}catch(A){console.error(A),alert(A instanceof Error?A.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(mt,{label:"Loading playbook..."}):o?r.jsx(kt,{error:o}):n?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:T?"Playbook Manifest":n.name}),T?r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:"auto-generated"}):null]}),!T&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,T?r.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.syntaur/playbooks/manifest.md"})," ","in your CLAUDE.md for agent context."]}):null,!T&&n.whenToUse?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(n.created)]}),r.jsxs("span",{children:["Updated ",Br(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(A=>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(hS,{className:"h-3 w-3"}),A]},A))}):null]}),T?null:r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),r.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:F,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(Te,{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(Ji,{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(c3,{className:"h-3 w-3"}),"Rename"]}),l?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:L,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:n.body})}),r.jsx(Ln,{open:y,onOpenChange:A=>v?void 0:b(A),children:r.jsxs(En,{children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:"Rename playbook"}),r.jsx(Wr,{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:A=>w(A.target.value),disabled:v,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),C&&I!==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:I||"—"})]}):null,C&&!R?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Rr,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:v,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:$,disabled:v||!R||!P,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function P9(){const e=_t(),[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,l]=f.useState(!1),[u,d]=f.useState(null);f.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),o(!1)}).catch(h=>{d(h.message),o(!1)})},[]);async function m(h){l(!0),d(null);try{const g=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){d(y.error||`HTTP ${g.status}`),l(!1);return}e(`/playbooks/${y.slug}`)}catch(g){d(g.message),l(!1);return}l(!1)}return s?r.jsx(mt,{label:"Loading playbook template..."}):u&&!t?r.jsx(kt,{error:u}):r.jsx(ul,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:m,saving:i,error:u,title:"Create Playbook",description:"Playbooks define rules and workflows for how agents should operate. Keep them short, imperative, and focused on a single concern.",onCancel:()=>e("/playbooks"),allowSlugEdit:!0})}function D9(){const{slug:e}=Mt(),t=_t(),[n,s]=f.useState(null),[o,i]=f.useState(!0),[l,u]=f.useState(!1),[d,m]=f.useState(null);f.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(g=>g.json()).then(g=>{s(g.content),i(!1)}).catch(g=>{m(g.message),i(!1)})},[e]);async function h(g){if(e){u(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),b=await y.json();if(!y.ok){m(b.error||`HTTP ${y.status}`),u(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),u(!1);return}u(!1)}}return o?r.jsx(mt,{label:"Loading playbook..."}):d&&!n?r.jsx(kt,{error:d}):r.jsx(ul,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:l,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function $9(){const{data:e,loading:t,error:n}=xD(),[s,o]=f.useState(""),[i,l]=f.useState("all"),[u,d]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.memories)??[],y=f.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),C=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),w=f.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.scope!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(mt,{label:"Loading memories…"}):n?r.jsx(kt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>l(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Te,{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(jt,{className:"h-4 w-4"}),"New Memory"]})]}),w.length===0?r.jsx(wt,{title:g.length===0?"No memories yet":"No memories match these filters",description:g.length===0?"Memories capture patterns and learnings discovered while working in a project. Agents create them via /create-memory or you can add one manually.":"Clear the current filters or create a new memory.",actions:g.length===0?r.jsxs(Te,{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(jt,{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:w.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Te,{to:`/projects/${v.projectSlug}/memories/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Te,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Mn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function L9(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=yD(e,t),[l,u]=f.useState(!1),[d,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 o?r.jsx(mt,{label:"Loading memory…"}):i?r.jsx(kt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Te,{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 ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Te,{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(Ji,{className:"h-3 w-3"}),"Edit"]}),l?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function I9(){const e=_t(),[t]=is(),n=t.get("project"),{data:s,loading:o,error:i}=Ts(),[l,u]=f.useState(n??""),[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[C,w]=f.useState(null);f.useEffect(()=>{!l&&s&&s.length>0&&u(n??s[0].slug)},[s,n,l]);async function v(k){if(k.preventDefault(),!(!l||!d.trim())){b(!0),w(null);try{const E=await fetch(`/api/projects/${l}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){w(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/memories/${S.slug}`)}catch(E){w(E.message),b(!1)}}}return o?r.jsx(mt,{label:"Loading projects…"}):i?r.jsx(kt,{error:i}):!s||s.length===0?r.jsx(kt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Memories capture patterns and learnings discovered during work in a project. They are available to every assignment in that project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:l,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!l,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 O9(){const{slug:e,itemSlug:t}=Mt();return r.jsx(dl,{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 _9(){const{data:e,loading:t,error:n}=bD(),[s,o]=f.useState(""),[i,l]=f.useState("all"),[u,d]=f.useState("all"),[m,h]=f.useState("all"),g=(e==null?void 0:e.resources)??[],y=f.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=f.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),C=f.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),w=f.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.category!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(mt,{label:"Loading resources…"}):n?r.jsx(kt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>l(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Te,{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(jt,{className:"h-4 w-4"}),"New Resource"]})]}),w.length===0?r.jsx(wt,{title:g.length===0?"No resources yet":"No resources match these filters",description:g.length===0?"Resources are reference materials shared across a project — specs, requirements, links, or any reference content.":"Clear the current filters or create a new resource.",actions:g.length===0?r.jsxs(Te,{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(jt,{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:w.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Te,{to:`/projects/${v.projectSlug}/resources/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Te,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Mn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function M9(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=vD(e,t),[l,u]=f.useState(!1),[d,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 o?r.jsx(mt,{label:"Loading resource…"}):i?r.jsx(kt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Te,{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 ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Te,{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(Ji,{className:"h-3 w-3"}),"Edit"]}),l?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function F9(){const e=_t(),[t]=is(),n=t.get("project"),{data:s,loading:o,error:i}=Ts(),[l,u]=f.useState(n??""),[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[C,w]=f.useState(null);f.useEffect(()=>{!l&&s&&s.length>0&&u(n??s[0].slug)},[s,n,l]);async function v(k){if(k.preventDefault(),!(!l||!d.trim())){b(!0),w(null);try{const E=await fetch(`/api/projects/${l}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){w(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/resources/${S.slug}`)}catch(E){w(E.message),b(!1)}}}return o?r.jsx(mt,{label:"Loading projects…"}):i?r.jsx(kt,{error:i}):!s||s.length===0?r.jsx(kt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Resources are reference material — specs, requirements, links — shared across every assignment in a project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:l,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!l,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 z9(){const{slug:e,itemSlug:t}=Mt();return r.jsx(dl,{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."})}const yx=["projects","playbooks","todos","servers","config"];function B9(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))yx.includes(n)&&t.add(n);return t}function Sk(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function U9(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[o,i]=f.useState(""),[l,u]=f.useState(new Set(yx)),[d,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[C,w]=f.useState(null),v=f.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const P=await R.json();s(P),i(P.repo??""),u(B9(P.categories)),m(!1)}catch(R){w({type:"error",message:`Failed to load backup config: ${R instanceof Error?R.message:String(R)}`})}finally{t(!1)}},[]);f.useEffect(()=>{v()},[v]);function k(R){u(P=>{const $=new Set(P);return $.has(R)?$.delete(R):$.add(R),$}),m(!0)}async function E(){g(!0),w(null);try{const R=Array.from(l),P=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:R})}),$=await P.json();if(!P.ok)throw new Error($.error||`HTTP ${P.status}`);s($),m(!1),w({type:"success",message:"Backup configuration saved."})}catch(R){w({type:"error",message:`Save failed: ${R instanceof Error?R.message:String(R)}`})}finally{g(!1)}}async function S(){b("push"),w(null);try{const R=await fetch("/api/backup/push",{method:"POST"}),P=await R.json();if(!R.ok||P.success===!1)throw new Error(P.error||P.message||`HTTP ${R.status}`);w({type:"success",message:P.message||"Backup complete."}),await v()}catch(R){w({type:"error",message:`Backup failed: ${R instanceof Error?R.message:String(R)}`})}finally{b(null)}}async function T(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),w(null);try{const P=await fetch("/api/backup/pull",{method:"POST"}),$=await P.json();if(!P.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${P.status}`);w({type:"success",message:$.message||"Restore complete."}),await v()}catch(P){w({type:"error",message:`Restore failed: ${P instanceof Error?P.message:String(P)}`})}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=!!o.trim()&&l.size>0&&!y&&!d;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:o,onChange:R=>{i(R.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:yx.map(R=>{const P=l.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${P?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${P?"bg-primary":"bg-muted-foreground/40"}`}),R]},R)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),Sk((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),Sk((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&r.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:E,disabled:h||!d,children:[r.jsx(zf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:S,disabled:!I,title:I?"Back up now":d?"Save config first":"Set repo and pick categories",children:[r.jsx(u3,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!I,title:I?"Restore from backup":d?"Save config first":"Set repo and pick categories",children:[r.jsx(_P,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),d&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(LP,{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 W9(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:o,unbindAction:i}=$o(),[l,u]=f.useState(null),[d,m]=f.useState(null),[h,g]=f.useState(!1),y=Object.values(t).some(S=>typeof S=="string"&&S.length>0);function b(S,T){m({type:S,message:T}),setTimeout(()=>m(null),2500)}function C(S){u({kind:S,combo:null,conflict:null,saving:!1,error:null})}function w(S){if(!l||S.key==="Escape")return;if(S.key==="Enter"&&l.combo){S.preventDefault(),v();return}if(S.key==="Enter")return;S.preventDefault(),S.stopPropagation();const T=HS(S.nativeEvent);if(!T)return;const I=s(T,l.kind);u({...l,combo:T,conflict:I,error:null})}async function v(){var S;if(l!=null&&l.combo){if((S=l.conflict)!=null&&S.description){u({...l,error:`Reserved: ${l.conflict.description}`});return}u({...l,saving:!0,error:null});try{await o(l.kind,l.combo),u(null),b("success",`Bound ${Jl[l.kind]}`)}catch(T){u({...l,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(S){try{await i(S),b("success",`Cleared ${Jl[S]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await V4(),b("success","All hotkey bindings cleared")}catch(S){b("error",S instanceof Error?S.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(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(Cs,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[d?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${d.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:d.message}):null,r.jsx("ul",{className:"space-y-2",children:Hf.map(S=>{var $,L;const T=n.find(F=>F.bindableKind===S),I=e[S],R=typeof t[S]=="string"&&!!t[S],P=(l==null?void 0:l.kind)===S;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(Eg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-sm text-foreground",children:(T==null?void 0:T.title)??Jl[S]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),I?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:Ss(I)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${R?"text-primary":"text-muted-foreground"}`,children:R?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(S),children:I?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(S),"aria-label":`Restore default ${Jl[S]} binding`,children:[r.jsx(Hc,{className:"h-3 w-3"}),"Restore default"]}):null]}),P?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:w,onBlur:()=>{(l==null?void 0:l.kind)===S&&!l.saving&&u(null)},children:l!=null&&l.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:Ss(l.combo)}),($=l.conflict)!=null&&$.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",l.conflict.description]}):(L=l.conflict)!=null&&L.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Jl[l.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."}),l.error?r.jsx("div",{className:"text-xs text-destructive",children:l.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},S)})})]})}const H9={kanban:"Kanban",list:"List",table:"Table"},V9={comfortable:"Comfortable",compact:"Compact"},K9={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},q9={asc:"Ascending",desc:"Descending"};function G9(){const e=ZU(),t=e.global,[n,s]=f.useState(!1),[o,i]=f.useState(null);function l(m,h){i({type:m,message:h}),setTimeout(()=>i(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await f2({[m]:h}),l("success","Saved")}catch(g){l("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function d(){if(e.custom){s(!0);try{await e7(),l("success","Reset to defaults")}catch(m){l("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:d,disabled:n,children:[r.jsx(Cs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:ay.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:H9[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:n4.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:V9[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:M1.map(m=>r.jsx("option",{value:m,children:K9[m]??m},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:t4.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:q9[m]},m))})]})]})]})}function Y9({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:o,className:i,wrapperClassName:l,singleLine:u,"aria-label":d}){const[m,h]=f.useState(0),[g,y]=f.useState(0),[b,C]=f.useState(!1),w=f.useRef(null),v=A2(e,m),k=v?P2(v.partial,n):[],E=!b&&k.length>0,S=Math.min(g,Math.max(0,k.length-1)),T=L=>u?L.replace(/[\r\n]+/g," "):L;function I(L){t(T(L.target.value)),h(L.target.selectionStart??L.target.value.length),y(0),C(!1)}function R(L){h(L.currentTarget.selectionStart??e.length)}function P(L){if(!v||!L)return;const F=D2(e,v,L);t(T(F.text)),h(F.caret),y(0),C(!0),requestAnimationFrame(()=>{const A=w.current;A&&(A.focus(),A.setSelectionRange(F.caret,F.caret))})}function $(L){E&&(L.key==="ArrowDown"?(L.preventDefault(),y(F=>Math.min(F+1,k.length-1))):L.key==="ArrowUp"?(L.preventDefault(),y(F=>Math.max(F-1,0))):L.key==="Enter"||L.key==="Tab"?(L.preventDefault(),P(k[S])):L.key==="Escape"&&(L.preventDefault(),C(!0)))}return r.jsxs("div",{className:be("relative",l),children:[r.jsx("textarea",{ref:w,value:e,rows:s,placeholder:o,"aria-label":d,onChange:I,onKeyDown:$,onKeyUp:R,onClick:R,className:i}),E&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:k.map((L,F)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":F===S,onMouseDown:A=>{A.preventDefault(),P(L)},className:be("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",F===S&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:L})]})},L))})]})}const J9={first:"first",last:"last",none:"none"};function H2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function sc(e){return e.map(t=>({rowKey:H2(),id:t.id,originalId:t.id,isNew:!1,idEditable:!1,autoSlugFromLabel:!1,label:t.label,command:t.command,argsText:t.args?t.args.join(" "):"",promptArgPosition:t.promptArgPosition??"first",resolveFromShellAliases:t.resolveFromShellAliases??!1,default:t.default??!1,model:t.model??"",playbook:t.playbook??"",launchPrompt:t.launchPrompt??"",fieldErrors:{}}))}function Q9(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},s=t.argsText.split(/[,\s]+/).filter(Boolean);return s.length>0&&(n.args=s),t.promptArgPosition!=="first"&&(n.promptArgPosition=t.promptArgPosition),t.resolveFromShellAliases&&(n.resolveFromShellAliases=!0),t.default&&(n.default=!0),t.model.trim()&&(n.model=t.model.trim()),t.playbook.trim()&&(n.playbook=t.playbook.trim()),t.launchPrompt.trim()&&(n.launchPrompt=t.launchPrompt),n})}function X9(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 Z9(e,t){return!t||t.length===0?e:e.map((n,s)=>{const o={};for(const i of t){if(i.index!==void 0){i.index===s&&(o[i.field]=i.message);continue}if(i.id!==void 0){i.id===n.id&&(o[i.field]=i.message);continue}o[i.field]=i.message}return{...n,fieldErrors:o}})}function eW(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function tW(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const s=e[n],o=t[n];if(s.id!==o.id||s.label!==o.label||s.command!==o.command||s.argsText!==o.argsText||s.promptArgPosition!==o.promptArgPosition||s.resolveFromShellAliases!==o.resolveFromShellAliases||s.default!==o.default||s.model!==o.model||s.playbook!==o.playbook||s.launchPrompt!==o.launchPrompt)return!1}return!0}function nW({row:e,index:t,canRemove:n,playbooks:s,onPatch:o,onSetDefault:i,onRemove:l}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=cp({id:e.rowKey}),C={transform:ns.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function w(T){const I={label:T};if(e.autoSlugFromLabel){const R=vr(T);R&&v7.test(R)?I.id=R:I.id=`agent-${t+1}`}o(I)}function v(T){o({id:T,autoSlugFromLabel:!1})}const k=T=>e.fieldErrors[T]?"border-error-foreground/60":"",E=f.useMemo(()=>s.map(T=>T.slug),[s]),S=f.useMemo(()=>$2(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:C,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...d,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Yi,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:T=>v(T.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick: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(yn,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:T=>w(T.target.value),className:`editor-input mt-0.5 w-full ${k("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:T=>o({command:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:T=>o({argsText:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:T=>o({promptArgPosition:T.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:N2.map(T=>r.jsx("option",{value:T,children:J9[T]},T))}),e.fieldErrors.promptArgPosition&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),r.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:T=>o({model:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("model")}`}),e.fieldErrors.model&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),r.jsxs("div",{className:"col-span-full",children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),r.jsx(Y9,{value:e.launchPrompt,onChange:T=>o({launchPrompt:T}),knownSlugs:E,singleLine:!0,rows:5,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",wrapperClassName:"mt-0.5",className:`editor-input w-full resize-y font-mono leading-relaxed min-h-[6rem] ${k("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),S.length>0&&!e.fieldErrors.launchPrompt&&r.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:S.map(T=>r.jsx("li",{children:T},T))})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:T=>o({resolveFromShellAliases:T.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function rW(){const e=T2(),t=Bx(),n=f.useMemo(()=>{var $;return((($=t.data)==null?void 0:$.playbooks)??[]).filter(L=>L.enabled).map(L=>({slug:L.slug,name:L.name}))},[t.data]),[s,o]=f.useState(()=>sc(e.agents)),[i,l]=f.useState(()=>sc(e.agents)),[u,d]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const $=sc(e.agents);o($),l($),h(null)},[e.agents]);const b=f.useMemo(()=>!tW(s,i),[s,i]),C=np(To(rl,{activationConstraint:{distance:8}}),To(nl));function w($,L){y({type:$,message:L}),setTimeout(()=>y(null),2500)}function v($,L){o(F=>F.map(A=>A.rowKey===$?{...A,...L,fieldErrors:sW(A.fieldErrors,L)}:A))}function k($){o(L=>L.map(F=>({...F,default:F.rowKey===$})))}function E(){o($=>{const L=new Set($.map(B=>B.id)),F="new-agent";let A=F,z=1;for(;L.has(A);)z+=1,A=`${F}-${z}`;const V=z===1?"New Agent":`New Agent ${z}`,O={rowKey:H2(),id:A,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:V,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...$,O]})}function S($){o(L=>L.filter(F=>F.rowKey!==$))}async function T(){d(!0),h(null);try{const $=X9(s),L=Q9($),F=await k7(L),A=sc(F.agents);o(A),l(A),w("success","Agents saved")}catch($){if($ instanceof C2)h($.message),o(L=>Z9(eW(L),$.fieldErrors)),w("error",$.message);else{const L=$ instanceof Error?$.message:"Failed to save";h(L),w("error",L)}}finally{d(!1)}}function I(){o(i),h(null)}async function R(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){d(!0),h(null);try{const $=await S7(),L=sc($.agents);o(L),l(L),w("success","Reset to defaults")}catch($){const L=$ instanceof Error?$.message:"Failed to reset";h(L),w("error",L)}finally{d(!1)}}}function P($){const{active:L,over:F}=$;!F||L.id===F.id||o(A=>{const z=A.findIndex(O=>O.rowKey===L.id),V=A.findIndex(O=>O.rowKey===F.id);return z===-1||V===-1?A:sl(A,z,V)})}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:R,disabled:u,children:[r.jsx(Cs,{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(Dx,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",r.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),g&&r.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),m&&(!g||g.type!=="error")&&r.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:m}),r.jsx(ip,{sensors:C,collisionDetection:rp,onDragEnd:P,children:r.jsx(lp,{items:s.map($=>$.rowKey),strategy:by,children:r.jsx("div",{className:"space-y-2",children:s.map(($,L)=>r.jsx(nW,{row:$,index:L,canRemove:s.length>1,playbooks:n,onPatch:F=>v($.rowKey,F),onSetDefault:()=>k($.rowKey),onRemove:()=>S($.rowKey)},$.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:E,disabled:u,className:"shell-action text-xs",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:I,disabled:!b||u,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:T,disabled:!b||u,className:"shell-action text-xs",children:[r.jsx(zf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function sW(e,t){if(Object.keys(e).length===0)return e;const n={...e};return"id"in t&&delete n.id,"label"in t&&delete n.label,"command"in t&&delete n.command,"argsText"in t&&delete n.args,"promptArgPosition"in t&&delete n.promptArgPosition,"resolveFromShellAliases"in t&&delete n.resolveFromShellAliases,"default"in t&&delete n.default,"model"in t&&delete n.model,"playbook"in t&&delete n.playbook,"launchPrompt"in t&&delete n.launchPrompt,n}const V2=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Af={terminal:"terminal-app",custom:!1};let ki=null,xi=null,Pf=0;const bx=new Set;function K2(e){ki=e;for(const t of bx)t(e)}function hb(e){if(!e||typeof e!="object")return Af;const t=e;return{terminal:typeof t.terminal=="string"&&V2.includes(t.terminal)?t.terminal:Af.terminal,custom:t.custom===!0}}function oW(){if(ki)return Promise.resolve(ki);if(xi)return xi;const e=++Pf;return xi=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{xi=null;const n=hb(t);return e!==Pf?ki??n:(ki=n,n)}).catch(()=>(xi=null,Af)),xi}function aW(){const[e,t]=f.useState(()=>ki??Af);return f.useEffect(()=>{let n=!1;return oW().then(s=>{n||t(s)}),bx.add(t),()=>{n=!0,bx.delete(t)}},[]),e}async function iW(e){++Pf;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=hb(await t.json());return K2(n),n}async function lW(){++Pf;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=hb(await e.json());return K2(t),t}const Ld={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function cW(){const{terminal:e,custom:t}=aW(),[n,s]=f.useState(!1),[o,i]=f.useState(null);function l(m){i(m),setTimeout(()=>i(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await iW(m),l({type:"success",message:`Terminal set to ${Ld[m]}.`})}catch(h){l({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function d(){s(!0);try{const m=await lW();l({type:"success",message:`Reset to OS default (${Ld[m.terminal]}).`})}catch(m){l({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 ${Ld[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:n,type:"button",children:[r.jsx(Cs,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:V2.map(m=>r.jsx("option",{value:m,children:Ld[m]},m))})]})]})}const Nk={all:"Everything",assignment:"Assignments",project:"Projects",todo:"Todos",server:"Servers",playbook:"Playbooks"},uW=["all",...Vf];function vg(e){return Object.entries(e).map(([t,n])=>({prefix:t,kind:n}))}function dW(e){const t=[],n={},s=new Set;for(const{prefix:i,kind:l}of e){const u=i.trim();if(u===""){t.push("An alias prefix is empty.");continue}if(s.has(u)){t.push(`Duplicate prefix "${u}".`);continue}s.add(u),n[u]=l}const o=LD(n);return o.ok||t.push(...o.errors),{map:n,errors:t}}function fW(){const{search:e,custom:t}=Gx(),[n,s]=f.useState(e.defaultScope),[o,i]=f.useState(e.externalIds),[l,u]=f.useState(()=>vg(e.aliases)),[d,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),C=JSON.stringify(e);f.useEffect(()=>{d||(s(e.defaultScope),i(e.externalIds),u(vg(e.aliases)))},[C]);const{map:w,errors:v}=dW(l);function k(L){b(L),setTimeout(()=>b(null),2500)}function E(){u(L=>[...L,{prefix:"",kind:"assignment"}]),m(!0)}function S(L){u(F=>F.filter((A,z)=>z!==L)),m(!0)}function T(L,F){u(A=>A.map((z,V)=>V===L?{...z,...F}:z)),m(!0)}function I(L){s(L.defaultScope),i(L.externalIds),u(vg(L.aliases)),m(!1)}async function R(){if(!(v.length>0)){g(!0);try{const L=await _D({defaultScope:n,aliases:w,externalIds:o});I(L.search),k({type:"success",message:"Search settings saved."})}catch(L){k({type:"error",message:L instanceof Error?L.message:"Save failed."})}finally{g(!1)}}}async function P(){g(!0);try{const L=await MD();I(L.search),k({type:"success",message:"Reset to defaults."})}catch(L){k({type:"error",message:L instanceof Error?L.message:"Reset failed."})}finally{g(!1)}}const $=d&&v.length===0&&!h;return r.jsxs(We,{title:"Search",description:"Customize the Cmd+K command palette: default scope, type-alias prefixes, and external-ID indexing.",actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:P,disabled:h,type:"button",children:[r.jsx(Cs,{className:"h-3 w-3"}),"Reset to defaults"]}):void 0,children:[y&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${y.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:y.message}),r.jsxs("div",{className:"space-y-5",children:[r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Default scope"}),r.jsx("select",{value:n,onChange:L=>{s(L.target.value),m(!0)},disabled:h,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:uW.map(L=>r.jsx("option",{value:L,children:Nk[L]},L))}),r.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:["Searches with no type prefix are limited to this. An ",r.jsx("code",{children:"all:"})," prefix (or empty box) always searches everything."]})]}),r.jsxs("div",{className:"text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Type-alias prefixes"}),r.jsx("div",{className:"space-y-2",children:l.map((L,F)=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:L.prefix,onChange:A=>T(F,{prefix:A.target.value}),placeholder:"prefix",disabled:h,spellCheck:!1,className:"w-24 rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsx("select",{value:L.kind,onChange:A=>T(F,{kind:A.target.value}),disabled:h,className:"rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:Vf.map(A=>r.jsx("option",{value:A,children:Nk[A]},A))}),r.jsx("button",{type:"button",onClick:()=>S(F),disabled:h,"aria-label":`Remove alias ${L.prefix}`,className:"rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-60",children:r.jsx(Hc,{className:"h-3.5 w-3.5"})})]},F))}),r.jsxs("button",{type:"button",onClick:E,disabled:h,className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-60",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add alias"]})]}),r.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[r.jsx("input",{type:"checkbox",checked:o,onChange:L=>{i(L.target.checked),m(!0)},disabled:h,className:"mt-0.5"}),r.jsxs("span",{children:[r.jsx("span",{className:"font-medium",children:"Index external IDs"}),r.jsxs("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:["Fold external IDs (e.g. Jira keys) into search and enable"," ",r.jsx("code",{children:"jira:"}),"/",r.jsx("code",{children:"externalid:"})," and bare-ID matching."]})]})]}),d&&v.length>0&&r.jsx("ul",{className:"space-y-1 text-xs text-error-foreground",children:v.map((L,F)=>r.jsx("li",{children:L},F))}),r.jsx("div",{children:r.jsx("button",{type:"button",onClick:R,disabled:!$,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:h?"Saving…":"Save search settings"})})]})]})}function oc(e){return e===uf?"Ungrouped":e}function pW(){const{data:e,loading:t,error:n,refetch:s}=ba(),{hidden:o,custom:i,loading:l,error:u,reload:d}=G1(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[uf]:[]]:[];async function w(k,E){const S=E?o.filter(T=>T!==k):[...o,k];h(!0);try{await tI(S),b({type:"success",message:E?`Showing "${oc(k)}" in the left nav.`:`Hiding "${oc(k)}" from the left nav.`})}catch(T){b({type:"error",message:T instanceof Error?T.message:"Save failed."})}finally{h(!1)}}async function v(){h(!0);try{await nI(),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:i?r.jsxs("button",{className:"shell-action text-xs",onClick:v,disabled:m,type:"button",children:[r.jsx(Cs,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||l?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&d()},children:[r.jsx(Cs,{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=!X4(k,o);return r.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("span",{className:"truncate text-sm",title:oc(k),children:[oc(k),k===uf&&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 "${oc(k)}" in the left nav`,onClick:()=>w(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 mW(){const{preset:e,setPreset:t,resetPreset:n}=Fx(),[s,o]=f.useState(!1),[i,l]=f.useState(null);async function u(m){if(!(m===e||s)){o(!0),l(null);try{await t(m),l({type:"success",message:"Theme updated"}),setTimeout(()=>l(null),2e3)}catch(h){l({type:"error",message:h instanceof Error?h.message:"Failed to save theme"})}finally{o(!1)}}}async function d(){o(!0),l(null);try{await n(),l({type:"success",message:"Theme reset to default"}),setTimeout(()=>l(null),2e3)}catch(m){l({type:"error",message:m instanceof Error?m.message:"Failed to reset theme"})}finally{o(!1)}}return 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:e!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:s,children:[r.jsx(Cs,{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.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:TS.map(m=>{const h=m.slug===e;return r.jsxs("button",{type:"button",onClick:()=>u(m.slug),disabled:s,"aria-pressed":h,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${h?"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:m.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:m.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:m.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:m.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:m.swatches.amber}}),h&&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(Tr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:m.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:m.description})]})]},m.slug)})})]}),r.jsx(W9,{}),r.jsx(cW,{}),r.jsx(fW,{}),r.jsx(pW,{}),r.jsx(rW,{}),r.jsx(G9,{}),r.jsx(U9,{})]})}function hW({open:e,affected:t,remaining:n,ruleReferences:s,headlineReferences:o,onResolve:i,onCancel:l}){var I,R;const[u,d]=f.useState(n.length>0?"remap":"delete"),[m,h]=f.useState(((I=n[0])==null?void 0:I.id)??""),[g,y]=f.useState(((R=n[0])==null?void 0:R.id)??""),[b,C]=f.useState(!1),w=t.count>0;f.useEffect(()=>{var P,$;e&&(d(n.length>0?"remap":"delete"),h(((P=n[0])==null?void 0:P.id)??""),y((($=n[0])==null?void 0:$.id)??""),C(!1))},[e,n]);const v=!o||g!==""&&g!==t.id,k=u==="remap"&&n.length>0&&m!==""&&m!==t.id||u==="delete"&&(!w||b)&&v;function E(){k&&(u==="remap"?i({id:t.id,mode:"remap",target:m},m):i({id:t.id,mode:"delete"},o?g:""))}const S=t.assignments.slice(0,10),T=t.count-S.length;return r.jsx(Ln,{open:e,onOpenChange:P=>P?void 0:l(),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Xn,{children:[r.jsxs(Tn,{children:['Delete status "',t.label,'"',w?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),r.jsx(Wr,{children:w?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),w&&r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[S.map(P=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:P.display})},`${P.projectSlug??"standalone"}/${P.assignmentSlug}`)),T>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",T," more not shown"]})]})}),s.length>0&&r.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-3",children:[r.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"Workflow rules referencing this status:"}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:s.map((P,$)=>r.jsxs("li",{children:[r.jsx("span",{className:"text-foreground",children:P.section}),r.jsx("span",{className:"mx-1",children:"·"}),P.detail]},$))}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:u==="remap"?"These will be remapped to the target status.":"Ladder rungs and transitions referencing this status will be removed"+(o?"; headline rules must be remapped below.":".")})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="remap",onChange:()=>d("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:w?"Remap to another status":"Remap rules to another status"}),r.jsxs("select",{value:m,onChange:P=>h(P.target.value),onClick:()=>d("remap"),disabled:u!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="delete",onChange:()=>d("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:w?"Delete these assignments":"Drop the referencing rules"}),r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:w?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),u==="delete"&&o&&r.jsxs("span",{className:"mt-2 block",children:[r.jsx("span",{className:"block text-xs font-medium",children:"Remap headline rules to"}),r.jsxs("select",{value:g,onChange:P=>y(P.target.value),disabled:n.length===0,className:"mt-1 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),r.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:"The headline projection cannot reference a deleted status, so it must point somewhere."})]}),u==="delete"&&w&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:b,onChange:P=>C(P.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Rr,{children:[r.jsx("button",{type:"button",onClick:l,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:E,disabled:!k,className:`shell-action ${u==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:u==="remap"?w?`Remap ${t.count} → ${m||"..."}`:`Remap rules → ${m||"..."}`:w?`Delete ${t.count}`:"Drop rules"})]})]})})}function gW({open:e,references:t,onConfirm:n,onCancel:s}){return r.jsx(Ln,{open:e,onOpenChange:o=>o?void 0:s(),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Xn,{children:[r.jsx(Tn,{children:"Delete fact — referenced by derive rules"}),r.jsx(Wr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:o.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:o.when})]},i))})}),r.jsxs(Rr,{children:[r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action bg-error text-error-foreground hover:opacity-90",children:"Confirm delete — rules will become invalid"})]})]})})}function xW({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",o=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:i=>t(i.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":s}),r.jsx("input",{type:"text",value:e,onChange:i=>t(i.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":o})]})}function yW({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:o,listeners:i,setNodeRef:l,setActivatorNodeRef:u,transform:d,transition:m,isDragging:h}=cp({id:e.rowKey}),g={transform:ns.Transform.toString(d),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:l,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...o,...i,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Yi,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Sr,{children:[r.jsx(Nr,{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(cr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[10rem] flex-1",children:r.jsx("input",{type:"text",value:e.description,onChange:y=>n("description",y.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),r.jsx(xW,{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(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(cr,{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(yn,{className:"h-3.5 w-3.5"})})]})}function bW({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:s,onRemove:o,onReorder:i}){const l=np(To(rl,{activationConstraint:{distance:8}}),To(nl,{coordinateGetter:FN}));function u(d){const{active:m,over:h}=d;if(!h||m.id===h.id)return;const g=e.findIndex(b=>b.rowKey===m.id),y=e.findIndex(b=>b.rowKey===h.id);g===-1||y===-1||i(sl(e,g,y))}return 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:s,children:[r.jsx(jt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(ip,{sensors:l,collisionDetection:rp,onDragEnd:u,children:r.jsx(lp,{items:e.map(d=>d.rowKey),strategy:by,children:r.jsx("div",{className:"space-y-2",children:e.map((d,m)=>r.jsx(yW,{row:d,isSaved:t.has(d.id),onUpdate:(h,g)=>n(m,h,g),onRemove:()=>o(m)},d.rowKey))})})})})}function vW(e){const t=Array.from(e.pendingResolutions.values()),s={statuses:e.statuses.map(o=>({id:o.id,label:o.label,...o.description?{description:o.description}:{},...o.color?{color:o.color}:{},...o.terminal?{terminal:!0}:{}})),order:e.order,resolutions:t};return e.transitions!==void 0&&(s.transitions=e.transitions),e.derive!==void 0&&(s.derive=e.derive),e.facts!==void 0&&(s.facts=e.facts),e.factRemovalAcks&&e.factRemovalAcks.length>0&&(s.factRemovalAcks=e.factRemovalAcks),{body:s,resolutions:t}}function wW(e,t,n){const s=[];t.phaseLadder.forEach((o,i)=>{o.phase===e&&s.push({section:"phaseLadder",detail:`phaseLadder rung ${i} ("${o.phase}")`})}),t.headline.parked===e&&s.push({section:"headline",detail:"headline.parked"}),t.headline.blocked===e&&s.push({section:"headline",detail:"headline.blocked"});for(const o of n)(o.from===e||o.to===e)&&s.push({section:"transitions",detail:`transition ${o.from} --${o.command}--> ${o.to}`});return s}function jW(e,t){return t.headline.parked===e||t.headline.blocked===e}function kW(e,t,n){return{phaseLadder:e.phaseLadder.map(s=>s.phase===t?{...s,phase:n}:s),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function SW(e,t,n){return e.map(s=>({...s,from:s.from===t?n:s.from,to:s.to===t?n:s.to}))}function NW(e,t,n){return{phaseLadder:e.phaseLadder.filter(s=>s.phase!==t),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function CW(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function EW(e,t){const n=new Map;t.forEach((o,i)=>{n.has(o)||n.set(o,i)});const s=t.length;return e.map((o,i)=>({s:o,originalIndex:i,r:n.get(o.id)??s})).sort((o,i)=>o.r-i.r||o.originalIndex-i.originalIndex).map(o=>o.s)}function Ck(e,t){const n=new Map;for(const[s,o]of e.entries())t.has(o.id)||o.mode==="remap"&&!t.has(o.target)||n.set(s,o);return n}function q2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function TW(e){const t=e.statuses.map(n=>({rowKey:q2(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return EW(t,e.order)}function RW(e){return Jg(e)}function Ek(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function AW(e){const t=new Map;for(let n=0;n<e.length;n++){const s=Ek(Jg(e.slice(0,n))),o=Ek(Jg(e.slice(0,n+1)));for(const[i,l]of o.entries()){const u=s.get(i)??0;if(l>u){t.set(n,i);break}}}return t}const PW=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],DW=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function $W(){return{name:"",type:"bool",binds:null}}function LW({rows:e,onChange:t,saving:n}){const s=AW(e),o=f.useCallback(()=>{t([...e,$W()])},[e,t]),i=f.useCallback((u,d,m)=>{t(e.map((h,g)=>g===u?{...h,[d]:m}:h))},[e,t]),l=f.useCallback(u=>{t(e.filter((d,m)=>m!==u))},[e,t]);return r.jsxs(We,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",children:[r.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Names must match ",r.jsx("code",{className:"font-mono",children:"^[a-z][a-zA-Z0-9]*"})," — start with a lowercase letter, then letters or numbers only (no spaces, hyphens, or underscores)."]}),r.jsxs("div",{className:"space-y-2",children:[e.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),e.map((u,d)=>{const m=s.get(d),h=u.type==="attestation";return r.jsxs("div",{className:`rounded-md border p-2 ${m?"border-error-foreground/40 bg-error/5":"border-border/60 bg-background/80"}`,children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[r.jsx("input",{type:"text",value:u.name,onChange:g=>i(d,"name",g.target.value),placeholder:"factName",disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm font-mono focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),r.jsx("select",{value:u.type,onChange:g=>{const y=g.target.value;t(e.map((b,C)=>C===d?{...b,type:y,binds:y==="attestation"?b.binds:null}:b))},disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:PW.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}),h?r.jsx("select",{value:u.binds??"none",onChange:g=>i(d,"binds",g.target.value),disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:DW.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}):r.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),m&&r.jsxs(Sr,{children:[r.jsx(Nr,{asChild:!0,children:r.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:r.jsx(sf,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),r.jsx(cr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:m})]}),r.jsx("button",{type:"button",onClick:()=>l(d),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]}),m&&r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:m})]},d)})]}),r.jsxs("button",{type:"button",onClick:o,disabled:n,className:"mt-2 shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(jt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function G2(e,t=xp){var s,o;if(e==="*")return null;const n=Gf(e);if(!n.ast)return((s=n.errors[0])==null?void 0:s.message)??"unparseable condition";try{return uc(n.ast,t),null}catch(i){if(i instanceof jr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function wg(e){if(e.values.length!==1)return null;const t=e.values[0];return{field:e.field,op:e.op,value:t.raw,valueType:t.type}}function IW(e){if(e.kind==="atom"){const t=wg(e);return t?{outerJoin:"AND",groups:[{join:"AND",comparisons:[t]}]}:null}if(e.kind==="and"||e.kind==="or"){const t=e.kind==="and"?"AND":"OR",n=e.kind==="and"?"or":"and",s=e.kind==="and"?"OR":"AND",o=[];for(const i of e.children)if(i.kind==="atom"){const l=wg(i);if(!l)return null;o.push({join:s,comparisons:[l]})}else if(i.kind===n){const l=[];for(const u of i.children){if(u.kind!=="atom")return null;const d=wg(u);if(!d)return null;l.push(d)}o.push({join:s,comparisons:l})}else return null;return{outerJoin:t,groups:o}}return null}function Tk(e){const t=e.trim();if(t===""||t==="*")return null;const n=Gf(t);return n.ast?IW(n.ast):null}const OW=/^[A-Za-z_][A-Za-z0-9_-]*$/;function _W(e){return e===""||!OW.test(e)||/^(and|or|not)$/i.test(e)}function MW(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function FW(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:_W(e.value)?MW(e.value):e.value}function zW(e){const t=FW(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function BW(e){return e.groups.map(n=>{const s=n.comparisons.map(zW).join(` ${n.join} `);return n.comparisons.length>1?`(${s})`:s}).join(` ${e.outerJoin} `)}function UW(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":G2(e,t)}function WW(e){return gM(hM(e))}function HW(e){const t=$y(e),n=[];for(const s of PC(e)){const o=t[s.toLowerCase()];o&&n.push({name:s,kind:o.kind})}return n}function Y2(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function vx(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function ac(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:vx(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:Y2(t.kind)}:{field:"",op:":",value:""}]}]}}function J2({value:e,onChange:t,fieldOptions:n,registry:s,disabled:o}){const i=f.useMemo(()=>Tk(e),[e]),l=e.trim()===""||i!==null,[u,d]=f.useState(l?"builder":"raw"),[m,h]=f.useState(()=>i??ac(n)),g=f.useRef(e);f.useEffect(()=>{if(e===g.current)return;const R=Tk(e);R&&h(R),!(e.trim()===""||R)&&u==="builder"&&d("raw"),g.current=e},[e]);const y=UW(e,s);function b(R){g.current=R,t(R)}function C(R){h(R),b(BW(R))}function w(R){C({outerJoin:R,groups:m.groups.map(P=>({...P,join:R==="AND"?"OR":"AND"}))})}function v(R,P,$){const L=m.groups.map((F,A)=>A===R?{...F,comparisons:F.comparisons.map((z,V)=>V===P?{...z,...$}:z)}:F);C({...m,groups:L})}function k(R){const P=ac(n).groups[0].comparisons[0],$=m.groups.map((L,F)=>F===R?{...L,comparisons:[...L.comparisons,{...P}]}:L);C({...m,groups:$})}function E(R,P){let $=m.groups.map((L,F)=>F===R?{...L,comparisons:L.comparisons.filter((A,z)=>z!==P)}:L);$=$.filter(L=>L.comparisons.length>0),$.length===0&&($=ac(n).groups),C({...m,groups:$})}function S(){const R=m.outerJoin==="AND"?"OR":"AND";C({...m,groups:[...m.groups,{join:R,comparisons:[ac(n).groups[0].comparisons[0]]}]})}function T(){if(u==="builder"){d("raw");return}l&&(h(i??ac(n)),d("builder"))}const I="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";return r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),r.jsxs("button",{type:"button",onClick:T,disabled:o||u==="raw"&&!l,title:u==="raw"&&!l?"Condition too complex for the builder — edit as raw AQL":u==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[u==="builder"?r.jsx(IP,{className:"h-3 w-3"}):r.jsx(YP,{className:"h-3 w-3"}),u==="builder"?"Raw AQL":"Builder"]})]}),u==="raw"?r.jsx("input",{type:"text",list:"aql-field-names",value:e,onChange:R=>b(R.target.value),disabled:o,placeholder:"e.g. planApproved:true AND implementationStarted:true",className:`${I} w-full font-mono`}):r.jsxs("div",{className:"space-y-2",children:[m.groups.map((R,P)=>r.jsxs("div",{children:[P>0&&r.jsxs("div",{className:"my-1 flex items-center gap-2",children:[r.jsx("span",{className:"h-px flex-1 bg-border/60"}),r.jsx("button",{type:"button",onClick:()=>w(m.outerJoin==="AND"?"OR":"AND"),disabled:o,className:"shell-action text-[10px] uppercase tracking-wide",children:m.outerJoin}),r.jsx("span",{className:"h-px flex-1 bg-border/60"})]}),r.jsxs("div",{className:"rounded-md border border-border/50 bg-background/60 p-2 space-y-1.5",children:[R.comparisons.map(($,L)=>{const F=n.find(V=>V.name===$.field),A=(F==null?void 0:F.kind)??"string",z=vx(A);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[L>0&&r.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:R.join}),r.jsxs("select",{value:$.field,onChange:V=>{const O=n.find(q=>q.name===V.target.value),B=(O==null?void 0:O.kind)??"string",K=vx(B);v(P,L,{field:V.target.value,op:K.includes($.op)?$.op:K[0],value:B==="bool"?"true":$.value,valueType:Y2(B)})},disabled:o,className:`${I} font-mono`,children:[n.length===0&&r.jsx("option",{value:"",children:"(no fields)"}),!n.some(V=>V.name===$.field)&&$.field!==""&&r.jsx("option",{value:$.field,children:$.field}),n.map(V=>r.jsx("option",{value:V.name,children:V.name},V.name))]}),r.jsx("select",{value:$.op,onChange:V=>v(P,L,{op:V.target.value}),disabled:o,className:`${I} font-mono`,children:z.map(V=>r.jsx("option",{value:V,children:V},V))}),A==="bool"?r.jsxs("select",{value:$.value||"true",onChange:V=>v(P,L,{value:V.target.value}),disabled:o,className:`${I} font-mono`,children:[r.jsx("option",{value:"true",children:"true"}),r.jsx("option",{value:"false",children:"false"})]}):r.jsx("input",{type:"text",value:$.value,onChange:V=>v(P,L,{value:V.target.value}),disabled:o,placeholder:"value",className:`${I} w-24 font-mono`}),r.jsx("button",{type:"button",onClick:()=>E(P,L),disabled:o,className:"ml-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove condition",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]},L)}),r.jsxs("button",{type:"button",onClick:()=>k(P),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(jt,{className:"h-3 w-3"}),R.join," condition"]})]})]},P)),r.jsxs("button",{type:"button",onClick:S,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(jt,{className:"h-3 w-3"}),m.outerJoin," group"]})]}),r.jsx("datalist",{id:"aql-field-names",children:n.map(R=>r.jsx("option",{value:R.name},R.name))}),r.jsx("p",{className:"font-mono text-[11px] text-muted-foreground truncate",title:e,children:e.trim()===""?r.jsx("span",{className:"italic",children:"empty condition"}):e}),y&&r.jsx("p",{className:"text-xs text-error-foreground",children:y})]})}let Rk=0;function Df(){return Rk+=1,`dr_${Rk}_${Math.random().toString(36).slice(2,8)}`}function jg(e){const t=[...e.disposition].sort((n,s)=>n.when===null&&s.when!==null?1:n.when!==null&&s.when===null?-1:0);return{phaseLadder:e.phaseLadder.map(n=>({rowKey:Df(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Df(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function wx(e){const t=e.phaseLadder.map(s=>s.next.trim()?{phase:s.phase,when:s.when,next:s.next.trim()}:{phase:s.phase,when:s.when}),n=e.disposition.map(s=>({when:s.when,is:s.is}));return{phaseLadder:t,disposition:n,headline:{terminal:"passthrough",active:"phase",parked:e.headline.parked,blocked:e.headline.blocked}}}function VW(e){return e.findIndex(t=>t.when.trim()==="*")}function Q2(e,t,n){return T4(e,{statuses:t},s=>G2(s,n))}const Ak=["active","blocked","parked"];function KW({value:e,deriveCustom:t,statuses:n,acceptedFacts:s,onChange:o,onReset:i,disabled:l}){const u=f.useMemo(()=>$y(s),[s]),d=f.useMemo(()=>HW(s),[s]),m=np(To(rl,{activationConstraint:{distance:8}}),To(nl,{coordinateGetter:FN})),h=f.useMemo(()=>{try{return Q2(wx(e),n,u)}catch{return["derive rules are malformed"]}},[e,n,u]),g=VW(e.phaseLadder),y=g>=0?e.phaseLadder[g]:null,b=e.phaseLadder.filter((L,F)=>F!==g);function C(L,F){o({...e,phaseLadder:[...L?[L]:[],...F]})}function w(L,F){const A=e.phaseLadder.map(z=>z.rowKey===L?{...z,...F}:z);o({...e,phaseLadder:A})}function v(){var F;const L={rowKey:Df(),phase:((F=n[0])==null?void 0:F.id)??"",when:"",next:""};C(y,[...b,L])}function k(L){o({...e,phaseLadder:e.phaseLadder.filter(F=>F.rowKey!==L)})}function E(L){const{active:F,over:A}=L;if(!A||F.id===A.id)return;const z=b.findIndex(O=>O.rowKey===F.id),V=b.findIndex(O=>O.rowKey===A.id);z===-1||V===-1||C(y,sl(b,z,V))}function S(L,F){o({...e,disposition:e.disposition.map(A=>A.rowKey===L?{...A,...F}:A)})}function T(){const L={rowKey:Df(),when:"",is:"active"},F=e.disposition.findIndex(z=>z.when===null),A=[...e.disposition];F>=0?A.splice(F,0,L):A.push(L),o({...e,disposition:A})}function I(L){o({...e,disposition:e.disposition.filter(F=>F.rowKey!==L)})}function R(L,F){o({...e,headline:{...e.headline,[L]:F}})}const P="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function $(L,F,A){return r.jsxs("select",{value:L,onChange:z=>F(z.target.value),disabled:l,"aria-label":A,className:`${P} font-mono`,children:[!n.some(z=>z.id===L)&&L!==""&&r.jsx("option",{value:L,children:L}),n.map(z=>r.jsxs("option",{value:z.id,children:[z.label," (",z.id,")"]},z.id))]})}return r.jsxs(We,{title:"Derive Rules",description:"The phase ladder, disposition rules, and headline projection that map facts to a status. Highest matching rung wins — drag to reorder priority.",actions:t?r.jsxs("button",{type:"button",className:"shell-action text-xs inline-flex items-center gap-1",onClick:i,disabled:l,children:[r.jsx(Cs,{className:"h-3 w-3"}),"Reset to default rules"]}):void 0,children:[!t&&r.jsx("div",{className:"mb-3 rounded-md border border-border/60 bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:"Using built-in derive rules. Editing anything below switches to a custom configuration."}),h.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These derive rules won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:h.map((L,F)=>r.jsx("li",{children:L},F))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Phase ladder"}),y&&r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2 opacity-90",children:[r.jsx("span",{className:"mt-1 text-muted-foreground/40",children:r.jsx(Yi,{className:"h-4 w-4 opacity-30"})}),r.jsxs("div",{className:"min-w-[10rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase (catch-all, lowest priority)"}),$(y.phase,L=>w(y.rowKey,{phase:L}),"Catch-all phase"),r.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"matches everything"})]}),r.jsxs("div",{className:"min-w-[12rem] flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:y.next,onChange:L=>w(y.rowKey,{next:L.target.value}),disabled:l,className:`${P} w-full`})]})]}),r.jsx(ip,{sensors:m,collisionDetection:rp,onDragEnd:E,children:r.jsx(lp,{items:b.map(L=>L.rowKey),strategy:by,children:r.jsx("div",{className:"space-y-2",children:b.map(L=>r.jsx(qW,{rung:L,disabled:l,statusSelect:$,fieldOptions:d,registry:u,onUpdate:F=>w(L.rowKey,F),onRemove:()=>k(L.rowKey)},L.rowKey))})})}),r.jsxs("button",{type:"button",onClick:v,disabled:l,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add rung"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),r.jsx("div",{className:"space-y-2",children:e.disposition.map(L=>L.when===null?r.jsxs("div",{className:"surface-panel flex items-center gap-3 px-3 py-2",children:[r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"otherwise"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:L.is,onChange:F=>S(L.rowKey,{is:F.target.value}),disabled:l,className:`${P} font-mono`,children:Ak.map(F=>r.jsx("option",{value:F,children:F},F))})]},L.rowKey):r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2",children:[r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(J2,{value:L.when,onChange:F=>S(L.rowKey,{when:F}),fieldOptions:d,registry:u,disabled:l})}),r.jsxs("div",{className:"flex items-center gap-2 pt-5",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:L.is,onChange:F=>S(L.rowKey,{is:F.target.value}),disabled:l,className:`${P} font-mono`,children:Ak.map(F=>r.jsx("option",{value:F,children:F},F))}),r.jsx("button",{type:"button",onClick:()=>I(L.rowKey),disabled:l,className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove disposition rule",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})]},L.rowKey))}),r.jsxs("button",{type:"button",onClick:T,disabled:l,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add disposition rule"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Headline projection"}),r.jsxs("div",{className:"surface-panel grid grid-cols-1 gap-3 px-3 py-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When parked, show"}),$(e.headline.parked,L=>R("parked",L),"Parked headline status")]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),$(e.headline.blocked,L=>R("blocked",L),"Blocked headline status")]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Terminal statuses: ",r.jsx("span",{className:"font-mono",children:"passthrough"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Active: ",r.jsx("span",{className:"font-mono",children:"phase"})]})]})]})]})}function qW({rung:e,disabled:t,statusSelect:n,fieldOptions:s,registry:o,onUpdate:i,onRemove:l}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=cp({id:e.rowKey}),C={transform:ns.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};return r.jsxs("div",{ref:m,style:C,className:`surface-panel flex flex-wrap items-start gap-3 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:h,...u,...d,type:"button","aria-label":"Drag to reorder rung",className:"mt-1 cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Yi,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-[10rem] space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase"}),n(e.phase,w=>i({phase:w}),"Rung phase")]}),r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(J2,{value:e.when,onChange:w=>i({when:w}),fieldOptions:s,registry:o,disabled:t})}),r.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:e.next,onChange:w=>i({next:w.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),r.jsx("button",{type:"button",onClick:l,disabled:t,className:"mt-5 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove rung",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})}const GW=new Map([["pending:start","in_progress"],["pending:block","blocked"],["draft:shape","ready_for_planning"],["draft:start","in_progress"],["ready_for_planning:plan-ready","ready_to_implement"],["ready_for_planning:start","in_progress"],["ready_to_implement:implement","in_progress"],["in_progress:block","blocked"],["in_progress:review","review"],["in_progress:complete","completed"],["in_progress:fail","failed"],["blocked:unblock","in_progress"],["review:start","in_progress"],["review:complete","completed"],["review:fail","failed"],["completed:reopen","in_progress"],["failed:reopen","in_progress"]]);let Pk=0;function X2(){return Pk+=1,`tr_${Pk}_${Math.random().toString(36).slice(2,8)}`}function YW(e){return{rowKey:X2(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function Dk(e){return e.map(YW)}function JW(e){const t={from:e.from,command:e.command,to:e.to};return e.label.trim()&&(t.label=e.label.trim()),e.description.trim()&&(t.description=e.description.trim()),e.requiresReason&&(t.requiresReason=!0),t}function QW(e){return e.map(JW)}function Z2(){const e=[];for(const[t,n]of GW){const s=t.indexOf(":");e.push({from:t.slice(0,s),command:t.slice(s+1),to:n})}return e}function eT(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function $k(e){const t=[],n=new Map;for(const s of e){let o=n.get(s.from);o||(o={from:s.from,rows:[]},n.set(s.from,o),t.push(o)),o.rows.push(s)}return t}function tT(e,t){const n=[];for(const s of e)t.has(s.from)||n.push(`transition ${s.from} --${s.command}--> ${s.to}: "${s.from}" is not a defined status`),t.has(s.to)||n.push(`transition ${s.from} --${s.command}--> ${s.to}: "${s.to}" is not a defined status`);return n}function XW({value:e,customizing:t,statuses:n,knownCommands:s,onChange:o,onCustomize:i,disabled:l}){const u=f.useMemo(()=>new Set(n.map(S=>S.id)),[n]),d=f.useMemo(()=>{const S=new Map(n.map(T=>[T.id,T.label]));return T=>S.get(T)??T},[n]),[m,h]=f.useState(""),g="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";if(!t&&e.length===0){const S=eT(Z2(),u),T=$k(S);return r.jsx(We,{title:"Transitions",description:"Which commands move an assignment between statuses. Showing the built-in defaults.",actions:r.jsx("button",{type:"button",onClick:i,disabled:l,className:"shell-action text-xs",children:"Customize defaults"}),children:T.length===0?r.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No built-in transitions apply to the current statuses."}):r.jsx("div",{className:"space-y-3",children:T.map(I=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsx("h4",{className:"mb-1 text-xs font-semibold text-foreground",children:d(I.from)}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:I.rows.map((R,P)=>r.jsxs("li",{children:[R.command," → ",d(R.to)," ",r.jsxs("span",{className:"opacity-60",children:["(",R.to,")"]})]},P))})]},I.from))})})}const y=tT(e,u),b=$k(e),C=n.filter(S=>!b.some(T=>T.from===S.id));function w(S,T){o(e.map(I=>I.rowKey===S?{...I,...T}:I))}function v(S){o(e.filter(T=>T.rowKey!==S))}function k(S){var I;const T={rowKey:X2(),from:S,command:s[0]??"",to:((I=n[0])==null?void 0:I.id)??"",label:"",description:"",requiresReason:!1};o([...e,T])}function E(){m&&(k(m),h(""))}return r.jsxs(We,{title:"Transitions",description:"Which commands move an assignment between statuses, grouped by the from-status.",children:[y.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These transitions won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:y.map((S,T)=>r.jsx("li",{children:S},T))})]}),r.jsx("div",{className:"space-y-3",children:b.map(S=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsxs("h4",{className:"mb-2 text-xs font-semibold text-foreground",children:[d(S.from)," ",r.jsxs("span",{className:"font-mono text-muted-foreground",children:["(",S.from,")"]})]}),r.jsx("div",{className:"space-y-2",children:S.rows.map(T=>r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("input",{type:"text",list:"transition-command-names",value:T.command,onChange:I=>w(T.rowKey,{command:I.target.value}),disabled:l,placeholder:"command",className:`${g} w-28 font-mono`}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsxs("select",{value:T.to,onChange:I=>w(T.rowKey,{to:I.target.value}),disabled:l,"aria-label":"Target status",className:`${g} font-mono`,children:[!u.has(T.to)&&T.to!==""&&r.jsx("option",{value:T.to,children:T.to}),n.map(I=>r.jsxs("option",{value:I.id,children:[I.label," (",I.id,")"]},I.id))]}),r.jsx("input",{type:"text",value:T.label,onChange:I=>w(T.rowKey,{label:I.target.value}),disabled:l,placeholder:"label (optional)",className:`${g} w-32`}),r.jsx("input",{type:"text",value:T.description,onChange:I=>w(T.rowKey,{description:I.target.value}),disabled:l,placeholder:"description (optional)",className:`${g} w-40`}),r.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx("button",{type:"button",role:"switch","aria-checked":T.requiresReason,"aria-label":"Requires reason",onClick:()=>w(T.rowKey,{requiresReason:!T.requiresReason}),disabled:l,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${T.requiresReason?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${T.requiresReason?"translate-x-4":"translate-x-0"}`})}),"needs reason"]}),r.jsx("button",{type:"button",onClick:()=>v(T.rowKey),disabled:l,className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove transition",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]},T.rowKey))}),r.jsxs("button",{type:"button",onClick:()=>k(S.from),disabled:l,className:"mt-2 shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add transition"]})]},S.from))}),C.length>0&&r.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r.jsxs("select",{value:m,onChange:S=>h(S.target.value),disabled:l,"aria-label":"Add rules for status",className:`${g} font-mono`,children:[r.jsx("option",{value:"",children:"Add rules for status…"}),C.map(S=>r.jsxs("option",{value:S.id,children:[S.label," (",S.id,")"]},S.id))]}),r.jsxs("button",{type:"button",onClick:E,disabled:l||!m,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(jt,{className:"h-3 w-3"}),"Add status rules"]})]}),r.jsx("datalist",{id:"transition-command-names",children:s.map(S=>r.jsx("option",{value:S},S))})]})}function ZW(e){const t=[];e.transitions>0&&t.push({tab:"Transitions",count:e.transitions}),e.derive>0&&t.push({tab:"Derive Rules",count:e.derive}),e.facts>0&&t.push({tab:"Facts",count:e.facts});const n=e.transitions+e.derive+e.facts,s=n===0?"Unsaved changes":`Fix errors in ${t.map(o=>o.tab).join(", ")} to save`;return{total:n,offending:t,message:s}}function eH(){var Ee;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[o,i]=f.useState(!1),[l,u]=f.useState([]),[d,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,w]=f.useState(new Set),[v,k]=f.useState(new Map),[E,S]=f.useState({open:!1}),[T,I]=f.useState([]),[R,P]=f.useState([]),[$,L]=f.useState({open:!1}),[F,A]=f.useState(()=>jg(Hd)),[z,V]=f.useState(!1),[O,B]=f.useState(!1),[K,q]=f.useState(!1),[_,G]=f.useState([]),[D,H]=f.useState(!1),[Z,U]=f.useState([]),[oe,ue]=f.useState("statuses"),re=f.useCallback(ve=>{const ee=TW(ve);u(ee),i(ve.custom),w(new Set(ee.map(fe=>fe.id))),k(new Map),I(ve.rawFacts??[]),P([]),A(jg(ve.derive??Hd)),V(ve.deriveCustom??!1),B(!1),q(!1),G(Dk(ve.transitions??[])),H(ve.transitionsCustom??!1),U(ve.knownCommands??[]),b(!1)},[]),xe=f.useCallback(async()=>{try{const ve=await fetch("/api/config/statuses");if(!ve.ok)throw new Error(`HTTP ${ve.status}`);const ee=await ve.json();re(ee),s(null)}catch(ve){s(ve instanceof Error?ve.message:"Failed to load config")}finally{t(!1)}},[re]);f.useEffect(()=>{xe()},[xe]);function ke(){setTimeout(()=>g(null),3e3)}const Pe=f.useMemo(()=>l.map(ve=>({id:ve.id,label:ve.label})),[l]),De=f.useMemo(()=>new Set(l.map(ve=>ve.id)),[l]),Xe=f.useMemo(()=>WW(T),[T]),st=f.useMemo(()=>$y(Xe),[Xe]),Ze=f.useMemo(()=>RW(T),[T]),ot=f.useMemo(()=>{try{return Q2(wx(F),l,st)}catch{return["derive rules are malformed"]}},[F,l,st]),le=f.useMemo(()=>D?tT(_,De):[],[_,D,De]),Re=Ze.length+ot.length+le.length,Se=f.useCallback(ve=>{I(ve),b(!0)},[]),Oe=f.useCallback(ve=>{A(ve),B(!0),q(!1),V(!0),b(!0)},[]),ze=f.useCallback(()=>{A(jg(Hd)),q(!0),B(!0),V(!1),b(!0)},[]),et=f.useCallback(ve=>{G(ve),b(!0)},[]),_e=f.useCallback(()=>{G(ve=>ve.length>0?ve:Dk(eT(Z2(),De))),H(!0),b(!0)},[De]);async function qe(ve=R){m(!0),g(null);try{const{body:ee}=vW({statuses:l,order:l.map(ce=>ce.id),pendingResolutions:v,facts:T,factRemovalAcks:ve,derive:K?null:O?wx(F):void 0,transitions:D?QW(_):void 0}),fe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ee)});if(!fe.ok){const ce=await fe.json().catch(()=>null);if(fe.status===409&&(ce==null?void 0:ce.error)==="unresolved-fact-references"&&ce.references){L({open:!0,references:ce.references}),m(!1);return}if((ce==null?void 0:ce.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(ce.problems??[]).join("; ")}`);if((ce==null?void 0:ce.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(ce.problems??[]).join("; ")}`);if((ce==null?void 0:ce.error)==="invalid-facts")throw new Error(`Invalid facts: ${(ce.problems??[]).join("; ")}`);if(fe.status===409&&(ce==null?void 0:ce.error)==="unresolved-orphans"){const pt=Array.isArray(ce.unresolved)?ce.unresolved.map(xt=>xt.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${pt}. Click the trash icon on each row to choose remap or delete.`)}if(fe.status===409&&(ce==null?void 0:ce.error)==="concurrent-edit"){const pt=ce.applied?` (${ce.applied.remapped} remapped, ${ce.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${pt}: ${ce.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await xe();return}if(fe.status===500&&(ce==null?void 0:ce.error)==="config-write-failed"&&(ce!=null&&ce.applied)){const{remapped:pt,deleted:xt}=ce.applied,St=ce.message?`: ${ce.message}`:"";g({type:"error",message:`Resolutions applied (${pt} remapped, ${xt} deleted) but the status config write failed${St}. Click Save again to retry.`}),await xe();return}throw(ce==null?void 0:ce.error)==="invalid-remap-target"?new Error(`Invalid remap target (${ce.reason}): ${ce.id} → ${ce.target}.`):(ce==null?void 0:ce.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(ce.ids??[]).join(", ")}`):(ce==null?void 0:ce.error)==="stale-resolution"?new Error(`Stale resolution for id "${ce.id??"?"}".`):(ce==null?void 0:ce.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${ce.message??"unknown"}`):(ce==null?void 0:ce.error)==="remap-write-failed"||(ce==null?void 0:ce.error)==="delete-failed"||(ce==null?void 0:ce.error)==="scan-failed"?new Error(`${ce.error}: ${ce.cause??"unknown"}`):new Error((ce==null?void 0:ce.error)??`Save failed (HTTP ${fe.status})`)}const Ne=await fe.json();re(Ne),bj();const He=Ne.applied?` (${Ne.applied.remapped} remapped, ${Ne.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${He}`}),ke()}catch(ee){g({type:"error",message:ee instanceof Error?ee.message:"Save failed"})}finally{m(!1)}}async function Lt(){m(!0),g(null);try{const ve=await fetch("/api/config/statuses",{method:"DELETE"});if(!ve.ok)throw new Error("Reset failed");const ee=await ve.json();re(ee),bj(),g({type:"success",message:"Reset to defaults"}),ke()}catch(ve){g({type:"error",message:ve instanceof Error?ve.message:"Reset failed"})}finally{m(!1)}}function bt(ve,ee,fe){u(Ne=>{const He=[...Ne];return He[ve]={...He[ve],[ee]:fe},He}),b(!0)}function ut(){const ve=`status_${l.length+1}`;u(ee=>[...ee,{rowKey:q2(),id:ve,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function ae(ve){u(ee=>{const fe=ee.filter(He=>He.id!==ve),Ne=new Set(fe.map(He=>He.id));return k(He=>Ck(He,Ne)),fe}),b(!0)}async function X(ve){const ee=l[ve].id,fe=wW(ee,F,_),Ne=jW(ee,F);if(!C.has(ee)){if(fe.length===0){ae(ee);return}S({open:!0,affected:{id:ee,count:0,truncated:!1,assignments:[]},pendingId:ee,ruleReferences:fe,headlineReferences:Ne});return}try{const He=await fetch(`/api/config/statuses/affected/${encodeURIComponent(ee)}`);if(!He.ok)throw new Error(`HTTP ${He.status}`);const ce=await He.json();if(ce.count===0&&fe.length===0){ae(ee);return}S({open:!0,affected:ce,pendingId:ee,ruleReferences:fe,headlineReferences:Ne})}catch(He){g({type:"error",message:`Could not check affected assignments for "${ee}": ${He instanceof Error?He.message:String(He)}`})}}function he(ve,ee){if(!E.open)return;const{pendingId:fe,affected:Ne,ruleReferences:He}=E;if(fe!==ve.id){S({open:!1});return}if(!l.some(ce=>ce.id===fe)){g({type:"error",message:`Row for "${fe}" was already removed — modal action ignored.`}),S({open:!1});return}ve.mode==="remap"?(A(ce=>kW(ce,fe,ee)),G(ce=>SW(ce,fe,ee))):(A(ce=>NW(ce,fe,ee)),G(ce=>CW(ce,fe))),He.some(ce=>ce.section!=="transitions")&&(B(!0),V(!0)),u(ce=>{const pt=ce.filter(St=>St.id!==fe),xt=new Set(pt.map(St=>St.id));return k(St=>{const at=Ck(St,xt),me=new Map(at);return Ne.count>0&&me.set(fe,ve),me}),pt}),b(!0),S({open:!1})}function ne(){if(!$.open)return;const ve=$.references.map(fe=>fe.factName),ee=Array.from(new Set([...R,...ve]));P(ee),L({open:!1}),qe(ee)}function ye(){S({open:!1})}return e?r.jsx(mt,{label:"Loading workflow..."}):n?r.jsx(kt,{error:n}):r.jsx(ma,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:`flex items-center justify-between rounded-lg border px-4 py-3 text-sm ${o?"border-primary/30 bg-primary/5 text-primary":"border-border/60 bg-muted/30 text-muted-foreground"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Dx,{className:"h-4 w-4"}),o?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:Lt,disabled:d||!o&&!y,children:[r.jsx(Cs,{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(Np,{value:oe,onValueChange:ue,items:[{value:"statuses",label:"Statuses",content:r.jsx(bW,{statuses:l,savedStatusIds:C,onUpdate:bt,onAdd:ut,onRemove:X,onReorder:ve=>{u(ve),b(!0)}})},{value:"transitions",label:"Transitions",problemCount:le.length,content:r.jsx(XW,{value:_,customizing:D,statuses:Pe,knownCommands:Z,onChange:et,onCustomize:_e,disabled:d})},{value:"derive",label:"Derive Rules",problemCount:ot.length,content:r.jsx(KW,{value:F,deriveCustom:z,statuses:Pe,acceptedFacts:Xe,onChange:Oe,onReset:ze,disabled:d})},{value:"facts",label:"Facts",problemCount:Ze.length,content:r.jsx(LW,{rows:T,onChange:Se,saving:d})}]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:()=>void qe(),disabled:d||!y||Re>0,children:[r.jsx(zf,{className:"h-3.5 w-3.5"}),d?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),xe()},disabled:d,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ZW({transitions:le.length,derive:ot.length,facts:Ze.length}).message})]})]}),E.open&&r.jsx(hW,{open:E.open,affected:{...E.affected,label:((Ee=l.find(ve=>ve.id===E.affected.id))==null?void 0:Ee.label)??E.affected.id},remaining:l.filter(ve=>ve.id!==E.affected.id&&C.has(ve.id)).map(ve=>({id:ve.id,label:ve.label})),ruleReferences:E.ruleReferences,headlineReferences:E.headlineReferences,onResolve:he,onCancel:ye}),r.jsx(gW,{open:$.open,references:$.open?$.references:[],onConfirm:ne,onCancel:()=>{L({open:!1}),m(!1)}})]})})}const Ws=e=>`${e.workspace}::${e.id}`;function Lk(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function tH(){var ve;const{data:e,loading:t,error:n,refetch:s}=VS(),o=_t(),[i,l]=f.useState(""),u=f.useRef(null);Lo("list:todos");const[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[C,w]=f.useState("_global"),[v,k]=f.useState(null),[E,S]=f.useState(null),[T,I]=f.useState(new Set),[R,P]=f.useState(!1),$=f.useRef(null),[L,F]=f.useState(null),A=sb("all"),[z,V]=f.useState(null),[O,B]=f.useState(null),K=f.useRef(null);f.useEffect(()=>{let ee=!1;return(async()=>{try{const fe=await fetch("/api/projects");if(!fe.ok)return;const Ne=await fe.json();ee||F(Ne.filter(He=>!He.archived))}catch{}})(),()=>{ee=!0}},[]);async function q(ee,fe){ee.stopPropagation(),await su(fe)&&(k(fe),setTimeout(()=>k(Ne=>Ne===fe?null:Ne),1500))}const _=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const ee=[];for(const fe of e.workspaces)for(const Ne of fe.items)ee.push({...Ne,workspace:fe.workspace});return ee},[e]),G=f.useMemo(()=>{const ee=new Set;for(const fe of _)for(const Ne of fe.tags)ee.add(Ne);return Array.from(ee).sort()},[_]),D=f.useMemo(()=>{let ee=_;if(i.trim()){const fe=i.toLowerCase();ee=ee.filter(Ne=>Ne.description.toLowerCase().includes(fe)||Ne.tags.some(He=>He.toLowerCase().includes(fe))||Ne.id.includes(fe))}return d&&(ee=ee.filter(fe=>fe.status===d)),h&&(ee=ee.filter(fe=>fe.tags.includes(h))),ee},[_,i,d,h]);f.useEffect(()=>{I(new Set),$.current=null},[i,d,h]);const H=f.useMemo(()=>D.filter(ee=>T.has(Ws(ee))),[D,T]),Z=D.length>0&&H.length===D.length,U=H.length>0&&!Z,oe=f.useMemo(()=>{if(H.length===0)return null;const ee=new Set(H.map(fe=>fe.workspace));return ee.size===1?[...ee][0]:null},[H]),ue=f.useMemo(()=>{if(!oe||!L)return;const ee=L.filter(fe=>fe.workspace===oe);return ee.length===1?ee[0].slug:void 0},[oe,L]),re=((ve=H[0])==null?void 0:ve.description)??"",xe=f.useMemo(()=>{if(oe)return null;const ee=new Map;for(const fe of H)ee.has(fe.workspace)||ee.set(fe.workspace,[]),ee.get(fe.workspace).push(fe.id);return Array.from(ee,([fe,Ne])=>({workspace:fe,todoIds:Ne}))},[H,oe]),ke=oe?{kind:"workspace",workspace:oe}:{kind:"aggregate",groups:xe??[]};function Pe(ee,fe,Ne){const He=Ws(ee),ce=!!(Ne&&"shiftKey"in Ne&&Ne.shiftKey),pt=$.current?_e.findIndex(xt=>Ws(xt)===$.current):-1;if(ce&&pt!==-1){const xt=Math.min(pt,fe),St=Math.max(pt,fe);I(at=>{const me=new Set(at);for(let Me=xt;Me<=St;Me++){const Ye=_e[Me];Ye&&me.add(Ws(Ye))}return me})}else I(xt=>{const St=new Set(xt);return St.has(He)?St.delete(He):St.add(He),St});$.current=He}function De(){I(ee=>{const fe=new Set(ee);if(Z)for(const Ne of D)fe.delete(Ws(Ne));else for(const Ne of D)fe.add(Ws(Ne));return fe})}function Xe(){I(new Set),$.current=null}function st(ee){Xe(),s(),ee!=null&&ee.assignmentRef&&o(Lk(ee.assignmentRef))}const Ze=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const ee={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const fe of e.workspaces)ee.open+=fe.counts.open,ee.in_progress+=fe.counts.in_progress,ee.completed+=fe.counts.completed,ee.blocked+=fe.counts.blocked,ee.total+=fe.counts.total;return ee},[e]);async function ot(){y.trim()&&(await Ux(C,y.trim()),b(""),s())}async function le(ee,fe,Ne){switch(Ne){case"open":await YS(ee,fe);break;case"in_progress":await GS(ee,fe);break;case"completed":await KS(ee,fe);break;case"blocked":await qS(ee,fe);break}s()}async function Re(ee,fe){await JS(ee,fe),s()}async function Se(ee,fe,Ne){await QS(ee,fe,Ne),s()}async function Oe(ee,fe,Ne){await XS(ee,fe,Ne),s()}async function ze(ee,fe,Ne){await ZS(ee,fe,Ne),s()}const et=rb(D),_e=et.filter(ee=>!A.isCollapsed(ee.config.id)).flatMap(ee=>ee.items),{hotkeyRowProps:qe}=Gc(_e,{scope:"list:todos",bindO:!1,onOpen:ee=>S(Ws(ee))});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ee;return(ee=u.current)==null?void 0:ee.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[Lt,bt]=is(),ut=Lt.get("focus");f.useEffect(()=>{if(!ut)return;const ee=_.find(Ne=>Ne.id===ut);if(!ee)return;const fe=Rp(ee.status);A.isCollapsed(fe)&&A.toggle(fe)},[ut,_]),f.useEffect(()=>{if(!ut)return;const ee=document.querySelector(`[data-todo-id="${CSS.escape(ut)}"]`);if(!ee)return;ee.scrollIntoView({block:"nearest"}),ee.classList.add("ring-2","ring-primary/60");const fe=window.setTimeout(()=>{ee.classList.remove("ring-2","ring-primary/60"),bt(Ne=>{const He=new URLSearchParams(Ne);return He.delete("focus"),He})},1500);return()=>window.clearTimeout(fe)},[ut,_e.length,bt]);const ae=z?D.find(ee=>Ws(ee)===z)??null:null;function X(ee,fe){const Ne=K.current;if(Ne!=null&&Ne.closest(Hi)){ee.preventDefault();return}ee.dataTransfer.effectAllowed="move",ee.dataTransfer.setData("text/plain",fe),V(fe)}function he(){V(null),B(null)}function ne(ee,fe){!ae||fe.statuses.includes(ae.status)||(ee.preventDefault(),ee.dataTransfer.dropEffect="move",B(fe.id))}function ye(ee,fe){O===fe.id&&!ee.currentTarget.contains(ee.relatedTarget)&&B(null)}function Ee(ee,fe){ee.preventDefault();const Ne=ae;he(),!(!Ne||fe.statuses.includes(Ne.status))&&le(Ne.workspace,Ne.id,fe.dropStatus)}return t?r.jsx(mt,{label:"Loading todos..."}):n?r.jsx(kt,{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(_n,{label:"Open",value:Ze.open,icon:Fr}),r.jsx(_n,{label:"In Progress",value:Ze.in_progress,icon:$x,tone:"info"}),r.jsx(_n,{label:"Blocked",value:Ze.blocked,icon:Ox,tone:"warn"}),r.jsx(_n,{label:"Completed",value:Ze.completed,icon:Fr,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:ee=>w(ee.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(ee=>ee.workspace!=="_global").map(ee=>r.jsx("option",{value:ee.workspace,children:ee.workspace},ee.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:ee=>b(ee.target.value),onKeyDown:ee=>ee.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(jt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:i,onChange:ee=>l(ee.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:d,onChange:ee=>m(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:h,onChange:ee=>g(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ee=>r.jsxs("option",{value:ee,children:["#",ee]},ee))]})]}),H.length>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[H.length," selected",oe?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:oe}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(H.map(ee=>ee.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>P(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:Xe,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,D.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:Z,ref:ee=>{ee&&(ee.indeterminate=U)},onChange:De,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",D.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ee=-1;return et.map(({config:fe,items:Ne})=>{const He=!A.isCollapsed(fe.id);return r.jsx(nb,{label:fe.label,count:Ne.length,expanded:He,onToggle:()=>A.toggle(fe.id),isDropTarget:O===fe.id,onDragOver:ce=>ne(ce,fe),onDragLeave:ce=>ye(ce,fe),onDrop:ce=>Ee(ce,fe),children:He&&Ne.map(ce=>{ee+=1;const pt=ee,xt=Ws(ce),St=T.has(xt);return r.jsxs("div",{draggable:!0,"data-todo-id":ce.id,...qe(pt),onMouseDown:at=>{K.current=at.target},onDragStart:at=>X(at,xt),onDragEnd:he,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${St?"ring-1 ring-foreground/20":""} ${z===xt?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${ce.id}`,title:"Select",checked:St,onChange:()=>{},onClick:at=>{at.stopPropagation(),Pe(ce,pt,at)},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(ZE,{status:ce.status,onChange:at=>le(ce.workspace,ce.id,at)})}),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(t2,{description:ce.description,status:ce.status,editing:E===xt,onBeginEdit:()=>S(xt),onEndEdit:()=>S(null),onSave:at=>Se(ce.workspace,ce.id,at)}),ce.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:ce.tags.map(at=>`#${at}`).join(" ")}),ce.linkedAssignmentRef?r.jsxs(Te,{to:Lk(ce.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:at=>at.stopPropagation(),children:[r.jsx(oS,{className:"h-2.5 w-2.5"}),ce.linkedAssignmentRef.includes("/")?ce.linkedAssignmentRef:`oneoff:${ce.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(n2,{item:ce,attachmentUrl:(at,me)=>Wx(ce.workspace,at,me),onAdd:at=>Oe(ce.workspace,ce.id,at),onDelete:at=>ze(ce.workspace,ce.id,at)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:ce.workspace!=="_global"&&r.jsx(Te,{to:`/w/${ce.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:at=>at.stopPropagation(),children:ce.workspace})}),v===ce.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Tr,{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:at=>q(at,ce.id),children:["t:",ce.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:at=>q(at,ce.id),children:r.jsx(of,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:at=>{at.stopPropagation(),Re(ce.workspace,ce.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${ce.workspace}-${ce.id}`)})},fe.id)})})()}),r.jsx(tb,{open:R,selectedIds:H.map(ee=>ee.id),scope:ke,onOpenChange:P,onDone:st,defaultProject:ue,defaultTitle:re,allowOneOff:!0})]})}const nH={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 rH({bundle:e}){const t=nH[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 sH({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(rH,{bundle:n},n.id))]})}function oH(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,l]=f.useState(null),u=f.useCallback(async()=>{try{const d=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),l(null)}catch(d){l(d instanceof Error?d.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Xi(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function aH(){const{workspace:e}=Mt(),t=e||"_global",{data:n,loading:s,error:o,refetch:i}=TD(t),{data:l}=oH(t),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,C]=f.useState(""),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(new Set),[I,R]=f.useState(!1),[P,$]=f.useState(!1),[L,F]=f.useState(null),A=f.useRef(null);Lo("list:todos");const z=sb("workspace:"+t),[V,O]=f.useState(null),[B,K]=f.useState(null),q=f.useRef(null);async function _(ne,ye){ne.stopPropagation(),await su(ye)&&(v(ye),setTimeout(()=>v(Ee=>Ee===ye?null:Ee),1500))}const G=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const ne=new Set;for(const ye of n.items)for(const Ee of ye.tags)ne.add(Ee);return Array.from(ne).sort()},[n]),D=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let ne=n.items;if(u.trim()){const ye=u.toLowerCase();ne=ne.filter(Ee=>Ee.description.toLowerCase().includes(ye)||Ee.tags.some(ve=>ve.toLowerCase().includes(ye))||Ee.id.includes(ye))}return m&&(ne=ne.filter(ye=>ye.status===m)),g&&(ne=ne.filter(ye=>ye.tags.includes(g))),ne},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const H=f.useMemo(()=>D.filter(ne=>S.has(ne.id)).length,[D,S]),Z=D.length>0&&H===D.length,U=H>0&&!Z;function oe(ne){T(ye=>{const Ee=new Set(ye);return Ee.has(ne)?Ee.delete(ne):Ee.add(ne),Ee})}function ue(){T(ne=>{const ye=new Set(ne);if(Z)for(const Ee of D)ye.delete(Ee.id);else for(const Ee of D)ye.add(Ee.id);return ye})}function re(){T(new Set)}const xe=L?[L]:Array.from(S);function ke(){T(new Set),F(null),i()}function Pe(){T(new Set),i()}async function De(){b.trim()&&(await Ux(t,b.trim()),C(""),i())}async function Xe(ne,ye,Ee){ne.stopPropagation(),window.confirm(`Delete "${Ee}"? This can't be undone.`)&&(await JS(t,ye),i())}async function st(ne,ye){switch(ye){case"open":await YS(t,ne);break;case"in_progress":await GS(t,ne);break;case"completed":await KS(t,ne);break;case"blocked":await qS(t,ne);break}i()}async function Ze(ne,ye){await QS(t,ne,ye),i()}async function ot(ne,ye){await XS(t,ne,ye),i()}async function le(ne,ye){await ZS(t,ne,ye),i()}const Re=rb(D),Se=Re.filter(ne=>!z.isCollapsed(ne.config.id)).flatMap(ne=>ne.items),{hotkeyRowProps:Oe}=Gc(Se,{scope:"list:todos",bindO:!1,onOpen:ne=>E(ne.id)});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ne;return(ne=A.current)==null?void 0:ne.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[ze,et]=is(),_e=ze.get("focus");f.useEffect(()=>{if(!_e||!(n!=null&&n.items))return;const ne=n.items.find(Ee=>Ee.id===_e);if(!ne)return;const ye=Rp(ne.status);z.isCollapsed(ye)&&z.toggle(ye)},[_e,n==null?void 0:n.items]),f.useEffect(()=>{if(!_e)return;const ne=document.querySelector(`[data-todo-id="${window.CSS.escape(_e)}"]`);if(!ne)return;ne.scrollIntoView({block:"nearest"}),ne.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{ne.classList.remove("ring-2","ring-primary/60"),et(Ee=>{const ve=new URLSearchParams(Ee);return ve.delete("focus"),ve})},1500);return()=>window.clearTimeout(ye)},[_e,Se.length,et]);const qe=V?(n==null?void 0:n.items.find(ne=>ne.id===V))??null:null;function Lt(ne,ye){const Ee=q.current;if(Ee!=null&&Ee.closest(Hi)){ne.preventDefault();return}ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("text/plain",ye),O(ye)}function bt(){O(null),K(null)}function ut(ne,ye){!qe||ye.statuses.includes(qe.status)||(ne.preventDefault(),ne.dataTransfer.dropEffect="move",K(ye.id))}function ae(ne,ye){B===ye.id&&!ne.currentTarget.contains(ne.relatedTarget)&&K(null)}function X(ne,ye){ne.preventDefault();const Ee=qe;bt(),!(!Ee||ye.statuses.includes(Ee.status))&&st(Ee.id,ye.dropStatus)}if(s)return r.jsx(mt,{label:"Loading todos..."});if(o)return r.jsx(kt,{error:o});const he=(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(_n,{label:"Open",value:he.open,icon:Fr}),r.jsx(_n,{label:"In Progress",value:he.in_progress,icon:Fr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:he.blocked,icon:Ox,tone:"warn"}),r.jsx(_n,{label:"Total",value:he.total,icon:Fr})]}),l&&r.jsx(sH,{bundles:l.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:ne=>C(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&De(),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:De,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(jt,{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(Do,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:A,type:"text",placeholder:"Search...",value:u,onChange:ne=>d(ne.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:ne=>h(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:g,onChange:ne=>y(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ne=>r.jsxs("option",{value:ne,children:["#",ne]},ne))]})]}),S.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[S.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{F(null),$(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:re,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,D.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:Z,ref:ne=>{ne&&(ne.indeterminate=U)},onChange:ue,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",D.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ne=-1;return Re.map(({config:ye,items:Ee})=>{const ve=!z.isCollapsed(ye.id);return r.jsx(nb,{label:ye.label,count:Ee.length,expanded:ve,onToggle:()=>z.toggle(ye.id),isDropTarget:B===ye.id,onDragOver:ee=>ut(ee,ye),onDragLeave:ee=>ae(ee,ye),onDrop:ee=>X(ee,ye),children:ve&&Ee.map(ee=>(ne+=1,r.jsx(e2,{item:ee,copiedId:w,selected:S.has(ee.id),editing:k===ee.id,onBeginEdit:fe=>E(fe),onEndEdit:()=>E(null),onPatchDescription:Ze,onAddAttachments:ot,onDeleteAttachment:le,attachmentUrl:(fe,Ne)=>Wx(t,fe,Ne),onToggleSelected:fe=>oe(fe),onMoveOne:(fe,Ne)=>{Ne.stopPropagation(),F(fe),$(!0)},onStatusChange:st,onCopyId:_,onDelete:Xe,hotkeyRowProps:Oe(ne),onDragOrigin:fe=>{q.current=fe.target},onDragStart:Lt,onDragEnd:bt,isDragging:V===ee.id},ee.id)))},ye.id)})})()}),r.jsx(tb,{open:I,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:Pe}),r.jsx(s2,{open:P,selectedIds:xe,scope:{kind:"workspace",workspace:t},onOpenChange:ne=>{$(ne),ne||F(null)},onDone:ke})]})}function nT(){const{views:e}=Zc();async function t(i,l,u){const d=e.find(g=>g.id===i.id)??i,m=UC(u,d.workspace).config,h=kf(d.config,m,d.config);await yf(i.id,{name:l,config:h})}async function n(i,l,u){const d=e.find(g=>g.id===i.id)??i,m=Ly(u,d.workspace).config,h=kf(d.config,m,d.config);await yf(i.id,{name:l,config:h})}async function s(i){await Bi({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await v5(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:o}}const Ik=80,iH={kanban:"Kanban",list:"List",table:"Table"},lH={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function rT({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:o}){const i=!!s,l=cs(),u=qc(),{data:d}=Ts(),{data:m}=Uf(),[h,g]=f.useState(""),[y,b]=f.useState(ci.viewMode),[C,w]=f.useState([]),[v,k]=f.useState([]),[E,S]=f.useState([]),[T,I]=f.useState([]),[R,P]=f.useState([]),[$,L]=f.useState([]),[F,A]=f.useState("all"),[z,V]=f.useState(null),[O,B]=f.useState(""),[K,q]=f.useState(ci.sortField),[_,G]=f.useState(ci.sortDirection),[D,H]=f.useState(!1),[Z,U]=f.useState(null);function oe(){b(ci.viewMode),w([]),k([]),S([]),I([]),P([]),L([]),A("all"),V(null),B(""),q(ci.sortField),G(ci.sortDirection)}f.useEffect(()=>{if(e)if(U(null),H(!1),s){const le=s.config.filters;g(s.name),b(s.config.viewMode),w(Fe(le.status)),k(Fe(le.priority)),S(Fe(le.type)),I(Fe(le.project)),P(Fe(le.assignee)),L(Fe(le.tags)),A(le.activity??"all"),V(wp(le.dateRange)),B(le.search??""),q(s.config.sortField),G(s.config.sortDirection)}else g(""),oe()},[e,s]);const ue=le=>Re=>le?le==="_ungrouped"?Re.projectWorkspace===null:Re.projectWorkspace===le:!0,re=f.useMemo(()=>{const le=Se=>n?n==="_ungrouped"?Se.workspace===null:Se.workspace===n:!0,Re=(d??[]).filter(le);return[{value:"__standalone__",label:"No project"},...Re.map(Se=>({value:Se.slug,label:Se.title}))]},[d,n]),xe=f.useMemo(()=>{const le=new Set,Re=ue(n);for(const Oe of(m==null?void 0:m.assignments)??[])Re(Oe)&&Oe.assignee&&le.add(Oe.assignee);const Se=[{value:"__unassigned__",label:"Unassigned"}];for(const Oe of Array.from(le).sort())Se.push({value:Oe,label:Oe});return Se},[m,n]),ke=f.useMemo(()=>{const le=new Set,Re=ue(n);for(const Se of(m==null?void 0:m.assignments)??[])if(Re(Se))for(const Oe of Se.tags??[])le.add(Oe);return Array.from(le).sort().map(Se=>({value:Se,label:Se}))},[m,n]),Pe=f.useMemo(()=>l.order.map(le=>({value:le,label:Eo(l,le)})),[l]),De=f.useMemo(()=>KM.map(le=>({value:le,label:le[0].toUpperCase()+le.slice(1)})),[]),Xe=f.useMemo(()=>u.definitions.map(le=>({value:le.id,label:Ri(u,le.id)})),[u]),st=ay.map(le=>({value:le,label:iH[le]})),Ze=h.trim(),ot=Ze.length>0&&Ze.length<=Ik;return r.jsx(Ln,{open:e,onOpenChange:t,children:r.jsx(En,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async le=>{if(le.preventDefault(),!ot||D)return;H(!0),U(null);const Re={viewMode:y,filters:{status:C,priority:v,type:E,project:T,assignee:R,tags:$,activity:F,dateRange:ha(z),search:O},sortField:K,sortDirection:_};try{await o(Ze,Re)}catch(Se){U(Se instanceof Error?Se.message:String(Se)),H(!1)}},children:[r.jsx(Xn,{children:r.jsx(Tn,{children:i?"Edit view":"Create view"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),r.jsx("input",{id:"create-view-name",type:"text",value:h,autoFocus:!0,required:!0,maxLength:Ik,onChange:le=>g(le.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(kp,{value:y,onChange:le=>b(le),options:st})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ys,{label:"Status",children:r.jsx(xn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:Pe,value:C,onChange:w})}),r.jsx(ys,{label:"Priority",children:r.jsx(xn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:De,value:v,onChange:k})}),r.jsx(ys,{label:"Type",children:r.jsx(xn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Xe,value:E,onChange:S})}),r.jsx(ys,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:re,value:T,onChange:I})}),r.jsx(ys,{label:"Assignee",children:r.jsx(xn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:xe,value:R,onChange:P})}),r.jsx(ys,{label:"Tags",children:r.jsx(xn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:ke,value:$,onChange:L})}),r.jsx(ys,{label:"Activity",children:r.jsxs("select",{value:F,onChange:le=>A(le.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(ys,{label:"Date range",children:r.jsx(vp,{className:"w-full",value:z,onChange:V})}),r.jsx(ys,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:O,onChange:le=>B(le.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(ys,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:K,onChange:le=>q(le.target.value),className:"editor-input w-full",children:M1.map(le=>r.jsx("option",{value:le,children:lH[le]??le},le))}),r.jsx("button",{type:"button",onClick:()=>G(le=>le==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:_==="asc"?"Ascending":"Descending",children:_==="asc"?"Asc":"Desc"})]})})]}),Z?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Z}):null,r.jsxs(Rr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:oe,className:"shell-action",disabled:D,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:D,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||D,className:"shell-action shell-action--cta disabled:opacity-50",children:D?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function ys({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 cH={kanban:"Kanban",list:"List",table:"Table"},uH={assignment:"Assignment",session:"Session"},dH={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function Ok(){const{workspace:e}=Mt(),{views:t,loading:n}=Zc(),{submitEdit:s,submitEditSession:o,duplicate:i,remove:l}=nT(),{toast:u,showToast:d,dismissToast:m}=Io(),[h,g]=f.useState(null),[y,b]=f.useState(!1),[C,w]=f.useState(!1),[v,k]=f.useState(!1),[E,S]=f.useState(null);async function T(V,O){const{workspace:B,config:K}=UC(O,e??null);try{await Bi({name:V,workspace:B,config:K}),w(!1),d(`Created view "${V}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to create saved view"),q}}async function I(V,O){const{workspace:B,config:K}=Ly(O,e??null);try{await Bi({name:V,workspace:B,config:K,entityType:"session"}),k(!1),d(`Created session view "${V}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to create session view"),q}}async function R(V,O,B){try{await s(V,O,B),S(null),d(`Updated view "${O}"`)}catch(K){throw d(K instanceof Error?K.message:"Failed to update saved view"),K}}async function P(V,O,B){try{await o(V,O,B),S(null),d(`Updated session view "${O}"`)}catch(K){throw d(K instanceof Error?K.message:"Failed to update session view"),K}}async function $(V){try{await i(V),d(`Duplicated "${V.name}"`)}catch(O){d(O instanceof Error?O.message:"Failed to duplicate saved view")}}async function L(){if(h){b(!0);try{await l(h),g(null)}catch(V){d(V instanceof Error?V.message:"Failed to delete saved view")}finally{b(!1)}}}const F=r.jsxs("button",{type:"button",onClick:()=>w(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(jt,{className:"h-4 w-4"}),"Create view"]}),A=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(jt,{className:"h-4 w-4"}),"Create session view"]}),z=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Cf,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[A,F]})}),n?r.jsx(mt,{label:"Loading saved views…"}):t.length===0?r.jsx(wt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[A,F]})}):r.jsx(We,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(V=>r.jsx(fH,{view:V,onRequestDelete:()=>g(V),onRequestEdit:()=>S(V),onRequestDuplicate:()=>void $(V)},V.id))})}),r.jsx(rT,{open:C||!z&&E!==null,onOpenChange:V=>{V||(w(!1),z||S(null))},workspace:E&&!z?E.workspace:e??null,initialView:E&&!z?E:null,onSubmit:E&&!z?(V,O)=>R(E,V,O):T}),r.jsx(qC,{open:v||z&&E!==null,onOpenChange:V=>{V||(k(!1),z&&S(null))},workspace:E&&z?E.workspace:e??null,initialView:E&&z?E:null,onSubmit:E&&z?(V,O)=>P(E,V,O):I}),r.jsx(Na,{open:h!==null,title:"Delete saved view?",description:h?`Delete '${h.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:y,destructive:!0,onConfirm:L,onOpenChange:V=>{!V&&!y&&g(null)}}),r.jsx(ka,{toast:u,onDismiss:m})]})}function fH({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const o=_t(),i=()=>o(HC(e)),l=KC(e.config.filters),u=e.workspace?kn(e.workspace):null,d=e.entityType??"assignment",m=d==="session",h=m?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`:null;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"truncate text-left text-sm font-semibold text-foreground hover:text-primary",title:"Open view",children:e.name}),r.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 text-xs font-medium ${dH[d]??"bg-muted text-muted-foreground"}`,children:uH[d]??d}),!m&&r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:cH[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[l,h?` · ${h}`:""]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const pH={kanban:"Kanban",list:"List",table:"Table"};function _k(){const{id:e,workspace:t}=Mt(),n=_t(),{view:s,ready:o,error:i,refetch:l}=Ro(e),{submitEdit:u,duplicate:d,remove:m}=nT(),{toast:h,showToast:g,dismissToast:y}=Io(),[b,C]=f.useState(!1),[w,v]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!o||!s||(t??null)!==(s.workspace??null)&&n(HC(s),{replace:!0})},[o,s,t,n]),!o)return r.jsx(mt,{label:"Loading view…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),r.jsx("button",{type:"button",onClick:()=>l(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Cf,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Te,{to:Jd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(nf,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=s.workspace?kn(s.workspace):null;async function T(P,$){const L=s;try{await u(L,P,$),C(!1),g(`Updated view "${P}"`)}catch(F){throw g(F instanceof Error?F.message:"Failed to update saved view"),F}}async function I(){const P=s;try{await d(P),g(`Duplicated "${P.name}"`)}catch($){g($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function R(){const P=s;E(!0);try{await m(P),v(!1),n(Jd(P.workspace))}catch($){g($ instanceof Error?$.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Te,{to:Jd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(nf,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(Cf,{title:s.name,description:KC(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:pH[s.config.viewMode]}),S?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:S}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void I(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(VC(s)),className:"shell-action",children:"Open on board"}),r.jsx("button",{type:"button",onClick:()=>v(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),r.jsx(zC,{view:s}),b?r.jsx(rT,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(Na,{open:w,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:R,onOpenChange:P=>{!P&&!k&&v(!1)}}),r.jsx(ka,{toast:h,onDismiss:y})]})}function mH(){return r.jsx(fP,{children:r.jsx(q4,{children:r.jsx(BA,{children:r.jsxs(Ke,{element:r.jsx(jI,{}),children:[r.jsx(Ke,{path:"/",element:r.jsx(vF,{})}),r.jsx(Ke,{path:"/projects",element:r.jsx(o0,{})}),r.jsx(Ke,{path:"/archive",element:r.jsx(IF,{})}),r.jsx(Ke,{path:"/assignments",element:r.jsx(mk,{})}),r.jsx(Ke,{path:"/assignments/new",element:r.jsx(yk,{})}),r.jsx(Ke,{path:"/assignments/:id",element:r.jsx(I7,{})}),r.jsx(Ke,{path:"/assignments/:id/edit",element:r.jsx(hg,{})}),r.jsx(Ke,{path:"/assignments/:id/plan/edit",element:r.jsx(gg,{})}),r.jsx(Ke,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(xg,{})}),r.jsx(Ke,{path:"/assignments/:id/handoff/edit",element:r.jsx(yg,{})}),r.jsx(Ke,{path:"/assignments/:id/decision-record/edit",element:r.jsx(bg,{})}),r.jsx(Ke,{path:"/servers",element:r.jsx(vk,{})}),r.jsx(Ke,{path:"/inventories",element:r.jsx(wk,{})}),r.jsx(Ke,{path:"/schedules",element:r.jsx(S9,{})}),r.jsx(Ke,{path:"/usage",element:r.jsx(jk,{})}),r.jsx(Ke,{path:"/agent-sessions",element:r.jsx(kk,{})}),r.jsx(Ke,{path:"/playbooks",element:r.jsx(R9,{})}),r.jsx(Ke,{path:"/playbooks/create",element:r.jsx(P9,{})}),r.jsx(Ke,{path:"/playbooks/:slug",element:r.jsx(A9,{})}),r.jsx(Ke,{path:"/playbooks/:slug/edit",element:r.jsx(D9,{})}),r.jsx(Ke,{path:"/memories",element:r.jsx($9,{})}),r.jsx(Ke,{path:"/memories/new",element:r.jsx(I9,{})}),r.jsx(Ke,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(L9,{})}),r.jsx(Ke,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(O9,{})}),r.jsx(Ke,{path:"/resources",element:r.jsx(_9,{})}),r.jsx(Ke,{path:"/resources/new",element:r.jsx(F9,{})}),r.jsx(Ke,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(M9,{})}),r.jsx(Ke,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(z9,{})}),r.jsx(Ke,{path:"/todos",element:r.jsx(tH,{})}),r.jsx(Ke,{path:"/views",element:r.jsx(Ok,{})}),r.jsx(Ke,{path:"/views/:id",element:r.jsx(_k,{})}),r.jsx(Ke,{path:"/help",element:r.jsx(jF,{})}),r.jsx(Ke,{path:"/settings",element:r.jsx(mW,{})}),r.jsx(Ke,{path:"/workflow",element:r.jsx(eH,{})}),r.jsx(Ke,{path:"/create/project",element:r.jsx(gk,{})}),r.jsx(Ke,{path:"/projects/:slug",element:r.jsx(ok,{})}),r.jsx(Ke,{path:"/projects/:slug/edit",element:r.jsx(bk,{})}),r.jsx(Ke,{path:"/projects/:slug/create/assignment",element:r.jsx(xk,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(uk,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(hg,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(gg,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(xg,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(yg,{})}),r.jsx(Ke,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(bg,{})}),r.jsx(Ke,{path:"/w/:workspace/projects",element:r.jsx(o0,{})}),r.jsx(Ke,{path:"/w/:workspace/assignments",element:r.jsx(mk,{})}),r.jsx(Ke,{path:"/w/:workspace/assignments/new",element:r.jsx(yk,{})}),r.jsx(Ke,{path:"/w/:workspace/servers",element:r.jsx(vk,{})}),r.jsx(Ke,{path:"/w/:workspace/inventories",element:r.jsx(wk,{})}),r.jsx(Ke,{path:"/w/:workspace/usage",element:r.jsx(jk,{})}),r.jsx(Ke,{path:"/w/:workspace/agent-sessions",element:r.jsx(kk,{})}),r.jsx(Ke,{path:"/w/:workspace/todos",element:r.jsx(aH,{})}),r.jsx(Ke,{path:"/w/:workspace/views",element:r.jsx(Ok,{})}),r.jsx(Ke,{path:"/w/:workspace/views/:id",element:r.jsx(_k,{})}),r.jsx(Ke,{path:"/w/:workspace/create/project",element:r.jsx(gk,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug",element:r.jsx(ok,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(bk,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(xk,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(uk,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(hg,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(gg,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(xg,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(yg,{})}),r.jsx(Ke,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(bg,{})})]})})})})}Q3();BR.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(X3,{children:r.jsx(mH,{})})}));export{a6 as _,gH as a,$f as g};
|