syntaur 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-Q1PSZECa.js → _basePickBy-DUHFI6oU.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-B6uu69P0.js → _baseUniq-DRt9RjSP.js} +1 -1
- package/dashboard/dist/assets/{arc-D15ezD9f.js → arc-5XWNPQlZ.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-C4z3OUp7.js → architectureDiagram-2XIMDMQ5-DqB7sQFA.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-G0PvoF7N.js → blockDiagram-WCTKOSBZ-CKPgcWQ8.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-DjSpuJsk.js → c4Diagram-IC4MRINW-B8sU_vmJ.js} +1 -1
- package/dashboard/dist/assets/channel-CcWylyp0.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-De4HdhLn.js → chunk-4BX2VUAB-CIhLGSUG.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-BMkP7lSs.js → chunk-55IACEB6-lsUFI0Ge.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-BUb4B6J_.js → chunk-FMBD7UC4-ujMphQmW.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-Bdfjf5kD.js → chunk-JSJVCQXG-kjF399s5.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-Dce-ALzt.js → chunk-KX2RTZJC-DInuQ4Qw.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-VC0KVDkQ.js → chunk-NQ4KR5QH-a7rEyED_.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-kXnhYlzI.js → chunk-QZHKN3VN-BI1uIUfy.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-Beh261rr.js → chunk-WL4C6EOR-CpPgsnls.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-Cw20cVVI.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Cw20cVVI.js +1 -0
- package/dashboard/dist/assets/clone-CmP08qqL.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CuPhgVEA.js → cose-bilkent-S5V4N54A-OL_9Zszj.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-CDkxfqOw.js → dagre-KLK3FWXG-D1OhJX9b.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-iTkQbEMa.js → diagram-E7M64L7V-DhIt0Jr9.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-BtpYU53Z.js → diagram-IFDJBPK2-CIfyB6G2.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-uGWbmH4Y.js → diagram-P4PSJMXO-CgU-dQUW.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-DenLyLIm.js → erDiagram-INFDFZHY-Du1JphjW.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-66j4-vCO.js → flowDiagram-PKNHOUZH-DURih31t.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-SVF_TA4w.js → ganttDiagram-A5KZAMGK-C-Cqqgsf.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-SVxQTBZM.js → gitGraphDiagram-K3NZZRJ6-CepAdX2T.js} +1 -1
- package/dashboard/dist/assets/{graph-CPhRysBU.js → graph-MiU6Qm8S.js} +1 -1
- package/dashboard/dist/assets/index-2E6DZUQG.js +592 -0
- package/dashboard/dist/assets/index-YXyh65SI.css +1 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-DC3jz7Mz.js → infoDiagram-LFFYTUFH-DJmaMWsH.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Z2onT5Ea.js → ishikawaDiagram-PHBUUO56-RN6mk8qj.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-BX8qpaJE.js → journeyDiagram-4ABVD52K-44pvF0Ob.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-fR2BiIKL.js → kanban-definition-K7BYSVSG-MlXOrJBh.js} +1 -1
- package/dashboard/dist/assets/{layout-lnW6QNdh.js → layout-B-i7H031.js} +1 -1
- package/dashboard/dist/assets/{linear-douFRX7V.js → linear-BcC4ElJz.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-D9FaILqM.js → mermaid.core-DaGpamF_.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-DEHosmEM.js → mindmap-definition-YRQLILUH-BF_LsKu3.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-DW9Kqq4N.js → pieDiagram-SKSYHLDU-BLpZGB3L.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-B5FqdsN-.js → quadrantDiagram-337W2JSQ-CQiR9ghP.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-qFH8L_CI.js → requirementDiagram-Z7DCOOCP-Dz6EuZPY.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-CFXjjTmg.js → sankeyDiagram-WA2Y5GQK-Bwk5fkY7.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-BFa1eUWT.js → sequenceDiagram-2WXFIKYE-BnQusPAE.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-D3Uwuidx.js → stateDiagram-RAJIS63D-CrvV_I-b.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-QzsQtw-C.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-Qe6hh_yt.js → timeline-definition-YZTLITO2-BJMA4ITk.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-CvDfsGUo.js → treemap-KZPCXAKY-TWGkD_Yk.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-aNTXgH77.js → vennDiagram-LZ73GAT5-DxPkvzPX.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-0dsre7bb.js → xychartDiagram-JWTSCODW-B5ZL4NDg.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +11 -1
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/launch/index.js +2 -0
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-B5BNb_on.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-RAXR887a.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-RAXR887a.js +0 -1
- package/dashboard/dist/assets/clone-CHQli9jV.js +0 -1
- package/dashboard/dist/assets/index-BdzQ01f3.css +0 -1
- package/dashboard/dist/assets/index-Bq02M5BX.js +0 -587
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-CVx5T-km.js +0 -1
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
var rR=Object.defineProperty;var sR=(e,t,n)=>t in e?rR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ah=(e,t,n)=>sR(e,typeof t!="symbol"?t+"":t,n);function oR(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 Sf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pV(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 ih={exports:{}},Ol={},lh={exports:{}},ht={};/**
|
|
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 fw;function aR(){if(fw)return ht;fw=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(V){return V===null||typeof V!="object"?null:(V=g&&V[g]||V["@@iterator"],typeof V=="function"?V:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,w={};function v(V,ee,B){this.props=V,this.context=ee,this.refs=w,this.updater=B||b}v.prototype.isReactComponent={},v.prototype.setState=function(V,ee){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,ee,"setState")},v.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(V,ee,B){this.props=V,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(V,ee,B){var ue,ye={},se=null,ge=null;if(ee!=null)for(ue in ee.ref!==void 0&&(ge=ee.ref),ee.key!==void 0&&(se=""+ee.key),ee)P.call(ee,ue)&&!A.hasOwnProperty(ue)&&(ye[ue]=ee[ue]);var ke=arguments.length-2;if(ke===1)ye.children=B;else if(1<ke){for(var Re=Array(ke),Ae=0;Ae<ke;Ae++)Re[Ae]=arguments[Ae+2];ye.children=Re}if(V&&V.defaultProps)for(ue in ke=V.defaultProps,ke)ye[ue]===void 0&&(ye[ue]=ke[ue]);return{$$typeof:e,type:V,key:se,ref:ge,props:ye,_owner:R.current}}function M(V,ee){return{$$typeof:e,type:V.type,key:ee,ref:V.ref,props:V.props,_owner:V._owner}}function F(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function D(V){var ee={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(B){return ee[B]})}var W=/\/+/g;function Y(V,ee){return typeof V=="object"&&V!==null&&V.key!=null?D(""+V.key):ee.toString(36)}function _(V,ee,B,ue,ye){var se=typeof V;(se==="undefined"||se==="boolean")&&(V=null);var ge=!1;if(V===null)ge=!0;else switch(se){case"string":case"number":ge=!0;break;case"object":switch(V.$$typeof){case e:case t:ge=!0}}if(ge)return ge=V,ye=ye(ge),V=ue===""?"."+Y(ge,0):ue,T(ye)?(B="",V!=null&&(B=V.replace(W,"$&/")+"/"),_(ye,ee,B,"",function(Ae){return Ae})):ye!=null&&(F(ye)&&(ye=M(ye,B+(!ye.key||ge&&ge.key===ye.key?"":(""+ye.key).replace(W,"$&/")+"/")+V)),ee.push(ye)),1;if(ge=0,ue=ue===""?".":ue+":",T(V))for(var ke=0;ke<V.length;ke++){se=V[ke];var Re=ue+Y(se,ke);ge+=_(se,ee,B,Re,ye)}else if(Re=y(V),typeof Re=="function")for(V=Re.call(V),ke=0;!(se=V.next()).done;)se=se.value,Re=ue+Y(se,ke++),ge+=_(se,ee,B,Re,ye);else if(se==="object")throw ee=String(V),Error("Objects are not valid as a React child (found: "+(ee==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":ee)+"). If you meant to render a collection of children, use an array instead.");return ge}function z(V,ee,B){if(V==null)return V;var ue=[],ye=0;return _(V,ue,"","",function(se){return ee.call(B,se,ye++)}),ue}function H(V){if(V._status===-1){var ee=V._result;ee=ee(),ee.then(function(B){(V._status===0||V._status===-1)&&(V._status=1,V._result=B)},function(B){(V._status===0||V._status===-1)&&(V._status=2,V._result=B)}),V._status===-1&&(V._status=0,V._result=ee)}if(V._status===1)return V._result.default;throw V._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 ht.Children={map:z,forEach:function(V,ee,B){z(V,function(){ee.apply(this,arguments)},B)},count:function(V){var ee=0;return z(V,function(){ee++}),ee},toArray:function(V){return z(V,function(ee){return ee})||[]},only:function(V){if(!F(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},ht.Component=v,ht.Fragment=n,ht.Profiler=o,ht.PureComponent=E,ht.StrictMode=s,ht.Suspense=d,ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,ht.act=$,ht.cloneElement=function(V,ee,B){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var ue=N({},V.props),ye=V.key,se=V.ref,ge=V._owner;if(ee!=null){if(ee.ref!==void 0&&(se=ee.ref,ge=R.current),ee.key!==void 0&&(ye=""+ee.key),V.type&&V.type.defaultProps)var ke=V.type.defaultProps;for(Re in ee)P.call(ee,Re)&&!A.hasOwnProperty(Re)&&(ue[Re]=ee[Re]===void 0&&ke!==void 0?ke[Re]:ee[Re])}var Re=arguments.length-2;if(Re===1)ue.children=B;else if(1<Re){ke=Array(Re);for(var Ae=0;Ae<Re;Ae++)ke[Ae]=arguments[Ae+2];ue.children=ke}return{$$typeof:e,type:V.type,key:ye,ref:se,props:ue,_owner:ge}},ht.createContext=function(V){return V={$$typeof:c,_currentValue:V,_currentValue2:V,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},V.Provider={$$typeof:i,_context:V},V.Consumer=V},ht.createElement=L,ht.createFactory=function(V){var ee=L.bind(null,V);return ee.type=V,ee},ht.createRef=function(){return{current:null}},ht.forwardRef=function(V){return{$$typeof:u,render:V}},ht.isValidElement=F,ht.lazy=function(V){return{$$typeof:h,_payload:{_status:-1,_result:V},_init:H}},ht.memo=function(V,ee){return{$$typeof:m,type:V,compare:ee===void 0?null:ee}},ht.startTransition=function(V){var ee=I.transition;I.transition={};try{V()}finally{I.transition=ee}},ht.unstable_act=$,ht.useCallback=function(V,ee){return q.current.useCallback(V,ee)},ht.useContext=function(V){return q.current.useContext(V)},ht.useDebugValue=function(){},ht.useDeferredValue=function(V){return q.current.useDeferredValue(V)},ht.useEffect=function(V,ee){return q.current.useEffect(V,ee)},ht.useId=function(){return q.current.useId()},ht.useImperativeHandle=function(V,ee,B){return q.current.useImperativeHandle(V,ee,B)},ht.useInsertionEffect=function(V,ee){return q.current.useInsertionEffect(V,ee)},ht.useLayoutEffect=function(V,ee){return q.current.useLayoutEffect(V,ee)},ht.useMemo=function(V,ee){return q.current.useMemo(V,ee)},ht.useReducer=function(V,ee,B){return q.current.useReducer(V,ee,B)},ht.useRef=function(V){return q.current.useRef(V)},ht.useState=function(V){return q.current.useState(V)},ht.useSyncExternalStore=function(V,ee,B){return q.current.useSyncExternalStore(V,ee,B)},ht.useTransition=function(){return q.current.useTransition()},ht.version="18.3.1",ht}var pw;function lx(){return pw||(pw=1,lh.exports=aR()),lh.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 mw;function iR(){if(mw)return Ol;mw=1;var e=lx(),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 Ol.Fragment=n,Ol.jsx=c,Ol.jsxs=c,Ol}var hw;function lR(){return hw||(hw=1,ih.exports=iR()),ih.exports}var r=lR(),f=lx();const Pt=Sf(f),bk=oR({__proto__:null,default:Pt},[f]);var od={},ch={exports:{}},ir={},uh={exports:{}},dh={};/**
|
|
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 gw;function cR(){return gw||(gw=1,(function(e){function t(I,K){var $=I.length;I.push(K);e:for(;0<$;){var V=$-1>>>1,ee=I[V];if(0<o(ee,K))I[V]=K,I[$]=ee,$=V;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 V=0,ee=I.length,B=ee>>>1;V<B;){var ue=2*(V+1)-1,ye=I[ue],se=ue+1,ge=I[se];if(0>o(ye,$))se<ee&&0>o(ge,ye)?(I[V]=ge,I[se]=$,V=se):(I[V]=ye,I[ue]=$,V=ue);else if(se<ee&&0>o(ge,$))I[V]=ge,I[se]=$,V=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 V=g.callback;if(typeof V=="function"){g.callback=null,y=g.priorityLevel;var ee=V(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 ue=n(m);ue!==null&&q(T,ue.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 W(){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(W)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,z=_.port2;_.port1.onmessage=W,Y=function(){z.postMessage(null)}}else Y=function(){v(W,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 V=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?V+$:V):$=V,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},$>V?(I.sortIndex=$,t(m,I),n(d)===null&&I===n(m)&&(w?(k(L),L=-1):w=!0,q(T,$-V))):(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=$}}}})(dh)),dh}var xw;function uR(){return xw||(xw=1,uh.exports=cR()),uh.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 yw;function dR(){if(yw)return ir;yw=1;var e=lx(),t=uR();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"),W=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,V;function ee(a){if(V===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);V=l&&l[1]||""}return`
|
|
34
|
+
`+V+a}var B=!1;function ue(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(fe){var x=fe}Reflect.construct(a,[],l)}else{try{l.call()}catch(fe){x=fe}a.call(l.prototype)}else{try{throw Error()}catch(fe){x=fe}a()}}catch(fe){if(fe&&x&&typeof fe.stack=="string"){for(var j=fe.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 J=`
|
|
37
|
+
`+j[O].replace(" at new "," at ");return a.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",a.displayName)),J}while(1<=O&&0<=G);break}}}finally{B=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?ee(a):""}function ye(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=ue(a.type,!1),a;case 11:return a=ue(a.type.render,!1),a;case 1:return a=ue(a.type,!0),a;default:return""}}function se(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case 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 W: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 ge(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 Je(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 Qe(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 ie(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 Q(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?ie(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var me,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(me=me||document.createElement("div"),me.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=me.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function xe(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 de(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 le(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 jt=null,st=null,pe=null;function Oe(a){if(a=wl(a)){if(typeof jt!="function")throw Error(n(280));var l=a.stateNode;l&&(l=vu(l),jt(a.stateNode,a.type,l))}}function qe(a){st?pe?pe.push(a):pe=[a]:st=a}function Lt(){if(st){var a=st,l=pe;if(pe=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||pe!==null)&&(dn(),Lt())}}function Ct(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 Et={};Object.defineProperty(Et,"passive",{get:function(){Fn=!0}}),window.addEventListener("test",Et,Et),window.removeEventListener("test",Et,Et)}catch{Fn=!1}function oe(a,l,p,x,j,C,O,G,J){var fe=Array.prototype.slice.call(arguments,3);try{l.apply(p,fe)}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,J){ze=!1,tt=null,oe.apply(qr,arguments)}function Qc(a,l,p,x,j,C,O,G,J){if(Ts.apply(this,arguments),ze){if(ze){var fe=tt;ze=!1,tt=null}else throw Error(n(198));yt||(yt=!0,tr=fe)}}function mt(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 Jc(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 rl(a){if(mt(a)!==a)throw Error(n(188))}function Xc(a){var l=a.alternate;if(!l){if(l=mt(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 rl(j),a;if(C===x)return rl(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,Ep=t.unstable_shouldYield,Tp=t.unstable_requestPaint,Zt=t.unstable_now,Rp=t.unstable_getCurrentPriorityLevel,sl=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:Dp,Ap=Math.log,Pp=Math.LN2;function Dp(a){return a>>>=0,a===0?32:31-(Ap(a)/Pp|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,J=j[O];J===-1?((G&p)===0||(G&x)!==0)&&(j[O]=su(G,l)):J<=l&&(a.expiredLanes|=G),C&=~G}}function $o(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function ol(){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 al(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 il(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 ll(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var Ca,Ea,Ys,Ta,au,cl=!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 he(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=wl(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=he(us,a,l,p,x,j),!0;case"dragenter":return Pr=he(Pr,a,l,p,x,j),!0;case"mouseover":return ds=he(ds,a,l,p,x,j),!0;case"pointerover":var C=j.pointerId;return Lo.set(C,he(Lo.get(C)||null,a,l,p,x,j)),!0;case"gotpointercapture":return C=j.pointerId,Io.set(C,he(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=mt(l);if(p!==null){if(l=p.tag,l===13){if(l=Jc(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=$p(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=wl(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(){cl=!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,cl||(cl=!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=$p(a,l,p,x);if(j===null)Qp(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=wl(j);if(C!==null&&Ca(C),C=$p(a,l,p,x),C===null&&Qp(a,l,x,lu,p),C===j)break;j=C}j!==null&&x.stopPropagation()}else Qp(a,l,x,null,p)}}var lu=null;function $p(a,l,p,x){if(lu=null,a=xt(x),a=_o(a),a!==null)if(l=mt(a),l===null)a=null;else if(p=l.tag,p===13){if(a=Jc(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 Xy(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(Rp()){case sl:return 1;case nu:return 4;case qs:case ja:return 16;case ru:return 536870912;default:return 16}default:return 16}}var Qs=null,Lp=null,cu=null;function Zy(){if(cu)return cu;var a,l=Lp,p=l.length,x,j="value"in Qs?Qs.value:Qs.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 eb(){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:eb,this.isPropagationStopped=eb,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},Ip=gr(Aa),ul=$({},Aa,{view:0,detail:0}),A2=gr(ul),Op,_p,dl,fu=$({},ul,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fp,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!==dl&&(dl&&a.type==="mousemove"?(Op=a.screenX-dl.screenX,_p=a.screenY-dl.screenY):_p=Op=0,dl=a),Op)},movementY:function(a){return"movementY"in a?a.movementY:_p}}),tb=gr(fu),P2=$({},fu,{dataTransfer:0}),D2=gr(P2),$2=$({},ul,{relatedTarget:0}),Mp=gr($2),L2=$({},Aa,{animationName:0,elapsedTime:0,pseudoElement:0}),I2=gr(L2),O2=$({},Aa,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),_2=gr(O2),M2=$({},Aa,{data:0}),nb=gr(M2),F2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},z2={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"},B2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function U2(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=B2[a])?!!l[a]:!1}function Fp(){return U2}var V2=$({},ul,{key:function(a){if(a.key){var l=F2[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"?z2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fp,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}}),W2=gr(V2),H2=$({},fu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rb=gr(H2),K2=$({},ul,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fp}),q2=gr(K2),G2=$({},Aa,{propertyName:0,elapsedTime:0,pseudoElement:0}),Y2=gr(G2),Q2=$({},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}),J2=gr(Q2),X2=[9,13,27,32],zp=u&&"CompositionEvent"in window,fl=null;u&&"documentMode"in document&&(fl=document.documentMode);var Z2=u&&"TextEvent"in window&&!fl,sb=u&&(!zp||fl&&8<fl&&11>=fl),ob=" ",ab=!1;function ib(a,l){switch(a){case"keyup":return X2.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lb(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Pa=!1;function eT(a,l){switch(a){case"compositionend":return lb(l);case"keypress":return l.which!==32?null:(ab=!0,ob);case"textInput":return a=l.data,a===ob&&ab?null:a;default:return null}}function tT(a,l){if(Pa)return a==="compositionend"||!zp&&ib(a,l)?(a=Zy(),cu=Lp=Qs=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 sb&&l.locale!=="ko"?null:l.data;default:return null}}var nT={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 cb(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!nT[a.type]:l==="textarea"}function ub(a,l,p,x){qe(x),l=xu(l,"onChange"),0<l.length&&(p=new Ip("onChange","change",null,p,x),a.push({event:p,listeners:l}))}var pl=null,ml=null;function rT(a){Tb(a,0)}function pu(a){var l=Oa(a);if(at(l))return a}function sT(a,l){if(a==="change")return l}var db=!1;if(u){var Bp;if(u){var Up="oninput"in document;if(!Up){var fb=document.createElement("div");fb.setAttribute("oninput","return;"),Up=typeof fb.oninput=="function"}Bp=Up}else Bp=!1;db=Bp&&(!document.documentMode||9<document.documentMode)}function pb(){pl&&(pl.detachEvent("onpropertychange",mb),ml=pl=null)}function mb(a){if(a.propertyName==="value"&&pu(ml)){var l=[];ub(l,ml,a,xt(a)),Gn(rT,l)}}function oT(a,l,p){a==="focusin"?(pb(),pl=l,ml=p,pl.attachEvent("onpropertychange",mb)):a==="focusout"&&pb()}function aT(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return pu(ml)}function iT(a,l){if(a==="click")return pu(l)}function lT(a,l){if(a==="input"||a==="change")return pu(l)}function cT(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Yr=typeof Object.is=="function"?Object.is:cT;function hl(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 hb(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function gb(a,l){var p=hb(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=hb(p)}}function xb(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?xb(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function yb(){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 Vp(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 uT(a){var l=yb(),p=a.focusedElem,x=a.selectionRange;if(l!==p&&p&&p.ownerDocument&&xb(p.ownerDocument.documentElement,p)){if(x!==null&&Vp(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=gb(p,C);var O=gb(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 dT=u&&"documentMode"in document&&11>=document.documentMode,Da=null,Wp=null,gl=null,Hp=!1;function bb(a,l,p){var x=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;Hp||Da==null||Da!==Ze(x)||(x=Da,"selectionStart"in x&&Vp(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}),gl&&hl(gl,x)||(gl=x,x=xu(Wp,"onSelect"),0<x.length&&(l=new Ip("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")},Kp={},vb={};u&&(vb=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(Kp[a])return Kp[a];if(!$a[a])return a;var l=$a[a],p;for(p in l)if(l.hasOwnProperty(p)&&p in vb)return Kp[a]=l[p];return a}var wb=hu("animationend"),jb=hu("animationiteration"),kb=hu("animationstart"),Sb=hu("transitionend"),Nb=new Map,Cb="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Js(a,l){Nb.set(a,l),i(l,[a])}for(var qp=0;qp<Cb.length;qp++){var Gp=Cb[qp],fT=Gp.toLowerCase(),pT=Gp[0].toUpperCase()+Gp.slice(1);Js(fT,"on"+pT)}Js(wb,"onAnimationEnd"),Js(jb,"onAnimationIteration"),Js(kb,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(Sb,"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 xl="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(" "),mT=new Set("cancel close invalid load scroll toggle".split(" ").concat(xl));function Eb(a,l,p){var x=a.type||"unknown-event";a.currentTarget=p,Qc(x,l,void 0,a),a.currentTarget=null}function Tb(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],J=G.instance,fe=G.currentTarget;if(G=G.listener,J!==C&&j.isPropagationStopped())break e;Eb(j,G,fe),C=J}else for(O=0;O<x.length;O++){if(G=x[O],J=G.instance,fe=G.currentTarget,G=G.listener,J!==C&&j.isPropagationStopped())break e;Eb(j,G,fe),C=J}}}if(yt)throw a=tr,yt=!1,tr=null,a}function Ut(a,l){var p=l[nm];p===void 0&&(p=l[nm]=new Set);var x=a+"__bubble";p.has(x)||(Rb(l,a,2,!1),p.add(x))}function Yp(a,l,p){var x=0;l&&(x|=4),Rb(p,a,x,l)}var gu="_reactListening"+Math.random().toString(36).slice(2);function yl(a){if(!a[gu]){a[gu]=!0,s.forEach(function(p){p!=="selectionchange"&&(mT.has(p)||Yp(p,!1,a),Yp(p,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[gu]||(l[gu]=!0,Yp("selectionchange",!1,l))}}function Rb(a,l,p,x){switch(Xy(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 Qp(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 J=O.tag;if((J===3||J===4)&&(J=O.stateNode.containerInfo,J===j||J.nodeType===8&&J.parentNode===j))return;O=O.return}for(;G!==null;){if(O=_o(G),O===null)return;if(J=O.tag,J===5||J===6){x=C=O;continue e}G=G.parentNode}}x=x.return}Gn(function(){var fe=C,je=xt(p),Ne=[];e:{var we=Nb.get(a);if(we!==void 0){var Be=Ip,Ke=a;switch(a){case"keypress":if(uu(p)===0)break e;case"keydown":case"keyup":Be=W2;break;case"focusin":Ke="focus",Be=Mp;break;case"focusout":Ke="blur",Be=Mp;break;case"beforeblur":case"afterblur":Be=Mp;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=tb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Be=D2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Be=q2;break;case wb:case jb:case kb:Be=I2;break;case Sb:Be=Y2;break;case"scroll":Be=A2;break;case"wheel":Be=J2;break;case"copy":case"cut":case"paste":Be=_2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Be=rb}var Ge=(l&4)!==0,cn=!Ge&&a==="scroll",ae=Ge?we!==null?we+"Capture":null:we;Ge=[];for(var ne=fe,ce;ne!==null;){ce=ne;var De=ce.stateNode;if(ce.tag===5&&De!==null&&(ce=De,ae!==null&&(De=Ct(ne,ae),De!=null&&Ge.push(bl(ne,De,ce)))),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=fe,Ke=Ke?_o(Ke):null,Ke!==null&&(cn=mt(Ke),Ke!==cn||Ke.tag!==5&&Ke.tag!==6)&&(Ke=null)):(Be=null,Ke=fe),Be!==Ke)){if(Ge=tb,De="onMouseLeave",ae="onMouseEnter",ne="mouse",(a==="pointerout"||a==="pointerover")&&(Ge=rb,De="onPointerLeave",ae="onPointerEnter",ne="pointer"),cn=Be==null?we:Oa(Be),ce=Ke==null?we:Oa(Ke),we=new Ge(De,ne+"leave",Be,p,je),we.target=cn,we.relatedTarget=ce,De=null,_o(je)===fe&&(Ge=new Ge(ae,ne+"enter",Ke,p,je),Ge.target=ce,Ge.relatedTarget=cn,De=Ge),cn=De,Be&&Ke)t:{for(Ge=Be,ae=Ke,ne=0,ce=Ge;ce;ce=La(ce))ne++;for(ce=0,De=ae;De;De=La(De))ce++;for(;0<ne-ce;)Ge=La(Ge),ne--;for(;0<ce-ne;)ae=La(ae),ce--;for(;ne--;){if(Ge===ae||ae!==null&&Ge===ae.alternate)break t;Ge=La(Ge),ae=La(ae)}Ge=null}else Ge=null;Be!==null&&Ab(Ne,we,Be,Ge,!1),Ke!==null&&cn!==null&&Ab(Ne,cn,Ke,Ge,!0)}}e:{if(we=fe?Oa(fe):window,Be=we.nodeName&&we.nodeName.toLowerCase(),Be==="select"||Be==="input"&&we.type==="file")var Xe=sT;else if(cb(we))if(db)Xe=lT;else{Xe=aT;var nt=oT}else(Be=we.nodeName)&&Be.toLowerCase()==="input"&&(we.type==="checkbox"||we.type==="radio")&&(Xe=iT);if(Xe&&(Xe=Xe(a,fe))){ub(Ne,Xe,p,je);break e}nt&&nt(a,we,fe),a==="focusout"&&(nt=we._wrapperState)&&nt.controlled&&we.type==="number"&&Ye(we,"number",we.value)}switch(nt=fe?Oa(fe):window,a){case"focusin":(cb(nt)||nt.contentEditable==="true")&&(Da=nt,Wp=fe,gl=null);break;case"focusout":gl=Wp=Da=null;break;case"mousedown":Hp=!0;break;case"contextmenu":case"mouseup":case"dragend":Hp=!1,bb(Ne,p,je);break;case"selectionchange":if(dT)break;case"keydown":case"keyup":bb(Ne,p,je)}var rt;if(zp)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?ib(a,p)&&(it="onCompositionEnd"):a==="keydown"&&p.keyCode===229&&(it="onCompositionStart");it&&(sb&&p.locale!=="ko"&&(Pa||it!=="onCompositionStart"?it==="onCompositionEnd"&&Pa&&(rt=Zy()):(Qs=je,Lp="value"in Qs?Qs.value:Qs.textContent,Pa=!0)),nt=xu(fe,it),0<nt.length&&(it=new nb(it,a,null,p,je),Ne.push({event:it,listeners:nt}),rt?it.data=rt:(rt=lb(p),rt!==null&&(it.data=rt)))),(rt=Z2?eT(a,p):tT(a,p))&&(fe=xu(fe,"onBeforeInput"),0<fe.length&&(je=new nb("onBeforeInput","beforeinput",null,p,je),Ne.push({event:je,listeners:fe}),je.data=rt))}Tb(Ne,l)})}function bl(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=Ct(a,p),C!=null&&x.unshift(bl(a,C,j)),C=Ct(a,l),C!=null&&x.push(bl(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 Ab(a,l,p,x,j){for(var C=l._reactName,O=[];p!==null&&p!==x;){var G=p,J=G.alternate,fe=G.stateNode;if(J!==null&&J===x)break;G.tag===5&&fe!==null&&(G=fe,j?(J=Ct(p,C),J!=null&&O.unshift(bl(p,J,G))):j||(J=Ct(p,C),J!=null&&O.push(bl(p,J,G)))),p=p.return}O.length!==0&&a.push({event:l,listeners:O})}var hT=/\r\n?/g,gT=/\u0000|\uFFFD/g;function Pb(a){return(typeof a=="string"?a:""+a).replace(hT,`
|
|
38
|
+
`).replace(gT,"")}function yu(a,l,p){if(l=Pb(l),Pb(a)!==l&&p)throw Error(n(425))}function bu(){}var Jp=null,Xp=null;function Zp(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 em=typeof setTimeout=="function"?setTimeout:void 0,xT=typeof clearTimeout=="function"?clearTimeout:void 0,Db=typeof Promise=="function"?Promise:void 0,yT=typeof queueMicrotask=="function"?queueMicrotask:typeof Db<"u"?function(a){return Db.resolve(null).then(a).catch(bT)}:em;function bT(a){setTimeout(function(){throw a})}function tm(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 $b(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,vl="__reactProps$"+Ia,Rs="__reactContainer$"+Ia,nm="__reactEvents$"+Ia,vT="__reactListeners$"+Ia,wT="__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=$b(a);a!==null;){if(p=a[ps])return p;a=$b(a)}return l}a=p,p=a.parentNode}return null}function wl(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[vl]||null}var rm=[],_a=-1;function Zs(a){return{current:a}}function Vt(a){0>_a||(a.current=rm[_a],rm[_a]=null,_a--)}function Ft(a,l){_a++,rm[_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(){Vt(nr),Vt(Un)}function Lb(a,l,p){if(Un.current!==eo)throw Error(n(168));Ft(Un,l),Ft(nr,p)}function Ib(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,ge(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 Ob(a,l,p){var x=a.stateNode;if(!x)throw Error(n(169));p?(a=Ib(a,l,Mo),x.__reactInternalMemoizedMergedChildContext=a,Vt(nr),Vt(Un),Ft(Un,a)):Vt(nr),Ft(nr,p)}var As=null,ku=!1,sm=!1;function _b(a){As===null?As=[a]:As.push(a)}function jT(a){ku=!0,_b(a)}function to(){if(!sm&&As!==null){sm=!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(sl,to),j}finally{At=l,sm=!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 Mb(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 om(a){a.return!==null&&(zo(a,1),Mb(a,1,0))}function am(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,Qt=!1,Qr=null;function Fb(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 zb(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 im(a){return(a.mode&1)!==0&&(a.flags&128)===0}function lm(a){if(Qt){var l=yr;if(l){var p=l;if(!zb(a,l)){if(im(a))throw Error(n(418));l=Xs(p.nextSibling);var x=xr;l&&zb(a,l)?Fb(x,p):(a.flags=a.flags&-4097|2,Qt=!1,xr=a)}}else{if(im(a))throw Error(n(418));a.flags=a.flags&-4097|2,Qt=!1,xr=a}}}function Bb(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(!Qt)return Bb(a),Qt=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!Zp(a.type,a.memoizedProps)),l&&(l=yr)){if(im(a))throw Ub(),Error(n(418));for(;l;)Fb(a,l),l=Xs(l.nextSibling)}if(Bb(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 Ub(){for(var a=yr;a;)a=Xs(a.nextSibling)}function Ba(){yr=xr=null,Qt=!1}function cm(a){Qr===null?Qr=[a]:Qr.push(a)}var kT=T.ReactCurrentBatchConfig;function jl(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 Wb(a){function l(ae,ne){if(a){var ce=ae.deletions;ce===null?(ae.deletions=[ne],ae.flags|=16):ce.push(ne)}}function p(ae,ne){if(!a)return null;for(;ne!==null;)l(ae,ne),ne=ne.sibling;return null}function x(ae,ne){for(ae=new Map;ne!==null;)ne.key!==null?ae.set(ne.key,ne):ae.set(ne.index,ne),ne=ne.sibling;return ae}function j(ae,ne){return ae=co(ae,ne),ae.index=0,ae.sibling=null,ae}function C(ae,ne,ce){return ae.index=ce,a?(ce=ae.alternate,ce!==null?(ce=ce.index,ce<ne?(ae.flags|=2,ne):ce):(ae.flags|=2,ne)):(ae.flags|=1048576,ne)}function O(ae){return a&&ae.alternate===null&&(ae.flags|=2),ae}function G(ae,ne,ce,De){return ne===null||ne.tag!==6?(ne=eh(ce,ae.mode,De),ne.return=ae,ne):(ne=j(ne,ce),ne.return=ae,ne)}function J(ae,ne,ce,De){var Xe=ce.type;return Xe===A?je(ae,ne,ce.props.children,De,ce.key):ne!==null&&(ne.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===H&&Vb(Xe)===ne.type)?(De=j(ne,ce.props),De.ref=jl(ae,ne,ce),De.return=ae,De):(De=Ju(ce.type,ce.key,ce.props,null,ae.mode,De),De.ref=jl(ae,ne,ce),De.return=ae,De)}function fe(ae,ne,ce,De){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==ce.containerInfo||ne.stateNode.implementation!==ce.implementation?(ne=th(ce,ae.mode,De),ne.return=ae,ne):(ne=j(ne,ce.children||[]),ne.return=ae,ne)}function je(ae,ne,ce,De,Xe){return ne===null||ne.tag!==7?(ne=Go(ce,ae.mode,De,Xe),ne.return=ae,ne):(ne=j(ne,ce),ne.return=ae,ne)}function Ne(ae,ne,ce){if(typeof ne=="string"&&ne!==""||typeof ne=="number")return ne=eh(""+ne,ae.mode,ce),ne.return=ae,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case P:return ce=Ju(ne.type,ne.key,ne.props,null,ae.mode,ce),ce.ref=jl(ae,null,ne),ce.return=ae,ce;case R:return ne=th(ne,ae.mode,ce),ne.return=ae,ne;case H:var De=ne._init;return Ne(ae,De(ne._payload),ce)}if(Me(ne)||K(ne))return ne=Go(ne,ae.mode,ce,null),ne.return=ae,ne;Eu(ae,ne)}return null}function we(ae,ne,ce,De){var Xe=ne!==null?ne.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Xe!==null?null:G(ae,ne,""+ce,De);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case P:return ce.key===Xe?J(ae,ne,ce,De):null;case R:return ce.key===Xe?fe(ae,ne,ce,De):null;case H:return Xe=ce._init,we(ae,ne,Xe(ce._payload),De)}if(Me(ce)||K(ce))return Xe!==null?null:je(ae,ne,ce,De,null);Eu(ae,ce)}return null}function Be(ae,ne,ce,De,Xe){if(typeof De=="string"&&De!==""||typeof De=="number")return ae=ae.get(ce)||null,G(ne,ae,""+De,Xe);if(typeof De=="object"&&De!==null){switch(De.$$typeof){case P:return ae=ae.get(De.key===null?ce:De.key)||null,J(ne,ae,De,Xe);case R:return ae=ae.get(De.key===null?ce:De.key)||null,fe(ne,ae,De,Xe);case H:var nt=De._init;return Be(ae,ne,ce,nt(De._payload),Xe)}if(Me(De)||K(De))return ae=ae.get(ce)||null,je(ne,ae,De,Xe,null);Eu(ne,De)}return null}function Ke(ae,ne,ce,De){for(var Xe=null,nt=null,rt=ne,it=ne=0,Pn=null;rt!==null&&it<ce.length;it++){rt.index>it?(Pn=rt,rt=null):Pn=rt.sibling;var Tt=we(ae,rt,ce[it],De);if(Tt===null){rt===null&&(rt=Pn);break}a&&rt&&Tt.alternate===null&&l(ae,rt),ne=C(Tt,ne,it),nt===null?Xe=Tt:nt.sibling=Tt,nt=Tt,rt=Pn}if(it===ce.length)return p(ae,rt),Qt&&zo(ae,it),Xe;if(rt===null){for(;it<ce.length;it++)rt=Ne(ae,ce[it],De),rt!==null&&(ne=C(rt,ne,it),nt===null?Xe=rt:nt.sibling=rt,nt=rt);return Qt&&zo(ae,it),Xe}for(rt=x(ae,rt);it<ce.length;it++)Pn=Be(rt,ae,it,ce[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(ae,uo)}),Qt&&zo(ae,it),Xe}function Ge(ae,ne,ce,De){var Xe=K(ce);if(typeof Xe!="function")throw Error(n(150));if(ce=Xe.call(ce),ce==null)throw Error(n(151));for(var nt=Xe=null,rt=ne,it=ne=0,Pn=null,Tt=ce.next();rt!==null&&!Tt.done;it++,Tt=ce.next()){rt.index>it?(Pn=rt,rt=null):Pn=rt.sibling;var uo=we(ae,rt,Tt.value,De);if(uo===null){rt===null&&(rt=Pn);break}a&&rt&&uo.alternate===null&&l(ae,rt),ne=C(uo,ne,it),nt===null?Xe=uo:nt.sibling=uo,nt=uo,rt=Pn}if(Tt.done)return p(ae,rt),Qt&&zo(ae,it),Xe;if(rt===null){for(;!Tt.done;it++,Tt=ce.next())Tt=Ne(ae,Tt.value,De),Tt!==null&&(ne=C(Tt,ne,it),nt===null?Xe=Tt:nt.sibling=Tt,nt=Tt);return Qt&&zo(ae,it),Xe}for(rt=x(ae,rt);!Tt.done;it++,Tt=ce.next())Tt=Be(rt,ae,it,Tt.value,De),Tt!==null&&(a&&Tt.alternate!==null&&rt.delete(Tt.key===null?it:Tt.key),ne=C(Tt,ne,it),nt===null?Xe=Tt:nt.sibling=Tt,nt=Tt);return a&&rt.forEach(function(nR){return l(ae,nR)}),Qt&&zo(ae,it),Xe}function cn(ae,ne,ce,De){if(typeof ce=="object"&&ce!==null&&ce.type===A&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case P:e:{for(var Xe=ce.key,nt=ne;nt!==null;){if(nt.key===Xe){if(Xe=ce.type,Xe===A){if(nt.tag===7){p(ae,nt.sibling),ne=j(nt,ce.props.children),ne.return=ae,ae=ne;break e}}else if(nt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===H&&Vb(Xe)===nt.type){p(ae,nt.sibling),ne=j(nt,ce.props),ne.ref=jl(ae,nt,ce),ne.return=ae,ae=ne;break e}p(ae,nt);break}else l(ae,nt);nt=nt.sibling}ce.type===A?(ne=Go(ce.props.children,ae.mode,De,ce.key),ne.return=ae,ae=ne):(De=Ju(ce.type,ce.key,ce.props,null,ae.mode,De),De.ref=jl(ae,ne,ce),De.return=ae,ae=De)}return O(ae);case R:e:{for(nt=ce.key;ne!==null;){if(ne.key===nt)if(ne.tag===4&&ne.stateNode.containerInfo===ce.containerInfo&&ne.stateNode.implementation===ce.implementation){p(ae,ne.sibling),ne=j(ne,ce.children||[]),ne.return=ae,ae=ne;break e}else{p(ae,ne);break}else l(ae,ne);ne=ne.sibling}ne=th(ce,ae.mode,De),ne.return=ae,ae=ne}return O(ae);case H:return nt=ce._init,cn(ae,ne,nt(ce._payload),De)}if(Me(ce))return Ke(ae,ne,ce,De);if(K(ce))return Ge(ae,ne,ce,De);Eu(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ne!==null&&ne.tag===6?(p(ae,ne.sibling),ne=j(ne,ce),ne.return=ae,ae=ne):(p(ae,ne),ne=eh(ce,ae.mode,De),ne.return=ae,ae=ne),O(ae)):p(ae,ne)}return cn}var Ua=Wb(!0),Hb=Wb(!1),Tu=Zs(null),Ru=null,Va=null,um=null;function dm(){um=Va=Ru=null}function fm(a){var l=Tu.current;Vt(Tu),a._currentValue=l}function pm(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 Wa(a,l){Ru=a,um=Va=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(um!==a)if(a={context:a,memoizedValue:l,next:null},Va===null){if(Ru===null)throw Error(n(308));Va=a,Ru.dependencies={lanes:0,firstContext:a}}else Va=Va.next=a;return l}var Bo=null;function mm(a){Bo===null?Bo=[a]:Bo.push(a)}function Kb(a,l,p,x){var j=l.interleaved;return j===null?(p.next=p,mm(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 hm(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qb(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,(kt&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,mm(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,il(a,p)}}function Gb(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 J=G,fe=J.next;J.next=null,O===null?C=fe:O.next=fe,O=J;var je=a.alternate;je!==null&&(je=je.updateQueue,G=je.lastBaseUpdate,G!==O&&(G===null?je.firstBaseUpdate=fe:G.next=fe,je.lastBaseUpdate=J))}if(C!==null){var Ne=j.baseState;O=0,je=fe=J=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?(fe=je=Be,J=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&&(J=Ne),j.baseState=J,j.firstBaseUpdate=fe,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);Wo|=O,a.lanes=O,a.memoizedState=Ne}}function Yb(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 kl={},ms=Zs(kl),Sl=Zs(kl),Nl=Zs(kl);function Uo(a){if(a===kl)throw Error(n(174));return a}function gm(a,l){switch(Ft(Nl,l),Ft(Sl,a),Ft(ms,kl),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Q(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=Q(l,a)}Vt(ms),Ft(ms,l)}function Ha(){Vt(ms),Vt(Sl),Vt(Nl)}function Qb(a){Uo(Nl.current);var l=Uo(ms.current),p=Q(l,a.type);l!==p&&(Ft(Sl,a),Ft(ms,p))}function xm(a){Sl.current===a&&(Vt(ms),Vt(Sl))}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 ym=[];function bm(){for(var a=0;a<ym.length;a++)ym[a]._workInProgressVersionPrimary=null;ym.length=0}var $u=T.ReactCurrentDispatcher,vm=T.ReactCurrentBatchConfig,Vo=0,tn=null,wn=null,Rn=null,Lu=!1,Cl=!1,El=0,ST=0;function Vn(){throw Error(n(321))}function wm(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 jm(a,l,p,x,j,C){if(Vo=C,tn=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,$u.current=a===null||a.memoizedState===null?TT:RT,a=p(x,j),Cl){C=0;do{if(Cl=!1,El=0,25<=C)throw Error(n(301));C+=1,Rn=wn=null,l.updateQueue=null,$u.current=AT,a=p(x,j)}while(Cl)}if($u.current=_u,l=wn!==null&&wn.next!==null,Vo=0,Rn=wn=tn=null,Lu=!1,l)throw Error(n(300));return a}function km(){var a=El!==0;return El=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 Tl(a,l){return typeof l=="function"?l(a):l}function Sm(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,J=null,fe=C;do{var je=fe.lane;if((Vo&je)===je)J!==null&&(J=J.next={lane:0,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null}),x=fe.hasEagerState?fe.eagerState:a(x,fe.action);else{var Ne={lane:je,action:fe.action,hasEagerState:fe.hasEagerState,eagerState:fe.eagerState,next:null};J===null?(G=J=Ne,O=x):J=J.next=Ne,tn.lanes|=je,Wo|=je}fe=fe.next}while(fe!==null&&fe!==C);J===null?O=x:J.next=G,Yr(x,l.memoizedState)||(sr=!0),l.memoizedState=x,l.baseState=O,l.baseQueue=J,p.lastRenderedState=x}if(a=p.interleaved,a!==null){j=a;do C=j.lane,tn.lanes|=C,Wo|=C,j=j.next;while(j!==a)}else j===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function Nm(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 Jb(){}function Xb(a,l){var p=tn,x=Ir(),j=l(),C=!Yr(x.memoizedState,j);if(C&&(x.memoizedState=j,sr=!0),x=x.queue,Cm(tv.bind(null,p,x,a),[a]),x.getSnapshot!==l||C||Rn!==null&&Rn.memoizedState.tag&1){if(p.flags|=2048,Rl(9,ev.bind(null,p,x,j,l),void 0,null),An===null)throw Error(n(349));(Vo&30)!==0||Zb(p,l,j)}return j}function Zb(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 ev(a,l,p,x){l.value=p,l.getSnapshot=x,nv(l)&&rv(a)}function tv(a,l,p){return p(function(){nv(l)&&rv(a)})}function nv(a){var l=a.getSnapshot;a=a.value;try{var p=l();return!Yr(a,p)}catch{return!0}}function rv(a){var l=$s(a,1);l!==null&&es(l,a,1,-1)}function sv(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:Tl,lastRenderedState:a},l.queue=a,a=a.dispatch=ET.bind(null,tn,a),[l.memoizedState,a]}function Rl(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 ov(){return Ir().memoizedState}function Iu(a,l,p,x){var j=hs();tn.flags|=a,j.memoizedState=Rl(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&&wm(x,O.deps)){j.memoizedState=Rl(l,p,C,x);return}}tn.flags|=a,j.memoizedState=Rl(1|l,p,C,x)}function av(a,l){return Iu(8390656,8,a,l)}function Cm(a,l){return Ou(2048,8,a,l)}function iv(a,l){return Ou(4,2,a,l)}function lv(a,l){return Ou(4,4,a,l)}function cv(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 uv(a,l,p){return p=p!=null?p.concat([a]):null,Ou(4,4,cv.bind(null,l,a),p)}function Em(){}function dv(a,l){var p=Ir();l=l===void 0?null:l;var x=p.memoizedState;return x!==null&&l!==null&&wm(l,x[1])?x[0]:(p.memoizedState=[a,l],a)}function fv(a,l){var p=Ir();l=l===void 0?null:l;var x=p.memoizedState;return x!==null&&l!==null&&wm(l,x[1])?x[0]:(a=a(),p.memoizedState=[a,l],a)}function pv(a,l,p){return(Vo&21)===0?(a.baseState&&(a.baseState=!1,sr=!0),a.memoizedState=p):(Yr(p,l)||(p=ol(),tn.lanes|=p,Wo|=p,a.baseState=!0),l)}function NT(a,l){var p=At;At=p!==0&&4>p?p:4,a(!0);var x=vm.transition;vm.transition={};try{a(!1),l()}finally{At=p,vm.transition=x}}function mv(){return Ir().memoizedState}function CT(a,l,p){var x=io(a);if(p={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null},hv(a))gv(l,p);else if(p=Kb(a,l,p,x),p!==null){var j=Jn();es(p,a,x,j),xv(p,l,x)}}function ET(a,l,p){var x=io(a),j={lane:x,action:p,hasEagerState:!1,eagerState:null,next:null};if(hv(a))gv(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 J=l.interleaved;J===null?(j.next=j,mm(l)):(j.next=J.next,J.next=j),l.interleaved=j;return}}catch{}finally{}p=Kb(a,l,j,x),p!==null&&(j=Jn(),es(p,a,x,j),xv(p,l,x))}}function hv(a){var l=a.alternate;return a===tn||l!==null&&l===tn}function gv(a,l){Cl=Lu=!0;var p=a.pending;p===null?l.next=l:(l.next=p.next,p.next=l),a.pending=l}function xv(a,l,p){if((p&4194240)!==0){var x=l.lanes;x&=a.pendingLanes,p|=x,l.lanes=p,il(a,p)}}var _u={readContext:Lr,useCallback:Vn,useContext:Vn,useEffect:Vn,useImperativeHandle:Vn,useInsertionEffect:Vn,useLayoutEffect:Vn,useMemo:Vn,useReducer:Vn,useRef:Vn,useState:Vn,useDebugValue:Vn,useDeferredValue:Vn,useTransition:Vn,useMutableSource:Vn,useSyncExternalStore:Vn,useId:Vn,unstable_isNewReconciler:!1},TT={readContext:Lr,useCallback:function(a,l){return hs().memoizedState=[a,l===void 0?null:l],a},useContext:Lr,useEffect:av,useImperativeHandle:function(a,l,p){return p=p!=null?p.concat([a]):null,Iu(4194308,4,cv.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=CT.bind(null,tn,a),[x.memoizedState,a]},useRef:function(a){var l=hs();return a={current:a},l.memoizedState=a},useState:sv,useDebugValue:Em,useDeferredValue:function(a){return hs().memoizedState=a},useTransition:function(){var a=sv(!1),l=a[0];return a=NT.bind(null,a[1]),hs().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,p){var x=tn,j=hs();if(Qt){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),An===null)throw Error(n(349));(Vo&30)!==0||Zb(x,l,p)}j.memoizedState=p;var C={value:p,getSnapshot:l};return j.queue=C,av(tv.bind(null,x,C,a),[a]),x.flags|=2048,Rl(9,ev.bind(null,x,C,p,l),void 0,null),p},useId:function(){var a=hs(),l=An.identifierPrefix;if(Qt){var p=Ds,x=Ps;p=(x&~(1<<32-zn(x)-1)).toString(32)+p,l=":"+l+"R"+p,p=El++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=ST++,l=":"+l+"r"+p.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},RT={readContext:Lr,useCallback:dv,useContext:Lr,useEffect:Cm,useImperativeHandle:uv,useInsertionEffect:iv,useLayoutEffect:lv,useMemo:fv,useReducer:Sm,useRef:ov,useState:function(){return Sm(Tl)},useDebugValue:Em,useDeferredValue:function(a){var l=Ir();return pv(l,wn.memoizedState,a)},useTransition:function(){var a=Sm(Tl)[0],l=Ir().memoizedState;return[a,l]},useMutableSource:Jb,useSyncExternalStore:Xb,useId:mv,unstable_isNewReconciler:!1},AT={readContext:Lr,useCallback:dv,useContext:Lr,useEffect:Cm,useImperativeHandle:uv,useInsertionEffect:iv,useLayoutEffect:lv,useMemo:fv,useReducer:Nm,useRef:ov,useState:function(){return Nm(Tl)},useDebugValue:Em,useDeferredValue:function(a){var l=Ir();return wn===null?l.memoizedState=a:pv(l,wn.memoizedState,a)},useTransition:function(){var a=Nm(Tl)[0],l=Ir().memoizedState;return[a,l]},useMutableSource:Jb,useSyncExternalStore:Xb,useId:mv,unstable_isNewReconciler:!1};function Jr(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 Tm(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)?mt(a)===a:!1},enqueueSetState:function(a,l,p){a=a._reactInternals;var x=Jn(),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=Jn(),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=Jn(),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 yv(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?!hl(p,x)||!hl(j,C):!0}function bv(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 vv(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 Rm(a,l,p,x){var j=a.stateNode;j.props=p,j.state=a.memoizedState,j.refs={},hm(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"&&(Tm(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+=ye(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 Am(a,l,p){return{value:a,source:null,stack:p??null,digest:l??null}}function Pm(a,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var PT=typeof WeakMap=="function"?WeakMap:Map;function wv(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,Km=x),Pm(a,l)},p}function jv(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(){Pm(a,l)}}var C=a.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(p.callback=function(){Pm(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 kv(a,l,p){var x=a.pingCache;if(x===null){x=a.pingCache=new PT;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=HT.bind(null,a,l,p),l.then(a,a))}function Sv(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 Nv(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 DT=T.ReactCurrentOwner,sr=!1;function Qn(a,l,p,x){l.child=a===null?Hb(l,null,p,x):Ua(l,a.child,p,x)}function Cv(a,l,p,x,j){p=p.render;var C=l.ref;return Wa(l,j),x=jm(a,l,p,x,C,j),p=km(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~j,Is(a,l,j)):(Qt&&p&&om(l),l.flags|=1,Qn(a,l,x,j),l.child)}function Ev(a,l,p,x,j){if(a===null){var C=p.type;return typeof C=="function"&&!Zm(C)&&C.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=C,Tv(a,l,C,x,j)):(a=Ju(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:hl,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 Tv(a,l,p,x,j){if(a!==null){var C=a.memoizedProps;if(hl(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 Dm(a,l,p,x,j)}function Rv(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 Qn(a,l,j,p),l.child}function Av(a,l){var p=l.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function Dm(a,l,p,x,j){var C=rr(p)?Mo:Un.current;return C=Ma(l,C),Wa(l,j),p=jm(a,l,p,x,C,j),x=km(),a!==null&&!sr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~j,Is(a,l,j)):(Qt&&x&&om(l),l.flags|=1,Qn(a,l,p,j),l.child)}function Pv(a,l,p,x,j){if(rr(p)){var C=!0;ju(l)}else C=!1;if(Wa(l,j),l.stateNode===null)zu(a,l),bv(l,p,x),Rm(l,p,x,j),x=!0;else if(a===null){var O=l.stateNode,G=l.memoizedProps;O.props=G;var J=O.context,fe=p.contextType;typeof fe=="object"&&fe!==null?fe=Lr(fe):(fe=rr(p)?Mo:Un.current,fe=Ma(l,fe));var je=p.getDerivedStateFromProps,Ne=typeof je=="function"||typeof O.getSnapshotBeforeUpdate=="function";Ne||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==x||J!==fe)&&vv(l,O,x,fe),no=!1;var we=l.memoizedState;O.state=we,Pu(l,x,O,j),J=l.memoizedState,G!==x||we!==J||nr.current||no?(typeof je=="function"&&(Tm(l,p,je,x),J=l.memoizedState),(G=no||yv(l,p,G,x,we,J,fe))?(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=J),O.props=x,O.state=J,O.context=fe,x=G):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),x=!1)}else{O=l.stateNode,qb(a,l),G=l.memoizedProps,fe=l.type===l.elementType?G:Jr(l.type,G),O.props=fe,Ne=l.pendingProps,we=O.context,J=p.contextType,typeof J=="object"&&J!==null?J=Lr(J):(J=rr(p)?Mo:Un.current,J=Ma(l,J));var Be=p.getDerivedStateFromProps;(je=typeof Be=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(G!==Ne||we!==J)&&vv(l,O,x,J),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"&&(Tm(l,p,Be,x),Ke=l.memoizedState),(fe=no||yv(l,p,fe,x,we,Ke,J)||!1)?(je||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(x,Ke,J),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(x,Ke,J)),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=J,x=fe):(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 $m(a,l,p,x,C,j)}function $m(a,l,p,x,j,C){Av(a,l);var O=(l.flags&128)!==0;if(!x&&!O)return j&&Ob(l,p,!1),Is(a,l,C);x=l.stateNode,DT.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)):Qn(a,l,G,C),l.memoizedState=x.state,j&&Ob(l,p,!0),l.child}function Dv(a){var l=a.stateNode;l.pendingContext?Lb(a,l.pendingContext,l.pendingContext!==l.context):l.context&&Lb(a,l.context,!1),gm(a,l.containerInfo)}function $v(a,l,p,x,j){return Ba(),cm(j),l.flags|=256,Qn(a,l,p,x),l.child}var Lm={dehydrated:null,treeContext:null,retryLane:0};function Im(a){return{baseLanes:a,cachePool:null,transitions:null}}function Lv(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 lm(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=Im(p),l.memoizedState=Lm,a):Om(l,O));if(j=a.memoizedState,j!==null&&(G=j.dehydrated,G!==null))return $T(a,l,O,x,G,j,p);if(C){C=x.fallback,O=l.mode,j=a.child,G=j.sibling;var J={mode:"hidden",children:x.children};return(O&1)===0&&l.child!==j?(x=l.child,x.childLanes=0,x.pendingProps=J,l.deletions=null):(x=co(j,J),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?Im(p):{baseLanes:O.baseLanes|p,cachePool:null,transitions:O.transitions},C.memoizedState=O,C.childLanes=a.childLanes&~p,l.memoizedState=Lm,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 Om(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&&cm(x),Ua(l,a.child,null,p),a=Om(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function $T(a,l,p,x,j,C,O){if(p)return l.flags&256?(l.flags&=-257,x=Am(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=Im(O),l.memoizedState=Lm,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=Am(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 Xm(),x=Am(Error(n(421))),Fu(a,l,O,x)}return j.data==="$?"?(l.flags|=128,l.child=a.child,l=KT.bind(null,a),j._reactRetry=l,null):(a=C.treeContext,yr=Xs(j.nextSibling),xr=l,Qt=!0,Qr=null,a!==null&&(Dr[$r++]=Ps,Dr[$r++]=Ds,Dr[$r++]=Fo,Ps=a.id,Ds=a.overflow,Fo=l),l=Om(l,x.children),l.flags|=4096,l)}function Iv(a,l,p){a.lanes|=l;var x=a.alternate;x!==null&&(x.lanes|=l),pm(a.return,l,p)}function _m(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 Ov(a,l,p){var x=l.pendingProps,j=x.revealOrder,C=x.tail;if(Qn(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&&Iv(a,p,l);else if(a.tag===19)Iv(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),_m(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}_m(l,!0,p,null,C);break;case"together":_m(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),Wo|=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 LT(a,l,p){switch(l.tag){case 3:Dv(l),Ba();break;case 5:Qb(l);break;case 1:rr(l.type)&&ju(l);break;case 4:gm(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?Lv(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 Ov(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,Rv(a,l,p)}return Is(a,l,p)}var _v,Mm,Mv,Fv;_v=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}},Mm=function(){},Mv=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=Qe(a,j),x=Qe(a,x),C=[];break;default:typeof j.onClick!="function"&&typeof x.onClick=="function"&&(a.onclick=bu)}Ue(p,x);var O;p=null;for(fe in j)if(!x.hasOwnProperty(fe)&&j.hasOwnProperty(fe)&&j[fe]!=null)if(fe==="style"){var G=j[fe];for(O in G)G.hasOwnProperty(O)&&(p||(p={}),p[O]="")}else fe!=="dangerouslySetInnerHTML"&&fe!=="children"&&fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&fe!=="autoFocus"&&(o.hasOwnProperty(fe)?C||(C=[]):(C=C||[]).push(fe,null));for(fe in x){var J=x[fe];if(G=j!=null?j[fe]:void 0,x.hasOwnProperty(fe)&&J!==G&&(J!=null||G!=null))if(fe==="style")if(G){for(O in G)!G.hasOwnProperty(O)||J&&J.hasOwnProperty(O)||(p||(p={}),p[O]="");for(O in J)J.hasOwnProperty(O)&&G[O]!==J[O]&&(p||(p={}),p[O]=J[O])}else p||(C||(C=[]),C.push(fe,p)),p=J;else fe==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,G=G?G.__html:void 0,J!=null&&G!==J&&(C=C||[]).push(fe,J)):fe==="children"?typeof J!="string"&&typeof J!="number"||(C=C||[]).push(fe,""+J):fe!=="suppressContentEditableWarning"&&fe!=="suppressHydrationWarning"&&(o.hasOwnProperty(fe)?(J!=null&&fe==="onScroll"&&Ut("scroll",a),C||G===J||(C=[])):(C=C||[]).push(fe,J))}p&&(C=C||[]).push("style",p);var fe=C;(l.updateQueue=fe)&&(l.flags|=4)}},Fv=function(a,l,p,x){p!==x&&(l.flags|=4)};function Al(a,l){if(!Qt)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 Wn(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 IT(a,l,p){var x=l.pendingProps;switch(am(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(l),null;case 1:return rr(l.type)&&wu(),Wn(l),null;case 3:return x=l.stateNode,Ha(),Vt(nr),Vt(Un),bm(),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,Qr!==null&&(Ym(Qr),Qr=null))),Mm(a,l),Wn(l),null;case 5:xm(l);var j=Uo(Nl.current);if(p=l.type,a!==null&&l.stateNode!=null)Mv(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 Wn(l),null}if(a=Uo(ms.current),Cu(l)){x=l.stateNode,p=l.type;var C=l.memoizedProps;switch(x[ps]=l,x[vl]=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<xl.length;j++)Ut(xl[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":Je(x),Ie(x,C,!0);break;case"textarea":Je(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=ie(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[vl]=x,_v(a,l,!1,!1),l.stateNode=a;e:{switch(O=le(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<xl.length;j++)Ut(xl[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=Qe(a,x),Ut("invalid",a);break;default:j=x}Ue(p,j),G=j;for(C in G)if(G.hasOwnProperty(C)){var J=G[C];C==="style"?de(a,J):C==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&re(a,J)):C==="children"?typeof J=="string"?(p!=="textarea"||J!=="")&&xe(a,J):typeof J=="number"&&xe(a,""+J):C!=="suppressContentEditableWarning"&&C!=="suppressHydrationWarning"&&C!=="autoFocus"&&(o.hasOwnProperty(C)?J!=null&&C==="onScroll"&&Ut("scroll",a):J!=null&&S(a,C,J,O))}switch(p){case"input":Je(a),Ie(a,x,!1);break;case"textarea":Je(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 Wn(l),null;case 6:if(a&&l.stateNode!=null)Fv(a,l,a.memoizedProps,x);else{if(typeof x!="string"&&l.stateNode===null)throw Error(n(166));if(p=Uo(Nl.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 Wn(l),null;case 13:if(Vt(en),x=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Qt&&yr!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Ub(),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;Wn(l),C=!1}else Qr!==null&&(Ym(Qr),Qr=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):Xm())),l.updateQueue!==null&&(l.flags|=4),Wn(l),null);case 4:return Ha(),Mm(a,l),a===null&&yl(l.stateNode.containerInfo),Wn(l),null;case 10:return fm(l.type._context),Wn(l),null;case 17:return rr(l.type)&&wu(),Wn(l),null;case 19:if(Vt(en),C=l.memoizedState,C===null)return Wn(l),null;if(x=(l.flags&128)!==0,O=C.rendering,O===null)if(x)Al(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,Al(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,Al(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),Al(C,!0),C.tail===null&&C.tailMode==="hidden"&&!O.alternate&&!Qt)return Wn(l),null}else 2*Zt()-C.renderingStartTime>Ya&&p!==1073741824&&(l.flags|=128,x=!0,Al(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):(Wn(l),null);case 22:case 23:return Jm(),x=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==x&&(l.flags|=8192),x&&(l.mode&1)!==0?(br&1073741824)!==0&&(Wn(l),l.subtreeFlags&6&&(l.flags|=8192)):Wn(l),null;case 24:return null;case 25:return null}throw Error(n(156,l.tag))}function OT(a,l){switch(am(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(),Vt(nr),Vt(Un),bm(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return xm(l),null;case 13:if(Vt(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 Vt(en),null;case 4:return Ha(),null;case 10:return fm(l.type._context),null;case 22:case 23:return Jm(),null;case 24:return null;default:return null}}var Bu=!1,Hn=!1,_T=typeof WeakSet=="function"?WeakSet:Set,We=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 Fm(a,l,p){try{p()}catch(x){sn(a,l,x)}}var zv=!1;function MT(a,l){if(Jp=Oo,a=yb(),Vp(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,J=-1,fe=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||(J=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&&++fe===j&&(G=O),we===C&&++je===x&&(J=O),(Be=Ne.nextSibling)!==null)break;Ne=we,we=Ne.parentNode}Ne=Be}p=G===-1||J===-1?null:{start:G,end:J}}else p=null}p=p||{start:0,end:0}}else p=null;for(Xp={focusedElem:a,selectionRange:p},Oo=!1,We=l;We!==null;)if(l=We,a=l.child,(l.subtreeFlags&1028)!==0&&a!==null)a.return=l,We=a;else for(;We!==null;){l=We;try{var 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,ae=l.stateNode,ne=ae.getSnapshotBeforeUpdate(l.elementType===l.type?Ge:Jr(l.type,Ge),cn);ae.__reactInternalSnapshotBeforeUpdate=ne}break;case 3:var ce=l.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(De){sn(l,l.return,De)}if(a=l.sibling,a!==null){a.return=l.return,We=a;break}We=l.return}return Ke=zv,zv=!1,Ke}function Pl(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&&Fm(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 zm(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 Bv(a){var l=a.alternate;l!==null&&(a.alternate=null,Bv(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[ps],delete l[vl],delete l[nm],delete l[vT],delete l[wT])),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 Uv(a){return a.tag===5||a.tag===3||a.tag===4}function Vv(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Uv(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 Bm(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(Bm(a,l,p),a=a.sibling;a!==null;)Bm(a,l,p),a=a.sibling}function Um(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(Um(a,l,p),a=a.sibling;a!==null;)Um(a,l,p),a=a.sibling}var In=null,Xr=!1;function so(a,l,p){for(p=p.child;p!==null;)Wv(a,l,p),p=p.sibling}function Wv(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?tm(a.parentNode,p):a.nodeType===1&&tm(a,p),fn(a)):tm(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)&&Fm(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 Hv(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new _T),l.forEach(function(x){var j=qT.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));Wv(C,O,j),In=null,Xr=!1;var J=j.alternate;J!==null&&(J.return=null),j.return=null}catch(fe){sn(j,l,fe)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)Kv(l,a),l=l.sibling}function Kv(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{Pl(3,a,a.return),Uu(3,a)}catch(Ge){sn(a,a.return,Ge)}try{Pl(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{xe(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,J=a.updateQueue;if(a.updateQueue=null,J!==null)try{G==="input"&&C.type==="radio"&&C.name!=null&&_e(j,C),le(G,O);var fe=le(G,C);for(O=0;O<J.length;O+=2){var je=J[O],Ne=J[O+1];je==="style"?de(j,Ne):je==="dangerouslySetInnerHTML"?re(j,Ne):je==="children"?xe(j,Ne):S(j,je,Ne,fe)}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[vl]=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||(Hm=Zt())),x&4&&Hv(a);break;case 22:if(je=p!==null&&p.memoizedState!==null,a.mode&1?(Hn=(fe=Hn)||je,Zr(l,a),Hn=fe):Zr(l,a),gs(a),x&8192){if(fe=a.memoizedState!==null,(a.stateNode.isHidden=fe)&&!je&&(a.mode&1)!==0)for(We=a,je=a.child;je!==null;){for(Ne=We=je;We!==null;){switch(we=We,Be=we.child,we.tag){case 0:case 11:case 14:case 15:Pl(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){Yv(Ne);continue}}Be!==null?(Be.return=we,We=Be):Yv(Ne)}je=je.sibling}e:for(je=null,Ne=a;;){if(Ne.tag===5){if(je===null){je=Ne;try{j=Ne.stateNode,fe?(C=j.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none"):(G=Ne.stateNode,J=Ne.memoizedProps.style,O=J!=null&&J.hasOwnProperty("display")?J.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=fe?"":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&&Hv(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(Uv(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&&(xe(j,""),x.flags&=-33);var C=Vv(a);Um(a,C,j);break;case 3:case 4:var O=x.stateNode.containerInfo,G=Vv(a);Bm(a,G,O);break;default:throw Error(n(161))}}catch(J){sn(a,a.return,J)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function FT(a,l,p){We=a,qv(a)}function qv(a,l,p){for(var x=(a.mode&1)!==0;We!==null;){var j=We,C=j.child;if(j.tag===22&&x){var O=j.memoizedState!==null||Bu;if(!O){var G=j.alternate,J=G!==null&&G.memoizedState!==null||Hn;G=Bu;var fe=Hn;if(Bu=O,(Hn=J)&&!fe)for(We=j;We!==null;)O=We,J=O.child,O.tag===22&&O.memoizedState!==null?Qv(j):J!==null?(J.return=O,We=J):Qv(j);for(;C!==null;)We=C,qv(C),C=C.sibling;We=j,Bu=G,Hn=fe}Gv(a)}else(j.subtreeFlags&8772)!==0&&C!==null?(C.return=j,We=C):Gv(a)}}function Gv(a){for(;We!==null;){var l=We;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:Jr(l.type,p.memoizedProps);x.componentDidUpdate(j,p.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var C=l.updateQueue;C!==null&&Yb(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}Yb(l,O,p)}break;case 5:var G=l.stateNode;if(p===null&&l.flags&4){p=G;var J=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":J.autoFocus&&p.focus();break;case"img":J.src&&(p.src=J.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var fe=l.alternate;if(fe!==null){var je=fe.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&&zm(l)}catch(we){sn(l,l.return,we)}}if(l===a){We=null;break}if(p=l.sibling,p!==null){p.return=l.return,We=p;break}We=l.return}}function Yv(a){for(;We!==null;){var l=We;if(l===a){We=null;break}var p=l.sibling;if(p!==null){p.return=l.return,We=p;break}We=l.return}}function Qv(a){for(;We!==null;){var l=We;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{Uu(4,l)}catch(J){sn(l,p,J)}break;case 1:var x=l.stateNode;if(typeof x.componentDidMount=="function"){var j=l.return;try{x.componentDidMount()}catch(J){sn(l,j,J)}}var C=l.return;try{zm(l)}catch(J){sn(l,C,J)}break;case 5:var O=l.return;try{zm(l)}catch(J){sn(l,O,J)}}}catch(J){sn(l,l.return,J)}if(l===a){We=null;break}var G=l.sibling;if(G!==null){G.return=l.return,We=G;break}We=l.return}}var zT=Math.ceil,Vu=T.ReactCurrentDispatcher,Vm=T.ReactCurrentOwner,Or=T.ReactCurrentBatchConfig,kt=0,An=null,mn=null,On=0,br=0,Ga=Zs(0),jn=0,Dl=null,Wo=0,Wu=0,Wm=0,$l=null,or=null,Hm=0,Ya=1/0,Os=null,Hu=!1,Km=null,oo=null,Ku=!1,ao=null,qu=0,Ll=0,qm=null,Gu=-1,Yu=0;function Jn(){return(kt&6)!==0?Zt():Gu!==-1?Gu:Gu=Zt()}function io(a){return(a.mode&1)===0?1:(kt&2)!==0&&On!==0?On&-On:kT.transition!==null?(Yu===0&&(Yu=ol()),Yu):(a=At,a!==0||(a=window.event,a=a===void 0?16:Xy(a.type)),a)}function es(a,l,p,x){if(50<Ll)throw Ll=0,qm=null,Error(n(185));Gr(a,p,x),((kt&2)===0||a!==An)&&(a===An&&((kt&2)===0&&(Wu|=p),jn===4&&lo(a,On)),ar(a,x),p===1&&kt===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?jT(Xv.bind(null,a)):_b(Xv.bind(null,a)),yT(function(){(kt&6)===0&&to()}),p=null;else{switch(ll(x)){case 1:p=sl;break;case 4:p=nu;break;case 16:p=qs;break;case 536870912:p=ru;break;default:p=qs}p=aw(p,Jv.bind(null,a))}a.callbackPriority=l,a.callbackNode=p}}function Jv(a,l){if(Gu=-1,Yu=0,(kt&6)!==0)throw Error(n(327));var p=a.callbackNode;if(Qa()&&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=Qu(a,x);else{l=x;var j=kt;kt|=2;var C=ew();(An!==a||On!==l)&&(Os=null,Ya=Zt()+500,Ko(a,l));do try{VT();break}catch(G){Zv(a,G)}while(!0);dm(),Vu.current=C,kt=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=Gm(a,j))),l===1)throw p=Dl,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&&!BT(j)&&(l=Qu(a,x),l===2&&(C=$o(a),C!==0&&(x=C,l=Gm(a,C))),l===1))throw p=Dl,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=Hm+500-Zt(),10<l)){if(Do(a,0)!==0)break;if(j=a.suspendedLanes,(j&x)!==x){Jn(),a.pingedLanes|=a.suspendedLanes&j;break}a.timeoutHandle=em(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*zT(x/1960))-x,10<x){a.timeoutHandle=em(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?Jv.bind(null,a):null}function Gm(a,l){var p=$l;return a.current.memoizedState.isDehydrated&&(Ko(a,l).flags|=256),a=Qu(a,l),a!==2&&(l=or,or=p,l!==null&&Ym(l)),a}function Ym(a){or===null?or=a:or.push.apply(or,a)}function BT(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&=~Wm,l&=~Wu,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 Xv(a){if((kt&6)!==0)throw Error(n(327));Qa();var l=Do(a,0);if((l&1)===0)return ar(a,Zt()),null;var p=Qu(a,l);if(a.tag!==0&&p===2){var x=$o(a);x!==0&&(l=x,p=Gm(a,x))}if(p===1)throw p=Dl,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 Qm(a,l){var p=kt;kt|=1;try{return a(l)}finally{kt=p,kt===0&&(Ya=Zt()+500,ku&&to())}}function Ho(a){ao!==null&&ao.tag===0&&(kt&6)===0&&Qa();var l=kt;kt|=1;var p=Or.transition,x=At;try{if(Or.transition=null,At=1,a)return a()}finally{At=x,Or.transition=p,kt=l,(kt&6)===0&&to()}}function Jm(){br=Ga.current,Vt(Ga)}function Ko(a,l){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==-1&&(a.timeoutHandle=-1,xT(p)),mn!==null)for(p=mn.return;p!==null;){var x=p;switch(am(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&wu();break;case 3:Ha(),Vt(nr),Vt(Un),bm();break;case 5:xm(x);break;case 4:Ha();break;case 13:Vt(en);break;case 19:Vt(en);break;case 10:fm(x.type._context);break;case 22:case 23:Jm()}p=p.return}if(An=a,mn=a=co(a.current,null),On=br=l,jn=0,Dl=null,Wm=Wu=Wo=0,or=$l=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 Zv(a,l){do{var p=mn;try{if(dm(),$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(Vo=0,Rn=wn=tn=null,Cl=!1,El=0,Vm.current=null,p===null||p.return===null){jn=1,Dl=l,mn=null;break}e:{var C=a,O=p.return,G=p,J=l;if(l=On,G.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var fe=J,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=Sv(O);if(Be!==null){Be.flags&=-257,Nv(Be,O,G,C,l),Be.mode&1&&kv(C,fe,l),l=Be,J=fe;var Ke=l.updateQueue;if(Ke===null){var Ge=new Set;Ge.add(J),l.updateQueue=Ge}else Ke.add(J);break e}else{if((l&1)===0){kv(C,fe,l),Xm();break e}J=Error(n(426))}}else if(Qt&&G.mode&1){var cn=Sv(O);if(cn!==null){(cn.flags&65536)===0&&(cn.flags|=256),Nv(cn,O,G,C,l),cm(Ka(J,G));break e}}C=J=Ka(J,G),jn!==4&&(jn=2),$l===null?$l=[C]:$l.push(C),C=O;do{switch(C.tag){case 3:C.flags|=65536,l&=-l,C.lanes|=l;var ae=wv(C,J,l);Gb(C,ae);break e;case 1:G=J;var ne=C.type,ce=C.stateNode;if((C.flags&128)===0&&(typeof ne.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(oo===null||!oo.has(ce)))){C.flags|=65536,l&=-l,C.lanes|=l;var De=jv(C,G,l);Gb(C,De);break e}}C=C.return}while(C!==null)}nw(p)}catch(Xe){l=Xe,mn===p&&p!==null&&(mn=p=p.return);continue}break}while(!0)}function ew(){var a=Vu.current;return Vu.current=_u,a===null?_u:a}function Xm(){(jn===0||jn===3||jn===2)&&(jn=4),An===null||(Wo&268435455)===0&&(Wu&268435455)===0||lo(An,On)}function Qu(a,l){var p=kt;kt|=2;var x=ew();(An!==a||On!==l)&&(Os=null,Ko(a,l));do try{UT();break}catch(j){Zv(a,j)}while(!0);if(dm(),kt=p,Vu.current=x,mn!==null)throw Error(n(261));return An=null,On=0,jn}function UT(){for(;mn!==null;)tw(mn)}function VT(){for(;mn!==null&&!Ep();)tw(mn)}function tw(a){var l=ow(a.alternate,a,br);a.memoizedProps=a.pendingProps,l===null?nw(a):mn=l,Vm.current=null}function nw(a){var l=a;do{var p=l.alternate;if(a=l.return,(l.flags&32768)===0){if(p=IT(p,l,br),p!==null){mn=p;return}}else{if(p=OT(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,WT(a,l,p,x)}finally{Or.transition=j,At=x}return null}function WT(a,l,p,x){do Qa();while(ao!==null);if((kt&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(al(a,C),a===An&&(mn=An=null,On=0),(p.subtreeFlags&2064)===0&&(p.flags&2064)===0||Ku||(Ku=!0,aw(qs,function(){return Qa(),null})),C=(p.flags&15990)!==0,(p.subtreeFlags&15990)!==0||C){C=Or.transition,Or.transition=null;var O=At;At=1;var G=kt;kt|=4,Vm.current=null,MT(a,p),Kv(p,a),uT(Xp),Oo=!!Jp,Xp=Jp=null,a.current=p,FT(p),Tp(),kt=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=Km,Km=null,a;return(qu&1)!==0&&a.tag!==0&&Qa(),C=a.pendingLanes,(C&1)!==0?a===qm?Ll++:(Ll=0,qm=a):Ll=0,to(),null}function Qa(){if(ao!==null){var a=ll(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,(kt&6)!==0)throw Error(n(331));var j=kt;for(kt|=4,We=a.current;We!==null;){var C=We,O=C.child;if((We.flags&16)!==0){var G=C.deletions;if(G!==null){for(var J=0;J<G.length;J++){var fe=G[J];for(We=fe;We!==null;){var je=We;switch(je.tag){case 0:case 11:case 15:Pl(8,je,C)}var Ne=je.child;if(Ne!==null)Ne.return=je,We=Ne;else for(;We!==null;){je=We;var we=je.sibling,Be=je.return;if(Bv(je),je===fe){We=null;break}if(we!==null){we.return=Be,We=we;break}We=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)}}We=C}}if((C.subtreeFlags&2064)!==0&&O!==null)O.return=C,We=O;else e:for(;We!==null;){if(C=We,(C.flags&2048)!==0)switch(C.tag){case 0:case 11:case 15:Pl(9,C,C.return)}var ae=C.sibling;if(ae!==null){ae.return=C.return,We=ae;break e}We=C.return}}var ne=a.current;for(We=ne;We!==null;){O=We;var ce=O.child;if((O.subtreeFlags&2064)!==0&&ce!==null)ce.return=O,We=ce;else e:for(O=ne;We!==null;){if(G=We,(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){We=null;break e}var De=G.sibling;if(De!==null){De.return=G.return,We=De;break e}We=G.return}}if(kt=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 rw(a,l,p){l=Ka(p,l),l=wv(a,l,1),a=ro(a,l,1),l=Jn(),a!==null&&(Gr(a,1,l),ar(a,l))}function sn(a,l,p){if(a.tag===3)rw(a,a,p);else for(;l!==null;){if(l.tag===3){rw(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=jv(l,a,1),l=ro(l,a,1),a=Jn(),l!==null&&(Gr(l,1,a),ar(l,a));break}}l=l.return}}function HT(a,l,p){var x=a.pingCache;x!==null&&x.delete(l),l=Jn(),a.pingedLanes|=a.suspendedLanes&p,An===a&&(On&p)===p&&(jn===4||jn===3&&(On&130023424)===On&&500>Zt()-Hm?Ko(a,0):Wm|=p),ar(a,l)}function sw(a,l){l===0&&((a.mode&1)===0?l=1:(l=Na,Na<<=1,(Na&130023424)===0&&(Na=4194304)));var p=Jn();a=$s(a,l),a!==null&&(Gr(a,l,p),ar(a,p))}function KT(a){var l=a.memoizedState,p=0;l!==null&&(p=l.retryLane),sw(a,p)}function qT(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),sw(a,p)}var ow;ow=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,LT(a,l,p);sr=(a.flags&131072)!==0}else sr=!1,Qt&&(l.flags&1048576)!==0&&Mb(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);Wa(l,p),j=jm(null,l,x,a,j,p);var C=km();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,hm(l),j.updater=Mu,l.stateNode=j,j._reactInternals=l,Rm(l,x,a,p),l=$m(null,l,x,!0,C,p)):(l.tag=0,Qt&&C&&om(l),Qn(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=YT(x),a=Jr(x,a),j){case 0:l=Dm(null,l,x,a,p);break e;case 1:l=Pv(null,l,x,a,p);break e;case 11:l=Cv(null,l,x,a,p);break e;case 14:l=Ev(null,l,x,Jr(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:Jr(x,j),Dm(a,l,x,j,p);case 1:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Jr(x,j),Pv(a,l,x,j,p);case 3:e:{if(Dv(l),a===null)throw Error(n(387));x=l.pendingProps,C=l.memoizedState,j=C.element,qb(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=$v(a,l,x,p,j);break e}else if(x!==j){j=Ka(Error(n(424)),l),l=$v(a,l,x,p,j);break e}else for(yr=Xs(l.stateNode.containerInfo.firstChild),xr=l,Qt=!0,Qr=null,p=Hb(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}Qn(a,l,x,p)}l=l.child}return l;case 5:return Qb(l),a===null&&lm(l),x=l.type,j=l.pendingProps,C=a!==null?a.memoizedProps:null,O=j.children,Zp(x,j)?O=null:C!==null&&Zp(x,C)&&(l.flags|=32),Av(a,l),Qn(a,l,O,p),l.child;case 6:return a===null&&lm(l),null;case 13:return Lv(a,l,p);case 4:return gm(l,l.stateNode.containerInfo),x=l.pendingProps,a===null?l.child=Ua(l,null,x,p):Qn(a,l,x,p),l.child;case 11:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Jr(x,j),Cv(a,l,x,j,p);case 7:return Qn(a,l,l.pendingProps,p),l.child;case 8:return Qn(a,l,l.pendingProps.children,p),l.child;case 12:return Qn(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 J=G.firstContext;J!==null;){if(J.context===x){if(C.tag===1){J=Ls(-1,p&-p),J.tag=2;var fe=C.updateQueue;if(fe!==null){fe=fe.shared;var je=fe.pending;je===null?J.next=J:(J.next=je.next,je.next=J),fe.pending=J}}C.lanes|=p,J=C.alternate,J!==null&&(J.lanes|=p),pm(C.return,p,l),G.lanes|=p;break}J=J.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),pm(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}Qn(a,l,j.children,p),l=l.child}return l;case 9:return j=l.type,x=l.pendingProps.children,Wa(l,p),j=Lr(j),x=x(j),l.flags|=1,Qn(a,l,x,p),l.child;case 14:return x=l.type,j=Jr(x,l.pendingProps),j=Jr(x.type,j),Ev(a,l,x,j,p);case 15:return Tv(a,l,l.type,l.pendingProps,p);case 17:return x=l.type,j=l.pendingProps,j=l.elementType===x?j:Jr(x,j),zu(a,l),l.tag=1,rr(x)?(a=!0,ju(l)):a=!1,Wa(l,p),bv(l,x,j),Rm(l,x,j,p),$m(null,l,x,!0,a,p);case 19:return Ov(a,l,p);case 22:return Rv(a,l,p)}throw Error(n(156,l.tag))};function aw(a,l){return eu(a,l)}function GT(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 GT(a,l,p,x)}function Zm(a){return a=a.prototype,!(!a||!a.isReactComponent)}function YT(a){if(typeof a=="function")return Zm(a)?1:0;if(a!=null){if(a=a.$$typeof,a===W)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 Ju(a,l,p,x,j,C){var O=2;if(x=a,typeof a=="function")Zm(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 W: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 eh(a,l,p){return a=_r(6,a,null,l),a.lanes=p,a}function th(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 QT(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 nh(a,l,p,x,j,C,O,G,J){return a=new QT(a,l,p,G,J),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},hm(C),a}function JT(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 iw(a){if(!a)return eo;a=a._reactInternals;e:{if(mt(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 Ib(a,p,l)}return l}function lw(a,l,p,x,j,C,O,G,J){return a=nh(p,x,!0,a,j,C,O,G,J),a.context=iw(null),p=a.current,x=Jn(),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=Jn(),O=io(j);return p=iw(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 cw(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<l?p:l}}function rh(a,l){cw(a,l),(a=a.alternate)&&cw(a,l)}function XT(){return null}var uw=typeof reportError=="function"?reportError:function(a){console.error(a)};function sh(a){this._internalRoot=a}td.prototype.render=sh.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Zu(a,l,null,null)},td.prototype.unmount=sh.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 oh(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 dw(){}function ZT(a,l,p,x,j){if(j){if(typeof x=="function"){var C=x;x=function(){var fe=ed(O);C.call(fe)}}var O=lw(l,x,a,0,null,!1,!1,"",dw);return a._reactRootContainer=O,a[Rs]=O.current,yl(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 fe=ed(J);G.call(fe)}}var J=nh(a,0,!1,null,null,!1,!1,"",dw);return a._reactRootContainer=J,a[Rs]=J.current,yl(a.nodeType===8?a.parentNode:a),Ho(function(){Zu(l,J,p,x)}),J}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 J=ed(O);G.call(J)}}Zu(l,O,a,j)}else O=ZT(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&&(il(l,p|1),ar(l,Zt()),(kt&6)===0&&(Ya=Zt()+500,to()))}break;case 13:Ho(function(){var x=$s(a,1);if(x!==null){var j=Jn();es(x,a,1,j)}}),rh(a,1)}},Ea=function(a){if(a.tag===13){var l=$s(a,134217728);if(l!==null){var p=Jn();es(l,a,134217728,p)}rh(a,134217728)}},Ys=function(a){if(a.tag===13){var l=io(a),p=$s(a,l);if(p!==null){var x=Jn();es(p,a,l,x)}rh(a,l)}},Ta=function(){return At},au=function(a,l){var p=At;try{return At=a,l()}finally{At=p}},jt=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=Qm,dn=Ho;var eR={usingClientEntryPoint:!1,Events:[wl,Oa,vu,qe,Lt,Qm]},Il={findFiberByHostInstance:_o,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tR={bundleType:Il.bundleType,version:Il.version,rendererPackageName:Il.rendererPackageName,rendererConfig:Il.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:Il.findFiberByHostInstance||XT,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(tR),an=sd}catch{}}return ir.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eR,ir.createPortal=function(a,l){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!oh(l))throw Error(n(200));return JT(a,l,null,p)},ir.createRoot=function(a,l){if(!oh(a))throw Error(n(299));var p=!1,x="",j=uw;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(j=l.onRecoverableError)),l=nh(a,1,!1,null,null,p,!1,x,j),a[Rs]=l.current,yl(a.nodeType===8?a.parentNode:a),new sh(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(!oh(a))throw Error(n(405));var x=p!=null&&p.hydratedSources||null,j=!1,C="",O=uw;if(p!=null&&(p.unstable_strictMode===!0&&(j=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onRecoverableError!==void 0&&(O=p.onRecoverableError)),l=lw(l,null,a,1,p??null,j,!1,C,O),a[Rs]=l.current,yl(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=Qm,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 bw;function vk(){if(bw)return ch.exports;bw=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(),ch.exports=dR(),ch.exports}var vw;function fR(){if(vw)return od;vw=1;var e=vk();return od.createRoot=e.createRoot,od.hydrateRoot=e.hydrateRoot,od}var pR=fR();/**
|
|
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 ww="popstate";function jw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function mR(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 pg("",{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:hc(o)}return gR(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 hR(){return Math.random().toString(36).substring(2,10)}function kw(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 pg(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||hR(),unstable_mask:o}}function hc({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 gR(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=jw(v)?v:pg(w.location,v,k);m=h()+1;let S=kw(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=jw(v)?v:pg(w.location,v,k);m=h();let S=kw(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 xR(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(ww,g),d=v,()=>{o.removeEventListener(ww,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 xR(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:hc(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function wk(e,t,n="/"){return yR(e,t,n,!1)}function yR(e,t,n,s){let o=typeof t=="string"?Mi(t):t,i=Bs(o.pathname||"/",n);if(i==null)return null;let c=jk(e);bR(c);let u=null;for(let d=0;u==null&&d<c.length;++d){let m=AR(i);u=TR(c[d],m,s)}return u}function jk(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}".`),jk(c.children,t,y,g,d)),!(c.path==null&&!c.index)&&t.push({path:g,score:CR(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 kk(c.path))i(c,u,!0,m)}),t}function kk(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=kk(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 bR(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:ER(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var vR=/^:[\w-]+$/,wR=3,jR=2,kR=1,SR=10,NR=-2,Sw=e=>e==="*";function CR(e,t){let n=e.split("/"),s=n.length;return n.some(Sw)&&(s+=NR),t&&(s+=jR),n.filter(o=>!Sw(o)).reduce((o,i)=>o+(vR.test(i)?wR:i===""?kR:SR),s)}function ER(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 TR(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:LR(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]=RR(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 RR(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 AR(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 PR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function DR(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=Nw(n.substring(1),"/"):i=Nw(n,t)):i=t,{pathname:i,search:IR(s),hash:OR(o)}}function Nw(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 fh(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 $R(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Sk(e){let t=$R(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function cx(e,t,n,s=!1){let o;typeof e=="string"?o=Mi(e):(o={...e},nn(!o.pathname||!o.pathname.includes("?"),fh("?","pathname","search",o)),nn(!o.pathname||!o.pathname.includes("#"),fh("#","pathname","hash",o)),nn(!o.search||!o.search.includes("#"),fh("#","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=DR(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,"/"),LR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),IR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,OR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,_R=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 MR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function FR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Nk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ck(e,t){let n=e;if(typeof n!="string"||!PR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,o=!1;if(Nk)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 Ek=["POST","PUT","PATCH","DELETE"];new Set(Ek);var zR=["GET",...Ek];new Set(zR);var Fi=f.createContext(null);Fi.displayName="DataRouter";var Nf=f.createContext(null);Nf.displayName="DataRouterState";var BR=f.createContext(!1),Tk=f.createContext({isTransitioning:!1});Tk.displayName="ViewTransition";var UR=f.createContext(new Map);UR.displayName="Fetchers";var VR=f.createContext(null);VR.displayName="Await";var Vr=f.createContext(null);Vr.displayName="Navigation";var Rc=f.createContext(null);Rc.displayName="Location";var is=f.createContext({outlet:null,matches:[],isDataRoute:!1});is.displayName="Route";var ux=f.createContext(null);ux.displayName="RouteError";var Rk="REACT_ROUTER_ERROR",WR="REDIRECT",HR="ROUTE_ERROR_RESPONSE";function KR(e){if(e.startsWith(`${Rk}:${WR}:{`))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 qR(e){if(e.startsWith(`${Rk}:${HR}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new _R(t.status,t.statusText,t.data)}catch{}}function GR(e,{relative:t}={}){nn(Ac(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=f.useContext(Vr),{hash:o,pathname:i,search:c}=Pc(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:js([n,i])),s.createHref({pathname:u,search:c,hash:o})}function Ac(){return f.useContext(Rc)!=null}function Xn(){return nn(Ac(),"useLocation() may be used only in the context of a <Router> component."),f.useContext(Rc).location}var Ak="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Pk(e){f.useContext(Vr).static||f.useLayoutEffect(e)}function _t(){let{isDataRoute:e}=f.useContext(is);return e?cA():YR()}function YR(){nn(Ac(),"useNavigate() may be used only in the context of a <Router> component.");let e=f.useContext(Fi),{basename:t,navigator:n}=f.useContext(Vr),{matches:s}=f.useContext(is),{pathname:o}=Xn(),i=JSON.stringify(Sk(s)),c=f.useRef(!1);return Pk(()=>{c.current=!0}),f.useCallback((d,m={})=>{if(ts(c.current,Ak),!c.current)return;if(typeof d=="number"){n.go(d);return}let h=cx(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 QR=f.createContext(null);function JR(e){let t=f.useContext(is).outlet;return f.useMemo(()=>t&&f.createElement(QR.Provider,{value:e},t),[t,e])}function Mt(){let{matches:e}=f.useContext(is),t=e[e.length-1];return t?t.params:{}}function Pc(e,{relative:t}={}){let{matches:n}=f.useContext(is),{pathname:s}=Xn(),o=JSON.stringify(Sk(n));return f.useMemo(()=>cx(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function XR(e,t){return Dk(e,t)}function Dk(e,t,n){var v;nn(Ac(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=f.useContext(Vr),{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||"";Lk(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=wk(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=rA(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(Rc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},w):w}function ZR(){let e=lA(),t=MR(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 eA=f.createElement(ZR,null),$k=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=qR(e.digest);n&&(e=n)}let t=e!==void 0?f.createElement(is.Provider,{value:this.props.routeContext},f.createElement(ux.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?f.createElement(tA,{error:e},t):t}};$k.contextType=BR;var ph=new WeakMap;function tA({children:e,error:t}){let{basename:n}=f.useContext(Vr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=KR(t.digest);if(s){let o=ph.get(t);if(o)throw o;let i=Ck(s.location,n);if(Nk&&!ph.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 ph.set(t,c),c}return f.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function nA({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 rA(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:FR(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||eA,c&&(u<0&&y===0?(Lk("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(nA,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?f.createElement($k,{location:s.location,revalidation:s.revalidation,component:w,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function dx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sA(e){let t=f.useContext(Fi);return nn(t,dx(e)),t}function oA(e){let t=f.useContext(Nf);return nn(t,dx(e)),t}function aA(e){let t=f.useContext(is);return nn(t,dx(e)),t}function fx(e){let t=aA(e),n=t.matches[t.matches.length-1];return nn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function iA(){return fx("useRouteId")}function lA(){var s;let e=f.useContext(ux),t=oA("useRouteError"),n=fx("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function cA(){let{router:e}=sA("useNavigate"),t=fx("useNavigate"),n=f.useRef(!1);return Pk(()=>{n.current=!0}),f.useCallback(async(o,i={})=>{ts(n.current,Ak),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var Cw={};function Lk(e,t,n){!t&&!Cw[e]&&(Cw[e]=!0,ts(!1,n))}f.memo(uA);function uA({routes:e,future:t,state:n,isStatic:s,onError:o}){return Dk(e,void 0,{state:n,isStatic:s,onError:o})}function dA(e){return JR(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 fA({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:o,static:i=!1,unstable_useTransitions:c}){nn(!Ac(),"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(Vr.Provider,{value:d},f.createElement(Rc.Provider,{children:t,value:w}))}function pA({children:e,location:t}){return XR(mg(e),t)}function mg(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,mg(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=mg(s.props.children,i)),n.push(c)}),n}var Cd="get",Ed="application/x-www-form-urlencoded";function Cf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function mA(e){return Cf(e)&&e.tagName.toLowerCase()==="button"}function hA(e){return Cf(e)&&e.tagName.toLowerCase()==="form"}function gA(e){return Cf(e)&&e.tagName.toLowerCase()==="input"}function xA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yA(e,t){return e.button===0&&(!t||t==="_self")&&!xA(e)}function hg(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 bA(e,t){let n=hg(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var ad=null;function vA(){if(ad===null)try{new FormData(document.createElement("form"),0),ad=!1}catch{ad=!0}return ad}var wA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function mh(e){return e!=null&&!wA.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ed}"`),null):e}function jA(e,t){let n,s,o,i,c;if(hA(e)){let u=e.getAttribute("action");s=u?Bs(u,t):null,n=e.getAttribute("method")||Cd,o=mh(e.getAttribute("enctype"))||Ed,i=new FormData(e)}else if(mA(e)||gA(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=mh(e.getAttribute("formenctype"))||mh(u.getAttribute("enctype"))||Ed,i=new FormData(u,e),!vA()){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(Cf(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 px(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function kA(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 SA(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 NA(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 CA(e,t,n){let s=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let c=await SA(i,n);return c.links?c.links():[]}return[]}));return AA(s.flat(1).filter(NA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Ew(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 EA(e,t,{includeHydrateFallback:n}={}){return TA(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 TA(e){return[...new Set(e)]}function RA(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function AA(e,t){let n=new Set;return new Set(t),e.reduce((s,o)=>{let i=JSON.stringify(RA(o));return n.has(i)||(n.add(i),s.push({key:i,link:o})),s},[])}function Ik(){let e=f.useContext(Fi);return px(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function PA(){let e=f.useContext(Nf);return px(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var mx=f.createContext(void 0);mx.displayName="FrameworkContext";function Ok(){let e=f.useContext(mx);return px(e,"You must render this element inside a <HydratedRouter> element"),e}function DA(e,t){let n=f.useContext(mx),[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:_l(u,b),onBlur:_l(d,N),onMouseEnter:_l(m,b),onMouseLeave:_l(h,N),onTouchStart:_l(g,b)}]:[!1,y,{}]}function _l(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $A({page:e,...t}){let{router:n}=Ik(),s=f.useMemo(()=>wk(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?f.createElement(IA,{page:e,matches:s,...t}):null}function LA(e){let{manifest:t,routeModules:n}=Ok(),[s,o]=f.useState([]);return f.useEffect(()=>{let i=!1;return CA(e,t,n).then(c=>{i||o(c)}),()=>{i=!0}},[e,t,n]),s}function IA({page:e,matches:t,...n}){let s=Xn(),{future:o,manifest:i,routeModules:c}=Ok(),{basename:u}=Ik(),{loaderData:d,matches:m}=PA(),h=f.useMemo(()=>Ew(e,t,m,i,s,"data"),[e,t,m,i,s]),g=f.useMemo(()=>Ew(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=kA(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(()=>EA(g,i),[g,i]),N=LA(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 OA(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var _A=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{_A&&(window.__reactRouterVersion="7.13.1")}catch{}function MA({basename:e,children:t,unstable_useTransitions:n,window:s}){let o=f.useRef();o.current==null&&(o.current=mR({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(fA,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:i,unstable_useTransitions:n})}var _k=/^(?:[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(Vr),S=typeof h=="string"&&_k.test(h),T=Ck(h,v);h=T.to;let P=GR(h,{relative:o}),R=Xn(),A=null;if(u){let z=cx(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]=DA(s,N),D=UA(h,{replace:c,unstable_mask:u,state:d,target:m,preventScrollReset:g,relative:o,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function W(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?W:t,ref:OA(w,M),target:m,"data-discover":!S&&n==="render"?"true":void 0});return L&&!S?f.createElement(f.Fragment,null,_,f.createElement($A,{page:P})):_});Ce.displayName="Link";var FA=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=Pc(c,{relative:m.relative}),y=Xn(),b=f.useContext(Nf),{navigator:N,basename:w}=f.useContext(Vr),v=b!=null&&qA(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)});FA.displayName="NavLink";var zA=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(Vr),v=HA(),k=KA(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",S=typeof u=="string"&&_k.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})});zA.displayName="Form";function BA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mk(e){let t=f.useContext(Fi);return nn(t,BA(e)),t}function UA(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=Pc(e,{relative:c});return f.useCallback(b=>{if(yA(b,t)){b.preventDefault();let N=n!==void 0?n:hc(g)===hc(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(hg(e)),n=f.useRef(!1),s=Xn(),o=f.useMemo(()=>bA(s.search,n.current?null:t.current),[s.search]),i=_t(),c=f.useCallback((u,d)=>{const m=hg(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,i("?"+m,d)},[i,o]);return[o,c]}var VA=0,WA=()=>`__${String(++VA)}__`;function HA(){let{router:e}=Mk("useSubmit"),{basename:t}=f.useContext(Vr),n=iA(),s=e.fetch,o=e.navigate;return f.useCallback(async(i,c={})=>{let{action:u,method:d,encType:m,formData:h,body:g}=jA(i,t);if(c.navigate===!1){let y=c.fetcherKey||WA();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 KA(e,{relative:t}={}){let{basename:n}=f.useContext(Vr),s=f.useContext(is);nn(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),i={...Pc(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])),hc(i)}function qA(e,{relative:t}={}){let n=f.useContext(Tk);nn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Mk("useViewTransitionState"),o=Pc(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=vk();const GA=Sf(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 YA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Fk=(...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 QA={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 JA=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,...QA,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Fk("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(JA,{ref:i,iconNode:t,className:Fk(`lucide-${YA(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 Ef=$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 Wd=$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 Tf=$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 Hd=$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 Rf=$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 zk=$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 Kd=$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 XA=$e("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/**
|
|
112
|
+
* @license lucide-react v0.460.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const Bk=$e("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
117
|
+
* @license lucide-react v0.460.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const Af=$e("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
|
|
122
|
+
* @license lucide-react v0.460.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const ZA=$e("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
127
|
+
* @license lucide-react v0.460.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Rr=$e("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
132
|
+
* @license lucide-react v0.460.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const pr=$e("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
137
|
+
* @license lucide-react v0.460.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const eP=$e("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
142
|
+
* @license lucide-react v0.460.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Uk=$e("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
147
|
+
* @license lucide-react v0.460.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Vk=$e("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
152
|
+
* @license lucide-react v0.460.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const qd=$e("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
157
|
+
* @license lucide-react v0.460.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const hx=$e("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
162
|
+
* @license lucide-react v0.460.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const gg=$e("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
167
|
+
* @license lucide-react v0.460.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const tP=$e("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
|
|
172
|
+
* @license lucide-react v0.460.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const nP=$e("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
177
|
+
* @license lucide-react v0.460.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const rP=$e("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
|
|
182
|
+
* @license lucide-react v0.460.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const sP=$e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
187
|
+
* @license lucide-react v0.460.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const oP=$e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
192
|
+
* @license lucide-react v0.460.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const aP=$e("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
197
|
+
* @license lucide-react v0.460.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const Dc=$e("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
|
|
202
|
+
* @license lucide-react v0.460.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const iP=$e("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
207
|
+
* @license lucide-react v0.460.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const Wk=$e("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
212
|
+
* @license lucide-react v0.460.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const Gd=$e("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
217
|
+
* @license lucide-react v0.460.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const lP=$e("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
222
|
+
* @license lucide-react v0.460.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const cP=$e("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
227
|
+
* @license lucide-react v0.460.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const 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"}]]);/**
|
|
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 Tw=$e("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
237
|
+
* @license lucide-react v0.460.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const uP=$e("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
|
|
242
|
+
* @license lucide-react v0.460.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const dP=$e("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
|
|
247
|
+
* @license lucide-react v0.460.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const Hk=$e("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
252
|
+
* @license lucide-react v0.460.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const gx=$e("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
|
|
257
|
+
* @license lucide-react v0.460.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const fP=$e("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/**
|
|
262
|
+
* @license lucide-react v0.460.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const xx=$e("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
267
|
+
* @license lucide-react v0.460.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const pP=$e("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
|
|
272
|
+
* @license lucide-react v0.460.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const 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"}]]);/**
|
|
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 mP=$e("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
|
|
282
|
+
* @license lucide-react v0.460.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const hP=$e("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
287
|
+
* @license lucide-react v0.460.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const yx=$e("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
292
|
+
* @license lucide-react v0.460.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const xg=$e("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
|
|
297
|
+
* @license lucide-react v0.460.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/const Kk=$e("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
|
|
302
|
+
* @license lucide-react v0.460.0 - ISC
|
|
303
|
+
*
|
|
304
|
+
* This source code is licensed under the ISC license.
|
|
305
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
306
|
+
*/const gP=$e("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
|
|
307
|
+
* @license lucide-react v0.460.0 - ISC
|
|
308
|
+
*
|
|
309
|
+
* This source code is licensed under the ISC license.
|
|
310
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
311
|
+
*/const xP=$e("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
|
|
312
|
+
* @license lucide-react v0.460.0 - ISC
|
|
313
|
+
*
|
|
314
|
+
* This source code is licensed under the ISC license.
|
|
315
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
316
|
+
*/const yP=$e("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
317
|
+
* @license lucide-react v0.460.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const bP=$e("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
322
|
+
* @license lucide-react v0.460.0 - ISC
|
|
323
|
+
*
|
|
324
|
+
* This source code is licensed under the ISC license.
|
|
325
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
326
|
+
*/const vP=$e("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
|
|
327
|
+
* @license lucide-react v0.460.0 - ISC
|
|
328
|
+
*
|
|
329
|
+
* This source code is licensed under the ISC license.
|
|
330
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
331
|
+
*/const bx=$e("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
332
|
+
* @license lucide-react v0.460.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/const wP=$e("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
337
|
+
* @license lucide-react v0.460.0 - ISC
|
|
338
|
+
*
|
|
339
|
+
* This source code is licensed under the ISC license.
|
|
340
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
341
|
+
*/const jP=$e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
342
|
+
* @license lucide-react v0.460.0 - ISC
|
|
343
|
+
*
|
|
344
|
+
* This source code is licensed under the ISC license.
|
|
345
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
346
|
+
*/const vx=$e("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
347
|
+
* @license lucide-react v0.460.0 - ISC
|
|
348
|
+
*
|
|
349
|
+
* This source code is licensed under the ISC license.
|
|
350
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
351
|
+
*/const kP=$e("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
|
|
352
|
+
* @license lucide-react v0.460.0 - ISC
|
|
353
|
+
*
|
|
354
|
+
* This source code is licensed under the ISC license.
|
|
355
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
356
|
+
*/const hh=$e("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
|
|
357
|
+
* @license lucide-react v0.460.0 - ISC
|
|
358
|
+
*
|
|
359
|
+
* This source code is licensed under the ISC license.
|
|
360
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
361
|
+
*/const qk=$e("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
|
|
362
|
+
* @license lucide-react v0.460.0 - ISC
|
|
363
|
+
*
|
|
364
|
+
* This source code is licensed under the ISC license.
|
|
365
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
366
|
+
*/const 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"}]]);/**
|
|
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 SP=$e("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
372
|
+
* @license lucide-react v0.460.0 - ISC
|
|
373
|
+
*
|
|
374
|
+
* This source code is licensed under the ISC license.
|
|
375
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
376
|
+
*/const Rt=$e("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
377
|
+
* @license lucide-react v0.460.0 - ISC
|
|
378
|
+
*
|
|
379
|
+
* This source code is licensed under the ISC license.
|
|
380
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
381
|
+
*/const Gk=$e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
382
|
+
* @license lucide-react v0.460.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/const NP=$e("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/**
|
|
387
|
+
* @license lucide-react v0.460.0 - ISC
|
|
388
|
+
*
|
|
389
|
+
* This source code is licensed under the ISC license.
|
|
390
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
391
|
+
*/const CP=$e("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
392
|
+
* @license lucide-react v0.460.0 - ISC
|
|
393
|
+
*
|
|
394
|
+
* This source code is licensed under the ISC license.
|
|
395
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
396
|
+
*/const Us=$e("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
397
|
+
* @license lucide-react v0.460.0 - ISC
|
|
398
|
+
*
|
|
399
|
+
* This source code is licensed under the ISC license.
|
|
400
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
401
|
+
*/const Pf=$e("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
|
|
402
|
+
* @license lucide-react v0.460.0 - ISC
|
|
403
|
+
*
|
|
404
|
+
* This source code is licensed under the ISC license.
|
|
405
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
406
|
+
*/const EP=$e("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
407
|
+
* @license lucide-react v0.460.0 - ISC
|
|
408
|
+
*
|
|
409
|
+
* This source code is licensed under the ISC license.
|
|
410
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
411
|
+
*/const Eo=$e("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
412
|
+
* @license lucide-react v0.460.0 - ISC
|
|
413
|
+
*
|
|
414
|
+
* This source code is licensed under the ISC license.
|
|
415
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
416
|
+
*/const TP=$e("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/**
|
|
417
|
+
* @license lucide-react v0.460.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/const RP=$e("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
422
|
+
* @license lucide-react v0.460.0 - ISC
|
|
423
|
+
*
|
|
424
|
+
* This source code is licensed under the ISC license.
|
|
425
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
426
|
+
*/const AP=$e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
|
|
427
|
+
* @license lucide-react v0.460.0 - ISC
|
|
428
|
+
*
|
|
429
|
+
* This source code is licensed under the ISC license.
|
|
430
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
431
|
+
*/const PP=$e("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
432
|
+
* @license lucide-react v0.460.0 - ISC
|
|
433
|
+
*
|
|
434
|
+
* This source code is licensed under the ISC license.
|
|
435
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
436
|
+
*/const DP=$e("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
|
|
437
|
+
* @license lucide-react v0.460.0 - ISC
|
|
438
|
+
*
|
|
439
|
+
* This source code is licensed under the ISC license.
|
|
440
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
441
|
+
*/const zr=$e("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
442
|
+
* @license lucide-react v0.460.0 - ISC
|
|
443
|
+
*
|
|
444
|
+
* This source code is licensed under the ISC license.
|
|
445
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
446
|
+
*/const Rw=$e("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
|
|
447
|
+
* @license lucide-react v0.460.0 - ISC
|
|
448
|
+
*
|
|
449
|
+
* This source code is licensed under the ISC license.
|
|
450
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
451
|
+
*/const Aw=$e("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
452
|
+
* @license lucide-react v0.460.0 - ISC
|
|
453
|
+
*
|
|
454
|
+
* This source code is licensed under the ISC license.
|
|
455
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
456
|
+
*/const wx=$e("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
457
|
+
* @license lucide-react v0.460.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/const $P=$e("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
|
|
462
|
+
* @license lucide-react v0.460.0 - ISC
|
|
463
|
+
*
|
|
464
|
+
* This source code is licensed under the ISC license.
|
|
465
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
466
|
+
*/const Yk=$e("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
|
|
467
|
+
* @license lucide-react v0.460.0 - ISC
|
|
468
|
+
*
|
|
469
|
+
* This source code is licensed under the ISC license.
|
|
470
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
471
|
+
*/const xi=$e("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
472
|
+
* @license lucide-react v0.460.0 - ISC
|
|
473
|
+
*
|
|
474
|
+
* This source code is licensed under the ISC license.
|
|
475
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
476
|
+
*/const 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"}]]);/**
|
|
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 jx=$e("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
482
|
+
* @license lucide-react v0.460.0 - ISC
|
|
483
|
+
*
|
|
484
|
+
* This source code is licensed under the ISC license.
|
|
485
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
486
|
+
*/const LP=$e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
|
|
487
|
+
* @license lucide-react v0.460.0 - ISC
|
|
488
|
+
*
|
|
489
|
+
* This source code is licensed under the ISC license.
|
|
490
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
491
|
+
*/const IP=$e("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
492
|
+
* @license lucide-react v0.460.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/const OP=$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"}]]);/**
|
|
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 kx=$e("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Qk(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=Qk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function _P(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Qk(e))&&(s&&(s+=" "),s+=t);return s}const Sx="-",MP=e=>{const t=zP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(Sx);return u[0]===""&&u.length!==1&&u.shift(),Jk(u,t)||FP(c)},getConflictingClassGroupIds:(c,u)=>{const d=n[c]||[];return u&&s[c]?[...d,...s[c]]:d}}},Jk=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Jk(e.slice(1),s):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Sx);return(c=t.validators.find(({validator:u})=>u(i)))==null?void 0:c.classGroupId},Pw=/^\[(.+)\]$/,FP=e=>{if(Pw.test(e)){const t=Pw.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zP=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return UP(Object.entries(e.classGroups),n).forEach(([i,c])=>{yg(c,s,i,t)}),s},yg=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:Dw(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(BP(o)){yg(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,c])=>{yg(c,Dw(t,i),n,s)})})},Dw=(e,t)=>{let n=e;return t.split(Sx).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},BP=e=>e.isThemeGetter,UP=(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,VP=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)}}},Xk="!",WP=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(Xk),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},HP=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},KP=e=>({cache:VP(e.cacheSize),parseClassName:WP(e),...MP(e)}),qP=/\s+/,GP=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],c=e.trim().split(qP);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=HP(h).join(":"),k=g?v+Xk: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 YP(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Zk(t))&&(s&&(s+=" "),s+=n);return s}const Zk=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Zk(e[s]))&&(n&&(n+=" "),n+=t);return n};function QP(e,...t){let n,s,o,i=c;function c(d){const m=t.reduce((h,g)=>g(h),e());return n=KP(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=GP(d,n);return o(d,h),h}return function(){return i(YP.apply(null,arguments))}}const Wt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},e1=/^\[(?:([a-z-]+):)?(.+)\]$/i,JP=/^\d+\/\d+$/,XP=new Set(["px","full","screen"]),ZP=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,e3=/\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$/,t3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,n3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,r3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>yi(e)||XP.has(e)||JP.test(e),fo=e=>Vi(e,"length",d3),yi=e=>!!e&&!Number.isNaN(Number(e)),gh=e=>Vi(e,"number",yi),Ml=e=>!!e&&Number.isInteger(Number(e)),s3=e=>e.endsWith("%")&&yi(e.slice(0,-1)),dt=e=>e1.test(e),po=e=>ZP.test(e),o3=new Set(["length","size","percentage"]),a3=e=>Vi(e,o3,t1),i3=e=>Vi(e,"position",t1),l3=new Set(["image","url"]),c3=e=>Vi(e,l3,p3),u3=e=>Vi(e,"",f3),Fl=()=>!0,Vi=(e,t,n)=>{const s=e1.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},d3=e=>e3.test(e)&&!t3.test(e),t1=()=>!1,f3=e=>n3.test(e),p3=e=>r3.test(e),m3=()=>{const e=Wt("colors"),t=Wt("spacing"),n=Wt("blur"),s=Wt("brightness"),o=Wt("borderColor"),i=Wt("borderRadius"),c=Wt("borderSpacing"),u=Wt("borderWidth"),d=Wt("contrast"),m=Wt("grayscale"),h=Wt("hueRotate"),g=Wt("invert"),y=Wt("gap"),b=Wt("gradientColorStops"),N=Wt("gradientColorStopPositions"),w=Wt("inset"),v=Wt("margin"),k=Wt("opacity"),E=Wt("padding"),S=Wt("saturate"),T=Wt("scale"),P=Wt("sepia"),R=Wt("skew"),A=Wt("space"),L=Wt("translate"),M=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",dt,t],W=()=>[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"],V=()=>[yi,dt];return{cacheSize:500,separator:":",theme:{colors:[Fl],spacing:[_s,fo],blur:["none","",po,dt],brightness:V(),borderColor:[e],borderRadius:["none","","full",po,dt],borderSpacing:W(),borderWidth:Y(),contrast:V(),grayscale:K(),hueRotate:V(),invert:K(),gap:W(),gradientColorStops:[e],gradientColorStopPositions:[s3,fo],inset:D(),margin:D(),opacity:V(),padding:W(),saturate:V(),scale:V(),sepia:K(),skew:V(),space:W(),translate:W()},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",Ml,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",Ml,dt]}],"grid-cols":[{"grid-cols":[Fl]}],"col-start-end":[{col:["auto",{span:["full",Ml,dt]},dt]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[Fl]}],"row-start-end":[{row:["auto",{span:[Ml,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",gh]}],"font-family":[{font:[Fl]}],"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,gh]}],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:W()}],"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(),i3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",a3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},c3]}],"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,u3]}],"shadow-color":[{shadow:[Fl]}],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:V()}],ease:[{ease:["linear","in","out","in-out",dt]}],delay:[{delay:V()}],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:[Ml,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":W()}],"scroll-mx":[{"scroll-mx":W()}],"scroll-my":[{"scroll-my":W()}],"scroll-ms":[{"scroll-ms":W()}],"scroll-me":[{"scroll-me":W()}],"scroll-mt":[{"scroll-mt":W()}],"scroll-mr":[{"scroll-mr":W()}],"scroll-mb":[{"scroll-mb":W()}],"scroll-ml":[{"scroll-ml":W()}],"scroll-p":[{"scroll-p":W()}],"scroll-px":[{"scroll-px":W()}],"scroll-py":[{"scroll-py":W()}],"scroll-ps":[{"scroll-ps":W()}],"scroll-pe":[{"scroll-pe":W()}],"scroll-pt":[{"scroll-pt":W()}],"scroll-pr":[{"scroll-pr":W()}],"scroll-pb":[{"scroll-pb":W()}],"scroll-pl":[{"scroll-pl":W()}],"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,gh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},h3=QP(m3);function be(...e){return h3(_P(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 n1(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function r1(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 s1(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 g3(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 o1(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function x3(e){let t=o1(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 a1(e,t){return x3(e)===t}function i1(e){let n=o1(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 $w({items:e,onNavigate:t}){const n=Xn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const o=s.icon,i=a1(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 l1=[{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)"}}],y3=l1.map(e=>e.slug),Yd="default";function c1(e){return typeof e=="string"&&y3.includes(e)}const u1={preset:Yd,custom:!1};let Xl=null,Ja=null;function Nx(e){if(!e||typeof e!="object")return u1;const t=e;return{preset:c1(t.preset)?t.preset:Yd,custom:t.custom===!0}}function b3(){return Xl?Promise.resolve(Xl):Ja||(Ja=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Nx(e);return Xl=t,Ja=null,t}).catch(()=>(Ja=null,u1)),Ja)}async function v3(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=Nx(await t.json());return Xl=n,n}async function w3(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Nx(await e.json());return Xl=t,t}const bg="syntaur-theme",Td="syntaur-preset",d1=f.createContext(null);function vg(){try{const e=window.localStorage.getItem(bg);return e==="light"||e==="dark"?e:null}catch{return null}}function f1(){try{const e=window.localStorage.getItem(Td);return c1(e)?e:Yd}catch{return Yd}}function p1(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function m1(e){document.documentElement.classList.toggle("dark",e==="dark")}function h1(e){document.documentElement.dataset.theme=e}function j3(){typeof document>"u"||(m1(vg()??p1()),h1(f1()))}function k3({children:e}){const[t,n]=f.useState(()=>vg()),[s,o]=f.useState(()=>vg()??p1()),[i,c]=f.useState(()=>f1());f.useEffect(()=>{m1(s)},[s]),f.useEffect(()=>{h1(i)},[i]),f.useEffect(()=>{let h=!1;return b3().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 v3(h)}async function d(){const h=await w3();c(h.preset);try{window.localStorage.setItem(Td,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(bg,h),n(h),o(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(bg,h),n(h),o(h)},preset:i,setPreset:u,resetPreset:d};return r.jsx(d1.Provider,{value:m,children:e})}function Cx(){const e=f.useContext(d1);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Rd=new Set;let cr=null,bi=null;function S3(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function g1(){cr&&(cr.readyState===WebSocket.OPEN||cr.readyState===WebSocket.CONNECTING)||(cr=new WebSocket(S3()),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(g1,2e3)},cr.onerror=()=>{cr==null||cr.close()})}function $c(e){const t=f.useRef(e);t.current=e,f.useEffect(()=>{const n=s=>t.current(s);return Rd.add(n),g1(),()=>{Rd.delete(n),Rd.size===0&&cr&&(bi&&clearTimeout(bi),bi=null,cr.close(),cr=null)}},[])}const Df=["7d","30d","90d","all","custom"],x1="30d",N3=/^\d{4}-\d{2}-\d{2}$/,Lc=["project","workspace","model","tool"],C3={"7d":7,"30d":30,"90d":90};function Zl(e){if(typeof e!="string"||!N3.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 Lw(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 E3(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function T3(e,t=new Date){const n=e.window??x1;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:Lw(E3(s,-(C3[n]-1))),until:Lw(s)}}function R3(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&&!Df.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const s of["since","until"])n[s]!==void 0&&!Zl(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 Zl(n.since)&&Zl(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"&&Df.includes(n.window)&&(t.window=n.window),Zl(n.since)&&(t.since=n.since),Zl(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 wg(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 A3(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 y1(e,t=new Date){const n=Ic(e),{since:s,until:o}=T3(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 P3={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function Iw(e){const t=Ic(e),n=t.window??x1,s=[];return s.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:P3[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]),$c(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 D3(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 $f(e=!0){return qt("/api/assignments","assignments",e)}function $3(e=!0){return qt("/api/archived","assignments",e)}function b1(){return qt("/api/help")}function v1(e){const t=e?`/api/projects/${e}`:null;return qt(t,"project")}function L3(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return qt(n,"assignment")}function I3(e){const t=e?`/api/assignments/${e}`:null;return qt(t,"assignment")}function w1(e){return qt(e)}function Ex(e=!0){return qt("/api/servers","servers",e)}function j1(){return qt("/api/leases","inventories")}function Lf(){return qt("/api/agent-sessions","agent-sessions")}function O3(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return qt(n,"agent-sessions")}function _3(e){const t=e?`/api/assignments/${e}/sessions`:null;return qt(t,"agent-sessions")}function M3(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return qt(n,void 0,!0,!0)}function F3(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return qt(t,void 0,!0,!0)}function Tx(e=!0){return qt("/api/playbooks","playbooks",e)}function z3(e){const t=y1(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return qt(n,void 0,!0,!0)}function k1(e=!0){return qt("/api/usage/facets",void 0,e)}function B3(e){const t=e?`/api/playbooks/${e}`:null;return qt(t,"playbooks")}function U3(){return qt("/api/memories","project")}function V3(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return qt(n,"project")}function W3(){return qt("/api/resources","project")}function H3(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return qt(n,"project")}const If=["new-workspace","new-project","new-todo","new-assignment"];function K3(e){return typeof e=="string"&&If.includes(e)}const q3=["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","[","]"],G3=["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 G3)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 Y3(e){const t=dr(e);return t?q3.includes(t):!1}const Q3={"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 J3(e){const t={...Q3};for(const n of If){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 X3(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=X3(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 S1(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 Z3(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]),$c(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function N1(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]),$c(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}async function Rx(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 C1(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 E1(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 T1(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 R1(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function A1(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function P1(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 Ax(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function D1(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 $1(e,t,n){const s=await fetch(Ax(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function Px(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 eD(e,t){return await Px(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function tD(e){return await Px("/api/todos/promote-bulk",e)}async function nD(e,t,n){await Px(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const rD=new Set(["/projects","/assignments","/servers","/todos"]);function Ad(e,t){return rD.has(e)?`${t}${e}`:e}const sD=[{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 Ow(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 oD(e){const t=[];for(const n of sD)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??[],...Ow(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??"",...Ow(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 aD(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 xh(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 _w(){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 Mw(){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 yh(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`---
|
|
502
|
+
${t}: ${JSON.stringify(n)}
|
|
503
|
+
---
|
|
504
|
+
${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}
|
|
505
|
+
${t}: ${d}`,`${o}${h}${c}${u}`}const iD=/^[a-z0-9][a-z0-9-]*$/;function lD(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:iD,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 _w(),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 yh("/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([_w(),Mw()]),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 Rx(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 Mw(),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 yh("/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 yh("/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 xh("_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 xh(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 xh(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:()=>aD(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 cD=["low","medium","high","critical"],Of={status:{kind:"enum"},priority:{kind:"ordinal",order:cD},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 uD(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 L1(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 jg(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 ec(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 bh(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function dD(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=>dD(jr(e,t,o)):o=>bh(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??ec(n.raw);if(o===null)throw new kr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>ec(jr(e,t,i))===o}case"ordinal":return o=>bh(jr(e,t,o),n.raw);case"list":return o=>{const i=jr(e,t,o);return Array.isArray(i)&&i.some(c=>bh(c,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=L1(n.raw);return c=>{const u=jg(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 fD(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??ec(s.raw);if(i===null)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=ec(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=jg(jr(e,t,u));return m!==null&&o(m,d.now+c)}}if(s.type==="date"){const[i,c]=L1(s.raw);return u=>{const d=jg(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=ec(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 pD(e,t){const n=uD(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 fD(n,e.field,e.op,e.values[0])}function tc(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return pD(e,t);case"not":{const n=tc(e.child,t);return(s,o)=>!n(s,o)}case"and":{const n=e.children.map(s=>tc(s,t));return(s,o)=>n.every(i=>i(s,o))}case"or":{const n=e.children.map(s=>tc(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 mD={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},hD=/[A-Za-z_]/,gD=/[A-Za-z0-9_-]/,xD=/^\d{4}-\d{2}-\d{2}/;function I1(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=mD[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===`
|
|
506
|
+
`||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(xD);if(c){t.push({type:"DATE",text:c[0],pos:i}),n+=c[0].length;continue}t.push(s(i,0));continue}if(hD.test(o)){let c=n+1;for(;c<e.length&&gD.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 Jo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const yD=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),bD=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class vD{constructor(t){ah(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 Jo(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 Jo(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(bD.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 Jo(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 Jo(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 Jo(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(!yD.has(t.type))throw new Jo(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 _f(e){try{const t=I1(e);return{ast:new vD(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ra||t instanceof Jo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Di(e,t=Of){const n=_f(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:tc(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof kr)return{query:null,errors:s.errors};throw s}}function Jt(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 Fw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Mf(...e){return t=>{let n=!1;const s=e.map(o=>{const i=Fw(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():Fw(e[o],null)}}}}function Kn(...e){return f.useCallback(Mf(...e),e)}function wD(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,jD(o,...t)]}function jD(...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:()=>{},kD=bk[" useId ".trim().toString()]||(()=>{}),SD=0;function vi(e){const[t,n]=f.useState(kD());return jo(()=>{n(s=>s??String(SD++))},[e]),e||(t?`radix-${t}`:"")}var ND=bk[" useInsertionEffect ".trim().toString()]||jo;function Ff({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,c]=CD({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=ED(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 CD({defaultProp:e,onChange:t}){const[n,s]=f.useState(e),o=f.useRef(n),i=f.useRef(t);return ND(()=>{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 ED(e){return typeof e=="function"}function TD(e){const t=RD(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(PD);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 RD(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=$D(o),u=DD(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Mf(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 AD=Symbol("radix.slottable");function PD(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===AD}function DD(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 $D(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 LD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=LD.reduce((e,t)=>{const n=TD(`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 ID(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 OD(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 _D="DismissableLayer",kg="dismissableLayer.update",MD="dismissableLayer.pointerDownOutside",FD="dismissableLayer.focusOutside",zw,O1=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Dx=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...d}=e,m=f.useContext(O1),[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=UD(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=VD(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 OD(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&&(zw=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),Bw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=zw)}},[h,y,n,m]),f.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),Bw())},[h,m]),f.useEffect(()=>{const A=()=>b({});return document.addEventListener(kg,A),()=>document.removeEventListener(kg,A)},[]),r.jsx(vn.div,{...d,ref:N,style:{pointerEvents:S?T?"auto":"none":void 0,...e.style},onFocusCapture:Jt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Jt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Jt(e.onPointerDownCapture,P.onPointerDownCapture)})});Dx.displayName=_D;var zD="DismissableLayerBranch",BD=f.forwardRef((e,t)=>{const n=f.useContext(O1),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})});BD.displayName=zD;function UD(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(){_1(MD,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 VD(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&&_1(FD,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 Bw(){const e=new CustomEvent(kg);document.dispatchEvent(e)}function _1(e,t,n,{discrete:s}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?ID(o,i):o.dispatchEvent(i)}var vh="focusScope.autoFocusOnMount",wh="focusScope.autoFocusOnUnmount",Uw={bubbles:!1,cancelable:!0},WD="FocusScope",M1=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){Ww.add(b);const w=document.activeElement;if(!u.contains(w)){const k=new CustomEvent(vh,Uw);u.addEventListener(vh,m),u.dispatchEvent(k),k.defaultPrevented||(HD(QD(F1(u)),{select:!0}),document.activeElement===w&&yo(u))}return()=>{u.removeEventListener(vh,m),setTimeout(()=>{const k=new CustomEvent(wh,Uw);u.addEventListener(wh,h),u.dispatchEvent(k),k.defaultPrevented||yo(w??document.body,{select:!0}),u.removeEventListener(wh,h),Ww.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]=KD(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})});M1.displayName=WD;function HD(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(yo(s,{select:t}),document.activeElement!==n)return}function KD(e){const t=F1(e),n=Vw(t,e),s=Vw(t.reverse(),e);return[n,s]}function F1(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(!qD(n,{upTo:t}))return n}function qD(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 GD(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&&GD(e)&&t&&e.select()}}var Ww=YD();function YD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Hw(e,t),e.unshift(t)},remove(t){var n;e=Hw(e,t),(n=e[0])==null||n.resume()}}}function Hw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function QD(e){return e.filter(t=>t.tagName!=="A")}var JD="Portal",$x=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?GA.createPortal(r.jsx(vn.div,{...s,ref:t}),c):null});$x.displayName=JD;function XD(e,t){return f.useReducer((n,s)=>t[n][s]??n,e)}var ga=e=>{const{present:t,children:n}=e,s=ZD(t),o=typeof n=="function"?n({present:s.isPresent}):f.Children.only(n),i=Kn(s.ref,e$(o));return typeof n=="function"||s.isPresent?f.cloneElement(o,{ref:i}):null};ga.displayName="Presence";function ZD(e){const[t,n]=f.useState(),s=f.useRef(null),o=f.useRef(e),i=f.useRef("none"),c=e?"mounted":"unmounted",[u,d]=XD(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 e$(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 jh=0;function t$(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Kw()),document.body.insertAdjacentElement("beforeend",e[1]??Kw()),jh++,()=>{jh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),jh--}},[])}function Kw(){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 z1(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 n$(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",r$="with-scroll-bars-hidden",s$="--removed-body-scroll-bar-size";function kh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function o$(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 a$=typeof window<"u"?f.useLayoutEffect:f.useEffect,qw=new WeakMap;function i$(e,t){var n=o$(null,function(s){return e.forEach(function(o){return kh(o,s)})});return a$(function(){var s=qw.get(n);if(s){var o=new Set(s),i=new Set(e),c=n.current;o.forEach(function(u){i.has(u)||kh(u,null)}),i.forEach(function(u){o.has(u)||kh(u,c)})}qw.set(n,e)},[e]),n}function l$(e){return e}function c$(e,t){t===void 0&&(t=l$);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 u$(e){e===void 0&&(e={});var t=c$(null);return t.options=bs({async:!0,ssr:!1},e),t}var B1=function(e){var t=e.sideCar,n=z1(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))};B1.isSideCarExport=!0;function d$(e,t){return e.useMedium(t),B1}var U1=u$(),Sh=function(){},zf=f.forwardRef(function(e,t){var n=f.useRef(null),s=f.useState({onScrollCapture:Sh,onWheelCapture:Sh,onTouchMoveCapture:Sh}),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=z1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=y,R=i$([n,t]),A=bs(bs({},T),o);return f.createElement(f.Fragment,null,h&&f.createElement(P,{sideCar:U1,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))});zf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zf.classNames={fullWidth:Ld,zeroRight:$d};var f$=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function p$(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=f$();return t&&e.setAttribute("nonce",t),e}function m$(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function h$(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var g$=function(){var e=0,t=null;return{add:function(n){e==0&&(t=p$())&&(m$(t,n),h$(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},x$=function(){var e=g$();return function(t,n){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},V1=function(){var e=x$(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},y$={left:0,top:0,right:0,gap:0},Nh=function(e){return parseInt(e||"",10)||0},b$=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[Nh(n),Nh(s),Nh(o)]},v$=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return y$;var t=b$(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])}},w$=V1(),wi="data-scroll-locked",j$=function(e,t,n,s){var o=e.left,i=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
507
|
+
.`.concat(r$,` {
|
|
508
|
+
overflow: hidden `).concat(s,`;
|
|
509
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
510
|
+
}
|
|
511
|
+
body[`).concat(wi,`] {
|
|
512
|
+
overflow: hidden `).concat(s,`;
|
|
513
|
+
overscroll-behavior: contain;
|
|
514
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
515
|
+
padding-left: `.concat(o,`px;
|
|
516
|
+
padding-top: `).concat(i,`px;
|
|
517
|
+
padding-right: `).concat(c,`px;
|
|
518
|
+
margin-left:0;
|
|
519
|
+
margin-top:0;
|
|
520
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
521
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.`).concat($d,` {
|
|
525
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.`).concat(Ld,` {
|
|
529
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.`).concat($d," .").concat($d,` {
|
|
533
|
+
right: 0 `).concat(s,`;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.`).concat(Ld," .").concat(Ld,` {
|
|
537
|
+
margin-right: 0 `).concat(s,`;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
body[`).concat(wi,`] {
|
|
541
|
+
`).concat(s$,": ").concat(u,`px;
|
|
542
|
+
}
|
|
543
|
+
`)},Gw=function(){var e=parseInt(document.body.getAttribute(wi)||"0",10);return isFinite(e)?e:0},k$=function(){f.useEffect(function(){return document.body.setAttribute(wi,(Gw()+1).toString()),function(){var e=Gw()-1;e<=0?document.body.removeAttribute(wi):document.body.setAttribute(wi,e.toString())}},[])},S$=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;k$();var i=f.useMemo(function(){return v$(o)},[o]);return f.createElement(w$,{styles:j$(i,!t,o,n?"":"!important")})},Sg=!1;if(typeof window<"u")try{var cd=Object.defineProperty({},"passive",{get:function(){return Sg=!0,!0}});window.addEventListener("test",cd,cd),window.removeEventListener("test",cd,cd)}catch{Sg=!1}var Xa=Sg?{passive:!1}:!1,N$=function(e){return e.tagName==="TEXTAREA"},W1=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!N$(e)&&n[t]==="visible")},C$=function(e){return W1(e,"overflowY")},E$=function(e){return W1(e,"overflowX")},Yw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=H1(e,s);if(o){var i=K1(e,s),c=i[1],u=i[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},T$=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},R$=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},H1=function(e,t){return e==="v"?C$(t):E$(t)},K1=function(e,t){return e==="v"?T$(t):R$(t)},A$=function(e,t){return e==="h"&&t==="rtl"?-1:1},P$=function(e,t,n,s,o){var i=A$(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=K1(e,u),N=b[0],w=b[1],v=b[2],k=w-v-i*N;(N||k)&&H1(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]},Jw=function(e){return e&&"current"in e?e.current:e},D$=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$$=function(e){return`
|
|
544
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
545
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
546
|
+
`)},L$=0,Za=[];function I$(e){var t=f.useRef([]),n=f.useRef([0,0]),s=f.useRef(),o=f.useState(L$++)[0],i=f.useState(V1)[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=n$([e.lockRef.current],(e.shards||[]).map(Jw),!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=Yw(A,R);if(!D)return!0;if(D?P=A:(P=A==="v"?"h":"v",D=Yw(A,R)),!D)return!1;if(!s.current&&"changedTouches"in w&&(S||T)&&(s.current=P),!P)return!0;var W=s.current||P;return P$(W,v,w,W==="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)&&D$(P.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var S=(c.current.shards||[]).map(Jw).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:O$(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)}):null,b?f.createElement(S$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function O$(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const _$=d$(U1,I$);var q1=f.forwardRef(function(e,t){return f.createElement(zf,bs({},e,{ref:t,sideCar:_$}))});q1.classNames=zf.classNames;var M$=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={},Ch=0,G1=function(e){return e&&(e.host||G1(e.parentNode))},F$=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=G1(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},z$=function(e,t,n,s){var o=F$(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(),Ch++,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)}),Ch--,Ch||(ei=new WeakMap,ei=new WeakMap,dd=new WeakMap,fd={})}},B$=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=M$(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),z$(s,o,n,"aria-hidden")):function(){return null}};function U$(e){const t=V$(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(H$);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 V$(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=q$(o),u=K$(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Mf(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 W$=Symbol("radix.slottable");function H$(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===W$}function K$(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 q$(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 Bf="Dialog",[Y1,Q1]=ha(Bf),[G$,cs]=Y1(Bf),J1=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]=Ff({prop:s,defaultProp:o??!1,onChange:i,caller:Bf});return r.jsx(G$,{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})};J1.displayName=Bf;var X1="DialogTrigger",Z1=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(X1,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":Ox(o.open),...s,ref:i,onClick:Jt(e.onClick,o.onOpenToggle)})});Z1.displayName=X1;var Lx="DialogPortal",[Y$,eS]=Y1(Lx,{forceMount:void 0}),tS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=cs(Lx,t);return r.jsx(Y$,{scope:t,forceMount:n,children:f.Children.map(s,c=>r.jsx(ga,{present:n||i.open,children:r.jsx($x,{asChild:!0,container:o,children:c})}))})};tS.displayName=Lx;var Qd="DialogOverlay",nS=f.forwardRef((e,t)=>{const n=eS(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(J$,{...o,ref:t})}):null});nS.displayName=Qd;var Q$=U$("DialogOverlay.RemoveScroll"),J$=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(Qd,n);return r.jsx(q1,{as:Q$,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(vn.div,{"data-state":Ox(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),fa="DialogContent",rS=f.forwardRef((e,t)=>{const n=eS(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(X$,{...o,ref:t}):r.jsx(Z$,{...o,ref:t})})});rS.displayName=fa;var X$=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 B$(i)},[]),r.jsx(sS,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Jt(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Jt(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&i.preventDefault()}),onFocusOutside:Jt(e.onFocusOutside,i=>i.preventDefault())})}),Z$=f.forwardRef((e,t)=>{const n=cs(fa,e.__scopeDialog),s=f.useRef(!1),o=f.useRef(!1);return r.jsx(sS,{...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()}})}),sS=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 t$(),r.jsxs(r.Fragment,{children:[r.jsx(M1,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx(Dx,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":Ox(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(tL,{titleId:u.titleId}),r.jsx(rL,{contentRef:d,descriptionId:u.descriptionId})]})]})}),Ix="DialogTitle",oS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(Ix,n);return r.jsx(vn.h2,{id:o.titleId,...s,ref:t})});oS.displayName=Ix;var aS="DialogDescription",iS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(aS,n);return r.jsx(vn.p,{id:o.descriptionId,...s,ref:t})});iS.displayName=aS;var lS="DialogClose",cS=f.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=cs(lS,n);return r.jsx(vn.button,{type:"button",...s,ref:t,onClick:Jt(e.onClick,()=>o.onOpenChange(!1))})});cS.displayName=lS;function Ox(e){return e?"open":"closed"}var uS="DialogTitleWarning",[eL,dS]=wD(uS,{contentName:fa,titleName:Ix,docsSlug:"dialog"}),tL=({titleId:e})=>{const t=dS(uS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
547
|
+
|
|
548
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
549
|
+
|
|
550
|
+
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},nL="DialogDescriptionWarning",rL=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${dS(nL).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},fS=J1,pS=Z1,mS=tS,_x=nS,Mx=rS,Fx=oS,zx=iS,Bx=cS;const $n=fS,sL=pS,oL=mS,aL=Bx,hS=f.forwardRef(({className:e,...t},n)=>r.jsx(_x,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));hS.displayName=_x.displayName;const En=f.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(oL,{children:[r.jsx(hS,{}),r.jsx(Mx,{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=Mx.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(Fx,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));Tn.displayName=Fx.displayName;const Wr=f.forwardRef(({className:e,...t},n)=>r.jsx(zx,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));Wr.displayName=zx.displayName;const iL=-1,lL=-40;function Eh(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(lL,i*iL)),o=s,i=0,s++,d=!0;break}else i++,s++;if(!d)return-1/0}return n}const Xw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function Ux(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=Eh(s,c.title.toLowerCase())*1,d=c.subtitle?Eh(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?Eh(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:(Xw[c.type]??99)-(Xw[u.type]??99)),i.slice(0,n)}const Ng={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},Zw=Symbol("absent");function pd(e){return e.replace(/\s+/g," ").trim()}const ej=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function cL(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function uL(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 Jd={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:Zw},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:Zw},externalid:{kind:"substring",get:cL},jira:{kind:"substring",get:uL},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function dL(e){let t;try{t=I1(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(mL(e,t,n));return Di(h,Jd).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=fL(t,u);if(h){m(u),i.push(h.atom),u=h.end,d=u;continue}const g=pL(t,u,n);if(g!==null){const y=s(u,g).trim();if(Di(y,Jd).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 fL(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=Ng[o.text.toLowerCase()];return!i||((c=e[n+1])==null?void 0:c.type)!=="COLON"?null:{atom:`${s}kind:${i}`,end:n+2}}function pL(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(Jd,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 ej.has(c.type)?s+3:null}if(i.type==="OP"){const c=e[s+2];return c&&ej.has(c.type)?s+3:null}return null}function mL(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(Ng,u.text.toLowerCase())&&((i=t[c+1])==null?void 0:i.type)==="COLON"&&(s+=e.slice(o,u.pos)+`kind:${Ng[u.text.toLowerCase()]} `,o=t[c+1].pos+1)}return s+=e.slice(o),s}const hL={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function gL({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(()=>dL(o),[o]),g=f.useMemo(()=>{let N=e,w=h;if(m){const v=Di(m,Jd);if(v.query){const k=Date.now(),{predicate:E}=v.query;N=e.filter(S=>E(S,{now:k}))}else w=o}return Ux(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:hL[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 xL({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(eP,{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 yL({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 bL({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 Ux(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 vL({entries:e}){var ue,ye;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(()=>Ux(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 ge=e.find(ke=>ke.bindableKind===se);ge&&W(ge)},[n,u]),f.useEffect(()=>{var ge;const se=(ge=M.current)==null?void 0:ge.querySelector(`[data-palette-idx="${g}"]`);se==null||se.scrollIntoView({block:"nearest"})},[g]);async function W(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(ge){L(ge instanceof Error?ge.message:"Action failed")}finally{R(!1)}}}}async function Y(se){if(!k)return;const ge=k.action.flow.steps[k.stepIndex],ke={...k.values,[ge.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(ge){L(ge instanceof Error?ge.message:"Action failed")}finally{R(!1)}}}function H(se){if(se.key==="ArrowDown")se.preventDefault(),y(ge=>Math.min(D.length-1,ge+1));else if(se.key==="ArrowUp")se.preventDefault(),y(ge=>Math.max(0,ge-1));else if(se.key==="Enter"&&(se.metaKey||se.ctrlKey)){se.preventDefault();const ge=D[g];ge!=null&&ge.action.bindableKind&&T({action:ge.action,combo:null,conflict:null,saving:!1,error:null})}else if(se.key==="Enter"){se.preventDefault();const ge=D[g];ge&&W(ge.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 ge=S1(se.nativeEvent);if(!ge)return;const ke=c(ge,S.action.bindableKind);T({...S,combo:ge,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(ge){T({...S,saving:!1,error:ge instanceof Error?ge.message:"Failed to save binding"})}}}const $=b!==null,V=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(V){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(xg,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),r.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",S.action.title]})]}),r.jsx("div",{className:"px-4 py-6 text-center",children:S.combo?r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:ks(S.combo)}),(ue=S.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(ye=S.conflict)!=null&&ye.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()}})]}):V&&B&&k?r.jsxs(r.Fragment,{children:[r.jsx(xL,{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(yL,{step:B,initialValue:k.values[B.id],disabled:P,onSubmit:Y}):r.jsx(bL,{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,ge)=>{const ke=ge===g,Re=se.action.bindableKind,Ae=Re?o[Re]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ge,onClick:()=>W(se.action),onMouseEnter:()=>y(ge),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:Je=>{Je.preventDefault(),Je.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(xg,{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 wL=[{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 jL(e){const t=dr(e);return t?wL.find(n=>n.combo===t)??null:null}const zl={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},kL={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},SL=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function tj(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${ks(t)} then ${ks(n)}`}return ks(e)}function NL(){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(Wr,{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:[SL.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:kL[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:tj(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:tj(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const Vx={bindings:{},custom:!1};let nc=null,ti=null;const Cg=new Set;function gS(e){nc=e;for(const t of Cg)t(e)}function Wx(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(!K3(s)||typeof o!="string"||o.trim()==="")continue;const i=dr(o);i&&(n[s]=i)}return{bindings:n,custom:t.custom===!0}}function CL(){return nc?Promise.resolve(nc):ti||(ti=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Wx(e);return nc=t,ti=null,t}).catch(()=>(ti=null,Vx)),ti)}function EL(){const[e,t]=f.useState(()=>nc??Vx);return f.useEffect(()=>{let n=!1;return CL().then(s=>{n||t(s)}),Cg.add(t),()=>{n=!0,Cg.delete(t)}},[]),e}async function nj(e){const t={};for(const o of If){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=Wx(await n.json());return gS(s),s}async function TL(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Wx(await e.json());return gS(t),t}const rj=1500;function RL(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const xS=f.createContext(null);function AL({children:e}){const{toggleTheme:t}=Cx(),n=Xn(),s=_t(),o=RL(n.pathname),[i,c]=f.useState(!1),u=Cs(i),d=$f(i),m=Tx(i),h=Ex(i),g=N1(i),y=f.useMemo(()=>{var et,Qe,$t,vt;const Z=u.data??[],_e=((et=d.data)==null?void 0:et.assignments)??[],Ee=((Qe=m.data)==null?void 0:Qe.playbooks)??[],Ie=(($t=h.data)==null?void 0:$t.sessions)??[],Me=(((vt=g.data)==null?void 0:vt.workspaces)??[]).flatMap(ct=>ct.items.map(ie=>({...ie,workspace:ct.workspace})));return oD({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(()=>i1(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 lD({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),[W,Y]=f.useState(!1),[_,z]=f.useState(null);f.useEffect(()=>{(L||W)&&c(!0)},[L,W]);const{bindings:H}=EL(),q=f.useMemo(()=>J3(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)},[]),V=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),[]),ue=f.useCallback(()=>D(!0),[]),ye=f.useCallback(()=>D(!1),[]),se=f.useCallback(()=>Y(!0),[]),ge=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)},[]),Je=f.useCallback((Z,_e)=>{const Ee=dr(Z);if(!Ee)return null;if(Y3(Ee)){const Ie=jL(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=Je(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 nj(Ye),Ee},[H,Je]),Ze=f.useCallback(async Z=>{if(!H[Z])return;const _e={...H};delete _e[Z],await nj(_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"),Qe=id(Me,"Mod+Shift+k"),$t=Me.key==="Escape",vt=et||Qe||$t;if(_e()&&!vt||Z(Me.target)&&!vt)return;const ct=P.current;if(ct.phase==="awaiting-second")if(Date.now()-ct.startedAt>rj)P.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const me=Array.from(S.current.values());for(const re of me){if(!Ie(re))continue;const xe=re.keys.split(" ");if(!(xe.length!==2||xe[0]!=="g")&&id(Me,xe[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 ie=Array.from(S.current.values());for(const Q of ie){if(!Ie(Q))continue;const me=Q.keys.split(" ");if(me.length===1&&id(Me,me[0])&&!(Q.when&&!Q.when())){Me.preventDefault(),Q.handler(Me);return}}Me.key==="g"&&!Me.metaKey&&!Me.ctrlKey&&!Me.altKey&&!Me.shiftKey&&Array.from(S.current.values()).some(me=>Ie(me)&&me.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},rj))}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:()=>ue()});return()=>K(Z)},[I,K,ue]),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(W){ge();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||se()}});return()=>K(Z)},[I,K,se,ge,W]),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:V,openPalette:ee,closePalette:B,paletteOpen:L,openCheatsheet:ue,closeCheatsheet:ye,cheatsheetOpen:F,openActionsPalette:se,closeActionsPalette:ge,actionsPaletteOpen:W,listBindings:ke,wsPrefix:o,paletteEntries:y,actionEntries:E,userBindings:H,customBindings:q,bindAction:at,unbindAction:Ze,findConflict:Je,openActionsPaletteWithAction:Ae,pendingActionKind:_,consumePendingActionKind:Re}),[I,K,$,V,ee,B,L,ue,ye,F,se,ge,W,ke,o,y,E,H,q,at,Ze,Je,Ae,_,Re]);return r.jsxs(xS.Provider,{value:ot,children:[e,r.jsx(gL,{entries:y}),r.jsx(vL,{entries:E}),r.jsx(NL,{})]})}function To(){const e=f.useContext(xS);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 PL({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const o=un(),{resolvedTheme:i,toggleTheme:c}=Cx(),{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(jP,{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(Rt,{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(Rt,{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($P,{className:"h-4 w-4"}):r.jsx(kP,{className:"h-4 w-4"}),r.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const Xd="_ungrouped",DL=256;function $L(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>DL||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function LL(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function IL(e,t){return t.includes(e)}const Hx={hidden:[],custom:!1};let zs=null,Xo=null,gc=0;const Eg=new Set;function yS(e){zs=e;for(const t of Eg)t(e)}function Kx(e){if(!e||typeof e!="object")return Hx;const t=e;return{hidden:$L(t.hidden),custom:t.custom===!0}}function OL(){if(zs)return Promise.resolve({value:zs,ok:!0});if(Xo)return Xo;const e=++gc;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=Kx(t);return e!==gc?{value:zs??n,ok:!0}:(zs=n,{value:n,ok:!0})}).catch(()=>(Xo=null,{value:Hx,ok:!1})),Xo}function bS(){const[e,t]=f.useState(()=>zs??Hx),[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),OL().then(h=>{m||(t(h.value),s(!1),i(!h.ok))}),Eg.add(t),()=>{m=!0,Eg.delete(t)}},[c]);function d(){_L(),u(m=>m+1)}return{...e,loading:n,error:o,reload:d}}function _L(){zs=null,Xo=null,++gc}async function ML(e){++gc;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=Kx(await t.json());return yS(n),n}async function FL(){++gc;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=Kx(await e.json());return yS(t),t}var zL=Symbol("radix.slottable");function BL(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=zL,t}var vS="AlertDialog",[UL]=ha(vS,[Q1]),Hs=Q1(),wS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(fS,{...s,...n,modal:!0})};wS.displayName=vS;var VL="AlertDialogTrigger",WL=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(pS,{...o,...s,ref:t})});WL.displayName=VL;var HL="AlertDialogPortal",jS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(mS,{...s,...n})};jS.displayName=HL;var KL="AlertDialogOverlay",kS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(_x,{...o,...s,ref:t})});kS.displayName=KL;var ji="AlertDialogContent",[qL,GL]=UL(ji),YL=BL("AlertDialogContent"),SS=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(eL,{contentName:ji,titleName:NS,docsSlug:"alert-dialog",children:r.jsx(qL,{scope:n,cancelRef:d,children:r.jsxs(Mx,{role:"alertdialog",...i,...o,ref:u,onOpenAutoFocus:Jt(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(YL,{children:s}),r.jsx(JL,{contentRef:c})]})})})});SS.displayName=ji;var NS="AlertDialogTitle",CS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(Fx,{...o,...s,ref:t})});CS.displayName=NS;var ES="AlertDialogDescription",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 QL="AlertDialogAction",RS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(Bx,{...o,...s,ref:t})});RS.displayName=QL;var AS="AlertDialogCancel",PS=f.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=GL(AS,n),i=Hs(n),c=Kn(t,o);return r.jsx(Bx,{...i,...s,ref:c})});PS.displayName=AS;var JL=({contentRef:e})=>{const t=`\`${ji}\` requires a description for the component to be accessible for screen reader users.
|
|
551
|
+
|
|
552
|
+
You can add a description to the \`${ji}\` by passing a \`${ES}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
553
|
+
|
|
554
|
+
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.
|
|
555
|
+
|
|
556
|
+
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},XL=wS,ZL=jS,DS=kS,$S=SS,LS=RS,IS=PS,OS=CS,_S=TS;const fi=XL,e4=ZL,MS=f.forwardRef(({className:e,...t},n)=>r.jsx(DS,{ref:n,className:be("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));MS.displayName=DS.displayName;const sa=f.forwardRef(({className:e,...t},n)=>r.jsxs(e4,{children:[r.jsx(MS,{}),r.jsx($S,{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=$S.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(OS,{ref:n,className:be("text-lg font-semibold tracking-tight text-foreground",e),...t}));oa.displayName=OS.displayName;const aa=f.forwardRef(({className:e,...t},n)=>r.jsx(_S,{ref:n,className:be("text-sm leading-6 text-muted-foreground",e),...t}));aa.displayName=_S.displayName;const vo=f.forwardRef(({className:e,...t},n)=>r.jsx(LS,{ref:n,className:be(e),...t}));vo.displayName=LS.displayName;const xc=f.forwardRef(({className:e,...t},n)=>r.jsx(IS,{ref:n,className:be(e),...t}));xc.displayName=IS.displayName;const t4=[{to:"/",label:"Overview",icon:Wk},{to:"/playbooks",label:"Playbooks",icon:Bk},{to:"/memories",label:"Memories",icon:ZA},{to:"/resources",label:"Resources",icon:gP},{to:"/inventories",label:"Inventories",icon:Af},{to:"/usage",label:"Usage",icon:Dc},{to:"/todos",label:"Todos",icon:zr},{to:"/views",label:"Saved Views",icon:Kk},{to:"/archive",label:"Archive",icon:Tf}],n4=[{suffix:"/projects",label:"Projects",icon:gx},{suffix:"/assignments",label:"Assignments",icon:bP},{suffix:"/servers",label:"Servers",icon:vx},{suffix:"/inventories",label:"Inventories",icon:Af},{suffix:"/usage",label:"Usage",icon:Dc},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Ef},{suffix:"/todos",label:"Todos",icon:zr}],r4=[{to:"/help",label:"Help",icon:xP},{to:"/workflow",label:"Workflow",icon:OP},{to:"/settings",label:"Settings",icon:PP}];function s4({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(sj,{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(kx,{className:"h-4 w-4"})})]}),r.jsx(sj,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(PL,{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 sj({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}=bS(),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 W=new Set(D);return W.has(F)?W.delete(F):W.add(F),W})}const A=LL([...s,...o?[Xd]:[]],i);async function L(F){if(w){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(w)}${F?"?cascade=true":""}`,W=await fetch(D,{method:"DELETE"});if(W.status===409){const Y=await W.json().catch(()=>({}));E((Y==null?void 0:Y.blockedBy)??{projects:[],standalones:[]});return}if(!W.ok){const Y=await W.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 W=await fetch(`/api/projects/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!W.ok){const Y=await W.json().catch(()=>({}));throw new Error(Y.error||"Failed to move project")}return}if(F.type==="standalone-assignment"){const W=await fetch(`/api/assignments/${encodeURIComponent(F.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!W.ok){const Y=await W.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(W){console.error(W),alert(W instanceof Error?W.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($w,{items:t4,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",W=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":""}`}),W]}),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:n4.map(q=>{const I=`${Y}${q.suffix}`,K=a1(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(Rt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx($w,{items:r4,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(xc,{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 o4(){const e=Xn(),{workspace:t}=Mt(),{title:n,breadcrumbs:s,projectSlug:o}=i1(e.pathname);return r.jsx(s4,{title:n,breadcrumbs:s,projectSlug:o,workspace:t??null,children:r.jsx(dA,{})})}function a4(){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 Uf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Wi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function qx(e){return"nodeType"in e}function er(e){var t,n;return e?Wi(e)?e:qx(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Gx(e){const{Document:t}=er(e);return e instanceof t}function _c(e){return Wi(e)?!1:e instanceof er(e).HTMLElement}function FS(e){return e instanceof er(e).SVGElement}function Hi(e){return e?Wi(e)?e.document:qx(e)?Gx(e)?e:_c(e)||FS(e)?e.ownerDocument:document:document:document}const ns=Uf?f.useLayoutEffect:f.useEffect;function Vf(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 i4(){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 yc(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 Zd(e){const t=Vf(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 ef(e){const t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}let Th={};function Fc(e,t){return f.useMemo(()=>{if(t)return t;const n=Th[e]==null?0:Th[e]+1;return Th[e]=n,e+"-"+n},[e,t])}function zS(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=zS(1),bc=zS(-1);function l4(e){return"clientX"in e&&"clientY"in e}function Wf(e){if(!e)return!1;const{KeyboardEvent:t}=er(e.target);return t&&e instanceof t}function c4(e){if(!e)return!1;const{TouchEvent:t}=er(e.target);return t&&e instanceof t}function tf(e){if(c4(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 l4(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}}}),oj="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function u4(e){return e.matches(oj)?e:e.querySelector(oj)}const d4={display:"none"};function f4(e){let{id:t,value:n}=e;return Pt.createElement("div",{id:t,style:d4},n)}function p4(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 m4(){const[e,t]=f.useState("");return{announce:f.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const BS=f.createContext(null);function h4(e){const t=f.useContext(BS);f.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function g4(){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 x4={draggable:`
|
|
557
|
+
To pick up a draggable item, press the space bar.
|
|
558
|
+
While dragging, use the arrow keys to move the item.
|
|
559
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
560
|
+
`},y4={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 b4(e){let{announcements:t=y4,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=x4}=e;const{announce:i,announcement:c}=m4(),u=Fc("DndLiveRegion"),[d,m]=f.useState(!1);if(f.useEffect(()=>{m(!0)},[]),h4(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(f4,{id:s,value:o.draggable}),Pt.createElement(p4,{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 nf(){}function ko(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Hf(){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 US(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function v4(e,t){const n=tf(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 VS(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function w4(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function aj(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 WS(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function ij(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 Kf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=ij(t,t.left,t.top),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=US(ij(d),o);i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(VS)},j4=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=aj(t),i=[];for(const c of s){const{id:u}=c,d=n.get(u);if(d){const m=aj(d),h=o.reduce((y,b,N)=>y+US(m[N],b),0),g=Number((h/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:g}})}}return i.sort(VS)};function k4(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 S4=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=k4(u,t);d>0&&o.push({id:c,data:{droppableContainer:i,value:d}})}}return o.sort(w4)};function N4(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function HS(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ss}function C4(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 E4=C4(1);function KS(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 T4(e,t,n){const s=KS(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 R4={ignoreTransform:!1};function Ki(e,t){t===void 0&&(t=R4);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=er(e).getComputedStyle(e);m&&(n=T4(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 lj(e){return Ki(e,{ignoreTransform:!0})}function A4(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function P4(e,t){return t===void 0&&(t=er(e).getComputedStyle(e)),t.position==="fixed"}function D4(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 qf(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(Gx(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!_c(o)||FS(o)||n.includes(o))return n;const i=er(e).getComputedStyle(o);return o!==e&&D4(o,i)&&n.push(o),P4(o,i)?n:s(o.parentNode)}return e?s(e):n}function qS(e){const[t]=qf(e,1);return t??null}function Rh(e){return!Uf||!e?null:Wi(e)?e:qx(e)?Gx(e)||e===Hi(e).scrollingElement?window:_c(e)?e:null:null}function GS(e){return Wi(e)?e.scrollX:e.scrollLeft}function YS(e){return Wi(e)?e.scrollY:e.scrollTop}function Tg(e){return{x:GS(e),y:YS(e)}}var Dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Dn||(Dn={}));function QS(e){return!Uf||!e?!1:e===document.scrollingElement}function JS(e){const t={x:0,y:0},n=QS(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 $4={x:.2,y:.2};function L4(e,t,n,s,o){let{top:i,left:c,right:u,bottom:d}=n;s===void 0&&(s=10),o===void 0&&(o=$4);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=JS(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 I4(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 XS(e){return e.reduce((t,n)=>ki(t,Tg(n)),ss)}function O4(e){return e.reduce((t,n)=>t+GS(n),0)}function _4(e){return e.reduce((t,n)=>t+YS(n),0)}function ZS(e,t){if(t===void 0&&(t=Ki),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);qS(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const M4=[["x",["left","right"],O4],["y",["top","bottom"],_4]];class Yx{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=qf(n),o=XS(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of M4)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 rc{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 F4(e){const{EventTarget:t}=er(e);return e instanceof t?e:Hi(e)}function Ah(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 cj(e){e.preventDefault()}function z4(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 eN={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},B4=(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 qi{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 rc(Hi(n)),this.windowListeners=new rc(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&&ZS(s),n(ss)}handleKeyDown(t){if(Wf(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=eN,coordinateGetter:c=B4,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=bc(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}=JS(w),A=I4(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,W=v===wt.Right&&D<=P.x||v===wt.Left&&D>=R.x;if(W&&!y.y){w.scrollTo({left:D,behavior:u});return}W?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,W=v===wt.Down&&D<=P.y||v===wt.Up&&D>=R.y;if(W&&!y.x){w.scrollTo({top:D,behavior:u});return}W?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(bc(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()}}qi.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=eN,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 uj(e){return!!(e&&"distance"in e)}function dj(e){return!!(e&&"delay"in e)}class Qx{constructor(t,n,s){var o;s===void 0&&(s=F4(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=Hi(c),this.documentListeners=new rc(this.document),this.listeners=new rc(s),this.windowListeners=new rc(er(c)),this.initialCoordinates=(o=tf(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,cj),this.windowListeners.add(Mr.VisibilityChange,this.handleCancel),this.windowListeners.add(Mr.ContextMenu,cj),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(dj(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(uj(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,z4,{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=tf(t))!=null?n:ss,m=bc(o,d);if(!s&&u){if(uj(u)){if(u.tolerance!=null&&Ah(m,u.tolerance))return this.handleCancel();if(Ah(m,u.distance))return this.handleStart()}if(dj(u)&&Ah(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 U4={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Gi extends Qx{constructor(t){const{event:n}=t,s=Hi(n.target);super(t,U4,s)}}Gi.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 V4={move:{name:"mousemove"},end:{name:"mouseup"}};var Rg;(function(e){e[e.RightClick=2]="RightClick"})(Rg||(Rg={}));class W4 extends Qx{constructor(t){super(t,V4,Hi(t.event.target))}}W4.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===Rg.RightClick?!1:(s==null||s({event:n}),!0)}}];const Ph={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class H4 extends Qx{constructor(t){super(t,Ph)}static setup(){return window.addEventListener(Ph.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ph.move.name,t)};function t(){}}}H4.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 sc;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(sc||(sc={}));var rf;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(rf||(rf={}));function K4(e){let{acceleration:t,activator:n=sc.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:c=5,order:u=rf.TreeOrder,pointerCoordinates:d,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=G4({delta:g,disabled:!i}),[N,w]=i4(),v=f.useRef({x:0,y:0}),k=f.useRef({x:0,y:0}),E=f.useMemo(()=>{switch(n){case sc.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case sc.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===rf.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}=L4(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 q4={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function G4(e){let{delta:t,disabled:n}=e;const s=ef(t);return Mc(o=>{if(n||!s||!o)return q4;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 Y4(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 Q4(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 vc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(vc||(vc={}));var Ag;(function(e){e.Optimized="optimized"})(Ag||(Ag={}));const fj=new Map;function J4(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=yc(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 fj;if(!k||k===fj||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 Yx(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 vc.Always:return!1;case vc.BeforeDragging:return n;default:return!n}}}function Jx(e,t){return Mc(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function X4(e,t){return Jx(e,t)}function Z4(e){let{callback:t,disabled:n}=e;const s=Vf(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 Gf(e){let{callback:t,disabled:n}=e;const s=Vf(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 eI(e){return new Yx(Ki(e),e)}function pj(e,t,n){t===void 0&&(t=eI);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=Z4({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=Gf({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 tI(e){const t=Jx(e);return HS(e,t)}const mj=[];function nI(e){const t=f.useRef(e),n=Mc(s=>e?s&&s!==mj&&e&&t.current&&e.parentNode===t.current.parentNode?s:qf(e):mj,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function rI(e){const[t,n]=f.useState(null),s=f.useRef(e),o=f.useCallback(i=>{const c=Rh(i.target);c&&n(u=>u?(u.set(c,Tg(c)),new Map(u)):null)},[]);return f.useEffect(()=>{const i=s.current;if(e!==i){c(i);const u=e.map(d=>{const m=Rh(d);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Tg(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=Rh(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):XS(e):ss,[e,t])}function hj(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?bc(e,n.current):ss}function sI(e){f.useEffect(()=>{if(!Uf)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 oI(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 tN(e){return f.useMemo(()=>e?A4(e):null,[e])}const gj=[];function aI(e,t){t===void 0&&(t=Ki);const[n]=e,s=tN(n?er(n):null),[o,i]=f.useState(gj);function c(){i(()=>e.length?e.map(d=>QS(d)?s:new Yx(t(d),d)):gj)}const u=Gf({callback:c});return ns(()=>{u==null||u.disconnect(),c(),e.forEach(d=>u==null?void 0:u.observe(d))},[e]),o}function nN(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return _c(t)?t:e}function iI(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=Gf({callback:o}),c=f.useCallback(m=>{const h=nN(m);i==null||i.disconnect(),h&&(i==null||i.observe(h)),s(h?t(h):null)},[t,i]),[u,d]=Zd(c);return f.useMemo(()=>({nodeRef:u,rect:n,setRef:d}),[n,u,d])}const lI=[{sensor:Gi,options:{}},{sensor:qi,options:{}}],cI={current:{}},Id={draggable:{measure:lj},droppable:{measure:lj,strategy:vc.WhileDragging,frequency:Ag.Optimized},dragOverlay:{measure:Ki}};class oc 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 uI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new oc,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nf},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Id,measureDroppableContainers:nf,windowRect:null,measuringScheduled:!1},rN={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nf,draggableNodes:new Map,over:null,measureDroppableContainers:nf},zc=f.createContext(rN),sN=f.createContext(uI);function dI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new oc}}}function fI(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 oc(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 oc(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 oc(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function pI(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=f.useContext(zc),i=ef(s),c=ef(n==null?void 0:n.id);return f.useEffect(()=>{if(!t&&!s&&i&&c!=null){if(!Wf(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=u4(h);if(g){g.focus();break}}})}},[s,t,o,c,i]),null}function oN(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function mI(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 hI(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=HS(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=qS(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const Yf=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 Qf=f.memo(function(t){var n,s,o,i;let{id:c,accessibility:u,autoScroll:d=!0,children:m,sensors:h=lI,collisionDetection:g=S4,measuring:y,modifiers:b,...N}=t;const w=f.useReducer(fI,void 0,dI),[v,k]=w,[E,S]=g4(),[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,W=f.useRef({initial:null,translated:null}),Y=f.useMemo(()=>{var pe;return A!=null?{id:A,data:(pe=D==null?void 0:D.data)!=null?pe:cI,rect:W}:null},[A,D]),_=f.useRef(null),[z,H]=f.useState(null),[q,I]=f.useState(null),K=yc(N,Object.values(N)),$=Fc("DndDescribedBy",c),V=f.useMemo(()=>F.getEnabled(),[F]),ee=mI(y),{droppableRects:B,measureDroppableContainers:ue,measuringScheduled:ye}=J4(V,{dragging:R,dependencies:[M.x,M.y],config:ee.droppable}),se=Y4(L,A),ge=f.useMemo(()=>q?tf(q):null,[q]),ke=st(),Re=X4(se,ee.draggable.measure);hI({activeNode:A!=null?L.get(A):null,config:ke.layoutShiftCompensation,initialRect:Re,measure:ee.draggable.measure});const Ae=pj(se,ee.draggable.measure,Re),Je=pj(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=iI({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=tI(Ee?null:Ae),Ye=tN(Z?er(Z):null),Me=nI(R?Ze??se:null),et=aI(Me),Qe=oN(b,{transform:{x:M.x-Ie.x,y:M.y-Ie.y,scaleX:1,scaleY:1},activatorEvent:q,active:Y,activeNodeRect:Ae,containerNodeRect:Je,draggingNodeRect:_e,over:at.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Me,scrollableAncestorRects:et,windowRect:Ye}),$t=ge?ki(ge,M):null,vt=rI(Me),ct=hj(vt),ie=hj(vt,[Ae]),Q=ki(Qe,ct),me=_e?E4(_e,Qe):null,re=Y&&me?g({active:Y,collisionRect:me,droppableRects:B,droppableContainers:V,pointerCoordinates:$t}):null,xe=WS(re,"id"),[Pe,ve]=f.useState(null),te=Ee?Qe:ki(Qe,ie),de=N4(te,(i=Pe==null?void 0:Pe.rect)!=null?i:null,Ae),Se=f.useRef(null),Ue=f.useCallback((pe,Oe)=>{let{sensor:qe,options:Lt}=Oe;if(_.current==null)return;const Xt=L.get(_.current);if(!Xt)return;const dn=pe.nativeEvent,Gt=new qe({active:_.current,activeNode:Xt,event:dn,options:Lt,context:at,onAbort(Ct){if(!L.get(Ct))return;const{onDragAbort:Et}=K.current,oe={id:Ct};Et==null||Et(oe),E({type:"onDragAbort",event:oe})},onPending(Ct,Fn,Et,oe){if(!L.get(Ct))return;const{onDragPending:tt}=K.current,yt={id:Ct,constraint:Fn,initialCoordinates:Et,offset:oe};tt==null||tt(yt),E({type:"onDragPending",event:yt})},onStart(Ct){const Fn=_.current;if(Fn==null)return;const Et=L.get(Fn);if(!Et)return;const{onDragStart:oe}=K.current,ze={activatorEvent:dn,active:{id:Fn,data:Et.data,rect:W}};Fs.unstable_batchedUpdates(()=>{oe==null||oe(ze),P(bo.Initializing),k({type:Sn.DragStart,initialCoordinates:Ct,active:Fn}),E({type:"onDragStart",event:ze}),H(Se.current),I(dn)})},onMove(Ct){k({type:Sn.DragMove,coordinates:Ct})},onEnd:Gn(Sn.DragEnd),onCancel:Gn(Sn.DragCancel)});Se.current=Gt;function Gn(Ct){return async function(){const{active:Et,collisions:oe,over:ze,scrollAdjustedTranslate:tt}=at.current;let yt=null;if(Et&&tt){const{cancelDrop:tr}=K.current;yt={activatorEvent:dn,active:Et,collisions:oe,delta:tt,over:ze},Ct===Sn.DragEnd&&typeof tr=="function"&&await Promise.resolve(tr(yt))&&(Ct=Sn.DragCancel)}_.current=null,Fs.unstable_batchedUpdates(()=>{k({type:Ct}),P(bo.Uninitialized),ve(null),H(null),I(null),Se.current=null;const tr=Ct===Sn.DragEnd?"onDragEnd":"onDragCancel";if(yt){const qr=K.current[tr];qr==null||qr(yt),E({type:tr,event:yt})}})}}},[L]),le=f.useCallback((pe,Oe)=>(qe,Lt)=>{const Xt=qe.nativeEvent,dn=L.get(Lt);if(_.current!==null||!dn||Xt.dndKit||Xt.defaultPrevented)return;const Gt={active:dn};pe(qe,Oe.options,Gt)===!0&&(Xt.dndKit={capturedBy:Oe.sensor},_.current=Lt,Ue(qe,Oe))},[L,Ue]),pt=Q4(h,le);sI(h),ns(()=>{Ae&&T===bo.Initializing&&P(bo.Initialized)},[Ae,T]),f.useEffect(()=>{const{onDragMove:pe}=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:Q.x,y:Q.y},over:Xt};Fs.unstable_batchedUpdates(()=>{pe==null||pe(dn),E({type:"onDragMove",event:dn})})},[Q.x,Q.y]),f.useEffect(()=>{const{active:pe,activatorEvent:Oe,collisions:qe,droppableContainers:Lt,scrollAdjustedTranslate:Xt}=at.current;if(!pe||_.current==null||!Oe||!Xt)return;const{onDragOver:dn}=K.current,Gt=Lt.get(xe),Gn=Gt&&Gt.rect.current?{id:Gt.id,rect:Gt.rect.current,data:Gt.data,disabled:Gt.disabled}:null,Ct={active:pe,activatorEvent:Oe,collisions:qe,delta:{x:Xt.x,y:Xt.y},over:Gn};Fs.unstable_batchedUpdates(()=>{ve(Gn),dn==null||dn(Ct),E({type:"onDragOver",event:Ct})})},[xe]),ns(()=>{at.current={activatorEvent:q,active:Y,activeNode:se,collisionRect:me,collisions:re,droppableRects:B,draggableNodes:L,draggingNode:Z,draggingNodeRect:_e,droppableContainers:F,over:Pe,scrollableAncestors:Me,scrollAdjustedTranslate:Q},W.current={initial:_e,translated:me}},[Y,se,re,me,L,Z,_e,B,F,Pe,Me,Q]),K4({...ke,delta:M,draggingRect:me,pointerCoordinates:$t,scrollableAncestors:Me,scrollableAncestorRects:et});const xt=f.useMemo(()=>({active:Y,activeNode:se,activeNodeRect:Ae,activatorEvent:q,collisions:re,containerNodeRect:Je,dragOverlay:ot,draggableNodes:L,droppableContainers:F,droppableRects:B,over:Pe,measureDroppableContainers:ue,scrollableAncestors:Me,scrollableAncestorRects:et,measuringConfiguration:ee,measuringScheduled:ye,windowRect:Ye}),[Y,se,Ae,q,re,Je,ot,L,F,B,Pe,ue,Me,et,ee,ye,Ye]),jt=f.useMemo(()=>({activatorEvent:q,activators:pt,active:Y,activeNodeRect:Ae,ariaDescribedById:{draggable:$},dispatch:k,draggableNodes:L,over:Pe,measureDroppableContainers:ue}),[q,pt,Y,Ae,k,$,L,Pe,ue]);return Pt.createElement(BS.Provider,{value:S},Pt.createElement(zc.Provider,{value:jt},Pt.createElement(sN.Provider,{value:xt},Pt.createElement(Yf.Provider,{value:de},m)),Pt.createElement(pI,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Pt.createElement(b4,{...u,hiddenTextDescribedById:$}));function st(){const pe=(z==null?void 0:z.autoScrollEnabled)===!1,Oe=typeof d=="object"?d.enabled===!1:d===!1,qe=R&&!pe&&!Oe;return typeof d=="object"?{...d,enabled:qe}:{enabled:qe}}}),gI=f.createContext(null),xj="button",xI="Draggable";function yI(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Fc(xI),{activators:c,activatorEvent:u,active:d,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=f.useContext(zc),{role:b=xj,roleDescription:N="draggable",tabIndex:w=0}=o??{},v=(d==null?void 0:d.id)===t,k=f.useContext(v?Yf:gI),[E,S]=Zd(),[T,P]=Zd(),R=oI(c,t),A=yc(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===xj?!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 aN(){return f.useContext(sN)}const bI="Droppable",vI={timeout:25};function wI(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Fc(bI),{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}={...vI,...o},k=yc(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=Gf({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]=Zd(T),A=yc(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 jI(e){let{animation:t,children:n}=e;const[s,o]=f.useState(null),[i,c]=f.useState(null),u=ef(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 kI={x:0,y:0,scaleX:1,scaleY:1};function SI(e){let{children:t}=e;return Pt.createElement(zc.Provider,{value:rN},Pt.createElement(Yf.Provider,{value:kI},t))}const NI={position:"fixed",touchAction:"none"},CI=e=>Wf(e)?"transform 250ms ease":void 0,EI=f.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:o,children:i,className:c,rect:u,style:d,transform:m,transition:h=CI}=e;if(!u)return null;const g=o?m:{...m,scaleX:1,scaleY:1},y={...NI,width:u.width,height:u.height,top:u.top,left:u.left,transform:rs.Transform.toString(g),transformOrigin:o&&s?v4(s,u):void 0,transition:typeof h=="function"?h(s):h,...d};return Pt.createElement(n,{className:c,style:y,ref:t},i)}),TI=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)}},RI=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rs.Transform.toString(t)},{transform:rs.Transform.toString(n)}]},AI={duration:250,easing:"ease",keyframes:RI,sideEffects:TI({styles:{active:{opacity:"0"}}})};function PI(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:o}=e;return Vf((i,c)=>{if(t===null)return;const u=n.get(i);if(!u)return;const d=u.node.current;if(!d)return;const m=nN(c);if(!m)return;const{transform:h}=er(c).getComputedStyle(c),g=KS(h);if(!g)return;const y=typeof t=="function"?t:DI(t);return ZS(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 DI(e){const{duration:t,easing:n,sideEffects:s,keyframes:o}={...AI,...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 yj=0;function $I(e){return f.useMemo(()=>{if(e!=null)return yj++,yj},[e])}const LI=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}=aN(),R=f.useContext(Yf),A=$I(g==null?void 0:g.id),L=oN(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=Jx(y),F=PI({config:s,draggableNodes:N,droppableContainers:w,measuringConfiguration:E}),D=M?v.setRef:void 0;return Pt.createElement(SI,null,Pt.createElement(jI,{animation:F},g&&A?Pt.createElement(EI,{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 Yi(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function II(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 OI(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 _I(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Xx=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=Yi(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},Zx=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=MI(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 MI(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 iN="Sortable",lN=Pt.createContext({activeIndex:-1,containerId:iN,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Xx,disabled:{draggable:!1,droppable:!1}});function Jf(e){let{children:t,id:n,items:s,strategy:o=Xx,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:d,over:m,measureDroppableContainers:h}=aN(),g=Fc(iN,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=!OI(b,k.current),S=v!==-1&&w===-1||E,T=_I(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:II(b,d),strategy:o}),[w,g,T.draggable,T.droppable,S,b,v,d,y,o]);return Pt.createElement(lN.Provider,{value:P},t)}const FI=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return Yi(n,s,o).indexOf(t)},zI=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},BI={duration:200,easing:"ease"},cN="transform",UI=rs.Transition.toString({property:cN,duration:0,easing:"linear"}),VI={roleDescription:"sortable"};function WI(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=Ki(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 Xf(e){let{animateLayoutChanges:t=zI,attributes:n,disabled:s,data:o,getNewIndex:i=FI,id:c,strategy:u,resizeObserverConfig:d,transition:m=BI}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:N,sortedRects:w,overIndex:v,useDragOverlay:k,strategy:E}=f.useContext(lN),S=HI(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}=wI({id:c,data:P,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:D,activatorEvent:W,activeNodeRect:Y,attributes:_,setNodeRef:z,listeners:H,isDragging:q,over:I,setActivatorNodeRef:K,transform:$}=yI({id:c,data:P,attributes:{...VI,...n},disabled:S.draggable}),V=a4(F,z),ee=!!D,B=ee&&!N&&md(y)&&md(v),ue=!k&&q,ye=ue&&B?$:null,ge=B?ye??(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}),Je=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=WI({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:V,setActivatorNodeRef:K,setDroppableNodeRef:F,setDraggableNodeRef:z,transform:Ze??ge,transition:ot()};function ot(){if(Ze||Je&&Ae.current.newIndex===T)return UI;if(!(ue&&!Wf(W)||!m)&&(ee||at))return rs.Transition.toString({...m,property:cN})}}function HI(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 sf(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 KI=[wt.Down,wt.Right,wt.Up,wt.Left],uN=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:o,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(KI.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=j4({collisionRect:s,droppableRects:o,droppableContainers:d});let h=WS(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=qf(N).some((R,A)=>u[A]!==R),k=dN(g,y),E=qI(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:bc(T,S)}}}};function dN(e,t){return!sf(e)||!sf(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function qI(e,t){return!sf(e)||!sf(t)||!dN(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function gt({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 Nt({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 Ve({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 GI({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(Ve,{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 Dh={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 YI(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function QI({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:Dh.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=Dh[e.copyKey]??Dh[e.kind],c=YI(i,{total:e.total,title:o}),u=s?JI(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 JI(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const ey=["kanban","list","table"],fN=["title","status","priority","assignee","dependencies","created","updated"],XI=["asc","desc"],ZI=["comfortable","compact"],eO=["none","status","type","priority","assignee","project"],tO=["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 nO(e,t){const n=Fe(e),s=Fe(t);return n.length===s.length&&n.every(o=>s.includes(o))}const rO={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},wc={version:1,global:rO,projects:{}};function $h(e){return e==="table"?"table":"kanban"}function sO(e,t){return t?{...e,...t}:{...e}}function pN(e,t){const n=e.global;if(t===null)return n;const s=e.projects[t];return s?{defaultView:s.defaultView??n.defaultView,sortField:s.sortField??n.sortField,sortDirection:s.sortDirection??n.sortDirection,density:n.density,grouping:s.grouping??n.grouping,filters:sO(n.filters,s.filters)}:n}const oO=/^[A-Za-z_][A-Za-z0-9_-]*$/,aO=new Set(["and","or","not"]);function mN(e){return oO.test(e)&&!aO.has(e.toLowerCase())?e:hN(e)}function hN(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const gN="__unassigned__",xN="__standalone__",iO={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function lO(e){return e.startsWith("older_")?"<":">="}const ty=["status","type","priority","assignee","project","tags"],cO=["created","updated"];function uO(e){var i;const t={};for(const c of ty){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=dO(o);if(c)s||(s=c);else{const u=fO(o);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function dO(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function fO(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 ac(e){const t=uO(e),n=[];for(const s of ty){const o=t[s]??[];o.length&&n.push(pO(s,o))}return t.search&&n.push(`search:${hN(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...hO(t.dateRange)),n.join(" AND ")}function pO(e,t){const n=t.map(s=>mO(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function mO(e,t){return e==="assignee"&&t===gN||e==="project"&&t===xN?"none":mN(t)}function hO(e){if(e.preset)return[`${e.field} ${lO(e.preset)} -${iO[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function ic(e){const t=_f(e);if(!t.ast)return null;const n=gO(t.ast);if(n===null)return null;const s={},o=new Set,i=new Map;for(const c of n){const u=xO(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 gO(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 xO(e){const t=e.field.toLowerCase();if(e.op===":"){if(ty.includes(t)){const o=t,i=[];for(const c of e.values){const u=jO(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(!cO.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?yO(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 yO(e,t,n){if(n.sign!==-1)return null;const s=bO(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=wO(t,s);return o?{kind:"datePreset",field:e,preset:o}:null}function bO(e){return e.replace(/^[-+]/,"")}const vO={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function wO(e,t){return e!==">="&&e!=="<"?null:vO[e][t]??null}function jO(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?gN:e==="project"&&n.toLowerCase()==="none"?xN:n}const Lh=["title","status","priority","assignee","dependencies","created","updated"],jc=24,yN=60;function kO(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=jc&&Number.isInteger(t.h)&&t.h>=1&&t.h<=yN}const SO={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},bj="2026-05-21T00:00:00Z";function Ih(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...SO,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:bj,updatedAt:bj}}const wo={version:1,views:[Ih("default-recently-updated","Recently updated",{}),Ih("default-high-priority","High priority",{priority:"high"}),Ih("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 bN(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&&ic(c)===null;return s&&(!o||o==="all")&&!i&&!u}function vN(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?bN(e.config,t.slug):!1}}const wN=`syntaur.savedViews.cache.v${wo.version}`;let Si=NO(),Zo=null,ny=null;const Pg=new Set,of=new Set;let jN=0;function kN(){return++jN}function Dg(e){return e===jN}function NO(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(wN);if(!e)return null;const t=JSON.parse(e);return t.version!==wo.version?null:t}catch{return null}}function CO(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(wN,JSON.stringify(e))}catch{}}function SN(e){Si=e,ny=null,CO(e);for(const t of Pg)t(e);for(const t of of)t(null)}function EO(e){ny=e;for(const t of of)t(e)}function NN(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 vj(){if(Zo)return Zo;const e=kN();return Zo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=NN(t);return Dg(e)&&SN(n),Zo=null,Si??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Dg(e)&&EO(n),Zo=null,Si??wo}),Zo}function ry(){const[e,t]=f.useState(()=>Si??wo),[n,s]=f.useState(()=>Si===null),[o,i]=f.useState(!1),[c,u]=f.useState(()=>ny);return f.useEffect(()=>{let m=!1;Si===null&&s(!0),vj().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 Pg.add(h),of.add(g),()=>{m=!0,Pg.delete(h),of.delete(g)}},[]),{file:e,loading:n,ready:o,error:c,refetch:()=>{Zo=null,s(!0),u(null),i(!1),vj()}}}function Bc(){const{file:e,loading:t}=ry();return{views:e.views,loading:t}}function CN(){const{file:e,loading:t}=ry();return{layout:e.dashboard,loading:t}}function So(e){const{file:t,loading:n,ready:s,error:o,refetch:i}=ry();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 Zf(e,t,n){const s=kN(),o=await fetch(t,{method:e,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0});if(!o.ok){const c=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(c.error??`HTTP ${o.status}`)}const i=NN(await o.json());return Dg(s)&&SN(i),i}function $i(e){return Zf("POST","/api/saved-views",e)}function af(e,t){return Zf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function TO(e){return Zf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function $g(e){return Zf("PUT","/api/dashboard",{slots:e})}const RO=["top","right","bottom","left"],No=Math.min,Sr=Math.max,lf=Math.round,gd=Math.floor,Ss=e=>({x:e,y:e}),AO={left:"right",right:"left",bottom:"top",top:"bottom"};function Lg(e,t,n){return Sr(e,No(t,n))}function Vs(e,t){return typeof e=="function"?e(t):e}function Ws(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function sy(e){return e==="x"?"y":"x"}function oy(e){return e==="y"?"height":"width"}function ws(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ay(e){return sy(ws(e))}function PO(e,t,n){n===void 0&&(n=!1);const s=Qi(e),o=ay(e),i=oy(o);let c=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=cf(c)),[c,cf(c)]}function DO(e){const t=cf(e);return[Ig(e),t,Ig(t)]}function Ig(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const wj=["left","right"],jj=["right","left"],$O=["top","bottom"],LO=["bottom","top"];function IO(e,t,n){switch(e){case"top":case"bottom":return n?t?jj:wj:t?wj:jj;case"left":case"right":return t?$O:LO;default:return[]}}function OO(e,t,n,s){const o=Qi(e);let i=IO(Ws(e),n==="start",s);return o&&(i=i.map(c=>c+"-"+o),t&&(i=i.concat(i.map(Ig)))),i}function cf(e){const t=Ws(e);return AO[t]+e.slice(t.length)}function _O(e){return{top:0,right:0,bottom:0,left:0,...e}}function EN(e){return typeof e!="number"?_O(e):{top:e,right:e,bottom:e,left:e}}function uf(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 kj(e,t,n){let{reference:s,floating:o}=e;const i=ws(t),c=ay(t),u=oy(c),d=Ws(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 MO(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:c,elements:u,strategy:d}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Vs(t,e),N=EN(b),v=u[y?g==="floating"?"reference":"floating":g],k=uf(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=uf(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 FO=50,zO=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:MO},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}=kj(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<FO&&(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}=kj(m,y,d)),w=-1)}return{x:h,y:g,placement:y,strategy:o,middlewareData:N}},BO=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:c,elements:u,middlewareData:d}=t,{element:m,padding:h=0}=Vs(e,t)||{};if(m==null)return{};const g=EN(h),y={x:n,y:s},b=ay(o),N=oy(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),W=F,Y=A-w[N]-D,_=A/2-w[N]/2+L,z=Lg(W,_,Y),H=!d.arrow&&Qi(o)!=null&&_!==z&&i.reference[N]/2-(_<W?F:D)-w[N]/2<0,q=H?_<W?_-W:_-Y:0;return{[b]:y[b]+q,data:{[b]:z,centerOffset:_-z-q,...H&&{alignmentOffset:q}},reset:H}}}),UO=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}=Vs(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Ws(o),E=ws(u),S=Ws(u)===u,T=await(d.isRTL==null?void 0:d.isRTL(m.floating)),P=y||(S||!w?[cf(u)]:DO(u)),R=N!=="none";!y&&R&&P.push(...OO(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 _=PO(o,c,T);M.push(L[_[0]],L[_[1]])}if(F=[...F,{placement:o,overflows:M}],!M.every(_=>_<=0)){var D,W;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=(W=F.filter(q=>q.overflows[0]<=0).sort((q,I)=>q.overflows[1]-I.overflows[1])[0])==null?void 0:W.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 Sj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Nj(e){return RO.some(t=>e[t]>=0)}const VO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=Vs(e,t);switch(o){case"referenceHidden":{const c=await s.detectOverflow(t,{...i,elementContext:"reference"}),u=Sj(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Nj(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...i,altBoundary:!0}),u=Sj(c,n.floating);return{data:{escapedOffsets:u,escaped:Nj(u)}}}default:return{}}}}},TN=new Set(["left","top"]);async function WO(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),c=Ws(n),u=Qi(n),d=ws(n)==="y",m=TN.has(c)?-1:1,h=i&&d?-1:1,g=Vs(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 HO=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 WO(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}}}}},KO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...m}=Vs(e,t),h={x:n,y:s},g=await i.detectOverflow(t,m),y=ws(Ws(o)),b=sy(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=Lg(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=Lg(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}}}}}},qO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:m=!0}=Vs(e,t),h={x:n,y:s},g=ws(o),y=sy(g);let b=h[y],N=h[g];const w=Vs(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=TN.has(Ws(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}}}},GO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:c,elements:u}=t,{apply:d=()=>{},...m}=Vs(e,t),h=await c.detectOverflow(t,m),g=Ws(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),W=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*(W!==0||Y!==0?W+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 ep(){return typeof window<"u"}function Ji(e){return RN(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=(RN(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function RN(e){return ep()?e instanceof Node||e instanceof Tr(e).Node:!1}function os(e){return ep()?e instanceof Element||e instanceof Tr(e).Element:!1}function Ks(e){return ep()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function Cj(e){return!ep()||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 YO(e){return/^(table|td|th)$/.test(Ji(e))}function tp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const QO=/transform|translate|scale|rotate|perspective|filter/,JO=/paint|layout|strict|content/,Qo=e=>!!e&&e!=="none";let Oh;function iy(e){const t=os(e)?as(e):e;return Qo(t.transform)||Qo(t.translate)||Qo(t.scale)||Qo(t.rotate)||Qo(t.perspective)||!ly()&&(Qo(t.backdropFilter)||Qo(t.filter))||QO.test(t.willChange||"")||JO.test(t.contain||"")}function XO(e){let t=Co(e);for(;Ks(t)&&!Li(t);){if(iy(t))return t;if(tp(t))return null;t=Co(t)}return null}function ly(){return Oh==null&&(Oh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Oh}function Li(e){return/^(html|body|#document)$/.test(Ji(e))}function as(e){return Tr(e).getComputedStyle(e)}function np(e){return os(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Co(e){if(Ji(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Cj(e)&&e.host||Es(e);return Cj(t)?t.host:t}function AN(e){const t=Co(e);return Li(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ks(t)&&Uc(t)?t:AN(t)}function kc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=AN(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),c=Tr(o);if(i){const u=Og(c);return t.concat(c,c.visualViewport||[],Uc(o)?o:[],u&&n?kc(u):[])}else return t.concat(o,kc(o,[],n))}function Og(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function PN(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=lf(n)!==i||lf(s)!==c;return u&&(n=i,s=c),{width:n,height:s,$:u}}function cy(e){return os(e)?e:e.contextElement}function Ni(e){const t=cy(e);if(!Ks(t))return Ss(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=PN(t);let c=(i?lf(n.width):n.width)/s,u=(i?lf(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const ZO=Ss(0);function DN(e){const t=Tr(e);return!ly()||!t.visualViewport?ZO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function e_(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=cy(e);let c=Ss(1);t&&(s?os(s)&&(c=Ni(s)):c=Ni(e));const u=e_(i,n,s)?DN(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=Og(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=Og(N)}}return uf({width:h,height:g,x:d,y:m})}function rp(e,t){const n=np(e).scrollLeft;return t?t.left+n:pa(Es(e)).left+n}function $N(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-rp(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function t_(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",c=Es(s),u=t?tp(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)&&((Ji(s)!=="body"||Uc(c))&&(d=np(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?$N(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 n_(e){return Array.from(e.getClientRects())}function r_(e){const t=Es(e),n=np(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+rp(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 Ej=25;function s_(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=ly();(!h||h&&t==="fixed")&&(u=o.offsetLeft,d=o.offsetTop)}const m=rp(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<=Ej&&(i-=N)}else m<=Ej&&(i+=m);return{width:i,height:c,x:u,y:d}}function o_(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 Tj(e,t,n){let s;if(t==="viewport")s=s_(e,n);else if(t==="document")s=r_(Es(e));else if(os(t))s=o_(t,n);else{const o=DN(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return uf(s)}function LN(e,t){const n=Co(e);return n===t||!os(n)||Li(n)?!1:as(n).position==="fixed"||LN(n,t)}function a_(e,t){const n=t.get(e);if(n)return n;let s=kc(e,[],!1).filter(u=>os(u)&&Ji(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=iy(c);!d&&u.position==="fixed"&&(o=null),(i?!d&&!o:!d&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Uc(c)&&!d&&LN(e,c))?s=s.filter(h=>h!==c):o=u,c=Co(c)}return t.set(e,s),s}function i_(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const c=[...n==="clippingAncestors"?tp(t)?[]:a_(t,this._c):[].concat(n),s],u=Tj(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=Tj(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 l_(e){const{width:t,height:n}=PN(e);return{width:t,height:n}}function c_(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=rp(o)}if(s||!s&&!i)if((Ji(t)!=="body"||Uc(o))&&(u=np(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?$N(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 _h(e){return as(e).position==="static"}function Rj(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 IN(e,t){const n=Tr(e);if(tp(e))return n;if(!Ks(e)){let o=Co(e);for(;o&&!Li(o);){if(os(o)&&!_h(o))return o;o=Co(o)}return n}let s=Rj(e,t);for(;s&&YO(s)&&_h(s);)s=Rj(s,t);return s&&Li(s)&&_h(s)&&!iy(s)?n:s||XO(e)||n}const u_=async function(e){const t=this.getOffsetParent||IN,n=this.getDimensions,s=await n(e.floating);return{reference:c_(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function d_(e){return as(e).direction==="rtl"}const f_={convertOffsetParentRelativeRectToViewportRelativeRect:t_,getDocumentElement:Es,getClippingRect:i_,getOffsetParent:IN,getElementRects:u_,getClientRects:n_,getDimensions:l_,getScale:Ni,isElement:os,isRTL:d_};function ON(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function p_(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&&!ON(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 m_(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=cy(e),h=o||i?[...m?kc(m):[],...t?kc(t):[]]:[];h.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const g=m&&u?p_(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&&!ON(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 h_=HO,g_=KO,x_=UO,y_=GO,b_=VO,Aj=BO,v_=qO,w_=(e,t,n)=>{const s=new Map,o={platform:f_,...n},i={...o.platform,_c:s};return zO(e,t,{...o,platform:i})};var j_=typeof document<"u",k_=function(){},_d=j_?f.useLayoutEffect:k_;function df(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(!df(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)&&!df(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function _N(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pj(e,t){const n=_N(e);return Math.round(t*n)/n}function Mh(e){const t=f.useRef(e);return _d(()=>{t.current=e}),t}function S_(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);df(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=Mh(d),D=Mh(o),W=Mh(m),Y=f.useCallback(()=>{if(!R.current||!A.current)return;const I={placement:t,strategy:n,middleware:y};D.current&&(I.platform=D.current),w_(R.current,A.current,I).then(K=>{const $={...K,isPositioned:W.current!==!1};_.current&&!df(L.current,$)&&(L.current=$,Fs.flushSync(()=>{g($)}))})},[y,t,n,D,W]);_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=Pj(H.floating,h.x),$=Pj(H.floating,h.y);return u?{...I,transform:"translate("+K+"px, "+$+"px)",..._N(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 N_=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?Aj({element:s.current,padding:o}).fn(n):{}:s?Aj({element:s,padding:o}).fn(n):{}}}},C_=(e,t)=>{const n=h_(e);return{name:n.name,fn:n.fn,options:[e,t]}},E_=(e,t)=>{const n=g_(e);return{name:n.name,fn:n.fn,options:[e,t]}},T_=(e,t)=>({fn:v_(e).fn,options:[e,t]}),R_=(e,t)=>{const n=x_(e);return{name:n.name,fn:n.fn,options:[e,t]}},A_=(e,t)=>{const n=y_(e);return{name:n.name,fn:n.fn,options:[e,t]}},P_=(e,t)=>{const n=b_(e);return{name:n.name,fn:n.fn,options:[e,t]}},D_=(e,t)=>{const n=N_(e);return{name:n.name,fn:n.fn,options:[e,t]}};var $_="Arrow",MN=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"})})});MN.displayName=$_;var L_=MN;function I_(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 uy="Popper",[FN,zN]=ha(uy),[O_,BN]=FN(uy),UN=e=>{const{__scopePopper:t,children:n}=e,[s,o]=f.useState(null);return r.jsx(O_,{scope:t,anchor:s,onAnchorChange:o,children:n})};UN.displayName=uy;var VN="PopperAnchor",WN=f.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=BN(VN,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})});WN.displayName=VN;var dy="PopperContent",[__,M_]=FN(dy),HN=f.forwardRef((e,t)=>{var ge,ke,Re,Ae,Je,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=BN(dy,n),[k,E]=f.useState(null),S=Kn(t,Ze=>E(Ze)),[T,P]=f.useState(null),R=I_(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],W=D.length>0,Y={padding:F,boundary:D.filter(z_),altBoundary:W},{refs:_,floatingStyles:z,placement:H,isPositioned:q,middlewareData:I}=S_({strategy:"fixed",placement:M,whileElementsMounted:(...Ze)=>m_(...Ze,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[C_({mainAxis:o+L,alignmentAxis:c}),d&&E_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?T_():void 0,...Y}),d&&R_({...Y}),A_({...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&&D_({element:T,padding:u}),B_({arrowWidth:A,arrowHeight:L}),y&&P_({strategy:"referenceHidden",...Y})]}),[K,$]=GN(H),V=da(N);jo(()=>{q&&(V==null||V())},[q,V]);const ee=(ge=I.arrow)==null?void 0:ge.x,B=(ke=I.arrow)==null?void 0:ke.y,ue=((Re=I.arrow)==null?void 0:Re.centerOffset)!==0,[ye,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:ye,"--radix-popper-transform-origin":[(Ae=I.transformOrigin)==null?void 0:Ae.x,(Je=I.transformOrigin)==null?void 0:Je.y].join(" "),...((at=I.hide)==null?void 0:at.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(__,{scope:n,placedSide:K,onArrowChange:P,arrowX:ee,arrowY:B,shouldHideArrow:ue,children:r.jsx(vn.div,{"data-side":K,"data-align":$,...w,ref:S,style:{...w.style,animation:q?void 0:"none"}})})})});HN.displayName=dy;var KN="PopperArrow",F_={top:"bottom",right:"left",bottom:"top",left:"right"},qN=f.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=M_(KN,s),c=F_[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(L_,{...o,ref:n,style:{...o.style,display:"block"}})})});qN.displayName=KN;function z_(e){return e!==null}var B_=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]=GN(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 GN(e){const[t,n="center"]=e.split("-");return[t,n]}var U_=UN,V_=WN,W_=HN,H_=qN,K_=Symbol("radix.slottable");function q_(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=K_,t}var G_=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"}),Y_="VisuallyHidden",YN=f.forwardRef((e,t)=>r.jsx(vn.span,{...e,ref:t,style:{...G_,...e.style}}));YN.displayName=Y_;var Q_=YN,[sp]=ha("Tooltip",[zN]),op=zN(),QN="TooltipProvider",J_=700,_g="tooltip.open",[X_,fy]=sp(QN),JN=e=>{const{__scopeTooltip:t,delayDuration:n=J_,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(X_,{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})};JN.displayName=QN;var Sc="Tooltip",[Z_,Vc]=sp(Sc),XN=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:c,delayDuration:u}=e,d=fy(Sc,e.__scopeTooltip),m=op(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]=Ff({prop:s,defaultProp:o??!1,onChange:A=>{A?(d.onOpen(),document.dispatchEvent(new CustomEvent(_g))):d.onClose(),i==null||i(A)},caller:Sc}),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(U_,{...m,children:r.jsx(Z_,{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})})};XN.displayName=Sc;var Mg="TooltipTrigger",ZN=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Vc(Mg,n),i=fy(Mg,n),c=op(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(V_,{asChild:!0,...c,children:r.jsx(vn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:d,onPointerMove:Jt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:Jt(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:Jt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Jt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:Jt(e.onBlur,o.onClose),onClick:Jt(e.onClick,o.onClose)})})});ZN.displayName=Mg;var py="TooltipPortal",[e5,t5]=sp(py,{forceMount:void 0}),eC=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=Vc(py,t);return r.jsx(e5,{scope:t,forceMount:n,children:r.jsx(ga,{present:n||i.open,children:r.jsx($x,{asChild:!0,container:o,children:s})})})};eC.displayName=py;var Ii="TooltipContent",tC=f.forwardRef((e,t)=>{const n=t5(Ii,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,c=Vc(Ii,e.__scopeTooltip);return r.jsx(ga,{present:s||c.open,children:c.disableHoverableContent?r.jsx(nC,{side:o,...i,ref:t}):r.jsx(n5,{side:o,...i,ref:t})})}),n5=f.forwardRef((e,t)=>{const n=Vc(Ii,e.__scopeTooltip),s=fy(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=i5(k,v.getBoundingClientRect()),S=l5(k,E),T=c5(w.getBoundingClientRect()),P=d5([...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=!u5(k,c);E?y():S&&(y(),m())};return document.addEventListener("pointermove",N),()=>document.removeEventListener("pointermove",N)}},[d,h,c,m,y]),r.jsx(nC,{...e,ref:i})}),[r5,s5]=sp(Sc,{isInside:!1}),o5=q_("TooltipContent"),nC=f.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:c,...u}=e,d=Vc(Ii,n),m=op(n),{onClose:h}=d;return f.useEffect(()=>(document.addEventListener(_g,h),()=>document.removeEventListener(_g,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(Dx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(W_,{"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(o5,{children:s}),r.jsx(r5,{scope:n,isInside:!0,children:r.jsx(Q_,{id:d.contentId,role:"tooltip",children:o||s})})]})})});tC.displayName=Ii;var rC="TooltipArrow",a5=f.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=op(n);return s5(rC,n).isInside?null:r.jsx(H_,{...o,...s,ref:t})});a5.displayName=rC;function i5(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 l5(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 c5(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 u5(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 d5(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),f5(t)}function f5(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 p5=JN,m5=XN,h5=ZN,g5=eC,sC=tC;const ca=p5,Nr=m5,Cr=h5,ur=f.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(g5,{children:r.jsx(sC,{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=sC.displayName;function my({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(cP,{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(Uk,{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 Dj(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const x5={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 y5(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function b5(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function v5(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=x5[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<y5(i)||c&&o>b5(c))}function w5(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"&&!Dj(e.updated)||y==="fresh"&&Dj(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(!v5(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 Nc(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 j5(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 oC={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 lc=null,ea=null;function k5(){return lc?Promise.resolve(lc):ea||(ea=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(lc=e,ea=null,e)).catch(()=>(ea=null,oC)),ea)}function xa(){const[e,t]=f.useState(()=>lc??oC);return f.useEffect(()=>{k5().then(t)},[]),e}function $j(){lc=null,ea=null}function Wc(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 Lj={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=(Lj[o.priority]??99)-(Lj[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 S5(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 aC(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=S5(u);return t.predicate(d,c)})}const ap={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 ip(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 N5(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 Fg(e){const t=[],n=new Map;for(const s of Object.keys(ap))n.set(s,"built-in");for(const s of Object.keys(Of))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=ip(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 C5(e){const t=new Set([...Object.keys(ap),...Object.keys(Of)]),n=[];for(const s of e){const o=ip(s).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(s)}}return n}function iC(e,t){const n=ip(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 hy(e){const t={...ap};for(const n of e)iC(t,n);return t}function lC(e){const t={...Of};for(const n of e)iC(t,n);return t}function cC(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=ip(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 St({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Oi='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function lp({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 W(_,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 V;if(_.preventDefault(),b||!c||!L){F();return}const q=s(L),K=(((V=A.find(ee=>ee.column.id===q))==null?void 0:V.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=>W(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(E5,{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),V=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=>W(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":"",V?"scale-[0.98] opacity-50":""),children:o(I,{dragging:V})})]},$)}),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 E5({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 Jl="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Fh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",T5="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",R5="border-status-review-foreground/30 bg-status-review text-status-review-foreground",A5="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",P5="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",D5="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",ff={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Jl,icon:Ui},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Jl,icon:rP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Jl,icon:Wk},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Fh,icon:SP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Fh,icon:bx},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:T5,icon:qd},review:{label:"Review",description:"Ready for inspection or approval.",className:R5,icon:EP},completed:{label:"Completed",description:"Finished successfully.",className:A5,icon:hx},failed:{label:"Failed",description:"Could not be completed as planned.",className:P5,icon:qd},active:{label:"Active",description:"The project has active or review work in flight.",className:Fh,icon:gg},stopped:{label:"Stopped",description:"Session ended without completing.",className:Jl,icon:tP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:D5,icon:gg}};function pf(e){const t=ff[e];return t||{className:Jl,icon:gg,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function uC(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)]",pf(e).className,t)}function bn({status:e,className:t,showIcon:n=!0,progress:s}){const o=pf(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:uC(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:o.label})]})}function cp(e){var t;return((t=ff[e])==null?void 0:t.description)??`Status: ${e}`}const dC={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 $5(){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,dC)),ni)}function up(){const[e,t]=f.useState(()=>Fd??dC);return f.useEffect(()=>{$5().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 L5(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ya({type:e,className:t,compact:n=!1}){const s=up();if(!e)return null;const o=L5(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 I5(e)}function I5(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(Gd,{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(Gd,{className:"h-3 w-3","aria-hidden":"true"})})}function O5(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function _5({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=Wc(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=O5(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 M5(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function F5({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=M5(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 fC({view:e,compact:t,emptyDescription:n}){const{data:s,loading:o,error:i}=$f(),c=xa(),u=f.useMemo(()=>c.order.map(h=>({id:h,title:Wc(c,h),description:cp(h)})),[c]),d=f.useMemo(()=>lC(c.factDeclarations),[c.factDeclarations]),m=f.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??ac(e.config.filters);let g=null;h.trim()!==""&&(g=Di(h,d).query);const y=aC(s.assignments,g,{workspace:e.workspace});return Hc(y,e.config.sortField,e.config.sortDirection)},[s,e,d]);if(o&&!s)return r.jsx(gt,{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(St,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(lp,{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(z5,{item:h}):r.jsx(B5,{item:h})});case"list":return r.jsx(_5,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(F5,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function z5({item:e}){const t=Nc(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 B5({item:e}){const t=Nc(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 U5({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:o,refetch:i}=So(e);return s?r.jsx(gt,{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(fC,{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 pC({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(V5,{session:t})},t.sessionId))})]})}function V5({session:e}){const t=un(),[n,s]=f.useState(!1),o=W5(e,t),i=H5(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," · ",s1(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 W5(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function H5(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const K5={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 q5(e,t,n=Date.now()){const s=ta(e);if(t.preset){const c=K5[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 G5(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&&!q5(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 Y5(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 Q5(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function J5({view:e,emptyDescription:t}){const{data:n,loading:s,error:o}=Lf(),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=G5(c,m);return h=Y5(h,u.sortField,u.sortDirection),h=Q5(h,u.limit),h},[n,e]);return s&&!n?r.jsx(gt,{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(St,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(pC,{sessions:i})}function X5({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(Rt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const Z5={__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:Z5[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 Ij={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"},eM=["updated","created"];function dp({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}: ${Ij[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:eM.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(zh,{label:"Any date",selected:!g,onClick:w}),tO.map(k=>r.jsx(zh,{label:Ij[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>N(k)},k)),r.jsx(zh,{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 zh({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 tM=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function nM(e,t){const n={};for(const[s,o]of Object.entries(e))tM.has(s)||(n[s]=o);return{...n,...t}}function mf(e,t,n){return{...e,viewMode:t.viewMode,filters:nM(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 rM(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:rM(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 mC(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 gy(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 fp(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function hC(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,fp(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??ac(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 gC(e){return`${zd(e.workspace)}/${encodeURIComponent(e.id)}`}function xC(e){const t=e.workspace?`/w/${e.workspace}`:"",n=Fe(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&bN(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const sM=["critical","high","medium","low"],oM={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 aM(e){if(e.preset)return`${e.field} ${oM[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function yC(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&ic(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(aM(e.dateRange));const s=(i=e.search)==null?void 0:i.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const Oj=80,iM=["started","lastActivity","projectName","agentName"],lM={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},cM=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function bC({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const o=!!n,{data:i}=Cs(),{data:c}=Lf(),[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(fp(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 W=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<=Oj,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,V={filters:{project:m,agent:g,sessionStatus:b,dateRange:$},sortField:k,sortDirection:S,limit:H};try{await s(_,V)}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:Oj,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(dp,{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:W,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:cM,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:iM.map(I=>r.jsx("option",{value:I,children:lM[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 uM=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},uM)},[]);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 Bh({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 dM({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:o,error:i}=Lf(),{view:c,loading:u,ready:d}=So(e??null),{layout:m}=CN(),{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 $g(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}=gy(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(gt,{label:"Loading view…"}):c?c.entityType!=="session"?w=r.jsx(Bh,{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(J5,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):w=r.jsx(Bh,{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(gt,{label:"Loading sessions…"}):i?w=r.jsx(Bh,{title:"Couldn't load sessions",message:i}):w=r.jsx(pC,{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(X5,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,w,r.jsx(bC,{open:g,onOpenChange:y,workspace:null,onSubmit:N})]})}const fM=5;function pM(){const{data:e,loading:t,error:n}=j1();if(t&&!e)return r.jsx(gt,{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,fM);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 mM(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 _j({filters:e,metric:t}){const n=e??{},{data:s,loading:o,error:i}=z3(n),c=t==="cost"?"Spend":"Token Usage",u=`/usage?${wg(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}=mM(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(Mj,{label:g.label,value:g.value,emphasize:!0}),r.jsx(Mj,{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:Iw(n),children:Iw(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 Mj({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 hM={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function gM(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 Fj({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}=k1(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=gM(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=R3(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 W=(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:Df.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:hM[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"}),W.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 xy={"saved-view":{title:"Saved view",icon:Kk,render:(e,t)=>e.kind!=="saved-view"?null:f.createElement(U5,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Ef,render:(e,t)=>e.kind!=="agent-sessions"?null:f.createElement(dM,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Af,render:()=>f.createElement(pM)},"token-usage":{title:"Token Usage",icon:hP,render:e=>e.kind!=="token-usage"?null:f.createElement(_j,{filters:e.filters,metric:"tokens"}),ConfigEditor:Fj},spend:{title:"Spend",icon:Dc,render:e=>e.kind!=="spend"?null:f.createElement(_j,{filters:e.filters,metric:"cost"}),ConfigEditor:Fj}},vC=20,zg=16,xM=2,ia=16,hf=28;function Bd(e,t,n){return Math.min(Math.max(e,t),n)}const yM=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function bM(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of yM)if(e>=t.minWidth)return t.columns;return 1}function Bg(e,t){return t<=0?1:Bd(Math.round(e/jc*t),1,t)}function Ug(e){if(kO(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:hf};case"large":return{w:16,h:hf};default:return{w:8,h:ia}}}function vM(e,t){return t>0?Math.round(e/t):0}function wM(e,t=vC){return Math.round(e/t)}const jM=[{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:hf},{label:"Full tall",w:24,h:hf}];function kM({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}=Xf({id:e.id}),T=Ug(e.size),P=h?h.renderW:Bg(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=Bg(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+vM(q.clientX-I.startX,n),1,t)),(I.axis==="h"||I.axis==="both")&&($=Bd(I.startH+wM(q.clientY-I.startY),xM,yN)),I.lastRenderW=K,I.lastH=$,g({renderW:K,h:$})},onPointerUp:q=>{const I=y.current;if(!I||q.pointerId!==I.pointerId)return;const K=Ug(e.size),V={w:I.axis==="h"?K.w:Bd(Math.round(I.lastRenderW/t*jc),1,jc),h:I.lastH};L(q),(V.w!==K.w||V.h!==K.h)&&c(V)},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]}),W=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,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:W}),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(Rt,{className:"h-4 w-4"}),"Add widget"]}),D]});const Y=xy[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:[W,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:[W,r.jsx(_,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(NM,{slot:e,fallback:Y.title})})]}),r.jsx(my,{items:[{key:"replace",label:"Replace…",icon:NP,onSelect:s},...Y.ConfigEditor?[{key:"configure",label:"Configure…",icon:AP,onSelect:()=>m(!0)}]:[],{key:"size",label:"Size",icon:wP,submenu:jM.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 SM({slot:e,activeColumns:t,colWidthPx:n}){const s=e.widget?xy[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=Ug(e.size),u=Bg(c.w,t),d=n>0?u*n+(u-1)*zg: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 NM({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 CM=["agent-sessions","inventories","token-usage","spend"];function EM({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(Wr,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:CM.map(c=>{const u=xy[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 TM=(e,{currentCoordinates:t,context:n})=>{var g;const s=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(s===0)return;e.preventDefault();const o=n.over??n.active,i=(g=o==null?void 0:o.data.current)==null?void 0:g.sortable,c=i==null?void 0:i.items;if(!o||!c)return t;const u=c.indexOf(o.id);if(u===-1)return t;const d=c[u+s],m=d===void 0?null:n.droppableRects.get(d),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function RM(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 AM(e,t){const n={id:RM(e),widget:null};return[...e,n]}function PM(e,t){return e.filter(n=>n.id!==t)}function DM(){const{data:e,error:t,refetch:n}=D3(),{data:s}=b1(),{layout:o}=CN(),[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(jc),[E,S]=f.useState(0);f.useEffect(()=>{const q=w.current;if(!q)return;const I=new ResizeObserver(K=>{for(const $ of K){const V=$.contentRect.width,ee=bM(V),B=ee>0?(V-(ee-1)*zg)/ee:0;k(ee),S(B)}});return I.observe(q),()=>I.disconnect()},[]),f.useEffect(()=>{y(o.slots)},[o.slots]);const T=Hf(ko(Gi,{activationConstraint:{distance:8}}),ko(qi,{coordinateGetter:TM}));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 $g(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}:K);R(I,g)},[g,R]),M=f.useCallback(q=>{const I=PM(g,q);R(I,g)},[g,R]),F=f.useCallback(()=>{const q=AM(g);R(q,g)},[g,R]),D=f.useCallback((q,I)=>{const K=g.map(($,V)=>V===q?{...$,size:I}:$);R(K,g)},[g,R]),W=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),V=g.findIndex(B=>B.id===K.id);if($===-1||V===-1)return;const ee=Yi(g,$,V);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((V,ee)=>ee===q?{...V,widget:I}:V);h(null),y($);try{await $g($)}catch(V){y(K);const ee=V instanceof Error?V.message:String(V);throw h(ee),V instanceof Error?V: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(QI,{hero:e.hero,itemsById:H}):t?r.jsx(Nt,{error:t}):r.jsx(gt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(GI,{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(Qf,{sensors:T,collisionDetection:Kf,onDragStart:Y,onDragCancel:()=>N(null),onDragEnd:W,children:[r.jsx(Jf,{items:g.map(q=>q.id),strategy:Xx,children:r.jsx("div",{ref:w,style:{display:"grid",gridTemplateColumns:`repeat(${v}, minmax(0, 1fr))`,gridAutoRows:`${vC}px`,gridAutoFlow:"dense",gap:`${zg}px`},children:g.map((q,I)=>r.jsx(kM,{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(LI,{dropAnimation:null,children:_?r.jsx(SM,{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(Rt,{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(vx,{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(EM,{open:i,onOpenChange:q=>{c(q),q||d(null)},onSelect:A})]})}function $M({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 LM(){const{data:e,loading:t,error:n}=b1(),{openCheatsheet:s}=To();return t?r.jsx(gt,{label:"Loading help…"}):n||!e?r.jsx(Nt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(Ve,{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(Ve,{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(Ve,{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(Ve,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>r.jsx($M,{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(Ve,{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(Ve,{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(Ve,{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(Ve,{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(Ve,{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(Ve,{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 yy({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 pp=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"})]}));pp.displayName="SearchInput";function mp({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 IM={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"},zj=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function gf({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:IM[d]??zj[c++%zj.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 OM=["pending","active","blocked","failed","completed"],by=OM,_M=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function wC(e){return e&&e.length>0?e:[..._M]}function MM(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 FM=220,bd=8;function jC({anchor:e,items:t,onClose:n}){const s=f.useRef(null),[o,i]=f.useState(null);return f.useLayoutEffect(()=>{if(!e){i(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??FM,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 zM="__ungrouped__";function vy({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:zM,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(Wr,{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(bx,{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 Bj(){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)=>VM(I,K,N)):[],[s,d,h,y,N,e]),W=D.map(I=>`${I.slug}:${I.status}`).join("|");f.useEffect(()=>{R(WM(D))},[W,N]);const Y=f.useMemo(()=>{const I=new Map(D.map(K=>[K.slug,K]));return by.flatMap(K=>(P[K]??D.filter(V=>V.status===K).map(V=>V.slug)).map(V=>I.get(V)).filter(V=>!!V))},[D,P]),{visibleItems:_,visibleIndexByKey:z}=f.useMemo(()=>{const I=S==="kanban"?Y:D,K=new Map;return I.forEach(($,V)=>K.set($.slug,V)),{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(gt,{label:"Loading projects…"});if(i||!s)return r.jsx(Nt,{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(yy,{children:[r.jsx(pp,{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(mp,{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(St,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Ce,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):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(gf,{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(Ve,{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(gf,{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(lp,{columns:UM,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:V,toIndex:ee})=>{if(K===$){const B=P[K]??D.filter(ue=>ue.status===K).map(ue=>ue.slug);R(ue=>({...ue,[K]:MM(B,V,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(HM,{project:I,dragging:K})})}}),r.jsx(jC,{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:Rf,onSelect:()=>F(A.project)}]:[],onClose:()=>L(null)}),r.jsx(vy,{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(yx,{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 BM={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},UM=by.map(e=>({id:e,title:BM[e],description:cp(e)}));function VM(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return Uj(t)-Uj(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function Uj(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function WM(e){return Object.fromEntries(by.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function HM({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(gf,{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 xf({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 KM(){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(Tf,{className:"h-3 w-3"}),"Archived"]})}function Vj(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function qM(){const{data:e,loading:t,error:n,refetch:s}=$3(),[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(gt,{label:"Loading archived content…"});if(n)return r.jsx(Nt,{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(xf,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(St,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[v.length>0&&r.jsx(Ve,{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(Uk,{className:"h-4 w-4"}),r.jsx(gx,{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(Wd,{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(Ve,{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(KM,{}),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(Wd,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const Wj="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",Hj="block min-w-0 truncate";function wy({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(Wj,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[r.jsx("span",{className:Hj,children:o}),r.jsx(zi,{className:"h-2.5 w-2.5 shrink-0"})]},i):r.jsx("span",{className:Wj,title:o,children:r.jsx("span",{className:Hj,children:o})},i)})})}const GM={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(GM[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 Kj(e){const t=YM(e),n=f.forwardRef((s,o)=>{const{children:i,...c}=s,u=f.Children.toArray(i),d=u.find(JM);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 YM(e){const t=f.forwardRef((n,s)=>{const{children:o,...i}=n;if(f.isValidElement(o)){const c=ZM(o),u=XM(i,o.props);return o.type!==f.Fragment&&(u.ref=s?Mf(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 QM=Symbol("radix.slottable");function JM(e){return f.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QM}function XM(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 ZM(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 eF(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=Kj(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=Kj(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 tF=f.createContext(void 0);function kC(e){const t=f.useContext(tF);return e||t||"ltr"}var Uh="rovingFocusGroup.onEntryFocus",nF={bubbles:!1,cancelable:!0},qc="RovingFocusGroup",[Vg,SC,rF]=eF(qc),[sF,NC]=ha(qc,[rF]),[oF,aF]=sF(qc),CC=f.forwardRef((e,t)=>r.jsx(Vg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Vg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(iF,{...e,ref:t})})}));CC.displayName=qc;var iF=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=kC(i),[w,v]=Ff({prop:c,defaultProp:u??null,onChange:d,caller:qc}),[k,E]=f.useState(!1),S=da(m),T=SC(n),P=f.useRef(!1),[R,A]=f.useState(0);return f.useEffect(()=>{const L=y.current;if(L)return L.addEventListener(Uh,S),()=>L.removeEventListener(Uh,S)},[S]),r.jsx(oF,{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:Jt(e.onMouseDown,()=>{P.current=!0}),onFocus:Jt(e.onFocus,L=>{const M=!P.current;if(L.target===L.currentTarget&&M&&!k){const F=new CustomEvent(Uh,nF);if(L.currentTarget.dispatchEvent(F),!F.defaultPrevented){const D=T().filter(H=>H.focusable),W=D.find(H=>H.active),Y=D.find(H=>H.id===w),z=[W,Y,...D].filter(Boolean).map(H=>H.ref.current);RC(z,h)}}P.current=!1}),onBlur:Jt(e.onBlur,()=>E(!1))})})}),EC="RovingFocusGroupItem",TC=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=aF(EC,n),g=h.currentTabStopId===m,y=SC(n),{onFocusableItemAdd:b,onFocusableItemRemove:N,currentTabStopId:w}=h;return f.useEffect(()=>{if(s)return b(),()=>N()},[s,b,N]),r.jsx(Vg.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:Jt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Jt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Jt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=uF(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?dF(S,T+1):S.slice(T+1)}setTimeout(()=>RC(S))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:w!=null}):c})})});TC.displayName=EC;var lF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cF(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function uF(e,t,n){const s=cF(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return lF[s]}function RC(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function dF(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var fF=CC,pF=TC,hp="Tabs",[mF]=ha(hp,[NC]),AC=NC(),[hF,jy]=mF(hp),PC=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:c="horizontal",dir:u,activationMode:d="automatic",...m}=e,h=kC(u),[g,y]=Ff({prop:s,onChange:o,defaultProp:i??"",caller:hp});return r.jsx(hF,{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})})});PC.displayName=hp;var DC="TabsList",$C=f.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=jy(DC,n),c=AC(n);return r.jsx(fF,{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})})});$C.displayName=DC;var LC="TabsTrigger",IC=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,c=jy(LC,n),u=AC(n),d=MC(c.baseId,s),m=FC(c.baseId,s),h=s===c.value;return r.jsx(pF,{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:Jt(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Jt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Jt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!o&&g&&c.onValueChange(s)})})})});IC.displayName=LC;var OC="TabsContent",_C=f.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...c}=e,u=jy(OC,n),d=MC(u.baseId,s),m=FC(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})})});_C.displayName=OC;function MC(e,t){return`${e}-trigger-${t}`}function FC(e,t){return`${e}-content-${t}`}var zC=PC,BC=$C,Wg=IC,Hg=_C;function gp({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(zC,{value:e,onValueChange:t,className:s,children:[r.jsx(BC,{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(Wg,{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(Hg,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const gF="modulepreload",xF=function(e){return"/"+e},qj={},yF=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=xF(m),m in qj)return;qj[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":gF,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 bF({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 yF(async()=>{const{default:w}=await import("./mermaid.core-DaGpamF_.js").then(v=>v.bF);return{default:w}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:vF(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,wF(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 vF(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 wF(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 jF(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const kF=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SF=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NF={};function Gj(e,t){return(NF.jsx?SF:kF).test(e)}const CF=/[ \t\n\f\r]/g;function EF(e){return typeof e=="object"?e.type==="text"?Yj(e.value):!1:Yj(e)}function Yj(e){return e.replace(CF,"")===""}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 UC(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 Kg(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 TF=0;const ft=va(),hn=va(),qg=va(),Te=va(),zt=va(),Ei=va(),vr=va();function va(){return 2**++TF}const Gg=Object.freeze(Object.defineProperty({__proto__:null,boolean:ft,booleanish:hn,commaOrSpaceSeparated:vr,commaSeparated:Ei,number:Te,overloadedBoolean:qg,spaceSeparated:zt},Symbol.toStringTag,{value:"Module"})),Vh=Object.keys(Gg);class ky extends mr{constructor(t,n,s,o){let i=-1;if(super(t,n),Qj(this,"space",o),typeof s=="number")for(;++i<Vh.length;){const c=Vh[i];Qj(this,Vh[i],(s&Gg[c])===Gg[c])}}}ky.prototype.defined=!0;function Qj(e,t,n){n&&(e[t]=n)}function Xi(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new ky(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Kg(s)]=s,n[Kg(i.attribute)]=s}return new Gc(t,n,e.space)}const VC=Xi({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 WC(e,t){return t in e?e[t]:t}function HC(e,t){return WC(e,t.toLowerCase())}const RF=Xi({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:qg,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:qg,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:HC}),AF=Xi({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:WC}),KC=Xi({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()}}),qC=Xi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:HC}),GC=Xi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),PF={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"},DF=/[A-Z]/g,Jj=/-[a-z]/g,$F=/^data[-\w.:]+$/i;function LF(e,t){const n=Kg(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"&&$F.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Jj,OF);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Jj.test(i)){let c=i.replace(DF,IF);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=ky}return new o(s,t)}function IF(e){return"-"+e.toLowerCase()}function OF(e){return e.charAt(1).toUpperCase()}const _F=UC([VC,RF,KC,qC,GC],"html"),Sy=UC([VC,AF,KC,qC,GC],"svg");function MF(e){return e.join(" ").trim()}var ai={},Wh,Xj;function FF(){if(Xj)return Wh;Xj=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=`
|
|
561
|
+
`,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 W(){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=W();)z!==!1&&(_.push(z),F(_));return _}return M(),Y()}function w(v){return v?v.replace(u,g):g}return Wh=N,Wh}var Zj;function zF(){if(Zj)return ai;Zj=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(FF());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 Bl={},e0;function BF(){if(e0)return Bl;e0=1,Object.defineProperty(Bl,"__esModule",{value:!0}),Bl.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 Bl.camelCase=d,Bl}var Ul,t0;function UF(){if(t0)return Ul;t0=1;var e=Ul&&Ul.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(zF()),n=BF();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,Ul=s,Ul}var VF=UF();const WF=Sf(VF),YC=QC("end"),Ny=QC("start");function QC(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 HF(e){const t=Ny(e),n=YC(e);if(t&&n)return{start:t,end:n}}function cc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?n0(e.position):"start"in e||"end"in e?n0(e):"line"in e||"column"in e?Yg(e):""}function Yg(e){return r0(e&&e.line)+":"+r0(e&&e.column)}function n0(e){return Yg(e&&e.start)+"-"+Yg(e&&e.end)}function r0(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=cc(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 Cy={}.hasOwnProperty,KF=new Map,qF=/[A-Z]/g,GF=new Set(["table","tbody","thead","tfoot","tr"]),YF=new Set(["td","th"]),JC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function QF(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=s6(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=r6(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"?Sy:_F,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=XC(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function XC(e,t,n){if(t.type==="element")return JF(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return XF(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return e6(e,t,n);if(t.type==="mdxjsEsm")return ZF(e,t);if(t.type==="root")return t6(e,t,n);if(t.type==="text")return n6(e,t)}function JF(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=Sy,e.schema=o),e.ancestors.push(t);const i=eE(e,t.tagName,!1),c=o6(e,t);let u=Ty(e,t);return GF.has(t.tagName)&&(u=u.filter(function(d){return typeof d=="string"?!EF(d):!0})),ZC(e,c,i,t),Ey(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function XF(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)}Cc(e,t.position)}function ZF(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cc(e,t.position)}function e6(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=Sy,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:eE(e,t.name,!0),c=a6(e,t),u=Ty(e,t);return ZC(e,c,i,t),Ey(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function t6(e,t,n){const s={};return Ey(s,Ty(e,t)),e.create(t,e.Fragment,s,n)}function n6(e,t){return t.value}function ZC(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function Ey(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function r6(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 s6(e,t){return n;function n(s,o,i,c){const u=Array.isArray(i.children),d=Ny(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 o6(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&Cy.call(t.properties,o)){const i=i6(e,o,t.properties[o]);if(i){const[c,u]=i;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&YF.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 a6(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 Cc(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 Cc(e,t.position);else i=s.value===null?!0:s.value;n[o]=i}return n}function Ty(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:KF;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=XC(e,i,c);u!==void 0&&n.push(u)}return n}function i6(e,t,n){const s=LF(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?jF(n):MF(n)),s.property==="style"){let o=typeof n=="object"?n:l6(e,String(n));return e.stylePropertyNameCase==="css"&&(o=c6(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?PF[s.property]||s.property:s.attribute,n]}}function l6(e,t){try{return WF(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=JC+"#cannot-parse-style-attribute",o}}function eE(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=Gj(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=Gj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return Cy.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);Cc(e)}function Cc(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=JC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function c6(e){const t={};let n;for(n in e)Cy.call(e,n)&&(t[u6(n)]=e[n]);return t}function u6(e){let t=e.replace(qF,d6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function d6(e){return"-"+e.toLowerCase()}const Hh={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"]},f6={};function p6(e,t){const n=f6,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return tE(e,s,o)}function tE(e,t,n){if(m6(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 s0(e.children,t,n)}return Array.isArray(e)?s0(e,t,n):""}function s0(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=tE(e[o],t,n);return s.join("")}function m6(e){return!!(e&&typeof e=="object")}const o0=document.createElement("i");function Ry(e){const t="&"+e+";";o0.innerHTML=t;const n=o0.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 a0={}.hasOwnProperty;function h6(e){const t={};let n=-1;for(;++n<e.length;)g6(t,e[n]);return t}function g6(e,t){let n;for(n in t){const o=(a0.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let c;if(i)for(c in i){a0.call(o,c)||(o[c]=[]);const u=i[c];x6(o[c],Array.isArray(u)?u:u?[u]:[])}}}function x6(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 nE(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]/),y6=Po(/[#-'*+\--9=?A-Z^-~]/);function Qg(e){return e!==null&&(e<32||e===127)}const Jg=Po(/\d/),b6=Po(/[\dA-Fa-f]/),v6=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 w6=Po(new RegExp("\\p{P}|\\p{S}","u")),j6=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Zi(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 k6={tokenize:S6};function S6(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 N6={tokenize:C6},i0={tokenize:E6};function C6(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(i0,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(i0,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 E6(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 l0(e){if(e===null||fr(e)||j6(e))return 1;if(w6(e))return 2}function Ay(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 Xg={name:"attention",resolveAll:T6,tokenize:R6};function T6(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};c0(g,-d),c0(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,Ay(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 R6(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=l0(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=l0(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 c0(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const A6={name:"autolink",tokenize:P6};function P6(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||Qg(b)?n(b):(e.consume(b),d)}function m(b){return b===64?(e.consume(b),h):y6(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 xp={partial:!0,tokenize:D6};function D6(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 rE={continuation:{tokenize:L6},exit:I6,name:"blockQuote",tokenize:$6};function $6(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 L6(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(rE,t,n)(c)}}function I6(e){e.exit("blockQuote")}const sE={name:"characterEscape",tokenize:O6};function O6(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 v6(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const oE={name:"characterReference",tokenize:_6};function _6(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=b6,h):(e.enter("characterReferenceValue"),i=7,c=Jg,h(g))}function h(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===Er&&!Ry(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 u0={partial:!0,tokenize:F6},d0={concrete:!0,name:"codeFenced",tokenize:M6};function M6(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(u0,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(u0,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,W,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):W(z)}function W(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 F6(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 Kh={name:"codeIndented",tokenize:B6},z6={partial:!0,tokenize:U6};function B6(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(z6,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 U6(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 V6={name:"codeText",previous:H6,resolve:W6,tokenize:K6};function W6(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 H6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function K6(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 q6{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 aE(e){const t={};let n=-1,s,o,i,c,u,d,m;const h=new q6(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,G6(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 G6(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 Y6={resolve:J6,tokenize:X6},Q6={partial:!0,tokenize:Z6};function J6(e){return aE(e),e}function X6(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(Q6,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 Z6(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 iE(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||Qg(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||Qg(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 lE(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 cE(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 uc(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 ez={name:"definition",tokenize:nz},tz={partial:!0,tokenize:rz};function nz(e,t,n){const s=this;let o;return i;function i(b){return e.enter("definition"),c(b)}function c(b){return lE.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)?uc(e,m)(b):m(b)}function m(b){return iE(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(tz,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 rz(e,t,n){return s;function s(u){return fr(u)?uc(e,o)(u):n(u)}function o(u){return cE(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 sz={name:"hardBreakEscape",tokenize:oz};function oz(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 az={name:"headingAtx",resolve:iz,tokenize:lz};function iz(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 lz(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 cz=["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"],f0=["pre","script","style","textarea"],uz={concrete:!0,name:"htmlFlow",resolveTo:pz,tokenize:mz},dz={partial:!0,tokenize:gz},fz={partial:!0,tokenize:hz};function pz(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 mz(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 ue="CDATA[";return B===ue.charCodeAt(u++)?(e.consume(B),u===ue.length?s.interrupt?t:W: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 ue=B===47,ye=c.toLowerCase();return!ue&&!i&&f0.includes(ye)?(o=1,s.interrupt?t(B):W(B)):cz.includes(c.toLowerCase())?(o=6,ue?(e.consume(B),k):s.interrupt?t(B):W(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:W):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)?W(B):Dt(B)?(e.consume(B),D):n(B)}function W(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),V):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(dz,ee,Y)(B)):B===null||lt(B)?(e.exit("htmlFlowData"),Y(B)):(e.consume(B),W)}function Y(B){return e.check(fz,_,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"),W(B))}function H(B){return B===45?(e.consume(B),$):W(B)}function q(B){return B===47?(e.consume(B),c="",I):W(B)}function I(B){if(B===62){const ue=c.toLowerCase();return f0.includes(ue)?(e.consume(B),V):W(B)}return vs(B)&&c.length<8?(e.consume(B),c+=String.fromCharCode(B),I):W(B)}function K(B){return B===93?(e.consume(B),$):W(B)}function $(B){return B===62?(e.consume(B),V):B===45&&o===2?(e.consume(B),$):W(B)}function V(B){return B===null||lt(B)?(e.exit("htmlFlowData"),ee(B)):(e.consume(B),V)}function ee(B){return e.exit("htmlFlow"),t(B)}}function hz(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 gz(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(xp,t,n)}}const xz={name:"htmlText",tokenize:yz};function yz(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 V="CDATA[";return $===V.charCodeAt(i++)?(e.consume($),i===V.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($),W):lt($)?(c=D,q($)):Dt($)?(e.consume($),D):M($)}function W($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),o=$,Y):lt($)?(c=W,q($)):Dt($)?(e.consume($),W):(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 Py={name:"labelEnd",resolveAll:jz,resolveTo:kz,tokenize:Sz},bz={tokenize:Nz},vz={tokenize:Cz},wz={tokenize:Ez};function jz(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 kz(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,Ay(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 Sz(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(bz,h,c?h:g)(y):y===91?e.attempt(vz,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(wz,h,g)(y)}function h(y){return t(y)}function g(y){return i._balanced=!0,n(y)}}function Nz(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)?uc(e,i)(g):i(g)}function i(g){return g===41?h(g):iE(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return fr(g)?uc(e,d)(g):h(g)}function u(g){return n(g)}function d(g){return g===34||g===39||g===40?cE(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return fr(g)?uc(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 Cz(e,t,n){const s=this;return o;function o(u){return lE.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 Ez(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 Tz={name:"labelStartImage",resolveAll:Py.resolveAll,tokenize:Rz};function Rz(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 Az={name:"labelStartLink",resolveAll:Py.resolveAll,tokenize:Pz};function Pz(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 qh={name:"lineEnding",tokenize:Dz};function Dz(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Bt(e,t,"linePrefix")}}const Ud={name:"thematicBreak",tokenize:$z};function $z(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:_z},exit:Fz,name:"list",tokenize:Oz},Lz={partial:!0,tokenize:zz},Iz={partial:!0,tokenize:Mz};function Oz(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:Jg(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(Ud,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 Jg(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(xp,s.interrupt?n:h,e.attempt(Lz,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 _z(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(xp,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(Iz,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 Mz(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 Fz(e){e.exit(this.containerState.type)}function zz(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 p0={name:"setextUnderline",resolveTo:Bz,tokenize:Uz};function Bz(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 Uz(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 Vz={tokenize:Wz};function Wz(e){const t=this,n=e.attempt(xp,s,e.attempt(this.parser.constructs.flowInitial,o,Bt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Y6,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 Hz={resolveAll:dE()},Kz=uE("string"),qz=uE("text");function uE(e){return{resolveAll:dE(e==="text"?Gz: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 dE(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 Gz(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 Yz={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:rE},Qz={91:ez},Jz={[-2]:Kh,[-1]:Kh,32:Kh},Xz={35:az,42:Ud,45:[p0,Ud],60:uz,61:p0,95:Ud,96:d0,126:d0},Zz={38:oE,92:sE},eB={[-5]:qh,[-4]:qh,[-3]:qh,33:Tz,38:oE,42:Xg,60:[A6,xz],91:Az,92:[sz,sE],93:Py,95:Xg,96:V6},tB={null:[Xg,Hz]},nB={null:[42,95]},rB={null:[]},sB=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:nB,contentInitial:Qz,disable:rB,document:Yz,flow:Xz,flowInitial:Jz,insideSpan:tB,string:Zz,text:eB},Symbol.toStringTag,{value:"Module"}));function oB(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=Ay(i,m.events,m),m.events)}function y(D,W){return iB(b(D),W)}function b(D){return aB(c,D)}function N(){const{_bufferIndex:D,_index:W,line:Y,column:_,offset:z}=s;return{_bufferIndex:D,_index:W,line:Y,column:_,offset:z}}function w(D){o[D.line]=D.column,F()}function v(){let D;for(;s._index<c.length;){const W=c[s._index];if(typeof W=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<W.length;)k(W.charCodeAt(s._bufferIndex));else k(W)}}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,W){const Y=W||{};return Y.type=D,Y.start=N(),m.events.push(["enter",Y,m]),u.push(Y),Y}function T(D){const W=u.pop();return W.end=N(),m.events.push(["exit",W,m]),W}function P(D,W){L(D,W.from)}function R(D,W){W.restore()}function A(D,W){return Y;function Y(_,z,H){let q,I,K,$;return Array.isArray(_)?ee(_):"tokenize"in _?ee([_]):V(_);function V(se){return ge;function ge(ke){const Re=ke!==null&&se[ke],Ae=ke!==null&&se.null,Je=[...Array.isArray(Re)?Re:Re?[Re]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return ee(Je)(ke)}}function ee(se){return q=se,I=0,se.length===0?H:B(se[I])}function B(se){return ge;function ge(ke){return $=M(),K=se,se.partial||(m.currentConstruct=se),se.name&&m.parser.constructs.disable.null.includes(se.name)?ye():se.tokenize.call(W?Object.assign(Object.create(m),W):m,d,ue,ye)(ke)}}function ue(se){return D(K,$),z}function ye(se){return $.restore(),++I<q.length?B(q[I]):H}}}function L(D,W){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Ns(m.events,W,m.events.length-W,D.resolve(m.events.slice(W),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function M(){const D=N(),W=m.previous,Y=m.currentConstruct,_=m.events.length,z=Array.from(u);return{from:_,restore:H};function H(){s=D,m.previous=W,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 aB(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 iB(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=`
|
|
562
|
+
`;break}case-3:{c=`\r
|
|
563
|
+
`;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 lB(e){const s={constructs:h6([sB,...(e||{}).extensions||[]]),content:o(k6),defined:[],document:o(N6),flow:o(Vz),lazy:{},string:o(Kz),text:o(qz)};return s;function o(i){return c;function c(u){return oB(s,i,u)}}}function cB(e){for(;!aE(e););return e}const m0=/[\0\t\n\r]/g;function uB(){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(m0.lastIndex=g,m=m0.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 dB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function fB(e){return e.replace(dB,pB)}function pB(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return nE(n.slice(i?2:1),i?16:10)}return Ry(n)||e}const fE={}.hasOwnProperty;function mB(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),hB(n)(cB(lB(n).document().write(uB()(e,t,!0))))}function hB(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(Je),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:i(Je,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(Qe),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:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:se,characterReference:ge,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(W),hardBreakTrailing:d(W),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:ue,resourceDestinationString:$,resourceTitleString:V,resource:ee,setextHeading:d(L),setextHeadingLineSequence:A,setextHeadingText:R,strong:d(),thematicBreak:d()}};pE(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ie){let Q={type:"root",children:[]};const me={stack:[Q],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},re=[];let xe=-1;for(;++xe<ie.length;)if(ie[xe][1].type==="listOrdered"||ie[xe][1].type==="listUnordered")if(ie[xe][0]==="enter")re.push(xe);else{const Pe=re.pop();xe=o(ie,Pe,xe)}for(xe=-1;++xe<ie.length;){const Pe=t[ie[xe][0]];fE.call(Pe,ie[xe][1].type)&&Pe[ie[xe][1].type].call(Object.assign({sliceSerialize:ie[xe][2].sliceSerialize},me),ie[xe][1])}if(me.tokenStack.length>0){const Pe=me.tokenStack[me.tokenStack.length-1];(Pe[1]||h0).call(me,void 0,Pe[0])}for(Q.position={start:mo(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:mo(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},xe=-1;++xe<t.transforms.length;)Q=t.transforms[xe](Q)||Q;return Q}function o(ie,Q,me){let re=Q-1,xe=-1,Pe=!1,ve,te,de,Se;for(;++re<=me;){const Ue=ie[re];switch(Ue[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ue[0]==="enter"?xe++:xe--,Se=void 0;break}case"lineEndingBlank":{Ue[0]==="enter"&&(ve&&!Se&&!xe&&!de&&(de=re),Se=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Se=void 0}if(!xe&&Ue[0]==="enter"&&Ue[1].type==="listItemPrefix"||xe===-1&&Ue[0]==="exit"&&(Ue[1].type==="listUnordered"||Ue[1].type==="listOrdered")){if(ve){let le=re;for(te=void 0;le--;){const pt=ie[le];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;te&&(ie[te][1].type="lineEndingBlank",Pe=!0),pt[1].type="lineEnding",te=le}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}de&&(!te||de<te)&&(ve._spread=!0),ve.end=Object.assign({},te?ie[te][1].start:Ue[1].end),ie.splice(te||re,0,["exit",ve,Ue[2]]),re++,me++}if(Ue[1].type==="listItemPrefix"){const le={type:"listItem",_spread:!1,start:Object.assign({},Ue[1].start),end:void 0};ve=le,ie.splice(re,0,["enter",le,Ue[2]]),re++,me++,de=void 0,Se=!0}}}return ie[Q][1]._spread=Pe,me}function i(ie,Q){return me;function me(re){u.call(this,ie(re),re),Q&&Q.call(this,re)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(ie,Q,me){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([Q,me||void 0]),ie.position={start:mo(Q.start),end:void 0}}function d(ie){return Q;function Q(me){ie&&ie.call(this,me),m.call(this,me)}}function m(ie,Q){const me=this.stack.pop(),re=this.tokenStack.pop();if(re)re[0].type!==ie.type&&(Q?Q.call(this,ie,re[0]):(re[1]||h0).call(this,ie,re[0]));else throw new Error("Cannot close `"+ie.type+"` ("+cc({start:ie.start,end:ie.end})+"): it’s not open");me.position.end=mo(ie.end)}function h(){return p6(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(ie){if(this.data.expectingFirstListItemValue){const Q=this.stack[this.stack.length-2];Q.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function b(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.lang=ie}function N(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.meta=ie}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.value=ie.replace(/(\r?\n|\r)$/g,"")}function E(ie){const Q=this.resume(),me=this.stack[this.stack.length-1];me.label=Q,me.identifier=Ti(this.sliceSerialize(ie)).toLowerCase()}function S(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.title=ie}function T(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.url=ie}function P(ie){const Q=this.stack[this.stack.length-1];if(!Q.depth){const me=this.sliceSerialize(ie).length;Q.depth=me}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function A(ie){const Q=this.stack[this.stack.length-1];Q.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function L(){this.data.setextHeadingSlurpLineEnding=void 0}function M(ie){const me=this.stack[this.stack.length-1].children;let re=me[me.length-1];(!re||re.type!=="text")&&(re=vt(),re.position={start:mo(ie.start),end:void 0},me.push(re)),this.stack.push(re)}function F(ie){const Q=this.stack.pop();Q.value+=this.sliceSerialize(ie),Q.position.end=mo(ie.end)}function D(ie){const Q=this.stack[this.stack.length-1];if(this.data.atHardBreak){const me=Q.children[Q.children.length-1];me.position.end=mo(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Q.type)&&(M.call(this,ie),F.call(this,ie))}function W(){this.data.atHardBreak=!0}function Y(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.value=ie}function _(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.value=ie}function z(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.value=ie}function H(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=Q,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function q(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const Q=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=Q,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function I(ie){const Q=this.sliceSerialize(ie),me=this.stack[this.stack.length-2];me.label=fB(Q),me.identifier=Ti(Q).toLowerCase()}function K(){const ie=this.stack[this.stack.length-1],Q=this.resume(),me=this.stack[this.stack.length-1];if(this.data.inReference=!0,me.type==="link"){const re=ie.children;me.children=re}else me.alt=Q}function $(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.url=ie}function V(){const ie=this.resume(),Q=this.stack[this.stack.length-1];Q.title=ie}function ee(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function ue(ie){const Q=this.resume(),me=this.stack[this.stack.length-1];me.label=Q,me.identifier=Ti(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ye(ie){this.data.characterReferenceType=ie.type}function se(ie){const Q=this.sliceSerialize(ie),me=this.data.characterReferenceType;let re;me?(re=nE(Q,me==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):re=Ry(Q);const xe=this.stack[this.stack.length-1];xe.value+=re}function ge(ie){const Q=this.stack.pop();Q.position.end=mo(ie.end)}function ke(ie){F.call(this,ie);const Q=this.stack[this.stack.length-1];Q.url=this.sliceSerialize(ie)}function Re(ie){F.call(this,ie);const Q=this.stack[this.stack.length-1];Q.url="mailto:"+this.sliceSerialize(ie)}function Ae(){return{type:"blockquote",children:[]}}function Je(){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(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function et(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function Qe(){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 pE(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?pE(e,s):gB(e,s)}}function gB(e,t){let n;for(n in t)if(fE.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 h0(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+cc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+cc({start:t.start,end:t.end})+") is still open")}function xB(e){const t=this;t.parser=n;function n(s){return mB(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function yB(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 bB(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
564
|
+
`}]}function vB(e,t){const n=t.value?t.value+`
|
|
565
|
+
`:"",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 wB(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jB(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kB(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=Zi(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 SB(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 NB(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function mE(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 CB(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return mE(e,t);const o={src:Zi(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 EB(e,t){const n={src:Zi(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 TB(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 RB(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return mE(e,t);const o={href:Zi(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 AB(e,t){const n={href:Zi(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 PB(e,t,n){const s=e.all(t),o=n?DB(n):hE(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:`
|
|
566
|
+
`}),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:`
|
|
567
|
+
`});const m={type:"element",tagName:"li",properties:i,children:c};return e.patch(t,m),e.applyData(t,m)}function DB(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=hE(n[s])}return t}function hE(e){const t=e.spread;return t??e.children.length>1}function $B(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 LB(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IB(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function OB(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _B(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=Ny(t.children[1]),d=YC(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 MB(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 FB(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const g0=9,x0=32;function zB(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const i=[];for(;s;)i.push(y0(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return i.push(y0(t.slice(o),o>0,!1)),i.join("")}function y0(e,t,n){let s=0,o=e.length;if(t){let i=e.codePointAt(s);for(;i===g0||i===x0;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(o-1);for(;i===g0||i===x0;)o--,i=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function BB(e,t){const n={type:"text",value:zB(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function UB(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const VB={blockquote:yB,break:bB,code:vB,delete:wB,emphasis:jB,footnoteReference:kB,heading:SB,html:NB,imageReference:CB,image:EB,inlineCode:TB,linkReference:RB,link:AB,listItem:PB,list:$B,paragraph:LB,root:IB,strong:OB,table:_B,tableCell:FB,tableRow:MB,text:BB,thematicBreak:UB,toml:vd,yaml:vd,definition:vd,footnoteDefinition:vd};function vd(){}const gE=-1,yp=0,dc=1,yf=2,Dy=3,$y=4,Ly=5,Iy=6,xE=7,yE=8,b0=typeof self=="object"?self:globalThis,WB=(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 yp:case gE:return n(c,o);case dc:{const u=n([],o);for(const d of c)u.push(s(d));return u}case yf:{const u=n({},o);for(const[d,m]of c)u[s(d)]=s(m);return u}case Dy:return n(new Date(c),o);case $y:{const{source:u,flags:d}=c;return n(new RegExp(u,d),o)}case Ly:{const u=n(new Map,o);for(const[d,m]of c)u.set(s(d),s(m));return u}case Iy:{const u=n(new Set,o);for(const d of c)u.add(s(d));return u}case xE:{const{name:u,message:d}=c;return n(new b0[u](d),o)}case yE: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 b0[i](c),o)};return s},v0=e=>WB(new Map,e)(0),ii="",{toString:HB}={},{keys:KB}=Object,Wl=e=>{const t=typeof e;if(t!=="object"||!e)return[yp,t];const n=HB.call(e).slice(8,-1);switch(n){case"Array":return[dc,ii];case"Object":return[yf,ii];case"Date":return[Dy,ii];case"RegExp":return[$y,ii];case"Map":return[Ly,ii];case"Set":return[Iy,ii];case"DataView":return[dc,n]}return n.includes("Array")?[dc,n]:n.includes("Error")?[xE,n]:[yf,n]},wd=([e,t])=>e===yp&&(t==="function"||t==="symbol"),qB=(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]=Wl(c);switch(u){case yp:{let h=c;switch(d){case"bigint":u=yE,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);h=null;break;case"undefined":return o([gE],c)}return o([u,h],c)}case dc:{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 yf:{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 KB(c))(e||!wd(Wl(c[y])))&&h.push([i(y),i(c[y])]);return g}case Dy:return o([u,c.toISOString()],c);case $y:{const{source:h,flags:g}=c;return o([u,{source:h,flags:g}],c)}case Ly:{const h=[],g=o([u,h],c);for(const[y,b]of c)(e||!(wd(Wl(y))||wd(Wl(b))))&&h.push([i(y),i(b)]);return g}case Iy:{const h=[],g=o([u,h],c);for(const y of c)(e||!wd(Wl(y)))&&h.push(i(y));return g}}const{message:m}=c;return o([u,{name:d,message:m}],c)};return i},w0=(e,{json:t,lossy:n}={})=>{const s=[];return qB(!(t||n),!!t,new Map,s)(e),s},bf=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?v0(w0(e,t)):structuredClone(e):(e,t)=>v0(w0(e,t));function GB(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 YB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function QB(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||GB,s=e.options.footnoteBackLabel||YB,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=Zi(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:{...bf(c),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
568
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
569
|
+
`}]}}const bE=(function(e){if(e==null)return e8;if(typeof e=="function")return bp(e);if(typeof e=="object")return Array.isArray(e)?JB(e):XB(e);if(typeof e=="string")return ZB(e);throw new Error("Expected function, string, or object as test")});function JB(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=bE(e[n]);return bp(s);function s(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function XB(e){const t=e;return bp(n);function n(s){const o=s;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function ZB(e){return bp(t);function t(n){return n&&n.type===e}}function bp(e){return t;function t(n,s,o){return!!(t8(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function e8(){return!0}function t8(e){return e!==null&&typeof e=="object"&&"type"in e}const vE=[],n8=!0,j0=!1,r8="skip";function s8(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const i=bE(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=vE,N,w,v;if((!t||i(d,m,h[h.length-1]||void 0))&&(b=o8(n(d,h)),b[0]===j0))return b;if("children"in d&&d.children){const k=d;if(k.children&&b[0]!==r8)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]===j0)return N;w=typeof N[1]=="number"?N[1]:w+c}}return b}}}function o8(e){return Array.isArray(e)?e:typeof e=="number"?[n8,e]:e==null?vE:[e]}function wE(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),s8(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 Zg={}.hasOwnProperty,a8={};function i8(e,t){const n=t||a8,s=new Map,o=new Map,i=new Map,c={...VB,...n.handlers},u={all:m,applyData:c8,definitionById:s,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:c,one:d,options:n,patch:l8,wrap:d8};return wE(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(Zg.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=bf(v);return k.children=u.all(h),k}return bf(h)}return(u.options.unknownHandler||u8)(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=k0(N.value)),!Array.isArray(N)&&N.type==="element")){const w=N.children[0];w&&w.type==="text"&&(w.value=k0(w.value))}Array.isArray(N)?g.push(...N):g.push(N)}}}return g}}function l8(e,t){e.position&&(t.position=HF(e))}function c8(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,bf(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function u8(e,t){const n=t.data||{},s="value"in t&&!(Zg.call(n,"hProperties")||Zg.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 d8(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
570
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
571
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
572
|
+
`}),n}function k0(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function S0(e,t){const n=i8(e,t),s=n.one(e,void 0),o=QB(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
573
|
+
`},o),i}function f8(e,t){return e&&"run"in e?async function(n,s){const o=S0(n,{file:s,...t});await e.run(o,s)}:function(n,s){return S0(n,{file:s,...e||t})}}function N0(e){if(e)throw e}var Gh,C0;function p8(){if(C0)return Gh;C0=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 Gh=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},Gh}var m8=p8();const Yh=Sf(m8);function ex(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 h8(){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?g8(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 g8(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:x8,dirname:y8,extname:b8,join:v8,sep:"/"};function x8(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 y8(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 b8(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 v8(...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?".":w8(n)}function w8(e){Yc(e);const t=e.codePointAt(0)===47;let n=j8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function j8(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 k8={cwd:S8};function S8(){return"/"}function tx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function N8(e){if(typeof e=="string")e=new URL(e);else if(!tx(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 C8(e)}function C8(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 Qh=["history","path","basename","stem","extname","dirname"];class jE{constructor(t){let n;t?tx(t)?n={path:t}:typeof t=="string"||E8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":k8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Qh.length;){const i=Qh[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)Qh.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ys.basename(this.path):void 0}set basename(t){Xh(t,"basename"),Jh(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){E0(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(Jh(t,"extname"),E0(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){tx(t)&&(t=N8(t)),Xh(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){Xh(t,"stem"),Jh(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 Jh(e,t){if(e&&e.includes(ys.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ys.sep+"`")}function Xh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function E0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function E8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const T8=(function(e){const s=this.constructor.prototype,o=s[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),R8={}.hasOwnProperty;class Oy extends T8{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=h8()}copy(){const t=new Oy;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Yh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(tg("data",this.frozen),this.namespace[t]=n,this):R8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(tg("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 Zh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Zh("process",this.parser||this.Parser),eg("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);D8(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(),Zh("processSync",this.parser||this.Parser),eg("processSync",this.compiler||this.Compiler),this.process(t,o),R0("processSync","process",n),s;function o(i,c){n=!0,N0(i),s=c}}run(t,n,s){T0(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),R0("runSync","run",s),o;function i(c,u){N0(c),o=u,s=!0}}stringify(t,n){this.freeze();const s=jd(n),o=this.compiler||this.Compiler;return eg("stringify",o),T0(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(tg("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=Yh(!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];ex(w)&&ex(b)&&(b=Yh(!0,w,b)),s[y]=[m,b,...N]}}}}const A8=new Oy().freeze();function Zh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function eg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function tg(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 T0(e){if(!ex(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function R0(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jd(e){return P8(e)?e:new jE(e)}function P8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function D8(e){return typeof e=="string"||$8(e)}function $8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const L8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",A0=[],P0={allowDangerousHtml:!0},I8=/^(https?|ircs?|mailto|xmpp)$/i,O8=[{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 _8(e){const t=M8(e),n=F8(e);return z8(t.runSync(t.parse(n),n),e)}function M8(e){const t=e.rehypePlugins||A0,n=e.remarkPlugins||A0,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...P0}:P0;return A8().use(xB).use(n).use(f8,s).use(t)}function F8(e){const t=e.children||"",n=new jE;return typeof t=="string"&&(n.value=t),n}function z8(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,i=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,d=t.urlTransform||B8;for(const h of O8)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+L8+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),wE(e,m),QF(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 Hh)if(Object.hasOwn(Hh,b)&&Object.hasOwn(h.properties,b)){const N=h.properties[b],w=Hh[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 B8(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||I8.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(_8,{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 U8(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]),$c(d=>{d.type==="todos-updated"&&d.projectSlug===e&&u()}),{data:t,loading:s,error:i,refetch:u}}async function V8(e,t,n){await fetch(Hr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function W8(e,t,n){await fetch(`${Hr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function H8(e,t,n){await fetch(`${Hr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function K8(e,t,n){await fetch(`${Hr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function q8(e,t){await fetch(`${Hr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function G8(e,t){await fetch(`${Hr(e)}/${t}`,{method:"DELETE"})}async function Y8(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 kE(e,t,n){return`${Hr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function Q8(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 J8(e,t,n){const s=await fetch(kE(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function SE(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 X8(e,t){return await SE(`${Hr(e)}/promote`,t)}async function Z8(e,t,n){await SE(`${Hr(e)}/${t}/move`,{to:n})}const D0=[{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 NE({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=D0.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:D0.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 CE({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(NE,{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(EE,{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(sU,{item:e})]}),r.jsx(TE,{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(Gd,{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(Rf,{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 EE({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:o,onSave:i}){return n?r.jsx(eU,{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 eU({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 tU(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function nU(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 TE({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(rU,{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(qk,{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=nU(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 rU({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:[tU(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(qk,{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(kx,{className:"h-3 w-3"})})]})}function sU({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(xx,{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(Hk,{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 RE="__one_off__";function _y({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(""),[W,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 ue=!1;return(async()=>{try{const ye=await fetch("/api/projects");if(!ye.ok)throw new Error(`HTTP ${ye.status}`);const se=await ye.json();ue||w(se.filter(ge=>!ge.archived))}catch(ye){ue||k(ye instanceof Error?ye.message:String(ye))}})(),()=>{ue=!0}},[e,i,c]),f.useEffect(()=>{if(!F){z(null);return}let ue=!1;return q(!0),(async()=>{try{const ye=await fetch(`/api/projects/${encodeURIComponent(F)}/assignments`);if(!ye.ok)throw new Error(`HTTP ${ye.status}`);const se=await ye.json();ue||z(se)}catch{ue||z([])}finally{ue||q(!1)}})(),()=>{ue=!0}},[F]);const K=f.useMemo(()=>N??[],[N]);async function $(ue){if(ue.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 ye=E===RE?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const ge={groups:n.groups,mode:"new-assignment",target:ye,title:T.trim()||void 0,type:R.trim()||void 0,priority:L||void 0};await B(ge);return}const se={todoIds:t,mode:"new-assignment",target:ye,title:T.trim()||void 0,type:R.trim()||void 0,priority:L||void 0};await ee(se)}async function V(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!F||!W){b("Pick both project and assignment.");return}const ye={todoIds:t,mode:"to-assignment",target:{assignment:`${F}/${W}`}};await ee(ye)}async function ee(ue){g(!0),b(null);try{let ye;if(n.kind==="workspace")ye=await eD(n.workspace,ue);else if(n.kind==="project")ye=await X8(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");o(ye),s(!1)}catch(ye){b(ye instanceof Error?ye.message:String(ye))}finally{g(!1)}}async function B(ue){g(!0),b(null);try{const ye=await tD(ue);o(ye),s(!1)}catch(ye){b(ye instanceof Error?ye.message:String(ye))}finally{g(!1)}}return r.jsx($n,{open:e,onOpenChange:ue=>h?void 0:s(ue),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(Wr,{children:["Convert the selected todo",t.length===1?"":"s"," to a new or existing assignment. Source todo",t.length===1?"":"s"," will be marked ",r.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),r.jsxs(zC,{value:d,onValueChange:ue=>m(ue),children:[r.jsxs(BC,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Wg,{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(Wg,{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(Hg,{value:"new",children:r.jsxs("form",{onSubmit:$,className:"space-y-4",children:[r.jsx(li,{label:"Target project",children:r.jsx($0,{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:ue=>P(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(li,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>A(ue.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:ue=>M(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"—"}),r.jsx("option",{value:"low",children:"low"}),r.jsx("option",{value:"medium",children:"medium"}),r.jsx("option",{value:"high",children:"high"}),r.jsx("option",{value:"critical",children:"critical"})]})})]}),y?r.jsx(L0,{message:y}):null,r.jsx(I0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(Hg,{value:"existing",children:r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsx(li,{label:"Project",children:r.jsx($0,{value:F,onChange:ue=>{D(ue),Y("")},projects:K,error:v,disabled:h})}),r.jsx(li,{label:H?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:W,onChange:ue=>Y(ue.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(ue=>r.jsxs("option",{value:ue.slug,children:[ue.title," (",ue.status,")"]},ue.slug))]})}),y?r.jsx(L0,{message:y}):null,r.jsx(I0,{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 $0({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:RE,children:"One-off (no project)"}):null,n.map(c=>r.jsxs("option",{value:c.slug,children:[c.title," (",c.slug,")"]},c.slug))]})}function L0({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 I0({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 AE({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 nD(n.workspace,A,L):await Z8(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 W=await P(D,L);W.ok?M.push(D):F.push({id:D,error:W.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(Wr,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),r.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(ng,{kind:"project",checked:i==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(ng,{kind:"workspace",checked:i==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(ng,{kind:"global",checked:i==="global",onChange:()=>c("global"),label:"Global"})]}),i==="project"?r.jsx(O0,{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(O0,{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(oU,{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 O0({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 ng({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 oU({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 My({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 PE=[{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 vp(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function Fy(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[vp(n.status)].push(n);return PE.map(n=>({config:n,items:t[n.id]}))}const DE="syntaur.todos.sections.collapsed.v1",_0=Object.fromEntries(PE.map(e=>[e.id,e.defaultCollapsed]));function rg(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(DE);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function aU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(DE,JSON.stringify(e))}catch{}}function zy(e){const[t,n]=f.useState(()=>rg()[e]??{});f.useEffect(()=>{n(rg()[e]??{})},[e]);const s=f.useCallback(i=>t[i]??_0[i],[t]),o=f.useCallback(i=>{const c=rg(),u=c[e]??{},d=u[i]??_0[i],m={...u,[i]:!d};c[e]=m,aU(c),n(m)},[e]);return{isCollapsed:s,toggle:o}}function iU({projectId:e}){const{data:t,loading:n,error:s,refetch:o}=U8(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=zy("project:"+e),[D,W]=f.useState(null),[Y,_]=f.useState(null),z=f.useRef(null);async function H(Q,me){Q.stopPropagation(),await Kc(me)&&(N(me),setTimeout(()=>N(re=>re===me?null:re),1500))}const q=f.useMemo(()=>{if(!(t!=null&&t.items))return[];const Q=new Set;for(const me of t.items)for(const re of me.tags)Q.add(re);return Array.from(Q).sort()},[t]),I=f.useMemo(()=>{if(!(t!=null&&t.items))return[];let Q=t.items;if(i.trim()){const me=i.toLowerCase();Q=Q.filter(re=>re.description.toLowerCase().includes(me)||re.tags.some(xe=>xe.toLowerCase().includes(me))||re.id.includes(me))}return u&&(Q=Q.filter(me=>me.status===u)),m&&(Q=Q.filter(me=>me.tags.includes(m))),Q},[t,i,u,m]);f.useEffect(()=>{E(new Set)},[i,u,m,e]);const K=f.useMemo(()=>I.filter(Q=>k.has(Q.id)).length,[I,k]),$=I.length>0&&K===I.length,V=K>0&&!$;function ee(Q){E(me=>{const re=new Set(me);return re.has(Q)?re.delete(Q):re.add(Q),re})}function B(){E(Q=>{const me=new Set(Q);if($)for(const re of I)me.delete(re.id);else for(const re of I)me.add(re.id);return me})}function ue(){E(new Set)}const ye=A?[A]:Array.from(k);function se(){E(new Set),L(null),o()}function ge(){E(new Set),o()}async function ke(){g.trim()&&(await V8(e,g.trim()),y(""),o())}async function Re(Q,me,re){Q.stopPropagation(),window.confirm(`Delete "${re}"? This can't be undone.`)&&(await G8(e,me),o())}async function Ae(Q,me){switch(me){case"open":await q8(e,Q);break;case"in_progress":await K8(e,Q);break;case"completed":await W8(e,Q);break;case"blocked":await H8(e,Q);break}o()}async function Je(Q,me){await Y8(e,Q,me),o()}async function at(Q,me){await Q8(e,Q,me),o()}async function Ze(Q,me){await J8(e,Q,me),o()}const ot=Fy(I),Z=ot.filter(Q=>!F.isCollapsed(Q.config.id)).flatMap(Q=>Q.items),{hotkeyRowProps:_e}=Oc(Z,{scope:"list:todos",bindO:!1,onOpen:Q=>v(Q.id)});Kt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Q;return(Q=M.current)==null?void 0:Q.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 Q=t.items.find(re=>re.id===Ye);if(!Q)return;const me=vp(Q.status);F.isCollapsed(me)&&F.toggle(me)},[Ye,t==null?void 0:t.items]),f.useEffect(()=>{if(!Ye)return;const Q=document.querySelector(`[data-todo-id="${window.CSS.escape(Ye)}"]`);if(!Q)return;Q.scrollIntoView({block:"nearest"}),Q.classList.add("ring-2","ring-primary/60");const me=window.setTimeout(()=>{Q.classList.remove("ring-2","ring-primary/60"),Ie(re=>{const xe=new URLSearchParams(re);return xe.delete("focus"),xe},{replace:!0})},1500);return()=>window.clearTimeout(me)},[Ye,Z.length,Ie]);const Me=D?(t==null?void 0:t.items.find(Q=>Q.id===D))??null:null;function et(Q,me){const re=z.current;if(re!=null&&re.closest(Oi)){Q.preventDefault();return}Q.dataTransfer.effectAllowed="move",Q.dataTransfer.setData("text/plain",me),W(me)}function Qe(){W(null),_(null)}function $t(Q,me){!Me||me.statuses.includes(Me.status)||(Q.preventDefault(),Q.dataTransfer.dropEffect="move",_(me.id))}function vt(Q,me){Y===me.id&&!Q.currentTarget.contains(Q.relatedTarget)&&_(null)}function ct(Q,me){Q.preventDefault();const re=Me;Qe(),!(!re||me.statuses.includes(re.status))&&Ae(re.id,me.dropStatus)}if(n)return r.jsx(gt,{label:"Loading todos..."});if(s)return r.jsx(Nt,{error:s});const ie=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(_n,{label:"Open",value:ie.open,icon:zr}),r.jsx(_n,{label:"In Progress",value:ie.in_progress,icon:zr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:ie.blocked,icon:jx,tone:"warn"}),r.jsx(_n,{label:"Total",value:ie.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:Q=>y(Q.target.value),onKeyDown:Q=>Q.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(Rt,{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:Q=>c(Q.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:Q=>d(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),q.length>0&&r.jsxs("select",{value:m,onChange:Q=>h(Q.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),q.map(Q=>r.jsxs("option",{value:Q,children:["#",Q]},Q))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>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:ue,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:Q=>{Q&&(Q.indeterminate=V)},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 Q=-1;return ot.map(({config:me,items:re})=>{const xe=!F.isCollapsed(me.id);return r.jsx(My,{label:me.label,count:re.length,expanded:xe,onToggle:()=>F.toggle(me.id),isDropTarget:Y===me.id,onDragOver:Pe=>$t(Pe,me),onDragLeave:Pe=>vt(Pe,me),onDrop:Pe=>ct(Pe,me),children:xe&&re.map(Pe=>(Q+=1,r.jsx(CE,{item:Pe,copiedId:b,selected:k.has(Pe.id),editing:w===Pe.id,onBeginEdit:ve=>v(ve),onEndEdit:()=>v(null),onPatchDescription:Je,onAddAttachments:at,onDeleteAttachment:Ze,attachmentUrl:(ve,te)=>kE(e,ve,te),onToggleSelected:ve=>ee(ve),onMoveOne:(ve,te)=>{te.stopPropagation(),L(ve),R(!0)},onStatusChange:Ae,onCopyId:H,onDelete:Re,hotkeyRowProps:_e(Q),onDragOrigin:ve=>{z.current=ve.target},onDragStart:et,onDragEnd:Qe,isDragging:D===Pe.id},Pe.id)))},me.id)})})()}),r.jsx(_y,{open:S,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ge}),r.jsx(AE,{open:P,selectedIds:ye,scope:{kind:"project",projectId:e},onOpenChange:Q=>{R(Q),Q||L(null)},onDone:se})]})}const lU={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},M0=new Set(["title"]);function $E({visibility:e,onChange:t}){const[n,s]=f.useState(!1);function o(c){if(M0.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(sL,{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(iP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",i>0?` (${Lh.length-i}/${Lh.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:Lh.map(c=>{const u=e.hidden.includes(c),d=M0.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:lU[c]}),d?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const Ri={...wc,custom:!1},LE=`view-prefs.cache.v${wc.version}`;let Ec=cU(),ci=null;const Tc=new Set;let IE=0;function By(){return++IE}function Uy(e){return e===IE}function cU(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(LE);if(!e)return null;const t=JSON.parse(e);return t.version!==wc.version?null:t}catch{return null}}function uU(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(LE,JSON.stringify(e))}catch{}}function Vy(e){Ec=e,uU(e);for(const t of Tc)t(e)}function Wy(e){if(!e||typeof e!="object")return Ri;const t=e;return t.version!==wc.version||!t.global||!t.projects?Ri:{version:wc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Hy(){if(ci)return ci;const e=By();return ci=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Wy(t);return Uy(e)&&Vy(n),ci=null,Ec??n}).catch(()=>(ci=null,Ec??Ri)),ci}function OE(e){const[t,n]=f.useState(()=>Ec??Ri);return f.useEffect(()=>{let s=!1;return Hy().then(o=>{s||n(o)}),Tc.add(n),()=>{s=!0,Tc.delete(n)}},[]),pN(t,e??null)}function dU(){const[e,t]=f.useState(()=>Ec??Ri);return f.useEffect(()=>{let n=!1;return Hy().then(s=>{n||t(s)}),Tc.add(t),()=>{n=!0,Tc.delete(t)}},[]),e}async function _E(e){const t=By(),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=Wy(await n.json());return Uy(t)&&Vy(s),s}function ME(e){return _E({global:e})}function FE(e,t){return _E({projects:{[e]:t}})}async function fU(){const e=By(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Wy(await t.json());return Uy(e)&&Vy(n),n}const F0=80;function zE({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<=F0;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:F0,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 BE({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=>vN(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 pU=new Set(["overview","assignments","todos","dependencies","knowledge"]),z0="__unknown_type__";function B0(){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}=v1(e),d=xa(),m=up(),{data:h}=ma(),[g,y]=ls(),b=g.get("tab"),N=b&&pU.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=OE(v),[E,S]=f.useState(()=>$h(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)),[W,Y]=f.useState(()=>Fe(k.filters.tags)),[_,z]=f.useState(null),[H,q]=f.useState(()=>k.grouping),[I,K]=f.useState(()=>k.sortField),[$,V]=f.useState(()=>k.sortDirection),[ee,B]=f.useState(()=>({collapsed:[]})),[ue,ye]=f.useState(()=>({hidden:[]})),[se,ge]=f.useState(()=>({hidden:[]})),[ke,Re]=f.useState(null),[Ae,Je]=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:Qe,loading:$t,error:vt}=So(ke),ct=f.useRef(null);f.useEffect(()=>{ke&&!$t&&!vt&&!Qe&&Re(null)},[Qe,vt,ke,$t]),f.useEffect(()=>{Re(null),ct.current=null,z(null)},[e,t]),f.useEffect(()=>{S($h(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),V(k.sortDirection)},[e,k.defaultView,k.filters.status,k.filters.assignee,k.filters.priority,k.filters.type,k.filters.tags,k.grouping,k.sortField,k.sortDirection]);const ie=f.useCallback(oe=>{v&&FE(v,oe).catch(ze=>{console.warn("Failed to persist project view prefs:",ze)})},[v]),Q=f.useCallback(oe=>{S(oe),ie({defaultView:oe})},[ie]),me=f.useCallback(oe=>{P(oe),ie({filters:{status:oe}})},[ie]),re=f.useCallback(oe=>{A(oe),ie({filters:{assignee:oe}})},[ie]),xe=f.useCallback(oe=>{M(oe),ie({filters:{priority:oe}})},[ie]),Pe=f.useCallback(oe=>{D(oe),ie({filters:{type:oe}})},[ie]),ve=f.useCallback(oe=>{Y(oe),ie({filters:{tags:oe}})},[ie]),te=f.useCallback(oe=>{q(oe),ie({grouping:oe})},[ie]),de=f.useCallback(oe=>{K(oe),ie({sortField:oe})},[ie]),Se=f.useCallback(oe=>{V(oe),ie({sortDirection:oe})},[ie]),Ue=f.useCallback(()=>({viewMode:E,filters:{status:T,priority:L,type:F,assignee:R,tags:W,project:"all",activity:"all",dateRange:ua(_)},sortField:I,sortDirection:$,listSectionVisibility:ee,kanbanColumnVisibility:ue,tableColumnVisibility:se}),[E,T,L,F,R,W,_,I,$,ee,ue,se]),le=f.useCallback(oe=>{hC(oe,{setViewMode:ze=>S($h(ze)),setStatusFilter:me,setPriorityFilter:xe,setTypeFilter:Pe,setAssigneeFilter:re,setTagsFilter:ve,setDateRange:z,setSortField:de,setSortDirection:Se,setListSectionVisibility:B,setKanbanColumnVisibility:ye,setTableColumnVisibility:ge}),Re(oe.id)},[me,xe,Pe,re,ve,de,Se]),pt=f.useCallback(oe=>{le(oe),ct.current=oe.id,y(ze=>{const tt=new URLSearchParams(ze);return tt.set("loadView",oe.id),tt},{replace:!0})},[le,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})),Je(!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]),jt=f.useCallback(async()=>{if(!(!ke||!Qe))try{const oe=Fe(Qe.config.filters.project)[0]??null,ze=_i({name:Qe.name,context:{workspace:t??null,projectSlug:oe},state:Ue()}),tt=mf(Qe.config,ze.config,ze.config);await af(ke,{config:tt}),Z("View updated","success")}catch(oe){Z(oe instanceof Error?oe.message:"Failed to update view","error")}},[Ue,Qe,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,!vN(Ye,{kind:"project",slug:e??"",workspace:t??null})){s(xC(Ye),{replace:!0});return}le(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,le,y,Z,s,e,t]);function st(oe){I===oe?Se($==="asc"?"desc":"asc"):(de(oe),Se("asc"))}const pe=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(gt,{label:"Loading project workspace…"});if(c||!o)return r.jsx(Nt,{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=>w5(oe,{status:T,priority:L,type:F,assignee:R,tags:W,dateRange:ua(_)})),Gn=Hc(Gt,I,$),Ct=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||!Ct.has(oe.type))?[{id:z0,title:"Other",description:"Assignments with no recognized type."}]:[]]:wC(d.order).map(oe=>({id:oe,title:Wc(d,oe),description:cp(oe)}));function Et({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(Vk,{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(Rw,{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(Rt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(wy,{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(gp,{value:N,onValueChange:w,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{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(Ve,{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:me}),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:xe}),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:W,onChange:ve}),r.jsx(dp,{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(mp,{value:E,onChange:oe=>Q(oe),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(BE,{scope:Ee,loadedViewId:ke,onApply:pt,onOpenSaveDialog:()=>{Ze(!1),Je(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Qe?jt():(Ze(!1),Je(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Qe?`Update ${Qe.name}`:"Save current view",children:Qe?`Update '${Qe.name}'`:"Save view"}),Qe?r.jsx("button",{type:"button",onClick:()=>{Ze(!0),Je(!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(St,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Ce,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(lp,{columns:Fn,items:Gn,getItemId:oe=>oe.slug,getColumnId:oe=>H==="type"?oe.type&&Ct.has(oe.type)?oe.type:z0:oe.status,dragDisabled:!0,renderCard:oe=>r.jsx(mU,{projectSlug:o.slug,assignment:oe}),emptyMessage:oe=>`No ${oe.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:oe=>ye(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($E,{visibility:se,onChange:ge})}),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(Et,{field:"title",children:"Assignment"}):null,ze("status")?r.jsx(Et,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),ze("priority")?r.jsx(Et,{field:"priority",children:"Priority"}):null,ze("assignee")?r.jsx(Et,{field:"assignee",children:"Assignee"}):null,ze("dependencies")?r.jsx(Et,{field:"dependencies",children:"Dependencies"}):null,ze("created")?r.jsx(Et,{field:"created",children:"Created"}):null,ze("updated")?r.jsx(Et,{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(iU,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?r.jsx(Ve,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(bF,{definition:o.dependencyGraph,nodeRoutes:pe})}):r.jsx(St,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(Ve,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Ce,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[r.jsx(Rt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?r.jsx(St,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children: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(Ve,{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(Rt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?r.jsx(St,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children: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(Ve,{title:"Progress Summary",children:r.jsx(gf,{progress:o.progress,showLegend:!0})}),r.jsx(Ve,{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(Ve,{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(Rw,{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(Rt,{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(XA,{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(xx,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?r.jsxs(Ve,{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(zE,{open:Ae,onOpenChange:oe=>{Je(oe),oe||Ze(!1)},initialName:at&&Qe?`${Qe.name} (copy)`:"",title:at?"Save as new view":"Save view",onSubmit:xt})]})}function mU({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 UE({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(Aw,{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(Aw,{className:"h-3 w-3","aria-hidden":"true"})})}function Hl(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 hU(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 gU(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 VE(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 WE(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 xU(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 HE(e){return e.requiresReason||e.command==="block"}async function yU(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 bU(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 Ky extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function qy(e){const t=await e.json().catch(()=>null);return new Ky((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function vU(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 wU(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 jU(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 qy(s);return(await s.json()).assignment}async function kU(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 qy(n);return(await n.json()).assignment}async function SU(e){const{url:t}=hU(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await qy(n);return await n.json()}async function wp(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 NU(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return wp(s)}async function CU(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return wp(n)}async function EU(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await wp(n)).sourceAssignments}async function TU(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await wp(t)).sourceAssignments}function KE(){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=Hl(R,A,void 0,L,M);return}const D=await F.json();if(D.ok){window.location.href=Hl(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=Hl(R,A,void 0,L,M)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=Hl(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 SU({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=Hl(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 Ky&&R.stderr?`${R.message}
|
|
574
|
+
${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(xc,{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(xc,{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 qE({session:e,onMarkStopped:t}){const n=KE(),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(pP,{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(wx,{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 RU(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function GE({sessions:e,loading:t,error:n,onError:s,onNotice:o}){return t&&!e?null:n&&!e?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(St,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(Ve,{title:"Agent Sessions",children:r.jsx(St,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(Ve,{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(Ef,{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(UE,{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(qE,{session:i,onMarkStopped:RU})]},i.sessionId))})})}const sg="Cost / Usage";function YE({summary:e,error:t}){return t&&!e?r.jsx(Ve,{title:sg,children:r.jsx(St,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(Ve,{title:sg,children:r.jsx(St,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(Ve,{title:sg,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(U0,{label:"Total cost",value:Pi(e.totalCost)}),r.jsx(U0,{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(Dc,{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 ",g3(e.lastEventDay)]})]})}):null}function U0({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 QE({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(Wr,{children:t.description})]}),t.warning?r.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:d}),r.jsx("textarea",{value: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(xc,{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 AU=/^[a-z0-9][a-z0-9_-]*$/,JE=["first","last","none"];class XE extends Error{constructor(n,s){super(n);ah(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Gy={agents:[],custom:!1};let hi=null,ui=null,vf=0;const nx=new Set;function ZE(e){hi=e;for(const t of nx)t(e)}function PU(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"&&JE.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 Yy(e){if(!e||typeof e!="object")return Gy;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const o of n){const i=PU(o);i&&s.push(i)}return{agents:s,custom:t.custom===!0}}function DU(){if(hi)return Promise.resolve(hi);if(ui)return ui;const e=++vf;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=Yy(t);return e!==vf?hi??n:(hi=n,n)}).catch(()=>(ui=null,Gy)),ui}function e2(){const[e,t]=f.useState(()=>hi??Gy);return f.useEffect(()=>{let n=!1;return DU().then(s=>{n||t(s)}),nx.add(t),()=>{n=!0,nx.delete(t)}},[]),e}async function t2(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new XE(n,t==null?void 0:t.fieldErrors)}async function $U(e){++vf;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await t2(t);const n=Yy(await t.json());return ZE(n),n}async function LU(){++vf;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await t2(e);const t=Yy(await e.json());return ZE(t),t}const V0=/[A-Za-z0-9_-]/,IU=/^[a-z0-9]+(-[a-z0-9]+)*$/,W0=/(^|\s)@([A-Za-z0-9_-]+)/g,rx="assignment";function n2(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 r2(e,t){const n=[rx,...t.filter(c=>c!==rx)],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 s2(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function o2(e,t){const n=t instanceof Set?t:new Set(t),s=[];W0.lastIndex=0;let o;for(;(o=W0.exec(e))!==null;){const i=o[2];i!==rx&&(IU.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 H0=2e3;function OU({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=n2(i,b),P=T?r2(T.partial,u):[],R=e&&!m&&!k&&P.length>0,A=o2(i,u),L=i.length>H0;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=s2(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 W(_){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(Wr,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:S,value:i,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:M,onKeyDown:W,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 ",H0," 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 a2({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,c=KE(),[u,d]=f.useState(null),h=e2().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(W=>W.id===A)??h.find(W=>W.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(OU,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:A=>{c.open(e,void 0,u.agentId,A)},onOpenChange:A=>{A||d(null)}})]})}const og="w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50";function i2({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:s,defaultParentBranch:o="main",onCreated:i}){const 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,W]=f.useState(""),[Y,_]=f.useState(null),[z,H]=f.useState(null),[q,I]=f.useState(""),[K,$]=f.useState(s),[V,ee]=f.useState(!1),[B,ue]=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),W(""),_(null),H(null),I(""),$(s),ue(null),(c.kind==="project-nested"?vU(c.projectSlug):wU(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"?EU(c.projectSlug,c.assignmentSlug):TU(c.assignmentId)).then(Ie=>{Z||_(Ie)}).catch(Ie=>{Z||(H(Ie.message),_([]))}),()=>{Z=!0}},[u,s,o,e,t,n]);const ye=m==="branch-off"?(Y??[]).find(Z=>Z.id===q)??null:null,se=m==="branch-off"?(ye==null?void 0:ye.repository)??"":k?S.trim():w;f.useEffect(()=>{if(!u||m!=="new-branch")return;if(!se){R([]),F(null),L(!1),W("");return}let Z=!1;return L(!0),F(null),W(""),(c.kind==="project-nested"?NU(c.projectSlug,c.assignmentSlug,se):CU(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])??"";W(Ie),L(!1)}).catch(Ee=>{Z||(R([]),F(Ee.message),L(!1))}),()=>{Z=!0}},[u,m,se,o,e,t,n]);const ge=gU(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,Je=Z=>{Z!==m&&(h(Z),I(""),ue(null),Z==="branch-off"&&(W(""),R([]),F(null),L(!1)))},at=Z=>{I(Z);const _e=(Y??[]).find(Ee=>Ee.id===Z);W((_e==null?void 0:_e.branch)??"")},Ze=V||ge!==null||!se||!D.trim()||(m==="new-branch"?g===null||A:Y===null||!q),ot=async()=>{ee(!0),ue(null);try{const Z={repository:se,branch:K.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await jU(c.projectSlug,c.assignmentSlug,Z):await kU(c.assignmentId,Z),d(!1),i()}catch(Z){Z instanceof Ky?ue({message:Z.message,stderr:Z.stderr}):Z instanceof Error?ue({message:Z.message}):ue({message:String(Z)})}finally{ee(!1)}};return r.jsxs($n,{open:u,onOpenChange:Z=>V?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(fP,{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(Wr,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:V,onClick:()=>Je("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:V,onClick:()=>Je("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:og,value:w,onChange:Z=>v(Z.target.value),disabled:V||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:V,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:V}):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:og,value:D,onChange:Z=>W(Z.target.value),disabled:V||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:og,value:q,onChange:Z=>at(Z.target.value),disabled:V||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))]})]}),ye?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:ye.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:ye.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:V}),ge?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ge}):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(aL,{disabled:V,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:V?"Working…":"Create worktree"})]})]})]})}function _U(e){const t=e.split(`
|
|
575
|
+
`),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(`
|
|
576
|
+
`).replace(/\n{3,}/g,`
|
|
577
|
+
|
|
578
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function MU(e){const t=e.split(`
|
|
579
|
+
`),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(`
|
|
580
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
581
|
+
|
|
582
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
583
|
+
`).replace(/\n{3,}/g,`
|
|
584
|
+
|
|
585
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function FU({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(hx,{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(qd,{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(Ve,{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(Kd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function zU({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(Ve,{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(zk,{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(Kd,{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(Hd,{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(Kd,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function BU(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 UU(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function l2({projectSlug:e,assignmentSlug:t,entries:n}){const[s,o]=f.useState(n);f.useEffect(()=>{o(n)},[n]);const i=f.useMemo(()=>BU(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(UU(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(Ve,{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(c2,{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 c2({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(hx,{className:"h-3 w-3"}):r.jsx(nP,{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(CP,{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(c2,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const VU=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function K0(){var ve,te,de,Se,Ue,le,pt,xt,jt,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:W,error:Y,refetch:_}=L3(e,t),{data:z}=v1(e),{data:H}=Ex(),{data:q,loading:I,error:K}=O3(e,t),{data:$,loading:V,error:ee}=M3(e,t),B=f.useMemo(()=>{if(!D||!z)return[];const pe=new Map(z.assignments.map(Oe=>[Oe.slug,Oe]));return D.dependsOn.map(Oe=>{const qe=pe.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]),ue=B.filter(pe=>pe.status!=="completed"&&pe.status!=="review");Ro("assignment");const ye=f.useMemo(()=>((z==null?void 0:z.assignments)??[]).map(pe=>pe.slug),[z]),se=t?ye.indexOf(t):-1,ge=se>0?ye[se-1]:null,ke=se>=0&&se<ye.length-1?ye[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:!!ge,handler:()=>ge&&n(`${s}/projects/${e}/assignments/${ge}`)}),Kt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!ke,handler:()=>ke&&n(`${s}/projects/${e}/assignments/${ke}`)});const Ae=f.useMemo(()=>D?_U(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),Je=f.useMemo(()=>MU(Ae.summaryBody),[Ae.summaryBody]),at=Ae.acceptanceCriteria,Ze=at.filter(pe=>pe.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(pe=>pe+1),Z.current=ot}},[ot,D]),W)return r.jsx(gt,{label:"Loading assignment workspace…"});if(Y||!D||!e||!t)return r.jsx(Nt,{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(pe=>!pe.disabled&&pe.targetStatus!==D.status),Qe=VU.map(pe=>et.find(Oe=>Oe.command===pe)).find(Boolean)??et[0]??null,$t=[];if(H!=null&&H.sessions)for(const pe of H.sessions)for(const Oe of pe.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:pe.name,command:qe.command,urls:qe.urls});async function vt(pe){u(null);try{await WE(Ee,Ie,pe),_()}catch(Oe){u(Oe.message)}}async function ct(pe){u(null);try{const Oe=await fetch(`/api/projects/${Ee}/assignments/${Ie}/${pe?"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(pe?"Assignment archived":"Assignment restored","success")}catch(Oe){u(Oe.message)}}async function ie(){R(!0);try{await xU(Ee,Ie),n(`${s}/projects/${Ee}`)}catch(pe){u(pe.message),R(!1),T(!1)}}async function Q(pe,Oe){u(null),y(pe.command);try{return await VE(Ee,Ie,pe,Oe),_(),!0}catch(qe){return u(qe.message),!1}finally{y(null)}}function me(pe){if(HE(pe)){N(pe);return}Q(pe)}async function re(pe,Oe){v(null),E(pe);try{const qe=await fetch(`/api/projects/${Ee}/assignments/${Ie}/acceptance-criteria/${pe}`,{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 xe=[...et.filter(pe=>pe!==Qe).map(pe=>({key:`transition-${pe.command}`,label:pe.label,onSelect:()=>me(pe),disabled:g===pe.command})),...Me.filter(pe=>pe.disabled||pe.targetStatus===D.status).map(pe=>({key:`transition-${pe.command}`,label:pe.label,disabled:!0,disabledReason:pe.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:pe.disabledReason??pe.warning??pe.description})),...F.statuses.map(pe=>({key:`override-${pe.id}`,label:`Override → ${pe.label}`,onSelect:()=>vt(pe.id),disabled:pe.id===D.status,disabledReason:pe.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:dP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:TP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:hh,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Kd,href:`${s}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:mP,href:`${s}/projects/${e}/assignments/${t}/decision-record/edit`},{key:D.archived?"unarchive":"archive",label:D.archived?"Restore assignment":"Archive assignment",icon:D.archived?Wd:Tf,onSelect:()=>ct(!D.archived)},{key:"delete",label:"Delete assignment",icon:yn,destructive:!0,onSelect:()=>T(!0)}],Pe=(Qe==null?void 0:Qe.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 ",s1(D.updated)]}),ue.length>0&&r.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",ue.length," unmet dep",ue.length===1?"":"s"]}),r.jsx(wy,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(a2,{target:{kind:"assignment",id:D.id},worktreePath:((de=D.workspace)==null?void 0:de.worktreePath)??null,repository:((Se=D.workspace)==null?void 0:Se.repository)??null}),!((Ue=D.workspace)!=null&&Ue.worktreePath)&&e&&t&&r.jsx(i2,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>_()}),Qe&&r.jsx("button",{type:"button",title:Qe.warning||Qe.description,disabled:g===Qe.command,onClick:()=>me(Qe),className:be("shell-action disabled:cursor-not-allowed disabled:opacity-50",Qe.warning&&"border-warning-foreground/40",Pe&&A>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Qe.command?"Working…":Qe.label})},Pe?`review-${A}`:Qe.command),r.jsx(my,{items:xe,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,(le=D.derived)!=null&&le.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(Ve,{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(([pe,Oe])=>r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[pe,": ",r.jsx("span",{className:"font-medium text-foreground",children:String(Oe)})]},pe))}),(D.derived.attestations??[]).map(pe=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:pe.fact}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",pe.binds,")"]}),pe.records.length===0?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):pe.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))]},pe.fact))]})}):null,B.length>0&&r.jsx(FU,{projectSlug:e,dependencies:B,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(zU,{links:D.enrichedLinks}),D.referencedBy&&D.referencedBy.length>0&&r.jsx(Ve,{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(pe=>{const Oe=pe.sourceProjectSlug===null?`/assignments/${pe.sourceId}`:`${s}/projects/${pe.sourceProjectSlug}/assignments/${pe.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:pe.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",pe.mentions," mention",pe.mentions===1?"":"s",")"]}),pe.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]},pe.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(gp,{value:M,onValueChange:pe=>i({tab:pe}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[Ae.acceptanceCriteria.length>0?r.jsx(Ve,{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((pe,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:pe.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":pe.checked,children:pe.text})]},`${Oe}-${pe.text}`)})]})}):null,Je.hasSection?r.jsx(Ve,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(gn,{content:Je.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(Ve,{title:"Assignment Summary",children:r.jsx(gn,{content:Je.remaining,emptyState:Ae.acceptanceCriteria.length>0||Je.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(Ve,{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(hh,{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(St,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(Ve,{title:"Scratchpad",actions:r.jsxs(Ce,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(hh,{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(St,{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(Ve,{children:r.jsx(gn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(St,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((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(Ve,{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((pe,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:pe.timestamp}),r.jsx(gn,{content:pe.body})]},`${pe.timestamp}-${Oe}`))})}):r.jsx(St,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((jt=D.comments)==null?void 0:jt.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(l2,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(St,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((st=D.decisionRecord)==null?void 0:st.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(Ve,{children:r.jsx(gn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(St,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(Ve,{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:`${r1(D.updated)} · Created ${n1(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((pe,Oe)=>r.jsx(WU,{entry:pe},`${pe.system}:${pe.id}:${Oe}`))]})}),$t.length>0&&r.jsx(Ve,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:$t.map((pe,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:pe.command,children:pe.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:pe.sessionName,children:pe.sessionName}),pe.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(GE,{sessions:q==null?void 0:q.sessions,loading:I,error:K,onError:pe=>m(pe.message,"error"),onNotice:pe=>m(pe,"success")}),r.jsx(YE,{summary:$==null?void 0:$.summary,loading:V,error:ee})]})]}),r.jsx(QE,{open:b!==null,action:b,assignmentTitle:D.title,loading:g===(b==null?void 0:b.command),onOpenChange:pe=>{pe||N(null)},onConfirm:async pe=>{if(!b)return;await Q(b,pe)&&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:pe=>{pe||T(!1)},onConfirm:ie})]})}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 WU({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 HU(){var R,A,L,M,F,D,W,Y;const{id:e}=Mt(),[t,n]=ls(),s=t.get("tab")??"summary",{data:o,loading:i,error:c,refetch:u}=I3(e),{data:d,loading:m,error:h}=_3(e),{data:g,loading:y,error:b}=F3(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(gt,{}):c?r.jsx(Nt,{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(wy,{externalIds:o.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(a2,{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(i2,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[r.jsx(Rf,{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(Wd,{className:"h-3 w-3"}):r.jsx(Tf,{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(Ve,{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(gp,{value:s,onValueChange:_=>n({tab:_}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(Ve,{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(Ve,{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(St,{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(l2,{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(Ve,{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(St,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:o.scratchpad?r.jsxs(Ve,{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(St,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((W=o.handoff)==null?void 0:W.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.handoff?r.jsxs(Ve,{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(St,{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(Ve,{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(St,{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(Ve,{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:`${r1(o.updated)} · Created ${n1(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(KU,{entry:_},`${_.system}:${_.id}:${z}`))]})}),r.jsx(GE,{sessions:d==null?void 0:d.sessions,loading:m,error:h,onError:_=>S(_.message,"error"),onNotice:_=>S(_,"success")}),r.jsx(YE,{summary:g==null?void 0:g.summary,loading:y,error:b})]})]}),r.jsx(vy,{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(Nt,{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 KU({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 qU({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=pf(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(uC(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=pf(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 u2({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[o,i]=f.useState(!1);return o?r.jsx(GU,{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 GU({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 d2(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 q0=/[A-Za-z0-9_-]/;function G0(e,t){const n=Math.max(0,Math.min(t,e.length)),s=YU(e,n);if(s)return s;let o=n;for(;o>0&&q0.test(e[o-1]);)o--;let i=n;for(;i<e.length&&q0.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 YU(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 QU(e,t){const n=cC(t),s=e.toLowerCase();if(s==="")return n;const o=[],i=[];for(const c of n){const u=c.toLowerCase();u.startsWith(s)?o.push(c):u.includes(s)&&i.push(c)}return[...o,...i]}function JU(e,t,n,s){const o=e.toLowerCase();let i=[];switch(o){case"status":i=[...n.statuses];break;case"priority":i=[...n.priorities];break;case"type":i=[...n.types];break;case"assignee":i=["none",...n.assignees];break;case"project":i=["none",...n.projects];break;case"tag":case"tags":i=[...n.tags];break;case"archived":case"pinned":case"blocked":case"parked":i=["true","false"];break;default:{const u=s[o];(u==null?void 0:u.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const c=t.toLowerCase();return c===""?i:i.filter(u=>u.toLowerCase().startsWith(c))}function XU(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=mN(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const ZU=180;function e7(e,t){const[n,s]=f.useState(e);return f.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function t7({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=e7(e,ZU),[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=G0(_,z);if(!H){N([]),T(!1);return}if(H.kind==="field"){const q=QU(H.partial,o);N(q),v("field"),T(q.length>0)}else{const q=JU(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=G0(e,H);if(!q)return;const{text:I,caret:K}=XU(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 W=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:W,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 Y0=ey;function kd(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function n7(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}=$f(),d=xa(),m=up(),[h,g]=ls(),y=e?`w:${e}`:null,b=OE(y),N=f.useRef(void 0),w=f.useMemo(()=>wC(d.order),[d]),v=f.useMemo(()=>{const U={};for(const X of w)U[X]=Wc(d,X);return U},[w,d]),k=f.useMemo(()=>w.map(U=>({id:U,title:v[U]??U,description:cp(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&&Y0.includes(P)?P:"kanban";function M(U){if(!U)return[];const X=[];for(const he of U.split(",")){const Le=he.trim();!Le||Le==="all"||!T.has(Le)||X.includes(Le)||X.push(Le)}return X}const F=f.useCallback(U=>{g(X=>{const he=new URLSearchParams(X);return U==="kanban"?he.delete("view"):he.set("view",U),he})},[g]),[D,W]=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)),[V,ee]=f.useState(()=>Fe(b.filters.project)),[B,ue]=f.useState(()=>Fe(b.filters.tags)),[ye,se]=f.useState(null),[ge,ke]=f.useState(()=>kd(A)),[Re,Ae]=f.useState(()=>ac({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)})),[Je,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",[Qe,$t]=f.useState(()=>new Set),[vt,ct]=f.useState([]),{toast:ie,showToast:Q,dismissToast:me}=Ao(),[re,xe]=f.useState(null),[Pe,ve]=f.useState(null),[te,de]=f.useState(null),[Se,Ue]=f.useState(null),[le,pt]=f.useState(null),[xt,jt]=f.useState(null),[st,pe]=f.useState(null),[Oe,qe]=f.useState(null),[Lt,Xt]=f.useState(null),[dn,Gt]=f.useState(!1),[Gn,Ct]=f.useState(!1),Fn=e?{kind:"workspace",workspace:e}:{kind:"global"},Et=h.get("loadView"),{view:oe,loading:ze,error:tt}=So(Et),{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),W("")},[e]);const Qc=f.useRef({status:R,stale:A});f.useEffect(()=>{const U=M(R),X=kd(A);nO(U,Y)||_(U),X!==ge&&ke(X);const he=Qc.current,Le=he.status!==R||he.stale!==A;Qc.current={status:R,stale:A},Le&&rn({status:U,activity:X})},[ge,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(",")),ge==="all"?X.delete("stale"):ge==="stale"?X.set("stale","1"):X.set("stale","0"),n7(U,X)?U:X})},[ge,y,g,Y]),f.useEffect(()=>{H(Fe(b.filters.priority)),I(Fe(b.filters.type)),$(Fe(b.filters.assignee)),ee(Fe(b.filters.project)),ue(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 Hy().then(X=>{if(U||N.current===y)return;const he=pN(X,y),Le=he.defaultView,ut=Fe(he.filters.status),bt=he.filters.activity??"all",It=new URLSearchParams(window.location.search);let hr=!1;const ln=new URLSearchParams(It);It.get("view")===null&&Le!=="kanban"&&Y0.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(ac({status:fn,priority:Fe(he.filters.priority),type:Fe(he.filters.type),assignee:Fe(he.filters.assignee),project:Fe(he.filters.project),tags:Fe(he.filters.tags),activity:pn==="fresh"||pn==="stale"?pn:"all"})),queueMicrotask(()=>{N.current=y})}),()=>{U=!0}},[y]);const mt=f.useCallback(U=>{(y===null?ME(U):FE(y,U)).catch(he=>{console.warn("Failed to persist view prefs:",he)})},[y]),Jc=f.useCallback(U=>{F(U),mt({defaultView:U})},[F,mt]),rl=f.useRef(null);rl.current={status:Y,priority:z,type:q,assignee:K,project:V,tags:B,activity:ge,dateRange:ye,search:D};const Xc=f.useCallback((U={})=>{const X=rl.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(ac(Xc(U)))},[Xc]),Zc=f.useCallback(U=>{_(U),mt({filters:{status:U}}),rn({status:U})},[mt,rn]),eu=f.useCallback(U=>{H(U),mt({filters:{priority:U}}),rn({priority:U})},[mt,rn]),tu=f.useCallback(U=>{I(U),mt({filters:{type:U}}),rn({type:U})},[mt,rn]),Ep=f.useCallback(U=>{$(U),mt({filters:{assignee:U}}),rn({assignee:U})},[mt,rn]),Tp=f.useCallback(U=>{ee(U),mt({filters:{project:U}}),rn({project:U})},[mt,rn]),Zt=f.useCallback(U=>{ue(U),mt({filters:{tags:U}}),rn({tags:U})},[mt,rn]),Rp=f.useCallback(U=>{ke(U),mt({filters:{activity:U}}),rn({activity:U})},[mt,rn]),sl=f.useCallback(U=>{W(U),rn({search:U})},[rn]),nu=f.useCallback(U=>{se(U),rn({dateRange:ua(U)})},[rn]),qs=f.useCallback(U=>{at(U),mt({sortField:U})},[mt]),ja=f.useCallback(U=>{ot(U),mt({sortDirection:U})},[mt]),ru=f.useCallback(U=>{Me(U),mt({grouping:U})},[mt]),ka=f.useCallback(U=>{Ae(U);const X=ic(U);X&&(_(Fe(X.status)),H(Fe(X.priority)),I(Fe(X.type)),$(Fe(X.assignee)),ee(Fe(X.project)),ue(Fe(X.tags)),W(X.search??""),ke(X.activity&&X.activity!=="all"?X.activity:"all"),se(fp(X.dateRange)))},[]),an=f.useMemo(()=>ic(Re)!==null,[Re]),Sa=f.useCallback(()=>{const X=ic(Re)!==null?{status:Y,priority:z,type:q,assignee:K,project:V,tags:B,activity:ge,dateRange:ua(ye),search:D}:{};return{viewMode:L,filters:{...X,query:Re},sortField:Je,sortDirection:Ze,listSectionVisibility:{collapsed:[...Qe]},kanbanColumnVisibility:Z,tableColumnVisibility:Ee}},[L,Re,Y,z,q,K,V,B,ge,ye,D,Je,Ze,Qe,Z,Ee]),zn=f.useCallback(U=>{hC(U,{setViewMode:F,setQuery:Ae,setStatusFilter:X=>{_(X),mt({filters:{status:X}})},setPriorityFilter:X=>{H(X),mt({filters:{priority:X}})},setTypeFilter:X=>{I(X),mt({filters:{type:X}})},setAssigneeFilter:X=>{$(X),mt({filters:{assignee:X}})},setProjectFilter:X=>{ee(X),mt({filters:{project:X}})},setTagsFilter:X=>{ue(X),mt({filters:{tags:X}})},setActivityFilter:X=>{ke(X),mt({filters:{activity:X}})},setDateRange:se,setSearch:W,setSortField:qs,setSortDirection:ja,setListSectionVisibility:X=>$t(new Set(X.collapsed)),setKanbanColumnVisibility:_e,setTableColumnVisibility:Ie}),Xt(U.id)},[F,mt,qs,ja]),Ap=f.useCallback(U=>{zn(U),Ts.current=U.id,g(X=>{const he=new URLSearchParams(X);return he.set("loadView",U.id),he},{replace:!0})},[zn,g]),Pp=f.useCallback(async U=>{try{const X=_i({name:U,context:{workspace:e??null,projectSlug:null},state:Sa()}),he=await $i(X),Le=he.views[he.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),Ct(!1),Q(`Saved view "${U}"`,"success")}catch(X){throw Q(X instanceof Error?X.message:"Failed to save view","error"),X}},[Sa,g,Q,e]),Dp=f.useCallback(async()=>{if(!(!Lt||!yt))try{const U=_i({name:yt.name,context:{workspace:e??null,projectSlug:null},state:Sa()}),X=mf(yt.config,U.config,U.config);await af(Lt,{config:X}),Q("View updated","success")}catch(U){Q(U instanceof Error?U.message:"Failed to update view","error")}},[Sa,yt,Lt,Q,e]);f.useEffect(()=>{if(!Et){Ts.current=null;return}if(Ts.current!==Et&&(Lt&&Lt!==Et&&Xt(null),!ze)){if(tt){Q("Couldn't load saved view — try again","error");return}if(oe){Ts.current=Et,zn(oe),g(U=>{const X=new URLSearchParams(U);return X.delete("loadView"),X},{replace:!0});return}Ts.current=Et,Q("Saved view no longer exists","error"),g(U=>{const X=new URLSearchParams(U);return X.delete("loadView"),X},{replace:!0})}},[Et,oe,ze,tt,Lt,zn,g,Q]);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(()=>lC(d.factDeclarations),[d.factDeclarations]),ol=f.useMemo(()=>Re.trim()===""?null:Di(Re,$o).query,[Re,$o]),Yt=f.useMemo(()=>aC(vt,ol,{workspace:e}),[vt,ol,e]),Gr=f.useMemo(()=>Hc(Yt,Je,Ze),[Yt,Je,Ze]),al=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)),he=Yt.filter(Le=>!Le.type||!X.has(Le.type));return he.length>0&&U.push({id:S,label:"Other",items:he}),U}if(Ye==="priority")return["critical","high","medium","low"].map(X=>({id:X,label:X.charAt(0).toUpperCase()+X.slice(1),items:Yt.filter(he=>he.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(he=>(he.assignee??"__unassigned__")===X)}));if(Ye==="project"){const U=new Map;for(const X of Yt){const he=X.projectSlug??"__standalone__",Le=X.projectTitle??"Standalone";U.has(he)||U.set(he,Le)}return Array.from(U.entries()).sort(([,X],[,he])=>X.localeCompare(he)).map(([X,he])=>({id:X,label:he,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]),il=f.useMemo(()=>{const U=new Set(m.definitions.map(he=>he.id));return Yt.some(he=>!he.type||!U.has(he.type))?[...E,{id:S,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Yt]),{visibleItems:At,visibleIndexByKey:ll}=f.useMemo(()=>{let U;if(L==="table")U=Gr;else if(L==="kanban"){const he=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||!he.has(Le.type))]:U=w.flatMap(Le=>Yt.filter(ut=>ut.status===Le))}else U=al.flatMap(he=>he.items);const X=new Map;return U.forEach((he,Le)=>X.set(on(he),Le)),{visibleItems:U,visibleIndexByKey:X}},[L,Gr,al,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(gt,{label:"Loading assignments board…"});if(c||!o)return r.jsx(Nt,{error:c||"Assignments board is unavailable."});async function Ea({item:U,toColumnId:X,action:he,reason:Le}){xe(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(!he)throw new Error("Standalone assignments require a transition action, not status override.");const It=await fetch(`/api/assignments/${encodeURIComponent(U.id)}/transitions/${encodeURIComponent(he.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=he?await VE(U.projectSlug,U.slug,he,Le):await WE(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),Q(bt.message,"error"),!1}finally{xe(null)}}async function Ys({item:U,toColumnId:X,action:he}){if(U.status===X)return;const Le=he??Kl(U,X);if(Le!=null&&Le.disabled){Q(Le.disabledReason||`Cannot move this assignment to ${X}.`,"error");return}if(Le&&HE(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 he=on(U),Le=vt;ct(ut=>ut.map(bt=>on(bt)===he?{...bt,title:X}:bt)),xe(he);try{const ut=U.projectSlug===null?await bU({id:U.id,title:X}):await yU({projectSlug:U.projectSlug,assignmentSlug:U.slug,title:X});ct(bt=>bt.map(It=>on(It)===he?{...It,title:ut.title,updated:ut.updated}:It)),u()}catch(ut){throw ct(Le),Q(ut.message,"error"),ut}finally{xe(null)}}function au(U){$t(X=>{const he=new Set(X);return he.has(U)?he.delete(U):he.add(U),he})}function cl(U){Je===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),de(null)}function ds(U,X){if(!Ln)return;const he=Kl(Ln,X);Ln.status===X||he!=null&&he.disabled||(U.preventDefault(),U.dataTransfer.dropEffect="move",de(X))}function Lo(U,X){te===X&&!U.currentTarget.contains(U.relatedTarget)&&de(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 he=Je===U;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>cl(U),className:"inline-flex items-center gap-1 hover:text-foreground",children:[X,he?Ze==="asc"?r.jsx(Vk,{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(Rt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(yy,{children:[r.jsx(t7,{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(pp,{ref:s,value:D,onChange:an?sl:()=>{},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:Ep}),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:V,onChange:Tp}),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(dp,{className:"max-w-[200px]",value:ye,onChange:an?nu:()=>{}}),r.jsxs("select",{value:ge,disabled:!an,onChange:U=>Rp(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:eO.map(U=>{const X=L==="kanban"&&U!=="status"&&U!=="type",he=U==="none"?"No grouping":`Group: ${U.charAt(0).toUpperCase()+U.slice(1)}`;return r.jsx("option",{value:U,disabled:X,children:X?`${he} (list only)`:he},U)})}),r.jsx(mp,{value:L,onChange:U=>Jc(U),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),L==="table"?r.jsx($E,{visibility:Ee,onChange:Ie}):null,r.jsx(BE,{scope:Fn,loadedViewId:Lt,onApply:Ap,onOpenSaveDialog:()=>{Ct(!1),Gt(!0)}}),r.jsx("button",{type:"button",onClick:()=>{yt?Dp():(Ct(!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:()=>{Ct(!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(St,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Ce,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(gx,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Yt.length===0?r.jsx(St,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):L==="table"?(()=>{const U=new Set(Ee.hidden),X=he=>he==="title"||!U.has(he);return r.jsx(Ve,{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((he,Le)=>r.jsxs(s7,{detailHref:Nc(he),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(u2,{title:he.title,detailHref:Nc(he),onSave:ut=>Ta(he,ut),disabled:re===on(he)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:he.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:he.id,children:[he.id.slice(0,8),r.jsx(Br,{value:he.id})]})]}):null,X("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:he.status,disabled:re===on(he),onChange:ut=>Ys({item:he,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")]`,(ff[he.status]??ff.pending).className,re===on(he)&&"animate-pulse opacity-60"),children:w.map(ut=>{const bt=he.status===ut?void 0:Kl(he,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:he.type,compact:!0})}),X("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:he.priority}):null,X("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.assignee??"Unassigned"}):null,X("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:he.dependsOn.length}):null,X("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Mn(he.created)}):null,X("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Mn(he.updated)}):null]},on(he)))})]})})})})():L==="list"?r.jsx("div",{className:"space-y-3",children:al.map(({id:U,label:X,items:he})=>{var ln;if(he.length===0&&!(Ln&&Ye==="status"))return null;const Le=!Qe.has(U),ut=Ye==="status",bt=ut&&Ln?Ln.status!==U&&!((ln=Kl(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:he.length})]}),Le&&he.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:he.map(fn=>{const pn=on(fn),Oo=Pe===pn,iu=ll.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(J0,{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(lp,{columns:et==="type"?il: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:he})=>{if(X===he)return{allowed:!0};const Le=Kl(U,he);return Le!=null&&Le.disabled?{allowed:!1,reason:Le.disabledReason||Le.description}:{allowed:!0,reason:Le?Le.warning||Le.description:`Move to ${he} (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 he=ll.get(on(U))??-1;return r.jsx("div",{...he>=0?Ca(he):{},children:r.jsx(J0,{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:ie,onDismiss:me}),r.jsx(zE,{open:dn,onOpenChange:U=>{Gt(U),U||Ct(!1)},initialName:Gn&&yt?`${yt.name} (copy)`:"",title:Gn?"Save as new view":"Save view",onSubmit:Pp}),r.jsx(QE,{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(jC,{anchor:(le==null?void 0:le.anchor)??null,items:le?r7(le.item,{onEdit:()=>{const U=le.item,X=U.projectSlug===null?`/assignments/${U.id}`:`${U.projectWorkspace?`/w/${U.projectWorkspace}`:t}/projects/${U.projectSlug}/assignments/${U.slug}`;n(X)},onDelete:()=>jt(le.item),onMove:()=>qe(le.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&&jt(null)},onConfirm:async()=>{if(!xt||xt.projectSlug===null){jt(null);return}const U=on(xt);pe(U);try{const X=await fetch(`/api/projects/${encodeURIComponent(xt.projectSlug)}/assignments/${encodeURIComponent(xt.slug)}`,{method:"DELETE"});if(!X.ok){const he=await X.json().catch(()=>({}));throw new Error(he.error||"Failed to delete assignment")}jt(null),u()}catch(X){alert(X instanceof Error?X.message:"Failed to delete assignment")}finally{pe(null)}}}),r.jsx(vy,{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 he=await X.json().catch(()=>({}));throw new Error(he.error||"Failed to move assignment")}u()}})]})}function r7(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:Rf,onSelect:t.onMove}),n}function s7({detailHref:e,children:t,className:n,...s}){const o=d2(e);return r.jsx("tr",{...s,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function J0({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:o}){var d;const i=Nc(e),c=!!(s&&o),u=d2(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(u2,{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(qU,{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 Kl(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(`
|
|
586
|
+
`),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 el(e){return`---
|
|
587
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
588
|
+
`)}
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
${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 o7(e,t){return Nn(e,t)==="true"}function fc(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 a7(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}: ${a7(n)}`])}function pc(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 mc(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function jp(e){const t=Kr(e);return{title:Nn(t,"title"),slug:Nn(t,"slug"),workspace:Nn(t,"workspace"),archived:o7(t,"archived"),archivedAt:Nn(t,"archivedAt"),archivedReason:Nn(t,"archivedReason"),tags:fc(t,"tags").join(", "),body:t.body}}function i7(e,t){const n=Kr(e),s={...jp(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),pc(n,"tags",mc(s.tags)),n.body=s.body,el(n)}function kp(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:fc(t,"dependsOn").join(", "),links:fc(t,"links").join(", "),blockedReason:Nn(t,"blockedReason"),tags:fc(t,"tags").join(", "),body:t.body}}function l7(e,t){const n=Kr(e),s={...kp(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),pc(n,"dependsOn",mc(s.dependsOn)),pc(n,"links",mc(s.links)),Cn(n,"blockedReason",s.blockedReason||null),pc(n,"tags",mc(s.tags)),n.body=s.body,el(n)}function Sp(e){const t=Kr(e);return{assignment:Nn(t,"assignment"),status:Nn(t,"status"),body:t.body}}function c7(e,t){const n=Kr(e),s={...Sp(e),...t};return Cn(n,"assignment",s.assignment),Cn(n,"status",s.status),n.body=s.body,el(n)}function Np(e){const t=Kr(e);return{assignment:Nn(t,"assignment"),body:t.body}}function u7(e,t){const n=Kr(e),s={...Np(e),...t};return Cn(n,"assignment",s.assignment),n.body=s.body,el(n)}function Cp(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:fc(t,"tags").join(", "),body:t.body}}function d7(e,t){const n=Kr(e),s={...Cp(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),pc(n,"tags",mc(s.tags)),n.body=s.body,el(n)}function Qy(e){return{body:Kr(e).body}}function f2(e){return Qy(e)}function p2(e,t){const n=Kr(e);return t.body!==void 0&&(n.body=t.body),el(n)}function f7(e,t){return p2(e,t)}function Ht(e,t,n){switch(e){case"project":return i7(t,n);case"assignment":return l7(t,n);case"plan":return c7(t,n);case"scratchpad":return u7(t,n);case"playbook":return d7(t,n);case"memory":return p2(t,n);case"resource":return f7(t,n);default:return t}}function tl({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=g7(t,y),S=y!==e,T=h7(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(Hd,{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(uP,{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(Pf,{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(Tw,{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(p7,{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(Tw,{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 p7({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const i=jp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(ql,{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(m7,{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=kp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(ql,{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=Sp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(ql,{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=Np(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(ql,{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):f2(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=Cp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(ql,{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 ql({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 m7({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 h7(e,t){switch(e){case"project":return jp(t).body;case"assignment":return kp(t).body;case"plan":return Sp(t).body;case"scratchpad":return Np(t).body;case"playbook":return Cp(t).body;case"memory":return Qy(t).body;case"resource":return f2(t).body}}function g7(e,t){switch(e){case"project":{const n=jp(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=kp(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 Sp(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Np(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Cp(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 X0(){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
|
|
592
|
+
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(gt,{label:"Loading project template…"}):m&&!s?r.jsx(Nt,{error:m}):r.jsx(tl,{initialContent:s||"",documentType:"project",mode:"create",onSave:g,saving:u,error:m,title:"Create Project",description:"Projects hold the high-level objective, shared context, and human-authored overview. Put execution details in assignments instead of overloading project.md.",onCancel:()=>e(`${n}/projects`),helpTitle:"Project editing rules",helpBody:"Use this form for project intent, slug, tags, and overview content. If you ever need less common metadata, raw markdown mode still exposes the full file.",allowSlugEdit:!0})}function Z0(){const{slug:e}=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(gt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Nt,{error:m}):r.jsx(tl,{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 ek(){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(gt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Nt,{error:m}):r.jsx(tl,{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 nl({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}=w1(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(gt,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(Nt,{error:g||`${s} is unavailable.`}):r.jsx(tl,{initialContent:m.content,documentType:i,onSave:v,saving:y,error:N,title:s,description:o,onCancel:()=>d(n),helpTitle:c,helpBody:u})}function tk(){const{slug:e}=Mt(),t=un(),n=e??"";return r.jsx(nl,{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 ag(){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(nl,{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 ig(){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(nl,{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 lg(){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(nl,{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 m2({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,helpTitle:i,helpBody:c}){const u=_t(),{data:d,loading:m,error:h}=w1(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(gt,{label:`Loading ${s.toLowerCase()}…`}):h||!d?r.jsx(Nt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ve,{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(Ve,{title:"Current Document",children:r.jsx(gn,{content:d.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function cg(){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(m2,{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 ug(){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(m2,{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 nk(){const{workspace:e}=Mt(),{data:t}=Cs(),{data:n,loading:s,error:o,refetch:i}=Ex(),[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(gt,{label:"Loading servers…"}):o?r.jsx(Nt,{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(Rt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:w,disabled:h,children:[r.jsx(Gk,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(St,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(E=>r.jsx(x7,{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 x7({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(vx,{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(Gk,{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(y7,{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(RP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function y7({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(xx,{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(yP,{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 h2(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 b7(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":h2(s)}function v7(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 w7(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function rk(){const{data:e,loading:t,error:n,refetch:s}=j1(),[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(gt,{label:"Loading inventories…"});if(n)return r.jsx(Nt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(St,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const 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(j7,{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 j7({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(Af,{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=",h2(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(k7,{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(S7,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function k7({member:e}){const t=w7(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 ${v7(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 S7({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(sP,{className:"h-3 w-3"}),b7(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(DP,{className:"h-3 w-3"}),"Force release"]})]})]})}const N7={"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 sk(){const[e,t]=ls(),n=A3(e),s=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Cs(),{data:c}=ma(),{data:u}=k1(),[d,m]=f.useState(null),[h,g]=f.useState(!0),[y,b]=f.useState(null);f.useEffect(()=>{if(!e.get("window")){const v=wg({window:"30d",...n});o==="assignment"&&v.set("groupBy","assignment"),t(v,{replace:!0})}},[]);const N=y1({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=wg(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(Dc,{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:Df.map(v=>r.jsx("option",{value:v,children:N7[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 ok(){const{workspace:e}=Mt(),{data:t}=Cs(),{data:n,loading:s,error:o}=Lf(),[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(V=>V.slug===H.projectSlug))==null?void 0:K.workspace)??null;if(e==="_ungrouped"){if($!==null)return!1}else if($!==e)return!1}const q=E7(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)=>T7(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 W(_){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(gt,{label:"Loading agent sessions..."});if(o)return r.jsx(Nt,{error:o});if(!n)return null;const Y=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(yy,{children:[r.jsx(pp,{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(St,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):r.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[1280px] table-fixed text-sm",children:[r.jsxs("colgroup",{children:[r.jsx("col",{style:{width:"32px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"160px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"110px"}}),r.jsx("col",{style:{width:"130px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"40px"}})]}),r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[r.jsx("th",{className:"pb-2 pr-3",children:r.jsx("button",{onClick: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(wx,{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(C7,{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:W,onCopyError:T},_.sessionId))})]})}):r.jsx(St,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(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 C7({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(wx,{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(Ef,{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(UE,{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(qE,{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 E7(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 T7(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 R7(){const{data:e,loading:t,error:n,refetch:s}=Tx(),[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(gt,{label:"Loading playbooks..."}):n?r.jsx(Nt,{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(Rt,{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(Hk,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:"auto-generated"})]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[11px]",children:"~/.syntaur/playbooks/manifest.md"})," in your CLAUDE.md for agent context."]})]})]}),y.length===0?r.jsx(St,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(Ce,{to:"/playbooks/create",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Rt,{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(my,{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(Bk,{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(Yk,{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 A7(){const{slug:e}=Mt(),t=_t(),{data:n,loading:s,error:o,refetch:i}=B3(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 W=await D.json().catch(()=>({}));throw new Error(W.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",W=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!W.ok){const Y=await W.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(gt,{label:"Loading playbook..."}):o?r.jsx(Nt,{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(Yk,{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(LP,{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(Wr,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value: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 P7(){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(gt,{label:"Loading playbook template..."}):u&&!t?r.jsx(Nt,{error:u}):r.jsx(tl,{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 D7(){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(gt,{label:"Loading playbook..."}):d&&!n?r.jsx(Nt,{error:d}):r.jsx(tl,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function $7(){const{data:e,loading:t,error:n}=U3(),[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(gt,{label:"Loading memories…"}):n?r.jsx(Nt,{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(Rt,{className:"h-4 w-4"}),"New Memory"]})]}),w.length===0?r.jsx(St,{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(Rt,{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 L7(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=V3(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(gt,{label:"Loading memory…"}):i?r.jsx(Nt,{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 I7(){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(gt,{label:"Loading projects…"}):i?r.jsx(Nt,{error:i}):!s||s.length===0?r.jsx(Nt,{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 O7(){const{slug:e,itemSlug:t}=Mt();return r.jsx(nl,{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 _7(){const{data:e,loading:t,error:n}=W3(),[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(gt,{label:"Loading resources…"}):n?r.jsx(Nt,{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(Rt,{className:"h-4 w-4"}),"New Resource"]})]}),w.length===0?r.jsx(St,{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(Rt,{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 M7(){const{slug:e,itemSlug:t}=Mt(),n=_t(),{data:s,loading:o,error:i}=H3(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(gt,{label:"Loading resource…"}):i?r.jsx(Nt,{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 F7(){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(gt,{label:"Loading projects…"}):i?r.jsx(Nt,{error:i}):!s||s.length===0?r.jsx(Nt,{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(nl,{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 sx=["projects","playbooks","todos","servers","config"];function B7(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))sx.includes(n)&&t.add(n);return t}function ak(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function U7(){const[e,t]=f.useState(!0),[n,s]=f.useState(null),[o,i]=f.useState(""),[c,u]=f.useState(new Set(sx)),[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(B7(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(Ve,{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(Ve,{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:sx.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: "}),ak((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),ak((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(Pf,{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(IP,{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(lP,{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(oP,{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 V7(){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=S1(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 ${zl[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 ${zl[S]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await TL(),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(Ve,{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:If.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(xg,{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)??zl[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 ${zl[S]} binding`,children:[r.jsx(kx,{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 "',zl[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 W7={kanban:"Kanban",list:"List",table:"Table"},H7={comfortable:"Comfortable",compact:"Compact"},K7={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},q7={asc:"Ascending",desc:"Descending"};function G7(){const e=dU(),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 ME({[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 fU(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(Ve,{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:ey.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:W7[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:ZI.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:H7[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:fN.map(m=>r.jsx("option",{value:m,children:K7[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:XI.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:q7[m]},m))})]})]})]})}function Y7({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=n2(e,m),k=v?r2(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=s2(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 Q7={first:"first",last:"last",none:"none"};function g2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Gl(e){return e.map(t=>({rowKey:g2(),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 J7(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 X7(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 Z7(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 e9(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function t9(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 n9({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}=Xf({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&&AU.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(()=>o2(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:JE.map(T=>r.jsx("option",{value:T,children:Q7[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(Y7,{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 r9(){const e=e2(),t=Tx(),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(()=>Gl(e.agents)),[i,c]=f.useState(()=>Gl(e.agents)),[u,d]=f.useState(!1),[m,h]=f.useState(null),[g,y]=f.useState(null);f.useEffect(()=>{const L=Gl(e.agents);o(L),c(L),h(null)},[e.agents]);const b=f.useMemo(()=>!t9(s,i),[s,i]),N=Hf(ko(Gi,{activationConstraint:{distance:8}}),ko(qi));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:s9(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,W=1;for(;M.has(D);)W+=1,D=`${F}-${W}`;const Y=W===1?"New Agent":`New Agent ${W}`,_={rowKey:g2(),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=X7(s),M=J7(L),F=await $U(M),D=Gl(F.agents);o(D),c(D),w("success","Agents saved")}catch(L){if(L instanceof XE)h(L.message),o(M=>Z7(e9(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 LU(),M=Gl(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 W=D.findIndex(_=>_.rowKey===M.id),Y=D.findIndex(_=>_.rowKey===F.id);return W===-1||Y===-1?D:Yi(D,W,Y)})}return r.jsxs(Ve,{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(yx,{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(Qf,{sensors:N,collisionDetection:Kf,onDragEnd:A,children:r.jsx(Jf,{items:s.map(L=>L.rowKey),strategy:Zx,children:r.jsx("div",{className:"space-y-2",children:s.map((L,M)=>r.jsx(n9,{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(Rt,{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(Pf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function s9(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 x2=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],wf={terminal:"terminal-app",custom:!1};let gi=null,di=null,jf=0;const ox=new Set;function y2(e){gi=e;for(const t of ox)t(e)}function Jy(e){if(!e||typeof e!="object")return wf;const t=e;return{terminal:typeof t.terminal=="string"&&x2.includes(t.terminal)?t.terminal:wf.terminal,custom:t.custom===!0}}function o9(){if(gi)return Promise.resolve(gi);if(di)return di;const e=++jf;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=Jy(t);return e!==jf?gi??n:(gi=n,n)}).catch(()=>(di=null,wf)),di}function a9(){const[e,t]=f.useState(()=>gi??wf);return f.useEffect(()=>{let n=!1;return o9().then(s=>{n||t(s)}),ox.add(t),()=>{n=!0,ox.delete(t)}},[]),e}async function i9(e){++jf;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=Jy(await t.json());return y2(n),n}async function l9(){++jf;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=Jy(await e.json());return y2(t),t}const Nd={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function c9(){const{terminal:e,custom:t}=a9(),[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 i9(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 l9();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(Ve,{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:x2.map(m=>r.jsx("option",{value:m,children:Nd[m]},m))})]})]})}function Yl(e){return e===Xd?"Ungrouped":e}function u9(){const{data:e,loading:t,error:n,refetch:s}=ma(),{hidden:o,custom:i,loading:c,error:u,reload:d}=bS(),[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?[Xd]:[]]:[];async function w(k,E){const S=E?o.filter(T=>T!==k):[...o,k];h(!0);try{await ML(S),b({type:"success",message:E?`Showing "${Yl(k)}" in the left nav.`:`Hiding "${Yl(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 FL(),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(Ve,{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=!IL(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:Yl(k),children:[Yl(k),k===Xd&&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 "${Yl(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 d9(){const{preset:e,setPreset:t,resetPreset:n}=Cx(),[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(Ve,{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:l1.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(V7,{}),r.jsx(c9,{}),r.jsx(u9,{}),r.jsx(r9,{}),r.jsx(G7,{}),r.jsx(U7,{})]})}function f9({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(Wr,{children:w?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),w&&r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[S.map(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 p9({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(Wr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:o.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:o.when})]},i))})}),r.jsxs(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 m9({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 h9({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:o,listeners:i,setNodeRef:c,setActivatorNodeRef:u,transform:d,transition:m,isDragging:h}=Xf({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(m9,{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 g9({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:s,onRemove:o,onReorder:i}){const c=Hf(ko(Gi,{activationConstraint:{distance:8}}),ko(qi,{coordinateGetter:uN}));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(Yi(e,g,y))}return r.jsx(Ve,{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(Rt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(Qf,{sensors:c,collisionDetection:Kf,onDragEnd:u,children:r.jsx(Jf,{items:e.map(d=>d.rowKey),strategy:Zx,children:r.jsx("div",{className:"space-y-2",children:e.map((d,m)=>r.jsx(h9,{row:d,isSaved:t.has(d.id),onUpdate:(h,g)=>n(m,h,g),onRemove:()=>o(m)},d.rowKey))})})})})}function x9(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 y9(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 b9(e,t){return t.headline.parked===e||t.headline.blocked===e}function v9(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 w9(e,t,n){return e.map(s=>({...s,from:s.from===t?n:s.from,to:s.to===t?n:s.to}))}function j9(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 k9(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function S9(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 ik(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 b2(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function N9(e){const t=e.statuses.map(n=>({rowKey:b2(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return S9(t,e.order)}function C9(e){return Fg(e)}function lk(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function E9(e){const t=new Map;for(let n=0;n<e.length;n++){const s=lk(Fg(e.slice(0,n))),o=lk(Fg(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 T9=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],R9=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function A9(){return{name:"",type:"bool",binds:null}}function P9({rows:e,onChange:t,saving:n}){const s=E9(e),o=f.useCallback(()=>{t([...e,A9()])},[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(Ve,{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:T9.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:R9.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(qd,{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(Rt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function v2(e,t=ap){var s,o;if(e==="*")return null;const n=_f(e);if(!n.ast)return((s=n.errors[0])==null?void 0:s.message)??"unparseable condition";try{return tc(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 dg(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 D9(e){if(e.kind==="atom"){const t=dg(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=dg(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=dg(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 ck(e){const t=e.trim();if(t===""||t==="*")return null;const n=_f(t);return n.ast?D9(n.ast):null}const $9=/^[A-Za-z_][A-Za-z0-9_-]*$/;function L9(e){return e===""||!$9.test(e)||/^(and|or|not)$/i.test(e)}function I9(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function O9(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:L9(e.value)?I9(e.value):e.value}function _9(e){const t=O9(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function M9(e){return e.groups.map(n=>{const s=n.comparisons.map(_9).join(` ${n.join} `);return n.comparisons.length>1?`(${s})`:s}).join(` ${e.outerJoin} `)}function F9(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":v2(e,t)}function z9(e){return C5(N5(e))}function B9(e){const t=hy(e),n=[];for(const s of cC(e)){const o=t[s.toLowerCase()];o&&n.push({name:s,kind:o.kind})}return n}function w2(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function ax(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:ax(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:w2(t.kind)}:{field:"",op:":",value:""}]}]}}function j2({value:e,onChange:t,fieldOptions:n,registry:s,disabled:o}){const i=f.useMemo(()=>ck(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=ck(e);R&&h(R),!(e.trim()===""||R)&&u==="builder"&&d("raw"),g.current=e},[e]);const y=F9(e,s);function b(R){g.current=R,t(R)}function N(R){h(R),b(M9(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((W,Y)=>Y===A?{...W,...L}:W)}: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,W)=>W!==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(aP,{className:"h-3 w-3"}):r.jsx(vP,{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",W=ax(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=ax(z);v(A,M,{field:Y.target.value,op:H.includes(L.op)?L.op:H[0],value:z==="bool"?"true":L.value,valueType:w2(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:W.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(Rt,{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(Rt,{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 uk=0;function kf(){return uk+=1,`dr_${uk}_${Math.random().toString(36).slice(2,8)}`}function fg(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:kf(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:kf(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function ix(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 U9(e){return e.findIndex(t=>t.when.trim()==="*")}function k2(e,t,n){return j5(e,{statuses:t},s=>v2(s,n))}const dk=["active","blocked","parked"];function V9({value:e,deriveCustom:t,statuses:n,acceptedFacts:s,onChange:o,onReset:i,disabled:c}){const u=f.useMemo(()=>hy(s),[s]),d=f.useMemo(()=>B9(s),[s]),m=Hf(ko(Gi,{activationConstraint:{distance:8}}),ko(qi,{coordinateGetter:uN})),h=f.useMemo(()=>{try{return k2(ix(e),n,u)}catch{return["derive rules are malformed"]}},[e,n,u]),g=U9(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(W=>W.rowKey===M?{...W,...F}:W);o({...e,phaseLadder:D})}function v(){var F;const M={rowKey:kf(),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 W=b.findIndex(_=>_.rowKey===F.id),Y=b.findIndex(_=>_.rowKey===D.id);W===-1||Y===-1||N(y,Yi(b,W,Y))}function S(M,F){o({...e,disposition:e.disposition.map(D=>D.rowKey===M?{...D,...F}:D)})}function T(){const M={rowKey:kf(),when:"",is:"active"},F=e.disposition.findIndex(W=>W.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:W=>F(W.target.value),disabled:c,"aria-label":D,className:`${A} font-mono`,children:[!n.some(W=>W.id===M)&&M!==""&&r.jsx("option",{value:M,children:M}),n.map(W=>r.jsxs("option",{value:W.id,children:[W.label," (",W.id,")"]},W.id))]})}return r.jsxs(Ve,{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(Qf,{sensors:m,collisionDetection:Kf,onDragEnd:E,children:r.jsx(Jf,{items:b.map(M=>M.rowKey),strategy:Zx,children:r.jsx("div",{className:"space-y-2",children:b.map(M=>r.jsx(W9,{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(Rt,{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:dk.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(j2,{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:dk.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(Rt,{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 W9({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}=Xf({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(j2,{value:e.when,onChange:w=>i({when:w}),fieldOptions:s,registry:o,disabled:t})}),r.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:e.next,onChange:w=>i({next:w.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),r.jsx("button",{type:"button",onClick: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 H9=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 fk=0;function S2(){return fk+=1,`tr_${fk}_${Math.random().toString(36).slice(2,8)}`}function K9(e){return{rowKey:S2(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function pk(e){return e.map(K9)}function q9(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 G9(e){return e.map(q9)}function N2(){const e=[];for(const[t,n]of H9){const s=t.indexOf(":");e.push({from:t.slice(0,s),command:t.slice(s+1),to:n})}return e}function C2(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function mk(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 E2(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 Y9({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=C2(N2(),u),T=mk(S);return r.jsx(Ve,{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=E2(e,u),b=mk(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:S2(),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(Ve,{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(Rt,{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(Rt,{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 Q9(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 J9(){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(()=>fg(Md)),[W,Y]=f.useState(!1),[_,z]=f.useState(!1),[H,q]=f.useState(!1),[I,K]=f.useState([]),[$,V]=f.useState(!1),[ee,B]=f.useState([]),[ue,ye]=f.useState("statuses"),se=f.useCallback(ve=>{const te=N9(ve);u(te),i(ve.custom),w(new Set(te.map(de=>de.id))),k(new Map),P(ve.rawFacts??[]),A([]),D(fg(ve.derive??Md)),Y(ve.deriveCustom??!1),z(!1),q(!1),K(pk(ve.transitions??[])),V(ve.transitionsCustom??!1),B(ve.knownCommands??[]),b(!1)},[]),ge=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(()=>{ge()},[ge]);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]),Je=f.useMemo(()=>z9(T),[T]),at=f.useMemo(()=>hy(Je),[Je]),Ze=f.useMemo(()=>C9(T),[T]),ot=f.useMemo(()=>{try{return k2(ix(F),c,at)}catch{return["derive rules are malformed"]}},[F,c,at]),Z=f.useMemo(()=>$?E2(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(fg(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:pk(C2(N2(),Ae))),V(!0),b(!0)},[Ae]);async function Qe(ve=R){m(!0),g(null);try{const{body:te}=x9({statuses:c,order:c.map(le=>le.id),pendingResolutions:v,facts:T,factRemovalAcks:ve,derive:H?null:_?ix(F):void 0,transitions:$?G9(I):void 0}),de=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)});if(!de.ok){const le=await de.json().catch(()=>null);if(de.status===409&&(le==null?void 0:le.error)==="unresolved-fact-references"&&le.references){M({open:!0,references:le.references}),m(!1);return}if((le==null?void 0:le.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(le.problems??[]).join("; ")}`);if((le==null?void 0:le.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(le.problems??[]).join("; ")}`);if((le==null?void 0:le.error)==="invalid-facts")throw new Error(`Invalid facts: ${(le.problems??[]).join("; ")}`);if(de.status===409&&(le==null?void 0:le.error)==="unresolved-orphans"){const pt=Array.isArray(le.unresolved)?le.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(de.status===409&&(le==null?void 0:le.error)==="concurrent-edit"){const pt=le.applied?` (${le.applied.remapped} remapped, ${le.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${pt}: ${le.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await ge();return}if(de.status===500&&(le==null?void 0:le.error)==="config-write-failed"&&(le!=null&&le.applied)){const{remapped:pt,deleted:xt}=le.applied,jt=le.message?`: ${le.message}`:"";g({type:"error",message:`Resolutions applied (${pt} remapped, ${xt} deleted) but the status config write failed${jt}. Click Save again to retry.`}),await ge();return}throw(le==null?void 0:le.error)==="invalid-remap-target"?new Error(`Invalid remap target (${le.reason}): ${le.id} → ${le.target}.`):(le==null?void 0:le.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(le.ids??[]).join(", ")}`):(le==null?void 0:le.error)==="stale-resolution"?new Error(`Stale resolution for id "${le.id??"?"}".`):(le==null?void 0:le.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${le.message??"unknown"}`):(le==null?void 0:le.error)==="remap-write-failed"||(le==null?void 0:le.error)==="delete-failed"||(le==null?void 0:le.error)==="scan-failed"?new Error(`${le.error}: ${le.cause??"unknown"}`):new Error((le==null?void 0:le.error)??`Save failed (HTTP ${de.status})`)}const Se=await de.json();se(Se),$j();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),$j(),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,de){u(Se=>{const Ue=[...Se];return Ue[ve]={...Ue[ve],[te]:de},Ue}),b(!0)}function ct(){const ve=`status_${c.length+1}`;u(te=>[...te,{rowKey:b2(),id:ve,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function ie(ve){u(te=>{const de=te.filter(Ue=>Ue.id!==ve),Se=new Set(de.map(Ue=>Ue.id));return k(Ue=>ik(Ue,Se)),de}),b(!0)}async function Q(ve){const te=c[ve].id,de=y9(te,F,I),Se=b9(te,F);if(!N.has(te)){if(de.length===0){ie(te);return}S({open:!0,affected:{id:te,count:0,truncated:!1,assignments:[]},pendingId:te,ruleReferences:de,headlineReferences:Se});return}try{const Ue=await fetch(`/api/config/statuses/affected/${encodeURIComponent(te)}`);if(!Ue.ok)throw new Error(`HTTP ${Ue.status}`);const le=await Ue.json();if(le.count===0&&de.length===0){ie(te);return}S({open:!0,affected:le,pendingId:te,ruleReferences:de,headlineReferences:Se})}catch(Ue){g({type:"error",message:`Could not check affected assignments for "${te}": ${Ue instanceof Error?Ue.message:String(Ue)}`})}}function me(ve,te){if(!E.open)return;const{pendingId:de,affected:Se,ruleReferences:Ue}=E;if(de!==ve.id){S({open:!1});return}if(!c.some(le=>le.id===de)){g({type:"error",message:`Row for "${de}" was already removed — modal action ignored.`}),S({open:!1});return}ve.mode==="remap"?(D(le=>v9(le,de,te)),K(le=>w9(le,de,te))):(D(le=>j9(le,de,te)),K(le=>k9(le,de))),Ue.some(le=>le.section!=="transitions")&&(z(!0),Y(!0)),u(le=>{const pt=le.filter(jt=>jt.id!==de),xt=new Set(pt.map(jt=>jt.id));return k(jt=>{const st=ik(jt,xt),pe=new Map(st);return Se.count>0&&pe.set(de,ve),pe}),pt}),b(!0),S({open:!1})}function re(){if(!L.open)return;const ve=L.references.map(de=>de.factName),te=Array.from(new Set([...R,...ve]));A(te),M({open:!1}),Qe(te)}function xe(){S({open:!1})}return e?r.jsx(gt,{label:"Loading workflow..."}):n?r.jsx(Nt,{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(yx,{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(gp,{value:ue,onValueChange:ye,items:[{value:"statuses",label:"Statuses",content:r.jsx(g9,{statuses:c,savedStatusIds:N,onUpdate:vt,onAdd:ct,onRemove:Q,onReorder:ve=>{u(ve),b(!0)}})},{value:"transitions",label:"Transitions",problemCount:Z.length,content:r.jsx(Y9,{value:I,customizing:$,statuses:Re,knownCommands:ee,onChange:Me,onCustomize:et,disabled:d})},{value:"derive",label:"Derive Rules",problemCount:ot.length,content:r.jsx(V9,{value:F,deriveCustom:W,statuses:Re,acceptedFacts:Je,onChange:Ie,onReset:Ye,disabled:d})},{value:"facts",label:"Facts",problemCount:Ze.length,content:r.jsx(P9,{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 Qe(),disabled:d||!y||_e>0,children:[r.jsx(Pf,{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),ge()},disabled:d,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Q9({transitions:Z.length,derive:ot.length,facts:Ze.length}).message})]})]}),E.open&&r.jsx(f9,{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:me,onCancel:xe}),r.jsx(p9,{open:L.open,references:L.open?L.references:[],onConfirm:re,onCancel:()=>{M({open:!1}),m(!1)}})]})})}const Ms=e=>`${e.workspace}::${e.id}`;function hk(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function X9(){var ve;const{data:e,loading:t,error:n,refetch:s}=N1(),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=zy("all"),[W,Y]=f.useState(null),[_,z]=f.useState(null),H=f.useRef(null);f.useEffect(()=>{let te=!1;return(async()=>{try{const de=await fetch("/api/projects");if(!de.ok)return;const Se=await de.json();te||F(Se.filter(Ue=>!Ue.archived))}catch{}})(),()=>{te=!0}},[]);async function q(te,de){te.stopPropagation(),await Kc(de)&&(k(de),setTimeout(()=>k(Se=>Se===de?null:Se),1500))}const I=f.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const te=[];for(const de of e.workspaces)for(const Se of de.items)te.push({...Se,workspace:de.workspace});return te},[e]),K=f.useMemo(()=>{const te=new Set;for(const de of I)for(const Se of de.tags)te.add(Se);return Array.from(te).sort()},[I]),$=f.useMemo(()=>{let te=I;if(i.trim()){const de=i.toLowerCase();te=te.filter(Se=>Se.description.toLowerCase().includes(de)||Se.tags.some(Ue=>Ue.toLowerCase().includes(de))||Se.id.includes(de))}return d&&(te=te.filter(de=>de.status===d)),h&&(te=te.filter(de=>de.tags.includes(h))),te},[I,i,d,h]);f.useEffect(()=>{P(new Set),L.current=null},[i,d,h]);const V=f.useMemo(()=>$.filter(te=>T.has(Ms(te))),[$,T]),ee=$.length>0&&V.length===$.length,B=V.length>0&&!ee,ue=f.useMemo(()=>{if(V.length===0)return null;const te=new Set(V.map(de=>de.workspace));return te.size===1?[...te][0]:null},[V]),ye=f.useMemo(()=>{if(!ue||!M)return;const te=M.filter(de=>de.workspace===ue);return te.length===1?te[0].slug:void 0},[ue,M]),se=((ve=V[0])==null?void 0:ve.description)??"",ge=f.useMemo(()=>{if(ue)return null;const te=new Map;for(const de of V)te.has(de.workspace)||te.set(de.workspace,[]),te.get(de.workspace).push(de.id);return Array.from(te,([de,Se])=>({workspace:de,todoIds:Se}))},[V,ue]),ke=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ge??[]};function Re(te,de,Se){const Ue=Ms(te),le=!!(Se&&"shiftKey"in Se&&Se.shiftKey),pt=L.current?et.findIndex(xt=>Ms(xt)===L.current):-1;if(le&&pt!==-1){const xt=Math.min(pt,de),jt=Math.max(pt,de);P(st=>{const pe=new Set(st);for(let Oe=xt;Oe<=jt;Oe++){const qe=et[Oe];qe&&pe.add(Ms(qe))}return pe})}else P(xt=>{const jt=new Set(xt);return jt.has(Ue)?jt.delete(Ue):jt.add(Ue),jt});L.current=Ue}function Ae(){P(te=>{const de=new Set(te);if(ee)for(const Se of $)de.delete(Ms(Se));else for(const Se of $)de.add(Ms(Se));return de})}function Je(){P(new Set),L.current=null}function at(te){Je(),s(),te!=null&&te.assignmentRef&&o(hk(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 de of e.workspaces)te.open+=de.counts.open,te.in_progress+=de.counts.in_progress,te.completed+=de.counts.completed,te.blocked+=de.counts.blocked,te.total+=de.counts.total;return te},[e]);async function ot(){y.trim()&&(await Rx(N,y.trim()),b(""),s())}async function Z(te,de,Se){switch(Se){case"open":await R1(te,de);break;case"in_progress":await T1(te,de);break;case"completed":await C1(te,de);break;case"blocked":await E1(te,de);break}s()}async function _e(te,de){await A1(te,de),s()}async function Ee(te,de,Se){await P1(te,de,Se),s()}async function Ie(te,de,Se){await D1(te,de,Se),s()}async function Ye(te,de,Se){await $1(te,de,Se),s()}const Me=Fy($),et=Me.filter(te=>!D.isCollapsed(te.config.id)).flatMap(te=>te.items),{hotkeyRowProps:Qe}=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 de=vp(te.status);D.isCollapsed(de)&&D.toggle(de)},[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 de=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(de)},[ct,et.length,vt]);const ie=W?$.find(te=>Ms(te)===W)??null:null;function Q(te,de){const Se=H.current;if(Se!=null&&Se.closest(Oi)){te.preventDefault();return}te.dataTransfer.effectAllowed="move",te.dataTransfer.setData("text/plain",de),Y(de)}function me(){Y(null),z(null)}function re(te,de){!ie||de.statuses.includes(ie.status)||(te.preventDefault(),te.dataTransfer.dropEffect="move",z(de.id))}function xe(te,de){_===de.id&&!te.currentTarget.contains(te.relatedTarget)&&z(null)}function Pe(te,de){te.preventDefault();const Se=ie;me(),!(!Se||de.statuses.includes(Se.status))&&Z(Se.workspace,Se.id,de.dropStatus)}return t?r.jsx(gt,{label:"Loading todos..."}):n?r.jsx(Nt,{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:bx,tone:"info"}),r.jsx(_n,{label:"Blocked",value:Ze.blocked,icon:jx,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(Rt,{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))]})]}),V.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:[V.length," selected",ue?r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",r.jsx("strong",{children:ue}),")"]}):r.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(V.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:Je,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:de,items:Se})=>{const Ue=!D.isCollapsed(de.id);return r.jsx(My,{label:de.label,count:Se.length,expanded:Ue,onToggle:()=>D.toggle(de.id),isDropTarget:_===de.id,onDragOver:le=>re(le,de),onDragLeave:le=>xe(le,de),onDrop:le=>Pe(le,de),children:Ue&&Se.map(le=>{te+=1;const pt=te,xt=Ms(le),jt=T.has(xt);return r.jsxs("div",{draggable:!0,"data-todo-id":le.id,...Qe(pt),onMouseDown:st=>{H.current=st.target},onDragStart:st=>Q(st,xt),onDragEnd:me,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${jt?"ring-1 ring-foreground/20":""} ${W===xt?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${le.id}`,title:"Select",checked:jt,onChange:()=>{},onClick:st=>{st.stopPropagation(),Re(le,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(NE,{status:le.status,onChange:st=>Z(le.workspace,le.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(EE,{description:le.description,status:le.status,editing:E===xt,onBeginEdit:()=>S(xt),onEndEdit:()=>S(null),onSave:st=>Ee(le.workspace,le.id,st)}),le.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:le.tags.map(st=>`#${st}`).join(" ")}),le.linkedAssignmentRef?r.jsxs(Ce,{to:hk(le.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(zk,{className:"h-2.5 w-2.5"}),le.linkedAssignmentRef.includes("/")?le.linkedAssignmentRef:`oneoff:${le.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(TE,{item:le,attachmentUrl:(st,pe)=>Ax(le.workspace,st,pe),onAdd:st=>Ie(le.workspace,le.id,st),onDelete:st=>Ye(le.workspace,le.id,st)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:le.workspace!=="_global"&&r.jsx(Ce,{to:`/w/${le.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:st=>st.stopPropagation(),children:le.workspace})}),v===le.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,le.id),children:["t:",le.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:st=>q(st,le.id),children:r.jsx(Gd,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:st=>{st.stopPropagation(),_e(le.workspace,le.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${le.workspace}-${le.id}`)})},de.id)})})()}),r.jsx(_y,{open:R,selectedIds:V.map(te=>te.id),scope:ke,onOpenChange:A,onDone:at,defaultProject:ye,defaultTitle:se,allowOneOff:!0})]})}const Z9={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 eV({bundle:e}){const t=Z9[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 tV({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(eV,{bundle:n},n.id))]})}function nV(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]),$c(d=>{d.type==="todos-updated"&&!d.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function rV(){const{workspace:e}=Mt(),t=e||"_global",{data:n,loading:s,error:o,refetch:i}=Z3(t),{data:c}=nV(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 W=zy("workspace:"+t),[Y,_]=f.useState(null),[z,H]=f.useState(null),q=f.useRef(null);async function I(re,xe){re.stopPropagation(),await Kc(xe)&&(v(xe),setTimeout(()=>v(Pe=>Pe===xe?null:Pe),1500))}const K=f.useMemo(()=>{if(!(n!=null&&n.items))return[];const re=new Set;for(const xe of n.items)for(const Pe of xe.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 xe=u.toLowerCase();re=re.filter(Pe=>Pe.description.toLowerCase().includes(xe)||Pe.tags.some(ve=>ve.toLowerCase().includes(xe))||Pe.id.includes(xe))}return m&&(re=re.filter(xe=>xe.status===m)),g&&(re=re.filter(xe=>xe.tags.includes(g))),re},[n,u,m,g]);f.useEffect(()=>{T(new Set)},[u,m,g,t]);const V=f.useMemo(()=>$.filter(re=>S.has(re.id)).length,[$,S]),ee=$.length>0&&V===$.length,B=V>0&&!ee;function ue(re){T(xe=>{const Pe=new Set(xe);return Pe.has(re)?Pe.delete(re):Pe.add(re),Pe})}function ye(){T(re=>{const xe=new Set(re);if(ee)for(const Pe of $)xe.delete(Pe.id);else for(const Pe of $)xe.add(Pe.id);return xe})}function se(){T(new Set)}const ge=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 Rx(t,b.trim()),N(""),i())}async function Je(re,xe,Pe){re.stopPropagation(),window.confirm(`Delete "${Pe}"? This can't be undone.`)&&(await A1(t,xe),i())}async function at(re,xe){switch(xe){case"open":await R1(t,re);break;case"in_progress":await T1(t,re);break;case"completed":await C1(t,re);break;case"blocked":await E1(t,re);break}i()}async function Ze(re,xe){await P1(t,re,xe),i()}async function ot(re,xe){await D1(t,re,xe),i()}async function Z(re,xe){await $1(t,re,xe),i()}const _e=Fy($),Ee=_e.filter(re=>!W.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 xe=vp(re.status);W.isCollapsed(xe)&&W.toggle(xe)},[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 xe=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(xe)},[et,Ee.length,Me]);const Qe=Y?(n==null?void 0:n.items.find(re=>re.id===Y))??null:null;function $t(re,xe){const Pe=q.current;if(Pe!=null&&Pe.closest(Oi)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",xe),_(xe)}function vt(){_(null),H(null)}function ct(re,xe){!Qe||xe.statuses.includes(Qe.status)||(re.preventDefault(),re.dataTransfer.dropEffect="move",H(xe.id))}function ie(re,xe){z===xe.id&&!re.currentTarget.contains(re.relatedTarget)&&H(null)}function Q(re,xe){re.preventDefault();const Pe=Qe;vt(),!(!Pe||xe.statuses.includes(Pe.status))&&at(Pe.id,xe.dropStatus)}if(s)return r.jsx(gt,{label:"Loading todos..."});if(o)return r.jsx(Nt,{error:o});const me=(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:me.open,icon:zr}),r.jsx(_n,{label:"In Progress",value:me.in_progress,icon:zr,tone:"info"}),r.jsx(_n,{label:"Blocked",value:me.blocked,icon:jx,tone:"warn"}),r.jsx(_n,{label:"Total",value:me.total,icon:zr})]}),c&&r.jsx(tV,{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(Rt,{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:ye,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:xe,items:Pe})=>{const ve=!W.isCollapsed(xe.id);return r.jsx(My,{label:xe.label,count:Pe.length,expanded:ve,onToggle:()=>W.toggle(xe.id),isDropTarget:z===xe.id,onDragOver:te=>ct(te,xe),onDragLeave:te=>ie(te,xe),onDrop:te=>Q(te,xe),children:ve&&Pe.map(te=>(re+=1,r.jsx(CE,{item:te,copiedId:w,selected:S.has(te.id),editing:k===te.id,onBeginEdit:de=>E(de),onEndEdit:()=>E(null),onPatchDescription:Ze,onAddAttachments:ot,onDeleteAttachment:Z,attachmentUrl:(de,Se)=>Ax(t,de,Se),onToggleSelected:de=>ue(de),onMoveOne:(de,Se)=>{Se.stopPropagation(),F(de),L(!0)},onStatusChange:at,onCopyId:I,onDelete:Je,hotkeyRowProps:Ie(re),onDragOrigin:de=>{q.current=de.target},onDragStart:$t,onDragEnd:vt,isDragging:Y===te.id},te.id)))},xe.id)})})()}),r.jsx(_y,{open:P,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:Re}),r.jsx(AE,{open:A,selectedIds:ge,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{L(re),re||F(null)},onDone:ke})]})}function T2(){const{views:e}=Bc();async function t(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=mC(u,d.workspace).config,h=mf(d.config,m,d.config);await af(i.id,{name:c,config:h})}async function n(i,c,u){const d=e.find(g=>g.id===i.id)??i,m=gy(u,d.workspace).config,h=mf(d.config,m,d.config);await af(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 TO(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:o}}const gk=80,sV={kanban:"Kanban",list:"List",table:"Table"},oV={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function R2({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:o}){const i=!!s,c=xa(),u=up(),{data:d}=Cs(),{data:m}=$f(),[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"),[W,Y]=f.useState(null),[_,z]=f.useState(""),[H,q]=f.useState(ri.sortField),[I,K]=f.useState(ri.sortDirection),[$,V]=f.useState(!1),[ee,B]=f.useState(null);function ue(){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),V(!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(fp(Z.dateRange)),z(Z.search??""),q(s.config.sortField),K(s.config.sortDirection)}else g(""),ue()},[e,s]);const ye=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]),ge=f.useMemo(()=>{const Z=new Set,_e=ye(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=ye(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:Wc(c,Z)})),[c]),Ae=f.useMemo(()=>sM.map(Z=>({value:Z,label:Z[0].toUpperCase()+Z.slice(1)})),[]),Je=f.useMemo(()=>u.definitions.map(Z=>({value:Z.id,label:Ci(u,Z.id)})),[u]),at=ey.map(Z=>({value:Z,label:sV[Z]})),Ze=h.trim(),ot=Ze.length>0&&Ze.length<=gk;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;V(!0),B(null);const _e={viewMode:y,filters:{status:N,priority:v,type:E,project:T,assignee:R,tags:L,activity:F,dateRange:ua(W),search:_},sortField:H,sortDirection:I};try{await o(Ze,_e)}catch(Ee){B(Ee instanceof Error?Ee.message:String(Ee)),V(!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:gk,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(mp,{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:Je,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:ge,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(dp,{className:"w-full",value:W,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:fN.map(Z=>r.jsx("option",{value:Z,children:oV[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:ue,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 aV={kanban:"Kanban",list:"List",table:"Table"},iV={assignment:"Assignment",session:"Session"},lV={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function xk(){const{workspace:e}=Mt(),{views:t,loading:n}=Bc(),{submitEdit:s,submitEditSession:o,duplicate:i,remove:c}=T2(),{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}=mC(_,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}=gy(_,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(Rt,{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(Rt,{className:"h-4 w-4"}),"Create session view"]}),W=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(xf,{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(gt,{label:"Loading saved views…"}):t.length===0?r.jsx(St,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,F]})}):r.jsx(Ve,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(Y=>r.jsx(cV,{view:Y,onRequestDelete:()=>g(Y),onRequestEdit:()=>S(Y),onRequestDuplicate:()=>void L(Y)},Y.id))})}),r.jsx(R2,{open:N||!W&&E!==null,onOpenChange:Y=>{Y||(w(!1),W||S(null))},workspace:E&&!W?E.workspace:e??null,initialView:E&&!W?E:null,onSubmit:E&&!W?(Y,_)=>R(E,Y,_):T}),r.jsx(bC,{open:v||W&&E!==null,onOpenChange:Y=>{Y||(k(!1),W&&S(null))},workspace:E&&W?E.workspace:e??null,initialView:E&&W?E:null,onSubmit:E&&W?(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 cV({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const o=_t(),i=()=>o(gC(e)),c=yC(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 ${lV[d]??"bg-muted text-muted-foreground"}`,children:iV[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:aV[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 uV={kanban:"Kanban",list:"List",table:"Table"};function yk(){const{id:e,workspace:t}=Mt(),n=_t(),{view:s,ready:o,error:i,refetch:c}=So(e),{submitEdit:u,duplicate:d,remove:m}=T2(),{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(gC(s),{replace:!0})},[o,s,t,n]),!o)return r.jsx(gt,{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(xf,{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(Hd,{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(Hd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(xf,{title:s.name,description:yC(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:uV[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(xC(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(fC,{view:s}),b?r.jsx(R2,{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 dV(){return r.jsx(MA,{children:r.jsx(AL,{children:r.jsx(pA,{children:r.jsxs(He,{element:r.jsx(o4,{}),children:[r.jsx(He,{path:"/",element:r.jsx(DM,{})}),r.jsx(He,{path:"/projects",element:r.jsx(Bj,{})}),r.jsx(He,{path:"/archive",element:r.jsx(qM,{})}),r.jsx(He,{path:"/assignments",element:r.jsx(Q0,{})}),r.jsx(He,{path:"/assignments/new",element:r.jsx(ek,{})}),r.jsx(He,{path:"/assignments/:id",element:r.jsx(HU,{})}),r.jsx(He,{path:"/assignments/:id/edit",element:r.jsx(ag,{})}),r.jsx(He,{path:"/assignments/:id/plan/edit",element:r.jsx(ig,{})}),r.jsx(He,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/assignments/:id/handoff/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/assignments/:id/decision-record/edit",element:r.jsx(ug,{})}),r.jsx(He,{path:"/servers",element:r.jsx(nk,{})}),r.jsx(He,{path:"/inventories",element:r.jsx(rk,{})}),r.jsx(He,{path:"/usage",element:r.jsx(sk,{})}),r.jsx(He,{path:"/agent-sessions",element:r.jsx(ok,{})}),r.jsx(He,{path:"/playbooks",element:r.jsx(R7,{})}),r.jsx(He,{path:"/playbooks/create",element:r.jsx(P7,{})}),r.jsx(He,{path:"/playbooks/:slug",element:r.jsx(A7,{})}),r.jsx(He,{path:"/playbooks/:slug/edit",element:r.jsx(D7,{})}),r.jsx(He,{path:"/memories",element:r.jsx($7,{})}),r.jsx(He,{path:"/memories/new",element:r.jsx(I7,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(L7,{})}),r.jsx(He,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(O7,{})}),r.jsx(He,{path:"/resources",element:r.jsx(_7,{})}),r.jsx(He,{path:"/resources/new",element:r.jsx(F7,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(M7,{})}),r.jsx(He,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(z7,{})}),r.jsx(He,{path:"/todos",element:r.jsx(X9,{})}),r.jsx(He,{path:"/views",element:r.jsx(xk,{})}),r.jsx(He,{path:"/views/:id",element:r.jsx(yk,{})}),r.jsx(He,{path:"/help",element:r.jsx(LM,{})}),r.jsx(He,{path:"/settings",element:r.jsx(d9,{})}),r.jsx(He,{path:"/workflow",element:r.jsx(J9,{})}),r.jsx(He,{path:"/create/project",element:r.jsx(X0,{})}),r.jsx(He,{path:"/projects/:slug",element:r.jsx(B0,{})}),r.jsx(He,{path:"/projects/:slug/edit",element:r.jsx(tk,{})}),r.jsx(He,{path:"/projects/:slug/create/assignment",element:r.jsx(Z0,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(K0,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(ag,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(ig,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(ug,{})}),r.jsx(He,{path:"/w/:workspace/projects",element:r.jsx(Bj,{})}),r.jsx(He,{path:"/w/:workspace/assignments",element:r.jsx(Q0,{})}),r.jsx(He,{path:"/w/:workspace/assignments/new",element:r.jsx(ek,{})}),r.jsx(He,{path:"/w/:workspace/servers",element:r.jsx(nk,{})}),r.jsx(He,{path:"/w/:workspace/inventories",element:r.jsx(rk,{})}),r.jsx(He,{path:"/w/:workspace/usage",element:r.jsx(sk,{})}),r.jsx(He,{path:"/w/:workspace/agent-sessions",element:r.jsx(ok,{})}),r.jsx(He,{path:"/w/:workspace/todos",element:r.jsx(rV,{})}),r.jsx(He,{path:"/w/:workspace/views",element:r.jsx(xk,{})}),r.jsx(He,{path:"/w/:workspace/views/:id",element:r.jsx(yk,{})}),r.jsx(He,{path:"/w/:workspace/create/project",element:r.jsx(X0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug",element:r.jsx(B0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(tk,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(Z0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(K0,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(ag,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(ig,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(lg,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(cg,{})}),r.jsx(He,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(ug,{})})]})})})})}j3();pR.createRoot(document.getElementById("root")).render(r.jsx(f.StrictMode,{children:r.jsx(k3,{children:r.jsx(dV,{})})}));export{yF as _,pV as a,Sf as g};
|