syntaur 0.55.0 → 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.
Files changed (70) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dashboard/dist/assets/{_basePickBy-DmVNJO8J.js → _basePickBy-BboQhTYn.js} +1 -1
  3. package/dashboard/dist/assets/{_baseUniq-BtWQDHxm.js → _baseUniq-C6ARYdEJ.js} +1 -1
  4. package/dashboard/dist/assets/{arc-BDZ8fFmA.js → arc-D76wUYJ-.js} +1 -1
  5. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-DmE3bMva.js → architectureDiagram-2XIMDMQ5-eoW8_dbN.js} +1 -1
  6. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-BUpzLbve.js → blockDiagram-WCTKOSBZ--XxaNbBK.js} +1 -1
  7. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-5lB7kxgt.js → c4Diagram-IC4MRINW-D2B-NJq6.js} +1 -1
  8. package/dashboard/dist/assets/channel-BPykMjmL.js +1 -0
  9. package/dashboard/dist/assets/{chunk-4BX2VUAB-DdRqNqOP.js → chunk-4BX2VUAB-CY34rkdT.js} +1 -1
  10. package/dashboard/dist/assets/{chunk-55IACEB6-D_qI2OxO.js → chunk-55IACEB6-CLXE1Ejn.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-FMBD7UC4-BMtQHZt3.js → chunk-FMBD7UC4-D00VtmIk.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-JSJVCQXG-CeCGSMMb.js → chunk-JSJVCQXG-_EITJTaI.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-KX2RTZJC-Biv2a0MB.js → chunk-KX2RTZJC-DrqZI_kX.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-NQ4KR5QH-CbkEQT8f.js → chunk-NQ4KR5QH-DnYhUmZY.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-QZHKN3VN-BU54yyBK.js → chunk-QZHKN3VN-CqCcFoFI.js} +1 -1
  16. package/dashboard/dist/assets/{chunk-WL4C6EOR-ypzKdtzY.js → chunk-WL4C6EOR-Bwx5h46l.js} +1 -1
  17. package/dashboard/dist/assets/classDiagram-VBA2DB6C-z8L393gl.js +1 -0
  18. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-z8L393gl.js +1 -0
  19. package/dashboard/dist/assets/clone--rMJOGpf.js +1 -0
  20. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-Cfexs6Pq.js → cose-bilkent-S5V4N54A-QUZroYuH.js} +1 -1
  21. package/dashboard/dist/assets/{dagre-KLK3FWXG-BjdeaK5Z.js → dagre-KLK3FWXG-D8hYiZ7i.js} +1 -1
  22. package/dashboard/dist/assets/{diagram-E7M64L7V-BVZRb5bD.js → diagram-E7M64L7V-Cl_n980P.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-IFDJBPK2-6fnO4hw1.js → diagram-IFDJBPK2-01DdmzmS.js} +1 -1
  24. package/dashboard/dist/assets/{diagram-P4PSJMXO-DX_fbvo0.js → diagram-P4PSJMXO-GcqkAPB2.js} +1 -1
  25. package/dashboard/dist/assets/{erDiagram-INFDFZHY-Dc-Ult_U.js → erDiagram-INFDFZHY-DQnXbhhn.js} +1 -1
  26. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-nrIBfe3g.js → flowDiagram-PKNHOUZH-DSmXtiZK.js} +1 -1
  27. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-7zt_k1Nl.js → ganttDiagram-A5KZAMGK-BLyt9LDp.js} +1 -1
  28. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-2yK7iOPo.js → gitGraphDiagram-K3NZZRJ6-FWlr0I_j.js} +1 -1
  29. package/dashboard/dist/assets/{graph-DD0OOYtL.js → graph-Czw8ZNXY.js} +1 -1
  30. package/dashboard/dist/assets/index-EntCfH3I.css +1 -0
  31. package/dashboard/dist/assets/index-zHNBGpC7.js +602 -0
  32. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-7nottSf8.js → infoDiagram-LFFYTUFH-CygGWMzd.js} +1 -1
  33. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-DHd9lm-i.js → ishikawaDiagram-PHBUUO56-39XaFufR.js} +1 -1
  34. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-BS86Ecdy.js → journeyDiagram-4ABVD52K-DCMzi84v.js} +1 -1
  35. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-B9uccuva.js → kanban-definition-K7BYSVSG-RSNF4GmM.js} +1 -1
  36. package/dashboard/dist/assets/{layout-Bq6MeguZ.js → layout-AOYFASCy.js} +1 -1
  37. package/dashboard/dist/assets/{linear-XkyDYAy6.js → linear-Bf-cRRMe.js} +1 -1
  38. package/dashboard/dist/assets/{mermaid.core-BH9rlHr4.js → mermaid.core-7QJzPWTu.js} +4 -4
  39. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-Cc-hDkvW.js → mindmap-definition-YRQLILUH-Ck4L1K7y.js} +1 -1
  40. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-BFIPTP1F.js → pieDiagram-SKSYHLDU-BHEH_9Yh.js} +1 -1
  41. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-yVL8WrSz.js → quadrantDiagram-337W2JSQ-DScQHhsU.js} +1 -1
  42. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-DxWjrQut.js → requirementDiagram-Z7DCOOCP-DLmxwUdt.js} +1 -1
  43. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-BPkz1Yl7.js → sankeyDiagram-WA2Y5GQK-B6OZtKmg.js} +1 -1
  44. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-DlgeS-S7.js → sequenceDiagram-2WXFIKYE-woFPqQIY.js} +1 -1
  45. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-DBpOK-Ql.js → stateDiagram-RAJIS63D-Db9HV_HG.js} +1 -1
  46. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-DZsj07hg.js +1 -0
  47. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-abDjZ0W-.js → timeline-definition-YZTLITO2-CGVOTXAD.js} +1 -1
  48. package/dashboard/dist/assets/{treemap-KZPCXAKY-bF6AoBlY.js → treemap-KZPCXAKY-CGmqtjaL.js} +1 -1
  49. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-lUeCE7KT.js → vennDiagram-LZ73GAT5-DAuyqqKn.js} +1 -1
  50. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-ByECFP6v.js → xychartDiagram-JWTSCODW--uOFgr6-.js} +1 -1
  51. package/dashboard/dist/index.html +2 -2
  52. package/dist/dashboard/server.js +290 -23
  53. package/dist/dashboard/server.js.map +1 -1
  54. package/dist/index.js +290 -23
  55. package/dist/index.js.map +1 -1
  56. package/dist/launch/index.d.ts +25 -0
  57. package/dist/launch/index.js +187 -1
  58. package/dist/launch/index.js.map +1 -1
  59. package/package.json +1 -1
  60. package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
  61. package/platforms/codex/.codex-plugin/plugin.json +1 -1
  62. package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
  63. package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
  64. package/dashboard/dist/assets/channel-SCYGGwh4.js +0 -1
  65. package/dashboard/dist/assets/classDiagram-VBA2DB6C-DDovN08E.js +0 -1
  66. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-DDovN08E.js +0 -1
  67. package/dashboard/dist/assets/clone-DjHcKoH3.js +0 -1
  68. package/dashboard/dist/assets/index-BKfPPYKw.js +0 -602
  69. package/dashboard/dist/assets/index-C8THdvxD.css +0 -1
  70. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-CS61beS7.js +0 -1
@@ -1,602 +0,0 @@
1
- var oR=Object.defineProperty;var aR=(e,t,n)=>t in e?oR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lh=(e,t,n)=>aR(e,typeof t!="symbol"?t+"":t,n);function iR(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(s,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const c of i.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Nf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function CW(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 ch={exports:{}},_l={},uh={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 pw;function lR(){if(pw)return gt;pw=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.iterator;function y(W){return W===null||typeof W!="object"?null:(W=g&&W[g]||W["@@iterator"],typeof W=="function"?W:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,w={};function v(W,ee,B){this.props=W,this.context=ee,this.refs=w,this.updater=B||b}v.prototype.isReactComponent={},v.prototype.setState=function(W,ee){if(typeof W!="object"&&typeof W!="function"&&W!=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,W,ee,"setState")},v.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(W,ee,B){this.props=W,this.context=ee,this.refs=w,this.updater=B||b}var S=E.prototype=new k;S.constructor=E,N(S,v.prototype),S.isPureReactComponent=!0;var T=Array.isArray,P=Object.prototype.hasOwnProperty,R={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function L(W,ee,B){var ae,ue={},se=null,xe=null;if(ee!=null)for(ae in ee.ref!==void 0&&(xe=ee.ref),ee.key!==void 0&&(se=""+ee.key),ee)P.call(ee,ae)&&!A.hasOwnProperty(ae)&&(ue[ae]=ee[ae]);var ke=arguments.length-2;if(ke===1)ue.children=B;else if(1<ke){for(var Re=Array(ke),Ae=0;Ae<ke;Ae++)Re[Ae]=arguments[Ae+2];ue.children=Re}if(W&&W.defaultProps)for(ae in ke=W.defaultProps,ke)ue[ae]===void 0&&(ue[ae]=ke[ae]);return{$$typeof:e,type:W,key:se,ref:xe,props:ue,_owner:R.current}}function M(W,ee){return{$$typeof:e,type:W.type,key:ee,ref:W.ref,props:W.props,_owner:W._owner}}function F(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function D(W){var ee={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(B){return ee[B]})}var V=/\/+/g;function Y(W,ee){return typeof W=="object"&&W!==null&&W.key!=null?D(""+W.key):ee.toString(36)}function _(W,ee,B,ae,ue){var se=typeof W;(se==="undefined"||se==="boolean")&&(W=null);var xe=!1;if(W===null)xe=!0;else switch(se){case"string":case"number":xe=!0;break;case"object":switch(W.$$typeof){case e:case t:xe=!0}}if(xe)return xe=W,ue=ue(xe),W=ae===""?"."+Y(xe,0):ae,T(ue)?(B="",W!=null&&(B=W.replace(V,"$&/")+"/"),_(ue,ee,B,"",function(Ae){return Ae})):ue!=null&&(F(ue)&&(ue=M(ue,B+(!ue.key||xe&&xe.key===ue.key?"":(""+ue.key).replace(V,"$&/")+"/")+W)),ee.push(ue)),1;if(xe=0,ae=ae===""?".":ae+":",T(W))for(var ke=0;ke<W.length;ke++){se=W[ke];var Re=ae+Y(se,ke);xe+=_(se,ee,B,Re,ue)}else if(Re=y(W),typeof Re=="function")for(W=Re.call(W),ke=0;!(se=W.next()).done;)se=se.value,Re=ae+Y(se,ke++),xe+=_(se,ee,B,Re,ue);else if(se==="object")throw ee=String(W),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.");return xe}function z(W,ee,B){if(W==null)return W;var ae=[],ue=0;return _(W,ae,"","",function(se){return ee.call(B,se,ue++)}),ae}function H(W){if(W._status===-1){var ee=W._result;ee=ee(),ee.then(function(B){(W._status===0||W._status===-1)&&(W._status=1,W._result=B)},function(B){(W._status===0||W._status===-1)&&(W._status=2,W._result=B)}),W._status===-1&&(W._status=0,W._result=ee)}if(W._status===1)return W._result.default;throw W._result}var q={current:null},I={transition:null},K={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:I,ReactCurrentOwner:R};function $(){throw Error("act(...) is not supported in production builds of React.")}return gt.Children={map:z,forEach:function(W,ee,B){z(W,function(){ee.apply(this,arguments)},B)},count:function(W){var ee=0;return z(W,function(){ee++}),ee},toArray:function(W){return z(W,function(ee){return ee})||[]},only:function(W){if(!F(W))throw Error("React.Children.only expected to receive a single React element child.");return W}},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=K,gt.act=$,gt.cloneElement=function(W,ee,B){if(W==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+W+".");var ae=N({},W.props),ue=W.key,se=W.ref,xe=W._owner;if(ee!=null){if(ee.ref!==void 0&&(se=ee.ref,xe=R.current),ee.key!==void 0&&(ue=""+ee.key),W.type&&W.type.defaultProps)var ke=W.type.defaultProps;for(Re in ee)P.call(ee,Re)&&!A.hasOwnProperty(Re)&&(ae[Re]=ee[Re]===void 0&&ke!==void 0?ke[Re]:ee[Re])}var Re=arguments.length-2;if(Re===1)ae.children=B;else if(1<Re){ke=Array(Re);for(var Ae=0;Ae<Re;Ae++)ke[Ae]=arguments[Ae+2];ae.children=ke}return{$$typeof:e,type:W.type,key:ue,ref:se,props:ae,_owner:xe}},gt.createContext=function(W){return W={$$typeof:c,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},W.Provider={$$typeof:i,_context:W},W.Consumer=W},gt.createElement=L,gt.createFactory=function(W){var ee=L.bind(null,W);return ee.type=W,ee},gt.createRef=function(){return{current:null}},gt.forwardRef=function(W){return{$$typeof:u,render:W}},gt.isValidElement=F,gt.lazy=function(W){return{$$typeof:h,_payload:{_status:-1,_result:W},_init:H}},gt.memo=function(W,ee){return{$$typeof:m,type:W,compare:ee===void 0?null:ee}},gt.startTransition=function(W){var ee=I.transition;I.transition={};try{W()}finally{I.transition=ee}},gt.unstable_act=$,gt.useCallback=function(W,ee){return q.current.useCallback(W,ee)},gt.useContext=function(W){return q.current.useContext(W)},gt.useDebugValue=function(){},gt.useDeferredValue=function(W){return q.current.useDeferredValue(W)},gt.useEffect=function(W,ee){return q.current.useEffect(W,ee)},gt.useId=function(){return q.current.useId()},gt.useImperativeHandle=function(W,ee,B){return q.current.useImperativeHandle(W,ee,B)},gt.useInsertionEffect=function(W,ee){return q.current.useInsertionEffect(W,ee)},gt.useLayoutEffect=function(W,ee){return q.current.useLayoutEffect(W,ee)},gt.useMemo=function(W,ee){return q.current.useMemo(W,ee)},gt.useReducer=function(W,ee,B){return q.current.useReducer(W,ee,B)},gt.useRef=function(W){return q.current.useRef(W)},gt.useState=function(W){return q.current.useState(W)},gt.useSyncExternalStore=function(W,ee,B){return q.current.useSyncExternalStore(W,ee,B)},gt.useTransition=function(){return q.current.useTransition()},gt.version="18.3.1",gt}var mw;function ux(){return mw||(mw=1,uh.exports=lR()),uh.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 hw;function cR(){if(hw)return _l;hw=1;var e=ux(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(u,d,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),d.key!==void 0&&(y=""+d.key),d.ref!==void 0&&(b=d.ref);for(h in d)s.call(d,h)&&!i.hasOwnProperty(h)&&(g[h]=d[h]);if(u&&u.defaultProps)for(h in d=u.defaultProps,d)g[h]===void 0&&(g[h]=d[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:o.current}}return _l.Fragment=n,_l.jsx=c,_l.jsxs=c,_l}var gw;function uR(){return gw||(gw=1,ch.exports=cR()),ch.exports}var r=uR(),f=ux();const Pt=Nf(f),vk=iR({__proto__:null,default:Pt},[f]);var od={},dh={exports:{}},ir={},fh={exports:{}},ph={};/**
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 xw;function dR(){return xw||(xw=1,(function(e){function t(I,K){var $=I.length;I.push(K);e:for(;0<$;){var W=$-1>>>1,ee=I[W];if(0<o(ee,K))I[W]=K,I[$]=ee,$=W;else break e}}function n(I){return I.length===0?null:I[0]}function s(I){if(I.length===0)return null;var K=I[0],$=I.pop();if($!==K){I[0]=$;e:for(var W=0,ee=I.length,B=ee>>>1;W<B;){var ae=2*(W+1)-1,ue=I[ae],se=ae+1,xe=I[se];if(0>o(ue,$))se<ee&&0>o(xe,ue)?(I[W]=xe,I[se]=$,W=se):(I[W]=ue,I[ae]=$,W=ae);else if(se<ee&&0>o(xe,$))I[W]=xe,I[se]=$,W=se;else break e}}return K}function o(I,K){var $=I.sortIndex-K.sortIndex;return $!==0?$:I.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var d=[],m=[],h=1,g=null,y=3,b=!1,N=!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(I){for(var K=n(m);K!==null;){if(K.callback===null)s(m);else if(K.startTime<=I)s(m),K.sortIndex=K.expirationTime,t(d,K);else break;K=n(m)}}function T(I){if(w=!1,S(I),!N)if(n(d)!==null)N=!0,H(P);else{var K=n(m);K!==null&&q(T,K.startTime-I)}}function P(I,K){N=!1,w&&(w=!1,k(L),L=-1),b=!0;var $=y;try{for(S(K),g=n(d);g!==null&&(!(g.expirationTime>K)||I&&!D());){var W=g.callback;if(typeof W=="function"){g.callback=null,y=g.priorityLevel;var ee=W(g.expirationTime<=K);K=e.unstable_now(),typeof ee=="function"?g.callback=ee:g===n(d)&&s(d),S(K)}else s(d);g=n(d)}if(g!==null)var B=!0;else{var ae=n(m);ae!==null&&q(T,ae.startTime-K),B=!1}return B}finally{g=null,y=$,b=!1}}var R=!1,A=null,L=-1,M=5,F=-1;function D(){return!(e.unstable_now()-F<M)}function V(){if(A!==null){var I=e.unstable_now();F=I;var K=!0;try{K=A(!0,I)}finally{K?Y():(R=!1,A=null)}}else R=!1}var Y;if(typeof E=="function")Y=function(){E(V)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,z=_.port2;_.port1.onmessage=V,Y=function(){z.postMessage(null)}}else Y=function(){v(V,0)};function H(I){A=I,R||(R=!0,Y())}function q(I,K){L=v(function(){I(e.unstable_now())},K)}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(I){I.callback=null},e.unstable_continueExecution=function(){N||b||(N=!0,H(P))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(I){switch(y){case 1:case 2:case 3:var K=3;break;default:K=y}var $=y;y=K;try{return I()}finally{y=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,K){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var $=y;y=I;try{return K()}finally{y=$}},e.unstable_scheduleCallback=function(I,K,$){var W=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?W+$:W):$=W,I){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=$+ee,I={id:h++,callback:K,priorityLevel:I,startTime:$,expirationTime:ee,sortIndex:-1},$>W?(I.sortIndex=$,t(m,I),n(d)===null&&I===n(m)&&(w?(k(L),L=-1):w=!0,q(T,$-W))):(I.sortIndex=ee,t(d,I),N||b||(N=!0,H(P))),I},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(I){var K=y;return function(){var $=y;y=K;try{return I.apply(this,arguments)}finally{y=$}}}})(ph)),ph}var yw;function fR(){return yw||(yw=1,fh.exports=dR()),fh.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 bw;function pR(){if(bw)return ir;bw=1;var e=ux(),t=fR();function n(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function i(a,l){c(a,l),c(a+"Capture",l)}function c(a,l){for(o[a]=l,a=0;a<l.length;a++)s.add(l[a])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,h={},g={};function y(a){return d.call(g,a)?!0:d.call(h,a)?!1:m.test(a)?g[a]=!0:(h[a]=!0,!1)}function b(a,l,p,x){if(p!==null&&p.type===0)return!1;switch(typeof l){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 N(a,l,p,x){if(l===null||typeof l>"u"||b(a,l,p,x))return!0;if(x)return!1;if(p!==null)switch(p.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function w(a,l,p,x,j,C,O){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=x,this.attributeNamespace=j,this.mustUseProperty=p,this.propertyName=a,this.type=l,this.sanitizeURL=C,this.removeEmptyString=O}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 l=a[0];v[l]=new w(l,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 l=a.replace(k,E);v[l]=new w(l,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var l=a.replace(k,E);v[l]=new w(l,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var l=a.replace(k,E);v[l]=new w(l,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,l,p,x){var j=v.hasOwnProperty(l)?v[l]:null;(j!==null?j.type!==0:x||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(N(l,p,j,x)&&(p=null),x||j===null?y(l)&&(p===null?a.removeAttribute(l):a.setAttribute(l,""+p)):j.mustUseProperty?a[j.propertyName]=p===null?j.type===3?!1:"":p:(l=j.attributeName,x=j.attributeNamespace,p===null?a.removeAttribute(l):(j=j.type,p=j===3||j===4&&p===!0?"":""+p,x?a.setAttributeNS(x,l,p):a.setAttribute(l,p))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P=Symbol.for("react.element"),R=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),D=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),I=Symbol.iterator;function K(a){return a===null||typeof a!="object"?null:(a=I&&a[I]||a["@@iterator"],typeof a=="function"?a:null)}var $=Object.assign,W;function ee(a){if(W===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);W=l&&l[1]||""}return`
34
- `+W+a}var B=!1;function ae(a,l){if(!a||B)return"";B=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(pe){var x=pe}Reflect.construct(a,[],l)}else{try{l.call()}catch(pe){x=pe}a.call(l.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
- `),C=x.stack.split(`
36
- `),O=j.length-1,G=C.length-1;1<=O&&0<=G&&j[O]!==C[G];)G--;for(;1<=O&&0<=G;O--,G--)if(j[O]!==C[G]){if(O!==1||G!==1)do if(O--,G--,0>G||j[O]!==C[G]){var Q=`
37
- `+j[O].replace(" at new "," at ");return a.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",a.displayName)),Q}while(1<=O&&0<=G);break}}}finally{B=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?ee(a):""}function ue(a){switch(a.tag){case 5:return ee(a.type);case 16:return ee("Lazy");case 13:return ee("Suspense");case 19:return ee("SuspenseList");case 0:case 2:case 15:return a=ae(a.type,!1),a;case 11:return a=ae(a.type.render,!1),a;case 1:return a=ae(a.type,!0),a;default:return""}}function se(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case A:return"Fragment";case R:return"Portal";case M:return"Profiler";case L:return"StrictMode";case Y:return"Suspense";case _:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case D:return(a.displayName||"Context")+".Consumer";case F:return(a._context.displayName||"Context")+".Provider";case V:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case z:return l=a.displayName||null,l!==null?l:se(a.type)||"Memo";case H:l=a._payload,a=a._init;try{return se(a(l))}catch{}}return null}function xe(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(l);case 8:return l===L?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function ke(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Re(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Ae(a){var l=Re(a)?"checked":"value",p=Object.getOwnPropertyDescriptor(a.constructor.prototype,l),x=""+a[l];if(!a.hasOwnProperty(l)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var j=p.get,C=p.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return j.call(this)},set:function(O){x=""+O,C.call(this,O)}}),Object.defineProperty(a,l,{enumerable:p.enumerable}),{getValue:function(){return x},setValue:function(O){x=""+O},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Qe(a){a._valueTracker||(a._valueTracker=Ae(a))}function at(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var p=l.getValue(),x="";return a&&(x=Re(a)?a.checked?"true":"false":a.value),a=x,a!==p?(l.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,l){var p=l.checked;return $({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:p??a._wrapperState.initialChecked})}function Z(a,l){var p=l.defaultValue==null?"":l.defaultValue,x=l.checked!=null?l.checked:l.defaultChecked;p=ke(l.value!=null?l.value:p),a._wrapperState={initialChecked:x,initialValue:p,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function _e(a,l){l=l.checked,l!=null&&S(a,"checked",l,!1)}function Ee(a,l){_e(a,l);var p=ke(l.value),x=l.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}l.hasOwnProperty("value")?Ye(a,l.type,p):l.hasOwnProperty("defaultValue")&&Ye(a,l.type,ke(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(a.defaultChecked=!!l.defaultChecked)}function Ie(a,l,p){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var x=l.type;if(!(x!=="submit"&&x!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+a._wrapperState.initialValue,p||l===a.value||(a.value=l),a.defaultValue=l}p=a.name,p!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,p!==""&&(a.name=p)}function Ye(a,l,p){(l!=="number"||Ze(a.ownerDocument)!==a)&&(p==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+p&&(a.defaultValue=""+p))}var Me=Array.isArray;function et(a,l,p,x){if(a=a.options,l){l={};for(var j=0;j<p.length;j++)l["$"+p[j]]=!0;for(p=0;p<a.length;p++)j=l.hasOwnProperty("$"+a[p].value),a[p].selected!==j&&(a[p].selected=j),j&&x&&(a[p].defaultSelected=!0)}else{for(p=""+ke(p),l=null,j=0;j<a.length;j++){if(a[j].value===p){a[j].selected=!0,x&&(a[j].defaultSelected=!0);return}l!==null||a[j].disabled||(l=a[j])}l!==null&&(l.selected=!0)}}function Je(a,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return $({},l,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function $t(a,l){var p=l.value;if(p==null){if(p=l.children,l=l.defaultValue,p!=null){if(l!=null)throw Error(n(92));if(Me(p)){if(1<p.length)throw Error(n(93));p=p[0]}l=p}l==null&&(l=""),p=l}a._wrapperState={initialValue:ke(p)}}function vt(a,l){var p=ke(l.value),x=ke(l.defaultValue);p!=null&&(p=""+p,p!==a.value&&(a.value=p),l.defaultValue==null&&a.defaultValue!==p&&(a.defaultValue=p)),x!=null&&(a.defaultValue=""+x)}function ct(a){var l=a.textContent;l===a._wrapperState.initialValue&&l!==""&&l!==null&&(a.value=l)}function le(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function J(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?le(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var he,re=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,p,x,j){MSApp.execUnsafeLocalFunction(function(){return a(l,p,x,j)})}:a})(function(a,l){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=l;else{for(he=he||document.createElement("div"),he.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=he.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function ye(a,l){if(l){var p=a.firstChild;if(p&&p===a.lastChild&&p.nodeType===3){p.nodeValue=l;return}}a.textContent=l}var Pe={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(Pe).forEach(function(a){ve.forEach(function(l){l=l+a.charAt(0).toUpperCase()+a.substring(1),Pe[l]=Pe[a]})});function te(a,l,p){return l==null||typeof l=="boolean"||l===""?"":p||typeof l!="number"||l===0||Pe.hasOwnProperty(a)&&Pe[a]?(""+l).trim():l+"px"}function fe(a,l){a=a.style;for(var p in l)if(l.hasOwnProperty(p)){var x=p.indexOf("--")===0,j=te(p,l[p],x);p==="float"&&(p="cssFloat"),x?a.setProperty(p,j):a[p]=j}}var Se=$({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 Ue(a,l){if(l){if(Se[a]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function ce(a,l){if(a.indexOf("-")===-1)return typeof l.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var 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,st=null,me=null;function Oe(a){if(a=jl(a)){if(typeof St!="function")throw Error(n(280));var l=a.stateNode;l&&(l=vu(l),St(a.stateNode,a.type,l))}}function qe(a){st?me?me.push(a):me=[a]:st=a}function Lt(){if(st){var a=st,l=me;if(me=st=null,Oe(a),l)for(a=0;a<l.length;a++)Oe(l[a])}}function Xt(a,l){return a(l)}function dn(){}var Gt=!1;function Gn(a,l,p){if(Gt)return a(l,p);Gt=!0;try{return Xt(a,l,p)}finally{Gt=!1,(st!==null||me!==null)&&(dn(),Lt())}}function Et(a,l){var p=a.stateNode;if(p===null)return null;var x=vu(p);if(x===null)return null;p=x[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(x=!x.disabled)||(a=a.type,x=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!x;break e;default:a=!1}if(a)return null;if(p&&typeof p!="function")throw Error(n(231,l,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 oe(a,l,p,x,j,C,O,G,Q){var pe=Array.prototype.slice.call(arguments,3);try{l.apply(p,pe)}catch(je){this.onError(je)}}var ze=!1,tt=null,yt=!1,tr=null,qr={onError:function(a){ze=!0,tt=a}};function Ts(a,l,p,x,j,C,O,G,Q){ze=!1,tt=null,oe.apply(qr,arguments)}function Jc(a,l,p,x,j,C,O,G,Q){if(Ts.apply(this,arguments),ze){if(ze){var pe=tt;ze=!1,tt=null}else throw Error(n(198));yt||(yt=!0,tr=pe)}}function ht(a){var l=a,p=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(p=l.return),a=l.return;while(a)}return l.tag===3?p:null}function Qc(a){if(a.tag===13){var l=a.memoizedState;if(l===null&&(a=a.alternate,a!==null&&(l=a.memoizedState)),l!==null)return l.dehydrated}return null}function sl(a){if(ht(a)!==a)throw Error(n(188))}function Xc(a){var l=a.alternate;if(!l){if(l=ht(a),l===null)throw Error(n(188));return l!==a?null:a}for(var p=a,x=l;;){var j=p.return;if(j===null)break;var C=j.alternate;if(C===null){if(x=j.return,x!==null){p=x;continue}break}if(j.child===C.child){for(C=j.child;C;){if(C===p)return sl(j),a;if(C===x)return sl(j),l;C=C.sibling}throw Error(n(188))}if(p.return!==x.return)p=j,x=C;else{for(var O=!1,G=j.child;G;){if(G===p){O=!0,p=j,x=C;break}if(G===x){O=!0,x=j,p=C;break}G=G.sibling}if(!O){for(G=C.child;G;){if(G===p){O=!0,p=C,x=j;break}if(G===x){O=!0,x=C,p=j;break}G=G.sibling}if(!O)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:l}function rn(a){return a=Xc(a),a!==null?Zc(a):null}function Zc(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=Zc(a);if(l!==null)return l;a=a.sibling}return null}var eu=t.unstable_scheduleCallback,tu=t.unstable_cancelCallback,Rp=t.unstable_shouldYield,Ap=t.unstable_requestPaint,Zt=t.unstable_now,Pp=t.unstable_getCurrentPriorityLevel,ol=t.unstable_ImmediatePriority,nu=t.unstable_UserBlockingPriority,qs=t.unstable_NormalPriority,ja=t.unstable_LowPriority,ru=t.unstable_IdlePriority,ka=null,an=null;function Sa(a){if(an&&typeof an.onCommitFiberRoot=="function")try{an.onCommitFiberRoot(ka,a,void 0,(a.current.flags&128)===128)}catch{}}var zn=Math.clz32?Math.clz32:Lp,Dp=Math.log,$p=Math.LN2;function Lp(a){return a>>>=0,a===0?32:31-(Dp(a)/$p|0)|0}var Yn=64,Na=4194304;function Gs(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function Do(a,l){var p=a.pendingLanes;if(p===0)return 0;var x=0,j=a.suspendedLanes,C=a.pingedLanes,O=p&268435455;if(O!==0){var G=O&~j;G!==0?x=Gs(G):(C&=O,C!==0&&(x=Gs(C)))}else O=p&~j,O!==0?x=Gs(O):C!==0&&(x=Gs(C));if(x===0)return 0;if(l!==0&&l!==x&&(l&j)===0&&(j=x&-x,C=l&-l,j>=C||j===16&&(C&4194240)!==0))return l;if((x&4)!==0&&(x|=p&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=x;0<l;)p=31-zn(l),j=1<<p,x|=a[p],l&=~j;return x}function su(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ou(a,l){for(var p=a.suspendedLanes,x=a.pingedLanes,j=a.expirationTimes,C=a.pendingLanes;0<C;){var O=31-zn(C),G=1<<O,Q=j[O];Q===-1?((G&p)===0||(G&x)!==0)&&(j[O]=su(G,l)):Q<=l&&(a.expiredLanes|=G),C&=~G}}function $o(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function al(){var a=Yn;return Yn<<=1,(Yn&4194240)===0&&(Yn=64),a}function Yt(a){for(var l=[],p=0;31>p;p++)l.push(a);return l}function Gr(a,l,p){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-zn(l),a[l]=p}function il(a,l){var p=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var x=a.eventTimes;for(a=a.expirationTimes;0<p;){var j=31-zn(p),C=1<<j;l[j]=0,x[j]=-1,a[j]=-1,p&=~C}}function ll(a,l){var p=a.entangledLanes|=l;for(a=a.entanglements;p;){var x=31-zn(p),j=1<<x;j&l|a[x]&l&&(a[x]|=l),p&=~j}}var At=0;function cl(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Ca,Ea,Ys,Ta,au,ul=!1,Ln=[],us=null,Pr=null,ds=null,Lo=new Map,Io=new Map,Bn=[],U="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 X(a,l){switch(a){case"focusin":case"focusout":us=null;break;case"dragenter":case"dragleave":Pr=null;break;case"mouseover":case"mouseout":ds=null;break;case"pointerover":case"pointerout":Lo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Io.delete(l.pointerId)}}function ge(a,l,p,x,j,C){return a===null||a.nativeEvent!==C?(a={blockedOn:l,domEventName:p,eventSystemFlags:x,nativeEvent:C,targetContainers:[j]},l!==null&&(l=jl(l),l!==null&&Ea(l)),a):(a.eventSystemFlags|=x,l=a.targetContainers,j!==null&&l.indexOf(j)===-1&&l.push(j),a)}function Le(a,l,p,x,j){switch(l){case"focusin":return us=ge(us,a,l,p,x,j),!0;case"dragenter":return Pr=ge(Pr,a,l,p,x,j),!0;case"mouseover":return ds=ge(ds,a,l,p,x,j),!0;case"pointerover":var C=j.pointerId;return Lo.set(C,ge(Lo.get(C)||null,a,l,p,x,j)),!0;case"gotpointercapture":return C=j.pointerId,Io.set(C,ge(Io.get(C)||null,a,l,p,x,j)),!0}return!1}function ut(a){var l=_o(a.target);if(l!==null){var p=ht(l);if(p!==null){if(l=p.tag,l===13){if(l=Qc(p),l!==null){a.blockedOn=l,au(a.priority,function(){Ys(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){a.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}a.blockedOn=null}function bt(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var p=Ip(a.domEventName,a.eventSystemFlags,l[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 l=jl(p),l!==null&&Ea(l),a.blockedOn=p,!1;l.shift()}return!0}function It(a,l,p){bt(a)&&p.delete(l)}function hr(){ul=!1,us!==null&&bt(us)&&(us=null),Pr!==null&&bt(Pr)&&(Pr=null),ds!==null&&bt(ds)&&(ds=null),Lo.forEach(It),Io.forEach(It)}function ln(a,l){a.blockedOn===l&&(a.blockedOn=null,ul||(ul=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hr)))}function fn(a){function l(j){return ln(j,a)}if(0<Ln.length){ln(Ln[0],a);for(var p=1;p<Ln.length;p++){var x=Ln[p];x.blockedOn===a&&(x.blockedOn=null)}}for(us!==null&&ln(us,a),Pr!==null&&ln(Pr,a),ds!==null&&ln(ds,a),Lo.forEach(l),Io.forEach(l),p=0;p<Bn.length;p++)x=Bn[p],x.blockedOn===a&&(x.blockedOn=null);for(;0<Bn.length&&(p=Bn[0],p.blockedOn===null);)ut(p),p.blockedOn===null&&Bn.shift()}var pn=T.ReactCurrentBatchConfig,Oo=!0;function iu(a,l,p,x){var j=At,C=pn.transition;pn.transition=null;try{At=1,fs(a,l,p,x)}finally{At=j,pn.transition=C}}function Ra(a,l,p,x){var j=At,C=pn.transition;pn.transition=null;try{At=4,fs(a,l,p,x)}finally{At=j,pn.transition=C}}function fs(a,l,p,x){if(Oo){var j=Ip(a,l,p,x);if(j===null)Xp(a,l,x,lu,p),X(a,x);else if(Le(j,a,l,p,x))x.stopPropagation();else if(X(a,x),l&4&&-1<U.indexOf(a)){for(;j!==null;){var C=jl(j);if(C!==null&&Ca(C),C=Ip(a,l,p,x),C===null&&Xp(a,l,x,lu,p),C===j)break;j=C}j!==null&&x.stopPropagation()}else Xp(a,l,x,null,p)}}var lu=null;function Ip(a,l,p,x){if(lu=null,a=xt(x),a=_o(a),a!==null)if(l=ht(a),l===null)a=null;else if(p=l.tag,p===13){if(a=Qc(l),a!==null)return a;a=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null);return lu=a,null}function Zy(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(Pp()){case ol:return 1;case nu:return 4;case qs:case ja:return 16;case ru:return 536870912;default:return 16}default:return 16}}var Js=null,Op=null,cu=null;function eb(){if(cu)return cu;var a,l=Op,p=l.length,x,j="value"in Js?Js.value:Js.textContent,C=j.length;for(a=0;a<p&&l[a]===j[a];a++);var O=p-a;for(x=1;x<=O&&l[p-x]===j[C-x];x++);return cu=j.slice(a,1<x?1-x:void 0)}function uu(a){var l=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&l===13&&(a=13)):a=l,a===10&&(a=13),32<=a||a===13?a:0}function du(){return!0}function tb(){return!1}function gr(a){function l(p,x,j,C,O){this._reactName=p,this._targetInst=j,this.type=x,this.nativeEvent=C,this.target=O,this.currentTarget=null;for(var G in a)a.hasOwnProperty(G)&&(p=a[G],this[G]=p?p(C):C[G]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?du:tb,this.isPropagationStopped=tb,this}return $(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=du)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=du)},persist:function(){},isPersistent:du}),l}var Aa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_p=gr(Aa),dl=$({},Aa,{view:0,detail:0}),D2=gr(dl),Mp,Fp,fl,fu=$({},dl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bp,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!==fl&&(fl&&a.type==="mousemove"?(Mp=a.screenX-fl.screenX,Fp=a.screenY-fl.screenY):Fp=Mp=0,fl=a),Mp)},movementY:function(a){return"movementY"in a?a.movementY:Fp}}),nb=gr(fu),$2=$({},fu,{dataTransfer:0}),L2=gr($2),I2=$({},dl,{relatedTarget:0}),zp=gr(I2),O2=$({},Aa,{animationName:0,elapsedTime:0,pseudoElement:0}),_2=gr(O2),M2=$({},Aa,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),F2=gr(M2),z2=$({},Aa,{data:0}),rb=gr(z2),B2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},U2={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"},W2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function V2(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=W2[a])?!!l[a]:!1}function Bp(){return V2}var H2=$({},dl,{key:function(a){if(a.key){var l=B2[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=uu(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?U2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bp,charCode:function(a){return a.type==="keypress"?uu(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?uu(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),K2=gr(H2),q2=$({},fu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),sb=gr(q2),G2=$({},dl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bp}),Y2=gr(G2),J2=$({},Aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Q2=gr(J2),X2=$({},fu,{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}),Z2=gr(X2),eT=[9,13,27,32],Up=u&&"CompositionEvent"in window,pl=null;u&&"documentMode"in document&&(pl=document.documentMode);var tT=u&&"TextEvent"in window&&!pl,ob=u&&(!Up||pl&&8<pl&&11>=pl),ab=" ",ib=!1;function lb(a,l){switch(a){case"keyup":return eT.indexOf(l.keyCode)!==-1;case"keydown":return l.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 Pa=!1;function nT(a,l){switch(a){case"compositionend":return cb(l);case"keypress":return l.which!==32?null:(ib=!0,ab);case"textInput":return a=l.data,a===ab&&ib?null:a;default:return null}}function rT(a,l){if(Pa)return a==="compositionend"||!Up&&lb(a,l)?(a=eb(),cu=Op=Js=null,Pa=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return ob&&l.locale!=="ko"?null:l.data;default:return null}}var sT={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 ub(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!sT[a.type]:l==="textarea"}function db(a,l,p,x){qe(x),l=xu(l,"onChange"),0<l.length&&(p=new _p("onChange","change",null,p,x),a.push({event:p,listeners:l}))}var ml=null,hl=null;function oT(a){Rb(a,0)}function pu(a){var l=Oa(a);if(at(l))return a}function aT(a,l){if(a==="change")return l}var fb=!1;if(u){var Wp;if(u){var Vp="oninput"in document;if(!Vp){var pb=document.createElement("div");pb.setAttribute("oninput","return;"),Vp=typeof pb.oninput=="function"}Wp=Vp}else Wp=!1;fb=Wp&&(!document.documentMode||9<document.documentMode)}function mb(){ml&&(ml.detachEvent("onpropertychange",hb),hl=ml=null)}function hb(a){if(a.propertyName==="value"&&pu(hl)){var l=[];db(l,hl,a,xt(a)),Gn(oT,l)}}function iT(a,l,p){a==="focusin"?(mb(),ml=l,hl=p,ml.attachEvent("onpropertychange",hb)):a==="focusout"&&mb()}function lT(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return pu(hl)}function cT(a,l){if(a==="click")return pu(l)}function uT(a,l){if(a==="input"||a==="change")return pu(l)}function dT(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Yr=typeof Object.is=="function"?Object.is:dT;function gl(a,l){if(Yr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var p=Object.keys(a),x=Object.keys(l);if(p.length!==x.length)return!1;for(x=0;x<p.length;x++){var j=p[x];if(!d.call(l,j)||!Yr(a[j],l[j]))return!1}return!0}function gb(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function xb(a,l){var p=gb(a);a=0;for(var x;p;){if(p.nodeType===3){if(x=a+p.textContent.length,a<=l&&x>=l)return{node:p,offset:l-a};a=x}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=gb(p)}}function yb(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?yb(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function bb(){for(var a=window,l=Ze();l instanceof a.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)a=l.contentWindow;else break;l=Ze(a.document)}return l}function Hp(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l&&(l==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||l==="textarea"||a.contentEditable==="true")}function fT(a){var l=bb(),p=a.focusedElem,x=a.selectionRange;if(l!==p&&p&&p.ownerDocument&&yb(p.ownerDocument.documentElement,p)){if(x!==null&&Hp(p)){if(l=x.start,a=x.end,a===void 0&&(a=l),"selectionStart"in p)p.selectionStart=l,p.selectionEnd=Math.min(a,p.value.length);else if(a=(l=p.ownerDocument||document)&&l.defaultView||window,a.getSelection){a=a.getSelection();var j=p.textContent.length,C=Math.min(x.start,j);x=x.end===void 0?C:Math.min(x.end,j),!a.extend&&C>x&&(j=x,x=C,C=j),j=xb(p,C);var O=xb(p,x);j&&O&&(a.rangeCount!==1||a.anchorNode!==j.node||a.anchorOffset!==j.offset||a.focusNode!==O.node||a.focusOffset!==O.offset)&&(l=l.createRange(),l.setStart(j.node,j.offset),a.removeAllRanges(),C>x?(a.addRange(l),a.extend(O.node,O.offset)):(l.setEnd(O.node,O.offset),a.addRange(l)))}}for(l=[],a=p;a=a.parentNode;)a.nodeType===1&&l.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;p<l.length;p++)a=l[p],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var pT=u&&"documentMode"in document&&11>=document.documentMode,Da=null,Kp=null,xl=null,qp=!1;function vb(a,l,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;qp||Da==null||Da!==Ze(x)||(x=Da,"selectionStart"in x&&Hp(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}),xl&&gl(xl,x)||(xl=x,x=xu(Kp,"onSelect"),0<x.length&&(l=new _p("onSelect","select",null,l,p),a.push({event:l,listeners:x}),l.target=Da)))}function mu(a,l){var p={};return p[a.toLowerCase()]=l.toLowerCase(),p["Webkit"+a]="webkit"+l,p["Moz"+a]="moz"+l,p}var $a={animationend:mu("Animation","AnimationEnd"),animationiteration:mu("Animation","AnimationIteration"),animationstart:mu("Animation","AnimationStart"),transitionend:mu("Transition","TransitionEnd")},Gp={},wb={};u&&(wb=document.createElement("div").style,"AnimationEvent"in window||(delete $a.animationend.animation,delete $a.animationiteration.animation,delete $a.animationstart.animation),"TransitionEvent"in window||delete $a.transitionend.transition);function hu(a){if(Gp[a])return Gp[a];if(!$a[a])return a;var l=$a[a],p;for(p in l)if(l.hasOwnProperty(p)&&p in wb)return Gp[a]=l[p];return a}var jb=hu("animationend"),kb=hu("animationiteration"),Sb=hu("animationstart"),Nb=hu("transitionend"),Cb=new Map,Eb="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 Qs(a,l){Cb.set(a,l),i(l,[a])}for(var Yp=0;Yp<Eb.length;Yp++){var Jp=Eb[Yp],mT=Jp.toLowerCase(),hT=Jp[0].toUpperCase()+Jp.slice(1);Qs(mT,"on"+hT)}Qs(jb,"onAnimationEnd"),Qs(kb,"onAnimationIteration"),Qs(Sb,"onAnimationStart"),Qs("dblclick","onDoubleClick"),Qs("focusin","onFocus"),Qs("focusout","onBlur"),Qs(Nb,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),i("onBeforeInput",["compositionend","keypress","textInput","paste"]),i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yl="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(" "),gT=new Set("cancel close invalid load scroll toggle".split(" ").concat(yl));function Tb(a,l,p){var x=a.type||"unknown-event";a.currentTarget=p,Jc(x,l,void 0,a),a.currentTarget=null}function Rb(a,l){l=(l&4)!==0;for(var p=0;p<a.length;p++){var x=a[p],j=x.event;x=x.listeners;e:{var C=void 0;if(l)for(var O=x.length-1;0<=O;O--){var G=x[O],Q=G.instance,pe=G.currentTarget;if(G=G.listener,Q!==C&&j.isPropagationStopped())break e;Tb(j,G,pe),C=Q}else for(O=0;O<x.length;O++){if(G=x[O],Q=G.instance,pe=G.currentTarget,G=G.listener,Q!==C&&j.isPropagationStopped())break e;Tb(j,G,pe),C=Q}}}if(yt)throw a=tr,yt=!1,tr=null,a}function Ut(a,l){var p=l[sm];p===void 0&&(p=l[sm]=new Set);var x=a+"__bubble";p.has(x)||(Ab(l,a,2,!1),p.add(x))}function Qp(a,l,p){var x=0;l&&(x|=4),Ab(p,a,x,l)}var gu="_reactListening"+Math.random().toString(36).slice(2);function bl(a){if(!a[gu]){a[gu]=!0,s.forEach(function(p){p!=="selectionchange"&&(gT.has(p)||Qp(p,!1,a),Qp(p,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[gu]||(l[gu]=!0,Qp("selectionchange",!1,l))}}function Ab(a,l,p,x){switch(Zy(l)){case 1:var j=iu;break;case 4:j=Ra;break;default:j=fs}p=j.bind(null,l,p,a),j=void 0,!Fn||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(j=!0),x?j!==void 0?a.addEventListener(l,p,{capture:!0,passive:j}):a.addEventListener(l,p,!0):j!==void 0?a.addEventListener(l,p,{passive:j}):a.addEventListener(l,p,!1)}function Xp(a,l,p,x,j){var C=x;if((l&1)===0&&(l&2)===0&&x!==null)e:for(;;){if(x===null)return;var O=x.tag;if(O===3||O===4){var G=x.stateNode.containerInfo;if(G===j||G.nodeType===8&&G.parentNode===j)break;if(O===4)for(O=x.return;O!==null;){var Q=O.tag;if((Q===3||Q===4)&&(Q=O.stateNode.containerInfo,Q===j||Q.nodeType===8&&Q.parentNode===j))return;O=O.return}for(;G!==null;){if(O=_o(G),O===null)return;if(Q=O.tag,Q===5||Q===6){x=C=O;continue e}G=G.parentNode}}x=x.return}Gn(function(){var pe=C,je=xt(p),Ne=[];e:{var we=Cb.get(a);if(we!==void 0){var Be=_p,Ke=a;switch(a){case"keypress":if(uu(p)===0)break e;case"keydown":case"keyup":Be=K2;break;case"focusin":Ke="focus",Be=zp;break;case"focusout":Ke="blur",Be=zp;break;case"beforeblur":case"afterblur":Be=zp;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":Be=nb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=L2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=Y2;break;case jb:case kb:case Sb:Be=_2;break;case Nb:Be=Q2;break;case"scroll":Be=D2;break;case"wheel":Be=Z2;break;case"copy":case"cut":case"paste":Be=F2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=sb}var Ge=(l&4)!==0,cn=!Ge&&a==="scroll",ie=Ge?we!==null?we+"Capture":null:we;Ge=[];for(var ne=pe,de;ne!==null;){de=ne;var De=de.stateNode;if(de.tag===5&&De!==null&&(de=De,ie!==null&&(De=Et(ne,ie),De!=null&&Ge.push(vl(ne,De,de)))),cn)break;ne=ne.return}0<Ge.length&&(we=new Be(we,Ke,null,p,je),Ne.push({event:we,listeners:Ge}))}}if((l&7)===0){e:{if(we=a==="mouseover"||a==="pointerover",Be=a==="mouseout"||a==="pointerout",we&&p!==pt&&(Ke=p.relatedTarget||p.fromElement)&&(_o(Ke)||Ke[Rs]))break e;if((Be||we)&&(we=je.window===je?je:(we=je.ownerDocument)?we.defaultView||we.parentWindow:window,Be?(Ke=p.relatedTarget||p.toElement,Be=pe,Ke=Ke?_o(Ke):null,Ke!==null&&(cn=ht(Ke),Ke!==cn||Ke.tag!==5&&Ke.tag!==6)&&(Ke=null)):(Be=null,Ke=pe),Be!==Ke)){if(Ge=nb,De="onMouseLeave",ie="onMouseEnter",ne="mouse",(a==="pointerout"||a==="pointerover")&&(Ge=sb,De="onPointerLeave",ie="onPointerEnter",ne="pointer"),cn=Be==null?we:Oa(Be),de=Ke==null?we:Oa(Ke),we=new Ge(De,ne+"leave",Be,p,je),we.target=cn,we.relatedTarget=de,De=null,_o(je)===pe&&(Ge=new Ge(ie,ne+"enter",Ke,p,je),Ge.target=de,Ge.relatedTarget=cn,De=Ge),cn=De,Be&&Ke)t:{for(Ge=Be,ie=Ke,ne=0,de=Ge;de;de=La(de))ne++;for(de=0,De=ie;De;De=La(De))de++;for(;0<ne-de;)Ge=La(Ge),ne--;for(;0<de-ne;)ie=La(ie),de--;for(;ne--;){if(Ge===ie||ie!==null&&Ge===ie.alternate)break t;Ge=La(Ge),ie=La(ie)}Ge=null}else Ge=null;Be!==null&&Pb(Ne,we,Be,Ge,!1),Ke!==null&&cn!==null&&Pb(Ne,cn,Ke,Ge,!0)}}e:{if(we=pe?Oa(pe):window,Be=we.nodeName&&we.nodeName.toLowerCase(),Be==="select"||Be==="input"&&we.type==="file")var Xe=aT;else if(ub(we))if(fb)Xe=uT;else{Xe=lT;var nt=iT}else(Be=we.nodeName)&&Be.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Xe=cT);if(Xe&&(Xe=Xe(a,pe))){db(Ne,Xe,p,je);break e}nt&&nt(a,we,pe),a==="focusout"&&(nt=we._wrapperState)&&nt.controlled&&we.type==="number"&&Ye(we,"number",we.value)}switch(nt=pe?Oa(pe):window,a){case"focusin":(ub(nt)||nt.contentEditable==="true")&&(Da=nt,Kp=pe,xl=null);break;case"focusout":xl=Kp=Da=null;break;case"mousedown":qp=!0;break;case"contextmenu":case"mouseup":case"dragend":qp=!1,vb(Ne,p,je);break;case"selectionchange":if(pT)break;case"keydown":case"keyup":vb(Ne,p,je)}var rt;if(Up)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 Pa?lb(a,p)&&(it="onCompositionEnd"):a==="keydown"&&p.keyCode===229&&(it="onCompositionStart");it&&(ob&&p.locale!=="ko"&&(Pa||it!=="onCompositionStart"?it==="onCompositionEnd"&&Pa&&(rt=eb()):(Js=je,Op="value"in Js?Js.value:Js.textContent,Pa=!0)),nt=xu(pe,it),0<nt.length&&(it=new rb(it,a,null,p,je),Ne.push({event:it,listeners:nt}),rt?it.data=rt:(rt=cb(p),rt!==null&&(it.data=rt)))),(rt=tT?nT(a,p):rT(a,p))&&(pe=xu(pe,"onBeforeInput"),0<pe.length&&(je=new rb("onBeforeInput","beforeinput",null,p,je),Ne.push({event:je,listeners:pe}),je.data=rt))}Rb(Ne,l)})}function vl(a,l,p){return{instance:a,listener:l,currentTarget:p}}function xu(a,l){for(var p=l+"Capture",x=[];a!==null;){var j=a,C=j.stateNode;j.tag===5&&C!==null&&(j=C,C=Et(a,p),C!=null&&x.unshift(vl(a,C,j)),C=Et(a,l),C!=null&&x.push(vl(a,C,j))),a=a.return}return x}function La(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function Pb(a,l,p,x,j){for(var C=l._reactName,O=[];p!==null&&p!==x;){var G=p,Q=G.alternate,pe=G.stateNode;if(Q!==null&&Q===x)break;G.tag===5&&pe!==null&&(G=pe,j?(Q=Et(p,C),Q!=null&&O.unshift(vl(p,Q,G))):j||(Q=Et(p,C),Q!=null&&O.push(vl(p,Q,G)))),p=p.return}O.length!==0&&a.push({event:l,listeners:O})}var xT=/\r\n?/g,yT=/\u0000|\uFFFD/g;function Db(a){return(typeof a=="string"?a:""+a).replace(xT,`
38
- `).replace(yT,"")}function yu(a,l,p){if(l=Db(l),Db(a)!==l&&p)throw Error(n(425))}function bu(){}var Zp=null,em=null;function tm(a,l){return a==="textarea"||a==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var nm=typeof setTimeout=="function"?setTimeout:void 0,bT=typeof clearTimeout=="function"?clearTimeout:void 0,$b=typeof Promise=="function"?Promise:void 0,vT=typeof queueMicrotask=="function"?queueMicrotask:typeof $b<"u"?function(a){return $b.resolve(null).then(a).catch(wT)}:nm;function wT(a){setTimeout(function(){throw a})}function rm(a,l){var p=l,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),fn(l);return}x--}else p!=="$"&&p!=="$?"&&p!=="$!"||x++;p=j}while(p);fn(l)}function Xs(a){for(;a!=null;a=a.nextSibling){var l=a.nodeType;if(l===1||l===3)break;if(l===8){if(l=a.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return a}function Lb(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var p=a.data;if(p==="$"||p==="$!"||p==="$?"){if(l===0)return a;l--}else p==="/$"&&l++}a=a.previousSibling}return null}var Ia=Math.random().toString(36).slice(2),ps="__reactFiber$"+Ia,wl="__reactProps$"+Ia,Rs="__reactContainer$"+Ia,sm="__reactEvents$"+Ia,jT="__reactListeners$"+Ia,kT="__reactHandles$"+Ia;function _o(a){var l=a[ps];if(l)return l;for(var p=a.parentNode;p;){if(l=p[Rs]||p[ps]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(a=Lb(a);a!==null;){if(p=a[ps])return p;a=Lb(a)}return l}a=p,p=a.parentNode}return null}function jl(a){return a=a[ps]||a[Rs],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function Oa(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function vu(a){return a[wl]||null}var om=[],_a=-1;function Zs(a){return{current:a}}function Wt(a){0>_a||(a.current=om[_a],om[_a]=null,_a--)}function Ft(a,l){_a++,om[_a]=a.current,a.current=l}var eo={},Un=Zs(eo),nr=Zs(!1),Mo=eo;function Ma(a,l){var p=a.type.contextTypes;if(!p)return eo;var x=a.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===l)return x.__reactInternalMemoizedMaskedChildContext;var j={},C;for(C in p)j[C]=l[C];return x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=j),j}function rr(a){return a=a.childContextTypes,a!=null}function wu(){Wt(nr),Wt(Un)}function Ib(a,l,p){if(Un.current!==eo)throw Error(n(168));Ft(Un,l),Ft(nr,p)}function Ob(a,l,p){var x=a.stateNode;if(l=l.childContextTypes,typeof x.getChildContext!="function")return p;x=x.getChildContext();for(var j in x)if(!(j in l))throw Error(n(108,xe(a)||"Unknown",j));return $({},p,x)}function ju(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||eo,Mo=Un.current,Ft(Un,a),Ft(nr,nr.current),!0}function _b(a,l,p){var x=a.stateNode;if(!x)throw Error(n(169));p?(a=Ob(a,l,Mo),x.__reactInternalMemoizedMergedChildContext=a,Wt(nr),Wt(Un),Ft(Un,a)):Wt(nr),Ft(nr,p)}var As=null,ku=!1,am=!1;function Mb(a){As===null?As=[a]:As.push(a)}function ST(a){ku=!0,Mb(a)}function to(){if(!am&&As!==null){am=!0;var a=0,l=At;try{var p=As;for(At=1;a<p.length;a++){var x=p[a];do x=x(!0);while(x!==null)}As=null,ku=!1}catch(j){throw As!==null&&(As=As.slice(a+1)),eu(ol,to),j}finally{At=l,am=!1}}return null}var Fa=[],za=0,Su=null,Nu=0,Dr=[],$r=0,Fo=null,Ps=1,Ds="";function zo(a,l){Fa[za++]=Nu,Fa[za++]=Su,Su=a,Nu=l}function Fb(a,l,p){Dr[$r++]=Ps,Dr[$r++]=Ds,Dr[$r++]=Fo,Fo=a;var x=Ps;a=Ds;var j=32-zn(x)-1;x&=~(1<<j),p+=1;var C=32-zn(l)+j;if(30<C){var O=j-j%5;C=(x&(1<<O)-1).toString(32),x>>=O,j-=O,Ps=1<<32-zn(l)+j|p<<j|x,Ds=C+a}else Ps=1<<C|p<<j|x,Ds=a}function im(a){a.return!==null&&(zo(a,1),Fb(a,1,0))}function lm(a){for(;a===Su;)Su=Fa[--za],Fa[za]=null,Nu=Fa[--za],Fa[za]=null;for(;a===Fo;)Fo=Dr[--$r],Dr[$r]=null,Ds=Dr[--$r],Dr[$r]=null,Ps=Dr[--$r],Dr[$r]=null}var xr=null,yr=null,Jt=!1,Jr=null;function zb(a,l){var p=_r(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=a,l=a.deletions,l===null?(a.deletions=[p],a.flags|=16):l.push(p)}function Bb(a,l){switch(a.tag){case 5:var p=a.type;return l=l.nodeType!==1||p.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(a.stateNode=l,xr=a,yr=Xs(l.firstChild),!0):!1;case 6:return l=a.pendingProps===""||l.nodeType!==3?null:l,l!==null?(a.stateNode=l,xr=a,yr=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(p=Fo!==null?{id:Ps,overflow:Ds}:null,a.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=_r(18,null,null,0),p.stateNode=l,p.return=a,a.child=p,xr=a,yr=null,!0):!1;default:return!1}}function cm(a){return(a.mode&1)!==0&&(a.flags&128)===0}function um(a){if(Jt){var l=yr;if(l){var p=l;if(!Bb(a,l)){if(cm(a))throw Error(n(418));l=Xs(p.nextSibling);var x=xr;l&&Bb(a,l)?zb(x,p):(a.flags=a.flags&-4097|2,Jt=!1,xr=a)}}else{if(cm(a))throw Error(n(418));a.flags=a.flags&-4097|2,Jt=!1,xr=a}}}function Ub(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;xr=a}function Cu(a){if(a!==xr)return!1;if(!Jt)return Ub(a),Jt=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!tm(a.type,a.memoizedProps)),l&&(l=yr)){if(cm(a))throw Wb(),Error(n(418));for(;l;)zb(a,l),l=Xs(l.nextSibling)}if(Ub(a),a.tag===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));e:{for(a=a.nextSibling,l=0;a;){if(a.nodeType===8){var p=a.data;if(p==="/$"){if(l===0){yr=Xs(a.nextSibling);break e}l--}else p!=="$"&&p!=="$!"&&p!=="$?"||l++}a=a.nextSibling}yr=null}}else yr=xr?Xs(a.stateNode.nextSibling):null;return!0}function Wb(){for(var a=yr;a;)a=Xs(a.nextSibling)}function Ba(){yr=xr=null,Jt=!1}function dm(a){Jr===null?Jr=[a]:Jr.push(a)}var NT=T.ReactCurrentBatchConfig;function kl(a,l,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,C=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===C?l.ref:(l=function(O){var G=j.refs;O===null?delete G[C]:G[C]=O},l._stringRef=C,l)}if(typeof a!="string")throw Error(n(284));if(!p._owner)throw Error(n(290,a))}return a}function Eu(a,l){throw a=Object.prototype.toString.call(l),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function Vb(a){var l=a._init;return l(a._payload)}function Hb(a){function l(ie,ne){if(a){var de=ie.deletions;de===null?(ie.deletions=[ne],ie.flags|=16):de.push(ne)}}function p(ie,ne){if(!a)return null;for(;ne!==null;)l(ie,ne),ne=ne.sibling;return null}function x(ie,ne){for(ie=new Map;ne!==null;)ne.key!==null?ie.set(ne.key,ne):ie.set(ne.index,ne),ne=ne.sibling;return ie}function j(ie,ne){return ie=co(ie,ne),ie.index=0,ie.sibling=null,ie}function C(ie,ne,de){return ie.index=de,a?(de=ie.alternate,de!==null?(de=de.index,de<ne?(ie.flags|=2,ne):de):(ie.flags|=2,ne)):(ie.flags|=1048576,ne)}function O(ie){return a&&ie.alternate===null&&(ie.flags|=2),ie}function G(ie,ne,de,De){return ne===null||ne.tag!==6?(ne=nh(de,ie.mode,De),ne.return=ie,ne):(ne=j(ne,de),ne.return=ie,ne)}function Q(ie,ne,de,De){var Xe=de.type;return Xe===A?je(ie,ne,de.props.children,De,de.key):ne!==null&&(ne.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===H&&Vb(Xe)===ne.type)?(De=j(ne,de.props),De.ref=kl(ie,ne,de),De.return=ie,De):(De=Qu(de.type,de.key,de.props,null,ie.mode,De),De.ref=kl(ie,ne,de),De.return=ie,De)}function pe(ie,ne,de,De){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==de.containerInfo||ne.stateNode.implementation!==de.implementation?(ne=rh(de,ie.mode,De),ne.return=ie,ne):(ne=j(ne,de.children||[]),ne.return=ie,ne)}function je(ie,ne,de,De,Xe){return ne===null||ne.tag!==7?(ne=Go(de,ie.mode,De,Xe),ne.return=ie,ne):(ne=j(ne,de),ne.return=ie,ne)}function Ne(ie,ne,de){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=nh(""+ne,ie.mode,de),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case P:return de=Qu(ne.type,ne.key,ne.props,null,ie.mode,de),de.ref=kl(ie,null,ne),de.return=ie,de;case R:return ne=rh(ne,ie.mode,de),ne.return=ie,ne;case H:var De=ne._init;return Ne(ie,De(ne._payload),de)}if(Me(ne)||K(ne))return ne=Go(ne,ie.mode,de,null),ne.return=ie,ne;Eu(ie,ne)}return null}function we(ie,ne,de,De){var Xe=ne!==null?ne.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return Xe!==null?null:G(ie,ne,""+de,De);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case P:return de.key===Xe?Q(ie,ne,de,De):null;case R:return de.key===Xe?pe(ie,ne,de,De):null;case H:return Xe=de._init,we(ie,ne,Xe(de._payload),De)}if(Me(de)||K(de))return Xe!==null?null:je(ie,ne,de,De,null);Eu(ie,de)}return null}function Be(ie,ne,de,De,Xe){if(typeof De=="string"&&De!==""||typeof De=="number")return ie=ie.get(de)||null,G(ne,ie,""+De,Xe);if(typeof De=="object"&&De!==null){switch(De.$$typeof){case P:return ie=ie.get(De.key===null?de:De.key)||null,Q(ne,ie,De,Xe);case R:return ie=ie.get(De.key===null?de:De.key)||null,pe(ne,ie,De,Xe);case H:var nt=De._init;return Be(ie,ne,de,nt(De._payload),Xe)}if(Me(De)||K(De))return ie=ie.get(de)||null,je(ne,ie,De,Xe,null);Eu(ne,De)}return null}function Ke(ie,ne,de,De){for(var Xe=null,nt=null,rt=ne,it=ne=0,Pn=null;rt!==null&&it<de.length;it++){rt.index>it?(Pn=rt,rt=null):Pn=rt.sibling;var Rt=we(ie,rt,de[it],De);if(Rt===null){rt===null&&(rt=Pn);break}a&&rt&&Rt.alternate===null&&l(ie,rt),ne=C(Rt,ne,it),nt===null?Xe=Rt:nt.sibling=Rt,nt=Rt,rt=Pn}if(it===de.length)return p(ie,rt),Jt&&zo(ie,it),Xe;if(rt===null){for(;it<de.length;it++)rt=Ne(ie,de[it],De),rt!==null&&(ne=C(rt,ne,it),nt===null?Xe=rt:nt.sibling=rt,nt=rt);return Jt&&zo(ie,it),Xe}for(rt=x(ie,rt);it<de.length;it++)Pn=Be(rt,ie,it,de[it],De),Pn!==null&&(a&&Pn.alternate!==null&&rt.delete(Pn.key===null?it:Pn.key),ne=C(Pn,ne,it),nt===null?Xe=Pn:nt.sibling=Pn,nt=Pn);return a&&rt.forEach(function(uo){return l(ie,uo)}),Jt&&zo(ie,it),Xe}function Ge(ie,ne,de,De){var Xe=K(de);if(typeof Xe!="function")throw Error(n(150));if(de=Xe.call(de),de==null)throw Error(n(151));for(var nt=Xe=null,rt=ne,it=ne=0,Pn=null,Rt=de.next();rt!==null&&!Rt.done;it++,Rt=de.next()){rt.index>it?(Pn=rt,rt=null):Pn=rt.sibling;var uo=we(ie,rt,Rt.value,De);if(uo===null){rt===null&&(rt=Pn);break}a&&rt&&uo.alternate===null&&l(ie,rt),ne=C(uo,ne,it),nt===null?Xe=uo:nt.sibling=uo,nt=uo,rt=Pn}if(Rt.done)return p(ie,rt),Jt&&zo(ie,it),Xe;if(rt===null){for(;!Rt.done;it++,Rt=de.next())Rt=Ne(ie,Rt.value,De),Rt!==null&&(ne=C(Rt,ne,it),nt===null?Xe=Rt:nt.sibling=Rt,nt=Rt);return Jt&&zo(ie,it),Xe}for(rt=x(ie,rt);!Rt.done;it++,Rt=de.next())Rt=Be(rt,ie,it,Rt.value,De),Rt!==null&&(a&&Rt.alternate!==null&&rt.delete(Rt.key===null?it:Rt.key),ne=C(Rt,ne,it),nt===null?Xe=Rt:nt.sibling=Rt,nt=Rt);return a&&rt.forEach(function(sR){return l(ie,sR)}),Jt&&zo(ie,it),Xe}function cn(ie,ne,de,De){if(typeof de=="object"&&de!==null&&de.type===A&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case P:e:{for(var Xe=de.key,nt=ne;nt!==null;){if(nt.key===Xe){if(Xe=de.type,Xe===A){if(nt.tag===7){p(ie,nt.sibling),ne=j(nt,de.props.children),ne.return=ie,ie=ne;break e}}else if(nt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===H&&Vb(Xe)===nt.type){p(ie,nt.sibling),ne=j(nt,de.props),ne.ref=kl(ie,nt,de),ne.return=ie,ie=ne;break e}p(ie,nt);break}else l(ie,nt);nt=nt.sibling}de.type===A?(ne=Go(de.props.children,ie.mode,De,de.key),ne.return=ie,ie=ne):(De=Qu(de.type,de.key,de.props,null,ie.mode,De),De.ref=kl(ie,ne,de),De.return=ie,ie=De)}return O(ie);case R:e:{for(nt=de.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===de.containerInfo&&ne.stateNode.implementation===de.implementation){p(ie,ne.sibling),ne=j(ne,de.children||[]),ne.return=ie,ie=ne;break e}else{p(ie,ne);break}else l(ie,ne);ne=ne.sibling}ne=rh(de,ie.mode,De),ne.return=ie,ie=ne}return O(ie);case H:return nt=de._init,cn(ie,ne,nt(de._payload),De)}if(Me(de))return Ke(ie,ne,de,De);if(K(de))return Ge(ie,ne,de,De);Eu(ie,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,ne!==null&&ne.tag===6?(p(ie,ne.sibling),ne=j(ne,de),ne.return=ie,ie=ne):(p(ie,ne),ne=nh(de,ie.mode,De),ne.return=ie,ie=ne),O(ie)):p(ie,ne)}return cn}var Ua=Hb(!0),Kb=Hb(!1),Tu=Zs(null),Ru=null,Wa=null,fm=null;function pm(){fm=Wa=Ru=null}function mm(a){var l=Tu.current;Wt(Tu),a._currentValue=l}function hm(a,l,p){for(;a!==null;){var x=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,x!==null&&(x.childLanes|=l)):x!==null&&(x.childLanes&l)!==l&&(x.childLanes|=l),a===p)break;a=a.return}}function Va(a,l){Ru=a,fm=Wa=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(sr=!0),a.firstContext=null)}function Lr(a){var l=a._currentValue;if(fm!==a)if(a={context:a,memoizedValue:l,next:null},Wa===null){if(Ru===null)throw Error(n(308));Wa=a,Ru.dependencies={lanes:0,firstContext:a}}else Wa=Wa.next=a;return l}var Bo=null;function gm(a){Bo===null?Bo=[a]:Bo.push(a)}function qb(a,l,p,x){var j=l.interleaved;return j===null?(p.next=p,gm(l)):(p.next=j.next,j.next=p),l.interleaved=p,$s(a,x)}function $s(a,l){a.lanes|=l;var p=a.alternate;for(p!==null&&(p.lanes|=l),p=a,a=a.return;a!==null;)a.childLanes|=l,p=a.alternate,p!==null&&(p.childLanes|=l),p=a,a=a.return;return p.tag===3?p.stateNode:null}var no=!1;function xm(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gb(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function Ls(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function ro(a,l,p){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(Nt&2)!==0){var j=x.pending;return j===null?l.next=l:(l.next=j.next,j.next=l),x.pending=l,$s(a,p)}return j=x.interleaved,j===null?(l.next=l,gm(x)):(l.next=j.next,j.next=l),x.interleaved=l,$s(a,p)}function Au(a,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var x=l.lanes;x&=a.pendingLanes,p|=x,l.lanes=p,ll(a,p)}}function Yb(a,l){var p=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,p===x)){var j=null,C=null;if(p=p.firstBaseUpdate,p!==null){do{var O={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};C===null?j=C=O:C=C.next=O,p=p.next}while(p!==null);C===null?j=C=l:C=C.next=l}else j=C=l;p={baseState:x.baseState,firstBaseUpdate:j,lastBaseUpdate:C,shared:x.shared,effects:x.effects},a.updateQueue=p;return}a=p.lastBaseUpdate,a===null?p.firstBaseUpdate=l:a.next=l,p.lastBaseUpdate=l}function Pu(a,l,p,x){var j=a.updateQueue;no=!1;var C=j.firstBaseUpdate,O=j.lastBaseUpdate,G=j.shared.pending;if(G!==null){j.shared.pending=null;var Q=G,pe=Q.next;Q.next=null,O===null?C=pe:O.next=pe,O=Q;var je=a.alternate;je!==null&&(je=je.updateQueue,G=je.lastBaseUpdate,G!==O&&(G===null?je.firstBaseUpdate=pe:G.next=pe,je.lastBaseUpdate=Q))}if(C!==null){var Ne=j.baseState;O=0,je=pe=Q=null,G=C;do{var we=G.lane,Be=G.eventTime;if((x&we)===we){je!==null&&(je=je.next={eventTime:Be,lane:0,tag:G.tag,payload:G.payload,callback:G.callback,next:null});e:{var Ke=a,Ge=G;switch(we=l,Be=p,Ge.tag){case 1:if(Ke=Ge.payload,typeof Ke=="function"){Ne=Ke.call(Be,Ne,we);break e}Ne=Ke;break e;case 3:Ke.flags=Ke.flags&-65537|128;case 0:if(Ke=Ge.payload,we=typeof Ke=="function"?Ke.call(Be,Ne,we):Ke,we==null)break e;Ne=$({},Ne,we);break e;case 2:no=!0}}G.callback!==null&&G.lane!==0&&(a.flags|=64,we=j.effects,we===null?j.effects=[G]:we.push(G))}else Be={eventTime:Be,lane:we,tag:G.tag,payload:G.payload,callback:G.callback,next:null},je===null?(pe=je=Be,Q=Ne):je=je.next=Be,O|=we;if(G=G.next,G===null){if(G=j.shared.pending,G===null)break;we=G,G=we.next,we.next=null,j.lastBaseUpdate=we,j.shared.pending=null}}while(!0);if(je===null&&(Q=Ne),j.baseState=Q,j.firstBaseUpdate=pe,j.lastBaseUpdate=je,l=j.shared.interleaved,l!==null){j=l;do O|=j.lane,j=j.next;while(j!==l)}else C===null&&(j.shared.lanes=0);Vo|=O,a.lanes=O,a.memoizedState=Ne}}function Jb(a,l,p){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var x=a[l],j=x.callback;if(j!==null){if(x.callback=null,x=p,typeof j!="function")throw Error(n(191,j));j.call(x)}}}var Sl={},ms=Zs(Sl),Nl=Zs(Sl),Cl=Zs(Sl);function Uo(a){if(a===Sl)throw Error(n(174));return a}function ym(a,l){switch(Ft(Cl,l),Ft(Nl,a),Ft(ms,Sl),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:J(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=J(l,a)}Wt(ms),Ft(ms,l)}function Ha(){Wt(ms),Wt(Nl),Wt(Cl)}function Qb(a){Uo(Cl.current);var l=Uo(ms.current),p=J(l,a.type);l!==p&&(Ft(Nl,a),Ft(ms,p))}function bm(a){Nl.current===a&&(Wt(ms),Wt(Nl))}var en=Zs(0);function Du(a){for(var l=a;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||p.data==="$?"||p.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var vm=[];function wm(){for(var a=0;a<vm.length;a++)vm[a]._workInProgressVersionPrimary=null;vm.length=0}var $u=T.ReactCurrentDispatcher,jm=T.ReactCurrentBatchConfig,Wo=0,tn=null,wn=null,Rn=null,Lu=!1,El=!1,Tl=0,CT=0;function Wn(){throw Error(n(321))}function km(a,l){if(l===null)return!1;for(var p=0;p<l.length&&p<a.length;p++)if(!Yr(a[p],l[p]))return!1;return!0}function Sm(a,l,p,x,j,C){if(Wo=C,tn=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,$u.current=a===null||a.memoizedState===null?AT:PT,a=p(x,j),El){C=0;do{if(El=!1,Tl=0,25<=C)throw Error(n(301));C+=1,Rn=wn=null,l.updateQueue=null,$u.current=DT,a=p(x,j)}while(El)}if($u.current=_u,l=wn!==null&&wn.next!==null,Wo=0,Rn=wn=tn=null,Lu=!1,l)throw Error(n(300));return a}function Nm(){var a=Tl!==0;return Tl=0,a}function hs(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?tn.memoizedState=Rn=a:Rn=Rn.next=a,Rn}function Ir(){if(wn===null){var a=tn.alternate;a=a!==null?a.memoizedState:null}else a=wn.next;var l=Rn===null?tn.memoizedState:Rn.next;if(l!==null)Rn=l,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},Rn===null?tn.memoizedState=Rn=a:Rn=Rn.next=a}return Rn}function Rl(a,l){return typeof l=="function"?l(a):l}function Cm(a){var l=Ir(),p=l.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=a;var x=wn,j=x.baseQueue,C=p.pending;if(C!==null){if(j!==null){var O=j.next;j.next=C.next,C.next=O}x.baseQueue=j=C,p.pending=null}if(j!==null){C=j.next,x=x.baseState;var G=O=null,Q=null,pe=C;do{var je=pe.lane;if((Wo&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 Ne={lane:je,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null};Q===null?(G=Q=Ne,O=x):Q=Q.next=Ne,tn.lanes|=je,Vo|=je}pe=pe.next}while(pe!==null&&pe!==C);Q===null?O=x:Q.next=G,Yr(x,l.memoizedState)||(sr=!0),l.memoizedState=x,l.baseState=O,l.baseQueue=Q,p.lastRenderedState=x}if(a=p.interleaved,a!==null){j=a;do C=j.lane,tn.lanes|=C,Vo|=C,j=j.next;while(j!==a)}else j===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function Em(a){var l=Ir(),p=l.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=a;var x=p.dispatch,j=p.pending,C=l.memoizedState;if(j!==null){p.pending=null;var O=j=j.next;do C=a(C,O.action),O=O.next;while(O!==j);Yr(C,l.memoizedState)||(sr=!0),l.memoizedState=C,l.baseQueue===null&&(l.baseState=C),p.lastRenderedState=C}return[C,x]}function Xb(){}function Zb(a,l){var p=tn,x=Ir(),j=l(),C=!Yr(x.memoizedState,j);if(C&&(x.memoizedState=j,sr=!0),x=x.queue,Tm(nv.bind(null,p,x,a),[a]),x.getSnapshot!==l||C||Rn!==null&&Rn.memoizedState.tag&1){if(p.flags|=2048,Al(9,tv.bind(null,p,x,j,l),void 0,null),An===null)throw Error(n(349));(Wo&30)!==0||ev(p,l,j)}return j}function ev(a,l,p){a.flags|=16384,a={getSnapshot:l,value:p},l=tn.updateQueue,l===null?(l={lastEffect:null,stores:null},tn.updateQueue=l,l.stores=[a]):(p=l.stores,p===null?l.stores=[a]:p.push(a))}function tv(a,l,p,x){l.value=p,l.getSnapshot=x,rv(l)&&sv(a)}function nv(a,l,p){return p(function(){rv(l)&&sv(a)})}function rv(a){var l=a.getSnapshot;a=a.value;try{var p=l();return!Yr(a,p)}catch{return!0}}function sv(a){var l=$s(a,1);l!==null&&es(l,a,1,-1)}function ov(a){var l=hs();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Rl,lastRenderedState:a},l.queue=a,a=a.dispatch=RT.bind(null,tn,a),[l.memoizedState,a]}function Al(a,l,p,x){return a={tag:a,create:l,destroy:p,deps:x,next:null},l=tn.updateQueue,l===null?(l={lastEffect:null,stores:null},tn.updateQueue=l,l.lastEffect=a.next=a):(p=l.lastEffect,p===null?l.lastEffect=a.next=a:(x=p.next,p.next=a,a.next=x,l.lastEffect=a)),a}function av(){return Ir().memoizedState}function Iu(a,l,p,x){var j=hs();tn.flags|=a,j.memoizedState=Al(1|l,p,void 0,x===void 0?null:x)}function Ou(a,l,p,x){var j=Ir();x=x===void 0?null:x;var C=void 0;if(wn!==null){var O=wn.memoizedState;if(C=O.destroy,x!==null&&km(x,O.deps)){j.memoizedState=Al(l,p,C,x);return}}tn.flags|=a,j.memoizedState=Al(1|l,p,C,x)}function iv(a,l){return Iu(8390656,8,a,l)}function Tm(a,l){return Ou(2048,8,a,l)}function lv(a,l){return Ou(4,2,a,l)}function cv(a,l){return Ou(4,4,a,l)}function uv(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function dv(a,l,p){return p=p!=null?p.concat([a]):null,Ou(4,4,uv.bind(null,l,a),p)}function Rm(){}function fv(a,l){var p=Ir();l=l===void 0?null:l;var x=p.memoizedState;return x!==null&&l!==null&&km(l,x[1])?x[0]:(p.memoizedState=[a,l],a)}function pv(a,l){var p=Ir();l=l===void 0?null:l;var x=p.memoizedState;return x!==null&&l!==null&&km(l,x[1])?x[0]:(a=a(),p.memoizedState=[a,l],a)}function mv(a,l,p){return(Wo&21)===0?(a.baseState&&(a.baseState=!1,sr=!0),a.memoizedState=p):(Yr(p,l)||(p=al(),tn.lanes|=p,Vo|=p,a.baseState=!0),l)}function ET(a,l){var p=At;At=p!==0&&4>p?p:4,a(!0);var x=jm.transition;jm.transition={};try{a(!1),l()}finally{At=p,jm.transition=x}}function hv(){return Ir().memoizedState}function TT(a,l,p){var x=io(a);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},gv(a))xv(l,p);else if(p=qb(a,l,p,x),p!==null){var j=Qn();es(p,a,x,j),yv(p,l,x)}}function RT(a,l,p){var x=io(a),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(gv(a))xv(l,j);else{var C=a.alternate;if(a.lanes===0&&(C===null||C.lanes===0)&&(C=l.lastRenderedReducer,C!==null))try{var O=l.lastRenderedState,G=C(O,p);if(j.hasEagerState=!0,j.eagerState=G,Yr(G,O)){var Q=l.interleaved;Q===null?(j.next=j,gm(l)):(j.next=Q.next,Q.next=j),l.interleaved=j;return}}catch{}finally{}p=qb(a,l,j,x),p!==null&&(j=Qn(),es(p,a,x,j),yv(p,l,x))}}function gv(a){var l=a.alternate;return a===tn||l!==null&&l===tn}function xv(a,l){El=Lu=!0;var p=a.pending;p===null?l.next=l:(l.next=p.next,p.next=l),a.pending=l}function yv(a,l,p){if((p&4194240)!==0){var x=l.lanes;x&=a.pendingLanes,p|=x,l.lanes=p,ll(a,p)}}var _u={readContext:Lr,useCallback:Wn,useContext:Wn,useEffect:Wn,useImperativeHandle:Wn,useInsertionEffect:Wn,useLayoutEffect:Wn,useMemo:Wn,useReducer:Wn,useRef:Wn,useState:Wn,useDebugValue:Wn,useDeferredValue:Wn,useTransition:Wn,useMutableSource:Wn,useSyncExternalStore:Wn,useId:Wn,unstable_isNewReconciler:!1},AT={readContext:Lr,useCallback:function(a,l){return hs().memoizedState=[a,l===void 0?null:l],a},useContext:Lr,useEffect:iv,useImperativeHandle:function(a,l,p){return p=p!=null?p.concat([a]):null,Iu(4194308,4,uv.bind(null,l,a),p)},useLayoutEffect:function(a,l){return Iu(4194308,4,a,l)},useInsertionEffect:function(a,l){return Iu(4,2,a,l)},useMemo:function(a,l){var p=hs();return l=l===void 0?null:l,a=a(),p.memoizedState=[a,l],a},useReducer:function(a,l,p){var x=hs();return l=p!==void 0?p(l):l,x.memoizedState=x.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},x.queue=a,a=a.dispatch=TT.bind(null,tn,a),[x.memoizedState,a]},useRef:function(a){var l=hs();return a={current:a},l.memoizedState=a},useState:ov,useDebugValue:Rm,useDeferredValue:function(a){return hs().memoizedState=a},useTransition:function(){var a=ov(!1),l=a[0];return a=ET.bind(null,a[1]),hs().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,p){var x=tn,j=hs();if(Jt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),An===null)throw Error(n(349));(Wo&30)!==0||ev(x,l,p)}j.memoizedState=p;var C={value:p,getSnapshot:l};return j.queue=C,iv(nv.bind(null,x,C,a),[a]),x.flags|=2048,Al(9,tv.bind(null,x,C,p,l),void 0,null),p},useId:function(){var a=hs(),l=An.identifierPrefix;if(Jt){var p=Ds,x=Ps;p=(x&~(1<<32-zn(x)-1)).toString(32)+p,l=":"+l+"R"+p,p=Tl++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=CT++,l=":"+l+"r"+p.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},PT={readContext:Lr,useCallback:fv,useContext:Lr,useEffect:Tm,useImperativeHandle:dv,useInsertionEffect:lv,useLayoutEffect:cv,useMemo:pv,useReducer:Cm,useRef:av,useState:function(){return Cm(Rl)},useDebugValue:Rm,useDeferredValue:function(a){var l=Ir();return mv(l,wn.memoizedState,a)},useTransition:function(){var a=Cm(Rl)[0],l=Ir().memoizedState;return[a,l]},useMutableSource:Xb,useSyncExternalStore:Zb,useId:hv,unstable_isNewReconciler:!1},DT={readContext:Lr,useCallback:fv,useContext:Lr,useEffect:Tm,useImperativeHandle:dv,useInsertionEffect:lv,useLayoutEffect:cv,useMemo:pv,useReducer:Em,useRef:av,useState:function(){return Em(Rl)},useDebugValue:Rm,useDeferredValue:function(a){var l=Ir();return wn===null?l.memoizedState=a:mv(l,wn.memoizedState,a)},useTransition:function(){var a=Em(Rl)[0],l=Ir().memoizedState;return[a,l]},useMutableSource:Xb,useSyncExternalStore:Zb,useId:hv,unstable_isNewReconciler:!1};function Qr(a,l){if(a&&a.defaultProps){l=$({},l),a=a.defaultProps;for(var p in a)l[p]===void 0&&(l[p]=a[p]);return l}return l}function Am(a,l,p,x){l=a.memoizedState,p=p(x,l),p=p==null?l:$({},l,p),a.memoizedState=p,a.lanes===0&&(a.updateQueue.baseState=p)}var Mu={isMounted:function(a){return(a=a._reactInternals)?ht(a)===a:!1},enqueueSetState:function(a,l,p){a=a._reactInternals;var x=Qn(),j=io(a),C=Ls(x,j);C.payload=l,p!=null&&(C.callback=p),l=ro(a,C,j),l!==null&&(es(l,a,j,x),Au(l,a,j))},enqueueReplaceState:function(a,l,p){a=a._reactInternals;var x=Qn(),j=io(a),C=Ls(x,j);C.tag=1,C.payload=l,p!=null&&(C.callback=p),l=ro(a,C,j),l!==null&&(es(l,a,j,x),Au(l,a,j))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var p=Qn(),x=io(a),j=Ls(p,x);j.tag=2,l!=null&&(j.callback=l),l=ro(a,j,x),l!==null&&(es(l,a,x,p),Au(l,a,x))}};function bv(a,l,p,x,j,C,O){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(x,C,O):l.prototype&&l.prototype.isPureReactComponent?!gl(p,x)||!gl(j,C):!0}function vv(a,l,p){var x=!1,j=eo,C=l.contextType;return typeof C=="object"&&C!==null?C=Lr(C):(j=rr(l)?Mo:Un.current,x=l.contextTypes,C=(x=x!=null)?Ma(a,j):eo),l=new l(p,C),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Mu,a.stateNode=l,l._reactInternals=a,x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=j,a.__reactInternalMemoizedMaskedChildContext=C),l}function wv(a,l,p,x){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,x),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,x),l.state!==a&&Mu.enqueueReplaceState(l,l.state,null)}function Pm(a,l,p,x){var j=a.stateNode;j.props=p,j.state=a.memoizedState,j.refs={},xm(a);var C=l.contextType;typeof C=="object"&&C!==null?j.context=Lr(C):(C=rr(l)?Mo:Un.current,j.context=Ma(a,C)),j.state=a.memoizedState,C=l.getDerivedStateFromProps,typeof C=="function"&&(Am(a,l,C,p),j.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(l=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),l!==j.state&&Mu.enqueueReplaceState(j,j.state,null),Pu(a,p,j,x),j.state=a.memoizedState),typeof j.componentDidMount=="function"&&(a.flags|=4194308)}function Ka(a,l){try{var p="",x=l;do p+=ue(x),x=x.return;while(x);var j=p}catch(C){j=`
39
- Error generating stack: `+C.message+`
40
- `+C.stack}return{value:a,source:l,stack:j,digest:null}}function Dm(a,l,p){return{value:a,source:null,stack:p??null,digest:l??null}}function $m(a,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var $T=typeof WeakMap=="function"?WeakMap:Map;function jv(a,l,p){p=Ls(-1,p),p.tag=3,p.payload={element:null};var x=l.value;return p.callback=function(){Hu||(Hu=!0,Gm=x),$m(a,l)},p}function kv(a,l,p){p=Ls(-1,p),p.tag=3;var x=a.type.getDerivedStateFromError;if(typeof x=="function"){var j=l.value;p.payload=function(){return x(j)},p.callback=function(){$m(a,l)}}var C=a.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(p.callback=function(){$m(a,l),typeof x!="function"&&(oo===null?oo=new Set([this]):oo.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})}),p}function Sv(a,l,p){var x=a.pingCache;if(x===null){x=a.pingCache=new $T;var j=new Set;x.set(l,j)}else j=x.get(l),j===void 0&&(j=new Set,x.set(l,j));j.has(p)||(j.add(p),a=qT.bind(null,a,l,p),l.then(a,a))}function Nv(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function Cv(a,l,p,x,j){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=Ls(-1,1),l.tag=2,ro(p,l,1))),p.lanes|=1),a):(a.flags|=65536,a.lanes=j,a)}var LT=T.ReactCurrentOwner,sr=!1;function Jn(a,l,p,x){l.child=a===null?Kb(l,null,p,x):Ua(l,a.child,p,x)}function Ev(a,l,p,x,j){p=p.render;var C=l.ref;return Va(l,j),x=Sm(a,l,p,x,C,j),p=Nm(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~j,Is(a,l,j)):(Jt&&p&&im(l),l.flags|=1,Jn(a,l,x,j),l.child)}function Tv(a,l,p,x,j){if(a===null){var C=p.type;return typeof C=="function"&&!th(C)&&C.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=C,Rv(a,l,C,x,j)):(a=Qu(p.type,null,x,l,l.mode,j),a.ref=l.ref,a.return=l,l.child=a)}if(C=a.child,(a.lanes&j)===0){var O=C.memoizedProps;if(p=p.compare,p=p!==null?p:gl,p(O,x)&&a.ref===l.ref)return Is(a,l,j)}return l.flags|=1,a=co(C,x),a.ref=l.ref,a.return=l,l.child=a}function Rv(a,l,p,x,j){if(a!==null){var C=a.memoizedProps;if(gl(C,x)&&a.ref===l.ref)if(sr=!1,l.pendingProps=x=C,(a.lanes&j)!==0)(a.flags&131072)!==0&&(sr=!0);else return l.lanes=a.lanes,Is(a,l,j)}return Lm(a,l,p,x,j)}function Av(a,l,p){var x=l.pendingProps,j=x.children,C=a!==null?a.memoizedState:null;if(x.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ft(Ga,br),br|=p;else{if((p&1073741824)===0)return a=C!==null?C.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null,transitions:null},l.updateQueue=null,Ft(Ga,br),br|=a,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=C!==null?C.baseLanes:p,Ft(Ga,br),br|=x}else C!==null?(x=C.baseLanes|p,l.memoizedState=null):x=p,Ft(Ga,br),br|=x;return Jn(a,l,j,p),l.child}function Pv(a,l){var p=l.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Lm(a,l,p,x,j){var C=rr(p)?Mo:Un.current;return C=Ma(l,C),Va(l,j),p=Sm(a,l,p,x,C,j),x=Nm(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~j,Is(a,l,j)):(Jt&&x&&im(l),l.flags|=1,Jn(a,l,p,j),l.child)}function Dv(a,l,p,x,j){if(rr(p)){var C=!0;ju(l)}else C=!1;if(Va(l,j),l.stateNode===null)zu(a,l),vv(l,p,x),Pm(l,p,x,j),x=!0;else if(a===null){var O=l.stateNode,G=l.memoizedProps;O.props=G;var Q=O.context,pe=p.contextType;typeof pe=="object"&&pe!==null?pe=Lr(pe):(pe=rr(p)?Mo:Un.current,pe=Ma(l,pe));var je=p.getDerivedStateFromProps,Ne=typeof je=="function"||typeof O.getSnapshotBeforeUpdate=="function";Ne||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==x||Q!==pe)&&wv(l,O,x,pe),no=!1;var we=l.memoizedState;O.state=we,Pu(l,x,O,j),Q=l.memoizedState,G!==x||we!==Q||nr.current||no?(typeof je=="function"&&(Am(l,p,je,x),Q=l.memoizedState),(G=no||bv(l,p,G,x,we,Q,pe))?(Ne||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(l.flags|=4194308)):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=x,l.memoizedState=Q),O.props=x,O.state=Q,O.context=pe,x=G):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),x=!1)}else{O=l.stateNode,Gb(a,l),G=l.memoizedProps,pe=l.type===l.elementType?G:Qr(l.type,G),O.props=pe,Ne=l.pendingProps,we=O.context,Q=p.contextType,typeof Q=="object"&&Q!==null?Q=Lr(Q):(Q=rr(p)?Mo:Un.current,Q=Ma(l,Q));var Be=p.getDerivedStateFromProps;(je=typeof Be=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==Ne||we!==Q)&&wv(l,O,x,Q),no=!1,we=l.memoizedState,O.state=we,Pu(l,x,O,j);var Ke=l.memoizedState;G!==Ne||we!==Ke||nr.current||no?(typeof Be=="function"&&(Am(l,p,Be,x),Ke=l.memoizedState),(pe=no||bv(l,p,pe,x,we,Ke,Q)||!1)?(je||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(x,Ke,Q),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(x,Ke,Q)),typeof O.componentDidUpdate=="function"&&(l.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof O.componentDidUpdate!="function"||G===a.memoizedProps&&we===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||G===a.memoizedProps&&we===a.memoizedState||(l.flags|=1024),l.memoizedProps=x,l.memoizedState=Ke),O.props=x,O.state=Ke,O.context=Q,x=pe):(typeof O.componentDidUpdate!="function"||G===a.memoizedProps&&we===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||G===a.memoizedProps&&we===a.memoizedState||(l.flags|=1024),x=!1)}return Im(a,l,p,x,C,j)}function Im(a,l,p,x,j,C){Pv(a,l);var O=(l.flags&128)!==0;if(!x&&!O)return j&&_b(l,p,!1),Is(a,l,C);x=l.stateNode,LT.current=l;var G=O&&typeof p.getDerivedStateFromError!="function"?null:x.render();return l.flags|=1,a!==null&&O?(l.child=Ua(l,a.child,null,C),l.child=Ua(l,null,G,C)):Jn(a,l,G,C),l.memoizedState=x.state,j&&_b(l,p,!0),l.child}function $v(a){var l=a.stateNode;l.pendingContext?Ib(a,l.pendingContext,l.pendingContext!==l.context):l.context&&Ib(a,l.context,!1),ym(a,l.containerInfo)}function Lv(a,l,p,x,j){return Ba(),dm(j),l.flags|=256,Jn(a,l,p,x),l.child}var Om={dehydrated:null,treeContext:null,retryLane:0};function _m(a){return{baseLanes:a,cachePool:null,transitions:null}}function Iv(a,l,p){var x=l.pendingProps,j=en.current,C=!1,O=(l.flags&128)!==0,G;if((G=O)||(G=a!==null&&a.memoizedState===null?!1:(j&2)!==0),G?(C=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(j|=1),Ft(en,j&1),a===null)return um(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:a.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(O=x.children,a=x.fallback,C?(x=l.mode,C=l.child,O={mode:"hidden",children:O},(x&1)===0&&C!==null?(C.childLanes=0,C.pendingProps=O):C=Xu(O,x,0,null),a=Go(a,x,p,null),C.return=l,a.return=l,C.sibling=a,l.child=C,l.child.memoizedState=_m(p),l.memoizedState=Om,a):Mm(l,O));if(j=a.memoizedState,j!==null&&(G=j.dehydrated,G!==null))return IT(a,l,O,x,G,j,p);if(C){C=x.fallback,O=l.mode,j=a.child,G=j.sibling;var Q={mode:"hidden",children:x.children};return(O&1)===0&&l.child!==j?(x=l.child,x.childLanes=0,x.pendingProps=Q,l.deletions=null):(x=co(j,Q),x.subtreeFlags=j.subtreeFlags&14680064),G!==null?C=co(G,C):(C=Go(C,O,p,null),C.flags|=2),C.return=l,x.return=l,x.sibling=C,l.child=x,x=C,C=l.child,O=a.child.memoizedState,O=O===null?_m(p):{baseLanes:O.baseLanes|p,cachePool:null,transitions:O.transitions},C.memoizedState=O,C.childLanes=a.childLanes&~p,l.memoizedState=Om,x}return C=a.child,a=C.sibling,x=co(C,{mode:"visible",children:x.children}),(l.mode&1)===0&&(x.lanes=p),x.return=l,x.sibling=null,a!==null&&(p=l.deletions,p===null?(l.deletions=[a],l.flags|=16):p.push(a)),l.child=x,l.memoizedState=null,x}function Mm(a,l){return l=Xu({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function Fu(a,l,p,x){return x!==null&&dm(x),Ua(l,a.child,null,p),a=Mm(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function IT(a,l,p,x,j,C,O){if(p)return l.flags&256?(l.flags&=-257,x=Dm(Error(n(422))),Fu(a,l,O,x)):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(C=x.fallback,j=l.mode,x=Xu({mode:"visible",children:x.children},j,0,null),C=Go(C,j,O,null),C.flags|=2,x.return=l,C.return=l,x.sibling=C,l.child=x,(l.mode&1)!==0&&Ua(l,a.child,null,O),l.child.memoizedState=_m(O),l.memoizedState=Om,C);if((l.mode&1)===0)return Fu(a,l,O,null);if(j.data==="$!"){if(x=j.nextSibling&&j.nextSibling.dataset,x)var G=x.dgst;return x=G,C=Error(n(419)),x=Dm(C,x,void 0),Fu(a,l,O,x)}if(G=(O&a.childLanes)!==0,sr||G){if(x=An,x!==null){switch(O&-O){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|O))!==0?0:j,j!==0&&j!==C.retryLane&&(C.retryLane=j,$s(a,j),es(x,a,j,-1))}return eh(),x=Dm(Error(n(421))),Fu(a,l,O,x)}return j.data==="$?"?(l.flags|=128,l.child=a.child,l=GT.bind(null,a),j._reactRetry=l,null):(a=C.treeContext,yr=Xs(j.nextSibling),xr=l,Jt=!0,Jr=null,a!==null&&(Dr[$r++]=Ps,Dr[$r++]=Ds,Dr[$r++]=Fo,Ps=a.id,Ds=a.overflow,Fo=l),l=Mm(l,x.children),l.flags|=4096,l)}function Ov(a,l,p){a.lanes|=l;var x=a.alternate;x!==null&&(x.lanes|=l),hm(a.return,l,p)}function Fm(a,l,p,x,j){var C=a.memoizedState;C===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:x,tail:p,tailMode:j}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=x,C.tail=p,C.tailMode=j)}function _v(a,l,p){var x=l.pendingProps,j=x.revealOrder,C=x.tail;if(Jn(a,l,x.children,p),x=en.current,(x&2)!==0)x=x&1|2,l.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Ov(a,p,l);else if(a.tag===19)Ov(a,p,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}x&=1}if(Ft(en,x),(l.mode&1)===0)l.memoizedState=null;else switch(j){case"forwards":for(p=l.child,j=null;p!==null;)a=p.alternate,a!==null&&Du(a)===null&&(j=p),p=p.sibling;p=j,p===null?(j=l.child,l.child=null):(j=p.sibling,p.sibling=null),Fm(l,!1,j,p,C);break;case"backwards":for(p=null,j=l.child,l.child=null;j!==null;){if(a=j.alternate,a!==null&&Du(a)===null){l.child=j;break}a=j.sibling,j.sibling=p,p=j,j=a}Fm(l,!0,p,null,C);break;case"together":Fm(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function zu(a,l){(l.mode&1)===0&&a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2)}function Is(a,l,p){if(a!==null&&(l.dependencies=a.dependencies),Vo|=l.lanes,(p&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(n(153));if(l.child!==null){for(a=l.child,p=co(a,a.pendingProps),l.child=p,p.return=l;a.sibling!==null;)a=a.sibling,p=p.sibling=co(a,a.pendingProps),p.return=l;p.sibling=null}return l.child}function OT(a,l,p){switch(l.tag){case 3:$v(l),Ba();break;case 5:Qb(l);break;case 1:rr(l.type)&&ju(l);break;case 4:ym(l,l.stateNode.containerInfo);break;case 10:var x=l.type._context,j=l.memoizedProps.value;Ft(Tu,x._currentValue),x._currentValue=j;break;case 13:if(x=l.memoizedState,x!==null)return x.dehydrated!==null?(Ft(en,en.current&1),l.flags|=128,null):(p&l.child.childLanes)!==0?Iv(a,l,p):(Ft(en,en.current&1),a=Is(a,l,p),a!==null?a.sibling:null);Ft(en,en.current&1);break;case 19:if(x=(p&l.childLanes)!==0,(a.flags&128)!==0){if(x)return _v(a,l,p);l.flags|=128}if(j=l.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 l.lanes=0,Av(a,l,p)}return Is(a,l,p)}var Mv,zm,Fv,zv;Mv=function(a,l){for(var p=l.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===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},zm=function(){},Fv=function(a,l,p,x){var j=a.memoizedProps;if(j!==x){a=l.stateNode,Uo(ms.current);var C=null;switch(p){case"input":j=ot(a,j),x=ot(a,x),C=[];break;case"select":j=$({},j,{value:void 0}),x=$({},x,{value:void 0}),C=[];break;case"textarea":j=Je(a,j),x=Je(a,x),C=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(a.onclick=bu)}Ue(p,x);var O;p=null;for(pe in j)if(!x.hasOwnProperty(pe)&&j.hasOwnProperty(pe)&&j[pe]!=null)if(pe==="style"){var G=j[pe];for(O in G)G.hasOwnProperty(O)&&(p||(p={}),p[O]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(o.hasOwnProperty(pe)?C||(C=[]):(C=C||[]).push(pe,null));for(pe in x){var Q=x[pe];if(G=j!=null?j[pe]:void 0,x.hasOwnProperty(pe)&&Q!==G&&(Q!=null||G!=null))if(pe==="style")if(G){for(O in G)!G.hasOwnProperty(O)||Q&&Q.hasOwnProperty(O)||(p||(p={}),p[O]="");for(O in Q)Q.hasOwnProperty(O)&&G[O]!==Q[O]&&(p||(p={}),p[O]=Q[O])}else p||(C||(C=[]),C.push(pe,p)),p=Q;else pe==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,G=G?G.__html:void 0,Q!=null&&G!==Q&&(C=C||[]).push(pe,Q)):pe==="children"?typeof Q!="string"&&typeof Q!="number"||(C=C||[]).push(pe,""+Q):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(o.hasOwnProperty(pe)?(Q!=null&&pe==="onScroll"&&Ut("scroll",a),C||G===Q||(C=[])):(C=C||[]).push(pe,Q))}p&&(C=C||[]).push("style",p);var pe=C;(l.updateQueue=pe)&&(l.flags|=4)}},zv=function(a,l,p,x){p!==x&&(l.flags|=4)};function Pl(a,l){if(!Jt)switch(a.tailMode){case"hidden":l=a.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.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?l||a.tail===null?a.tail=null:a.tail.sibling=null:x.sibling=null}}function Vn(a){var l=a.alternate!==null&&a.alternate.child===a.child,p=0,x=0;if(l)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,l}function _T(a,l,p){var x=l.pendingProps;switch(lm(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Vn(l),null;case 1:return rr(l.type)&&wu(),Vn(l),null;case 3:return x=l.stateNode,Ha(),Wt(nr),Wt(Un),wm(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(a===null||a.child===null)&&(Cu(l)?l.flags|=4:a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Jr!==null&&(Qm(Jr),Jr=null))),zm(a,l),Vn(l),null;case 5:bm(l);var j=Uo(Cl.current);if(p=l.type,a!==null&&l.stateNode!=null)Fv(a,l,p,x,j),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!x){if(l.stateNode===null)throw Error(n(166));return Vn(l),null}if(a=Uo(ms.current),Cu(l)){x=l.stateNode,p=l.type;var C=l.memoizedProps;switch(x[ps]=l,x[wl]=C,a=(l.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<yl.length;j++)Ut(yl[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":Z(x,C),Ut("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!C.multiple},Ut("invalid",x);break;case"textarea":$t(x,C),Ut("invalid",x)}Ue(p,C),j=null;for(var O in C)if(C.hasOwnProperty(O)){var G=C[O];O==="children"?typeof G=="string"?x.textContent!==G&&(C.suppressHydrationWarning!==!0&&yu(x.textContent,G,a),j=["children",G]):typeof G=="number"&&x.textContent!==""+G&&(C.suppressHydrationWarning!==!0&&yu(x.textContent,G,a),j=["children",""+G]):o.hasOwnProperty(O)&&G!=null&&O==="onScroll"&&Ut("scroll",x)}switch(p){case"input":Qe(x),Ie(x,C,!0);break;case"textarea":Qe(x),ct(x);break;case"select":case"option":break;default:typeof C.onClick=="function"&&(x.onclick=bu)}x=j,l.updateQueue=x,x!==null&&(l.flags|=4)}else{O=j.nodeType===9?j:j.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=le(p)),a==="http://www.w3.org/1999/xhtml"?p==="script"?(a=O.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof x.is=="string"?a=O.createElement(p,{is:x.is}):(a=O.createElement(p),p==="select"&&(O=a,x.multiple?O.multiple=!0:x.size&&(O.size=x.size))):a=O.createElementNS(a,p),a[ps]=l,a[wl]=x,Mv(a,l,!1,!1),l.stateNode=a;e:{switch(O=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<yl.length;j++)Ut(yl[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":Z(a,x),j=ot(a,x),Ut("invalid",a);break;case"option":j=x;break;case"select":a._wrapperState={wasMultiple:!!x.multiple},j=$({},x,{value:void 0}),Ut("invalid",a);break;case"textarea":$t(a,x),j=Je(a,x),Ut("invalid",a);break;default:j=x}Ue(p,j),G=j;for(C in G)if(G.hasOwnProperty(C)){var Q=G[C];C==="style"?fe(a,Q):C==="dangerouslySetInnerHTML"?(Q=Q?Q.__html:void 0,Q!=null&&re(a,Q)):C==="children"?typeof Q=="string"?(p!=="textarea"||Q!=="")&&ye(a,Q):typeof Q=="number"&&ye(a,""+Q):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(o.hasOwnProperty(C)?Q!=null&&C==="onScroll"&&Ut("scroll",a):Q!=null&&S(a,C,Q,O))}switch(p){case"input":Qe(a),Ie(a,x,!1);break;case"textarea":Qe(a),ct(a);break;case"option":x.value!=null&&a.setAttribute("value",""+ke(x.value));break;case"select":a.multiple=!!x.multiple,C=x.value,C!=null?et(a,!!x.multiple,C,!1):x.defaultValue!=null&&et(a,!!x.multiple,x.defaultValue,!0);break;default:typeof j.onClick=="function"&&(a.onclick=bu)}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&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Vn(l),null;case 6:if(a&&l.stateNode!=null)zv(a,l,a.memoizedProps,x);else{if(typeof x!="string"&&l.stateNode===null)throw Error(n(166));if(p=Uo(Cl.current),Uo(ms.current),Cu(l)){if(x=l.stateNode,p=l.memoizedProps,x[ps]=l,(C=x.nodeValue!==p)&&(a=xr,a!==null))switch(a.tag){case 3:yu(x.nodeValue,p,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&yu(x.nodeValue,p,(a.mode&1)!==0)}C&&(l.flags|=4)}else x=(p.nodeType===9?p:p.ownerDocument).createTextNode(x),x[ps]=l,l.stateNode=x}return Vn(l),null;case 13:if(Wt(en),x=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Jt&&yr!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Wb(),Ba(),l.flags|=98560,C=!1;else if(C=Cu(l),x!==null&&x.dehydrated!==null){if(a===null){if(!C)throw Error(n(318));if(C=l.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(n(317));C[ps]=l}else Ba(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Vn(l),C=!1}else Jr!==null&&(Qm(Jr),Jr=null),C=!0;if(!C)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=p,l):(x=x!==null,x!==(a!==null&&a.memoizedState!==null)&&x&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(en.current&1)!==0?jn===0&&(jn=3):eh())),l.updateQueue!==null&&(l.flags|=4),Vn(l),null);case 4:return Ha(),zm(a,l),a===null&&bl(l.stateNode.containerInfo),Vn(l),null;case 10:return mm(l.type._context),Vn(l),null;case 17:return rr(l.type)&&wu(),Vn(l),null;case 19:if(Wt(en),C=l.memoizedState,C===null)return Vn(l),null;if(x=(l.flags&128)!==0,O=C.rendering,O===null)if(x)Pl(C,!1);else{if(jn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(O=Du(a),O!==null){for(l.flags|=128,Pl(C,!1),x=O.updateQueue,x!==null&&(l.updateQueue=x,l.flags|=4),l.subtreeFlags=0,x=p,p=l.child;p!==null;)C=p,a=x,C.flags&=14680066,O=C.alternate,O===null?(C.childLanes=0,C.lanes=a,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=O.childLanes,C.lanes=O.lanes,C.child=O.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=O.memoizedProps,C.memoizedState=O.memoizedState,C.updateQueue=O.updateQueue,C.type=O.type,a=O.dependencies,C.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),p=p.sibling;return Ft(en,en.current&1|2),l.child}a=a.sibling}C.tail!==null&&Zt()>Ya&&(l.flags|=128,x=!0,Pl(C,!1),l.lanes=4194304)}else{if(!x)if(a=Du(O),a!==null){if(l.flags|=128,x=!0,p=a.updateQueue,p!==null&&(l.updateQueue=p,l.flags|=4),Pl(C,!0),C.tail===null&&C.tailMode==="hidden"&&!O.alternate&&!Jt)return Vn(l),null}else 2*Zt()-C.renderingStartTime>Ya&&p!==1073741824&&(l.flags|=128,x=!0,Pl(C,!1),l.lanes=4194304);C.isBackwards?(O.sibling=l.child,l.child=O):(p=C.last,p!==null?p.sibling=O:l.child=O,C.last=O)}return C.tail!==null?(l=C.tail,C.rendering=l,C.tail=l.sibling,C.renderingStartTime=Zt(),l.sibling=null,p=en.current,Ft(en,x?p&1|2:p&1),l):(Vn(l),null);case 22:case 23:return Zm(),x=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==x&&(l.flags|=8192),x&&(l.mode&1)!==0?(br&1073741824)!==0&&(Vn(l),l.subtreeFlags&6&&(l.flags|=8192)):Vn(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function MT(a,l){switch(lm(l),l.tag){case 1:return rr(l.type)&&wu(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Ha(),Wt(nr),Wt(Un),wm(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return bm(l),null;case 13:if(Wt(en),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Ba()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Wt(en),null;case 4:return Ha(),null;case 10:return mm(l.type._context),null;case 22:case 23:return Zm(),null;case 24:return null;default:return null}}var Bu=!1,Hn=!1,FT=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function qa(a,l){var p=a.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(x){sn(a,l,x)}else p.current=null}function Bm(a,l,p){try{p()}catch(x){sn(a,l,x)}}var Bv=!1;function zT(a,l){if(Zp=Oo,a=bb(),Hp(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,C=x.focusNode;x=x.focusOffset;try{p.nodeType,C.nodeType}catch{p=null;break e}var O=0,G=-1,Q=-1,pe=0,je=0,Ne=a,we=null;t:for(;;){for(var Be;Ne!==p||j!==0&&Ne.nodeType!==3||(G=O+j),Ne!==C||x!==0&&Ne.nodeType!==3||(Q=O+x),Ne.nodeType===3&&(O+=Ne.nodeValue.length),(Be=Ne.firstChild)!==null;)we=Ne,Ne=Be;for(;;){if(Ne===a)break t;if(we===p&&++pe===j&&(G=O),we===C&&++je===x&&(Q=O),(Be=Ne.nextSibling)!==null)break;Ne=we,we=Ne.parentNode}Ne=Be}p=G===-1||Q===-1?null:{start:G,end:Q}}else p=null}p=p||{start:0,end:0}}else p=null;for(em={focusedElem:a,selectionRange:p},Oo=!1,Ve=l;Ve!==null;)if(l=Ve,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,Ve=a;else for(;Ve!==null;){l=Ve;try{var Ke=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(Ke!==null){var Ge=Ke.memoizedProps,cn=Ke.memoizedState,ie=l.stateNode,ne=ie.getSnapshotBeforeUpdate(l.elementType===l.type?Ge:Qr(l.type,Ge),cn);ie.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var de=l.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(De){sn(l,l.return,De)}if(a=l.sibling,a!==null){a.return=l.return,Ve=a;break}Ve=l.return}return Ke=Bv,Bv=!1,Ke}function Dl(a,l,p){var x=l.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var j=x=x.next;do{if((j.tag&a)===a){var C=j.destroy;j.destroy=void 0,C!==void 0&&Bm(l,p,C)}j=j.next}while(j!==x)}}function Uu(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&a)===a){var x=p.create;p.destroy=x()}p=p.next}while(p!==l)}}function Um(a){var l=a.ref;if(l!==null){var p=a.stateNode;switch(a.tag){case 5:a=p;break;default:a=p}typeof l=="function"?l(a):l.current=a}}function Uv(a){var l=a.alternate;l!==null&&(a.alternate=null,Uv(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[ps],delete l[wl],delete l[sm],delete l[jT],delete l[kT])),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 Wv(a){return a.tag===5||a.tag===3||a.tag===4}function Vv(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Wv(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 Wm(a,l,p){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?p.nodeType===8?p.parentNode.insertBefore(a,l):p.insertBefore(a,l):(p.nodeType===8?(l=p.parentNode,l.insertBefore(a,p)):(l=p,l.appendChild(a)),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=bu));else if(x!==4&&(a=a.child,a!==null))for(Wm(a,l,p),a=a.sibling;a!==null;)Wm(a,l,p),a=a.sibling}function Vm(a,l,p){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?p.insertBefore(a,l):p.appendChild(a);else if(x!==4&&(a=a.child,a!==null))for(Vm(a,l,p),a=a.sibling;a!==null;)Vm(a,l,p),a=a.sibling}var In=null,Xr=!1;function so(a,l,p){for(p=p.child;p!==null;)Hv(a,l,p),p=p.sibling}function Hv(a,l,p){if(an&&typeof an.onCommitFiberUnmount=="function")try{an.onCommitFiberUnmount(ka,p)}catch{}switch(p.tag){case 5:Hn||qa(p,l);case 6:var x=In,j=Xr;In=null,so(a,l,p),In=x,Xr=j,In!==null&&(Xr?(a=In,p=p.stateNode,a.nodeType===8?a.parentNode.removeChild(p):a.removeChild(p)):In.removeChild(p.stateNode));break;case 18:In!==null&&(Xr?(a=In,p=p.stateNode,a.nodeType===8?rm(a.parentNode,p):a.nodeType===1&&rm(a,p),fn(a)):rm(In,p.stateNode));break;case 4:x=In,j=Xr,In=p.stateNode.containerInfo,Xr=!0,so(a,l,p),In=x,Xr=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 C=j,O=C.destroy;C=C.tag,O!==void 0&&((C&2)!==0||(C&4)!==0)&&Bm(p,l,O),j=j.next}while(j!==x)}so(a,l,p);break;case 1:if(!Hn&&(qa(p,l),x=p.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=p.memoizedProps,x.state=p.memoizedState,x.componentWillUnmount()}catch(G){sn(p,l,G)}so(a,l,p);break;case 21:so(a,l,p);break;case 22:p.mode&1?(Hn=(x=Hn)||p.memoizedState!==null,so(a,l,p),Hn=x):so(a,l,p);break;default:so(a,l,p)}}function Kv(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new FT),l.forEach(function(x){var j=YT.bind(null,a,x);p.has(x)||(p.add(x),x.then(j,j))})}}function Zr(a,l){var p=l.deletions;if(p!==null)for(var x=0;x<p.length;x++){var j=p[x];try{var C=a,O=l,G=O;e:for(;G!==null;){switch(G.tag){case 5:In=G.stateNode,Xr=!1;break e;case 3:In=G.stateNode.containerInfo,Xr=!0;break e;case 4:In=G.stateNode.containerInfo,Xr=!0;break e}G=G.return}if(In===null)throw Error(n(160));Hv(C,O,j),In=null,Xr=!1;var Q=j.alternate;Q!==null&&(Q.return=null),j.return=null}catch(pe){sn(j,l,pe)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)qv(l,a),l=l.sibling}function qv(a,l){var p=a.alternate,x=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Zr(l,a),gs(a),x&4){try{Dl(3,a,a.return),Uu(3,a)}catch(Ge){sn(a,a.return,Ge)}try{Dl(5,a,a.return)}catch(Ge){sn(a,a.return,Ge)}}break;case 1:Zr(l,a),gs(a),x&512&&p!==null&&qa(p,p.return);break;case 5:if(Zr(l,a),gs(a),x&512&&p!==null&&qa(p,p.return),a.flags&32){var j=a.stateNode;try{ye(j,"")}catch(Ge){sn(a,a.return,Ge)}}if(x&4&&(j=a.stateNode,j!=null)){var C=a.memoizedProps,O=p!==null?p.memoizedProps:C,G=a.type,Q=a.updateQueue;if(a.updateQueue=null,Q!==null)try{G==="input"&&C.type==="radio"&&C.name!=null&&_e(j,C),ce(G,O);var pe=ce(G,C);for(O=0;O<Q.length;O+=2){var je=Q[O],Ne=Q[O+1];je==="style"?fe(j,Ne):je==="dangerouslySetInnerHTML"?re(j,Ne):je==="children"?ye(j,Ne):S(j,je,Ne,pe)}switch(G){case"input":Ee(j,C);break;case"textarea":vt(j,C);break;case"select":var we=j._wrapperState.wasMultiple;j._wrapperState.wasMultiple=!!C.multiple;var Be=C.value;Be!=null?et(j,!!C.multiple,Be,!1):we!==!!C.multiple&&(C.defaultValue!=null?et(j,!!C.multiple,C.defaultValue,!0):et(j,!!C.multiple,C.multiple?[]:"",!1))}j[wl]=C}catch(Ge){sn(a,a.return,Ge)}}break;case 6:if(Zr(l,a),gs(a),x&4){if(a.stateNode===null)throw Error(n(162));j=a.stateNode,C=a.memoizedProps;try{j.nodeValue=C}catch(Ge){sn(a,a.return,Ge)}}break;case 3:if(Zr(l,a),gs(a),x&4&&p!==null&&p.memoizedState.isDehydrated)try{fn(l.containerInfo)}catch(Ge){sn(a,a.return,Ge)}break;case 4:Zr(l,a),gs(a);break;case 13:Zr(l,a),gs(a),j=a.child,j.flags&8192&&(C=j.memoizedState!==null,j.stateNode.isHidden=C,!C||j.alternate!==null&&j.alternate.memoizedState!==null||(qm=Zt())),x&4&&Kv(a);break;case 22:if(je=p!==null&&p.memoizedState!==null,a.mode&1?(Hn=(pe=Hn)||je,Zr(l,a),Hn=pe):Zr(l,a),gs(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(Ne=Ve=je;Ve!==null;){switch(we=Ve,Be=we.child,we.tag){case 0:case 11:case 14:case 15:Dl(4,we,we.return);break;case 1:qa(we,we.return);var Ke=we.stateNode;if(typeof Ke.componentWillUnmount=="function"){x=we,p=we.return;try{l=x,Ke.props=l.memoizedProps,Ke.state=l.memoizedState,Ke.componentWillUnmount()}catch(Ge){sn(x,p,Ge)}}break;case 5:qa(we,we.return);break;case 22:if(we.memoizedState!==null){Jv(Ne);continue}}Be!==null?(Be.return=we,Ve=Be):Jv(Ne)}je=je.sibling}e:for(je=null,Ne=a;;){if(Ne.tag===5){if(je===null){je=Ne;try{j=Ne.stateNode,pe?(C=j.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(G=Ne.stateNode,Q=Ne.memoizedProps.style,O=Q!=null&&Q.hasOwnProperty("display")?Q.display:null,G.style.display=te("display",O))}catch(Ge){sn(a,a.return,Ge)}}}else if(Ne.tag===6){if(je===null)try{Ne.stateNode.nodeValue=pe?"":Ne.memoizedProps}catch(Ge){sn(a,a.return,Ge)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===a)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===a)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===a)break e;je===Ne&&(je=null),Ne=Ne.return}je===Ne&&(je=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Zr(l,a),gs(a),x&4&&Kv(a);break;case 21:break;default:Zr(l,a),gs(a)}}function gs(a){var l=a.flags;if(l&2){try{e:{for(var p=a.return;p!==null;){if(Wv(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 C=Vv(a);Vm(a,C,j);break;case 3:case 4:var O=x.stateNode.containerInfo,G=Vv(a);Wm(a,G,O);break;default:throw Error(n(161))}}catch(Q){sn(a,a.return,Q)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function BT(a,l,p){Ve=a,Gv(a)}function Gv(a,l,p){for(var x=(a.mode&1)!==0;Ve!==null;){var j=Ve,C=j.child;if(j.tag===22&&x){var O=j.memoizedState!==null||Bu;if(!O){var G=j.alternate,Q=G!==null&&G.memoizedState!==null||Hn;G=Bu;var pe=Hn;if(Bu=O,(Hn=Q)&&!pe)for(Ve=j;Ve!==null;)O=Ve,Q=O.child,O.tag===22&&O.memoizedState!==null?Qv(j):Q!==null?(Q.return=O,Ve=Q):Qv(j);for(;C!==null;)Ve=C,Gv(C),C=C.sibling;Ve=j,Bu=G,Hn=pe}Yv(a)}else(j.subtreeFlags&8772)!==0&&C!==null?(C.return=j,Ve=C):Yv(a)}}function Yv(a){for(;Ve!==null;){var l=Ve;if((l.flags&8772)!==0){var p=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Hn||Uu(5,l);break;case 1:var x=l.stateNode;if(l.flags&4&&!Hn)if(p===null)x.componentDidMount();else{var j=l.elementType===l.type?p.memoizedProps:Qr(l.type,p.memoizedProps);x.componentDidUpdate(j,p.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var C=l.updateQueue;C!==null&&Jb(l,C,x);break;case 3:var O=l.updateQueue;if(O!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=l.child.stateNode;break;case 1:p=l.child.stateNode}Jb(l,O,p)}break;case 5:var G=l.stateNode;if(p===null&&l.flags&4){p=G;var Q=l.memoizedProps;switch(l.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(l.memoizedState===null){var pe=l.alternate;if(pe!==null){var je=pe.memoizedState;if(je!==null){var Ne=je.dehydrated;Ne!==null&&fn(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Hn||l.flags&512&&Um(l)}catch(we){sn(l,l.return,we)}}if(l===a){Ve=null;break}if(p=l.sibling,p!==null){p.return=l.return,Ve=p;break}Ve=l.return}}function Jv(a){for(;Ve!==null;){var l=Ve;if(l===a){Ve=null;break}var p=l.sibling;if(p!==null){p.return=l.return,Ve=p;break}Ve=l.return}}function Qv(a){for(;Ve!==null;){var l=Ve;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{Uu(4,l)}catch(Q){sn(l,p,Q)}break;case 1:var x=l.stateNode;if(typeof x.componentDidMount=="function"){var j=l.return;try{x.componentDidMount()}catch(Q){sn(l,j,Q)}}var C=l.return;try{Um(l)}catch(Q){sn(l,C,Q)}break;case 5:var O=l.return;try{Um(l)}catch(Q){sn(l,O,Q)}}}catch(Q){sn(l,l.return,Q)}if(l===a){Ve=null;break}var G=l.sibling;if(G!==null){G.return=l.return,Ve=G;break}Ve=l.return}}var UT=Math.ceil,Wu=T.ReactCurrentDispatcher,Hm=T.ReactCurrentOwner,Or=T.ReactCurrentBatchConfig,Nt=0,An=null,mn=null,On=0,br=0,Ga=Zs(0),jn=0,$l=null,Vo=0,Vu=0,Km=0,Ll=null,or=null,qm=0,Ya=1/0,Os=null,Hu=!1,Gm=null,oo=null,Ku=!1,ao=null,qu=0,Il=0,Ym=null,Gu=-1,Yu=0;function Qn(){return(Nt&6)!==0?Zt():Gu!==-1?Gu:Gu=Zt()}function io(a){return(a.mode&1)===0?1:(Nt&2)!==0&&On!==0?On&-On:NT.transition!==null?(Yu===0&&(Yu=al()),Yu):(a=At,a!==0||(a=window.event,a=a===void 0?16:Zy(a.type)),a)}function es(a,l,p,x){if(50<Il)throw Il=0,Ym=null,Error(n(185));Gr(a,p,x),((Nt&2)===0||a!==An)&&(a===An&&((Nt&2)===0&&(Vu|=p),jn===4&&lo(a,On)),ar(a,x),p===1&&Nt===0&&(l.mode&1)===0&&(Ya=Zt()+500,ku&&to()))}function ar(a,l){var p=a.callbackNode;ou(a,l);var x=Do(a,a===An?On:0);if(x===0)p!==null&&tu(p),a.callbackNode=null,a.callbackPriority=0;else if(l=x&-x,a.callbackPriority!==l){if(p!=null&&tu(p),l===1)a.tag===0?ST(Zv.bind(null,a)):Mb(Zv.bind(null,a)),vT(function(){(Nt&6)===0&&to()}),p=null;else{switch(cl(x)){case 1:p=ol;break;case 4:p=nu;break;case 16:p=qs;break;case 536870912:p=ru;break;default:p=qs}p=iw(p,Xv.bind(null,a))}a.callbackPriority=l,a.callbackNode=p}}function Xv(a,l){if(Gu=-1,Yu=0,(Nt&6)!==0)throw Error(n(327));var p=a.callbackNode;if(Ja()&&a.callbackNode!==p)return null;var x=Do(a,a===An?On:0);if(x===0)return null;if((x&30)!==0||(x&a.expiredLanes)!==0||l)l=Ju(a,x);else{l=x;var j=Nt;Nt|=2;var C=tw();(An!==a||On!==l)&&(Os=null,Ya=Zt()+500,Ko(a,l));do try{HT();break}catch(G){ew(a,G)}while(!0);pm(),Wu.current=C,Nt=j,mn!==null?l=0:(An=null,On=0,l=jn)}if(l!==0){if(l===2&&(j=$o(a),j!==0&&(x=j,l=Jm(a,j))),l===1)throw p=$l,Ko(a,0),lo(a,x),ar(a,Zt()),p;if(l===6)lo(a,x);else{if(j=a.current.alternate,(x&30)===0&&!WT(j)&&(l=Ju(a,x),l===2&&(C=$o(a),C!==0&&(x=C,l=Jm(a,C))),l===1))throw p=$l,Ko(a,0),lo(a,x),ar(a,Zt()),p;switch(a.finishedWork=j,a.finishedLanes=x,l){case 0:case 1:throw Error(n(345));case 2:qo(a,or,Os);break;case 3:if(lo(a,x),(x&130023424)===x&&(l=qm+500-Zt(),10<l)){if(Do(a,0)!==0)break;if(j=a.suspendedLanes,(j&x)!==x){Qn(),a.pingedLanes|=a.suspendedLanes&j;break}a.timeoutHandle=nm(qo.bind(null,a,or,Os),l);break}qo(a,or,Os);break;case 4:if(lo(a,x),(x&4194240)===x)break;for(l=a.eventTimes,j=-1;0<x;){var O=31-zn(x);C=1<<O,O=l[O],O>j&&(j=O),x&=~C}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*UT(x/1960))-x,10<x){a.timeoutHandle=nm(qo.bind(null,a,or,Os),x);break}qo(a,or,Os);break;case 5:qo(a,or,Os);break;default:throw Error(n(329))}}}return ar(a,Zt()),a.callbackNode===p?Xv.bind(null,a):null}function Jm(a,l){var p=Ll;return a.current.memoizedState.isDehydrated&&(Ko(a,l).flags|=256),a=Ju(a,l),a!==2&&(l=or,or=p,l!==null&&Qm(l)),a}function Qm(a){or===null?or=a:or.push.apply(or,a)}function WT(a){for(var l=a;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var x=0;x<p.length;x++){var j=p[x],C=j.getSnapshot;j=j.value;try{if(!Yr(C(),j))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function lo(a,l){for(l&=~Km,l&=~Vu,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var p=31-zn(l),x=1<<p;a[p]=-1,l&=~x}}function Zv(a){if((Nt&6)!==0)throw Error(n(327));Ja();var l=Do(a,0);if((l&1)===0)return ar(a,Zt()),null;var p=Ju(a,l);if(a.tag!==0&&p===2){var x=$o(a);x!==0&&(l=x,p=Jm(a,x))}if(p===1)throw p=$l,Ko(a,0),lo(a,l),ar(a,Zt()),p;if(p===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,qo(a,or,Os),ar(a,Zt()),null}function Xm(a,l){var p=Nt;Nt|=1;try{return a(l)}finally{Nt=p,Nt===0&&(Ya=Zt()+500,ku&&to())}}function Ho(a){ao!==null&&ao.tag===0&&(Nt&6)===0&&Ja();var l=Nt;Nt|=1;var p=Or.transition,x=At;try{if(Or.transition=null,At=1,a)return a()}finally{At=x,Or.transition=p,Nt=l,(Nt&6)===0&&to()}}function Zm(){br=Ga.current,Wt(Ga)}function Ko(a,l){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==-1&&(a.timeoutHandle=-1,bT(p)),mn!==null)for(p=mn.return;p!==null;){var x=p;switch(lm(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&wu();break;case 3:Ha(),Wt(nr),Wt(Un),wm();break;case 5:bm(x);break;case 4:Ha();break;case 13:Wt(en);break;case 19:Wt(en);break;case 10:mm(x.type._context);break;case 22:case 23:Zm()}p=p.return}if(An=a,mn=a=co(a.current,null),On=br=l,jn=0,$l=null,Km=Vu=Vo=0,or=Ll=null,Bo!==null){for(l=0;l<Bo.length;l++)if(p=Bo[l],x=p.interleaved,x!==null){p.interleaved=null;var j=x.next,C=p.pending;if(C!==null){var O=C.next;C.next=j,x.next=O}p.pending=x}Bo=null}return a}function ew(a,l){do{var p=mn;try{if(pm(),$u.current=_u,Lu){for(var x=tn.memoizedState;x!==null;){var j=x.queue;j!==null&&(j.pending=null),x=x.next}Lu=!1}if(Wo=0,Rn=wn=tn=null,El=!1,Tl=0,Hm.current=null,p===null||p.return===null){jn=1,$l=l,mn=null;break}e:{var C=a,O=p.return,G=p,Q=l;if(l=On,G.flags|=32768,Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var pe=Q,je=G,Ne=je.tag;if((je.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var we=je.alternate;we?(je.updateQueue=we.updateQueue,je.memoizedState=we.memoizedState,je.lanes=we.lanes):(je.updateQueue=null,je.memoizedState=null)}var Be=Nv(O);if(Be!==null){Be.flags&=-257,Cv(Be,O,G,C,l),Be.mode&1&&Sv(C,pe,l),l=Be,Q=pe;var Ke=l.updateQueue;if(Ke===null){var Ge=new Set;Ge.add(Q),l.updateQueue=Ge}else Ke.add(Q);break e}else{if((l&1)===0){Sv(C,pe,l),eh();break e}Q=Error(n(426))}}else if(Jt&&G.mode&1){var cn=Nv(O);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Cv(cn,O,G,C,l),dm(Ka(Q,G));break e}}C=Q=Ka(Q,G),jn!==4&&(jn=2),Ll===null?Ll=[C]:Ll.push(C),C=O;do{switch(C.tag){case 3:C.flags|=65536,l&=-l,C.lanes|=l;var ie=jv(C,Q,l);Yb(C,ie);break e;case 1:G=Q;var ne=C.type,de=C.stateNode;if((C.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||de!==null&&typeof de.componentDidCatch=="function"&&(oo===null||!oo.has(de)))){C.flags|=65536,l&=-l,C.lanes|=l;var De=kv(C,G,l);Yb(C,De);break e}}C=C.return}while(C!==null)}rw(p)}catch(Xe){l=Xe,mn===p&&p!==null&&(mn=p=p.return);continue}break}while(!0)}function tw(){var a=Wu.current;return Wu.current=_u,a===null?_u:a}function eh(){(jn===0||jn===3||jn===2)&&(jn=4),An===null||(Vo&268435455)===0&&(Vu&268435455)===0||lo(An,On)}function Ju(a,l){var p=Nt;Nt|=2;var x=tw();(An!==a||On!==l)&&(Os=null,Ko(a,l));do try{VT();break}catch(j){ew(a,j)}while(!0);if(pm(),Nt=p,Wu.current=x,mn!==null)throw Error(n(261));return An=null,On=0,jn}function VT(){for(;mn!==null;)nw(mn)}function HT(){for(;mn!==null&&!Rp();)nw(mn)}function nw(a){var l=aw(a.alternate,a,br);a.memoizedProps=a.pendingProps,l===null?rw(a):mn=l,Hm.current=null}function rw(a){var l=a;do{var p=l.alternate;if(a=l.return,(l.flags&32768)===0){if(p=_T(p,l,br),p!==null){mn=p;return}}else{if(p=MT(p,l),p!==null){p.flags&=32767,mn=p;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{jn=6,mn=null;return}}if(l=l.sibling,l!==null){mn=l;return}mn=l=a}while(l!==null);jn===0&&(jn=5)}function qo(a,l,p){var x=At,j=Or.transition;try{Or.transition=null,At=1,KT(a,l,p,x)}finally{Or.transition=j,At=x}return null}function KT(a,l,p,x){do Ja();while(ao!==null);if((Nt&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 C=p.lanes|p.childLanes;if(il(a,C),a===An&&(mn=An=null,On=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||Ku||(Ku=!0,iw(qs,function(){return Ja(),null})),C=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||C){C=Or.transition,Or.transition=null;var O=At;At=1;var G=Nt;Nt|=4,Hm.current=null,zT(a,p),qv(p,a),fT(em),Oo=!!Zp,em=Zp=null,a.current=p,BT(p),Ap(),Nt=G,At=O,Or.transition=C}else a.current=p;if(Ku&&(Ku=!1,ao=a,qu=j),C=a.pendingLanes,C===0&&(oo=null),Sa(p.stateNode),ar(a,Zt()),l!==null)for(x=a.onRecoverableError,p=0;p<l.length;p++)j=l[p],x(j.value,{componentStack:j.stack,digest:j.digest});if(Hu)throw Hu=!1,a=Gm,Gm=null,a;return(qu&1)!==0&&a.tag!==0&&Ja(),C=a.pendingLanes,(C&1)!==0?a===Ym?Il++:(Il=0,Ym=a):Il=0,to(),null}function Ja(){if(ao!==null){var a=cl(qu),l=Or.transition,p=At;try{if(Or.transition=null,At=16>a?16:a,ao===null)var x=!1;else{if(a=ao,ao=null,qu=0,(Nt&6)!==0)throw Error(n(331));var j=Nt;for(Nt|=4,Ve=a.current;Ve!==null;){var C=Ve,O=C.child;if((Ve.flags&16)!==0){var G=C.deletions;if(G!==null){for(var Q=0;Q<G.length;Q++){var pe=G[Q];for(Ve=pe;Ve!==null;){var je=Ve;switch(je.tag){case 0:case 11:case 15:Dl(8,je,C)}var Ne=je.child;if(Ne!==null)Ne.return=je,Ve=Ne;else for(;Ve!==null;){je=Ve;var we=je.sibling,Be=je.return;if(Uv(je),je===pe){Ve=null;break}if(we!==null){we.return=Be,Ve=we;break}Ve=Be}}}var Ke=C.alternate;if(Ke!==null){var Ge=Ke.child;if(Ge!==null){Ke.child=null;do{var cn=Ge.sibling;Ge.sibling=null,Ge=cn}while(Ge!==null)}}Ve=C}}if((C.subtreeFlags&2064)!==0&&O!==null)O.return=C,Ve=O;else e:for(;Ve!==null;){if(C=Ve,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:Dl(9,C,C.return)}var ie=C.sibling;if(ie!==null){ie.return=C.return,Ve=ie;break e}Ve=C.return}}var ne=a.current;for(Ve=ne;Ve!==null;){O=Ve;var de=O.child;if((O.subtreeFlags&2064)!==0&&de!==null)de.return=O,Ve=de;else e:for(O=ne;Ve!==null;){if(G=Ve,(G.flags&2048)!==0)try{switch(G.tag){case 0:case 11:case 15:Uu(9,G)}}catch(Xe){sn(G,G.return,Xe)}if(G===O){Ve=null;break e}var De=G.sibling;if(De!==null){De.return=G.return,Ve=De;break e}Ve=G.return}}if(Nt=j,to(),an&&typeof an.onPostCommitFiberRoot=="function")try{an.onPostCommitFiberRoot(ka,a)}catch{}x=!0}return x}finally{At=p,Or.transition=l}}return!1}function sw(a,l,p){l=Ka(p,l),l=jv(a,l,1),a=ro(a,l,1),l=Qn(),a!==null&&(Gr(a,1,l),ar(a,l))}function sn(a,l,p){if(a.tag===3)sw(a,a,p);else for(;l!==null;){if(l.tag===3){sw(l,a,p);break}else if(l.tag===1){var x=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(oo===null||!oo.has(x))){a=Ka(p,a),a=kv(l,a,1),l=ro(l,a,1),a=Qn(),l!==null&&(Gr(l,1,a),ar(l,a));break}}l=l.return}}function qT(a,l,p){var x=a.pingCache;x!==null&&x.delete(l),l=Qn(),a.pingedLanes|=a.suspendedLanes&p,An===a&&(On&p)===p&&(jn===4||jn===3&&(On&130023424)===On&&500>Zt()-qm?Ko(a,0):Km|=p),ar(a,l)}function ow(a,l){l===0&&((a.mode&1)===0?l=1:(l=Na,Na<<=1,(Na&130023424)===0&&(Na=4194304)));var p=Qn();a=$s(a,l),a!==null&&(Gr(a,l,p),ar(a,p))}function GT(a){var l=a.memoizedState,p=0;l!==null&&(p=l.retryLane),ow(a,p)}function YT(a,l){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(l),ow(a,p)}var aw;aw=function(a,l,p){if(a!==null)if(a.memoizedProps!==l.pendingProps||nr.current)sr=!0;else{if((a.lanes&p)===0&&(l.flags&128)===0)return sr=!1,OT(a,l,p);sr=(a.flags&131072)!==0}else sr=!1,Jt&&(l.flags&1048576)!==0&&Fb(l,Nu,l.index);switch(l.lanes=0,l.tag){case 2:var x=l.type;zu(a,l),a=l.pendingProps;var j=Ma(l,Un.current);Va(l,p),j=Sm(null,l,x,a,j,p);var C=Nm();return l.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,rr(x)?(C=!0,ju(l)):C=!1,l.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,xm(l),j.updater=Mu,l.stateNode=j,j._reactInternals=l,Pm(l,x,a,p),l=Im(null,l,x,!0,C,p)):(l.tag=0,Jt&&C&&im(l),Jn(null,l,j,p),l=l.child),l;case 16:x=l.elementType;e:{switch(zu(a,l),a=l.pendingProps,j=x._init,x=j(x._payload),l.type=x,j=l.tag=QT(x),a=Qr(x,a),j){case 0:l=Lm(null,l,x,a,p);break e;case 1:l=Dv(null,l,x,a,p);break e;case 11:l=Ev(null,l,x,a,p);break e;case 14:l=Tv(null,l,x,Qr(x.type,a),p);break e}throw Error(n(306,x,""))}return l;case 0:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Qr(x,j),Lm(a,l,x,j,p);case 1:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Qr(x,j),Dv(a,l,x,j,p);case 3:e:{if($v(l),a===null)throw Error(n(387));x=l.pendingProps,C=l.memoizedState,j=C.element,Gb(a,l),Pu(l,x,null,p);var O=l.memoizedState;if(x=O.element,C.isDehydrated)if(C={element:x,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},l.updateQueue.baseState=C,l.memoizedState=C,l.flags&256){j=Ka(Error(n(423)),l),l=Lv(a,l,x,p,j);break e}else if(x!==j){j=Ka(Error(n(424)),l),l=Lv(a,l,x,p,j);break e}else for(yr=Xs(l.stateNode.containerInfo.firstChild),xr=l,Jt=!0,Jr=null,p=Kb(l,null,x,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(Ba(),x===j){l=Is(a,l,p);break e}Jn(a,l,x,p)}l=l.child}return l;case 5:return Qb(l),a===null&&um(l),x=l.type,j=l.pendingProps,C=a!==null?a.memoizedProps:null,O=j.children,tm(x,j)?O=null:C!==null&&tm(x,C)&&(l.flags|=32),Pv(a,l),Jn(a,l,O,p),l.child;case 6:return a===null&&um(l),null;case 13:return Iv(a,l,p);case 4:return ym(l,l.stateNode.containerInfo),x=l.pendingProps,a===null?l.child=Ua(l,null,x,p):Jn(a,l,x,p),l.child;case 11:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Qr(x,j),Ev(a,l,x,j,p);case 7:return Jn(a,l,l.pendingProps,p),l.child;case 8:return Jn(a,l,l.pendingProps.children,p),l.child;case 12:return Jn(a,l,l.pendingProps.children,p),l.child;case 10:e:{if(x=l.type._context,j=l.pendingProps,C=l.memoizedProps,O=j.value,Ft(Tu,x._currentValue),x._currentValue=O,C!==null)if(Yr(C.value,O)){if(C.children===j.children&&!nr.current){l=Is(a,l,p);break e}}else for(C=l.child,C!==null&&(C.return=l);C!==null;){var G=C.dependencies;if(G!==null){O=C.child;for(var Q=G.firstContext;Q!==null;){if(Q.context===x){if(C.tag===1){Q=Ls(-1,p&-p),Q.tag=2;var pe=C.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}}C.lanes|=p,Q=C.alternate,Q!==null&&(Q.lanes|=p),hm(C.return,p,l),G.lanes|=p;break}Q=Q.next}}else if(C.tag===10)O=C.type===l.type?null:C.child;else if(C.tag===18){if(O=C.return,O===null)throw Error(n(341));O.lanes|=p,G=O.alternate,G!==null&&(G.lanes|=p),hm(O,p,l),O=C.sibling}else O=C.child;if(O!==null)O.return=C;else for(O=C;O!==null;){if(O===l){O=null;break}if(C=O.sibling,C!==null){C.return=O.return,O=C;break}O=O.return}C=O}Jn(a,l,j.children,p),l=l.child}return l;case 9:return j=l.type,x=l.pendingProps.children,Va(l,p),j=Lr(j),x=x(j),l.flags|=1,Jn(a,l,x,p),l.child;case 14:return x=l.type,j=Qr(x,l.pendingProps),j=Qr(x.type,j),Tv(a,l,x,j,p);case 15:return Rv(a,l,l.type,l.pendingProps,p);case 17:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Qr(x,j),zu(a,l),l.tag=1,rr(x)?(a=!0,ju(l)):a=!1,Va(l,p),vv(l,x,j),Pm(l,x,j,p),Im(null,l,x,!0,a,p);case 19:return _v(a,l,p);case 22:return Av(a,l,p)}throw Error(n(156,l.tag))};function iw(a,l){return eu(a,l)}function JT(a,l,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=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=x,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _r(a,l,p,x){return new JT(a,l,p,x)}function th(a){return a=a.prototype,!(!a||!a.isReactComponent)}function QT(a){if(typeof a=="function")return th(a)?1:0;if(a!=null){if(a=a.$$typeof,a===V)return 11;if(a===z)return 14}return 2}function co(a,l){var p=a.alternate;return p===null?(p=_r(a.tag,l,a.key,a.mode),p.elementType=a.elementType,p.type=a.type,p.stateNode=a.stateNode,p.alternate=a,a.alternate=p):(p.pendingProps=l,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,l=a.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=a.sibling,p.index=a.index,p.ref=a.ref,p}function Qu(a,l,p,x,j,C){var O=2;if(x=a,typeof a=="function")th(a)&&(O=1);else if(typeof a=="string")O=5;else e:switch(a){case A:return Go(p.children,j,C,l);case L:O=8,j|=8;break;case M:return a=_r(12,p,l,j|2),a.elementType=M,a.lanes=C,a;case Y:return a=_r(13,p,l,j),a.elementType=Y,a.lanes=C,a;case _:return a=_r(19,p,l,j),a.elementType=_,a.lanes=C,a;case q:return Xu(p,j,C,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case F:O=10;break e;case D:O=9;break e;case V:O=11;break e;case z:O=14;break e;case H:O=16,x=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return l=_r(O,p,l,j),l.elementType=a,l.type=x,l.lanes=C,l}function Go(a,l,p,x){return a=_r(7,a,x,l),a.lanes=p,a}function Xu(a,l,p,x){return a=_r(22,a,x,l),a.elementType=q,a.lanes=p,a.stateNode={isHidden:!1},a}function nh(a,l,p){return a=_r(6,a,null,l),a.lanes=p,a}function rh(a,l,p){return l=_r(4,a.children!==null?a.children:[],a.key,l),l.lanes=p,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function XT(a,l,p,x,j){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=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 sh(a,l,p,x,j,C,O,G,Q){return a=new XT(a,l,p,G,Q),l===1?(l=1,C===!0&&(l|=8)):l=0,C=_r(3,null,null,l),a.current=C,C.stateNode=a,C.memoizedState={element:x,isDehydrated:p,cache:null,transitions:null,pendingSuspenseBoundaries:null},xm(C),a}function ZT(a,l,p){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:x==null?null:""+x,children:a,containerInfo:l,implementation:p}}function lw(a){if(!a)return eo;a=a._reactInternals;e:{if(ht(a)!==a||a.tag!==1)throw Error(n(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(rr(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(a.tag===1){var p=a.type;if(rr(p))return Ob(a,p,l)}return l}function cw(a,l,p,x,j,C,O,G,Q){return a=sh(p,x,!0,a,j,C,O,G,Q),a.context=lw(null),p=a.current,x=Qn(),j=io(p),C=Ls(x,j),C.callback=l??null,ro(p,C,j),a.current.lanes=j,Gr(a,j,x),ar(a,x),a}function Zu(a,l,p,x){var j=l.current,C=Qn(),O=io(j);return p=lw(p),l.context===null?l.context=p:l.pendingContext=p,l=Ls(C,O),l.payload={element:a},x=x===void 0?null:x,x!==null&&(l.callback=x),a=ro(j,l,O),a!==null&&(es(a,j,O,C),Au(a,j,O)),O}function ed(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 uw(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<l?p:l}}function oh(a,l){uw(a,l),(a=a.alternate)&&uw(a,l)}function eR(){return null}var dw=typeof reportError=="function"?reportError:function(a){console.error(a)};function ah(a){this._internalRoot=a}td.prototype.render=ah.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Zu(a,l,null,null)},td.prototype.unmount=ah.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Ho(function(){Zu(null,a,null,null)}),l[Rs]=null}};function td(a){this._internalRoot=a}td.prototype.unstable_scheduleHydration=function(a){if(a){var l=Ta();a={blockedOn:null,target:a,priority:l};for(var p=0;p<Bn.length&&l!==0&&l<Bn[p].priority;p++);Bn.splice(p,0,a),p===0&&ut(a)}};function ih(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function nd(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function fw(){}function tR(a,l,p,x,j){if(j){if(typeof x=="function"){var C=x;x=function(){var pe=ed(O);C.call(pe)}}var O=cw(l,x,a,0,null,!1,!1,"",fw);return a._reactRootContainer=O,a[Rs]=O.current,bl(a.nodeType===8?a.parentNode:a),Ho(),O}for(;j=a.lastChild;)a.removeChild(j);if(typeof x=="function"){var G=x;x=function(){var pe=ed(Q);G.call(pe)}}var Q=sh(a,0,!1,null,null,!1,!1,"",fw);return a._reactRootContainer=Q,a[Rs]=Q.current,bl(a.nodeType===8?a.parentNode:a),Ho(function(){Zu(l,Q,p,x)}),Q}function rd(a,l,p,x,j){var C=p._reactRootContainer;if(C){var O=C;if(typeof j=="function"){var G=j;j=function(){var Q=ed(O);G.call(Q)}}Zu(l,O,a,j)}else O=tR(p,l,a,j,x);return ed(O)}Ca=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var p=Gs(l.pendingLanes);p!==0&&(ll(l,p|1),ar(l,Zt()),(Nt&6)===0&&(Ya=Zt()+500,to()))}break;case 13:Ho(function(){var x=$s(a,1);if(x!==null){var j=Qn();es(x,a,1,j)}}),oh(a,1)}},Ea=function(a){if(a.tag===13){var l=$s(a,134217728);if(l!==null){var p=Qn();es(l,a,134217728,p)}oh(a,134217728)}},Ys=function(a){if(a.tag===13){var l=io(a),p=$s(a,l);if(p!==null){var x=Qn();es(p,a,l,x)}oh(a,l)}},Ta=function(){return At},au=function(a,l){var p=At;try{return At=a,l()}finally{At=p}},St=function(a,l,p){switch(l){case"input":if(Ee(a,p),l=p.name,p.type==="radio"&&l!=null){for(p=a;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<p.length;l++){var x=p[l];if(x!==a&&x.form===a.form){var j=vu(x);if(!j)throw Error(n(90));at(x),Ee(x,j)}}}break;case"textarea":vt(a,p);break;case"select":l=p.value,l!=null&&et(a,!!p.multiple,l,!1)}},Xt=Xm,dn=Ho;var nR={usingClientEntryPoint:!1,Events:[jl,Oa,vu,qe,Lt,Xm]},Ol={findFiberByHostInstance:_o,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rR={bundleType:Ol.bundleType,version:Ol.version,rendererPackageName:Ol.rendererPackageName,rendererConfig:Ol.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:Ol.findFiberByHostInstance||eR,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 sd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!sd.isDisabled&&sd.supportsFiber)try{ka=sd.inject(rR),an=sd}catch{}}return ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=nR,ir.createPortal=function(a,l){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ih(l))throw Error(n(200));return ZT(a,l,null,p)},ir.createRoot=function(a,l){if(!ih(a))throw Error(n(299));var p=!1,x="",j=dw;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),l=sh(a,1,!1,null,null,p,!1,x,j),a[Rs]=l.current,bl(a.nodeType===8?a.parentNode:a),new ah(l)},ir.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=rn(l),a=a===null?null:a.stateNode,a},ir.flushSync=function(a){return Ho(a)},ir.hydrate=function(a,l,p){if(!nd(l))throw Error(n(200));return rd(null,a,l,!0,p)},ir.hydrateRoot=function(a,l,p){if(!ih(a))throw Error(n(405));var x=p!=null&&p.hydratedSources||null,j=!1,C="",O=dw;if(p!=null&&(p.unstable_strictMode===!0&&(j=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onRecoverableError!==void 0&&(O=p.onRecoverableError)),l=cw(l,null,a,1,p??null,j,!1,C,O),a[Rs]=l.current,bl(a),x)for(a=0;a<x.length;a++)p=x[a],j=p._getVersion,j=j(p._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[p,j]:l.mutableSourceEagerHydrationData.push(p,j);return new td(l)},ir.render=function(a,l,p){if(!nd(l))throw Error(n(200));return rd(null,a,l,!1,p)},ir.unmountComponentAtNode=function(a){if(!nd(a))throw Error(n(40));return a._reactRootContainer?(Ho(function(){rd(null,null,a,!1,function(){a._reactRootContainer=null,a[Rs]=null})}),!0):!1},ir.unstable_batchedUpdates=Xm,ir.unstable_renderSubtreeIntoContainer=function(a,l,p,x){if(!nd(p))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return rd(a,l,p,!1,x)},ir.version="18.3.1-next-f1338f8080-20240426",ir}var vw;function wk(){if(vw)return dh.exports;vw=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(),dh.exports=pR(),dh.exports}var ww;function mR(){if(ww)return od;ww=1;var e=wk();return od.createRoot=e.createRoot,od.hydrateRoot=e.hydrateRoot,od}var hR=mR();/**
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 jw="popstate";function kw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function gR(e={}){function t(s,o){var m;let i=(m=o.state)==null?void 0:m.masked,{pathname:c,search:u,hash:d}=i||s.location;return hg("",{pathname:c,search:u,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function n(s,o){return typeof o=="string"?o:gc(o)}return yR(t,n,null,e)}function nn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ts(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function xR(){return Math.random().toString(36).substring(2,10)}function Sw(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 hg(e,t,n=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Mi(t):t,state:n,key:t&&t.key||s||xR(),unstable_mask:o}}function gc({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 Mi(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 yR(e,t,n,s={}){let{window:o=document.defaultView,v5Compat:i=!1}=s,c=o.history,u="POP",d=null,m=h();m==null&&(m=0,c.replaceState({...c.state,idx:m},""));function h(){return(c.state||{idx:null}).idx}function g(){u="POP";let v=h(),k=v==null?null:v-m;m=v,d&&d({action:u,location:w.location,delta:k})}function y(v,k){u="PUSH";let E=kw(v)?v:hg(w.location,v,k);m=h()+1;let S=Sw(E,m),T=w.createHref(E.unstable_mask||E);try{c.pushState(S,"",T)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;o.location.assign(T)}i&&d&&d({action:u,location:w.location,delta:1})}function b(v,k){u="REPLACE";let E=kw(v)?v:hg(w.location,v,k);m=h();let S=Sw(E,m),T=w.createHref(E.unstable_mask||E);c.replaceState(S,"",T),i&&d&&d({action:u,location:w.location,delta:0})}function N(v){return bR(v)}let w={get action(){return u},get location(){return e(o,c)},listen(v){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(jw,g),d=v,()=>{o.removeEventListener(jw,g),d=null}},createHref(v){return t(o,v)},createURL:N,encodeLocation(v){let k=N(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return w}function bR(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:gc(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function jk(e,t,n="/"){return vR(e,t,n,!1)}function vR(e,t,n,s){let o=typeof t=="string"?Mi(t):t,i=Bs(o.pathname||"/",n);if(i==null)return null;let c=kk(e);wR(c);let u=null;for(let d=0;u==null&&d<c.length;++d){let m=DR(i);u=AR(c[d],m,s)}return u}function kk(e,t=[],n=[],s="",o=!1){let i=(c,u,d=o,m)=>{let h={relativePath:m===void 0?c.path||"":m,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(s)&&d)return;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=js([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(nn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),kk(c.children,t,y,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:TR(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))i(c,u);else for(let m of Sk(c.path))i(c,u,!0,m)}),t}function Sk(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(s.length===0)return o?[i,""]:[i];let c=Sk(s.join("/")),u=[];return u.push(...c.map(d=>d===""?i:[i,d].join("/"))),o&&u.push(...c),u.map(d=>e.startsWith("/")&&d===""?"/":d)}function wR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:RR(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var jR=/^:[\w-]+$/,kR=3,SR=2,NR=1,CR=10,ER=-2,Nw=e=>e==="*";function TR(e,t){let n=e.split("/"),s=n.length;return n.some(Nw)&&(s+=ER),t&&(s+=SR),n.filter(o=>!Nw(o)).reduce((o,i)=>o+(jR.test(i)?kR:i===""?NR:CR),s)}function RR(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 AR(e,t,n=!1){let{routesMeta:s}=e,o={},i="/",c=[];for(let u=0;u<s.length;++u){let d=s[u],m=u===s.length-1,h=i==="/"?t:t.slice(i.length)||"/",g=Vd({path:d.relativePath,caseSensitive:d.caseSensitive,end:m},h),y=d.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=Vd({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},h)),!g)return null;Object.assign(o,g.params),c.push({params:o,pathname:js([i,g.pathname]),pathnameBase:OR(js([i,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(i=js([i,g.pathnameBase]))}return c}function Vd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=PR(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],c=i.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let N=u[y]||"";c=i.slice(0,i.length-N.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:i,pathnameBase:c,pattern:e}}function PR(e,t=!1,n=!0){ts(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,u,d,m,h)=>{if(s.push({paramName:u,isOptional:d!=null}),d){let g=h.charAt(m+c.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function DR(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ts(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Bs(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}var $R=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function LR(e,t="/"){let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Mi(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=Cw(n.substring(1),"/"):i=Cw(n,t)):i=t,{pathname:i,search:_R(s),hash:MR(o)}}function Cw(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 mh(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 IR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Nk(e){let t=IR(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function dx(e,t,n,s=!1){let o;typeof e=="string"?o=Mi(e):(o={...e},nn(!o.pathname||!o.pathname.includes("?"),mh("?","pathname","search",o)),nn(!o.pathname||!o.pathname.includes("#"),mh("#","pathname","hash",o)),nn(!o.search||!o.search.includes("#"),mh("#","search","hash",o)));let i=e===""||o.pathname==="",c=i?"/":o.pathname,u;if(c==null)u=n;else{let g=t.length-1;if(!s&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;o.pathname=y.join("/")}u=g>=0?t[g]:"/"}let d=LR(o,u),m=c&&c!=="/"&&c.endsWith("/"),h=(i||c===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(m||h)&&(d.pathname+="/"),d}var js=e=>e.join("/").replace(/\/\/+/g,"/"),OR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),_R=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,MR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,FR=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 zR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function BR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Ck=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ek(e,t){let n=e;if(typeof n!="string"||!$R.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,o=!1;if(Ck)try{let i=new URL(window.location.href),c=n.startsWith("//")?new URL(i.protocol+n):new URL(n),u=Bs(c.pathname,t);c.origin===i.origin&&u!=null?n=u+c.search+c.hash:o=!0}catch{ts(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Tk=["POST","PUT","PATCH","DELETE"];new Set(Tk);var UR=["GET",...Tk];new Set(UR);var Fi=f.createContext(null);Fi.displayName="DataRouter";var Cf=f.createContext(null);Cf.displayName="DataRouterState";var WR=f.createContext(!1),Rk=f.createContext({isTransitioning:!1});Rk.displayName="ViewTransition";var VR=f.createContext(new Map);VR.displayName="Fetchers";var HR=f.createContext(null);HR.displayName="Await";var Wr=f.createContext(null);Wr.displayName="Navigation";var Ac=f.createContext(null);Ac.displayName="Location";var is=f.createContext({outlet:null,matches:[],isDataRoute:!1});is.displayName="Route";var fx=f.createContext(null);fx.displayName="RouteError";var Ak="REACT_ROUTER_ERROR",KR="REDIRECT",qR="ROUTE_ERROR_RESPONSE";function GR(e){if(e.startsWith(`${Ak}:${KR}:{`))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 YR(e){if(e.startsWith(`${Ak}:${qR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new FR(t.status,t.statusText,t.data)}catch{}}function JR(e,{relative:t}={}){nn(Pc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Wr),{hash:o,pathname:i,search:c}=Dc(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:js([n,i])),s.createHref({pathname:u,search:c,hash:o})}function Pc(){return f.useContext(Ac)!=null}function Xn(){return nn(Pc(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(Ac).location}var Pk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Dk(e){f.useContext(Wr).static||f.useLayoutEffect(e)}function _t(){let{isDataRoute:e}=f.useContext(is);return e?dA():QR()}function QR(){nn(Pc(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Fi),{basename:t,navigator:n}=f.useContext(Wr),{matches:s}=f.useContext(is),{pathname:o}=Xn(),i=JSON.stringify(Nk(s)),c=f.useRef(!1);return Dk(()=>{c.current=!0}),f.useCallback((d,m={})=>{if(ts(c.current,Pk),!c.current)return;if(typeof d=="number"){n.go(d);return}let h=dx(d,JSON.parse(i),o,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:js([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,i,o,e])}var XR=f.createContext(null);function ZR(e){let t=f.useContext(is).outlet;return f.useMemo(()=>t&&f.createElement(XR.Provider,{value:e},t),[t,e])}function Mt(){let{matches:e}=f.useContext(is),t=e[e.length-1];return t?t.params:{}}function Dc(e,{relative:t}={}){let{matches:n}=f.useContext(is),{pathname:s}=Xn(),o=JSON.stringify(Nk(n));return f.useMemo(()=>dx(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function eA(e,t){return $k(e,t)}function $k(e,t,n){var v;nn(Pc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Wr),{matches:o}=f.useContext(is),i=o[o.length-1],c=i?i.params:{},u=i?i.pathname:"/",d=i?i.pathnameBase:"/",m=i&&i.route;{let k=m&&m.path||"";Ik(u,!m||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${k}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
-
51
- Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=Xn(),g;if(t){let k=typeof t=="string"?Mi(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 N=jk(e,{pathname:b});ts(m||N!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ts(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.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=oA(N&&N.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:js([d,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?d:js([d,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,n);return t&&w?f.createElement(Ac.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},w):w}function tA(){let e=uA(),t=zR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=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,c)}var nA=f.createElement(tA,null),Lk=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=YR(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(is.Provider,{value:this.props.routeContext},f.createElement(fx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(rA,{error:e},t):t}};Lk.contextType=WR;var hh=new WeakMap;function rA({children:e,error:t}){let{basename:n}=f.useContext(Wr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=GR(t.digest);if(s){let o=hh.get(t);if(o)throw o;let i=Ek(s.location,n);if(Ck&&!hh.get(t))if(i.isExternal||s.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:s.replace}));throw hh.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function sA({routeContext:e,match:t,children:n}){let s=f.useContext(Fi);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),f.createElement(is.Provider,{value:e},n)}function oA(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 c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<o.length;h++){let g=o[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,N=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||N){n.isStatic&&(c=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let d=n==null?void 0:n.onError,m=s&&d?(h,g)=>{var y,b;d(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:BR(s.matches),errorInfo:g})}:void 0;return o.reduceRight((h,g,y)=>{let b,N=!1,w=null,v=null;s&&(b=i&&g.route.id?i[g.route.id]:void 0,w=g.route.errorElement||nA,c&&(u<0&&y===0?(Ik("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,v=null):u===y&&(N=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,y+1)),E=()=>{let S;return b?S=w:N?S=v:g.route.Component?S=f.createElement(g.route.Component,null):g.route.element?S=g.route.element:S=h,f.createElement(sA,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement(Lk,{location:s.location,revalidation:s.revalidation,component:w,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function px(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function aA(e){let t=f.useContext(Fi);return nn(t,px(e)),t}function iA(e){let t=f.useContext(Cf);return nn(t,px(e)),t}function lA(e){let t=f.useContext(is);return nn(t,px(e)),t}function mx(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 cA(){return mx("useRouteId")}function uA(){var s;let e=f.useContext(fx),t=iA("useRouteError"),n=mx("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function dA(){let{router:e}=aA("useNavigate"),t=mx("useNavigate"),n=f.useRef(!1);return Dk(()=>{n.current=!0}),f.useCallback(async(o,i={})=>{ts(n.current,Pk),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var Ew={};function Ik(e,t,n){!t&&!Ew[e]&&(Ew[e]=!0,ts(!1,n))}f.memo(fA);function fA({routes:e,future:t,state:n,isStatic:s,onError:o}){return $k(e,void 0,{state:n,isStatic:s,onError:o})}function pA(e){return ZR(e.context)}function He(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 mA({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:o,static:i=!1,unstable_useTransitions:c}){nn(!Pc(),"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:c,future:{}}),[u,o,i,c]);typeof n=="string"&&(n=Mi(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:N}=n,w=f.useMemo(()=>{let v=Bs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:N},navigationType:s}},[u,m,h,g,y,b,s,N]);return ts(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(Wr.Provider,{value:d},f.createElement(Ac.Provider,{children:t,value:w}))}function hA({children:e,location:t}){return eA(gg(e),t)}function gg(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,gg(s.props.children,i));return}nn(s.type===He,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),nn(!s.props.index||!s.props.children,"An index route cannot have child routes.");let c={id:s.props.id||i.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(c.children=gg(s.props.children,i)),n.push(c)}),n}var Cd="get",Ed="application/x-www-form-urlencoded";function Ef(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gA(e){return Ef(e)&&e.tagName.toLowerCase()==="button"}function xA(e){return Ef(e)&&e.tagName.toLowerCase()==="form"}function yA(e){return Ef(e)&&e.tagName.toLowerCase()==="input"}function bA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function vA(e,t){return e.button===0&&(!t||t==="_self")&&!bA(e)}function xg(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 wA(e,t){let n=xg(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var ad=null;function jA(){if(ad===null)try{new FormData(document.createElement("form"),0),ad=!1}catch{ad=!0}return ad}var kA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function gh(e){return e!=null&&!kA.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ed}"`),null):e}function SA(e,t){let n,s,o,i,c;if(xA(e)){let u=e.getAttribute("action");s=u?Bs(u,t):null,n=e.getAttribute("method")||Cd,o=gh(e.getAttribute("enctype"))||Ed,i=new FormData(e)}else if(gA(e)||yA(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||u.getAttribute("action");if(s=d?Bs(d,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Cd,o=gh(e.getAttribute("formenctype"))||gh(u.getAttribute("enctype"))||Ed,i=new FormData(u,e),!jA()){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(Ef(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Cd,s=null,o=Ed,c=e}return i&&o==="text/plain"&&(c=i,i=void 0),{action:s,method:n.toLowerCase(),encType:o,formData:i,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function hx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function NA(e,t,n,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&Bs(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${s}`,o}async function CA(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function EA(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 TA(e,t,n){let s=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let c=await CA(i,n);return c.links?c.links():[]}return[]}));return DA(s.flat(1).filter(EA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Tw(e,t,n,s,o,i){let c=(d,m)=>n[m]?d.route.id!==n[m].route.id:!0,u=(d,m)=>{var h;return n[m].pathname!==d.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,m)=>c(d,m)||u(d,m)):i==="data"?t.filter((d,m)=>{var g;let h=s.routes[d.route.id];if(!h||!h.hasLoader)return!1;if(c(d,m)||u(d,m))return!0;if(d.route.shouldRevalidate){let y=d.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function RA(e,t,{includeHydrateFallback:n}={}){return AA(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 AA(e){return[...new Set(e)]}function PA(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function DA(e,t){let n=new Set;return new Set(t),e.reduce((s,o)=>{let i=JSON.stringify(PA(o));return n.has(i)||(n.add(i),s.push({key:i,link:o})),s},[])}function Ok(){let e=f.useContext(Fi);return hx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $A(){let e=f.useContext(Cf);return hx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var gx=f.createContext(void 0);gx.displayName="FrameworkContext";function _k(){let e=f.useContext(gx);return hx(e,"You must render this element inside a <HydratedRouter> element"),e}function LA(e,t){let n=f.useContext(gx),[s,o]=f.useState(!1),[i,c]=f.useState(!1),{onFocus:u,onBlur:d,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=f.useRef(null);f.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let w=k=>{k.forEach(E=>{c(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(()=>{c(!0)},100);return()=>{clearTimeout(w)}}},[s]);let b=()=>{o(!0)},N=()=>{o(!1),c(!1)};return n?e!=="intent"?[i,y,{}]:[i,y,{onFocus:Ml(u,b),onBlur:Ml(d,N),onMouseEnter:Ml(m,b),onMouseLeave:Ml(h,N),onTouchStart:Ml(g,b)}]:[!1,y,{}]}function Ml(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function IA({page:e,...t}){let{router:n}=Ok(),s=f.useMemo(()=>jk(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(_A,{page:e,matches:s,...t}):null}function OA(e){let{manifest:t,routeModules:n}=_k(),[s,o]=f.useState([]);return f.useEffect(()=>{let i=!1;return TA(e,t,n).then(c=>{i||o(c)}),()=>{i=!0}},[e,t,n]),s}function _A({page:e,matches:t,...n}){let s=Xn(),{future:o,manifest:i,routeModules:c}=_k(),{basename:u}=Ok(),{loaderData:d,matches:m}=$A(),h=f.useMemo(()=>Tw(e,t,m,i,s,"data"),[e,t,m,i,s]),g=f.useMemo(()=>Tw(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(P=>P.route.id===E.route.id)&&E.route.id in d&&((T=c[E.route.id])!=null&&T.shouldRevalidate)||S.hasClientLoader?v=!0:w.add(E.route.id))}),w.size===0)return[];let k=NA(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,c]),b=f.useMemo(()=>RA(g,i),[g,i]),N=OA(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})),N.map(({key:w,link:v})=>f.createElement("link",{key:w,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function MA(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var FA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{FA&&(window.__reactRouterVersion="7.13.1")}catch{}function zA({basename:e,children:t,unstable_useTransitions:n,window:s}){let o=f.useRef();o.current==null&&(o.current=gR({window:s,v5Compat:!0}));let i=o.current,[c,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(mA,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:i,unstable_useTransitions:n})}var Mk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ce=f.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:o,reloadDocument:i,replace:c,unstable_mask:u,state:d,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...N},w){let{basename:v,navigator:k,unstable_useTransitions:E}=f.useContext(Wr),S=typeof h=="string"&&Mk.test(h),T=Ek(h,v);h=T.to;let P=JR(h,{relative:o}),R=Xn(),A=null;if(u){let z=dx(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(z.pathname=z.pathname==="/"?v:js([v,z.pathname])),A=k.createHref(z)}let[L,M,F]=LA(s,N),D=VA(h,{replace:c,unstable_mask:u,state:d,target:m,preventScrollReset:g,relative:o,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function V(z){t&&t(z),z.defaultPrevented||D(z)}let Y=!(T.isExternal||i),_=f.createElement("a",{...N,...F,href:(Y?A:void 0)||T.absoluteURL||P,onClick:Y?V:t,ref:MA(w,M),target:m,"data-discover":!S&&n==="render"?"true":void 0});return L&&!S?f.createElement(f.Fragment,null,_,f.createElement(IA,{page:P})):_});Ce.displayName="Link";var BA=f.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:o=!1,style:i,to:c,viewTransition:u,children:d,...m},h){let g=Dc(c,{relative:m.relative}),y=Xn(),b=f.useContext(Cf),{navigator:N,basename:w}=f.useContext(Wr),v=b!=null&&YA(g)&&u===!0,k=N.encodeLocation?N.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=Bs(S,w)||S);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let P=E===k||!o&&E.startsWith(k)&&E.charAt(T)==="/",R=S!=null&&(S===k||!o&&S.startsWith(k)&&S.charAt(k.length)==="/"),A={isActive:P,isPending:R,isTransitioning:v},L=P?t:void 0,M;typeof s=="function"?M=s(A):M=[s,P?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let F=typeof i=="function"?i(A):i;return f.createElement(Ce,{...m,"aria-current":L,className:M,ref:h,style:F,to:c,viewTransition:u},typeof d=="function"?d(A):d)});BA.displayName="NavLink";var UA=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:o,state:i,method:c=Cd,action:u,onSubmit:d,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},N)=>{let{unstable_useTransitions:w}=f.useContext(Wr),v=qA(),k=GA(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",S=typeof u=="string"&&Mk.test(u),T=P=>{if(d&&d(P),P.defaultPrevented)return;P.preventDefault();let R=P.nativeEvent.submitter,A=(R==null?void 0:R.getAttribute("formmethod"))||c,L=()=>v(R||P.currentTarget,{fetcherKey:t,method:A,navigate:n,replace:o,state:i,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});w&&n!==!1?f.startTransition(()=>L()):L()};return f.createElement("form",{ref:N,method:E,action:k,onSubmit:s?d:T,...b,"data-discover":!S&&e==="render"?"true":void 0})});UA.displayName="Form";function WA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Fk(e){let t=f.useContext(Fi);return nn(t,WA(e)),t}function VA(e,{target:t,replace:n,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:m}={}){let h=_t(),g=Xn(),y=Dc(e,{relative:c});return f.useCallback(b=>{if(vA(b,t)){b.preventDefault();let N=n!==void 0?n:gc(g)===gc(y),w=()=>h(e,{replace:N,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:d});m?f.startTransition(()=>w()):w()}},[g,h,y,n,s,o,t,e,i,c,u,d,m])}function ls(e){ts(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=f.useRef(xg(e)),n=f.useRef(!1),s=Xn(),o=f.useMemo(()=>wA(s.search,n.current?null:t.current),[s.search]),i=_t(),c=f.useCallback((u,d)=>{const m=xg(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,i("?"+m,d)},[i,o]);return[o,c]}var HA=0,KA=()=>`__${String(++HA)}__`;function qA(){let{router:e}=Fk("useSubmit"),{basename:t}=f.useContext(Wr),n=cA(),s=e.fetch,o=e.navigate;return f.useCallback(async(i,c={})=>{let{action:u,method:d,encType:m,formData:h,body:g}=SA(i,t);if(c.navigate===!1){let y=c.fetcherKey||KA();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||d,formEncType:c.encType||m,flushSync:c.flushSync})}else await o(c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||d,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,o,t,n])}function GA(e,{relative:t}={}){let{basename:n}=f.useContext(Wr),s=f.useContext(is);nn(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),i={...Dc(e||".",{relative:t})},c=Xn();if(e==null){i.search=c.search;let u=new URLSearchParams(i.search),d=u.getAll("index");if(d.some(h=>h==="")){u.delete("index"),d.filter(g=>g).forEach(g=>u.append("index",g));let h=u.toString();i.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:js([n,i.pathname])),gc(i)}function YA(e,{relative:t}={}){let n=f.useContext(Rk);nn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Fk("useViewTransitionState"),o=Dc(e,{relative:t});if(!n.isTransitioning)return!1;let i=Bs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=Bs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Vd(o.pathname,c)!=null||Vd(o.pathname,i)!=null}var Fs=wk();const JA=Nf(Fs);/**
52
- * @license lucide-react v0.460.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const QA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),zk=(...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 XA={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 ZA=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:c,...u},d)=>f.createElement("svg",{ref:d,...XA,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:zk("lucide",o),...u},[...c.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 $e=(e,t)=>{const n=f.forwardRef(({className:s,...o},i)=>f.createElement(ZA,{ref:i,iconNode:t,className:zk(`lucide-${QA(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 Tf=$e("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
77
- * @license lucide-react v0.460.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const Hd=$e("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
82
- * @license lucide-react v0.460.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const Rf=$e("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
87
- * @license lucide-react v0.460.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const Kd=$e("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
92
- * @license lucide-react v0.460.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const Af=$e("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
97
- * @license lucide-react v0.460.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const Bk=$e("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
102
- * @license lucide-react v0.460.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const qd=$e("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
107
- * @license lucide-react v0.460.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const eP=$e("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 tP=$e("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/**
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 Uk=$e("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
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 Pf=$e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
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 nP=$e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
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 Wk=$e("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 Rr=$e("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 pr=$e("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=$e("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 Vk=$e("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 Hk=$e("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 Gd=$e("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
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 xx=$e("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 yg=$e("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 sP=$e("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 oP=$e("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 aP=$e("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 iP=$e("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=$e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 cP=$e("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
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 $c=$e("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
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 uP=$e("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 Kk=$e("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 Yd=$e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
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 dP=$e("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
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 fP=$e("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
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 zi=$e("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
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 Rw=$e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 pP=$e("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
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 mP=$e("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
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 qk=$e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
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 yx=$e("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
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 hP=$e("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/**
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 bx=$e("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
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 gP=$e("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
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 Bi=$e("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
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 xP=$e("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
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 yP=$e("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
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 vx=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 bg=$e("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
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 Gk=$e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
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 bP=$e("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
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 vP=$e("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
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 wP=$e("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
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 jP=$e("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
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 kP=$e("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
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 wx=$e("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 SP=$e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
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 NP=$e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
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 jx=$e("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
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 CP=$e("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
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 xh=$e("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
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 Yk=$e("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
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 Ui=$e("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
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 EP=$e("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 Ct=$e("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 Jk=$e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
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 TP=$e("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/**
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 RP=$e("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
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 Us=$e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
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 Df=$e("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
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 AP=$e("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Eo=$e("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 PP=$e("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/**
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 DP=$e("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
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 $P=$e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
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 LP=$e("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 IP=$e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
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 zr=$e("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
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 Aw=$e("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
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 Pw=$e("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
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 kx=$e("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 OP=$e("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
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 Qk=$e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
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 xi=$e("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=$e("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
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 Sx=$e("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
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 _P=$e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
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 MP=$e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
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 FP=$e("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 $f=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Xk(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=Xk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function zP(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Xk(e))&&(s&&(s+=" "),s+=t);return s}const Nx="-",BP=e=>{const t=WP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(Nx);return u[0]===""&&u.length!==1&&u.shift(),Zk(u,t)||UP(c)},getConflictingClassGroupIds:(c,u)=>{const d=n[c]||[];return u&&s[c]?[...d,...s[c]]:d}}},Zk=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Zk(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Nx);return(c=t.validators.find(({validator:u})=>u(i)))==null?void 0:c.classGroupId},Dw=/^\[(.+)\]$/,UP=e=>{if(Dw.test(e)){const t=Dw.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},WP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return HP(Object.entries(e.classGroups),n).forEach(([i,c])=>{vg(c,s,i,t)}),s},vg=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:$w(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(VP(o)){vg(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,c])=>{vg(c,$w(t,i),n,s)})})},$w=(e,t)=>{let n=e;return t.split(Nx).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},VP=e=>e.isThemeGetter,HP=(e,t)=>t?e.map(([n,s])=>{const o=s.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([c,u])=>[t+c,u])):i);return[n,o]}):e,KP=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const o=(i,c)=>{n.set(i,c),t++,t>e&&(t=0,s=n,n=new Map)};return{get(i){let c=n.get(i);if(c!==void 0)return c;if((c=s.get(i))!==void 0)return o(i,c),c},set(i,c){n.has(i)?n.set(i,c):o(i,c)}}},e1="!",qP=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,c=u=>{const d=[];let m=0,h=0,g;for(let v=0;v<u.length;v++){let k=u[v];if(m===0){if(k===o&&(s||u.slice(v,v+i)===t)){d.push(u.slice(h,v)),h=v+i;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=d.length===0?u:u.substring(h),b=y.startsWith(e1),N=b?y.substring(1):y,w=g&&g>h?g-h:void 0;return{modifiers:d,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:w}};return n?u=>n({className:u,parseClassName:c}):c},GP=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},YP=e=>({cache:KP(e.cacheSize),parseClassName:qP(e),...BP(e)}),JP=/\s+/,QP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],c=e.trim().split(JP);let u="";for(let d=c.length-1;d>=0;d-=1){const m=c[d],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let N=!!b,w=s(N?y.substring(0,b):y);if(!w){if(!N){u=m+(u.length>0?" "+u:u);continue}if(w=s(y),!w){u=m+(u.length>0?" "+u:u);continue}N=!1}const v=GP(h).join(":"),k=g?v+e1:v,E=k+w;if(i.includes(E))continue;i.push(E);const S=o(w,N);for(let T=0;T<S.length;++T){const P=S[T];i.push(k+P)}u=m+(u.length>0?" "+u:u)}return u};function XP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=t1(t))&&(s&&(s+=" "),s+=n);return s}const t1=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=t1(e[s]))&&(n&&(n+=" "),n+=t);return n};function ZP(e,...t){let n,s,o,i=c;function c(d){const m=t.reduce((h,g)=>g(h),e());return n=YP(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=QP(d,n);return o(d,h),h}return function(){return i(XP.apply(null,arguments))}}const Vt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},n1=/^\[(?:([a-z-]+):)?(.+)\]$/i,e3=/^\d+\/\d+$/,t3=new Set(["px","full","screen"]),n3=/^(\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$/,s3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,o3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,a3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>yi(e)||t3.has(e)||e3.test(e),fo=e=>Wi(e,"length",m3),yi=e=>!!e&&!Number.isNaN(Number(e)),yh=e=>Wi(e,"number",yi),Fl=e=>!!e&&Number.isInteger(Number(e)),i3=e=>e.endsWith("%")&&yi(e.slice(0,-1)),dt=e=>n1.test(e),po=e=>n3.test(e),l3=new Set(["length","size","percentage"]),c3=e=>Wi(e,l3,r1),u3=e=>Wi(e,"position",r1),d3=new Set(["image","url"]),f3=e=>Wi(e,d3,g3),p3=e=>Wi(e,"",h3),zl=()=>!0,Wi=(e,t,n)=>{const s=n1.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},m3=e=>r3.test(e)&&!s3.test(e),r1=()=>!1,h3=e=>o3.test(e),g3=e=>a3.test(e),x3=()=>{const e=Vt("colors"),t=Vt("spacing"),n=Vt("blur"),s=Vt("brightness"),o=Vt("borderColor"),i=Vt("borderRadius"),c=Vt("borderSpacing"),u=Vt("borderWidth"),d=Vt("contrast"),m=Vt("grayscale"),h=Vt("hueRotate"),g=Vt("invert"),y=Vt("gap"),b=Vt("gradientColorStops"),N=Vt("gradientColorStopPositions"),w=Vt("inset"),v=Vt("margin"),k=Vt("opacity"),E=Vt("padding"),S=Vt("saturate"),T=Vt("scale"),P=Vt("sepia"),R=Vt("skew"),A=Vt("space"),L=Vt("translate"),M=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,t],V=()=>[dt,t],Y=()=>["",_s,fo],_=()=>["auto",yi,dt],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],H=()=>["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"],I=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",dt],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[yi,dt];return{cacheSize:500,separator:":",theme:{colors:[zl],spacing:[_s,fo],blur:["none","",po,dt],brightness:W(),borderColor:[e],borderRadius:["none","","full",po,dt],borderSpacing:V(),borderWidth:Y(),contrast:W(),grayscale:K(),hueRotate:W(),invert:K(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[i3,fo],inset:D(),margin:D(),opacity:W(),padding:V(),saturate:W(),scale:W(),sepia:K(),skew:W(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",dt]}],container:["container"],columns:[{columns:[po]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"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:[...z(),dt]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],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",Fl,dt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dt]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",Fl,dt]}],"grid-cols":[{"grid-cols":[zl]}],"col-start-end":[{col:["auto",{span:["full",Fl,dt]},dt]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[zl]}],"row-start-end":[{row:["auto",{span:[Fl,dt]},dt]}],"row-start":[{"row-start":_()}],"row-end":[{"row-end":_()}],"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",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"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":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"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:[po]},po]}],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",po,fo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yh]}],"font-family":[{font:[zl]}],"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",yi,yh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_s,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:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_s,fo]}],"underline-offset":[{"underline-offset":["auto",_s,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:V()}],"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:[...z(),u3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",c3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},f3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"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:[...H(),"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:H()}],"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:["",...H()]}],"outline-offset":[{"outline-offset":[_s,dt]}],"outline-w":[{outline:[_s,fo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Y()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[_s,fo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",po,p3]}],"shadow-color":[{shadow:[zl]}],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",po,dt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[S]}],sepia:[{sepia:[P]}],"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":[P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dt]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:W()}],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:[Fl,dt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"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":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",dt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_s,fo,yh]}],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"]}}},y3=ZP(x3);function be(...e){return y3(zP(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 Ur(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function s1(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function o1(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 a1(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 Ai(e){return e.toLocaleString("en-US")}function Pi(e){return`$${e.toFixed(4)}`}function b3(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 i1(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function v3(e){let t=i1(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 l1(e,t){return v3(e)===t}function c1(e){let n=i1(e).split("/").filter(Boolean);const s=[];let o="Overview",i=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:kn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:s,projectSlug:i};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),o="Projects",n[1]&&(i=n[1],s.push({label:kn(n[1]),path:`${c}/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:`${c}/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:`${c}/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:`${c}/servers`})):n[0]==="inventories"?(o="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(o="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(o="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label: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:`${c}/todos`})):n[0]==="views"?(o="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",s.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:o,breadcrumbs:s,projectSlug:i}}function Lw({items:e,onNavigate:t}){const n=Xn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const o=s.icon,i=l1(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Ce,{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 u1=[{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)"}}],w3=u1.map(e=>e.slug),Jd="default";function d1(e){return typeof e=="string"&&w3.includes(e)}const f1={preset:Jd,custom:!1};let Zl=null,Qa=null;function Cx(e){if(!e||typeof e!="object")return f1;const t=e;return{preset:d1(t.preset)?t.preset:Jd,custom:t.custom===!0}}function j3(){return Zl?Promise.resolve(Zl):Qa||(Qa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Cx(e);return Zl=t,Qa=null,t}).catch(()=>(Qa=null,f1)),Qa)}async function k3(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=Cx(await t.json());return Zl=n,n}async function S3(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Cx(await e.json());return Zl=t,t}const wg="syntaur-theme",Td="syntaur-preset",p1=f.createContext(null);function jg(){try{const e=window.localStorage.getItem(wg);return e==="light"||e==="dark"?e:null}catch{return null}}function m1(){try{const e=window.localStorage.getItem(Td);return d1(e)?e:Jd}catch{return Jd}}function h1(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function g1(e){document.documentElement.classList.toggle("dark",e==="dark")}function x1(e){document.documentElement.dataset.theme=e}function N3(){typeof document>"u"||(g1(jg()??h1()),x1(m1()))}function C3({children:e}){const[t,n]=f.useState(()=>jg()),[s,o]=f.useState(()=>jg()??h1()),[i,c]=f.useState(()=>m1());f.useEffect(()=>{g1(s)},[s]),f.useEffect(()=>{x1(i)},[i]),f.useEffect(()=>{let h=!1;return j3().then(g=>{if(!h&&g.preset!==i){c(g.preset);try{window.localStorage.setItem(Td,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){c(h);try{window.localStorage.setItem(Td,h)}catch{}await k3(h)}async function d(){const h=await S3();c(h.preset);try{window.localStorage.setItem(Td,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(wg,h),n(h),o(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(wg,h),n(h),o(h)},preset:i,setPreset:u,resetPreset:d};return r.jsx(p1.Provider,{value:m,children:e})}function Ex(){const e=f.useContext(p1);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Rd=new Set;let cr=null,bi=null;function E3(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function y1(){cr&&(cr.readyState===WebSocket.OPEN||cr.readyState===WebSocket.CONNECTING)||(cr=new WebSocket(E3()),cr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Rd)n(t)}catch{}},cr.onclose=()=>{cr=null,bi&&clearTimeout(bi),bi=setTimeout(y1,2e3)},cr.onerror=()=>{cr==null||cr.close()})}function Vi(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Rd.add(n),y1(),()=>{Rd.delete(n),Rd.size===0&&cr&&(bi&&clearTimeout(bi),bi=null,cr.close(),cr=null)}},[])}const Lf=["7d","30d","90d","all","custom"],b1="30d",T3=/^\d{4}-\d{2}-\d{2}$/,Lc=["project","workspace","model","tool"],R3={"7d":7,"30d":30,"90d":90};function ec(e){if(typeof e!="string"||!T3.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 Iw(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 A3(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function P3(e,t=new Date){const n=e.window??b1;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:Iw(A3(s,-(R3[n]-1))),until:Iw(s)}}function D3(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&&!Lf.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const s of["since","until"])n[s]!==void 0&&!ec(n[s])&&t.push(`invalid ${s}: ${String(n[s])} (expected YYYY-MM-DD)`);for(const s of Lc)n[s]!==void 0&&(typeof n[s]!="string"||n[s].length===0)&&t.push(`invalid ${s}: must be a non-empty string`);return ec(n.since)&&ec(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Ic(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Lf.includes(n.window)&&(t.window=n.window),ec(n.since)&&(t.since=n.since),ec(n.until)&&(t.until=n.until);for(const s of Lc)typeof n[s]=="string"&&n[s].length>0&&(t[s]=n[s]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function kg(e){const t=Ic(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 Lc)t[s]&&n.set(s,t[s]);return n}function $3(e){const t={};for(const n of["window","since","until",...Lc]){const s=e.get(n);s!==null&&(t[n]=s)}return Ic(t)}function v1(e,t=new Date){const n=Ic(e),{since:s,until:o}=P3(n,t),i=new URLSearchParams;s&&i.set("since",s),o&&i.set("until",o);for(const c of Lc)n[c]&&i.set(c,n[c]);return i}const L3={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function Ow(e){const t=Ic(e),n=t.window??b1,s=[];return s.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:L3[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),[c,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)},[]),N=f.useRef(y);return s&&N.current!==y&&(N.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]),Vi(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:c,error:d,refetch:b}}function Cs(e=!0){return qt("/api/projects","projects",e)}function ma(){return qt("/api/workspaces","projects")}function un(){const{workspace:e}=Mt();return e?`/w/${e}`:""}function I3(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 If(e=!0){return qt("/api/assignments","assignments",e)}function O3(e=!0){return qt("/api/archived","assignments",e)}function w1(){return qt("/api/help")}function j1(e){const t=e?`/api/projects/${e}`:null;return qt(t,"project")}function _3(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return qt(n,"assignment")}function M3(e){const t=e?`/api/assignments/${e}`:null;return qt(t,"assignment")}function k1(e){return qt(e)}function Tx(e=!0){return qt("/api/servers","servers",e)}function S1(){return qt("/api/leases","inventories")}function Of(){return qt("/api/agent-sessions","agent-sessions")}function F3(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return qt(n,"agent-sessions")}function z3(e){const t=e?`/api/assignments/${e}/sessions`:null;return qt(t,"agent-sessions")}function B3(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return qt(n,void 0,!0,!0)}function U3(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return qt(t,void 0,!0,!0)}function Rx(e=!0){return qt("/api/playbooks","playbooks",e)}function W3(e){const t=v1(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return qt(n,void 0,!0,!0)}function N1(e=!0){return qt("/api/usage/facets",void 0,e)}function V3(e){const t=e?`/api/playbooks/${e}`:null;return qt(t,"playbooks")}function H3(){return qt("/api/memories","project")}function K3(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return qt(n,"project")}function q3(){return qt("/api/resources","project")}function G3(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return qt(n,"project")}const _f=["new-workspace","new-project","new-todo","new-assignment"];function Y3(e){return typeof e=="string"&&_f.includes(e)}const J3=["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","[","]"],Q3=["mod","ctrl","alt","shift"];function dr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(dr).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(u=>u.toLowerCase()),i=new Set,c=[];for(const u of Q3)o.includes(u)&&!i.has(u)&&(c.push(u),i.add(u));for(const u of o)i.has(u)||(c.push(u),i.add(u));return[...c,s].join("+")}function X3(e){const t=dr(e);return t?J3.includes(t):!1}const Z3={"new-workspace":dr("Mod+Shift+Alt+w"),"new-project":dr("Mod+Shift+Alt+p"),"new-todo":dr("Mod+Shift+Alt+t"),"new-assignment":dr("Mod+Shift+Alt+a")};function eD(e){const t={...Z3};for(const n of _f){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function na(){if(typeof navigator>"u")return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/Mac|iPhone|iPad|iPod/.test(e)||/Mac OS X/.test(t)}function tD(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 id(e,t){const n=tD(t);if(e.key.toLowerCase()!==n.key)return!1;const o=na()?e.metaKey:e.ctrlKey;return!(n.mod&&!o||!n.mod&&!n.ctrl&&o||n.ctrl&&!e.ctrlKey||n.shift&&!e.shiftKey||!n.shift&&!(n.key.length===1&&!/^[a-z0-9]$/.test(n.key))&&e.shiftKey||n.alt&&!e.altKey||!n.alt&&e.altKey)}function C1(e){const t=[],n=na()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const s=e.key;let o;s===" "||s==="Spacebar"?o="space":(s.length,o=s.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const c=[...t,o].join("+");return dr(c)}function ks(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?na()?"⌘":"Ctrl":s==="shift"?na()?"⇧":"Shift":s==="alt"?na()?"⌥":"Alt":s==="ctrl"?na()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(na()?"":"+")}function nD(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,c]=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()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Vi(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function E1(e=!0){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,c]=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()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[]);return f.useEffect(()=>{if(!e){o(!1);return}u()},[u,e]),Vi(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}async function Ax(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 T1(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 R1(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 A1(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 P1(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function D1(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function $1(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 Px(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function L1(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 I1(e,t,n){const s=await fetch(Px(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Dx(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,c=new Error(i);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function rD(e,t){return await Dx(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function sD(e){return await Dx("/api/todos/promote-bulk",e)}async function oD(e,t,n){await Dx(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const aD=new Set(["/projects","/assignments","/servers","/todos"]);function Ad(e,t){return aD.has(e)?`${t}${e}`:e}const iD=[{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 _w(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 lD(e){const t=[];for(const n of iD)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:Ad(n.basePath,e.wsPrefix)});for(const n of e.projects??[]){const s=n.workspace?`/w/${n.workspace}`:"";t.push({type:"project",id:`project-${n.slug}`,title:n.title,subtitle:n.slug,keywords:[...n.tags??[],..._w(n.externalIds)],route:`${s}/projects/${n.slug}`,tags:n.tags,project:n.slug,externalIds:n.externalIds}),t.push({type:"todo",id:`project-todos-${n.slug}`,title:`${n.title} todos`,subtitle:`${n.slug} · project`,keywords:[...n.tags??[],"project","todos"],route:`${s}/projects/${n.slug}?tab=todos`})}for(const n of e.assignments??[]){const s=n.projectWorkspace?`/w/${n.projectWorkspace}`:"";t.push({type:"assignment",id:n.projectSlug===null?`assignment-standalone-${n.id}`:`assignment-${n.projectSlug}-${n.slug}`,title:n.title,subtitle:`${n.projectTitle} · ${n.status}`,keywords:[n.projectSlug??"standalone",n.assignee??"",..._w(n.externalIds)].filter(o=>!!o),route:n.projectSlug===null?`/assignments/${n.id}`:`${s}/projects/${n.projectSlug}/assignments/${n.slug}`,status:n.status,tags:n.tags,assignee:n.assignee,assignmentType:n.type,project:n.projectSlug,externalIds:n.externalIds})}for(const n of e.playbooks??[])t.push({type:"playbook",id:`playbook-${n.slug}`,title:n.name,subtitle:n.description,keywords:n.tags,route:`/playbooks/${n.slug}`,tags:n.tags});for(const n of e.servers??[])t.push({type:"server",id:`server-${n.name}`,title:n.name,subtitle:n.alive?"alive":"dead",route:`${Ad("/servers",e.wsPrefix)}#server-${encodeURIComponent(n.name)}`});for(const n of e.todos??[]){const s=n.workspace&&n.workspace!=="_ungrouped"?`/w/${n.workspace}`:e.wsPrefix,o=Ad("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${o}?focus=${encodeURIComponent(n.id)}`,status:n.status,tags:n.tags})}return t}function wr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Pd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function cD(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 bh(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 Mw(){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 Fw(){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 vh(e){const t=await fetch(e);if(!t.ok)throw new Error(`Failed to load template (HTTP ${t.status})`);const n=await t.json();if(!n.content)throw new Error("Template returned no content");return n.content}function Yo(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
512
- ${t}: ${JSON.stringify(n)}
513
- ---
514
- ${e}`;const o=s[1],i=s[2],c=s[3],u=e.slice(s[0].length),d=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(i)?h=i.replace(m,`${t}: ${d}`):h=`${i}
515
- ${t}: ${d}`,`${o}${h}${c}${u}`}const uD=/^[a-z0-9][a-z0-9-]*$/;function dD(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:c,navigate:u,toggleTheme:d}=e,m=[];if(m.push({id:"new-workspace",title:"New Workspace",subtitle:"Create a Syntaur workspace",group:"Create",keywords:["new","create","workspace"],bindableKind:"new-workspace",flow:{steps:[{kind:"text",id:"name",label:"Workspace name",placeholder:"lowercase, hyphenated (e.g. acme-app)",required:!0,pattern:{regex:uD,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 N=await b.json().catch(()=>({}));throw new Error(N.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 Mw(),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 N=wr(b);if(!N)throw new Error("Title must contain at least one alphanumeric character");let w=await vh("/api/templates/project");w=Yo(w,"slug",N),w=Yo(w,"title",b),y&&y!=="_ungrouped"&&(w=Yo(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??N}`:`/projects/${k.slug??N}`;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([Mw(),Fw()]),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 N=b.workspace??"_ungrouped";y.push({value:N,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 Ax(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 Fw(),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 N=wr(b);if(!N)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await vh("/api/templates/assignment?standalone=1");T=Yo(T,"slug",N),T=Yo(T,"title",b);const P=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await P.json().catch(()=>({}));if(!P.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${P.status})`);const A=((S=R==null?void 0:R.assignment)==null?void 0:S.id)??(R==null?void 0:R.id);A?g.navigate(`/assignments/${A}`):g.navigate("/assignments");return}let w=await vh("/api/templates/assignment");w=Yo(w,"slug",N),w=Yo(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??N;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 bh("_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 bh(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 bh(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:()=>cD(h.slug,h.enabled,c)});return m.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>d()}),m}const fD=["low","medium","high","critical"],Mf={status:{kind:"enum"},priority:{kind:"ordinal",order:fD},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 pD(e,t){return e[t.toLowerCase()]??null}function jr(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class kr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function O1(e){const[t,n,s]=e.split("-").map(c=>parseInt(c,10)),o=new Date(t,n-1,s).getTime(),i=new Date(t,n-1,s+1).getTime();return[o,i]}function Sg(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 tc(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 wh(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function mD(e){return e==null||e===""}function Dd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>mD(jr(e,t,o)):o=>wh(jr(e,t,o),n.raw);case"substring":return o=>{const i=jr(e,t,o);return typeof i=="string"&&i.toLowerCase().includes(n.raw.toLowerCase())};case"bool":{const o=n.raw.toLowerCase();if(o!=="true"&&o!=="false")throw new kr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return c=>{const u=jr(e,t,c),d=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return d!==null&&d===i}}case"number":{const o=n.num??tc(n.raw);if(o===null)throw new kr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>tc(jr(e,t,i))===o}case"ordinal":return o=>wh(jr(e,t,o),n.raw);case"list":return o=>{const i=jr(e,t,o);return Array.isArray(i)&&i.some(c=>wh(c,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=O1(n.raw);return c=>{const u=Sg(jr(e,t,c));return u!==null&&u>=o&&u<i}}throw new kr([{pos:n.pos,message:`Field "${t}" is a timestamp — use a comparison (e.g. ${t} > -36h) or an absolute date (${t}:2026-06-01)`}])}case"duration":throw new kr([{pos:s,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function hD(e,t,n,s){const o=(i,c)=>{switch(n){case"<":return i<c;case">":return i>c;case"<=":return i<=c;case">=":return i>=c;case"=":return i===c;case"!=":return i!==c;default:return!1}};switch(e.kind){case"number":{const i=s.num??tc(s.raw);if(i===null)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=tc(jr(e,t,c));return u!==null&&o(u,i)}}case"ordinal":{const i=e.order??[],c=i.findIndex(u=>u.toLowerCase()===s.raw.toLowerCase());if(c<0)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return u=>{const d=jr(e,t,u),m=typeof d=="string"?i.findIndex(h=>h.toLowerCase()===d.toLowerCase()):-1;return m>=0&&o(m,c)}}case"timestamp":{if(s.type==="duration"){const c=(s.sign===0?-1:s.sign??-1)*(s.num??0);return(u,d)=>{const m=Sg(jr(e,t,u));return m!==null&&o(m,d.now+c)}}if(s.type==="date"){const[i,c]=O1(s.raw);return u=>{const d=Sg(jr(e,t,u));if(d===null)return!1;switch(n){case"<":return d<i;case"<=":return d<c;case">":return d>=c;case">=":return d>=i;case"=":return d>=i&&d<c;case"!=":return d<i||d>=c;default:return!1}}}throw new kr([{pos:s.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(s.type!=="duration")throw new kr([{pos:s.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=s.num??0;return c=>{const u=tc(jr(e,t,c));return u!==null&&o(u,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Dd(e,t,s,s.pos);if(n==="!="){const i=Dd(e,t,s,s.pos);return(c,u)=>!i(c,u)}throw new kr([{pos:s.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Dd(e,t,s,s.pos);return n==="="?i:(c,u)=>!i(c,u)}throw new kr([{pos:s.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function gD(e,t){const n=pD(t,e.field);if(!n)throw new kr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const s=e.values.map(o=>Dd(n,e.field,o,e.pos));return s.length===1?s[0]:(o,i)=>s.some(c=>c(o,i))}return hD(n,e.field,e.op,e.values[0])}function nc(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return gD(e,t);case"not":{const n=nc(e.child,t);return(s,o)=>!n(s,o)}case"and":{const n=e.children.map(s=>nc(s,t));return(s,o)=>n.every(i=>i(s,o))}case"or":{const n=e.children.map(s=>nc(s,t));return(s,o)=>n.some(i=>i(s,o))}}}class ra extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const xD={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},yD=/[A-Za-z_]/,bD=/[A-Za-z0-9_-]/,vD=/^\d{4}-\d{2}-\d{2}/;function _1(e){const t=[];let n=0;const s=(o,i)=>{let c=n;for(;c<e.length&&/\d/.test(e[c]);)c++;const u=e.slice(n,c);let d="";for(;c<e.length&&/[a-z]/i.test(e[c]);)d+=e[c],c++;if(n=c,d.length>0){const m=xD[d.toLowerCase()];if(m===void 0)throw new ra(o,`Unknown duration unit "${d}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(o,c),pos:o,num:parseInt(u,10)*m,sign:i}}return i!==0?{type:"NUMBER",text:e.slice(o,c),pos:o,num:i*parseInt(u,10)}:{type:"NUMBER",text:u,pos:o,num:parseInt(u,10)}};for(;n<e.length;){const o=e[n],i=n;if(o===" "||o===" "||o===`
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 ra(i,'Unexpected "!" (did you mean "!="?)')}if(o==="="){n+=e[n+1]==="="?2:1,t.push({type:"OP",text:"=",pos:i});continue}if(o==='"'||o==="'"){const c=o;let u=n+1,d="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(d+=e[u+1],u+=2):(d+=e[u],u++);if(u>=e.length)throw new ra(i,"Unterminated string literal");t.push({type:"STRING",text:d,pos:i}),n=u+1;continue}if(o==="-"||o==="+"){if(/\d/.test(e[n+1]??"")){const c=o==="-"?-1:1;n++,t.push(s(i,c));continue}if(o==="-"){t.push({type:"MINUS",text:"-",pos:i}),n++;continue}throw new ra(i,'Unexpected "+"')}if(/\d/.test(o)){const c=e.slice(n).match(vD);if(c){t.push({type:"DATE",text:c[0],pos:i}),n+=c[0].length;continue}t.push(s(i,0));continue}if(yD.test(o)){let c=n+1;for(;c<e.length&&bD.test(e[c]);)c++;const u=e.slice(n,c),d=u.toLowerCase();d==="and"?t.push({type:"AND",text:u,pos:i}):d==="or"?t.push({type:"OR",text:u,pos:i}):d==="not"?t.push({type:"NOT",text:u,pos:i}):t.push({type:"IDENT",text:u,pos:i}),n=c;continue}throw new ra(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Qo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const wD=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),jD=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class kD{constructor(t){lh(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 Qo(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 Qo(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(jD.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 Qo(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 Qo(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 Qo(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(!wD.has(t.type))throw new Qo(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 Ff(e){try{const t=_1(e);return{ast:new kD(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ra||t instanceof Qo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Di(e,t=Mf){const n=Ff(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:nc(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof kr)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 zw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zf(...e){return t=>{let n=!1;const s=e.map(o=>{const i=zw(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():zw(e[o],null)}}}}function Kn(...e){return f.useCallback(zf(...e),e)}function SD(e,t){const n=f.createContext(t),s=i=>{const{children:c,...u}=i,d=f.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:d,children:c})};s.displayName=e+"Provider";function o(i){const c=f.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function ha(e,t=[]){let n=[];function s(i,c){const u=f.createContext(c),d=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...N}=g,w=((k=y==null?void 0:y[e])==null?void 0:k[d])||u,v=f.useMemo(()=>N,Object.values(N));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,N=f.useContext(b);if(N)return N;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${i}\``)}return[m,h]}const o=()=>{const i=n.map(c=>f.createContext(c));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,ND(o,...t)]}function ND(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const c=s.reduce((u,{useScope:d,scopeName:m})=>{const g=d(i)[`__scope${m}`];return{...u,...g}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var jo=globalThis!=null&&globalThis.document?f.useLayoutEffect:()=>{},CD=vk[" useId ".trim().toString()]||(()=>{}),ED=0;function vi(e){const[t,n]=f.useState(CD());return jo(()=>{n(s=>s??String(ED++))},[e]),e||(t?`radix-${t}`:"")}var TD=vk[" useInsertionEffect ".trim().toString()]||jo;function Bf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,c]=RD({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=AD(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else i(h)},[u,e,i,c]);return[d,m]}function RD({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),o=f.useRef(n),i=f.useRef(t);return TD(()=>{i.current=t},[t]),f.useEffect(()=>{var c;o.current!==n&&((c=i.current)==null||c.call(i,n),o.current=n)},[n,o]),[n,s,i]}function AD(e){return typeof e=="function"}function PD(e){const t=DD(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(LD);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,{...c,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function DD(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=OD(o),u=ID(i,o.props);return o.type!==f.Fragment&&(u.ref=s?zf(s,c):c),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var $D=Symbol("radix.slottable");function LD(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$D}function ID(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function OD(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _D=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=_D.reduce((e,t)=>{const n=PD(`Primitive.${t}`),s=f.forwardRef((o,i)=>{const{asChild:c,...u}=o,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...u,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function MD(e,t){e&&Fs.flushSync(()=>e.dispatchEvent(t))}function da(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 FD(e,t=globalThis==null?void 0:globalThis.document){const n=da(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 zD="DismissableLayer",Ng="dismissableLayer.update",BD="dismissableLayer.pointerDownOutside",UD="dismissableLayer.focusOutside",Bw,M1=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$x=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...d}=e,m=f.useContext(M1),[h,g]=f.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=f.useState({}),N=Kn(t,A=>g(A)),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,P=HD(A=>{const L=A.target,M=[...m.branches].some(F=>F.contains(L));!T||M||(o==null||o(A),c==null||c(A),A.defaultPrevented||u==null||u())},y),R=KD(A=>{const L=A.target;[...m.branches].some(F=>F.contains(L))||(i==null||i(A),c==null||c(A),A.defaultPrevented||u==null||u())},y);return FD(A=>{E===m.layers.size-1&&(s==null||s(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))},y),f.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(Bw=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Uw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Bw)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Uw())},[h,m]),f.useEffect(()=>{const A=()=>b({});return document.addEventListener(Ng,A),()=>document.removeEventListener(Ng,A)},[]),r.jsx(vn.div,{...d,ref:N,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,P.onPointerDownCapture)})});$x.displayName=zD;var WD="DismissableLayerBranch",VD=f.forwardRef((e,t)=>{const n=f.useContext(M1),s=f.useRef(null),o=Kn(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})});VD.displayName=WD;function HD(e,t=globalThis==null?void 0:globalThis.document){const n=da(e),s=f.useRef(!1),o=f.useRef(()=>{});return f.useEffect(()=>{const i=u=>{if(u.target&&!s.current){let d=function(){F1(BD,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);s.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function KD(e,t=globalThis==null?void 0:globalThis.document){const n=da(e),s=f.useRef(!1);return f.useEffect(()=>{const o=i=>{i.target&&!s.current&&F1(UD,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 Uw(){const e=new CustomEvent(Ng);document.dispatchEvent(e)}function F1(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?MD(o,i):o.dispatchEvent(i)}var jh="focusScope.autoFocusOnMount",kh="focusScope.autoFocusOnUnmount",Ww={bubbles:!1,cancelable:!0},qD="FocusScope",z1=f.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=e,[u,d]=f.useState(null),m=da(o),h=da(i),g=f.useRef(null),y=Kn(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:yo(g.current,{select:!0})},v=function(S){if(b.paused||!u)return;const T=S.relatedTarget;T!==null&&(u.contains(T)||yo(g.current,{select:!0}))},k=function(S){if(document.activeElement===document.body)for(const P of S)P.removedNodes.length>0&&yo(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){Hw.add(b);const w=document.activeElement;if(!u.contains(w)){const k=new CustomEvent(jh,Ww);u.addEventListener(jh,m),u.dispatchEvent(k),k.defaultPrevented||(GD(ZD(B1(u)),{select:!0}),document.activeElement===w&&yo(u))}return()=>{u.removeEventListener(jh,m),setTimeout(()=>{const k=new CustomEvent(kh,Ww);u.addEventListener(kh,h),u.dispatchEvent(k),k.defaultPrevented||yo(w??document.body,{select:!0}),u.removeEventListener(kh,h),Hw.remove(b)},0)}}},[u,m,h,b]);const N=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]=YD(E);S&&T?!w.shiftKey&&k===T?(w.preventDefault(),n&&yo(S,{select:!0})):w.shiftKey&&k===S&&(w.preventDefault(),n&&yo(T,{select:!0})):k===E&&w.preventDefault()}},[n,s,b.paused]);return r.jsx(vn.div,{tabIndex:-1,...c,ref:y,onKeyDown:N})});z1.displayName=qD;function GD(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(yo(s,{select:t}),document.activeElement!==n)return}function YD(e){const t=B1(e),n=Vw(t,e),s=Vw(t.reverse(),e);return[n,s]}function B1(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 Vw(e,t){for(const n of e)if(!JD(n,{upTo:t}))return n}function JD(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 QD(e){return e instanceof HTMLInputElement&&"select"in e}function yo(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&QD(e)&&t&&e.select()}}var Hw=XD();function XD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Kw(e,t),e.unshift(t)},remove(t){var n;e=Kw(e,t),(n=e[0])==null||n.resume()}}}function Kw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function ZD(e){return e.filter(t=>t.tagName!=="A")}var e$="Portal",Lx=f.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[o,i]=f.useState(!1);jo(()=>i(!0),[]);const c=n||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?JA.createPortal(r.jsx(vn.div,{...s,ref:t}),c):null});Lx.displayName=e$;function t$(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var ga=e=>{const{present:t,children:n}=e,s=n$(t),o=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=Kn(s.ref,r$(o));return typeof n=="function"||s.isPresent?f.cloneElement(o,{ref:i}):null};ga.displayName="Presence";function n$(e){const[t,n]=f.useState(),s=f.useRef(null),o=f.useRef(e),i=f.useRef("none"),c=e?"mounted":"unmounted",[u,d]=t$(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const m=ld(s.current);i.current=u==="mounted"?m:"none"},[u]),jo(()=>{const m=s.current,h=o.current;if(h!==e){const y=i.current,b=ld(m);e?d("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?d("UNMOUNT"):d(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),jo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const w=ld(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=ld(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 ld(e){return(e==null?void 0:e.animationName)||"none"}function r$(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 Sh=0;function s$(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??qw()),document.body.insertAdjacentElement("beforeend",e[1]??qw()),Sh++,()=>{Sh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Sh--}},[])}function qw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var bs=function(){return bs=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},bs.apply(this,arguments)};function U1(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 o$(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 $d="right-scroll-bar-position",Ld="width-before-scroll-bar",a$="with-scroll-bars-hidden",i$="--removed-body-scroll-bar-size";function Nh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function l$(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 c$=typeof window<"u"?f.useLayoutEffect:f.useEffect,Gw=new WeakMap;function u$(e,t){var n=l$(null,function(s){return e.forEach(function(o){return Nh(o,s)})});return c$(function(){var s=Gw.get(n);if(s){var o=new Set(s),i=new Set(e),c=n.current;o.forEach(function(u){i.has(u)||Nh(u,null)}),i.forEach(function(u){o.has(u)||Nh(u,c)})}Gw.set(n,e)},[e]),n}function d$(e){return e}function f$(e,t){t===void 0&&(t=d$);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var c=t(i,s);return n.push(c),function(){n=n.filter(function(u){return u!==c})}},assignSyncMedium:function(i){for(s=!0;n.length;){var c=n;n=[],c.forEach(i)}n={push:function(u){return i(u)},filter:function(){return n}}},assignMedium:function(i){s=!0;var c=[];if(n.length){var u=n;n=[],u.forEach(i),c=n}var d=function(){var h=c;c=[],h.forEach(i)},m=function(){return Promise.resolve().then(d)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return o}function p$(e){e===void 0&&(e={});var t=f$(null);return t.options=bs({async:!0,ssr:!1},e),t}var W1=function(e){var t=e.sideCar,n=U1(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,bs({},n))};W1.isSideCarExport=!0;function m$(e,t){return e.useMedium(t),W1}var V1=p$(),Ch=function(){},Uf=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Ch,onWheelCapture:Ch,onTouchMoveCapture:Ch}),o=s[0],i=s[1],c=e.forwardProps,u=e.children,d=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,N=e.noIsolation,w=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,S=e.gapMode,T=U1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=y,R=u$([n,t]),A=bs(bs({},T),o);return f.createElement(f.Fragment,null,h&&f.createElement(P,{sideCar:V1,removeScrollBar:m,shards:g,noRelative:b,noIsolation:N,inert:w,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:S}),c?f.cloneElement(f.Children.only(u),bs(bs({},A),{ref:R})):f.createElement(E,bs({},A,{className:d,ref:R}),u))});Uf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uf.classNames={fullWidth:Ld,zeroRight:$d};var h$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function g$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=h$();return t&&e.setAttribute("nonce",t),e}function x$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function y$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var b$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=g$())&&(x$(t,n),y$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},v$=function(){var e=b$();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},H1=function(){var e=v$(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},w$={left:0,top:0,right:0,gap:0},Eh=function(e){return parseInt(e||"",10)||0},j$=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[Eh(n),Eh(s),Eh(o)]},k$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return w$;var t=j$(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])}},S$=H1(),wi="data-scroll-locked",N$=function(e,t,n,s){var o=e.left,i=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
517
- .`.concat(a$,` {
518
- overflow: hidden `).concat(s,`;
519
- padding-right: `).concat(u,"px ").concat(s,`;
520
- }
521
- body[`).concat(wi,`] {
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(c,`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($d,` {
535
- right: `).concat(u,"px ").concat(s,`;
536
- }
537
-
538
- .`).concat(Ld,` {
539
- margin-right: `).concat(u,"px ").concat(s,`;
540
- }
541
-
542
- .`).concat($d," .").concat($d,` {
543
- right: 0 `).concat(s,`;
544
- }
545
-
546
- .`).concat(Ld," .").concat(Ld,` {
547
- margin-right: 0 `).concat(s,`;
548
- }
549
-
550
- body[`).concat(wi,`] {
551
- `).concat(i$,": ").concat(u,`px;
552
- }
553
- `)},Yw=function(){var e=parseInt(document.body.getAttribute(wi)||"0",10);return isFinite(e)?e:0},C$=function(){f.useEffect(function(){return document.body.setAttribute(wi,(Yw()+1).toString()),function(){var e=Yw()-1;e<=0?document.body.removeAttribute(wi):document.body.setAttribute(wi,e.toString())}},[])},E$=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;C$();var i=f.useMemo(function(){return k$(o)},[o]);return f.createElement(S$,{styles:N$(i,!t,o,n?"":"!important")})},Cg=!1;if(typeof window<"u")try{var cd=Object.defineProperty({},"passive",{get:function(){return Cg=!0,!0}});window.addEventListener("test",cd,cd),window.removeEventListener("test",cd,cd)}catch{Cg=!1}var Xa=Cg?{passive:!1}:!1,T$=function(e){return e.tagName==="TEXTAREA"},K1=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!T$(e)&&n[t]==="visible")},R$=function(e){return K1(e,"overflowY")},A$=function(e){return K1(e,"overflowX")},Jw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=q1(e,s);if(o){var i=G1(e,s),c=i[1],u=i[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},P$=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},D$=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},q1=function(e,t){return e==="v"?R$(t):A$(t)},G1=function(e,t){return e==="v"?P$(t):D$(t)},$$=function(e,t){return e==="h"&&t==="rtl"?-1:1},L$=function(e,t,n,s,o){var i=$$(e,window.getComputedStyle(t).direction),c=i*s,u=n.target,d=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=G1(e,u),N=b[0],w=b[1],v=b[2],k=w-v-i*N;(N||k)&&q1(e,u)&&(g+=k,y+=N);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},ud=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qw=function(e){return[e.deltaX,e.deltaY]},Xw=function(e){return e&&"current"in e?e.current:e},I$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},O$=function(e){return`
554
- .block-interactivity-`.concat(e,` {pointer-events: none;}
555
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
556
- `)},_$=0,Za=[];function M$(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),o=f.useState(_$++)[0],i=f.useState(H1)[0],c=f.useRef(e);f.useEffect(function(){c.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var w=o$([e.lockRef.current],(e.shards||[]).map(Xw),!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!c.current.allowPinchZoom;var k=ud(w),E=n.current,S="deltaX"in w?w.deltaX:E[0]-k[0],T="deltaY"in w?w.deltaY:E[1]-k[1],P,R=w.target,A=Math.abs(S)>Math.abs(T)?"h":"v";if("touches"in w&&A==="h"&&R.type==="range")return!1;var L=window.getSelection(),M=L&&L.anchorNode,F=M?M===R||M.contains(R):!1;if(F)return!1;var D=Jw(A,R);if(!D)return!0;if(D?P=A:(P=A==="v"?"h":"v",D=Jw(A,R)),!D)return!1;if(!s.current&&"changedTouches"in w&&(S||T)&&(s.current=P),!P)return!0;var V=s.current||P;return L$(V,v,w,V==="h"?S:T)},[]),d=f.useCallback(function(w){var v=w;if(!(!Za.length||Za[Za.length-1]!==i)){var k="deltaY"in v?Qw(v):ud(v),E=t.current.filter(function(P){return P.name===v.type&&(P.target===v.target||v.target===P.shadowParent)&&I$(P.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var S=(c.current.shards||[]).map(Xw).filter(Boolean).filter(function(P){return P.contains(v.target)}),T=S.length>0?u(v,S[0]):!c.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:F$(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=ud(w),s.current=void 0},[]),g=f.useCallback(function(w){m(w.type,Qw(w),w.target,u(w,e.lockRef.current))},[]),y=f.useCallback(function(w){m(w.type,ud(w),w.target,u(w,e.lockRef.current))},[]);f.useEffect(function(){return Za.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",d,Xa),document.addEventListener("touchmove",d,Xa),document.addEventListener("touchstart",h,Xa),function(){Za=Za.filter(function(w){return w!==i}),document.removeEventListener("wheel",d,Xa),document.removeEventListener("touchmove",d,Xa),document.removeEventListener("touchstart",h,Xa)}},[]);var b=e.removeScrollBar,N=e.inert;return f.createElement(f.Fragment,null,N?f.createElement(i,{styles:O$(o)}):null,b?f.createElement(E$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function F$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const z$=m$(V1,M$);var Y1=f.forwardRef(function(e,t){return f.createElement(Uf,bs({},e,{ref:t,sideCar:z$}))});Y1.classNames=Uf.classNames;var B$=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ei=new WeakMap,dd=new WeakMap,fd={},Th=0,J1=function(e){return e&&(e.host||J1(e.parentNode))},U$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=J1(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})},W$=function(e,t,n,s){var o=U$(t,Array.isArray(e)?e:[e]);fd[n]||(fd[n]=new WeakMap);var i=fd[n],c=[],u=new Set,d=new Set(o),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};o.forEach(m);var h=function(g){!g||d.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),N=b!==null&&b!=="false",w=(ei.get(y)||0)+1,v=(i.get(y)||0)+1;ei.set(y,w),i.set(y,v),c.push(y),w===1&&N&&dd.set(y,!0),v===1&&y.setAttribute(n,"true"),N||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),Th++,function(){c.forEach(function(g){var y=ei.get(g)-1,b=i.get(g)-1;ei.set(g,y),i.set(g,b),y||(dd.has(g)||g.removeAttribute(s),dd.delete(g)),b||g.removeAttribute(n)}),Th--,Th||(ei=new WeakMap,ei=new WeakMap,dd=new WeakMap,fd={})}},V$=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=B$(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),W$(s,o,n,"aria-hidden")):function(){return null}};function H$(e){const t=K$(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(G$);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,{...c,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function K$(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=J$(o),u=Y$(i,o.props);return o.type!==f.Fragment&&(u.ref=s?zf(s,c):c),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var q$=Symbol("radix.slottable");function G$(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===q$}function Y$(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...u)=>{const d=i(...u);return o(...u),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function J$(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 Wf="Dialog",[Q1,X1]=ha(Wf),[Q$,cs]=Q1(Wf),Z1=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,u=f.useRef(null),d=f.useRef(null),[m,h]=Bf({prop:s,defaultProp:o??!1,onChange:i,caller:Wf});return r.jsx(Q$,{scope:t,triggerRef:u,contentRef:d,contentId:vi(),titleId:vi(),descriptionId:vi(),open:m,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};Z1.displayName=Wf;var eS="DialogTrigger",tS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(eS,n),i=Kn(t,o.triggerRef);return r.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_x(o.open),...s,ref:i,onClick:Qt(e.onClick,o.onOpenToggle)})});tS.displayName=eS;var Ix="DialogPortal",[X$,nS]=Q1(Ix,{forceMount:void 0}),rS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=cs(Ix,t);return r.jsx(X$,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(ga,{present:n||i.open,children:r.jsx(Lx,{asChild:!0,container:o,children:c})}))})};rS.displayName=Ix;var Qd="DialogOverlay",sS=f.forwardRef((e,t)=>{const n=nS(Qd,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=cs(Qd,e.__scopeDialog);return i.modal?r.jsx(ga,{present:s||i.open,children:r.jsx(e4,{...o,ref:t})}):null});sS.displayName=Qd;var Z$=H$("DialogOverlay.RemoveScroll"),e4=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(Qd,n);return r.jsx(Y1,{as:Z$,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(vn.div,{"data-state":_x(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),fa="DialogContent",oS=f.forwardRef((e,t)=>{const n=nS(fa,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=cs(fa,e.__scopeDialog);return r.jsx(ga,{present:s||i.open,children:i.modal?r.jsx(t4,{...o,ref:t}):r.jsx(n4,{...o,ref:t})})});oS.displayName=fa;var t4=f.forwardRef((e,t)=>{const n=cs(fa,e.__scopeDialog),s=f.useRef(null),o=Kn(t,n.contentRef,s);return f.useEffect(()=>{const i=s.current;if(i)return V$(i)},[]),r.jsx(aS,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Qt(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Qt(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&i.preventDefault()}),onFocusOutside:Qt(e.onFocusOutside,i=>i.preventDefault())})}),n4=f.forwardRef((e,t)=>{const n=cs(fa,e.__scopeDialog),s=f.useRef(!1),o=f.useRef(!1);return r.jsx(aS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var c,u;(c=e.onCloseAutoFocus)==null||c.call(e,i),i.defaultPrevented||(s.current||(u=n.triggerRef.current)==null||u.focus(),i.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:i=>{var d,m;(d=e.onInteractOutside)==null||d.call(e,i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=i.target;((m=n.triggerRef.current)==null?void 0:m.contains(c))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),aS=f.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=e,u=cs(fa,n),d=f.useRef(null),m=Kn(t,d);return s$(),r.jsxs(r.Fragment,{children:[r.jsx(z1,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx($x,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":_x(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(s4,{titleId:u.titleId}),r.jsx(a4,{contentRef:d,descriptionId:u.descriptionId})]})]})}),Ox="DialogTitle",iS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(Ox,n);return r.jsx(vn.h2,{id:o.titleId,...s,ref:t})});iS.displayName=Ox;var lS="DialogDescription",cS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(lS,n);return r.jsx(vn.p,{id:o.descriptionId,...s,ref:t})});cS.displayName=lS;var uS="DialogClose",dS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(uS,n);return r.jsx(vn.button,{type:"button",...s,ref:t,onClick:Qt(e.onClick,()=>o.onOpenChange(!1))})});dS.displayName=uS;function _x(e){return e?"open":"closed"}var fS="DialogTitleWarning",[r4,pS]=SD(fS,{contentName:fa,titleName:Ox,docsSlug:"dialog"}),s4=({titleId:e})=>{const t=pS(fS),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},o4="DialogDescriptionWarning",a4=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pS(o4).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},mS=Z1,hS=tS,gS=rS,Mx=sS,Fx=oS,zx=iS,Bx=cS,Ux=dS;const $n=mS,i4=hS,l4=gS,c4=Ux,xS=f.forwardRef(({className:e,...t},n)=>r.jsx(Mx,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));xS.displayName=Mx.displayName;const En=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(l4,{children:[r.jsx(xS,{}),r.jsx(Fx,{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=Fx.displayName;function Zn({className:e,...t}){return r.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function Ar({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(zx,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));Tn.displayName=zx.displayName;const Vr=f.forwardRef(({className:e,...t},n)=>r.jsx(Bx,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));Vr.displayName=Bx.displayName;const u4=-1,d4=-40;function Rh(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,s=0,o=-2,i=0;for(let c=0;c<e.length;c++){const u=e[c];let d=!1;for(;s<t.length;)if(t[s]===u){if(n+=100,s===o+1&&(n+=20),s===0)n+=30;else{const m=t[s-1];(m===" "||m==="-"||m==="_"||m==="/")&&(n+=15)}i>0&&(n+=Math.max(d4,i*u4)),o=s,i=0,s++,d=!0;break}else i++,s++;if(!d)return-1/0}return n}const Zw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Wx(e,t,n=50){const s=e.toLowerCase();if(!s)return t.slice(0,n).map(c=>({...c,score:0}));const i=t.map(c=>{var g;const u=Rh(s,c.title.toLowerCase())*1,d=c.subtitle?Rh(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?Rh(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,d,m);return{...c,score:h}}).filter(c=>c.score>-1/0);return i.sort((c,u)=>u.score!==c.score?u.score-c.score:c.title.length!==u.title.length?c.title.length-u.title.length:c.title!==u.title?c.title<u.title?-1:1:(Zw[c.type]??99)-(Zw[u.type]??99)),i.slice(0,n)}const Eg={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},ej=Symbol("absent");function pd(e){return e.replace(/\s+/g," ").trim()}const tj=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function f4(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function p4(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 Xd={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:ej},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:ej},externalid:{kind:"substring",get:f4},jira:{kind:"substring",get:p4},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function m4(e){let t;try{t=_1(e)}catch(h){if(h instanceof ra)return{aqlExpr:"",fuzzy:pd(e)};throw h}const n=t.length,s=(h,g)=>e.slice(t[h].pos,g<n?t[g].pos:e.length);let o=!1;for(let h=0;h<n;h++){const g=t[h];if(g.type==="OR"||g.type==="LPAREN"&&(h===0||t[h-1].type!=="COLON")){o=!0;break}}if(o){const h=pd(x4(e,t,n));return Di(h,Xd).query?{aqlExpr:h,fuzzy:""}:{aqlExpr:"",fuzzy:pd(e)}}const i=[],c=[];let u=0,d=0;const m=h=>{if(h>d){const g=pd(s(d,h));g&&c.push(g)}};for(;u<n-1;){const h=h4(t,u);if(h){m(u),i.push(h.atom),u=h.end,d=u;continue}const g=g4(t,u,n);if(g!==null){const y=s(u,g).trim();if(Di(y,Xd).query){m(u),i.push(y),u=g,d=u;continue}u=g;continue}u++}return m(n-1),{aqlExpr:i.join(" "),fuzzy:c.join(" ")}}function h4(e,t){var c;let n=t,s="";e[n].type==="MINUS"?(s="-",n++):e[n].type==="NOT"&&(s="NOT ",n++);const o=e[n];if(!o||o.type!=="IDENT")return null;const i=Eg[o.text.toLowerCase()];return!i||((c=e[n+1])==null?void 0:c.type)!=="COLON"?null:{atom:`${s}kind:${i}`,end:n+2}}function g4(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(Xd,o.text.toLowerCase()))return null;const i=e[s+1];if(!i)return null;if(i.type==="COLON"){const c=e[s+2];if(!c)return null;if(c.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 tj.has(c.type)?s+3:null}if(i.type==="OP"){const c=e[s+2];return c&&tj.has(c.type)?s+3:null}return null}function x4(e,t,n){var i;let s="",o=0;for(let c=0;c<n;c++){const u=t[c];u.type==="IDENT"&&Object.prototype.hasOwnProperty.call(Eg,u.text.toLowerCase())&&((i=t[c+1])==null?void 0:i.type)==="COLON"&&(s+=e.slice(o,u.pos)+`kind:${Eg[u.text.toLowerCase()]} `,o=t[c+1].pos+1)}return s+=e.slice(o),s}const y4={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function b4({entries:e}){const{paletteOpen:t,closePalette:n}=To(),s=_t(),[o,i]=f.useState(""),[c,u]=f.useState(0),d=f.useRef(null),{aqlExpr:m,fuzzy:h}=f.useMemo(()=>m4(o),[o]),g=f.useMemo(()=>{let N=e,w=h;if(m){const v=Di(m,Xd);if(v.query){const k=Date.now(),{predicate:E}=v.query;N=e.filter(S=>E(S,{now:k}))}else w=o}return Wx(w,N,50)},[e,m,h,o]);f.useEffect(()=>{u(0)},[o,t]),f.useEffect(()=>{t||i("")},[t]),f.useEffect(()=>{var w;const N=(w=d.current)==null?void 0:w.querySelector(`[data-palette-idx="${c}"]`);N==null||N.scrollIntoView({block:"nearest"})},[c]);function y(N){s(N.route),n()}function b(N){if(N.key==="ArrowDown")N.preventDefault(),u(w=>Math.min(g.length-1,w+1));else if(N.key==="ArrowUp")N.preventDefault(),u(w=>Math.max(0,w-1));else if(N.key==="Enter"){N.preventDefault();const w=g[c];w&&y(w)}}return r.jsx($n,{open:t,onOpenChange:N=>N?null:n(),children:r.jsxs(En,{className:"max-w-xl p-0 gap-0",children:[r.jsx(Tn,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:o,onChange:N=>i(N.target.value),onKeyDown:b,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"}),m?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:m}),h?r.jsxs("span",{children:[" · ranking “",h,"”"]}):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"})," ",r.jsx("code",{children:"a:"})," ",r.jsx("code",{children:"p:"})," ",r.jsx("code",{children:"t:"})," ",r.jsx("code",{children:"s:"})," ",r.jsx("code",{children:"pb:"})," · ",r.jsx("code",{children:"status:"})," ",r.jsx("code",{children:"tag:"})," ",r.jsx("code",{children:"assignee:"})," ",r.jsx("code",{children:"type:"})," ",r.jsx("code",{children:"jira:"})]}):null,r.jsx("div",{ref:d,className:"max-h-[60vh] overflow-y-auto p-1",children:g.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):g.map((N,w)=>{const v=w===c;return r.jsxs("button",{type:"button","data-palette-idx":w,onClick:()=>y(N),onMouseEnter:()=>u(w),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${v?"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:y4[N.type]??N.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:N.title}),N.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:N.subtitle}):null]},N.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," open ","·"," Esc close"]}),r.jsxs("span",{children:[g.length," result",g.length===1?"":"s"]})]})]})})}function v4({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 w4({step:e,initialValue:t,disabled:n,onSubmit:s}){const[o,i]=f.useState(t??""),[c,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{var N;(N=d.current)==null||N.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(N){if(N.key==="Enter"){if(N.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:d,type:"text",value:o,onChange:N=>{i(N.target.value),u(!1)},onKeyDown:b,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),c&&e.pattern&&g?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function j4({step:e,disabled:t,onSubmit:n}){const[s,o]=f.useState({phase:"loading"}),[i,c]=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 Wx(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 N(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=>c(w.target.value),onKeyDown:N,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 k4({entries:e}){var ae,ue;const t=_t(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:o,bindAction:i,findConflict:c,pendingActionKind:u,consumePendingActionKind:d}=To(),[m,h]=f.useState(""),[g,y]=f.useState(0),[b,N]=f.useState(null),[w,v]=f.useState(""),[k,E]=f.useState(null),[S,T]=f.useState(null),[P,R]=f.useState(!1),[A,L]=f.useState(null),M=f.useRef(null),F=f.useMemo(()=>e.map(se=>({type:se.group.toLowerCase(),title:se.title,subtitle:se.subtitle,keywords:se.keywords,action:se})),[e]),D=f.useMemo(()=>Wx(m,F,50),[m,F]);f.useEffect(()=>{y(0)},[m,n]),f.useEffect(()=>{n||(h(""),N(null),v(""),E(null),T(null),R(!1),L(null))},[n]),f.useEffect(()=>{if(!n||!u)return;const se=d();if(!se)return;const xe=e.find(ke=>ke.bindableKind===se);xe&&V(xe)},[n,u]),f.useEffect(()=>{var xe;const se=(xe=M.current)==null?void 0:xe.querySelector(`[data-palette-idx="${g}"]`);se==null||se.scrollIntoView({block:"nearest"})},[g]);async function V(se){if(!P){if(se.flow&&se.flow.steps.length>0){E({action:se,stepIndex:0,values:{}}),L(null);return}if(se.requiresInput){N(se),v(""),L(null);return}if(se.run){R(!0),L(null);try{await se.run(),s()}catch(xe){L(xe instanceof Error?xe.message:"Action failed")}finally{R(!1)}}}}async function Y(se){if(!k)return;const xe=k.action.flow.steps[k.stepIndex],ke={...k.values,[xe.id]:se};if(k.stepIndex+1<k.action.flow.steps.length){E({action:k.action,stepIndex:k.stepIndex+1,values:ke});return}R(!0),L(null);try{await k.action.flow.submit(ke,{navigate:t}),s()}catch(Re){L(Re instanceof Error?Re.message:"Action failed")}finally{R(!1)}}function _(){if(k&&!P){if(k.stepIndex===0){E(null),L(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),L(null)}}async function z(){if(P||!(b!=null&&b.requiresInput))return;const se=w.trim();if(se){R(!0),L(null);try{await b.requiresInput.runWithInput(se),s()}catch(xe){L(xe instanceof Error?xe.message:"Action failed")}finally{R(!1)}}}function H(se){if(se.key==="ArrowDown")se.preventDefault(),y(xe=>Math.min(D.length-1,xe+1));else if(se.key==="ArrowUp")se.preventDefault(),y(xe=>Math.max(0,xe-1));else if(se.key==="Enter"&&(se.metaKey||se.ctrlKey)){se.preventDefault();const xe=D[g];xe!=null&&xe.action.bindableKind&&T({action:xe.action,combo:null,conflict:null,saving:!1,error:null})}else if(se.key==="Enter"){se.preventDefault();const xe=D[g];xe&&V(xe.action)}}function q(se){se.key==="Enter"?(se.preventDefault(),z()):se.key==="Escape"&&(se.preventDefault(),N(null),v(""))}function I(se){if(!S||se.key==="Escape"||se.key==="Enter"&&!S.combo)return;se.preventDefault(),se.stopPropagation();const xe=C1(se.nativeEvent);if(!xe)return;const ke=c(xe,S.action.bindableKind);T({...S,combo:xe,conflict:ke,error:null})}async function K(){var se;if(!(!S||!S.combo||!S.action.bindableKind)){if((se=S.conflict)!=null&&se.description){T({...S,error:`Reserved: ${S.conflict.description}`});return}T({...S,saving:!0,error:null});try{await i(S.action.bindableKind,S.combo),T(null)}catch(xe){T({...S,saving:!1,error:xe instanceof Error?xe.message:"Failed to save binding"})}}}const $=b!==null,W=k!==null,ee=S!==null,B=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx($n,{open:n,onOpenChange:se=>se?null:s(),children:r.jsxs(En,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:se=>{if(!P){if(ee){se.preventDefault(),T(null);return}if(W){se.preventDefault(),_();return}$&&(se.preventDefault(),N(null),v(""),L(null))}},children:[r.jsx(Tn,{className:"sr-only",children:"Actions palette"}),ee&&S?r.jsxs("div",{onKeyDown:I,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(bg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",S.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:S.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:ks(S.combo)}),(ae=S.conflict)!=null&&ae.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 K(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:se=>{se.key==="Enter"&&K()}})]}):W&&B&&k?r.jsxs(r.Fragment,{children:[r.jsx(v4,{label:`${k.action.title} · ${B.label}`,onBack:_,disabled:P,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),B.kind==="text"?r.jsx(w4,{step:B,initialValue:k.values[B.id],disabled:P,onSubmit:Y}):r.jsx(j4,{step:B,disabled:P,onSubmit:Y}),A?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):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:P?"Running…":""})]})]}):$?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:se=>v(se.target.value),onKeyDown:q,placeholder:b.requiresInput.placeholder,disabled:P,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"}),A?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):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:P?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:se=>h(se.target.value),onKeyDown:H,placeholder:"Run an action: new project, new todo, toggle…",disabled:P,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"}),A?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:A}):null,r.jsx("div",{ref:M,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:m?"No matches":"Start typing to search actions"}):D.map((se,xe)=>{const ke=xe===g,Re=se.action.bindableKind,Ae=Re?o[Re]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":xe,onClick:()=>V(se.action),onMouseEnter:()=>y(xe),disabled:P,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:se.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:se.action.title}),se.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:se.action.subtitle}):null,Ae?r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium tracking-wide text-foreground",children:ks(Ae)}):null,Re?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Qe=>{Qe.preventDefault(),Qe.stopPropagation(),T({action:se.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${ke?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(bg,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},se.action.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),r.jsx("span",{children:P?"Running…":`${D.length} action${D.length===1?"":"s"}`})]})]})]})})}const S4=[{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 N4(e){const t=dr(e);return t?S4.find(n=>n.combo===t)??null:null}const Bl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},C4={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},E4=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function nj(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${ks(t)} then ${ks(n)}`}return ks(e)}function T4(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:o}=To(),i=f.useMemo(()=>{const d=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&d.add(dr(m));return d},[s]),c=f.useMemo(()=>{if(!e)return new Map;const d=n(),m=new Map;for(const h of d){if(i.has(dr(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,i]),u=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($n,{open:e,onOpenChange:d=>d?null:t(),children:r.jsxs(En,{className:"max-w-2xl",children:[r.jsx(Tn,{children:"Keyboard shortcuts"}),r.jsxs(Vr,{children:["Press Esc to close. ",ks("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),r.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[E4.map(d=>{const m=c.get(d);return!m||m.length===0?null:r.jsxs("section",{children:[r.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:C4[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:nj(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:nj(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const Vx={bindings:{},custom:!1};let rc=null,ti=null;const Tg=new Set;function yS(e){rc=e;for(const t of Tg)t(e)}function Hx(e){if(!e||typeof e!="object")return Vx;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(!Y3(s)||typeof o!="string"||o.trim()==="")continue;const i=dr(o);i&&(n[s]=i)}return{bindings:n,custom:t.custom===!0}}function R4(){return rc?Promise.resolve(rc):ti||(ti=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Hx(e);return rc=t,ti=null,t}).catch(()=>(ti=null,Vx)),ti)}function A4(){const[e,t]=f.useState(()=>rc??Vx);return f.useEffect(()=>{let n=!1;return R4().then(s=>{n||t(s)}),Tg.add(t),()=>{n=!0,Tg.delete(t)}},[]),e}async function rj(e){const t={};for(const o of _f){const i=e[o];if(typeof i!="string")continue;const c=dr(i);c&&(t[o]=c)}const n=await fetch("/api/config/hotkeys",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({bindings:t})});if(!n.ok){const o=await n.json().catch(()=>({error:`HTTP ${n.status}`}));throw new Error(o.error??"Failed to save hotkey bindings")}const s=Hx(await n.json());return yS(s),s}async function P4(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Hx(await e.json());return yS(t),t}const sj=1500;function D4(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const bS=f.createContext(null);function $4({children:e}){const{toggleTheme:t}=Ex(),n=Xn(),s=_t(),o=D4(n.pathname),[i,c]=f.useState(!1),u=Cs(i),d=If(i),m=Rx(i),h=Tx(i),g=E1(i),y=f.useMemo(()=>{var et,Je,$t,vt;const Z=u.data??[],_e=((et=d.data)==null?void 0:et.assignments)??[],Ee=((Je=m.data)==null?void 0:Je.playbooks)??[],Ie=(($t=h.data)==null?void 0:$t.sessions)??[],Me=(((vt=g.data)==null?void 0:vt.workspaces)??[]).flatMap(ct=>ct.items.map(le=>({...le,workspace:ct.workspace})));return lD({projects:Z,assignments:_e,playbooks:Ee,servers:Ie,todos:Me,wsPrefix:o})},[u.data,d.data,m.data,h.data,g.data,o]),N=f.useMemo(()=>c1(n.pathname),[n.pathname]).projectSlug,w=f.useMemo(()=>{var Z;return N?((Z=u.data)==null?void 0:Z.find(_e=>_e.slug===N))??null:null},[u.data,N]),v=(w==null?void 0:w.title)??null,k=(w==null?void 0:w.workspace)??null,E=f.useMemo(()=>{var Z;return dD({playbooks:((Z=m.data)==null?void 0:Z.playbooks)??[],projectSlug:N,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:o,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,N,v,k,o,s,t]),S=f.useRef(new Map),T=f.useRef(["global"]),P=f.useRef({phase:"idle"}),R=f.useRef(null),A=f.useRef(1),[L,M]=f.useState(!1),[F,D]=f.useState(!1),[V,Y]=f.useState(!1),[_,z]=f.useState(null);f.useEffect(()=>{(L||V)&&c(!0)},[L,V]);const{bindings:H}=A4(),q=f.useMemo(()=>eD(H),[H]),I=f.useCallback(Z=>{const _e=A.current++;return S.current.set(_e,{...Z,id:_e}),_e},[]),K=f.useCallback(Z=>{S.current.delete(Z)},[]),$=f.useCallback(Z=>{T.current.push(Z)},[]),W=f.useCallback(Z=>{const _e=T.current;for(let Ee=_e.length-1;Ee>=0;Ee--)if(_e[Ee]===Z){_e.splice(Ee,1);return}},[]),ee=f.useCallback(()=>M(!0),[]),B=f.useCallback(()=>M(!1),[]),ae=f.useCallback(()=>D(!0),[]),ue=f.useCallback(()=>D(!1),[]),se=f.useCallback(()=>Y(!0),[]),xe=f.useCallback(()=>{Y(!1),z(null)},[]),ke=f.useCallback(()=>Array.from(S.current.values()),[]),Re=f.useCallback(()=>{let Z=null;return z(_e=>(Z=_e,null)),Z},[]),Ae=f.useCallback(Z=>{z(Z),Y(!0)},[]),Qe=f.useCallback((Z,_e)=>{const Ee=dr(Z);if(!Ee)return null;if(X3(Ee)){const Ie=N4(Ee);return{description:(Ie==null?void 0:Ie.description)??"Reserved built-in shortcut"}}for(const[Ie,Ye]of Object.entries(q))if(!(_e&&Ie===_e)&&Ye===Ee)return{kind:Ie};return null},[q]),at=f.useCallback(async(Z,_e)=>{const Ee=dr(_e);if(!Ee)throw new Error("Empty combo");const Ie=Qe(Ee,Z);if(Ie){const Me=Ie.description?`Reserved: ${Ie.description}`:`Already bound to "${Ie.kind}"`;throw new Error(Me)}const Ye={...H,[Z]:Ee};return await rj(Ye),Ee},[H,Qe]),Ze=f.useCallback(async Z=>{if(!H[Z])return;const _e={...H};delete _e[Z],await rj(_e)},[H]);f.useEffect(()=>{P.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),f.useEffect(()=>{function Z(Me){if(!(Me instanceof HTMLElement))return!1;const et=Me.tagName;return!!(et==="INPUT"||et==="TEXTAREA"||et==="SELECT"||Me.isContentEditable||Me.closest('[role="combobox"], [role="textbox"]'))}function _e(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Ee(){const Me=T.current;return Me[Me.length-1]??"global"}function Ie(Me){return Me.scope==="global"?!0:Me.scope===Ee()}function Ye(Me){const et=id(Me,"Mod+k"),Je=id(Me,"Mod+Shift+k"),$t=Me.key==="Escape",vt=et||Je||$t;if(_e()&&!vt||Z(Me.target)&&!vt)return;const ct=P.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>sj)P.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const he=Array.from(S.current.values());for(const re of he){if(!Ie(re))continue;const ye=re.keys.split(" ");if(!(ye.length!==2||ye[0]!=="g")&&id(Me,ye[1])&&!(re.when&&!re.when())){Me.preventDefault(),P.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),re.handler(Me);return}}P.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(S.current.values());for(const J of le){if(!Ie(J))continue;const he=J.keys.split(" ");if(he.length===1&&id(Me,he[0])&&!(J.when&&!J.when())){Me.preventDefault(),J.handler(Me);return}}Me.key==="g"&&!Me.metaKey&&!Me.ctrlKey&&!Me.altKey&&!Me.shiftKey&&Array.from(S.current.values()).some(he=>Ie(he)&&he.keys.startsWith("g "))&&(Me.preventDefault(),P.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{P.current={phase:"idle"},R.current=null},sj))}return window.addEventListener("keydown",Ye),()=>{window.removeEventListener("keydown",Ye),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),f.useEffect(()=>{const Z=I({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>K(Z)},[I,K,t]),f.useEffect(()=>{const Z=I({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ae()});return()=>K(Z)},[I,K,ae]),f.useEffect(()=>{const Z=I({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(L){B();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ee()}});return()=>K(Z)},[I,K,ee,B,L]),f.useEffect(()=>{const Z=I({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(V){xe();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||se()}});return()=>K(Z)},[I,K,se,xe,V]),f.useEffect(()=>{const _e=[{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(Ee=>I({keys:`g ${Ee.suffix}`,scope:"global",description:Ee.desc,handler:()=>s(Ad(Ee.basePath,o))}));return()=>_e.forEach(K)},[I,K,s,o]),f.useEffect(()=>{const Z=[];for(const[_e,Ee]of Object.entries(q)){if(!Ee)continue;const Ie=E.find(Me=>Me.bindableKind===_e),Ye=Ie?`Custom: ${Ie.title}`:`Custom: ${_e}`;Z.push(I({keys:Ee,scope:"global",description:Ye,handler:()=>{z(_e),Y(!0)}}))}return()=>Z.forEach(K)},[I,K,q,E]);const ot=f.useMemo(()=>({register:I,unregister:K,pushScope:$,popScope:W,openPalette:ee,closePalette:B,paletteOpen:L,openCheatsheet:ae,closeCheatsheet:ue,cheatsheetOpen:F,openActionsPalette:se,closeActionsPalette:xe,actionsPaletteOpen:V,listBindings:ke,wsPrefix:o,paletteEntries:y,actionEntries:E,userBindings:H,customBindings:q,bindAction:at,unbindAction:Ze,findConflict:Qe,openActionsPaletteWithAction:Ae,pendingActionKind:_,consumePendingActionKind:Re}),[I,K,$,W,ee,B,L,ae,ue,F,se,xe,V,ke,o,y,E,H,q,at,Ze,Qe,Ae,_,Re]);return r.jsxs(bS.Provider,{value:ot,children:[e,r.jsx(b4,{entries:y}),r.jsx(k4,{entries:E}),r.jsx(T4,{})]})}function To(){const e=f.useContext(bS);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:c,unregister:u}=To(),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=c({keys:e,handler:g=>d.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,i])}function Ro(e){const{pushScope:t,popScope:n}=To();f.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Oc(e,t){const[n,s]=f.useState(e.length===0?-1:0),o=Xn();f.useEffect(()=>{s(e.length===0?-1:0)},[o.pathname]),f.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),f.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const 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(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Kt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-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(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function L4({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const o=un(),{resolvedTheme:i,toggleTheme:c}=Ex(),{openPalette:u}=To();return r.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border/70 bg-card/80 text-foreground lg:hidden","aria-label":"Open navigation",children:r.jsx(NP,{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(Ce,{to:d.path,className:"hover:text-foreground",children:d.label})]},d.path)),r.jsx("span",{children:"/"})]}):null,r.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:u,className:"shell-action","aria-label":"Open command palette",children:[r.jsx(Eo,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:ks("Mod+k")})]}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Ce,{className:"shell-action",to:`${o}/create/project`,children:[r.jsx(Ct,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Ce,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[r.jsx(Ct,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}):null,r.jsxs("button",{type:"button",onClick:c,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?r.jsx(OP,{className:"h-4 w-4"}):r.jsx(CP,{className:"h-4 w-4"}),r.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const Zd="_ungrouped",I4=256;function O4(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>I4||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function _4(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function M4(e,t){return t.includes(e)}const Kx={hidden:[],custom:!1};let zs=null,Xo=null,xc=0;const Rg=new Set;function vS(e){zs=e;for(const t of Rg)t(e)}function qx(e){if(!e||typeof e!="object")return Kx;const t=e;return{hidden:O4(t.hidden),custom:t.custom===!0}}function F4(){if(zs)return Promise.resolve({value:zs,ok:!0});if(Xo)return Xo;const e=++xc;return Xo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Xo=null;const n=qx(t);return e!==xc?{value:zs??n,ok:!0}:(zs=n,{value:n,ok:!0})}).catch(()=>(Xo=null,{value:Kx,ok:!1})),Xo}function wS(){const[e,t]=f.useState(()=>zs??Kx),[n,s]=f.useState(()=>zs===null),[o,i]=f.useState(!1),[c,u]=f.useState(0);f.useEffect(()=>{let m=!1;return s(zs===null),F4().then(h=>{m||(t(h.value),s(!1),i(!h.ok))}),Rg.add(t),()=>{m=!0,Rg.delete(t)}},[c]);function d(){z4(),u(m=>m+1)}return{...e,loading:n,error:o,reload:d}}function z4(){zs=null,Xo=null,++xc}async function B4(e){++xc;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=qx(await t.json());return vS(n),n}async function U4(){++xc;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=qx(await e.json());return vS(t),t}var W4=Symbol("radix.slottable");function V4(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=W4,t}var jS="AlertDialog",[H4]=ha(jS,[X1]),Hs=X1(),kS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(mS,{...s,...n,modal:!0})};kS.displayName=jS;var K4="AlertDialogTrigger",q4=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(hS,{...o,...s,ref:t})});q4.displayName=K4;var G4="AlertDialogPortal",SS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(gS,{...s,...n})};SS.displayName=G4;var Y4="AlertDialogOverlay",NS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(Mx,{...o,...s,ref:t})});NS.displayName=Y4;var ji="AlertDialogContent",[J4,Q4]=H4(ji),X4=V4("AlertDialogContent"),CS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,i=Hs(n),c=f.useRef(null),u=Kn(t,c),d=f.useRef(null);return r.jsx(r4,{contentName:ji,titleName:ES,docsSlug:"alert-dialog",children:r.jsx(J4,{scope:n,cancelRef:d,children:r.jsxs(Fx,{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(X4,{children:s}),r.jsx(eL,{contentRef:c})]})})})});CS.displayName=ji;var ES="AlertDialogTitle",TS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(zx,{...o,...s,ref:t})});TS.displayName=ES;var RS="AlertDialogDescription",AS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(Bx,{...o,...s,ref:t})});AS.displayName=RS;var Z4="AlertDialogAction",PS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(Ux,{...o,...s,ref:t})});PS.displayName=Z4;var DS="AlertDialogCancel",$S=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=Q4(DS,n),i=Hs(n),c=Kn(t,o);return r.jsx(Ux,{...i,...s,ref:c})});$S.displayName=DS;var eL=({contentRef:e})=>{const t=`\`${ji}\` requires a description for the component to be accessible for screen reader users.
561
-
562
- You can add a description to the \`${ji}\` by passing a \`${RS}\` 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 \`${ji}\`. 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},tL=kS,nL=SS,LS=NS,IS=CS,OS=PS,_S=$S,MS=TS,FS=AS;const fi=tL,rL=nL,zS=f.forwardRef(({className:e,...t},n)=>r.jsx(LS,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));zS.displayName=LS.displayName;const sa=f.forwardRef(({className:e,...t},n)=>r.jsxs(rL,{children:[r.jsx(zS,{}),r.jsx(IS,{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})]}));sa.displayName=IS.displayName;function pi({className:e,...t}){return r.jsx("div",{className:be("flex flex-col space-y-2 text-left",e),...t})}function mi({className:e,...t}){return r.jsx("div",{className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const oa=f.forwardRef(({className:e,...t},n)=>r.jsx(MS,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));oa.displayName=MS.displayName;const aa=f.forwardRef(({className:e,...t},n)=>r.jsx(FS,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));aa.displayName=FS.displayName;const vo=f.forwardRef(({className:e,...t},n)=>r.jsx(OS,{ref:n,className:be(e),...t}));vo.displayName=OS.displayName;const yc=f.forwardRef(({className:e,...t},n)=>r.jsx(_S,{ref:n,className:be(e),...t}));yc.displayName=_S.displayName;const sL=[{to:"/",label:"Overview",icon:Kk},{to:"/playbooks",label:"Playbooks",icon:Uk},{to:"/memories",label:"Memories",icon:nP},{to:"/resources",label:"Resources",icon:bP},{to:"/inventories",label:"Inventories",icon:Pf},{to:"/schedules",label:"Schedules",icon:Wk},{to:"/usage",label:"Usage",icon:$c},{to:"/todos",label:"Todos",icon:zr},{to:"/views",label:"Saved Views",icon:Gk},{to:"/archive",label:"Archive",icon:Rf}],oL=[{suffix:"/projects",label:"Projects",icon:yx},{suffix:"/assignments",label:"Assignments",icon:jP},{suffix:"/servers",label:"Servers",icon:jx},{suffix:"/inventories",label:"Inventories",icon:Pf},{suffix:"/usage",label:"Usage",icon:$c},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Tf},{suffix:"/todos",label:"Todos",icon:zr}],aL=[{to:"/help",label:"Help",icon:vP},{to:"/workflow",label:"Workflow",icon:FP},{to:"/settings",label:"Settings",icon:LP}];function iL({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:o}){const[i,c]=f.useState(!1);return Kt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(oj,{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(Ce,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>c(!1),children:"Syntaur"}),r.jsx("button",{type:"button",onClick:()=>c(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80",children:r.jsx($f,{className:"h-4 w-4"})})]}),r.jsx(oj,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(L4,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>c(!0)}),r.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:o})]})]})})}function oj({activeWorkspace:e,onNavigate:t}){const{data:n}=ma(),s=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=wS(),c=Xn(),[u,d]=f.useState(new Set),[m,h]=f.useState(!1),[g,y]=f.useState(""),[b,N]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(!1),P=_t();function R(F){d(D=>{const V=new Set(D);return V.has(F)?V.delete(F):V.add(F),V})}const A=_4([...s,...o?[Zd]:[]],i);async function L(F){if(w){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(w)}${F?"?cascade=true":""}`,V=await fetch(D,{method:"DELETE"});if(V.status===409){const Y=await V.json().catch(()=>({}));E((Y==null?void 0:Y.blockedBy)??{projects:[],standalones:[]});return}if(!V.ok){const Y=await V.json().catch(()=>({}));throw new Error(Y.error||"Failed to delete workspace")}v(null),E(null)}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to delete workspace")}finally{T(!1)}}}async function M(F,D){try{if(F.type==="project"){const V=await fetch(`/api/projects/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!V.ok){const Y=await V.json().catch(()=>({}));throw new Error(Y.error||"Failed to move project")}return}if(F.type==="standalone-assignment"){const V=await fetch(`/api/assignments/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!V.ok){const Y=await V.json().catch(()=>({}));throw new Error(Y.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(V){console.error(V),alert(V instanceof Error?V.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Ce,{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(Lw,{items:sL,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[A.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),A.map(F=>{const D=F==="_ungrouped",V=D?"Ungrouped":kn(F),Y=D?"/w/_ungrouped":`/w/${F}`,_=u.has(F),z=e===F||e===null&&D&&c.pathname.startsWith("/w/_ungrouped"),H=b===F;return r.jsxs("div",{className:`rounded-md transition ${H?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:q=>{q.dataTransfer.types.includes("application/json")&&(q.preventDefault(),q.dataTransfer.dropEffect="move",N(F))},onDragLeave:q=>{q.currentTarget.contains(q.relatedTarget)||N(I=>I===F?null:I)},onDrop:async q=>{try{const I=q.dataTransfer.getData("application/json");if(!I)return;q.preventDefault();let K;try{K=JSON.parse(I)}catch{return}if(!(K!=null&&K.type)||!(K!=null&&K.id))return;await M(K,D?null:F)}finally{N(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 ${z?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(pr,{className:`h-3 w-3 transition-transform ${_?"-rotate-90":""}`}),V]}),D?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"})})]}),!_&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:oL.map(q=>{const I=`${Y}${q.suffix}`,K=l1(c.pathname,q.suffix)&&c.pathname.startsWith(Y),$=q.icon;return r.jsxs(Ce,{to:I,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${K?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx($,{className:"h-4 w-4"}),r.jsx("span",{children:q.label})]},I)})})]},F)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:F=>{F.preventDefault();const D=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");D&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}).then(()=>{t==null||t(),P(`/w/${D}/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(Ct,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(Lw,{items:aL,onNavigate:t}),r.jsx(fi,{open:w!==null,onOpenChange:F=>{S||F||(v(null),E(null))},children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsx(oa,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(aa,{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(Ce,{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(Ce,{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(mi,{children:[r.jsx(yc,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(vo,{disabled:S,onClick:F=>{F.preventDefault(),L(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Clear references and delete"}):r.jsx(vo,{disabled:S,onClick:F=>{F.preventDefault(),L(!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 lL(){const e=Xn(),{workspace:t}=Mt(),{title:n,breadcrumbs:s,projectSlug:o}=c1(e.pathname);return r.jsx(iL,{title:n,breadcrumbs:s,projectSlug:o,workspace:t??null,children:r.jsx(pA,{})})}function cL(){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 Vf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Hi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Gx(e){return"nodeType"in e}function er(e){var t,n;return e?Hi(e)?e:Gx(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Yx(e){const{Document:t}=er(e);return e instanceof t}function _c(e){return Hi(e)?!1:e instanceof er(e).HTMLElement}function BS(e){return e instanceof er(e).SVGElement}function Ki(e){return e?Hi(e)?e.document:Gx(e)?Yx(e)?e:_c(e)||BS(e)?e.ownerDocument:document:document:document}const ns=Vf?f.useLayoutEffect:f.useEffect;function Hf(e){const t=f.useRef(e);return ns(()=>{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 uL(){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 bc(e,t){t===void 0&&(t=[e]);const n=f.useRef(e);return ns(()=>{n.current!==e&&(n.current=e)},t),n}function Mc(e,t){const n=f.useRef();return f.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function ef(e){const t=Hf(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 tf(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let Ah={};function Fc(e,t){return f.useMemo(()=>{if(t)return t;const n=Ah[e]==null?0:Ah[e]+1;return Ah[e]=n,e+"-"+n},[e,t])}function US(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return s.reduce((i,c)=>{const u=Object.entries(c);for(const[d,m]of u){const h=i[d];h!=null&&(i[d]=h+e*m)}return i},{...t})}}const ki=US(1),vc=US(-1);function dL(e){return"clientX"in e&&"clientY"in e}function Kf(e){if(!e)return!1;const{KeyboardEvent:t}=er(e.target);return t&&e instanceof t}function fL(e){if(!e)return!1;const{TouchEvent:t}=er(e.target);return t&&e instanceof t}function nf(e){if(fL(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 dL(e)?{x:e.clientX,y:e.clientY}:null}const rs=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[rs.Translate.toString(e),rs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),aj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function pL(e){return e.matches(aj)?e:e.querySelector(aj)}const mL={display:"none"};function hL(e){let{id:t,value:n}=e;return Pt.createElement("div",{id:t,style:mL},n)}function gL(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 Pt.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function xL(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const WS=f.createContext(null);function yL(e){const t=f.useContext(WS);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function bL(){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(c=>{var u;return(u=c[o])==null?void 0:u.call(c,i)})},[e]),t]}const vL={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
- `},wL={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 jL(e){let{announcements:t=wL,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=vL}=e;const{announce:i,announcement:c}=xL(),u=Fc("DndLiveRegion"),[d,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),yL(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=Pt.createElement(Pt.Fragment,null,Pt.createElement(hL,{id:s,value:o.draggable}),Pt.createElement(gL,{id:u,announcement:c}));return n?Fs.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 rf(){}function ko(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function qf(){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 ss=Object.freeze({x:0,y:0});function VS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kL(e,t){const n=nf(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 HS(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function SL(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function ij(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 KS(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function lj(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 Gf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=lj(t,t.left,t.top),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=VS(lj(d),o);i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(HS)},NL=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=ij(t),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=ij(d),h=o.reduce((y,b,N)=>y+VS(m[N],b),0),g=Number((h/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:g}})}}return i.sort(HS)};function CL(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),c=o-s,u=i-n;if(s<o&&n<i){const d=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(d+m-h);return Number(g.toFixed(4))}return 0}const EL=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=[];for(const i of s){const{id:c}=i,u=n.get(c);if(u){const d=CL(u,t);d>0&&o.push({id:c,data:{droppableContainer:i,value:d}})}}return o.sort(SL)};function TL(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function qS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ss}function RL(e){return function(n){for(var s=arguments.length,o=new Array(s>1?s-1:0),i=1;i<s;i++)o[i-1]=arguments[i];return o.reduce((c,u)=>({...c,top:c.top+e*u.y,bottom:c.bottom+e*u.y,left:c.left+e*u.x,right:c.right+e*u.x}),{...n})}}const AL=RL(1);function GS(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 PL(e,t,n){const s=GS(t);if(!s)return e;const{scaleX:o,scaleY:i,x:c,y:u}=s,d=e.left-c-(1-o)*parseFloat(n),m=e.top-u-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),h=o?e.width/o:e.width,g=i?e.height/i:e.height;return{width:h,height:g,top:m,right:d+h,bottom:m+g,left:d}}const DL={ignoreTransform:!1};function qi(e,t){t===void 0&&(t=DL);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=er(e).getComputedStyle(e);m&&(n=PL(n,m,h))}const{top:s,left:o,width:i,height:c,bottom:u,right:d}=n;return{top:s,left:o,width:i,height:c,bottom:u,right:d}}function cj(e){return qi(e,{ignoreTransform:!0})}function $L(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function LL(e,t){return t===void 0&&(t=er(e).getComputedStyle(e)),t.position==="fixed"}function IL(e,t){t===void 0&&(t=er(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Yf(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(Yx(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!_c(o)||BS(o)||n.includes(o))return n;const i=er(e).getComputedStyle(o);return o!==e&&IL(o,i)&&n.push(o),LL(o,i)?n:s(o.parentNode)}return e?s(e):n}function YS(e){const[t]=Yf(e,1);return t??null}function Ph(e){return!Vf||!e?null:Hi(e)?e:Gx(e)?Yx(e)||e===Ki(e).scrollingElement?window:_c(e)?e:null:null}function JS(e){return Hi(e)?e.scrollX:e.scrollLeft}function QS(e){return Hi(e)?e.scrollY:e.scrollTop}function Ag(e){return{x:JS(e),y:QS(e)}}var Dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Dn||(Dn={}));function XS(e){return!Vf||!e?!1:e===document.scrollingElement}function ZS(e){const t={x:0,y:0},n=XS(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,c=e.scrollTop>=s.y,u=e.scrollLeft>=s.x;return{isTop:o,isLeft:i,isBottom:c,isRight:u,maxScroll:s,minScroll:t}}const OL={x:.2,y:.2};function _L(e,t,n,s,o){let{top:i,left:c,right:u,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=OL);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=ZS(e),b={x:0,y:0},N={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!m&&i<=t.top+w.height?(b.y=Dn.Backward,N.y=s*Math.abs((t.top+w.height-i)/w.height)):!h&&d>=t.bottom-w.height&&(b.y=Dn.Forward,N.y=s*Math.abs((t.bottom-w.height-d)/w.height)),!y&&u>=t.right-w.width?(b.x=Dn.Forward,N.x=s*Math.abs((t.right-w.width-u)/w.width)):!g&&c<=t.left+w.width&&(b.x=Dn.Backward,N.x=s*Math.abs((t.left+w.width-c)/w.width)),{direction:b,speed:N}}function ML(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:t,left:n,right:s,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:o,width:e.clientWidth,height:e.clientHeight}}function eN(e){return e.reduce((t,n)=>ki(t,Ag(n)),ss)}function FL(e){return e.reduce((t,n)=>t+JS(n),0)}function zL(e){return e.reduce((t,n)=>t+QS(n),0)}function tN(e,t){if(t===void 0&&(t=qi),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);YS(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const BL=[["x",["left","right"],FL],["y",["top","bottom"],zL]];class Jx{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=Yf(n),o=eN(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of BL)for(const d of c)Object.defineProperty(this,d,{get:()=>{const m=u(s),h=o[i]-m;return this.rect[d]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class sc{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 UL(e){const{EventTarget:t}=er(e);return e instanceof t?e:Ki(e)}function Dh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Mr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Mr||(Mr={}));function uj(e){e.preventDefault()}function WL(e){e.stopPropagation()}var wt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(wt||(wt={}));const nN={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},VL=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case wt.Right:return{...n,x:n.x+25};case wt.Left:return{...n,x:n.x-25};case wt.Down:return{...n,y:n.y+25};case wt.Up:return{...n,y:n.y-25}}};class Gi{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 sc(Ki(n)),this.windowListeners=new sc(er(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Mr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&tN(s),n(ss)}handleKeyDown(t){if(Kf(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=nN,coordinateGetter:c=VL,scrollBehavior:u="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:m}=s.current,h=m?{x:m.left,y:m.top}:ss;this.referenceCoordinates||(this.referenceCoordinates=h);const g=c(t,{active:n,context:s.current,currentCoordinates:h});if(g){const y=vc(g,h),b={x:0,y:0},{scrollableAncestors:N}=s.current;for(const w of N){const v=t.code,{isTop:k,isRight:E,isLeft:S,isBottom:T,maxScroll:P,minScroll:R}=ZS(w),A=ML(w),L={x:Math.min(v===wt.Right?A.right-A.width/2:A.right,Math.max(v===wt.Right?A.left:A.left+A.width/2,g.x)),y:Math.min(v===wt.Down?A.bottom-A.height/2:A.bottom,Math.max(v===wt.Down?A.top:A.top+A.height/2,g.y))},M=v===wt.Right&&!E||v===wt.Left&&!S,F=v===wt.Down&&!T||v===wt.Up&&!k;if(M&&L.x!==g.x){const D=w.scrollLeft+y.x,V=v===wt.Right&&D<=P.x||v===wt.Left&&D>=R.x;if(V&&!y.y){w.scrollTo({left:D,behavior:u});return}V?b.x=w.scrollLeft-D:b.x=v===wt.Right?w.scrollLeft-P.x:w.scrollLeft-R.x,b.x&&w.scrollBy({left:-b.x,behavior:u});break}else if(F&&L.y!==g.y){const D=w.scrollTop+y.y,V=v===wt.Down&&D<=P.y||v===wt.Up&&D>=R.y;if(V&&!y.x){w.scrollTo({top:D,behavior:u});return}V?b.y=w.scrollTop-D:b.y=v===wt.Down?w.scrollTop-P.y:w.scrollTop-R.y,b.y&&w.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,ki(vc(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()}}Gi.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=nN,onActivation:o}=t,{active:i}=n;const{code:c}=e.nativeEvent;if(s.start.includes(c)){const u=i.activatorNode.current;return u&&e.target!==u?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function dj(e){return!!(e&&"distance"in e)}function fj(e){return!!(e&&"delay"in e)}class Qx{constructor(t,n,s){var o;s===void 0&&(s=UL(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:c}=i;this.props=t,this.events=n,this.document=Ki(c),this.documentListeners=new sc(this.document),this.listeners=new sc(s),this.windowListeners=new sc(er(c)),this.initialCoordinates=(o=nf(i))!=null?o:ss,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Mr.Resize,this.handleCancel),this.windowListeners.add(Mr.DragStart,uj),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),this.windowListeners.add(Mr.ContextMenu,uj),this.documentListeners.add(Mr.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dj(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Mr.Click,WL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Mr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:u}}=i;if(!o)return;const d=(n=nf(t))!=null?n:ss,m=vc(o,d);if(!s&&u){if(dj(u)){if(u.tolerance!=null&&Dh(m,u.tolerance))return this.handleCancel();if(Dh(m,u.distance))return this.handleStart()}if(fj(u)&&Dh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===wt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const HL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Yi extends Qx{constructor(t){const{event:n}=t,s=Ki(n.target);super(t,HL,s)}}Yi.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 KL={move:{name:"mousemove"},end:{name:"mouseup"}};var Pg;(function(e){e[e.RightClick=2]="RightClick"})(Pg||(Pg={}));class qL extends Qx{constructor(t){super(t,KL,Ki(t.event.target))}}qL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Pg.RightClick?!1:(s==null||s({event:n}),!0)}}];const $h={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class GL extends Qx{constructor(t){super(t,$h)}static setup(){return window.addEventListener($h.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener($h.move.name,t)};function t(){}}}GL.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 oc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(oc||(oc={}));var sf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(sf||(sf={}));function YL(e){let{acceleration:t,activator:n=oc.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:c=5,order:u=sf.TreeOrder,pointerCoordinates:d,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=QL({delta:g,disabled:!i}),[N,w]=uL(),v=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case oc.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case oc.DraggableRect:return o}},[n,o,d]),S=f.useRef(null),T=f.useCallback(()=>{const R=S.current;if(!R)return;const A=v.current.x*k.current.x,L=v.current.y*k.current.y;R.scrollBy(A,L)},[]),P=f.useMemo(()=>u===sf.TreeOrder?[...m].reverse():m,[u,m]);f.useEffect(()=>{if(!i||!m.length||!E){w();return}for(const R of P){if((s==null?void 0:s(R))===!1)continue;const A=m.indexOf(R),L=h[A];if(!L)continue;const{direction:M,speed:F}=_L(R,L,E,t,y);for(const D of["x","y"])b[D][M[D]]||(F[D]=0,M[D]=0);if(F.x>0||F.y>0){w(),S.current=R,N(T,c),v.current=F,k.current=M;return}}v.current={x:0,y:0},k.current={x:0,y:0},w()},[t,T,s,w,i,c,JSON.stringify(E),JSON.stringify(b),N,m,P,h,JSON.stringify(y)])}const JL={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function QL(e){let{delta:t,disabled:n}=e;const s=tf(t);return Mc(o=>{if(n||!s||!o)return JL;const i={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Dn.Backward]:o.x[Dn.Backward]||i.x===-1,[Dn.Forward]:o.x[Dn.Forward]||i.x===1},y:{[Dn.Backward]:o.y[Dn.Backward]||i.y===-1,[Dn.Forward]:o.y[Dn.Forward]||i.y===1}}},[n,t,s])}function XL(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Mc(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function ZL(e,t){return f.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...i]},[]),[e,t])}var wc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(wc||(wc={}));var Dg;(function(e){e.Optimized="optimized"})(Dg||(Dg={}));const pj=new Map;function eI(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,c]=f.useState(null),{frequency:u,measure:d,strategy:m}=o,h=f.useRef(e),g=v(),y=bc(g),b=f.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(S=>!E.includes(S))))},[y]),N=f.useRef(null),w=Mc(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,P=T?new Jx(d(T),T):null;S.rect.current=P,P&&E.set(S.id,P)}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&&c(null)},[JSON.stringify(i)]),f.useEffect(()=>{g||typeof u!="number"||N.current!==null||(N.current=setTimeout(()=>{b(),N.current=null},u))},[u,g,b,...s]),{droppableRects:w,measureDroppableContainers:b,measuringScheduled:i!=null};function v(){switch(m){case wc.Always:return!1;case wc.BeforeDragging:return n;default:return!n}}}function Xx(e,t){return Mc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function tI(e,t){return Xx(e,t)}function nI(e){let{callback:t,disabled:n}=e;const s=Hf(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 Jf(e){let{callback:t,disabled:n}=e;const s=Hf(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 rI(e){return new Jx(qi(e),e)}function mj(e,t,n){t===void 0&&(t=rI);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 c=nI({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=Jf({callback:i});return ns(()=>{i(),e?(u==null||u.observe(e),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(u==null||u.disconnect(),c==null||c.disconnect())},[e]),s}function sI(e){const t=Xx(e);return qS(e,t)}const hj=[];function oI(e){const t=f.useRef(e),n=Mc(s=>e?s&&s!==hj&&e&&t.current&&e.parentNode===t.current.parentNode?s:Yf(e):hj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function aI(e){const[t,n]=f.useState(null),s=f.useRef(e),o=f.useCallback(i=>{const c=Ph(i.target);c&&n(u=>u?(u.set(c,Ag(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const i=s.current;if(e!==i){c(i);const u=e.map(d=>{const m=Ph(d);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Ag(m)]):null}).filter(d=>d!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(i)};function c(u){u.forEach(d=>{const m=Ph(d);m==null||m.removeEventListener("scroll",o)})}},[o,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>ki(i,c),ss):eN(e):ss,[e,t])}function gj(e,t){t===void 0&&(t=[]);const n=f.useRef(null);return f.useEffect(()=>{n.current=null},t),f.useEffect(()=>{const s=e!==ss;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?vc(e,n.current):ss}function iI(e){f.useEffect(()=>{if(!Vf)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 lI(e,t){return f.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function rN(e){return f.useMemo(()=>e?$L(e):null,[e])}const xj=[];function cI(e,t){t===void 0&&(t=qi);const[n]=e,s=rN(n?er(n):null),[o,i]=f.useState(xj);function c(){i(()=>e.length?e.map(d=>XS(d)?s:new Jx(t(d),d)):xj)}const u=Jf({callback:c});return ns(()=>{u==null||u.disconnect(),c(),e.forEach(d=>u==null?void 0:u.observe(d))},[e]),o}function sN(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return _c(t)?t:e}function uI(e){let{measure:t}=e;const[n,s]=f.useState(null),o=f.useCallback(m=>{for(const{target:h}of m)if(_c(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),i=Jf({callback:o}),c=f.useCallback(m=>{const h=sN(m);i==null||i.disconnect(),h&&(i==null||i.observe(h)),s(h?t(h):null)},[t,i]),[u,d]=ef(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:d}),[n,u,d])}const dI=[{sensor:Yi,options:{}},{sensor:Gi,options:{}}],fI={current:{}},Id={draggable:{measure:cj},droppable:{measure:cj,strategy:wc.WhileDragging,frequency:Dg.Optimized},dragOverlay:{measure:qi}};class ac 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 pI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ac,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:rf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Id,measureDroppableContainers:rf,windowRect:null,measuringScheduled:!1},oN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:rf,draggableNodes:new Map,over:null,measureDroppableContainers:rf},zc=f.createContext(oN),aN=f.createContext(pI);function mI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ac}}}function hI(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 ac(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 c=new ac(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}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 ac(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function gI(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=f.useContext(zc),i=tf(s),c=tf(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&i&&c!=null){if(!Kf(i)||document.activeElement===i.target)return;const u=o.get(c);if(!u)return;const{activatorNode:d,node:m}=u;if(!d.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[d.current,m.current]){if(!h)continue;const g=pL(h);if(g){g.focus();break}}})}},[s,t,o,c,i]),null}function iN(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function xI(e){return f.useMemo(()=>({draggable:{...Id.draggable,...e==null?void 0:e.draggable},droppable:{...Id.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Id.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 yI(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=f.useRef(!1),{x:c,y:u}=typeof o=="boolean"?{x:o,y:o}:o;ns(()=>{if(!c&&!u||!t){i.current=!1;return}if(i.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=qS(h,s);if(c||(g.x=0),u||(g.y=0),i.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const y=YS(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const Qf=f.createContext({...ss,scaleX:1,scaleY:1});var bo;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(bo||(bo={}));const Xf=f.memo(function(t){var n,s,o,i;let{id:c,accessibility:u,autoScroll:d=!0,children:m,sensors:h=dI,collisionDetection:g=EL,measuring:y,modifiers:b,...N}=t;const w=f.useReducer(hI,void 0,mI),[v,k]=w,[E,S]=bL(),[T,P]=f.useState(bo.Uninitialized),R=T===bo.Initialized,{draggable:{active:A,nodes:L,translate:M},droppable:{containers:F}}=v,D=A!=null?L.get(A):null,V=f.useRef({initial:null,translated:null}),Y=f.useMemo(()=>{var me;return A!=null?{id:A,data:(me=D==null?void 0:D.data)!=null?me:fI,rect:V}:null},[A,D]),_=f.useRef(null),[z,H]=f.useState(null),[q,I]=f.useState(null),K=bc(N,Object.values(N)),$=Fc("DndDescribedBy",c),W=f.useMemo(()=>F.getEnabled(),[F]),ee=xI(y),{droppableRects:B,measureDroppableContainers:ae,measuringScheduled:ue}=eI(W,{dragging:R,dependencies:[M.x,M.y],config:ee.droppable}),se=XL(L,A),xe=f.useMemo(()=>q?nf(q):null,[q]),ke=st(),Re=tI(se,ee.draggable.measure);yI({activeNode:A!=null?L.get(A):null,config:ke.layoutShiftCompensation,initialRect:Re,measure:ee.draggable.measure});const Ae=mj(se,ee.draggable.measure,Re),Qe=mj(se?se.parentElement:null),at=f.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:L,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ze=F.getNodeFor((n=at.current.over)==null?void 0:n.id),ot=uI({measure:ee.dragOverlay.measure}),Z=(s=ot.nodeRef.current)!=null?s:se,_e=R?(o=ot.rect)!=null?o:Ae:null,Ee=!!(ot.nodeRef.current&&ot.rect),Ie=sI(Ee?null:Ae),Ye=rN(Z?er(Z):null),Me=oI(R?Ze??se:null),et=cI(Me),Je=iN(b,{transform:{x:M.x-Ie.x,y:M.y-Ie.y,scaleX:1,scaleY:1},activatorEvent:q,active:Y,activeNodeRect:Ae,containerNodeRect:Qe,draggingNodeRect:_e,over:at.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Me,scrollableAncestorRects:et,windowRect:Ye}),$t=xe?ki(xe,M):null,vt=aI(Me),ct=gj(vt),le=gj(vt,[Ae]),J=ki(Je,ct),he=_e?AL(_e,Je):null,re=Y&&he?g({active:Y,collisionRect:he,droppableRects:B,droppableContainers:W,pointerCoordinates:$t}):null,ye=KS(re,"id"),[Pe,ve]=f.useState(null),te=Ee?Je:ki(Je,le),fe=TL(te,(i=Pe==null?void 0:Pe.rect)!=null?i:null,Ae),Se=f.useRef(null),Ue=f.useCallback((me,Oe)=>{let{sensor:qe,options:Lt}=Oe;if(_.current==null)return;const Xt=L.get(_.current);if(!Xt)return;const dn=me.nativeEvent,Gt=new qe({active:_.current,activeNode:Xt,event:dn,options:Lt,context:at,onAbort(Et){if(!L.get(Et))return;const{onDragAbort:Tt}=K.current,oe={id:Et};Tt==null||Tt(oe),E({type:"onDragAbort",event:oe})},onPending(Et,Fn,Tt,oe){if(!L.get(Et))return;const{onDragPending:tt}=K.current,yt={id:Et,constraint:Fn,initialCoordinates:Tt,offset:oe};tt==null||tt(yt),E({type:"onDragPending",event:yt})},onStart(Et){const Fn=_.current;if(Fn==null)return;const Tt=L.get(Fn);if(!Tt)return;const{onDragStart:oe}=K.current,ze={activatorEvent:dn,active:{id:Fn,data:Tt.data,rect:V}};Fs.unstable_batchedUpdates(()=>{oe==null||oe(ze),P(bo.Initializing),k({type:Sn.DragStart,initialCoordinates:Et,active:Fn}),E({type:"onDragStart",event:ze}),H(Se.current),I(dn)})},onMove(Et){k({type:Sn.DragMove,coordinates:Et})},onEnd:Gn(Sn.DragEnd),onCancel:Gn(Sn.DragCancel)});Se.current=Gt;function Gn(Et){return async function(){const{active:Tt,collisions:oe,over:ze,scrollAdjustedTranslate:tt}=at.current;let yt=null;if(Tt&&tt){const{cancelDrop:tr}=K.current;yt={activatorEvent:dn,active:Tt,collisions:oe,delta:tt,over:ze},Et===Sn.DragEnd&&typeof tr=="function"&&await Promise.resolve(tr(yt))&&(Et=Sn.DragCancel)}_.current=null,Fs.unstable_batchedUpdates(()=>{k({type:Et}),P(bo.Uninitialized),ve(null),H(null),I(null),Se.current=null;const tr=Et===Sn.DragEnd?"onDragEnd":"onDragCancel";if(yt){const qr=K.current[tr];qr==null||qr(yt),E({type:tr,event:yt})}})}}},[L]),ce=f.useCallback((me,Oe)=>(qe,Lt)=>{const Xt=qe.nativeEvent,dn=L.get(Lt);if(_.current!==null||!dn||Xt.dndKit||Xt.defaultPrevented)return;const Gt={active:dn};me(qe,Oe.options,Gt)===!0&&(Xt.dndKit={capturedBy:Oe.sensor},_.current=Lt,Ue(qe,Oe))},[L,Ue]),pt=ZL(h,ce);iI(h),ns(()=>{Ae&&T===bo.Initializing&&P(bo.Initialized)},[Ae,T]),f.useEffect(()=>{const{onDragMove:me}=K.current,{active:Oe,activatorEvent:qe,collisions:Lt,over:Xt}=at.current;if(!Oe||!qe)return;const dn={active:Oe,activatorEvent:qe,collisions:Lt,delta:{x:J.x,y:J.y},over:Xt};Fs.unstable_batchedUpdates(()=>{me==null||me(dn),E({type:"onDragMove",event:dn})})},[J.x,J.y]),f.useEffect(()=>{const{active:me,activatorEvent:Oe,collisions:qe,droppableContainers:Lt,scrollAdjustedTranslate:Xt}=at.current;if(!me||_.current==null||!Oe||!Xt)return;const{onDragOver:dn}=K.current,Gt=Lt.get(ye),Gn=Gt&&Gt.rect.current?{id:Gt.id,rect:Gt.rect.current,data:Gt.data,disabled:Gt.disabled}:null,Et={active:me,activatorEvent:Oe,collisions:qe,delta:{x:Xt.x,y:Xt.y},over:Gn};Fs.unstable_batchedUpdates(()=>{ve(Gn),dn==null||dn(Et),E({type:"onDragOver",event:Et})})},[ye]),ns(()=>{at.current={activatorEvent:q,active:Y,activeNode:se,collisionRect:he,collisions:re,droppableRects:B,draggableNodes:L,draggingNode:Z,draggingNodeRect:_e,droppableContainers:F,over:Pe,scrollableAncestors:Me,scrollAdjustedTranslate:J},V.current={initial:_e,translated:he}},[Y,se,re,he,L,Z,_e,B,F,Pe,Me,J]),YL({...ke,delta:M,draggingRect:he,pointerCoordinates:$t,scrollableAncestors:Me,scrollableAncestorRects:et});const xt=f.useMemo(()=>({active:Y,activeNode:se,activeNodeRect:Ae,activatorEvent:q,collisions:re,containerNodeRect:Qe,dragOverlay:ot,draggableNodes:L,droppableContainers:F,droppableRects:B,over:Pe,measureDroppableContainers:ae,scrollableAncestors:Me,scrollableAncestorRects:et,measuringConfiguration:ee,measuringScheduled:ue,windowRect:Ye}),[Y,se,Ae,q,re,Qe,ot,L,F,B,Pe,ae,Me,et,ee,ue,Ye]),St=f.useMemo(()=>({activatorEvent:q,activators:pt,active:Y,activeNodeRect:Ae,ariaDescribedById:{draggable:$},dispatch:k,draggableNodes:L,over:Pe,measureDroppableContainers:ae}),[q,pt,Y,Ae,k,$,L,Pe,ae]);return Pt.createElement(WS.Provider,{value:S},Pt.createElement(zc.Provider,{value:St},Pt.createElement(aN.Provider,{value:xt},Pt.createElement(Qf.Provider,{value:fe},m)),Pt.createElement(gI,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Pt.createElement(jL,{...u,hiddenTextDescribedById:$}));function st(){const me=(z==null?void 0:z.autoScrollEnabled)===!1,Oe=typeof d=="object"?d.enabled===!1:d===!1,qe=R&&!me&&!Oe;return typeof d=="object"?{...d,enabled:qe}:{enabled:qe}}}),bI=f.createContext(null),yj="button",vI="Draggable";function wI(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Fc(vI),{activators:c,activatorEvent:u,active:d,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(zc),{role:b=yj,roleDescription:N="draggable",tabIndex:w=0}=o??{},v=(d==null?void 0:d.id)===t,k=f.useContext(v?Qf:bI),[E,S]=ef(),[T,P]=ef(),R=lI(c,t),A=bc(n);ns(()=>(g.set(t,{id:t,key:i,node:E,activatorNode:T,data:A}),()=>{const M=g.get(t);M&&M.key===i&&g.delete(t)}),[g,t]);const L=f.useMemo(()=>({role:b,tabIndex:w,"aria-disabled":s,"aria-pressed":v&&b===yj?!0:void 0,"aria-roledescription":N,"aria-describedby":h.draggable}),[s,b,w,v,N,h.draggable]);return{active:d,activatorEvent:u,activeNodeRect:m,attributes:L,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:S,setActivatorNodeRef:P,transform:k}}function lN(){return f.useContext(aN)}const jI="Droppable",kI={timeout:25};function SI(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Fc(jI),{active:c,dispatch:u,over:d,measureDroppableContainers:m}=f.useContext(zc),h=f.useRef({disabled:n}),g=f.useRef(!1),y=f.useRef(null),b=f.useRef(null),{disabled:N,updateMeasurementsFor:w,timeout:v}={...kI,...o},k=bc(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=Jf({callback:E,disabled:N||!c}),T=f.useCallback((L,M)=>{S&&(M&&(S.unobserve(M),g.current=!1),L&&S.observe(L))},[S]),[P,R]=ef(T),A=bc(t);return f.useEffect(()=>{!S||!P.current||(S.disconnect(),g.current=!1,S.observe(P.current))},[P,S]),f.useEffect(()=>(u({type:Sn.RegisterDroppable,element:{id:s,key:i,disabled:n,node:P,rect:y,data:A}}),()=>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:c,rect:y,isOver:(d==null?void 0:d.id)===s,node:P,over:d,setNodeRef:R}}function NI(e){let{animation:t,children:n}=e;const[s,o]=f.useState(null),[i,c]=f.useState(null),u=tf(n);return!n&&!s&&u&&o(u),ns(()=>{if(!i)return;const d=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(d==null||m==null){o(null);return}Promise.resolve(t(m,i)).then(()=>{o(null)})},[t,s,i]),Pt.createElement(Pt.Fragment,null,n,s?f.cloneElement(s,{ref:c}):null)}const CI={x:0,y:0,scaleX:1,scaleY:1};function EI(e){let{children:t}=e;return Pt.createElement(zc.Provider,{value:oN},Pt.createElement(Qf.Provider,{value:CI},t))}const TI={position:"fixed",touchAction:"none"},RI=e=>Kf(e)?"transform 250ms ease":void 0,AI=f.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:o,children:i,className:c,rect:u,style:d,transform:m,transition:h=RI}=e;if(!u)return null;const g=o?m:{...m,scaleX:1,scaleY:1},y={...TI,width:u.width,height:u.height,top:u.top,left:u.left,transform:rs.Transform.toString(g),transformOrigin:o&&s?kL(s,u):void 0,transition:typeof h=="function"?h(s):h,...d};return Pt.createElement(n,{className:c,style:y,ref:t},i)}),PI=e=>t=>{let{active:n,dragOverlay:s}=t;const o={},{styles:i,className:c}=e;if(i!=null&&i.active)for(const[u,d]of Object.entries(i.active))d!==void 0&&(o[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,d));if(i!=null&&i.dragOverlay)for(const[u,d]of Object.entries(i.dragOverlay))d!==void 0&&s.node.style.setProperty(u,d);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[d,m]of Object.entries(o))n.node.style.setProperty(d,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},DI=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rs.Transform.toString(t)},{transform:rs.Transform.toString(n)}]},$I={duration:250,easing:"ease",keyframes:DI,sideEffects:PI({styles:{active:{opacity:"0"}}})};function LI(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:o}=e;return Hf((i,c)=>{if(t===null)return;const u=n.get(i);if(!u)return;const d=u.node.current;if(!d)return;const m=sN(c);if(!m)return;const{transform:h}=er(c).getComputedStyle(c),g=GS(h);if(!g)return;const y=typeof t=="function"?t:II(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:c,rect:o.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:o,transform:g})})}function II(e){const{duration:t,easing:n,sideEffects:s,keyframes:o}={...$I,...e};return i=>{let{active:c,dragOverlay:u,transform:d,...m}=i;if(!t)return;const h={x:u.rect.left-c.rect.left,y:u.rect.top-c.rect.top},g={scaleX:d.scaleX!==1?c.rect.width*d.scaleX/u.rect.width:1,scaleY:d.scaleY!==1?c.rect.height*d.scaleY/u.rect.height:1},y={x:d.x-h.x,y:d.y-h.y,...g},b=o({...m,active:c,dragOverlay:u,transform:{initial:d,final:y}}),[N]=b,w=b[b.length-1];if(JSON.stringify(N)===JSON.stringify(w))return;const v=s==null?void 0:s({active:c,dragOverlay:u,...m}),k=u.node.animate(b,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{v==null||v(),E()}})}}let bj=0;function OI(e){return f.useMemo(()=>{if(e!=null)return bj++,bj},[e])}const _I=Pt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:o,transition:i,modifiers:c,wrapperElement:u="div",className:d,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggableNodes:N,droppableContainers:w,dragOverlay:v,over:k,measuringConfiguration:E,scrollableAncestors:S,scrollableAncestorRects:T,windowRect:P}=lN(),R=f.useContext(Qf),A=OI(g==null?void 0:g.id),L=iN(c,{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:T,transform:R,windowRect:P}),M=Xx(y),F=LI({config:s,draggableNodes:N,droppableContainers:w,measuringConfiguration:E}),D=M?v.setRef:void 0;return Pt.createElement(EI,null,Pt.createElement(NI,{animation:F},g&&A?Pt.createElement(AI,{key:A,id:g.id,ref:D,as:u,activatorEvent:h,adjustScale:t,className:d,transition:i,rect:M,style:{zIndex:m,...o},transform:L},n):null))});function Ji(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function MI(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function md(e){return e!==null&&e>=0}function FI(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 zI(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Zx=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=Ji(t,s,n),c=t[o],u=i[o];return!u||!c?null:{x:u.left-c.left,y:u.top-c.top,scaleX:u.width/c.width,scaleY:u.height/c.height}},hd={scaleX:1,scaleY:1},ey=e=>{var t;let{activeIndex:n,activeNodeRect:s,index:o,rects:i,overIndex:c}=e;const u=(t=i[n])!=null?t:s;if(!u)return null;if(o===n){const m=i[c];return m?{x:0,y:n<c?m.top+m.height-(u.top+u.height):m.top-u.top,...hd}:null}const d=BI(i,o,n);return o>n&&o<=c?{x:0,y:-u.height-d,...hd}:o<n&&o>=c?{x:0,y:u.height+d,...hd}:{x:0,y:0,...hd}};function BI(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 cN="Sortable",uN=Pt.createContext({activeIndex:-1,containerId:cN,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Zx,disabled:{draggable:!1,droppable:!1}});function Zf(e){let{children:t,id:n,items:s,strategy:o=Zx,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:d,over:m,measureDroppableContainers:h}=lN(),g=Fc(cN,n),y=u.rect!==null,b=f.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),N=c!=null,w=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=f.useRef(b),E=!FI(b,k.current),S=v!==-1&&w===-1||E,T=zI(i);ns(()=>{E&&N&&h(b)},[E,b,N,h]),f.useEffect(()=>{k.current=b},[b]);const P=f.useMemo(()=>({activeIndex:w,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:v,useDragOverlay:y,sortedRects:MI(b,d),strategy:o}),[w,g,T.draggable,T.droppable,S,b,v,d,y,o]);return Pt.createElement(uN.Provider,{value:P},t)}const UI=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return Ji(n,s,o).indexOf(t)},WI=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:c,previousItems:u,previousContainerId:d,transition:m}=e;return!m||!s||u!==i&&o===c?!1:n?!0:c!==o&&t===d},VI={duration:200,easing:"ease"},dN="transform",HI=rs.Transition.toString({property:dN,duration:0,easing:"linear"}),KI={roleDescription:"sortable"};function qI(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,c]=f.useState(null),u=f.useRef(n);return ns(()=>{if(!t&&n!==u.current&&s.current){const d=o.current;if(d){const m=qi(s.current,{ignoreTransform:!0}),h={x:d.left-m.left,y:d.top-m.top,scaleX:d.width/m.width,scaleY:d.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,o]),f.useEffect(()=>{i&&c(null)},[i]),i}function ep(e){let{animateLayoutChanges:t=WI,attributes:n,disabled:s,data:o,getNewIndex:i=UI,id:c,strategy:u,resizeObserverConfig:d,transition:m=VI}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:N,sortedRects:w,overIndex:v,useDragOverlay:k,strategy:E}=f.useContext(uN),S=GI(s,b),T=h.indexOf(c),P=f.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...o}),[g,o,T,h]),R=f.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:A,node:L,isOver:M,setNodeRef:F}=SI({id:c,data:P,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:D,activatorEvent:V,activeNodeRect:Y,attributes:_,setNodeRef:z,listeners:H,isDragging:q,over:I,setActivatorNodeRef:K,transform:$}=wI({id:c,data:P,attributes:{...KI,...n},disabled:S.draggable}),W=cL(F,z),ee=!!D,B=ee&&!N&&md(y)&&md(v),ae=!k&&q,ue=ae&&B?$:null,xe=B?ue??(u??E)({rects:w,activeNodeRect:Y,activeIndex:y,overIndex:v,index:T}):null,ke=md(y)&&md(v)?i({id:c,items:h,activeIndex:y,overIndex:v}):T,Re=D==null?void 0:D.id,Ae=f.useRef({activeId:Re,items:h,newIndex:ke,containerId:g}),Qe=h!==Ae.current.items,at=t({active:D,containerId:g,isDragging:q,isSorting:ee,id:c,index:T,items:h,newIndex:Ae.current.newIndex,previousItems:Ae.current.items,previousContainerId:Ae.current.containerId,transition:m,wasDragging:Ae.current.activeId!=null}),Ze=qI({disabled:!at,index:T,node:L,rect:A});return f.useEffect(()=>{ee&&Ae.current.newIndex!==ke&&(Ae.current.newIndex=ke),g!==Ae.current.containerId&&(Ae.current.containerId=g),h!==Ae.current.items&&(Ae.current.items=h)},[ee,ke,g,h]),f.useEffect(()=>{if(Re===Ae.current.activeId)return;if(Re!=null&&Ae.current.activeId==null){Ae.current.activeId=Re;return}const Z=setTimeout(()=>{Ae.current.activeId=Re},50);return()=>clearTimeout(Z)},[Re]),{active:D,activeIndex:y,attributes:_,data:P,rect:A,index:T,newIndex:ke,items:h,isOver:M,isSorting:ee,isDragging:q,listeners:H,node:L,overIndex:v,over:I,setNodeRef:W,setActivatorNodeRef:K,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:Ze??xe,transition:ot()};function ot(){if(Ze||Qe&&Ae.current.newIndex===T)return HI;if(!(ae&&!Kf(V)||!m)&&(ee||at))return rs.Transition.toString({...m,property:dN})}}function GI(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 of(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 YI=[wt.Down,wt.Right,wt.Up,wt.Left],fN=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:o,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(YI.includes(e.code)){if(e.preventDefault(),!n||!s)return;const d=[];i.getEnabled().forEach(g=>{if(!g||g!=null&&g.disabled)return;const y=o.get(g.id);if(y)switch(e.code){case wt.Down:s.top<y.top&&d.push(g);break;case wt.Up:s.top>y.top&&d.push(g);break;case wt.Left:s.left>y.left&&d.push(g);break;case wt.Right:s.left<y.left&&d.push(g);break}});const m=NL({collisionRect:s,droppableRects:o,droppableContainers:d});let h=KS(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=i.get(n.id),y=i.get(h),b=y?o.get(y.id):null,N=y==null?void 0:y.node.current;if(N&&b&&g&&y){const v=Yf(N).some((R,A)=>u[A]!==R),k=pN(g,y),E=JI(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:vc(T,S)}}}};function pN(e,t){return!of(e)||!of(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function JI(e,t){return!of(e)||!of(t)||!pN(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 Od({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 QI({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(We,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Ce,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,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(Od,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const Lh={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."},la={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 XI(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function ZI({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:la.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:Lh.clean}),r.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),r.jsx("div",{className:"mt-4",children:r.jsx(Ce,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:la.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,o=(s==null?void 0:s.assignmentTitle)??"",i=Lh[e.copyKey]??Lh[e.kind],c=XI(i,{total:e.total,title:o}),u=s?eO(s,n):`${n}/assignments`;return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:"What needs you today"}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:c}),s?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",r.jsx("span",{className:"font-medium text-foreground",children:s.projectTitle??"Standalone"})," ","· status ",r.jsx("span",{className:"font-medium text-foreground",children:s.status})]}):null,r.jsx("div",{className:"mt-4",children:r.jsxs(Ce,{to:u,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function eO(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const ty=["kanban","list","table"],mN=["title","status","priority","assignee","dependencies","created","updated"],tO=["asc","desc"],nO=["comfortable","compact"],rO=["none","status","type","priority","assignee","project"],sO=["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 oO(e,t){const n=Fe(e),s=Fe(t);return n.length===s.length&&n.every(o=>s.includes(o))}const aO={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},jc={version:1,global:aO,projects:{}};function Ih(e){return e==="table"?"table":"kanban"}function iO(e,t){return t?{...e,...t}:{...e}}function hN(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:iO(n.filters,s.filters)}:n}const lO=/^[A-Za-z_][A-Za-z0-9_-]*$/,cO=new Set(["and","or","not"]);function gN(e){return lO.test(e)&&!cO.has(e.toLowerCase())?e:xN(e)}function xN(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const yN="__unassigned__",bN="__standalone__",uO={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function dO(e){return e.startsWith("older_")?"<":">="}const ny=["status","type","priority","assignee","project","tags"],fO=["created","updated"];function pO(e){var i;const t={};for(const c of ny){const u=Fe(e[c]);u.length&&(t[c]=u)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let s=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const c=mO(o);if(c)s||(s=c);else{const u=hO(o);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function mO(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function hO(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 ic(e){const t=pO(e),n=[];for(const s of ny){const o=t[s]??[];o.length&&n.push(gO(s,o))}return t.search&&n.push(`search:${xN(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...yO(t.dateRange)),n.join(" AND ")}function gO(e,t){const n=t.map(s=>xO(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function xO(e,t){return e==="assignee"&&t===yN||e==="project"&&t===bN?"none":gN(t)}function yO(e){if(e.preset)return[`${e.field} ${dO(e.preset)} -${uO[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function lc(e){const t=Ff(e);if(!t.ast)return null;const n=bO(t.ast);if(n===null)return null;const s={},o=new Set,i=new Map;for(const c of n){const u=vO(c);if(!u)return null;switch(u.kind){case"value":{if(o.has(u.field))return null;o.add(u.field),s[u.field]=u.values;break}case"search":{if(o.has("search"))return null;o.add("search"),s.search=u.text;break}case"activity":{if(o.has("activity"))return null;o.add("activity"),s.activity=u.activity;break}case"datePreset":{const d=`date:${u.field}`;if(o.has(d)||i.has(u.field))return null;o.add(d),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const d=`date:${u.field}`;if(o.has(d))return null;const m=i.get(u.field)??{};if(u.bound==="from"){if(m.from!==void 0)return null;m.from=u.date}else{if(m.to!==void 0)return null;m.to=u.date}i.set(u.field,m);break}}}if(i.size>1)return null;for(const[c,u]of i){if(s.dateRange)return null;const d={field:c};u.from!==void 0&&(d.from=u.from),u.to!==void 0&&(d.to=u.to),s.dateRange=d}return s}function bO(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 vO(e){const t=e.field.toLowerCase();if(e.op===":"){if(ny.includes(t)){const o=t,i=[];for(const c of e.values){const u=NO(o,c);if(u===null)return null;i.push(u)}return i.length===0?null:{kind:"value",field:o,values:i}}return t==="search"?e.values.length!==1?null:{kind:"search",text:e.values[0].raw}:null}if(!fO.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?wO(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 wO(e,t,n){if(n.sign!==-1)return null;const s=jO(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=SO(t,s);return o?{kind:"datePreset",field:e,preset:o}:null}function jO(e){return e.replace(/^[-+]/,"")}const kO={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function SO(e,t){return e!==">="&&e!=="<"?null:kO[e][t]??null}function NO(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?yN:e==="project"&&n.toLowerCase()==="none"?bN:n}const Oh=["title","status","priority","assignee","dependencies","created","updated"],kc=24,vN=60;function CO(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=kc&&Number.isInteger(t.h)&&t.h>=1&&t.h<=vN}const EO={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},vj="2026-05-21T00:00:00Z";function _h(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...EO,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:vj,updatedAt:vj}}const wo={version:1,views:[_h("default-recently-updated","Recently updated",{}),_h("default-high-priority","High priority",{priority:"high"}),_h("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 wN(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,c=e.filters.query,u=typeof c=="string"&&c.trim().length>0&&lc(c)===null;return s&&(!o||o==="all")&&!i&&!u}function jN(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?wN(e.config,t.slug):!1}}const kN=`syntaur.savedViews.cache.v${wo.version}`;let Si=TO(),Zo=null,ry=null;const $g=new Set,af=new Set;let SN=0;function NN(){return++SN}function Lg(e){return e===SN}function TO(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(kN);if(!e)return null;const t=JSON.parse(e);return t.version!==wo.version?null:t}catch{return null}}function RO(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(kN,JSON.stringify(e))}catch{}}function CN(e){Si=e,ry=null,RO(e);for(const t of $g)t(e);for(const t of af)t(null)}function AO(e){ry=e;for(const t of af)t(e)}function EN(e){if(!e||typeof e!="object")return wo;const t=e;return t.version!==wo.version||!Array.isArray(t.views)||!t.dashboard?wo:t}function wj(){if(Zo)return Zo;const e=NN();return Zo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=EN(t);return Lg(e)&&CN(n),Zo=null,Si??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Lg(e)&&AO(n),Zo=null,Si??wo}),Zo}function sy(){const[e,t]=f.useState(()=>Si??wo),[n,s]=f.useState(()=>Si===null),[o,i]=f.useState(!1),[c,u]=f.useState(()=>ry);return f.useEffect(()=>{let m=!1;Si===null&&s(!0),wj().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 $g.add(h),af.add(g),()=>{m=!0,$g.delete(h),af.delete(g)}},[]),{file:e,loading:n,ready:o,error:c,refetch:()=>{Zo=null,s(!0),u(null),i(!1),wj()}}}function Bc(){const{file:e,loading:t}=sy();return{views:e.views,loading:t}}function TN(){const{file:e,loading:t}=sy();return{layout:e.dashboard,loading:t}}function So(e){const{file:t,loading:n,ready:s,error:o,refetch:i}=sy();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 tp(e,t,n){const s=NN(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const c=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(c.error??`HTTP ${o.status}`)}const i=EN(await o.json());return Lg(s)&&CN(i),i}function $i(e){return tp("POST","/api/saved-views",e)}function lf(e,t){return tp("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function PO(e){return tp("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Ig(e){return tp("PUT","/api/dashboard",{slots:e})}const DO=["top","right","bottom","left"],No=Math.min,Sr=Math.max,cf=Math.round,gd=Math.floor,Ss=e=>({x:e,y:e}),$O={left:"right",right:"left",bottom:"top",top:"bottom"};function Og(e,t,n){return Sr(e,No(t,n))}function Ws(e,t){return typeof e=="function"?e(t):e}function Vs(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function oy(e){return e==="x"?"y":"x"}function ay(e){return e==="y"?"height":"width"}function ws(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function iy(e){return oy(ws(e))}function LO(e,t,n){n===void 0&&(n=!1);const s=Qi(e),o=iy(e),i=ay(o);let c=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=uf(c)),[c,uf(c)]}function IO(e){const t=uf(e);return[_g(e),t,_g(t)]}function _g(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const jj=["left","right"],kj=["right","left"],OO=["top","bottom"],_O=["bottom","top"];function MO(e,t,n){switch(e){case"top":case"bottom":return n?t?kj:jj:t?jj:kj;case"left":case"right":return t?OO:_O;default:return[]}}function FO(e,t,n,s){const o=Qi(e);let i=MO(Vs(e),n==="start",s);return o&&(i=i.map(c=>c+"-"+o),t&&(i=i.concat(i.map(_g)))),i}function uf(e){const t=Vs(e);return $O[t]+e.slice(t.length)}function zO(e){return{top:0,right:0,bottom:0,left:0,...e}}function RN(e){return typeof e!="number"?zO(e):{top:e,right:e,bottom:e,left:e}}function df(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 Sj(e,t,n){let{reference:s,floating:o}=e;const i=ws(t),c=iy(t),u=ay(c),d=Vs(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(Qi(t)){case"start":b[c]-=y*(n&&m?-1:1);break;case"end":b[c]+=y*(n&&m?-1:1);break}return b}async function BO(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:c,elements:u,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Ws(t,e),N=RN(b),v=u[y?g==="floating"?"reference":"floating":g],k=df(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(u.floating)),boundary:m,rootBoundary:h,strategy:d})),E=g==="floating"?{x:s,y:o,width:c.floating.width,height:c.floating.height}:c.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},P=df(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:S,strategy:d}):E);return{top:(k.top-P.top+N.top)/T.y,bottom:(P.bottom-k.bottom+N.bottom)/T.y,left:(k.left-P.left+N.left)/T.x,right:(P.right-k.right+N.right)/T.x}}const UO=50,WO=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:BO},d=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:g}=Sj(m,s,d),y=s,b=0;const N={};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:P,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:o,middlewareData:N,rects:m,platform:u,elements:{reference:e,floating:t}});h=S??h,g=T??g,N[k]={...N[k],...P},R&&b<UO&&(b++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(m=R.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):R.rects),{x:h,y:g}=Sj(m,y,d)),w=-1)}return{x:h,y:g,placement:y,strategy:o,middlewareData:N}},VO=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:c,elements:u,middlewareData:d}=t,{element:m,padding:h=0}=Ws(e,t)||{};if(m==null)return{};const g=RN(h),y={x:n,y:s},b=iy(o),N=ay(b),w=await c.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",S=v?"clientHeight":"clientWidth",T=i.reference[N]+i.reference[b]-y[b]-i.floating[N],P=y[b]-i.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let A=R?R[S]:0;(!A||!await(c.isElement==null?void 0:c.isElement(R)))&&(A=u.floating[S]||i.floating[N]);const L=T/2-P/2,M=A/2-w[N]/2-1,F=No(g[k],M),D=No(g[E],M),V=F,Y=A-w[N]-D,_=A/2-w[N]/2+L,z=Og(V,_,Y),H=!d.arrow&&Qi(o)!=null&&_!==z&&i.reference[N]/2-(_<V?F:D)-w[N]/2<0,q=H?_<V?_-V:_-Y:0;return{[b]:y[b]+q,data:{[b]:z,centerOffset:_-z-q,...H&&{alignmentOffset:q}},reset:H}}}),HO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:c,initialPlacement:u,platform:d,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:w=!0,...v}=Ws(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Vs(o),E=ws(u),S=Vs(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(m.floating)),P=y||(S||!w?[uf(u)]:IO(u)),R=N!=="none";!y&&R&&P.push(...FO(u,w,N,T));const A=[u,...P],L=await d.detectOverflow(t,v),M=[];let F=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&M.push(L[k]),g){const _=LO(o,c,T);M.push(L[_[0]],L[_[1]])}if(F=[...F,{placement:o,overflows:M}],!M.every(_=>_<=0)){var D,V;const _=(((D=i.flip)==null?void 0:D.index)||0)+1,z=A[_];if(z&&(!(g==="alignment"?E!==ws(z):!1)||F.every(I=>ws(I.placement)===E?I.overflows[0]>0:!0)))return{data:{index:_,overflows:F},reset:{placement:z}};let H=(V=F.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:V.placement;if(!H)switch(b){case"bestFit":{var Y;const q=(Y=F.filter(I=>{if(R){const K=ws(I.placement);return K===E||K==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(K=>K>0).reduce((K,$)=>K+$,0)]).sort((I,K)=>I[1]-K[1])[0])==null?void 0:Y[0];q&&(H=q);break}case"initialPlacement":H=u;break}if(o!==H)return{reset:{placement:H}}}return{}}}};function Nj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cj(e){return DO.some(t=>e[t]>=0)}const KO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=Ws(e,t);switch(o){case"referenceHidden":{const c=await s.detectOverflow(t,{...i,elementContext:"reference"}),u=Nj(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Cj(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...i,altBoundary:!0}),u=Nj(c,n.floating);return{data:{escapedOffsets:u,escaped:Cj(u)}}}default:return{}}}}},AN=new Set(["left","top"]);async function qO(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),c=Vs(n),u=Qi(n),d=ws(n)==="y",m=AN.has(c)?-1:1,h=i&&d?-1:1,g=Ws(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:N}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof N=="number"&&(b=u==="end"?N*-1:N),d?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const GO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:c,middlewareData:u}=t,d=await qO(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,placement:c}}}}},YO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...m}=Ws(e,t),h={x:n,y:s},g=await i.detectOverflow(t,m),y=ws(Vs(o)),b=oy(y);let N=h[b],w=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",S=N+g[k],T=N-g[E];N=Og(S,N,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",S=w+g[k],T=w-g[E];w=Og(S,w,T)}const v=d.fn({...t,[b]:N,[y]:w});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},JO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:m=!0}=Ws(e,t),h={x:n,y:s},g=ws(o),y=oy(g);let b=h[y],N=h[g];const w=Ws(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,P=i.reference[y]+i.reference[S]-v.mainAxis;b<T?b=T:b>P&&(b=P)}if(m){var k,E;const S=y==="y"?"width":"height",T=AN.has(Vs(o)),P=i.reference[g]-i.floating[S]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=i.reference[g]+i.reference[S]+(T?0:((E=c.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);N<P?N=P:N>R&&(N=R)}return{[y]:b,[g]:N}}}},QO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:c,elements:u}=t,{apply:d=()=>{},...m}=Ws(e,t),h=await c.detectOverflow(t,m),g=Vs(o),y=Qi(o),b=ws(o)==="y",{width:N,height:w}=i.floating;let v,k;g==="top"||g==="bottom"?(v=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,v=y==="end"?"top":"bottom");const E=w-h.top-h.bottom,S=N-h.left-h.right,T=No(w-h[v],E),P=No(N-h[k],S),R=!t.middlewareData.shift;let A=T,L=P;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=S),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(A=E),R&&!y){const F=Sr(h.left,0),D=Sr(h.right,0),V=Sr(h.top,0),Y=Sr(h.bottom,0);b?L=N-2*(F!==0||D!==0?F+D:Sr(h.left,h.right)):A=w-2*(V!==0||Y!==0?V+Y:Sr(h.top,h.bottom))}await d({...t,availableWidth:L,availableHeight:A});const M=await c.getDimensions(u.floating);return N!==M.width||w!==M.height?{reset:{rects:!0}}:{}}}};function np(){return typeof window<"u"}function Xi(e){return PN(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Es(e){var t;return(t=(PN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function PN(e){return np()?e instanceof Node||e instanceof Tr(e).Node:!1}function os(e){return np()?e instanceof Element||e instanceof Tr(e).Element:!1}function Ks(e){return np()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function Ej(e){return!np()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}function Uc(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=as(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function XO(e){return/^(table|td|th)$/.test(Xi(e))}function rp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ZO=/transform|translate|scale|rotate|perspective|filter/,e5=/paint|layout|strict|content/,Jo=e=>!!e&&e!=="none";let Mh;function ly(e){const t=os(e)?as(e):e;return Jo(t.transform)||Jo(t.translate)||Jo(t.scale)||Jo(t.rotate)||Jo(t.perspective)||!cy()&&(Jo(t.backdropFilter)||Jo(t.filter))||ZO.test(t.willChange||"")||e5.test(t.contain||"")}function t5(e){let t=Co(e);for(;Ks(t)&&!Li(t);){if(ly(t))return t;if(rp(t))return null;t=Co(t)}return null}function cy(){return Mh==null&&(Mh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Mh}function Li(e){return/^(html|body|#document)$/.test(Xi(e))}function as(e){return Tr(e).getComputedStyle(e)}function sp(e){return os(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Co(e){if(Xi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ej(e)&&e.host||Es(e);return Ej(t)?t.host:t}function DN(e){const t=Co(e);return Li(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&Uc(t)?t:DN(t)}function Sc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=DN(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),c=Tr(o);if(i){const u=Mg(c);return t.concat(c,c.visualViewport||[],Uc(o)?o:[],u&&n?Sc(u):[])}else return t.concat(o,Sc(o,[],n))}function Mg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $N(e){const t=as(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Ks(e),i=o?e.offsetWidth:n,c=o?e.offsetHeight:s,u=cf(n)!==i||cf(s)!==c;return u&&(n=i,s=c),{width:n,height:s,$:u}}function uy(e){return os(e)?e:e.contextElement}function Ni(e){const t=uy(e);if(!Ks(t))return Ss(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=$N(t);let c=(i?cf(n.width):n.width)/s,u=(i?cf(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const n5=Ss(0);function LN(e){const t=Tr(e);return!cy()||!t.visualViewport?n5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function r5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function pa(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=uy(e);let c=Ss(1);t&&(s?os(s)&&(c=Ni(s)):c=Ni(e));const u=r5(i,n,s)?LN(i):Ss(0);let d=(o.left+u.x)/c.x,m=(o.top+u.y)/c.y,h=o.width/c.x,g=o.height/c.y;if(i){const y=Tr(i),b=s&&os(s)?Tr(s):s;let N=y,w=Mg(N);for(;w&&s&&b!==N;){const v=Ni(w),k=w.getBoundingClientRect(),E=as(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,N=Tr(w),w=Mg(N)}}return df({width:h,height:g,x:d,y:m})}function op(e,t){const n=sp(e).scrollLeft;return t?t.left+n:pa(Es(e)).left+n}function IN(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-op(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function s5(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",c=Es(s),u=t?rp(t.floating):!1;if(s===c||u&&i)return n;let d={scrollLeft:0,scrollTop:0},m=Ss(1);const h=Ss(0),g=Ks(s);if((g||!g&&!i)&&((Xi(s)!=="body"||Uc(c))&&(d=sp(s)),g)){const b=pa(s);m=Ni(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!i?IN(c,d):Ss(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-d.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-d.scrollTop*m.y+h.y+y.y}}function o5(e){return Array.from(e.getClientRects())}function a5(e){const t=Es(e),n=sp(e),s=e.ownerDocument.body,o=Sr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Sr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+op(e);const u=-n.scrollTop;return as(s).direction==="rtl"&&(c+=Sr(t.clientWidth,s.clientWidth)-o),{width:o,height:i,x:c,y:u}}const Tj=25;function i5(e,t){const n=Tr(e),s=Es(e),o=n.visualViewport;let i=s.clientWidth,c=s.clientHeight,u=0,d=0;if(o){i=o.width,c=o.height;const h=cy();(!h||h&&t==="fixed")&&(u=o.offsetLeft,d=o.offsetTop)}const m=op(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,N=Math.abs(s.clientWidth-g.clientWidth-b);N<=Tj&&(i-=N)}else m<=Tj&&(i+=m);return{width:i,height:c,x:u,y:d}}function l5(e,t){const n=pa(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ks(e)?Ni(e):Ss(1),c=e.clientWidth*i.x,u=e.clientHeight*i.y,d=o*i.x,m=s*i.y;return{width:c,height:u,x:d,y:m}}function Rj(e,t,n){let s;if(t==="viewport")s=i5(e,n);else if(t==="document")s=a5(Es(e));else if(os(t))s=l5(t,n);else{const o=LN(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return df(s)}function ON(e,t){const n=Co(e);return n===t||!os(n)||Li(n)?!1:as(n).position==="fixed"||ON(n,t)}function c5(e,t){const n=t.get(e);if(n)return n;let s=Sc(e,[],!1).filter(u=>os(u)&&Xi(u)!=="body"),o=null;const i=as(e).position==="fixed";let c=i?Co(e):e;for(;os(c)&&!Li(c);){const u=as(c),d=ly(c);!d&&u.position==="fixed"&&(o=null),(i?!d&&!o:!d&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Uc(c)&&!d&&ON(e,c))?s=s.filter(h=>h!==c):o=u,c=Co(c)}return t.set(e,s),s}function u5(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const c=[...n==="clippingAncestors"?rp(t)?[]:c5(t,this._c):[].concat(n),s],u=Rj(t,c[0],o);let d=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=Rj(t,c[y],o);d=Sr(b.top,d),m=No(b.right,m),h=No(b.bottom,h),g=Sr(b.left,g)}return{width:m-g,height:h-d,x:g,y:d}}function d5(e){const{width:t,height:n}=$N(e);return{width:t,height:n}}function f5(e,t,n){const s=Ks(t),o=Es(t),i=n==="fixed",c=pa(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const d=Ss(0);function m(){d.x=op(o)}if(s||!s&&!i)if((Xi(t)!=="body"||Uc(o))&&(u=sp(t)),s){const b=pa(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?IN(o,u):Ss(0),g=c.left+u.scrollLeft-d.x-h.x,y=c.top+u.scrollTop-d.y-h.y;return{x:g,y,width:c.width,height:c.height}}function Fh(e){return as(e).position==="static"}function Aj(e,t){if(!Ks(e)||as(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Es(e)===n&&(n=n.ownerDocument.body),n}function _N(e,t){const n=Tr(e);if(rp(e))return n;if(!Ks(e)){let o=Co(e);for(;o&&!Li(o);){if(os(o)&&!Fh(o))return o;o=Co(o)}return n}let s=Aj(e,t);for(;s&&XO(s)&&Fh(s);)s=Aj(s,t);return s&&Li(s)&&Fh(s)&&!ly(s)?n:s||t5(e)||n}const p5=async function(e){const t=this.getOffsetParent||_N,n=this.getDimensions,s=await n(e.floating);return{reference:f5(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function m5(e){return as(e).direction==="rtl"}const h5={convertOffsetParentRelativeRectToViewportRelativeRect:s5,getDocumentElement:Es,getClippingRect:u5,getOffsetParent:_N,getElementRects:p5,getClientRects:o5,getDimensions:d5,getScale:Ni,isElement:os,isRTL:m5};function MN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function g5(e,t){let n=null,s;const o=Es(e);function i(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),i();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const N=gd(g),w=gd(o.clientWidth-(h+y)),v=gd(o.clientHeight-(g+b)),k=gd(h),S={rootMargin:-N+"px "+-w+"px "+-v+"px "+-k+"px",threshold:Sr(0,No(1,d))||1};let T=!0;function P(R){const A=R[0].intersectionRatio;if(A!==d){if(!T)return c();A?c(!1,A):s=setTimeout(()=>{c(!1,1e-7)},1e3)}A===1&&!MN(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(P,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(P,S)}n.observe(e)}return c(!0),i}function x5(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,m=uy(e),h=o||i?[...m?Sc(m):[],...t?Sc(t):[]]:[];h.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const g=m&&u?g5(m,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&b&&t&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var S;(S=b)==null||S.observe(t)})),n()}),m&&!d&&b.observe(m),t&&b.observe(t));let N,w=d?pa(e):null;d&&v();function v(){const k=pa(e);w&&!MN(w,k)&&n(),w=k,N=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(N)}}const y5=GO,b5=YO,v5=HO,w5=QO,j5=KO,Pj=VO,k5=JO,S5=(e,t,n)=>{const s=new Map,o={platform:h5,...n},i={...o.platform,_c:s};return WO(e,t,{...o,platform:i})};var N5=typeof document<"u",C5=function(){},_d=N5?f.useLayoutEffect:C5;function ff(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(!ff(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)&&!ff(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function FN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dj(e,t){const n=FN(e);return Math.round(t*n)/n}function zh(e){const t=f.useRef(e);return _d(()=>{t.current=e}),t}function E5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:i,floating:c}={},transform:u=!0,whileElementsMounted:d,open:m}=e,[h,g]=f.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=f.useState(s);ff(y,s)||b(s);const[N,w]=f.useState(null),[v,k]=f.useState(null),E=f.useCallback(I=>{I!==R.current&&(R.current=I,w(I))},[]),S=f.useCallback(I=>{I!==A.current&&(A.current=I,k(I))},[]),T=i||N,P=c||v,R=f.useRef(null),A=f.useRef(null),L=f.useRef(h),M=d!=null,F=zh(d),D=zh(o),V=zh(m),Y=f.useCallback(()=>{if(!R.current||!A.current)return;const I={placement:t,strategy:n,middleware:y};D.current&&(I.platform=D.current),S5(R.current,A.current,I).then(K=>{const $={...K,isPositioned:V.current!==!1};_.current&&!ff(L.current,$)&&(L.current=$,Fs.flushSync(()=>{g($)}))})},[y,t,n,D,V]);_d(()=>{m===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,g(I=>({...I,isPositioned:!1})))},[m]);const _=f.useRef(!1);_d(()=>(_.current=!0,()=>{_.current=!1}),[]),_d(()=>{if(T&&(R.current=T),P&&(A.current=P),T&&P){if(F.current)return F.current(T,P,Y);Y()}},[T,P,Y,F,M]);const z=f.useMemo(()=>({reference:R,floating:A,setReference:E,setFloating:S}),[E,S]),H=f.useMemo(()=>({reference:T,floating:P}),[T,P]),q=f.useMemo(()=>{const I={position:n,left:0,top:0};if(!H.floating)return I;const K=Dj(H.floating,h.x),$=Dj(H.floating,h.y);return u?{...I,transform:"translate("+K+"px, "+$+"px)",...FN(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:$}},[n,u,H.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:Y,refs:z,elements:H,floatingStyles:q}),[h,Y,z,H,q])}const T5=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?Pj({element:s.current,padding:o}).fn(n):{}:s?Pj({element:s,padding:o}).fn(n):{}}}},R5=(e,t)=>{const n=y5(e);return{name:n.name,fn:n.fn,options:[e,t]}},A5=(e,t)=>{const n=b5(e);return{name:n.name,fn:n.fn,options:[e,t]}},P5=(e,t)=>({fn:k5(e).fn,options:[e,t]}),D5=(e,t)=>{const n=v5(e);return{name:n.name,fn:n.fn,options:[e,t]}},$5=(e,t)=>{const n=w5(e);return{name:n.name,fn:n.fn,options:[e,t]}},L5=(e,t)=>{const n=j5(e);return{name:n.name,fn:n.fn,options:[e,t]}},I5=(e,t)=>{const n=T5(e);return{name:n.name,fn:n.fn,options:[e,t]}};var O5="Arrow",zN=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"})})});zN.displayName=O5;var _5=zN;function M5(e){const[t,n]=f.useState(void 0);return jo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let c,u;if("borderBoxSize"in i){const d=i.borderBoxSize,m=Array.isArray(d)?d[0]:d;c=m.inlineSize,u=m.blockSize}else c=e.offsetWidth,u=e.offsetHeight;n({width:c,height:u})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var dy="Popper",[BN,UN]=ha(dy),[F5,WN]=BN(dy),VN=e=>{const{__scopePopper:t,children:n}=e,[s,o]=f.useState(null);return r.jsx(F5,{scope:t,anchor:s,onAnchorChange:o,children:n})};VN.displayName=dy;var HN="PopperAnchor",KN=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=WN(HN,n),c=f.useRef(null),u=Kn(t,c),d=f.useRef(null);return f.useEffect(()=>{const m=d.current;d.current=(s==null?void 0:s.current)||c.current,m!==d.current&&i.onAnchorChange(d.current)}),s?null:r.jsx(vn.div,{...o,ref:u})});KN.displayName=HN;var fy="PopperContent",[z5,B5]=BN(fy),qN=f.forwardRef((e,t)=>{var xe,ke,Re,Ae,Qe,at;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:N,...w}=e,v=WN(fy,n),[k,E]=f.useState(null),S=Kn(t,Ze=>E(Ze)),[T,P]=f.useState(null),R=M5(T),A=(R==null?void 0:R.width)??0,L=(R==null?void 0:R.height)??0,M=s+(i!=="center"?"-"+i:""),F=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},D=Array.isArray(m)?m:[m],V=D.length>0,Y={padding:F,boundary:D.filter(W5),altBoundary:V},{refs:_,floatingStyles:z,placement:H,isPositioned:q,middlewareData:I}=E5({strategy:"fixed",placement:M,whileElementsMounted:(...Ze)=>x5(...Ze,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[R5({mainAxis:o+L,alignmentAxis:c}),d&&A5({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?P5():void 0,...Y}),d&&D5({...Y}),$5({...Y,apply:({elements:Ze,rects:ot,availableWidth:Z,availableHeight:_e})=>{const{width:Ee,height:Ie}=ot.reference,Ye=Ze.floating.style;Ye.setProperty("--radix-popper-available-width",`${Z}px`),Ye.setProperty("--radix-popper-available-height",`${_e}px`),Ye.setProperty("--radix-popper-anchor-width",`${Ee}px`),Ye.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),T&&I5({element:T,padding:u}),V5({arrowWidth:A,arrowHeight:L}),y&&L5({strategy:"referenceHidden",...Y})]}),[K,$]=JN(H),W=da(N);jo(()=>{q&&(W==null||W())},[q,W]);const ee=(xe=I.arrow)==null?void 0:xe.x,B=(ke=I.arrow)==null?void 0:ke.y,ae=((Re=I.arrow)==null?void 0:Re.centerOffset)!==0,[ue,se]=f.useState();return jo(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(Ae=I.transformOrigin)==null?void 0:Ae.x,(Qe=I.transformOrigin)==null?void 0:Qe.y].join(" "),...((at=I.hide)==null?void 0:at.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(z5,{scope:n,placedSide:K,onArrowChange:P,arrowX:ee,arrowY:B,shouldHideArrow:ae,children:r.jsx(vn.div,{"data-side":K,"data-align":$,...w,ref:S,style:{...w.style,animation:q?void 0:"none"}})})})});qN.displayName=fy;var GN="PopperArrow",U5={top:"bottom",right:"left",bottom:"top",left:"right"},YN=f.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=B5(GN,s),c=U5[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(_5,{...o,ref:n,style:{...o.style,display:"block"}})})});YN.displayName=GN;function W5(e){return e!==null}var V5=e=>({name:"transformOrigin",options:e,fn(t){var v,k,E;const{placement:n,rects:s,middlewareData:o}=t,c=((v=o.arrow)==null?void 0:v.centerOffset)!==0,u=c?0:e.arrowWidth,d=c?0:e.arrowHeight,[m,h]=JN(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 N="",w="";return m==="bottom"?(N=c?g:`${y}px`,w=`${-d}px`):m==="top"?(N=c?g:`${y}px`,w=`${s.floating.height+d}px`):m==="right"?(N=`${-d}px`,w=c?g:`${b}px`):m==="left"&&(N=`${s.floating.width+d}px`,w=c?g:`${b}px`),{data:{x:N,y:w}}}});function JN(e){const[t,n="center"]=e.split("-");return[t,n]}var H5=VN,K5=KN,q5=qN,G5=YN,Y5=Symbol("radix.slottable");function J5(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Y5,t}var Q5=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"}),X5="VisuallyHidden",QN=f.forwardRef((e,t)=>r.jsx(vn.span,{...e,ref:t,style:{...Q5,...e.style}}));QN.displayName=X5;var Z5=QN,[ap]=ha("Tooltip",[UN]),ip=UN(),XN="TooltipProvider",e_=700,Fg="tooltip.open",[t_,py]=ap(XN),ZN=e=>{const{__scopeTooltip:t,delayDuration:n=e_,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,c=f.useRef(!0),u=f.useRef(!1),d=f.useRef(0);return f.useEffect(()=>{const m=d.current;return()=>window.clearTimeout(m)},[]),r.jsx(t_,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:f.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:f.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:f.useCallback(m=>{u.current=m},[]),disableHoverableContent:o,children:i})};ZN.displayName=XN;var Nc="Tooltip",[n_,Wc]=ap(Nc),eC=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:c,delayDuration:u}=e,d=py(Nc,e.__scopeTooltip),m=ip(t),[h,g]=f.useState(null),y=vi(),b=f.useRef(0),N=c??d.disableHoverableContent,w=u??d.delayDuration,v=f.useRef(!1),[k,E]=Bf({prop:s,defaultProp:o??!1,onChange:A=>{A?(d.onOpen(),document.dispatchEvent(new CustomEvent(Fg))):d.onClose(),i==null||i(A)},caller:Nc}),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]),P=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(H5,{...m,children:r.jsx(n_,{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(()=>{N?P():(window.clearTimeout(b.current),b.current=0)},[P,N]),onOpen:T,onClose:P,disableHoverableContent:N,children:n})})};eC.displayName=Nc;var zg="TooltipTrigger",tC=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Wc(zg,n),i=py(zg,n),c=ip(n),u=f.useRef(null),d=Kn(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(K5,{asChild:!0,...c,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)})})});tC.displayName=zg;var my="TooltipPortal",[r_,s_]=ap(my,{forceMount:void 0}),nC=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=Wc(my,t);return r.jsx(r_,{scope:t,forceMount:n,children:r.jsx(ga,{present:n||i.open,children:r.jsx(Lx,{asChild:!0,container:o,children:s})})})};nC.displayName=my;var Ii="TooltipContent",rC=f.forwardRef((e,t)=>{const n=s_(Ii,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,c=Wc(Ii,e.__scopeTooltip);return r.jsx(ga,{present:s||c.open,children:c.disableHoverableContent?r.jsx(sC,{side:o,...i,ref:t}):r.jsx(o_,{side:o,...i,ref:t})})}),o_=f.forwardRef((e,t)=>{const n=Wc(Ii,e.__scopeTooltip),s=py(Ii,e.__scopeTooltip),o=f.useRef(null),i=Kn(t,o),[c,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((N,w)=>{const v=N.currentTarget,k={x:N.clientX,y:N.clientY},E=u_(k,v.getBoundingClientRect()),S=d_(k,E),T=f_(w.getBoundingClientRect()),P=m_([...S,...T]);u(P),g(!0)},[g]);return f.useEffect(()=>()=>y(),[y]),f.useEffect(()=>{if(d&&h){const N=v=>b(v,h),w=v=>b(v,d);return d.addEventListener("pointerleave",N),h.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",N),h.removeEventListener("pointerleave",w)}}},[d,h,b,y]),f.useEffect(()=>{if(c){const N=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=!p_(k,c);E?y():S&&(y(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[d,h,c,m,y]),r.jsx(sC,{...e,ref:i})}),[a_,i_]=ap(Nc,{isInside:!1}),l_=J5("TooltipContent"),sC=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:c,...u}=e,d=Wc(Ii,n),m=ip(n),{onClose:h}=d;return f.useEffect(()=>(document.addEventListener(Fg,h),()=>document.removeEventListener(Fg,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($x,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(q5,{"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(l_,{children:s}),r.jsx(a_,{scope:n,isInside:!0,children:r.jsx(Z5,{id:d.contentId,role:"tooltip",children:o||s})})]})})});rC.displayName=Ii;var oC="TooltipArrow",c_=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=ip(n);return i_(oC,n).isInside?null:r.jsx(G5,{...o,...s,ref:t})});c_.displayName=oC;function u_(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 d_(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 f_(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 p_(e,t){const{x:n,y:s}=e;let o=!1;for(let i=0,c=t.length-1;i<t.length;c=i++){const u=t[i],d=t[c],m=u.x,h=u.y,g=d.x,y=d.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(o=!o)}return o}function m_(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),h_(t)}function h_(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const i=t[t.length-1],c=t[t.length-2];if((i.x-c.x)*(o.y-c.y)>=(i.y-c.y)*(o.x-c.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const i=n[n.length-1],c=n[n.length-2];if((i.x-c.x)*(o.y-c.y)>=(i.y-c.y)*(o.x-c.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var g_=ZN,x_=eC,y_=tC,b_=nC,aC=rC;const ca=g_,Nr=x_,Cr=y_,ur=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(b_,{children:r.jsx(aC,{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})}));ur.displayName=aC.displayName;function hy({items:e,align:t="end"}){const[n,s]=f.useState(!1),[o,i]=f.useState(null),c=f.useRef(null);if(f.useEffect(()=>{if(!n){i(null);return}function d(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(d,m){const h=d.icon,g=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(Rr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):r.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):h?r.jsx(h,{className:"h-4 w-4 shrink-0"}):null,b=r.jsxs(r.Fragment,{children:[y,r.jsx("span",{className:"block min-w-0 truncate",children:d.label})]});if(d.disabled){const N=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return d.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:N}),r.jsx(ur,{side:"left",children:d.disabledReason})]},d.key):r.jsx("div",{children:N},d.key)}return d.href?r.jsx(Ce,{to:d.href,className:g,onClick:()=>s(!1),children:b},d.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var N;(N=d.onSelect)==null||N.call(d),s(!1)},children:b},d.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(d=>!d),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx(fP,{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(ca,{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(pr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(Vk,{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 $j(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const v_={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 w_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function j_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function k_(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=v_[t.preset];return u===void 0?!0:t.preset.startsWith("older_")?n-o>u:o>=n-u&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,c=t.to&&t.to.length>0?t.to:void 0;return!i&&!c?!0:!(i&&o<w_(i)||c&&o>j_(c))}function S_(e,t,n={}){const{workspace:s,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const c=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(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||d.length&&!d.includes(e.type??"")||y==="stale"&&!$j(e.updated)||y==="fresh"&&$j(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(N=>N==="__standalone__"?e.projectSlug==null:e.projectSlug===N))return!1;if(g.length){const b=e.tags??[];if(!g.some(N=>b.includes(N)))return!1}if(!k_(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 Cc(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const Md={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 N_(e,t,n=()=>null){const s=[],o=new Set(t.statuses.map(u=>u.id));e.phaseLadder.length===0&&s.push("phaseLadder must have at least one rung");for(const u of e.phaseLadder){o.has(u.phase)||s.push(`phaseLadder rung "${u.phase}" is not a defined status id`);const d=u.when==="*"?null:n(u.when);d&&s.push(`phaseLadder rung "${u.phase}": invalid condition — ${d}`)}const i=new Set(["active","blocked","parked"]);for(const u of e.disposition)if(i.has(u.is)||s.push(`disposition "${u.is}" is not valid (expected active, blocked, or parked — terminal is never a rule)`),u.when!==null){const d=n(u.when);d&&s.push(`disposition rule "${u.is}": invalid condition — ${d}`)}const c=e.disposition.map((u,d)=>u.when===null?d:-1).filter(u=>u>=0);c.length===0?s.push("disposition rules must end with an `else:` arm (a rule with when: null)"):c.length>1?s.push("disposition rules must have exactly one `else:` arm (when: null)"):c[0]!==e.disposition.length-1&&s.push("the `else:` arm (when: null) must be the LAST disposition rule — rules after it are unreachable");for(const u of["parked","blocked"])o.has(e.headline[u])||s.push(`headline.${u} → "${e.headline[u]}" is not a defined status id (add the definition or run migrate-derive)`);return s}const iC={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:Md,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let cc=null,ea=null;function C_(){return cc?Promise.resolve(cc):ea||(ea=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(cc=e,ea=null,e)).catch(()=>(ea=null,iC)),ea)}function xa(){const[e,t]=f.useState(()=>cc??iC);return f.useEffect(()=>{C_().then(t)},[]),e}function Lj(){cc=null,ea=null}function Vc(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 Ij={critical:0,high:1,medium:2,low:3};function xd(e){return Date.parse(e??"")||0}function Hc(e,t,n){return[...e].sort((o,i)=>{let c=0;switch(t){case"title":c=o.title.localeCompare(i.title);break;case"status":c=o.status.localeCompare(i.status);break;case"priority":c=(Ij[o.priority]??99)-(Ij[i.priority]??99);break;case"assignee":c=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":c=o.dependsOn.length-i.dependsOn.length;break;case"created":c=xd(o.created)-xd(i.created);break;case"updated":c=xd(o.updated)-xd(i.updated);break}return n==="asc"?c:-c})}function E_(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 lC(e,t,n={}){const{workspace:s,includeArchived:o=!1,now:i=Date.now()}=n,c={now:i};return e.filter(u=>{if(u.archived===!0&&!o)return!1;if(s){if(s==="_ungrouped"){if(u.projectWorkspace!=null)return!1}else if(u.projectWorkspace!==s)return!1}if(!t)return!0;const d=E_(u);return t.predicate(d,c)})}const lp={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 cp(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 T_(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 Bg(e){const t=[],n=new Map;for(const s of Object.keys(lp))n.set(s,"built-in");for(const s of Object.keys(Mf))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=cp(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 R_(e){const t=new Set([...Object.keys(lp),...Object.keys(Mf)]),n=[];for(const s of e){const o=cp(s).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(s)}}return n}function cC(e,t){const n=cp(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 gy(e){const t={...lp};for(const n of e)cC(t,n);return t}function uC(e){const t={...Mf};for(const n of e)cC(t,n);return t}function dC(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=cp(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 jt({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 Oi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function up({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:o,canDrop:i,onMove:c,getExternalDragData:u,onCardContextMenu:d,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const N=f.useMemo(()=>new Set(h??[]),[h]),w=f.useMemo(()=>e.filter(_=>!N.has(_.id)),[e,N]),v=f.useMemo(()=>e.filter(_=>N.has(_.id)),[e,N]),[k,E]=f.useState(null),[S,T]=f.useState(null),P=f.useRef(null),R=f.useMemo(()=>new Map(t.map(_=>[n(_),_])),[n,t]),A=f.useMemo(()=>w.map(_=>({column:_,items:t.filter(z=>s(z)===_.id)})),[w,s,t]),L=k?R.get(k)??null:null;function M(_){if(!L)return{allowed:!1};const z=s(L);return(i==null?void 0:i({item:L,fromColumnId:z,toColumnId:_}))??{allowed:!0}}function F(){E(null),T(null)}function D(_,z,H){if(b)return;const q=(u==null?void 0:u(z))??null;!c&&!q||(_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",H),q&&_.dataTransfer.setData("application/json",JSON.stringify(q)),c&&E(H))}function V(_,z,H){b||!c||!L||!M(z).allowed||(_.preventDefault(),_.dataTransfer.dropEffect="move",T(I=>(I==null?void 0:I.columnId)===z&&I.index===H?I:{columnId:z,index:H}))}async function Y(_,z,H){var W;if(_.preventDefault(),b||!c||!L){F();return}const q=s(L),K=(((W=A.find(ee=>ee.column.id===q))==null?void 0:W.items)??[]).findIndex(ee=>n(ee)===n(L));if(!M(z).allowed||K<0){F();return}if(q===z&&(H===K||H===K+1)){F();return}try{await c({item:L,fromColumnId:q,toColumnId:z,fromIndex:K,toIndex:H})}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(_=>r.jsxs("button",{type:"button",onClick:()=>g(_.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${_.title}" column`,children:[_.title," ×"]},_.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:A.map(({column:_,items:z})=>{const H=M(_.id),q=(S==null?void 0:S.columnId)===_.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",L&&!H.allowed?"border-dashed opacity-65":"",L&&H.allowed?"border-primary/30 bg-accent/30":"",q?"ring-2 ring-ring/30":""),title:L&&!H.allowed?H.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:_.title}),_.description&&!y?r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:_.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:z.length}),g?r.jsx("button",{type:"button",onClick:()=>g(_.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 "${_.title}" column`,"aria-label":`Hide column ${_.title}`,children:"×"}):null]})]}),r.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:I=>V(I,_.id,z.length),onDrop:I=>Y(I,_.id,z.length),children:[z.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(_):m}):r.jsx(A_,{active:(S==null?void 0:S.columnId)===_.id&&S.index===0,disabled:!!L&&!H.allowed,children:typeof m=="function"?m(_):m}):null,z.map((I,K)=>{const $=n(I),W=k===$;return r.jsxs(f.Fragment,{children:[r.jsx("div",{className:be("h-2 rounded-full transition",(S==null?void 0:S.columnId)===_.id&&S.index===K?"bg-primary/70":"bg-transparent"),onDragOver:ee=>V(ee,_.id,K),onDrop:ee=>Y(ee,_.id,K)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:ee=>{P.current=ee.target},onDragStart:ee=>{const B=P.current;if(B!=null&&B.closest(Oi)){ee.preventDefault();return}D(ee,I,$)},onDragEnd:F,onContextMenu:ee=>{if(!d)return;const B=ee.target;B!=null&&B.closest(Oi)||d(I,ee)},className:be("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",W?"scale-[0.98] opacity-50":""),children:o(I,{dragging:W})})]},$)}),z.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)===_.id&&S.index===z.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",L&&!H.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},_.id)})})]})}function A_({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 Xl="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Bh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",P_="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",D_="border-status-review-foreground/30 bg-status-review text-status-review-foreground",$_="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",L_="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",I_="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",pf={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Xl,icon:Ui},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Xl,icon:aP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Xl,icon:Kk},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Bh,icon:EP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Bh,icon:wx},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:P_,icon:Gd},review:{label:"Review",description:"Ready for inspection or approval.",className:D_,icon:AP},completed:{label:"Completed",description:"Finished successfully.",className:$_,icon:xx},failed:{label:"Failed",description:"Could not be completed as planned.",className:L_,icon:Gd},active:{label:"Active",description:"The project has active or review work in flight.",className:Bh,icon:yg},stopped:{label:"Stopped",description:"Session ended without completing.",className:Xl,icon:sP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:I_,icon:yg}};function mf(e){const t=pf[e];return t||{className:Xl,icon:yg,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function fC(e,t){return be("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)]",mf(e).className,t)}function bn({status:e,className:t,showIcon:n=!0,progress:s}){const o=mf(e),i=o.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,d=c?`${o.label} — ${o.description} (${s.checked}/${s.total} criteria)`:`${o.label} — ${o.description}`,m=n?c?r.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[r.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),r.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeDasharray:2*Math.PI*7,strokeDashoffset:2*Math.PI*7*(1-u)})]}),r.jsx(i,{className:"h-2.5 w-2.5"})]}):r.jsx(i,{className:"h-3.5 w-3.5 shrink-0"}):null;return r.jsxs("span",{title:d,className:fC(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:o.label})]})}function dp(e){var t;return((t=pf[e])==null?void 0:t.description)??`Status: ${e}`}const pC={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 Fd=null,ni=null;function O_(){return Fd?Promise.resolve(Fd):ni||(ni=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Fd=e,ni=null,e)).catch(()=>(ni=null,pC)),ni)}function fp(){const[e,t]=f.useState(()=>Fd??pC);return f.useEffect(()=>{O_().then(t)},[]),e}function Ci(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 __(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ya({type:e,className:t,compact:n=!1}){const s=fp();if(!e)return null;const o=__(s,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return r.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:c,className:be("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:i})}async function Kc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return M_(e)}function M_(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function Br({value:e,label:t,disabled:n=!1,disabledReason:s,onError:o}){const[i,c]=f.useState(!1);async function u(){n||(await Kc(e)?(c(!0),setTimeout(()=>c(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?r.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:s??"Copy unavailable","aria-label":t??"Copy",children:r.jsx(Yd,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded",title:i?"Copied!":t??`Copy: ${e}`,"aria-label":t??"Copy",children:i?r.jsx(Rr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Yd,{className:"h-3 w-3","aria-hidden":"true"})})}function F_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function z_({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:o,compact:i=!1}){const c=xa(),[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=Hc(e.filter(N=>N.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=Vc(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className: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(pr,{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(N=>{const w=F_(N);return r.jsx("li",{children:r.jsxs(Ce,{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:N.title}),N.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:N.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Mn(N.updated)})]})},`${N.projectSlug??"standalone"}:${N.id}`)})})]},h)})})}function B_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function U_({items:e,sortField:t,sortDirection:n,tableColumnVisibility:s,compact:o=!1}){const i=new Set(s.hidden);i.delete("title");const c=h=>!i.has(h),u=Hc(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:[c("title")?r.jsx("th",{className:be("font-medium",d),children:"Assignment"}):null,c("status")?r.jsx("th",{className:be("font-medium",d),children:"Status"}):null,c("priority")?r.jsx("th",{className:be("font-medium",d),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:be("font-medium",d),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:be("font-medium",d),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:be("font-medium",d),children:"Created"}):null,c("updated")?r.jsx("th",{className:be("font-medium",d),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=B_(h),y=`${h.projectSlug??"standalone"}:${h.id}`;return r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[c("title")?r.jsxs("td",{className:d,children:[r.jsx(Ce,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:d,children:r.jsx(bn,{status:h.status,className:"max-w-[150px]"})}):null,c("priority")?r.jsx("td",{className:be("capitalize text-muted-foreground",d),children:h.priority}):null,c("assignee")?r.jsx("td",{className:be("text-muted-foreground",d),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:be("text-muted-foreground",d),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:be("text-muted-foreground",d),children:Mn(h.created)}):null,c("updated")?r.jsx("td",{className:be("text-muted-foreground",d),children:Mn(h.updated)}):null]},y)})})]})})}function mC({view:e,compact:t,emptyDescription:n}){const{data:s,loading:o,error:i}=If(),c=xa(),u=f.useMemo(()=>c.order.map(h=>({id:h,title:Vc(c,h),description:dp(h)})),[c]),d=f.useMemo(()=>uC(c.factDeclarations),[c.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??ic(e.config.filters);let g=null;h.trim()!==""&&(g=Di(h,d).query);const y=lC(s.assignments,g,{workspace:e.workspace});return Hc(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(jt,{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(up,{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(W_,{item:h}):r.jsx(V_,{item:h})});case"list":return r.jsx(z_,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(U_,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function W_({item:e}){const t=Cc(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(Ce,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(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(Br,{value:e.id})]}):null]})}function V_({item:e}){const t=Cc(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ce,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ya,{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 H_({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:o,refetch:i}=So(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(mC,{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 hC({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:la.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:la.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(K_,{session:t})},t.sessionId))})]})}function K_({session:e}){const t=un(),[n,s]=f.useState(!1),o=q_(e,t),i=G_(e),c=!e.path;return r.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Ce,{to: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," · ",a1(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:la.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(Br,{value:e.path,label:la.recentSessionsCopyPathLabel,disabled:c,disabledReason:la.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function q_(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function G_(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const Y_={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function ta(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function J_(e,t,n=Date.now()){const s=ta(e);if(t.preset){const c=Y_[t.preset];return c?t.preset.startsWith("older_")?s<n-c:s>=n-c:!0}const o=t.from?Date.parse(`${t.from}T00:00:00.000Z`):null,i=t.to?Date.parse(`${t.to}T23:59:59.999Z`):null;return!(o!==null&&Number.isFinite(o)&&s<o||i!==null&&Number.isFinite(i)&&s>i)}function Q_(e,t,n=Date.now()){const{dateRange:s,project:o,agent:i,sessionStatus:c}=t,u=new Set(o??[]),d=new Set(i??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!J_(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 X_(e,t,n){return[...e].sort((o,i)=>{let c=0;switch(t){case"started":c=ta(o.started)-ta(i.started);break;case"lastActivity":c=ta(o.updatedAt)-ta(i.updatedAt);break;case"projectName":{const u=o.projectSlug??"",d=i.projectSlug??"";c=u.localeCompare(d);break}case"agentName":c=o.agent.localeCompare(i.agent);break;default:c=ta(o.started)-ta(i.started);break}return n==="asc"?c:-c})}function Z_(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function eM({view:e,emptyDescription:t}){const{data:n,loading:s,error:o}=Of(),i=f.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,d=u.filters,m={dateRange:d.dateRange?{...d.dateRange,field:"started"}:void 0,project:Fe(d.project),agent:Fe(d.agent),sessionStatus:Fe(d.sessionStatus),limit:u.limit};let h=Q_(c,m);return h=X_(h,u.sortField,u.sortDirection),h=Z_(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(jt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(hC,{sessions:i})}function tM({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:o}=Bc(),[i,c]=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)&&c(!1)}function y(b){b.key==="Escape"&&c(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[i]);const m=e?s.find(g=>g.id===e)??null:null,h=o?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:o,onClick:()=>c(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(pr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(null)},className: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(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),d.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),d.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className: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(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:g.name})]},g.id)})]}),r.jsx("div",{className:"my-1 border-t border-border/40"}),r.jsxs("button",{type:"button",onClick:()=>{c(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[r.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const nM={__unassigned__:"Unassigned",__standalone__:"No project"};function xn({options:e,value:t,onChange:n,allLabel:s="Any",className:o,disabled:i,ariaLabel:c}){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:nM[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 N=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,P=S.findIndex(A=>A===T);E.key==="ArrowDown"?(E.preventDefault(),v(P<0?0:P+1)):E.key==="ArrowUp"?(E.preventDefault(),v(P<0?y.length-1:P-1)):E.key==="Home"?(E.preventDefault(),v(0)):E.key==="End"?(E.preventDefault(),v(y.length-1)):E.key==="Escape"&&(E.preventDefault(),d(!1),(R=h.current)==null||R.focus())}return r.jsxs("div",{className:"relative",ref:m,children:[r.jsxs("button",{type:"button",ref:h,disabled:i,"aria-haspopup":"menu","aria-expanded":u,"aria-label":c,onClick:()=>d(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),d(!0))},className: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:N}),r.jsx(pr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":c,onKeyDown:k,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(E=>E.value)),children:"Select all"}),r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((E,S)=>{const T=b.has(E.value);return r.jsxs("button",{ref:P=>{g.current[S]=P},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(Rr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const Oj={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"},rM=["updated","created"];function pp({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[o,i]=f.useState(!1),c=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){c.current&&!c.current.contains(S.target)&&i(!1)}function E(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[o]);const g=!!(e&&(e.preset||e.from||e.to)),y=f.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${Oj[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 N(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:c,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(pr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?r.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[r.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:rM.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(Uh,{label:"Any date",selected:!g,onClick:w}),sO.map(k=>r.jsx(Uh,{label:Oj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>N(k)},k)),r.jsx(Uh,{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 Uh({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(Rr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const sM=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function oM(e,t){const n={};for(const[s,o]of Object.entries(e))sM.has(s)||(n[s]=o);return{...n,...t}}function hf(e,t,n){return{...e,viewMode:t.viewMode,filters:oM(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 aM(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 c=Fe(e.assignee);c.length&&(n.assignee=c);const u=Fe(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const N=Fe(e.project);N.length&&(n.project=N)}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 _i(e){const t={viewMode:e.state.viewMode,filters:aM(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 ri={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},yd={sortField:"started",sortDirection:"desc"};function gC(e,t){const{config:n}=_i({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 xy(e,t){const{config:n}=_i({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 ua(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 mp(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function xC(e,t){var s,o,i,c,u,d,m,h,g,y,b,N,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)),(c=t.setPriorityFilter)==null||c.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,mp(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??ic(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),(N=t.setSortDirection)==null||N.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 zd(e){return e?`/w/${e}/views`:"/views"}function yC(e){return`${zd(e.workspace)}/${encodeURIComponent(e.id)}`}function bC(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Fe(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&wN(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const iM=["critical","high","medium","low"],lM={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 cM(e){if(e.preset)return`${e.field} ${lM[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function vC(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&lc(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=Fe(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(cM(e.dateRange));const s=(i=e.search)==null?void 0:i.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const _j=80,uM=["started","lastActivity","projectName","agentName"],dM={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},fM=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function wC({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const o=!!n,{data:i}=Cs(),{data:c}=Of(),[u,d]=f.useState(""),[m,h]=f.useState([]),[g,y]=f.useState([]),[b,N]=f.useState([]),[w,v]=f.useState(null),[k,E]=f.useState(yd.sortField),[S,T]=f.useState(yd.sortDirection),[P,R]=f.useState(""),[A,L]=f.useState(!1),[M,F]=f.useState(null);function D(){h([]),y([]),N([]),v(null),E(yd.sortField),T(yd.sortDirection),R("")}f.useEffect(()=>{if(e)if(F(null),L(!1),n){const I=n.config.filters;d(n.name),h(Fe(I.project)),y(Fe(I.agent)),N(Fe(I.sessionStatus)),v(mp(I.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else d(""),D()},[e,n]);const V=f.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(K=>({value:K.slug,label:K.title}))],[i]),Y=f.useMemo(()=>{const I=new Set;for(const K of(c==null?void 0:c.sessions)??[])K.agent&&I.add(K.agent);return Array.from(I).sort().map(K=>({value:K,label:K}))},[c]),_=u.trim(),z=_.length>0&&_.length<=_j,H=P.trim()===""?void 0:parseInt(P.trim(),10),q=P.trim()===""||Number.isFinite(H)&&H!==void 0&&H>0&&H<=500;return r.jsx($n,{open:e,onOpenChange:t,children:r.jsx(En,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async I=>{if(I.preventDefault(),!z||!q||A)return;L(!0),F(null);const K=ua(w),$=K?{...K,field:"started"}:void 0,W={filters:{project:m,agent:g,sessionStatus:b,dateRange:$},sortField:k,sortDirection:S,limit:H};try{await s(_,W)}catch(ee){F(ee instanceof Error?ee.message:String(ee)),L(!1)}},children:[r.jsx(Zn,{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:_j,onChange:I=>d(I.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(si,{label:"Date range (session start)",children:r.jsx(pp,{className:"w-full",value:w,onChange:v})}),r.jsx(si,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:m,onChange:h})}),r.jsx(si,{label:"Agent",children:r.jsx(xn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:Y,value:g,onChange:y})}),r.jsx(si,{label:"Session status",children:r.jsx(xn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:fM,value:b,onChange:N})}),r.jsx(si,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:I=>E(I.target.value),className:"editor-input w-full",children:uM.map(I=>r.jsx("option",{value:I,children:dM[I]??I},I))}),r.jsx("button",{type:"button",onClick:()=>T(I=>I==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),r.jsxs(si,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:P,onChange:I=>R(I.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"})]})]}),M?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:M}):null,r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:D,className:"shell-action",disabled:A,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:A,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!z||!q||A,className:"shell-action shell-action--cta disabled:opacity-50",children:A?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function si({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 pM=4e3;function Ao(){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,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},pM)},[]);return f.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:s}}function ba({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 Wh({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 mM({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:o,error:i}=Of(),{view:c,loading:u,ready:d}=So(e??null),{layout:m}=TN(),{showToast:h}=Ao(),[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 Ig(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function N(v,k){const{workspace:E,config:S}=xy(k,null);try{const P=(await $i({name:v,workspace:E,config:S,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");P&&await b(P.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…"}):c?c.entityType!=="session"?w=r.jsx(Wh,{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(eM,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):w=r.jsx(Wh,{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(Wh,{title:"Couldn't load sessions",message:i}):w=r.jsx(hC,{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(tM,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,w,r.jsx(wC,{open:g,onOpenChange:y,workspace:null,onSubmit:N})]})}const hM=5;function gM(){const{data:e,loading:t,error:n}=S1();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,hM);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Ce,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const c=i.inventory,u=i.active_leases.length,d=i.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Ce,{to:`/inventories/${encodeURIComponent(c.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:m}),r.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[u,"/",d," leased"]})]})},c.slug)})})]})}function xM(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 Mj({filters:e,metric:t}){const n=e??{},{data:s,loading:o,error:i}=W3(n),c=t==="cost"?"Spend":"Token Usage",u=`/usage?${kg(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}=xM(s),g=t==="cost"?{label:"Total spend",value:Pi(h)}:{label:"Total tokens",value:Ai(m)},y=t==="cost"?{label:"Tokens",value:Ai(m)}:{label:"Spend",value:Pi(h)};d=r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Fj,{label:g.label,value:g.value,emphasize:!0}),r.jsx(Fj,{label:y.label,value:y.value})]})}return r.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground",children:c}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",title:Ow(n),children:Ow(n)})]}),r.jsx(Ce,{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 Fj({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 yM={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function bM(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const oi="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function zj({config:e,open:t,onSave:n,onCancel:s}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Cs(),{data:c}=ma(),{data:u}=N1(t),[d,m]=f.useState("30d"),[h,g]=f.useState(""),[y,b]=f.useState(""),[N,w]=f.useState(""),[v,k]=f.useState(""),[E,S]=f.useState(""),[T,P]=f.useState(""),[R,A]=f.useState(!1),[L,M]=f.useState(null);f.useEffect(()=>{if(!t)return;const z=bM(e);m(z.window??"30d"),g(z.since??""),b(z.until??""),w(z.project??""),k(z.workspace??""),S(z.model??""),P(z.tool??""),A(!1),M(null)},[t,e]);function F(){return Ic({window:d,since:d==="custom"?h:void 0,until:d==="custom"?y:void 0,project:N||void 0,workspace:v||void 0,model:E||void 0,tool:T||void 0})}async function D(z){if(z.preventDefault(),R)return;const H=F(),q=D3(H);if(!q.ok){M(q.errors.join("; "));return}A(!0),M(null);const I=e.kind==="token-usage"?{kind:"token-usage",filters:H}:e.kind==="spend"?{kind:"spend",filters:H}:e;try{await n(I)}catch(K){M(K instanceof Error?K.message:String(K)),A(!1)}}const V=(i==null?void 0:i.map(z=>z.slug))??[],Y=(c==null?void 0:c.workspaces)??[],_=(c==null?void 0:c.hasUngrouped)??!1;return r.jsx($n,{open:t,onOpenChange:z=>{z||s()},children:r.jsx(En,{className:"max-w-md",children:r.jsxs("form",{onSubmit:D,children:[r.jsx(Zn,{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:Lf.map(z=>r.jsx("button",{type:"button",onClick:()=>m(z),className:"rounded px-2.5 py-1 text-sm border "+(z===d?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:yM[z]},z))})]}),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:z=>g(z.target.value),className:oi})]}),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:z=>b(z.target.value),className:oi})]})]}):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:z=>{k(z.target.value),z.target.value&&w("")},className:oi,children:[r.jsx("option",{value:"",children:"All workspaces"}),_?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,Y.map(z=>r.jsx("option",{value:z,children:z},z))]})]}),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:N,onChange:z=>{w(z.target.value),z.target.value&&k("")},className:oi,children:[r.jsx("option",{value:"",children:"All projects"}),V.map(z=>r.jsx("option",{value:z,children:z},z))]})]}),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:z=>S(z.target.value),className:oi,children:[r.jsx("option",{value:"",children:"All models"}),((u==null?void 0:u.models)??[]).map(z=>r.jsx("option",{value:z,children:z},z))]})]}),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:z=>P(z.target.value),className:oi,children:[r.jsx("option",{value:"",children:"All tools"}),((u==null?void 0:u.tools)??[]).map(z=>r.jsx("option",{value:z,children:z},z))]})]})]}),L?r.jsx("p",{className:"text-xs text-destructive",role:"alert",children:L}):null]}),r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:s,disabled:R,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:R,className:"shell-action shell-action--cta",children:R?"Saving…":"Save"})]})]})})})}const yy={"saved-view":{title:"Saved view",icon:Gk,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(H_,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Tf,render:(e,t)=>e.kind!=="agent-sessions"?null:f.createElement(mM,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Pf,render:()=>f.createElement(gM)},"token-usage":{title:"Token Usage",icon:yP,render:e=>e.kind!=="token-usage"?null:f.createElement(Mj,{filters:e.filters,metric:"tokens"}),ConfigEditor:zj},spend:{title:"Spend",icon:$c,render:e=>e.kind!=="spend"?null:f.createElement(Mj,{filters:e.filters,metric:"cost"}),ConfigEditor:zj}},jC=50,Ug=16,vM=2,ia=6,gf=11,Wg={w:6,h:2};function Bd(e,t,n){return Math.min(Math.max(e,t),n)}const wM=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function jM(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of wM)if(e>=t.minWidth)return t.columns;return 1}function Ud(e,t){return t<=0?1:Bd(Math.round(e/kc*t),1,t)}function Vg(e){if(CO(e))return e;switch(e){case"small":return{w:8,h:ia};case"wide":return{w:16,h:ia};case"tall":return{w:8,h:gf};case"large":return{w:16,h:gf};default:return{w:8,h:ia}}}function kM(e,t){return t>0?Math.round(e/t):0}function SM(e,t=jC){return Math.round(e/t)}const NM=[{label:"Third",w:8,h:ia},{label:"Half",w:12,h:ia},{label:"Two-thirds",w:16,h:ia},{label:"Full",w:24,h:ia},{label:"Half tall",w:12,h:gf},{label:"Full tall",w:24,h:gf}];function CM({slot:e,activeColumns:t,colWidthPx:n,onReplace:s,onRemove:o,onRemoveSlot:i,onResize:c,onConfigChange:u}){const[d,m]=f.useState(!1),[h,g]=f.useState(null),y=f.useRef(null),{attributes:b,listeners:N,setNodeRef:w,setActivatorNodeRef:v,transform:k,transition:E,isDragging:S}=ep({id:e.id}),T=Vg(e.size),P=h?h.renderW:Ud(T.w,t),R=h?h.h:T.h,A={transform:rs.Translate.toString(k),transition:E,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${P}`,gridRow:`span ${R}`};function L(H){y.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}g(null)}function M(H){return{onPointerDown:q=>{if(y.current)return;q.preventDefault(),q.stopPropagation(),q.currentTarget.setPointerCapture(q.pointerId);const I=Ud(T.w,t);y.current={pointerId:q.pointerId,startX:q.clientX,startY:q.clientY,startRenderW:I,startH:T.h,axis:H,lastRenderW:I,lastH:T.h},g({renderW:I,h:T.h})},onPointerMove:q=>{const I=y.current;if(!I||q.pointerId!==I.pointerId)return;let K=I.startRenderW,$=I.startH;(I.axis==="w"||I.axis==="both")&&(K=Bd(I.startRenderW+kM(q.clientX-I.startX,n),1,t)),(I.axis==="h"||I.axis==="both")&&($=Bd(I.startH+SM(q.clientY-I.startY),vM,vN)),I.lastRenderW=K,I.lastH=$,g({renderW:K,h:$})},onPointerUp:q=>{const I=y.current;if(!I||q.pointerId!==I.pointerId)return;const K=Vg(e.size),W={w:I.axis==="h"?K.w:Bd(Math.round(I.lastRenderW/t*kc),1,kc),h:I.lastH};L(q),(W.w!==K.w||W.h!==K.h)&&c(W)},onPointerCancel:q=>{const I=y.current;I&&q.pointerId===I.pointerId&&L(q)},onLostPointerCapture:q=>{const I=y.current;I&&q.pointerId===I.pointerId&&L(q)}}}const F="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",D=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"),...M("w")}):null,r.jsx("div",{"aria-hidden":"true",className:be(F,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),...M("h")}),t>1?r.jsx("div",{"aria-hidden":"true",className:be(F,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),...M("both")}):null]}),V=r.jsx("button",{ref:v,...b,...N,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(Bi,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return r.jsxs("div",{ref:w,style:{...A,gridColumn:`span ${Ud(Wg.w,t)}`,gridRow:`span ${Wg.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:V}),r.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:H=>H.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(Ct,{className:"h-4 w-4"}),"Add widget"]})]});const Y=yy[e.widget.kind];if(!Y)return r.jsxs("div",{ref:w,style:A,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:[V,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]})]}),D]});const _=Y.icon,z=Y.ConfigEditor;return r.jsxs("div",{ref:w,style:A,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:[V,r.jsx(_,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(TM,{slot:e,fallback:Y.title})})]}),r.jsx(hy,{items:[{key:"replace",label:"Replace…",icon:TP,onSelect:s},...Y.ConfigEditor?[{key:"configure",label:"Configure…",icon:$P,onSelect:()=>m(!0)}]:[],{key:"size",label:"Size",icon:SP,submenu:NM.map(H=>({key:`size-${H.label}`,label:H.label,active:T.w===H.w&&T.h===H.h,onSelect:()=>c({w:H.w,h:H.h})}))},{key:"remove",label:"Remove",icon:yn,destructive:!0,onSelect:o}]})]}),r.jsx("div",{children:Y.render(e.widget,{slotId:e.id,onPickAnother:s})}),z?r.jsx(z,{config:e.widget,open:d,onSave:async H=>{await u(H),m(!1)},onCancel:()=>m(!1)}):null,D]})}function EM({slot:e,activeColumns:t,colWidthPx:n}){const s=e.widget?yy[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}`,c=e.widget===null?Wg:Vg(e.size),u=Ud(c.w,t),d=n>0?u*n+(u-1)*Ug: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(Bi,{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 TM({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:s}=So(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&s?r.jsx(r.Fragment,{children:s.name}):r.jsx(r.Fragment,{children:t})}const RM=["agent-sessions","inventories","token-usage","spend"];function AM({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:o}=Bc();function i(c){n(c),t(!1)}return r.jsx($n,{open:e,onOpenChange:t,children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:"Add a widget"}),r.jsx(Vr,{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:RM.map(c=>{const u=yy[c],d=u.icon;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:c}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx(d,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsx("span",{className:"font-medium text-foreground",children:u.title})]})},c)})})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?r.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):s.length===0?r.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),r.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",r.jsx(Ce,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):r.jsxs("div",{className:"space-y-3",children:[s.some(c=>c.entityType!=="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType!=="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null,r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:c.config.viewMode})]})},c.id))})]}),s.some(c=>c.entityType==="session")&&r.jsxs("div",{children:[r.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:s.filter(c=>c.entityType==="session").map(c=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:c.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:c.name}),c.workspace!==null?r.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] text-muted-foreground",title:`Scoped to workspace: ${c.workspace}`,children:c.workspace}):null]})},c.id))})]})]}),!o&&s.some(c=>c.workspace!==null)?r.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Workspace-scoped views on the global Overview will only show items from that workspace."}):null]})]})})}const PM=(e,{currentCoordinates:t,context:n})=>{var g;const s=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();const o=n.over??n.active,i=(g=o==null?void 0:o.data.current)==null?void 0:g.sortable,c=i==null?void 0:i.items;if(!o||!c)return t;const u=c.indexOf(o.id);if(u===-1)return t;const d=c[u+s],m=d===void 0?null:n.droppableRects.get(d),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function DM(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 c=parseInt(i[1],10);c>n&&(n=c)}}let s=n+1;for(;t.has(`slot-${s}`);)s++;return`slot-${s}`}function $M(e,t){const n={id:DM(e),widget:null};return[...e,n]}function LM(e,t){return e.filter(n=>n.id!==t)}function IM(){const{data:e,error:t,refetch:n}=I3(),{data:s}=w1(),{layout:o}=TN(),[i,c]=f.useState(!1),[u,d]=f.useState(null),[m,h]=f.useState(null),[g,y]=f.useState(o.slots),[b,N]=f.useState(null),w=f.useRef(null),[v,k]=f.useState(kc),[E,S]=f.useState(0);f.useEffect(()=>{const q=w.current;if(!q)return;const I=new ResizeObserver(K=>{for(const $ of K){const W=$.contentRect.width,ee=jM(W),B=ee>0?(W-(ee-1)*Ug)/ee:0;k(ee),S(B)}});return I.observe(q),()=>I.disconnect()},[]),f.useEffect(()=>{y(o.slots)},[o.slots]);const T=qf(ko(Yi,{activationConstraint:{distance:8}}),ko(Gi,{coordinateGetter:PM}));Ro("list:overview"),Kt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const P=f.useCallback(q=>{d(q),c(!0)},[]),R=f.useCallback(async(q,I)=>{h(null),y(q);try{await Ig(q)}catch(K){y(I),h(K instanceof Error?K.message:String(K))}},[]),A=f.useCallback(q=>{if(u===null)return;const I=g.map((K,$)=>$===u?{...K,widget:q}:K);d(null),R(I,g)},[g,u,R]),L=f.useCallback(q=>{const I=g.map((K,$)=>$===q?{...K,widget:null,size:void 0}:K);R(I,g)},[g,R]),M=f.useCallback(q=>{const I=LM(g,q);R(I,g)},[g,R]),F=f.useCallback(()=>{const q=$M(g);R(q,g)},[g,R]),D=f.useCallback((q,I)=>{const K=g.map(($,W)=>W===q?{...$,size:I}:$);R(K,g)},[g,R]),V=f.useCallback(q=>{const{active:I,over:K}=q;if(N(null),!K||I.id===K.id)return;const $=g.findIndex(B=>B.id===I.id),W=g.findIndex(B=>B.id===K.id);if($===-1||W===-1)return;const ee=Ji(g,$,W);R(ee,g)},[g,R]),Y=f.useCallback(q=>{N(String(q.active.id))},[]),_=g.find(q=>q.id===b)??null,z=f.useCallback(async(q,I)=>{const K=g,$=g.map((W,ee)=>ee===q?{...W,widget:I}:W);h(null),y($);try{await Ig($)}catch(W){y(K);const ee=W instanceof Error?W.message:String(W);throw h(ee),W instanceof Error?W:new Error(ee)}},[g]),H={};if(e)for(const q of Object.keys(e.segments))for(const I of e.segments[q].items)H[I.id]=I;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(ZI,{hero:e.hero,itemsById:H}):t?r.jsx(kt,{error:t}):r.jsx(mt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(QI,{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(Xf,{sensors:T,collisionDetection:Gf,onDragStart:Y,onDragCancel:()=>N(null),onDragEnd:V,children:[r.jsx(Zf,{items:g.map(q=>q.id),strategy:Zx,children:r.jsx("div",{ref:w,style:{display:"grid",gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`,gridAutoRows:`${jC}px`,gridAutoFlow:"dense",gap:`${Ug}px`},children:g.map((q,I)=>r.jsx(CM,{slot:q,index:I,activeColumns:v,colWidthPx:E,onReplace:()=>P(I),onRemove:()=>L(I),onRemoveSlot:()=>M(q.id),onResize:K=>D(I,K),onConfigChange:K=>z(I,K)},q.id))})}),r.jsx(_I,{dropAnimation:null,children:_?r.jsx(EM,{slot:_,activeColumns:v,colWidthPx:E}):null})]}),r.jsxs("button",{type:"button",onClick:F,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(Ct,{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(jx,{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(AM,{open:i,onOpenChange:q=>{c(q),q||d(null)},onSelect:A})]})}function OM({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 _M(){const{data:e,loading:t,error:n}=w1(),{openCheatsheet:s}=To();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. ",ks("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(Od,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?r.jsx(Ce,{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(OM,{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(Ce,{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(Od,{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(Od,{command:o.command.command,example:o.command.example}):null,o.href?r.jsx(Ce,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function by({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 hp=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(Eo,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),r.jsx("input",{ref:s,value:e,onChange:o=>t(o.target.value),placeholder:n,className:"h-9 w-full rounded-md border border-border/60 bg-background/90 pl-9 pr-3 text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30"})]}));hp.displayName="SearchInput";function gp({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 MM={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"},Bj=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function xf({progress:e,className:t,showLegend:n=!1}){const s=xa(),o=f.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(d=>d!=="total")).map(d=>({key:d,className:MM[d]??Bj[c++%Bj.length]}))},[s.order,e]),i=o.filter(c=>(e[c.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(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${kn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:be("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:kn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const FM=["pending","active","blocked","failed","completed"],vy=FM,zM=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function kC(e){return e&&e.length>0?e:[...zM]}function BM(e,t,n){if(t<0||t>=e.length)return e;const s=[...e],[o]=s.splice(t,1),i=t<n?n-1:n;return s.splice(Math.max(0,Math.min(i,s.length)),0,o),s}const UM=220,bd=8;function SC({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 c=s.current,u=(c==null?void 0:c.offsetWidth)??UM,d=(c==null?void 0:c.offsetHeight)??0,m=Math.max(bd,window.innerWidth-u-bd),h=Math.max(bd,window.innerHeight-d-bd);i({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),f.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function d(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",d,!0)}},[e,n]),!e||t.length===0?null:r.jsx("div",{ref:s,role:"menu",className:"fixed z-50 min-w-[220px] rounded-md border border-border/70 bg-background py-1 shadow-lg",style:{left:(o==null?void 0:o.left)??e.x,top:(o==null?void 0:o.top)??e.y,visibility:o?"visible":"hidden"},children:r.jsx(ca,{delayDuration:200,children:t.map(c=>{const u=c.icon,d=be("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:d,children:m})});return c.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:h}),r.jsx(ur,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Ce,{to:c.href,className:d,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:d,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const WM="__ungrouped__";function wy({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:s,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:c,loading:u}=ma(),[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 N=f.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:WM,label:"Ungrouped",value:null}],[c]),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($n,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs(En,{children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:o}),r.jsx(Vr,{children:i})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&N.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(wx,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):N.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(Rr,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:v,disabled:!w,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function Uj(){const{workspace:e}=Mt(),t=un(),n=_t(),{data:s,loading:o,error:i,refetch:c}=Cs(),u=f.useRef(null);Ro("list:projects");const[d,m]=f.useState(""),[h,g]=f.useState("all"),[y,b]=f.useState("all"),[N,w]=f.useState("updated"),[v,k]=ls(),E=v.get("view"),S=E==="table"||E==="kanban"?E:"cards",T=I=>{k(K=>{const $=new URLSearchParams(K);return I==="cards"?$.delete("view"):$.set("view",I),$})},[P,R]=f.useState({}),[A,L]=f.useState(null),[M,F]=f.useState(null),D=f.useMemo(()=>s?s.filter(I=>{if(e){if(e==="_ungrouped"){if(I.workspace!==null)return!1}else if(I.workspace!==e)return!1}return h!=="all"&&I.status!==h||y!=="all"&&!I.tags.includes(y)?!1:d.trim()?`${I.title} ${I.tags.join(" ")} ${I.slug}`.toLowerCase().includes(d.toLowerCase()):!0}).sort((I,K)=>KM(I,K,N)):[],[s,d,h,y,N,e]),V=D.map(I=>`${I.slug}:${I.status}`).join("|");f.useEffect(()=>{R(qM(D))},[V,N]);const Y=f.useMemo(()=>{const I=new Map(D.map(K=>[K.slug,K]));return vy.flatMap(K=>(P[K]??D.filter(W=>W.status===K).map(W=>W.slug)).map(W=>I.get(W)).filter(W=>!!W))},[D,P]),{visibleItems:_,visibleIndexByKey:z}=f.useMemo(()=>{const I=S==="kanban"?Y:D,K=new Map;return I.forEach(($,W)=>K.set($.slug,W)),{visibleItems:I,visibleIndexByKey:K}},[S,D,Y]),{hotkeyRowProps:H}=Oc(_,{scope:"list:projects",onOpen:I=>n(`${t}/projects/${I.slug}`)});if(Kt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var I;return(I=u.current)==null?void 0:I.focus()}}),Kt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),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(I=>I.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(by,{children:[r.jsx(hp,{ref:u,value:d,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:I=>g(I.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:I=>b(I.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),q.map(I=>r.jsx("option",{value:I,children:I},I))]}),r.jsxs("select",{value:N,onChange:I=>w(I.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(gp,{value:S,onChange:I=>T(I),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),D.length===0?s.length===0?r.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[r.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),r.jsx("h2",{className:"mx-auto mt-4 max-w-2xl text-3xl font-semibold tracking-display text-foreground md:text-4xl",children:"The task manager built for agents, by agents"}),r.jsx("p",{className:"mx-auto mt-3 max-w-xl text-sm leading-6 text-muted-foreground",children:"A project groups assignments, resources, and memories under one objective. Markdown stays authoritative — the dashboard is just a view."}),r.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[r.jsx(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Ce,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(jt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):S==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:D.map((I,K)=>r.jsxs(Ce,{to:`${t}/projects/${I.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...H(K),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:I.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Mn(I.updated)]})]}),r.jsx(bn,{status:I.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(xf,{progress:I.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:I.tags.map($=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:$},$))}),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:I.needsAttention.blockedCount+I.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:I.progress.total})]})]})]})]},I.slug))}):S==="table"?r.jsx(We,{title:`${D.length} project${D.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:D.map((I,K)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...H(K),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Ce,{to:`${t}/projects/${I.slug}`,className:"font-semibold text-foreground hover:text-primary",children:I.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:I.tags.map($=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:$},$))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(bn,{status:I.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(xf,{progress:I.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:I.needsAttention.blockedCount+I.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(I.updated)})]},I.slug))})]})})}):r.jsx(up,{columns:HM,items:Y,getItemId:I=>I.slug,getColumnId:I=>I.status,canDrop:({fromColumnId:I,toColumnId:K})=>({allowed:!0,reason:I===K?void 0:"This will set a manual status override on the project."}),onMove:({item:I,fromColumnId:K,toColumnId:$,fromIndex:W,toIndex:ee})=>{if(K===$){const B=P[K]??D.filter(ae=>ae.status===K).map(ae=>ae.slug);R(ae=>({...ae,[K]:BM(B,W,ee)}));return}fetch(`/api/projects/${I.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:$})}).then(()=>{window.location.reload()})},getExternalDragData:I=>({type:"project",id:I.slug}),onCardContextMenu:(I,K)=>{K.preventDefault(),L({project:I,anchor:{x:K.clientX,y:K.clientY}})},emptyMessage:I=>`No ${I.title.toLowerCase()} projects.`,renderCard:(I,{dragging:K})=>{const $=z.get(I.slug)??-1;return r.jsx("div",{...$>=0?H($):{},children:r.jsx(GM,{project:I,dragging:K})})}}),r.jsx(SC,{anchor:(A==null?void 0:A.anchor)??null,items:A?[{key:"edit",label:"Edit",icon:Ui,onSelect:()=>n(`${t}/projects/${A.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Af,onSelect:()=>F(A.project)}]:[],onClose:()=>L(null)}),r.jsx(wy,{open:M!==null,onOpenChange:I=>{I||F(null)},currentWorkspace:(M==null?void 0:M.workspace)??null,title:"Move project to workspace",onSubmit:async I=>{if(!M)return;const K=await fetch(`/api/projects/${encodeURIComponent(M.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:I})});if(!K.ok){const $=await K.json().catch(()=>({}));throw new Error($.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(vx,{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 VM={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},HM=vy.map(e=>({id:e,title:VM[e],description:dp(e)}));function KM(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Wj(t)-Wj(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Wj(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function qM(e){return Object.fromEntries(vy.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function GM({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(Ce,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Mn(e.updated)]})]}),r.jsx(bn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(xf,{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 yf({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 YM(){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(Rf,{className:"h-3 w-3"}),"Archived"]})}function Vj(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function JM(){const{data:e,loading:t,error:n,refetch:s}=O3(),[o,i]=f.useState(null),[c,u]=f.useState(null),[d,m]=f.useState({}),{toast:h,showToast:g,dismissToast:y}=Ao();async function b(S,T,P){i(T),u(null);try{const R=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const A=await R.json().catch(()=>null);throw new Error((A==null?void 0:A.error)||`HTTP ${R.status}`)}s(),g(P,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{i(null)}}function N(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(ba,{toast:h,onDismiss:y}),r.jsx(yf,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(jt,{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(P=>({...P,[S.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(pr,{className:"h-4 w-4"}):r.jsx(Vk,{className:"h-4 w-4"}),r.jsx(yx,{className:"h-4 w-4 text-muted-foreground"}),S.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Ur(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Ce,{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:()=>N(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(Hd,{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(P=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Ce,{to:Vj(P),className:"text-foreground hover:text-foreground/80",children:P.title}),r.jsx(bn,{status:P.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:P.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},P.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(Ce,{to:Vj(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(YM,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Ur(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>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(Hd,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const Hj="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",Kj="block min-w-0 truncate";function jy({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(Hj,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[r.jsx("span",{className:Kj,children:o}),r.jsx(zi,{className:"h-2.5 w-2.5 shrink-0"})]},i):r.jsx("span",{className:Hj,title:o,children:r.jsx("span",{className:Kj,children:o})},i)})})}const QM={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 c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=be(QM[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(Ce,{to:i,className:u,children:c}):r.jsx("article",{className:u,children:c})}function qj(e){const t=XM(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(eF);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,{...c,ref:o,children:f.isValidElement(m)?f.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function XM(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=nF(o),u=tF(i,o.props);return o.type!==f.Fragment&&(u.ref=s?zf(s,c):c),f.cloneElement(o,u)}return f.Children.count(o)>1?f.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ZM=Symbol("radix.slottable");function eF(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ZM}function tF(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 nF(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 rF(e){const t=e+"CollectionProvider",[n,s]=ha(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=w=>{const{scope:v,children:k}=w,E=Pt.useRef(null),S=Pt.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:S,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",d=qj(u),m=Pt.forwardRef((w,v)=>{const{scope:k,children:E}=w,S=i(u,k),T=Kn(v,S.collectionRef);return r.jsx(d,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=qj(h),b=Pt.forwardRef((w,v)=>{const{scope:k,children:E,...S}=w,T=Pt.useRef(null),P=Kn(v,T),R=i(h,k);return Pt.useEffect(()=>(R.itemMap.set(T,{ref:T,...S}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:P,children:E})});b.displayName=h;function N(w){const v=i(e+"CollectionConsumer",w);return Pt.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const S=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,A)=>S.indexOf(R.ref.current)-S.indexOf(A.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},N,s]}var sF=f.createContext(void 0);function NC(e){const t=f.useContext(sF);return e||t||"ltr"}var Vh="rovingFocusGroup.onEntryFocus",oF={bubbles:!1,cancelable:!0},qc="RovingFocusGroup",[Hg,CC,aF]=rF(qc),[iF,EC]=ha(qc,[aF]),[lF,cF]=iF(qc),TC=f.forwardRef((e,t)=>r.jsx(Hg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Hg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(uF,{...e,ref:t})})}));TC.displayName=qc;var uF=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:d,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=f.useRef(null),b=Kn(t,y),N=NC(i),[w,v]=Bf({prop:c,defaultProp:u??null,onChange:d,caller:qc}),[k,E]=f.useState(!1),S=da(m),T=CC(n),P=f.useRef(!1),[R,A]=f.useState(0);return f.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(Vh,S),()=>L.removeEventListener(Vh,S)},[S]),r.jsx(lF,{scope:n,orientation:s,dir:N,loop:o,currentTabStopId:w,onItemFocus:f.useCallback(L=>v(L),[v]),onItemShiftTab:f.useCallback(()=>E(!0),[]),onFocusableItemAdd:f.useCallback(()=>A(L=>L+1),[]),onFocusableItemRemove:f.useCallback(()=>A(L=>L-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,()=>{P.current=!0}),onFocus:Qt(e.onFocus,L=>{const M=!P.current;if(L.target===L.currentTarget&&M&&!k){const F=new CustomEvent(Vh,oF);if(L.currentTarget.dispatchEvent(F),!F.defaultPrevented){const D=T().filter(H=>H.focusable),V=D.find(H=>H.active),Y=D.find(H=>H.id===w),z=[V,Y,...D].filter(Boolean).map(H=>H.ref.current);PC(z,h)}}P.current=!1}),onBlur:Qt(e.onBlur,()=>E(!1))})})}),RC="RovingFocusGroupItem",AC=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:c,...u}=e,d=vi(),m=i||d,h=cF(RC,n),g=h.currentTabStopId===m,y=CC(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:w}=h;return f.useEffect(()=>{if(s)return b(),()=>N()},[s,b,N]),r.jsx(Hg.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=pF(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?mF(S,T+1):S.slice(T+1)}setTimeout(()=>PC(S))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:w!=null}):c})})});AC.displayName=RC;var dF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function pF(e,t,n){const s=fF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return dF[s]}function PC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function mF(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var hF=TC,gF=AC,xp="Tabs",[xF]=ha(xp,[EC]),DC=EC(),[yF,ky]=xF(xp),$C=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:c="horizontal",dir:u,activationMode:d="automatic",...m}=e,h=NC(u),[g,y]=Bf({prop:s,onChange:o,defaultProp:i??"",caller:xp});return r.jsx(yF,{scope:n,baseId:vi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:d,children:r.jsx(vn.div,{dir:h,"data-orientation":c,...m,ref:t})})});$C.displayName=xp;var LC="TabsList",IC=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=ky(LC,n),c=DC(n);return r.jsx(hF,{asChild:!0,...c,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(vn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});IC.displayName=LC;var OC="TabsTrigger",_C=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,c=ky(OC,n),u=DC(n),d=zC(c.baseId,s),m=BC(c.baseId,s),h=s===c.value;return r.jsx(gF,{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?c.onValueChange(s):g.preventDefault()}),onKeyDown:Qt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Qt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!o&&g&&c.onValueChange(s)})})})});_C.displayName=OC;var MC="TabsContent",FC=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...c}=e,u=ky(MC,n),d=zC(u.baseId,s),m=BC(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(ga,{present:o||h,children:({present:y})=>r.jsx(vn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":d,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&i})})});FC.displayName=MC;function zC(e,t){return`${e}-trigger-${t}`}function BC(e,t){return`${e}-content-${t}`}var UC=$C,WC=IC,Kg=_C,qg=FC;function yp({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(UC,{value:e,onValueChange:t,className:s,children:[r.jsx(WC,{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(Kg,{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(qg,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const bF="modulepreload",vF=function(e){return"/"+e},Gj={},wF=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let c=function(m){return Promise.all(m.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),d=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=c(n.map(m=>{if(m=vF(m),m in Gj)return;Gj[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":bF,h||(y.as="script"),y.crossOrigin="",y.href=m,d&&y.setAttribute("nonce",d),document.head.appendChild(y),h)return new Promise((b,N)=>{y.addEventListener("load",b),y.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${m}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return o.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function jF({definition:e,className:t,nodeRoutes:n={}}){const s=f.useRef(null),[o,i]=f.useState(null),[c,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 wF(async()=>{const{default:w}=await import("./mermaid.core-BH9rlHr4.js").then(v=>v.bF);return{default:w}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:kF(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:N}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=N,SF(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:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function kF(e){const t=document.documentElement,n=g=>{const y=getComputedStyle(t).getPropertyValue(g).trim();return y?`oklch(${y})`:""},s=n("--card"),o=n("--card-foreground"),i=n("--border"),c=n("--primary"),u=n("--primary-foreground"),d=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:o,primaryBorderColor:i,secondaryColor:d,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:d,tertiaryTextColor:m,tertiaryBorderColor:i,lineColor:e?m:i,textColor:o,mainBkg:s,nodeBkg:s,nodeTextColor:o,nodeBorder:i,clusterBkg:d,clusterBorder:i,edgeLabelBackground:s,titleColor:o,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:d,labelColor:o,errorBkgColor:h,errorTextColor:u}}function SF(e,t,n){var s;for(const o of e.querySelectorAll(".node")){const i=((s=o.textContent)==null?void 0:s.replace(/\s+/g," ").trim())??"",c=t[i];if(!c)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const u=()=>n(c);o.addEventListener("click",u),o.addEventListener("keydown",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),u())})}}function NF(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const CF=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,EF=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TF={};function Yj(e,t){return(TF.jsx?EF:CF).test(e)}const RF=/[ \t\n\f\r]/g;function AF(e){return typeof e=="object"?e.type==="text"?Jj(e.value):!1:Jj(e)}function Jj(e){return e.replace(RF,"")===""}class Gc{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Gc.prototype.normal={};Gc.prototype.property={};Gc.prototype.space=void 0;function VC(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new Gc(n,s,t)}function Gg(e){return e.toLowerCase()}class mr{constructor(t,n){this.attribute=n,this.property=t}}mr.prototype.attribute="";mr.prototype.booleanish=!1;mr.prototype.boolean=!1;mr.prototype.commaOrSpaceSeparated=!1;mr.prototype.commaSeparated=!1;mr.prototype.defined=!1;mr.prototype.mustUseProperty=!1;mr.prototype.number=!1;mr.prototype.overloadedBoolean=!1;mr.prototype.property="";mr.prototype.spaceSeparated=!1;mr.prototype.space=void 0;let PF=0;const ft=va(),hn=va(),Yg=va(),Te=va(),zt=va(),Ei=va(),vr=va();function va(){return 2**++PF}const Jg=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:vr,commaSeparated:Ei,number:Te,overloadedBoolean:Yg,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Hh=Object.keys(Jg);class Sy extends mr{constructor(t,n,s,o){let i=-1;if(super(t,n),Qj(this,"space",o),typeof s=="number")for(;++i<Hh.length;){const c=Hh[i];Qj(this,Hh[i],(s&Jg[c])===Jg[c])}}}Sy.prototype.defined=!0;function Qj(e,t,n){n&&(e[t]=n)}function Zi(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new Sy(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Gg(s)]=s,n[Gg(i.attribute)]=s}return new Gc(t,n,e.space)}const HC=Zi({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,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:Te,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:zt,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:zt,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:hn,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function KC(e,t){return t in e?e[t]:t}function qC(e,t){return KC(e,t.toLowerCase())}const DF=Zi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ei,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:Te,colSpan:null,content:null,contentEditable:hn,controls:ft,controlsList:zt,coords:Te|Ei,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ft,defer:ft,dir:null,dirName:null,disabled:ft,download:Yg,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ft,formTarget:null,headers:zt,height:Te,hidden:Yg,high:Te,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:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,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:Te,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:Te,rowSpan:Te,sandbox:zt,scope:null,scoped:ft,seamless:ft,selected:ft,shadowRootClonable:ft,shadowRootDelegatesFocus:ft,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:ft,useMap:null,value:hn,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:zt,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,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:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:ft,noHref:ft,noShade:ft,noWrap:ft,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ft,disableRemotePlayback:ft,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:qC}),$F=Zi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vr,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,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:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:ft,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,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:Ei,g2:Ei,glyphName:Ei,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,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:Te,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:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KC}),GC=Zi({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()}}),YC=Zi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:qC}),JC=Zi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),LF={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"},IF=/[A-Z]/g,Xj=/-[a-z]/g,OF=/^data[-\w.:]+$/i;function _F(e,t){const n=Gg(t);let s=t,o=mr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&OF.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Xj,FF);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Xj.test(i)){let c=i.replace(IF,MF);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=Sy}return new o(s,t)}function MF(e){return"-"+e.toLowerCase()}function FF(e){return e.charAt(1).toUpperCase()}const zF=VC([HC,DF,GC,YC,JC],"html"),Ny=VC([HC,$F,GC,YC,JC],"svg");function BF(e){return e.join(" ").trim()}var ai={},Kh,Zj;function UF(){if(Zj)return Kh;Zj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,d=`
571
- `,m="/",h="*",g="",y="comment",b="declaration";function N(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(_){var z=_.match(t);z&&(E+=z.length);var H=_.lastIndexOf(d);S=~H?_.length-H:S+_.length}function P(){var _={line:E,column:S};return function(z){return z.position=new R(_),M(),z}}function R(_){this.start=_,this.end={line:E,column:S},this.source=k.source}R.prototype.content=v;function A(_){var z=new Error(k.source+":"+E+":"+S+": "+_);if(z.reason=_,z.filename=k.source,z.line=E,z.column=S,z.source=v,!k.silent)throw z}function L(_){var z=_.exec(v);if(z){var H=z[0];return T(H),v=v.slice(H.length),z}}function M(){L(n)}function F(_){var z;for(_=_||[];z=D();)z!==!1&&_.push(z);return _}function D(){var _=P();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var z=2;g!=v.charAt(z)&&(h!=v.charAt(z)||m!=v.charAt(z+1));)++z;if(z+=2,g===v.charAt(z-1))return A("End of comment missing");var H=v.slice(2,z-2);return S+=2,T(H),v=v.slice(z),S+=2,_({type:y,comment:H})}}function V(){var _=P(),z=L(s);if(z){if(D(),!L(o))return A("property missing ':'");var H=L(i),q=_({type:b,property:w(z[0].replace(e,g)),value:H?w(H[0].replace(e,g)):g});return L(c),q}}function Y(){var _=[];F(_);for(var z;z=V();)z!==!1&&(_.push(z),F(_));return _}return M(),Y()}function w(v){return v?v.replace(u,g):g}return Kh=N,Kh}var e0;function WF(){if(e0)return ai;e0=1;var e=ai&&ai.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ai,"__esModule",{value:!0}),ai.default=n;const t=e(UF());function n(s,o){let i=null;if(!s||typeof s!="string")return i;const c=(0,t.default)(s),u=typeof o=="function";return c.forEach(d=>{if(d.type!=="declaration")return;const{property:m,value:h}=d;u?o(m,h,d):h&&(i=i||{},i[m]=h)}),i}return ai}var Ul={},t0;function VF(){if(t0)return Ul;t0=1,Object.defineProperty(Ul,"__esModule",{value:!0}),Ul.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(m){return!m||n.test(m)||e.test(m)},c=function(m,h){return h.toUpperCase()},u=function(m,h){return"".concat(h,"-")},d=function(m,h){return h===void 0&&(h={}),i(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(o,u):m=m.replace(s,u),m.replace(t,c))};return Ul.camelCase=d,Ul}var Wl,n0;function HF(){if(n0)return Wl;n0=1;var e=Wl&&Wl.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(WF()),n=VF();function s(o,i){var c={};return!o||typeof o!="string"||(0,t.default)(o,function(u,d){u&&d&&(c[(0,n.camelCase)(u,i)]=d)}),c}return s.default=s,Wl=s,Wl}var KF=HF();const qF=Nf(KF),QC=XC("end"),Cy=XC("start");function XC(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function GF(e){const t=Cy(e),n=QC(e);if(t&&n)return{start:t,end:n}}function uc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?r0(e.position):"start"in e||"end"in e?r0(e):"line"in e||"column"in e?Qg(e):""}function Qg(e){return s0(e&&e.line)+":"+s0(e&&e.column)}function r0(e){return Qg(e&&e.start)+"-"+Qg(e&&e.end)}function s0(e){return e&&typeof e=="number"?e:1}class qn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",i={},c=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(c=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const d=s.indexOf(":");d===-1?i.ruleId=s:(i.source=s.slice(0,d),i.ruleId=s.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.position)}const u=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=u?u.line:void 0,this.name=uc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=c&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}qn.prototype.file="";qn.prototype.name="";qn.prototype.reason="";qn.prototype.message="";qn.prototype.stack="";qn.prototype.column=void 0;qn.prototype.line=void 0;qn.prototype.ancestors=void 0;qn.prototype.cause=void 0;qn.prototype.fatal=void 0;qn.prototype.place=void 0;qn.prototype.ruleId=void 0;qn.prototype.source=void 0;const Ey={}.hasOwnProperty,YF=new Map,JF=/[A-Z]/g,QF=new Set(["table","tbody","thead","tfoot","tr"]),XF=new Set(["td","th"]),ZC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ZF(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=i6(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=a6(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"?Ny:zF,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=eE(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function eE(e,t,n){if(t.type==="element")return e6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return t6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return r6(e,t,n);if(t.type==="mdxjsEsm")return n6(e,t);if(t.type==="root")return s6(e,t,n);if(t.type==="text")return o6(e,t)}function e6(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=Ny,e.schema=o),e.ancestors.push(t);const i=nE(e,t.tagName,!1),c=l6(e,t);let u=Ry(e,t);return QF.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!AF(d):!0})),tE(e,c,i,t),Ty(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function t6(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)}Ec(e,t.position)}function n6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ec(e,t.position)}function r6(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=Ny,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:nE(e,t.name,!0),c=c6(e,t),u=Ry(e,t);return tE(e,c,i,t),Ty(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function s6(e,t,n){const s={};return Ty(s,Ry(e,t)),e.create(t,e.Fragment,s,n)}function o6(e,t){return t.value}function tE(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Ty(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function a6(e,t,n){return s;function s(o,i,c,u){const m=Array.isArray(c.children)?n:t;return u?m(i,c,u):m(i,c)}}function i6(e,t){return n;function n(s,o,i,c){const u=Array.isArray(i.children),d=Cy(s);return t(o,i,c,u,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function l6(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&Ey.call(t.properties,o)){const i=u6(e,o,t.properties[o]);if(i){const[c,u]=i;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&XF.has(t.tagName)?s=u:n[c]=u}}if(s){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function c6(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const i=s.data.estree.body[0];i.type;const c=i.expression;c.type;const u=c.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Ec(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 Ec(e,t.position);else i=s.value===null?!0:s.value;n[o]=i}return n}function Ry(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:YF;for(;++s<t.children.length;){const i=t.children[s];let c;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const m=o.get(d)||0;c=d+"-"+m,o.set(d,m+1)}}const u=eE(e,i,c);u!==void 0&&n.push(u)}return n}function u6(e,t,n){const s=_F(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?NF(n):BF(n)),s.property==="style"){let o=typeof n=="object"?n:d6(e,String(n));return e.stylePropertyNameCase==="css"&&(o=f6(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?LF[s.property]||s.property:s.attribute,n]}}function d6(e,t){try{return qF(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new qn("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=ZC+"#cannot-parse-style-attribute",o}}function nE(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,c;for(;++i<o.length;){const u=Yj(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};c=c?{type:"MemberExpression",object:c,property:u,computed:!!(i&&u.type==="Literal"),optional:!1}:u}s=c}else s=Yj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return Ey.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);Ec(e)}function Ec(e,t){const n=new qn("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=ZC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function f6(e){const t={};let n;for(n in e)Ey.call(e,n)&&(t[p6(n)]=e[n]);return t}function p6(e){let t=e.replace(JF,m6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function m6(e){return"-"+e.toLowerCase()}const qh={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"]},h6={};function g6(e,t){const n=h6,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(x6(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 o0(e.children,t,n)}return Array.isArray(e)?o0(e,t,n):""}function o0(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=rE(e[o],t,n);return s.join("")}function x6(e){return!!(e&&typeof e=="object")}const a0=document.createElement("i");function Ay(e){const t="&"+e+";";a0.innerHTML=t;const n=a0.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ns(e,t,n,s){const o=e.length;let i=0,c;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,s.length<1e4)c=Array.from(s),c.unshift(t,n),e.splice(...c);else for(n&&e.splice(t,n);i<s.length;)c=s.slice(i,i+1e4),c.unshift(t,0),e.splice(...c),i+=1e4,t+=1e4}function Fr(e,t){return e.length>0?(Ns(e,e.length,0,t),e):t}const i0={}.hasOwnProperty;function y6(e){const t={};let n=-1;for(;++n<e.length;)b6(t,e[n]);return t}function b6(e,t){let n;for(n in t){const o=(i0.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let c;if(i)for(c in i){i0.call(o,c)||(o[c]=[]);const u=i[c];v6(o[c],Array.isArray(u)?u:u?[u]:[])}}}function v6(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ns(e,0,0,s)}function sE(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 Ti(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vs=Po(/[A-Za-z]/),Er=Po(/[\dA-Za-z]/),w6=Po(/[#-'*+\--9=?A-Z^-~]/);function Xg(e){return e!==null&&(e<32||e===127)}const Zg=Po(/\d/),j6=Po(/[\dA-Fa-f]/),k6=Po(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function fr(e){return e!==null&&(e<0||e===32)}function Dt(e){return e===-2||e===-1||e===32}const S6=Po(new RegExp("\\p{P}|\\p{S}","u")),N6=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function el(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let c="";if(i===37&&Er(e.charCodeAt(n+1))&&Er(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(c=String.fromCharCode(i));else if(i>55295&&i<57344){const u=e.charCodeAt(n+1);i<56320&&u>56319&&u<57344?(c=String.fromCharCode(i,u),o=1):c="�"}else c=String.fromCharCode(i);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+o+1,c=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Bt(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let i=0;return c;function c(d){return Dt(d)?(e.enter(n),u(d)):t(d)}function u(d){return Dt(d)&&i++<o?(e.consume(d),u):(e.exit(n),t(d))}}const C6={tokenize:E6};function E6(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,c(u)}function c(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return lt(u)?(e.consume(u),e.exit("chunkText"),i):(e.consume(u),c)}}const T6={tokenize:R6},l0={tokenize:A6};function R6(e){const t=this,n=[];let s=0,o,i,c;return u;function u(S){if(s<n.length){const T=n[s];return t.containerState=T[1],e.attempt(T[0].continuation,d,m)(S)}return m(S)}function d(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&E();const T=t.events.length;let P=T,R;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){R=t.events[P][1].end;break}k(s);let A=T;for(;A<t.events.length;)t.events[A][1].end={...R},A++;return Ns(t.events,P+1,0,t.events.slice(T)),t.events.length=A,m(S)}return u(S)}function m(S){if(s===n.length){if(!o)return y(S);if(o.currentConstruct&&o.currentConstruct.concrete)return N(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(l0,h,g)(S)}function h(S){return o&&E(),k(s),y(S)}function g(S){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,N(S)}function y(S){return t.containerState={},e.attempt(l0,b,N)(S)}function b(S){return s++,n.push([t.currentConstruct,t.containerState]),y(S)}function N(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 P=t.sliceStream(S);if(T&&P.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(P),t.parser.lazy[S.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<c&&(!o.events[R][1].end||o.events[R][1].end.offset>c))return;const A=t.events.length;let L=A,M,F;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(M){F=t.events[L][1].end;break}M=!0}for(k(s),R=A;R<t.events.length;)t.events[R][1].end={...F},R++;Ns(t.events,L+1,0,t.events.slice(A)),t.events.length=R}}function k(S){let T=n.length;for(;T-- >S;){const P=n[T];t.containerState=P[1],P[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 A6(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||fr(e)||N6(e))return 1;if(S6(e))return 2}function Py(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 ex={name:"attention",resolveAll:P6,tokenize:D6};function P6(e,t){let n=-1,s,o,i,c,u,d,m,h;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},y={...e[n][1].start};u0(g,-d),u0(y,d),c={type:d>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},i={type:d>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...c.start},end:{...u.end}},e[s][1].end={...c.start},e[n][1].start={...u.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Fr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Fr(m,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",i,t]]),m=Fr(m,Py(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Fr(m,[["exit",i,t],["enter",u,t],["exit",u,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Fr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Ns(e,s-1,n-s+3,m),n=s+m.length-h-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function D6(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=c0(s);let i;return c;function c(d){return i=d,e.enter("attentionSequence"),u(d)}function u(d){if(d===i)return e.consume(d),u;const m=e.exit("attentionSequence"),h=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 u0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const $6={name:"autolink",tokenize:L6};function L6(e,t,n){let s=0;return o;function o(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(b){return vs(b)?(e.consume(b),c):b===64?n(b):m(b)}function c(b){return b===43||b===45||b===46||Er(b)?(s=1,u(b)):m(b)}function u(b){return b===58?(e.consume(b),s=0,d):(b===43||b===45||b===46||Er(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function d(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||Xg(b)?n(b):(e.consume(b),d)}function m(b){return b===64?(e.consume(b),h):w6(b)?(e.consume(b),m):n(b)}function h(b){return Er(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Er(b))&&s++<63){const N=b===45?y:g;return e.consume(b),N}return n(b)}}const bp={partial:!0,tokenize:I6};function I6(e,t,n){return s;function s(i){return Dt(i)?Bt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||lt(i)?t(i):n(i)}}const oE={continuation:{tokenize:_6},exit:M6,name:"blockQuote",tokenize:O6};function O6(e,t,n){const s=this;return o;function o(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),i}return n(c)}function i(c){return Dt(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function _6(e,t,n){const s=this;return o;function o(c){return Dt(c)?Bt(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):i(c)}function i(c){return e.attempt(oE,t,n)(c)}}function M6(e){e.exit("blockQuote")}const aE={name:"characterEscape",tokenize:F6};function F6(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 k6(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const iE={name:"characterReference",tokenize:z6};function z6(e,t,n){const s=this;let o=0,i,c;return u;function u(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),d}function d(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),i=31,c=Er,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,c=j6,h):(e.enter("characterReferenceValue"),i=7,c=Zg,h(g))}function h(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===Er&&!Ay(s.sliceSerialize(y))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&o++<i?(e.consume(g),h):n(g)}}const d0={partial:!0,tokenize:U6},f0={concrete:!0,name:"codeFenced",tokenize:B6};function B6(e,t,n){const s=this,o={partial:!0,tokenize:P};let i=0,c=0,u;return d;function d(R){return m(R)}function m(R){const A=s.events[s.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(c++,e.consume(R),h):c<3?n(R):(e.exit("codeFencedFenceSequence"),Dt(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(d0,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)):Dt(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"}),N(R))}function N(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),N)}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&&Dt(R)?Bt(e,E,"linePrefix",i+1)(R):E(R)}function E(R){return R===null||lt(R)?e.check(d0,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 P(R,A,L){let M=0;return F;function F(z){return R.enter("lineEnding"),R.consume(z),R.exit("lineEnding"),D}function D(z){return R.enter("codeFencedFence"),Dt(z)?Bt(R,V,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):V(z)}function V(z){return z===u?(R.enter("codeFencedFenceSequence"),Y(z)):L(z)}function Y(z){return z===u?(M++,R.consume(z),Y):M>=c?(R.exit("codeFencedFenceSequence"),Dt(z)?Bt(R,_,"whitespace")(z):_(z)):L(z)}function _(z){return z===null||lt(z)?(R.exit("codeFencedFence"),A(z)):L(z)}}}function U6(e,t,n){const s=this;return o;function o(c){return c===null?n(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i)}function i(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}const Gh={name:"codeIndented",tokenize:V6},W6={partial:!0,tokenize:H6};function V6(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?c(m):n(m)}function c(m){return m===null?d(m):lt(m)?e.attempt(W6,c,d)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||lt(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function d(m){return e.exit("codeIndented"),t(m)}}function H6(e,t,n){const s=this;return o;function o(c){return s.parser.lazy[s.now().line]?n(c):lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):Bt(e,i,"linePrefix",5)(c)}function i(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):lt(c)?o(c):n(c)}}const K6={name:"codeText",previous:G6,resolve:q6,tokenize:Y6};function q6(e){let t=e.length-4,n=3,s,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)o===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(o=s):(s===t||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),t-=s-o-2,s=o+2),o=void 0);return e}function G6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Y6(e,t,n){let s=0,o,i;return c;function c(g){return e.enter("codeText"),e.enter("codeTextSequence"),u(g)}function u(g){return g===96?(e.consume(g),s++,u):(e.exit("codeTextSequence"),d(g))}function d(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),d):g===96?(i=e.enter("codeTextSequence"),o=0,h(g)):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),d):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||lt(g)?(e.exit("codeTextData"),d(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),o++,h):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(i.type="codeTextData",m(g))}}class J6{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&&Vl(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),Vl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Vl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Vl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Vl(this.left,n.reverse())}}}function Vl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function lE(e){const t={};let n=-1,s,o,i,c,u,d,m;const h=new J6(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,Q6(h,n)),n=t[n],m=!0);else if(s[1]._container){for(i=n,o=void 0;i--;)if(c=h.get(i),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(o&&(h.get(o)[1].type="lineEndingBlank"),c[1].type="lineEnding",o=i);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;o&&(s[1].end={...h.get(o)[1].start},u=h.slice(o,n),u.unshift(s),h.splice(o,n-o+1,u))}}return Ns(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function Q6(e,t){const n=e.get(t)[1],s=e.get(t)[2];let o=t-1;const i=[];let c=n._tokenizer;c||(c=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const u=c.events,d=[],m={};let h,g,y=-1,b=n,N=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&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(w=y+1,v.push(w),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):v.pop(),y=v.length;y--;){const k=u.slice(v[y],v[y+1]),E=i.pop();d.push([E,E+k.length-1]),e.splice(E,2,k)}for(d.reverse(),y=-1;++y<d.length;)m[N+d[y][0]]=N+d[y][1],N+=d[y][1]-d[y][0]-1;return m}const X6={resolve:ez,tokenize:tz},Z6={partial:!0,tokenize:nz};function ez(e){return lE(e),e}function tz(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(Z6,c,i)(u):(e.consume(u),o)}function i(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function c(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function nz(e,t,n){const s=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Bt(e,i,"linePrefix")}function i(c){if(c===null||lt(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function cE(e,t,n,s,o,i,c,u,d){const m=d||Number.POSITIVE_INFINITY;let h=0;return g;function g(k){return k===60?(e.enter(s),e.enter(o),e.enter(i),e.consume(k),e.exit(i),y):k===null||k===32||k===41||Xg(k)?n(k):(e.enter(s),e.enter(c),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?N:b)}function N(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function w(k){return!h&&(k===null||k===41||fr(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,w):k===41?(e.consume(k),h--,w):k===null||k===32||k===40||Xg(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 uE(e,t,n,s,o,i){const c=this;let u=0,d;return m;function m(b){return e.enter(s),e.enter(o),e.consume(b),e.exit(o),e.enter(i),h}function h(b){return u>999||b===null||b===91||b===93&&!d||b===94&&!u&&"_hiddenFootnoteSupport"in c.parser.constructs?n(b):b===93?(e.exit(i),e.enter(o),e.consume(b),e.exit(o),e.exit(s),t):lt(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===null||b===91||b===93||lt(b)||u++>999?(e.exit("chunkString"),h(b)):(e.consume(b),d||(d=!Dt(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function dE(e,t,n,s,o,i){let c;return u;function u(y){return y===34||y===39||y===40?(e.enter(s),e.enter(o),e.consume(y),e.exit(o),c=y===40?41:y,d):n(y)}function d(y){return y===c?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),t):(e.enter(i),m(y))}function m(y){return y===c?(e.exit(i),d(c)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Bt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||lt(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===c||y===92?(e.consume(y),h):h(y)}}function dc(e,t){let n;return s;function s(o){return lt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):Dt(o)?Bt(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const rz={name:"definition",tokenize:oz},sz={partial:!0,tokenize:az};function oz(e,t,n){const s=this;let o;return i;function i(b){return e.enter("definition"),c(b)}function c(b){return uE.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return o=Ti(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),d):n(b)}function d(b){return fr(b)?dc(e,m)(b):m(b)}function m(b){return cE(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(sz,g,g)(b)}function g(b){return Dt(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 az(e,t,n){return s;function s(u){return fr(u)?dc(e,o)(u):n(u)}function o(u){return dE(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function i(u){return Dt(u)?Bt(e,c,"whitespace")(u):c(u)}function c(u){return u===null||lt(u)?t(u):n(u)}}const iz={name:"hardBreakEscape",tokenize:lz};function lz(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 cz={name:"headingAtx",resolve:uz,tokenize:dz};function uz(e,t){let n=e.length-2,s=3,o,i;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},i={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},Ns(e,s,n-s+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function dz(e,t,n){let s=0;return o;function o(h){return e.enter("atxHeading"),i(h)}function i(h){return e.enter("atxHeadingSequence"),c(h)}function c(h){return h===35&&s++<6?(e.consume(h),c):h===null||fr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),d(h)):h===null||lt(h)?(e.exit("atxHeading"),t(h)):Dt(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||fr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const fz=["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"],p0=["pre","script","style","textarea"],pz={concrete:!0,name:"htmlFlow",resolveTo:gz,tokenize:xz},mz={partial:!0,tokenize:bz},hz={partial:!0,tokenize:yz};function gz(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 xz(e,t,n){const s=this;let o,i,c,u,d;return m;function m(B){return h(B)}function h(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),g}function g(B){return B===33?(e.consume(B),y):B===47?(e.consume(B),i=!0,w):B===63?(e.consume(B),o=3,s.interrupt?t:$):vs(B)?(e.consume(B),c=String.fromCharCode(B),v):n(B)}function y(B){return B===45?(e.consume(B),o=2,b):B===91?(e.consume(B),o=5,u=0,N):vs(B)?(e.consume(B),o=4,s.interrupt?t:$):n(B)}function b(B){return B===45?(e.consume(B),s.interrupt?t:$):n(B)}function N(B){const ae="CDATA[";return B===ae.charCodeAt(u++)?(e.consume(B),u===ae.length?s.interrupt?t:V:N):n(B)}function w(B){return vs(B)?(e.consume(B),c=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||fr(B)){const ae=B===47,ue=c.toLowerCase();return!ae&&!i&&p0.includes(ue)?(o=1,s.interrupt?t(B):V(B)):fz.includes(c.toLowerCase())?(o=6,ae?(e.consume(B),k):s.interrupt?t(B):V(B)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(B):i?E(B):S(B))}return B===45||Er(B)?(e.consume(B),c+=String.fromCharCode(B),v):n(B)}function k(B){return B===62?(e.consume(B),s.interrupt?t:V):n(B)}function E(B){return Dt(B)?(e.consume(B),E):F(B)}function S(B){return B===47?(e.consume(B),F):B===58||B===95||vs(B)?(e.consume(B),T):Dt(B)?(e.consume(B),S):F(B)}function T(B){return B===45||B===46||B===58||B===95||Er(B)?(e.consume(B),T):P(B)}function P(B){return B===61?(e.consume(B),R):Dt(B)?(e.consume(B),P):S(B)}function R(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),d=B,A):Dt(B)?(e.consume(B),R):L(B)}function A(B){return B===d?(e.consume(B),d=null,M):B===null||lt(B)?n(B):(e.consume(B),A)}function L(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||fr(B)?P(B):(e.consume(B),L)}function M(B){return B===47||B===62||Dt(B)?S(B):n(B)}function F(B){return B===62?(e.consume(B),D):n(B)}function D(B){return B===null||lt(B)?V(B):Dt(B)?(e.consume(B),D):n(B)}function V(B){return B===45&&o===2?(e.consume(B),H):B===60&&o===1?(e.consume(B),q):B===62&&o===4?(e.consume(B),W):B===63&&o===3?(e.consume(B),$):B===93&&o===5?(e.consume(B),K):lt(B)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(mz,ee,Y)(B)):B===null||lt(B)?(e.exit("htmlFlowData"),Y(B)):(e.consume(B),V)}function Y(B){return e.check(hz,_,ee)(B)}function _(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),z}function z(B){return B===null||lt(B)?Y(B):(e.enter("htmlFlowData"),V(B))}function H(B){return B===45?(e.consume(B),$):V(B)}function q(B){return B===47?(e.consume(B),c="",I):V(B)}function I(B){if(B===62){const ae=c.toLowerCase();return p0.includes(ae)?(e.consume(B),W):V(B)}return vs(B)&&c.length<8?(e.consume(B),c+=String.fromCharCode(B),I):V(B)}function K(B){return B===93?(e.consume(B),$):V(B)}function $(B){return B===62?(e.consume(B),W):B===45&&o===2?(e.consume(B),$):V(B)}function W(B){return B===null||lt(B)?(e.exit("htmlFlowData"),ee(B)):(e.consume(B),W)}function ee(B){return e.exit("htmlFlow"),t(B)}}function yz(e,t,n){const s=this;return o;function o(c){return lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),i):n(c)}function i(c){return s.parser.lazy[s.now().line]?n(c):t(c)}}function bz(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(bp,t,n)}}const vz={name:"htmlText",tokenize:wz};function wz(e,t,n){const s=this;let o,i,c;return u;function u($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),d}function d($){return $===33?(e.consume($),m):$===47?(e.consume($),P):$===63?(e.consume($),S):vs($)?(e.consume($),L):n($)}function m($){return $===45?(e.consume($),h):$===91?(e.consume($),i=0,N):vs($)?(e.consume($),E):n($)}function h($){return $===45?(e.consume($),b):n($)}function g($){return $===null?n($):$===45?(e.consume($),y):lt($)?(c=g,q($)):(e.consume($),g)}function y($){return $===45?(e.consume($),b):g($)}function b($){return $===62?H($):$===45?y($):g($)}function N($){const W="CDATA[";return $===W.charCodeAt(i++)?(e.consume($),i===W.length?w:N):n($)}function w($){return $===null?n($):$===93?(e.consume($),v):lt($)?(c=w,q($)):(e.consume($),w)}function v($){return $===93?(e.consume($),k):w($)}function k($){return $===62?H($):$===93?(e.consume($),k):w($)}function E($){return $===null||$===62?H($):lt($)?(c=E,q($)):(e.consume($),E)}function S($){return $===null?n($):$===63?(e.consume($),T):lt($)?(c=S,q($)):(e.consume($),S)}function T($){return $===62?H($):S($)}function P($){return vs($)?(e.consume($),R):n($)}function R($){return $===45||Er($)?(e.consume($),R):A($)}function A($){return lt($)?(c=A,q($)):Dt($)?(e.consume($),A):H($)}function L($){return $===45||Er($)?(e.consume($),L):$===47||$===62||fr($)?M($):n($)}function M($){return $===47?(e.consume($),H):$===58||$===95||vs($)?(e.consume($),F):lt($)?(c=M,q($)):Dt($)?(e.consume($),M):H($)}function F($){return $===45||$===46||$===58||$===95||Er($)?(e.consume($),F):D($)}function D($){return $===61?(e.consume($),V):lt($)?(c=D,q($)):Dt($)?(e.consume($),D):M($)}function V($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),o=$,Y):lt($)?(c=V,q($)):Dt($)?(e.consume($),V):(e.consume($),_)}function Y($){return $===o?(e.consume($),o=void 0,z):$===null?n($):lt($)?(c=Y,q($)):(e.consume($),Y)}function _($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||fr($)?M($):(e.consume($),_)}function z($){return $===47||$===62||fr($)?M($):n($)}function H($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function q($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),I}function I($){return Dt($)?Bt(e,K,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):K($)}function K($){return e.enter("htmlTextData"),c($)}}const Dy={name:"labelEnd",resolveAll:Nz,resolveTo:Cz,tokenize:Ez},jz={tokenize:Tz},kz={tokenize:Rz},Sz={tokenize:Az};function Nz(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",t+=o}}return e.length!==n.length&&Ns(e,0,e.length,n),e}function Cz(e,t){let n=e.length,s=0,o,i,c,u;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(c){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(c=n);const d={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[i][1].start},end:{...e[c][1].end}},h={type:"labelText",start:{...e[i+s+2][1].end},end:{...e[c-2][1].start}};return u=[["enter",d,t],["enter",m,t]],u=Fr(u,e.slice(i+1,i+s+3)),u=Fr(u,[["enter",h,t]]),u=Fr(u,Py(t.parser.constructs.insideSpan.null,e.slice(i+s+4,c-3),t)),u=Fr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Fr(u,e.slice(c+1)),u=Fr(u,[["exit",d,t]]),Ns(e,i,e.length,u),e}function Ez(e,t,n){const s=this;let o=s.events.length,i,c;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){i=s.events[o][1];break}return u;function u(y){return i?i._inactive?g(y):(c=s.parser.defined.includes(Ti(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(jz,h,c?h:g)(y):y===91?e.attempt(kz,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(Sz,h,g)(y)}function h(y){return t(y)}function g(y){return i._balanced=!0,n(y)}}function Tz(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return fr(g)?dc(e,i)(g):i(g)}function i(g){return g===41?h(g):cE(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return fr(g)?dc(e,d)(g):h(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?dE(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return fr(g)?dc(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 Rz(e,t,n){const s=this;return o;function o(u){return uE.call(s,e,i,c,"reference","referenceMarker","referenceString")(u)}function i(u){return s.parser.defined.includes(Ti(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function Az(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 Pz={name:"labelStartImage",resolveAll:Dy.resolveAll,tokenize:Dz};function Dz(e,t,n){const s=this;return o;function o(u){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(u),e.exit("labelImageMarker"),i}function i(u){return u===91?(e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelImage"),c):n(u)}function c(u){return u===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(u):t(u)}}const $z={name:"labelStartLink",resolveAll:Dy.resolveAll,tokenize:Lz};function Lz(e,t,n){const s=this;return o;function o(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),i}function i(c){return c===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(c):t(c)}}const Yh={name:"lineEnding",tokenize:Iz};function Iz(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Bt(e,t,"linePrefix")}}const Wd={name:"thematicBreak",tokenize:Oz};function Oz(e,t,n){let s=0,o;return i;function i(m){return e.enter("thematicBreak"),c(m)}function c(m){return o=m,u(m)}function u(m){return m===o?(e.enter("thematicBreakSequence"),d(m)):s>=3&&(m===null||lt(m))?(e.exit("thematicBreak"),t(m)):n(m)}function d(m){return m===o?(e.consume(m),s++,d):(e.exit("thematicBreakSequence"),Dt(m)?Bt(e,u,"whitespace")(m):u(m))}}const lr={continuation:{tokenize:zz},exit:Uz,name:"list",tokenize:Fz},_z={partial:!0,tokenize:Wz},Mz={partial:!0,tokenize:Bz};function Fz(e,t,n){const s=this,o=s.events[s.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return u;function u(b){const N=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Zg(b)){if(s.containerState.type||(s.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Wd,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 Zg(b)&&++c<10?(e.consume(b),d):(!s.interrupt||c<2)&&(s.containerState.marker?b===s.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),m(b)):n(b)}function m(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||b,e.check(bp,s.interrupt?n:h,e.attempt(_z,y,g))}function h(b){return s.containerState.initialBlankLine=!0,i++,y(b)}function g(b){return Dt(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 zz(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(bp,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||!Dt(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(Mz,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Bt(e,e.attempt(lr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function Bz(e,t,n){const s=this;return Bt(e,o,"listItemIndent",s.containerState.size+1);function o(i){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(i):n(i)}}function Uz(e){e.exit(this.containerState.type)}function Wz(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 c=s.events[s.events.length-1];return!Dt(i)&&c&&c[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const m0={name:"setextUnderline",resolveTo:Vz,tokenize:Hz};function Vz(e,t){let n=e.length,s,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const c={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",c,t]),e.splice(i+1,0,["exit",e[s][1],t]),e[s][1].end={...e[i][1].end}):e[s][1]=c,e.push(["exit",c,t]),e}function Hz(e,t,n){const s=this;let o;return i;function i(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===o?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),Dt(m)?Bt(e,d,"lineSuffix")(m):d(m))}function d(m){return m===null||lt(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const Kz={tokenize:qz};function qz(e){const t=this,n=e.attempt(bp,s,e.attempt(this.parser.constructs.flowInitial,o,Bt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(X6,o)),"linePrefix")));return n;function s(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Gz={resolveAll:pE()},Yz=fE("string"),Jz=fE("text");function fE(e){return{resolveAll:pE(e==="text"?Qz:void 0),tokenize:t};function t(n){const s=this,o=this.parser.constructs[e],i=n.attempt(o,c,u);return c;function c(h){return m(h)?i(h):u(h)}function u(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),d}function d(h){return m(h)?(n.exit("data"),i(h)):(n.consume(h),d)}function m(h){if(h===null)return!0;const g=o[h];let y=-1;if(g)for(;++y<g.length;){const b=g[y];if(!b.previous||b.previous.call(s,s.previous))return!0}return!1}}}function pE(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 Qz(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],o=t.sliceStream(s);let i=o.length,c=-1,u=0,d;for(;i--;){const m=o[i];if(typeof m=="string"){for(c=m.length;m.charCodeAt(c-1)===32;)u++,c--;if(c)break;c=-1}else if(m===-2)d=!0,u++;else if(m!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||d||u<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?c:s.start._bufferIndex+c,_index:s.start._index+i,line:s.end.line,column:s.end.column-u,offset:s.end.offset-u},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const Xz={42:lr,43:lr,45:lr,48:lr,49:lr,50:lr,51:lr,52:lr,53:lr,54:lr,55:lr,56:lr,57:lr,62:oE},Zz={91:rz},eB={[-2]:Gh,[-1]:Gh,32:Gh},tB={35:cz,42:Wd,45:[m0,Wd],60:pz,61:m0,95:Wd,96:f0,126:f0},nB={38:iE,92:aE},rB={[-5]:Yh,[-4]:Yh,[-3]:Yh,33:Pz,38:iE,42:ex,60:[$6,vz],91:$z,92:[iz,aE],93:Dy,95:ex,96:K6},sB={null:[ex,Gz]},oB={null:[42,95]},aB={null:[]},iB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oB,contentInitial:Zz,disable:aB,document:Xz,flow:tB,flowInitial:eB,insideSpan:sB,string:nB,text:rB},Symbol.toStringTag,{value:"Module"}));function lB(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let c=[],u=[];const d={attempt:A(P),check:A(R),consume:E,enter:S,exit:T,interrupt:A(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:w,events:[],now:N,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,d);return t.resolveAll&&i.push(t),m;function g(D){return c=Fr(c,D),v(),c[c.length-1]!==null?[]:(L(t,0),m.events=Py(i,m.events,m),m.events)}function y(D,V){return uB(b(D),V)}function b(D){return cB(c,D)}function N(){const{_bufferIndex:D,_index:V,line:Y,column:_,offset:z}=s;return{_bufferIndex:D,_index:V,line:Y,column:_,offset:z}}function w(D){o[D.line]=D.column,F()}function v(){let D;for(;s._index<c.length;){const V=c[s._index];if(typeof V=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<V.length;)k(V.charCodeAt(s._bufferIndex));else k(V)}}function k(D){h=h(D)}function E(D){lt(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,F()):D!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===c[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=D}function S(D,V){const Y=V||{};return Y.type=D,Y.start=N(),m.events.push(["enter",Y,m]),u.push(Y),Y}function T(D){const V=u.pop();return V.end=N(),m.events.push(["exit",V,m]),V}function P(D,V){L(D,V.from)}function R(D,V){V.restore()}function A(D,V){return Y;function Y(_,z,H){let q,I,K,$;return Array.isArray(_)?ee(_):"tokenize"in _?ee([_]):W(_);function W(se){return xe;function xe(ke){const Re=ke!==null&&se[ke],Ae=ke!==null&&se.null,Qe=[...Array.isArray(Re)?Re:Re?[Re]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return ee(Qe)(ke)}}function ee(se){return q=se,I=0,se.length===0?H:B(se[I])}function B(se){return xe;function xe(ke){return $=M(),K=se,se.partial||(m.currentConstruct=se),se.name&&m.parser.constructs.disable.null.includes(se.name)?ue():se.tokenize.call(V?Object.assign(Object.create(m),V):m,d,ae,ue)(ke)}}function ae(se){return D(K,$),z}function ue(se){return $.restore(),++I<q.length?B(q[I]):H}}}function L(D,V){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Ns(m.events,V,m.events.length-V,D.resolve(m.events.slice(V),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function M(){const D=N(),V=m.previous,Y=m.currentConstruct,_=m.events.length,z=Array.from(u);return{from:_,restore:H};function H(){s=D,m.previous=V,m.currentConstruct=Y,m.events.length=_,u=z,F()}}function F(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function cB(e,t){const n=t.start._index,s=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let c;if(n===o)c=[e[n].slice(s,i)];else{if(c=e.slice(n,o),s>-1){const u=c[0];typeof u=="string"?c[0]=u.slice(s):c.shift()}i>0&&c.push(e[o].slice(0,i))}return c}function uB(e,t){let n=-1;const s=[];let o;for(;++n<e.length;){const i=e[n];let c;if(typeof i=="string")c=i;else switch(i){case-5:{c="\r";break}case-4:{c=`
572
- `;break}case-3:{c=`\r
573
- `;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&o)continue;c=" ";break}default:c=String.fromCharCode(i)}o=i===-2,s.push(c)}return s.join("")}function dB(e){const s={constructs:y6([iB,...(e||{}).extensions||[]]),content:o(C6),defined:[],document:o(T6),flow:o(Kz),lazy:{},string:o(Yz),text:o(Jz)};return s;function o(i){return c;function c(u){return lB(s,i,u)}}}function fB(e){for(;!lE(e););return e}const h0=/[\0\t\n\r]/g;function pB(){let e=1,t="",n=!0,s;return o;function o(i,c,u){const d=[];let m,h,g,y,b;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(c||void 0).decode(i)),g=0,t="",n&&(i.charCodeAt(0)===65279&&g++,n=void 0);g<i.length;){if(h0.lastIndex=g,m=h0.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 mB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hB(e){return e.replace(mB,gB)}function gB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return sE(n.slice(i?2:1),i?16:10)}return Ay(n)||e}const mE={}.hasOwnProperty;function xB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),yB(n)(fB(dB(n).document().write(pB()(e,t,!0))))}function yB(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ye),autolinkProtocol:M,autolinkEmail:M,atxHeading:i(Z),blockQuote:i(Ae),characterEscape:M,characterReference:M,codeFenced:i(Qe),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:i(Qe,c),codeText:i(at,c),codeTextData:M,data:M,codeFlowValue:M,definition:i(Ze),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:i(ot),hardBreakEscape:i(_e),hardBreakTrailing:i(_e),htmlFlow:i(Ee,c),htmlFlowData:M,htmlText:i(Ee,c),htmlTextData:M,image:i(Ie),label:c,link:i(Ye),listItem:i(et),listItemValue:y,listOrdered:i(Me,g),listUnordered:i(Me),paragraph:i(Je),reference:B,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:i(Z),strong:i($t),thematicBreak:i(ct)},exit:{atxHeading:d(),atxHeadingSequence:P,autolink:d(),autolinkEmail:Re,autolinkProtocol:ke,blockQuote:d(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:se,characterReference:xe,codeFenced:d(v),codeFencedFence:w,codeFencedFenceInfo:b,codeFencedFenceMeta:N,codeFlowValue:F,codeIndented:d(k),codeText:d(z),codeTextData:F,data:F,definition:d(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(V),hardBreakTrailing:d(V),htmlFlow:d(Y),htmlFlowData:F,htmlText:d(_),htmlTextData:F,image:d(q),label:K,labelText:I,lineEnding:D,link:d(H),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ae,resourceDestinationString:$,resourceTitleString:W,resource:ee,setextHeading:d(L),setextHeadingLineSequence:A,setextHeadingText:R,strong:d(),thematicBreak:d()}};hE(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let J={type:"root",children:[]};const he={stack:[J],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},re=[];let ye=-1;for(;++ye<le.length;)if(le[ye][1].type==="listOrdered"||le[ye][1].type==="listUnordered")if(le[ye][0]==="enter")re.push(ye);else{const Pe=re.pop();ye=o(le,Pe,ye)}for(ye=-1;++ye<le.length;){const Pe=t[le[ye][0]];mE.call(Pe,le[ye][1].type)&&Pe[le[ye][1].type].call(Object.assign({sliceSerialize:le[ye][2].sliceSerialize},he),le[ye][1])}if(he.tokenStack.length>0){const Pe=he.tokenStack[he.tokenStack.length-1];(Pe[1]||g0).call(he,void 0,Pe[0])}for(J.position={start:mo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:mo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye<t.transforms.length;)J=t.transforms[ye](J)||J;return J}function o(le,J,he){let re=J-1,ye=-1,Pe=!1,ve,te,fe,Se;for(;++re<=he;){const Ue=le[re];switch(Ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ue[0]==="enter"?ye++:ye--,Se=void 0;break}case"lineEndingBlank":{Ue[0]==="enter"&&(ve&&!Se&&!ye&&!fe&&(fe=re),Se=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Se=void 0}if(!ye&&Ue[0]==="enter"&&Ue[1].type==="listItemPrefix"||ye===-1&&Ue[0]==="exit"&&(Ue[1].type==="listUnordered"||Ue[1].type==="listOrdered")){if(ve){let ce=re;for(te=void 0;ce--;){const pt=le[ce];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;te&&(le[te][1].type="lineEndingBlank",Pe=!0),pt[1].type="lineEnding",te=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&&(!te||fe<te)&&(ve._spread=!0),ve.end=Object.assign({},te?le[te][1].start:Ue[1].end),le.splice(te||re,0,["exit",ve,Ue[2]]),re++,he++}if(Ue[1].type==="listItemPrefix"){const ce={type:"listItem",_spread:!1,start:Object.assign({},Ue[1].start),end:void 0};ve=ce,le.splice(re,0,["enter",ce,Ue[2]]),re++,he++,fe=void 0,Se=!0}}}return le[J][1]._spread=Pe,he}function i(le,J){return he;function he(re){u.call(this,le(re),re),J&&J.call(this,re)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,J,he){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([J,he||void 0]),le.position={start:mo(J.start),end:void 0}}function d(le){return J;function J(he){le&&le.call(this,he),m.call(this,he)}}function m(le,J){const he=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==le.type&&(J?J.call(this,le,re[0]):(re[1]||g0).call(this,le,re[0]));else throw new Error("Cannot close `"+le.type+"` ("+uc({start:le.start,end:le.end})+"): it’s not open");he.position.end=mo(le.end)}function h(){return g6(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const J=this.stack[this.stack.length-2];J.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),J=this.stack[this.stack.length-1];J.lang=le}function N(){const le=this.resume(),J=this.stack[this.stack.length-1];J.meta=le}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le.replace(/(\r?\n|\r)$/g,"")}function E(le){const J=this.resume(),he=this.stack[this.stack.length-1];he.label=J,he.identifier=Ti(this.sliceSerialize(le)).toLowerCase()}function S(){const le=this.resume(),J=this.stack[this.stack.length-1];J.title=le}function T(){const le=this.resume(),J=this.stack[this.stack.length-1];J.url=le}function P(le){const J=this.stack[this.stack.length-1];if(!J.depth){const he=this.sliceSerialize(le).length;J.depth=he}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function A(le){const J=this.stack[this.stack.length-1];J.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function M(le){const he=this.stack[this.stack.length-1].children;let re=he[he.length-1];(!re||re.type!=="text")&&(re=vt(),re.position={start:mo(le.start),end:void 0},he.push(re)),this.stack.push(re)}function F(le){const J=this.stack.pop();J.value+=this.sliceSerialize(le),J.position.end=mo(le.end)}function D(le){const J=this.stack[this.stack.length-1];if(this.data.atHardBreak){const he=J.children[J.children.length-1];he.position.end=mo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(J.type)&&(M.call(this,le),F.call(this,le))}function V(){this.data.atHardBreak=!0}function Y(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function _(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function z(){const le=this.resume(),J=this.stack[this.stack.length-1];J.value=le}function H(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=J,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const J=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=J,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function I(le){const J=this.sliceSerialize(le),he=this.stack[this.stack.length-2];he.label=hB(J),he.identifier=Ti(J).toLowerCase()}function K(){const le=this.stack[this.stack.length-1],J=this.resume(),he=this.stack[this.stack.length-1];if(this.data.inReference=!0,he.type==="link"){const re=le.children;he.children=re}else he.alt=J}function $(){const le=this.resume(),J=this.stack[this.stack.length-1];J.url=le}function W(){const le=this.resume(),J=this.stack[this.stack.length-1];J.title=le}function ee(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function ae(le){const J=this.resume(),he=this.stack[this.stack.length-1];he.label=J,he.identifier=Ti(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ue(le){this.data.characterReferenceType=le.type}function se(le){const J=this.sliceSerialize(le),he=this.data.characterReferenceType;let re;he?(re=sE(J,he==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=Ay(J);const ye=this.stack[this.stack.length-1];ye.value+=re}function xe(le){const J=this.stack.pop();J.position.end=mo(le.end)}function ke(le){F.call(this,le);const J=this.stack[this.stack.length-1];J.url=this.sliceSerialize(le)}function Re(le){F.call(this,le);const J=this.stack[this.stack.length-1];J.url="mailto:"+this.sliceSerialize(le)}function Ae(){return{type:"blockquote",children:[]}}function Qe(){return{type:"code",lang:null,meta:null,value:""}}function at(){return{type:"inlineCode",value:""}}function Ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function Z(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function Ye(){return{type:"link",title:null,url:"",children:[]}}function Me(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function et(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Je(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function mo(e){return{line:e.line,column:e.column,offset:e.offset}}function hE(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?hE(e,s):bB(e,s)}}function bB(e,t){let n;for(n in t)if(mE.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 g0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+uc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+uc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+uc({start:t.start,end:t.end})+") is still open")}function vB(e){const t=this;t.parser=n;function n(s){return xB(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function wB(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 jB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
574
- `}]}function kB(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 SB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function NB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=el(s.toLowerCase()),i=e.footnoteOrder.indexOf(s);let c,u=e.footnoteCounts.get(s);u===void 0?(u=0,e.footnoteOrder.push(s),c=e.footnoteOrder.length):c=i+1,u+=1,e.footnoteCounts.set(s,u);const d={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(c)}]};e.patch(t,d);const m={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,m),e.applyData(t,m)}function EB(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 TB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function gE(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const c=o[o.length-1];return c&&c.type==="text"?c.value+=s:o.push({type:"text",value:s}),o}function RB(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return gE(e,t);const o={src:el(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 AB(e,t){const n={src:el(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 PB(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 DB(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return gE(e,t);const o={href:el(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 $B(e,t){const n={href:el(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 LB(e,t,n){const s=e.all(t),o=n?IB(n):xE(t),i={},c=[];if(typeof t.checked=="boolean"){const h=s[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let u=-1;for(;++u<s.length;){const h=s[u];(o||u!==0||h.type!=="element"||h.tagName!=="p")&&c.push({type:"text",value:`
576
- `}),h.type==="element"&&h.tagName==="p"&&!o?c.push(...h.children):c.push(h)}const d=s[s.length-1];d&&(o||d.type!=="element"||d.tagName!=="p")&&c.push({type:"text",value:`
577
- `});const m={type:"element",tagName:"li",properties:i,children:c};return e.patch(t,m),e.applyData(t,m)}function IB(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=xE(n[s])}return t}function xE(e){const t=e.spread;return t??e.children.length>1}function OB(e,t){const n={},s=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<s.length;){const c=s[o];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function _B(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function FB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zB(e,t){const n=e.all(t),s=n.shift(),o=[];if(s){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],c),o.push(c)}if(n.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=Cy(t.children[1]),d=QC(t.children[t.children.length-1]);u&&d&&(c.position={start:u,end:d}),o.push(c)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function BB(e,t,n){const s=n?n.children:void 0,i=(s?s.indexOf(t):1)===0?"th":"td",c=n&&n.type==="table"?n.align:void 0,u=c?c.length:t.children.length;let d=-1;const m=[];for(;++d<u;){const g=t.children[d],y={},b=c?c[d]:void 0;b&&(y.align=b);let N={type:"element",tagName:i,properties:y,children:[]};g&&(N.children=e.all(g),e.patch(g,N),N=e.applyData(g,N)),m.push(N)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function UB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const x0=9,y0=32;function WB(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const i=[];for(;s;)i.push(b0(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return i.push(b0(t.slice(o),o>0,!1)),i.join("")}function b0(e,t,n){let s=0,o=e.length;if(t){let i=e.codePointAt(s);for(;i===x0||i===y0;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(o-1);for(;i===x0||i===y0;)o--,i=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function VB(e,t){const n={type:"text",value:WB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function HB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const KB={blockquote:wB,break:jB,code:kB,delete:SB,emphasis:NB,footnoteReference:CB,heading:EB,html:TB,imageReference:RB,image:AB,inlineCode:PB,linkReference:DB,link:$B,listItem:LB,list:OB,paragraph:_B,root:MB,strong:FB,table:zB,tableCell:UB,tableRow:BB,text:VB,thematicBreak:HB,toml:vd,yaml:vd,definition:vd,footnoteDefinition:vd};function vd(){}const yE=-1,vp=0,fc=1,bf=2,$y=3,Ly=4,Iy=5,Oy=6,bE=7,vE=8,v0=typeof self=="object"?self:globalThis,qB=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),s=o=>{if(e.has(o))return e.get(o);const[i,c]=t[o];switch(i){case vp:case yE:return n(c,o);case fc:{const u=n([],o);for(const d of c)u.push(s(d));return u}case bf:{const u=n({},o);for(const[d,m]of c)u[s(d)]=s(m);return u}case $y:return n(new Date(c),o);case Ly:{const{source:u,flags:d}=c;return n(new RegExp(u,d),o)}case Iy:{const u=n(new Map,o);for(const[d,m]of c)u.set(s(d),s(m));return u}case Oy:{const u=n(new Set,o);for(const d of c)u.add(s(d));return u}case bE:{const{name:u,message:d}=c;return n(new v0[u](d),o)}case vE:return n(BigInt(c),o);case"BigInt":return n(Object(BigInt(c)),o);case"ArrayBuffer":return n(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:u}=new Uint8Array(c);return n(new DataView(u),c)}}return n(new v0[i](c),o)};return s},w0=e=>qB(new Map,e)(0),ii="",{toString:GB}={},{keys:YB}=Object,Hl=e=>{const t=typeof e;if(t!=="object"||!e)return[vp,t];const n=GB.call(e).slice(8,-1);switch(n){case"Array":return[fc,ii];case"Object":return[bf,ii];case"Date":return[$y,ii];case"RegExp":return[Ly,ii];case"Map":return[Iy,ii];case"Set":return[Oy,ii];case"DataView":return[fc,n]}return n.includes("Array")?[fc,n]:n.includes("Error")?[bE,n]:[bf,n]},wd=([e,t])=>e===vp&&(t==="function"||t==="symbol"),JB=(e,t,n,s)=>{const o=(c,u)=>{const d=s.push(c)-1;return n.set(u,d),d},i=c=>{if(n.has(c))return n.get(c);let[u,d]=Hl(c);switch(u){case vp:{let h=c;switch(d){case"bigint":u=vE,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return o([yE],c)}return o([u,h],c)}case fc:{if(d){let y=c;return d==="DataView"?y=new Uint8Array(c.buffer):d==="ArrayBuffer"&&(y=new Uint8Array(c)),o([d,[...y]],c)}const h=[],g=o([u,h],c);for(const y of c)h.push(i(y));return g}case bf:{if(d)switch(d){case"BigInt":return o([d,c.toString()],c);case"Boolean":case"Number":case"String":return o([d,c.valueOf()],c)}if(t&&"toJSON"in c)return i(c.toJSON());const h=[],g=o([u,h],c);for(const y of YB(c))(e||!wd(Hl(c[y])))&&h.push([i(y),i(c[y])]);return g}case $y:return o([u,c.toISOString()],c);case Ly:{const{source:h,flags:g}=c;return o([u,{source:h,flags:g}],c)}case Iy:{const h=[],g=o([u,h],c);for(const[y,b]of c)(e||!(wd(Hl(y))||wd(Hl(b))))&&h.push([i(y),i(b)]);return g}case Oy:{const h=[],g=o([u,h],c);for(const y of c)(e||!wd(Hl(y)))&&h.push(i(y));return g}}const{message:m}=c;return o([u,{name:d,message:m}],c)};return i},j0=(e,{json:t,lossy:n}={})=>{const s=[];return JB(!(t||n),!!t,new Map,s)(e),s},vf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?w0(j0(e,t)):structuredClone(e):(e,t)=>w0(j0(e,t));function QB(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 XB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function ZB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||QB,s=e.options.footnoteBackLabel||XB,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let d=-1;for(;++d<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[d]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=el(g.toLowerCase());let b=0;const N=[],w=e.footnoteCounts.get(g);for(;w!==void 0&&++b<=w;){N.length>0&&N.push({type:"text",value:" "});let E=typeof n=="string"?n:n(d,b);typeof E=="string"&&(E={type:"text",value:E}),N.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(...N)}else h.push(...N);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:{...vf(c),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 wE=(function(e){if(e==null)return r8;if(typeof e=="function")return wp(e);if(typeof e=="object")return Array.isArray(e)?e8(e):t8(e);if(typeof e=="string")return n8(e);throw new Error("Expected function, string, or object as test")});function e8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=wE(e[n]);return wp(s);function s(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function t8(e){const t=e;return wp(n);function n(s){const o=s;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function n8(e){return wp(t);function t(n){return n&&n.type===e}}function wp(e){return t;function t(n,s,o){return!!(s8(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function r8(){return!0}function s8(e){return e!==null&&typeof e=="object"&&"type"in e}const jE=[],o8=!0,k0=!1,a8="skip";function i8(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const i=wE(o),c=s?-1:1;u(e,void 0,[])();function u(d,m,h){const g=d&&typeof d=="object"?d:{};if(typeof g.type=="string"){const b=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(y,"name",{value:"node ("+(d.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=jE,N,w,v;if((!t||i(d,m,h[h.length-1]||void 0))&&(b=l8(n(d,h)),b[0]===k0))return b;if("children"in d&&d.children){const k=d;if(k.children&&b[0]!==a8)for(w=(s?k.children.length:-1)+c,v=h.concat(k);w>-1&&w<k.children.length;){const E=k.children[w];if(N=u(E,w,v)(),N[0]===k0)return N;w=typeof N[1]=="number"?N[1]:w+c}}return b}}}function l8(e){return Array.isArray(e)?e:typeof e=="number"?[o8,e]:e==null?jE:[e]}function kE(e,t,n,s){let o,i,c;typeof t=="function"&&typeof n!="function"?(i=void 0,c=t,o=n):(i=t,c=n,o=s),i8(e,i,u,o);function u(d,m){const h=m[m.length-1],g=h?h.children.indexOf(d):void 0;return c(d,g,h)}}const tx={}.hasOwnProperty,c8={};function u8(e,t){const n=t||c8,s=new Map,o=new Map,i=new Map,c={...KB,...n.handlers},u={all:m,applyData:f8,definitionById:s,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:c,one:d,options:n,patch:d8,wrap:m8};return kE(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(tx.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=vf(v);return k.children=u.all(h),k}return vf(h)}return(u.options.unknownHandler||p8)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const N=u.one(y[b],h);if(N){if(b&&y[b-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=S0(N.value)),!Array.isArray(N)&&N.type==="element")){const w=N.children[0];w&&w.type==="text"&&(w.value=S0(w.value))}Array.isArray(N)?g.push(...N):g.push(N)}}}return g}}function d8(e,t){e.position&&(t.position=GF(e))}function f8(e,t){let n=t;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const c="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:c}}n.type==="element"&&i&&Object.assign(n.properties,vf(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function p8(e,t){const n=t.data||{},s="value"in t&&!(tx.call(n,"hProperties")||tx.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 m8(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 S0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function N0(e,t){const n=u8(e,t),s=n.one(e,void 0),o=ZB(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 h8(e,t){return e&&"run"in e?async function(n,s){const o=N0(n,{file:s,...t});await e.run(o,s)}:function(n,s){return N0(n,{file:s,...e||t})}}function C0(e){if(e)throw e}var Jh,E0;function g8(){if(E0)return Jh;E0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},i=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var y;for(y in m);return typeof y>"u"||e.call(m,y)},c=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(s)return s(m,h).value}else return;return m[h]};return Jh=function d(){var m,h,g,y,b,N,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,N=g&&o(g)?g:[]):N=g&&i(g)?g:{},c(w,{name:h,newValue:d(E,N,y)})):typeof y<"u"&&c(w,{name:h,newValue:y}));return w},Jh}var x8=g8();const Qh=Nf(x8);function nx(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 y8(){const e=[],t={run:n,use:s};return t;function n(...o){let i=-1;const c=o.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);u(null,...o);function u(d,...m){const h=e[++i];let g=-1;if(d){c(d);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,h?b8(h,u)(...m):c(null,...m)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function b8(e,t){let n;return s;function s(...c){const u=e.length>c.length;let d;u&&c.push(o);try{d=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return o(h)}u||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(c,...u){n||(n=!0,t(c,...u))}function i(c){o(null,c)}}const ys={basename:v8,dirname:w8,extname:j8,join:k8,sep:"/"};function v8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Yc(e);let n=0,s=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let c=-1,u=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else c<0&&(i=!0,c=o+1),u>-1&&(e.codePointAt(o)===t.codePointAt(u--)?u<0&&(s=o):(u=-1,s=c));return n===s?s=c:s<0&&(s=e.length),e.slice(n,s)}function w8(e){if(Yc(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 j8(e){Yc(e);let t=e.length,n=-1,s=0,o=-1,i=0,c;for(;t--;){const u=e.codePointAt(t);if(u===47){if(c){s=t+1;break}continue}n<0&&(c=!0,n=t+1),u===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function k8(...e){let t=-1,n;for(;++t<e.length;)Yc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S8(n)}function S8(e){Yc(e);const t=e.codePointAt(0)===47;let n=N8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function N8(e,t){let n="",s=0,o=-1,i=0,c=-1,u,d;for(;++c<=e.length;){if(c<e.length)u=e.codePointAt(c);else{if(u===47)break;u=47}if(u===47){if(!(o===c-1||i===1))if(o!==c-1&&i===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf("/")),o=c,i=0;continue}}else if(n.length>0){n="",s=0,o=c,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,c):n=e.slice(o+1,c),s=c-o-1;o=c,i=0}else u===46&&i>-1?i++:i=-1}return n}function Yc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const C8={cwd:E8};function E8(){return"/"}function rx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function T8(e){if(typeof e=="string")e=new URL(e);else if(!rx(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 R8(e)}function R8(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 Xh=["history","path","basename","stem","extname","dirname"];class SE{constructor(t){let n;t?rx(t)?n={path:t}:typeof t=="string"||A8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":C8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Xh.length;){const i=Xh[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)Xh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ys.basename(this.path):void 0}set basename(t){eg(t,"basename"),Zh(t,"basename"),this.path=ys.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ys.dirname(this.path):void 0}set dirname(t){T0(this.basename,"dirname"),this.path=ys.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ys.extname(this.path):void 0}set extname(t){if(Zh(t,"extname"),T0(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ys.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){rx(t)&&(t=T8(t)),eg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ys.basename(this.path,this.extname):void 0}set stem(t){eg(t,"stem"),Zh(t,"stem"),this.path=ys.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new qn(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 Zh(e,t){if(e&&e.includes(ys.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ys.sep+"`")}function eg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function T0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function A8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const P8=(function(e){const s=this.constructor.prototype,o=s[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),D8={}.hasOwnProperty;class _y extends P8{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=y8()}copy(){const t=new _y;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Qh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rg("data",this.frozen),this.namespace[t]=n,this):D8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rg("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=jd(t),s=this.parser||this.Parser;return tg("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),tg("process",this.parser||this.Parser),ng("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,c){const u=jd(t),d=s.parse(u);s.run(d,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,N=s.stringify(b,y);I8(N)?y.value=N:y.result=N,m(h,y)});function m(h,g){h||!g?c(h):i?i(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),tg("processSync",this.parser||this.Parser),ng("processSync",this.compiler||this.Compiler),this.process(t,o),A0("processSync","process",n),s;function o(i,c){n=!0,C0(i),s=c}}run(t,n,s){R0(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?i(void 0,s):new Promise(i);function i(c,u){const d=jd(n);o.run(t,d,m);function m(h,g,y){const b=g||t;h?u(h):c?c(b):s(void 0,b,y)}}}runSync(t,n){let s=!1,o;return this.run(t,n,i),A0("runSync","run",s),o;function i(c,u){C0(c),o=u,s=!0}}stringify(t,n){this.freeze();const s=jd(n),o=this.compiler||this.Compiler;return ng("stringify",o),R0(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(rg("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(m){if(typeof m=="function")d(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;d(h,g)}else c(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function c(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");u(m.plugins),m.settings&&(o.settings=Qh(!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,...N]=h;const w=s[y][1];nx(w)&&nx(b)&&(b=Qh(!0,w,b)),s[y]=[m,b,...N]}}}}const $8=new _y().freeze();function tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ng(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rg(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 R0(e){if(!nx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function A0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jd(e){return L8(e)?e:new SE(e)}function L8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function I8(e){return typeof e=="string"||O8(e)}function O8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",P0=[],D0={allowDangerousHtml:!0},M8=/^(https?|ircs?|mailto|xmpp)$/i,F8=[{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 z8(e){const t=B8(e),n=U8(e);return W8(t.runSync(t.parse(n),n),e)}function B8(e){const t=e.rehypePlugins||P0,n=e.remarkPlugins||P0,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...D0}:D0;return $8().use(vB).use(n).use(h8,s).use(t)}function U8(e){const t=e.children||"",n=new SE;return typeof t=="string"&&(n.value=t),n}function W8(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,i=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||V8;for(const h of F8)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+_8+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),kE(e,m),ZF(e,{Fragment:r.Fragment,components:o,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function m(h,g,y){if(h.type==="raw"&&y&&typeof g=="number")return c?y.children.splice(g,1):y.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let b;for(b in qh)if(Object.hasOwn(qh,b)&&Object.hasOwn(h.properties,b)){const N=h.properties[b],w=qh[b];(w===null||w.includes(h.tagName))&&(h.properties[b]=d(String(N||""),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 V8(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||M8.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(z8,{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 H8(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,c]=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()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Vi(d=>{d.type==="todos-updated"&&d.projectSlug===e&&u()}),{data:t,loading:s,error:i,refetch:u}}async function K8(e,t,n){await fetch(Hr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function q8(e,t,n){await fetch(`${Hr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function G8(e,t,n){await fetch(`${Hr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function Y8(e,t,n){await fetch(`${Hr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function J8(e,t){await fetch(`${Hr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function Q8(e,t){await fetch(`${Hr(e)}/${t}`,{method:"DELETE"})}async function X8(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 NE(e,t,n){return`${Hr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function Z8(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 eU(e,t,n){const s=await fetch(NE(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function CE(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,c=new Error(i);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function tU(e,t){return await CE(`${Hr(e)}/promote`,t)}async function nU(e,t,n){await CE(`${Hr(e)}/${t}/move`,{to:n})}const $0=[{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 EE({status:e,onChange:t}){const[n,s]=f.useState(!1),o=f.useRef(null);f.useEffect(()=>{if(!n)return;function c(u){o.current&&!o.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const i=$0.find(c=>c.value===e);return r.jsxs("div",{className:"relative",ref:o,onClick:c=>c.stopPropagation(),children:[r.jsx("button",{onClick:()=>s(!n),className:`text-lg leading-none ${i.color} hover:opacity-70 transition`,title:i.label,children:i.icon}),n&&r.jsx("div",{className:"absolute left-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:$0.filter(c=>c.value!==e).map(c=>r.jsxs("button",{onClick:()=>{t(c.value),s(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${c.color}`,children:[r.jsx("span",{className:"text-base leading-none",children:c.icon}),r.jsx("span",{children:c.label})]},c.value))})]})}function TE({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:o,onEndEdit:i,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:d,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:N,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(EE,{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(RE,{description:e.description,status:e.status,editing:s,onBeginEdit:()=>o(e.id),onEndEdit:i,onSave:T=>c(e.id,T)}),e.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(T=>`#${T}`).join(" ")}),e.session&&r.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),r.jsx(iU,{item:e})]}),r.jsx(AE,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>d(e.id,T)})]}),t===e.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Rr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:T=>b(T,e.id),children:["t:",e.id]}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:T=>b(T,e.id),children:r.jsx(Yd,{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(Af,{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=>N(T,e.id,e.description),children:r.jsx(yn,{className:"h-3 w-3"})})]})]})}function RE({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:o,onSave:i}){return n?r.jsx(rU,{initialValue:e,onSave:i,onExit:o}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:c=>{c.stopPropagation(),s()},title:"Click to edit",className: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 rU({initialValue:e,onSave:t,onExit:n}){const s=f.useRef(e),[o,i]=f.useState(e),[c,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 N(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:c,value:o,onClick:w=>w.stopPropagation(),onChange:w=>i(w.target.value),onKeyDown:N,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",c&&"opacity-70")})}function sU(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function oU(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 AE({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const o=e.attachments??[],[i,c]=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),c(!1)}finally{d(!1)}}},[n]);return r.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:y=>y.stopPropagation(),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(y=>r.jsx(aU,{att:y,url:t(e.id,y.id),onDelete:()=>void s(y.id)},y.id)),r.jsxs("button",{type:"button","data-no-drag":!0,title:"Attach files",onClick:()=>c(y=>!y),className:"inline-flex items-center gap-1 rounded-md border border-border/60 px-1.5 py-0.5 text-xs text-muted-foreground hover:text-foreground hover:border-border transition",children:[r.jsx(Yk,{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=oU(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 aU({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:[sU(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(Yk,{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($f,{className:"h-3 w-3"})})]})}function iU({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(ca,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-info-foreground/30 bg-info/30 px-1.5 py-0.5 text-[10px] font-mono text-info-foreground",children:[r.jsx(bx,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(ur,{children:e.branch})]})}):null,e.planDir?r.jsx(ca,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Kc(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(qk,{className:"h-2.5 w-2.5"})})}),r.jsxs(ur,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(ca,{delayDuration:120,children:r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),r.jsx(ur,{children:r.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?r.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?r.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?r.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const PE="__one_off__";function My({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o,defaultProject:i,defaultTitle:c,allowOneOff:u=!0}){const[d,m]=f.useState("new"),[h,g]=f.useState(!1),[y,b]=f.useState(null),[N,w]=f.useState(null),[v,k]=f.useState(null),[E,S]=f.useState(""),[T,P]=f.useState(""),[R,A]=f.useState(""),[L,M]=f.useState(""),[F,D]=f.useState(""),[V,Y]=f.useState(""),[_,z]=f.useState(null),[H,q]=f.useState(!1),I=t.length>1;f.useEffect(()=>{if(!e){m("new"),b(null),S(""),P(""),A(""),M(""),D(""),Y(""),z(null);return}S(i??""),P(c??"");let ae=!1;return(async()=>{try{const ue=await fetch("/api/projects");if(!ue.ok)throw new Error(`HTTP ${ue.status}`);const se=await ue.json();ae||w(se.filter(xe=>!xe.archived))}catch(ue){ae||k(ue instanceof Error?ue.message:String(ue))}})(),()=>{ae=!0}},[e,i,c]),f.useEffect(()=>{if(!F){z(null);return}let ae=!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 se=await ue.json();ae||z(se)}catch{ae||z([])}finally{ae||q(!1)}})(),()=>{ae=!0}},[F]);const K=f.useMemo(()=>N??[],[N]);async function $(ae){if(ae.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(I&&!T.trim()){b("Title is required when promoting multiple todos.");return}const ue=E===PE?{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:L||void 0};await B(xe);return}const se={todoIds:t,mode:"new-assignment",target:ue,title:T.trim()||void 0,type:R.trim()||void 0,priority:L||void 0};await ee(se)}async function W(ae){if(ae.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!F||!V){b("Pick both project and assignment.");return}const ue={todoIds:t,mode:"to-assignment",target:{assignment:`${F}/${V}`}};await ee(ue)}async function ee(ae){g(!0),b(null);try{let ue;if(n.kind==="workspace")ue=await rD(n.workspace,ae);else if(n.kind==="project")ue=await tU(n.projectId,ae);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 B(ae){g(!0),b(null);try{const ue=await sD(ae);o(ue),s(!1)}catch(ue){b(ue instanceof Error?ue.message:String(ue))}finally{g(!1)}}return r.jsx($n,{open:e,onOpenChange:ae=>h?void 0:s(ae),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsxs(Tn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Vr,{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(UC,{value:d,onValueChange:ae=>m(ae),children:[r.jsxs(WC,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Kg,{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(Kg,{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(qg,{value:"new",children:r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsx(li,{label:"Target project",children:r.jsx(L0,{value:E,onChange:S,projects:K,error:v,disabled:h,allowOneOff:u})}),r.jsx(li,{label:I?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ae=>P(ae.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(li,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ae=>A(ae.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(li,{label:"Priority",children:r.jsxs("select",{value:L,onChange:ae=>M(ae.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(I0,{message:y}):null,r.jsx(O0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(qg,{value:"existing",children:r.jsxs("form",{onSubmit:W,className:"space-y-4",children:[r.jsx(li,{label:"Project",children:r.jsx(L0,{value:F,onChange:ae=>{D(ae),Y("")},projects:K,error:v,disabled:h})}),r.jsx(li,{label:H?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:V,onChange:ae=>Y(ae.target.value),disabled:h||!F||H,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:F?"Select assignment...":"Pick a project first"}),(_??[]).map(ae=>r.jsxs("option",{value:ae.slug,children:[ae.title," (",ae.status,")"]},ae.slug))]})}),y?r.jsx(I0,{message:y}):null,r.jsx(O0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function li({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 L0({value:e,onChange:t,projects:n,error:s,disabled:o,allowOneOff:i}){return s?r.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",s]}):r.jsxs("select",{value:e,onChange:c=>t(c.target.value),disabled:o,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),i?r.jsx("option",{value:PE,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function I0({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 O0({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:e,disabled:t,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:t,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function DE({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o}){const[i,c]=f.useState("project"),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(!1),[b,N]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null);f.useEffect(()=>{if(!e){c("project"),d(""),h(""),N(null),v(null);return}let A=!1;return(async()=>{try{const L=await fetch("/api/projects");if(!L.ok)throw new Error(`HTTP ${L.status}`);const M=await L.json();A||E(M.filter(F=>!F.archived))}catch(L){A||v(L instanceof Error?L.message:String(L))}})(),()=>{A=!0}},[e]);const S=f.useMemo(()=>k?n.kind==="project"?k.filter(A=>A.slug!==n.projectId):k:[],[k,n]);function T(){if(i==="global")return{global:!0};if(i==="workspace"){const A=u.trim();return A?{workspace:A}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function P(A,L){try{return n.kind==="workspace"?await oD(n.workspace,A,L):await nU(n.projectId,A,L),{ok:!0}}catch(M){return{ok:!1,error:M instanceof Error?M.message:String(M)}}}async function R(A){A.preventDefault(),v(null);const L=T();if(typeof L=="string"){v(L);return}y(!0),N(null);const M=[],F=[];for(const D of t){const V=await P(D,L);V.ok?M.push(D):F.push({id:D,error:V.error})}y(!1),o(),F.length===0?s(!1):N({succeeded:M,failed:F})}return r.jsx($n,{open:e,onOpenChange:A=>g?void 0:s(A),children:r.jsx(En,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(Zn,{children:[r.jsxs(Tn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Vr,{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(sg,{kind:"project",checked:i==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(sg,{kind:"workspace",checked:i==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(sg,{kind:"global",checked:i==="global",onChange:()=>c("global"),label:"Global"})]}),i==="project"?r.jsx(_0,{label:"Target project",children:r.jsxs("select",{value:m,onChange:A=>h(A.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),S.map(A=>r.jsxs("option",{value:A.slug,children:[A.title," (",A.slug,")"]},A.slug))]})}):null,i==="workspace"?r.jsx(_0,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:A=>d(A.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,w?r.jsx(lU,{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(A=>r.jsxs("li",{children:["[t:",A.id,"] ",A.error]},A.id))})]}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>s(!1),disabled:g,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:b?"Close":"Cancel"}),b===null?r.jsx("button",{type:"submit",disabled:g,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:g?"Moving...":"Move"}):null]})]})})})}function _0({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 sg({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 lU({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 Fy({label:e,count:t,expanded:n,onToggle:s,isDropTarget:o=!1,onDragOver:i,onDragLeave:c,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:c,onDrop:u,children:[r.jsxs("button",{type:"button",onClick:s,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[r.jsx(pr,{className: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 $E=[{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 jp(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function zy(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[jp(n.status)].push(n);return $E.map(n=>({config:n,items:t[n.id]}))}const LE="syntaur.todos.sections.collapsed.v1",M0=Object.fromEntries($E.map(e=>[e.id,e.defaultCollapsed]));function og(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(LE);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function cU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(LE,JSON.stringify(e))}catch{}}function By(e){const[t,n]=f.useState(()=>og()[e]??{});f.useEffect(()=>{n(og()[e]??{})},[e]);const s=f.useCallback(i=>t[i]??M0[i],[t]),o=f.useCallback(i=>{const c=og(),u=c[e]??{},d=u[i]??M0[i],m={...u,[i]:!d};c[e]=m,cU(c),n(m)},[e]);return{isCollapsed:s,toggle:o}}function uU({projectId:e}){const{data:t,loading:n,error:s,refetch:o}=H8(e),[i,c]=f.useState(""),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,N]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(new Set),[S,T]=f.useState(!1),[P,R]=f.useState(!1),[A,L]=f.useState(null),M=f.useRef(null);Ro("list:todos");const F=By("project:"+e),[D,V]=f.useState(null),[Y,_]=f.useState(null),z=f.useRef(null);async function H(J,he){J.stopPropagation(),await Kc(he)&&(N(he),setTimeout(()=>N(re=>re===he?null:re),1500))}const q=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const J=new Set;for(const he of t.items)for(const re of he.tags)J.add(re);return Array.from(J).sort()},[t]),I=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let J=t.items;if(i.trim()){const he=i.toLowerCase();J=J.filter(re=>re.description.toLowerCase().includes(he)||re.tags.some(ye=>ye.toLowerCase().includes(he))||re.id.includes(he))}return u&&(J=J.filter(he=>he.status===u)),m&&(J=J.filter(he=>he.tags.includes(m))),J},[t,i,u,m]);f.useEffect(()=>{E(new Set)},[i,u,m,e]);const K=f.useMemo(()=>I.filter(J=>k.has(J.id)).length,[I,k]),$=I.length>0&&K===I.length,W=K>0&&!$;function ee(J){E(he=>{const re=new Set(he);return re.has(J)?re.delete(J):re.add(J),re})}function B(){E(J=>{const he=new Set(J);if($)for(const re of I)he.delete(re.id);else for(const re of I)he.add(re.id);return he})}function ae(){E(new Set)}const ue=A?[A]:Array.from(k);function se(){E(new Set),L(null),o()}function xe(){E(new Set),o()}async function ke(){g.trim()&&(await K8(e,g.trim()),y(""),o())}async function Re(J,he,re){J.stopPropagation(),window.confirm(`Delete "${re}"? This can't be undone.`)&&(await Q8(e,he),o())}async function Ae(J,he){switch(he){case"open":await J8(e,J);break;case"in_progress":await Y8(e,J);break;case"completed":await q8(e,J);break;case"blocked":await G8(e,J);break}o()}async function Qe(J,he){await X8(e,J,he),o()}async function at(J,he){await Z8(e,J,he),o()}async function Ze(J,he){await eU(e,J,he),o()}const ot=zy(I),Z=ot.filter(J=>!F.isCollapsed(J.config.id)).flatMap(J=>J.items),{hotkeyRowProps:_e}=Oc(Z,{scope:"list:todos",bindO:!1,onOpen:J=>v(J.id)});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var J;return(J=M.current)==null?void 0:J.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Ee,Ie]=ls(),Ye=Ee.get("focus");f.useEffect(()=>{if(!Ye||!(t!=null&&t.items))return;const J=t.items.find(re=>re.id===Ye);if(!J)return;const he=jp(J.status);F.isCollapsed(he)&&F.toggle(he)},[Ye,t==null?void 0:t.items]),f.useEffect(()=>{if(!Ye)return;const J=document.querySelector(`[data-todo-id="${window.CSS.escape(Ye)}"]`);if(!J)return;J.scrollIntoView({block:"nearest"}),J.classList.add("ring-2","ring-primary/60");const he=window.setTimeout(()=>{J.classList.remove("ring-2","ring-primary/60"),Ie(re=>{const ye=new URLSearchParams(re);return ye.delete("focus"),ye},{replace:!0})},1500);return()=>window.clearTimeout(he)},[Ye,Z.length,Ie]);const Me=D?(t==null?void 0:t.items.find(J=>J.id===D))??null:null;function et(J,he){const re=z.current;if(re!=null&&re.closest(Oi)){J.preventDefault();return}J.dataTransfer.effectAllowed="move",J.dataTransfer.setData("text/plain",he),V(he)}function Je(){V(null),_(null)}function $t(J,he){!Me||he.statuses.includes(Me.status)||(J.preventDefault(),J.dataTransfer.dropEffect="move",_(he.id))}function vt(J,he){Y===he.id&&!J.currentTarget.contains(J.relatedTarget)&&_(null)}function ct(J,he){J.preventDefault();const re=Me;Je(),!(!re||he.statuses.includes(re.status))&&Ae(re.id,he.dropStatus)}if(n)return r.jsx(mt,{label:"Loading todos..."});if(s)return r.jsx(kt,{error:s});const le=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(_n,{label:"Open",value:le.open,icon:zr}),r.jsx(_n,{label:"In Progress",value:le.in_progress,icon:zr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:le.blocked,icon:Sx,tone:"warn"}),r.jsx(_n,{label:"Total",value:le.total,icon:zr})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:J=>y(J.target.value),onKeyDown:J=>J.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(Ct,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:M,type:"text",placeholder:"Search...",value:i,onChange:J=>c(J.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:J=>d(J.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:J=>h(J.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(J=>r.jsxs("option",{value:J,children:["#",J]},J))]})]}),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:()=>{L(null),R(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:ae,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,I.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:$,ref:J=>{J&&(J.indeterminate=W)},onChange:B,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",I.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let J=-1;return ot.map(({config:he,items:re})=>{const ye=!F.isCollapsed(he.id);return r.jsx(Fy,{label:he.label,count:re.length,expanded:ye,onToggle:()=>F.toggle(he.id),isDropTarget:Y===he.id,onDragOver:Pe=>$t(Pe,he),onDragLeave:Pe=>vt(Pe,he),onDrop:Pe=>ct(Pe,he),children:ye&&re.map(Pe=>(J+=1,r.jsx(TE,{item:Pe,copiedId:b,selected:k.has(Pe.id),editing:w===Pe.id,onBeginEdit:ve=>v(ve),onEndEdit:()=>v(null),onPatchDescription:Qe,onAddAttachments:at,onDeleteAttachment:Ze,attachmentUrl:(ve,te)=>NE(e,ve,te),onToggleSelected:ve=>ee(ve),onMoveOne:(ve,te)=>{te.stopPropagation(),L(ve),R(!0)},onStatusChange:Ae,onCopyId:H,onDelete:Re,hotkeyRowProps:_e(J),onDragOrigin:ve=>{z.current=ve.target},onDragStart:et,onDragEnd:Je,isDragging:D===Pe.id},Pe.id)))},he.id)})})()}),r.jsx(My,{open:S,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:xe}),r.jsx(DE,{open:P,selectedIds:ue,scope:{kind:"project",projectId:e},onOpenChange:J=>{R(J),J||L(null)},onDone:se})]})}const dU={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},F0=new Set(["title"]);function IE({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function o(c){if(F0.has(c))return;const d=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:d})}const i=e.hidden.length;return r.jsxs($n,{open:n,onOpenChange:s,children:[r.jsx(i4,{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(uP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",i>0?` (${Oh.length-i}/${Oh.length})`:""]})]})}),r.jsxs(En,{className:"max-w-sm",children:[r.jsx(Zn,{children:r.jsx(Tn,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:Oh.map(c=>{const u=e.hidden.includes(c),d=F0.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${d?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>o(c),disabled:d,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:dU[c]}),d?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const Ri={...jc,custom:!1},OE=`view-prefs.cache.v${jc.version}`;let Tc=fU(),ci=null;const Rc=new Set;let _E=0;function Uy(){return++_E}function Wy(e){return e===_E}function fU(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(OE);if(!e)return null;const t=JSON.parse(e);return t.version!==jc.version?null:t}catch{return null}}function pU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(OE,JSON.stringify(e))}catch{}}function Vy(e){Tc=e,pU(e);for(const t of Rc)t(e)}function Hy(e){if(!e||typeof e!="object")return Ri;const t=e;return t.version!==jc.version||!t.global||!t.projects?Ri:{version:jc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Ky(){if(ci)return ci;const e=Uy();return ci=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Hy(t);return Wy(e)&&Vy(n),ci=null,Tc??n}).catch(()=>(ci=null,Tc??Ri)),ci}function ME(e){const[t,n]=f.useState(()=>Tc??Ri);return f.useEffect(()=>{let s=!1;return Ky().then(o=>{s||n(o)}),Rc.add(n),()=>{s=!0,Rc.delete(n)}},[]),hN(t,e??null)}function mU(){const[e,t]=f.useState(()=>Tc??Ri);return f.useEffect(()=>{let n=!1;return Ky().then(s=>{n||t(s)}),Rc.add(t),()=>{n=!0,Rc.delete(t)}},[]),e}async function FE(e){const t=Uy(),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=Hy(await n.json());return Wy(t)&&Vy(s),s}function zE(e){return FE({global:e})}function BE(e,t){return FE({projects:{[e]:t}})}async function hU(){const e=Uy(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Hy(await t.json());return Wy(e)&&Vy(n),n}const z0=80;function UE({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:o="Save view"}){const[i,c]=f.useState(n),[u,d]=f.useState(!1),[m,h]=f.useState(null);f.useEffect(()=>{e&&(c(n),h(null),d(!1))},[e,n]);const g=i.trim(),y=g.length>0&&g.length<=z0;return r.jsx($n,{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(N){h(N instanceof Error?N.message:String(N)),d(!1)}}},children:[r.jsx(Zn,{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:z0,onChange:b=>c(b.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),m?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:m}):null]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:u,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!y||u,className:"shell-action shell-action--cta disabled:opacity-50",children:u?"Saving…":"Save"})]})]})})})}function WE({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:o,loading:i}=Bc(),[c,u]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{if(!c)return;function y(N){d.current&&!d.current.contains(N.target)&&u(!1)}function b(N){N.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=f.useMemo(()=>o.filter(y=>jN(y,e)),[o,e]),h=t?o.find(y=>y.id===t)??null:null,g=i?"Saved views…":h?h.name:"Saved views";return r.jsxs("div",{className:"relative",ref:d,children:[r.jsxs("button",{type:"button",disabled:i,onClick:()=>u(y=>!y),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":c,title:"Saved views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:g}),r.jsx(pr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),c&&r.jsx("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:m.length===0?r.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),r.jsx("button",{type:"button",onClick:()=>{u(!1),s()},className:"shell-action w-full justify-center",children:"Save current view"})]}):m.map(y=>{const b=y.id===t;return r.jsxs("button",{type:"button",onClick:()=>{u(!1),n(y)},className: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(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const gU=new Set(["overview","assignments","todos","dependencies","knowledge"]),B0="__unknown_type__";function U0(){const{slug:e,workspace:t}=Mt(),n=un(),s=_t();Ro("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:c,refetch:u}=j1(e),d=xa(),m=fp(),{data:h}=ma(),[g,y]=ls(),b=g.get("tab"),N=b&&gU.has(b)?b:"overview";function w(oe){y(ze=>{const tt=new URLSearchParams(ze);return oe==="overview"?tt.delete("tab"):tt.set("tab",oe),tt},{replace:!0})}const v=e?`p:${e}`:null,k=ME(v),[E,S]=f.useState(()=>Ih(k.defaultView)),[T,P]=f.useState(()=>Fe(k.filters.status)),[R,A]=f.useState(()=>Fe(k.filters.assignee)),[L,M]=f.useState(()=>Fe(k.filters.priority)),[F,D]=f.useState(()=>Fe(k.filters.type)),[V,Y]=f.useState(()=>Fe(k.filters.tags)),[_,z]=f.useState(null),[H,q]=f.useState(()=>k.grouping),[I,K]=f.useState(()=>k.sortField),[$,W]=f.useState(()=>k.sortDirection),[ee,B]=f.useState(()=>({collapsed:[]})),[ae,ue]=f.useState(()=>({hidden:[]})),[se,xe]=f.useState(()=>({hidden:[]})),[ke,Re]=f.useState(null),[Ae,Qe]=f.useState(!1),[at,Ze]=f.useState(!1),{toast:ot,showToast:Z,dismissToast:_e}=Ao(),Ee={kind:"project",slug:e??"",workspace:t??null},Ie=g.get("loadView"),{view:Ye,loading:Me,error:et}=So(Ie),{view:Je,loading:$t,error:vt}=So(ke),ct=f.useRef(null);f.useEffect(()=>{ke&&!$t&&!vt&&!Je&&Re(null)},[Je,vt,ke,$t]),f.useEffect(()=>{Re(null),ct.current=null,z(null)},[e,t]),f.useEffect(()=>{S(Ih(k.defaultView)),P(Fe(k.filters.status)),A(Fe(k.filters.assignee)),M(Fe(k.filters.priority)),D(Fe(k.filters.type)),Y(Fe(k.filters.tags)),q(k.grouping),K(k.sortField),W(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const le=f.useCallback(oe=>{v&&BE(v,oe).catch(ze=>{console.warn("Failed to persist project view prefs:",ze)})},[v]),J=f.useCallback(oe=>{S(oe),le({defaultView:oe})},[le]),he=f.useCallback(oe=>{P(oe),le({filters:{status:oe}})},[le]),re=f.useCallback(oe=>{A(oe),le({filters:{assignee:oe}})},[le]),ye=f.useCallback(oe=>{M(oe),le({filters:{priority:oe}})},[le]),Pe=f.useCallback(oe=>{D(oe),le({filters:{type:oe}})},[le]),ve=f.useCallback(oe=>{Y(oe),le({filters:{tags:oe}})},[le]),te=f.useCallback(oe=>{q(oe),le({grouping:oe})},[le]),fe=f.useCallback(oe=>{K(oe),le({sortField:oe})},[le]),Se=f.useCallback(oe=>{W(oe),le({sortDirection:oe})},[le]),Ue=f.useCallback(()=>({viewMode:E,filters:{status:T,priority:L,type:F,assignee:R,tags:V,project:"all",activity:"all",dateRange:ua(_)},sortField:I,sortDirection:$,listSectionVisibility:ee,kanbanColumnVisibility:ae,tableColumnVisibility:se}),[E,T,L,F,R,V,_,I,$,ee,ae,se]),ce=f.useCallback(oe=>{xC(oe,{setViewMode:ze=>S(Ih(ze)),setStatusFilter:he,setPriorityFilter:ye,setTypeFilter:Pe,setAssigneeFilter:re,setTagsFilter:ve,setDateRange:z,setSortField:fe,setSortDirection:Se,setListSectionVisibility:B,setKanbanColumnVisibility:ue,setTableColumnVisibility:xe}),Re(oe.id)},[he,ye,Pe,re,ve,fe,Se]),pt=f.useCallback(oe=>{ce(oe),ct.current=oe.id,y(ze=>{const tt=new URLSearchParams(ze);return tt.set("loadView",oe.id),tt},{replace:!0})},[ce,y]),xt=f.useCallback(async oe=>{try{const ze=_i({name:oe,context:{workspace:t??null,projectSlug:e??null},state:Ue()}),tt=await $i(ze),yt=tt.views[tt.views.length-1];Re((yt==null?void 0:yt.id)??null),yt&&(ct.current=yt.id,y(tr=>{const qr=new URLSearchParams(tr);return qr.set("loadView",yt.id),qr},{replace:!0})),Qe(!1),Ze(!1),Z(`Saved view "${oe}"`,"success")}catch(ze){throw Z(ze instanceof Error?ze.message:"Failed to save view","error"),ze}},[Ue,y,Z,e,t]),St=f.useCallback(async()=>{if(!(!ke||!Je))try{const oe=Fe(Je.config.filters.project)[0]??null,ze=_i({name:Je.name,context:{workspace:t??null,projectSlug:oe},state:Ue()}),tt=hf(Je.config,ze.config,ze.config);await lf(ke,{config:tt}),Z("View updated","success")}catch(oe){Z(oe instanceof Error?oe.message:"Failed to update view","error")}},[Ue,Je,ke,Z,t]);f.useEffect(()=>{if(!Ie){ct.current=null;return}if(ct.current!==Ie&&(ke&&ke!==Ie&&Re(null),!Me)){if(et){Z("Couldn't load saved view — try again","error");return}if(Ye){if(ct.current=Ie,!jN(Ye,{kind:"project",slug:e??"",workspace:t??null})){s(bC(Ye),{replace:!0});return}ce(Ye),y(oe=>{const ze=new URLSearchParams(oe);return ze.delete("loadView"),ze},{replace:!0});return}ct.current=Ie,Z("Saved view no longer exists","error"),y(oe=>{const ze=new URLSearchParams(oe);return ze.delete("loadView"),ze},{replace:!0})}},[Ie,Ye,Me,et,ke,ce,y,Z,s,e,t]);function st(oe){I===oe?Se($==="asc"?"desc":"asc"):(fe(oe),Se("asc"))}const me=f.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(oe=>{const ze=`${n}/projects/${o.slug}/assignments/${oe.slug}`;return[[oe.slug,ze],[oe.title,ze]]})):{},[o]);async function Oe(oe){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:oe})}),u()}async function qe(oe){try{const ze=await fetch(`/api/projects/${e}/${oe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!ze.ok){const tt=await ze.json().catch(()=>null);Z((tt==null?void 0:tt.error)||`HTTP ${ze.status}`,"error");return}u(),Z(oe?"Project archived":"Project restored","success")}catch(ze){Z(ze instanceof Error?ze.message:"Failed to update archive state","error")}}async function Lt(oe){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:oe})}),u()}if(i)return r.jsx(mt,{label:"Loading project workspace…"});if(c||!o)return r.jsx(kt,{error:c||"Project not found."});const Xt=(()=>{const oe=new Set;for(const tt of o.assignments)tt.assignee&&oe.add(tt.assignee);const ze=[{value:"__unassigned__",label:"Unassigned"}];for(const tt of Array.from(oe).sort())ze.push({value:tt,label:tt});return ze})(),dn=Array.from(new Set(o.assignments.flatMap(oe=>oe.tags??[]))).sort().map(oe=>({value:oe,label:oe})),Gt=o.assignments.filter(oe=>S_(oe,{status:T,priority:L,type:F,assignee:R,tags:V,dateRange:ua(_)})),Gn=Hc(Gt,I,$),Et=new Set(m.definitions.map(oe=>oe.id)),Fn=H==="type"?[...m.definitions.map(oe=>({id:oe.id,title:Ci(m,oe.id),description:oe.description})),...Gt.some(oe=>!oe.type||!Et.has(oe.type))?[{id:B0,title:"Other",description:"Assignments with no recognized type."}]:[]]:kC(d.order).map(oe=>({id:oe,title:Vc(d,oe),description:dp(oe)}));function Tt({field:oe,children:ze}){const tt=I===oe;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>st(oe),className:"inline-flex items-center gap-1 hover:text-foreground",children:[ze,tt?$==="asc"?r.jsx(Hk,{className:"h-3 w-3"}):r.jsx(pr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),o.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Oe(null),title:"Clear manual status override and return to derived status",children:"Clear Override"}),r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value&&Oe(oe.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),d.statuses.map(oe=>r.jsx("option",{value:oe.id,children:oe.label},oe.id)),r.jsx("option",{value:"active",children:"Active"})]}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>qe(!o.archived),title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value==="_ungrouped"?Lt(null):oe.target.value&&Lt(oe.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(oe=>oe!==o.workspace).map(oe=>r.jsx("option",{value:oe,children:oe},oe)),o.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Ce,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(Aw,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Ct,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(jy,{externalIds:o.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Mn(o.created),". Last source update ",Ur(o.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(_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(yp,{value:N,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(oe=>!oe.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(oe=>({value:oe.id,label:oe.label})),value:T,onChange:he}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Xt,value:R,onChange:re}),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:L,onChange:ye}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(oe=>({value:oe.id,label:Ci(m,oe.id)})),value:F,onChange:Pe}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:dn,value:V,onChange:ve}),r.jsx(pp,{className:"max-w-[190px]",value:_,onChange:z}),E==="kanban"&&r.jsxs("select",{value:H==="type"?"type":"status",onChange:oe=>te(oe.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[r.jsx("option",{value:"status",children:"Group: Status"}),r.jsx("option",{value:"type",children:"Group: Type"})]}),r.jsx(gp,{value:E,onChange:oe=>J(oe),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(WE,{scope:Ee,loadedViewId:ke,onApply:pt,onOpenSaveDialog:()=>{Ze(!1),Qe(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Je?St():(Ze(!1),Qe(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Je?`Update ${Je.name}`:"Save current view",children:Je?`Update '${Je.name}'`:"Save view"}),Je?r.jsx("button",{type:"button",onClick:()=>{Ze(!0),Qe(!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(jt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(up,{columns:Fn,items:Gn,getItemId:oe=>oe.slug,getColumnId:oe=>H==="type"?oe.type&&Et.has(oe.type)?oe.type:B0:oe.status,dragDisabled:!0,renderCard:oe=>r.jsx(xU,{projectSlug:o.slug,assignment:oe}),emptyMessage:oe=>`No ${oe.title.toLowerCase()} assignments.`,hiddenColumnIds:ae.hidden,onHideColumn:oe=>ue(ze=>({hidden:ze.hidden.includes(oe)?ze.hidden.filter(yt=>yt!==oe):[...ze.hidden,oe]}))}):(()=>{const oe=new Set(se.hidden),ze=tt=>tt==="title"||!oe.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(IE,{visibility:se,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:[ze("title")?r.jsx(Tt,{field:"title",children:"Assignment"}):null,ze("status")?r.jsx(Tt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),ze("priority")?r.jsx(Tt,{field:"priority",children:"Priority"}):null,ze("assignee")?r.jsx(Tt,{field:"assignee",children:"Assignee"}):null,ze("dependencies")?r.jsx(Tt,{field:"dependencies",children:"Dependencies"}):null,ze("created")?r.jsx(Tt,{field:"created",children:"Created"}):null,ze("updated")?r.jsx(Tt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gn.map(tt=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[ze("title")?r.jsx("td",{className:"py-4",children:r.jsx(Ce,{to:`${n}/projects/${o.slug}/assignments/${tt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:tt.title})}):null,ze("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(ya,{type:tt.type,compact:!0})}),ze("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:tt.priority}):null,ze("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.assignee??"—"}):null,ze("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:tt.dependsOn.length}):null,ze("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(tt.created)}):null,ze("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(tt.updated)}):null]},tt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(uU,{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(jF,{definition:o.dependencyGraph,nodeRoutes:me})}):r.jsx(jt,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(We,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ce,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[r.jsx(Ct,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?r.jsx(jt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:o.resources.map(oe=>r.jsxs(Ce,{to:`/projects/${o.slug}/resources/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.category," · ",oe.source]})]},oe.slug))})}),r.jsx(We,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Ce,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[r.jsx(Ct,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?r.jsx(jt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:o.memories.map(oe=>r.jsxs(Ce,{to:`/projects/${o.slug}/memories/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.scope," · ",oe.source]})]},oe.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(We,{title:"Progress Summary",children:r.jsx(xf,{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(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(Aw,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Ct,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Ce,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(tP,{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(bx,{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?Ur(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),r.jsx(ba,{toast:ot,onDismiss:_e}),r.jsx(UE,{open:Ae,onOpenChange:oe=>{Qe(oe),oe||Ze(!1)},initialName:at&&Je?`${Je.name} (copy)`:"",title:at?"Save as new view":"Save view",onSubmit:xt})]})}function xU({projectSlug:e,assignment:t}){const n=un();return r.jsxs(Ce,{to:`${n}/projects/${e}/assignments/${t.slug}`,className:"vp-card block rounded-lg border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:t.id,children:[t.id.slice(0,8),r.jsx("span",{onClick:s=>{s.preventDefault(),s.stopPropagation()},children:r.jsx(Br,{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(ya,{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 VE({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:o}){const[i,c]=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 N=await y.json().catch(()=>null);throw new Error((N==null?void 0:N.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(N=>new Blob([N.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const N=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(N.command),b=N.fallbackWarning}c(!0),setTimeout(()=>c(!1),1500),b&&(o==null||o(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(N){b=N instanceof Error?N:new Error(String(N))}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(Pw,{className:"h-3 w-3","aria-hidden":"true"})}):r.jsx("button",{type:"button",onClick:m,disabled:u,className:"text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 rounded disabled:cursor-wait",title:i?"Copied!":"Copy launch command (cd + resume)","aria-label":"Copy launch command",children:i?r.jsx(Rr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):r.jsx(Pw,{className:"h-3 w-3","aria-hidden":"true"})})}function Kl(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 yU(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 bU(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 HE(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 KE(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 vU(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 qE(e){return e.requiresReason||e.command==="block"}async function wU(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 jU(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 qy extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function Gy(e){const t=await e.json().catch(()=>null);return new qy((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function kU(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 SU(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 NU(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 Gy(s);return(await s.json()).assignment}async function CU(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 Gy(n);return(await n.json()).assignment}async function EU(e){const{url:t}=yU(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await Gy(n);return await n.json()}async function kp(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 TU(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return kp(s)}async function RU(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return kp(n)}async function AU(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await kp(n)).sourceAssignments}async function PU(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await kp(t)).sourceAssignments}function GE(){const[e,t]=f.useState(!1),[n,s]=f.useState(null),[o,i]=f.useState(null),[c,u]=f.useState(null),[d,m]=f.useState(null),[h,g]=f.useState(null),[y,b]=f.useState(!1),[N,w]=f.useState(null),[v,k]=f.useState(null);async function E(R,A,L,M){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=Kl(R,A,void 0,L,M);return}const D=await F.json();if(D.ok){window.location.href=Kl(R,A,void 0,L,M);return}if(D.reason==="workspace-path-invalid"){D.recreate?(m(D.recreate),g({target:R,mode:A,agentId:L,prompt:M})):u(D.message);return}s(D),i({target:R,mode:A,agentId:L,prompt:M})}catch(F){console.warn("preflight failed, firing without override:",F),window.location.href=Kl(R,A,void 0,L,M)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=Kl(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 EU({kind:d.kind,id:d.id,projectSlug:d.projectSlug,assignmentSlug:d.assignmentSlug}),{target:A,mode:L,agentId:M,prompt:F}=h;m(null),g(null),window.location.href=Kl(A,L,void 0,M,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 qy&&R.stderr?`${R.message}
584
- ${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const P=r.jsxs(r.Fragment,{children:[r.jsx(fi,{open:n!==null,onOpenChange:R=>!R&&(s(null),i(null)),children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsxs(oa,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(aa,{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(Ce,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),i(null)},children:"Settings"}),"."]})]}),r.jsxs(mi,{children:[r.jsx(yc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(vo,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(fi,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsx(oa,{children:"Can't open in agent"}),r.jsxs(aa,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(mi,{children:r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(fi,{open:d!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),w(null))},children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsx(oa,{children:"Worktree was deleted"}),r.jsxs(aa,{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?"]})]}),N&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:N}),r.jsxs(mi,{children:[r.jsx(yc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(fi,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsx(oa,{children:"Worktree recreated"}),r.jsx(aa,{children:v})]}),r.jsx(mi,{children:r.jsx(vo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:P}}function YE({session:e,onMarkStopped:t}){const n=GE(),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"),c="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",u=!e.resumeSupported&&!e.forkSupported;return r.jsxs(r.Fragment,{children:[r.jsx(ca,{delayDuration:200,children:r.jsxs("div",{className:"inline-flex items-center gap-1",children:[u&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(xi,{className:o}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(ur,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{tabIndex:0,className:c,children:r.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[r.jsx(xi,{className:o}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(ur,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"resume"),children:[r.jsx(xi,{className:o}),r.jsx("span",{children:"Resume"})]})}),r.jsx(ur,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(s,"fork"),children:[r.jsx(gP,{className:o}),r.jsx("span",{children:"Fork"})]})}),r.jsx(ur,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[r.jsx(kx,{className:o}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(ur,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})}),n.dialogs]})}async function DU(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function JE({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(jt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(We,{title:"Agent Sessions",children:r.jsx(jt,{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(Tf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:i.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:i.sessionId,children:[i.sessionId.slice(0,8),r.jsx(Br,{value:i.sessionId,onError:s}),r.jsx(VE,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:s,onNotice:o})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(bn,{status:i.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Ur(i.started)})]}),r.jsx(YE,{session:i,onMarkStopped:DU})]},i.sessionId))})})}const ag="Cost / Usage";function QE({summary:e,error:t}){return t&&!e?r.jsx(We,{title:ag,children:r.jsx(jt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(We,{title:ag,children:r.jsx(jt,{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:ag,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(W0,{label:"Total cost",value:Pi(e.totalCost)}),r.jsx(W0,{label:"Total tokens",value:Ai(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($c,{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:[Ai(n.totalTokens)," · ",Pi(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",b3(e.lastEventDay)]})]})}):null}function W0({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 XE({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:o,onOpenChange:i}){const[c,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=c.trim()||void 0;return r.jsx($n,{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(Zn,{children:[r.jsx(Tn,{children:m}),r.jsx(Vr,{children:t.description})]}),t.warning?r.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:d}),r.jsx("textarea",{value:c,onChange:y=>u(y.target.value),autoFocus:!0,rows:4,disabled:s,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>i(!1),disabled:s,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"submit",disabled:s,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h})]})]})})})}function wa({open:e,title:t,description:n,confirmLabel:s,cancelLabel:o="Cancel",loading:i=!1,destructive:c=!1,onConfirm:u,onOpenChange:d}){return r.jsx(fi,{open:e,onOpenChange:m=>i?void 0:d(m),children:r.jsxs(sa,{children:[r.jsxs(pi,{children:[r.jsx(oa,{children:t}),r.jsx(aa,{children:n})]}),r.jsxs(mi,{children:[r.jsx(yc,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),r.jsx(vo,{disabled:i,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${c?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:m=>{m.preventDefault(),u()},children:i?"Working...":s})]})]})})}const $U=/^[a-z0-9][a-z0-9_-]*$/,ZE=["first","last","none"];class e2 extends Error{constructor(n,s){super(n);lh(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Yy={agents:[],custom:!1};let hi=null,ui=null,wf=0;const sx=new Set;function t2(e){hi=e;for(const t of sx)t(e)}function LU(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"&&ZE.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 Jy(e){if(!e||typeof e!="object")return Yy;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const o of n){const i=LU(o);i&&s.push(i)}return{agents:s,custom:t.custom===!0}}function IU(){if(hi)return Promise.resolve(hi);if(ui)return ui;const e=++wf;return ui=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ui=null;const n=Jy(t);return e!==wf?hi??n:(hi=n,n)}).catch(()=>(ui=null,Yy)),ui}function n2(){const[e,t]=f.useState(()=>hi??Yy);return f.useEffect(()=>{let n=!1;return IU().then(s=>{n||t(s)}),sx.add(t),()=>{n=!0,sx.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 e2(n,t==null?void 0:t.fieldErrors)}async function OU(e){++wf;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=Jy(await t.json());return t2(n),n}async function _U(){++wf;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await r2(e);const t=Jy(await e.json());return t2(t),t}const V0=/[A-Za-z0-9_-]/,MU=/^[a-z0-9]+(-[a-z0-9]+)*$/,H0=/(^|\s)@([A-Za-z0-9_-]+)/g,ox="assignment";function s2(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&V0.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&&V0.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function o2(e,t){const n=[ox,...t.filter(c=>c!==ox)],s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?o.push(c):u.includes(s)&&i.push(c)}return[...o,...i]}function a2(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function i2(e,t){const n=t instanceof Set?t:new Set(t),s=[];H0.lastIndex=0;let o;for(;(o=H0.exec(e))!==null;){const i=o[2];i!==ox&&(MU.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 K0=2e3;function FU({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:o}){const[i,c]=f.useState(""),[u,d]=f.useState([]),[m,h]=f.useState(!1),[g,y]=f.useState(null),[b,N]=f.useState(0),[w,v]=f.useState(0),[k,E]=f.useState(!1),S=f.useRef(null);f.useEffect(()=>{if(!e)return;let _=!1;h(!0),y(null),E(!1);const z=new URLSearchParams({assignment:t});return n&&z.set("agent",n),fetch(`/api/launch/prompt?${z.toString()}`).then(async H=>{if(!H.ok){const q=await H.json().catch(()=>null);throw new Error((q==null?void 0:q.error)??`HTTP ${H.status}`)}return await H.json()}).then(H=>{_||(c(H.template??""),d(H.knownPlaybookSlugs??[]),N((H.template??"").length))}).catch(H=>{_||y(H instanceof Error?H.message:String(H))}).finally(()=>{_||h(!1)}),()=>{_=!0}},[e,t,n]);const T=s2(i,b),P=T?o2(T.partial,u):[],R=e&&!m&&!k&&P.length>0,A=i2(i,u),L=i.length>K0;function M(_){c(_.target.value),N(_.target.selectionStart??_.target.value.length),v(0),E(!1)}function F(_){N(_.currentTarget.selectionStart??i.length),v(0)}function D(_){if(!T||!_)return;const z=a2(i,T,_);c(z.text),N(z.caret),v(0),E(!0),requestAnimationFrame(()=>{const H=S.current;H&&(H.focus(),H.setSelectionRange(z.caret,z.caret))})}function V(_){R&&(_.key==="ArrowDown"?(_.preventDefault(),v(z=>Math.min(z+1,P.length-1))):_.key==="ArrowUp"?(_.preventDefault(),v(z=>Math.max(z-1,0))):(_.key==="Enter"||_.key==="Tab")&&(_.preventDefault(),D(P[w])))}function Y(){L||m||(s(i),o(!1))}return r.jsx($n,{open:e,onOpenChange:o,children:r.jsxs(En,{onEscapeKeyDown:_=>{R&&(_.preventDefault(),E(!0))},children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:"Edit launch prompt"}),r.jsxs(Vr,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:S,value:i,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:M,onKeyDown:V,onKeyUp: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",L&&"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:P.map((_,z)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":z===w,onMouseDown:H=>{H.preventDefault(),D(_)},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",z===w&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:_})]})},_))})]}),A.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:A.map(_=>r.jsx("li",{children:_},_))}),L&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",K0," characters (",i.length,")."]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||L||g!==null,onClick:Y,children:"Launch"})]})]})})}function l2({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,c=GE(),[u,d]=f.useState(null),h=n2().agents,[g,y]=f.useState(null);f.useEffect(()=>{h.length!==0&&y(A=>A&&h.some(M=>M.id===A)?A:(h.find(M=>M.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,N=h.find(A=>A.id===g)??null,w=f.useRef(null),[v,k]=f.useState(!1);f.useEffect(()=>{if(!v)return;function A(M){w.current&&!w.current.contains(M.target)&&k(!1)}function L(M){M.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",A),document.addEventListener("keydown",L),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",L)}},[v]);function E(A){var L,M;if(e.kind==="assignment"){const F=h.find(V=>V.id===A)??h.find(V=>V.default)??h[0];!!((L=F==null?void 0:F.launchPrompt)!=null&&L.trim())||!!((M=F==null?void 0:F.playbook)!=null&&M.trim())?c.open(e,void 0,A):d({agentId:A})}else c.open(e,void 0,A)}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",P=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:P,"aria-disabled":!0,children:[r.jsx(xi,{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:c.pending,title:(o??S)+(b&&N?` (${N.label})`:""),className:be(P,b&&"rounded-r-none"),children:[r.jsx(xi,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(A=>!A),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:be(P,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(pr,{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(A=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":A.id===g,onClick:()=>{y(A.id),k(!1),E(A.id)},className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent",children:[r.jsx(Rr,{className:be("size-3.5 shrink-0",A.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:A.label}),A.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},A.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx(FU,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:A=>{c.open(e,void 0,u.agentId,A)},onOpenChange:A=>{A||d(null)}})]})}const ig="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 c2({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:o="main",onCreated:i}){const c=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[u,d]=f.useState(!1),[m,h]=f.useState("new-branch"),[g,y]=f.useState(null),[b,N]=f.useState(null),[w,v]=f.useState(""),[k,E]=f.useState(!1),[S,T]=f.useState(""),[P,R]=f.useState([]),[A,L]=f.useState(!1),[M,F]=f.useState(null),[D,V]=f.useState(""),[Y,_]=f.useState(null),[z,H]=f.useState(null),[q,I]=f.useState(""),[K,$]=f.useState(s),[W,ee]=f.useState(!1),[B,ae]=f.useState(null);f.useEffect(()=>{if(!u)return;let Z=!1;return h("new-branch"),y(null),N(null),v(""),E(!1),T(""),R([]),L(!1),F(null),V(""),_(null),H(null),I(""),$(s),ae(null),(c.kind==="project-nested"?kU(c.projectSlug):SU(c.assignmentId)).then(Ie=>{if(!Z)if(y(Ie),Ie.length===0)E(!0);else{const Ye=Ie.find(et=>et.source==="project"),Me=Ie.find(et=>et.source==="sibling");v((Ye==null?void 0:Ye.path)??(Me==null?void 0:Me.path)??Ie[0].path)}}).catch(Ie=>{Z||(N(Ie.message),y([]),E(!0))}),(c.kind==="project-nested"?AU(c.projectSlug,c.assignmentSlug):PU(c.assignmentId)).then(Ie=>{Z||_(Ie)}).catch(Ie=>{Z||(H(Ie.message),_([]))}),()=>{Z=!0}},[u,s,o,e,t,n]);const ue=m==="branch-off"?(Y??[]).find(Z=>Z.id===q)??null:null,se=m==="branch-off"?(ue==null?void 0:ue.repository)??"":k?S.trim():w;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!se){R([]),F(null),L(!1),V("");return}let Z=!1;return L(!0),F(null),V(""),(c.kind==="project-nested"?TU(c.projectSlug,c.assignmentSlug,se):RU(c.assignmentId,se)).then(Ee=>{if(Z)return;R(Ee.branches);const Ie=(Ee.defaultBranch&&Ee.branches.includes(Ee.defaultBranch)?Ee.defaultBranch:Ee.branches.includes(o)?o:Ee.branches[0])??"";V(Ie),L(!1)}).catch(Ee=>{Z||(R([]),F(Ee.message),L(!1))}),()=>{Z=!0}},[u,m,se,o,e,t,n]);const xe=bU(K.trim()),ke=f.useMemo(()=>!se||!K.trim()?"":`${se.replace(/\/+$/,"")}/.worktrees/${K.trim()}`,[se,K]),Re=g!==null&&g.length===0,Ae=Y!==null&&Y.length===0,Qe=Z=>{Z!==m&&(h(Z),I(""),ae(null),Z==="branch-off"&&(V(""),R([]),F(null),L(!1)))},at=Z=>{I(Z);const _e=(Y??[]).find(Ee=>Ee.id===Z);V((_e==null?void 0:_e.branch)??"")},Ze=W||xe!==null||!se||!D.trim()||(m==="new-branch"?g===null||A:Y===null||!q),ot=async()=>{ee(!0),ae(null);try{const Z={repository:se,branch:K.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await NU(c.projectSlug,c.assignmentSlug,Z):await CU(c.assignmentId,Z),d(!1),i()}catch(Z){Z instanceof qy?ae({message:Z.message,stderr:Z.stderr}):Z instanceof Error?ae({message:Z.message}):ae({message:String(Z)})}finally{ee(!1)}};return r.jsxs($n,{open:u,onOpenChange:Z=>W?void 0:d(Z),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>d(!0),children:[r.jsx(hP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs(En,{children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:"Create worktree"}),r.jsxs(Vr,{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:W,onClick:()=>Qe("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:W,onClick:()=>Qe("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:[Re?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:ig,value:w,onChange:Z=>v(Z.target.value),disabled:W||g===null||k,children:(g??[]).map(Z=>r.jsxs("option",{value:Z.path,children:[Z.path,Z.source==="project"?" (project)":Z.sourceAssignmentSlug?` (sibling — ${Z.sourceAssignmentSlug})`:" (sibling)"]},`${Z.source}:${Z.path}`))}),Re?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:W,onClick:()=>E(Z=>!Z),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:Z=>T(Z.target.value),disabled:W}):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:ig,value:D,onChange:Z=>V(Z.target.value),disabled:W||A||P.length===0,children:A?r.jsx("option",{value:"",children:"Loading branches…"}):P.length===0?r.jsx("option",{value:"",children:M?"Could not load branches":se?"No branches found":"— pick a repository —"}):P.map(Z=>r.jsx("option",{value:Z,children:Z},Z))}),M?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",M]}):null]})]}):r.jsxs(r.Fragment,{children:[z?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: ",z]}):null,Ae?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:ig,value:q,onChange:Z=>at(Z.target.value),disabled:W||Y===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(Y??[]).map(Z=>r.jsxs("option",{value:Z.id,children:[Z.title," (",Z.branch,")"]},Z.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:K,onChange:Z=>$(Z.target.value),disabled:W}),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 —"})})]}),B?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:B.message}),B.stderr?r.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:B.stderr}):null]}):null]}),r.jsxs(Ar,{children:[r.jsx(c4,{disabled:W,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:W?"Working…":"Create worktree"})]})]})]})}function zU(e){const t=e.split(`
585
- `),n=t.findIndex(c=>/^##\s+Acceptance Criteria\s*$/i.test(c.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const o=t.slice(n+1,s).map(c=>c.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(c=>!!c).map(c=>({checked:c[1].toLowerCase()==="x",text:c[2].trim()})),i=[...t.slice(0,n),...t.slice(s)].join(`
586
- `).replace(/\n{3,}/g,`
587
-
588
- `).trim();return{acceptanceCriteria:o,summaryBody:i}}function BU(e){const t=e.split(`
589
- `),n=t.findIndex(c=>/^##\s+Todos\s*$/i.test(c.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let s=t.length;for(let c=n+1;c<t.length;c+=1)if(/^#{1,2}\s+\S/.test(t[c].trim())){s=c;break}const o=t.slice(n+1,s).join(`
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 UU({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"),c=i.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(xx,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx(pr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[i.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(Gd,{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:c?r.jsx("button",{type:"button",onClick:()=>o(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Ce,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(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(qd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function WU({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(Ce,{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(Bk,{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(qd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),s.map(o=>r.jsxs(Ce,{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(Kd,{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(qd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function VU(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 HU(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function u2({projectSlug:e,assignmentSlug:t,entries:n}){const[s,o]=f.useState(n);f.useEffect(()=>{o(n)},[n]);const i=f.useMemo(()=>VU(s),[s]),[c,u]=f.useState(""),[d,m]=f.useState("note"),[h,g]=f.useState(!1),[y,b]=f.useState(null);async function N(v){var S;if(v.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:d,body:c,resolved:d==="question"?!1:void 0};o(T=>[...T,E]);try{const T=await fetch(HU(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:d})});if(!T.ok){const A=await T.text();throw new Error(A||`HTTP ${T.status}`)}const P=await T.json().catch(()=>null),R=(S=P==null?void 0:P.comment)==null?void 0:S.id;o(A=>A.map(L=>L.id===k?{...L,id:R??L.id}:L)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),o(P=>P.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(d2,{node:v,onToggleResolved:w,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:N,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:v=>u(v.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:d,onChange:v=>m(v.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[r.jsx("option",{value:"note",children:"note"}),r.jsx("option",{value:"question",children:"question"}),r.jsx("option",{value:"feedback",children:"feedback"})]}),r.jsx("button",{type:"submit",disabled:h||!c.trim(),className:"shell-action",children:h?"Posting…":"Post comment"}),y?r.jsx("span",{className:"text-xs text-error-foreground",children:y}):null]})]})]})})}function d2({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(xx,{className:"h-3 w-3"}):r.jsx(oP,{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(RP,{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(c=>r.jsx(d2,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const KU=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function q0(){var ve,te,fe,Se,Ue,ce,pt,xt,St,st;const{slug:e,aslug:t}=Mt(),n=_t(),s=un(),[o,i]=ls(),[c,u]=f.useState(null),{toast:d,showToast:m,dismissToast:h}=Ao(),[g,y]=f.useState(null),[b,N]=f.useState(null),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(!1),[P,R]=f.useState(!1),[A,L]=f.useState(0),M=o.get("tab")??"summary",F=xa(),{data:D,loading:V,error:Y,refetch:_}=_3(e,t),{data:z}=j1(e),{data:H}=Tx(),{data:q,loading:I,error:K}=F3(e,t),{data:$,loading:W,error:ee}=B3(e,t),B=f.useMemo(()=>{if(!D||!z)return[];const me=new Map(z.assignments.map(Oe=>[Oe.slug,Oe]));return D.dependsOn.map(Oe=>{const qe=me.get(Oe);return{slug:Oe,title:(qe==null?void 0:qe.title)??Oe,status:(qe==null?void 0:qe.status)??"pending",priority:(qe==null?void 0:qe.priority)??"medium",assignee:(qe==null?void 0:qe.assignee)??null}})},[D,z]),ae=B.filter(me=>me.status!=="completed"&&me.status!=="review");Ro("assignment");const ue=f.useMemo(()=>((z==null?void 0:z.assignments)??[]).map(me=>me.slug),[z]),se=t?ue.indexOf(t):-1,xe=se>0?ue[se-1]:null,ke=se>=0&&se<ue.length-1?ue[se+1]:null,Re=`${s}/projects/${e}/assignments/${t}`;Kt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Re}/edit`)}),Kt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Re}/plan/edit`)}),Kt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Re}/handoff/edit`)}),Kt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Re}/decision-record/edit`)}),Kt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Re}/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 Ae=f.useMemo(()=>D?zU(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),Qe=f.useMemo(()=>BU(Ae.summaryBody),[Ae.summaryBody]),at=Ae.acceptanceCriteria,Ze=at.filter(me=>me.checked).length,ot=at.length>0&&Ze===at.length,Z=f.useRef(ot),_e=f.useRef(!1);if(f.useEffect(()=>{if(D){if(!_e.current){Z.current=ot,_e.current=!0;return}ot&&!Z.current&&L(me=>me+1),Z.current=ot}},[ot,D]),V)return r.jsx(mt,{label:"Loading assignment workspace…"});if(Y||!D||!e||!t)return r.jsx(kt,{error:Y||"Assignment not found."});const Ee=e,Ie=t,Ye=at.length>0?{checked:Ze,total:at.length}:void 0,Me=D.availableTransitions??[],et=Me.filter(me=>!me.disabled&&me.targetStatus!==D.status),Je=KU.map(me=>et.find(Oe=>Oe.command===me)).find(Boolean)??et[0]??null,$t=[];if(H!=null&&H.sessions)for(const me of H.sessions)for(const Oe of me.windows)for(const qe of Oe.panes)((ve=qe.assignment)==null?void 0:ve.project)===e&&((te=qe.assignment)==null?void 0:te.slug)===t&&$t.push({sessionName:me.name,command:qe.command,urls:qe.urls});async function vt(me){u(null);try{await KE(Ee,Ie,me),_()}catch(Oe){u(Oe.message)}}async function ct(me){u(null);try{const Oe=await fetch(`/api/projects/${Ee}/assignments/${Ie}/${me?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Oe.ok){const qe=await Oe.json().catch(()=>null);throw new Error((qe==null?void 0:qe.error)||`HTTP ${Oe.status}`)}_(),m(me?"Assignment archived":"Assignment restored","success")}catch(Oe){u(Oe.message)}}async function le(){R(!0);try{await vU(Ee,Ie),n(`${s}/projects/${Ee}`)}catch(me){u(me.message),R(!1),T(!1)}}async function J(me,Oe){u(null),y(me.command);try{return await HE(Ee,Ie,me,Oe),_(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function he(me){if(qE(me)){N(me);return}J(me)}async function re(me,Oe){v(null),E(me);try{const qe=await fetch(`/api/projects/${Ee}/assignments/${Ie}/acceptance-criteria/${me}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Oe})}),Lt=await qe.json();if(!qe.ok)throw new Error(Lt.error||`HTTP ${qe.status}`);_()}catch(qe){v(qe.message)}finally{E(null)}}const ye=[...et.filter(me=>me!==Je).map(me=>({key:`transition-${me.command}`,label:me.label,onSelect:()=>he(me),disabled:g===me.command})),...Me.filter(me=>me.disabled||me.targetStatus===D.status).map(me=>({key:`transition-${me.command}`,label:me.label,disabled:!0,disabledReason:me.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:me.disabledReason??me.warning??me.description})),...F.statuses.map(me=>({key:`override-${me.id}`,label:`Override → ${me.label}`,onSelect:()=>vt(me.id),disabled:me.id===D.status,disabledReason:me.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:mP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:PP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:xh,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:qd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:xP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:D.archived?"unarchive":"archive",label:D.archived?"Restore assignment":"Archive assignment",icon:D.archived?Hd:Rf,onSelect:()=>ct(!D.archived)},{key:"delete",label:"Delete assignment",icon:yn,destructive:!0,onSelect:()=>T(!0)}],Pe=(Je==null?void 0:Je.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(ba,{toast:d,onDismiss:h}),r.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:D.status,progress:Ye}),D.phase&&D.phase!==D.status&&r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",title:"Phase dimension — how far along the work is, independent of blockage",children:["phase: ",D.phase]}),D.disposition&&D.disposition!=="active"&&r.jsx("span",{className:"rounded-full border border-warning-foreground/40 px-2 py-0.5 text-[11px] text-warning-foreground",title:"Disposition dimension — orthogonal to phase",children:D.disposition}),r.jsx(ya,{type:D.type}),r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:D.title}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",a1(D.updated)]}),ae.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ae.length," unmet dep",ae.length===1?"":"s"]}),r.jsx(jy,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(l2,{target:{kind:"assignment",id:D.id},worktreePath:((fe=D.workspace)==null?void 0:fe.worktreePath)??null,repository:((Se=D.workspace)==null?void 0:Se.repository)??null}),!((Ue=D.workspace)!=null&&Ue.worktreePath)&&e&&t&&r.jsx(c2,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>_()}),Je&&r.jsx("button",{type:"button",title:Je.warning||Je.description,disabled:g===Je.command,onClick:()=>he(Je),className:be("shell-action disabled:cursor-not-allowed disabled:opacity-50",Je.warning&&"border-warning-foreground/40",Pe&&A>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Je.command?"Working…":Je.label})},Pe?`review-${A}`:Je.command),r.jsx(hy,{items:ye,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,D.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",D.blockedReason]}):null,D.override&&D.derived&&D.derived.derivedStatus!==D.status?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsxs("strong",{children:["Pinned to ",D.status]})," by ",D.override.source,D.override.reason?r.jsxs(r.Fragment,{children:[" — “",D.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:D.derived.derivedStatus})]}):null,(ce=D.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:"})," ",D.derived.nextAction]}):null]}),D.derived&&(Object.keys(D.derived.customFacts??{}).length>0||(D.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(D.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(D.derived.customFacts??{}).map(([me,Oe])=>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(Oe)})]},me))}),(D.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(Oe=>r.jsxs("span",{title:`${Oe.verdict}${Oe.note?` — ${Oe.note}`:""}${Oe.stale?" (stale — revision moved)":""} · ${Oe.at}`,className:be("rounded-full border px-2 py-0.5 text-[11px]",Oe.stale?"border-border/40 text-muted-foreground line-through":Oe.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[Oe.actor,": ",Oe.verdict==="approved"?"approved":"changes",Oe.stale?" (stale)":""]},Oe.actor))]},me.fact))]})}):null,B.length>0&&r.jsx(UU,{projectSlug:e,dependencies:B,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(WU,{links:D.enrichedLinks}),D.referencedBy&&D.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:D.referencedBy.map(me=>{const Oe=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(Ce,{to:Oe,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(yp,{value:M,onValueChange:me=>i({tab:me}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[Ae.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,Ae.acceptanceCriteria.map((me,Oe)=>{const qe=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:qe,onChange:Lt=>re(Oe,Lt.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})]},`${Oe}-${me.text}`)})]})}):null,Qe.hasSection?r.jsx(We,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(gn,{content:Qe.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(We,{title:"Assignment Summary",children:r.jsx(gn,{content:Qe.remaining,emptyState:Ae.acceptanceCriteria.length>0||Qe.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:D.plan?1:0,content:D.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(We,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(xh,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(bn,{status:D.plan.status})}),r.jsx(gn,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(jt,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(We,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(xh,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(gn,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(jt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((pt=D.handoff)==null?void 0:pt.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(We,{children:r.jsx(gn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(jt,{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=D.progress)==null?void 0:xt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.progress&&D.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:D.progress.entries.map((me,Oe)=>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}-${Oe}`))})}):r.jsx(jt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((St=D.comments)==null?void 0:St.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(u2,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(jt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((st=D.decisionRecord)==null?void 0:st.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(We,{children:r.jsx(gn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(jt,{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(ho,{label:"ID",value:D.id,copyable:!0}),r.jsx(ho,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(ho,{label:"Assignee",value:D.assignee}),r.jsx(ho,{label:"Updated",value:`${o1(D.updated)} · Created ${s1(D.created)}`}),D.workspace.repository&&r.jsx(ho,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(ho,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(ho,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(ho,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((me,Oe)=>r.jsx(qU,{entry:me},`${me.system}:${me.id}:${Oe}`))]})}),$t.length>0&&r.jsx(We,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:$t.map((me,Oe)=>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(qe=>r.jsxs("a",{href:qe,target:"_blank",rel:"noopener noreferrer",title:qe,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:qe.replace("http://localhost:",":")}),r.jsx(zi,{className:"h-2.5 w-2.5 shrink-0"})]},qe))]},Oe))})}),r.jsx(JE,{sessions:q==null?void 0:q.sessions,loading:I,error:K,onError:me=>m(me.message,"error"),onNotice:me=>m(me,"success")}),r.jsx(QE,{summary:$==null?void 0:$.summary,loading:W,error:ee})]})]}),r.jsx(XE,{open:b!==null,action:b,assignmentTitle:D.title,loading:g===(b==null?void 0:b.command),onOpenChange:me=>{me||N(null)},onConfirm:async me=>{if(!b)return;await J(b,me)&&N(null)}}),r.jsx(wa,{open:S,title:"Delete assignment?",description:`This will permanently delete "${D.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:P,onOpenChange:me=>{me||T(!1)},onConfirm:le})]})}function ho({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Br,{value:t})]})]})}function qU({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(zi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function GU(){var R,A,L,M,F,D,V,Y;const{id:e}=Mt(),[t,n]=ls(),s=t.get("tab")??"summary",{data:o,loading:i,error:c,refetch:u}=M3(e),{data:d,loading:m,error:h}=z3(e),{data:g,loading:y,error:b}=U3(o==null?void 0:o.slug),[N,w]=f.useState(!1),[v,k]=f.useState(null),{toast:E,showToast:S,dismissToast:T}=Ao();async function P(_){if(e){k(null);try{const z=await fetch(`/api/assignments/${e}/${_?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!z.ok){const H=await z.json().catch(()=>null);throw new Error((H==null?void 0:H.error)||`HTTP ${z.status}`)}u(),S(_?"Assignment archived":"Assignment restored","success")}catch(z){k(z instanceof Error?z.message:"Archive failed")}}}return i?r.jsx(mt,{}):c?r.jsx(kt,{error:c}):o?r.jsxs("div",{className:"space-y-6",children:[r.jsx(ba,{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(ya,{type:o.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),r.jsx(jy,{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:((A=o.workspace)==null?void 0:A.repository)??null,size:"compact"}),!((L=o.workspace)!=null&&L.worktreePath)&&r.jsx(c2,{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(Af,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Ce,{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:()=>P(!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(Hd,{className:"h-3 w-3"}):r.jsx(Rf,{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(_=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ce,{to:_.sourceProjectSlug===null?`/assignments/${_.sourceId}`:`/projects/${_.sourceProjectSlug}/assignments/${_.sourceSlug}`,className:"text-foreground hover:text-primary",children:_.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",_.mentions," mention",_.mentions===1?"":"s",")"]})]},_.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(yp,{value:s,onValueChange:_=>n({tab:_}),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:((M=o.progress)==null?void 0:M.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.progress&&o.progress.entries.length>0?r.jsx(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((_,z)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:_.timestamp}),r.jsx(gn,{content:_.body})]},`${_.timestamp}-${z}`))})}):r.jsx(jt,{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(u2,{projectSlug:null,assignmentSlug:o.id,entries:((D=o.comments)==null?void 0:D.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:o.plan?r.jsxs(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(Ce,{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(jt,{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(Ce,{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(jt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((V=o.handoff)==null?void 0:V.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.handoff?r.jsxs(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(Ce,{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(jt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((Y=o.decisionRecord)==null?void 0:Y.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(Ce,{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(jt,{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(go,{label:"ID",value:o.id,copyable:!0}),r.jsx(go,{label:"Priority",value:o.priority}),o.assignee&&r.jsx(go,{label:"Assignee",value:o.assignee}),r.jsx(go,{label:"Updated",value:`${o1(o.updated)} · Created ${s1(o.created)}`}),o.workspace.repository&&r.jsx(go,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&r.jsx(go,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&r.jsx(go,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&r.jsx(go,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((_,z)=>r.jsx(YU,{entry:_},`${_.system}:${_.id}:${z}`))]})}),r.jsx(JE,{sessions:d==null?void 0:d.sessions,loading:m,error:h,onError:_=>S(_.message,"error"),onNotice:_=>S(_,"success")}),r.jsx(QE,{summary:g==null?void 0:g.summary,loading:y,error:b})]})]}),r.jsx(wy,{open:N,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 _=>{const z=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:_})});if(!z.ok){const H=await z.json().catch(()=>({}));throw new Error(H.error||"Failed to move assignment")}u()}})]}):r.jsx(kt,{error:"Assignment not found"})}function go({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(Br,{value:t})]})]})}function YU({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(zi,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function JU({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1,className:o}){const[i,c]=f.useState(!1),[u,d]=f.useState(null),[m,h]=f.useState(0),g=f.useRef(null),y=f.useRef(null),b=f.useId(),N=mf(e),w=N.icon,v=f.useCallback(P=>{c(!1),P&&requestAnimationFrame(()=>{var R;(R=g.current)==null||R.focus()})},[]),k=f.useCallback(()=>{var R;const P=(R=g.current)==null?void 0:R.getBoundingClientRect();P&&d({top:P.top,left:P.left,width:P.width,bottom:P.bottom})},[]);f.useLayoutEffect(()=>{i&&k()},[i,k]),f.useEffect(()=>{if(!i)return;const P=()=>k();return window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[i,k]),f.useEffect(()=>{if(!i)return;const P=R=>{var L,M;const A=R.target;A&&((L=y.current)!=null&&L.contains(A)||(M=g.current)!=null&&M.contains(A)||v(!1))};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[i,v]),f.useEffect(()=>{i&&h(0)},[i,t.length]);function E(P){(P.key==="Enter"||P.key===" "||P.key==="ArrowDown")&&(P.preventDefault(),c(!0))}function S(P){if(t.length===0){P.key==="Escape"&&(P.preventDefault(),v(!0));return}if(P.key==="ArrowDown")P.preventDefault(),h(R=>(R+1)%t.length);else if(P.key==="ArrowUp")P.preventDefault(),h(R=>(R-1+t.length)%t.length);else if(P.key==="Home")P.preventDefault(),h(0);else if(P.key==="End")P.preventDefault(),h(t.length-1);else if(P.key==="Enter"){P.preventDefault();const R=t[m];R&&(n(R),v(!0))}else P.key==="Escape"&&(P.preventDefault(),v(!0))}function T(P){n(P),v(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?b:void 0,onClick:()=>{s||c(P=>!P)},onKeyDown:E,title:`Status: ${N.label}. Click to change.`,className:be(fC(e,o),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(w,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 truncate",children:N.label})]}),i&&u&&typeof document<"u"?Fs.createPortal(r.jsx("div",{ref:y,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:S,style:{position:"fixed",top:u.bottom+6,left:u.left,minWidth:Math.max(u.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((P,R)=>{const A=mf(P.targetStatus),L=A.icon,M=R===m;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>h(R),onClick:()=>T(P),title:P.warning||P.description,className:be("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",M?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(L,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:P.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:A.label})]}),P.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:P.warning}):null]},`${P.command}:${P.targetStatus}`)})}),document.body):null]})}function f2({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[o,i]=f.useState(!1);return o?r.jsx(QU,{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(Ce,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:c=>c.stopPropagation(),className:"text-muted-foreground opacity-0 transition group-hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",children:r.jsx(zi,{className:"h-3.5 w-3.5"})})]})}function QU({initialTitle:e,disabled:t,onSave:n,onExit:s}){const o=f.useRef(e),[i,c]=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()},[]),N=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(),N()):v.key==="Escape"&&(v.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:i,onChange:v=>c(v.target.value),onKeyDown:w,onBlur:()=>void N(),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 p2(e){const t=_t(),n=f.useRef(null),s=f.useRef(!1),o=f.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),d=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||d||h},[]),i=f.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(Oi)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const G0=/[A-Za-z0-9_-]/;function Y0(e,t){const n=Math.max(0,Math.min(t,e.length)),s=XU(e,n);if(s)return s;let o=n;for(;o>0&&G0.test(e[o-1]);)o--;let i=n;for(;i<e.length&&G0.test(e[i]);)i++;const c=e.slice(o,n),u=e.slice(0,o),d=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(d)return{kind:"value",field:d[1].toLowerCase(),partial:c,tokenStart:o,tokenEnd:i};const m=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return m?{kind:"value",field:m[1].toLowerCase(),partial:c,tokenStart:o,tokenEnd:i}:{kind:"field",partial:c,tokenStart:o,tokenEnd:i}}function XU(e,t){let n=-1;for(let d=t-1;d>=0;d--)if(e[d]==='"'&&(d===0||e[d-1]!=="\\")){n=d;break}if(n<0)return null;for(let d=n+1;d<t;d++)if(e[d]==='"'&&e[d-1]!=="\\")return null;let s=t;for(;s<e.length&&!(e[s]==='"'&&e[s-1]!=="\\");)s++;const o=e.slice(n+1,t),c=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:c?c[1].toLowerCase():"",partial:o,tokenStart:n,tokenEnd:s<e.length?s+1:s}}function ZU(e,t){const n=dC(t),s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?o.push(c):u.includes(s)&&i.push(c)}return[...o,...i]}function e7(e,t,n,s){const o=e.toLowerCase();let i=[];switch(o){case"status":i=[...n.statuses];break;case"priority":i=[...n.priorities];break;case"type":i=[...n.types];break;case"assignee":i=["none",...n.assignees];break;case"project":i=["none",...n.projects];break;case"tag":case"tags":i=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":i=["true","false"];break;default:{const u=s[o];(u==null?void 0:u.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const c=t.toLowerCase();return c===""?i:i.filter(u=>u.toLowerCase().startsWith(c))}function t7(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=gN(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const n7=180;function r7(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function s7({value:e,onChange:t,onCompiled:n,registry:s,declarations:o,valueSources:i,placeholder:c="AQL query (e.g. status:active AND priority:high)",className:u}){const d=f.useRef(null),m=f.useRef(null),h=r7(e,n7),[g,y]=f.useState([]),[b,N]=f.useState([]),[w,v]=f.useState("field"),[k,E]=f.useState(-1),[S,T]=f.useState(!1),P=f.useRef(e.length);f.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const _=Di(h,s);_.errors.length>0?(y(_.errors),n==null||n(null)):(y([]),n==null||n(_.query))},[h,s,n]);const R=f.useCallback((_,z)=>{const H=Y0(_,z);if(!H){N([]),T(!1);return}if(H.kind==="field"){const q=ZU(H.partial,o);N(q),v("field"),T(q.length>0)}else{const q=e7(H.field,H.partial,i,s);N(q),v("value"),T(q.length>0)}E(-1)},[o,i,s]),A=f.useCallback(_=>{const z=_.target.value,H=_.target.selectionStart??z.length;P.current=H,t(z),R(z,H)},[t,R]),L=f.useCallback(_=>{const z=d.current,H=(z==null?void 0:z.selectionStart)??P.current,q=Y0(e,H);if(!q)return;const{text:I,caret:K}=t7(e,q,_);t(I),T(!1),N([]),requestAnimationFrame(()=>{d.current&&(d.current.focus(),d.current.setSelectionRange(K,K),P.current=K)})},[e,t]),M=f.useCallback(_=>{if(!(!S||b.length===0))switch(_.key){case"ArrowDown":_.preventDefault(),E(z=>Math.min(z+1,b.length-1));break;case"ArrowUp":_.preventDefault(),E(z=>Math.max(z-1,-1));break;case"Enter":case"Tab":k>=0&&(_.preventDefault(),L(b[k]));break;case"Escape":T(!1),N([]);break}},[S,b,k,L]),F=f.useRef(null),D=f.useCallback(()=>{F.current=setTimeout(()=>T(!1),120)},[]);f.useEffect(()=>()=>{F.current!==null&&clearTimeout(F.current)},[]);const V=f.useCallback(()=>{var z;const _=((z=d.current)==null?void 0:z.selectionStart)??e.length;R(e,_)},[e,R]);f.useEffect(()=>{var _,z;S&&((z=(_=m.current)==null?void 0:_.querySelector('[aria-selected="true"]'))==null||z.scrollIntoView({block:"nearest"}))},[k,S]);const Y=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:A,onKeyDown:M,onBlur:D,onFocus:V,placeholder:c,"aria-label":"AQL query input","aria-expanded":S,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",Y?"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((_,z)=>r.jsx("li",{role:"option","aria-selected":z===k,onMouseDown:H=>{H.preventDefault(),L(_)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",z===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:_},_))}),Y&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((_,z)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",_.pos,": ",_.message]},z))})]})}const J0=ty;function kd(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function o7(e,t){return e.toString()===t.toString()}function Q0(){const{workspace:e}=Mt(),t=un(),n=_t(),s=f.useRef(null);Ro("list:assignments");const{data:o,loading:i,error:c,refetch:u}=If(),d=xa(),m=fp(),[h,g]=ls(),y=e?`w:${e}`:null,b=ME(y),N=f.useRef(void 0),w=f.useMemo(()=>kC(d.order),[d]),v=f.useMemo(()=>{const U={};for(const X of w)U[X]=Vc(d,X);return U},[w,d]),k=f.useMemo(()=>w.map(U=>({id:U,title:v[U]??U,description:dp(U)})),[w,v]),E=f.useMemo(()=>m.definitions.map(U=>({id:U.id,title:Ci(m,U.id),description:U.description})),[m]),S="__unknown_type__",T=f.useMemo(()=>new Set(["all",...w]),[w]),P=h.get("view"),R=h.get("status"),A=h.get("stale"),L=P&&J0.includes(P)?P:"kanban";function M(U){if(!U)return[];const X=[];for(const ge of U.split(",")){const Le=ge.trim();!Le||Le==="all"||!T.has(Le)||X.includes(Le)||X.push(Le)}return X}const F=f.useCallback(U=>{g(X=>{const ge=new URLSearchParams(X);return U==="kanban"?ge.delete("view"):ge.set("view",U),ge})},[g]),[D,V]=f.useState(""),[Y,_]=f.useState(()=>M(R)),[z,H]=f.useState(()=>Fe(b.filters.priority)),[q,I]=f.useState(()=>Fe(b.filters.type)),[K,$]=f.useState(()=>Fe(b.filters.assignee)),[W,ee]=f.useState(()=>Fe(b.filters.project)),[B,ae]=f.useState(()=>Fe(b.filters.tags)),[ue,se]=f.useState(null),[xe,ke]=f.useState(()=>kd(A)),[Re,Ae]=f.useState(()=>ic({status:M(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:kd(A)})),[Qe,at]=f.useState(()=>b.sortField),[Ze,ot]=f.useState(()=>b.sortDirection),[Z,_e]=f.useState(()=>({hidden:[]})),[Ee,Ie]=f.useState(()=>({hidden:[]})),[Ye,Me]=f.useState(()=>b.grouping),et=Ye==="type"?"type":"status",[Je,$t]=f.useState(()=>new Set),[vt,ct]=f.useState([]),{toast:le,showToast:J,dismissToast:he}=Ao(),[re,ye]=f.useState(null),[Pe,ve]=f.useState(null),[te,fe]=f.useState(null),[Se,Ue]=f.useState(null),[ce,pt]=f.useState(null),[xt,St]=f.useState(null),[st,me]=f.useState(null),[Oe,qe]=f.useState(null),[Lt,Xt]=f.useState(null),[dn,Gt]=f.useState(!1),[Gn,Et]=f.useState(!1),Fn=e?{kind:"workspace",workspace:e}:{kind:"global"},Tt=h.get("loadView"),{view:oe,loading:ze,error:tt}=So(Tt),{view:yt,loading:tr,error:qr}=So(Lt),Ts=f.useRef(null);f.useEffect(()=>{ct((o==null?void 0:o.assignments)??[])},[o]),f.useEffect(()=>{Lt&&!tr&&!qr&&!yt&&Xt(null)},[yt,qr,Lt,tr]),f.useEffect(()=>{Xt(null),Ts.current=null,se(null),V("")},[e]);const Jc=f.useRef({status:R,stale:A});f.useEffect(()=>{const U=M(R),X=kd(A);oO(U,Y)||_(U),X!==xe&&ke(X);const ge=Jc.current,Le=ge.status!==R||ge.stale!==A;Jc.current={status:R,stale:A},Le&&rn({status:U,activity:X})},[xe,A,Y,R]),f.useEffect(()=>{N.current===y&&g(U=>{const X=new URLSearchParams(U);return Y.length===0?X.delete("status"):X.set("status",Y.join(",")),xe==="all"?X.delete("stale"):xe==="stale"?X.set("stale","1"):X.set("stale","0"),o7(U,X)?U:X})},[xe,y,g,Y]),f.useEffect(()=>{H(Fe(b.filters.priority)),I(Fe(b.filters.type)),$(Fe(b.filters.assignee)),ee(Fe(b.filters.project)),ae(Fe(b.filters.tags)),at(b.sortField),ot(b.sortDirection),Me(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(N.current===y)return;let U=!1;return Ky().then(X=>{if(U||N.current===y)return;const ge=hN(X,y),Le=ge.defaultView,ut=Fe(ge.filters.status),bt=ge.filters.activity??"all",It=new URLSearchParams(window.location.search);let hr=!1;const ln=new URLSearchParams(It);It.get("view")===null&&Le!=="kanban"&&J0.includes(Le)&&(ln.set("view",Le),hr=!0),It.get("status")===null&&ut.length>0&&(ln.set("status",ut.join(",")),_(ut),hr=!0),It.get("stale")===null&&bt!=="all"&&(ln.set("stale",bt==="stale"?"1":"0"),ke(bt),hr=!0),hr&&g(ln,{replace:!0});const fn=M(ln.get("status")),pn=ln.get("stale")===null?bt:kd(ln.get("stale"));Ae(ic({status:fn,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:pn==="fresh"||pn==="stale"?pn:"all"})),queueMicrotask(()=>{N.current=y})}),()=>{U=!0}},[y]);const ht=f.useCallback(U=>{(y===null?zE(U):BE(y,U)).catch(ge=>{console.warn("Failed to persist view prefs:",ge)})},[y]),Qc=f.useCallback(U=>{F(U),ht({defaultView:U})},[F,ht]),sl=f.useRef(null);sl.current={status:Y,priority:z,type:q,assignee:K,project:W,tags:B,activity:xe,dateRange:ue,search:D};const Xc=f.useCallback((U={})=>{const X=sl.current;return{status:X.status,priority:X.priority,type:X.type,assignee:X.assignee,project:X.project,tags:X.tags,activity:X.activity,dateRange:ua(X.dateRange),search:X.search,...U}},[]),rn=f.useCallback((U={})=>{Ae(ic(Xc(U)))},[Xc]),Zc=f.useCallback(U=>{_(U),ht({filters:{status:U}}),rn({status:U})},[ht,rn]),eu=f.useCallback(U=>{H(U),ht({filters:{priority:U}}),rn({priority:U})},[ht,rn]),tu=f.useCallback(U=>{I(U),ht({filters:{type:U}}),rn({type:U})},[ht,rn]),Rp=f.useCallback(U=>{$(U),ht({filters:{assignee:U}}),rn({assignee:U})},[ht,rn]),Ap=f.useCallback(U=>{ee(U),ht({filters:{project:U}}),rn({project:U})},[ht,rn]),Zt=f.useCallback(U=>{ae(U),ht({filters:{tags:U}}),rn({tags:U})},[ht,rn]),Pp=f.useCallback(U=>{ke(U),ht({filters:{activity:U}}),rn({activity:U})},[ht,rn]),ol=f.useCallback(U=>{V(U),rn({search:U})},[rn]),nu=f.useCallback(U=>{se(U),rn({dateRange:ua(U)})},[rn]),qs=f.useCallback(U=>{at(U),ht({sortField:U})},[ht]),ja=f.useCallback(U=>{ot(U),ht({sortDirection:U})},[ht]),ru=f.useCallback(U=>{Me(U),ht({grouping:U})},[ht]),ka=f.useCallback(U=>{Ae(U);const X=lc(U);X&&(_(Fe(X.status)),H(Fe(X.priority)),I(Fe(X.type)),$(Fe(X.assignee)),ee(Fe(X.project)),ae(Fe(X.tags)),V(X.search??""),ke(X.activity&&X.activity!=="all"?X.activity:"all"),se(mp(X.dateRange)))},[]),an=f.useMemo(()=>lc(Re)!==null,[Re]),Sa=f.useCallback(()=>{const X=lc(Re)!==null?{status:Y,priority:z,type:q,assignee:K,project:W,tags:B,activity:xe,dateRange:ua(ue),search:D}:{};return{viewMode:L,filters:{...X,query:Re},sortField:Qe,sortDirection:Ze,listSectionVisibility:{collapsed:[...Je]},kanbanColumnVisibility:Z,tableColumnVisibility:Ee}},[L,Re,Y,z,q,K,W,B,xe,ue,D,Qe,Ze,Je,Z,Ee]),zn=f.useCallback(U=>{xC(U,{setViewMode:F,setQuery:Ae,setStatusFilter:X=>{_(X),ht({filters:{status:X}})},setPriorityFilter:X=>{H(X),ht({filters:{priority:X}})},setTypeFilter:X=>{I(X),ht({filters:{type:X}})},setAssigneeFilter:X=>{$(X),ht({filters:{assignee:X}})},setProjectFilter:X=>{ee(X),ht({filters:{project:X}})},setTagsFilter:X=>{ae(X),ht({filters:{tags:X}})},setActivityFilter:X=>{ke(X),ht({filters:{activity:X}})},setDateRange:se,setSearch:V,setSortField:qs,setSortDirection:ja,setListSectionVisibility:X=>$t(new Set(X.collapsed)),setKanbanColumnVisibility:_e,setTableColumnVisibility:Ie}),Xt(U.id)},[F,ht,qs,ja]),Dp=f.useCallback(U=>{zn(U),Ts.current=U.id,g(X=>{const ge=new URLSearchParams(X);return ge.set("loadView",U.id),ge},{replace:!0})},[zn,g]),$p=f.useCallback(async U=>{try{const X=_i({name:U,context:{workspace:e??null,projectSlug:null},state:Sa()}),ge=await $i(X),Le=ge.views[ge.views.length-1];Xt((Le==null?void 0:Le.id)??null),Le&&(Ts.current=Le.id,g(ut=>{const bt=new URLSearchParams(ut);return bt.set("loadView",Le.id),bt},{replace:!0})),Gt(!1),Et(!1),J(`Saved view "${U}"`,"success")}catch(X){throw J(X instanceof Error?X.message:"Failed to save view","error"),X}},[Sa,g,J,e]),Lp=f.useCallback(async()=>{if(!(!Lt||!yt))try{const U=_i({name:yt.name,context:{workspace:e??null,projectSlug:null},state:Sa()}),X=hf(yt.config,U.config,U.config);await lf(Lt,{config:X}),J("View updated","success")}catch(U){J(U instanceof Error?U.message:"Failed to update view","error")}},[Sa,yt,Lt,J,e]);f.useEffect(()=>{if(!Tt){Ts.current=null;return}if(Ts.current!==Tt&&(Lt&&Lt!==Tt&&Xt(null),!ze)){if(tt){J("Couldn't load saved view — try again","error");return}if(oe){Ts.current=Tt,zn(oe),g(U=>{const X=new URLSearchParams(U);return X.delete("loadView"),X},{replace:!0});return}Ts.current=Tt,J("Saved view no longer exists","error"),g(U=>{const X=new URLSearchParams(U);return X.delete("loadView"),X},{replace:!0})}},[Tt,oe,ze,tt,Lt,zn,g,J]);const Yn=f.useMemo(()=>vt.filter(U=>e?e==="_ungrouped"?U.projectWorkspace===null:U.projectWorkspace===e:!0),[vt,e]),Na=f.useMemo(()=>Array.from(new Set(Yn.map(U=>U.status))).sort(),[Yn]),Gs=f.useMemo(()=>Array.from(new Set(Yn.map(U=>U.priority))).sort(),[Yn]),Do=f.useMemo(()=>Array.from(new Set(Yn.map(U=>U.assignee??"__unassigned__"))).sort(),[Yn]),su=f.useMemo(()=>Array.from(new Map(Yn.filter(U=>U.projectSlug!==null).map(U=>[U.projectSlug,U.projectTitle]))).sort(([,U],[,X])=>U.localeCompare(X)),[Yn]),ou=f.useMemo(()=>Array.from(new Set(Yn.flatMap(U=>U.tags??[]))).sort(),[Yn]),$o=f.useMemo(()=>uC(d.factDeclarations),[d.factDeclarations]),al=f.useMemo(()=>Re.trim()===""?null:Di(Re,$o).query,[Re,$o]),Yt=f.useMemo(()=>lC(vt,al,{workspace:e}),[vt,al,e]),Gr=f.useMemo(()=>Hc(Yt,Qe,Ze),[Yt,Qe,Ze]),il=f.useMemo(()=>{if(Ye==="none")return[{id:"__all__",label:"All assignments",items:Yt}];if(Ye==="type"){const U=m.definitions.map(Le=>({id:Le.id,label:Ci(m,Le.id),items:Yt.filter(ut=>ut.type===Le.id)})),X=new Set(m.definitions.map(Le=>Le.id)),ge=Yt.filter(Le=>!Le.type||!X.has(Le.type));return ge.length>0&&U.push({id:S,label:"Other",items:ge}),U}if(Ye==="priority")return["critical","high","medium","low"].map(X=>({id:X,label:X.charAt(0).toUpperCase()+X.slice(1),items:Yt.filter(ge=>ge.priority===X)}));if(Ye==="assignee")return Array.from(new Set(Yt.map(X=>X.assignee??"__unassigned__"))).sort().map(X=>({id:X,label:X==="__unassigned__"?"Unassigned":X,items:Yt.filter(ge=>(ge.assignee??"__unassigned__")===X)}));if(Ye==="project"){const U=new Map;for(const X of Yt){const ge=X.projectSlug??"__standalone__",Le=X.projectTitle??"Standalone";U.has(ge)||U.set(ge,Le)}return Array.from(U.entries()).sort(([,X],[,ge])=>X.localeCompare(ge)).map(([X,ge])=>({id:X,label:ge,items:Yt.filter(Le=>(Le.projectSlug??"__standalone__")===X)}))}return w.map(U=>({id:U,label:v[U]??U,items:Yt.filter(X=>X.status===U)}))},[Ye,Yt,m,w,v]),ll=f.useMemo(()=>{const U=new Set(m.definitions.map(ge=>ge.id));return Yt.some(ge=>!ge.type||!U.has(ge.type))?[...E,{id:S,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Yt]),{visibleItems:At,visibleIndexByKey:cl}=f.useMemo(()=>{let U;if(L==="table")U=Gr;else if(L==="kanban"){const ge=new Set(m.definitions.map(Le=>Le.id));et==="type"?U=[...m.definitions.flatMap(Le=>Yt.filter(ut=>ut.type===Le.id)),...Yt.filter(Le=>!Le.type||!ge.has(Le.type))]:U=w.flatMap(Le=>Yt.filter(ut=>ut.status===Le))}else U=il.flatMap(ge=>ge.items);const X=new Map;return U.forEach((ge,Le)=>X.set(on(ge),Le)),{visibleItems:U,visibleIndexByKey:X}},[L,Gr,il,et,m,Yt,w]),{hotkeyRowProps:Ca}=Oc(At,{scope:"list:assignments",onOpen:U=>{if(U.projectSlug===null){n(`/assignments/${U.id}`);return}const X=U.projectWorkspace?`/w/${U.projectWorkspace}`:t;n(`${X}/projects/${U.projectSlug}/assignments/${U.slug}`)}});if(Kt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var U;return(U=s.current)==null?void 0:U.focus()}}),Kt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),i)return r.jsx(mt,{label:"Loading assignments board…"});if(c||!o)return r.jsx(kt,{error:c||"Assignments board is unavailable."});async function Ea({item:U,toColumnId:X,action:ge,reason:Le}){ye(on(U));const ut=vt;ct(bt=>bt.map(It=>on(It)===on(U)?{...It,status:X,blockedReason:X==="blocked"?Le??It.blockedReason:null}:It));try{if(U.projectSlug===null){if(!ge)throw new Error("Standalone assignments require a transition action, not status override.");const It=await fetch(`/api/assignments/${encodeURIComponent(U.id)}/transitions/${encodeURIComponent(ge.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le?{reason:Le}:{})});if(!It.ok)throw new Error((await It.json()).error??`HTTP ${It.status}`);const ln=(await It.json()).assignment;ct(fn=>fn.map(pn=>on(pn)===on(U)?{...pn,status:ln.status,blockedReason:ln.blockedReason,availableTransitions:ln.availableTransitions,updated:ln.updated}:pn));return}const bt=ge?await HE(U.projectSlug,U.slug,ge,Le):await KE(U.projectSlug,U.slug,X);return ct(It=>It.map(hr=>on(hr)===on(U)?{...hr,status:bt.status,blockedReason:bt.blockedReason,availableTransitions:bt.availableTransitions,updated:bt.updated}:hr)),u(),!0}catch(bt){return ct(ut),J(bt.message,"error"),!1}finally{ye(null)}}async function Ys({item:U,toColumnId:X,action:ge}){if(U.status===X)return;const Le=ge??ql(U,X);if(Le!=null&&Le.disabled){J(Le.disabledReason||`Cannot move this assignment to ${X}.`,"error");return}if(Le&&qE(Le)){Ue({item:U,toColumnId:X,action:Le});return}await Ea({item:U,toColumnId:X,action:Le})}async function Ta(U,X){if(X===U.title)return;const ge=on(U),Le=vt;ct(ut=>ut.map(bt=>on(bt)===ge?{...bt,title:X}:bt)),ye(ge);try{const ut=U.projectSlug===null?await jU({id:U.id,title:X}):await wU({projectSlug:U.projectSlug,assignmentSlug:U.slug,title:X});ct(bt=>bt.map(It=>on(It)===ge?{...It,title:ut.title,updated:ut.updated}:It)),u()}catch(ut){throw ct(Le),J(ut.message,"error"),ut}finally{ye(null)}}function au(U){$t(X=>{const ge=new Set(X);return ge.has(U)?ge.delete(U):ge.add(U),ge})}function ul(U){Qe===U?ja(Ze==="asc"?"desc":"asc"):(qs(U),ja("asc"))}const Ln=Pe?vt.find(U=>on(U)===Pe)??null:null;function us(U,X){U.dataTransfer.effectAllowed="move",U.dataTransfer.setData("text/plain",X),ve(X)}function Pr(){ve(null),fe(null)}function ds(U,X){if(!Ln)return;const ge=ql(Ln,X);Ln.status===X||ge!=null&&ge.disabled||(U.preventDefault(),U.dataTransfer.dropEffect="move",fe(X))}function Lo(U,X){te===X&&!U.currentTarget.contains(U.relatedTarget)&&fe(null)}function Io(U,X){if(U.preventDefault(),!Ln||Ln.status===X){Pr();return}Pr(),Ys({item:Ln,toColumnId:X})}function Bn({field:U,children:X}){const ge=Qe===U;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>ul(U),className:"inline-flex items-center gap-1 hover:text-foreground",children:[X,ge?Ze==="asc"?r.jsx(Hk,{className:"h-3 w-3"}):r.jsx(pr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Ce,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(by,{children:[r.jsx(s7,{className:"w-full md:min-w-[320px] md:flex-1",value:Re,onChange:ka,registry:$o,declarations:d.factDeclarations,valueSources:{statuses:d.order,priorities:Gs,types:m.definitions.map(U=>U.id),assignees:Do.filter(U=>U!=="__unassigned__"),projects:su.map(([U])=>U),tags:ou}}),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(hp,{ref:s,value:D,onChange:an?ol:()=>{},placeholder:"Search assignments or projects"}),r.jsx(xn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!an,options:Na.map(U=>({value:U,label:v[U]??U})),value:Y,onChange:Zc}),r.jsx(xn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!an,options:Gs.map(U=>({value:U,label:U[0].toUpperCase()+U.slice(1)})),value:z,onChange:eu}),r.jsx(xn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!an,options:m.definitions.map(U=>({value:U.id,label:Ci(m,U.id)})),value:q,onChange:tu}),r.jsx(xn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!an,options:[{value:"__unassigned__",label:"Unassigned"},...Do.filter(U=>U!=="__unassigned__").map(U=>({value:U,label:U}))],value:K,onChange:Rp}),r.jsx(xn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!an,options:[{value:"__standalone__",label:"Standalone"},...su.map(([U,X])=>({value:U,label:X}))],value:W,onChange:Ap}),r.jsx(xn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!an,options:ou.map(U=>({value:U,label:U})),value:B,onChange:Zt}),r.jsx(pp,{className:"max-w-[200px]",value:ue,onChange:an?nu:()=>{}}),r.jsxs("select",{value:xe,disabled:!an,onChange:U=>Pp(U.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:L==="kanban"?et:Ye,onChange:U=>ru(U.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:rO.map(U=>{const X=L==="kanban"&&U!=="status"&&U!=="type",ge=U==="none"?"No grouping":`Group: ${U.charAt(0).toUpperCase()+U.slice(1)}`;return r.jsx("option",{value:U,disabled:X,children:X?`${ge} (list only)`:ge},U)})}),r.jsx(gp,{value:L,onChange:U=>Qc(U),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),L==="table"?r.jsx(IE,{visibility:Ee,onChange:Ie}):null,r.jsx(WE,{scope:Fn,loadedViewId:Lt,onApply:Dp,onOpenSaveDialog:()=>{Et(!1),Gt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{yt?Lp():(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(jt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(yx,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Yt.length===0?r.jsx(jt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):L==="table"?(()=>{const U=new Set(Ee.hidden),X=ge=>ge==="title"||!U.has(ge);return r.jsx(We,{title:`${Gr.length} assignment${Gr.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[X("title")?r.jsx(Bn,{field:"title",children:"Assignment"}):null,X("status")?r.jsx(Bn,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),X("priority")?r.jsx(Bn,{field:"priority",children:"Priority"}):null,X("assignee")?r.jsx(Bn,{field:"assignee",children:"Assignee"}):null,X("dependencies")?r.jsx(Bn,{field:"dependencies",children:"Dependencies"}):null,X("created")?r.jsx(Bn,{field:"created",children:"Created"}):null,X("updated")?r.jsx(Bn,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gr.map((ge,Le)=>r.jsxs(i7,{detailHref:Cc(ge),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Ca(Le),children:[X("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(f2,{title:ge.title,detailHref:Cc(ge),onSave:ut=>Ta(ge,ut),disabled:re===on(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(Br,{value:ge.id})]})]}):null,X("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:ge.status,disabled:re===on(ge),onChange:ut=>Ys({item:ge,toColumnId:ut.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")]`,(pf[ge.status]??pf.pending).className,re===on(ge)&&"animate-pulse opacity-60"),children:w.map(ut=>{const bt=ge.status===ut?void 0:ql(ge,ut),It=(bt==null?void 0:bt.disabled)??!1;return r.jsx("option",{value:ut,disabled:It,title:It?(bt==null?void 0:bt.disabledReason)??void 0:void 0,children:v[ut]},ut)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ya,{type:ge.type,compact:!0})}),X("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:ge.priority}):null,X("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ge.assignee??"Unassigned"}):null,X("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ge.dependsOn.length}):null,X("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Mn(ge.created)}):null,X("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(ge.updated)}):null]},on(ge)))})]})})})})():L==="list"?r.jsx("div",{className:"space-y-3",children:il.map(({id:U,label:X,items:ge})=>{var ln;if(ge.length===0&&!(Ln&&Ye==="status"))return null;const Le=!Je.has(U),ut=Ye==="status",bt=ut&&Ln?Ln.status!==U&&!((ln=ql(Ln,U))!=null&&ln.disabled):!1,It=ut&&Ln?Ln.status!==U&&!bt:!1,hr=ut&&te===U;return r.jsxs("div",{className:be("rounded-lg border border-border/60 bg-card/90 transition",hr&&bt&&"ring-2 ring-ring/30",It&&"border-dashed opacity-65"),onDragOver:ut?fn=>ds(fn,U):void 0,onDragLeave:ut?fn=>Lo(fn,U):void 0,onDrop:ut?fn=>Io(fn,U):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>au(U),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(pr,{className:`h-4 w-4 text-muted-foreground transition-transform ${Le?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:X}),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(fn=>{const pn=on(fn),Oo=Pe===pn,iu=cl.get(pn)??-1,Ra=ut;return r.jsx("div",{draggable:Ra,onDragStart:Ra?fs=>us(fs,pn):void 0,onDragEnd:Ra?Pr:void 0,...iu>=0?Ca(iu):{},className:be("transition",Ra&&"cursor-grab active:cursor-grabbing",Oo&&"scale-[0.98] opacity-50"),children:r.jsx(X0,{assignment:fn,dragging:Oo,transitioning:re===pn,onPillSelect:fs=>void Ys({item:fn,toColumnId:fs.targetStatus,action:fs}),onRenameTitle:fs=>Ta(fn,fs)})},pn)})})]},U)})}):r.jsx(up,{columns:et==="type"?ll:k,items:Yt,getItemId:on,getColumnId:U=>et==="type"?U.type&&m.definitions.some(X=>X.id===U.type)?U.type:S:U.status,canDrop:({item:U,fromColumnId:X,toColumnId:ge})=>{if(X===ge)return{allowed:!0};const Le=ql(U,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:et==="type"?void 0:({item:U,toColumnId:X})=>Ys({item:U,toColumnId:X}),dragDisabled:et==="type",getExternalDragData:U=>U.projectSlug===null?{type:"standalone-assignment",id:U.id}:{type:"project-assignment",id:U.id},onCardContextMenu:(U,X)=>{X.preventDefault(),pt({item:U,anchor:{x:X.clientX,y:X.clientY}})},emptyMessage:U=>`No ${U.title.toLowerCase()} assignments.`,hiddenColumnIds:Z.hidden,onHideColumn:U=>_e(X=>({hidden:X.hidden.includes(U)?X.hidden.filter(Le=>Le!==U):[...X.hidden,U]})),renderCard:(U,{dragging:X})=>{const ge=cl.get(on(U))??-1;return r.jsx("div",{...ge>=0?Ca(ge):{},children:r.jsx(X0,{assignment:U,dragging:X,transitioning:re===on(U),onPillSelect:Le=>void Ys({item:U,toColumnId:Le.targetStatus,action:Le}),onRenameTitle:Le=>Ta(U,Le)})})}}),r.jsx(ba,{toast:le,onDismiss:he}),r.jsx(UE,{open:dn,onOpenChange:U=>{Gt(U),U||Et(!1)},initialName:Gn&&yt?`${yt.name} (copy)`:"",title:Gn?"Save as new view":"Save view",onSubmit:$p}),r.jsx(XE,{open:Se!==null,action:(Se==null?void 0:Se.action)??null,assignmentTitle:(Se==null?void 0:Se.item.title)??"Assignment",loading:re===(Se?on(Se.item):null),onOpenChange:U=>{U||Ue(null)},onConfirm:async U=>{if(!Se)return;const X=Se;await Ea({item:X.item,toColumnId:X.toColumnId,action:X.action,reason:U})&&Ue(null)}}),r.jsx(SC,{anchor:(ce==null?void 0:ce.anchor)??null,items:ce?a7(ce.item,{onEdit:()=>{const U=ce.item,X=U.projectSlug===null?`/assignments/${U.id}`:`${U.projectWorkspace?`/w/${U.projectWorkspace}`:t}/projects/${U.projectSlug}/assignments/${U.slug}`;n(X)},onDelete:()=>St(ce.item),onMove:()=>qe(ce.item)}):[],onClose:()=>pt(null)}),r.jsx(wa,{open:xt!==null,title:"Delete assignment?",description:xt?`"${xt.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:st!==null,onOpenChange:U=>{!U&&st===null&&St(null)},onConfirm:async()=>{if(!xt||xt.projectSlug===null){St(null);return}const U=on(xt);me(U);try{const X=await fetch(`/api/projects/${encodeURIComponent(xt.projectSlug)}/assignments/${encodeURIComponent(xt.slug)}`,{method:"DELETE"});if(!X.ok){const ge=await X.json().catch(()=>({}));throw new Error(ge.error||"Failed to delete assignment")}St(null),u()}catch(X){alert(X instanceof Error?X.message:"Failed to delete assignment")}finally{me(null)}}}),r.jsx(wy,{open:Oe!==null,onOpenChange:U=>{U||qe(null)},currentWorkspace:(Oe==null?void 0:Oe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async U=>{if(!Oe)return;const X=await fetch(`/api/assignments/${encodeURIComponent(Oe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:U})});if(!X.ok){const ge=await X.json().catch(()=>({}));throw new Error(ge.error||"Failed to move assignment")}u()}})]})}function a7(e,t){const n=[{key:"edit",label:"Edit",icon:Ui,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:Af,onSelect:t.onMove}),n}function i7({detailHref:e,children:t,className:n,...s}){const o=p2(e);return r.jsx("tr",{...s,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function X0({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:o}){var d;const i=Cc(e),c=!!(s&&o),u=p2(i);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:be("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(f2,{title:e.title,detailHref:i,onSave:o,disabled:n}):r.jsx(Ce,{to:i,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(d=e.id)==null?void 0:d.slice(0,8),e.id&&r.jsx(Br,{value:e.id})]})]}),c?r.jsx(JU,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:s,disabled:n,className:"max-w-[150px]"}):r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),e.blockedReason?r.jsx("p",{className:"mt-3 rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground",children:e.blockedReason}):null,r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[r.jsx(ya,{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 ql(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function on(e){return e.id||e.slug||"unknown"}function Kr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),o=n.split(`
596
- `),i=[],c=new Map;let u=null,d=[];const m=()=>{u&&(i.push(u),c.set(u,d))};for(const h of o){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],d=[h];continue}u&&d.push(h)}return m(),{order:i,blocks:c,body:s}}function tl(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 l7(e,t){return Nn(e,t)==="true"}function pc(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 c7(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}: ${c7(n)}`])}function mc(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 hc(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Sp(e){const t=Kr(e);return{title:Nn(t,"title"),slug:Nn(t,"slug"),workspace:Nn(t,"workspace"),archived:l7(t,"archived"),archivedAt:Nn(t,"archivedAt"),archivedReason:Nn(t,"archivedReason"),tags:pc(t,"tags").join(", "),body:t.body}}function u7(e,t){const n=Kr(e),s={...Sp(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),mc(n,"tags",hc(s.tags)),n.body=s.body,tl(n)}function Np(e){const t=Kr(e);return{title:Nn(t,"title"),slug:Nn(t,"slug"),status:Nn(t,"status"),priority:Nn(t,"priority")||"medium",assignee:Nn(t,"assignee"),dependsOn:pc(t,"dependsOn").join(", "),links:pc(t,"links").join(", "),blockedReason:Nn(t,"blockedReason"),tags:pc(t,"tags").join(", "),body:t.body}}function d7(e,t){const n=Kr(e),s={...Np(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),mc(n,"dependsOn",hc(s.dependsOn)),mc(n,"links",hc(s.links)),Cn(n,"blockedReason",s.blockedReason||null),mc(n,"tags",hc(s.tags)),n.body=s.body,tl(n)}function Cp(e){const t=Kr(e);return{assignment:Nn(t,"assignment"),status:Nn(t,"status"),body:t.body}}function f7(e,t){const n=Kr(e),s={...Cp(e),...t};return Cn(n,"assignment",s.assignment),Cn(n,"status",s.status),n.body=s.body,tl(n)}function Ep(e){const t=Kr(e);return{assignment:Nn(t,"assignment"),body:t.body}}function p7(e,t){const n=Kr(e),s={...Ep(e),...t};return Cn(n,"assignment",s.assignment),n.body=s.body,tl(n)}function Tp(e){const t=Kr(e);return{name:Nn(t,"name"),slug:Nn(t,"slug"),description:Nn(t,"description"),whenToUse:Nn(t,"when_to_use"),tags:pc(t,"tags").join(", "),body:t.body}}function m7(e,t){const n=Kr(e),s={...Tp(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),mc(n,"tags",hc(s.tags)),n.body=s.body,tl(n)}function Qy(e){return{body:Kr(e).body}}function m2(e){return Qy(e)}function h2(e,t){const n=Kr(e);return t.body!==void 0&&(n.body=t.body),tl(n)}function h7(e,t){return h2(e,t)}function Ht(e,t,n){switch(e){case"project":return u7(t,n);case"assignment":return d7(t,n);case"plan":return f7(t,n);case"scratchpad":return p7(t,n);case"playbook":return m7(t,n);case"memory":return h2(t,n);case"resource":return h7(t,n);default:return t}}function nl({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:o,error:i,title:c,description:u,onCancel:d,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=f.useState(e),[N,w]=f.useState(!1),[v,k]=f.useState("edit");f.useEffect(()=>{b(e)},[e]);const E=b7(t,y),S=y!==e,T=y7(t,y),P=S?"Unsaved changes":n==="create"?"Draft":"Saved",R=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:c}),r.jsx("span",{className:"rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:P})]}),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(Kd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>w(A=>!A),className:"shell-action",children:[r.jsx(pP,{className:"h-4 w-4"}),r.jsx("span",{children:N?"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(Df,{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(A=>r.jsx("li",{children:A},A))})}):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(Rw,{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:N?r.jsx("textarea",{value:y,onChange:A=>b(A.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(g7,{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(Rw,{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 g7({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const i=Sp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Gl,{children:[r.jsx(Ot,{label:"Project title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,d={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(d.slug=wr(u)),n(Ht(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:c=>n(Ht(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is the folder name and URL-safe identifier. It is locked after creation so links and file paths stay stable."})]})}),r.jsx(Ot,{label:"Tags",children:r.jsx("input",{value:i.tags,onChange:c=>n(Ht(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(x7,{value:i.workspace,onChange:c=>n(Ht(e,t,{workspace:c}))})]}),r.jsx(Ot,{label:"Project body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const i=Np(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Gl,{children:[r.jsx(Ot,{label:"Assignment title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,d={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(d.slug=wr(u)),n(Ht(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:c=>n(Ht(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the assignment folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is locked after creation because assignment paths and dependency references use it as a stable identifier."})]})}),r.jsx(Ot,{label:"Status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Ht(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"review",children:"Review"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})}),r.jsx(Ot,{label:"Priority",children:r.jsxs("select",{value:i.priority,onChange:c=>n(Ht(e,t,{priority:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"low",children:"Low"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"critical",children:"Critical"})]})}),r.jsx(Ot,{label:"Assignee",children:r.jsx("input",{value:i.assignee,onChange:c=>n(Ht(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(Ot,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:i.dependsOn,onChange:c=>n(Ht(e,t,{dependsOn:c.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:i.links,onChange:c=>n(Ht(e,t,{links:c.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:i.blockedReason,onChange:c=>n(Ht(e,t,{blockedReason:c.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:i.tags,onChange:c=>n(Ht(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(Ot,{label:"Assignment body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const i=Cp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Gl,{children:[r.jsx(Ot,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(Ot,{label:"Plan status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Ht(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"draft",children:"Draft"}),r.jsx("option",{value:"approved",children:"Approved"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"})]})})]}),r.jsx(Ot,{label:"Plan body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const i=Ep(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Gl,{children:r.jsx(Ot,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(Ot,{label:"Scratchpad body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Ht(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const i=e==="memory"?Qy(t):m2(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ot,{label:c,children:r.jsx("textarea",{value:i.body,onChange:u=>n(Ht(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const o=Tp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Gl,{children:[r.jsx(Ot,{label:"Playbook name",children:r.jsx("input",{value:o.name,onChange:i=>{const c=i.target.value,u={name:c};s&&(o.slug===wr(o.name)||!o.slug.trim())&&(u.slug=wr(c)),n(Ht(e,t,u))},className:"editor-input"})}),r.jsx(Ot,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:o.slug,disabled:!s,onChange:i=>n(Ht(e,t,{slug:wr(i.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the filename. It is auto-generated from the name until you change it.":"The slug is locked after creation because it is the filename."})]})}),r.jsx(Ot,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:o.description,onChange:i=>n(Ht(e,t,{description:i.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:o.tags,onChange:i=>n(Ht(e,t,{tags:i.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:o.whenToUse,onChange:i=>n(Ht(e,t,{whenToUse:i.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(Ot,{label:"Playbook rules",children:r.jsx("textarea",{value:o.body,onChange:i=>n(Ht(e,t,{body:i.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function Gl({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 x7({value:e,onChange:t}){const{data:n}=ma(),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 y7(e,t){switch(e){case"project":return Sp(t).body;case"assignment":return Np(t).body;case"plan":return Cp(t).body;case"scratchpad":return Ep(t).body;case"playbook":return Tp(t).body;case"memory":return Qy(t).body;case"resource":return m2(t).body}}function b7(e,t){switch(e){case"project":{const n=Sp(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Pd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=Np(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Pd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return Cp(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Ep(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Tp(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Pd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function Z0(){const e=_t(),{workspace:t}=Mt(),n=un(),[s,o]=f.useState(null),[i,c]=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),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){d(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),N=await b.json();if(!b.ok){h(N.error||`HTTP ${b.status}`),d(!1);return}e(`${n}/projects/${N.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(nl,{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 ek(){const{slug:e}=Mt(),t=un(),n=_t(),[s,o]=f.useState(null),[i,c]=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),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}d(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),N=await b.json();if(!b.ok){h(N.error||`HTTP ${b.status}`),d(!1);return}n(`${t}/projects/${e}/assignments/${N.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(nl,{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 tk(){const{workspace:e}=Mt(),t=un(),n=_t(),[s,o]=f.useState(null),[i,c]=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),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;d(!0),h(null);try{const N=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),w=await N.json();if(!N.ok){h(w.error||`HTTP ${N.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(N){h(N.message),d(!1);return}d(!1)}return i?r.jsx(mt,{label:"Loading assignment template…"}):m&&!s?r.jsx(kt,{error:m}):r.jsx(nl,{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 rl({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,documentType:i,helpTitle:c,helpBody:u}){const d=_t(),{data:m,loading:h,error:g}=k1(e),[y,b]=f.useState(!1),[N,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(nl,{initialContent:m.content,documentType:i,onSave:v,saving:y,error:N,title:s,description:o,onCancel:()=>d(n),helpTitle:c,helpBody:u})}function nk(){const{slug:e}=Mt(),t=un(),n=e??"";return r.jsx(rl,{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 lg(){const{slug:e,aslug:t,id:n}=Mt(),s=un(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=o?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(rl,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Assignment",description:"Edit assignment fields including status, priority, assignee, dependencies, and body.",documentType:"assignment",helpTitle:"Assignment editing",helpBody:"All fields are editable. Status can also be changed through lifecycle actions or kanban drag."})}function cg(){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`,c=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=o?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(rl,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Plan",description:"Plans are separate from assignment status, so keep implementation steps here instead of overloading the assignment body.",documentType:"plan",helpTitle:"Plan status is separate",helpBody:"Plan status tracks the plan document itself. It does not replace the assignment lifecycle state."})}function ug(){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`,c=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=o?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(rl,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Edit Scratchpad",description:"Scratchpad is the assignment’s working memory surface for notes, experiments, and temporary context.",documentType:"scratchpad",helpTitle:"Scratchpad usage",helpBody:"Scratchpad is for transient notes. Keep canonical objective and lifecycle data in assignment.md and any active plan files (plan.md, plan-v2.md, ...)."})}function g2({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,helpTitle:i,helpBody:c}){const u=_t(),{data:d,loading:m,error:h}=k1(e),[g,y]=f.useState(""),[b,N]=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})}),P=await T.json();if(!T.ok){E(P.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=>N(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 dg(){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`,c=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=o?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(g2,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Append Handoff Entry",description:"Add a new handoff without rewriting previous history.",helpTitle:"Append-only handoff history",helpBody:"Handoff log entries preserve the baton-passing trail between sessions and agents. Add a new entry instead of editing older ones."})}function fg(){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`,c=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=o?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(g2,{loadUrl:i,saveUrl:c,redirectTo:u,title:"Append Decision Entry",description:"Record a new decision and rationale without editing prior entries.",helpTitle:"Append-only decision history",helpBody:"Decision records should accumulate over time so the implementation rationale remains auditable and reviewable."})}function rk(){const{workspace:e}=Mt(),{data:t}=Cs(),{data:n,loading:s,error:o,refetch:i}=Tx(),[c,u]=f.useState(!1),[d,m]=f.useState(""),[h,g]=f.useState(!1),y=Xn();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 P=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(P)},[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(P=>P.assignment&&P.assignment.project!==null&&E.has(P.assignment.project))))})();async function N(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:[c?r.jsxs("form",{onSubmit:N,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(Ct,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:w,disabled:h,children:[r.jsx(Jk,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(jt,{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(v7,{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(xi,{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 v7({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(jx,{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(Jk,{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(w7,{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(DP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function w7({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(Br,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(bx,{className:"h-3 w-3"}),e.branch,e.worktree&&r.jsx("span",{className:"rounded bg-status-in-progress px-1 py-0.5 text-[10px] font-medium text-status-in-progress-foreground",children:"worktree"})]}),e.ports.length>0&&r.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.urls.map(c=>r.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/5 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 dark:border-primary/40 dark:bg-primary/10 dark:hover:bg-primary/20",children:[c.replace("http://localhost:",":"),r.jsx(zi,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Ce,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${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(wP,{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 x2(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 j7(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":x2(s)}function k7(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 S7(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function sk(){const{data:e,loading:t,error:n,refetch:s}=S1(),[o,i]=f.useState(()=>Date.now()),[c,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(jt,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(N7,{detail:g,now:o,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(wa,{open:c!==null,title:"Force release this lease?",description:c?`This will revoke lease ${c.lease.lease_id} and (if it's still the current holder) free member ${c.lease.member_id}. Any agent still using this lease will see a stale-lease error on its next CLI call.`:"",confirmLabel:"Force release",destructive:!0,loading:d,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function N7({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:o,active_leases:i}=e,c=o.filter(d=>d.status==="idle").length,u=o.filter(d=>d.status==="leased").length;return r.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{children:[r.jsxs("h2",{className:"text-lg font-semibold",children:[r.jsx(Pf,{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=",x2(s.default_ttl_s)]})]}),r.jsx("div",{className:"text-right text-xs text-muted-foreground",children:r.jsxs("div",{children:[c," idle · ",u," leased · ",o.length," total"]})})]}),r.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(d=>r.jsx(C7,{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(E7,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function C7({member:e}){const t=S7(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 ${k7(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 E7({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(iP,{className:"h-3 w-3"}),j7(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(IP,{className:"h-3 w-3"}),"Force release"]})]})]})}function T7(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 R7(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function A7(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 P7(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 D7(){const[e,t]=f.useState(null),[n,s]=f.useState(!0),[o,i]=f.useState(null),c=f.useCallback(async()=>{try{t(await R7()),i(null)}catch(u){i(u instanceof Error?u.message:"Failed to fetch schedules")}finally{s(!1)}},[]);return f.useEffect(()=>{c()},[c]),Vi(u=>{u.type==="schedules-updated"&&c()}),{data:e,loading:n,error:o,refetch:c}}const $7=[{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 L7({open:e,onOpenChange:t,onCreated:n}){const[s,o]=f.useState(""),[i,c]=f.useState("claude"),[u,d]=f.useState("cron"),[m,h]=f.useState(!0),[g,y]=f.useState(""),[b,N]=f.useState(""),[w,v]=f.useState("0 3 * * *"),[k,E]=f.useState(""),[S,T]=f.useState(""),[P,R]=f.useState("5"),[A,L]=f.useState("claude"),[M,F]=f.useState(""),[D,V]=f.useState("rolling-5h"),[Y,_]=f.useState("ready_to_implement"),[z,H]=f.useState(""),[q,I]=f.useState(!1),[K,$]=f.useState(null);if(!e)return null;function W(){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(P)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:u,provider:A,anchor:{windowStartIso:M||new Date().toISOString(),windowKind:D}};case"when-status":return{kind:u,status:Y,...z?{assignmentId:z}:{}};case"when-plan-lands":return{kind:u,...z?{assignmentId:z}:{}}}}async function ee(){I(!0),$(null);try{const ue={assignmentId:s.trim(),agentId:i.trim(),trigger:W(),unattended:m,terminalPreference:g.trim()||null,promptTemplate:b.trim()||null};if(!ue.assignmentId)throw new Error("Assignment id is required");await A7(ue),n(),t(!1)}catch(ue){$(ue instanceof Error?ue.message:"Create failed")}finally{I(!1)}}const B="w-full rounded border bg-background px-2 py-1 text-sm",ae="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($f,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Assignment id / slug"}),r.jsx("input",{className:B,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:ae,children:"Agent"}),r.jsx("input",{className:B,value:i,onChange:ue=>c(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Terminal (optional)"}),r.jsx("input",{className:B,value:g,onChange:ue=>y(ue.target.value),placeholder:"default"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Trigger"}),r.jsx("select",{className:B,value:u,onChange:ue=>d(ue.target.value),children:$7.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:ae,children:"Cron expr"}),r.jsx("input",{className:B,value:w,onChange:ue=>v(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Timezone (optional)"}),r.jsx("input",{className:B,value:k,onChange:ue=>E(ue.target.value),placeholder:"local"})]})]}),u==="at"&&r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"ISO timestamp"}),r.jsx("input",{className:B,value:S,onChange:ue=>T(ue.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),u==="in"&&r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Delay (hours)"}),r.jsx("input",{className:B,type:"number",value:P,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:ae,children:"Provider"}),r.jsxs("select",{className:B,value:A,onChange:ue=>L(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:ae,children:"Window kind"}),r.jsxs("select",{className:B,value:D,onChange:ue=>V(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:ae,children:"Window start (optional ISO)"}),r.jsx("input",{className:B,value:M,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:ae,children:"Status"}),r.jsx("input",{className:B,value:Y,onChange:ue=>_(ue.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Watch assignment (optional)"}),r.jsx("input",{className:B,value:z,onChange:ue=>H(ue.target.value),placeholder:"this assignment"})]})]}),u==="when-plan-lands"&&r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Watch assignment (optional)"}),r.jsx("input",{className:B,value:z,onChange:ue=>H(ue.target.value),placeholder:"this assignment"})]}),r.jsxs("div",{children:[r.jsx("label",{className:ae,children:"Prompt template (optional)"}),r.jsx("input",{className:B,value:b,onChange:ue=>N(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)"]}),K&&r.jsx("p",{className:"text-sm text-destructive",children:K})]}),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:ee,disabled:q,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:q?"Creating…":"Create"})]})]})})}const I7=new Set(["completed","failed","launch_failed","cancelled","killed"]);function O7(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 _7(){const{data:e,loading:t,error:n,refetch:s}=D7(),[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 c(u){try{await P7(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(Ct,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?r.jsx(jt,{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(Wk,{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 ${O7(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:[T7(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]})]})]}),!I7.has(u.attempt.state)&&r.jsxs("button",{type:"button",onClick:()=>c(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(eP,{className:"h-3 w-3"}),"Cancel"]})]},u.id))}),r.jsx(L7,{open:o,onOpenChange:i,onCreated:s})]})}const M7={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},xo="bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm";function ok(){const[e,t]=ls(),n=$3(e),s=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Cs(),{data:c}=ma(),{data:u}=N1(),[d,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null);f.useEffect(()=>{if(!e.get("window")){const v=kg({window:"30d",...n});o==="assignment"&&v.set("groupBy","assignment"),t(v,{replace:!0})}},[]);const N=v1({window:s,...n}).toString();f.useEffect(()=>{const v=new AbortController;g(!0),b(null);const k=N?`/api/usage?${N}&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()},[N,o]);function w(v,k=o){const E=kg(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($c,{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:xo,children:Lf.map(v=>r.jsx("option",{value:v,children:M7[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:xo})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n.until??"",onChange:v=>w({...n,window:"custom",until:v.target.value||void 0}),className:xo})]})]}):null,r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Workspace"}),r.jsxs("select",{value:n.workspace??"",onChange:v=>w({...n,workspace:v.target.value||void 0,project:void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),c!=null&&c.hasUngrouped?r.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,((c==null?void 0:c.workspaces)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:n.project??"",onChange:v=>w({...n,project:v.target.value||void 0,workspace:void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),(i??[]).map(v=>r.jsx("option",{value:v.slug,children:v.slug},v.slug))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Model"}),r.jsxs("select",{value:n.model??"",onChange:v=>w({...n,model:v.target.value||void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.models)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Tool"}),r.jsxs("select",{value:n.tool??"",onChange:v=>w({...n,tool:v.target.value||void 0}),className:xo,children:[r.jsx("option",{value:"",children:"All"}),((u==null?void 0:u.tools)??[]).map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Group by"}),r.jsxs("select",{value:o,onChange:v=>w(n,v.target.value),className:xo,children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),d&&!h&&!y&&r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mb-8",children:[r.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),d.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data for these filters. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),o==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:d.summary.map((v,k)=>r.jsxs("tr",{className:"border-t border-zinc-800",children:[r.jsx("td",{className:"px-3 py-2",children:v.projectSlug||"(unattributed)"}),o==="assignment"&&r.jsx("td",{className:"px-3 py-2",children:v.assignmentSlug||"(unattributed)"}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Ai(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Pi(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:Ai(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Pi(v.total_cost)})]},k))})]})]})]})]})}function ak(){const{workspace:e}=Mt(),{data:t}=Cs(),{data:n,loading:s,error:o}=Of(),[i,c]=f.useState(""),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState("started_desc"),[b,N]=f.useState(0),[w,v]=f.useState(new Set),[k,E]=f.useState(!1),[S,T]=f.useState(null),[P,R]=f.useState(null),A=(n==null?void 0:n.sessions.some(_=>_.status==="active"))??!1;f.useEffect(()=>{if(!A)return;const _=window.setInterval(()=>N(z=>z+1),3e4);return()=>window.clearInterval(_)},[A]),f.useEffect(()=>{v(_=>{if(_.size===0)return _;const z=new Set((n==null?void 0:n.sessions.map(q=>q.sessionId))??[]),H=new Set([..._].filter(q=>z.has(q)));return H.size===_.size?_:H})},[n]);const L=f.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const _=i.trim().toLowerCase();return[...n.sessions.filter(H=>{var K;if(e&&t){const $=((K=t.find(W=>W.slug===H.projectSlug))==null?void 0:K.workspace)??null;if(e==="_ungrouped"){if($!==null)return!1}else if($!==e)return!1}const q=z7(H.started);return u&&(!q||q<u)||m&&(!q||q>m)?!1:_?[H.projectSlug??"",H.assignmentSlug??"",H.agent,H.sessionId,H.path,H.description??"",H.transcriptPath??""].join(" ").toLowerCase().includes(_):!0})].sort((H,q)=>B7(H,q,g))},[n,i,g,u,m,b,e,t]);function M(_){v(z=>{const H=new Set(z);return H.has(_)?H.delete(_):H.add(_),H})}function F(){w.size===L.length&&L.length>0?v(new Set):v(new Set(L.map(_=>_.sessionId)))}async function D(_){T(null),E(!0);try{const z=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:_})}),H=await z.json().catch(()=>null);if(!z.ok)throw new Error((H==null?void 0:H.error)||`HTTP ${z.status}`);v(q=>new Set([...q].filter(I=>!_.includes(I)))),R(null)}catch(z){T(z.message)}finally{E(!1)}}async function V(_){try{const z=await fetch(`/api/agent-sessions/${encodeURIComponent(_)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!z.ok){const H=await z.json().catch(()=>null);T((H==null?void 0:H.error)||`Failed to mark session stopped: HTTP ${z.status}`)}}catch(z){T(z.message)}}if(s)return r.jsx(mt,{label:"Loading agent sessions..."});if(o)return r.jsx(kt,{error:o});if(!n)return null;const Y=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(by,{children:[r.jsx(hp,{value:i,onChange:c,placeholder:"Search project, assignment, agent, session ID, path, or description"}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started From",r.jsx("input",{type:"date",value:u,onChange:_=>d(_.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:_=>h(_.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("select",{value:g,onChange:_=>y(_.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"})]}),Y?L.length===0?r.jsx(jt,{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===L.length&&L.length>0?r.jsx(zr,{className:"h-4 w-4"}):r.jsx(kx,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:L.map(_=>r.jsx(F7,{session:_,selected:w.has(_.sessionId),onToggle:()=>M(_.sessionId),onDelete:()=>R({sessionIds:[_.sessionId],title:`Delete session ${_.sessionId.slice(0,8)}...?`,description:`Remove this ${_.agent} session record${_.assignmentSlug?` for ${_.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:V,onCopyError:T},_.sessionId))})]})}):r.jsx(jt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(wa,{open:P!==null,title:(P==null?void 0:P.title)??"Delete session?",description:(P==null?void 0:P.description)??"",confirmLabel:(P==null?void 0:P.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:_=>{_||R(null)},onConfirm:async()=>{P&&await D(P.sessionIds)}})]})}function F7({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:o,onCopyError:i}){const c=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(zr,{className:"h-4 w-4"}):r.jsx(kx,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Ce,{to:`${c}/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(Ce,{to:`${c}/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(Ce,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.description?r.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(Tf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:u}),r.jsx(Br,{value:e.sessionId}),r.jsx(VE,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>i(h.message),onNotice:h=>i(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Ur(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:d}),e.path&&r.jsx(Br,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx(Br,{value:e.transcriptPath})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(YE,{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 z7(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 Sd(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 B7(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 Sd(e)-Sd(t);case"duration_desc":return Sd(t)-Sd(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 U7(){const{data:e,loading:t,error:n,refetch:s}=Rx(),[o,i]=f.useState(""),[c,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(),!c){u(v);try{const E=k?"disable":"enable",S=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!S.ok){const T=await S.json().catch(()=>({}));throw new Error(T.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{u(null)}}}async function N(){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(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange: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(Ce,{to:"/playbooks/create",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Ce,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(qk,{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(jt,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(Ce,{to:"/playbooks/create",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{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=c===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(hy,{items:k})}),r.jsxs(Ce,{to:`/playbooks/${w.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Uk,{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(Qk,{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(wa,{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:N,onOpenChange:w=>{w||m(null)}})]})}function W7(){const{slug:e}=Mt(),t=_t(),{data:n,loading:s,error:o,refetch:i}=V3(e),[c,u]=f.useState(!1),[d,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(!1),[N,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 P=wr(N),R=P.length>0&&Pd(P)&&P!=="manifest",A=P!==e;async function L(){if(!(!e||!R||!A)){k(!0),S(null);try{const D=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:P})});if(!D.ok){const V=await D.json().catch(()=>({}));throw new Error(V.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${P}`)}catch(D){S(D instanceof Error?D.message:"Failed to rename playbook")}finally{k(!1)}}}async function M(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function F(){if(!(!e||!n)){g(!0);try{const D=n.enabled?"disable":"enable",V=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!V.ok){const Y=await V.json().catch(()=>({}));throw new Error(Y.error||`Failed to ${D} playbook`)}i()}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(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 ",Ur(n.created)]}),r.jsxs("span",{children:["Updated ",Ur(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(D=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:[r.jsx(Qk,{className:"h-3 w-3"}),D]},D))}):null]}),T?null:r.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),r.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick: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(Ce,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Ui,{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(_P,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:M,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:n.body})}),r.jsx($n,{open:y,onOpenChange:D=>v?void 0:b(D),children:r.jsxs(En,{children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:"Rename playbook"}),r.jsx(Vr,{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:N,onChange:D=>w(D.target.value),disabled:v,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),N&&P!==N?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:P||"—"})]}):null,N&&!R?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:v,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:L,disabled:v||!R||!A,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function V7(){const e=_t(),[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,c]=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){c(!0),d(null);try{const g=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){d(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){d(g.message),c(!1);return}c(!1)}return s?r.jsx(mt,{label:"Loading playbook template..."}):u&&!t?r.jsx(kt,{error:u}):r.jsx(nl,{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 H7(){const{slug:e}=Mt(),t=_t(),[n,s]=f.useState(null),[o,i]=f.useState(!0),[c,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(nl,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function K7(){const{data:e,loading:t,error:n}=H3(),[s,o]=f.useState(""),[i,c]=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]),N=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(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search memories…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),N.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ce,{to:"/memories/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{className:"h-4 w-4"}),"New Memory"]})]}),w.length===0?r.jsx(jt,{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(Ce,{to:"/memories/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{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(Ce,{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(Ce,{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 q7(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=K3(e,t),[c,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(Ce,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.scope?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",s.scope]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,s.sourceAssignment?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",s.sourceAssignment]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Ur(s.created)]}),r.jsxs("span",{children:["Updated ",Ur(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{to:`/projects/${e}/memories/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Ui,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function G7(){const e=_t(),[t]=ls(),n=t.get("project"),{data:s,loading:o,error:i}=Cs(),[c,u]=f.useState(n??""),[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[N,w]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!d.trim())){b(!0),w(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){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:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),N?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Memory"}),r.jsx("button",{type:"button",onClick:()=>e("/memories"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function Y7(){const{slug:e,itemSlug:t}=Mt();return r.jsx(rl,{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 J7(){const{data:e,loading:t,error:n}=q3(),[s,o]=f.useState(""),[i,c]=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]),N=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(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search resources…",value:s,onChange:v=>o(v.target.value),className:"h-9 w-64 rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:i,onChange:v=>c(v.target.value),className:"editor-input max-w-[170px]",children:[r.jsx("option",{value:"all",children:"All projects"}),y.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:u,onChange:v=>d(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),N.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Ce,{to:"/resources/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{className:"h-4 w-4"}),"New Resource"]})]}),w.length===0?r.jsx(jt,{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(Ce,{to:"/resources/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Ct,{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(Ce,{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(Ce,{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 Q7(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=G3(e,t),[c,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(Ce,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.category?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",s.category]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Ur(s.created)]}),r.jsxs("span",{children:["Updated ",Ur(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Ce,{to:`/projects/${e}/resources/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Ui,{className:"h-3 w-3"}),"Edit"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:h,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(yn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(gn,{content:s.body})})]}):null}function X7(){const e=_t(),[t]=ls(),n=t.get("project"),{data:s,loading:o,error:i}=Cs(),[c,u]=f.useState(n??""),[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(!1),[N,w]=f.useState(null);f.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!d.trim())){b(!0),w(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){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:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:d,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),N?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:N}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!d.trim()||!c,className:"inline-flex h-9 items-center rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-50",children:y?"Creating…":"Create Resource"}),r.jsx("button",{type:"button",onClick:()=>e("/resources"),className:"inline-flex h-9 items-center rounded-md border border-border/70 bg-background px-3 text-sm font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]})]})}function Z7(){const{slug:e,itemSlug:t}=Mt();return r.jsx(rl,{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 ax=["projects","playbooks","todos","servers","config"];function e9(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))ax.includes(n)&&t.add(n);return t}function ik(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function t9(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[o,i]=f.useState(""),[c,u]=f.useState(new Set(ax)),[d,m]=f.useState(!1),[h,g]=f.useState(!1),[y,b]=f.useState(null),[N,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 A=await R.json();s(A),i(A.repo??""),u(e9(A.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(A=>{const L=new Set(A);return L.has(R)?L.delete(R):L.add(R),L}),m(!0)}async function E(){g(!0),w(null);try{const R=Array.from(c),A=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:R})}),L=await A.json();if(!A.ok)throw new Error(L.error||`HTTP ${A.status}`);s(L),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"}),A=await R.json();if(!R.ok||A.success===!1)throw new Error(A.error||A.message||`HTTP ${R.status}`);w({type:"success",message:A.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 A=await fetch("/api/backup/pull",{method:"POST"}),L=await A.json();if(!A.ok||L.success===!1)throw new Error(L.error||L.message||`HTTP ${A.status}`);w({type:"success",message:L.message||"Restore complete."}),await v()}catch(A){w({type:"error",message:`Restore failed: ${A instanceof Error?A.message:String(A)}`})}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 P=!!o.trim()&&c.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:[N&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${N.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:N.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:ax.map(R=>{const A=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${A?"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 ${A?"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: "}),ik((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),ik((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(Df,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:S,disabled:!P,title:P?"Back up now":d?"Save config first":"Set repo and pick categories",children:[r.jsx(MP,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!P,title:P?"Restore from backup":d?"Save config first":"Set repo and pick categories",children:[r.jsx(dP,{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 n9(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:o,unbindAction:i}=To(),[c,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 N(S){u({kind:S,combo:null,conflict:null,saving:!1,error:null})}function w(S){if(!c||S.key==="Escape")return;if(S.key==="Enter"&&c.combo){S.preventDefault(),v();return}if(S.key==="Enter")return;S.preventDefault(),S.stopPropagation();const T=C1(S.nativeEvent);if(!T)return;const P=s(T,c.kind);u({...c,combo:T,conflict:P,error:null})}async function v(){var S;if(c!=null&&c.combo){if((S=c.conflict)!=null&&S.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await o(c.kind,c.combo),u(null),b("success",`Bound ${Bl[c.kind]}`)}catch(T){u({...c,saving:!1,error:T instanceof Error?T.message:"Failed to save"})}}}async function k(S){try{await i(S),b("success",`Cleared ${Bl[S]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await P4(),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(Us,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[d?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${d.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:d.message}):null,r.jsx("ul",{className:"space-y-2",children:_f.map(S=>{var L,M;const T=n.find(F=>F.bindableKind===S),P=e[S],R=typeof t[S]=="string"&&!!t[S],A=(c==null?void 0:c.kind)===S;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(bg,{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)??Bl[S]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),P?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:ks(P)}),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:()=>N(S),children:P?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(S),"aria-label":`Restore default ${Bl[S]} binding`,children:[r.jsx($f,{className:"h-3 w-3"}),"Restore default"]}):null]}),A?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:()=>{(c==null?void 0:c.kind)===S&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:ks(c.combo)}),(L=c.conflict)!=null&&L.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(M=c.conflict)!=null&&M.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',Bl[c.conflict.kind],'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),c.error?r.jsx("div",{className:"text-xs text-destructive",children:c.error}):null]}):r.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},S)})})]})}const r9={kanban:"Kanban",list:"List",table:"Table"},s9={comfortable:"Comfortable",compact:"Compact"},o9={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},a9={asc:"Ascending",desc:"Descending"};function i9(){const e=mU(),t=e.global,[n,s]=f.useState(!1),[o,i]=f.useState(null);function c(m,h){i({type:m,message:h}),setTimeout(()=>i(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await zE({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function d(){if(e.custom){s(!0);try{await hU(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(We,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:d,disabled:n,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:ty.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:r9[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:nO.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:s9[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:mN.map(m=>r.jsx("option",{value:m,children:o9[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:tO.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:a9[m]},m))})]})]})]})}function l9({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:o,className:i,wrapperClassName:c,singleLine:u,"aria-label":d}){const[m,h]=f.useState(0),[g,y]=f.useState(0),[b,N]=f.useState(!1),w=f.useRef(null),v=s2(e,m),k=v?o2(v.partial,n):[],E=!b&&k.length>0,S=Math.min(g,Math.max(0,k.length-1)),T=M=>u?M.replace(/[\r\n]+/g," "):M;function P(M){t(T(M.target.value)),h(M.target.selectionStart??M.target.value.length),y(0),N(!1)}function R(M){h(M.currentTarget.selectionStart??e.length)}function A(M){if(!v||!M)return;const F=a2(e,v,M);t(T(F.text)),h(F.caret),y(0),N(!0),requestAnimationFrame(()=>{const D=w.current;D&&(D.focus(),D.setSelectionRange(F.caret,F.caret))})}function L(M){E&&(M.key==="ArrowDown"?(M.preventDefault(),y(F=>Math.min(F+1,k.length-1))):M.key==="ArrowUp"?(M.preventDefault(),y(F=>Math.max(F-1,0))):M.key==="Enter"||M.key==="Tab"?(M.preventDefault(),A(k[S])):M.key==="Escape"&&(M.preventDefault(),N(!0)))}return r.jsxs("div",{className:be("relative",c),children:[r.jsx("textarea",{ref:w,value:e,rows:s,placeholder:o,"aria-label":d,onChange:P,onKeyDown:L,onKeyUp:R,onClick:R,className:i}),E&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:k.map((M,F)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":F===S,onMouseDown:D=>{D.preventDefault(),A(M)},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:M})]})},M))})]})}const c9={first:"first",last:"last",none:"none"};function y2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Yl(e){return e.map(t=>({rowKey:y2(),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 u9(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 d9(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 f9(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 p9(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function m9(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 h9({row:e,index:t,canRemove:n,playbooks:s,onPatch:o,onSetDefault:i,onRemove:c}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=ep({id:e.rowKey}),N={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function w(T){const P={label:T};if(e.autoSlugFromLabel){const R=wr(T);R&&$U.test(R)?P.id=R:P.id=`agent-${t+1}`}o(P)}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(()=>i2(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:N,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(Bi,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:T=>v(T.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:c,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(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:ZE.map(T=>r.jsx("option",{value:T,children:c9[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(l9,{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 g9(){const e=n2(),t=Rx(),n=f.useMemo(()=>{var L;return(((L=t.data)==null?void 0:L.playbooks)??[]).filter(M=>M.enabled).map(M=>({slug:M.slug,name:M.name}))},[t.data]),[s,o]=f.useState(()=>Yl(e.agents)),[i,c]=f.useState(()=>Yl(e.agents)),[u,d]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const L=Yl(e.agents);o(L),c(L),h(null)},[e.agents]);const b=f.useMemo(()=>!m9(s,i),[s,i]),N=qf(ko(Yi,{activationConstraint:{distance:8}}),ko(Gi));function w(L,M){y({type:L,message:M}),setTimeout(()=>y(null),2500)}function v(L,M){o(F=>F.map(D=>D.rowKey===L?{...D,...M,fieldErrors:x9(D.fieldErrors,M)}:D))}function k(L){o(M=>M.map(F=>({...F,default:F.rowKey===L})))}function E(){o(L=>{const M=new Set(L.map(z=>z.id)),F="new-agent";let D=F,V=1;for(;M.has(D);)V+=1,D=`${F}-${V}`;const Y=V===1?"New Agent":`New Agent ${V}`,_={rowKey:y2(),id:D,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:Y,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...L,_]})}function S(L){o(M=>M.filter(F=>F.rowKey!==L))}async function T(){d(!0),h(null);try{const L=d9(s),M=u9(L),F=await OU(M),D=Yl(F.agents);o(D),c(D),w("success","Agents saved")}catch(L){if(L instanceof e2)h(L.message),o(M=>f9(p9(M),L.fieldErrors)),w("error",L.message);else{const M=L instanceof Error?L.message:"Failed to save";h(M),w("error",M)}}finally{d(!1)}}function P(){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 L=await _U(),M=Yl(L.agents);o(M),c(M),w("success","Reset to defaults")}catch(L){const M=L instanceof Error?L.message:"Failed to reset";h(M),w("error",M)}finally{d(!1)}}}function A(L){const{active:M,over:F}=L;!F||M.id===F.id||o(D=>{const V=D.findIndex(_=>_.rowKey===M.id),Y=D.findIndex(_=>_.rowKey===F.id);return V===-1||Y===-1?D:Ji(D,V,Y)})}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(Us,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&r.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/60 bg-foreground/[0.02] px-3 py-2 text-xs text-muted-foreground",children:[r.jsx(vx,{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(Xf,{sensors:N,collisionDetection:Gf,onDragEnd:A,children:r.jsx(Zf,{items:s.map(L=>L.rowKey),strategy:ey,children:r.jsx("div",{className:"space-y-2",children:s.map((L,M)=>r.jsx(h9,{row:L,index:M,canRemove:s.length>1,playbooks:n,onPatch:F=>v(L.rowKey,F),onSetDefault:()=>k(L.rowKey),onRemove:()=>S(L.rowKey)},L.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(Ct,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:P,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(Df,{className:"h-3 w-3"}),"Save"]})]})]})]})}function x9(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 b2=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],jf={terminal:"terminal-app",custom:!1};let gi=null,di=null,kf=0;const ix=new Set;function v2(e){gi=e;for(const t of ix)t(e)}function Xy(e){if(!e||typeof e!="object")return jf;const t=e;return{terminal:typeof t.terminal=="string"&&b2.includes(t.terminal)?t.terminal:jf.terminal,custom:t.custom===!0}}function y9(){if(gi)return Promise.resolve(gi);if(di)return di;const e=++kf;return di=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{di=null;const n=Xy(t);return e!==kf?gi??n:(gi=n,n)}).catch(()=>(di=null,jf)),di}function b9(){const[e,t]=f.useState(()=>gi??jf);return f.useEffect(()=>{let n=!1;return y9().then(s=>{n||t(s)}),ix.add(t),()=>{n=!0,ix.delete(t)}},[]),e}async function v9(e){++kf;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=Xy(await t.json());return v2(n),n}async function w9(){++kf;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=Xy(await e.json());return v2(t),t}const Nd={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function j9(){const{terminal:e,custom:t}=b9(),[n,s]=f.useState(!1),[o,i]=f.useState(null);function c(m){i(m),setTimeout(()=>i(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await v9(m),c({type:"success",message:`Terminal set to ${Nd[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function d(){s(!0);try{const m=await w9();c({type:"success",message:`Reset to OS default (${Nd[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(We,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${Nd[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:n,type:"button",children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[o&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${o.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:o.message}),r.jsxs("label",{className:"block text-sm",children:[r.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),r.jsx("select",{value:e,onChange:m=>u(m.target.value),disabled:n,className:"w-full max-w-sm rounded-md border border-border/60 bg-background px-3 py-1.5 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:b2.map(m=>r.jsx("option",{value:m,children:Nd[m]},m))})]})]})}function Jl(e){return e===Zd?"Ungrouped":e}function k9(){const{data:e,loading:t,error:n,refetch:s}=ma(),{hidden:o,custom:i,loading:c,error:u,reload:d}=wS(),[m,h]=f.useState(!1),[g,y]=f.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const N=e?[...e.workspaces,...e.hasUngrouped?[Zd]:[]]:[];async function w(k,E){const S=E?o.filter(T=>T!==k):[...o,k];h(!0);try{await B4(S),b({type:"success",message:E?`Showing "${Jl(k)}" in the left nav.`:`Hiding "${Jl(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 U4(),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(Us,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[g&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${g.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:g.message}),t||c?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||u?r.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[r.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&s(),u&&d()},children:[r.jsx(Us,{className:"h-3 w-3"}),"Retry"]})]}):N.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:N.map(k=>{const E=!M4(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:Jl(k),children:[Jl(k),k===Zd&&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 "${Jl(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 S9(){const{preset:e,setPreset:t,resetPreset:n}=Ex(),[s,o]=f.useState(!1),[i,c]=f.useState(null);async function u(m){if(!(m===e||s)){o(!0),c(null);try{await t(m),c({type:"success",message:"Theme updated"}),setTimeout(()=>c(null),2e3)}catch(h){c({type:"error",message:h instanceof Error?h.message:"Failed to save theme"})}finally{o(!1)}}}async function d(){o(!0),c(null);try{await n(),c({type:"success",message:"Theme reset to default"}),setTimeout(()=>c(null),2e3)}catch(m){c({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(Us,{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:u1.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(Rr,{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(n9,{}),r.jsx(j9,{}),r.jsx(k9,{}),r.jsx(g9,{}),r.jsx(i9,{}),r.jsx(t9,{})]})}function N9({open:e,affected:t,remaining:n,ruleReferences:s,headlineReferences:o,onResolve:i,onCancel:c}){var P,R;const[u,d]=f.useState(n.length>0?"remap":"delete"),[m,h]=f.useState(((P=n[0])==null?void 0:P.id)??""),[g,y]=f.useState(((R=n[0])==null?void 0:R.id)??""),[b,N]=f.useState(!1),w=t.count>0;f.useEffect(()=>{var A,L;e&&(d(n.length>0?"remap":"delete"),h(((A=n[0])==null?void 0:A.id)??""),y(((L=n[0])==null?void 0:L.id)??""),N(!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($n,{open:e,onOpenChange:A=>A?void 0:c(),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsxs(Tn,{children:['Delete status "',t.label,'"',w?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),r.jsx(Vr,{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(A=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:A.display})},`${A.projectSlug??"standalone"}/${A.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((A,L)=>r.jsxs("li",{children:[r.jsx("span",{className:"text-foreground",children:A.section}),r.jsx("span",{className:"mx-1",children:"·"}),A.detail]},L))}),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:A=>h(A.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(A=>r.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.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:A=>y(A.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(A=>r.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.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:A=>N(A.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:c,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:E,disabled:!k,className:`shell-action ${u==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:u==="remap"?w?`Remap ${t.count} → ${m||"..."}`:`Remap rules → ${m||"..."}`:w?`Delete ${t.count}`:"Drop rules"})]})]})})}function C9({open:e,references:t,onConfirm:n,onCancel:s}){return r.jsx($n,{open:e,onOpenChange:o=>o?void 0:s(),children:r.jsxs(En,{className:"max-w-xl",children:[r.jsxs(Zn,{children:[r.jsx(Tn,{children:"Delete fact — referenced by derive rules"}),r.jsx(Vr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:o.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:o.when})]},i))})}),r.jsxs(Ar,{children:[r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action bg-error text-error-foreground hover:opacity-90",children:"Confirm delete — rules will become invalid"})]})]})})}function E9({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 T9({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:o,listeners:i,setNodeRef:c,setActivatorNodeRef:u,transform:d,transition:m,isDragging:h}=ep({id:e.rowKey}),g={transform:rs.Transform.toString(d),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0};return r.jsxs("div",{ref:c,style:g,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${h?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:u,...o,...i,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:r.jsx(Bi,{className:"h-4 w-4"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:t?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("input",{type:"text",value:e.id,readOnly:!0,"aria-label":"Status ID",className:"editor-input w-full text-sm cursor-not-allowed opacity-60"})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[10rem] flex-1",children:r.jsx("input",{type:"text",value:e.description,onChange:y=>n("description",y.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),r.jsx(E9,{value:e.color,onChange:y=>n("color",y),ariaLabel:`Color for ${e.label||e.id}`}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),r.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})}function R9({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:s,onRemove:o,onReorder:i}){const c=qf(ko(Yi,{activationConstraint:{distance:8}}),ko(Gi,{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(Ji(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(Ct,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(Xf,{sensors:c,collisionDetection:Gf,onDragEnd:u,children:r.jsx(Zf,{items:e.map(d=>d.rowKey),strategy:ey,children:r.jsx("div",{className:"space-y-2",children:e.map((d,m)=>r.jsx(T9,{row:d,isSaved:t.has(d.id),onUpdate:(h,g)=>n(m,h,g),onRemove:()=>o(m)},d.rowKey))})})})})}function A9(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 P9(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 D9(e,t){return t.headline.parked===e||t.headline.blocked===e}function $9(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 L9(e,t,n){return e.map(s=>({...s,from:s.from===t?n:s.from,to:s.to===t?n:s.to}))}function I9(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 O9(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function _9(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 lk(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 w2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function M9(e){const t=e.statuses.map(n=>({rowKey:w2(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return _9(t,e.order)}function F9(e){return Bg(e)}function ck(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function z9(e){const t=new Map;for(let n=0;n<e.length;n++){const s=ck(Bg(e.slice(0,n))),o=ck(Bg(e.slice(0,n+1)));for(const[i,c]of o.entries()){const u=s.get(i)??0;if(c>u){t.set(n,i);break}}}return t}const B9=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],U9=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function W9(){return{name:"",type:"bool",binds:null}}function V9({rows:e,onChange:t,saving:n}){const s=z9(e),o=f.useCallback(()=>{t([...e,W9()])},[e,t]),i=f.useCallback((u,d,m)=>{t(e.map((h,g)=>g===u?{...h,[d]:m}:h))},[e,t]),c=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,N)=>N===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:B9.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:U9.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}):r.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),m&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:r.jsx(Gd,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),r.jsx(ur,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:m})]}),r.jsx("button",{type:"button",onClick:()=>c(d),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:r.jsx(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(Ct,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function j2(e,t=lp){var s,o;if(e==="*")return null;const n=Ff(e);if(!n.ast)return((s=n.errors[0])==null?void 0:s.message)??"unparseable condition";try{return nc(n.ast,t),null}catch(i){if(i instanceof kr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function pg(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 H9(e){if(e.kind==="atom"){const t=pg(e);return t?{outerJoin:"AND",groups:[{join:"AND",comparisons:[t]}]}:null}if(e.kind==="and"||e.kind==="or"){const t=e.kind==="and"?"AND":"OR",n=e.kind==="and"?"or":"and",s=e.kind==="and"?"OR":"AND",o=[];for(const i of e.children)if(i.kind==="atom"){const c=pg(i);if(!c)return null;o.push({join:s,comparisons:[c]})}else if(i.kind===n){const c=[];for(const u of i.children){if(u.kind!=="atom")return null;const d=pg(u);if(!d)return null;c.push(d)}o.push({join:s,comparisons:c})}else return null;return{outerJoin:t,groups:o}}return null}function uk(e){const t=e.trim();if(t===""||t==="*")return null;const n=Ff(t);return n.ast?H9(n.ast):null}const K9=/^[A-Za-z_][A-Za-z0-9_-]*$/;function q9(e){return e===""||!K9.test(e)||/^(and|or|not)$/i.test(e)}function G9(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Y9(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:q9(e.value)?G9(e.value):e.value}function J9(e){const t=Y9(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function Q9(e){return e.groups.map(n=>{const s=n.comparisons.map(J9).join(` ${n.join} `);return n.comparisons.length>1?`(${s})`:s}).join(` ${e.outerJoin} `)}function X9(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":j2(e,t)}function Z9(e){return R_(T_(e))}function eW(e){const t=gy(e),n=[];for(const s of dC(e)){const o=t[s.toLowerCase()];o&&n.push({name:s,kind:o.kind})}return n}function k2(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function lx(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function Ql(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:lx(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:k2(t.kind)}:{field:"",op:":",value:""}]}]}}function S2({value:e,onChange:t,fieldOptions:n,registry:s,disabled:o}){const i=f.useMemo(()=>uk(e),[e]),c=e.trim()===""||i!==null,[u,d]=f.useState(c?"builder":"raw"),[m,h]=f.useState(()=>i??Ql(n)),g=f.useRef(e);f.useEffect(()=>{if(e===g.current)return;const R=uk(e);R&&h(R),!(e.trim()===""||R)&&u==="builder"&&d("raw"),g.current=e},[e]);const y=X9(e,s);function b(R){g.current=R,t(R)}function N(R){h(R),b(Q9(R))}function w(R){N({outerJoin:R,groups:m.groups.map(A=>({...A,join:R==="AND"?"OR":"AND"}))})}function v(R,A,L){const M=m.groups.map((F,D)=>D===R?{...F,comparisons:F.comparisons.map((V,Y)=>Y===A?{...V,...L}:V)}:F);N({...m,groups:M})}function k(R){const A=Ql(n).groups[0].comparisons[0],L=m.groups.map((M,F)=>F===R?{...M,comparisons:[...M.comparisons,{...A}]}:M);N({...m,groups:L})}function E(R,A){let L=m.groups.map((M,F)=>F===R?{...M,comparisons:M.comparisons.filter((D,V)=>V!==A)}:M);L=L.filter(M=>M.comparisons.length>0),L.length===0&&(L=Ql(n).groups),N({...m,groups:L})}function S(){const R=m.outerJoin==="AND"?"OR":"AND";N({...m,groups:[...m.groups,{join:R,comparisons:[Ql(n).groups[0].comparisons[0]]}]})}function T(){if(u==="builder"){d("raw");return}c&&(h(i??Ql(n)),d("builder"))}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";return r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),r.jsxs("button",{type:"button",onClick:T,disabled:o||u==="raw"&&!c,title:u==="raw"&&!c?"Condition too complex for the builder — edit as raw AQL":u==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[u==="builder"?r.jsx(cP,{className:"h-3 w-3"}):r.jsx(kP,{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:`${P} w-full font-mono`}):r.jsxs("div",{className:"space-y-2",children:[m.groups.map((R,A)=>r.jsxs("div",{children:[A>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,M)=>{const F=n.find(Y=>Y.name===L.field),D=(F==null?void 0:F.kind)??"string",V=lx(D);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[M>0&&r.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:R.join}),r.jsxs("select",{value:L.field,onChange:Y=>{const _=n.find(q=>q.name===Y.target.value),z=(_==null?void 0:_.kind)??"string",H=lx(z);v(A,M,{field:Y.target.value,op:H.includes(L.op)?L.op:H[0],value:z==="bool"?"true":L.value,valueType:k2(z)})},disabled:o,className:`${P} font-mono`,children:[n.length===0&&r.jsx("option",{value:"",children:"(no fields)"}),!n.some(Y=>Y.name===L.field)&&L.field!==""&&r.jsx("option",{value:L.field,children:L.field}),n.map(Y=>r.jsx("option",{value:Y.name,children:Y.name},Y.name))]}),r.jsx("select",{value:L.op,onChange:Y=>v(A,M,{op:Y.target.value}),disabled:o,className:`${P} font-mono`,children:V.map(Y=>r.jsx("option",{value:Y,children:Y},Y))}),D==="bool"?r.jsxs("select",{value:L.value||"true",onChange:Y=>v(A,M,{value:Y.target.value}),disabled:o,className:`${P} font-mono`,children:[r.jsx("option",{value:"true",children:"true"}),r.jsx("option",{value:"false",children:"false"})]}):r.jsx("input",{type:"text",value:L.value,onChange:Y=>v(A,M,{value:Y.target.value}),disabled:o,placeholder:"value",className:`${P} w-24 font-mono`}),r.jsx("button",{type:"button",onClick:()=>E(A,M),disabled:o,className:"ml-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove condition",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]},M)}),r.jsxs("button",{type:"button",onClick:()=>k(A),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Ct,{className:"h-3 w-3"}),R.join," condition"]})]})]},A)),r.jsxs("button",{type:"button",onClick:S,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Ct,{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 dk=0;function Sf(){return dk+=1,`dr_${dk}_${Math.random().toString(36).slice(2,8)}`}function mg(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:Sf(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Sf(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function cx(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 tW(e){return e.findIndex(t=>t.when.trim()==="*")}function N2(e,t,n){return N_(e,{statuses:t},s=>j2(s,n))}const fk=["active","blocked","parked"];function nW({value:e,deriveCustom:t,statuses:n,acceptedFacts:s,onChange:o,onReset:i,disabled:c}){const u=f.useMemo(()=>gy(s),[s]),d=f.useMemo(()=>eW(s),[s]),m=qf(ko(Yi,{activationConstraint:{distance:8}}),ko(Gi,{coordinateGetter:fN})),h=f.useMemo(()=>{try{return N2(cx(e),n,u)}catch{return["derive rules are malformed"]}},[e,n,u]),g=tW(e.phaseLadder),y=g>=0?e.phaseLadder[g]:null,b=e.phaseLadder.filter((M,F)=>F!==g);function N(M,F){o({...e,phaseLadder:[...M?[M]:[],...F]})}function w(M,F){const D=e.phaseLadder.map(V=>V.rowKey===M?{...V,...F}:V);o({...e,phaseLadder:D})}function v(){var F;const M={rowKey:Sf(),phase:((F=n[0])==null?void 0:F.id)??"",when:"",next:""};N(y,[...b,M])}function k(M){o({...e,phaseLadder:e.phaseLadder.filter(F=>F.rowKey!==M)})}function E(M){const{active:F,over:D}=M;if(!D||F.id===D.id)return;const V=b.findIndex(_=>_.rowKey===F.id),Y=b.findIndex(_=>_.rowKey===D.id);V===-1||Y===-1||N(y,Ji(b,V,Y))}function S(M,F){o({...e,disposition:e.disposition.map(D=>D.rowKey===M?{...D,...F}:D)})}function T(){const M={rowKey:Sf(),when:"",is:"active"},F=e.disposition.findIndex(V=>V.when===null),D=[...e.disposition];F>=0?D.splice(F,0,M):D.push(M),o({...e,disposition:D})}function P(M){o({...e,disposition:e.disposition.filter(F=>F.rowKey!==M)})}function R(M,F){o({...e,headline:{...e.headline,[M]:F}})}const A="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function L(M,F,D){return r.jsxs("select",{value:M,onChange:V=>F(V.target.value),disabled:c,"aria-label":D,className:`${A} font-mono`,children:[!n.some(V=>V.id===M)&&M!==""&&r.jsx("option",{value:M,children:M}),n.map(V=>r.jsxs("option",{value:V.id,children:[V.label," (",V.id,")"]},V.id))]})}return r.jsxs(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:c,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to default rules"]}):void 0,children:[!t&&r.jsx("div",{className:"mb-3 rounded-md border border-border/60 bg-muted/30 px-3 py-1.5 text-xs text-muted-foreground",children:"Using built-in derive rules. Editing anything below switches to a custom configuration."}),h.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These derive rules won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:h.map((M,F)=>r.jsx("li",{children:M},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(Bi,{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)"}),L(y.phase,M=>w(y.rowKey,{phase:M}),"Catch-all phase"),r.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"matches everything"})]}),r.jsxs("div",{className:"min-w-[12rem] flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:y.next,onChange:M=>w(y.rowKey,{next:M.target.value}),disabled:c,className:`${A} w-full`})]})]}),r.jsx(Xf,{sensors:m,collisionDetection:Gf,onDragEnd:E,children:r.jsx(Zf,{items:b.map(M=>M.rowKey),strategy:ey,children:r.jsx("div",{className:"space-y-2",children:b.map(M=>r.jsx(rW,{rung:M,disabled:c,statusSelect:L,fieldOptions:d,registry:u,onUpdate:F=>w(M.rowKey,F),onRemove:()=>k(M.rowKey)},M.rowKey))})})}),r.jsxs("button",{type:"button",onClick:v,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Ct,{className:"h-3 w-3"}),"Add rung"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),r.jsx("div",{className:"space-y-2",children:e.disposition.map(M=>M.when===null?r.jsxs("div",{className:"surface-panel flex items-center gap-3 px-3 py-2",children:[r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"otherwise"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:M.is,onChange:F=>S(M.rowKey,{is:F.target.value}),disabled:c,className:`${A} font-mono`,children:fk.map(F=>r.jsx("option",{value:F,children:F},F))})]},M.rowKey):r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2",children:[r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(S2,{value:M.when,onChange:F=>S(M.rowKey,{when:F}),fieldOptions:d,registry:u,disabled:c})}),r.jsxs("div",{className:"flex items-center gap-2 pt-5",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),r.jsx("select",{value:M.is,onChange:F=>S(M.rowKey,{is:F.target.value}),disabled:c,className:`${A} font-mono`,children:fk.map(F=>r.jsx("option",{value:F,children:F},F))}),r.jsx("button",{type:"button",onClick:()=>P(M.rowKey),disabled:c,className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove disposition rule",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})]},M.rowKey))}),r.jsxs("button",{type:"button",onClick:T,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Ct,{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"}),L(e.headline.parked,M=>R("parked",M),"Parked headline status")]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),L(e.headline.blocked,M=>R("blocked",M),"Blocked headline status")]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Terminal statuses: ",r.jsx("span",{className:"font-mono",children:"passthrough"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:["Active: ",r.jsx("span",{className:"font-mono",children:"phase"})]})]})]})]})}function rW({rung:e,disabled:t,statusSelect:n,fieldOptions:s,registry:o,onUpdate:i,onRemove:c}){const{attributes:u,listeners:d,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=ep({id:e.rowKey}),N={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};return r.jsxs("div",{ref:m,style:N,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(Bi,{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(S2,{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:c,disabled:t,className:"mt-5 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove rung",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]})}const sW=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 C2(){return pk+=1,`tr_${pk}_${Math.random().toString(36).slice(2,8)}`}function oW(e){return{rowKey:C2(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function mk(e){return e.map(oW)}function aW(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 iW(e){return e.map(aW)}function E2(){const e=[];for(const[t,n]of sW){const s=t.indexOf(":");e.push({from:t.slice(0,s),command:t.slice(s+1),to:n})}return e}function T2(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function hk(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 R2(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 lW({value:e,customizing:t,statuses:n,knownCommands:s,onChange:o,onCustomize:i,disabled:c}){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=T2(E2(),u),T=hk(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:c,className:"shell-action text-xs",children:"Customize defaults"}),children:T.length===0?r.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No built-in transitions apply to the current statuses."}):r.jsx("div",{className:"space-y-3",children:T.map(P=>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(P.from)}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:P.rows.map((R,A)=>r.jsxs("li",{children:[R.command," → ",d(R.to)," ",r.jsxs("span",{className:"opacity-60",children:["(",R.to,")"]})]},A))})]},P.from))})})}const y=R2(e,u),b=hk(e),N=n.filter(S=>!b.some(T=>T.from===S.id));function w(S,T){o(e.map(P=>P.rowKey===S?{...P,...T}:P))}function v(S){o(e.filter(T=>T.rowKey!==S))}function k(S){var P;const T={rowKey:C2(),from:S,command:s[0]??"",to:((P=n[0])==null?void 0:P.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:P=>w(T.rowKey,{command:P.target.value}),disabled:c,placeholder:"command",className:`${g} w-28 font-mono`}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsxs("select",{value:T.to,onChange:P=>w(T.rowKey,{to:P.target.value}),disabled:c,"aria-label":"Target status",className:`${g} font-mono`,children:[!u.has(T.to)&&T.to!==""&&r.jsx("option",{value:T.to,children:T.to}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),r.jsx("input",{type:"text",value:T.label,onChange:P=>w(T.rowKey,{label:P.target.value}),disabled:c,placeholder:"label (optional)",className:`${g} w-32`}),r.jsx("input",{type:"text",value:T.description,onChange:P=>w(T.rowKey,{description:P.target.value}),disabled:c,placeholder:"description (optional)",className:`${g} w-40`}),r.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx("button",{type:"button",role:"switch","aria-checked":T.requiresReason,"aria-label":"Requires reason",onClick:()=>w(T.rowKey,{requiresReason:!T.requiresReason}),disabled:c,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${T.requiresReason?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${T.requiresReason?"translate-x-4":"translate-x-0"}`})}),"needs reason"]}),r.jsx("button",{type:"button",onClick:()=>v(T.rowKey),disabled:c,className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove transition",children:r.jsx(yn,{className:"h-3.5 w-3.5"})})]},T.rowKey))}),r.jsxs("button",{type:"button",onClick:()=>k(S.from),disabled:c,className:"mt-2 shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Ct,{className:"h-3 w-3"}),"Add transition"]})]},S.from))}),N.length>0&&r.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r.jsxs("select",{value:m,onChange:S=>h(S.target.value),disabled:c,"aria-label":"Add rules for status",className:`${g} font-mono`,children:[r.jsx("option",{value:"",children:"Add rules for status…"}),N.map(S=>r.jsxs("option",{value:S.id,children:[S.label," (",S.id,")"]},S.id))]}),r.jsxs("button",{type:"button",onClick:E,disabled:c||!m,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Ct,{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 cW(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 uW(){var Pe;const[e,t]=f.useState(!0),[n,s]=f.useState(null),[o,i]=f.useState(!1),[c,u]=f.useState([]),[d,m]=f.useState(!1),[h,g]=f.useState(null),[y,b]=f.useState(!1),[N,w]=f.useState(new Set),[v,k]=f.useState(new Map),[E,S]=f.useState({open:!1}),[T,P]=f.useState([]),[R,A]=f.useState([]),[L,M]=f.useState({open:!1}),[F,D]=f.useState(()=>mg(Md)),[V,Y]=f.useState(!1),[_,z]=f.useState(!1),[H,q]=f.useState(!1),[I,K]=f.useState([]),[$,W]=f.useState(!1),[ee,B]=f.useState([]),[ae,ue]=f.useState("statuses"),se=f.useCallback(ve=>{const te=M9(ve);u(te),i(ve.custom),w(new Set(te.map(fe=>fe.id))),k(new Map),P(ve.rawFacts??[]),A([]),D(mg(ve.derive??Md)),Y(ve.deriveCustom??!1),z(!1),q(!1),K(mk(ve.transitions??[])),W(ve.transitionsCustom??!1),B(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 te=await ve.json();se(te),s(null)}catch(ve){s(ve instanceof Error?ve.message:"Failed to load config")}finally{t(!1)}},[se]);f.useEffect(()=>{xe()},[xe]);function ke(){setTimeout(()=>g(null),3e3)}const Re=f.useMemo(()=>c.map(ve=>({id:ve.id,label:ve.label})),[c]),Ae=f.useMemo(()=>new Set(c.map(ve=>ve.id)),[c]),Qe=f.useMemo(()=>Z9(T),[T]),at=f.useMemo(()=>gy(Qe),[Qe]),Ze=f.useMemo(()=>F9(T),[T]),ot=f.useMemo(()=>{try{return N2(cx(F),c,at)}catch{return["derive rules are malformed"]}},[F,c,at]),Z=f.useMemo(()=>$?R2(I,Ae):[],[I,$,Ae]),_e=Ze.length+ot.length+Z.length,Ee=f.useCallback(ve=>{P(ve),b(!0)},[]),Ie=f.useCallback(ve=>{D(ve),z(!0),q(!1),Y(!0),b(!0)},[]),Ye=f.useCallback(()=>{D(mg(Md)),q(!0),z(!0),Y(!1),b(!0)},[]),Me=f.useCallback(ve=>{K(ve),b(!0)},[]),et=f.useCallback(()=>{K(ve=>ve.length>0?ve:mk(T2(E2(),Ae))),W(!0),b(!0)},[Ae]);async function Je(ve=R){m(!0),g(null);try{const{body:te}=A9({statuses:c,order:c.map(ce=>ce.id),pendingResolutions:v,facts:T,factRemovalAcks:ve,derive:H?null:_?cx(F):void 0,transitions:$?iW(I):void 0}),fe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)});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){M({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 Se=await fe.json();se(Se),Lj();const Ue=Se.applied?` (${Se.applied.remapped} remapped, ${Se.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${Ue}`}),ke()}catch(te){g({type:"error",message:te instanceof Error?te.message:"Save failed"})}finally{m(!1)}}async function $t(){m(!0),g(null);try{const ve=await fetch("/api/config/statuses",{method:"DELETE"});if(!ve.ok)throw new Error("Reset failed");const te=await ve.json();se(te),Lj(),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 vt(ve,te,fe){u(Se=>{const Ue=[...Se];return Ue[ve]={...Ue[ve],[te]:fe},Ue}),b(!0)}function ct(){const ve=`status_${c.length+1}`;u(te=>[...te,{rowKey:w2(),id:ve,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function le(ve){u(te=>{const fe=te.filter(Ue=>Ue.id!==ve),Se=new Set(fe.map(Ue=>Ue.id));return k(Ue=>lk(Ue,Se)),fe}),b(!0)}async function J(ve){const te=c[ve].id,fe=P9(te,F,I),Se=D9(te,F);if(!N.has(te)){if(fe.length===0){le(te);return}S({open:!0,affected:{id:te,count:0,truncated:!1,assignments:[]},pendingId:te,ruleReferences:fe,headlineReferences:Se});return}try{const Ue=await fetch(`/api/config/statuses/affected/${encodeURIComponent(te)}`);if(!Ue.ok)throw new Error(`HTTP ${Ue.status}`);const ce=await Ue.json();if(ce.count===0&&fe.length===0){le(te);return}S({open:!0,affected:ce,pendingId:te,ruleReferences:fe,headlineReferences:Se})}catch(Ue){g({type:"error",message:`Could not check affected assignments for "${te}": ${Ue instanceof Error?Ue.message:String(Ue)}`})}}function he(ve,te){if(!E.open)return;const{pendingId:fe,affected:Se,ruleReferences:Ue}=E;if(fe!==ve.id){S({open:!1});return}if(!c.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"?(D(ce=>$9(ce,fe,te)),K(ce=>L9(ce,fe,te))):(D(ce=>I9(ce,fe,te)),K(ce=>O9(ce,fe))),Ue.some(ce=>ce.section!=="transitions")&&(z(!0),Y(!0)),u(ce=>{const pt=ce.filter(St=>St.id!==fe),xt=new Set(pt.map(St=>St.id));return k(St=>{const st=lk(St,xt),me=new Map(st);return Se.count>0&&me.set(fe,ve),me}),pt}),b(!0),S({open:!1})}function re(){if(!L.open)return;const ve=L.references.map(fe=>fe.factName),te=Array.from(new Set([...R,...ve]));A(te),M({open:!1}),Je(te)}function ye(){S({open:!1})}return e?r.jsx(mt,{label:"Loading workflow..."}):n?r.jsx(kt,{error:n}):r.jsx(ca,{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(vx,{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:$t,disabled:d||!o&&!y,children:[r.jsx(Us,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(yp,{value:ae,onValueChange:ue,items:[{value:"statuses",label:"Statuses",content:r.jsx(R9,{statuses:c,savedStatusIds:N,onUpdate:vt,onAdd:ct,onRemove:J,onReorder:ve=>{u(ve),b(!0)}})},{value:"transitions",label:"Transitions",problemCount:Z.length,content:r.jsx(lW,{value:I,customizing:$,statuses:Re,knownCommands:ee,onChange:Me,onCustomize:et,disabled:d})},{value:"derive",label:"Derive Rules",problemCount:ot.length,content:r.jsx(nW,{value:F,deriveCustom:V,statuses:Re,acceptedFacts:Qe,onChange:Ie,onReset:Ye,disabled:d})},{value:"facts",label:"Facts",problemCount:Ze.length,content:r.jsx(V9,{rows:T,onChange:Ee,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 Je(),disabled:d||!y||_e>0,children:[r.jsx(Df,{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:cW({transitions:Z.length,derive:ot.length,facts:Ze.length}).message})]})]}),E.open&&r.jsx(N9,{open:E.open,affected:{...E.affected,label:((Pe=c.find(ve=>ve.id===E.affected.id))==null?void 0:Pe.label)??E.affected.id},remaining:c.filter(ve=>ve.id!==E.affected.id&&N.has(ve.id)).map(ve=>({id:ve.id,label:ve.label})),ruleReferences:E.ruleReferences,headlineReferences:E.headlineReferences,onResolve:he,onCancel:ye}),r.jsx(C9,{open:L.open,references:L.open?L.references:[],onConfirm:re,onCancel:()=>{M({open:!1}),m(!1)}})]})})}const Ms=e=>`${e.workspace}::${e.id}`;function gk(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function dW(){var ve;const{data:e,loading:t,error:n,refetch:s}=E1(),o=_t(),[i,c]=f.useState(""),u=f.useRef(null);Ro("list:todos");const[d,m]=f.useState(""),[h,g]=f.useState(""),[y,b]=f.useState(""),[N,w]=f.useState("_global"),[v,k]=f.useState(null),[E,S]=f.useState(null),[T,P]=f.useState(new Set),[R,A]=f.useState(!1),L=f.useRef(null),[M,F]=f.useState(null),D=By("all"),[V,Y]=f.useState(null),[_,z]=f.useState(null),H=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const fe=await fetch("/api/projects");if(!fe.ok)return;const Se=await fe.json();te||F(Se.filter(Ue=>!Ue.archived))}catch{}})(),()=>{te=!0}},[]);async function q(te,fe){te.stopPropagation(),await Kc(fe)&&(k(fe),setTimeout(()=>k(Se=>Se===fe?null:Se),1500))}const I=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const fe of e.workspaces)for(const Se of fe.items)te.push({...Se,workspace:fe.workspace});return te},[e]),K=f.useMemo(()=>{const te=new Set;for(const fe of I)for(const Se of fe.tags)te.add(Se);return Array.from(te).sort()},[I]),$=f.useMemo(()=>{let te=I;if(i.trim()){const fe=i.toLowerCase();te=te.filter(Se=>Se.description.toLowerCase().includes(fe)||Se.tags.some(Ue=>Ue.toLowerCase().includes(fe))||Se.id.includes(fe))}return d&&(te=te.filter(fe=>fe.status===d)),h&&(te=te.filter(fe=>fe.tags.includes(h))),te},[I,i,d,h]);f.useEffect(()=>{P(new Set),L.current=null},[i,d,h]);const W=f.useMemo(()=>$.filter(te=>T.has(Ms(te))),[$,T]),ee=$.length>0&&W.length===$.length,B=W.length>0&&!ee,ae=f.useMemo(()=>{if(W.length===0)return null;const te=new Set(W.map(fe=>fe.workspace));return te.size===1?[...te][0]:null},[W]),ue=f.useMemo(()=>{if(!ae||!M)return;const te=M.filter(fe=>fe.workspace===ae);return te.length===1?te[0].slug:void 0},[ae,M]),se=((ve=W[0])==null?void 0:ve.description)??"",xe=f.useMemo(()=>{if(ae)return null;const te=new Map;for(const fe of W)te.has(fe.workspace)||te.set(fe.workspace,[]),te.get(fe.workspace).push(fe.id);return Array.from(te,([fe,Se])=>({workspace:fe,todoIds:Se}))},[W,ae]),ke=ae?{kind:"workspace",workspace:ae}:{kind:"aggregate",groups:xe??[]};function Re(te,fe,Se){const Ue=Ms(te),ce=!!(Se&&"shiftKey"in Se&&Se.shiftKey),pt=L.current?et.findIndex(xt=>Ms(xt)===L.current):-1;if(ce&&pt!==-1){const xt=Math.min(pt,fe),St=Math.max(pt,fe);P(st=>{const me=new Set(st);for(let Oe=xt;Oe<=St;Oe++){const qe=et[Oe];qe&&me.add(Ms(qe))}return me})}else P(xt=>{const St=new Set(xt);return St.has(Ue)?St.delete(Ue):St.add(Ue),St});L.current=Ue}function Ae(){P(te=>{const fe=new Set(te);if(ee)for(const Se of $)fe.delete(Ms(Se));else for(const Se of $)fe.add(Ms(Se));return fe})}function Qe(){P(new Set),L.current=null}function at(te){Qe(),s(),te!=null&&te.assignmentRef&&o(gk(te.assignmentRef))}const Ze=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const te={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const fe of e.workspaces)te.open+=fe.counts.open,te.in_progress+=fe.counts.in_progress,te.completed+=fe.counts.completed,te.blocked+=fe.counts.blocked,te.total+=fe.counts.total;return te},[e]);async function ot(){y.trim()&&(await Ax(N,y.trim()),b(""),s())}async function Z(te,fe,Se){switch(Se){case"open":await P1(te,fe);break;case"in_progress":await A1(te,fe);break;case"completed":await T1(te,fe);break;case"blocked":await R1(te,fe);break}s()}async function _e(te,fe){await D1(te,fe),s()}async function Ee(te,fe,Se){await $1(te,fe,Se),s()}async function Ie(te,fe,Se){await L1(te,fe,Se),s()}async function Ye(te,fe,Se){await I1(te,fe,Se),s()}const Me=zy($),et=Me.filter(te=>!D.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Je}=Oc(et,{scope:"list:todos",bindO:!1,onOpen:te=>S(Ms(te))});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var te;return(te=u.current)==null?void 0:te.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[$t,vt]=ls(),ct=$t.get("focus");f.useEffect(()=>{if(!ct)return;const te=I.find(Se=>Se.id===ct);if(!te)return;const fe=jp(te.status);D.isCollapsed(fe)&&D.toggle(fe)},[ct,I]),f.useEffect(()=>{if(!ct)return;const te=document.querySelector(`[data-todo-id="${CSS.escape(ct)}"]`);if(!te)return;te.scrollIntoView({block:"nearest"}),te.classList.add("ring-2","ring-primary/60");const fe=window.setTimeout(()=>{te.classList.remove("ring-2","ring-primary/60"),vt(Se=>{const Ue=new URLSearchParams(Se);return Ue.delete("focus"),Ue})},1500);return()=>window.clearTimeout(fe)},[ct,et.length,vt]);const le=V?$.find(te=>Ms(te)===V)??null:null;function J(te,fe){const Se=H.current;if(Se!=null&&Se.closest(Oi)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",fe),Y(fe)}function he(){Y(null),z(null)}function re(te,fe){!le||fe.statuses.includes(le.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",z(fe.id))}function ye(te,fe){_===fe.id&&!te.currentTarget.contains(te.relatedTarget)&&z(null)}function Pe(te,fe){te.preventDefault();const Se=le;he(),!(!Se||fe.statuses.includes(Se.status))&&Z(Se.workspace,Se.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:zr}),r.jsx(_n,{label:"In Progress",value:Ze.in_progress,icon:wx,tone:"info"}),r.jsx(_n,{label:"Blocked",value:Ze.blocked,icon:Sx,tone:"warn"}),r.jsx(_n,{label:"Completed",value:Ze.completed,icon:zr,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:N,onChange:te=>w(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(te=>te.workspace!=="_global").map(te=>r.jsx("option",{value:te.workspace,children:te.workspace},te.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:te=>b(te.target.value),onKeyDown:te=>te.key==="Enter"&&ot(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ot,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Ct,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:i,onChange:te=>c(te.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:d,onChange:te=>m(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),K.length>0&&r.jsxs("select",{value:h,onChange:te=>g(te.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),K.map(te=>r.jsxs("option",{value:te,children:["#",te]},te))]})]}),W.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:[W.length," selected",ae?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:ae}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(W.map(te=>te.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>A(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:Qe,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:ee,ref:te=>{te&&(te.indeterminate=B)},onChange:Ae,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",$.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let te=-1;return Me.map(({config:fe,items:Se})=>{const Ue=!D.isCollapsed(fe.id);return r.jsx(Fy,{label:fe.label,count:Se.length,expanded:Ue,onToggle:()=>D.toggle(fe.id),isDropTarget:_===fe.id,onDragOver:ce=>re(ce,fe),onDragLeave:ce=>ye(ce,fe),onDrop:ce=>Pe(ce,fe),children:Ue&&Se.map(ce=>{te+=1;const pt=te,xt=Ms(ce),St=T.has(xt);return r.jsxs("div",{draggable:!0,"data-todo-id":ce.id,...Je(pt),onMouseDown:st=>{H.current=st.target},onDragStart:st=>J(st,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":""} ${V===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:st=>{st.stopPropagation(),Re(ce,pt,st)},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(EE,{status:ce.status,onChange:st=>Z(ce.workspace,ce.id,st)})}),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(RE,{description:ce.description,status:ce.status,editing:E===xt,onBeginEdit:()=>S(xt),onEndEdit:()=>S(null),onSave:st=>Ee(ce.workspace,ce.id,st)}),ce.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:ce.tags.map(st=>`#${st}`).join(" ")}),ce.linkedAssignmentRef?r.jsxs(Ce,{to:gk(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:st=>st.stopPropagation(),children:[r.jsx(Bk,{className:"h-2.5 w-2.5"}),ce.linkedAssignmentRef.includes("/")?ce.linkedAssignmentRef:`oneoff:${ce.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(AE,{item:ce,attachmentUrl:(st,me)=>Px(ce.workspace,st,me),onAdd:st=>Ie(ce.workspace,ce.id,st),onDelete:st=>Ye(ce.workspace,ce.id,st)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:ce.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${ce.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:st=>st.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(Rr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:st=>q(st,ce.id),children:["t:",ce.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:st=>q(st,ce.id),children:r.jsx(Yd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:st=>{st.stopPropagation(),_e(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(My,{open:R,selectedIds:W.map(te=>te.id),scope:ke,onOpenChange:A,onDone:at,defaultProject:ue,defaultTitle:se,allowOneOff:!0})]})}const fW={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 pW({bundle:e}){const t=fW[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 mW({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(pW,{bundle:n},n.id))]})}function hW(e){const[t,n]=f.useState(null),[s,o]=f.useState(!0),[i,c]=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()),c(null)}catch(d){c(d instanceof Error?d.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return f.useEffect(()=>{u()},[u]),Vi(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function gW(){const{workspace:e}=Mt(),t=e||"_global",{data:n,loading:s,error:o,refetch:i}=nD(t),{data:c}=hW(t),[u,d]=f.useState(""),[m,h]=f.useState(""),[g,y]=f.useState(""),[b,N]=f.useState(""),[w,v]=f.useState(null),[k,E]=f.useState(null),[S,T]=f.useState(new Set),[P,R]=f.useState(!1),[A,L]=f.useState(!1),[M,F]=f.useState(null),D=f.useRef(null);Ro("list:todos");const V=By("workspace:"+t),[Y,_]=f.useState(null),[z,H]=f.useState(null),q=f.useRef(null);async function I(re,ye){re.stopPropagation(),await Kc(ye)&&(v(ye),setTimeout(()=>v(Pe=>Pe===ye?null:Pe),1500))}const K=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const re=new Set;for(const ye of n.items)for(const Pe of ye.tags)re.add(Pe);return Array.from(re).sort()},[n]),$=f.useMemo(()=>{if(!(n!=null&&n.items))return[];let re=n.items;if(u.trim()){const ye=u.toLowerCase();re=re.filter(Pe=>Pe.description.toLowerCase().includes(ye)||Pe.tags.some(ve=>ve.toLowerCase().includes(ye))||Pe.id.includes(ye))}return m&&(re=re.filter(ye=>ye.status===m)),g&&(re=re.filter(ye=>ye.tags.includes(g))),re},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const W=f.useMemo(()=>$.filter(re=>S.has(re.id)).length,[$,S]),ee=$.length>0&&W===$.length,B=W>0&&!ee;function ae(re){T(ye=>{const Pe=new Set(ye);return Pe.has(re)?Pe.delete(re):Pe.add(re),Pe})}function ue(){T(re=>{const ye=new Set(re);if(ee)for(const Pe of $)ye.delete(Pe.id);else for(const Pe of $)ye.add(Pe.id);return ye})}function se(){T(new Set)}const xe=M?[M]:Array.from(S);function ke(){T(new Set),F(null),i()}function Re(){T(new Set),i()}async function Ae(){b.trim()&&(await Ax(t,b.trim()),N(""),i())}async function Qe(re,ye,Pe){re.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await D1(t,ye),i())}async function at(re,ye){switch(ye){case"open":await P1(t,re);break;case"in_progress":await A1(t,re);break;case"completed":await T1(t,re);break;case"blocked":await R1(t,re);break}i()}async function Ze(re,ye){await $1(t,re,ye),i()}async function ot(re,ye){await L1(t,re,ye),i()}async function Z(re,ye){await I1(t,re,ye),i()}const _e=zy($),Ee=_e.filter(re=>!V.isCollapsed(re.config.id)).flatMap(re=>re.items),{hotkeyRowProps:Ie}=Oc(Ee,{scope:"list:todos",bindO:!1,onOpen:re=>E(re.id)});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var re;return(re=D.current)==null?void 0:re.focus()}}),Kt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[Ye,Me]=ls(),et=Ye.get("focus");f.useEffect(()=>{if(!et||!(n!=null&&n.items))return;const re=n.items.find(Pe=>Pe.id===et);if(!re)return;const ye=jp(re.status);V.isCollapsed(ye)&&V.toggle(ye)},[et,n==null?void 0:n.items]),f.useEffect(()=>{if(!et)return;const re=document.querySelector(`[data-todo-id="${window.CSS.escape(et)}"]`);if(!re)return;re.scrollIntoView({block:"nearest"}),re.classList.add("ring-2","ring-primary/60");const ye=window.setTimeout(()=>{re.classList.remove("ring-2","ring-primary/60"),Me(Pe=>{const ve=new URLSearchParams(Pe);return ve.delete("focus"),ve})},1500);return()=>window.clearTimeout(ye)},[et,Ee.length,Me]);const Je=Y?(n==null?void 0:n.items.find(re=>re.id===Y))??null:null;function $t(re,ye){const Pe=q.current;if(Pe!=null&&Pe.closest(Oi)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",ye),_(ye)}function vt(){_(null),H(null)}function ct(re,ye){!Je||ye.statuses.includes(Je.status)||(re.preventDefault(),re.dataTransfer.dropEffect="move",H(ye.id))}function le(re,ye){z===ye.id&&!re.currentTarget.contains(re.relatedTarget)&&H(null)}function J(re,ye){re.preventDefault();const Pe=Je;vt(),!(!Pe||ye.statuses.includes(Pe.status))&&at(Pe.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:zr}),r.jsx(_n,{label:"In Progress",value:he.in_progress,icon:zr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:he.blocked,icon:Sx,tone:"warn"}),r.jsx(_n,{label:"Total",value:he.total,icon:zr})]}),c&&r.jsx(mW,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:re=>N(re.target.value),onKeyDown:re=>re.key==="Enter"&&Ae(),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:Ae,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(Ct,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Eo,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:D,type:"text",placeholder:"Search...",value:u,onChange:re=>d(re.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:re=>h(re.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"})]}),K.length>0&&r.jsxs("select",{value:g,onChange:re=>y(re.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"}),K.map(re=>r.jsxs("option",{value:re,children:["#",re]},re))]})]}),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),L(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:se,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,$.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:ee,ref:re=>{re&&(re.indeterminate=B)},onChange:ue,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 re=-1;return _e.map(({config:ye,items:Pe})=>{const ve=!V.isCollapsed(ye.id);return r.jsx(Fy,{label:ye.label,count:Pe.length,expanded:ve,onToggle:()=>V.toggle(ye.id),isDropTarget:z===ye.id,onDragOver:te=>ct(te,ye),onDragLeave:te=>le(te,ye),onDrop:te=>J(te,ye),children:ve&&Pe.map(te=>(re+=1,r.jsx(TE,{item:te,copiedId:w,selected:S.has(te.id),editing:k===te.id,onBeginEdit:fe=>E(fe),onEndEdit:()=>E(null),onPatchDescription:Ze,onAddAttachments:ot,onDeleteAttachment:Z,attachmentUrl:(fe,Se)=>Px(t,fe,Se),onToggleSelected:fe=>ae(fe),onMoveOne:(fe,Se)=>{Se.stopPropagation(),F(fe),L(!0)},onStatusChange:at,onCopyId:I,onDelete:Qe,hotkeyRowProps:Ie(re),onDragOrigin:fe=>{q.current=fe.target},onDragStart:$t,onDragEnd:vt,isDragging:Y===te.id},te.id)))},ye.id)})})()}),r.jsx(My,{open:P,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:Re}),r.jsx(DE,{open:A,selectedIds:xe,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{L(re),re||F(null)},onDone:ke})]})}function A2(){const{views:e}=Bc();async function t(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=gC(u,d.workspace).config,h=hf(d.config,m,d.config);await lf(i.id,{name:c,config:h})}async function n(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=xy(u,d.workspace).config,h=hf(d.config,m,d.config);await lf(i.id,{name:c,config:h})}async function s(i){await $i({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await PO(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:o}}const xk=80,xW={kanban:"Kanban",list:"List",table:"Table"},yW={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function P2({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:o}){const i=!!s,c=xa(),u=fp(),{data:d}=Cs(),{data:m}=If(),[h,g]=f.useState(""),[y,b]=f.useState(ri.viewMode),[N,w]=f.useState([]),[v,k]=f.useState([]),[E,S]=f.useState([]),[T,P]=f.useState([]),[R,A]=f.useState([]),[L,M]=f.useState([]),[F,D]=f.useState("all"),[V,Y]=f.useState(null),[_,z]=f.useState(""),[H,q]=f.useState(ri.sortField),[I,K]=f.useState(ri.sortDirection),[$,W]=f.useState(!1),[ee,B]=f.useState(null);function ae(){b(ri.viewMode),w([]),k([]),S([]),P([]),A([]),M([]),D("all"),Y(null),z(""),q(ri.sortField),K(ri.sortDirection)}f.useEffect(()=>{if(e)if(B(null),W(!1),s){const Z=s.config.filters;g(s.name),b(s.config.viewMode),w(Fe(Z.status)),k(Fe(Z.priority)),S(Fe(Z.type)),P(Fe(Z.project)),A(Fe(Z.assignee)),M(Fe(Z.tags)),D(Z.activity??"all"),Y(mp(Z.dateRange)),z(Z.search??""),q(s.config.sortField),K(s.config.sortDirection)}else g(""),ae()},[e,s]);const ue=Z=>_e=>Z?Z==="_ungrouped"?_e.projectWorkspace===null:_e.projectWorkspace===Z:!0,se=f.useMemo(()=>{const Z=Ee=>n?n==="_ungrouped"?Ee.workspace===null:Ee.workspace===n:!0,_e=(d??[]).filter(Z);return[{value:"__standalone__",label:"No project"},..._e.map(Ee=>({value:Ee.slug,label:Ee.title}))]},[d,n]),xe=f.useMemo(()=>{const Z=new Set,_e=ue(n);for(const Ie of(m==null?void 0:m.assignments)??[])_e(Ie)&&Ie.assignee&&Z.add(Ie.assignee);const Ee=[{value:"__unassigned__",label:"Unassigned"}];for(const Ie of Array.from(Z).sort())Ee.push({value:Ie,label:Ie});return Ee},[m,n]),ke=f.useMemo(()=>{const Z=new Set,_e=ue(n);for(const Ee of(m==null?void 0:m.assignments)??[])if(_e(Ee))for(const Ie of Ee.tags??[])Z.add(Ie);return Array.from(Z).sort().map(Ee=>({value:Ee,label:Ee}))},[m,n]),Re=f.useMemo(()=>c.order.map(Z=>({value:Z,label:Vc(c,Z)})),[c]),Ae=f.useMemo(()=>iM.map(Z=>({value:Z,label:Z[0].toUpperCase()+Z.slice(1)})),[]),Qe=f.useMemo(()=>u.definitions.map(Z=>({value:Z.id,label:Ci(u,Z.id)})),[u]),at=ty.map(Z=>({value:Z,label:xW[Z]})),Ze=h.trim(),ot=Ze.length>0&&Ze.length<=xk;return r.jsx($n,{open:e,onOpenChange:t,children:r.jsx(En,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async Z=>{if(Z.preventDefault(),!ot||$)return;W(!0),B(null);const _e={viewMode:y,filters:{status:N,priority:v,type:E,project:T,assignee:R,tags:L,activity:F,dateRange:ua(V),search:_},sortField:H,sortDirection:I};try{await o(Ze,_e)}catch(Ee){B(Ee instanceof Error?Ee.message:String(Ee)),W(!1)}},children:[r.jsx(Zn,{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:xk,onChange:Z=>g(Z.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(gp,{value:y,onChange:Z=>b(Z),options:at})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(xs,{label:"Status",children:r.jsx(xn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:Re,value:N,onChange:w})}),r.jsx(xs,{label:"Priority",children:r.jsx(xn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:Ae,value:v,onChange:k})}),r.jsx(xs,{label:"Type",children:r.jsx(xn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Qe,value:E,onChange:S})}),r.jsx(xs,{label:"Project",children:r.jsx(xn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:se,value:T,onChange:P})}),r.jsx(xs,{label:"Assignee",children:r.jsx(xn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:xe,value:R,onChange:A})}),r.jsx(xs,{label:"Tags",children:r.jsx(xn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:ke,value:L,onChange:M})}),r.jsx(xs,{label:"Activity",children:r.jsxs("select",{value:F,onChange:Z=>D(Z.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]})}),r.jsx(xs,{label:"Date range",children:r.jsx(pp,{className:"w-full",value:V,onChange:Y})}),r.jsx(xs,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:_,onChange:Z=>z(Z.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(xs,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:H,onChange:Z=>q(Z.target.value),className:"editor-input w-full",children:mN.map(Z=>r.jsx("option",{value:Z,children:yW[Z]??Z},Z))}),r.jsx("button",{type:"button",onClick:()=>K(Z=>Z==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:I==="asc"?"Ascending":"Descending",children:I==="asc"?"Asc":"Desc"})]})})]}),ee?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:ee}):null,r.jsxs(Ar,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ae,className:"shell-action",disabled:$,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:$,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||$,className:"shell-action shell-action--cta disabled:opacity-50",children:$?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function xs({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const bW={kanban:"Kanban",list:"List",table:"Table"},vW={assignment:"Assignment",session:"Session"},wW={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function yk(){const{workspace:e}=Mt(),{views:t,loading:n}=Bc(),{submitEdit:s,submitEditSession:o,duplicate:i,remove:c}=A2(),{toast:u,showToast:d,dismissToast:m}=Ao(),[h,g]=f.useState(null),[y,b]=f.useState(!1),[N,w]=f.useState(!1),[v,k]=f.useState(!1),[E,S]=f.useState(null);async function T(Y,_){const{workspace:z,config:H}=gC(_,e??null);try{await $i({name:Y,workspace:z,config:H}),w(!1),d(`Created view "${Y}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to create saved view"),q}}async function P(Y,_){const{workspace:z,config:H}=xy(_,e??null);try{await $i({name:Y,workspace:z,config:H,entityType:"session"}),k(!1),d(`Created session view "${Y}"`)}catch(q){throw d(q instanceof Error?q.message:"Failed to create session view"),q}}async function R(Y,_,z){try{await s(Y,_,z),S(null),d(`Updated view "${_}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to update saved view"),H}}async function A(Y,_,z){try{await o(Y,_,z),S(null),d(`Updated session view "${_}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to update session view"),H}}async function L(Y){try{await i(Y),d(`Duplicated "${Y.name}"`)}catch(_){d(_ instanceof Error?_.message:"Failed to duplicate saved view")}}async function M(){if(h){b(!0);try{await c(h),g(null)}catch(Y){d(Y instanceof Error?Y.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(Ct,{className:"h-4 w-4"}),"Create view"]}),D=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Ct,{className:"h-4 w-4"}),"Create session view"]}),V=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(yf,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,F]})}),n?r.jsx(mt,{label:"Loading saved views…"}):t.length===0?r.jsx(jt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,F]})}):r.jsx(We,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(Y=>r.jsx(jW,{view:Y,onRequestDelete:()=>g(Y),onRequestEdit:()=>S(Y),onRequestDuplicate:()=>void L(Y)},Y.id))})}),r.jsx(P2,{open:N||!V&&E!==null,onOpenChange:Y=>{Y||(w(!1),V||S(null))},workspace:E&&!V?E.workspace:e??null,initialView:E&&!V?E:null,onSubmit:E&&!V?(Y,_)=>R(E,Y,_):T}),r.jsx(wC,{open:v||V&&E!==null,onOpenChange:Y=>{Y||(k(!1),V&&S(null))},workspace:E&&V?E.workspace:e??null,initialView:E&&V?E:null,onSubmit:E&&V?(Y,_)=>A(E,Y,_):P}),r.jsx(wa,{open:h!==null,title:"Delete saved view?",description:h?`Delete '${h.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:y,destructive:!0,onConfirm:M,onOpenChange:Y=>{!Y&&!y&&g(null)}}),r.jsx(ba,{toast:u,onDismiss:m})]})}function jW({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const o=_t(),i=()=>o(yC(e)),c=vC(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 ${wW[d]??"bg-muted text-muted-foreground"}`,children:vW[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:bW[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[c,h?` · ${h}`:""]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const kW={kanban:"Kanban",list:"List",table:"Table"};function bk(){const{id:e,workspace:t}=Mt(),n=_t(),{view:s,ready:o,error:i,refetch:c}=So(e),{submitEdit:u,duplicate:d,remove:m}=A2(),{toast:h,showToast:g,dismissToast:y}=Ao(),[b,N]=f.useState(!1),[w,v]=f.useState(!1),[k,E]=f.useState(!1);if(f.useEffect(()=>{!o||!s||(t??null)!==(s.workspace??null)&&n(yC(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:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(yf,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Ce,{to:zd(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Kd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=s.workspace?kn(s.workspace):null;async function T(A,L){const M=s;try{await u(M,A,L),N(!1),g(`Updated view "${A}"`)}catch(F){throw g(F instanceof Error?F.message:"Failed to update saved view"),F}}async function P(){const A=s;try{await d(A),g(`Duplicated "${A.name}"`)}catch(L){g(L instanceof Error?L.message:"Failed to duplicate saved view")}}async function R(){const A=s;E(!0);try{await m(A),v(!1),n(zd(A.workspace))}catch(L){g(L instanceof Error?L.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ce,{to:zd(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(Kd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(yf,{title:s.name,description:vC(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:kW[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:()=>N(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void P(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(bC(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(mC,{view:s}),b?r.jsx(P2,{open:b,onOpenChange:N,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(wa,{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:A=>{!A&&!k&&v(!1)}}),r.jsx(ba,{toast:h,onDismiss:y})]})}function SW(){return r.jsx(zA,{children:r.jsx($4,{children:r.jsx(hA,{children:r.jsxs(He,{element:r.jsx(lL,{}),children:[r.jsx(He,{path:"/",element:r.jsx(IM,{})}),r.jsx(He,{path:"/projects",element:r.jsx(Uj,{})}),r.jsx(He,{path:"/archive",element:r.jsx(JM,{})}),r.jsx(He,{path:"/assignments",element:r.jsx(Q0,{})}),r.jsx(He,{path:"/assignments/new",element:r.jsx(tk,{})}),r.jsx(He,{path:"/assignments/:id",element:r.jsx(GU,{})}),r.jsx(He,{path:"/assignments/:id/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/assignments/:id/plan/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(ug,{})}),r.jsx(He,{path:"/assignments/:id/handoff/edit",element:r.jsx(dg,{})}),r.jsx(He,{path:"/assignments/:id/decision-record/edit",element:r.jsx(fg,{})}),r.jsx(He,{path:"/servers",element:r.jsx(rk,{})}),r.jsx(He,{path:"/inventories",element:r.jsx(sk,{})}),r.jsx(He,{path:"/schedules",element:r.jsx(_7,{})}),r.jsx(He,{path:"/usage",element:r.jsx(ok,{})}),r.jsx(He,{path:"/agent-sessions",element:r.jsx(ak,{})}),r.jsx(He,{path:"/playbooks",element:r.jsx(U7,{})}),r.jsx(He,{path:"/playbooks/create",element:r.jsx(V7,{})}),r.jsx(He,{path:"/playbooks/:slug",element:r.jsx(W7,{})}),r.jsx(He,{path:"/playbooks/:slug/edit",element:r.jsx(H7,{})}),r.jsx(He,{path:"/memories",element:r.jsx(K7,{})}),r.jsx(He,{path:"/memories/new",element:r.jsx(G7,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(q7,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(Y7,{})}),r.jsx(He,{path:"/resources",element:r.jsx(J7,{})}),r.jsx(He,{path:"/resources/new",element:r.jsx(X7,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(Q7,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(Z7,{})}),r.jsx(He,{path:"/todos",element:r.jsx(dW,{})}),r.jsx(He,{path:"/views",element:r.jsx(yk,{})}),r.jsx(He,{path:"/views/:id",element:r.jsx(bk,{})}),r.jsx(He,{path:"/help",element:r.jsx(_M,{})}),r.jsx(He,{path:"/settings",element:r.jsx(S9,{})}),r.jsx(He,{path:"/workflow",element:r.jsx(uW,{})}),r.jsx(He,{path:"/create/project",element:r.jsx(Z0,{})}),r.jsx(He,{path:"/projects/:slug",element:r.jsx(U0,{})}),r.jsx(He,{path:"/projects/:slug/edit",element:r.jsx(nk,{})}),r.jsx(He,{path:"/projects/:slug/create/assignment",element:r.jsx(ek,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(q0,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(ug,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(dg,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(fg,{})}),r.jsx(He,{path:"/w/:workspace/projects",element:r.jsx(Uj,{})}),r.jsx(He,{path:"/w/:workspace/assignments",element:r.jsx(Q0,{})}),r.jsx(He,{path:"/w/:workspace/assignments/new",element:r.jsx(tk,{})}),r.jsx(He,{path:"/w/:workspace/servers",element:r.jsx(rk,{})}),r.jsx(He,{path:"/w/:workspace/inventories",element:r.jsx(sk,{})}),r.jsx(He,{path:"/w/:workspace/usage",element:r.jsx(ok,{})}),r.jsx(He,{path:"/w/:workspace/agent-sessions",element:r.jsx(ak,{})}),r.jsx(He,{path:"/w/:workspace/todos",element:r.jsx(gW,{})}),r.jsx(He,{path:"/w/:workspace/views",element:r.jsx(yk,{})}),r.jsx(He,{path:"/w/:workspace/views/:id",element:r.jsx(bk,{})}),r.jsx(He,{path:"/w/:workspace/create/project",element:r.jsx(Z0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug",element:r.jsx(U0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(nk,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(ek,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(q0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(ug,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(dg,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(fg,{})})]})})})})}N3();hR.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(C3,{children:r.jsx(SW,{})})}));export{wF as _,CW as a,Nf as g};