syntaur 0.49.0 → 0.51.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-D_1PqV49.js → _basePickBy-iqEGomW8.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-Go3lJYWk.js → _baseUniq--Qg0UGRL.js} +1 -1
- package/dashboard/dist/assets/{arc-CPkf0K8o.js → arc-DARwlKiU.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-D-YQc-ni.js → architectureDiagram-2XIMDMQ5-oWU1lL2y.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-BYKjgbgS.js → blockDiagram-WCTKOSBZ-DMuCwZLv.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-DL0q4c_7.js → c4Diagram-IC4MRINW-Axpp-L4P.js} +1 -1
- package/dashboard/dist/assets/channel-DJkgIua7.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-Dz3hphvh.js → chunk-4BX2VUAB-BE-Yhqdt.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-KkMi7-rO.js → chunk-55IACEB6-DacZdH_M.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-C6i7PgE-.js → chunk-FMBD7UC4-vAEg5Z3N.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-D9nWD3SH.js → chunk-JSJVCQXG-CTukijKn.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-C-pz_QfY.js → chunk-KX2RTZJC-C-lU6Wil.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-m21dA_AB.js → chunk-NQ4KR5QH-m-jZxhEZ.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-BTYD7vUi.js → chunk-QZHKN3VN-VA8PtmgY.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-D_92eLJ7.js → chunk-WL4C6EOR-BhM9cEr9.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-BQpVKOOw.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-BQpVKOOw.js +1 -0
- package/dashboard/dist/assets/clone-Cyb0u6Fm.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-xG37nIJ5.js → cose-bilkent-S5V4N54A-DBGtEkKf.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-BmMnqFf5.js → dagre-KLK3FWXG-BIU8RfcY.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-NKwCHorn.js → diagram-E7M64L7V-C1OD19qw.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-RFbM55z9.js → diagram-IFDJBPK2-B-VWSLa6.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-DFATQN63.js → diagram-P4PSJMXO-gpFwgRk6.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-CnkbUfYo.js → erDiagram-INFDFZHY-MxL4ZzOD.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-C2bCpv_b.js → flowDiagram-PKNHOUZH-B0BqXx8A.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Cyz3i9ox.js → ganttDiagram-A5KZAMGK-CZSBVo4l.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-DNSJOJPu.js → gitGraphDiagram-K3NZZRJ6-CfXBKQ-d.js} +1 -1
- package/dashboard/dist/assets/{graph-B0uvMYEt.js → graph-IrjCiOoy.js} +1 -1
- package/dashboard/dist/assets/index-BHyNXpJx.js +577 -0
- package/dashboard/dist/assets/index-KhylT_54.css +1 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-CIAGOhnc.js → infoDiagram-LFFYTUFH-Rf9ZeCX3.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Cz1e1z95.js → ishikawaDiagram-PHBUUO56-RAQWTALS.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-DQpnaGS3.js → journeyDiagram-4ABVD52K-ZcEWsM-p.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-ctedqNYC.js → kanban-definition-K7BYSVSG-B-GmGguF.js} +1 -1
- package/dashboard/dist/assets/{layout-DB-MZUE7.js → layout-CGl1QE2H.js} +1 -1
- package/dashboard/dist/assets/{linear-ChyfHemL.js → linear-C8T_EWa_.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-B7D9g8Z0.js → mermaid.core-_rgvEzla.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-BBwO3Cx_.js → mindmap-definition-YRQLILUH-D9eiyPrJ.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-D5cgYxWS.js → pieDiagram-SKSYHLDU-DuAS5_1b.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-D1PRaNvQ.js → quadrantDiagram-337W2JSQ-Bs9cFwnM.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-DSPKmecF.js → requirementDiagram-Z7DCOOCP-P8h8bKqs.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-qoBrVPPJ.js → sankeyDiagram-WA2Y5GQK-jvYtbQv9.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-COHgbUzd.js → sequenceDiagram-2WXFIKYE-dfHtIxLr.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-D7o2ec5P.js → stateDiagram-RAJIS63D-BVKA9rS_.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-B1fHHK2b.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-0_qvF5FF.js → timeline-definition-YZTLITO2-Cm1H8Att.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-DrWRWtnJ.js → treemap-KZPCXAKY-BRzwg_ce.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-Chnf9HfQ.js → vennDiagram-LZ73GAT5-BJ4UoDVK.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-DZaMVdVS.js → xychartDiagram-JWTSCODW-TyeURVy0.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dist/dashboard/server.js +300 -171
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +300 -171
- package/dist/index.js.map +1 -1
- package/dist/launch/index.d.ts +35 -21
- package/dist/launch/index.js +151 -85
- 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/claude-code/skills/manage-statuses/SKILL.md +17 -0
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/codex/skills/manage-statuses/SKILL.md +17 -0
- 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/skills/manage-statuses/SKILL.md +17 -0
- package/dashboard/dist/assets/channel-BogPsJQf.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-LFy25hGC.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-LFy25hGC.js +0 -1
- package/dashboard/dist/assets/clone-B2jJrmVo.js +0 -1
- package/dashboard/dist/assets/index-J9J1LmFz.js +0 -567
- package/dashboard/dist/assets/index-hXP7kHLF.css +0 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-Bn85KIR5.js +0 -1
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
var ET=Object.defineProperty;var TT=(e,t,n)=>t in e?ET(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Km=(e,t,n)=>TT(e,typeof t!="symbol"?t+"":t,n);function RT(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 df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l9(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 qm={exports:{}},Rl={},Gm={exports:{}},gt={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var Gv;function PT(){if(Gv)return gt;Gv=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"),f=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(){}},C=Object.assign,j={};function v(V,re,B){this.props=V,this.context=re,this.refs=j,this.updater=B||b}v.prototype.isReactComponent={},v.prototype.setState=function(V,re){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,re,"setState")},v.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function k(){}k.prototype=v.prototype;function E(V,re,B){this.props=V,this.context=re,this.refs=j,this.updater=B||b}var S=E.prototype=new k;S.constructor=E,C(S,v.prototype),S.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,R={current:null},P={key:!0,ref:!0,__self:!0,__source:!0};function $(V,re,B){var ue,ge={},se=null,ye=null;if(re!=null)for(ue in re.ref!==void 0&&(ye=re.ref),re.key!==void 0&&(se=""+re.key),re)A.call(re,ue)&&!P.hasOwnProperty(ue)&&(ge[ue]=re[ue]);var Se=arguments.length-2;if(Se===1)ge.children=B;else if(1<Se){for(var Ee=Array(Se),Ae=0;Ae<Se;Ae++)Ee[Ae]=arguments[Ae+2];ge.children=Ee}if(V&&V.defaultProps)for(ue in Se=V.defaultProps,Se)ge[ue]===void 0&&(ge[ue]=Se[ue]);return{$$typeof:e,type:V,key:se,ref:ye,props:ge,_owner:R.current}}function I(V,re){return{$$typeof:e,type:V.type,key:re,ref:V.ref,props:V.props,_owner:V._owner}}function M(V){return typeof V=="object"&&V!==null&&V.$$typeof===e}function D(V){var re={"=":"=0",":":"=2"};return"$"+V.replace(/[=:]/g,function(B){return re[B]})}var H=/\/+/g;function K(V,re){return typeof V=="object"&&V!==null&&V.key!=null?D(""+V.key):re.toString(36)}function _(V,re,B,ue,ge){var se=typeof V;(se==="undefined"||se==="boolean")&&(V=null);var ye=!1;if(V===null)ye=!0;else switch(se){case"string":case"number":ye=!0;break;case"object":switch(V.$$typeof){case e:case t:ye=!0}}if(ye)return ye=V,ge=ge(ye),V=ue===""?"."+K(ye,0):ue,T(ge)?(B="",V!=null&&(B=V.replace(H,"$&/")+"/"),_(ge,re,B,"",function(Ae){return Ae})):ge!=null&&(M(ge)&&(ge=I(ge,B+(!ge.key||ye&&ye.key===ge.key?"":(""+ge.key).replace(H,"$&/")+"/")+V)),re.push(ge)),1;if(ye=0,ue=ue===""?".":ue+":",T(V))for(var Se=0;Se<V.length;Se++){se=V[Se];var Ee=ue+K(se,Se);ye+=_(se,re,B,Ee,ge)}else if(Ee=y(V),typeof Ee=="function")for(V=Ee.call(V),Se=0;!(se=V.next()).done;)se=se.value,Ee=ue+K(se,Se++),ye+=_(se,re,B,Ee,ge);else if(se==="object")throw re=String(V),Error("Objects are not valid as a React child (found: "+(re==="[object Object]"?"object with keys {"+Object.keys(V).join(", ")+"}":re)+"). If you meant to render a collection of children, use an array instead.");return ye}function U(V,re,B){if(V==null)return V;var ue=[],ge=0;return _(V,ue,"","",function(se){return re.call(B,se,ge++)}),ue}function q(V){if(V._status===-1){var re=V._result;re=re(),re.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=re)}if(V._status===1)return V._result.default;throw V._result}var Z={current:null},F={transition:null},G={ReactCurrentDispatcher:Z,ReactCurrentBatchConfig:F,ReactCurrentOwner:R};function L(){throw Error("act(...) is not supported in production builds of React.")}return gt.Children={map:U,forEach:function(V,re,B){U(V,function(){re.apply(this,arguments)},B)},count:function(V){var re=0;return U(V,function(){re++}),re},toArray:function(V){return U(V,function(re){return re})||[]},only:function(V){if(!M(V))throw Error("React.Children.only expected to receive a single React element child.");return V}},gt.Component=v,gt.Fragment=n,gt.Profiler=o,gt.PureComponent=E,gt.StrictMode=s,gt.Suspense=f,gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=G,gt.act=L,gt.cloneElement=function(V,re,B){if(V==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+V+".");var ue=C({},V.props),ge=V.key,se=V.ref,ye=V._owner;if(re!=null){if(re.ref!==void 0&&(se=re.ref,ye=R.current),re.key!==void 0&&(ge=""+re.key),V.type&&V.type.defaultProps)var Se=V.type.defaultProps;for(Ee in re)A.call(re,Ee)&&!P.hasOwnProperty(Ee)&&(ue[Ee]=re[Ee]===void 0&&Se!==void 0?Se[Ee]:re[Ee])}var Ee=arguments.length-2;if(Ee===1)ue.children=B;else if(1<Ee){Se=Array(Ee);for(var Ae=0;Ae<Ee;Ae++)Se[Ae]=arguments[Ae+2];ue.children=Se}return{$$typeof:e,type:V.type,key:ge,ref:se,props:ue,_owner:ye}},gt.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},gt.createElement=$,gt.createFactory=function(V){var re=$.bind(null,V);return re.type=V,re},gt.createRef=function(){return{current:null}},gt.forwardRef=function(V){return{$$typeof:u,render:V}},gt.isValidElement=M,gt.lazy=function(V){return{$$typeof:h,_payload:{_status:-1,_result:V},_init:q}},gt.memo=function(V,re){return{$$typeof:m,type:V,compare:re===void 0?null:re}},gt.startTransition=function(V){var re=F.transition;F.transition={};try{V()}finally{F.transition=re}},gt.unstable_act=L,gt.useCallback=function(V,re){return Z.current.useCallback(V,re)},gt.useContext=function(V){return Z.current.useContext(V)},gt.useDebugValue=function(){},gt.useDeferredValue=function(V){return Z.current.useDeferredValue(V)},gt.useEffect=function(V,re){return Z.current.useEffect(V,re)},gt.useId=function(){return Z.current.useId()},gt.useImperativeHandle=function(V,re,B){return Z.current.useImperativeHandle(V,re,B)},gt.useInsertionEffect=function(V,re){return Z.current.useInsertionEffect(V,re)},gt.useLayoutEffect=function(V,re){return Z.current.useLayoutEffect(V,re)},gt.useMemo=function(V,re){return Z.current.useMemo(V,re)},gt.useReducer=function(V,re,B){return Z.current.useReducer(V,re,B)},gt.useRef=function(V){return Z.current.useRef(V)},gt.useState=function(V){return Z.current.useState(V)},gt.useSyncExternalStore=function(V,re,B){return Z.current.useSyncExternalStore(V,re,B)},gt.useTransition=function(){return Z.current.useTransition()},gt.version="18.3.1",gt}var Yv;function Ug(){return Yv||(Yv=1,Gm.exports=PT()),Gm.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 Jv;function AT(){if(Jv)return Rl;Jv=1;var e=Ug(),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,f,m){var h,g={},y=null,b=null;m!==void 0&&(y=""+m),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(b=f.ref);for(h in f)s.call(f,h)&&!i.hasOwnProperty(h)&&(g[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)g[h]===void 0&&(g[h]=f[h]);return{$$typeof:t,type:u,key:y,ref:b,props:g,_owner:o.current}}return Rl.Fragment=n,Rl.jsx=c,Rl.jsxs=c,Rl}var Qv;function DT(){return Qv||(Qv=1,qm.exports=AT()),qm.exports}var r=DT(),p=Ug();const Dt=df(p),q0=RT({__proto__:null,default:Dt},[p]);var Gu={},Ym={exports:{}},ar={},Jm={exports:{}},Qm={};/**
|
|
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 Xv;function $T(){return Xv||(Xv=1,(function(e){function t(F,G){var L=F.length;F.push(G);e:for(;0<L;){var V=L-1>>>1,re=F[V];if(0<o(re,G))F[V]=G,F[L]=re,L=V;else break e}}function n(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var G=F[0],L=F.pop();if(L!==G){F[0]=L;e:for(var V=0,re=F.length,B=re>>>1;V<B;){var ue=2*(V+1)-1,ge=F[ue],se=ue+1,ye=F[se];if(0>o(ge,L))se<re&&0>o(ye,ge)?(F[V]=ye,F[se]=L,V=se):(F[V]=ge,F[ue]=L,V=ue);else if(se<re&&0>o(ye,L))F[V]=ye,F[se]=L,V=se;else break e}}return G}function o(F,G){var L=F.sortIndex-G.sortIndex;return L!==0?L:F.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],m=[],h=1,g=null,y=3,b=!1,C=!1,j=!1,v=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(F){for(var G=n(m);G!==null;){if(G.callback===null)s(m);else if(G.startTime<=F)s(m),G.sortIndex=G.expirationTime,t(f,G);else break;G=n(m)}}function T(F){if(j=!1,S(F),!C)if(n(f)!==null)C=!0,q(A);else{var G=n(m);G!==null&&Z(T,G.startTime-F)}}function A(F,G){C=!1,j&&(j=!1,k($),$=-1),b=!0;var L=y;try{for(S(G),g=n(f);g!==null&&(!(g.expirationTime>G)||F&&!D());){var V=g.callback;if(typeof V=="function"){g.callback=null,y=g.priorityLevel;var re=V(g.expirationTime<=G);G=e.unstable_now(),typeof re=="function"?g.callback=re:g===n(f)&&s(f),S(G)}else s(f);g=n(f)}if(g!==null)var B=!0;else{var ue=n(m);ue!==null&&Z(T,ue.startTime-G),B=!1}return B}finally{g=null,y=L,b=!1}}var R=!1,P=null,$=-1,I=5,M=-1;function D(){return!(e.unstable_now()-M<I)}function H(){if(P!==null){var F=e.unstable_now();M=F;var G=!0;try{G=P(!0,F)}finally{G?K():(R=!1,P=null)}}else R=!1}var K;if(typeof E=="function")K=function(){E(H)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,U=_.port2;_.port1.onmessage=H,K=function(){U.postMessage(null)}}else K=function(){v(H,0)};function q(F){P=F,R||(R=!0,K())}function Z(F,G){$=v(function(){F(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(F){F.callback=null},e.unstable_continueExecution=function(){C||b||(C=!0,q(A))},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(F){switch(y){case 1:case 2:case 3:var G=3;break;default:G=y}var L=y;y=G;try{return F()}finally{y=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(F,G){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var L=y;y=F;try{return G()}finally{y=L}},e.unstable_scheduleCallback=function(F,G,L){var V=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?V+L:V):L=V,F){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=L+re,F={id:h++,callback:G,priorityLevel:F,startTime:L,expirationTime:re,sortIndex:-1},L>V?(F.sortIndex=L,t(m,F),n(f)===null&&F===n(m)&&(j?(k($),$=-1):j=!0,Z(T,L-V))):(F.sortIndex=re,t(f,F),C||b||(C=!0,q(A))),F},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(F){var G=y;return function(){var L=y;y=G;try{return F.apply(this,arguments)}finally{y=L}}}})(Qm)),Qm}var Zv;function LT(){return Zv||(Zv=1,Jm.exports=$T()),Jm.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 ew;function OT(){if(ew)return ar;ew=1;var e=Ug(),t=LT();function n(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=1;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d]);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"),f=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 f.call(g,a)?!0:f.call(h,a)?!1:m.test(a)?g[a]=!0:(h[a]=!0,!1)}function b(a,l,d,x){if(d!==null&&d.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return x?!1:d!==null?!d.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function C(a,l,d,x){if(l===null||typeof l>"u"||b(a,l,d,x))return!0;if(x)return!1;if(d!==null)switch(d.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function j(a,l,d,x,w,N,O){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=x,this.attributeNamespace=w,this.mustUseProperty=d,this.propertyName=a,this.type=l,this.sanitizeURL=N,this.removeEmptyString=O}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){v[a]=new j(a,0,!1,a,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var l=a[0];v[l]=new j(l,1,!1,a[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(a){v[a]=new j(a,2,!1,a.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){v[a]=new j(a,2,!1,a,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){v[a]=new j(a,3,!1,a.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(a){v[a]=new j(a,3,!0,a,null,!1,!1)}),["capture","download"].forEach(function(a){v[a]=new j(a,4,!1,a,null,!1,!1)}),["cols","rows","size","span"].forEach(function(a){v[a]=new j(a,6,!1,a,null,!1,!1)}),["rowSpan","start"].forEach(function(a){v[a]=new j(a,5,!1,a.toLowerCase(),null,!1,!1)});var k=/[\-:]([a-z])/g;function E(a){return a[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(a){var l=a.replace(k,E);v[l]=new j(l,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(a){v[a]=new j(a,1,!1,a.toLowerCase(),null,!1,!1)}),v.xlinkHref=new j("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(a){v[a]=new j(a,1,!1,a.toLowerCase(),null,!0,!0)});function S(a,l,d,x){var w=v.hasOwnProperty(l)?v[l]:null;(w!==null?w.type!==0:x||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(C(l,d,w,x)&&(d=null),x||w===null?y(l)&&(d===null?a.removeAttribute(l):a.setAttribute(l,""+d)):w.mustUseProperty?a[w.propertyName]=d===null?w.type===3?!1:"":d:(l=w.attributeName,x=w.attributeNamespace,d===null?a.removeAttribute(l):(w=w.type,d=w===3||w===4&&d===!0?"":""+d,x?a.setAttributeNS(x,l,d):a.setAttribute(l,d))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),R=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),D=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Z=Symbol.for("react.offscreen"),F=Symbol.iterator;function G(a){return a===null||typeof a!="object"?null:(a=F&&a[F]||a["@@iterator"],typeof a=="function"?a:null)}var L=Object.assign,V;function re(a){if(V===void 0)try{throw Error()}catch(d){var l=d.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 d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(de){var x=de}Reflect.construct(a,[],l)}else{try{l.call()}catch(de){x=de}a.call(l.prototype)}else{try{throw Error()}catch(de){x=de}a()}}catch(de){if(de&&x&&typeof de.stack=="string"){for(var w=de.stack.split(`
|
|
35
|
+
`),N=x.stack.split(`
|
|
36
|
+
`),O=w.length-1,W=N.length-1;1<=O&&0<=W&&w[O]!==N[W];)W--;for(;1<=O&&0<=W;O--,W--)if(w[O]!==N[W]){if(O!==1||W!==1)do if(O--,W--,0>W||w[O]!==N[W]){var J=`
|
|
37
|
+
`+w[O].replace(" at new "," at ");return a.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",a.displayName)),J}while(1<=O&&0<=W);break}}}finally{B=!1,Error.prepareStackTrace=d}return(a=a?a.displayName||a.name:"")?re(a):""}function ge(a){switch(a.tag){case 5:return re(a.type);case 16:return re("Lazy");case 13:return re("Suspense");case 19:return re("SuspenseList");case 0:case 2:case 15:return a=ue(a.type,!1),a;case 11:return a=ue(a.type.render,!1),a;case 1:return a=ue(a.type,!0),a;default:return""}}function se(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case P:return"Fragment";case R:return"Portal";case I:return"Profiler";case $:return"StrictMode";case K:return"Suspense";case _:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case D:return(a.displayName||"Context")+".Consumer";case M:return(a._context.displayName||"Context")+".Provider";case H:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case U:return l=a.displayName||null,l!==null?l:se(a.type)||"Memo";case q:l=a._payload,a=a._init;try{return se(a(l))}catch{}}return null}function ye(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return se(l);case 8:return l===$?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Se(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ee(a){var l=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Ae(a){var l=Ee(a)?"checked":"value",d=Object.getOwnPropertyDescriptor(a.constructor.prototype,l),x=""+a[l];if(!a.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var w=d.get,N=d.set;return Object.defineProperty(a,l,{configurable:!0,get:function(){return w.call(this)},set:function(O){x=""+O,N.call(this,O)}}),Object.defineProperty(a,l,{enumerable:d.enumerable}),{getValue:function(){return x},setValue:function(O){x=""+O},stopTracking:function(){a._valueTracker=null,delete a[l]}}}}function Ke(a){a._valueTracker||(a._valueTracker=Ae(a))}function ct(a){if(!a)return!1;var l=a._valueTracker;if(!l)return!0;var d=l.getValue(),x="";return a&&(x=Ee(a)?a.checked?"true":"false":a.value),a=x,a!==d?(l.setValue(a),!0):!1}function et(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function ot(a,l){var d=l.checked;return L({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??a._wrapperState.initialChecked})}function X(a,l){var d=l.defaultValue==null?"":l.defaultValue,x=l.checked!=null?l.checked:l.defaultChecked;d=Se(l.value!=null?l.value:d),a._wrapperState={initialChecked:x,initialValue:d,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function Me(a,l){l=l.checked,l!=null&&S(a,"checked",l,!1)}function Ce(a,l){Me(a,l);var d=Se(l.value),x=l.type;if(d!=null)x==="number"?(d===0&&a.value===""||a.value!=d)&&(a.value=""+d):a.value!==""+d&&(a.value=""+d);else if(x==="submit"||x==="reset"){a.removeAttribute("value");return}l.hasOwnProperty("value")?Ye(a,l.type,d):l.hasOwnProperty("defaultValue")&&Ye(a,l.type,Se(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(a.defaultChecked=!!l.defaultChecked)}function Ie(a,l,d){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,d||l===a.value||(a.value=l),a.defaultValue=l}d=a.name,d!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,d!==""&&(a.name=d)}function Ye(a,l,d){(l!=="number"||et(a.ownerDocument)!==a)&&(d==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+d&&(a.defaultValue=""+d))}var Fe=Array.isArray;function Ze(a,l,d,x){if(a=a.options,l){l={};for(var w=0;w<d.length;w++)l["$"+d[w]]=!0;for(d=0;d<a.length;d++)w=l.hasOwnProperty("$"+a[d].value),a[d].selected!==w&&(a[d].selected=w),w&&x&&(a[d].defaultSelected=!0)}else{for(d=""+Se(d),l=null,w=0;w<a.length;w++){if(a[w].value===d){a[w].selected=!0,x&&(a[w].defaultSelected=!0);return}l!==null||a[w].disabled||(l=a[w])}l!==null&&(l.selected=!0)}}function Qe(a,l){if(l.dangerouslySetInnerHTML!=null)throw Error(n(91));return L({},l,{value:void 0,defaultValue:void 0,children:""+a._wrapperState.initialValue})}function Ot(a,l){var d=l.value;if(d==null){if(d=l.children,l=l.defaultValue,d!=null){if(l!=null)throw Error(n(92));if(Fe(d)){if(1<d.length)throw Error(n(93));d=d[0]}l=d}l==null&&(l=""),d=l}a._wrapperState={initialValue:Se(d)}}function yt(a,l){var d=Se(l.value),x=Se(l.defaultValue);d!=null&&(d=""+d,d!==a.value&&(a.value=d),l.defaultValue==null&&a.defaultValue!==d&&(a.defaultValue=d)),x!=null&&(a.defaultValue=""+x)}function dt(a){var l=a.textContent;l===a._wrapperState.initialValue&&l!==""&&l!==null&&(a.value=l)}function le(a){switch(a){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Y(a,l){return a==null||a==="http://www.w3.org/1999/xhtml"?le(l):a==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":a}var fe,ne=(function(a){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,d,x,w){MSApp.execUnsafeLocalFunction(function(){return a(l,d,x,w)})}:a})(function(a,l){if(a.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in a)a.innerHTML=l;else{for(fe=fe||document.createElement("div"),fe.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=fe.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;l.firstChild;)a.appendChild(l.firstChild)}});function he(a,l){if(l){var d=a.firstChild;if(d&&d===a.lastChild&&d.nodeType===3){d.nodeValue=l;return}}a.textContent=l}var De={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ut=["Webkit","ms","Moz","O"];Object.keys(De).forEach(function(a){ut.forEach(function(l){l=l+a.charAt(0).toUpperCase()+a.substring(1),De[l]=De[a]})});function ae(a,l,d){return l==null||typeof l=="boolean"||l===""?"":d||typeof l!="number"||l===0||De.hasOwnProperty(a)&&De[a]?(""+l).trim():l+"px"}function be(a,l){a=a.style;for(var d in l)if(l.hasOwnProperty(d)){var x=d.indexOf("--")===0,w=ae(d,l[d],x);d==="float"&&(d="cssFloat"),x?a.setProperty(d,w):a[d]=w}}var $e=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function at(a,l){if(l){if($e[a]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(n(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(n(61))}if(l.style!=null&&typeof l.style!="object")throw Error(n(62))}}function Be(a,l){if(a.indexOf("-")===-1)return typeof l.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var kt=null;function St(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var _t=null,pe=null,te=null;function xe(a){if(a=ml(a)){if(typeof _t!="function")throw Error(n(280));var l=a.stateNode;l&&(l=cu(l),_t(a.stateNode,a.type,l))}}function Le(a){pe?te?te.push(a):te=[a]:pe=a}function tt(){if(pe){var a=pe,l=te;if(te=pe=null,xe(a),l)for(a=0;a<l.length;a++)xe(l[a])}}function ve(a,l){return a(l)}function Nt(){}var It=!1;function Zt(a,l,d){if(It)return a(l,d);It=!0;try{return ve(a,l,d)}finally{It=!1,(pe!==null||te!==null)&&(Nt(),tt())}}function jt(a,l){var d=a.stateNode;if(d===null)return null;var x=cu(d);if(x===null)return null;d=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(d&&typeof d!="function")throw Error(n(231,l,typeof d));return d}var wn=!1;if(u)try{var Rt={};Object.defineProperty(Rt,"passive",{get:function(){wn=!0}}),window.addEventListener("test",Rt,Rt),window.removeEventListener("test",Rt,Rt)}catch{wn=!1}function oe(a,l,d,x,w,N,O,W,J){var de=Array.prototype.slice.call(arguments,3);try{l.apply(d,de)}catch(ke){this.onError(ke)}}var Ue=!1,nt=null,bt=!1,er=null,qr={onError:function(a){Ue=!0,nt=a}};function Es(a,l,d,x,w,N,O,W,J){Ue=!1,nt=null,oe.apply(qr,arguments)}function Fc(a,l,d,x,w,N,O,W,J){if(Es.apply(this,arguments),Ue){if(Ue){var de=nt;Ue=!1,nt=null}else throw Error(n(198));bt||(bt=!0,er=de)}}function ht(a){var l=a,d=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,(l.flags&4098)!==0&&(d=l.return),a=l.return;while(a)}return l.tag===3?d:null}function zc(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 Ji(a){if(ht(a)!==a)throw Error(n(188))}function Bc(a){var l=a.alternate;if(!l){if(l=ht(a),l===null)throw Error(n(188));return l!==a?null:a}for(var d=a,x=l;;){var w=d.return;if(w===null)break;var N=w.alternate;if(N===null){if(x=w.return,x!==null){d=x;continue}break}if(w.child===N.child){for(N=w.child;N;){if(N===d)return Ji(w),a;if(N===x)return Ji(w),l;N=N.sibling}throw Error(n(188))}if(d.return!==x.return)d=w,x=N;else{for(var O=!1,W=w.child;W;){if(W===d){O=!0,d=w,x=N;break}if(W===x){O=!0,x=w,d=N;break}W=W.sibling}if(!O){for(W=N.child;W;){if(W===d){O=!0,d=N,x=w;break}if(W===x){O=!0,x=N,d=w;break}W=W.sibling}if(!O)throw Error(n(189))}}if(d.alternate!==x)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?a:l}function on(a){return a=Bc(a),a!==null?Uc(a):null}function Uc(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=Uc(a);if(l!==null)return l;a=a.sibling}return null}var Vc=t.unstable_scheduleCallback,Hc=t.unstable_cancelCallback,pp=t.unstable_shouldYield,mp=t.unstable_requestPaint,en=t.unstable_now,hp=t.unstable_getCurrentPriorityLevel,Qi=t.unstable_ImmediatePriority,Wc=t.unstable_UserBlockingPriority,Ks=t.unstable_NormalPriority,ya=t.unstable_LowPriority,Kc=t.unstable_IdlePriority,ba=null,cn=null;function va(a){if(cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(ba,a,void 0,(a.current.flags&128)===128)}catch{}}var Bn=Math.clz32?Math.clz32:yp,gp=Math.log,xp=Math.LN2;function yp(a){return a>>>=0,a===0?32:31-(gp(a)/xp|0)|0}var Yn=64,wa=4194304;function qs(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 Ao(a,l){var d=a.pendingLanes;if(d===0)return 0;var x=0,w=a.suspendedLanes,N=a.pingedLanes,O=d&268435455;if(O!==0){var W=O&~w;W!==0?x=qs(W):(N&=O,N!==0&&(x=qs(N)))}else O=d&~w,O!==0?x=qs(O):N!==0&&(x=qs(N));if(x===0)return 0;if(l!==0&&l!==x&&(l&w)===0&&(w=x&-x,N=l&-l,w>=N||w===16&&(N&4194240)!==0))return l;if((x&4)!==0&&(x|=d&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=x;0<l;)d=31-Bn(l),w=1<<d,x|=a[d],l&=~w;return x}function qc(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 Gc(a,l){for(var d=a.suspendedLanes,x=a.pingedLanes,w=a.expirationTimes,N=a.pendingLanes;0<N;){var O=31-Bn(N),W=1<<O,J=w[O];J===-1?((W&d)===0||(W&x)!==0)&&(w[O]=qc(W,l)):J<=l&&(a.expiredLanes|=W),N&=~W}}function Do(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function Xi(){var a=Yn;return Yn<<=1,(Yn&4194240)===0&&(Yn=64),a}function Jt(a){for(var l=[],d=0;31>d;d++)l.push(a);return l}function Gr(a,l,d){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-Bn(l),a[l]=d}function Zi(a,l){var d=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<d;){var w=31-Bn(d),N=1<<w;l[w]=0,x[w]=-1,a[w]=-1,d&=~N}}function el(a,l){var d=a.entangledLanes|=l;for(a=a.entanglements;d;){var x=31-Bn(d),w=1<<x;w&l|a[x]&l&&(a[x]|=l),d&=~w}}var At=0;function tl(a){return a&=-a,1<a?4<a?(a&268435455)!==0?16:536870912:4:1}var ja,ka,Gs,Sa,Yc,nl=!1,On=[],cs=null,Pr=null,us=null,$o=new Map,Lo=new Map,Un=[],z="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 Q(a,l){switch(a){case"focusin":case"focusout":cs=null;break;case"dragenter":case"dragleave":Pr=null;break;case"mouseover":case"mouseout":us=null;break;case"pointerover":case"pointerout":$o.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lo.delete(l.pointerId)}}function me(a,l,d,x,w,N){return a===null||a.nativeEvent!==N?(a={blockedOn:l,domEventName:d,eventSystemFlags:x,nativeEvent:N,targetContainers:[w]},l!==null&&(l=ml(l),l!==null&&ka(l)),a):(a.eventSystemFlags|=x,l=a.targetContainers,w!==null&&l.indexOf(w)===-1&&l.push(w),a)}function _e(a,l,d,x,w){switch(l){case"focusin":return cs=me(cs,a,l,d,x,w),!0;case"dragenter":return Pr=me(Pr,a,l,d,x,w),!0;case"mouseover":return us=me(us,a,l,d,x,w),!0;case"pointerover":var N=w.pointerId;return $o.set(N,me($o.get(N)||null,a,l,d,x,w)),!0;case"gotpointercapture":return N=w.pointerId,Lo.set(N,me(Lo.get(N)||null,a,l,d,x,w)),!0}return!1}function ft(a){var l=Io(a.target);if(l!==null){var d=ht(l);if(d!==null){if(l=d.tag,l===13){if(l=zc(d),l!==null){a.blockedOn=l,Yc(a.priority,function(){Gs(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){a.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}a.blockedOn=null}function vt(a){if(a.blockedOn!==null)return!1;for(var l=a.targetContainers;0<l.length;){var d=bp(a.domEventName,a.eventSystemFlags,l[0],a.nativeEvent);if(d===null){d=a.nativeEvent;var x=new d.constructor(d.type,d);kt=x,d.target.dispatchEvent(x),kt=null}else return l=ml(d),l!==null&&ka(l),a.blockedOn=d,!1;l.shift()}return!0}function Mt(a,l,d){vt(a)&&d.delete(l)}function hr(){nl=!1,cs!==null&&vt(cs)&&(cs=null),Pr!==null&&vt(Pr)&&(Pr=null),us!==null&&vt(us)&&(us=null),$o.forEach(Mt),Lo.forEach(Mt)}function un(a,l){a.blockedOn===l&&(a.blockedOn=null,nl||(nl=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hr)))}function pn(a){function l(w){return un(w,a)}if(0<On.length){un(On[0],a);for(var d=1;d<On.length;d++){var x=On[d];x.blockedOn===a&&(x.blockedOn=null)}}for(cs!==null&&un(cs,a),Pr!==null&&un(Pr,a),us!==null&&un(us,a),$o.forEach(l),Lo.forEach(l),d=0;d<Un.length;d++)x=Un[d],x.blockedOn===a&&(x.blockedOn=null);for(;0<Un.length&&(d=Un[0],d.blockedOn===null);)ft(d),d.blockedOn===null&&Un.shift()}var mn=T.ReactCurrentBatchConfig,Oo=!0;function Jc(a,l,d,x){var w=At,N=mn.transition;mn.transition=null;try{At=1,ds(a,l,d,x)}finally{At=w,mn.transition=N}}function Na(a,l,d,x){var w=At,N=mn.transition;mn.transition=null;try{At=4,ds(a,l,d,x)}finally{At=w,mn.transition=N}}function ds(a,l,d,x){if(Oo){var w=bp(a,l,d,x);if(w===null)Ip(a,l,x,Qc,d),Q(a,x);else if(_e(w,a,l,d,x))x.stopPropagation();else if(Q(a,x),l&4&&-1<z.indexOf(a)){for(;w!==null;){var N=ml(w);if(N!==null&&ja(N),N=bp(a,l,d,x),N===null&&Ip(a,l,x,Qc,d),N===w)break;w=N}w!==null&&x.stopPropagation()}else Ip(a,l,x,null,d)}}var Qc=null;function bp(a,l,d,x){if(Qc=null,a=St(x),a=Io(a),a!==null)if(l=ht(a),l===null)a=null;else if(d=l.tag,d===13){if(a=zc(l),a!==null)return a;a=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;a=null}else l!==a&&(a=null);return Qc=a,null}function Ly(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(hp()){case Qi:return 1;case Wc:return 4;case Ks:case ya:return 16;case Kc:return 536870912;default:return 16}default:return 16}}var Ys=null,vp=null,Xc=null;function Oy(){if(Xc)return Xc;var a,l=vp,d=l.length,x,w="value"in Ys?Ys.value:Ys.textContent,N=w.length;for(a=0;a<d&&l[a]===w[a];a++);var O=d-a;for(x=1;x<=O&&l[d-x]===w[N-x];x++);return Xc=w.slice(a,1<x?1-x:void 0)}function Zc(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 eu(){return!0}function Iy(){return!1}function gr(a){function l(d,x,w,N,O){this._reactName=d,this._targetInst=w,this.type=x,this.nativeEvent=N,this.target=O,this.currentTarget=null;for(var W in a)a.hasOwnProperty(W)&&(d=a[W],this[W]=d?d(N):N[W]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?eu:Iy,this.isPropagationStopped=Iy,this}return L(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),l}var Ca={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wp=gr(Ca),rl=L({},Ca,{view:0,detail:0}),e2=gr(rl),jp,kp,sl,tu=L({},rl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Np,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!==sl&&(sl&&a.type==="mousemove"?(jp=a.screenX-sl.screenX,kp=a.screenY-sl.screenY):kp=jp=0,sl=a),jp)},movementY:function(a){return"movementY"in a?a.movementY:kp}}),_y=gr(tu),t2=L({},tu,{dataTransfer:0}),n2=gr(t2),r2=L({},rl,{relatedTarget:0}),Sp=gr(r2),s2=L({},Ca,{animationName:0,elapsedTime:0,pseudoElement:0}),o2=gr(s2),a2=L({},Ca,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),i2=gr(a2),l2=L({},Ca,{data:0}),My=gr(l2),c2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u2={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},d2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f2(a){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(a):(a=d2[a])?!!l[a]:!1}function Np(){return f2}var p2=L({},rl,{key:function(a){if(a.key){var l=c2[a.key]||a.key;if(l!=="Unidentified")return l}return a.type==="keypress"?(a=Zc(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?u2[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Np,charCode:function(a){return a.type==="keypress"?Zc(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Zc(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),m2=gr(p2),h2=L({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fy=gr(h2),g2=L({},rl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Np}),x2=gr(g2),y2=L({},Ca,{propertyName:0,elapsedTime:0,pseudoElement:0}),b2=gr(y2),v2=L({},tu,{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}),w2=gr(v2),j2=[9,13,27,32],Cp=u&&"CompositionEvent"in window,ol=null;u&&"documentMode"in document&&(ol=document.documentMode);var k2=u&&"TextEvent"in window&&!ol,zy=u&&(!Cp||ol&&8<ol&&11>=ol),By=" ",Uy=!1;function Vy(a,l){switch(a){case"keyup":return j2.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hy(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ea=!1;function S2(a,l){switch(a){case"compositionend":return Hy(l);case"keypress":return l.which!==32?null:(Uy=!0,By);case"textInput":return a=l.data,a===By&&Uy?null:a;default:return null}}function N2(a,l){if(Ea)return a==="compositionend"||!Cp&&Vy(a,l)?(a=Oy(),Xc=vp=Ys=null,Ea=!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 zy&&l.locale!=="ko"?null:l.data;default:return null}}var C2={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 Wy(a){var l=a&&a.nodeName&&a.nodeName.toLowerCase();return l==="input"?!!C2[a.type]:l==="textarea"}function Ky(a,l,d,x){Le(x),l=au(l,"onChange"),0<l.length&&(d=new wp("onChange","change",null,d,x),a.push({event:d,listeners:l}))}var al=null,il=null;function E2(a){ub(a,0)}function nu(a){var l=Da(a);if(ct(l))return a}function T2(a,l){if(a==="change")return l}var qy=!1;if(u){var Ep;if(u){var Tp="oninput"in document;if(!Tp){var Gy=document.createElement("div");Gy.setAttribute("oninput","return;"),Tp=typeof Gy.oninput=="function"}Ep=Tp}else Ep=!1;qy=Ep&&(!document.documentMode||9<document.documentMode)}function Yy(){al&&(al.detachEvent("onpropertychange",Jy),il=al=null)}function Jy(a){if(a.propertyName==="value"&&nu(il)){var l=[];Ky(l,il,a,St(a)),Zt(E2,l)}}function R2(a,l,d){a==="focusin"?(Yy(),al=l,il=d,al.attachEvent("onpropertychange",Jy)):a==="focusout"&&Yy()}function P2(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return nu(il)}function A2(a,l){if(a==="click")return nu(l)}function D2(a,l){if(a==="input"||a==="change")return nu(l)}function $2(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var Yr=typeof Object.is=="function"?Object.is:$2;function ll(a,l){if(Yr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var d=Object.keys(a),x=Object.keys(l);if(d.length!==x.length)return!1;for(x=0;x<d.length;x++){var w=d[x];if(!f.call(l,w)||!Yr(a[w],l[w]))return!1}return!0}function Qy(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function Xy(a,l){var d=Qy(a);a=0;for(var x;d;){if(d.nodeType===3){if(x=a+d.textContent.length,a<=l&&x>=l)return{node:d,offset:l-a};a=x}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Qy(d)}}function Zy(a,l){return a&&l?a===l?!0:a&&a.nodeType===3?!1:l&&l.nodeType===3?Zy(a,l.parentNode):"contains"in a?a.contains(l):a.compareDocumentPosition?!!(a.compareDocumentPosition(l)&16):!1:!1}function eb(){for(var a=window,l=et();l instanceof a.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)a=l.contentWindow;else break;l=et(a.document)}return l}function Rp(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 L2(a){var l=eb(),d=a.focusedElem,x=a.selectionRange;if(l!==d&&d&&d.ownerDocument&&Zy(d.ownerDocument.documentElement,d)){if(x!==null&&Rp(d)){if(l=x.start,a=x.end,a===void 0&&(a=l),"selectionStart"in d)d.selectionStart=l,d.selectionEnd=Math.min(a,d.value.length);else if(a=(l=d.ownerDocument||document)&&l.defaultView||window,a.getSelection){a=a.getSelection();var w=d.textContent.length,N=Math.min(x.start,w);x=x.end===void 0?N:Math.min(x.end,w),!a.extend&&N>x&&(w=x,x=N,N=w),w=Xy(d,N);var O=Xy(d,x);w&&O&&(a.rangeCount!==1||a.anchorNode!==w.node||a.anchorOffset!==w.offset||a.focusNode!==O.node||a.focusOffset!==O.offset)&&(l=l.createRange(),l.setStart(w.node,w.offset),a.removeAllRanges(),N>x?(a.addRange(l),a.extend(O.node,O.offset)):(l.setEnd(O.node,O.offset),a.addRange(l)))}}for(l=[],a=d;a=a.parentNode;)a.nodeType===1&&l.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<l.length;d++)a=l[d],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var O2=u&&"documentMode"in document&&11>=document.documentMode,Ta=null,Pp=null,cl=null,Ap=!1;function tb(a,l,d){var x=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Ap||Ta==null||Ta!==et(x)||(x=Ta,"selectionStart"in x&&Rp(x)?x={start:x.selectionStart,end:x.selectionEnd}:(x=(x.ownerDocument&&x.ownerDocument.defaultView||window).getSelection(),x={anchorNode:x.anchorNode,anchorOffset:x.anchorOffset,focusNode:x.focusNode,focusOffset:x.focusOffset}),cl&&ll(cl,x)||(cl=x,x=au(Pp,"onSelect"),0<x.length&&(l=new wp("onSelect","select",null,l,d),a.push({event:l,listeners:x}),l.target=Ta)))}function ru(a,l){var d={};return d[a.toLowerCase()]=l.toLowerCase(),d["Webkit"+a]="webkit"+l,d["Moz"+a]="moz"+l,d}var Ra={animationend:ru("Animation","AnimationEnd"),animationiteration:ru("Animation","AnimationIteration"),animationstart:ru("Animation","AnimationStart"),transitionend:ru("Transition","TransitionEnd")},Dp={},nb={};u&&(nb=document.createElement("div").style,"AnimationEvent"in window||(delete Ra.animationend.animation,delete Ra.animationiteration.animation,delete Ra.animationstart.animation),"TransitionEvent"in window||delete Ra.transitionend.transition);function su(a){if(Dp[a])return Dp[a];if(!Ra[a])return a;var l=Ra[a],d;for(d in l)if(l.hasOwnProperty(d)&&d in nb)return Dp[a]=l[d];return a}var rb=su("animationend"),sb=su("animationiteration"),ob=su("animationstart"),ab=su("transitionend"),ib=new Map,lb="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){ib.set(a,l),i(l,[a])}for(var $p=0;$p<lb.length;$p++){var Lp=lb[$p],I2=Lp.toLowerCase(),_2=Lp[0].toUpperCase()+Lp.slice(1);Js(I2,"on"+_2)}Js(rb,"onAnimationEnd"),Js(sb,"onAnimationIteration"),Js(ob,"onAnimationStart"),Js("dblclick","onDoubleClick"),Js("focusin","onFocus"),Js("focusout","onBlur"),Js(ab,"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 ul="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(" "),M2=new Set("cancel close invalid load scroll toggle".split(" ").concat(ul));function cb(a,l,d){var x=a.type||"unknown-event";a.currentTarget=d,Fc(x,l,void 0,a),a.currentTarget=null}function ub(a,l){l=(l&4)!==0;for(var d=0;d<a.length;d++){var x=a[d],w=x.event;x=x.listeners;e:{var N=void 0;if(l)for(var O=x.length-1;0<=O;O--){var W=x[O],J=W.instance,de=W.currentTarget;if(W=W.listener,J!==N&&w.isPropagationStopped())break e;cb(w,W,de),N=J}else for(O=0;O<x.length;O++){if(W=x[O],J=W.instance,de=W.currentTarget,W=W.listener,J!==N&&w.isPropagationStopped())break e;cb(w,W,de),N=J}}}if(bt)throw a=er,bt=!1,er=null,a}function Wt(a,l){var d=l[Up];d===void 0&&(d=l[Up]=new Set);var x=a+"__bubble";d.has(x)||(db(l,a,2,!1),d.add(x))}function Op(a,l,d){var x=0;l&&(x|=4),db(d,a,x,l)}var ou="_reactListening"+Math.random().toString(36).slice(2);function dl(a){if(!a[ou]){a[ou]=!0,s.forEach(function(d){d!=="selectionchange"&&(M2.has(d)||Op(d,!1,a),Op(d,!0,a))});var l=a.nodeType===9?a:a.ownerDocument;l===null||l[ou]||(l[ou]=!0,Op("selectionchange",!1,l))}}function db(a,l,d,x){switch(Ly(l)){case 1:var w=Jc;break;case 4:w=Na;break;default:w=ds}d=w.bind(null,l,d,a),w=void 0,!wn||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(w=!0),x?w!==void 0?a.addEventListener(l,d,{capture:!0,passive:w}):a.addEventListener(l,d,!0):w!==void 0?a.addEventListener(l,d,{passive:w}):a.addEventListener(l,d,!1)}function Ip(a,l,d,x,w){var N=x;if((l&1)===0&&(l&2)===0&&x!==null)e:for(;;){if(x===null)return;var O=x.tag;if(O===3||O===4){var W=x.stateNode.containerInfo;if(W===w||W.nodeType===8&&W.parentNode===w)break;if(O===4)for(O=x.return;O!==null;){var J=O.tag;if((J===3||J===4)&&(J=O.stateNode.containerInfo,J===w||J.nodeType===8&&J.parentNode===w))return;O=O.return}for(;W!==null;){if(O=Io(W),O===null)return;if(J=O.tag,J===5||J===6){x=N=O;continue e}W=W.parentNode}}x=x.return}Zt(function(){var de=N,ke=St(d),Ne=[];e:{var je=ib.get(a);if(je!==void 0){var Ve=wp,qe=a;switch(a){case"keypress":if(Zc(d)===0)break e;case"keydown":case"keyup":Ve=m2;break;case"focusin":qe="focus",Ve=Sp;break;case"focusout":qe="blur",Ve=Sp;break;case"beforeblur":case"afterblur":Ve=Sp;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ve=_y;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ve=n2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ve=x2;break;case rb:case sb:case ob:Ve=o2;break;case ab:Ve=b2;break;case"scroll":Ve=e2;break;case"wheel":Ve=w2;break;case"copy":case"cut":case"paste":Ve=i2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ve=Fy}var Je=(l&4)!==0,dn=!Je&&a==="scroll",ie=Je?je!==null?je+"Capture":null:je;Je=[];for(var ee=de,ce;ee!==null;){ce=ee;var Pe=ce.stateNode;if(ce.tag===5&&Pe!==null&&(ce=Pe,ie!==null&&(Pe=jt(ee,ie),Pe!=null&&Je.push(fl(ee,Pe,ce)))),dn)break;ee=ee.return}0<Je.length&&(je=new Ve(je,qe,null,d,ke),Ne.push({event:je,listeners:Je}))}}if((l&7)===0){e:{if(je=a==="mouseover"||a==="pointerover",Ve=a==="mouseout"||a==="pointerout",je&&d!==kt&&(qe=d.relatedTarget||d.fromElement)&&(Io(qe)||qe[Ts]))break e;if((Ve||je)&&(je=ke.window===ke?ke:(je=ke.ownerDocument)?je.defaultView||je.parentWindow:window,Ve?(qe=d.relatedTarget||d.toElement,Ve=de,qe=qe?Io(qe):null,qe!==null&&(dn=ht(qe),qe!==dn||qe.tag!==5&&qe.tag!==6)&&(qe=null)):(Ve=null,qe=de),Ve!==qe)){if(Je=_y,Pe="onMouseLeave",ie="onMouseEnter",ee="mouse",(a==="pointerout"||a==="pointerover")&&(Je=Fy,Pe="onPointerLeave",ie="onPointerEnter",ee="pointer"),dn=Ve==null?je:Da(Ve),ce=qe==null?je:Da(qe),je=new Je(Pe,ee+"leave",Ve,d,ke),je.target=dn,je.relatedTarget=ce,Pe=null,Io(ke)===de&&(Je=new Je(ie,ee+"enter",qe,d,ke),Je.target=ce,Je.relatedTarget=dn,Pe=Je),dn=Pe,Ve&&qe)t:{for(Je=Ve,ie=qe,ee=0,ce=Je;ce;ce=Pa(ce))ee++;for(ce=0,Pe=ie;Pe;Pe=Pa(Pe))ce++;for(;0<ee-ce;)Je=Pa(Je),ee--;for(;0<ce-ee;)ie=Pa(ie),ce--;for(;ee--;){if(Je===ie||ie!==null&&Je===ie.alternate)break t;Je=Pa(Je),ie=Pa(ie)}Je=null}else Je=null;Ve!==null&&fb(Ne,je,Ve,Je,!1),qe!==null&&dn!==null&&fb(Ne,dn,qe,Je,!0)}}e:{if(je=de?Da(de):window,Ve=je.nodeName&&je.nodeName.toLowerCase(),Ve==="select"||Ve==="input"&&je.type==="file")var Xe=T2;else if(Wy(je))if(qy)Xe=D2;else{Xe=P2;var rt=R2}else(Ve=je.nodeName)&&Ve.toLowerCase()==="input"&&(je.type==="checkbox"||je.type==="radio")&&(Xe=A2);if(Xe&&(Xe=Xe(a,de))){Ky(Ne,Xe,d,ke);break e}rt&&rt(a,je,de),a==="focusout"&&(rt=je._wrapperState)&&rt.controlled&&je.type==="number"&&Ye(je,"number",je.value)}switch(rt=de?Da(de):window,a){case"focusin":(Wy(rt)||rt.contentEditable==="true")&&(Ta=rt,Pp=de,cl=null);break;case"focusout":cl=Pp=Ta=null;break;case"mousedown":Ap=!0;break;case"contextmenu":case"mouseup":case"dragend":Ap=!1,tb(Ne,d,ke);break;case"selectionchange":if(O2)break;case"keydown":case"keyup":tb(Ne,d,ke)}var st;if(Cp)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 Ea?Vy(a,d)&&(it="onCompositionEnd"):a==="keydown"&&d.keyCode===229&&(it="onCompositionStart");it&&(zy&&d.locale!=="ko"&&(Ea||it!=="onCompositionStart"?it==="onCompositionEnd"&&Ea&&(st=Oy()):(Ys=ke,vp="value"in Ys?Ys.value:Ys.textContent,Ea=!0)),rt=au(de,it),0<rt.length&&(it=new My(it,a,null,d,ke),Ne.push({event:it,listeners:rt}),st?it.data=st:(st=Hy(d),st!==null&&(it.data=st)))),(st=k2?S2(a,d):N2(a,d))&&(de=au(de,"onBeforeInput"),0<de.length&&(ke=new My("onBeforeInput","beforeinput",null,d,ke),Ne.push({event:ke,listeners:de}),ke.data=st))}ub(Ne,l)})}function fl(a,l,d){return{instance:a,listener:l,currentTarget:d}}function au(a,l){for(var d=l+"Capture",x=[];a!==null;){var w=a,N=w.stateNode;w.tag===5&&N!==null&&(w=N,N=jt(a,d),N!=null&&x.unshift(fl(a,N,w)),N=jt(a,l),N!=null&&x.push(fl(a,N,w))),a=a.return}return x}function Pa(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5);return a||null}function fb(a,l,d,x,w){for(var N=l._reactName,O=[];d!==null&&d!==x;){var W=d,J=W.alternate,de=W.stateNode;if(J!==null&&J===x)break;W.tag===5&&de!==null&&(W=de,w?(J=jt(d,N),J!=null&&O.unshift(fl(d,J,W))):w||(J=jt(d,N),J!=null&&O.push(fl(d,J,W)))),d=d.return}O.length!==0&&a.push({event:l,listeners:O})}var F2=/\r\n?/g,z2=/\u0000|\uFFFD/g;function pb(a){return(typeof a=="string"?a:""+a).replace(F2,`
|
|
38
|
+
`).replace(z2,"")}function iu(a,l,d){if(l=pb(l),pb(a)!==l&&d)throw Error(n(425))}function lu(){}var _p=null,Mp=null;function Fp(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 zp=typeof setTimeout=="function"?setTimeout:void 0,B2=typeof clearTimeout=="function"?clearTimeout:void 0,mb=typeof Promise=="function"?Promise:void 0,U2=typeof queueMicrotask=="function"?queueMicrotask:typeof mb<"u"?function(a){return mb.resolve(null).then(a).catch(V2)}:zp;function V2(a){setTimeout(function(){throw a})}function Bp(a,l){var d=l,x=0;do{var w=d.nextSibling;if(a.removeChild(d),w&&w.nodeType===8)if(d=w.data,d==="/$"){if(x===0){a.removeChild(w),pn(l);return}x--}else d!=="$"&&d!=="$?"&&d!=="$!"||x++;d=w}while(d);pn(l)}function Qs(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 hb(a){a=a.previousSibling;for(var l=0;a;){if(a.nodeType===8){var d=a.data;if(d==="$"||d==="$!"||d==="$?"){if(l===0)return a;l--}else d==="/$"&&l++}a=a.previousSibling}return null}var Aa=Math.random().toString(36).slice(2),fs="__reactFiber$"+Aa,pl="__reactProps$"+Aa,Ts="__reactContainer$"+Aa,Up="__reactEvents$"+Aa,H2="__reactListeners$"+Aa,W2="__reactHandles$"+Aa;function Io(a){var l=a[fs];if(l)return l;for(var d=a.parentNode;d;){if(l=d[Ts]||d[fs]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(a=hb(a);a!==null;){if(d=a[fs])return d;a=hb(a)}return l}a=d,d=a.parentNode}return null}function ml(a){return a=a[fs]||a[Ts],!a||a.tag!==5&&a.tag!==6&&a.tag!==13&&a.tag!==3?null:a}function Da(a){if(a.tag===5||a.tag===6)return a.stateNode;throw Error(n(33))}function cu(a){return a[pl]||null}var Vp=[],$a=-1;function Xs(a){return{current:a}}function Kt(a){0>$a||(a.current=Vp[$a],Vp[$a]=null,$a--)}function Ut(a,l){$a++,Vp[$a]=a.current,a.current=l}var Zs={},Vn=Xs(Zs),tr=Xs(!1),_o=Zs;function La(a,l){var d=a.type.contextTypes;if(!d)return Zs;var x=a.stateNode;if(x&&x.__reactInternalMemoizedUnmaskedChildContext===l)return x.__reactInternalMemoizedMaskedChildContext;var w={},N;for(N in d)w[N]=l[N];return x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=w),w}function nr(a){return a=a.childContextTypes,a!=null}function uu(){Kt(tr),Kt(Vn)}function gb(a,l,d){if(Vn.current!==Zs)throw Error(n(168));Ut(Vn,l),Ut(tr,d)}function xb(a,l,d){var x=a.stateNode;if(l=l.childContextTypes,typeof x.getChildContext!="function")return d;x=x.getChildContext();for(var w in x)if(!(w in l))throw Error(n(108,ye(a)||"Unknown",w));return L({},d,x)}function du(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Zs,_o=Vn.current,Ut(Vn,a),Ut(tr,tr.current),!0}function yb(a,l,d){var x=a.stateNode;if(!x)throw Error(n(169));d?(a=xb(a,l,_o),x.__reactInternalMemoizedMergedChildContext=a,Kt(tr),Kt(Vn),Ut(Vn,a)):Kt(tr),Ut(tr,d)}var Rs=null,fu=!1,Hp=!1;function bb(a){Rs===null?Rs=[a]:Rs.push(a)}function K2(a){fu=!0,bb(a)}function eo(){if(!Hp&&Rs!==null){Hp=!0;var a=0,l=At;try{var d=Rs;for(At=1;a<d.length;a++){var x=d[a];do x=x(!0);while(x!==null)}Rs=null,fu=!1}catch(w){throw Rs!==null&&(Rs=Rs.slice(a+1)),Vc(Qi,eo),w}finally{At=l,Hp=!1}}return null}var Oa=[],Ia=0,pu=null,mu=0,Ar=[],Dr=0,Mo=null,Ps=1,As="";function Fo(a,l){Oa[Ia++]=mu,Oa[Ia++]=pu,pu=a,mu=l}function vb(a,l,d){Ar[Dr++]=Ps,Ar[Dr++]=As,Ar[Dr++]=Mo,Mo=a;var x=Ps;a=As;var w=32-Bn(x)-1;x&=~(1<<w),d+=1;var N=32-Bn(l)+w;if(30<N){var O=w-w%5;N=(x&(1<<O)-1).toString(32),x>>=O,w-=O,Ps=1<<32-Bn(l)+w|d<<w|x,As=N+a}else Ps=1<<N|d<<w|x,As=a}function Wp(a){a.return!==null&&(Fo(a,1),vb(a,1,0))}function Kp(a){for(;a===pu;)pu=Oa[--Ia],Oa[Ia]=null,mu=Oa[--Ia],Oa[Ia]=null;for(;a===Mo;)Mo=Ar[--Dr],Ar[Dr]=null,As=Ar[--Dr],Ar[Dr]=null,Ps=Ar[--Dr],Ar[Dr]=null}var xr=null,yr=null,Qt=!1,Jr=null;function wb(a,l){var d=Ir(5,null,null,0);d.elementType="DELETED",d.stateNode=l,d.return=a,l=a.deletions,l===null?(a.deletions=[d],a.flags|=16):l.push(d)}function jb(a,l){switch(a.tag){case 5:var d=a.type;return l=l.nodeType!==1||d.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(a.stateNode=l,xr=a,yr=Qs(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?(d=Mo!==null?{id:Ps,overflow:As}:null,a.memoizedState={dehydrated:l,treeContext:d,retryLane:1073741824},d=Ir(18,null,null,0),d.stateNode=l,d.return=a,a.child=d,xr=a,yr=null,!0):!1;default:return!1}}function qp(a){return(a.mode&1)!==0&&(a.flags&128)===0}function Gp(a){if(Qt){var l=yr;if(l){var d=l;if(!jb(a,l)){if(qp(a))throw Error(n(418));l=Qs(d.nextSibling);var x=xr;l&&jb(a,l)?wb(x,d):(a.flags=a.flags&-4097|2,Qt=!1,xr=a)}}else{if(qp(a))throw Error(n(418));a.flags=a.flags&-4097|2,Qt=!1,xr=a}}}function kb(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;xr=a}function hu(a){if(a!==xr)return!1;if(!Qt)return kb(a),Qt=!0,!1;var l;if((l=a.tag!==3)&&!(l=a.tag!==5)&&(l=a.type,l=l!=="head"&&l!=="body"&&!Fp(a.type,a.memoizedProps)),l&&(l=yr)){if(qp(a))throw Sb(),Error(n(418));for(;l;)wb(a,l),l=Qs(l.nextSibling)}if(kb(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 d=a.data;if(d==="/$"){if(l===0){yr=Qs(a.nextSibling);break e}l--}else d!=="$"&&d!=="$!"&&d!=="$?"||l++}a=a.nextSibling}yr=null}}else yr=xr?Qs(a.stateNode.nextSibling):null;return!0}function Sb(){for(var a=yr;a;)a=Qs(a.nextSibling)}function _a(){yr=xr=null,Qt=!1}function Yp(a){Jr===null?Jr=[a]:Jr.push(a)}var q2=T.ReactCurrentBatchConfig;function hl(a,l,d){if(a=d.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var x=d.stateNode}if(!x)throw Error(n(147,a));var w=x,N=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===N?l.ref:(l=function(O){var W=w.refs;O===null?delete W[N]:W[N]=O},l._stringRef=N,l)}if(typeof a!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,a))}return a}function gu(a,l){throw a=Object.prototype.toString.call(l),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function Nb(a){var l=a._init;return l(a._payload)}function Cb(a){function l(ie,ee){if(a){var ce=ie.deletions;ce===null?(ie.deletions=[ee],ie.flags|=16):ce.push(ee)}}function d(ie,ee){if(!a)return null;for(;ee!==null;)l(ie,ee),ee=ee.sibling;return null}function x(ie,ee){for(ie=new Map;ee!==null;)ee.key!==null?ie.set(ee.key,ee):ie.set(ee.index,ee),ee=ee.sibling;return ie}function w(ie,ee){return ie=lo(ie,ee),ie.index=0,ie.sibling=null,ie}function N(ie,ee,ce){return ie.index=ce,a?(ce=ie.alternate,ce!==null?(ce=ce.index,ce<ee?(ie.flags|=2,ee):ce):(ie.flags|=2,ee)):(ie.flags|=1048576,ee)}function O(ie){return a&&ie.alternate===null&&(ie.flags|=2),ie}function W(ie,ee,ce,Pe){return ee===null||ee.tag!==6?(ee=zm(ce,ie.mode,Pe),ee.return=ie,ee):(ee=w(ee,ce),ee.return=ie,ee)}function J(ie,ee,ce,Pe){var Xe=ce.type;return Xe===P?ke(ie,ee,ce.props.children,Pe,ce.key):ee!==null&&(ee.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===q&&Nb(Xe)===ee.type)?(Pe=w(ee,ce.props),Pe.ref=hl(ie,ee,ce),Pe.return=ie,Pe):(Pe=zu(ce.type,ce.key,ce.props,null,ie.mode,Pe),Pe.ref=hl(ie,ee,ce),Pe.return=ie,Pe)}function de(ie,ee,ce,Pe){return ee===null||ee.tag!==4||ee.stateNode.containerInfo!==ce.containerInfo||ee.stateNode.implementation!==ce.implementation?(ee=Bm(ce,ie.mode,Pe),ee.return=ie,ee):(ee=w(ee,ce.children||[]),ee.return=ie,ee)}function ke(ie,ee,ce,Pe,Xe){return ee===null||ee.tag!==7?(ee=qo(ce,ie.mode,Pe,Xe),ee.return=ie,ee):(ee=w(ee,ce),ee.return=ie,ee)}function Ne(ie,ee,ce){if(typeof ee=="string"&&ee!==""||typeof ee=="number")return ee=zm(""+ee,ie.mode,ce),ee.return=ie,ee;if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case A:return ce=zu(ee.type,ee.key,ee.props,null,ie.mode,ce),ce.ref=hl(ie,null,ee),ce.return=ie,ce;case R:return ee=Bm(ee,ie.mode,ce),ee.return=ie,ee;case q:var Pe=ee._init;return Ne(ie,Pe(ee._payload),ce)}if(Fe(ee)||G(ee))return ee=qo(ee,ie.mode,ce,null),ee.return=ie,ee;gu(ie,ee)}return null}function je(ie,ee,ce,Pe){var Xe=ee!==null?ee.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Xe!==null?null:W(ie,ee,""+ce,Pe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:return ce.key===Xe?J(ie,ee,ce,Pe):null;case R:return ce.key===Xe?de(ie,ee,ce,Pe):null;case q:return Xe=ce._init,je(ie,ee,Xe(ce._payload),Pe)}if(Fe(ce)||G(ce))return Xe!==null?null:ke(ie,ee,ce,Pe,null);gu(ie,ce)}return null}function Ve(ie,ee,ce,Pe,Xe){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number")return ie=ie.get(ce)||null,W(ee,ie,""+Pe,Xe);if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case A:return ie=ie.get(Pe.key===null?ce:Pe.key)||null,J(ee,ie,Pe,Xe);case R:return ie=ie.get(Pe.key===null?ce:Pe.key)||null,de(ee,ie,Pe,Xe);case q:var rt=Pe._init;return Ve(ie,ee,ce,rt(Pe._payload),Xe)}if(Fe(Pe)||G(Pe))return ie=ie.get(ce)||null,ke(ee,ie,Pe,Xe,null);gu(ee,Pe)}return null}function qe(ie,ee,ce,Pe){for(var Xe=null,rt=null,st=ee,it=ee=0,An=null;st!==null&&it<ce.length;it++){st.index>it?(An=st,st=null):An=st.sibling;var Pt=je(ie,st,ce[it],Pe);if(Pt===null){st===null&&(st=An);break}a&&st&&Pt.alternate===null&&l(ie,st),ee=N(Pt,ee,it),rt===null?Xe=Pt:rt.sibling=Pt,rt=Pt,st=An}if(it===ce.length)return d(ie,st),Qt&&Fo(ie,it),Xe;if(st===null){for(;it<ce.length;it++)st=Ne(ie,ce[it],Pe),st!==null&&(ee=N(st,ee,it),rt===null?Xe=st:rt.sibling=st,rt=st);return Qt&&Fo(ie,it),Xe}for(st=x(ie,st);it<ce.length;it++)An=Ve(st,ie,it,ce[it],Pe),An!==null&&(a&&An.alternate!==null&&st.delete(An.key===null?it:An.key),ee=N(An,ee,it),rt===null?Xe=An:rt.sibling=An,rt=An);return a&&st.forEach(function(co){return l(ie,co)}),Qt&&Fo(ie,it),Xe}function Je(ie,ee,ce,Pe){var Xe=G(ce);if(typeof Xe!="function")throw Error(n(150));if(ce=Xe.call(ce),ce==null)throw Error(n(151));for(var rt=Xe=null,st=ee,it=ee=0,An=null,Pt=ce.next();st!==null&&!Pt.done;it++,Pt=ce.next()){st.index>it?(An=st,st=null):An=st.sibling;var co=je(ie,st,Pt.value,Pe);if(co===null){st===null&&(st=An);break}a&&st&&co.alternate===null&&l(ie,st),ee=N(co,ee,it),rt===null?Xe=co:rt.sibling=co,rt=co,st=An}if(Pt.done)return d(ie,st),Qt&&Fo(ie,it),Xe;if(st===null){for(;!Pt.done;it++,Pt=ce.next())Pt=Ne(ie,Pt.value,Pe),Pt!==null&&(ee=N(Pt,ee,it),rt===null?Xe=Pt:rt.sibling=Pt,rt=Pt);return Qt&&Fo(ie,it),Xe}for(st=x(ie,st);!Pt.done;it++,Pt=ce.next())Pt=Ve(st,ie,it,Pt.value,Pe),Pt!==null&&(a&&Pt.alternate!==null&&st.delete(Pt.key===null?it:Pt.key),ee=N(Pt,ee,it),rt===null?Xe=Pt:rt.sibling=Pt,rt=Pt);return a&&st.forEach(function(CT){return l(ie,CT)}),Qt&&Fo(ie,it),Xe}function dn(ie,ee,ce,Pe){if(typeof ce=="object"&&ce!==null&&ce.type===P&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:e:{for(var Xe=ce.key,rt=ee;rt!==null;){if(rt.key===Xe){if(Xe=ce.type,Xe===P){if(rt.tag===7){d(ie,rt.sibling),ee=w(rt,ce.props.children),ee.return=ie,ie=ee;break e}}else if(rt.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===q&&Nb(Xe)===rt.type){d(ie,rt.sibling),ee=w(rt,ce.props),ee.ref=hl(ie,rt,ce),ee.return=ie,ie=ee;break e}d(ie,rt);break}else l(ie,rt);rt=rt.sibling}ce.type===P?(ee=qo(ce.props.children,ie.mode,Pe,ce.key),ee.return=ie,ie=ee):(Pe=zu(ce.type,ce.key,ce.props,null,ie.mode,Pe),Pe.ref=hl(ie,ee,ce),Pe.return=ie,ie=Pe)}return O(ie);case R:e:{for(rt=ce.key;ee!==null;){if(ee.key===rt)if(ee.tag===4&&ee.stateNode.containerInfo===ce.containerInfo&&ee.stateNode.implementation===ce.implementation){d(ie,ee.sibling),ee=w(ee,ce.children||[]),ee.return=ie,ie=ee;break e}else{d(ie,ee);break}else l(ie,ee);ee=ee.sibling}ee=Bm(ce,ie.mode,Pe),ee.return=ie,ie=ee}return O(ie);case q:return rt=ce._init,dn(ie,ee,rt(ce._payload),Pe)}if(Fe(ce))return qe(ie,ee,ce,Pe);if(G(ce))return Je(ie,ee,ce,Pe);gu(ie,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,ee!==null&&ee.tag===6?(d(ie,ee.sibling),ee=w(ee,ce),ee.return=ie,ie=ee):(d(ie,ee),ee=zm(ce,ie.mode,Pe),ee.return=ie,ie=ee),O(ie)):d(ie,ee)}return dn}var Ma=Cb(!0),Eb=Cb(!1),xu=Xs(null),yu=null,Fa=null,Jp=null;function Qp(){Jp=Fa=yu=null}function Xp(a){var l=xu.current;Kt(xu),a._currentValue=l}function Zp(a,l,d){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===d)break;a=a.return}}function za(a,l){yu=a,Jp=Fa=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&l)!==0&&(rr=!0),a.firstContext=null)}function $r(a){var l=a._currentValue;if(Jp!==a)if(a={context:a,memoizedValue:l,next:null},Fa===null){if(yu===null)throw Error(n(308));Fa=a,yu.dependencies={lanes:0,firstContext:a}}else Fa=Fa.next=a;return l}var zo=null;function em(a){zo===null?zo=[a]:zo.push(a)}function Tb(a,l,d,x){var w=l.interleaved;return w===null?(d.next=d,em(l)):(d.next=w.next,w.next=d),l.interleaved=d,Ds(a,x)}function Ds(a,l){a.lanes|=l;var d=a.alternate;for(d!==null&&(d.lanes|=l),d=a,a=a.return;a!==null;)a.childLanes|=l,d=a.alternate,d!==null&&(d.childLanes|=l),d=a,a=a.return;return d.tag===3?d.stateNode:null}var to=!1;function tm(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Rb(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 $s(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function no(a,l,d){var x=a.updateQueue;if(x===null)return null;if(x=x.shared,(Ct&2)!==0){var w=x.pending;return w===null?l.next=l:(l.next=w.next,w.next=l),x.pending=l,Ds(a,d)}return w=x.interleaved,w===null?(l.next=l,em(x)):(l.next=w.next,w.next=l),x.interleaved=l,Ds(a,d)}function bu(a,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194240)!==0)){var x=l.lanes;x&=a.pendingLanes,d|=x,l.lanes=d,el(a,d)}}function Pb(a,l){var d=a.updateQueue,x=a.alternate;if(x!==null&&(x=x.updateQueue,d===x)){var w=null,N=null;if(d=d.firstBaseUpdate,d!==null){do{var O={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};N===null?w=N=O:N=N.next=O,d=d.next}while(d!==null);N===null?w=N=l:N=N.next=l}else w=N=l;d={baseState:x.baseState,firstBaseUpdate:w,lastBaseUpdate:N,shared:x.shared,effects:x.effects},a.updateQueue=d;return}a=d.lastBaseUpdate,a===null?d.firstBaseUpdate=l:a.next=l,d.lastBaseUpdate=l}function vu(a,l,d,x){var w=a.updateQueue;to=!1;var N=w.firstBaseUpdate,O=w.lastBaseUpdate,W=w.shared.pending;if(W!==null){w.shared.pending=null;var J=W,de=J.next;J.next=null,O===null?N=de:O.next=de,O=J;var ke=a.alternate;ke!==null&&(ke=ke.updateQueue,W=ke.lastBaseUpdate,W!==O&&(W===null?ke.firstBaseUpdate=de:W.next=de,ke.lastBaseUpdate=J))}if(N!==null){var Ne=w.baseState;O=0,ke=de=J=null,W=N;do{var je=W.lane,Ve=W.eventTime;if((x&je)===je){ke!==null&&(ke=ke.next={eventTime:Ve,lane:0,tag:W.tag,payload:W.payload,callback:W.callback,next:null});e:{var qe=a,Je=W;switch(je=l,Ve=d,Je.tag){case 1:if(qe=Je.payload,typeof qe=="function"){Ne=qe.call(Ve,Ne,je);break e}Ne=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=Je.payload,je=typeof qe=="function"?qe.call(Ve,Ne,je):qe,je==null)break e;Ne=L({},Ne,je);break e;case 2:to=!0}}W.callback!==null&&W.lane!==0&&(a.flags|=64,je=w.effects,je===null?w.effects=[W]:je.push(W))}else Ve={eventTime:Ve,lane:je,tag:W.tag,payload:W.payload,callback:W.callback,next:null},ke===null?(de=ke=Ve,J=Ne):ke=ke.next=Ve,O|=je;if(W=W.next,W===null){if(W=w.shared.pending,W===null)break;je=W,W=je.next,je.next=null,w.lastBaseUpdate=je,w.shared.pending=null}}while(!0);if(ke===null&&(J=Ne),w.baseState=J,w.firstBaseUpdate=de,w.lastBaseUpdate=ke,l=w.shared.interleaved,l!==null){w=l;do O|=w.lane,w=w.next;while(w!==l)}else N===null&&(w.shared.lanes=0);Vo|=O,a.lanes=O,a.memoizedState=Ne}}function Ab(a,l,d){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var x=a[l],w=x.callback;if(w!==null){if(x.callback=null,x=d,typeof w!="function")throw Error(n(191,w));w.call(x)}}}var gl={},ps=Xs(gl),xl=Xs(gl),yl=Xs(gl);function Bo(a){if(a===gl)throw Error(n(174));return a}function nm(a,l){switch(Ut(yl,l),Ut(xl,a),Ut(ps,gl),a=l.nodeType,a){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Y(null,"");break;default:a=a===8?l.parentNode:l,l=a.namespaceURI||null,a=a.tagName,l=Y(l,a)}Kt(ps),Ut(ps,l)}function Ba(){Kt(ps),Kt(xl),Kt(yl)}function Db(a){Bo(yl.current);var l=Bo(ps.current),d=Y(l,a.type);l!==d&&(Ut(xl,a),Ut(ps,d))}function rm(a){xl.current===a&&(Kt(ps),Kt(xl))}var tn=Xs(0);function wu(a){for(var l=a;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.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 sm=[];function om(){for(var a=0;a<sm.length;a++)sm[a]._workInProgressVersionPrimary=null;sm.length=0}var ju=T.ReactCurrentDispatcher,am=T.ReactCurrentBatchConfig,Uo=0,nn=null,jn=null,Rn=null,ku=!1,bl=!1,vl=0,G2=0;function Hn(){throw Error(n(321))}function im(a,l){if(l===null)return!1;for(var d=0;d<l.length&&d<a.length;d++)if(!Yr(a[d],l[d]))return!1;return!0}function lm(a,l,d,x,w,N){if(Uo=N,nn=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,ju.current=a===null||a.memoizedState===null?X2:Z2,a=d(x,w),bl){N=0;do{if(bl=!1,vl=0,25<=N)throw Error(n(301));N+=1,Rn=jn=null,l.updateQueue=null,ju.current=eT,a=d(x,w)}while(bl)}if(ju.current=Cu,l=jn!==null&&jn.next!==null,Uo=0,Rn=jn=nn=null,ku=!1,l)throw Error(n(300));return a}function cm(){var a=vl!==0;return vl=0,a}function ms(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Rn===null?nn.memoizedState=Rn=a:Rn=Rn.next=a,Rn}function Lr(){if(jn===null){var a=nn.alternate;a=a!==null?a.memoizedState:null}else a=jn.next;var l=Rn===null?nn.memoizedState:Rn.next;if(l!==null)Rn=l,jn=a;else{if(a===null)throw Error(n(310));jn=a,a={memoizedState:jn.memoizedState,baseState:jn.baseState,baseQueue:jn.baseQueue,queue:jn.queue,next:null},Rn===null?nn.memoizedState=Rn=a:Rn=Rn.next=a}return Rn}function wl(a,l){return typeof l=="function"?l(a):l}function um(a){var l=Lr(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=a;var x=jn,w=x.baseQueue,N=d.pending;if(N!==null){if(w!==null){var O=w.next;w.next=N.next,N.next=O}x.baseQueue=w=N,d.pending=null}if(w!==null){N=w.next,x=x.baseState;var W=O=null,J=null,de=N;do{var ke=de.lane;if((Uo&ke)===ke)J!==null&&(J=J.next={lane:0,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),x=de.hasEagerState?de.eagerState:a(x,de.action);else{var Ne={lane:ke,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null};J===null?(W=J=Ne,O=x):J=J.next=Ne,nn.lanes|=ke,Vo|=ke}de=de.next}while(de!==null&&de!==N);J===null?O=x:J.next=W,Yr(x,l.memoizedState)||(rr=!0),l.memoizedState=x,l.baseState=O,l.baseQueue=J,d.lastRenderedState=x}if(a=d.interleaved,a!==null){w=a;do N=w.lane,nn.lanes|=N,Vo|=N,w=w.next;while(w!==a)}else w===null&&(d.lanes=0);return[l.memoizedState,d.dispatch]}function dm(a){var l=Lr(),d=l.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=a;var x=d.dispatch,w=d.pending,N=l.memoizedState;if(w!==null){d.pending=null;var O=w=w.next;do N=a(N,O.action),O=O.next;while(O!==w);Yr(N,l.memoizedState)||(rr=!0),l.memoizedState=N,l.baseQueue===null&&(l.baseState=N),d.lastRenderedState=N}return[N,x]}function $b(){}function Lb(a,l){var d=nn,x=Lr(),w=l(),N=!Yr(x.memoizedState,w);if(N&&(x.memoizedState=w,rr=!0),x=x.queue,fm(_b.bind(null,d,x,a),[a]),x.getSnapshot!==l||N||Rn!==null&&Rn.memoizedState.tag&1){if(d.flags|=2048,jl(9,Ib.bind(null,d,x,w,l),void 0,null),Pn===null)throw Error(n(349));(Uo&30)!==0||Ob(d,l,w)}return w}function Ob(a,l,d){a.flags|=16384,a={getSnapshot:l,value:d},l=nn.updateQueue,l===null?(l={lastEffect:null,stores:null},nn.updateQueue=l,l.stores=[a]):(d=l.stores,d===null?l.stores=[a]:d.push(a))}function Ib(a,l,d,x){l.value=d,l.getSnapshot=x,Mb(l)&&Fb(a)}function _b(a,l,d){return d(function(){Mb(l)&&Fb(a)})}function Mb(a){var l=a.getSnapshot;a=a.value;try{var d=l();return!Yr(a,d)}catch{return!0}}function Fb(a){var l=Ds(a,1);l!==null&&es(l,a,1,-1)}function zb(a){var l=ms();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:wl,lastRenderedState:a},l.queue=a,a=a.dispatch=Q2.bind(null,nn,a),[l.memoizedState,a]}function jl(a,l,d,x){return a={tag:a,create:l,destroy:d,deps:x,next:null},l=nn.updateQueue,l===null?(l={lastEffect:null,stores:null},nn.updateQueue=l,l.lastEffect=a.next=a):(d=l.lastEffect,d===null?l.lastEffect=a.next=a:(x=d.next,d.next=a,a.next=x,l.lastEffect=a)),a}function Bb(){return Lr().memoizedState}function Su(a,l,d,x){var w=ms();nn.flags|=a,w.memoizedState=jl(1|l,d,void 0,x===void 0?null:x)}function Nu(a,l,d,x){var w=Lr();x=x===void 0?null:x;var N=void 0;if(jn!==null){var O=jn.memoizedState;if(N=O.destroy,x!==null&&im(x,O.deps)){w.memoizedState=jl(l,d,N,x);return}}nn.flags|=a,w.memoizedState=jl(1|l,d,N,x)}function Ub(a,l){return Su(8390656,8,a,l)}function fm(a,l){return Nu(2048,8,a,l)}function Vb(a,l){return Nu(4,2,a,l)}function Hb(a,l){return Nu(4,4,a,l)}function Wb(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 Kb(a,l,d){return d=d!=null?d.concat([a]):null,Nu(4,4,Wb.bind(null,l,a),d)}function pm(){}function qb(a,l){var d=Lr();l=l===void 0?null:l;var x=d.memoizedState;return x!==null&&l!==null&&im(l,x[1])?x[0]:(d.memoizedState=[a,l],a)}function Gb(a,l){var d=Lr();l=l===void 0?null:l;var x=d.memoizedState;return x!==null&&l!==null&&im(l,x[1])?x[0]:(a=a(),d.memoizedState=[a,l],a)}function Yb(a,l,d){return(Uo&21)===0?(a.baseState&&(a.baseState=!1,rr=!0),a.memoizedState=d):(Yr(d,l)||(d=Xi(),nn.lanes|=d,Vo|=d,a.baseState=!0),l)}function Y2(a,l){var d=At;At=d!==0&&4>d?d:4,a(!0);var x=am.transition;am.transition={};try{a(!1),l()}finally{At=d,am.transition=x}}function Jb(){return Lr().memoizedState}function J2(a,l,d){var x=ao(a);if(d={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null},Qb(a))Xb(l,d);else if(d=Tb(a,l,d,x),d!==null){var w=Qn();es(d,a,x,w),Zb(d,l,x)}}function Q2(a,l,d){var x=ao(a),w={lane:x,action:d,hasEagerState:!1,eagerState:null,next:null};if(Qb(a))Xb(l,w);else{var N=a.alternate;if(a.lanes===0&&(N===null||N.lanes===0)&&(N=l.lastRenderedReducer,N!==null))try{var O=l.lastRenderedState,W=N(O,d);if(w.hasEagerState=!0,w.eagerState=W,Yr(W,O)){var J=l.interleaved;J===null?(w.next=w,em(l)):(w.next=J.next,J.next=w),l.interleaved=w;return}}catch{}finally{}d=Tb(a,l,w,x),d!==null&&(w=Qn(),es(d,a,x,w),Zb(d,l,x))}}function Qb(a){var l=a.alternate;return a===nn||l!==null&&l===nn}function Xb(a,l){bl=ku=!0;var d=a.pending;d===null?l.next=l:(l.next=d.next,d.next=l),a.pending=l}function Zb(a,l,d){if((d&4194240)!==0){var x=l.lanes;x&=a.pendingLanes,d|=x,l.lanes=d,el(a,d)}}var Cu={readContext:$r,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useInsertionEffect:Hn,useLayoutEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useMutableSource:Hn,useSyncExternalStore:Hn,useId:Hn,unstable_isNewReconciler:!1},X2={readContext:$r,useCallback:function(a,l){return ms().memoizedState=[a,l===void 0?null:l],a},useContext:$r,useEffect:Ub,useImperativeHandle:function(a,l,d){return d=d!=null?d.concat([a]):null,Su(4194308,4,Wb.bind(null,l,a),d)},useLayoutEffect:function(a,l){return Su(4194308,4,a,l)},useInsertionEffect:function(a,l){return Su(4,2,a,l)},useMemo:function(a,l){var d=ms();return l=l===void 0?null:l,a=a(),d.memoizedState=[a,l],a},useReducer:function(a,l,d){var x=ms();return l=d!==void 0?d(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=J2.bind(null,nn,a),[x.memoizedState,a]},useRef:function(a){var l=ms();return a={current:a},l.memoizedState=a},useState:zb,useDebugValue:pm,useDeferredValue:function(a){return ms().memoizedState=a},useTransition:function(){var a=zb(!1),l=a[0];return a=Y2.bind(null,a[1]),ms().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,d){var x=nn,w=ms();if(Qt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=l(),Pn===null)throw Error(n(349));(Uo&30)!==0||Ob(x,l,d)}w.memoizedState=d;var N={value:d,getSnapshot:l};return w.queue=N,Ub(_b.bind(null,x,N,a),[a]),x.flags|=2048,jl(9,Ib.bind(null,x,N,d,l),void 0,null),d},useId:function(){var a=ms(),l=Pn.identifierPrefix;if(Qt){var d=As,x=Ps;d=(x&~(1<<32-Bn(x)-1)).toString(32)+d,l=":"+l+"R"+d,d=vl++,0<d&&(l+="H"+d.toString(32)),l+=":"}else d=G2++,l=":"+l+"r"+d.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},Z2={readContext:$r,useCallback:qb,useContext:$r,useEffect:fm,useImperativeHandle:Kb,useInsertionEffect:Vb,useLayoutEffect:Hb,useMemo:Gb,useReducer:um,useRef:Bb,useState:function(){return um(wl)},useDebugValue:pm,useDeferredValue:function(a){var l=Lr();return Yb(l,jn.memoizedState,a)},useTransition:function(){var a=um(wl)[0],l=Lr().memoizedState;return[a,l]},useMutableSource:$b,useSyncExternalStore:Lb,useId:Jb,unstable_isNewReconciler:!1},eT={readContext:$r,useCallback:qb,useContext:$r,useEffect:fm,useImperativeHandle:Kb,useInsertionEffect:Vb,useLayoutEffect:Hb,useMemo:Gb,useReducer:dm,useRef:Bb,useState:function(){return dm(wl)},useDebugValue:pm,useDeferredValue:function(a){var l=Lr();return jn===null?l.memoizedState=a:Yb(l,jn.memoizedState,a)},useTransition:function(){var a=dm(wl)[0],l=Lr().memoizedState;return[a,l]},useMutableSource:$b,useSyncExternalStore:Lb,useId:Jb,unstable_isNewReconciler:!1};function Qr(a,l){if(a&&a.defaultProps){l=L({},l),a=a.defaultProps;for(var d in a)l[d]===void 0&&(l[d]=a[d]);return l}return l}function mm(a,l,d,x){l=a.memoizedState,d=d(x,l),d=d==null?l:L({},l,d),a.memoizedState=d,a.lanes===0&&(a.updateQueue.baseState=d)}var Eu={isMounted:function(a){return(a=a._reactInternals)?ht(a)===a:!1},enqueueSetState:function(a,l,d){a=a._reactInternals;var x=Qn(),w=ao(a),N=$s(x,w);N.payload=l,d!=null&&(N.callback=d),l=no(a,N,w),l!==null&&(es(l,a,w,x),bu(l,a,w))},enqueueReplaceState:function(a,l,d){a=a._reactInternals;var x=Qn(),w=ao(a),N=$s(x,w);N.tag=1,N.payload=l,d!=null&&(N.callback=d),l=no(a,N,w),l!==null&&(es(l,a,w,x),bu(l,a,w))},enqueueForceUpdate:function(a,l){a=a._reactInternals;var d=Qn(),x=ao(a),w=$s(d,x);w.tag=2,l!=null&&(w.callback=l),l=no(a,w,x),l!==null&&(es(l,a,x,d),bu(l,a,x))}};function ev(a,l,d,x,w,N,O){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(x,N,O):l.prototype&&l.prototype.isPureReactComponent?!ll(d,x)||!ll(w,N):!0}function tv(a,l,d){var x=!1,w=Zs,N=l.contextType;return typeof N=="object"&&N!==null?N=$r(N):(w=nr(l)?_o:Vn.current,x=l.contextTypes,N=(x=x!=null)?La(a,w):Zs),l=new l(d,N),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Eu,a.stateNode=l,l._reactInternals=a,x&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=w,a.__reactInternalMemoizedMaskedChildContext=N),l}function nv(a,l,d,x){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,x),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,x),l.state!==a&&Eu.enqueueReplaceState(l,l.state,null)}function hm(a,l,d,x){var w=a.stateNode;w.props=d,w.state=a.memoizedState,w.refs={},tm(a);var N=l.contextType;typeof N=="object"&&N!==null?w.context=$r(N):(N=nr(l)?_o:Vn.current,w.context=La(a,N)),w.state=a.memoizedState,N=l.getDerivedStateFromProps,typeof N=="function"&&(mm(a,l,N,d),w.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(l=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),l!==w.state&&Eu.enqueueReplaceState(w,w.state,null),vu(a,d,w,x),w.state=a.memoizedState),typeof w.componentDidMount=="function"&&(a.flags|=4194308)}function Ua(a,l){try{var d="",x=l;do d+=ge(x),x=x.return;while(x);var w=d}catch(N){w=`
|
|
39
|
+
Error generating stack: `+N.message+`
|
|
40
|
+
`+N.stack}return{value:a,source:l,stack:w,digest:null}}function gm(a,l,d){return{value:a,source:null,stack:d??null,digest:l??null}}function xm(a,l){try{console.error(l.value)}catch(d){setTimeout(function(){throw d})}}var tT=typeof WeakMap=="function"?WeakMap:Map;function rv(a,l,d){d=$s(-1,d),d.tag=3,d.payload={element:null};var x=l.value;return d.callback=function(){Lu||(Lu=!0,Dm=x),xm(a,l)},d}function sv(a,l,d){d=$s(-1,d),d.tag=3;var x=a.type.getDerivedStateFromError;if(typeof x=="function"){var w=l.value;d.payload=function(){return x(w)},d.callback=function(){xm(a,l)}}var N=a.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(d.callback=function(){xm(a,l),typeof x!="function"&&(so===null?so=new Set([this]):so.add(this));var O=l.stack;this.componentDidCatch(l.value,{componentStack:O!==null?O:""})}),d}function ov(a,l,d){var x=a.pingCache;if(x===null){x=a.pingCache=new tT;var w=new Set;x.set(l,w)}else w=x.get(l),w===void 0&&(w=new Set,x.set(l,w));w.has(d)||(w.add(d),a=hT.bind(null,a,l,d),l.then(a,a))}function av(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 iv(a,l,d,x,w){return(a.mode&1)===0?(a===l?a.flags|=65536:(a.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(l=$s(-1,1),l.tag=2,no(d,l,1))),d.lanes|=1),a):(a.flags|=65536,a.lanes=w,a)}var nT=T.ReactCurrentOwner,rr=!1;function Jn(a,l,d,x){l.child=a===null?Eb(l,null,d,x):Ma(l,a.child,d,x)}function lv(a,l,d,x,w){d=d.render;var N=l.ref;return za(l,w),x=lm(a,l,d,x,N,w),d=cm(),a!==null&&!rr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,Ls(a,l,w)):(Qt&&d&&Wp(l),l.flags|=1,Jn(a,l,x,w),l.child)}function cv(a,l,d,x,w){if(a===null){var N=d.type;return typeof N=="function"&&!Fm(N)&&N.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(l.tag=15,l.type=N,uv(a,l,N,x,w)):(a=zu(d.type,null,x,l,l.mode,w),a.ref=l.ref,a.return=l,l.child=a)}if(N=a.child,(a.lanes&w)===0){var O=N.memoizedProps;if(d=d.compare,d=d!==null?d:ll,d(O,x)&&a.ref===l.ref)return Ls(a,l,w)}return l.flags|=1,a=lo(N,x),a.ref=l.ref,a.return=l,l.child=a}function uv(a,l,d,x,w){if(a!==null){var N=a.memoizedProps;if(ll(N,x)&&a.ref===l.ref)if(rr=!1,l.pendingProps=x=N,(a.lanes&w)!==0)(a.flags&131072)!==0&&(rr=!0);else return l.lanes=a.lanes,Ls(a,l,w)}return ym(a,l,d,x,w)}function dv(a,l,d){var x=l.pendingProps,w=x.children,N=a!==null?a.memoizedState:null;if(x.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ut(Ha,br),br|=d;else{if((d&1073741824)===0)return a=N!==null?N.baseLanes|d:d,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null,transitions:null},l.updateQueue=null,Ut(Ha,br),br|=a,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},x=N!==null?N.baseLanes:d,Ut(Ha,br),br|=x}else N!==null?(x=N.baseLanes|d,l.memoizedState=null):x=d,Ut(Ha,br),br|=x;return Jn(a,l,w,d),l.child}function fv(a,l){var d=l.ref;(a===null&&d!==null||a!==null&&a.ref!==d)&&(l.flags|=512,l.flags|=2097152)}function ym(a,l,d,x,w){var N=nr(d)?_o:Vn.current;return N=La(l,N),za(l,w),d=lm(a,l,d,x,N,w),x=cm(),a!==null&&!rr?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~w,Ls(a,l,w)):(Qt&&x&&Wp(l),l.flags|=1,Jn(a,l,d,w),l.child)}function pv(a,l,d,x,w){if(nr(d)){var N=!0;du(l)}else N=!1;if(za(l,w),l.stateNode===null)Ru(a,l),tv(l,d,x),hm(l,d,x,w),x=!0;else if(a===null){var O=l.stateNode,W=l.memoizedProps;O.props=W;var J=O.context,de=d.contextType;typeof de=="object"&&de!==null?de=$r(de):(de=nr(d)?_o:Vn.current,de=La(l,de));var ke=d.getDerivedStateFromProps,Ne=typeof ke=="function"||typeof O.getSnapshotBeforeUpdate=="function";Ne||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(W!==x||J!==de)&&nv(l,O,x,de),to=!1;var je=l.memoizedState;O.state=je,vu(l,x,O,w),J=l.memoizedState,W!==x||je!==J||tr.current||to?(typeof ke=="function"&&(mm(l,d,ke,x),J=l.memoizedState),(W=to||ev(l,d,W,x,je,J,de))?(Ne||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(l.flags|=4194308)):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=x,l.memoizedState=J),O.props=x,O.state=J,O.context=de,x=W):(typeof O.componentDidMount=="function"&&(l.flags|=4194308),x=!1)}else{O=l.stateNode,Rb(a,l),W=l.memoizedProps,de=l.type===l.elementType?W:Qr(l.type,W),O.props=de,Ne=l.pendingProps,je=O.context,J=d.contextType,typeof J=="object"&&J!==null?J=$r(J):(J=nr(d)?_o:Vn.current,J=La(l,J));var Ve=d.getDerivedStateFromProps;(ke=typeof Ve=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(W!==Ne||je!==J)&&nv(l,O,x,J),to=!1,je=l.memoizedState,O.state=je,vu(l,x,O,w);var qe=l.memoizedState;W!==Ne||je!==qe||tr.current||to?(typeof Ve=="function"&&(mm(l,d,Ve,x),qe=l.memoizedState),(de=to||ev(l,d,de,x,je,qe,J)||!1)?(ke||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(x,qe,J),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(x,qe,J)),typeof O.componentDidUpdate=="function"&&(l.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof O.componentDidUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=1024),l.memoizedProps=x,l.memoizedState=qe),O.props=x,O.state=qe,O.context=J,x=de):(typeof O.componentDidUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||W===a.memoizedProps&&je===a.memoizedState||(l.flags|=1024),x=!1)}return bm(a,l,d,x,N,w)}function bm(a,l,d,x,w,N){fv(a,l);var O=(l.flags&128)!==0;if(!x&&!O)return w&&yb(l,d,!1),Ls(a,l,N);x=l.stateNode,nT.current=l;var W=O&&typeof d.getDerivedStateFromError!="function"?null:x.render();return l.flags|=1,a!==null&&O?(l.child=Ma(l,a.child,null,N),l.child=Ma(l,null,W,N)):Jn(a,l,W,N),l.memoizedState=x.state,w&&yb(l,d,!0),l.child}function mv(a){var l=a.stateNode;l.pendingContext?gb(a,l.pendingContext,l.pendingContext!==l.context):l.context&&gb(a,l.context,!1),nm(a,l.containerInfo)}function hv(a,l,d,x,w){return _a(),Yp(w),l.flags|=256,Jn(a,l,d,x),l.child}var vm={dehydrated:null,treeContext:null,retryLane:0};function wm(a){return{baseLanes:a,cachePool:null,transitions:null}}function gv(a,l,d){var x=l.pendingProps,w=tn.current,N=!1,O=(l.flags&128)!==0,W;if((W=O)||(W=a!==null&&a.memoizedState===null?!1:(w&2)!==0),W?(N=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(w|=1),Ut(tn,w&1),a===null)return Gp(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((l.mode&1)===0?l.lanes=1:a.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(O=x.children,a=x.fallback,N?(x=l.mode,N=l.child,O={mode:"hidden",children:O},(x&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=O):N=Bu(O,x,0,null),a=qo(a,x,d,null),N.return=l,a.return=l,N.sibling=a,l.child=N,l.child.memoizedState=wm(d),l.memoizedState=vm,a):jm(l,O));if(w=a.memoizedState,w!==null&&(W=w.dehydrated,W!==null))return rT(a,l,O,x,W,w,d);if(N){N=x.fallback,O=l.mode,w=a.child,W=w.sibling;var J={mode:"hidden",children:x.children};return(O&1)===0&&l.child!==w?(x=l.child,x.childLanes=0,x.pendingProps=J,l.deletions=null):(x=lo(w,J),x.subtreeFlags=w.subtreeFlags&14680064),W!==null?N=lo(W,N):(N=qo(N,O,d,null),N.flags|=2),N.return=l,x.return=l,x.sibling=N,l.child=x,x=N,N=l.child,O=a.child.memoizedState,O=O===null?wm(d):{baseLanes:O.baseLanes|d,cachePool:null,transitions:O.transitions},N.memoizedState=O,N.childLanes=a.childLanes&~d,l.memoizedState=vm,x}return N=a.child,a=N.sibling,x=lo(N,{mode:"visible",children:x.children}),(l.mode&1)===0&&(x.lanes=d),x.return=l,x.sibling=null,a!==null&&(d=l.deletions,d===null?(l.deletions=[a],l.flags|=16):d.push(a)),l.child=x,l.memoizedState=null,x}function jm(a,l){return l=Bu({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function Tu(a,l,d,x){return x!==null&&Yp(x),Ma(l,a.child,null,d),a=jm(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function rT(a,l,d,x,w,N,O){if(d)return l.flags&256?(l.flags&=-257,x=gm(Error(n(422))),Tu(a,l,O,x)):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(N=x.fallback,w=l.mode,x=Bu({mode:"visible",children:x.children},w,0,null),N=qo(N,w,O,null),N.flags|=2,x.return=l,N.return=l,x.sibling=N,l.child=x,(l.mode&1)!==0&&Ma(l,a.child,null,O),l.child.memoizedState=wm(O),l.memoizedState=vm,N);if((l.mode&1)===0)return Tu(a,l,O,null);if(w.data==="$!"){if(x=w.nextSibling&&w.nextSibling.dataset,x)var W=x.dgst;return x=W,N=Error(n(419)),x=gm(N,x,void 0),Tu(a,l,O,x)}if(W=(O&a.childLanes)!==0,rr||W){if(x=Pn,x!==null){switch(O&-O){case 4:w=2;break;case 16:w=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:w=32;break;case 536870912:w=268435456;break;default:w=0}w=(w&(x.suspendedLanes|O))!==0?0:w,w!==0&&w!==N.retryLane&&(N.retryLane=w,Ds(a,w),es(x,a,w,-1))}return Mm(),x=gm(Error(n(421))),Tu(a,l,O,x)}return w.data==="$?"?(l.flags|=128,l.child=a.child,l=gT.bind(null,a),w._reactRetry=l,null):(a=N.treeContext,yr=Qs(w.nextSibling),xr=l,Qt=!0,Jr=null,a!==null&&(Ar[Dr++]=Ps,Ar[Dr++]=As,Ar[Dr++]=Mo,Ps=a.id,As=a.overflow,Mo=l),l=jm(l,x.children),l.flags|=4096,l)}function xv(a,l,d){a.lanes|=l;var x=a.alternate;x!==null&&(x.lanes|=l),Zp(a.return,l,d)}function km(a,l,d,x,w){var N=a.memoizedState;N===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:x,tail:d,tailMode:w}:(N.isBackwards=l,N.rendering=null,N.renderingStartTime=0,N.last=x,N.tail=d,N.tailMode=w)}function yv(a,l,d){var x=l.pendingProps,w=x.revealOrder,N=x.tail;if(Jn(a,l,x.children,d),x=tn.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&&xv(a,d,l);else if(a.tag===19)xv(a,d,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}x&=1}if(Ut(tn,x),(l.mode&1)===0)l.memoizedState=null;else switch(w){case"forwards":for(d=l.child,w=null;d!==null;)a=d.alternate,a!==null&&wu(a)===null&&(w=d),d=d.sibling;d=w,d===null?(w=l.child,l.child=null):(w=d.sibling,d.sibling=null),km(l,!1,w,d,N);break;case"backwards":for(d=null,w=l.child,l.child=null;w!==null;){if(a=w.alternate,a!==null&&wu(a)===null){l.child=w;break}a=w.sibling,w.sibling=d,d=w,w=a}km(l,!0,d,null,N);break;case"together":km(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Ru(a,l){(l.mode&1)===0&&a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2)}function Ls(a,l,d){if(a!==null&&(l.dependencies=a.dependencies),Vo|=l.lanes,(d&l.childLanes)===0)return null;if(a!==null&&l.child!==a.child)throw Error(n(153));if(l.child!==null){for(a=l.child,d=lo(a,a.pendingProps),l.child=d,d.return=l;a.sibling!==null;)a=a.sibling,d=d.sibling=lo(a,a.pendingProps),d.return=l;d.sibling=null}return l.child}function sT(a,l,d){switch(l.tag){case 3:mv(l),_a();break;case 5:Db(l);break;case 1:nr(l.type)&&du(l);break;case 4:nm(l,l.stateNode.containerInfo);break;case 10:var x=l.type._context,w=l.memoizedProps.value;Ut(xu,x._currentValue),x._currentValue=w;break;case 13:if(x=l.memoizedState,x!==null)return x.dehydrated!==null?(Ut(tn,tn.current&1),l.flags|=128,null):(d&l.child.childLanes)!==0?gv(a,l,d):(Ut(tn,tn.current&1),a=Ls(a,l,d),a!==null?a.sibling:null);Ut(tn,tn.current&1);break;case 19:if(x=(d&l.childLanes)!==0,(a.flags&128)!==0){if(x)return yv(a,l,d);l.flags|=128}if(w=l.memoizedState,w!==null&&(w.rendering=null,w.tail=null,w.lastEffect=null),Ut(tn,tn.current),x)break;return null;case 22:case 23:return l.lanes=0,dv(a,l,d)}return Ls(a,l,d)}var bv,Sm,vv,wv;bv=function(a,l){for(var d=l.child;d!==null;){if(d.tag===5||d.tag===6)a.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},Sm=function(){},vv=function(a,l,d,x){var w=a.memoizedProps;if(w!==x){a=l.stateNode,Bo(ps.current);var N=null;switch(d){case"input":w=ot(a,w),x=ot(a,x),N=[];break;case"select":w=L({},w,{value:void 0}),x=L({},x,{value:void 0}),N=[];break;case"textarea":w=Qe(a,w),x=Qe(a,x),N=[];break;default:typeof w.onClick!="function"&&typeof x.onClick=="function"&&(a.onclick=lu)}at(d,x);var O;d=null;for(de in w)if(!x.hasOwnProperty(de)&&w.hasOwnProperty(de)&&w[de]!=null)if(de==="style"){var W=w[de];for(O in W)W.hasOwnProperty(O)&&(d||(d={}),d[O]="")}else de!=="dangerouslySetInnerHTML"&&de!=="children"&&de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&de!=="autoFocus"&&(o.hasOwnProperty(de)?N||(N=[]):(N=N||[]).push(de,null));for(de in x){var J=x[de];if(W=w!=null?w[de]:void 0,x.hasOwnProperty(de)&&J!==W&&(J!=null||W!=null))if(de==="style")if(W){for(O in W)!W.hasOwnProperty(O)||J&&J.hasOwnProperty(O)||(d||(d={}),d[O]="");for(O in J)J.hasOwnProperty(O)&&W[O]!==J[O]&&(d||(d={}),d[O]=J[O])}else d||(N||(N=[]),N.push(de,d)),d=J;else de==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,W=W?W.__html:void 0,J!=null&&W!==J&&(N=N||[]).push(de,J)):de==="children"?typeof J!="string"&&typeof J!="number"||(N=N||[]).push(de,""+J):de!=="suppressContentEditableWarning"&&de!=="suppressHydrationWarning"&&(o.hasOwnProperty(de)?(J!=null&&de==="onScroll"&&Wt("scroll",a),N||W===J||(N=[])):(N=N||[]).push(de,J))}d&&(N=N||[]).push("style",d);var de=N;(l.updateQueue=de)&&(l.flags|=4)}},wv=function(a,l,d,x){d!==x&&(l.flags|=4)};function kl(a,l){if(!Qt)switch(a.tailMode){case"hidden":l=a.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?a.tail=null:d.sibling=null;break;case"collapsed":d=a.tail;for(var x=null;d!==null;)d.alternate!==null&&(x=d),d=d.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,d=0,x=0;if(l)for(var w=a.child;w!==null;)d|=w.lanes|w.childLanes,x|=w.subtreeFlags&14680064,x|=w.flags&14680064,w.return=a,w=w.sibling;else for(w=a.child;w!==null;)d|=w.lanes|w.childLanes,x|=w.subtreeFlags,x|=w.flags,w.return=a,w=w.sibling;return a.subtreeFlags|=x,a.childLanes=d,l}function oT(a,l,d){var x=l.pendingProps;switch(Kp(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 nr(l.type)&&uu(),Wn(l),null;case 3:return x=l.stateNode,Ba(),Kt(tr),Kt(Vn),om(),x.pendingContext&&(x.context=x.pendingContext,x.pendingContext=null),(a===null||a.child===null)&&(hu(l)?l.flags|=4:a===null||a.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Jr!==null&&(Om(Jr),Jr=null))),Sm(a,l),Wn(l),null;case 5:rm(l);var w=Bo(yl.current);if(d=l.type,a!==null&&l.stateNode!=null)vv(a,l,d,x,w),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!x){if(l.stateNode===null)throw Error(n(166));return Wn(l),null}if(a=Bo(ps.current),hu(l)){x=l.stateNode,d=l.type;var N=l.memoizedProps;switch(x[fs]=l,x[pl]=N,a=(l.mode&1)!==0,d){case"dialog":Wt("cancel",x),Wt("close",x);break;case"iframe":case"object":case"embed":Wt("load",x);break;case"video":case"audio":for(w=0;w<ul.length;w++)Wt(ul[w],x);break;case"source":Wt("error",x);break;case"img":case"image":case"link":Wt("error",x),Wt("load",x);break;case"details":Wt("toggle",x);break;case"input":X(x,N),Wt("invalid",x);break;case"select":x._wrapperState={wasMultiple:!!N.multiple},Wt("invalid",x);break;case"textarea":Ot(x,N),Wt("invalid",x)}at(d,N),w=null;for(var O in N)if(N.hasOwnProperty(O)){var W=N[O];O==="children"?typeof W=="string"?x.textContent!==W&&(N.suppressHydrationWarning!==!0&&iu(x.textContent,W,a),w=["children",W]):typeof W=="number"&&x.textContent!==""+W&&(N.suppressHydrationWarning!==!0&&iu(x.textContent,W,a),w=["children",""+W]):o.hasOwnProperty(O)&&W!=null&&O==="onScroll"&&Wt("scroll",x)}switch(d){case"input":Ke(x),Ie(x,N,!0);break;case"textarea":Ke(x),dt(x);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(x.onclick=lu)}x=w,l.updateQueue=x,x!==null&&(l.flags|=4)}else{O=w.nodeType===9?w:w.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=le(d)),a==="http://www.w3.org/1999/xhtml"?d==="script"?(a=O.createElement("div"),a.innerHTML="<script><\/script>",a=a.removeChild(a.firstChild)):typeof x.is=="string"?a=O.createElement(d,{is:x.is}):(a=O.createElement(d),d==="select"&&(O=a,x.multiple?O.multiple=!0:x.size&&(O.size=x.size))):a=O.createElementNS(a,d),a[fs]=l,a[pl]=x,bv(a,l,!1,!1),l.stateNode=a;e:{switch(O=Be(d,x),d){case"dialog":Wt("cancel",a),Wt("close",a),w=x;break;case"iframe":case"object":case"embed":Wt("load",a),w=x;break;case"video":case"audio":for(w=0;w<ul.length;w++)Wt(ul[w],a);w=x;break;case"source":Wt("error",a),w=x;break;case"img":case"image":case"link":Wt("error",a),Wt("load",a),w=x;break;case"details":Wt("toggle",a),w=x;break;case"input":X(a,x),w=ot(a,x),Wt("invalid",a);break;case"option":w=x;break;case"select":a._wrapperState={wasMultiple:!!x.multiple},w=L({},x,{value:void 0}),Wt("invalid",a);break;case"textarea":Ot(a,x),w=Qe(a,x),Wt("invalid",a);break;default:w=x}at(d,w),W=w;for(N in W)if(W.hasOwnProperty(N)){var J=W[N];N==="style"?be(a,J):N==="dangerouslySetInnerHTML"?(J=J?J.__html:void 0,J!=null&&ne(a,J)):N==="children"?typeof J=="string"?(d!=="textarea"||J!=="")&&he(a,J):typeof J=="number"&&he(a,""+J):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(o.hasOwnProperty(N)?J!=null&&N==="onScroll"&&Wt("scroll",a):J!=null&&S(a,N,J,O))}switch(d){case"input":Ke(a),Ie(a,x,!1);break;case"textarea":Ke(a),dt(a);break;case"option":x.value!=null&&a.setAttribute("value",""+Se(x.value));break;case"select":a.multiple=!!x.multiple,N=x.value,N!=null?Ze(a,!!x.multiple,N,!1):x.defaultValue!=null&&Ze(a,!!x.multiple,x.defaultValue,!0);break;default:typeof w.onClick=="function"&&(a.onclick=lu)}switch(d){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)wv(a,l,a.memoizedProps,x);else{if(typeof x!="string"&&l.stateNode===null)throw Error(n(166));if(d=Bo(yl.current),Bo(ps.current),hu(l)){if(x=l.stateNode,d=l.memoizedProps,x[fs]=l,(N=x.nodeValue!==d)&&(a=xr,a!==null))switch(a.tag){case 3:iu(x.nodeValue,d,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&iu(x.nodeValue,d,(a.mode&1)!==0)}N&&(l.flags|=4)}else x=(d.nodeType===9?d:d.ownerDocument).createTextNode(x),x[fs]=l,l.stateNode=x}return Wn(l),null;case 13:if(Kt(tn),x=l.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(Qt&&yr!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Sb(),_a(),l.flags|=98560,N=!1;else if(N=hu(l),x!==null&&x.dehydrated!==null){if(a===null){if(!N)throw Error(n(318));if(N=l.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[fs]=l}else _a(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Wn(l),N=!1}else Jr!==null&&(Om(Jr),Jr=null),N=!0;if(!N)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=d,l):(x=x!==null,x!==(a!==null&&a.memoizedState!==null)&&x&&(l.child.flags|=8192,(l.mode&1)!==0&&(a===null||(tn.current&1)!==0?kn===0&&(kn=3):Mm())),l.updateQueue!==null&&(l.flags|=4),Wn(l),null);case 4:return Ba(),Sm(a,l),a===null&&dl(l.stateNode.containerInfo),Wn(l),null;case 10:return Xp(l.type._context),Wn(l),null;case 17:return nr(l.type)&&uu(),Wn(l),null;case 19:if(Kt(tn),N=l.memoizedState,N===null)return Wn(l),null;if(x=(l.flags&128)!==0,O=N.rendering,O===null)if(x)kl(N,!1);else{if(kn!==0||a!==null&&(a.flags&128)!==0)for(a=l.child;a!==null;){if(O=wu(a),O!==null){for(l.flags|=128,kl(N,!1),x=O.updateQueue,x!==null&&(l.updateQueue=x,l.flags|=4),l.subtreeFlags=0,x=d,d=l.child;d!==null;)N=d,a=x,N.flags&=14680066,O=N.alternate,O===null?(N.childLanes=0,N.lanes=a,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=O.childLanes,N.lanes=O.lanes,N.child=O.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=O.memoizedProps,N.memoizedState=O.memoizedState,N.updateQueue=O.updateQueue,N.type=O.type,a=O.dependencies,N.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),d=d.sibling;return Ut(tn,tn.current&1|2),l.child}a=a.sibling}N.tail!==null&&en()>Wa&&(l.flags|=128,x=!0,kl(N,!1),l.lanes=4194304)}else{if(!x)if(a=wu(O),a!==null){if(l.flags|=128,x=!0,d=a.updateQueue,d!==null&&(l.updateQueue=d,l.flags|=4),kl(N,!0),N.tail===null&&N.tailMode==="hidden"&&!O.alternate&&!Qt)return Wn(l),null}else 2*en()-N.renderingStartTime>Wa&&d!==1073741824&&(l.flags|=128,x=!0,kl(N,!1),l.lanes=4194304);N.isBackwards?(O.sibling=l.child,l.child=O):(d=N.last,d!==null?d.sibling=O:l.child=O,N.last=O)}return N.tail!==null?(l=N.tail,N.rendering=l,N.tail=l.sibling,N.renderingStartTime=en(),l.sibling=null,d=tn.current,Ut(tn,x?d&1|2:d&1),l):(Wn(l),null);case 22:case 23:return _m(),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 aT(a,l){switch(Kp(l),l.tag){case 1:return nr(l.type)&&uu(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return Ba(),Kt(tr),Kt(Vn),om(),a=l.flags,(a&65536)!==0&&(a&128)===0?(l.flags=a&-65537|128,l):null;case 5:return rm(l),null;case 13:if(Kt(tn),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(n(340));_a()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Kt(tn),null;case 4:return Ba(),null;case 10:return Xp(l.type._context),null;case 22:case 23:return _m(),null;case 24:return null;default:return null}}var Pu=!1,Kn=!1,iT=typeof WeakSet=="function"?WeakSet:Set,We=null;function Va(a,l){var d=a.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(x){an(a,l,x)}else d.current=null}function Nm(a,l,d){try{d()}catch(x){an(a,l,x)}}var jv=!1;function lT(a,l){if(_p=Oo,a=eb(),Rp(a)){if("selectionStart"in a)var d={start:a.selectionStart,end:a.selectionEnd};else e:{d=(d=a.ownerDocument)&&d.defaultView||window;var x=d.getSelection&&d.getSelection();if(x&&x.rangeCount!==0){d=x.anchorNode;var w=x.anchorOffset,N=x.focusNode;x=x.focusOffset;try{d.nodeType,N.nodeType}catch{d=null;break e}var O=0,W=-1,J=-1,de=0,ke=0,Ne=a,je=null;t:for(;;){for(var Ve;Ne!==d||w!==0&&Ne.nodeType!==3||(W=O+w),Ne!==N||x!==0&&Ne.nodeType!==3||(J=O+x),Ne.nodeType===3&&(O+=Ne.nodeValue.length),(Ve=Ne.firstChild)!==null;)je=Ne,Ne=Ve;for(;;){if(Ne===a)break t;if(je===d&&++de===w&&(W=O),je===N&&++ke===x&&(J=O),(Ve=Ne.nextSibling)!==null)break;Ne=je,je=Ne.parentNode}Ne=Ve}d=W===-1||J===-1?null:{start:W,end:J}}else d=null}d=d||{start:0,end:0}}else d=null;for(Mp={focusedElem:a,selectionRange:d},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 qe=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(qe!==null){var Je=qe.memoizedProps,dn=qe.memoizedState,ie=l.stateNode,ee=ie.getSnapshotBeforeUpdate(l.elementType===l.type?Je:Qr(l.type,Je),dn);ie.__reactInternalSnapshotBeforeUpdate=ee}break;case 3:var ce=l.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Pe){an(l,l.return,Pe)}if(a=l.sibling,a!==null){a.return=l.return,We=a;break}We=l.return}return qe=jv,jv=!1,qe}function Sl(a,l,d){var x=l.updateQueue;if(x=x!==null?x.lastEffect:null,x!==null){var w=x=x.next;do{if((w.tag&a)===a){var N=w.destroy;w.destroy=void 0,N!==void 0&&Nm(l,d,N)}w=w.next}while(w!==x)}}function Au(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var d=l=l.next;do{if((d.tag&a)===a){var x=d.create;d.destroy=x()}d=d.next}while(d!==l)}}function Cm(a){var l=a.ref;if(l!==null){var d=a.stateNode;switch(a.tag){case 5:a=d;break;default:a=d}typeof l=="function"?l(a):l.current=a}}function kv(a){var l=a.alternate;l!==null&&(a.alternate=null,kv(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&(delete l[fs],delete l[pl],delete l[Up],delete l[H2],delete l[W2])),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 Sv(a){return a.tag===5||a.tag===3||a.tag===4}function Nv(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Sv(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 Em(a,l,d){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?d.nodeType===8?d.parentNode.insertBefore(a,l):d.insertBefore(a,l):(d.nodeType===8?(l=d.parentNode,l.insertBefore(a,d)):(l=d,l.appendChild(a)),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=lu));else if(x!==4&&(a=a.child,a!==null))for(Em(a,l,d),a=a.sibling;a!==null;)Em(a,l,d),a=a.sibling}function Tm(a,l,d){var x=a.tag;if(x===5||x===6)a=a.stateNode,l?d.insertBefore(a,l):d.appendChild(a);else if(x!==4&&(a=a.child,a!==null))for(Tm(a,l,d),a=a.sibling;a!==null;)Tm(a,l,d),a=a.sibling}var In=null,Xr=!1;function ro(a,l,d){for(d=d.child;d!==null;)Cv(a,l,d),d=d.sibling}function Cv(a,l,d){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(ba,d)}catch{}switch(d.tag){case 5:Kn||Va(d,l);case 6:var x=In,w=Xr;In=null,ro(a,l,d),In=x,Xr=w,In!==null&&(Xr?(a=In,d=d.stateNode,a.nodeType===8?a.parentNode.removeChild(d):a.removeChild(d)):In.removeChild(d.stateNode));break;case 18:In!==null&&(Xr?(a=In,d=d.stateNode,a.nodeType===8?Bp(a.parentNode,d):a.nodeType===1&&Bp(a,d),pn(a)):Bp(In,d.stateNode));break;case 4:x=In,w=Xr,In=d.stateNode.containerInfo,Xr=!0,ro(a,l,d),In=x,Xr=w;break;case 0:case 11:case 14:case 15:if(!Kn&&(x=d.updateQueue,x!==null&&(x=x.lastEffect,x!==null))){w=x=x.next;do{var N=w,O=N.destroy;N=N.tag,O!==void 0&&((N&2)!==0||(N&4)!==0)&&Nm(d,l,O),w=w.next}while(w!==x)}ro(a,l,d);break;case 1:if(!Kn&&(Va(d,l),x=d.stateNode,typeof x.componentWillUnmount=="function"))try{x.props=d.memoizedProps,x.state=d.memoizedState,x.componentWillUnmount()}catch(W){an(d,l,W)}ro(a,l,d);break;case 21:ro(a,l,d);break;case 22:d.mode&1?(Kn=(x=Kn)||d.memoizedState!==null,ro(a,l,d),Kn=x):ro(a,l,d);break;default:ro(a,l,d)}}function Ev(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var d=a.stateNode;d===null&&(d=a.stateNode=new iT),l.forEach(function(x){var w=xT.bind(null,a,x);d.has(x)||(d.add(x),x.then(w,w))})}}function Zr(a,l){var d=l.deletions;if(d!==null)for(var x=0;x<d.length;x++){var w=d[x];try{var N=a,O=l,W=O;e:for(;W!==null;){switch(W.tag){case 5:In=W.stateNode,Xr=!1;break e;case 3:In=W.stateNode.containerInfo,Xr=!0;break e;case 4:In=W.stateNode.containerInfo,Xr=!0;break e}W=W.return}if(In===null)throw Error(n(160));Cv(N,O,w),In=null,Xr=!1;var J=w.alternate;J!==null&&(J.return=null),w.return=null}catch(de){an(w,l,de)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)Tv(l,a),l=l.sibling}function Tv(a,l){var d=a.alternate,x=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(Zr(l,a),hs(a),x&4){try{Sl(3,a,a.return),Au(3,a)}catch(Je){an(a,a.return,Je)}try{Sl(5,a,a.return)}catch(Je){an(a,a.return,Je)}}break;case 1:Zr(l,a),hs(a),x&512&&d!==null&&Va(d,d.return);break;case 5:if(Zr(l,a),hs(a),x&512&&d!==null&&Va(d,d.return),a.flags&32){var w=a.stateNode;try{he(w,"")}catch(Je){an(a,a.return,Je)}}if(x&4&&(w=a.stateNode,w!=null)){var N=a.memoizedProps,O=d!==null?d.memoizedProps:N,W=a.type,J=a.updateQueue;if(a.updateQueue=null,J!==null)try{W==="input"&&N.type==="radio"&&N.name!=null&&Me(w,N),Be(W,O);var de=Be(W,N);for(O=0;O<J.length;O+=2){var ke=J[O],Ne=J[O+1];ke==="style"?be(w,Ne):ke==="dangerouslySetInnerHTML"?ne(w,Ne):ke==="children"?he(w,Ne):S(w,ke,Ne,de)}switch(W){case"input":Ce(w,N);break;case"textarea":yt(w,N);break;case"select":var je=w._wrapperState.wasMultiple;w._wrapperState.wasMultiple=!!N.multiple;var Ve=N.value;Ve!=null?Ze(w,!!N.multiple,Ve,!1):je!==!!N.multiple&&(N.defaultValue!=null?Ze(w,!!N.multiple,N.defaultValue,!0):Ze(w,!!N.multiple,N.multiple?[]:"",!1))}w[pl]=N}catch(Je){an(a,a.return,Je)}}break;case 6:if(Zr(l,a),hs(a),x&4){if(a.stateNode===null)throw Error(n(162));w=a.stateNode,N=a.memoizedProps;try{w.nodeValue=N}catch(Je){an(a,a.return,Je)}}break;case 3:if(Zr(l,a),hs(a),x&4&&d!==null&&d.memoizedState.isDehydrated)try{pn(l.containerInfo)}catch(Je){an(a,a.return,Je)}break;case 4:Zr(l,a),hs(a);break;case 13:Zr(l,a),hs(a),w=a.child,w.flags&8192&&(N=w.memoizedState!==null,w.stateNode.isHidden=N,!N||w.alternate!==null&&w.alternate.memoizedState!==null||(Am=en())),x&4&&Ev(a);break;case 22:if(ke=d!==null&&d.memoizedState!==null,a.mode&1?(Kn=(de=Kn)||ke,Zr(l,a),Kn=de):Zr(l,a),hs(a),x&8192){if(de=a.memoizedState!==null,(a.stateNode.isHidden=de)&&!ke&&(a.mode&1)!==0)for(We=a,ke=a.child;ke!==null;){for(Ne=We=ke;We!==null;){switch(je=We,Ve=je.child,je.tag){case 0:case 11:case 14:case 15:Sl(4,je,je.return);break;case 1:Va(je,je.return);var qe=je.stateNode;if(typeof qe.componentWillUnmount=="function"){x=je,d=je.return;try{l=x,qe.props=l.memoizedProps,qe.state=l.memoizedState,qe.componentWillUnmount()}catch(Je){an(x,d,Je)}}break;case 5:Va(je,je.return);break;case 22:if(je.memoizedState!==null){Av(Ne);continue}}Ve!==null?(Ve.return=je,We=Ve):Av(Ne)}ke=ke.sibling}e:for(ke=null,Ne=a;;){if(Ne.tag===5){if(ke===null){ke=Ne;try{w=Ne.stateNode,de?(N=w.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(W=Ne.stateNode,J=Ne.memoizedProps.style,O=J!=null&&J.hasOwnProperty("display")?J.display:null,W.style.display=ae("display",O))}catch(Je){an(a,a.return,Je)}}}else if(Ne.tag===6){if(ke===null)try{Ne.stateNode.nodeValue=de?"":Ne.memoizedProps}catch(Je){an(a,a.return,Je)}}else if((Ne.tag!==22&&Ne.tag!==23||Ne.memoizedState===null||Ne===a)&&Ne.child!==null){Ne.child.return=Ne,Ne=Ne.child;continue}if(Ne===a)break e;for(;Ne.sibling===null;){if(Ne.return===null||Ne.return===a)break e;ke===Ne&&(ke=null),Ne=Ne.return}ke===Ne&&(ke=null),Ne.sibling.return=Ne.return,Ne=Ne.sibling}}break;case 19:Zr(l,a),hs(a),x&4&&Ev(a);break;case 21:break;default:Zr(l,a),hs(a)}}function hs(a){var l=a.flags;if(l&2){try{e:{for(var d=a.return;d!==null;){if(Sv(d)){var x=d;break e}d=d.return}throw Error(n(160))}switch(x.tag){case 5:var w=x.stateNode;x.flags&32&&(he(w,""),x.flags&=-33);var N=Nv(a);Tm(a,N,w);break;case 3:case 4:var O=x.stateNode.containerInfo,W=Nv(a);Em(a,W,O);break;default:throw Error(n(161))}}catch(J){an(a,a.return,J)}a.flags&=-3}l&4096&&(a.flags&=-4097)}function cT(a,l,d){We=a,Rv(a)}function Rv(a,l,d){for(var x=(a.mode&1)!==0;We!==null;){var w=We,N=w.child;if(w.tag===22&&x){var O=w.memoizedState!==null||Pu;if(!O){var W=w.alternate,J=W!==null&&W.memoizedState!==null||Kn;W=Pu;var de=Kn;if(Pu=O,(Kn=J)&&!de)for(We=w;We!==null;)O=We,J=O.child,O.tag===22&&O.memoizedState!==null?Dv(w):J!==null?(J.return=O,We=J):Dv(w);for(;N!==null;)We=N,Rv(N),N=N.sibling;We=w,Pu=W,Kn=de}Pv(a)}else(w.subtreeFlags&8772)!==0&&N!==null?(N.return=w,We=N):Pv(a)}}function Pv(a){for(;We!==null;){var l=We;if((l.flags&8772)!==0){var d=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Kn||Au(5,l);break;case 1:var x=l.stateNode;if(l.flags&4&&!Kn)if(d===null)x.componentDidMount();else{var w=l.elementType===l.type?d.memoizedProps:Qr(l.type,d.memoizedProps);x.componentDidUpdate(w,d.memoizedState,x.__reactInternalSnapshotBeforeUpdate)}var N=l.updateQueue;N!==null&&Ab(l,N,x);break;case 3:var O=l.updateQueue;if(O!==null){if(d=null,l.child!==null)switch(l.child.tag){case 5:d=l.child.stateNode;break;case 1:d=l.child.stateNode}Ab(l,O,d)}break;case 5:var W=l.stateNode;if(d===null&&l.flags&4){d=W;var J=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":J.autoFocus&&d.focus();break;case"img":J.src&&(d.src=J.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var de=l.alternate;if(de!==null){var ke=de.memoizedState;if(ke!==null){var Ne=ke.dehydrated;Ne!==null&&pn(Ne)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Kn||l.flags&512&&Cm(l)}catch(je){an(l,l.return,je)}}if(l===a){We=null;break}if(d=l.sibling,d!==null){d.return=l.return,We=d;break}We=l.return}}function Av(a){for(;We!==null;){var l=We;if(l===a){We=null;break}var d=l.sibling;if(d!==null){d.return=l.return,We=d;break}We=l.return}}function Dv(a){for(;We!==null;){var l=We;try{switch(l.tag){case 0:case 11:case 15:var d=l.return;try{Au(4,l)}catch(J){an(l,d,J)}break;case 1:var x=l.stateNode;if(typeof x.componentDidMount=="function"){var w=l.return;try{x.componentDidMount()}catch(J){an(l,w,J)}}var N=l.return;try{Cm(l)}catch(J){an(l,N,J)}break;case 5:var O=l.return;try{Cm(l)}catch(J){an(l,O,J)}}}catch(J){an(l,l.return,J)}if(l===a){We=null;break}var W=l.sibling;if(W!==null){W.return=l.return,We=W;break}We=l.return}}var uT=Math.ceil,Du=T.ReactCurrentDispatcher,Rm=T.ReactCurrentOwner,Or=T.ReactCurrentBatchConfig,Ct=0,Pn=null,hn=null,_n=0,br=0,Ha=Xs(0),kn=0,Nl=null,Vo=0,$u=0,Pm=0,Cl=null,sr=null,Am=0,Wa=1/0,Os=null,Lu=!1,Dm=null,so=null,Ou=!1,oo=null,Iu=0,El=0,$m=null,_u=-1,Mu=0;function Qn(){return(Ct&6)!==0?en():_u!==-1?_u:_u=en()}function ao(a){return(a.mode&1)===0?1:(Ct&2)!==0&&_n!==0?_n&-_n:q2.transition!==null?(Mu===0&&(Mu=Xi()),Mu):(a=At,a!==0||(a=window.event,a=a===void 0?16:Ly(a.type)),a)}function es(a,l,d,x){if(50<El)throw El=0,$m=null,Error(n(185));Gr(a,d,x),((Ct&2)===0||a!==Pn)&&(a===Pn&&((Ct&2)===0&&($u|=d),kn===4&&io(a,_n)),or(a,x),d===1&&Ct===0&&(l.mode&1)===0&&(Wa=en()+500,fu&&eo()))}function or(a,l){var d=a.callbackNode;Gc(a,l);var x=Ao(a,a===Pn?_n:0);if(x===0)d!==null&&Hc(d),a.callbackNode=null,a.callbackPriority=0;else if(l=x&-x,a.callbackPriority!==l){if(d!=null&&Hc(d),l===1)a.tag===0?K2(Lv.bind(null,a)):bb(Lv.bind(null,a)),U2(function(){(Ct&6)===0&&eo()}),d=null;else{switch(tl(x)){case 1:d=Qi;break;case 4:d=Wc;break;case 16:d=Ks;break;case 536870912:d=Kc;break;default:d=Ks}d=Uv(d,$v.bind(null,a))}a.callbackPriority=l,a.callbackNode=d}}function $v(a,l){if(_u=-1,Mu=0,(Ct&6)!==0)throw Error(n(327));var d=a.callbackNode;if(Ka()&&a.callbackNode!==d)return null;var x=Ao(a,a===Pn?_n:0);if(x===0)return null;if((x&30)!==0||(x&a.expiredLanes)!==0||l)l=Fu(a,x);else{l=x;var w=Ct;Ct|=2;var N=Iv();(Pn!==a||_n!==l)&&(Os=null,Wa=en()+500,Wo(a,l));do try{pT();break}catch(W){Ov(a,W)}while(!0);Qp(),Du.current=N,Ct=w,hn!==null?l=0:(Pn=null,_n=0,l=kn)}if(l!==0){if(l===2&&(w=Do(a),w!==0&&(x=w,l=Lm(a,w))),l===1)throw d=Nl,Wo(a,0),io(a,x),or(a,en()),d;if(l===6)io(a,x);else{if(w=a.current.alternate,(x&30)===0&&!dT(w)&&(l=Fu(a,x),l===2&&(N=Do(a),N!==0&&(x=N,l=Lm(a,N))),l===1))throw d=Nl,Wo(a,0),io(a,x),or(a,en()),d;switch(a.finishedWork=w,a.finishedLanes=x,l){case 0:case 1:throw Error(n(345));case 2:Ko(a,sr,Os);break;case 3:if(io(a,x),(x&130023424)===x&&(l=Am+500-en(),10<l)){if(Ao(a,0)!==0)break;if(w=a.suspendedLanes,(w&x)!==x){Qn(),a.pingedLanes|=a.suspendedLanes&w;break}a.timeoutHandle=zp(Ko.bind(null,a,sr,Os),l);break}Ko(a,sr,Os);break;case 4:if(io(a,x),(x&4194240)===x)break;for(l=a.eventTimes,w=-1;0<x;){var O=31-Bn(x);N=1<<O,O=l[O],O>w&&(w=O),x&=~N}if(x=w,x=en()-x,x=(120>x?120:480>x?480:1080>x?1080:1920>x?1920:3e3>x?3e3:4320>x?4320:1960*uT(x/1960))-x,10<x){a.timeoutHandle=zp(Ko.bind(null,a,sr,Os),x);break}Ko(a,sr,Os);break;case 5:Ko(a,sr,Os);break;default:throw Error(n(329))}}}return or(a,en()),a.callbackNode===d?$v.bind(null,a):null}function Lm(a,l){var d=Cl;return a.current.memoizedState.isDehydrated&&(Wo(a,l).flags|=256),a=Fu(a,l),a!==2&&(l=sr,sr=d,l!==null&&Om(l)),a}function Om(a){sr===null?sr=a:sr.push.apply(sr,a)}function dT(a){for(var l=a;;){if(l.flags&16384){var d=l.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var x=0;x<d.length;x++){var w=d[x],N=w.getSnapshot;w=w.value;try{if(!Yr(N(),w))return!1}catch{return!1}}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;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 io(a,l){for(l&=~Pm,l&=~$u,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var d=31-Bn(l),x=1<<d;a[d]=-1,l&=~x}}function Lv(a){if((Ct&6)!==0)throw Error(n(327));Ka();var l=Ao(a,0);if((l&1)===0)return or(a,en()),null;var d=Fu(a,l);if(a.tag!==0&&d===2){var x=Do(a);x!==0&&(l=x,d=Lm(a,x))}if(d===1)throw d=Nl,Wo(a,0),io(a,l),or(a,en()),d;if(d===6)throw Error(n(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,Ko(a,sr,Os),or(a,en()),null}function Im(a,l){var d=Ct;Ct|=1;try{return a(l)}finally{Ct=d,Ct===0&&(Wa=en()+500,fu&&eo())}}function Ho(a){oo!==null&&oo.tag===0&&(Ct&6)===0&&Ka();var l=Ct;Ct|=1;var d=Or.transition,x=At;try{if(Or.transition=null,At=1,a)return a()}finally{At=x,Or.transition=d,Ct=l,(Ct&6)===0&&eo()}}function _m(){br=Ha.current,Kt(Ha)}function Wo(a,l){a.finishedWork=null,a.finishedLanes=0;var d=a.timeoutHandle;if(d!==-1&&(a.timeoutHandle=-1,B2(d)),hn!==null)for(d=hn.return;d!==null;){var x=d;switch(Kp(x),x.tag){case 1:x=x.type.childContextTypes,x!=null&&uu();break;case 3:Ba(),Kt(tr),Kt(Vn),om();break;case 5:rm(x);break;case 4:Ba();break;case 13:Kt(tn);break;case 19:Kt(tn);break;case 10:Xp(x.type._context);break;case 22:case 23:_m()}d=d.return}if(Pn=a,hn=a=lo(a.current,null),_n=br=l,kn=0,Nl=null,Pm=$u=Vo=0,sr=Cl=null,zo!==null){for(l=0;l<zo.length;l++)if(d=zo[l],x=d.interleaved,x!==null){d.interleaved=null;var w=x.next,N=d.pending;if(N!==null){var O=N.next;N.next=w,x.next=O}d.pending=x}zo=null}return a}function Ov(a,l){do{var d=hn;try{if(Qp(),ju.current=Cu,ku){for(var x=nn.memoizedState;x!==null;){var w=x.queue;w!==null&&(w.pending=null),x=x.next}ku=!1}if(Uo=0,Rn=jn=nn=null,bl=!1,vl=0,Rm.current=null,d===null||d.return===null){kn=1,Nl=l,hn=null;break}e:{var N=a,O=d.return,W=d,J=l;if(l=_n,W.flags|=32768,J!==null&&typeof J=="object"&&typeof J.then=="function"){var de=J,ke=W,Ne=ke.tag;if((ke.mode&1)===0&&(Ne===0||Ne===11||Ne===15)){var je=ke.alternate;je?(ke.updateQueue=je.updateQueue,ke.memoizedState=je.memoizedState,ke.lanes=je.lanes):(ke.updateQueue=null,ke.memoizedState=null)}var Ve=av(O);if(Ve!==null){Ve.flags&=-257,iv(Ve,O,W,N,l),Ve.mode&1&&ov(N,de,l),l=Ve,J=de;var qe=l.updateQueue;if(qe===null){var Je=new Set;Je.add(J),l.updateQueue=Je}else qe.add(J);break e}else{if((l&1)===0){ov(N,de,l),Mm();break e}J=Error(n(426))}}else if(Qt&&W.mode&1){var dn=av(O);if(dn!==null){(dn.flags&65536)===0&&(dn.flags|=256),iv(dn,O,W,N,l),Yp(Ua(J,W));break e}}N=J=Ua(J,W),kn!==4&&(kn=2),Cl===null?Cl=[N]:Cl.push(N),N=O;do{switch(N.tag){case 3:N.flags|=65536,l&=-l,N.lanes|=l;var ie=rv(N,J,l);Pb(N,ie);break e;case 1:W=J;var ee=N.type,ce=N.stateNode;if((N.flags&128)===0&&(typeof ee.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(so===null||!so.has(ce)))){N.flags|=65536,l&=-l,N.lanes|=l;var Pe=sv(N,W,l);Pb(N,Pe);break e}}N=N.return}while(N!==null)}Mv(d)}catch(Xe){l=Xe,hn===d&&d!==null&&(hn=d=d.return);continue}break}while(!0)}function Iv(){var a=Du.current;return Du.current=Cu,a===null?Cu:a}function Mm(){(kn===0||kn===3||kn===2)&&(kn=4),Pn===null||(Vo&268435455)===0&&($u&268435455)===0||io(Pn,_n)}function Fu(a,l){var d=Ct;Ct|=2;var x=Iv();(Pn!==a||_n!==l)&&(Os=null,Wo(a,l));do try{fT();break}catch(w){Ov(a,w)}while(!0);if(Qp(),Ct=d,Du.current=x,hn!==null)throw Error(n(261));return Pn=null,_n=0,kn}function fT(){for(;hn!==null;)_v(hn)}function pT(){for(;hn!==null&&!pp();)_v(hn)}function _v(a){var l=Bv(a.alternate,a,br);a.memoizedProps=a.pendingProps,l===null?Mv(a):hn=l,Rm.current=null}function Mv(a){var l=a;do{var d=l.alternate;if(a=l.return,(l.flags&32768)===0){if(d=oT(d,l,br),d!==null){hn=d;return}}else{if(d=aT(d,l),d!==null){d.flags&=32767,hn=d;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{kn=6,hn=null;return}}if(l=l.sibling,l!==null){hn=l;return}hn=l=a}while(l!==null);kn===0&&(kn=5)}function Ko(a,l,d){var x=At,w=Or.transition;try{Or.transition=null,At=1,mT(a,l,d,x)}finally{Or.transition=w,At=x}return null}function mT(a,l,d,x){do Ka();while(oo!==null);if((Ct&6)!==0)throw Error(n(327));d=a.finishedWork;var w=a.finishedLanes;if(d===null)return null;if(a.finishedWork=null,a.finishedLanes=0,d===a.current)throw Error(n(177));a.callbackNode=null,a.callbackPriority=0;var N=d.lanes|d.childLanes;if(Zi(a,N),a===Pn&&(hn=Pn=null,_n=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Ou||(Ou=!0,Uv(Ks,function(){return Ka(),null})),N=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||N){N=Or.transition,Or.transition=null;var O=At;At=1;var W=Ct;Ct|=4,Rm.current=null,lT(a,d),Tv(d,a),L2(Mp),Oo=!!_p,Mp=_p=null,a.current=d,cT(d),mp(),Ct=W,At=O,Or.transition=N}else a.current=d;if(Ou&&(Ou=!1,oo=a,Iu=w),N=a.pendingLanes,N===0&&(so=null),va(d.stateNode),or(a,en()),l!==null)for(x=a.onRecoverableError,d=0;d<l.length;d++)w=l[d],x(w.value,{componentStack:w.stack,digest:w.digest});if(Lu)throw Lu=!1,a=Dm,Dm=null,a;return(Iu&1)!==0&&a.tag!==0&&Ka(),N=a.pendingLanes,(N&1)!==0?a===$m?El++:(El=0,$m=a):El=0,eo(),null}function Ka(){if(oo!==null){var a=tl(Iu),l=Or.transition,d=At;try{if(Or.transition=null,At=16>a?16:a,oo===null)var x=!1;else{if(a=oo,oo=null,Iu=0,(Ct&6)!==0)throw Error(n(331));var w=Ct;for(Ct|=4,We=a.current;We!==null;){var N=We,O=N.child;if((We.flags&16)!==0){var W=N.deletions;if(W!==null){for(var J=0;J<W.length;J++){var de=W[J];for(We=de;We!==null;){var ke=We;switch(ke.tag){case 0:case 11:case 15:Sl(8,ke,N)}var Ne=ke.child;if(Ne!==null)Ne.return=ke,We=Ne;else for(;We!==null;){ke=We;var je=ke.sibling,Ve=ke.return;if(kv(ke),ke===de){We=null;break}if(je!==null){je.return=Ve,We=je;break}We=Ve}}}var qe=N.alternate;if(qe!==null){var Je=qe.child;if(Je!==null){qe.child=null;do{var dn=Je.sibling;Je.sibling=null,Je=dn}while(Je!==null)}}We=N}}if((N.subtreeFlags&2064)!==0&&O!==null)O.return=N,We=O;else e:for(;We!==null;){if(N=We,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Sl(9,N,N.return)}var ie=N.sibling;if(ie!==null){ie.return=N.return,We=ie;break e}We=N.return}}var ee=a.current;for(We=ee;We!==null;){O=We;var ce=O.child;if((O.subtreeFlags&2064)!==0&&ce!==null)ce.return=O,We=ce;else e:for(O=ee;We!==null;){if(W=We,(W.flags&2048)!==0)try{switch(W.tag){case 0:case 11:case 15:Au(9,W)}}catch(Xe){an(W,W.return,Xe)}if(W===O){We=null;break e}var Pe=W.sibling;if(Pe!==null){Pe.return=W.return,We=Pe;break e}We=W.return}}if(Ct=w,eo(),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(ba,a)}catch{}x=!0}return x}finally{At=d,Or.transition=l}}return!1}function Fv(a,l,d){l=Ua(d,l),l=rv(a,l,1),a=no(a,l,1),l=Qn(),a!==null&&(Gr(a,1,l),or(a,l))}function an(a,l,d){if(a.tag===3)Fv(a,a,d);else for(;l!==null;){if(l.tag===3){Fv(l,a,d);break}else if(l.tag===1){var x=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof x.componentDidCatch=="function"&&(so===null||!so.has(x))){a=Ua(d,a),a=sv(l,a,1),l=no(l,a,1),a=Qn(),l!==null&&(Gr(l,1,a),or(l,a));break}}l=l.return}}function hT(a,l,d){var x=a.pingCache;x!==null&&x.delete(l),l=Qn(),a.pingedLanes|=a.suspendedLanes&d,Pn===a&&(_n&d)===d&&(kn===4||kn===3&&(_n&130023424)===_n&&500>en()-Am?Wo(a,0):Pm|=d),or(a,l)}function zv(a,l){l===0&&((a.mode&1)===0?l=1:(l=wa,wa<<=1,(wa&130023424)===0&&(wa=4194304)));var d=Qn();a=Ds(a,l),a!==null&&(Gr(a,l,d),or(a,d))}function gT(a){var l=a.memoizedState,d=0;l!==null&&(d=l.retryLane),zv(a,d)}function xT(a,l){var d=0;switch(a.tag){case 13:var x=a.stateNode,w=a.memoizedState;w!==null&&(d=w.retryLane);break;case 19:x=a.stateNode;break;default:throw Error(n(314))}x!==null&&x.delete(l),zv(a,d)}var Bv;Bv=function(a,l,d){if(a!==null)if(a.memoizedProps!==l.pendingProps||tr.current)rr=!0;else{if((a.lanes&d)===0&&(l.flags&128)===0)return rr=!1,sT(a,l,d);rr=(a.flags&131072)!==0}else rr=!1,Qt&&(l.flags&1048576)!==0&&vb(l,mu,l.index);switch(l.lanes=0,l.tag){case 2:var x=l.type;Ru(a,l),a=l.pendingProps;var w=La(l,Vn.current);za(l,d),w=lm(null,l,x,a,w,d);var N=cm();return l.flags|=1,typeof w=="object"&&w!==null&&typeof w.render=="function"&&w.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,nr(x)?(N=!0,du(l)):N=!1,l.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,tm(l),w.updater=Eu,l.stateNode=w,w._reactInternals=l,hm(l,x,a,d),l=bm(null,l,x,!0,N,d)):(l.tag=0,Qt&&N&&Wp(l),Jn(null,l,w,d),l=l.child),l;case 16:x=l.elementType;e:{switch(Ru(a,l),a=l.pendingProps,w=x._init,x=w(x._payload),l.type=x,w=l.tag=bT(x),a=Qr(x,a),w){case 0:l=ym(null,l,x,a,d);break e;case 1:l=pv(null,l,x,a,d);break e;case 11:l=lv(null,l,x,a,d);break e;case 14:l=cv(null,l,x,Qr(x.type,a),d);break e}throw Error(n(306,x,""))}return l;case 0:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Qr(x,w),ym(a,l,x,w,d);case 1:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Qr(x,w),pv(a,l,x,w,d);case 3:e:{if(mv(l),a===null)throw Error(n(387));x=l.pendingProps,N=l.memoizedState,w=N.element,Rb(a,l),vu(l,x,null,d);var O=l.memoizedState;if(x=O.element,N.isDehydrated)if(N={element:x,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},l.updateQueue.baseState=N,l.memoizedState=N,l.flags&256){w=Ua(Error(n(423)),l),l=hv(a,l,x,d,w);break e}else if(x!==w){w=Ua(Error(n(424)),l),l=hv(a,l,x,d,w);break e}else for(yr=Qs(l.stateNode.containerInfo.firstChild),xr=l,Qt=!0,Jr=null,d=Eb(l,null,x,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(_a(),x===w){l=Ls(a,l,d);break e}Jn(a,l,x,d)}l=l.child}return l;case 5:return Db(l),a===null&&Gp(l),x=l.type,w=l.pendingProps,N=a!==null?a.memoizedProps:null,O=w.children,Fp(x,w)?O=null:N!==null&&Fp(x,N)&&(l.flags|=32),fv(a,l),Jn(a,l,O,d),l.child;case 6:return a===null&&Gp(l),null;case 13:return gv(a,l,d);case 4:return nm(l,l.stateNode.containerInfo),x=l.pendingProps,a===null?l.child=Ma(l,null,x,d):Jn(a,l,x,d),l.child;case 11:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Qr(x,w),lv(a,l,x,w,d);case 7:return Jn(a,l,l.pendingProps,d),l.child;case 8:return Jn(a,l,l.pendingProps.children,d),l.child;case 12:return Jn(a,l,l.pendingProps.children,d),l.child;case 10:e:{if(x=l.type._context,w=l.pendingProps,N=l.memoizedProps,O=w.value,Ut(xu,x._currentValue),x._currentValue=O,N!==null)if(Yr(N.value,O)){if(N.children===w.children&&!tr.current){l=Ls(a,l,d);break e}}else for(N=l.child,N!==null&&(N.return=l);N!==null;){var W=N.dependencies;if(W!==null){O=N.child;for(var J=W.firstContext;J!==null;){if(J.context===x){if(N.tag===1){J=$s(-1,d&-d),J.tag=2;var de=N.updateQueue;if(de!==null){de=de.shared;var ke=de.pending;ke===null?J.next=J:(J.next=ke.next,ke.next=J),de.pending=J}}N.lanes|=d,J=N.alternate,J!==null&&(J.lanes|=d),Zp(N.return,d,l),W.lanes|=d;break}J=J.next}}else if(N.tag===10)O=N.type===l.type?null:N.child;else if(N.tag===18){if(O=N.return,O===null)throw Error(n(341));O.lanes|=d,W=O.alternate,W!==null&&(W.lanes|=d),Zp(O,d,l),O=N.sibling}else O=N.child;if(O!==null)O.return=N;else for(O=N;O!==null;){if(O===l){O=null;break}if(N=O.sibling,N!==null){N.return=O.return,O=N;break}O=O.return}N=O}Jn(a,l,w.children,d),l=l.child}return l;case 9:return w=l.type,x=l.pendingProps.children,za(l,d),w=$r(w),x=x(w),l.flags|=1,Jn(a,l,x,d),l.child;case 14:return x=l.type,w=Qr(x,l.pendingProps),w=Qr(x.type,w),cv(a,l,x,w,d);case 15:return uv(a,l,l.type,l.pendingProps,d);case 17:return x=l.type,w=l.pendingProps,w=l.elementType===x?w:Qr(x,w),Ru(a,l),l.tag=1,nr(x)?(a=!0,du(l)):a=!1,za(l,d),tv(l,x,w),hm(l,x,w,d),bm(null,l,x,!0,a,d);case 19:return yv(a,l,d);case 22:return dv(a,l,d)}throw Error(n(156,l.tag))};function Uv(a,l){return Vc(a,l)}function yT(a,l,d,x){this.tag=a,this.key=d,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 Ir(a,l,d,x){return new yT(a,l,d,x)}function Fm(a){return a=a.prototype,!(!a||!a.isReactComponent)}function bT(a){if(typeof a=="function")return Fm(a)?1:0;if(a!=null){if(a=a.$$typeof,a===H)return 11;if(a===U)return 14}return 2}function lo(a,l){var d=a.alternate;return d===null?(d=Ir(a.tag,l,a.key,a.mode),d.elementType=a.elementType,d.type=a.type,d.stateNode=a.stateNode,d.alternate=a,a.alternate=d):(d.pendingProps=l,d.type=a.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=a.flags&14680064,d.childLanes=a.childLanes,d.lanes=a.lanes,d.child=a.child,d.memoizedProps=a.memoizedProps,d.memoizedState=a.memoizedState,d.updateQueue=a.updateQueue,l=a.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=a.sibling,d.index=a.index,d.ref=a.ref,d}function zu(a,l,d,x,w,N){var O=2;if(x=a,typeof a=="function")Fm(a)&&(O=1);else if(typeof a=="string")O=5;else e:switch(a){case P:return qo(d.children,w,N,l);case $:O=8,w|=8;break;case I:return a=Ir(12,d,l,w|2),a.elementType=I,a.lanes=N,a;case K:return a=Ir(13,d,l,w),a.elementType=K,a.lanes=N,a;case _:return a=Ir(19,d,l,w),a.elementType=_,a.lanes=N,a;case Z:return Bu(d,w,N,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case M:O=10;break e;case D:O=9;break e;case H:O=11;break e;case U:O=14;break e;case q:O=16,x=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return l=Ir(O,d,l,w),l.elementType=a,l.type=x,l.lanes=N,l}function qo(a,l,d,x){return a=Ir(7,a,x,l),a.lanes=d,a}function Bu(a,l,d,x){return a=Ir(22,a,x,l),a.elementType=Z,a.lanes=d,a.stateNode={isHidden:!1},a}function zm(a,l,d){return a=Ir(6,a,null,l),a.lanes=d,a}function Bm(a,l,d){return l=Ir(4,a.children!==null?a.children:[],a.key,l),l.lanes=d,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function vT(a,l,d,x,w){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jt(0),this.expirationTimes=Jt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jt(0),this.identifierPrefix=x,this.onRecoverableError=w,this.mutableSourceEagerHydrationData=null}function Um(a,l,d,x,w,N,O,W,J){return a=new vT(a,l,d,W,J),l===1?(l=1,N===!0&&(l|=8)):l=0,N=Ir(3,null,null,l),a.current=N,N.stateNode=a,N.memoizedState={element:x,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},tm(N),a}function wT(a,l,d){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:d}}function Vv(a){if(!a)return Zs;a=a._reactInternals;e:{if(ht(a)!==a||a.tag!==1)throw Error(n(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(nr(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(n(171))}if(a.tag===1){var d=a.type;if(nr(d))return xb(a,d,l)}return l}function Hv(a,l,d,x,w,N,O,W,J){return a=Um(d,x,!0,a,w,N,O,W,J),a.context=Vv(null),d=a.current,x=Qn(),w=ao(d),N=$s(x,w),N.callback=l??null,no(d,N,w),a.current.lanes=w,Gr(a,w,x),or(a,x),a}function Uu(a,l,d,x){var w=l.current,N=Qn(),O=ao(w);return d=Vv(d),l.context===null?l.context=d:l.pendingContext=d,l=$s(N,O),l.payload={element:a},x=x===void 0?null:x,x!==null&&(l.callback=x),a=no(w,l,O),a!==null&&(es(a,w,O,N),bu(a,w,O)),O}function Vu(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 Wv(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var d=a.retryLane;a.retryLane=d!==0&&d<l?d:l}}function Vm(a,l){Wv(a,l),(a=a.alternate)&&Wv(a,l)}function jT(){return null}var Kv=typeof reportError=="function"?reportError:function(a){console.error(a)};function Hm(a){this._internalRoot=a}Hu.prototype.render=Hm.prototype.render=function(a){var l=this._internalRoot;if(l===null)throw Error(n(409));Uu(a,l,null,null)},Hu.prototype.unmount=Hm.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var l=a.containerInfo;Ho(function(){Uu(null,a,null,null)}),l[Ts]=null}};function Hu(a){this._internalRoot=a}Hu.prototype.unstable_scheduleHydration=function(a){if(a){var l=Sa();a={blockedOn:null,target:a,priority:l};for(var d=0;d<Un.length&&l!==0&&l<Un[d].priority;d++);Un.splice(d,0,a),d===0&&ft(a)}};function Wm(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function Wu(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11&&(a.nodeType!==8||a.nodeValue!==" react-mount-point-unstable "))}function qv(){}function kT(a,l,d,x,w){if(w){if(typeof x=="function"){var N=x;x=function(){var de=Vu(O);N.call(de)}}var O=Hv(l,x,a,0,null,!1,!1,"",qv);return a._reactRootContainer=O,a[Ts]=O.current,dl(a.nodeType===8?a.parentNode:a),Ho(),O}for(;w=a.lastChild;)a.removeChild(w);if(typeof x=="function"){var W=x;x=function(){var de=Vu(J);W.call(de)}}var J=Um(a,0,!1,null,null,!1,!1,"",qv);return a._reactRootContainer=J,a[Ts]=J.current,dl(a.nodeType===8?a.parentNode:a),Ho(function(){Uu(l,J,d,x)}),J}function Ku(a,l,d,x,w){var N=d._reactRootContainer;if(N){var O=N;if(typeof w=="function"){var W=w;w=function(){var J=Vu(O);W.call(J)}}Uu(l,O,a,w)}else O=kT(d,l,a,w,x);return Vu(O)}ja=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var d=qs(l.pendingLanes);d!==0&&(el(l,d|1),or(l,en()),(Ct&6)===0&&(Wa=en()+500,eo()))}break;case 13:Ho(function(){var x=Ds(a,1);if(x!==null){var w=Qn();es(x,a,1,w)}}),Vm(a,1)}},ka=function(a){if(a.tag===13){var l=Ds(a,134217728);if(l!==null){var d=Qn();es(l,a,134217728,d)}Vm(a,134217728)}},Gs=function(a){if(a.tag===13){var l=ao(a),d=Ds(a,l);if(d!==null){var x=Qn();es(d,a,l,x)}Vm(a,l)}},Sa=function(){return At},Yc=function(a,l){var d=At;try{return At=a,l()}finally{At=d}},_t=function(a,l,d){switch(l){case"input":if(Ce(a,d),l=d.name,d.type==="radio"&&l!=null){for(d=a;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<d.length;l++){var x=d[l];if(x!==a&&x.form===a.form){var w=cu(x);if(!w)throw Error(n(90));ct(x),Ce(x,w)}}}break;case"textarea":yt(a,d);break;case"select":l=d.value,l!=null&&Ze(a,!!d.multiple,l,!1)}},ve=Im,Nt=Ho;var ST={usingClientEntryPoint:!1,Events:[ml,Da,cu,Le,tt,Im]},Tl={findFiberByHostInstance:Io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},NT={bundleType:Tl.bundleType,version:Tl.version,rendererPackageName:Tl.rendererPackageName,rendererConfig:Tl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(a){return a=on(a),a===null?null:a.stateNode},findFiberByHostInstance:Tl.findFiberByHostInstance||jT,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 qu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qu.isDisabled&&qu.supportsFiber)try{ba=qu.inject(NT),cn=qu}catch{}}return ar.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ST,ar.createPortal=function(a,l){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wm(l))throw Error(n(200));return wT(a,l,null,d)},ar.createRoot=function(a,l){if(!Wm(a))throw Error(n(299));var d=!1,x="",w=Kv;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(w=l.onRecoverableError)),l=Um(a,1,!1,null,null,d,!1,x,w),a[Ts]=l.current,dl(a.nodeType===8?a.parentNode:a),new Hm(l)},ar.findDOMNode=function(a){if(a==null)return null;if(a.nodeType===1)return a;var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=on(l),a=a===null?null:a.stateNode,a},ar.flushSync=function(a){return Ho(a)},ar.hydrate=function(a,l,d){if(!Wu(l))throw Error(n(200));return Ku(null,a,l,!0,d)},ar.hydrateRoot=function(a,l,d){if(!Wm(a))throw Error(n(405));var x=d!=null&&d.hydratedSources||null,w=!1,N="",O=Kv;if(d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(N=d.identifierPrefix),d.onRecoverableError!==void 0&&(O=d.onRecoverableError)),l=Hv(l,null,a,1,d??null,w,!1,N,O),a[Ts]=l.current,dl(a),x)for(a=0;a<x.length;a++)d=x[a],w=d._getVersion,w=w(d._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[d,w]:l.mutableSourceEagerHydrationData.push(d,w);return new Hu(l)},ar.render=function(a,l,d){if(!Wu(l))throw Error(n(200));return Ku(null,a,l,!1,d)},ar.unmountComponentAtNode=function(a){if(!Wu(a))throw Error(n(40));return a._reactRootContainer?(Ho(function(){Ku(null,null,a,!1,function(){a._reactRootContainer=null,a[Ts]=null})}),!0):!1},ar.unstable_batchedUpdates=Im,ar.unstable_renderSubtreeIntoContainer=function(a,l,d,x){if(!Wu(d))throw Error(n(200));if(a==null||a._reactInternals===void 0)throw Error(n(38));return Ku(a,l,d,!1,x)},ar.version="18.3.1-next-f1338f8080-20240426",ar}var tw;function G0(){if(tw)return Ym.exports;tw=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(),Ym.exports=OT(),Ym.exports}var nw;function IT(){if(nw)return Gu;nw=1;var e=G0();return Gu.createRoot=e.createRoot,Gu.hydrateRoot=e.hydrateRoot,Gu}var _T=IT();/**
|
|
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 rw="popstate";function sw(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function MT(e={}){function t(s,o){var m;let i=(m=o.state)==null?void 0:m.masked,{pathname:c,search:u,hash:f}=i||s.location;return Zh("",{pathname:c,search:u,hash:f},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:ic(o)}return zT(t,n,null,e)}function rn(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 FT(){return Math.random().toString(36).substring(2,10)}function ow(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 Zh(e,t,n=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ai(t):t,state:n,key:t&&t.key||s||FT(),unstable_mask:o}}function ic({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 Ai(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 zT(e,t,n,s={}){let{window:o=document.defaultView,v5Compat:i=!1}=s,c=o.history,u="POP",f=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,f&&f({action:u,location:j.location,delta:k})}function y(v,k){u="PUSH";let E=sw(v)?v:Zh(j.location,v,k);m=h()+1;let S=ow(E,m),T=j.createHref(E.unstable_mask||E);try{c.pushState(S,"",T)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;o.location.assign(T)}i&&f&&f({action:u,location:j.location,delta:1})}function b(v,k){u="REPLACE";let E=sw(v)?v:Zh(j.location,v,k);m=h();let S=ow(E,m),T=j.createHref(E.unstable_mask||E);c.replaceState(S,"",T),i&&f&&f({action:u,location:j.location,delta:0})}function C(v){return BT(v)}let j={get action(){return u},get location(){return e(o,c)},listen(v){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(rw,g),f=v,()=>{o.removeEventListener(rw,g),f=null}},createHref(v){return t(o,v)},createURL:C,encodeLocation(v){let k=C(v);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:b,go(v){return c.go(v)}};return j}function BT(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),rn(n,"No window.location.(origin|href) available to create URL");let s=typeof e=="string"?e:ic(e);return s=s.replace(/ $/,"%20"),!t&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function Y0(e,t,n="/"){return UT(e,t,n,!1)}function UT(e,t,n,s){let o=typeof t=="string"?Ai(t):t,i=zs(o.pathname||"/",n);if(i==null)return null;let c=J0(e);VT(c);let u=null;for(let f=0;u==null&&f<c.length;++f){let m=eR(i);u=XT(c[f],m,s)}return u}function J0(e,t=[],n=[],s="",o=!1){let i=(c,u,f=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)&&f)return;rn(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=ws([s,h.relativePath]),y=n.concat(h);c.children&&c.children.length>0&&(rn(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),J0(c.children,t,y,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:JT(g,c.index),routesMeta:y})};return e.forEach((c,u)=>{var f;if(c.path===""||!((f=c.path)!=null&&f.includes("?")))i(c,u);else for(let m of Q0(c.path))i(c,u,!0,m)}),t}function Q0(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=Q0(s.join("/")),u=[];return u.push(...c.map(f=>f===""?i:[i,f].join("/"))),o&&u.push(...c),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function VT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:QT(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var HT=/^:[\w-]+$/,WT=3,KT=2,qT=1,GT=10,YT=-2,aw=e=>e==="*";function JT(e,t){let n=e.split("/"),s=n.length;return n.some(aw)&&(s+=YT),t&&(s+=KT),n.filter(o=>!aw(o)).reduce((o,i)=>o+(HT.test(i)?WT:i===""?qT:GT),s)}function QT(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 XT(e,t,n=!1){let{routesMeta:s}=e,o={},i="/",c=[];for(let u=0;u<s.length;++u){let f=s[u],m=u===s.length-1,h=i==="/"?t:t.slice(i.length)||"/",g=Pd({path:f.relativePath,caseSensitive:f.caseSensitive,end:m},h),y=f.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=Pd({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},h)),!g)return null;Object.assign(o,g.params),c.push({params:o,pathname:ws([i,g.pathname]),pathnameBase:sR(ws([i,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(i=ws([i,g.pathnameBase]))}return c}function Pd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=ZT(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],c=i.replace(/(.)\/+$/,"$1"),u=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:g},y)=>{if(h==="*"){let C=u[y]||"";c=i.slice(0,i.length-C.length).replace(/(.)\/+$/,"$1")}const b=u[y];return g&&!b?m[h]=void 0:m[h]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:i,pathnameBase:c,pattern:e}}function ZT(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,f,m,h)=>{if(s.push({paramName:u,isOptional:f!=null}),f){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 eR(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 zs(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 tR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function nR(e,t="/"){let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Ai(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=iw(n.substring(1),"/"):i=iw(n,t)):i=t,{pathname:i,search:oR(s),hash:aR(o)}}function iw(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 Xm(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 rR(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function X0(e){let t=rR(e);return t.map((n,s)=>s===t.length-1?n.pathname:n.pathnameBase)}function Vg(e,t,n,s=!1){let o;typeof e=="string"?o=Ai(e):(o={...e},rn(!o.pathname||!o.pathname.includes("?"),Xm("?","pathname","search",o)),rn(!o.pathname||!o.pathname.includes("#"),Xm("#","pathname","hash",o)),rn(!o.search||!o.search.includes("#"),Xm("#","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 f=nR(o,u),m=c&&c!=="/"&&c.endsWith("/"),h=(i||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(m||h)&&(f.pathname+="/"),f}var ws=e=>e.join("/").replace(/\/\/+/g,"/"),sR=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),oR=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,aR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,iR=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 lR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function cR(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Z0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ek(e,t){let n=e;if(typeof n!="string"||!tR.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,o=!1;if(Z0)try{let i=new URL(window.location.href),c=n.startsWith("//")?new URL(i.protocol+n):new URL(n),u=zs(c.pathname,t);c.origin===i.origin&&u!=null?n=u+c.search+c.hash:o=!0}catch{ts(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var tk=["POST","PUT","PATCH","DELETE"];new Set(tk);var uR=["GET",...tk];new Set(uR);var Di=p.createContext(null);Di.displayName="DataRouter";var ff=p.createContext(null);ff.displayName="DataRouterState";var dR=p.createContext(!1),nk=p.createContext({isTransitioning:!1});nk.displayName="ViewTransition";var fR=p.createContext(new Map);fR.displayName="Fetchers";var pR=p.createContext(null);pR.displayName="Await";var Ur=p.createContext(null);Ur.displayName="Navigation";var vc=p.createContext(null);vc.displayName="Location";var is=p.createContext({outlet:null,matches:[],isDataRoute:!1});is.displayName="Route";var Hg=p.createContext(null);Hg.displayName="RouteError";var rk="REACT_ROUTER_ERROR",mR="REDIRECT",hR="ROUTE_ERROR_RESPONSE";function gR(e){if(e.startsWith(`${rk}:${mR}:{`))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 xR(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 iR(t.status,t.statusText,t.data)}catch{}}function yR(e,{relative:t}={}){rn(wc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=p.useContext(Ur),{hash:o,pathname:i,search:c}=jc(e,{relative:t}),u=i;return n!=="/"&&(u=i==="/"?n:ws([n,i])),s.createHref({pathname:u,search:c,hash:o})}function wc(){return p.useContext(vc)!=null}function Xn(){return rn(wc(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(vc).location}var sk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ok(e){p.useContext(Ur).static||p.useLayoutEffect(e)}function zt(){let{isDataRoute:e}=p.useContext(is);return e?$R():bR()}function bR(){rn(wc(),"useNavigate() may be used only in the context of a <Router> component.");let e=p.useContext(Di),{basename:t,navigator:n}=p.useContext(Ur),{matches:s}=p.useContext(is),{pathname:o}=Xn(),i=JSON.stringify(X0(s)),c=p.useRef(!1);return ok(()=>{c.current=!0}),p.useCallback((f,m={})=>{if(ts(c.current,sk),!c.current)return;if(typeof f=="number"){n.go(f);return}let h=Vg(f,JSON.parse(i),o,m.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ws([t,h.pathname])),(m.replace?n.replace:n.push)(h,m.state,m)},[t,n,i,o,e])}var vR=p.createContext(null);function wR(e){let t=p.useContext(is).outlet;return p.useMemo(()=>t&&p.createElement(vR.Provider,{value:e},t),[t,e])}function Bt(){let{matches:e}=p.useContext(is),t=e[e.length-1];return t?t.params:{}}function jc(e,{relative:t}={}){let{matches:n}=p.useContext(is),{pathname:s}=Xn(),o=JSON.stringify(X0(n));return p.useMemo(()=>Vg(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function jR(e,t){return ak(e,t)}function ak(e,t,n){var v;rn(wc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=p.useContext(Ur),{matches:o}=p.useContext(is),i=o[o.length-1],c=i?i.params:{},u=i?i.pathname:"/",f=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"?Ai(t):t;rn(f==="/"||((v=k.pathname)==null?void 0:v.startsWith(f)),`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 "${f}" but pathname "${k.pathname}" was given in the \`location\` prop.`),g=k}else g=h;let y=g.pathname||"/",b=y;if(f!=="/"){let k=f.replace(/^\//,"").split("/");b="/"+y.replace(/^\//,"").split("/").slice(k.length).join("/")}let C=Y0(e,{pathname:b});ts(m||C!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ts(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let j=ER(C&&C.map(k=>Object.assign({},k,{params:Object.assign({},c,k.params),pathname:ws([f,s.encodeLocation?s.encodeLocation(k.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:ws([f,s.encodeLocation?s.encodeLocation(k.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),o,n);return t&&j?p.createElement(vc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},j):j}function kR(){let e=DR(),t=lR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},i={padding:"2px 4px",backgroundColor:s},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:i},"ErrorBoundary")," or"," ",p.createElement("code",{style:i},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),n?p.createElement("pre",{style:o},n):null,c)}var SR=p.createElement(kR,null),ik=class extends p.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=xR(e.digest);n&&(e=n)}let t=e!==void 0?p.createElement(is.Provider,{value:this.props.routeContext},p.createElement(Hg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?p.createElement(NR,{error:e},t):t}};ik.contextType=dR;var Zm=new WeakMap;function NR({children:e,error:t}){let{basename:n}=p.useContext(Ur);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=gR(t.digest);if(s){let o=Zm.get(t);if(o)throw o;let i=ek(s.location,n);if(Z0&&!Zm.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 Zm.set(t,c),c}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function CR({routeContext:e,match:t,children:n}){let s=p.useContext(Di);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),p.createElement(is.Provider,{value:e},n)}function ER(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);rn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let c=!1,u=-1;if(n&&s){c=s.renderFallback;for(let h=0;h<o.length;h++){let g=o[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:y,errors:b}=s,C=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||C){n.isStatic&&(c=!0),u>=0?o=o.slice(0,u+1):o=[o[0]];break}}}}let f=n==null?void 0:n.onError,m=s&&f?(h,g)=>{var y,b;f(h,{location:s.location,params:((b=(y=s.matches)==null?void 0:y[0])==null?void 0:b.params)??{},unstable_pattern:cR(s.matches),errorInfo:g})}:void 0;return o.reduceRight((h,g,y)=>{let b,C=!1,j=null,v=null;s&&(b=i&&g.route.id?i[g.route.id]:void 0,j=g.route.errorElement||SR,c&&(u<0&&y===0?(lk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),C=!0,v=null):u===y&&(C=!0,v=g.route.hydrateFallbackElement||null)));let k=t.concat(o.slice(0,y+1)),E=()=>{let S;return b?S=j:C?S=v:g.route.Component?S=p.createElement(g.route.Component,null):g.route.element?S=g.route.element:S=h,p.createElement(CR,{match:g,routeContext:{outlet:h,matches:k,isDataRoute:s!=null},children:S})};return s&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?p.createElement(ik,{location:s.location,revalidation:s.revalidation,component:j,error:b,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function Wg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function TR(e){let t=p.useContext(Di);return rn(t,Wg(e)),t}function RR(e){let t=p.useContext(ff);return rn(t,Wg(e)),t}function PR(e){let t=p.useContext(is);return rn(t,Wg(e)),t}function Kg(e){let t=PR(e),n=t.matches[t.matches.length-1];return rn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function AR(){return Kg("useRouteId")}function DR(){var s;let e=p.useContext(Hg),t=RR("useRouteError"),n=Kg("useRouteError");return e!==void 0?e:(s=t.errors)==null?void 0:s[n]}function $R(){let{router:e}=TR("useNavigate"),t=Kg("useNavigate"),n=p.useRef(!1);return ok(()=>{n.current=!0}),p.useCallback(async(o,i={})=>{ts(n.current,sk),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var lw={};function lk(e,t,n){!t&&!lw[e]&&(lw[e]=!0,ts(!1,n))}p.memo(LR);function LR({routes:e,future:t,state:n,isStatic:s,onError:o}){return ak(e,void 0,{state:n,isStatic:s,onError:o})}function OR(e){return wR(e.context)}function Ge(e){rn(!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 IR({basename:e="/",children:t=null,location:n,navigationType:s="POP",navigator:o,static:i=!1,unstable_useTransitions:c}){rn(!wc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),f=p.useMemo(()=>({basename:u,navigator:o,static:i,unstable_useTransitions:c,future:{}}),[u,o,i,c]);typeof n=="string"&&(n=Ai(n));let{pathname:m="/",search:h="",hash:g="",state:y=null,key:b="default",unstable_mask:C}=n,j=p.useMemo(()=>{let v=zs(m,u);return v==null?null:{location:{pathname:v,search:h,hash:g,state:y,key:b,unstable_mask:C},navigationType:s}},[u,m,h,g,y,b,s,C]);return ts(j!=null,`<Router basename="${u}"> is not able to match the URL "${m}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:p.createElement(Ur.Provider,{value:f},p.createElement(vc.Provider,{children:t,value:j}))}function _R({children:e,location:t}){return jR(eg(e),t)}function eg(e,t=[]){let n=[];return p.Children.forEach(e,(s,o)=>{if(!p.isValidElement(s))return;let i=[...t,o];if(s.type===p.Fragment){n.push.apply(n,eg(s.props.children,i));return}rn(s.type===Ge,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),rn(!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=eg(s.props.children,i)),n.push(c)}),n}var md="get",hd="application/x-www-form-urlencoded";function pf(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function MR(e){return pf(e)&&e.tagName.toLowerCase()==="button"}function FR(e){return pf(e)&&e.tagName.toLowerCase()==="form"}function zR(e){return pf(e)&&e.tagName.toLowerCase()==="input"}function BR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function UR(e,t){return e.button===0&&(!t||t==="_self")&&!BR(e)}function tg(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 VR(e,t){let n=tg(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var Yu=null;function HR(){if(Yu===null)try{new FormData(document.createElement("form"),0),Yu=!1}catch{Yu=!0}return Yu}var WR=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function eh(e){return e!=null&&!WR.has(e)?(ts(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${hd}"`),null):e}function KR(e,t){let n,s,o,i,c;if(FR(e)){let u=e.getAttribute("action");s=u?zs(u,t):null,n=e.getAttribute("method")||md,o=eh(e.getAttribute("enctype"))||hd,i=new FormData(e)}else if(MR(e)||zR(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 f=e.getAttribute("formaction")||u.getAttribute("action");if(s=f?zs(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||md,o=eh(e.getAttribute("formenctype"))||eh(u.getAttribute("enctype"))||hd,i=new FormData(u,e),!HR()){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(pf(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=md,s=null,o=hd,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 qg(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function qR(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&&zs(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${s}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${s}`,o}async function GR(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 YR(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 JR(e,t,n){let s=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let c=await GR(i,n);return c.links?c.links():[]}return[]}));return eP(s.flat(1).filter(YR).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function cw(e,t,n,s,o,i){let c=(f,m)=>n[m]?f.route.id!==n[m].route.id:!0,u=(f,m)=>{var h;return n[m].pathname!==f.pathname||((h=n[m].route.path)==null?void 0:h.endsWith("*"))&&n[m].params["*"]!==f.params["*"]};return i==="assets"?t.filter((f,m)=>c(f,m)||u(f,m)):i==="data"?t.filter((f,m)=>{var g;let h=s.routes[f.route.id];if(!h||!h.hasLoader)return!1;if(c(f,m)||u(f,m))return!0;if(f.route.shouldRevalidate){let y=f.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:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function QR(e,t,{includeHydrateFallback:n}={}){return XR(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 XR(e){return[...new Set(e)]}function ZR(e){let t={},n=Object.keys(e).sort();for(let s of n)t[s]=e[s];return t}function eP(e,t){let n=new Set;return new Set(t),e.reduce((s,o)=>{let i=JSON.stringify(ZR(o));return n.has(i)||(n.add(i),s.push({key:i,link:o})),s},[])}function ck(){let e=p.useContext(Di);return qg(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function tP(){let e=p.useContext(ff);return qg(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Gg=p.createContext(void 0);Gg.displayName="FrameworkContext";function uk(){let e=p.useContext(Gg);return qg(e,"You must render this element inside a <HydratedRouter> element"),e}function nP(e,t){let n=p.useContext(Gg),[s,o]=p.useState(!1),[i,c]=p.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=t,y=p.useRef(null);p.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=k=>{k.forEach(E=>{c(E.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return y.current&&v.observe(y.current),()=>{v.disconnect()}}},[e]),p.useEffect(()=>{if(s){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[s]);let b=()=>{o(!0)},C=()=>{o(!1),c(!1)};return n?e!=="intent"?[i,y,{}]:[i,y,{onFocus:Pl(u,b),onBlur:Pl(f,C),onMouseEnter:Pl(m,b),onMouseLeave:Pl(h,C),onTouchStart:Pl(g,b)}]:[!1,y,{}]}function Pl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function rP({page:e,...t}){let{router:n}=ck(),s=p.useMemo(()=>Y0(n.routes,e,n.basename),[n.routes,e,n.basename]);return s?p.createElement(oP,{page:e,matches:s,...t}):null}function sP(e){let{manifest:t,routeModules:n}=uk(),[s,o]=p.useState([]);return p.useEffect(()=>{let i=!1;return JR(e,t,n).then(c=>{i||o(c)}),()=>{i=!0}},[e,t,n]),s}function oP({page:e,matches:t,...n}){let s=Xn(),{future:o,manifest:i,routeModules:c}=uk(),{basename:u}=ck(),{loaderData:f,matches:m}=tP(),h=p.useMemo(()=>cw(e,t,m,i,s,"data"),[e,t,m,i,s]),g=p.useMemo(()=>cw(e,t,m,i,s,"assets"),[e,t,m,i,s]),y=p.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let j=new Set,v=!1;if(t.forEach(E=>{var T;let S=i.routes[E.route.id];!S||!S.hasLoader||(!h.some(A=>A.route.id===E.route.id)&&E.route.id in f&&((T=c[E.route.id])!=null&&T.shouldRevalidate)||S.hasClientLoader?v=!0:j.add(E.route.id))}),j.size===0)return[];let k=qR(e,u,o.unstable_trailingSlashAwareDataRequests,"data");return v&&j.size>0&&k.searchParams.set("_routes",t.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[u,o.unstable_trailingSlashAwareDataRequests,f,s,i,h,t,e,c]),b=p.useMemo(()=>QR(g,i),[g,i]),C=sP(g);return p.createElement(p.Fragment,null,y.map(j=>p.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),b.map(j=>p.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),C.map(({key:j,link:v})=>p.createElement("link",{key:j,nonce:n.nonce,...v,crossOrigin:v.crossOrigin??n.crossOrigin})))}function aP(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var iP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{iP&&(window.__reactRouterVersion="7.13.1")}catch{}function lP({basename:e,children:t,unstable_useTransitions:n,window:s}){let o=p.useRef();o.current==null&&(o.current=MT({window:s,v5Compat:!0}));let i=o.current,[c,u]=p.useState({action:i.action,location:i.location}),f=p.useCallback(m=>{n===!1?u(m):p.startTransition(()=>u(m))},[n]);return p.useLayoutEffect(()=>i.listen(f),[i,f]),p.createElement(IR,{basename:e,children:t,location:c.location,navigationType:c.action,navigator:i,unstable_useTransitions:n})}var dk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Te=p.forwardRef(function({onClick:t,discover:n="render",prefetch:s="none",relative:o,reloadDocument:i,replace:c,unstable_mask:u,state:f,target:m,to:h,preventScrollReset:g,viewTransition:y,unstable_defaultShouldRevalidate:b,...C},j){let{basename:v,navigator:k,unstable_useTransitions:E}=p.useContext(Ur),S=typeof h=="string"&&dk.test(h),T=ek(h,v);h=T.to;let A=yR(h,{relative:o}),R=Xn(),P=null;if(u){let U=Vg(u,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);v!=="/"&&(U.pathname=U.pathname==="/"?v:ws([v,U.pathname])),P=k.createHref(U)}let[$,I,M]=nP(s,C),D=fP(h,{replace:c,unstable_mask:u,state:f,target:m,preventScrollReset:g,relative:o,viewTransition:y,unstable_defaultShouldRevalidate:b,unstable_useTransitions:E});function H(U){t&&t(U),U.defaultPrevented||D(U)}let K=!(T.isExternal||i),_=p.createElement("a",{...C,...M,href:(K?P:void 0)||T.absoluteURL||A,onClick:K?H:t,ref:aP(j,I),target:m,"data-discover":!S&&n==="render"?"true":void 0});return $&&!S?p.createElement(p.Fragment,null,_,p.createElement(rP,{page:A})):_});Te.displayName="Link";var cP=p.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:s="",end:o=!1,style:i,to:c,viewTransition:u,children:f,...m},h){let g=jc(c,{relative:m.relative}),y=Xn(),b=p.useContext(ff),{navigator:C,basename:j}=p.useContext(Ur),v=b!=null&&xP(g)&&u===!0,k=C.encodeLocation?C.encodeLocation(g).pathname:g.pathname,E=y.pathname,S=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(E=E.toLowerCase(),S=S?S.toLowerCase():null,k=k.toLowerCase()),S&&j&&(S=zs(S,j)||S);const T=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let A=E===k||!o&&E.startsWith(k)&&E.charAt(T)==="/",R=S!=null&&(S===k||!o&&S.startsWith(k)&&S.charAt(k.length)==="/"),P={isActive:A,isPending:R,isTransitioning:v},$=A?t:void 0,I;typeof s=="function"?I=s(P):I=[s,A?"active":null,R?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let M=typeof i=="function"?i(P):i;return p.createElement(Te,{...m,"aria-current":$,className:I,ref:h,style:M,to:c,viewTransition:u},typeof f=="function"?f(P):f)});cP.displayName="NavLink";var uP=p.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:s,replace:o,state:i,method:c=md,action:u,onSubmit:f,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...b},C)=>{let{unstable_useTransitions:j}=p.useContext(Ur),v=hP(),k=gP(u,{relative:m}),E=c.toLowerCase()==="get"?"get":"post",S=typeof u=="string"&&dk.test(u),T=A=>{if(f&&f(A),A.defaultPrevented)return;A.preventDefault();let R=A.nativeEvent.submitter,P=(R==null?void 0:R.getAttribute("formmethod"))||c,$=()=>v(R||A.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:o,state:i,relative:m,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y});j&&n!==!1?p.startTransition(()=>$()):$()};return p.createElement("form",{ref:C,method:E,action:k,onSubmit:s?f:T,...b,"data-discover":!S&&e==="render"?"true":void 0})});uP.displayName="Form";function dP(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fk(e){let t=p.useContext(Di);return rn(t,dP(e)),t}function fP(e,{target:t,replace:n,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f,unstable_useTransitions:m}={}){let h=zt(),g=Xn(),y=jc(e,{relative:c});return p.useCallback(b=>{if(UR(b,t)){b.preventDefault();let C=n!==void 0?n:ic(g)===ic(y),j=()=>h(e,{replace:C,unstable_mask:s,state:o,preventScrollReset:i,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:f});m?p.startTransition(()=>j()):j()}},[g,h,y,n,s,o,t,e,i,c,u,f,m])}function Ns(e){ts(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=p.useRef(tg(e)),n=p.useRef(!1),s=Xn(),o=p.useMemo(()=>VR(s.search,n.current?null:t.current),[s.search]),i=zt(),c=p.useCallback((u,f)=>{const m=tg(typeof u=="function"?u(new URLSearchParams(o)):u);n.current=!0,i("?"+m,f)},[i,o]);return[o,c]}var pP=0,mP=()=>`__${String(++pP)}__`;function hP(){let{router:e}=fk("useSubmit"),{basename:t}=p.useContext(Ur),n=AR(),s=e.fetch,o=e.navigate;return p.useCallback(async(i,c={})=>{let{action:u,method:f,encType:m,formData:h,body:g}=KR(i,t);if(c.navigate===!1){let y=c.fetcherKey||mP();await s(y,n,c.action||u,{unstable_defaultShouldRevalidate:c.unstable_defaultShouldRevalidate,preventScrollReset:c.preventScrollReset,formData:h,body:g,formMethod:c.method||f,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||f,formEncType:c.encType||m,replace:c.replace,state:c.state,fromRouteId:n,flushSync:c.flushSync,viewTransition:c.viewTransition})},[s,o,t,n])}function gP(e,{relative:t}={}){let{basename:n}=p.useContext(Ur),s=p.useContext(is);rn(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),i={...jc(e||".",{relative:t})},c=Xn();if(e==null){i.search=c.search;let u=new URLSearchParams(i.search),f=u.getAll("index");if(f.some(h=>h==="")){u.delete("index"),f.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:ws([n,i.pathname])),ic(i)}function xP(e,{relative:t}={}){let n=p.useContext(nk);rn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=fk("useViewTransitionState"),o=jc(e,{relative:t});if(!n.isTransitioning)return!1;let i=zs(n.currentLocation.pathname,s)||n.currentLocation.pathname,c=zs(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Pd(o.pathname,c)!=null||Pd(o.pathname,i)!=null}var Ms=G0();const yP=df(Ms);/**
|
|
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 bP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),pk=(...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 vP={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 wP=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:c,...u},f)=>p.createElement("svg",{ref:f,...vP,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:pk("lucide",o),...u},[...c.map(([m,h])=>p.createElement(m,h)),...Array.isArray(i)?i:[i]]));/**
|
|
67
|
+
* @license lucide-react v0.460.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Oe=(e,t)=>{const n=p.forwardRef(({className:s,...o},i)=>p.createElement(wP,{ref:i,iconNode:t,className:pk(`lucide-${bP(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 mf=Oe("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 Ad=Oe("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 hf=Oe("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 Dd=Oe("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 gf=Oe("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 mk=Oe("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 $d=Oe("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 jP=Oe("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 hk=Oe("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 xf=Oe("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 kP=Oe("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=Oe("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 fr=Oe("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 SP=Oe("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 gk=Oe("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 xk=Oe("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 Ld=Oe("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 Yg=Oe("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 ng=Oe("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 NP=Oe("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 CP=Oe("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 EP=Oe("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 TP=Oe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
187
|
+
* @license lucide-react v0.460.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const RP=Oe("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 PP=Oe("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 yf=Oe("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 AP=Oe("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 yk=Oe("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 Od=Oe("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 DP=Oe("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 $P=Oe("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 $i=Oe("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 uw=Oe("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 LP=Oe("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 OP=Oe("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 bk=Oe("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 Jg=Oe("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 IP=Oe("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 Qg=Oe("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 _P=Oe("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 Li=Oe("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=Oe("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 Xg=Oe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 rg=Oe("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"}]]);/**
|
|
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 vk=Oe("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"}]]);/**
|
|
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 FP=Oe("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"}]]);/**
|
|
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 zP=Oe("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"}]]);/**
|
|
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 BP=Oe("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"}]]);/**
|
|
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 UP=Oe("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"}]]);/**
|
|
317
|
+
* @license lucide-react v0.460.0 - ISC
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the ISC license.
|
|
320
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/const VP=Oe("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"}]]);/**
|
|
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 Zg=Oe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 HP=Oe("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"}]]);/**
|
|
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=Oe("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"}]]);/**
|
|
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 ex=Oe("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"}]]);/**
|
|
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 KP=Oe("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"}]]);/**
|
|
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 th=Oe("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"}]]);/**
|
|
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 wk=Oe("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"}]]);/**
|
|
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 Oi=Oe("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"}]]);/**
|
|
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 qP=Oe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 Lt=Oe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 jk=Oe("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"}]]);/**
|
|
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 GP=Oe("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"}]]);/**
|
|
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 YP=Oe("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
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 Bs=Oe("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"}]]);/**
|
|
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 bf=Oe("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"}]]);/**
|
|
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 JP=Oe("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"}]]);/**
|
|
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 No=Oe("Search",[["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 QP=Oe("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"}]]);/**
|
|
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 XP=Oe("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"}]]);/**
|
|
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 ZP=Oe("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"}]]);/**
|
|
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 eA=Oe("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"}]]);/**
|
|
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 Fr=Oe("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"}]]);/**
|
|
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 dw=Oe("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"}]]);/**
|
|
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 fw=Oe("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"}]]);/**
|
|
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 tx=Oe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
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 tA=Oe("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"}]]);/**
|
|
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 kk=Oe("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"}]]);/**
|
|
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 pi=Oe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
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 Tn=Oe("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"}]]);/**
|
|
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 nx=Oe("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"}]]);/**
|
|
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 nA=Oe("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"}]]);/**
|
|
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 rA=Oe("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"}]]);/**
|
|
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 rx=Oe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Sk(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=Sk(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function sA(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Sk(e))&&(s&&(s+=" "),s+=t);return s}const sx="-",oA=e=>{const t=iA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:c=>{const u=c.split(sx);return u[0]===""&&u.length!==1&&u.shift(),Nk(u,t)||aA(c)},getConflictingClassGroupIds:(c,u)=>{const f=n[c]||[];return u&&s[c]?[...f,...s[c]]:f}}},Nk=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),o=s?Nk(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=/^\[(.+)\]$/,aA=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}},iA=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return cA(Object.entries(e.classGroups),n).forEach(([i,c])=>{sg(c,s,i,t)}),s},sg=(e,t,n,s)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:mw(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(lA(o)){sg(o(s),t,n,s);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,c])=>{sg(c,mw(t,i),n,s)})})},mw=(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},lA=e=>e.isThemeGetter,cA=(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,uA=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)}}},Ck="!",dA=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,o=t[0],i=t.length,c=u=>{const f=[];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)){f.push(u.slice(h,v)),h=v+i;continue}if(k==="/"){g=v;continue}}k==="["?m++:k==="]"&&m--}const y=f.length===0?u:u.substring(h),b=y.startsWith(Ck),C=b?y.substring(1):y,j=g&&g>h?g-h:void 0;return{modifiers:f,hasImportantModifier:b,baseClassName:C,maybePostfixModifierPosition:j}};return n?u=>n({className:u,parseClassName:c}):c},fA=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},pA=e=>({cache:uA(e.cacheSize),parseClassName:dA(e),...oA(e)}),mA=/\s+/,hA=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o}=t,i=[],c=e.trim().split(mA);let u="";for(let f=c.length-1;f>=0;f-=1){const m=c[f],{modifiers:h,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=n(m);let C=!!b,j=s(C?y.substring(0,b):y);if(!j){if(!C){u=m+(u.length>0?" "+u:u);continue}if(j=s(y),!j){u=m+(u.length>0?" "+u:u);continue}C=!1}const v=fA(h).join(":"),k=g?v+Ck:v,E=k+j;if(i.includes(E))continue;i.push(E);const S=o(j,C);for(let T=0;T<S.length;++T){const A=S[T];i.push(k+A)}u=m+(u.length>0?" "+u:u)}return u};function gA(){let e=0,t,n,s="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ek(t))&&(s&&(s+=" "),s+=n);return s}const Ek=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=Ek(e[s]))&&(n&&(n+=" "),n+=t);return n};function xA(e,...t){let n,s,o,i=c;function c(f){const m=t.reduce((h,g)=>g(h),e());return n=pA(m),s=n.cache.get,o=n.cache.set,i=u,u(f)}function u(f){const m=s(f);if(m)return m;const h=hA(f,n);return o(f,h),h}return function(){return i(gA.apply(null,arguments))}}const qt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Tk=/^\[(?:([a-z-]+):)?(.+)\]$/i,yA=/^\d+\/\d+$/,bA=new Set(["px","full","screen"]),vA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wA=/\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$/,jA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,SA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Is=e=>mi(e)||bA.has(e)||yA.test(e),uo=e=>Ii(e,"length",DA),mi=e=>!!e&&!Number.isNaN(Number(e)),nh=e=>Ii(e,"number",mi),Al=e=>!!e&&Number.isInteger(Number(e)),NA=e=>e.endsWith("%")&&mi(e.slice(0,-1)),pt=e=>Tk.test(e),fo=e=>vA.test(e),CA=new Set(["length","size","percentage"]),EA=e=>Ii(e,CA,Rk),TA=e=>Ii(e,"position",Rk),RA=new Set(["image","url"]),PA=e=>Ii(e,RA,LA),AA=e=>Ii(e,"",$A),Dl=()=>!0,Ii=(e,t,n)=>{const s=Tk.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},DA=e=>wA.test(e)&&!jA.test(e),Rk=()=>!1,$A=e=>kA.test(e),LA=e=>SA.test(e),OA=()=>{const e=qt("colors"),t=qt("spacing"),n=qt("blur"),s=qt("brightness"),o=qt("borderColor"),i=qt("borderRadius"),c=qt("borderSpacing"),u=qt("borderWidth"),f=qt("contrast"),m=qt("grayscale"),h=qt("hueRotate"),g=qt("invert"),y=qt("gap"),b=qt("gradientColorStops"),C=qt("gradientColorStopPositions"),j=qt("inset"),v=qt("margin"),k=qt("opacity"),E=qt("padding"),S=qt("saturate"),T=qt("scale"),A=qt("sepia"),R=qt("skew"),P=qt("space"),$=qt("translate"),I=()=>["auto","contain","none"],M=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",pt,t],H=()=>[pt,t],K=()=>["",Is,uo],_=()=>["auto",mi,pt],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",pt],L=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[mi,pt];return{cacheSize:500,separator:":",theme:{colors:[Dl],spacing:[Is,uo],blur:["none","",fo,pt],brightness:V(),borderColor:[e],borderRadius:["none","","full",fo,pt],borderSpacing:H(),borderWidth:K(),contrast:V(),grayscale:G(),hueRotate:V(),invert:G(),gap:H(),gradientColorStops:[e],gradientColorStopPositions:[NA,uo],inset:D(),margin:D(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:G(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",pt]}],container:["container"],columns:[{columns:[fo]}],"break-after":[{"break-after":L()}],"break-before":[{"break-before":L()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),pt]}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Al,pt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Al,pt]}],"grid-cols":[{"grid-cols":[Dl]}],"col-start-end":[{col:["auto",{span:["full",Al,pt]},pt]}],"col-start":[{"col-start":_()}],"col-end":[{"col-end":_()}],"grid-rows":[{"grid-rows":[Dl]}],"row-start-end":[{row:["auto",{span:[Al,pt]},pt]}],"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",pt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",pt,t]}],"min-w":[{"min-w":[pt,t,"min","max","fit"]}],"max-w":[{"max-w":[pt,t,"none","full","min","max","fit","prose",{screen:[fo]},fo]}],h:[{h:[pt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fo,uo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",nh]}],"font-family":[{font:[Dl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",pt]}],"line-clamp":[{"line-clamp":["none",mi,nh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Is,pt]}],"list-image":[{"list-image":["none",pt]}],"list-style-type":[{list:["none","disc","decimal",pt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Is,uo]}],"underline-offset":[{"underline-offset":["auto",Is,pt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),TA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:q()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[Is,pt]}],"outline-w":[{outline:[Is,uo]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[Is,uo]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fo,AA]}],"shadow-color":[{shadow:[Dl]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",fo,pt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[g]}],saturate:[{saturate:[S]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",pt]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",pt]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",pt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[Al,pt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Is,uo,nh]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},IA=xA(OA);function we(...e){return IA(sA(e))}function Fn(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Br(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Pk(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ak(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 Dk(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 Id(e){return e.toLocaleString("en-US")}function _d(e){return`$${e.toFixed(4)}`}function _A(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,s,o]=t,i=new Date(Number(n),Number(s)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Sn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function $k(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function MA(e){let t=$k(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":null}function Lk(e,t){return MA(e)===t}function Ok(e){let n=$k(e).split("/").filter(Boolean);const s=[];let o="Overview",i=null,c="";if(n[0]==="w"&&n[1]&&(c=`/w/${n[1]}`,s.push({label:Sn(n[1]),path:`${c}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:s,projectSlug:i};if(n[0]==="projects"){if(s.push({label:"Projects",path:`${c}/projects`}),o="Projects",n[1]&&(i=n[1],s.push({label:Sn(n[1]),path:`${c}/projects/${n[1]}`}),o=Sn(n[1])),n[2]==="edit")o="Edit Project";else if(n[2]==="create"&&n[3]==="assignment")o="Create Assignment";else if(n[2]==="assignments"&&n[3])s.push({label:Sn(n[3]),path:`${c}/projects/${n[1]}/assignments/${n[3]}`}),o=Sn(n[3]),n[4]==="edit"?o="Edit Assignment":n[4]==="plan"&&n[5]==="edit"?o="Edit Plan":n[4]==="scratchpad"&&n[5]==="edit"?o="Edit Scratchpad":n[4]==="handoff"&&n[5]==="edit"?o="Append Handoff":n[4]==="decision-record"&&n[5]==="edit"&&(o="Append Decision");else if((n[2]==="memories"||n[2]==="resources")&&n[3]){const u=n[2]==="memories"?"Memories":"Resources",f=n[2]==="memories"?"/memories":"/resources";s.push({label:u,path:f}),s.push({label:Sn(n[3]),path:`${c}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=Sn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",s.push({label:"Servers",path:`${c}/servers`})):n[0]==="inventories"?(o="Inventories",s.push({label:"Inventories",path:`${c}/inventories`})):n[0]==="usage"?(o="Usage",s.push({label:"Usage",path:`${c}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",s.push({label:"Agent Sessions",path:`${c}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",s.push({label:"Assignments",path:`${c}/assignments`})):n[0]==="archive"?(o="Archive",s.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(s.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(s.push({label:Sn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(s.push({label:Sn(n[1]),path:`/playbooks/${n[1]}`}),o=Sn(n[1]))):n[0]==="memories"?(s.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(s.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",s.push({label:"Todos",path:`${c}/todos`})):n[0]==="views"?(o="Saved Views",s.push({label:"Saved Views",path:`${c}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",s.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",s.push({label:"Settings",path:"/settings"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",s.push({label:"Create Project",path:`${c}/create/project`}));return{title:o,breadcrumbs:s,projectSlug:i}}function hw({items:e,onNavigate:t}){const n=Xn();return r.jsx("nav",{className:"space-y-1",children:e.map(s=>{const o=s.icon,i=Lk(n.pathname,s.to)&&!n.pathname.startsWith("/w/");return r.jsxs(Te,{to:s.to,onClick:t,className:we("flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition",i?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[r.jsx(o,{className:"h-4 w-4"}),r.jsx("span",{children:s.label})]},s.to)})})}const Ik=[{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)"}}],FA=Ik.map(e=>e.slug),Md="default";function _k(e){return typeof e=="string"&&FA.includes(e)}const Mk={preset:Md,custom:!1};let Wl=null,qa=null;function ox(e){if(!e||typeof e!="object")return Mk;const t=e;return{preset:_k(t.preset)?t.preset:Md,custom:t.custom===!0}}function zA(){return Wl?Promise.resolve(Wl):qa||(qa=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=ox(e);return Wl=t,qa=null,t}).catch(()=>(qa=null,Mk)),qa)}async function BA(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=ox(await t.json());return Wl=n,n}async function UA(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=ox(await e.json());return Wl=t,t}const og="syntaur-theme",gd="syntaur-preset",Fk=p.createContext(null);function ag(){try{const e=window.localStorage.getItem(og);return e==="light"||e==="dark"?e:null}catch{return null}}function zk(){try{const e=window.localStorage.getItem(gd);return _k(e)?e:Md}catch{return Md}}function Bk(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Uk(e){document.documentElement.classList.toggle("dark",e==="dark")}function Vk(e){document.documentElement.dataset.theme=e}function VA(){typeof document>"u"||(Uk(ag()??Bk()),Vk(zk()))}function HA({children:e}){const[t,n]=p.useState(()=>ag()),[s,o]=p.useState(()=>ag()??Bk()),[i,c]=p.useState(()=>zk());p.useEffect(()=>{Uk(s)},[s]),p.useEffect(()=>{Vk(i)},[i]),p.useEffect(()=>{let h=!1;return zA().then(g=>{if(!h&&g.preset!==i){c(g.preset);try{window.localStorage.setItem(gd,g.preset)}catch{}}}),()=>{h=!0}},[]),p.useEffect(()=>{if(!window.matchMedia)return;const h=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{t||o(h.matches?"dark":"light")};return g(),h.addEventListener("change",g),()=>{h.removeEventListener("change",g)}},[t]);async function u(h){c(h);try{window.localStorage.setItem(gd,h)}catch{}await BA(h)}async function f(){const h=await UA();c(h.preset);try{window.localStorage.setItem(gd,h.preset)}catch{}}const m={resolvedTheme:s,explicitTheme:t,setTheme:h=>{window.localStorage.setItem(og,h),n(h),o(h)},toggleTheme:()=>{const h=s==="dark"?"light":"dark";window.localStorage.setItem(og,h),n(h),o(h)},preset:i,setPreset:u,resetPreset:f};return r.jsx(Fk.Provider,{value:m,children:e})}function ax(){const e=p.useContext(Fk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const xd=new Set;let lr=null,hi=null;function WA(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function Hk(){lr&&(lr.readyState===WebSocket.OPEN||lr.readyState===WebSocket.CONNECTING)||(lr=new WebSocket(WA()),lr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of xd)n(t)}catch{}},lr.onclose=()=>{lr=null,hi&&clearTimeout(hi),hi=setTimeout(Hk,2e3)},lr.onerror=()=>{lr==null||lr.close()})}function kc(e){const t=p.useRef(e);t.current=e,p.useEffect(()=>{const n=s=>t.current(s);return xd.add(n),Hk(),()=>{xd.delete(n),xd.size===0&&lr&&(hi&&clearTimeout(hi),hi=null,lr.close(),lr=null)}},[])}function sn(e,t,n=!0,s=!1){const[o,i]=p.useState(null),[c,u]=p.useState(!0),[f,m]=p.useState(null),[h,g]=p.useState(0),y=n?e:null,b=p.useCallback(()=>{g(j=>j+1)},[]),C=p.useRef(y);return s&&C.current!==y&&(C.current=y,i(null),m(null)),p.useEffect(()=>{if(!y){u(!1),i(null);return}let j=!1;return u(!0),m(null),fetch(y).then(async v=>{if(!v.ok){const k=await v.json().catch(()=>null);throw new Error((k==null?void 0:k.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{j||(i(v),u(!1))}).catch(v=>{j||(m(v.message),u(!1))}),()=>{j=!0}},[y,h]),kc(j=>{!t||!y||((j.type==="project-updated"||j.type==="assignment-updated")&&b(),j.type==="servers-updated"&&t==="servers"&&b(),j.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&b(),j.type==="playbooks-updated"&&t==="playbooks"&&b(),j.type==="leases-updated"&&t==="inventories"&&b())}),{data:o,loading:c,error:f,refetch:b}}function Co(e=!0){return sn("/api/projects","projects",e)}function Sc(){return sn("/api/workspaces","projects")}function fn(){const{workspace:e}=Bt();return e?`/w/${e}`:""}function KA(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 sn(s,"overview")}function vf(e=!0){return sn("/api/assignments","assignments",e)}function qA(e=!0){return sn("/api/archived","assignments",e)}function Wk(){return sn("/api/help")}function Kk(e){const t=e?`/api/projects/${e}`:null;return sn(t,"project")}function GA(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return sn(n,"assignment")}function YA(e){const t=e?`/api/assignments/${e}`:null;return sn(t,"assignment")}function qk(e){return sn(e)}function ix(e=!0){return sn("/api/servers","servers",e)}function Gk(){return sn("/api/leases","inventories")}function wf(){return sn("/api/agent-sessions","agent-sessions")}function JA(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return sn(n,"agent-sessions")}function QA(e){const t=e?`/api/assignments/${e}/sessions`:null;return sn(t,"agent-sessions")}function XA(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return sn(n,void 0,!0,!0)}function ZA(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return sn(t,void 0,!0,!0)}function lx(e=!0){return sn("/api/playbooks","playbooks",e)}function e3(e){const t=e?`/api/playbooks/${e}`:null;return sn(t,"playbooks")}function t3(){return sn("/api/memories","project")}function n3(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return sn(n,"project")}function r3(){return sn("/api/resources","project")}function s3(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return sn(n,"project")}const jf=["new-workspace","new-project","new-todo","new-assignment"];function o3(e){return typeof e=="string"&&jf.includes(e)}const a3=["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","[","]"],i3=["mod","ctrl","alt","shift"];function ur(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(ur).filter(u=>u.length>0).join(" ");const n=t.split("+").map(u=>u.trim()).filter(u=>u.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const s=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(u=>u.toLowerCase()),i=new Set,c=[];for(const u of i3)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 l3(e){const t=ur(e);return t?a3.includes(t):!1}const c3={"new-workspace":ur("Mod+Shift+Alt+w"),"new-project":ur("Mod+Shift+Alt+p"),"new-todo":ur("Mod+Shift+Alt+t"),"new-assignment":ur("Mod+Shift+Alt+a")};function u3(e){const t={...c3};for(const n of jf){const s=e[n];typeof s=="string"&&s.length>0&&(t[n]=s)}return t}function ta(){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 d3(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 Ju(e,t){const n=d3(t);if(e.key.toLowerCase()!==n.key)return!1;const o=ta()?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 Yk(e){const t=[],n=ta()?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 ur(c)}function js(e){return e.split("+").map(n=>{const s=n.toLowerCase();return s==="mod"?ta()?"⌘":"Ctrl":s==="shift"?ta()?"⇧":"Shift":s==="alt"?ta()?"⌥":"Alt":s==="ctrl"?ta()?"⌃":"Ctrl":s==="enter"?"↵":s==="escape"?"Esc":s==="arrowup"?"↑":s==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(ta()?"":"+")}function f3(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),kc(f=>{f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function Jk(e=!0){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch("/api/todos");if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{o(!1)}},[]);return p.useEffect(()=>{if(!e){o(!1);return}u()},[u,e]),kc(f=>{e&&f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}async function cx(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 Qk(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 Xk(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 Zk(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 eS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function tS(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function nS(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 ux(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function rS(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 sS(e,t,n){const s=await fetch(ux(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function dx(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const s=await n.text().catch(()=>"");let o=null;try{o=s?JSON.parse(s):null}catch{}const i=(o==null?void 0:o.error)||s||`HTTP ${n.status}`,c=new Error(i);throw c.status=n.status,c}return n.json().catch(()=>({}))}async function p3(e,t){return await dx(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function m3(e){return await dx("/api/todos/promote-bulk",e)}async function h3(e,t,n){await dx(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const g3=new Set(["/projects","/assignments","/servers","/todos"]);function yd(e,t){return g3.has(e)?`${t}${e}`:e}const x3=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function y3(e){const t=[];for(const n of x3)t.push({type:"page",id:n.id,title:n.title,keywords:[...n.keywords],route:yd(n.basePath,e.wsPrefix)});for(const n of e.projects??[]){const s=n.workspace?`/w/${n.workspace}`:"";t.push({type:"project",id:`project-${n.slug}`,title:n.title,subtitle:n.slug,keywords:n.tags,route:`${s}/projects/${n.slug}`}),t.push({type:"todo",id:`project-todos-${n.slug}`,title:`${n.title} todos`,subtitle:`${n.slug} · project`,keywords:[...n.tags??[],"project","todos"],route:`${s}/projects/${n.slug}?tab=todos`})}for(const n of e.assignments??[]){const s=n.projectWorkspace?`/w/${n.projectWorkspace}`:"";t.push({type:"assignment",id:n.projectSlug===null?`assignment-standalone-${n.id}`:`assignment-${n.projectSlug}-${n.slug}`,title:n.title,subtitle:`${n.projectTitle} · ${n.status}`,keywords:[n.projectSlug??"standalone",n.assignee??""].filter(o=>!!o),route:n.projectSlug===null?`/assignments/${n.id}`:`${s}/projects/${n.projectSlug}/assignments/${n.slug}`})}for(const n of e.playbooks??[])t.push({type:"playbook",id:`playbook-${n.slug}`,title:n.name,subtitle:n.description,keywords:n.tags,route:`/playbooks/${n.slug}`});for(const n of e.servers??[])t.push({type:"server",id:`server-${n.name}`,title:n.name,subtitle:n.alive?"alive":"dead",route:`${yd("/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=yd("/todos",s);t.push({type:"todo",id:`todo-${n.id}`,title:n.description,subtitle:n.status,keywords:n.tags,route:`${o}?focus=${encodeURIComponent(n.id)}`})}return t}function wr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function bd(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function b3(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 rh(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 gw(){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 xw(){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 sh(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 Go(e,t,n){const s=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!s)return`---
|
|
487
|
+
${t}: ${JSON.stringify(n)}
|
|
488
|
+
---
|
|
489
|
+
${e}`;const o=s[1],i=s[2],c=s[3],u=e.slice(s[0].length),f=JSON.stringify(n),m=new RegExp(`^${t}:\\s*.*$`,"m");let h;return m.test(i)?h=i.replace(m,`${t}: ${f}`):h=`${i}
|
|
490
|
+
${t}: ${f}`,`${o}${h}${c}${u}`}const v3=/^[a-z0-9][a-z0-9-]*$/;function w3(e){const{playbooks:t,projectSlug:n,currentProjectTitle:s,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:c,navigate:u,toggleTheme:f}=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:v3,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(h,g)=>{const y=(h.name??"").trim();if(!y)throw new Error("Name is required");const b=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:y})});if(!b.ok){const C=await b.json().catch(()=>({}));throw new Error(C.error||`Failed to create workspace (HTTP ${b.status})`)}g.navigate(`/w/${y}/projects`)}}}),m.push({id:"new-project",title:"New Project",subtitle:"Create a project (pick workspace)",group:"Create",keywords:["new","create","project"],bindableKind:"new-project",flow:{steps:[{kind:"picker",id:"workspace",label:"Workspace",emptyMessage:'No workspaces yet — create one with "New Workspace"',loadOptions:async()=>{const{workspaces:h,hasUngrouped:g}=await gw(),y=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});return y}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(h,g)=>{const y=(h.workspace??"").trim(),b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=wr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");let j=await sh("/api/templates/project");j=Go(j,"slug",C),j=Go(j,"title",b),y&&y!=="_ungrouped"&&(j=Go(j,"workspace",y));const v=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create project (HTTP ${v.status})`);const E=y&&y!=="_ungrouped"?`/w/${y}/projects/${k.slug??C}`:`/projects/${k.slug??C}`;g.navigate(E)}}}),m.push({id:"new-todo",title:"New Todo",subtitle:"Pick scope (global / workspace / project)",group:"Create",keywords:["new","create","todo","task"],bindableKind:"new-todo",flow:{steps:[{kind:"picker",id:"scope",label:"Scope",loadOptions:async()=>{const[{workspaces:h},g]=await Promise.all([gw(),xw()]),y=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const b of h)y.push({value:b,label:b,hint:"workspace"});for(const b of g){const C=b.workspace??"_ungrouped";y.push({value:C,label:`${b.title}`,hint:`project · ${b.workspace??"ungrouped"}`})}return y}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async h=>{const g=(h.scope??"_ungrouped").trim()||"_ungrouped",y=(h.description??"").trim();if(!y)throw new Error("Description is required");await cx(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 xw(),g=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const y of h)g.push({value:y.slug,label:y.title,hint:y.workspace?`workspace · ${y.workspace}`:"ungrouped"});return g}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(h,g)=>{var S;const y=(h.project??"_standalone").trim()||"_standalone",b=(h.title??"").trim();if(!b)throw new Error("Title is required");const C=wr(b);if(!C)throw new Error("Title must contain at least one alphanumeric character");if(y==="_standalone"){let T=await sh("/api/templates/assignment?standalone=1");T=Go(T,"slug",C),T=Go(T,"title",b);const A=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:T})}),R=await A.json().catch(()=>({}));if(!A.ok)throw new Error(R.error||`Failed to create assignment (HTTP ${A.status})`);const P=((S=R==null?void 0:R.assignment)==null?void 0:S.id)??(R==null?void 0:R.id);P?g.navigate(`/assignments/${P}`):g.navigate("/assignments");return}let j=await sh("/api/templates/assignment");j=Go(j,"slug",C),j=Go(j,"title",b);const v=await fetch(`/api/projects/${encodeURIComponent(y)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),k=await v.json().catch(()=>({}));if(!v.ok)throw new Error(k.error||`Failed to create assignment (HTTP ${v.status})`);const E=k.slug??C;g.navigate(`/projects/${y}/assignments/${E}`)}}}),m.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>u(`${i}/create/project`)}),m.push({id:"create-standalone-assignment",title:"New Standalone Assignment (editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","assignment","standalone","one-off","editor"],run:()=>u(`${i}/assignments/new`)}),n&&m.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${s??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>u(`${i}/projects/${n}/create/assignment`)}),m.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>u("/playbooks/create")}),m.push({id:"create-todo-global",title:"New Todo (global, quick)",subtitle:"Ungrouped, single-step",group:"Create",keywords:["new","create","todo","global","ungrouped","quick"],requiresInput:{placeholder:"Describe the todo…",runWithInput:async h=>{const g=h.trim();g&&await rh("_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 rh(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 rh(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:()=>b3(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:()=>f()}),m}function Xt(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 yw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function kf(...e){return t=>{let n=!1;const s=e.map(o=>{const i=yw(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():yw(e[o],null)}}}}function qn(...e){return p.useCallback(kf(...e),e)}function j3(e,t){const n=p.createContext(t),s=i=>{const{children:c,...u}=i,f=p.useMemo(()=>u,Object.values(u));return r.jsx(n.Provider,{value:f,children:c})};s.displayName=e+"Provider";function o(i){const c=p.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function da(e,t=[]){let n=[];function s(i,c){const u=p.createContext(c),f=n.length;n=[...n,c];const m=g=>{var k;const{scope:y,children:b,...C}=g,j=((k=y==null?void 0:y[e])==null?void 0:k[f])||u,v=p.useMemo(()=>C,Object.values(C));return r.jsx(j.Provider,{value:v,children:b})};m.displayName=i+"Provider";function h(g,y){var j;const b=((j=y==null?void 0:y[e])==null?void 0:j[f])||u,C=p.useContext(b);if(C)return C;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${i}\``)}return[m,h]}const o=()=>{const i=n.map(c=>p.createContext(c));return function(u){const f=(u==null?void 0:u[e])||i;return p.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])}};return o.scopeName=e,[s,k3(o,...t)]}function k3(...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:f,scopeName:m})=>{const g=f(i)[`__scope${m}`];return{...u,...g}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var vo=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},S3=q0[" useId ".trim().toString()]||(()=>{}),N3=0;function gi(e){const[t,n]=p.useState(S3());return vo(()=>{n(s=>s??String(N3++))},[e]),e||(t?`radix-${t}`:"")}var C3=q0[" useInsertionEffect ".trim().toString()]||vo;function Sf({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,c]=E3({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:o;{const h=p.useRef(e!==void 0);p.useEffect(()=>{const g=h.current;g!==u&&console.warn(`${s} is changing from ${g?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),h.current=u},[u,s])}const m=p.useCallback(h=>{var g;if(u){const y=T3(h)?h(e):h;y!==e&&((g=c.current)==null||g.call(c,y))}else i(h)},[u,e,i,c]);return[f,m]}function E3({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),o=p.useRef(n),i=p.useRef(t);return C3(()=>{i.current=t},[t]),p.useEffect(()=>{var c;o.current!==n&&((c=i.current)==null||c.call(i,n),o.current=n)},[n,o]),[n,s,i]}function T3(e){return typeof e=="function"}function R3(e){const t=P3(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),f=u.find(D3);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function P3(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=L3(o),u=$3(i,o.props);return o.type!==p.Fragment&&(u.ref=s?kf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var A3=Symbol("radix.slottable");function D3(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===A3}function $3(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 f=i(...u);return o(...u),f}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function L3(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 O3=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vn=O3.reduce((e,t)=>{const n=R3(`Primitive.${t}`),s=p.forwardRef((o,i)=>{const{asChild:c,...u}=o,f=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(f,{...u,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function I3(e,t){e&&Ms.flushSync(()=>e.dispatchEvent(t))}function la(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function _3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e);p.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var M3="DismissableLayer",ig="dismissableLayer.update",F3="dismissableLayer.pointerDownOutside",z3="dismissableLayer.focusOutside",bw,oS=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fx=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...f}=e,m=p.useContext(oS),[h,g]=p.useState(null),y=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),C=qn(t,P=>g(P)),j=Array.from(m.layers),[v]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),k=j.indexOf(v),E=h?j.indexOf(h):-1,S=m.layersWithOutsidePointerEventsDisabled.size>0,T=E>=k,A=V3(P=>{const $=P.target,I=[...m.branches].some(M=>M.contains($));!T||I||(o==null||o(P),c==null||c(P),P.defaultPrevented||u==null||u())},y),R=H3(P=>{const $=P.target;[...m.branches].some(M=>M.contains($))||(i==null||i(P),c==null||c(P),P.defaultPrevented||u==null||u())},y);return _3(P=>{E===m.layers.size-1&&(s==null||s(P),!P.defaultPrevented&&u&&(P.preventDefault(),u()))},y),p.useEffect(()=>{if(h)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(bw=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(h)),m.layers.add(h),vw(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=bw)}},[h,y,n,m]),p.useEffect(()=>()=>{h&&(m.layers.delete(h),m.layersWithOutsidePointerEventsDisabled.delete(h),vw())},[h,m]),p.useEffect(()=>{const P=()=>b({});return document.addEventListener(ig,P),()=>document.removeEventListener(ig,P)},[]),r.jsx(vn.div,{...f,ref:C,style:{pointerEvents:S?T?"auto":"none":void 0,...e.style},onFocusCapture:Xt(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Xt(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Xt(e.onPointerDownCapture,A.onPointerDownCapture)})});fx.displayName=M3;var B3="DismissableLayerBranch",U3=p.forwardRef((e,t)=>{const n=p.useContext(oS),s=p.useRef(null),o=qn(t,s);return p.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(vn.div,{...e,ref:o})});U3.displayName=B3;function V3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e),s=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=u=>{if(u.target&&!s.current){let f=function(){aS(F3,n,m,{discrete:!0})};const m={originalEvent:u};u.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=f,t.addEventListener("click",o.current,{once:!0})):f()}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 H3(e,t=globalThis==null?void 0:globalThis.document){const n=la(e),s=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!s.current&&aS(z3,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 vw(){const e=new CustomEvent(ig);document.dispatchEvent(e)}function aS(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?I3(o,i):o.dispatchEvent(i)}var oh="focusScope.autoFocusOnMount",ah="focusScope.autoFocusOnUnmount",ww={bubbles:!1,cancelable:!0},W3="FocusScope",iS=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...c}=e,[u,f]=p.useState(null),m=la(o),h=la(i),g=p.useRef(null),y=qn(t,j=>f(j)),b=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let j=function(S){if(b.paused||!u)return;const T=S.target;u.contains(T)?g.current=T:go(g.current,{select:!0})},v=function(S){if(b.paused||!u)return;const T=S.relatedTarget;T!==null&&(u.contains(T)||go(g.current,{select:!0}))},k=function(S){if(document.activeElement===document.body)for(const A of S)A.removedNodes.length>0&&go(u)};document.addEventListener("focusin",j),document.addEventListener("focusout",v);const E=new MutationObserver(k);return u&&E.observe(u,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",v),E.disconnect()}}},[s,u,b.paused]),p.useEffect(()=>{if(u){kw.add(b);const j=document.activeElement;if(!u.contains(j)){const k=new CustomEvent(oh,ww);u.addEventListener(oh,m),u.dispatchEvent(k),k.defaultPrevented||(K3(Q3(lS(u)),{select:!0}),document.activeElement===j&&go(u))}return()=>{u.removeEventListener(oh,m),setTimeout(()=>{const k=new CustomEvent(ah,ww);u.addEventListener(ah,h),u.dispatchEvent(k),k.defaultPrevented||go(j??document.body,{select:!0}),u.removeEventListener(ah,h),kw.remove(b)},0)}}},[u,m,h,b]);const C=p.useCallback(j=>{if(!n&&!s||b.paused)return;const v=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,k=document.activeElement;if(v&&k){const E=j.currentTarget,[S,T]=q3(E);S&&T?!j.shiftKey&&k===T?(j.preventDefault(),n&&go(S,{select:!0})):j.shiftKey&&k===S&&(j.preventDefault(),n&&go(T,{select:!0})):k===E&&j.preventDefault()}},[n,s,b.paused]);return r.jsx(vn.div,{tabIndex:-1,...c,ref:y,onKeyDown:C})});iS.displayName=W3;function K3(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(go(s,{select:t}),document.activeElement!==n)return}function q3(e){const t=lS(e),n=jw(t,e),s=jw(t.reverse(),e);return[n,s]}function lS(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 jw(e,t){for(const n of e)if(!G3(n,{upTo:t}))return n}function G3(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 Y3(e){return e instanceof HTMLInputElement&&"select"in e}function go(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Y3(e)&&t&&e.select()}}var kw=J3();function J3(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Sw(e,t),e.unshift(t)},remove(t){var n;e=Sw(e,t),(n=e[0])==null||n.resume()}}}function Sw(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Q3(e){return e.filter(t=>t.tagName!=="A")}var X3="Portal",px=p.forwardRef((e,t)=>{var u;const{container:n,...s}=e,[o,i]=p.useState(!1);vo(()=>i(!0),[]);const c=n||o&&((u=globalThis==null?void 0:globalThis.document)==null?void 0:u.body);return c?yP.createPortal(r.jsx(vn.div,{...s,ref:t}),c):null});px.displayName=X3;function Z3(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var fa=e=>{const{present:t,children:n}=e,s=eD(t),o=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),i=qn(s.ref,tD(o));return typeof n=="function"||s.isPresent?p.cloneElement(o,{ref:i}):null};fa.displayName="Presence";function eD(e){const[t,n]=p.useState(),s=p.useRef(null),o=p.useRef(e),i=p.useRef("none"),c=e?"mounted":"unmounted",[u,f]=Z3(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const m=Qu(s.current);i.current=u==="mounted"?m:"none"},[u]),vo(()=>{const m=s.current,h=o.current;if(h!==e){const y=i.current,b=Qu(m);e?f("MOUNT"):b==="none"||(m==null?void 0:m.display)==="none"?f("UNMOUNT"):f(h&&y!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,f]),vo(()=>{if(t){let m;const h=t.ownerDocument.defaultView??window,g=b=>{const j=Qu(s.current).includes(CSS.escape(b.animationName));if(b.target===t&&j&&(f("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=Qu(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 f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:p.useCallback(m=>{s.current=m?getComputedStyle(m):null,n(m)},[])}}function Qu(e){return(e==null?void 0:e.animationName)||"none"}function tD(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 ih=0;function nD(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Nw()),document.body.insertAdjacentElement("beforeend",e[1]??Nw()),ih++,()=>{ih===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ih--}},[])}function Nw(){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 ys=function(){return ys=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},ys.apply(this,arguments)};function cS(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 rD(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 vd="right-scroll-bar-position",wd="width-before-scroll-bar",sD="with-scroll-bars-hidden",oD="--removed-body-scroll-bar-size";function lh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function aD(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var iD=typeof window<"u"?p.useLayoutEffect:p.useEffect,Cw=new WeakMap;function lD(e,t){var n=aD(null,function(s){return e.forEach(function(o){return lh(o,s)})});return iD(function(){var s=Cw.get(n);if(s){var o=new Set(s),i=new Set(e),c=n.current;o.forEach(function(u){i.has(u)||lh(u,null)}),i.forEach(function(u){o.has(u)||lh(u,c)})}Cw.set(n,e)},[e]),n}function cD(e){return e}function uD(e,t){t===void 0&&(t=cD);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 f=function(){var h=c;c=[],h.forEach(i)},m=function(){return Promise.resolve().then(f)};m(),n={push:function(h){c.push(h),m()},filter:function(h){return c=c.filter(h),n}}}};return o}function dD(e){e===void 0&&(e={});var t=uD(null);return t.options=ys({async:!0,ssr:!1},e),t}var uS=function(e){var t=e.sideCar,n=cS(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,ys({},n))};uS.isSideCarExport=!0;function fD(e,t){return e.useMedium(t),uS}var dS=dD(),ch=function(){},Nf=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:ch,onWheelCapture:ch,onTouchMoveCapture:ch}),o=s[0],i=s[1],c=e.forwardProps,u=e.children,f=e.className,m=e.removeScrollBar,h=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,C=e.noIsolation,j=e.inert,v=e.allowPinchZoom,k=e.as,E=k===void 0?"div":k,S=e.gapMode,T=cS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),A=y,R=lD([n,t]),P=ys(ys({},T),o);return p.createElement(p.Fragment,null,h&&p.createElement(A,{sideCar:dS,removeScrollBar:m,shards:g,noRelative:b,noIsolation:C,inert:j,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:S}),c?p.cloneElement(p.Children.only(u),ys(ys({},P),{ref:R})):p.createElement(E,ys({},P,{className:f,ref:R}),u))});Nf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nf.classNames={fullWidth:wd,zeroRight:vd};var pD=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function mD(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=pD();return t&&e.setAttribute("nonce",t),e}function hD(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gD(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var xD=function(){var e=0,t=null;return{add:function(n){e==0&&(t=mD())&&(hD(t,n),gD(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},yD=function(){var e=xD();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},fS=function(){var e=yD(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},bD={left:0,top:0,right:0,gap:0},uh=function(e){return parseInt(e||"",10)||0},vD=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[uh(n),uh(s),uh(o)]},wD=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return bD;var t=vD(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])}},jD=fS(),xi="data-scroll-locked",kD=function(e,t,n,s){var o=e.left,i=e.top,c=e.right,u=e.gap;return n===void 0&&(n="margin"),`
|
|
491
|
+
.`.concat(sD,` {
|
|
492
|
+
overflow: hidden `).concat(s,`;
|
|
493
|
+
padding-right: `).concat(u,"px ").concat(s,`;
|
|
494
|
+
}
|
|
495
|
+
body[`).concat(xi,`] {
|
|
496
|
+
overflow: hidden `).concat(s,`;
|
|
497
|
+
overscroll-behavior: contain;
|
|
498
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
499
|
+
padding-left: `.concat(o,`px;
|
|
500
|
+
padding-top: `).concat(i,`px;
|
|
501
|
+
padding-right: `).concat(c,`px;
|
|
502
|
+
margin-left:0;
|
|
503
|
+
margin-top:0;
|
|
504
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
505
|
+
`),n==="padding"&&"padding-right: ".concat(u,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.`).concat(vd,` {
|
|
509
|
+
right: `).concat(u,"px ").concat(s,`;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.`).concat(wd,` {
|
|
513
|
+
margin-right: `).concat(u,"px ").concat(s,`;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.`).concat(vd," .").concat(vd,` {
|
|
517
|
+
right: 0 `).concat(s,`;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
.`).concat(wd," .").concat(wd,` {
|
|
521
|
+
margin-right: 0 `).concat(s,`;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
body[`).concat(xi,`] {
|
|
525
|
+
`).concat(oD,": ").concat(u,`px;
|
|
526
|
+
}
|
|
527
|
+
`)},Ew=function(){var e=parseInt(document.body.getAttribute(xi)||"0",10);return isFinite(e)?e:0},SD=function(){p.useEffect(function(){return document.body.setAttribute(xi,(Ew()+1).toString()),function(){var e=Ew()-1;e<=0?document.body.removeAttribute(xi):document.body.setAttribute(xi,e.toString())}},[])},ND=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;SD();var i=p.useMemo(function(){return wD(o)},[o]);return p.createElement(jD,{styles:kD(i,!t,o,n?"":"!important")})},lg=!1;if(typeof window<"u")try{var Xu=Object.defineProperty({},"passive",{get:function(){return lg=!0,!0}});window.addEventListener("test",Xu,Xu),window.removeEventListener("test",Xu,Xu)}catch{lg=!1}var Ga=lg?{passive:!1}:!1,CD=function(e){return e.tagName==="TEXTAREA"},pS=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!CD(e)&&n[t]==="visible")},ED=function(e){return pS(e,"overflowY")},TD=function(e){return pS(e,"overflowX")},Tw=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=mS(e,s);if(o){var i=hS(e,s),c=i[1],u=i[2];if(c>u)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},RD=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},PD=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},mS=function(e,t){return e==="v"?ED(t):TD(t)},hS=function(e,t){return e==="v"?RD(t):PD(t)},AD=function(e,t){return e==="h"&&t==="rtl"?-1:1},DD=function(e,t,n,s,o){var i=AD(e,window.getComputedStyle(t).direction),c=i*s,u=n.target,f=t.contains(u),m=!1,h=c>0,g=0,y=0;do{if(!u)break;var b=hS(e,u),C=b[0],j=b[1],v=b[2],k=j-v-i*C;(C||k)&&mS(e,u)&&(g+=k,y+=C);var E=u.parentNode;u=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(h&&Math.abs(g)<1||!h&&Math.abs(y)<1)&&(m=!0),m},Zu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rw=function(e){return[e.deltaX,e.deltaY]},Pw=function(e){return e&&"current"in e?e.current:e},$D=function(e,t){return e[0]===t[0]&&e[1]===t[1]},LD=function(e){return`
|
|
528
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
529
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
530
|
+
`)},OD=0,Ya=[];function ID(e){var t=p.useRef([]),n=p.useRef([0,0]),s=p.useRef(),o=p.useState(OD++)[0],i=p.useState(fS)[0],c=p.useRef(e);p.useEffect(function(){c.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var j=rD([e.lockRef.current],(e.shards||[]).map(Pw),!0).filter(Boolean);return j.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),j.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var u=p.useCallback(function(j,v){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var k=Zu(j),E=n.current,S="deltaX"in j?j.deltaX:E[0]-k[0],T="deltaY"in j?j.deltaY:E[1]-k[1],A,R=j.target,P=Math.abs(S)>Math.abs(T)?"h":"v";if("touches"in j&&P==="h"&&R.type==="range")return!1;var $=window.getSelection(),I=$&&$.anchorNode,M=I?I===R||I.contains(R):!1;if(M)return!1;var D=Tw(P,R);if(!D)return!0;if(D?A=P:(A=P==="v"?"h":"v",D=Tw(P,R)),!D)return!1;if(!s.current&&"changedTouches"in j&&(S||T)&&(s.current=A),!A)return!0;var H=s.current||A;return DD(H,v,j,H==="h"?S:T)},[]),f=p.useCallback(function(j){var v=j;if(!(!Ya.length||Ya[Ya.length-1]!==i)){var k="deltaY"in v?Rw(v):Zu(v),E=t.current.filter(function(A){return A.name===v.type&&(A.target===v.target||v.target===A.shadowParent)&&$D(A.delta,k)})[0];if(E&&E.should){v.cancelable&&v.preventDefault();return}if(!E){var S=(c.current.shards||[]).map(Pw).filter(Boolean).filter(function(A){return A.contains(v.target)}),T=S.length>0?u(v,S[0]):!c.current.noIsolation;T&&v.cancelable&&v.preventDefault()}}},[]),m=p.useCallback(function(j,v,k,E){var S={name:j,delta:v,target:k,should:E,shadowParent:_D(k)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(T){return T!==S})},1)},[]),h=p.useCallback(function(j){n.current=Zu(j),s.current=void 0},[]),g=p.useCallback(function(j){m(j.type,Rw(j),j.target,u(j,e.lockRef.current))},[]),y=p.useCallback(function(j){m(j.type,Zu(j),j.target,u(j,e.lockRef.current))},[]);p.useEffect(function(){return Ya.push(i),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,Ga),document.addEventListener("touchmove",f,Ga),document.addEventListener("touchstart",h,Ga),function(){Ya=Ya.filter(function(j){return j!==i}),document.removeEventListener("wheel",f,Ga),document.removeEventListener("touchmove",f,Ga),document.removeEventListener("touchstart",h,Ga)}},[]);var b=e.removeScrollBar,C=e.inert;return p.createElement(p.Fragment,null,C?p.createElement(i,{styles:LD(o)}):null,b?p.createElement(ND,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function _D(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const MD=fD(dS,ID);var gS=p.forwardRef(function(e,t){return p.createElement(Nf,ys({},e,{ref:t,sideCar:MD}))});gS.classNames=Nf.classNames;var FD=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ja=new WeakMap,ed=new WeakMap,td={},dh=0,xS=function(e){return e&&(e.host||xS(e.parentNode))},zD=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=xS(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})},BD=function(e,t,n,s){var o=zD(t,Array.isArray(e)?e:[e]);td[n]||(td[n]=new WeakMap);var i=td[n],c=[],u=new Set,f=new Set(o),m=function(g){!g||u.has(g)||(u.add(g),m(g.parentNode))};o.forEach(m);var h=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(y){if(u.has(y))h(y);else try{var b=y.getAttribute(s),C=b!==null&&b!=="false",j=(Ja.get(y)||0)+1,v=(i.get(y)||0)+1;Ja.set(y,j),i.set(y,v),c.push(y),j===1&&C&&ed.set(y,!0),v===1&&y.setAttribute(n,"true"),C||y.setAttribute(s,"true")}catch(k){console.error("aria-hidden: cannot operate on ",y,k)}})};return h(t),u.clear(),dh++,function(){c.forEach(function(g){var y=Ja.get(g)-1,b=i.get(g)-1;Ja.set(g,y),i.set(g,b),y||(ed.has(g)||g.removeAttribute(s),ed.delete(g)),b||g.removeAttribute(n)}),dh--,dh||(Ja=new WeakMap,Ja=new WeakMap,ed=new WeakMap,td={})}},UD=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=FD(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),BD(s,o,n,"aria-hidden")):function(){return null}};function VD(e){const t=HD(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),f=u.find(KD);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function HD(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=GD(o),u=qD(i,o.props);return o.type!==p.Fragment&&(u.ref=s?kf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WD=Symbol("radix.slottable");function KD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WD}function qD(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 f=i(...u);return o(...u),f}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function GD(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 Cf="Dialog",[yS,bS]=da(Cf),[YD,ls]=yS(Cf),vS=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:c=!0}=e,u=p.useRef(null),f=p.useRef(null),[m,h]=Sf({prop:s,defaultProp:o??!1,onChange:i,caller:Cf});return r.jsx(YD,{scope:t,triggerRef:u,contentRef:f,contentId:gi(),titleId:gi(),descriptionId:gi(),open:m,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(g=>!g),[h]),modal:c,children:n})};vS.displayName=Cf;var wS="DialogTrigger",jS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(wS,n),i=qn(t,o.triggerRef);return r.jsx(vn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":gx(o.open),...s,ref:i,onClick:Xt(e.onClick,o.onOpenToggle)})});jS.displayName=wS;var mx="DialogPortal",[JD,kS]=yS(mx,{forceMount:void 0}),SS=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=ls(mx,t);return r.jsx(JD,{scope:t,forceMount:n,children:p.Children.map(s,c=>r.jsx(fa,{present:n||i.open,children:r.jsx(px,{asChild:!0,container:o,children:c})}))})};SS.displayName=mx;var Fd="DialogOverlay",NS=p.forwardRef((e,t)=>{const n=kS(Fd,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=ls(Fd,e.__scopeDialog);return i.modal?r.jsx(fa,{present:s||i.open,children:r.jsx(XD,{...o,ref:t})}):null});NS.displayName=Fd;var QD=VD("DialogOverlay.RemoveScroll"),XD=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(Fd,n);return r.jsx(gS,{as:QD,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(vn.div,{"data-state":gx(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ca="DialogContent",CS=p.forwardRef((e,t)=>{const n=kS(ca,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=ls(ca,e.__scopeDialog);return r.jsx(fa,{present:s||i.open,children:i.modal?r.jsx(ZD,{...o,ref:t}):r.jsx(e$,{...o,ref:t})})});CS.displayName=ca;var ZD=p.forwardRef((e,t)=>{const n=ls(ca,e.__scopeDialog),s=p.useRef(null),o=qn(t,n.contentRef,s);return p.useEffect(()=>{const i=s.current;if(i)return UD(i)},[]),r.jsx(ES,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xt(e.onCloseAutoFocus,i=>{var c;i.preventDefault(),(c=n.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Xt(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0;(c.button===2||u)&&i.preventDefault()}),onFocusOutside:Xt(e.onFocusOutside,i=>i.preventDefault())})}),e$=p.forwardRef((e,t)=>{const n=ls(ca,e.__scopeDialog),s=p.useRef(!1),o=p.useRef(!1);return r.jsx(ES,{...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 f,m;(f=e.onInteractOutside)==null||f.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()}})}),ES=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...c}=e,u=ls(ca,n),f=p.useRef(null),m=qn(t,f);return nD(),r.jsxs(r.Fragment,{children:[r.jsx(iS,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx(fx,{role:"dialog",id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":gx(u.open),...c,ref:m,onDismiss:()=>u.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(n$,{titleId:u.titleId}),r.jsx(s$,{contentRef:f,descriptionId:u.descriptionId})]})]})}),hx="DialogTitle",TS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(hx,n);return r.jsx(vn.h2,{id:o.titleId,...s,ref:t})});TS.displayName=hx;var RS="DialogDescription",PS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(RS,n);return r.jsx(vn.p,{id:o.descriptionId,...s,ref:t})});PS.displayName=RS;var AS="DialogClose",DS=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=ls(AS,n);return r.jsx(vn.button,{type:"button",...s,ref:t,onClick:Xt(e.onClick,()=>o.onOpenChange(!1))})});DS.displayName=AS;function gx(e){return e?"open":"closed"}var $S="DialogTitleWarning",[t$,LS]=j3($S,{contentName:ca,titleName:hx,docsSlug:"dialog"}),n$=({titleId:e})=>{const t=LS($S),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
531
|
+
|
|
532
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
533
|
+
|
|
534
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},r$="DialogDescriptionWarning",s$=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${LS(r$).contentName}}.`;return p.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},OS=vS,IS=jS,_S=SS,xx=NS,yx=CS,bx=TS,vx=PS,wx=DS;const zn=OS,o$=IS,a$=_S,i$=wx,MS=p.forwardRef(({className:e,...t},n)=>r.jsx(xx,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));MS.displayName=xx.displayName;const $n=p.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(a$,{children:[r.jsx(MS,{}),r.jsx(yx,{ref:s,className:we("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...n,children:t})]}));$n.displayName=yx.displayName;function pr({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function Vr({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Ln=p.forwardRef(({className:e,...t},n)=>r.jsx(bx,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));Ln.displayName=bx.displayName;const Hr=p.forwardRef(({className:e,...t},n)=>r.jsx(vx,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));Hr.displayName=vx.displayName;const l$=-1,c$=-40;function fh(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 f=!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(c$,i*l$)),o=s,i=0,s++,f=!0;break}else i++,s++;if(!f)return-1/0}return n}const Aw={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function jx(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=fh(s,c.title.toLowerCase())*1,f=c.subtitle?fh(s,c.subtitle.toLowerCase())*.5:-1/0,m=(g=c.keywords)!=null&&g.length?fh(s,c.keywords.join(" ").toLowerCase())*.3:-1/0,h=Math.max(u,f,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:(Aw[c.type]??99)-(Aw[u.type]??99)),i.slice(0,n)}const u$={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function d$({entries:e}){const{paletteOpen:t,closePalette:n}=Eo(),s=zt(),[o,i]=p.useState(""),[c,u]=p.useState(0),f=p.useRef(null),m=p.useMemo(()=>jx(o,e,50),[o,e]);p.useEffect(()=>{u(0)},[o,t]),p.useEffect(()=>{t||i("")},[t]),p.useEffect(()=>{var b;const y=(b=f.current)==null?void 0:b.querySelector(`[data-palette-idx="${c}"]`);y==null||y.scrollIntoView({block:"nearest"})},[c]);function h(y){s(y.route),n()}function g(y){if(y.key==="ArrowDown")y.preventDefault(),u(b=>Math.min(m.length-1,b+1));else if(y.key==="ArrowUp")y.preventDefault(),u(b=>Math.max(0,b-1));else if(y.key==="Enter"){y.preventDefault();const b=m[c];b&&h(b)}}return r.jsx(zn,{open:t,onOpenChange:y=>y?null:n(),children:r.jsxs($n,{className:"max-w-xl p-0 gap-0",children:[r.jsx(Ln,{className:"sr-only",children:"Command palette"}),r.jsx("input",{autoFocus:!0,type:"text",value:o,onChange:y=>i(y.target.value),onKeyDown:g,placeholder:"Search projects, assignments, playbooks, servers, todos…",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0"}),r.jsx("div",{ref:f,className:"max-h-[60vh] overflow-y-auto p-1",children:m.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:o?"No matches":"Start typing to search"}):m.map((y,b)=>{const C=b===c;return r.jsxs("button",{type:"button","data-palette-idx":b,onClick:()=>h(y),onMouseEnter:()=>u(b),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${C?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:u$[y.type]??y.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:y.title}),y.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:y.subtitle}):null]},y.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," open ","·"," Esc close"]}),r.jsxs("span",{children:[m.length," result",m.length===1?"":"s"]})]})]})})}function f$({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(SP,{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 p$({step:e,initialValue:t,disabled:n,onSubmit:s}){const[o,i]=p.useState(t??""),[c,u]=p.useState(!1),f=p.useRef(null);p.useEffect(()=>{var C;(C=f.current)==null||C.focus()},[]);const m=o.trim(),h=e.required!==!1,g=e.pattern&&m.length>0&&!e.pattern.regex.test(m),y=!n&&(!h||m.length>0)&&!g;function b(C){if(C.key==="Enter"){if(C.preventDefault(),!y){u(!0);return}s(m)}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:f,type:"text",value:o,onChange:C=>{i(C.target.value),u(!1)},onKeyDown:b,placeholder:e.placeholder,disabled:n,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),c&&e.pattern&&g?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:e.pattern.message}):null]})}function m$({step:e,disabled:t,onSubmit:n}){const[s,o]=p.useState({phase:"loading"}),[i,c]=p.useState(""),[u,f]=p.useState(0),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null);p.useEffect(()=>{var j;(j=g.current)==null||j.focus()},[]),p.useEffect(()=>{let j=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(v=>{j||o({phase:"loaded",options:v})}).catch(v=>{if(j)return;const k=v instanceof Error?v.message:"Failed to load options";o({phase:"error",message:k})}),()=>{j=!0}},[e,m]);const b=p.useMemo(()=>{if(s.phase!=="loaded")return[];const j=s.options.map(v=>({type:"option",title:v.label,subtitle:v.hint,keywords:[v.value],option:v}));return jx(i,j,100)},[s,i]);p.useEffect(()=>{f(0)},[b.length]),p.useEffect(()=>{var v;const j=(v=y.current)==null?void 0:v.querySelector(`[data-picker-idx="${u}"]`);j==null||j.scrollIntoView({block:"nearest"})},[u]);function C(j){if(s.phase==="loaded"){if(j.key==="ArrowDown")j.preventDefault(),f(v=>Math.min(b.length-1,v+1));else if(j.key==="ArrowUp")j.preventDefault(),f(v=>Math.max(0,v-1));else if(j.key==="Enter"){j.preventDefault();const v=b[u];v&&n(v.option.value)}}}return r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:g,type:"text",value:i,onChange:j=>c(j.target.value),onKeyDown:C,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||s.phase==="loading",className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),r.jsx("div",{ref:y,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:s.phase==="loading"?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):s.phase==="error"?r.jsxs("div",{className:"px-4 py-4 text-sm",children:[r.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",s.message]}),r.jsx("button",{type:"button",onClick:()=>h(j=>j+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):b.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s.options.length===0?e.emptyMessage??"No options available":"No matches"}):b.map((j,v)=>{const k=v===u;return r.jsxs("button",{type:"button","data-picker-idx":v,onClick:()=>n(j.option.value),onMouseEnter:()=>f(v),disabled:t,className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${k?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"min-w-0 flex-1 truncate",children:j.option.label}),j.option.hint?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:j.option.hint}):null]},j.option.value)})})]})}function h$({entries:e}){var ue,ge;const t=zt(),{actionsPaletteOpen:n,closeActionsPalette:s,customBindings:o,bindAction:i,findConflict:c,pendingActionKind:u,consumePendingActionKind:f}=Eo(),[m,h]=p.useState(""),[g,y]=p.useState(0),[b,C]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(null),[S,T]=p.useState(null),[A,R]=p.useState(!1),[P,$]=p.useState(null),I=p.useRef(null),M=p.useMemo(()=>e.map(se=>({type:se.group.toLowerCase(),title:se.title,subtitle:se.subtitle,keywords:se.keywords,action:se})),[e]),D=p.useMemo(()=>jx(m,M,50),[m,M]);p.useEffect(()=>{y(0)},[m,n]),p.useEffect(()=>{n||(h(""),C(null),v(""),E(null),T(null),R(!1),$(null))},[n]),p.useEffect(()=>{if(!n||!u)return;const se=f();if(!se)return;const ye=e.find(Se=>Se.bindableKind===se);ye&&H(ye)},[n,u]),p.useEffect(()=>{var ye;const se=(ye=I.current)==null?void 0:ye.querySelector(`[data-palette-idx="${g}"]`);se==null||se.scrollIntoView({block:"nearest"})},[g]);async function H(se){if(!A){if(se.flow&&se.flow.steps.length>0){E({action:se,stepIndex:0,values:{}}),$(null);return}if(se.requiresInput){C(se),v(""),$(null);return}if(se.run){R(!0),$(null);try{await se.run(),s()}catch(ye){$(ye instanceof Error?ye.message:"Action failed")}finally{R(!1)}}}}async function K(se){if(!k)return;const ye=k.action.flow.steps[k.stepIndex],Se={...k.values,[ye.id]:se};if(k.stepIndex+1<k.action.flow.steps.length){E({action:k.action,stepIndex:k.stepIndex+1,values:Se});return}R(!0),$(null);try{await k.action.flow.submit(Se,{navigate:t}),s()}catch(Ee){$(Ee instanceof Error?Ee.message:"Action failed")}finally{R(!1)}}function _(){if(k&&!A){if(k.stepIndex===0){E(null),$(null);return}E({action:k.action,stepIndex:k.stepIndex-1,values:k.values}),$(null)}}async function U(){if(A||!(b!=null&&b.requiresInput))return;const se=j.trim();if(se){R(!0),$(null);try{await b.requiresInput.runWithInput(se),s()}catch(ye){$(ye instanceof Error?ye.message:"Action failed")}finally{R(!1)}}}function q(se){if(se.key==="ArrowDown")se.preventDefault(),y(ye=>Math.min(D.length-1,ye+1));else if(se.key==="ArrowUp")se.preventDefault(),y(ye=>Math.max(0,ye-1));else if(se.key==="Enter"&&(se.metaKey||se.ctrlKey)){se.preventDefault();const ye=D[g];ye!=null&&ye.action.bindableKind&&T({action:ye.action,combo:null,conflict:null,saving:!1,error:null})}else if(se.key==="Enter"){se.preventDefault();const ye=D[g];ye&&H(ye.action)}}function Z(se){se.key==="Enter"?(se.preventDefault(),U()):se.key==="Escape"&&(se.preventDefault(),C(null),v(""))}function F(se){if(!S||se.key==="Escape"||se.key==="Enter"&&!S.combo)return;se.preventDefault(),se.stopPropagation();const ye=Yk(se.nativeEvent);if(!ye)return;const Se=c(ye,S.action.bindableKind);T({...S,combo:ye,conflict:Se,error:null})}async function G(){var se;if(!(!S||!S.combo||!S.action.bindableKind)){if((se=S.conflict)!=null&&se.description){T({...S,error:`Reserved: ${S.conflict.description}`});return}T({...S,saving:!0,error:null});try{await i(S.action.bindableKind,S.combo),T(null)}catch(ye){T({...S,saving:!1,error:ye instanceof Error?ye.message:"Failed to save binding"})}}}const L=b!==null,V=k!==null,re=S!==null,B=k?k.action.flow.steps[k.stepIndex]:null;return r.jsx(zn,{open:n,onOpenChange:se=>se?null:s(),children:r.jsxs($n,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:se=>{if(!A){if(re){se.preventDefault(),T(null);return}if(V){se.preventDefault(),_();return}L&&(se.preventDefault(),C(null),v(""),$(null))}},children:[r.jsx(Ln,{className:"sr-only",children:"Actions palette"}),re&&S?r.jsxs("div",{onKeyDown:F,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(rg,{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:js(S.combo)}),(ue=S.conflict)!=null&&ue.description?r.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(ge=S.conflict)!=null&&ge.kind?r.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',S.conflict.kind,'". Press Enter to overwrite.']}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),S.error?r.jsx("div",{className:"text-sm text-destructive",children:S.error}):null]}):r.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),r.jsx("span",{children:S.saving?"Saving…":""})]}),r.jsx("button",{type:"button",className:"sr-only",onClick:()=>void G(),"data-bind-confirm":!0}),r.jsx("input",{type:"hidden",onKeyDown:se=>{se.key==="Enter"&&G()}})]}):V&&B&&k?r.jsxs(r.Fragment,{children:[r.jsx(f$,{label:`${k.action.title} · ${B.label}`,onBack:_,disabled:A,stepCounter:{current:k.stepIndex+1,total:k.action.flow.steps.length}}),B.kind==="text"?r.jsx(p$,{step:B,initialValue:k.values[B.id],disabled:A,onSubmit:K}):r.jsx(m$,{step:B,disabled:A,onSubmit:K}),P?r.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{children:"↵ next · ← back · Esc back"}),r.jsx("span",{children:A?"Running…":""})]})]}):L?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:b.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:b.title})]}),r.jsx("input",{autoFocus:!0,type:"text",value:j,onChange:se=>v(se.target.value),onKeyDown:Z,placeholder:b.requiresInput.placeholder,disabled:A,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),r.jsx("span",{children:A?"Running…":""})]})]}):r.jsxs(r.Fragment,{children:[r.jsx("input",{autoFocus:!0,type:"text",value:m,onChange:se=>h(se.target.value),onKeyDown:q,placeholder:"Run an action: new project, new todo, toggle…",disabled:A,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),P?r.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:P}):null,r.jsx("div",{ref:I,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?r.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:m?"No matches":"Start typing to search actions"}):D.map((se,ye)=>{const Se=ye===g,Ee=se.action.bindableKind,Ae=Ee?o[Ee]:void 0;return r.jsxs("button",{type:"button","data-palette-idx":ye,onClick:()=>H(se.action),onMouseEnter:()=>y(ye),disabled:A,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${Se?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[r.jsx("span",{className:"shrink-0 rounded border border-border/70 bg-background/60 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:se.action.group}),r.jsx("span",{className:"min-w-0 flex-1 truncate",children:se.action.title}),se.action.subtitle?r.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:se.action.subtitle}):null,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:js(Ae)}):null,Ee?r.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Ke=>{Ke.preventDefault(),Ke.stopPropagation(),T({action:se.action,combo:null,conflict:null,saving:!1,error:null})},className:`shrink-0 inline-flex h-6 w-6 items-center justify-center rounded border border-border/70 bg-background/60 text-muted-foreground transition-opacity hover:text-foreground ${Se?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:r.jsx(rg,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},se.action.id)})}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[r.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),r.jsx("span",{children:A?"Running…":`${D.length} action${D.length===1?"":"s"}`})]})]})]})})}const g$=[{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 x$(e){const t=ur(e);return t?g$.find(n=>n.combo===t)??null:null}const $l={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},y$={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},b$=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function Dw(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${js(t)} then ${js(n)}`}return js(e)}function v$(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:s,actionEntries:o}=Eo(),i=p.useMemo(()=>{const f=new Set;for(const m of Object.values(s))typeof m=="string"&&m&&f.add(ur(m));return f},[s]),c=p.useMemo(()=>{if(!e)return new Map;const f=n(),m=new Map;for(const h of f){if(i.has(ur(h.keys)))continue;const g=m.get(h.scope)??[];g.push({keys:h.keys,description:h.description}),m.set(h.scope,g)}return m},[e,n,i]),u=p.useMemo(()=>{const f=[];for(const[m,h]of Object.entries(s)){if(!h)continue;const g=o.find(y=>y.bindableKind===m);f.push({kind:m,combo:h,title:g?g.title:m})}return f},[s,o]);return r.jsx(zn,{open:e,onOpenChange:f=>f?null:t(),children:r.jsxs($n,{className:"max-w-2xl",children:[r.jsx(Ln,{children:"Keyboard shortcuts"}),r.jsxs(Hr,{children:["Press Esc to close. ",js("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:[b$.map(f=>{const m=c.get(f);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:y$[f]}),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:Dw(h.keys)})]},`${f}-${h.keys}-${g}`))})]},f)}),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(f=>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:f.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:Dw(f.combo)})]},`custom-${f.kind}`))})]}):null]})]})})}const kx={bindings:{},custom:!1};let Kl=null,Qa=null;const cg=new Set;function FS(e){Kl=e;for(const t of cg)t(e)}function Sx(e){if(!e||typeof e!="object")return kx;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(!o3(s)||typeof o!="string"||o.trim()==="")continue;const i=ur(o);i&&(n[s]=i)}return{bindings:n,custom:t.custom===!0}}function w$(){return Kl?Promise.resolve(Kl):Qa||(Qa=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Sx(e);return Kl=t,Qa=null,t}).catch(()=>(Qa=null,kx)),Qa)}function j$(){const[e,t]=p.useState(()=>Kl??kx);return p.useEffect(()=>{let n=!1;return w$().then(s=>{n||t(s)}),cg.add(t),()=>{n=!0,cg.delete(t)}},[]),e}async function $w(e){const t={};for(const o of jf){const i=e[o];if(typeof i!="string")continue;const c=ur(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=Sx(await n.json());return FS(s),s}async function k$(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Sx(await e.json());return FS(t),t}const Lw=1500;function S$(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const zS=p.createContext(null);function N$({children:e}){const{toggleTheme:t}=ax(),n=Xn(),s=zt(),o=S$(n.pathname),[i,c]=p.useState(!1),u=Co(i),f=vf(i),m=lx(i),h=ix(i),g=Jk(i),y=p.useMemo(()=>{var Ze,Qe,Ot,yt;const X=u.data??[],Me=((Ze=f.data)==null?void 0:Ze.assignments)??[],Ce=((Qe=m.data)==null?void 0:Qe.playbooks)??[],Ie=((Ot=h.data)==null?void 0:Ot.sessions)??[],Fe=(((yt=g.data)==null?void 0:yt.workspaces)??[]).flatMap(dt=>dt.items.map(le=>({...le,workspace:dt.workspace})));return y3({projects:X,assignments:Me,playbooks:Ce,servers:Ie,todos:Fe,wsPrefix:o})},[u.data,f.data,m.data,h.data,g.data,o]),C=p.useMemo(()=>Ok(n.pathname),[n.pathname]).projectSlug,j=p.useMemo(()=>{var X;return C?((X=u.data)==null?void 0:X.find(Me=>Me.slug===C))??null:null},[u.data,C]),v=(j==null?void 0:j.title)??null,k=(j==null?void 0:j.workspace)??null,E=p.useMemo(()=>{var X;return w3({playbooks:((X=m.data)==null?void 0:X.playbooks)??[],projectSlug:C,currentProjectTitle:v,currentProjectWorkspace:k,wsPrefix:o,refetchPlaybooks:m.refetch,navigate:s,toggleTheme:t})},[m.data,m.refetch,C,v,k,o,s,t]),S=p.useRef(new Map),T=p.useRef(["global"]),A=p.useRef({phase:"idle"}),R=p.useRef(null),P=p.useRef(1),[$,I]=p.useState(!1),[M,D]=p.useState(!1),[H,K]=p.useState(!1),[_,U]=p.useState(null);p.useEffect(()=>{($||H)&&c(!0)},[$,H]);const{bindings:q}=j$(),Z=p.useMemo(()=>u3(q),[q]),F=p.useCallback(X=>{const Me=P.current++;return S.current.set(Me,{...X,id:Me}),Me},[]),G=p.useCallback(X=>{S.current.delete(X)},[]),L=p.useCallback(X=>{T.current.push(X)},[]),V=p.useCallback(X=>{const Me=T.current;for(let Ce=Me.length-1;Ce>=0;Ce--)if(Me[Ce]===X){Me.splice(Ce,1);return}},[]),re=p.useCallback(()=>I(!0),[]),B=p.useCallback(()=>I(!1),[]),ue=p.useCallback(()=>D(!0),[]),ge=p.useCallback(()=>D(!1),[]),se=p.useCallback(()=>K(!0),[]),ye=p.useCallback(()=>{K(!1),U(null)},[]),Se=p.useCallback(()=>Array.from(S.current.values()),[]),Ee=p.useCallback(()=>{let X=null;return U(Me=>(X=Me,null)),X},[]),Ae=p.useCallback(X=>{U(X),K(!0)},[]),Ke=p.useCallback((X,Me)=>{const Ce=ur(X);if(!Ce)return null;if(l3(Ce)){const Ie=x$(Ce);return{description:(Ie==null?void 0:Ie.description)??"Reserved built-in shortcut"}}for(const[Ie,Ye]of Object.entries(Z))if(!(Me&&Ie===Me)&&Ye===Ce)return{kind:Ie};return null},[Z]),ct=p.useCallback(async(X,Me)=>{const Ce=ur(Me);if(!Ce)throw new Error("Empty combo");const Ie=Ke(Ce,X);if(Ie){const Fe=Ie.description?`Reserved: ${Ie.description}`:`Already bound to "${Ie.kind}"`;throw new Error(Fe)}const Ye={...q,[X]:Ce};return await $w(Ye),Ce},[q,Ke]),et=p.useCallback(async X=>{if(!q[X])return;const Me={...q};delete Me[X],await $w(Me)},[q]);p.useEffect(()=>{A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),p.useEffect(()=>{function X(Fe){if(!(Fe instanceof HTMLElement))return!1;const Ze=Fe.tagName;return!!(Ze==="INPUT"||Ze==="TEXTAREA"||Ze==="SELECT"||Fe.isContentEditable||Fe.closest('[role="combobox"], [role="textbox"]'))}function Me(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function Ce(){const Fe=T.current;return Fe[Fe.length-1]??"global"}function Ie(Fe){return Fe.scope==="global"?!0:Fe.scope===Ce()}function Ye(Fe){const Ze=Ju(Fe,"Mod+k"),Qe=Ju(Fe,"Mod+Shift+k"),Ot=Fe.key==="Escape",yt=Ze||Qe||Ot;if(Me()&&!yt||X(Fe.target)&&!yt)return;const dt=A.current;if(dt.phase==="awaiting-second")if(Date.now()-dt.startedAt>Lw)A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const fe=Array.from(S.current.values());for(const ne of fe){if(!Ie(ne))continue;const he=ne.keys.split(" ");if(!(he.length!==2||he[0]!=="g")&&Ju(Fe,he[1])&&!(ne.when&&!ne.when())){Fe.preventDefault(),A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),ne.handler(Fe);return}}A.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const le=Array.from(S.current.values());for(const Y of le){if(!Ie(Y))continue;const fe=Y.keys.split(" ");if(fe.length===1&&Ju(Fe,fe[0])&&!(Y.when&&!Y.when())){Fe.preventDefault(),Y.handler(Fe);return}}Fe.key==="g"&&!Fe.metaKey&&!Fe.ctrlKey&&!Fe.altKey&&!Fe.shiftKey&&Array.from(S.current.values()).some(fe=>Ie(fe)&&fe.keys.startsWith("g "))&&(Fe.preventDefault(),A.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{A.current={phase:"idle"},R.current=null},Lw))}return window.addEventListener("keydown",Ye),()=>{window.removeEventListener("keydown",Ye),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),p.useEffect(()=>{const X=F({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>G(X)},[F,G,t]),p.useEffect(()=>{const X=F({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ue()});return()=>G(X)},[F,G,ue]),p.useEffect(()=>{const X=F({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if($){B();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||re()}});return()=>G(X)},[F,G,re,B,$]),p.useEffect(()=>{const X=F({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(H){ye();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||se()}});return()=>G(X)},[F,G,se,ye,H]),p.useEffect(()=>{const Me=[{suffix:"o",basePath:"/",desc:"Go to Overview"},{suffix:"m",basePath:"/projects",desc:"Go to Projects"},{suffix:"a",basePath:"/assignments",desc:"Go to Assignments"},{suffix:"t",basePath:"/todos",desc:"Go to Todos"},{suffix:"s",basePath:"/servers",desc:"Go to Servers"},{suffix:",",basePath:"/settings",desc:"Go to Settings"}].map(Ce=>F({keys:`g ${Ce.suffix}`,scope:"global",description:Ce.desc,handler:()=>s(yd(Ce.basePath,o))}));return()=>Me.forEach(G)},[F,G,s,o]),p.useEffect(()=>{const X=[];for(const[Me,Ce]of Object.entries(Z)){if(!Ce)continue;const Ie=E.find(Fe=>Fe.bindableKind===Me),Ye=Ie?`Custom: ${Ie.title}`:`Custom: ${Me}`;X.push(F({keys:Ce,scope:"global",description:Ye,handler:()=>{U(Me),K(!0)}}))}return()=>X.forEach(G)},[F,G,Z,E]);const ot=p.useMemo(()=>({register:F,unregister:G,pushScope:L,popScope:V,openPalette:re,closePalette:B,paletteOpen:$,openCheatsheet:ue,closeCheatsheet:ge,cheatsheetOpen:M,openActionsPalette:se,closeActionsPalette:ye,actionsPaletteOpen:H,listBindings:Se,wsPrefix:o,paletteEntries:y,actionEntries:E,userBindings:q,customBindings:Z,bindAction:ct,unbindAction:et,findConflict:Ke,openActionsPaletteWithAction:Ae,pendingActionKind:_,consumePendingActionKind:Ee}),[F,G,L,V,re,B,$,ue,ge,M,se,ye,H,Se,o,y,E,q,Z,ct,et,Ke,Ae,_,Ee]);return r.jsxs(zS.Provider,{value:ot,children:[e,r.jsx(d$,{entries:y}),r.jsx(h$,{entries:E}),r.jsx(v$,{})]})}function Eo(){const e=p.useContext(zS);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Yt({keys:e,handler:t,scope:n="global",description:s,when:o,enabled:i=!0}){const{register:c,unregister:u}=Eo(),f=p.useRef(t),m=p.useRef(o);p.useEffect(()=>{f.current=t,m.current=o},[t,o]),p.useEffect(()=>{if(!i)return;const h=c({keys:e,handler:g=>f.current(g),scope:n,description:s,when:m.current?()=>m.current():void 0});return()=>u(h)},[c,u,e,n,s,i])}function To(e){const{pushScope:t,popScope:n}=Eo();p.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Nc(e,t){const[n,s]=p.useState(e.length===0?-1:0),o=Xn();p.useEffect(()=>{s(e.length===0?-1:0)},[o.pathname]),p.useEffect(()=>{s(c=>e.length===0?-1:Math.min(Math.max(0,c),e.length-1))},[e.length]),p.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(u=>{const f=Number(u.getAttribute("data-hotkey-row-index"));u.setAttribute("data-hotkey-selected",f===n?"true":"false")}),n>=0){const u=document.querySelector(`[data-hotkey-row-index="${n}"]`);u==null||u.scrollIntoView({block:"nearest"})}},[n,e.length]),Yt({keys:"j",scope:t.scope,description:"Select next row",handler:()=>s(c=>e.length===0?-1:Math.min(e.length-1,c<0?0:c+1))}),Yt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>s(c=>e.length===0?-1:Math.max(0,c<0?0:c-1))}),Yt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Yt({keys:"o",scope:t.scope,description:"Open selected row",enabled:t.bindO??!0,handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}});const i=p.useCallback(c=>({"data-hotkey-row-index":c,"data-hotkey-selected":c===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function C$({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:s}){const o=fn(),{resolvedTheme:i,toggleTheme:c}=ax(),{openPalette:u}=Eo();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(WP,{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((f,m)=>r.jsxs("span",{className:"flex items-center gap-1.5",children:[m>0?r.jsx("span",{children:"/"}):null,r.jsx(Te,{to:f.path,className:"hover:text-foreground",children:f.label})]},f.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(No,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:js("Mod+k")})]}),r.jsx(Te,{className:"shell-action",to:"/help",children:"Help"}),r.jsxs(Te,{className:"shell-action",to:`${o}/create/project`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Project"})]}),n?r.jsxs(Te,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}):null,r.jsxs("button",{type:"button",onClick:c,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?r.jsx(tA,{className:"h-4 w-4"}):r.jsx(KP,{className:"h-4 w-4"}),r.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const zd="_ungrouped",E$=256;function T$(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>E$||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function R$(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(s=>!n.has(s))}function P$(e,t){return t.includes(e)}const Nx={hidden:[],custom:!1};let Fs=null,Jo=null,lc=0;const ug=new Set;function BS(e){Fs=e;for(const t of ug)t(e)}function Cx(e){if(!e||typeof e!="object")return Nx;const t=e;return{hidden:T$(t.hidden),custom:t.custom===!0}}function A$(){if(Fs)return Promise.resolve({value:Fs,ok:!0});if(Jo)return Jo;const e=++lc;return Jo=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Jo=null;const n=Cx(t);return e!==lc?{value:Fs??n,ok:!0}:(Fs=n,{value:n,ok:!0})}).catch(()=>(Jo=null,{value:Nx,ok:!1})),Jo}function US(){const[e,t]=p.useState(()=>Fs??Nx),[n,s]=p.useState(()=>Fs===null),[o,i]=p.useState(!1),[c,u]=p.useState(0);p.useEffect(()=>{let m=!1;return s(Fs===null),A$().then(h=>{m||(t(h.value),s(!1),i(!h.ok))}),ug.add(t),()=>{m=!0,ug.delete(t)}},[c]);function f(){D$(),u(m=>m+1)}return{...e,loading:n,error:o,reload:f}}function D$(){Fs=null,Jo=null,++lc}async function $$(e){++lc;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=Cx(await t.json());return BS(n),n}async function L$(){++lc;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=Cx(await e.json());return BS(t),t}var O$=Symbol("radix.slottable");function I$(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=O$,t}var VS="AlertDialog",[_$]=da(VS,[bS]),Hs=bS(),HS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(OS,{...s,...n,modal:!0})};HS.displayName=VS;var M$="AlertDialogTrigger",F$=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(IS,{...o,...s,ref:t})});F$.displayName=M$;var z$="AlertDialogPortal",WS=e=>{const{__scopeAlertDialog:t,...n}=e,s=Hs(t);return r.jsx(_S,{...s,...n})};WS.displayName=z$;var B$="AlertDialogOverlay",KS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(xx,{...o,...s,ref:t})});KS.displayName=B$;var yi="AlertDialogContent",[U$,V$]=_$(yi),H$=I$("AlertDialogContent"),qS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,i=Hs(n),c=p.useRef(null),u=qn(t,c),f=p.useRef(null);return r.jsx(t$,{contentName:yi,titleName:GS,docsSlug:"alert-dialog",children:r.jsx(U$,{scope:n,cancelRef:f,children:r.jsxs(yx,{role:"alertdialog",...i,...o,ref:u,onOpenAutoFocus:Xt(o.onOpenAutoFocus,m=>{var h;m.preventDefault(),(h=f.current)==null||h.focus({preventScroll:!0})}),onPointerDownOutside:m=>m.preventDefault(),onInteractOutside:m=>m.preventDefault(),children:[r.jsx(H$,{children:s}),r.jsx(K$,{contentRef:c})]})})})});qS.displayName=yi;var GS="AlertDialogTitle",YS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(bx,{...o,...s,ref:t})});YS.displayName=GS;var JS="AlertDialogDescription",QS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(vx,{...o,...s,ref:t})});QS.displayName=JS;var W$="AlertDialogAction",XS=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Hs(n);return r.jsx(wx,{...o,...s,ref:t})});XS.displayName=W$;var ZS="AlertDialogCancel",e1=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=V$(ZS,n),i=Hs(n),c=qn(t,o);return r.jsx(wx,{...i,...s,ref:c})});e1.displayName=ZS;var K$=({contentRef:e})=>{const t=`\`${yi}\` requires a description for the component to be accessible for screen reader users.
|
|
535
|
+
|
|
536
|
+
You can add a description to the \`${yi}\` by passing a \`${JS}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
537
|
+
|
|
538
|
+
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 \`${yi}\`. 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.
|
|
539
|
+
|
|
540
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return p.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},q$=HS,G$=WS,t1=KS,n1=qS,r1=XS,s1=e1,o1=YS,a1=QS;const li=q$,Y$=G$,i1=p.forwardRef(({className:e,...t},n)=>r.jsx(t1,{ref:n,className:we("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));i1.displayName=t1.displayName;const na=p.forwardRef(({className:e,...t},n)=>r.jsxs(Y$,{children:[r.jsx(i1,{}),r.jsx(n1,{ref:n,className:we("chrome-card fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 !p-6 outline-none",e),...t})]}));na.displayName=n1.displayName;function ci({className:e,...t}){return r.jsx("div",{className:we("flex flex-col space-y-2 text-left",e),...t})}function ui({className:e,...t}){return r.jsx("div",{className:we("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const ra=p.forwardRef(({className:e,...t},n)=>r.jsx(o1,{ref:n,className:we("text-lg font-semibold tracking-tight text-foreground",e),...t}));ra.displayName=o1.displayName;const sa=p.forwardRef(({className:e,...t},n)=>r.jsx(a1,{ref:n,className:we("text-sm leading-6 text-muted-foreground",e),...t}));sa.displayName=a1.displayName;const yo=p.forwardRef(({className:e,...t},n)=>r.jsx(r1,{ref:n,className:we(e),...t}));yo.displayName=r1.displayName;const cc=p.forwardRef(({className:e,...t},n)=>r.jsx(s1,{ref:n,className:we(e),...t}));cc.displayName=s1.displayName;const J$=[{to:"/",label:"Overview",icon:yk},{to:"/playbooks",label:"Playbooks",icon:hk},{to:"/memories",label:"Memories",icon:kP},{to:"/resources",label:"Resources",icon:FP},{to:"/inventories",label:"Inventories",icon:xf},{to:"/usage",label:"Usage",icon:yf},{to:"/todos",label:"Todos",icon:Fr},{to:"/views",label:"Saved Views",icon:vk},{to:"/archive",label:"Archive",icon:hf}],Q$=[{suffix:"/projects",label:"Projects",icon:Jg},{suffix:"/assignments",label:"Assignments",icon:UP},{suffix:"/servers",label:"Servers",icon:ex},{suffix:"/inventories",label:"Inventories",icon:xf},{suffix:"/usage",label:"Usage",icon:yf},{suffix:"/agent-sessions",label:"Agent Sessions",icon:mf},{suffix:"/todos",label:"Todos",icon:Fr}],X$=[{to:"/help",label:"Help",icon:zP},{to:"/settings",label:"Settings",icon:ZP}];function Z$({title:e,breadcrumbs:t,projectSlug:n,workspace:s,children:o}){const[i,c]=p.useState(!1);return Yt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>c(!1)}),r.jsx("div",{className:"min-h-screen bg-background",children:r.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[r.jsx("aside",{className:"hidden max-h-screen sticky top-0 overflow-y-auto border-r border-border/70 bg-sidebar px-4 py-4 lg:flex lg:flex-col",children:r.jsx(Ow,{activeWorkspace:s})}),i?r.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:r.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[r.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[r.jsx(Te,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>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(rx,{className:"h-4 w-4"})})]}),r.jsx(Ow,{activeWorkspace:s,onNavigate:()=>c(!1)})]})}):null,r.jsxs("div",{className:"min-w-0",children:[r.jsx(C$,{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 Ow({activeWorkspace:e,onNavigate:t}){const{data:n}=Sc(),s=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=US(),c=Xn(),[u,f]=p.useState(new Set),[m,h]=p.useState(!1),[g,y]=p.useState(""),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(!1),A=zt();function R(M){f(D=>{const H=new Set(D);return H.has(M)?H.delete(M):H.add(M),H})}const P=R$([...s,...o?[zd]:[]],i);async function $(M){if(j){T(!0);try{const D=`/api/workspaces/${encodeURIComponent(j)}${M?"?cascade=true":""}`,H=await fetch(D,{method:"DELETE"});if(H.status===409){const K=await H.json().catch(()=>({}));E((K==null?void 0:K.blockedBy)??{projects:[],standalones:[]});return}if(!H.ok){const K=await H.json().catch(()=>({}));throw new Error(K.error||"Failed to delete workspace")}v(null),E(null)}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to delete workspace")}finally{T(!1)}}}async function I(M,D){try{if(M.type==="project"){const H=await fetch(`/api/projects/${encodeURIComponent(M.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:D})});if(!H.ok){const K=await H.json().catch(()=>({}));throw new Error(K.error||"Failed to move project")}return}if(M.type==="standalone-assignment"){const H=await fetch(`/api/assignments/${encodeURIComponent(M.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:D})});if(!H.ok){const K=await H.json().catch(()=>({}));throw new Error(K.error||"Failed to move assignment")}return}if(M.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(H){console.error(H),alert(H instanceof Error?H.message:"Failed to move item")}}return r.jsxs("div",{className:"flex h-full flex-col gap-3",children:[r.jsx("div",{className:"space-y-3",children:r.jsxs(Te,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[r.jsx("span",{className:"inline-flex h-8 w-8 items-center justify-center rounded-lg bg-card text-foreground shadow-sm ring-1 ring-border/60",children:r.jsxs("svg",{viewBox:"0 0 43 51","aria-label":"Syntaur",role:"img",className:"h-4 w-auto",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("path",{d:"M13 2C13 0.89543 13.8954 0 15 0H41C42.1046 0 43 0.895431 43 2V12C43 13.1046 42.1046 14 41 14H13V2Z"}),r.jsx("path",{d:"M0 15C0 13.8954 0.895431 13 2 13H14V25C14 26.1046 13.1046 27 12 27H2C0.89543 27 0 26.1046 0 25V15Z"}),r.jsx("path",{d:"M30 49C30 50.1046 29.1046 51 28 51L2 51C0.89543 51 0 50.1046 0 49L0 39C0 37.8954 0.895431 37 2 37L30 37L30 49Z"}),r.jsx("path",{d:"M42.9646 36C42.9646 37.1046 42.0692 38 40.9646 38H28.9646V26C28.9646 24.8954 29.86 24 30.9646 24H40.9646C42.0692 24 42.9646 24.8954 42.9646 26V36Z"})]})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),r.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),r.jsx(hw,{items:J$,onNavigate:t}),r.jsx("div",{className:"border-t border-border/40"}),r.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[P.length===0&&!m&&r.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),P.map(M=>{const D=M==="_ungrouped",H=D?"Ungrouped":Sn(M),K=D?"/w/_ungrouped":`/w/${M}`,_=u.has(M),U=e===M||e===null&&D&&c.pathname.startsWith("/w/_ungrouped"),q=b===M;return r.jsxs("div",{className:`rounded-md transition ${q?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:Z=>{Z.dataTransfer.types.includes("application/json")&&(Z.preventDefault(),Z.dataTransfer.dropEffect="move",C(M))},onDragLeave:Z=>{Z.currentTarget.contains(Z.relatedTarget)||C(F=>F===M?null:F)},onDrop:async Z=>{try{const F=Z.dataTransfer.getData("application/json");if(!F)return;Z.preventDefault();let G;try{G=JSON.parse(F)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await I(G,D?null:M)}finally{C(null)}},children:[r.jsxs("div",{className:"group flex items-center",children:[r.jsxs("button",{type:"button",onClick:()=>R(M),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${U?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[r.jsx(fr,{className:`h-3 w-3 transition-transform ${_?"-rotate-90":""}`}),H]}),D?null:r.jsx("button",{type:"button",onClick:Z=>{Z.stopPropagation(),v(M),E(null)},title:`Delete workspace "${M}"`,"aria-label":`Delete workspace "${M}"`,className:"mr-1 flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 opacity-0 transition hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100",children:r.jsx(Tn,{className:"h-3 w-3"})})]}),!_&&r.jsx("nav",{className:"ml-2 space-y-0.5",children:Q$.map(Z=>{const F=`${K}${Z.suffix}`,G=Lk(c.pathname,Z.suffix)&&c.pathname.startsWith(K),L=Z.icon;return r.jsxs(Te,{to:F,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${G?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[r.jsx(L,{className:"h-4 w-4"}),r.jsx("span",{children:Z.label})]},F)})})]},M)}),m?r.jsx("form",{className:"px-3 py-1.5",onSubmit:M=>{M.preventDefault();const D=g.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");D&&(h(!1),y(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:D})}).then(()=>{t==null||t(),A(`/w/${D}/projects`)}))},children:r.jsx("input",{autoFocus:!0,type:"text",value:g,onChange:M=>y(M.target.value),onKeyDown:M=>{M.key==="Escape"&&(h(!1),y(""))},onBlur:()=>{g.trim()||(h(!1),y(""))},placeholder:"workspace-name",className:"w-full rounded-md border border-border/60 bg-background/80 px-2 py-1 text-xs text-foreground placeholder:text-muted-foreground/50 focus:border-foreground/40 focus:outline-none"})}):r.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-xs font-medium text-muted-foreground/60 transition hover:text-muted-foreground",children:[r.jsx(Lt,{className:"h-3 w-3"}),"New Workspace"]})]}),r.jsx("div",{className:"border-t border-border/40"}),r.jsx(hw,{items:X$,onNavigate:t}),r.jsx(li,{open:j!==null,onOpenChange:M=>{S||M||(v(null),E(null))},children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsx(ra,{children:k?"Workspace has references":"Delete workspace?"}),r.jsx(sa,{children:k?r.jsxs(r.Fragment,{children:["The workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," is still referenced by:"]}):r.jsxs(r.Fragment,{children:["Remove the workspace ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:j})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),k?r.jsxs("div",{className:"space-y-2 text-sm",children:[k.projects.length>0?r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",k.projects.length,")"]}),r.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:k.projects.map(M=>r.jsx("li",{children:r.jsx(Te,{to:`/projects/${M}`,className:"hover:underline",children:M})},M))})]}):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(M=>r.jsx("li",{children:r.jsx(Te,{to:`/assignments/${M}`,className:"hover:underline",children:M})},M))})]}):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(ui,{children:[r.jsx(cc,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),k?r.jsx(yo,{disabled:S,onClick:M=>{M.preventDefault(),$(!0)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Clear references and delete"}):r.jsx(yo,{disabled:S,onClick:M=>{M.preventDefault(),$(!1)},className:"shell-action mt-0 border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:cursor-not-allowed disabled:opacity-50",children:S?"Working…":"Delete"})]})]})})]})}function eL(){const e=Xn(),{workspace:t}=Bt(),{title:n,breadcrumbs:s,projectSlug:o}=Ok(e.pathname);return r.jsx(Z$,{title:n,breadcrumbs:s,projectSlug:o,workspace:t??null,children:r.jsx(OR,{})})}function tL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>s=>{t.forEach(o=>o(s))},t)}const Ef=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _i(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Ex(e){return"nodeType"in e}function Zn(e){var t,n;return e?_i(e)?e:Ex(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Tx(e){const{Document:t}=Zn(e);return e instanceof t}function Cc(e){return _i(e)?!1:e instanceof Zn(e).HTMLElement}function l1(e){return e instanceof Zn(e).SVGElement}function Mi(e){return e?_i(e)?e.document:Ex(e)?Tx(e)?e:Cc(e)||l1(e)?e.ownerDocument:document:document:document}const ns=Ef?p.useLayoutEffect:p.useEffect;function Tf(e){const t=p.useRef(e);return ns(()=>{t.current=e}),p.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return t.current==null?void 0:t.current(...s)},[])}function nL(){const e=p.useRef(null),t=p.useCallback((s,o)=>{e.current=setInterval(s,o)},[]),n=p.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function uc(e,t){t===void 0&&(t=[e]);const n=p.useRef(e);return ns(()=>{n.current!==e&&(n.current=e)},t),n}function Ec(e,t){const n=p.useRef();return p.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Bd(e){const t=Tf(e),n=p.useRef(null),s=p.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,s]}function Ud(e){const t=p.useRef();return p.useEffect(()=>{t.current=e},[e]),t.current}let ph={};function Tc(e,t){return p.useMemo(()=>{if(t)return t;const n=ph[e]==null?0:ph[e]+1;return ph[e]=n,e+"-"+n},[e,t])}function c1(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[f,m]of u){const h=i[f];h!=null&&(i[f]=h+e*m)}return i},{...t})}}const bi=c1(1),dc=c1(-1);function rL(e){return"clientX"in e&&"clientY"in e}function Rf(e){if(!e)return!1;const{KeyboardEvent:t}=Zn(e.target);return t&&e instanceof t}function sL(e){if(!e)return!1;const{TouchEvent:t}=Zn(e.target);return t&&e instanceof t}function Vd(e){if(sL(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 rL(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}}}),Iw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function oL(e){return e.matches(Iw)?e:e.querySelector(Iw)}const aL={display:"none"};function iL(e){let{id:t,value:n}=e;return Dt.createElement("div",{id:t,style:aL},n)}function lL(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Dt.createElement("div",{id:t,style:o,role:"status","aria-live":s,"aria-atomic":!0},n)}function cL(){const[e,t]=p.useState("");return{announce:p.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const u1=p.createContext(null);function uL(e){const t=p.useContext(u1);p.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function dL(){const[e]=p.useState(()=>new Set),t=p.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[p.useCallback(s=>{let{type:o,event:i}=s;e.forEach(c=>{var u;return(u=c[o])==null?void 0:u.call(c,i)})},[e]),t]}const fL={draggable:`
|
|
541
|
+
To pick up a draggable item, press the space bar.
|
|
542
|
+
While dragging, use the arrow keys to move the item.
|
|
543
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
544
|
+
`},pL={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 mL(e){let{announcements:t=pL,container:n,hiddenTextDescribedById:s,screenReaderInstructions:o=fL}=e;const{announce:i,announcement:c}=cL(),u=Tc("DndLiveRegion"),[f,m]=p.useState(!1);if(p.useEffect(()=>{m(!0)},[]),uL(p.useMemo(()=>({onDragStart(g){let{active:y}=g;i(t.onDragStart({active:y}))},onDragMove(g){let{active:y,over:b}=g;t.onDragMove&&i(t.onDragMove({active:y,over:b}))},onDragOver(g){let{active:y,over:b}=g;i(t.onDragOver({active:y,over:b}))},onDragEnd(g){let{active:y,over:b}=g;i(t.onDragEnd({active:y,over:b}))},onDragCancel(g){let{active:y,over:b}=g;i(t.onDragCancel({active:y,over:b}))}}),[i,t])),!f)return null;const h=Dt.createElement(Dt.Fragment,null,Dt.createElement(iL,{id:s,value:o.draggable}),Dt.createElement(lL,{id:u,announcement:c}));return n?Ms.createPortal(h,n):h}var Nn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Nn||(Nn={}));function Hd(){}function wo(e,t){return p.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Pf(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.useMemo(()=>[...t].filter(s=>s!=null),[...t])}const ss=Object.freeze({x:0,y:0});function d1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function hL(e,t){const n=Vd(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 f1(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function gL(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function _w(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 p1(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function Mw(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 Af=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=Mw(t,t.left,t.top),i=[];for(const c of s){const{id:u}=c,f=n.get(u);if(f){const m=d1(Mw(f),o);i.push({id:u,data:{droppableContainer:c,value:m}})}}return i.sort(f1)},xL=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const o=_w(t),i=[];for(const c of s){const{id:u}=c,f=n.get(u);if(f){const m=_w(f),h=o.reduce((y,b,C)=>y+d1(m[C],b),0),g=Number((h/4).toFixed(4));i.push({id:u,data:{droppableContainer:c,value:g}})}}return i.sort(f1)};function yL(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 f=t.width*t.height,m=e.width*e.height,h=c*u,g=h/(f+m-h);return Number(g.toFixed(4))}return 0}const bL=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 f=yL(u,t);f>0&&o.push({id:c,data:{droppableContainer:i,value:f}})}}return o.sort(gL)};function vL(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function m1(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ss}function wL(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 jL=wL(1);function h1(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 kL(e,t,n){const s=h1(t);if(!s)return e;const{scaleX:o,scaleY:i,x:c,y:u}=s,f=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:f+h,bottom:m+g,left:f}}const SL={ignoreTransform:!1};function Fi(e,t){t===void 0&&(t=SL);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:h}=Zn(e).getComputedStyle(e);m&&(n=kL(n,m,h))}const{top:s,left:o,width:i,height:c,bottom:u,right:f}=n;return{top:s,left:o,width:i,height:c,bottom:u,right:f}}function Fw(e){return Fi(e,{ignoreTransform:!0})}function NL(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function CL(e,t){return t===void 0&&(t=Zn(e).getComputedStyle(e)),t.position==="fixed"}function EL(e,t){t===void 0&&(t=Zn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function Df(e,t){const n=[];function s(o){if(t!=null&&n.length>=t||!o)return n;if(Tx(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Cc(o)||l1(o)||n.includes(o))return n;const i=Zn(e).getComputedStyle(o);return o!==e&&EL(o,i)&&n.push(o),CL(o,i)?n:s(o.parentNode)}return e?s(e):n}function g1(e){const[t]=Df(e,1);return t??null}function mh(e){return!Ef||!e?null:_i(e)?e:Ex(e)?Tx(e)||e===Mi(e).scrollingElement?window:Cc(e)?e:null:null}function x1(e){return _i(e)?e.scrollX:e.scrollLeft}function y1(e){return _i(e)?e.scrollY:e.scrollTop}function dg(e){return{x:x1(e),y:y1(e)}}var Dn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Dn||(Dn={}));function b1(e){return!Ef||!e?!1:e===document.scrollingElement}function v1(e){const t={x:0,y:0},n=b1(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 TL={x:.2,y:.2};function RL(e,t,n,s,o){let{top:i,left:c,right:u,bottom:f}=n;s===void 0&&(s=10),o===void 0&&(o=TL);const{isTop:m,isBottom:h,isLeft:g,isRight:y}=v1(e),b={x:0,y:0},C={x:0,y:0},j={height:t.height*o.y,width:t.width*o.x};return!m&&i<=t.top+j.height?(b.y=Dn.Backward,C.y=s*Math.abs((t.top+j.height-i)/j.height)):!h&&f>=t.bottom-j.height&&(b.y=Dn.Forward,C.y=s*Math.abs((t.bottom-j.height-f)/j.height)),!y&&u>=t.right-j.width?(b.x=Dn.Forward,C.x=s*Math.abs((t.right-j.width-u)/j.width)):!g&&c<=t.left+j.width&&(b.x=Dn.Backward,C.x=s*Math.abs((t.left+j.width-c)/j.width)),{direction:b,speed:C}}function PL(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 w1(e){return e.reduce((t,n)=>bi(t,dg(n)),ss)}function AL(e){return e.reduce((t,n)=>t+x1(n),0)}function DL(e){return e.reduce((t,n)=>t+y1(n),0)}function j1(e,t){if(t===void 0&&(t=Fi),!e)return;const{top:n,left:s,bottom:o,right:i}=t(e);g1(e)&&(o<=0||i<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const $L=[["x",["left","right"],AL],["y",["top","bottom"],DL]];class Rx{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Df(n),o=w1(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,c,u]of $L)for(const f of c)Object.defineProperty(this,f,{get:()=>{const m=u(s),h=o[i]-m;return this.rect[f]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ql{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 LL(e){const{EventTarget:t}=Zn(e);return e instanceof t?e:Mi(e)}function hh(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var _r;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(_r||(_r={}));function zw(e){e.preventDefault()}function OL(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 k1={start:[wt.Space,wt.Enter],cancel:[wt.Esc],end:[wt.Space,wt.Enter,wt.Tab]},IL=(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 zi{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 ql(Mi(n)),this.windowListeners=new ql(Zn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(_r.Resize,this.handleCancel),this.windowListeners.add(_r.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(_r.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&j1(s),n(ss)}handleKeyDown(t){if(Rf(t)){const{active:n,context:s,options:o}=this.props,{keyboardCodes:i=k1,coordinateGetter:c=IL,scrollBehavior:u="smooth"}=o,{code:f}=t;if(i.end.includes(f)){this.handleEnd(t);return}if(i.cancel.includes(f)){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=dc(g,h),b={x:0,y:0},{scrollableAncestors:C}=s.current;for(const j of C){const v=t.code,{isTop:k,isRight:E,isLeft:S,isBottom:T,maxScroll:A,minScroll:R}=v1(j),P=PL(j),$={x:Math.min(v===wt.Right?P.right-P.width/2:P.right,Math.max(v===wt.Right?P.left:P.left+P.width/2,g.x)),y:Math.min(v===wt.Down?P.bottom-P.height/2:P.bottom,Math.max(v===wt.Down?P.top:P.top+P.height/2,g.y))},I=v===wt.Right&&!E||v===wt.Left&&!S,M=v===wt.Down&&!T||v===wt.Up&&!k;if(I&&$.x!==g.x){const D=j.scrollLeft+y.x,H=v===wt.Right&&D<=A.x||v===wt.Left&&D>=R.x;if(H&&!y.y){j.scrollTo({left:D,behavior:u});return}H?b.x=j.scrollLeft-D:b.x=v===wt.Right?j.scrollLeft-A.x:j.scrollLeft-R.x,b.x&&j.scrollBy({left:-b.x,behavior:u});break}else if(M&&$.y!==g.y){const D=j.scrollTop+y.y,H=v===wt.Down&&D<=A.y||v===wt.Up&&D>=R.y;if(H&&!y.x){j.scrollTo({top:D,behavior:u});return}H?b.y=j.scrollTop-D:b.y=v===wt.Down?j.scrollTop-A.y:j.scrollTop-R.y,b.y&&j.scrollBy({top:-b.y,behavior:u});break}}this.handleMove(t,bi(dc(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()}}zi.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=k1,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 Bw(e){return!!(e&&"distance"in e)}function Uw(e){return!!(e&&"delay"in e)}class Px{constructor(t,n,s){var o;s===void 0&&(s=LL(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=Mi(c),this.documentListeners=new ql(this.document),this.listeners=new ql(s),this.windowListeners=new ql(Zn(c)),this.initialCoordinates=(o=Vd(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(_r.Resize,this.handleCancel),this.windowListeners.add(_r.DragStart,zw),this.windowListeners.add(_r.VisibilityChange,this.handleCancel),this.windowListeners.add(_r.ContextMenu,zw),this.documentListeners.add(_r.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Uw(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Bw(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:o}=this.props;o(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(_r.Click,OL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(_r.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:o,props:i}=this,{onMove:c,options:{activationConstraint:u}}=i;if(!o)return;const f=(n=Vd(t))!=null?n:ss,m=dc(o,f);if(!s&&u){if(Bw(u)){if(u.tolerance!=null&&hh(m,u.tolerance))return this.handleCancel();if(hh(m,u.distance))return this.handleStart()}if(Uw(u)&&hh(m,u.tolerance))return this.handleCancel();this.handlePending(u,m);return}t.cancelable&&t.preventDefault(),c(f)}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 _L={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Bi extends Px{constructor(t){const{event:n}=t,s=Mi(n.target);super(t,_L,s)}}Bi.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 ML={move:{name:"mousemove"},end:{name:"mouseup"}};var fg;(function(e){e[e.RightClick=2]="RightClick"})(fg||(fg={}));class FL extends Px{constructor(t){super(t,ML,Mi(t.event.target))}}FL.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===fg.RightClick?!1:(s==null||s({event:n}),!0)}}];const gh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class zL extends Px{constructor(t){super(t,gh)}static setup(){return window.addEventListener(gh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(gh.move.name,t)};function t(){}}}zL.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 Gl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Gl||(Gl={}));var Wd;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Wd||(Wd={}));function BL(e){let{acceleration:t,activator:n=Gl.Pointer,canScroll:s,draggingRect:o,enabled:i,interval:c=5,order:u=Wd.TreeOrder,pointerCoordinates:f,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:y}=e;const b=VL({delta:g,disabled:!i}),[C,j]=nL(),v=p.useRef({x:0,y:0}),k=p.useRef({x:0,y:0}),E=p.useMemo(()=>{switch(n){case Gl.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Gl.DraggableRect:return o}},[n,o,f]),S=p.useRef(null),T=p.useCallback(()=>{const R=S.current;if(!R)return;const P=v.current.x*k.current.x,$=v.current.y*k.current.y;R.scrollBy(P,$)},[]),A=p.useMemo(()=>u===Wd.TreeOrder?[...m].reverse():m,[u,m]);p.useEffect(()=>{if(!i||!m.length||!E){j();return}for(const R of A){if((s==null?void 0:s(R))===!1)continue;const P=m.indexOf(R),$=h[P];if(!$)continue;const{direction:I,speed:M}=RL(R,$,E,t,y);for(const D of["x","y"])b[D][I[D]]||(M[D]=0,I[D]=0);if(M.x>0||M.y>0){j(),S.current=R,C(T,c),v.current=M,k.current=I;return}}v.current={x:0,y:0},k.current={x:0,y:0},j()},[t,T,s,j,i,c,JSON.stringify(E),JSON.stringify(b),C,m,A,h,JSON.stringify(y)])}const UL={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function VL(e){let{delta:t,disabled:n}=e;const s=Ud(t);return Ec(o=>{if(n||!s||!o)return UL;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 HL(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return Ec(o=>{var i;return t==null?null:(i=s??o)!=null?i:null},[s,t])}function WL(e,t){return p.useMemo(()=>e.reduce((n,s)=>{const{sensor:o}=s,i=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,s)}));return[...n,...i]},[]),[e,t])}var fc;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(fc||(fc={}));var pg;(function(e){e.Optimized="optimized"})(pg||(pg={}));const Vw=new Map;function KL(e,t){let{dragging:n,dependencies:s,config:o}=t;const[i,c]=p.useState(null),{frequency:u,measure:f,strategy:m}=o,h=p.useRef(e),g=v(),y=uc(g),b=p.useCallback(function(k){k===void 0&&(k=[]),!y.current&&c(E=>E===null?k:E.concat(k.filter(S=>!E.includes(S))))},[y]),C=p.useRef(null),j=Ec(k=>{if(g&&!n)return Vw;if(!k||k===Vw||h.current!==e||i!=null){const E=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){E.set(S.id,S.rect.current);continue}const T=S.node.current,A=T?new Rx(f(T),T):null;S.rect.current=A,A&&E.set(S.id,A)}return E}return k},[e,i,n,g,f]);return p.useEffect(()=>{h.current=e},[e]),p.useEffect(()=>{g||b()},[n,g]),p.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),p.useEffect(()=>{g||typeof u!="number"||C.current!==null||(C.current=setTimeout(()=>{b(),C.current=null},u))},[u,g,b,...s]),{droppableRects:j,measureDroppableContainers:b,measuringScheduled:i!=null};function v(){switch(m){case fc.Always:return!1;case fc.BeforeDragging:return n;default:return!n}}}function Ax(e,t){return Ec(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function qL(e,t){return Ax(e,t)}function GL(e){let{callback:t,disabled:n}=e;const s=Tf(t),o=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(s)},[s,n]);return p.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function $f(e){let{callback:t,disabled:n}=e;const s=Tf(t),o=p.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(s)},[n]);return p.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function YL(e){return new Rx(Fi(e),e)}function Hw(e,t,n){t===void 0&&(t=YL);const[s,o]=p.useState(null);function i(){o(f=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=f??n)!=null?m:null}const h=t(e);return JSON.stringify(f)===JSON.stringify(h)?f:h})}const c=GL({callback(f){if(e)for(const m of f){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){i();break}}}}),u=$f({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 JL(e){const t=Ax(e);return m1(e,t)}const Ww=[];function QL(e){const t=p.useRef(e),n=Ec(s=>e?s&&s!==Ww&&e&&t.current&&e.parentNode===t.current.parentNode?s:Df(e):Ww,[e]);return p.useEffect(()=>{t.current=e},[e]),n}function XL(e){const[t,n]=p.useState(null),s=p.useRef(e),o=p.useCallback(i=>{const c=mh(i.target);c&&n(u=>u?(u.set(c,dg(c)),new Map(u)):null)},[]);return p.useEffect(()=>{const i=s.current;if(e!==i){c(i);const u=e.map(f=>{const m=mh(f);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,dg(m)]):null}).filter(f=>f!=null);n(u.length?new Map(u):null),s.current=e}return()=>{c(e),c(i)};function c(u){u.forEach(f=>{const m=mh(f);m==null||m.removeEventListener("scroll",o)})}},[o,e]),p.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,c)=>bi(i,c),ss):w1(e):ss,[e,t])}function Kw(e,t){t===void 0&&(t=[]);const n=p.useRef(null);return p.useEffect(()=>{n.current=null},t),p.useEffect(()=>{const s=e!==ss;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?dc(e,n.current):ss}function ZL(e){p.useEffect(()=>{if(!Ef)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 e4(e,t){return p.useMemo(()=>e.reduce((n,s)=>{let{eventName:o,handler:i}=s;return n[o]=c=>{i(c,t)},n},{}),[e,t])}function S1(e){return p.useMemo(()=>e?NL(e):null,[e])}const qw=[];function t4(e,t){t===void 0&&(t=Fi);const[n]=e,s=S1(n?Zn(n):null),[o,i]=p.useState(qw);function c(){i(()=>e.length?e.map(f=>b1(f)?s:new Rx(t(f),f)):qw)}const u=$f({callback:c});return ns(()=>{u==null||u.disconnect(),c(),e.forEach(f=>u==null?void 0:u.observe(f))},[e]),o}function N1(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Cc(t)?t:e}function n4(e){let{measure:t}=e;const[n,s]=p.useState(null),o=p.useCallback(m=>{for(const{target:h}of m)if(Cc(h)){s(g=>{const y=t(h);return g?{...g,width:y.width,height:y.height}:y});break}},[t]),i=$f({callback:o}),c=p.useCallback(m=>{const h=N1(m);i==null||i.disconnect(),h&&(i==null||i.observe(h)),s(h?t(h):null)},[t,i]),[u,f]=Bd(c);return p.useMemo(()=>({nodeRef:u,rect:n,setRef:f}),[n,u,f])}const r4=[{sensor:Bi,options:{}},{sensor:zi,options:{}}],s4={current:{}},jd={draggable:{measure:Fw},droppable:{measure:Fw,strategy:fc.WhileDragging,frequency:pg.Optimized},dragOverlay:{measure:Fi}};class Yl 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 o4={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Yl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:jd,measureDroppableContainers:Hd,windowRect:null,measuringScheduled:!1},C1={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Hd,draggableNodes:new Map,over:null,measureDroppableContainers:Hd},Rc=p.createContext(C1),E1=p.createContext(o4);function a4(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Yl}}}function i4(e,t){switch(t.type){case Nn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Nn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Nn.DragEnd:case Nn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Nn.RegisterDroppable:{const{element:n}=t,{id:s}=n,o=new Yl(e.droppable.containers);return o.set(s,n),{...e,droppable:{...e.droppable,containers:o}}}case Nn.SetDroppableDisabled:{const{id:n,key:s,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||s!==i.key)return e;const c=new Yl(e.droppable.containers);return c.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:c}}}case Nn.UnregisterDroppable:{const{id:n,key:s}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new Yl(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function l4(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:o}=p.useContext(Rc),i=Ud(s),c=Ud(n==null?void 0:n.id);return p.useEffect(()=>{if(!t&&!s&&i&&c!=null){if(!Rf(i)||document.activeElement===i.target)return;const u=o.get(c);if(!u)return;const{activatorNode:f,node:m}=u;if(!f.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[f.current,m.current]){if(!h)continue;const g=oL(h);if(g){g.focus();break}}})}},[s,t,o,c,i]),null}function T1(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...s}),n):n}function c4(e){return p.useMemo(()=>({draggable:{...jd.draggable,...e==null?void 0:e.draggable},droppable:{...jd.droppable,...e==null?void 0:e.droppable},dragOverlay:{...jd.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 u4(e){let{activeNode:t,measure:n,initialRect:s,config:o=!0}=e;const i=p.useRef(!1),{x:c,y:u}=typeof o=="boolean"?{x:o,y:o}:o;ns(()=>{if(!c&&!u||!t){i.current=!1;return}if(i.current||!s)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const h=n(m),g=m1(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=g1(m);y&&y.scrollBy({top:g.y,left:g.x})}},[t,c,u,s,n])}const Lf=p.createContext({...ss,scaleX:1,scaleY:1});var xo;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(xo||(xo={}));const Of=p.memo(function(t){var n,s,o,i;let{id:c,accessibility:u,autoScroll:f=!0,children:m,sensors:h=r4,collisionDetection:g=bL,measuring:y,modifiers:b,...C}=t;const j=p.useReducer(i4,void 0,a4),[v,k]=j,[E,S]=dL(),[T,A]=p.useState(xo.Uninitialized),R=T===xo.Initialized,{draggable:{active:P,nodes:$,translate:I},droppable:{containers:M}}=v,D=P!=null?$.get(P):null,H=p.useRef({initial:null,translated:null}),K=p.useMemo(()=>{var te;return P!=null?{id:P,data:(te=D==null?void 0:D.data)!=null?te:s4,rect:H}:null},[P,D]),_=p.useRef(null),[U,q]=p.useState(null),[Z,F]=p.useState(null),G=uc(C,Object.values(C)),L=Tc("DndDescribedBy",c),V=p.useMemo(()=>M.getEnabled(),[M]),re=c4(y),{droppableRects:B,measureDroppableContainers:ue,measuringScheduled:ge}=KL(V,{dragging:R,dependencies:[I.x,I.y],config:re.droppable}),se=HL($,P),ye=p.useMemo(()=>Z?Vd(Z):null,[Z]),Se=pe(),Ee=qL(se,re.draggable.measure);u4({activeNode:P!=null?$.get(P):null,config:Se.layoutShiftCompensation,initialRect:Ee,measure:re.draggable.measure});const Ae=Hw(se,re.draggable.measure,Ee),Ke=Hw(se?se.parentElement:null),ct=p.useRef({activatorEvent:null,active:null,activeNode:se,collisionRect:null,collisions:null,droppableRects:B,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),et=M.getNodeFor((n=ct.current.over)==null?void 0:n.id),ot=n4({measure:re.dragOverlay.measure}),X=(s=ot.nodeRef.current)!=null?s:se,Me=R?(o=ot.rect)!=null?o:Ae:null,Ce=!!(ot.nodeRef.current&&ot.rect),Ie=JL(Ce?null:Ae),Ye=S1(X?Zn(X):null),Fe=QL(R?et??se:null),Ze=t4(Fe),Qe=T1(b,{transform:{x:I.x-Ie.x,y:I.y-Ie.y,scaleX:1,scaleY:1},activatorEvent:Z,active:K,activeNodeRect:Ae,containerNodeRect:Ke,draggingNodeRect:Me,over:ct.current.over,overlayNodeRect:ot.rect,scrollableAncestors:Fe,scrollableAncestorRects:Ze,windowRect:Ye}),Ot=ye?bi(ye,I):null,yt=XL(Fe),dt=Kw(yt),le=Kw(yt,[Ae]),Y=bi(Qe,dt),fe=Me?jL(Me,Qe):null,ne=K&&fe?g({active:K,collisionRect:fe,droppableRects:B,droppableContainers:V,pointerCoordinates:Ot}):null,he=p1(ne,"id"),[De,ut]=p.useState(null),ae=Ce?Qe:bi(Qe,le),be=vL(ae,(i=De==null?void 0:De.rect)!=null?i:null,Ae),$e=p.useRef(null),at=p.useCallback((te,xe)=>{let{sensor:Le,options:tt}=xe;if(_.current==null)return;const ve=$.get(_.current);if(!ve)return;const Nt=te.nativeEvent,It=new Le({active:_.current,activeNode:ve,event:Nt,options:tt,context:ct,onAbort(jt){if(!$.get(jt))return;const{onDragAbort:Rt}=G.current,oe={id:jt};Rt==null||Rt(oe),E({type:"onDragAbort",event:oe})},onPending(jt,wn,Rt,oe){if(!$.get(jt))return;const{onDragPending:nt}=G.current,bt={id:jt,constraint:wn,initialCoordinates:Rt,offset:oe};nt==null||nt(bt),E({type:"onDragPending",event:bt})},onStart(jt){const wn=_.current;if(wn==null)return;const Rt=$.get(wn);if(!Rt)return;const{onDragStart:oe}=G.current,Ue={activatorEvent:Nt,active:{id:wn,data:Rt.data,rect:H}};Ms.unstable_batchedUpdates(()=>{oe==null||oe(Ue),A(xo.Initializing),k({type:Nn.DragStart,initialCoordinates:jt,active:wn}),E({type:"onDragStart",event:Ue}),q($e.current),F(Nt)})},onMove(jt){k({type:Nn.DragMove,coordinates:jt})},onEnd:Zt(Nn.DragEnd),onCancel:Zt(Nn.DragCancel)});$e.current=It;function Zt(jt){return async function(){const{active:Rt,collisions:oe,over:Ue,scrollAdjustedTranslate:nt}=ct.current;let bt=null;if(Rt&&nt){const{cancelDrop:er}=G.current;bt={activatorEvent:Nt,active:Rt,collisions:oe,delta:nt,over:Ue},jt===Nn.DragEnd&&typeof er=="function"&&await Promise.resolve(er(bt))&&(jt=Nn.DragCancel)}_.current=null,Ms.unstable_batchedUpdates(()=>{k({type:jt}),A(xo.Uninitialized),ut(null),q(null),F(null),$e.current=null;const er=jt===Nn.DragEnd?"onDragEnd":"onDragCancel";if(bt){const qr=G.current[er];qr==null||qr(bt),E({type:er,event:bt})}})}}},[$]),Be=p.useCallback((te,xe)=>(Le,tt)=>{const ve=Le.nativeEvent,Nt=$.get(tt);if(_.current!==null||!Nt||ve.dndKit||ve.defaultPrevented)return;const It={active:Nt};te(Le,xe.options,It)===!0&&(ve.dndKit={capturedBy:xe.sensor},_.current=tt,at(Le,xe))},[$,at]),kt=WL(h,Be);ZL(h),ns(()=>{Ae&&T===xo.Initializing&&A(xo.Initialized)},[Ae,T]),p.useEffect(()=>{const{onDragMove:te}=G.current,{active:xe,activatorEvent:Le,collisions:tt,over:ve}=ct.current;if(!xe||!Le)return;const Nt={active:xe,activatorEvent:Le,collisions:tt,delta:{x:Y.x,y:Y.y},over:ve};Ms.unstable_batchedUpdates(()=>{te==null||te(Nt),E({type:"onDragMove",event:Nt})})},[Y.x,Y.y]),p.useEffect(()=>{const{active:te,activatorEvent:xe,collisions:Le,droppableContainers:tt,scrollAdjustedTranslate:ve}=ct.current;if(!te||_.current==null||!xe||!ve)return;const{onDragOver:Nt}=G.current,It=tt.get(he),Zt=It&&It.rect.current?{id:It.id,rect:It.rect.current,data:It.data,disabled:It.disabled}:null,jt={active:te,activatorEvent:xe,collisions:Le,delta:{x:ve.x,y:ve.y},over:Zt};Ms.unstable_batchedUpdates(()=>{ut(Zt),Nt==null||Nt(jt),E({type:"onDragOver",event:jt})})},[he]),ns(()=>{ct.current={activatorEvent:Z,active:K,activeNode:se,collisionRect:fe,collisions:ne,droppableRects:B,draggableNodes:$,draggingNode:X,draggingNodeRect:Me,droppableContainers:M,over:De,scrollableAncestors:Fe,scrollAdjustedTranslate:Y},H.current={initial:Me,translated:fe}},[K,se,ne,fe,$,X,Me,B,M,De,Fe,Y]),BL({...Se,delta:I,draggingRect:fe,pointerCoordinates:Ot,scrollableAncestors:Fe,scrollableAncestorRects:Ze});const St=p.useMemo(()=>({active:K,activeNode:se,activeNodeRect:Ae,activatorEvent:Z,collisions:ne,containerNodeRect:Ke,dragOverlay:ot,draggableNodes:$,droppableContainers:M,droppableRects:B,over:De,measureDroppableContainers:ue,scrollableAncestors:Fe,scrollableAncestorRects:Ze,measuringConfiguration:re,measuringScheduled:ge,windowRect:Ye}),[K,se,Ae,Z,ne,Ke,ot,$,M,B,De,ue,Fe,Ze,re,ge,Ye]),_t=p.useMemo(()=>({activatorEvent:Z,activators:kt,active:K,activeNodeRect:Ae,ariaDescribedById:{draggable:L},dispatch:k,draggableNodes:$,over:De,measureDroppableContainers:ue}),[Z,kt,K,Ae,k,L,$,De,ue]);return Dt.createElement(u1.Provider,{value:S},Dt.createElement(Rc.Provider,{value:_t},Dt.createElement(E1.Provider,{value:St},Dt.createElement(Lf.Provider,{value:be},m)),Dt.createElement(l4,{disabled:(u==null?void 0:u.restoreFocus)===!1})),Dt.createElement(mL,{...u,hiddenTextDescribedById:L}));function pe(){const te=(U==null?void 0:U.autoScrollEnabled)===!1,xe=typeof f=="object"?f.enabled===!1:f===!1,Le=R&&!te&&!xe;return typeof f=="object"?{...f,enabled:Le}:{enabled:Le}}}),d4=p.createContext(null),Gw="button",f4="Draggable";function p4(e){let{id:t,data:n,disabled:s=!1,attributes:o}=e;const i=Tc(f4),{activators:c,activatorEvent:u,active:f,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:y}=p.useContext(Rc),{role:b=Gw,roleDescription:C="draggable",tabIndex:j=0}=o??{},v=(f==null?void 0:f.id)===t,k=p.useContext(v?Lf:d4),[E,S]=Bd(),[T,A]=Bd(),R=e4(c,t),P=uc(n);ns(()=>(g.set(t,{id:t,key:i,node:E,activatorNode:T,data:P}),()=>{const I=g.get(t);I&&I.key===i&&g.delete(t)}),[g,t]);const $=p.useMemo(()=>({role:b,tabIndex:j,"aria-disabled":s,"aria-pressed":v&&b===Gw?!0:void 0,"aria-roledescription":C,"aria-describedby":h.draggable}),[s,b,j,v,C,h.draggable]);return{active:f,activatorEvent:u,activeNodeRect:m,attributes:$,isDragging:v,listeners:s?void 0:R,node:E,over:y,setNodeRef:S,setActivatorNodeRef:A,transform:k}}function R1(){return p.useContext(E1)}const m4="Droppable",h4={timeout:25};function g4(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:o}=e;const i=Tc(m4),{active:c,dispatch:u,over:f,measureDroppableContainers:m}=p.useContext(Rc),h=p.useRef({disabled:n}),g=p.useRef(!1),y=p.useRef(null),b=p.useRef(null),{disabled:C,updateMeasurementsFor:j,timeout:v}={...h4,...o},k=uc(j??s),E=p.useCallback(()=>{if(!g.current){g.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(k.current)?k.current:[k.current]),b.current=null},v)},[v]),S=$f({callback:E,disabled:C||!c}),T=p.useCallback(($,I)=>{S&&(I&&(S.unobserve(I),g.current=!1),$&&S.observe($))},[S]),[A,R]=Bd(T),P=uc(t);return p.useEffect(()=>{!S||!A.current||(S.disconnect(),g.current=!1,S.observe(A.current))},[A,S]),p.useEffect(()=>(u({type:Nn.RegisterDroppable,element:{id:s,key:i,disabled:n,node:A,rect:y,data:P}}),()=>u({type:Nn.UnregisterDroppable,key:i,id:s})),[s]),p.useEffect(()=>{n!==h.current.disabled&&(u({type:Nn.SetDroppableDisabled,id:s,key:i,disabled:n}),h.current.disabled=n)},[s,i,n,u]),{active:c,rect:y,isOver:(f==null?void 0:f.id)===s,node:A,over:f,setNodeRef:R}}function x4(e){let{animation:t,children:n}=e;const[s,o]=p.useState(null),[i,c]=p.useState(null),u=Ud(n);return!n&&!s&&u&&o(u),ns(()=>{if(!i)return;const f=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(f==null||m==null){o(null);return}Promise.resolve(t(m,i)).then(()=>{o(null)})},[t,s,i]),Dt.createElement(Dt.Fragment,null,n,s?p.cloneElement(s,{ref:c}):null)}const y4={x:0,y:0,scaleX:1,scaleY:1};function b4(e){let{children:t}=e;return Dt.createElement(Rc.Provider,{value:C1},Dt.createElement(Lf.Provider,{value:y4},t))}const v4={position:"fixed",touchAction:"none"},w4=e=>Rf(e)?"transform 250ms ease":void 0,j4=p.forwardRef((e,t)=>{let{as:n,activatorEvent:s,adjustScale:o,children:i,className:c,rect:u,style:f,transform:m,transition:h=w4}=e;if(!u)return null;const g=o?m:{...m,scaleX:1,scaleY:1},y={...v4,width:u.width,height:u.height,top:u.top,left:u.left,transform:rs.Transform.toString(g),transformOrigin:o&&s?hL(s,u):void 0,transition:typeof h=="function"?h(s):h,...f};return Dt.createElement(n,{className:c,style:y,ref:t},i)}),k4=e=>t=>{let{active:n,dragOverlay:s}=t;const o={},{styles:i,className:c}=e;if(i!=null&&i.active)for(const[u,f]of Object.entries(i.active))f!==void 0&&(o[u]=n.node.style.getPropertyValue(u),n.node.style.setProperty(u,f));if(i!=null&&i.dragOverlay)for(const[u,f]of Object.entries(i.dragOverlay))f!==void 0&&s.node.style.setProperty(u,f);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[f,m]of Object.entries(o))n.node.style.setProperty(f,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},S4=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:rs.Transform.toString(t)},{transform:rs.Transform.toString(n)}]},N4={duration:250,easing:"ease",keyframes:S4,sideEffects:k4({styles:{active:{opacity:"0"}}})};function C4(e){let{config:t,draggableNodes:n,droppableContainers:s,measuringConfiguration:o}=e;return Tf((i,c)=>{if(t===null)return;const u=n.get(i);if(!u)return;const f=u.node.current;if(!f)return;const m=N1(c);if(!m)return;const{transform:h}=Zn(c).getComputedStyle(c),g=h1(h);if(!g)return;const y=typeof t=="function"?t:E4(t);return j1(f,o.draggable.measure),y({active:{id:i,data:u.data,node:f,rect:o.draggable.measure(f)},draggableNodes:n,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:o,transform:g})})}function E4(e){const{duration:t,easing:n,sideEffects:s,keyframes:o}={...N4,...e};return i=>{let{active:c,dragOverlay:u,transform:f,...m}=i;if(!t)return;const h={x:u.rect.left-c.rect.left,y:u.rect.top-c.rect.top},g={scaleX:f.scaleX!==1?c.rect.width*f.scaleX/u.rect.width:1,scaleY:f.scaleY!==1?c.rect.height*f.scaleY/u.rect.height:1},y={x:f.x-h.x,y:f.y-h.y,...g},b=o({...m,active:c,dragOverlay:u,transform:{initial:f,final:y}}),[C]=b,j=b[b.length-1];if(JSON.stringify(C)===JSON.stringify(j))return;const v=s==null?void 0:s({active:c,dragOverlay:u,...m}),k=u.node.animate(b,{duration:t,easing:n,fill:"forwards"});return new Promise(E=>{k.onfinish=()=>{v==null||v(),E()}})}}let Yw=0;function T4(e){return p.useMemo(()=>{if(e!=null)return Yw++,Yw},[e])}const R4=Dt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:s,style:o,transition:i,modifiers:c,wrapperElement:u="div",className:f,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggableNodes:C,droppableContainers:j,dragOverlay:v,over:k,measuringConfiguration:E,scrollableAncestors:S,scrollableAncestorRects:T,windowRect:A}=R1(),R=p.useContext(Lf),P=T4(g==null?void 0:g.id),$=T1(c,{activatorEvent:h,active:g,activeNodeRect:y,containerNodeRect:b,draggingNodeRect:v.rect,over:k,overlayNodeRect:v.rect,scrollableAncestors:S,scrollableAncestorRects:T,transform:R,windowRect:A}),I=Ax(y),M=C4({config:s,draggableNodes:C,droppableContainers:j,measuringConfiguration:E}),D=I?v.setRef:void 0;return Dt.createElement(b4,null,Dt.createElement(x4,{animation:M},g&&P?Dt.createElement(j4,{key:P,id:g.id,ref:D,as:u,activatorEvent:h,adjustScale:t,className:f,transition:i,rect:I,style:{zIndex:m,...o},transform:$},n):null))});function Ui(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function P4(e,t){return e.reduce((n,s,o)=>{const i=t.get(s);return i&&(n[o]=i),n},Array(e.length))}function nd(e){return e!==null&&e>=0}function A4(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 D4(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const Dx=e=>{let{rects:t,activeIndex:n,overIndex:s,index:o}=e;const i=Ui(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}},rd={scaleX:1,scaleY:1},$x=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,...rd}:null}const f=$4(i,o,n);return o>n&&o<=c?{x:0,y:-u.height-f,...rd}:o<n&&o>=c?{x:0,y:u.height+f,...rd}:{x:0,y:0,...rd}};function $4(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 P1="Sortable",A1=Dt.createContext({activeIndex:-1,containerId:P1,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dx,disabled:{draggable:!1,droppable:!1}});function If(e){let{children:t,id:n,items:s,strategy:o=Dx,disabled:i=!1}=e;const{active:c,dragOverlay:u,droppableRects:f,over:m,measureDroppableContainers:h}=R1(),g=Tc(P1,n),y=u.rect!==null,b=p.useMemo(()=>s.map(R=>typeof R=="object"&&"id"in R?R.id:R),[s]),C=c!=null,j=c?b.indexOf(c.id):-1,v=m?b.indexOf(m.id):-1,k=p.useRef(b),E=!A4(b,k.current),S=v!==-1&&j===-1||E,T=D4(i);ns(()=>{E&&C&&h(b)},[E,b,C,h]),p.useEffect(()=>{k.current=b},[b]);const A=p.useMemo(()=>({activeIndex:j,containerId:g,disabled:T,disableTransforms:S,items:b,overIndex:v,useDragOverlay:y,sortedRects:P4(b,f),strategy:o}),[j,g,T.draggable,T.droppable,S,b,v,f,y,o]);return Dt.createElement(A1.Provider,{value:A},t)}const L4=e=>{let{id:t,items:n,activeIndex:s,overIndex:o}=e;return Ui(n,s,o).indexOf(t)},O4=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:o,items:i,newIndex:c,previousItems:u,previousContainerId:f,transition:m}=e;return!m||!s||u!==i&&o===c?!1:n?!0:c!==o&&t===f},I4={duration:200,easing:"ease"},D1="transform",_4=rs.Transition.toString({property:D1,duration:0,easing:"linear"}),M4={roleDescription:"sortable"};function F4(e){let{disabled:t,index:n,node:s,rect:o}=e;const[i,c]=p.useState(null),u=p.useRef(n);return ns(()=>{if(!t&&n!==u.current&&s.current){const f=o.current;if(f){const m=Fi(s.current,{ignoreTransform:!0}),h={x:f.left-m.left,y:f.top-m.top,scaleX:f.width/m.width,scaleY:f.height/m.height};(h.x||h.y)&&c(h)}}n!==u.current&&(u.current=n)},[t,n,s,o]),p.useEffect(()=>{i&&c(null)},[i]),i}function _f(e){let{animateLayoutChanges:t=O4,attributes:n,disabled:s,data:o,getNewIndex:i=L4,id:c,strategy:u,resizeObserverConfig:f,transition:m=I4}=e;const{items:h,containerId:g,activeIndex:y,disabled:b,disableTransforms:C,sortedRects:j,overIndex:v,useDragOverlay:k,strategy:E}=p.useContext(A1),S=z4(s,b),T=h.indexOf(c),A=p.useMemo(()=>({sortable:{containerId:g,index:T,items:h},...o}),[g,o,T,h]),R=p.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:P,node:$,isOver:I,setNodeRef:M}=g4({id:c,data:A,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...f}}),{active:D,activatorEvent:H,activeNodeRect:K,attributes:_,setNodeRef:U,listeners:q,isDragging:Z,over:F,setActivatorNodeRef:G,transform:L}=p4({id:c,data:A,attributes:{...M4,...n},disabled:S.draggable}),V=tL(M,U),re=!!D,B=re&&!C&&nd(y)&&nd(v),ue=!k&&Z,ge=ue&&B?L:null,ye=B?ge??(u??E)({rects:j,activeNodeRect:K,activeIndex:y,overIndex:v,index:T}):null,Se=nd(y)&&nd(v)?i({id:c,items:h,activeIndex:y,overIndex:v}):T,Ee=D==null?void 0:D.id,Ae=p.useRef({activeId:Ee,items:h,newIndex:Se,containerId:g}),Ke=h!==Ae.current.items,ct=t({active:D,containerId:g,isDragging:Z,isSorting:re,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}),et=F4({disabled:!ct,index:T,node:$,rect:P});return p.useEffect(()=>{re&&Ae.current.newIndex!==Se&&(Ae.current.newIndex=Se),g!==Ae.current.containerId&&(Ae.current.containerId=g),h!==Ae.current.items&&(Ae.current.items=h)},[re,Se,g,h]),p.useEffect(()=>{if(Ee===Ae.current.activeId)return;if(Ee!=null&&Ae.current.activeId==null){Ae.current.activeId=Ee;return}const X=setTimeout(()=>{Ae.current.activeId=Ee},50);return()=>clearTimeout(X)},[Ee]),{active:D,activeIndex:y,attributes:_,data:A,rect:P,index:T,newIndex:Se,items:h,isOver:I,isSorting:re,isDragging:Z,listeners:q,node:$,overIndex:v,over:F,setNodeRef:V,setActivatorNodeRef:G,setDroppableNodeRef:M,setDraggableNodeRef:U,transform:et??ye,transition:ot()};function ot(){if(et||Ke&&Ae.current.newIndex===T)return _4;if(!(ue&&!Rf(H)||!m)&&(re||ct))return rs.Transition.toString({...m,property:D1})}}function z4(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 Kd(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 B4=[wt.Down,wt.Right,wt.Up,wt.Left],$1=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:o,droppableContainers:i,over:c,scrollableAncestors:u}}=t;if(B4.includes(e.code)){if(e.preventDefault(),!n||!s)return;const f=[];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&&f.push(g);break;case wt.Up:s.top>y.top&&f.push(g);break;case wt.Left:s.left>y.left&&f.push(g);break;case wt.Right:s.left<y.left&&f.push(g);break}});const m=xL({collisionRect:s,droppableRects:o,droppableContainers:f});let h=p1(m,"id");if(h===(c==null?void 0:c.id)&&m.length>1&&(h=m[1].id),h!=null){const g=i.get(n.id),y=i.get(h),b=y?o.get(y.id):null,C=y==null?void 0:y.node.current;if(C&&b&&g&&y){const v=Df(C).some((R,P)=>u[P]!==R),k=L1(g,y),E=U4(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:dc(T,S)}}}};function L1(e,t){return!Kd(e)||!Kd(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function U4(e,t){return!Kd(e)||!Kd(t)||!L1(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function xt({label:e="Loading dashboard data…"}){return r.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:r.jsx("div",{className:"chrome-card !px-4 !py-3",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Tt({title:e="Something went wrong",error:t,action:n}){return r.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?r.jsx("div",{className:"pt-2",children:n}):null]})})}function kd({command:e,description:t,example:n}){return r.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[r.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?r.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?r.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function He({title:e,description:t,children:n,className:s,actions:o}){return r.jsxs("section",{className:we("surface-panel space-y-3",s),children:[e||o?r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?r.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function V4({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return r.jsx(He,{title:t?"Getting Started Refresher":"Getting Started",description:t?"A fast reminder of the real flow for creating and running work in Syntaur.":"A first-run checklist that maps to the current CLI and dashboard flow.",actions:r.jsx(Te,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:r.jsx("div",{className:"space-y-3",children:n.map((s,o)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:o+1}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:s.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:s.detail}),s.command?r.jsx(kd,{command:s.command.command,example:s.command.example}):null]})]})},s.title))})})}const xh={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."},oa={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 H4(e,t){return e.replace(/\{(\w+)\}/g,(n,s)=>String(t[s]??`{${s}}`))}function W4({hero:e,itemsById:t}){const n=fn();if(e.kind==="clean")return r.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[r.jsx("p",{className:"eyebrow",children:oa.emptyStateCleanTitle}),r.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:xh.clean}),r.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"When work shows up — a draft, a review, a stale row — it’ll surface here."}),r.jsx("div",{className:"mt-4",children:r.jsx(Te,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:oa.emptyStateCleanCTA})})]});const s=e.itemId?t[e.itemId]:void 0,o=(s==null?void 0:s.assignmentTitle)??"",i=xh[e.copyKey]??xh[e.kind],c=H4(i,{total:e.total,title:o}),u=s?K4(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(Te,{to:u,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function K4(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const Lx=["kanban","list","table"],O1=["title","status","priority","assignee","dependencies","created","updated"],q4=["asc","desc"],G4=["comfortable","compact"],Y4=["none","status","type","priority","assignee","project"],J4=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function ze(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const s of t){if(typeof s!="string")continue;const o=s.trim();!o||o==="all"||n.includes(o)||n.push(o)}return n}function Q4(e,t){const n=ze(e),s=ze(t);return n.length===s.length&&n.every(o=>s.includes(o))}const X4={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},pc={version:1,global:X4,projects:{}};function yh(e){return e==="table"?"table":"kanban"}function Z4(e,t){return t?{...e,...t}:{...e}}function I1(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:Z4(n.filters,s.filters)}:n}const eO=["low","medium","high","critical"],Mf={status:{kind:"enum"},priority:{kind:"ordinal",order:eO},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 tO(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 _1(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 mg(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 Jl(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 nO(e){return e==null||e===""}function Sd(e,t,n,s){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>nO(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),f=typeof u=="boolean"?u:u==="true"?!0:u==="false"||u===null||u===void 0||u===""?!1:null;return f!==null&&f===i}}case"number":{const o=n.num??Jl(n.raw);if(o===null)throw new kr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>Jl(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]=_1(n.raw);return c=>{const u=mg(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 rO(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??Jl(s.raw);if(i===null)throw new kr([{pos:s.pos,message:`"${s.raw}" is not a number (field "${t}")`}]);return c=>{const u=Jl(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 f=jr(e,t,u),m=typeof f=="string"?i.findIndex(h=>h.toLowerCase()===f.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,f)=>{const m=mg(jr(e,t,u));return m!==null&&o(m,f.now+c)}}if(s.type==="date"){const[i,c]=_1(s.raw);return u=>{const f=mg(jr(e,t,u));if(f===null)return!1;switch(n){case"<":return f<i;case"<=":return f<c;case">":return f>=c;case">=":return f>=i;case"=":return f>=i&&f<c;case"!=":return f<i||f>=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=Jl(jr(e,t,c));return u!==null&&o(u,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Sd(e,t,s,s.pos);if(n==="!="){const i=Sd(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=Sd(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 sO(e,t){const n=tO(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=>Sd(n,e.field,o,e.pos));return s.length===1?s[0]:(o,i)=>s.some(c=>c(o,i))}return rO(n,e.field,e.op,e.values[0])}function Ql(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return sO(e,t);case"not":{const n=Ql(e.child,t);return(s,o)=>!n(s,o)}case"and":{const n=e.children.map(s=>Ql(s,t));return(s,o)=>n.every(i=>i(s,o))}case"or":{const n=e.children.map(s=>Ql(s,t));return(s,o)=>n.some(i=>i(s,o))}}}class ii extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const oO={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},aO=/[A-Za-z_]/,iO=/[A-Za-z0-9_-]/,lO=/^\d{4}-\d{2}-\d{2}/;function cO(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 f="";for(;c<e.length&&/[a-z]/i.test(e[c]);)f+=e[c],c++;if(n=c,f.length>0){const m=oO[f.toLowerCase()];if(m===void 0)throw new ii(o,`Unknown duration unit "${f}" (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===`
|
|
545
|
+
`||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 ii(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,f="";for(;u<e.length&&e[u]!==c;)e[u]==="\\"&&u+1<e.length?(f+=e[u+1],u+=2):(f+=e[u],u++);if(u>=e.length)throw new ii(i,"Unterminated string literal");t.push({type:"STRING",text:f,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 ii(i,'Unexpected "+"')}if(/\d/.test(o)){const c=e.slice(n).match(lO);if(c){t.push({type:"DATE",text:c[0],pos:i}),n+=c[0].length;continue}t.push(s(i,0));continue}if(aO.test(o)){let c=n+1;for(;c<e.length&&iO.test(e[c]);)c++;const u=e.slice(n,c),f=u.toLowerCase();f==="and"?t.push({type:"AND",text:u,pos:i}):f==="or"?t.push({type:"OR",text:u,pos:i}):f==="not"?t.push({type:"NOT",text:u,pos:i}):t.push({type:"IDENT",text:u,pos:i}),n=c;continue}throw new ii(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Qo extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const uO=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),dO=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class fO{constructor(t){Km(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const s=this.peek();if(s.type!==t)throw new Qo(s.pos,`Expected ${n}, got "${s.text||s.type}"`);return this.next()}parseQuery(){if(this.peek().type==="EOF")return{kind:"all"};const t=this.orExpr(),n=this.peek();if(n.type!=="EOF")throw new Qo(n.pos,`Unexpected "${n.text}" — unbalanced parentheses or stray token`);return t}orExpr(){const t=[this.andExpr()];for(;this.peek().type==="OR";)this.next(),t.push(this.andExpr());return t.length===1?t[0]:{kind:"or",children:t}}andExpr(){const t=[this.unary()];for(;;){const n=this.peek();if(n.type==="AND")this.next(),t.push(this.unary());else if(dO.has(n.type))t.push(this.unary());else break}return t.length===1?t[0]:{kind:"and",children:t}}unary(){const t=this.peek();if(t.type==="NOT")return this.next(),{kind:"not",child:this.unary()};if(t.type==="MINUS"){this.next();const n=this.peek();if(n.type!=="IDENT")throw new Qo(n.pos,'Expected a field atom after "-" negation');return{kind:"not",child:this.atom()}}return this.primary()}primary(){const t=this.peek();if(t.type==="LPAREN"){this.next();const n=this.orExpr();return this.expect("RPAREN",'")"'),n}if(t.type==="STAR")return this.next(),{kind:"all"};if(t.type==="IDENT")return this.atom();throw new Qo(t.pos,`Expected a field, "(", "*", or NOT — got "${t.text||"end of query"}"`)}atom(){const t=this.expect("IDENT","a field name"),n=this.peek();if(n.type==="COLON"){this.next();const s=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:s,pos:t.pos}}if(n.type==="OP"){this.next();const s=this.value();return{kind:"atom",field:t.text,op:n.text,values:[s],pos:t.pos}}throw new Qo(n.pos,`Expected ":" or a comparison operator after field "${t.text}"`)}valueOrList(){if(this.peek().type==="LPAREN"){this.next();const t=[this.value()];for(;this.peek().type==="COMMA";)this.next(),t.push(this.value());return this.expect("RPAREN",'")" to close the value list'),t}return[this.value()]}value(){const t=this.peek();if(!uO.has(t.type))throw new Qo(t.pos,`Expected a value, got "${t.text||t.type}"`);switch(this.next(),t.type){case"STRING":return{type:"string",raw:t.text,pos:t.pos};case"NUMBER":return{type:"number",raw:t.text,num:t.num,pos:t.pos};case"DATE":return{type:"date",raw:t.text,pos:t.pos};case"DURATION":return{type:"duration",raw:t.text,num:t.num,sign:t.sign??0,pos:t.pos};default:return{type:"word",raw:t.text,pos:t.pos}}}}function Ff(e){try{const t=cO(e);return{ast:new fO(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ii||t instanceof Qo)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Ox(e,t=Mf){const n=Ff(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:Ql(n.ast,t),ast:n.ast},errors:[]}}catch(s){if(s instanceof kr)return{query:null,errors:s.errors};throw s}}const pO=/^[A-Za-z_][A-Za-z0-9_-]*$/,mO=new Set(["and","or","not"]);function M1(e){return pO.test(e)&&!mO.has(e.toLowerCase())?e:F1(e)}function F1(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const z1="__unassigned__",B1="__standalone__",hO={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function gO(e){return e.startsWith("older_")?"<":">="}const Ix=["status","type","priority","assignee","project","tags"],xO=["created","updated"];function yO(e){var i;const t={};for(const c of Ix){const u=ze(e[c]);u.length&&(t[c]=u)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let s=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const c=bO(o);if(c)s||(s=c);else{const u=vO(o);u&&(t.dateRange=u)}}return s&&(t.activity=s),t}function bO(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function vO(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 Xl(e){const t=yO(e),n=[];for(const s of Ix){const o=t[s]??[];o.length&&n.push(wO(s,o))}return t.search&&n.push(`search:${F1(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...kO(t.dateRange)),n.join(" AND ")}function wO(e,t){const n=t.map(s=>jO(e,s));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function jO(e,t){return e==="assignee"&&t===z1||e==="project"&&t===B1?"none":M1(t)}function kO(e){if(e.preset)return[`${e.field} ${gO(e.preset)} -${hO[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Zl(e){const t=Ff(e);if(!t.ast)return null;const n=SO(t.ast);if(n===null)return null;const s={},o=new Set,i=new Map;for(const c of n){const u=NO(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 f=`date:${u.field}`;if(o.has(f)||i.has(u.field))return null;o.add(f),s.dateRange={field:u.field,preset:u.preset};break}case"dateBound":{const f=`date:${u.field}`;if(o.has(f))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 f={field:c};u.from!==void 0&&(f.from=u.from),u.to!==void 0&&(f.to=u.to),s.dateRange=f}return s}function SO(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 NO(e){const t=e.field.toLowerCase();if(e.op===":"){if(Ix.includes(t)){const o=t,i=[];for(const c of e.values){const u=PO(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(!xO.includes(t))return null;const n=t;if(e.values.length!==1)return null;const s=e.values[0];return s.type==="duration"?CO(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 CO(e,t,n){if(n.sign!==-1)return null;const s=EO(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=RO(t,s);return o?{kind:"datePreset",field:e,preset:o}:null}function EO(e){return e.replace(/^[-+]/,"")}const TO={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function RO(e,t){return e!==">="&&e!=="<"?null:TO[e][t]??null}function PO(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?z1:e==="project"&&n.toLowerCase()==="none"?B1:n}const vh=["title","status","priority","assignee","dependencies","created","updated"],AO=["small","wide","tall","large"],DO={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},Jw="2026-05-21T00:00:00Z";function wh(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...DO,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:Jw,updatedAt:Jw}}const bo={version:1,views:[wh("default-recently-updated","Recently updated",{}),wh("default-high-priority","High priority",{priority:"high"}),wh("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 U1(e,t){const n=ze(e.filters.project),s=n.length===0||n.length===1&&n[0]===t,o=e.filters.activity,i=typeof e.filters.search=="string"&&e.filters.search.trim().length>0,c=e.filters.query,u=typeof c=="string"&&c.trim().length>0&&Zl(c)===null;return s&&(!o||o==="all")&&!i&&!u}function V1(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?U1(e.config,t.slug):!1}}const H1=`syntaur.savedViews.cache.v${bo.version}`;let vi=$O(),Xo=null,_x=null;const hg=new Set,qd=new Set;let W1=0;function K1(){return++W1}function gg(e){return e===W1}function $O(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(H1);if(!e)return null;const t=JSON.parse(e);return t.version!==bo.version?null:t}catch{return null}}function LO(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(H1,JSON.stringify(e))}catch{}}function q1(e){vi=e,_x=null,LO(e);for(const t of hg)t(e);for(const t of qd)t(null)}function OO(e){_x=e;for(const t of qd)t(e)}function G1(e){if(!e||typeof e!="object")return bo;const t=e;return t.version!==bo.version||!Array.isArray(t.views)||!t.dashboard?bo:t}function Qw(){if(Xo)return Xo;const e=K1();return Xo=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=G1(t);return gg(e)&&q1(n),Xo=null,vi??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return gg(e)&&OO(n),Xo=null,vi??bo}),Xo}function Mx(){const[e,t]=p.useState(()=>vi??bo),[n,s]=p.useState(()=>vi===null),[o,i]=p.useState(!1),[c,u]=p.useState(()=>_x);return p.useEffect(()=>{let m=!1;vi===null&&s(!0),Qw().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 hg.add(h),qd.add(g),()=>{m=!0,hg.delete(h),qd.delete(g)}},[]),{file:e,loading:n,ready:o,error:c,refetch:()=>{Xo=null,s(!0),u(null),i(!1),Qw()}}}function Pc(){const{file:e,loading:t}=Mx();return{views:e.views,loading:t}}function Y1(){const{file:e,loading:t}=Mx();return{layout:e.dashboard,loading:t}}function jo(e){const{file:t,loading:n,ready:s,error:o,refetch:i}=Mx();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=K1(),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=G1(await o.json());return gg(s)&&q1(i),i}function Ci(e){return zf("POST","/api/saved-views",e)}function Gd(e,t){return zf("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function IO(e){return zf("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function J1(e){return zf("PUT","/api/dashboard",{slots:e})}const _O=["top","right","bottom","left"],ko=Math.min,Sr=Math.max,Yd=Math.round,sd=Math.floor,ks=e=>({x:e,y:e}),MO={left:"right",right:"left",bottom:"top",top:"bottom"};function xg(e,t,n){return Sr(e,ko(t,n))}function Us(e,t){return typeof e=="function"?e(t):e}function Vs(e){return e.split("-")[0]}function Vi(e){return e.split("-")[1]}function Fx(e){return e==="x"?"y":"x"}function zx(e){return e==="y"?"height":"width"}function vs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bx(e){return Fx(vs(e))}function FO(e,t,n){n===void 0&&(n=!1);const s=Vi(e),o=Bx(e),i=zx(o);let c=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=Jd(c)),[c,Jd(c)]}function zO(e){const t=Jd(e);return[yg(e),t,yg(t)]}function yg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Xw=["left","right"],Zw=["right","left"],BO=["top","bottom"],UO=["bottom","top"];function VO(e,t,n){switch(e){case"top":case"bottom":return n?t?Zw:Xw:t?Xw:Zw;case"left":case"right":return t?BO:UO;default:return[]}}function HO(e,t,n,s){const o=Vi(e);let i=VO(Vs(e),n==="start",s);return o&&(i=i.map(c=>c+"-"+o),t&&(i=i.concat(i.map(yg)))),i}function Jd(e){const t=Vs(e);return MO[t]+e.slice(t.length)}function WO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Q1(e){return typeof e!="number"?WO(e):{top:e,right:e,bottom:e,left:e}}function Qd(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 ej(e,t,n){let{reference:s,floating:o}=e;const i=vs(t),c=Bx(t),u=zx(c),f=Vs(t),m=i==="y",h=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,y=s[u]/2-o[u]/2;let b;switch(f){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(Vi(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 KO(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:c,elements:u,strategy:f}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Us(t,e),C=Q1(b),v=u[y?g==="floating"?"reference":"floating":g],k=Qd(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:f})),E=g==="floating"?{x:s,y:o,width:c.floating.width,height:c.floating.height}:c.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u.floating)),T=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},A=Qd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:S,strategy:f}):E);return{top:(k.top-A.top+C.top)/T.y,bottom:(A.bottom-k.bottom+C.bottom)/T.y,left:(k.left-A.left+C.left)/T.x,right:(A.right-k.right+C.right)/T.x}}const qO=50,GO=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:KO},f=await(c.isRTL==null?void 0:c.isRTL(t));let m=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:h,y:g}=ej(m,s,f),y=s,b=0;const C={};for(let j=0;j<i.length;j++){const v=i[j];if(!v)continue;const{name:k,fn:E}=v,{x:S,y:T,data:A,reset:R}=await E({x:h,y:g,initialPlacement:s,placement:y,strategy:o,middlewareData:C,rects:m,platform:u,elements:{reference:e,floating:t}});h=S??h,g=T??g,C[k]={...C[k],...A},R&&b<qO&&(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}=ej(m,y,f)),j=-1)}return{x:h,y:g,placement:y,strategy:o,middlewareData:C}},YO=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:c,elements:u,middlewareData:f}=t,{element:m,padding:h=0}=Us(e,t)||{};if(m==null)return{};const g=Q1(h),y={x:n,y:s},b=Bx(o),C=zx(b),j=await c.getDimensions(m),v=b==="y",k=v?"top":"left",E=v?"bottom":"right",S=v?"clientHeight":"clientWidth",T=i.reference[C]+i.reference[b]-y[b]-i.floating[C],A=y[b]-i.reference[b],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(m));let P=R?R[S]:0;(!P||!await(c.isElement==null?void 0:c.isElement(R)))&&(P=u.floating[S]||i.floating[C]);const $=T/2-A/2,I=P/2-j[C]/2-1,M=ko(g[k],I),D=ko(g[E],I),H=M,K=P-j[C]-D,_=P/2-j[C]/2+$,U=xg(H,_,K),q=!f.arrow&&Vi(o)!=null&&_!==U&&i.reference[C]/2-(_<H?M:D)-j[C]/2<0,Z=q?_<H?_-H:_-K:0;return{[b]:y[b]+Z,data:{[b]:U,centerOffset:_-U-Z,...q&&{alignmentOffset:Z}},reset:q}}}),JO=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:f,elements:m}=t,{mainAxis:h=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:j=!0,...v}=Us(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const k=Vs(o),E=vs(u),S=Vs(u)===u,T=await(f.isRTL==null?void 0:f.isRTL(m.floating)),A=y||(S||!j?[Jd(u)]:zO(u)),R=C!=="none";!y&&R&&A.push(...HO(u,j,C,T));const P=[u,...A],$=await f.detectOverflow(t,v),I=[];let M=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&I.push($[k]),g){const _=FO(o,c,T);I.push($[_[0]],$[_[1]])}if(M=[...M,{placement:o,overflows:I}],!I.every(_=>_<=0)){var D,H;const _=(((D=i.flip)==null?void 0:D.index)||0)+1,U=P[_];if(U&&(!(g==="alignment"?E!==vs(U):!1)||M.every(F=>vs(F.placement)===E?F.overflows[0]>0:!0)))return{data:{index:_,overflows:M},reset:{placement:U}};let q=(H=M.filter(Z=>Z.overflows[0]<=0).sort((Z,F)=>Z.overflows[1]-F.overflows[1])[0])==null?void 0:H.placement;if(!q)switch(b){case"bestFit":{var K;const Z=(K=M.filter(F=>{if(R){const G=vs(F.placement);return G===E||G==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(G=>G>0).reduce((G,L)=>G+L,0)]).sort((F,G)=>F[1]-G[1])[0])==null?void 0:K[0];Z&&(q=Z);break}case"initialPlacement":q=u;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function tj(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 _O.some(t=>e[t]>=0)}const QO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=Us(e,t);switch(o){case"referenceHidden":{const c=await s.detectOverflow(t,{...i,elementContext:"reference"}),u=tj(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:nj(u)}}}case"escaped":{const c=await s.detectOverflow(t,{...i,altBoundary:!0}),u=tj(c,n.floating);return{data:{escapedOffsets:u,escaped:nj(u)}}}default:return{}}}}},X1=new Set(["left","top"]);async function XO(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),c=Vs(n),u=Vi(n),f=vs(n)==="y",m=X1.has(c)?-1:1,h=i&&f?-1:1,g=Us(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:C}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof C=="number"&&(b=u==="end"?C*-1:C),f?{x:b*h,y:y*m}:{x:y*m,y:b*h}}const ZO=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,f=await XO(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:o+f.x,y:i+f.y,data:{...f,placement:c}}}}},eI=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:f={fn:k=>{let{x:E,y:S}=k;return{x:E,y:S}}},...m}=Us(e,t),h={x:n,y:s},g=await i.detectOverflow(t,m),y=vs(Vs(o)),b=Fx(y);let C=h[b],j=h[y];if(c){const k=b==="y"?"top":"left",E=b==="y"?"bottom":"right",S=C+g[k],T=C-g[E];C=xg(S,C,T)}if(u){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",S=j+g[k],T=j-g[E];j=xg(S,j,T)}const v=f.fn({...t,[b]:C,[y]:j});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[b]:c,[y]:u}}}}}},tI=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:f=!0,crossAxis:m=!0}=Us(e,t),h={x:n,y:s},g=vs(o),y=Fx(g);let b=h[y],C=h[g];const j=Us(u,t),v=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(f){const S=y==="y"?"height":"width",T=i.reference[y]-i.floating[S]+v.mainAxis,A=i.reference[y]+i.reference[S]-v.mainAxis;b<T?b=T:b>A&&(b=A)}if(m){var k,E;const S=y==="y"?"width":"height",T=X1.has(Vs(o)),A=i.reference[g]-i.floating[S]+(T&&((k=c.offset)==null?void 0:k[g])||0)+(T?0:v.crossAxis),R=i.reference[g]+i.reference[S]+(T?0:((E=c.offset)==null?void 0:E[g])||0)-(T?v.crossAxis:0);C<A?C=A:C>R&&(C=R)}return{[y]:b,[g]:C}}}},nI=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:f=()=>{},...m}=Us(e,t),h=await c.detectOverflow(t,m),g=Vs(o),y=Vi(o),b=vs(o)==="y",{width:C,height:j}=i.floating;let v,k;g==="top"||g==="bottom"?(v=g,k=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,v=y==="end"?"top":"bottom");const E=j-h.top-h.bottom,S=C-h.left-h.right,T=ko(j-h[v],E),A=ko(C-h[k],S),R=!t.middlewareData.shift;let P=T,$=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(P=E),R&&!y){const M=Sr(h.left,0),D=Sr(h.right,0),H=Sr(h.top,0),K=Sr(h.bottom,0);b?$=C-2*(M!==0||D!==0?M+D:Sr(h.left,h.right)):P=j-2*(H!==0||K!==0?H+K:Sr(h.top,h.bottom))}await f({...t,availableWidth:$,availableHeight:P});const I=await c.getDimensions(u.floating);return C!==I.width||j!==I.height?{reset:{rects:!0}}:{}}}};function Bf(){return typeof window<"u"}function Hi(e){return Z1(e)?(e.nodeName||"").toLowerCase():"#document"}function Tr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Cs(e){var t;return(t=(Z1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Z1(e){return Bf()?e instanceof Node||e instanceof Tr(e).Node:!1}function os(e){return Bf()?e instanceof Element||e instanceof Tr(e).Element:!1}function Ws(e){return Bf()?e instanceof HTMLElement||e instanceof Tr(e).HTMLElement:!1}function rj(e){return!Bf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Tr(e).ShadowRoot}function Ac(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 rI(e){return/^(table|td|th)$/.test(Hi(e))}function Uf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const sI=/transform|translate|scale|rotate|perspective|filter/,oI=/paint|layout|strict|content/,Yo=e=>!!e&&e!=="none";let jh;function Ux(e){const t=os(e)?as(e):e;return Yo(t.transform)||Yo(t.translate)||Yo(t.scale)||Yo(t.rotate)||Yo(t.perspective)||!Vx()&&(Yo(t.backdropFilter)||Yo(t.filter))||sI.test(t.willChange||"")||oI.test(t.contain||"")}function aI(e){let t=So(e);for(;Ws(t)&&!Ei(t);){if(Ux(t))return t;if(Uf(t))return null;t=So(t)}return null}function Vx(){return jh==null&&(jh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jh}function Ei(e){return/^(html|body|#document)$/.test(Hi(e))}function as(e){return Tr(e).getComputedStyle(e)}function Vf(e){return os(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function So(e){if(Hi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||rj(e)&&e.host||Cs(e);return rj(t)?t.host:t}function eN(e){const t=So(e);return Ei(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ws(t)&&Ac(t)?t:eN(t)}function mc(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=eN(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),c=Tr(o);if(i){const u=bg(c);return t.concat(c,c.visualViewport||[],Ac(o)?o:[],u&&n?mc(u):[])}else return t.concat(o,mc(o,[],n))}function bg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tN(e){const t=as(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Ws(e),i=o?e.offsetWidth:n,c=o?e.offsetHeight:s,u=Yd(n)!==i||Yd(s)!==c;return u&&(n=i,s=c),{width:n,height:s,$:u}}function Hx(e){return os(e)?e:e.contextElement}function wi(e){const t=Hx(e);if(!Ws(t))return ks(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=tN(t);let c=(i?Yd(n.width):n.width)/s,u=(i?Yd(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const iI=ks(0);function nN(e){const t=Tr(e);return!Vx()||!t.visualViewport?iI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Tr(e)?!1:t}function ua(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Hx(e);let c=ks(1);t&&(s?os(s)&&(c=wi(s)):c=wi(e));const u=lI(i,n,s)?nN(i):ks(0);let f=(o.left+u.x)/c.x,m=(o.top+u.y)/c.y,h=o.width/c.x,g=o.height/c.y;if(i){const y=Tr(i),b=s&&os(s)?Tr(s):s;let C=y,j=bg(C);for(;j&&s&&b!==C;){const v=wi(j),k=j.getBoundingClientRect(),E=as(j),S=k.left+(j.clientLeft+parseFloat(E.paddingLeft))*v.x,T=k.top+(j.clientTop+parseFloat(E.paddingTop))*v.y;f*=v.x,m*=v.y,h*=v.x,g*=v.y,f+=S,m+=T,C=Tr(j),j=bg(C)}}return Qd({width:h,height:g,x:f,y:m})}function Hf(e,t){const n=Vf(e).scrollLeft;return t?t.left+n:ua(Cs(e)).left+n}function rN(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Hf(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function cI(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",c=Cs(s),u=t?Uf(t.floating):!1;if(s===c||u&&i)return n;let f={scrollLeft:0,scrollTop:0},m=ks(1);const h=ks(0),g=Ws(s);if((g||!g&&!i)&&((Hi(s)!=="body"||Ac(c))&&(f=Vf(s)),g)){const b=ua(s);m=wi(s),h.x=b.x+s.clientLeft,h.y=b.y+s.clientTop}const y=c&&!g&&!i?rN(c,f):ks(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-f.scrollLeft*m.x+h.x+y.x,y:n.y*m.y-f.scrollTop*m.y+h.y+y.y}}function uI(e){return Array.from(e.getClientRects())}function dI(e){const t=Cs(e),n=Vf(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+Hf(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 sj=25;function fI(e,t){const n=Tr(e),s=Cs(e),o=n.visualViewport;let i=s.clientWidth,c=s.clientHeight,u=0,f=0;if(o){i=o.width,c=o.height;const h=Vx();(!h||h&&t==="fixed")&&(u=o.offsetLeft,f=o.offsetTop)}const m=Hf(s);if(m<=0){const h=s.ownerDocument,g=h.body,y=getComputedStyle(g),b=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,C=Math.abs(s.clientWidth-g.clientWidth-b);C<=sj&&(i-=C)}else m<=sj&&(i+=m);return{width:i,height:c,x:u,y:f}}function pI(e,t){const n=ua(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Ws(e)?wi(e):ks(1),c=e.clientWidth*i.x,u=e.clientHeight*i.y,f=o*i.x,m=s*i.y;return{width:c,height:u,x:f,y:m}}function oj(e,t,n){let s;if(t==="viewport")s=fI(e,n);else if(t==="document")s=dI(Cs(e));else if(os(t))s=pI(t,n);else{const o=nN(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Qd(s)}function sN(e,t){const n=So(e);return n===t||!os(n)||Ei(n)?!1:as(n).position==="fixed"||sN(n,t)}function mI(e,t){const n=t.get(e);if(n)return n;let s=mc(e,[],!1).filter(u=>os(u)&&Hi(u)!=="body"),o=null;const i=as(e).position==="fixed";let c=i?So(e):e;for(;os(c)&&!Ei(c);){const u=as(c),f=Ux(c);!f&&u.position==="fixed"&&(o=null),(i?!f&&!o:!f&&u.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Ac(c)&&!f&&sN(e,c))?s=s.filter(h=>h!==c):o=u,c=So(c)}return t.set(e,s),s}function hI(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const c=[...n==="clippingAncestors"?Uf(t)?[]:mI(t,this._c):[].concat(n),s],u=oj(t,c[0],o);let f=u.top,m=u.right,h=u.bottom,g=u.left;for(let y=1;y<c.length;y++){const b=oj(t,c[y],o);f=Sr(b.top,f),m=ko(b.right,m),h=ko(b.bottom,h),g=Sr(b.left,g)}return{width:m-g,height:h-f,x:g,y:f}}function gI(e){const{width:t,height:n}=tN(e);return{width:t,height:n}}function xI(e,t,n){const s=Ws(t),o=Cs(t),i=n==="fixed",c=ua(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const f=ks(0);function m(){f.x=Hf(o)}if(s||!s&&!i)if((Hi(t)!=="body"||Ac(o))&&(u=Vf(t)),s){const b=ua(t,!0,i,t);f.x=b.x+t.clientLeft,f.y=b.y+t.clientTop}else o&&m();i&&!s&&o&&m();const h=o&&!s&&!i?rN(o,u):ks(0),g=c.left+u.scrollLeft-f.x-h.x,y=c.top+u.scrollTop-f.y-h.y;return{x:g,y,width:c.width,height:c.height}}function kh(e){return as(e).position==="static"}function aj(e,t){if(!Ws(e)||as(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Cs(e)===n&&(n=n.ownerDocument.body),n}function oN(e,t){const n=Tr(e);if(Uf(e))return n;if(!Ws(e)){let o=So(e);for(;o&&!Ei(o);){if(os(o)&&!kh(o))return o;o=So(o)}return n}let s=aj(e,t);for(;s&&rI(s)&&kh(s);)s=aj(s,t);return s&&Ei(s)&&kh(s)&&!Ux(s)?n:s||aI(e)||n}const yI=async function(e){const t=this.getOffsetParent||oN,n=this.getDimensions,s=await n(e.floating);return{reference:xI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function bI(e){return as(e).direction==="rtl"}const vI={convertOffsetParentRelativeRectToViewportRelativeRect:cI,getDocumentElement:Cs,getClippingRect:hI,getOffsetParent:oN,getElementRects:yI,getClientRects:uI,getDimensions:gI,getScale:wi,isElement:os,isRTL:bI};function aN(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wI(e,t){let n=null,s;const o=Cs(e);function i(){var u;clearTimeout(s),(u=n)==null||u.disconnect(),n=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),i();const m=e.getBoundingClientRect(),{left:h,top:g,width:y,height:b}=m;if(u||t(),!y||!b)return;const C=sd(g),j=sd(o.clientWidth-(h+y)),v=sd(o.clientHeight-(g+b)),k=sd(h),S={rootMargin:-C+"px "+-j+"px "+-v+"px "+-k+"px",threshold:Sr(0,ko(1,f))||1};let T=!0;function A(R){const P=R[0].intersectionRatio;if(P!==f){if(!T)return c();P?c(!1,P):s=setTimeout(()=>{c(!1,1e-7)},1e3)}P===1&&!aN(m,e.getBoundingClientRect())&&c(),T=!1}try{n=new IntersectionObserver(A,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,S)}n.observe(e)}return c(!0),i}function jI(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:f=!1}=s,m=Hx(e),h=o||i?[...m?mc(m):[],...t?mc(t):[]]:[];h.forEach(k=>{o&&k.addEventListener("scroll",n,{passive:!0}),i&&k.addEventListener("resize",n)});const g=m&&u?wI(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&&!f&&b.observe(m),t&&b.observe(t));let C,j=f?ua(e):null;f&&v();function v(){const k=ua(e);j&&!aN(j,k)&&n(),j=k,C=requestAnimationFrame(v)}return n(),()=>{var k;h.forEach(E=>{o&&E.removeEventListener("scroll",n),i&&E.removeEventListener("resize",n)}),g==null||g(),(k=b)==null||k.disconnect(),b=null,f&&cancelAnimationFrame(C)}}const kI=ZO,SI=eI,NI=JO,CI=nI,EI=QO,ij=YO,TI=tI,RI=(e,t,n)=>{const s=new Map,o={platform:vI,...n},i={...o.platform,_c:s};return GO(e,t,{...o,platform:i})};var PI=typeof document<"u",AI=function(){},Nd=PI?p.useLayoutEffect:AI;function Xd(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(!Xd(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)&&!Xd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function iN(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lj(e,t){const n=iN(e);return Math.round(t*n)/n}function Sh(e){const t=p.useRef(e);return Nd(()=>{t.current=e}),t}function DI(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:f,open:m}=e,[h,g]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=p.useState(s);Xd(y,s)||b(s);const[C,j]=p.useState(null),[v,k]=p.useState(null),E=p.useCallback(F=>{F!==R.current&&(R.current=F,j(F))},[]),S=p.useCallback(F=>{F!==P.current&&(P.current=F,k(F))},[]),T=i||C,A=c||v,R=p.useRef(null),P=p.useRef(null),$=p.useRef(h),I=f!=null,M=Sh(f),D=Sh(o),H=Sh(m),K=p.useCallback(()=>{if(!R.current||!P.current)return;const F={placement:t,strategy:n,middleware:y};D.current&&(F.platform=D.current),RI(R.current,P.current,F).then(G=>{const L={...G,isPositioned:H.current!==!1};_.current&&!Xd($.current,L)&&($.current=L,Ms.flushSync(()=>{g(L)}))})},[y,t,n,D,H]);Nd(()=>{m===!1&&$.current.isPositioned&&($.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[m]);const _=p.useRef(!1);Nd(()=>(_.current=!0,()=>{_.current=!1}),[]),Nd(()=>{if(T&&(R.current=T),A&&(P.current=A),T&&A){if(M.current)return M.current(T,A,K);K()}},[T,A,K,M,I]);const U=p.useMemo(()=>({reference:R,floating:P,setReference:E,setFloating:S}),[E,S]),q=p.useMemo(()=>({reference:T,floating:A}),[T,A]),Z=p.useMemo(()=>{const F={position:n,left:0,top:0};if(!q.floating)return F;const G=lj(q.floating,h.x),L=lj(q.floating,h.y);return u?{...F,transform:"translate("+G+"px, "+L+"px)",...iN(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:L}},[n,u,q.floating,h.x,h.y]);return p.useMemo(()=>({...h,update:K,refs:U,elements:q,floatingStyles:Z}),[h,K,U,q,Z])}const $I=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?ij({element:s.current,padding:o}).fn(n):{}:s?ij({element:s,padding:o}).fn(n):{}}}},LI=(e,t)=>{const n=kI(e);return{name:n.name,fn:n.fn,options:[e,t]}},OI=(e,t)=>{const n=SI(e);return{name:n.name,fn:n.fn,options:[e,t]}},II=(e,t)=>({fn:TI(e).fn,options:[e,t]}),_I=(e,t)=>{const n=NI(e);return{name:n.name,fn:n.fn,options:[e,t]}},MI=(e,t)=>{const n=CI(e);return{name:n.name,fn:n.fn,options:[e,t]}},FI=(e,t)=>{const n=EI(e);return{name:n.name,fn:n.fn,options:[e,t]}},zI=(e,t)=>{const n=$I(e);return{name:n.name,fn:n.fn,options:[e,t]}};var BI="Arrow",lN=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...i}=e;return r.jsx(vn.svg,{...i,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});lN.displayName=BI;var UI=lN;function VI(e){const[t,n]=p.useState(void 0);return vo(()=>{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 f=i.borderBoxSize,m=Array.isArray(f)?f[0]:f;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 Wx="Popper",[cN,uN]=da(Wx),[HI,dN]=cN(Wx),fN=e=>{const{__scopePopper:t,children:n}=e,[s,o]=p.useState(null);return r.jsx(HI,{scope:t,anchor:s,onAnchorChange:o,children:n})};fN.displayName=Wx;var pN="PopperAnchor",mN=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=dN(pN,n),c=p.useRef(null),u=qn(t,c),f=p.useRef(null);return p.useEffect(()=>{const m=f.current;f.current=(s==null?void 0:s.current)||c.current,m!==f.current&&i.onAnchorChange(f.current)}),s?null:r.jsx(vn.div,{...o,ref:u})});mN.displayName=pN;var Kx="PopperContent",[WI,KI]=cN(Kx),hN=p.forwardRef((e,t)=>{var ye,Se,Ee,Ae,Ke,ct;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:f=!0,collisionBoundary:m=[],collisionPadding:h=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:C,...j}=e,v=dN(Kx,n),[k,E]=p.useState(null),S=qn(t,et=>E(et)),[T,A]=p.useState(null),R=VI(T),P=(R==null?void 0:R.width)??0,$=(R==null?void 0:R.height)??0,I=s+(i!=="center"?"-"+i:""),M=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},D=Array.isArray(m)?m:[m],H=D.length>0,K={padding:M,boundary:D.filter(GI),altBoundary:H},{refs:_,floatingStyles:U,placement:q,isPositioned:Z,middlewareData:F}=DI({strategy:"fixed",placement:I,whileElementsMounted:(...et)=>jI(...et,{animationFrame:b==="always"}),elements:{reference:v.anchor},middleware:[LI({mainAxis:o+$,alignmentAxis:c}),f&&OI({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?II():void 0,...K}),f&&_I({...K}),MI({...K,apply:({elements:et,rects:ot,availableWidth:X,availableHeight:Me})=>{const{width:Ce,height:Ie}=ot.reference,Ye=et.floating.style;Ye.setProperty("--radix-popper-available-width",`${X}px`),Ye.setProperty("--radix-popper-available-height",`${Me}px`),Ye.setProperty("--radix-popper-anchor-width",`${Ce}px`),Ye.setProperty("--radix-popper-anchor-height",`${Ie}px`)}}),T&&zI({element:T,padding:u}),YI({arrowWidth:P,arrowHeight:$}),y&&FI({strategy:"referenceHidden",...K})]}),[G,L]=yN(q),V=la(C);vo(()=>{Z&&(V==null||V())},[Z,V]);const re=(ye=F.arrow)==null?void 0:ye.x,B=(Se=F.arrow)==null?void 0:Se.y,ue=((Ee=F.arrow)==null?void 0:Ee.centerOffset)!==0,[ge,se]=p.useState();return vo(()=>{k&&se(window.getComputedStyle(k).zIndex)},[k]),r.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:Z?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(Ae=F.transformOrigin)==null?void 0:Ae.x,(Ke=F.transformOrigin)==null?void 0:Ke.y].join(" "),...((ct=F.hide)==null?void 0:ct.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(WI,{scope:n,placedSide:G,onArrowChange:A,arrowX:re,arrowY:B,shouldHideArrow:ue,children:r.jsx(vn.div,{"data-side":G,"data-align":L,...j,ref:S,style:{...j.style,animation:Z?void 0:"none"}})})})});hN.displayName=Kx;var gN="PopperArrow",qI={top:"bottom",right:"left",bottom:"top",left:"right"},xN=p.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=KI(gN,s),c=qI[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(UI,{...o,ref:n,style:{...o.style,display:"block"}})})});xN.displayName=gN;function GI(e){return e!==null}var YI=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,f=c?0:e.arrowHeight,[m,h]=yN(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)+f/2;let C="",j="";return m==="bottom"?(C=c?g:`${y}px`,j=`${-f}px`):m==="top"?(C=c?g:`${y}px`,j=`${s.floating.height+f}px`):m==="right"?(C=`${-f}px`,j=c?g:`${b}px`):m==="left"&&(C=`${s.floating.width+f}px`,j=c?g:`${b}px`),{data:{x:C,y:j}}}});function yN(e){const[t,n="center"]=e.split("-");return[t,n]}var JI=fN,QI=mN,XI=hN,ZI=xN,e_=Symbol("radix.slottable");function t_(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=e_,t}var n_=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"}),r_="VisuallyHidden",bN=p.forwardRef((e,t)=>r.jsx(vn.span,{...e,ref:t,style:{...n_,...e.style}}));bN.displayName=r_;var s_=bN,[Wf]=da("Tooltip",[uN]),Kf=uN(),vN="TooltipProvider",o_=700,vg="tooltip.open",[a_,qx]=Wf(vN),wN=e=>{const{__scopeTooltip:t,delayDuration:n=o_,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,c=p.useRef(!0),u=p.useRef(!1),f=p.useRef(0);return p.useEffect(()=>{const m=f.current;return()=>window.clearTimeout(m)},[]),r.jsx(a_,{scope:t,isOpenDelayedRef:c,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(f.current),c.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>c.current=!0,s)},[s]),isPointerInTransitRef:u,onPointerInTransitChange:p.useCallback(m=>{u.current=m},[]),disableHoverableContent:o,children:i})};wN.displayName=vN;var hc="Tooltip",[i_,Dc]=Wf(hc),jN=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:c,delayDuration:u}=e,f=qx(hc,e.__scopeTooltip),m=Kf(t),[h,g]=p.useState(null),y=gi(),b=p.useRef(0),C=c??f.disableHoverableContent,j=u??f.delayDuration,v=p.useRef(!1),[k,E]=Sf({prop:s,defaultProp:o??!1,onChange:P=>{P?(f.onOpen(),document.dispatchEvent(new CustomEvent(vg))):f.onClose(),i==null||i(P)},caller:hc}),S=p.useMemo(()=>k?v.current?"delayed-open":"instant-open":"closed",[k]),T=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,E(!0)},[E]),A=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,E(!1)},[E]),R=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,E(!0),b.current=0},j)},[j,E]);return p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(JI,{...m,children:r.jsx(i_,{scope:t,contentId:y,open:k,stateAttribute:S,trigger:h,onTriggerChange:g,onTriggerEnter:p.useCallback(()=>{f.isOpenDelayedRef.current?R():T()},[f.isOpenDelayedRef,R,T]),onTriggerLeave:p.useCallback(()=>{C?A():(window.clearTimeout(b.current),b.current=0)},[A,C]),onOpen:T,onClose:A,disableHoverableContent:C,children:n})})};jN.displayName=hc;var wg="TooltipTrigger",kN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Dc(wg,n),i=qx(wg,n),c=Kf(n),u=p.useRef(null),f=qn(t,u,o.onTriggerChange),m=p.useRef(!1),h=p.useRef(!1),g=p.useCallback(()=>m.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),r.jsx(QI,{asChild:!0,...c,children:r.jsx(vn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:f,onPointerMove:Xt(e.onPointerMove,y=>{y.pointerType!=="touch"&&!h.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),h.current=!0)}),onPointerLeave:Xt(e.onPointerLeave,()=>{o.onTriggerLeave(),h.current=!1}),onPointerDown:Xt(e.onPointerDown,()=>{o.open&&o.onClose(),m.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Xt(e.onFocus,()=>{m.current||o.onOpen()}),onBlur:Xt(e.onBlur,o.onClose),onClick:Xt(e.onClick,o.onClose)})})});kN.displayName=wg;var Gx="TooltipPortal",[l_,c_]=Wf(Gx,{forceMount:void 0}),SN=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=Dc(Gx,t);return r.jsx(l_,{scope:t,forceMount:n,children:r.jsx(fa,{present:n||i.open,children:r.jsx(px,{asChild:!0,container:o,children:s})})})};SN.displayName=Gx;var Ti="TooltipContent",NN=p.forwardRef((e,t)=>{const n=c_(Ti,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,c=Dc(Ti,e.__scopeTooltip);return r.jsx(fa,{present:s||c.open,children:c.disableHoverableContent?r.jsx(CN,{side:o,...i,ref:t}):r.jsx(u_,{side:o,...i,ref:t})})}),u_=p.forwardRef((e,t)=>{const n=Dc(Ti,e.__scopeTooltip),s=qx(Ti,e.__scopeTooltip),o=p.useRef(null),i=qn(t,o),[c,u]=p.useState(null),{trigger:f,onClose:m}=n,h=o.current,{onPointerInTransitChange:g}=s,y=p.useCallback(()=>{u(null),g(!1)},[g]),b=p.useCallback((C,j)=>{const v=C.currentTarget,k={x:C.clientX,y:C.clientY},E=h_(k,v.getBoundingClientRect()),S=g_(k,E),T=x_(j.getBoundingClientRect()),A=b_([...S,...T]);u(A),g(!0)},[g]);return p.useEffect(()=>()=>y(),[y]),p.useEffect(()=>{if(f&&h){const C=v=>b(v,h),j=v=>b(v,f);return f.addEventListener("pointerleave",C),h.addEventListener("pointerleave",j),()=>{f.removeEventListener("pointerleave",C),h.removeEventListener("pointerleave",j)}}},[f,h,b,y]),p.useEffect(()=>{if(c){const C=j=>{const v=j.target,k={x:j.clientX,y:j.clientY},E=(f==null?void 0:f.contains(v))||(h==null?void 0:h.contains(v)),S=!y_(k,c);E?y():S&&(y(),m())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[f,h,c,m,y]),r.jsx(CN,{...e,ref:i})}),[d_,f_]=Wf(hc,{isInside:!1}),p_=t_("TooltipContent"),CN=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:c,...u}=e,f=Dc(Ti,n),m=Kf(n),{onClose:h}=f;return p.useEffect(()=>(document.addEventListener(vg,h),()=>document.removeEventListener(vg,h)),[h]),p.useEffect(()=>{if(f.trigger){const g=y=>{const b=y.target;b!=null&&b.contains(f.trigger)&&h()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[f.trigger,h]),r.jsx(fx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:r.jsxs(XI,{"data-state":f.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(p_,{children:s}),r.jsx(d_,{scope:n,isInside:!0,children:r.jsx(s_,{id:f.contentId,role:"tooltip",children:o||s})})]})})});NN.displayName=Ti;var EN="TooltipArrow",m_=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=Kf(n);return f_(EN,n).isInside?null:r.jsx(ZI,{...o,...s,ref:t})});m_.displayName=EN;function h_(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 g_(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 x_(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 y_(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],f=t[c],m=u.x,h=u.y,g=f.x,y=f.y;h>s!=y>s&&n<(g-m)*(s-h)/(y-h)+m&&(o=!o)}return o}function b_(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),v_(t)}function v_(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 w_=wN,j_=jN,k_=kN,S_=SN,TN=NN;const aa=w_,Nr=j_,Cr=k_,cr=p.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(S_,{children:r.jsx(TN,{ref:s,sideOffset:t,className:we("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));cr.displayName=TN.displayName;function Yx({items:e,align:t="end"}){const[n,s]=p.useState(!1),[o,i]=p.useState(null),c=p.useRef(null);if(p.useEffect(()=>{if(!n){i(null);return}function f(h){c.current&&!c.current.contains(h.target)&&s(!1)}function m(h){h.key==="Escape"&&s(!1)}return document.addEventListener("mousedown",f),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",m)}},[n]),e.length===0)return null;function u(f,m){const h=f.icon,g=we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",m&&"pl-8",f.disabled?"opacity-50 cursor-not-allowed":f.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),y=m?f.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:f.label})]});if(f.disabled){const C=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:g,children:b})});return f.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:C}),r.jsx(cr,{side:"left",children:f.disabledReason})]},f.key):r.jsx("div",{children:C},f.key)}return f.href?r.jsx(Te,{to:f.href,className:g,onClick:()=>s(!1),children:b},f.key):r.jsx("button",{type:"button",className:g,onClick:()=>{var C;(C=f.onSelect)==null||C.call(f),s(!1)},children:b},f.key)}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsx("button",{type:"button",onClick:()=>s(f=>!f),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:r.jsx($P,{className:"h-4 w-4"})}),n&&r.jsx("div",{className:we("absolute top-full mt-1 z-30 min-w-[220px] rounded-md border border-border/70 bg-background shadow-lg py-1",t==="end"?"right-0":"left-0"),children:r.jsx(aa,{delayDuration:200,children:e.map(f=>{if(f.submenu&&f.submenu.length>0){const m=f.icon,h=o===f.key;return r.jsxs("div",{children:[r.jsxs("button",{type:"button",className:we("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":h,onClick:()=>i(h?null:f.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:f.label}),h?r.jsx(fr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):r.jsx(gk,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),h?f.submenu.map(g=>u(g,!0)):null]},f.key)}return u(f,!1)})})})]})}function cj(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const N_={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 C_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,0,0,0,0).getTime()}function E_(e){const[t,n,s]=e.split("-").map(Number);return new Date(t,n-1,s,23,59,59,999).getTime()}function T_(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=N_[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<C_(i)||c&&o>E_(c))}function R_(e,t,n={}){const{workspace:s,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const c=ze(t.status),u=ze(t.priority),f=ze(t.type),m=ze(t.assignee),h=ze(t.project),g=ze(t.tags),{activity:y}=t;if(s){if(s==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==s)return!1}if(c.length&&!c.includes(e.status)||u.length&&!u.includes(e.priority)||f.length&&!f.includes(e.type??"")||y==="stale"&&!cj(e.updated)||y==="fresh"&&cj(e.updated))return!1;if(m.length){const b=e.assignee??"__unassigned__";if(!m.includes(b))return!1}if(h.length&&!h.some(C=>C==="__standalone__"?e.projectSlug==null:e.projectSlug===C))return!1;if(g.length){const b=e.tags??[];if(!g.some(C=>b.includes(C)))return!1}if(!T_(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 gc(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const Cd={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 P_(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 f=u.when==="*"?null:n(u.when);f&&s.push(`phaseLadder rung "${u.phase}": invalid condition — ${f}`)}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 f=n(u.when);f&&s.push(`disposition rule "${u.is}": invalid condition — ${f}`)}const c=e.disposition.map((u,f)=>u.when===null?f:-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 RN={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:Cd,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let ec=null,Zo=null;function A_(){return ec?Promise.resolve(ec):Zo||(Zo=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(ec=e,Zo=null,e)).catch(()=>(Zo=null,RN)),Zo)}function pa(){const[e,t]=p.useState(()=>ec??RN);return p.useEffect(()=>{A_().then(t)},[]),e}function uj(){ec=null,Zo=null}function $c(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 dj={critical:0,high:1,medium:2,low:3};function od(e){return Date.parse(e??"")||0}function Lc(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=(dj[o.priority]??99)-(dj[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=od(o.created)-od(i.created);break;case"updated":c=od(o.updated)-od(i.updated);break}return n==="asc"?c:-c})}function D_(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 PN(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 f=D_(u);return t.predicate(f,c)})}const qf={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 Gf(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 $_(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const s=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(s))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:s,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:s,type:"attestation",binds:i})}}return t}function jg(e){const t=[],n=new Map;for(const s of Object.keys(qf))n.set(s,"built-in");for(const s of Object.keys(Mf))n.set(s,"built-in");for(const s of e??[]){const o=((s==null?void 0:s.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(s==null?void 0:s.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(s.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${s.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const m=(s.binds??"none").toString().trim()||"none";if(m!=="plan"&&m!=="commit"&&m!=="none"){t.push(`fact "${o}": invalid binds "${s.binds}" — expected plan, commit, or none`);continue}}const u=Gf(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,f=u.find(m=>n.has(m));if(f!==void 0){const m=n.get(f);m==="built-in"?t.push(`fact "${o}": exported field "${f}" 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 "${f}" collides with fact "${m}"`);continue}for(const m of u)n.set(m,o)}return t}function L_(e){const t=new Set([...Object.keys(qf),...Object.keys(Mf)]),n=[];for(const s of e){const o=Gf(s).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(s)}}return n}function AN(e,t){const n=Gf(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 Jx(e){const t={...qf};for(const n of e)AN(t,n);return t}function DN(e){const t={...Mf};for(const n of e)AN(t,n);return t}function $N(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=Gf(s);s.type==="attestation"?n.push(o.exports.fact,o.exports.approved,o.exports.changesRequested,o.exports.by,o.exports.approvedBy):n.push(o.exports.fact)}return[...t,...n]}function Et({title:e,description:t,actions:n}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:r.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[r.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?r.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Ri='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Yf({columns:e,items:t,getItemId:n,getColumnId:s,renderCard:o,canDrop:i,onMove:c,getExternalDragData:u,onCardContextMenu:f,emptyMessage:m="No cards in this column.",hiddenColumnIds:h,onHideColumn:g,compact:y=!1,dragDisabled:b=!1}){const C=p.useMemo(()=>new Set(h??[]),[h]),j=p.useMemo(()=>e.filter(_=>!C.has(_.id)),[e,C]),v=p.useMemo(()=>e.filter(_=>C.has(_.id)),[e,C]),[k,E]=p.useState(null),[S,T]=p.useState(null),A=p.useRef(null),R=p.useMemo(()=>new Map(t.map(_=>[n(_),_])),[n,t]),P=p.useMemo(()=>j.map(_=>({column:_,items:t.filter(U=>s(U)===_.id)})),[j,s,t]),$=k?R.get(k)??null:null;function I(_){if(!$)return{allowed:!1};const U=s($);return(i==null?void 0:i({item:$,fromColumnId:U,toColumnId:_}))??{allowed:!0}}function M(){E(null),T(null)}function D(_,U,q){if(b)return;const Z=(u==null?void 0:u(U))??null;!c&&!Z||(_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("text/plain",q),Z&&_.dataTransfer.setData("application/json",JSON.stringify(Z)),c&&E(q))}function H(_,U,q){b||!c||!$||!I(U).allowed||(_.preventDefault(),_.dataTransfer.dropEffect="move",T(F=>(F==null?void 0:F.columnId)===U&&F.index===q?F:{columnId:U,index:q}))}async function K(_,U,q){var V;if(_.preventDefault(),b||!c||!$){M();return}const Z=s($),G=(((V=P.find(re=>re.column.id===Z))==null?void 0:V.items)??[]).findIndex(re=>n(re)===n($));if(!I(U).allowed||G<0){M();return}if(Z===U&&(q===G||q===G+1)){M();return}try{await c({item:$,fromColumnId:Z,toColumnId:U,fromIndex:G,toIndex:q})}finally{M()}}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:we("grid min-w-max grid-flow-col gap-4",y?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:P.map(({column:_,items:U})=>{const q=I(_.id),Z=(S==null?void 0:S.columnId)===_.id;return r.jsxs("section",{className:we("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",y?"min-h-[200px] p-2":"min-h-[320px] p-3",$&&!q.allowed?"border-dashed opacity-65":"",$&&q.allowed?"border-primary/30 bg-accent/30":"",Z?"ring-2 ring-ring/30":""),title:$&&!q.allowed?q.reason:void 0,children:[r.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:we("font-semibold uppercase tracking-[0.16em] text-muted-foreground",y?"text-xs":"text-sm"),children:_.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:U.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:F=>H(F,_.id,U.length),onDrop:F=>K(F,_.id,U.length),children:[U.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(O_,{active:(S==null?void 0:S.columnId)===_.id&&S.index===0,disabled:!!$&&!q.allowed,children:typeof m=="function"?m(_):m}):null,U.map((F,G)=>{const L=n(F),V=k===L;return r.jsxs(p.Fragment,{children:[r.jsx("div",{className:we("h-2 rounded-full transition",(S==null?void 0:S.columnId)===_.id&&S.index===G?"bg-primary/70":"bg-transparent"),onDragOver:re=>H(re,_.id,G),onDrop:re=>K(re,_.id,G)}),r.jsx("div",{draggable:!b&&!!(c||u),onMouseDown:re=>{A.current=re.target},onDragStart:re=>{const B=A.current;if(B!=null&&B.closest(Ri)){re.preventDefault();return}D(re,F,L)},onDragEnd:M,onContextMenu:re=>{if(!f)return;const B=re.target;B!=null&&B.closest(Ri)||f(F,re)},className:we("transition",!b&&(c||u)?"cursor-grab active:cursor-grabbing":"",V?"scale-[0.98] opacity-50":""),children:o(F,{dragging:V})})]},L)}),U.length>0&&!b?r.jsx("div",{className:we("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(S==null?void 0:S.columnId)===_.id&&S.index===U.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",$&&!q.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},_.id)})})]})}function O_({active:e,disabled:t,children:n}){return r.jsx("div",{className:we("flex min-h-[128px] items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground transition",e?"border-primary/60 bg-primary/10 text-foreground":"border-border/60 bg-background/50",t?"opacity-45":""),children:n})}const Hl="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Nh="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",I_="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",__="border-status-review-foreground/30 bg-status-review text-status-review-foreground",M_="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",F_="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",z_="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Zd={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:Hl,icon:Oi},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:Hl,icon:EP},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:Hl,icon:yk},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Nh,icon:qP},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Nh,icon:Zg},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:I_,icon:Ld},review:{label:"Review",description:"Ready for inspection or approval.",className:__,icon:JP},completed:{label:"Completed",description:"Finished successfully.",className:M_,icon:Yg},failed:{label:"Failed",description:"Could not be completed as planned.",className:F_,icon:Ld},active:{label:"Active",description:"The project has active or review work in flight.",className:Nh,icon:ng},stopped:{label:"Stopped",description:"Session ended without completing.",className:Hl,icon:NP},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:z_,icon:ng}};function ef(e){const t=Zd[e];return t||{className:Hl,icon:ng,label:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()),description:`Status: ${e}`}}function LN(e,t){return we("inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal","shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]",ef(e).className,t)}function bn({status:e,className:t,showIcon:n=!0,progress:s}){const o=ef(e),i=o.icon,c=s&&s.total>0,u=c?Math.min(1,Math.max(0,s.checked/s.total)):0,f=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:f,className:LN(e,t),children:[m,r.jsx("span",{className:"min-w-0 truncate",children:o.label})]})}function Jf(e){var t;return((t=Zd[e])==null?void 0:t.description)??`Status: ${e}`}const ON={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 Ed=null,Xa=null;function B_(){return Ed?Promise.resolve(Ed):Xa||(Xa=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Ed=e,Xa=null,e)).catch(()=>(Xa=null,ON)),Xa)}function Qf(){const[e,t]=p.useState(()=>Ed??ON);return p.useEffect(()=>{B_().then(t)},[]),e}function ji(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 U_(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}function ma({type:e,className:t,compact:n=!1}){const s=Qf();if(!e)return null;const o=U_(s,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase()),c=o!=null&&o.color?{backgroundColor:`color-mix(in oklch, ${o.color} 18%, transparent)`,borderColor:`color-mix(in oklch, ${o.color} 50%, transparent)`,color:o.color}:void 0;return r.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:c,className:we("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!c&&"border-border/60 text-muted-foreground",t),children:i})}async function Oc(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return V_(e)}function V_(e){try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select(),t.setSelectionRange(0,t.value.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return!1}}function zr({value:e,label:t,disabled:n=!1,disabledReason:s,onError:o}){const[i,c]=p.useState(!1);async function u(){n||(await Oc(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(Od,{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(Od,{className:"h-3 w-3","aria-hidden":"true"})})}function H_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function W_({items:e,statusOrder:t,sortField:n,sortDirection:s,listSectionVisibility:o,compact:i=!1}){const c=pa(),[u,f]=p.useState(()=>new Set(o.collapsed));p.useEffect(()=>{f(new Set(o.collapsed))},[o]);const m=h=>{f(g=>{const y=new Set(g);return y.has(h)?y.delete(h):y.add(h),y})};return r.jsx("div",{className:we("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(h=>{const g=Lc(e.filter(C=>C.status===h),n,s);if(g.length===0)return null;const y=!u.has(h),b=$c(c,h);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[r.jsxs("button",{type:"button",onClick:()=>m(h),className:we("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[r.jsx(fr,{className:we("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",y?"":"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:b}),r.jsx("span",{className:we("rounded-full border border-border/60 text-muted-foreground",i?"px-1.5 py-0 text-[10px]":"px-2 py-0.5 text-xs"),children:g.length})]}),y&&r.jsx("ul",{className:we("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:g.map(C=>{const j=H_(C);return r.jsx("li",{children:r.jsxs(Te,{to:j,className:we("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[r.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:C.title}),C.projectTitle?r.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:C.projectTitle}):null,r.jsx("span",{className:"shrink-0 text-muted-foreground",children:Fn(C.updated)})]})},`${C.projectSlug??"standalone"}:${C.id}`)})})]},h)})})}function K_(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function q_({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=Lc(e,t,n),f=o?"py-2 pr-3":"py-3 pr-4",m=o?"text-xs":"text-sm";return r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:we("w-full text-left",m),children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[c("title")?r.jsx("th",{className:we("font-medium",f),children:"Assignment"}):null,c("status")?r.jsx("th",{className:we("font-medium",f),children:"Status"}):null,c("priority")?r.jsx("th",{className:we("font-medium",f),children:"Priority"}):null,c("assignee")?r.jsx("th",{className:we("font-medium",f),children:"Assignee"}):null,c("dependencies")?r.jsx("th",{className:we("font-medium",f),children:"Dependencies"}):null,c("created")?r.jsx("th",{className:we("font-medium",f),children:"Created"}):null,c("updated")?r.jsx("th",{className:we("font-medium",f),children:"Updated"}):null]})}),r.jsx("tbody",{children:u.map(h=>{const g=K_(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:f,children:[r.jsx(Te,{to:g,className:"font-semibold text-foreground hover:text-primary",children:h.title}),h.projectTitle?r.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:h.projectTitle}):null]}):null,c("status")?r.jsx("td",{className:f,children:r.jsx(bn,{status:h.status,className:"max-w-[150px]"})}):null,c("priority")?r.jsx("td",{className:we("capitalize text-muted-foreground",f),children:h.priority}):null,c("assignee")?r.jsx("td",{className:we("text-muted-foreground",f),children:h.assignee??"Unassigned"}):null,c("dependencies")?r.jsx("td",{className:we("text-muted-foreground",f),children:h.dependsOn.length}):null,c("created")?r.jsx("td",{className:we("text-muted-foreground",f),children:Fn(h.created)}):null,c("updated")?r.jsx("td",{className:we("text-muted-foreground",f),children:Fn(h.updated)}):null]},y)})})]})})}function IN({view:e,compact:t,emptyDescription:n}){const{data:s,loading:o,error:i}=vf(),c=pa(),u=p.useMemo(()=>c.order.map(h=>({id:h,title:$c(c,h),description:Jf(h)})),[c]),f=p.useMemo(()=>DN(c.factDeclarations),[c.factDeclarations]),m=p.useMemo(()=>{if(!s)return[];const h=e.config.filters.query??Xl(e.config.filters);let g=null;h.trim()!==""&&(g=Ox(h,f).query);const y=PN(s.assignments,g,{workspace:e.workspace});return Lc(y,e.config.sortField,e.config.sortDirection)},[s,e,f]);if(o&&!s)return r.jsx(xt,{label:"Loading assignments…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(m.length===0)return r.jsx(Et,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return r.jsx(Yf,{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(G_,{item:h}):r.jsx(Y_,{item:h})});case"list":return r.jsx(W_,{items:m,statusOrder:c.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return r.jsx(q_,{items:m,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function G_({item:e}){const t=gc(e);return r.jsxs("div",{className:we("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Te,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[r.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),r.jsx("span",{className:"shrink-0",children:Fn(e.updated)})]}),e.id?r.jsxs("p",{className:"mt-1 inline-flex items-center gap-1 font-mono text-[10px] text-muted-foreground/70",children:[e.id.slice(0,8),r.jsx(zr,{value:e.id})]}):null]})}function Y_({item:e}){const t=gc(e);return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx(Te,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),r.jsx(bn,{status:e.status,className:"max-w-[150px]"})]}),r.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[r.jsx(ma,{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:Fn(e.updated)})]})]})}function J_({viewId:e,onPickAnother:t}){const{view:n,loading:s,error:o,refetch:i}=jo(e);return s?r.jsx(xt,{label:"Loading view…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),r.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?r.jsx(IN,{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 _N({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:oa.recentSessionsEmptyTitle}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:oa.recentSessionsEmptyHint})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>r.jsx("li",{children:r.jsx(Q_,{session:t})},t.sessionId))})]})}function Q_({session:e}){const t=fn(),[n,s]=p.useState(!1),o=X_(e,t),i=Z_(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(Te,{to:o,className:"block text-sm font-medium text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-sm",children:e.agent}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",Dk(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:oa.recentSessionsCopyFallbackHint})]}):null]}),r.jsx(zr,{value:e.path,label:oa.recentSessionsCopyPathLabel,disabled:c,disabledReason:oa.recentSessionsCopyPathDisabled,onError:()=>s(!0)})]})}function X_(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function Z_(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const e5={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 ea(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function t5(e,t,n=Date.now()){const s=ea(e);if(t.preset){const c=e5[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 n5(e,t,n=Date.now()){const{dateRange:s,project:o,agent:i,sessionStatus:c}=t,u=new Set(o??[]),f=new Set(i??[]),m=new Set(c??[]);return e.filter(h=>{if(s&&!t5(h.started,s,n))return!1;if(u.size>0){const g=h.projectSlug??"__standalone__";if(!u.has(g))return!1}if(f.size>0&&!Array.from(f).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 r5(e,t,n){return[...e].sort((o,i)=>{let c=0;switch(t){case"started":c=ea(o.started)-ea(i.started);break;case"lastActivity":c=ea(o.updatedAt)-ea(i.updatedAt);break;case"projectName":{const u=o.projectSlug??"",f=i.projectSlug??"";c=u.localeCompare(f);break}case"agentName":c=o.agent.localeCompare(i.agent);break;default:c=ea(o.started)-ea(i.started);break}return n==="asc"?c:-c})}function s5(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function o5({view:e,emptyDescription:t}){const{data:n,loading:s,error:o}=wf(),i=p.useMemo(()=>{if(!n)return[];const c=n.sessions??[],{config:u}=e,f=u.filters,m={dateRange:f.dateRange?{...f.dateRange,field:"started"}:void 0,project:ze(f.project),agent:ze(f.agent),sessionStatus:ze(f.sessionStatus),limit:u.limit};let h=n5(c,m);return h=r5(h,u.sortField,u.sortDirection),h=s5(h,u.limit),h},[n,e]);return s&&!n?r.jsx(xt,{label:"Loading sessions…"}):o?r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?r.jsx(Et,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):r.jsx(_N,{sessions:i})}function a5({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:s,loading:o}=Pc(),[i,c]=p.useState(!1),u=p.useRef(null),f=p.useMemo(()=>s.filter(g=>g.entityType==="session"),[s]);p.useEffect(()=>{if(!i)return;function g(b){u.current&&!u.current.contains(b.target)&&c(!1)}function y(b){b.key==="Escape"&&c(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[i]);const m=e?s.find(g=>g.id===e)??null:null,h=o?"Session views…":m?m.name:"Session views";return r.jsxs("div",{className:"relative",ref:u,children:[r.jsxs("button",{type:"button",disabled:o,onClick:()=>c(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":i,title:"Session views",children:[r.jsx("span",{className:"max-w-[160px] truncate",children:h}),r.jsx(fr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&r.jsxs("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:[r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(null)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",!e&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),r.jsx("span",{children:"All sessions"})]}),f.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-1 border-t border-border/40"}),f.map(g=>{const y=g.id===e;return r.jsxs("button",{type:"button",onClick:()=>{c(!1),t(g.id)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",y&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:g.name})]},g.id)})]}),r.jsx("div",{className:"my-1 border-t border-border/40"}),r.jsxs("button",{type:"button",onClick:()=>{c(!1),n()},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5 text-muted-foreground",children:[r.jsx(Lt,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),r.jsx("span",{children:"Create new view…"})]})]})]})}const i5={__unassigned__:"Unassigned",__standalone__:"No project"};function yn({options:e,value:t,onChange:n,allLabel:s="Any",className:o,disabled:i,ariaLabel:c}){const[u,f]=p.useState(!1),m=p.useRef(null),h=p.useRef(null),g=p.useRef([]),y=p.useMemo(()=>{const E=new Set(e.map(T=>T.value)),S=t.filter(T=>!E.has(T)).map(T=>({value:T,label:i5[T]??T}));return[...e,...S]},[e,t]),b=p.useMemo(()=>new Set(t),[t]);p.useEffect(()=>{if(!u)return;function E(S){m.current&&!m.current.contains(S.target)&&f(!1)}return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[u]),p.useEffect(()=>{var E;u&&((E=g.current[0])==null||E.focus())},[u]);const C=p.useMemo(()=>{if(t.length===0)return s;if(t.length===1){const E=y.find(S=>S.value===t[0]);return E?E.label:t[0]}return`${t.length} selected`},[t,y,s]);function j(E){n(b.has(E)?t.filter(S=>S!==E):[...t,E])}function v(E){var T;const S=Math.max(0,Math.min(E,y.length-1));(T=g.current[S])==null||T.focus()}function k(E){var R;const S=g.current,T=document.activeElement,A=S.findIndex(P=>P===T);E.key==="ArrowDown"?(E.preventDefault(),v(A<0?0:A+1)):E.key==="ArrowUp"?(E.preventDefault(),v(A<0?y.length-1:A-1)):E.key==="Home"?(E.preventDefault(),v(0)):E.key==="End"?(E.preventDefault(),v(y.length-1)):E.key==="Escape"&&(E.preventDefault(),f(!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:()=>f(E=>!E),onKeyDown:E=>{!u&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),f(!0))},className:we("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[r.jsx("span",{className:"truncate",children:C}),r.jsx(fr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),u?r.jsxs("div",{role:"menu","aria-label":c,onKeyDown:k,className:"absolute left-0 top-full z-30 mt-1 max-h-72 min-w-[200px] overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===y.length,onClick:()=>n(y.map(E=>E.value)),children:"Select all"}),r.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===0,onClick:()=>n([]),children:"Clear"})]}),y.length===0?r.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):y.map((E,S)=>{const T=b.has(E.value);return r.jsxs("button",{ref:A=>{g.current[S]=A},type:"button",role:"menuitemcheckbox","aria-checked":T,tabIndex:-1,onClick:()=>j(E.value),className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",T?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{className:we("flex h-4 w-4 shrink-0 items-center justify-center rounded border",T?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:T?r.jsx(Rr,{className:"h-3 w-3"}):null}),r.jsx("span",{className:"truncate",children:E.label})]},E.value)})]}):null]})}const fj={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"},l5=["updated","created"];function Xf({value:e,onChange:t,className:n,ariaLabel:s="Date range filter"}){const[o,i]=p.useState(!1),c=p.useRef(null),u=(e==null?void 0:e.field)??"updated",f=!!(e&&!e.preset&&(e.from||e.to)),[m,h]=p.useState(f);p.useEffect(()=>h(f),[f]),p.useEffect(()=>{if(!o)return;function k(S){c.current&&!c.current.contains(S.target)&&i(!1)}function E(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",k),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",E)}},[o]);const g=!!(e&&(e.preset||e.from||e.to)),y=p.useMemo(()=>!g||!e?"Any date":e.preset?`${u}: ${fj[e.preset]??e.preset}`:`${u}: ${e.from||"…"} → ${e.to||"…"}`,[g,e,u]);function b(k){t(e?{...e,field:k}:{field:k,preset:"",from:"",to:""})}function C(k){h(!1),t({field:u,preset:k,from:"",to:""})}function j(){h(!1),t(null)}function v(k,E){const S={field:u,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[k]:E})}return r.jsxs("div",{className:"relative",ref:c,children:[r.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":s,onClick:()=>i(k=>!k),className:we("editor-input inline-flex items-center justify-between gap-1.5 text-left",g&&"border-foreground/40 text-foreground",n),children:[r.jsx("span",{className:"truncate",children:y}),r.jsx(fr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?r.jsxs("div",{className:"absolute left-0 top-full z-30 mt-1 w-64 rounded-md border border-border/70 bg-background p-2 shadow-lg",children:[r.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:l5.map(k=>r.jsx("button",{type:"button","aria-pressed":u===k,onClick:()=>b(k),className:we("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",u===k?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:k},k))}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Ch,{label:"Any date",selected:!g,onClick:j}),J4.map(k=>r.jsx(Ch,{label:fj[k],selected:(e==null?void 0:e.preset)===k,onClick:()=>C(k)},k)),r.jsx(Ch,{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 Ch({label:e,selected:t,onClick:n}){return r.jsxs("button",{type:"button",onClick:n,className:we("flex w-full items-center justify-between gap-2 rounded px-2 py-1.5 text-left text-sm transition hover:bg-foreground/5",t?"text-foreground":"text-muted-foreground"),children:[r.jsx("span",{children:e}),t?r.jsx(Rr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const c5=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function u5(e,t){const n={};for(const[s,o]of Object.entries(e))c5.has(s)||(n[s]=o);return{...n,...t}}function tf(e,t,n){return{...e,viewMode:t.viewMode,filters:u5(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 d5(e,t){var y,b;const n={},s=ze(e.status);s.length&&(n.status=s);const o=ze(e.type);o.length&&(n.type=o);const i=ze(e.priority);i.length&&(n.priority=i);const c=ze(e.assignee);c.length&&(n.assignee=c);const u=ze(e.tags);if(u.length&&(n.tags=u),t&&t!=="all")n.project=[t];else{const C=ze(e.project);C.length&&(n.project=C)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const f=ze(e.sessionStatus);f.length&&(n.sessionStatus=f);const m=ze(e.agent);m.length&&(n.agent=m),e.dateRange&&(n.dateRange=e.dateRange);const h=(y=e.search)==null?void 0:y.trim();h&&(n.search=h);const g=(b=e.query)==null?void 0:b.trim();return g&&(n.query=g),n}function Pi(e){const t={viewMode:e.state.viewMode,filters:d5(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 Za={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},ad={sortField:"started",sortDirection:"desc"};function MN(e,t){const{config:n}=Pi({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 Qx(e,t){const{config:n}=Pi({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 ia(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 Zf(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function FN(e,t){var s,o,i,c,u,f,m,h,g,y,b,C,j,v,k;const{config:n}=e;if((s=t.setViewMode)==null||s.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,ze(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,ze(n.filters.type)),(c=t.setPriorityFilter)==null||c.call(t,ze(n.filters.priority)),(u=t.setAssigneeFilter)==null||u.call(t,ze(n.filters.assignee)),(f=t.setProjectFilter)==null||f.call(t,ze(n.filters.project)),(m=t.setTagsFilter)==null||m.call(t,ze(n.filters.tags)),(h=t.setDateRange)==null||h.call(t,Zf(n.filters.dateRange)),(g=t.setSearch)==null||g.call(t,n.filters.search??""),(y=t.setQuery)==null||y.call(t,n.filters.query??Xl(n.filters)),t.setActivityFilter){const E=n.filters.activity??"all";t.setActivityFilter(E==="fresh"||E==="stale"?E:"all")}(b=t.setSortField)==null||b.call(t,n.sortField),(C=t.setSortDirection)==null||C.call(t,n.sortDirection),(j=t.setListSectionVisibility)==null||j.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(v=t.setKanbanColumnVisibility)==null||v.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(k=t.setTableColumnVisibility)==null||k.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Td(e){return e?`/w/${e}/views`:"/views"}function zN(e){return`${Td(e.workspace)}/${encodeURIComponent(e.id)}`}function BN(e){const t=e.workspace?`/w/${e.workspace}`:"",n=ze(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&U1(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const f5=["critical","high","medium","low"],p5={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 m5(e){if(e.preset)return`${e.field} ${p5[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function UN(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&Zl(t)===null)return`query: ${t}`;const n=[];for(const c of["status","priority","type","assignee","project","tags"]){const u=ze(e[c]);u.length&&n.push(`${c}=${u.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(m5(e.dateRange));const s=(i=e.search)==null?void 0:i.trim();return s&&n.push(`search="${s}"`),n.join(" · ")||"no filters"}const pj=80,h5=["started","lastActivity","projectName","agentName"],g5={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},x5=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function VN({open:e,onOpenChange:t,initialView:n,onSubmit:s}){const o=!!n,{data:i}=Co(),{data:c}=wf(),[u,f]=p.useState(""),[m,h]=p.useState([]),[g,y]=p.useState([]),[b,C]=p.useState([]),[j,v]=p.useState(null),[k,E]=p.useState(ad.sortField),[S,T]=p.useState(ad.sortDirection),[A,R]=p.useState(""),[P,$]=p.useState(!1),[I,M]=p.useState(null);function D(){h([]),y([]),C([]),v(null),E(ad.sortField),T(ad.sortDirection),R("")}p.useEffect(()=>{if(e)if(M(null),$(!1),n){const F=n.config.filters;f(n.name),h(ze(F.project)),y(ze(F.agent)),C(ze(F.sessionStatus)),v(Zf(F.dateRange)),E(n.config.sortField),T(n.config.sortDirection),R(n.config.limit!==void 0?String(n.config.limit):"")}else f(""),D()},[e,n]);const H=p.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(G=>({value:G.slug,label:G.title}))],[i]),K=p.useMemo(()=>{const F=new Set;for(const G of(c==null?void 0:c.sessions)??[])G.agent&&F.add(G.agent);return Array.from(F).sort().map(G=>({value:G,label:G}))},[c]),_=u.trim(),U=_.length>0&&_.length<=pj,q=A.trim()===""?void 0:parseInt(A.trim(),10),Z=A.trim()===""||Number.isFinite(q)&&q!==void 0&&q>0&&q<=500;return r.jsx(zn,{open:e,onOpenChange:t,children:r.jsx($n,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async F=>{if(F.preventDefault(),!U||!Z||P)return;$(!0),M(null);const G=ia(j),L=G?{...G,field:"started"}:void 0,V={filters:{project:m,agent:g,sessionStatus:b,dateRange:L},sortField:k,sortDirection:S,limit:q};try{await s(_,V)}catch(re){M(re instanceof Error?re.message:String(re)),$(!1)}},children:[r.jsx(pr,{children:r.jsx(Ln,{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:pj,onChange:F=>f(F.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(ei,{label:"Date range (session start)",children:r.jsx(Xf,{className:"w-full",value:j,onChange:v})}),r.jsx(ei,{label:"Project",children:r.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:H,value:m,onChange:h})}),r.jsx(ei,{label:"Agent",children:r.jsx(yn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:K,value:g,onChange:y})}),r.jsx(ei,{label:"Session status",children:r.jsx(yn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:x5,value:b,onChange:C})}),r.jsx(ei,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:k,onChange:F=>E(F.target.value),className:"editor-input w-full",children:h5.map(F=>r.jsx("option",{value:F,children:g5[F]??F},F))}),r.jsx("button",{type:"button",onClick:()=>T(F=>F==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),r.jsxs(ei,{label:"Max results",className:"sm:col-span-2",children:[r.jsx("input",{type:"number",min:1,max:500,value:A,onChange:F=>R(F.target.value),placeholder:"No limit",className:"editor-input w-full"}),Z?null:r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),I?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:I}):null,r.jsxs(Vr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:D,className:"shell-action",disabled:P,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:P,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!U||!Z||P,className:"shell-action shell-action--cta disabled:opacity-50",children:P?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function ei({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 y5=4e3;function Ro(){const[e,t]=p.useState(null),n=p.useRef(null),s=p.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),o=p.useCallback((i,c="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:c}),n.current=setTimeout(()=>{t(null),n.current=null},y5)},[]);return p.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:s}}function ha({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:r.jsx("button",{type:"button",onClick:t,className:we("syntaur-toast pointer-events-auto rounded-md border px-4 py-3 text-sm font-medium shadow-lg transition",n?"border-error-foreground/30 bg-error text-error-foreground hover:opacity-90":"border-success-foreground/30 bg-success text-success-foreground hover:opacity-90"),children:e.message},e.id)})}function Eh({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 b5({viewId:e,slotId:t,onPickAnother:n}){const{data:s,loading:o,error:i}=wf(),{view:c,loading:u,ready:f}=jo(e??null),{layout:m}=Y1(),{showToast:h}=Ro(),[g,y]=p.useState(!1),b=p.useCallback(async v=>{if(!t)return;const k=m.slots.map(E=>E.id===t?{...E,widget:v?{kind:"agent-sessions",viewId:v}:{kind:"agent-sessions"}}:E);try{await J1(k)}catch(E){h(E instanceof Error?E.message:"Failed to update widget")}},[m,t,h]);async function C(v,k){const{workspace:E,config:S}=Qx(k,null);try{const A=(await Ci({name:v,workspace:E,config:S,entityType:"session"})).views.find(R=>R.name===v&&R.entityType==="session");A&&await b(A.id),y(!1),h(`Created session view "${v}"`)}catch(T){throw h(T instanceof Error?T.message:"Failed to create session view"),T}}let j;return e?u&&!f?j=r.jsx(xt,{label:"Loading view…"}):c?c.entityType!=="session"?j=r.jsx(Eh,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):j=r.jsx(o5,{view:c,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):j=r.jsx(Eh,{title:"View no longer exists",message:"The saved view this widget was bound to has been deleted. Pick another session view above, or choose a different widget.",onPickAnother:n}):o&&!s?j=r.jsx(xt,{label:"Loading sessions…"}):i?j=r.jsx(Eh,{title:"Couldn't load sessions",message:i}):j=r.jsx(_N,{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(a5,{activeViewId:e??null,onSelectView:v=>void b(v),onCreateNew:()=>y(!0)})}):null,j,r.jsx(VN,{open:g,onOpenChange:y,workspace:null,onSubmit:C})]})}const v5=5;function w5(){const{data:e,loading:t,error:n}=Gk();if(t&&!e)return r.jsx(xt,{label:"Loading inventories…"});if(n)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),r.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,v5);return r.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[r.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[r.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),r.jsx(Te,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?r.jsxs("div",{className:"px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),r.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):r.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const c=i.inventory,u=i.active_leases.length,f=i.members.length,m=c.display_name??c.slug;return r.jsx("li",{children:r.jsxs(Te,{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,"/",f," leased"]})]})},c.slug)})})]})}const Xx={"saved-view":{title:"Saved view",icon:vk,render:(e,t)=>e.kind!=="saved-view"?null:p.createElement(J_,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:mf,render:(e,t)=>e.kind!=="agent-sessions"?null:p.createElement(b5,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:xf,render:()=>p.createElement(w5)}},j5={small:"min-h-[320px]",wide:"xl:col-span-2 min-h-[320px]",tall:"min-h-[560px]",large:"xl:col-span-2 min-h-[560px]"},HN={small:"Small",wide:"Wide",tall:"Tall",large:"Large"};function k5({slot:e,onReplace:t,onRemove:n,onResize:s}){const{attributes:o,listeners:i,setNodeRef:c,setActivatorNodeRef:u,transform:f,transition:m,isDragging:h}=_f({id:e.id}),g={transform:rs.Translate.toString(f),transition:m,zIndex:h?50:void 0,position:h?"relative":void 0},y=r.jsx("button",{ref:u,...o,...i,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(Li,{className:"h-4 w-4","aria-hidden":"true"})}),b=e.size??"small",C=j5[b];if(e.widget===null)return r.jsxs("div",{ref:c,style:g,className:we("relative flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-card/40 p-3 shadow-sm",C,h&&"opacity-0"),children:[r.jsx("div",{className:"absolute left-2 top-2",children:y}),r.jsxs("button",{type:"button",onClick:t,className:"shell-action inline-flex items-center gap-2",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add widget"]})]});const j=Xx[e.widget.kind];if(!j)return r.jsx("div",{ref:c,style:g,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",C,h&&"opacity-0"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[y,r.jsxs("div",{className:"flex-1 rounded-md border border-border/60 bg-background/60 px-3 py-2 text-sm text-muted-foreground",children:["Unknown widget kind: ",e.widget.kind]})]})});const v=j.icon;return r.jsxs("div",{ref:c,style:g,className:we("overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",C,h&&"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:[y,r.jsx(v,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{className:"truncate",children:r.jsx(N5,{slot:e,fallback:j.title})})]}),r.jsx(Yx,{items:[{key:"replace",label:"Replace…",icon:GP,onSelect:t},{key:"size",label:"Size",icon:HP,submenu:AO.map(k=>({key:`size-${k}`,label:HN[k],active:k===b,onSelect:()=>s(k)}))},{key:"remove",label:"Remove",icon:Tn,destructive:!0,onSelect:n}]})]}),r.jsx("div",{children:j.render(e.widget,{slotId:e.id,onPickAnother:t})})]})}function S5({slot:e}){const t=e.widget?Xx[e.widget.kind]:null,n=t==null?void 0:t.icon,s=e.widget===null?"Empty widget slot":(t==null?void 0:t.title)??`Unknown widget kind: ${e.widget.kind}`,o=HN[e.size??"small"];return r.jsx("div",{"aria-hidden":"true",className:"w-72 rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",children:r.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[r.jsx(Li,{className:"h-4 w-4","aria-hidden":"true"}),n?r.jsx(n,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,r.jsx("span",{className:"min-w-0 flex-1 truncate",children:s}),r.jsx("span",{className:"text-[10px] tracking-normal text-muted-foreground/70",children:o})]})})}function N5({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}=jo(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 C5=["agent-sessions","inventories"];function E5({open:e,onOpenChange:t,onSelect:n}){const{views:s,loading:o}=Pc();function i(c){n(c),t(!1)}return r.jsx(zn,{open:e,onOpenChange:t,children:r.jsxs($n,{className:"max-w-xl",children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:"Add a widget"}),r.jsx(Hr,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),r.jsxs("section",{className:"space-y-2",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),r.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:C5.map(c=>{const u=Xx[c],f=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(f,{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(Te,{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 T5=(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 f=c[u+s],m=f===void 0?null:n.droppableRects.get(f),h=n.collisionRect;return!m||!h?t:{x:m.left+(m.width-h.width)/2,y:m.top+(m.height-h.height)/2}};function R5(){const{data:e,error:t,refetch:n}=KA(),{data:s}=Wk(),{layout:o}=Y1(),[i,c]=p.useState(!1),[u,f]=p.useState(null),[m,h]=p.useState(null),[g,y]=p.useState(o.slots),[b,C]=p.useState(null);p.useEffect(()=>{y(o.slots)},[o.slots]);const j=Pf(wo(Bi,{activationConstraint:{distance:8}}),wo(zi,{coordinateGetter:T5}));To("list:overview"),Yt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const v=p.useCallback(I=>{f(I),c(!0)},[]),k=p.useCallback(async(I,M)=>{h(null),y(I);try{await J1(I)}catch(D){y(M),h(D instanceof Error?D.message:String(D))}},[]),E=p.useCallback(I=>{if(u===null)return;const M=g.map((D,H)=>H===u?{...D,widget:I}:D);f(null),k(M,g)},[g,u,k]),S=p.useCallback(I=>{const M=g.map((D,H)=>H===I?{...D,widget:null}:D);k(M,g)},[g,k]),T=p.useCallback((I,M)=>{const D=g.map((H,K)=>K===I?{...H,size:M}:H);k(D,g)},[g,k]),A=p.useCallback(I=>{const{active:M,over:D}=I;if(C(null),!D||M.id===D.id)return;const H=g.findIndex(U=>U.id===M.id),K=g.findIndex(U=>U.id===D.id);if(H===-1||K===-1)return;const _=Ui(g,H,K);k(_,g)},[g,k]),R=p.useCallback(I=>{C(String(I.active.id))},[]),P=g.find(I=>I.id===b)??null,$={};if(e)for(const I of Object.keys(e.segments))for(const M of e.segments[I].items)$[M.id]=M;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(W4,{hero:e.hero,itemsById:$}):t?r.jsx(Tt,{error:t}):r.jsx(xt,{label:"Loading overview…"}),e!=null&&e.firstRun?r.jsx(V4,{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(Of,{sensors:j,collisionDetection:Af,onDragStart:R,onDragCancel:()=>C(null),onDragEnd:A,children:[r.jsx(If,{items:g.map(I=>I.id),strategy:Dx,children:r.jsx("div",{className:"grid grid-flow-dense grid-cols-1 gap-4 xl:grid-cols-2",children:g.map((I,M)=>r.jsx(k5,{slot:I,index:M,onReplace:()=>v(M),onRemove:()=>S(M),onResize:D=>T(M,D)},I.id))})}),r.jsx(R4,{dropAnimation:null,children:P?r.jsx(S5,{slot:P}):null})]}),e!=null&&e.serverStats?r.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(ex,{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(E5,{open:i,onOpenChange:I=>{c(I),I||f(null)},onSelect:E})]})}function P5({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 A5(){const{data:e,loading:t,error:n}=Wk(),{openCheatsheet:s}=Eo();return t?r.jsx(xt,{label:"Loading help…"}):n||!e?r.jsx(Tt,{error:n||"Help content is unavailable."}):r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("button",{type:"button",onClick:s,className:"inline-flex items-center gap-2 rounded-md border border-border/70 bg-background/80 px-3 py-1.5 text-sm font-medium text-foreground hover:bg-accent",children:"Open shortcuts cheatsheet"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",js("Mod+k")," opens the command palette."]})]})}),r.jsx(He,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:r.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),r.jsx(He,{title:"Getting Started",children:r.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(kd,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?r.jsx(Te,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(He,{title:"Core Concepts",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>r.jsx(P5,{term:o.term,description:o.description},o.term))}),r.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),r.jsx(He,{title:"Status Guide",children:r.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),r.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),r.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"Ownership And File Rules",children:r.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>r.jsx("span",{className:"rounded-full border border-border/60 bg-card/90 px-2.5 py-1 font-mono text-xs text-foreground",children:i},i))})]},o.label))})}),r.jsx(He,{title:"How To Navigate The Dashboard",children:r.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),r.jsx(Te,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),r.jsx(He,{title:"CLI Quick Reference",children:r.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>r.jsx(kd,{command:o.command,description:o.description,example:o.example},o.command))})}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsx(He,{title:"FAQ",children:r.jsx("div",{className:"space-y-3",children:e.faq.map(o=>r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),r.jsx(He,{title:"First Project Checklist",children:r.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-foreground text-xs font-semibold text-background",children:i+1}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),r.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?r.jsx(kd,{command:o.command.command,example:o.command.example}):null,o.href?r.jsx(Te,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Zx({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 ep=p.forwardRef(({value:e,onChange:t,placeholder:n="Search"},s)=>r.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[r.jsx(No,{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"})]}));ep.displayName="SearchInput";function tp({value:e,options:t,onChange:n}){return r.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(s=>r.jsx("button",{type:"button","aria-pressed":e===s.value,onClick:()=>n(s.value),className:we("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===s.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:s.label},s.value))})}const D5={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"},mj=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function nf({progress:e,className:t,showLegend:n=!1}){const s=pa(),o=p.useMemo(()=>{let c=0;return(s.order.length>0?s.order:Object.keys(e).filter(f=>f!=="total")).map(f=>({key:f,className:D5[f]??mj[c++%mj.length]}))},[s.order,e]),i=o.filter(c=>(e[c.key]??0)>0);return r.jsxs("div",{className:we("space-y-2",t),children:[r.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?r.jsx("div",{className:"h-full w-full bg-muted"}):i.map(c=>r.jsx("div",{className:c.className,style:{width:`${(e[c.key]??0)/e.total*100}%`},title:`${Sn(c.key)}: ${e[c.key]??0}`},c.key))}),n?r.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.map(c=>r.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[r.jsx("span",{className:we("h-2 w-2 rounded-full",c.className)}),r.jsx("span",{children:Sn(c.key)}),r.jsx("span",{className:"font-medium text-foreground",children:e[c.key]??0})]},c.key))}):null]})}const $5=["pending","active","blocked","failed","completed"],ey=$5,L5=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function WN(e){return e&&e.length>0?e:[...L5]}function O5(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 I5=220,id=8;function KN({anchor:e,items:t,onClose:n}){const s=p.useRef(null),[o,i]=p.useState(null);return p.useLayoutEffect(()=>{if(!e){i(null);return}const c=s.current,u=(c==null?void 0:c.offsetWidth)??I5,f=(c==null?void 0:c.offsetHeight)??0,m=Math.max(id,window.innerWidth-u-id),h=Math.max(id,window.innerHeight-f-id);i({left:Math.min(e.x,m),top:Math.min(e.y,h)})},[e]),p.useEffect(()=>{if(!e)return;function c(m){s.current&&!s.current.contains(m.target)&&n()}function u(m){m.key==="Escape"&&n()}function f(){n()}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),document.addEventListener("contextmenu",c),window.addEventListener("scroll",f,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u),document.removeEventListener("contextmenu",c),window.removeEventListener("scroll",f,!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(aa,{delayDuration:200,children:t.map(c=>{const u=c.icon,f=we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",c.disabled?"cursor-not-allowed opacity-50":c.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),m=r.jsxs(r.Fragment,{children:[u?r.jsx(u,{className:"h-4 w-4 shrink-0"}):null,r.jsx("span",{className:"block min-w-0 truncate",children:c.label})]});if(c.disabled){const h=r.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:r.jsx("button",{type:"button",disabled:!0,className:f,children:m})});return c.disabledReason?r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:h}),r.jsx(cr,{side:"left",children:c.disabledReason})]},c.key):r.jsx("div",{children:h},c.key)}return c.href?r.jsx(Te,{to:c.href,className:f,onClick:()=>n(),children:m},c.key):r.jsx("button",{type:"button",className:f,onClick:()=>{var h;(h=c.onSelect)==null||h.call(c),n()},children:m},c.key)})})})}const _5="__ungrouped__";function ty({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}=Sc(),[f,m]=p.useState(n),[h,g]=p.useState(!1),[y,b]=p.useState(null);p.useEffect(()=>{e&&(m(n),b(null))},[e,n]);const C=p.useMemo(()=>[...((c==null?void 0:c.workspaces)??[]).map(E=>({key:E,label:E,value:E})),{key:_5,label:"Ungrouped",value:null}],[c]),j=!h&&f!==n;async function v(){if(j){g(!0),b(null);try{await s(f),t(!1)}catch(k){b(k instanceof Error?k.message:"Failed to move item")}finally{g(!1)}}}return r.jsx(zn,{open:e,onOpenChange:k=>h?void 0:t(k),children:r.jsxs($n,{children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:o}),r.jsx(Hr,{children:i})]}),r.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:u&&C.length===0?r.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[r.jsx(Zg,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):C.map(k=>{const E=k.value===n,S=k.value===f;return r.jsxs("button",{type:"button",disabled:E||h,onClick:()=>m(k.value),className:we("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",E?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:we("block min-w-0 truncate",k.value===null?"italic text-muted-foreground":""),children:[k.label,E?r.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?r.jsx(Rr,{className:"h-4 w-4 text-foreground"}):null]},k.key)})}),y?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:y}):null,r.jsxs(Vr,{children:[r.jsx("button",{type:"button",onClick:()=>t(!1),disabled:h,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:v,disabled:!j,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving…":"Move"})]})]})})}function hj(){const{workspace:e}=Bt(),t=fn(),n=zt(),{data:s,loading:o,error:i,refetch:c}=Co(),u=p.useRef(null);To("list:projects");const[f,m]=p.useState(""),[h,g]=p.useState("all"),[y,b]=p.useState("all"),[C,j]=p.useState("updated"),[v,k]=Ns(),E=v.get("view"),S=E==="table"||E==="kanban"?E:"cards",T=F=>{k(G=>{const L=new URLSearchParams(G);return F==="cards"?L.delete("view"):L.set("view",F),L})},[A,R]=p.useState({}),[P,$]=p.useState(null),[I,M]=p.useState(null),D=p.useMemo(()=>s?s.filter(F=>{if(e){if(e==="_ungrouped"){if(F.workspace!==null)return!1}else if(F.workspace!==e)return!1}return h!=="all"&&F.status!==h||y!=="all"&&!F.tags.includes(y)?!1:f.trim()?`${F.title} ${F.tags.join(" ")} ${F.slug}`.toLowerCase().includes(f.toLowerCase()):!0}).sort((F,G)=>z5(F,G,C)):[],[s,f,h,y,C,e]),H=D.map(F=>`${F.slug}:${F.status}`).join("|");p.useEffect(()=>{R(B5(D))},[H,C]);const K=p.useMemo(()=>{const F=new Map(D.map(G=>[G.slug,G]));return ey.flatMap(G=>(A[G]??D.filter(V=>V.status===G).map(V=>V.slug)).map(V=>F.get(V)).filter(V=>!!V))},[D,A]),{visibleItems:_,visibleIndexByKey:U}=p.useMemo(()=>{const F=S==="kanban"?K:D,G=new Map;return F.forEach((L,V)=>G.set(L.slug,V)),{visibleItems:F,visibleIndexByKey:G}},[S,D,K]),{hotkeyRowProps:q}=Nc(_,{scope:"list:projects",onOpen:F=>n(`${t}/projects/${F.slug}`)});if(Yt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var F;return(F=u.current)==null?void 0:F.focus()}}),Yt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>c()}),o)return r.jsx(xt,{label:"Loading projects…"});if(i||!s)return r.jsx(Tt,{error:i||"Project list is unavailable."});const Z=Array.from(new Set(s.flatMap(F=>F.tags))).sort();return r.jsxs("div",{className:"space-y-5",children:[r.jsxs(Zx,{children:[r.jsx(ep,{ref:u,value:f,onChange:m,placeholder:"Search by project title or tag"}),r.jsxs("select",{value:h,onChange:F=>g(F.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:F=>b(F.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All tags"}),Z.map(F=>r.jsx("option",{value:F,children:F},F))]}),r.jsxs("select",{value:C,onChange:F=>j(F.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(tp,{value:S,onChange:F=>T(F),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(Te,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),r.jsx(Te,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):r.jsx(Et,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:r.jsx(Te,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):S==="cards"?r.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:D.map((F,G)=>r.jsxs(Te,{to:`${t}/projects/${F.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...q(G),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:F.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Fn(F.updated)]})]}),r.jsx(bn,{status:F.status})]}),r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsx(nf,{progress:F.progress,showLegend:!0}),r.jsx("div",{className:"flex flex-wrap gap-2",children:F.tags.map(L=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:L},L))}),r.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[r.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[r.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),r.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.needsAttention.blockedCount+F.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:F.progress.total})]})]})]})]},F.slug))}):S==="table"?r.jsx(He,{title:`${D.length} project${D.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"pb-3 font-medium",children:"Project"}),r.jsx("th",{className:"pb-3 font-medium",children:"Status"}),r.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),r.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),r.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:D.map((F,G)=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",...q(G),children:[r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(Te,{to:`${t}/projects/${F.slug}`,className:"font-semibold text-foreground hover:text-primary",children:F.title}),r.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:F.tags.map(L=>r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:L},L))})]}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx(bn,{status:F.status})}),r.jsx("td",{className:"py-4 pr-4",children:r.jsx("div",{className:"min-w-[220px]",children:r.jsx(nf,{progress:F.progress})})}),r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount}),r.jsx("td",{className:"py-4 text-muted-foreground",children:Fn(F.updated)})]},F.slug))})]})})}):r.jsx(Yf,{columns:F5,items:K,getItemId:F=>F.slug,getColumnId:F=>F.status,canDrop:({fromColumnId:F,toColumnId:G})=>({allowed:!0,reason:F===G?void 0:"This will set a manual status override on the project."}),onMove:({item:F,fromColumnId:G,toColumnId:L,fromIndex:V,toIndex:re})=>{if(G===L){const B=A[G]??D.filter(ue=>ue.status===G).map(ue=>ue.slug);R(ue=>({...ue,[G]:O5(B,V,re)}));return}fetch(`/api/projects/${F.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:L})}).then(()=>{window.location.reload()})},getExternalDragData:F=>({type:"project",id:F.slug}),onCardContextMenu:(F,G)=>{G.preventDefault(),$({project:F,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:F=>`No ${F.title.toLowerCase()} projects.`,renderCard:(F,{dragging:G})=>{const L=U.get(F.slug)??-1;return r.jsx("div",{...L>=0?q(L):{},children:r.jsx(U5,{project:F,dragging:G})})}}),r.jsx(KN,{anchor:(P==null?void 0:P.anchor)??null,items:P?[{key:"edit",label:"Edit",icon:Oi,onSelect:()=>n(`${t}/projects/${P.project.slug}`)},{key:"move",label:"Move to workspace…",icon:gf,onSelect:()=>M(P.project)}]:[],onClose:()=>$(null)}),r.jsx(ty,{open:I!==null,onOpenChange:F=>{F||M(null)},currentWorkspace:(I==null?void 0:I.workspace)??null,title:"Move project to workspace",onSubmit:async F=>{if(!I)return;const G=await fetch(`/api/projects/${encodeURIComponent(I.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:F})});if(!G.ok){const L=await G.json().catch(()=>({}));throw new Error(L.error||"Failed to move project")}c()}}),r.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Xg,{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 M5={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},F5=ey.map(e=>({id:e,title:M5[e],description:Jf(e)}));function z5(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return gj(t)-gj(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function gj(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function B5(e){return Object.fromEntries(ey.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function U5({project:e,dragging:t}){const n=fn();return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(Te,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Fn(e.updated)]})]}),r.jsx(bn,{status:e.status})]}),r.jsx("div",{className:"mt-4",children:r.jsx(nf,{progress:e.progress})}),r.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(s=>r.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:s},s)),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),r.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.needsAttention.blockedCount+e.needsAttention.failedCount," needs attention"]})]}),r.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function rf({title:e,description:t,actions:n,className:s}){return r.jsxs("div",{className:we("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",s),children:[r.jsxs("div",{className:"space-y-1",children:[e?r.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function V5(){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(hf,{className:"h-3 w-3"}),"Archived"]})}function xj(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function H5(){const{data:e,loading:t,error:n,refetch:s}=qA(),[o,i]=p.useState(null),[c,u]=p.useState(null),[f,m]=p.useState({}),{toast:h,showToast:g,dismissToast:y}=Ro();async function b(S,T,A){i(T),u(null);try{const R=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!R.ok){const P=await R.json().catch(()=>null);throw new Error((P==null?void 0:P.error)||`HTTP ${R.status}`)}s(),g(A,"success")}catch(R){u(R instanceof Error?R.message:"Restore failed")}finally{i(null)}}function C(S){return b(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function j(S){const T=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return b(T,`assignment:${S.id}`,"Assignment restored")}if(t)return r.jsx(xt,{label:"Loading archived content…"});if(n)return r.jsx(Tt,{error:n});const v=(e==null?void 0:e.projects)??[],k=(e==null?void 0:e.assignments)??[],E=v.length===0&&k.length===0;return r.jsxs("div",{className:"space-y-6",children:[r.jsx(ha,{toast:h,onDismiss:y}),r.jsx(rf,{title:"Archive",description:"Archived projects and individually-archived assignments. Restoring a project also brings back its cascade-hidden assignments; assignments archived on their own stay archived until restored here."}),c?r.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:c}):null,E?r.jsx(Et,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):r.jsxs(r.Fragment,{children:[v.length>0&&r.jsx(He,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:r.jsx("ul",{className:"divide-y divide-border",children:v.map(S=>{const T=f[S.slug]??!1;return r.jsxs("li",{className:"py-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs("button",{type:"button",onClick:()=>m(A=>({...A,[S.slug]:!T})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":T,children:[T?r.jsx(fr,{className:"h-4 w-4"}):r.jsx(gk,{className:"h-4 w-4"}),r.jsx(Jg,{className:"h-4 w-4 text-muted-foreground"}),S.title,r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?Br(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(Te,{to:`/projects/${S.slug}`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Open"}),r.jsxs("button",{type:"button",onClick:()=>C(S),disabled:o===`project:${S.slug}`,className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(Ad,{className:"h-3 w-3"}),"Restore"]})]})]}),T&&S.assignments.length>0&&r.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(A=>r.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[r.jsx(Te,{to:xj(A),className:"text-foreground hover:text-foreground/80",children:A.title}),r.jsx(bn,{status:A.status,showIcon:!1}),r.jsx("span",{className:"text-xs text-muted-foreground",children:A.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},A.id))})]},S.slug)})})}),k.length>0&&r.jsx(He,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:r.jsx("ul",{className:"divide-y divide-border",children:k.map(S=>r.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[r.jsx(Te,{to:xj(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(V5,{}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Br(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),r.jsxs("button",{type:"button",onClick:()=>j(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[r.jsx(Ad,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const yj="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",bj="block min-w-0 truncate";function ny({externalIds:e,className:t}){return e.length===0?null:r.jsx("span",{className:we("flex flex-wrap items-center gap-1.5",t),children:e.map((n,s)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${s}`;return n.url!=null&&n.url.length>0?r.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:we(yj,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[r.jsx("span",{className:bj,children:o}),r.jsx($i,{className:"h-2.5 w-2.5 shrink-0"})]},i):r.jsx("span",{className:yj,title:o,children:r.jsx("span",{className:bj,children:o})},i)})})}const W5={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 Mn({label:e,value:t,description:n,icon:s,tone:o="default",to:i}){const c=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),r.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),s?r.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:r.jsx(s,{className:"h-5 w-5"})}):null]}),n?r.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),u=we(W5[o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?r.jsx(Te,{to:i,className:u,children:c}):r.jsx("article",{className:u,children:c})}function vj(e){const t=K5(e),n=p.forwardRef((s,o)=>{const{children:i,...c}=s,u=p.Children.toArray(i),f=u.find(G5);if(f){const m=f.props.children,h=u.map(g=>g===f?p.Children.count(m)>1?p.Children.only(null):p.isValidElement(m)?m.props.children:null:g);return r.jsx(t,{...c,ref:o,children:p.isValidElement(m)?p.cloneElement(m,void 0,h):null})}return r.jsx(t,{...c,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function K5(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const c=J5(o),u=Y5(i,o.props);return o.type!==p.Fragment&&(u.ref=s?kf(s,c):c),p.cloneElement(o,u)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var q5=Symbol("radix.slottable");function G5(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===q5}function Y5(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 f=i(...u);return o(...u),f}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function J5(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 Q5(e){const t=e+"CollectionProvider",[n,s]=da(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=j=>{const{scope:v,children:k}=j,E=Dt.useRef(null),S=Dt.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:S,collectionRef:E,children:k})};c.displayName=t;const u=e+"CollectionSlot",f=vj(u),m=Dt.forwardRef((j,v)=>{const{scope:k,children:E}=j,S=i(u,k),T=qn(v,S.collectionRef);return r.jsx(f,{ref:T,children:E})});m.displayName=u;const h=e+"CollectionItemSlot",g="data-radix-collection-item",y=vj(h),b=Dt.forwardRef((j,v)=>{const{scope:k,children:E,...S}=j,T=Dt.useRef(null),A=qn(v,T),R=i(h,k);return Dt.useEffect(()=>(R.itemMap.set(T,{ref:T,...S}),()=>void R.itemMap.delete(T))),r.jsx(y,{[g]:"",ref:A,children:E})});b.displayName=h;function C(j){const v=i(e+"CollectionConsumer",j);return Dt.useCallback(()=>{const E=v.collectionRef.current;if(!E)return[];const S=Array.from(E.querySelectorAll(`[${g}]`));return Array.from(v.itemMap.values()).sort((R,P)=>S.indexOf(R.ref.current)-S.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:m,ItemSlot:b},C,s]}var X5=p.createContext(void 0);function qN(e){const t=p.useContext(X5);return e||t||"ltr"}var Th="rovingFocusGroup.onEntryFocus",Z5={bubbles:!1,cancelable:!0},Ic="RovingFocusGroup",[kg,GN,eM]=Q5(Ic),[tM,YN]=da(Ic,[eM]),[nM,rM]=tM(Ic),JN=p.forwardRef((e,t)=>r.jsx(kg.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(kg.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(sM,{...e,ref:t})})}));JN.displayName=Ic;var sM=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:u,onCurrentTabStopIdChange:f,onEntryFocus:m,preventScrollOnEntryFocus:h=!1,...g}=e,y=p.useRef(null),b=qn(t,y),C=qN(i),[j,v]=Sf({prop:c,defaultProp:u??null,onChange:f,caller:Ic}),[k,E]=p.useState(!1),S=la(m),T=GN(n),A=p.useRef(!1),[R,P]=p.useState(0);return p.useEffect(()=>{const $=y.current;if($)return $.addEventListener(Th,S),()=>$.removeEventListener(Th,S)},[S]),r.jsx(nM,{scope:n,orientation:s,dir:C,loop:o,currentTabStopId:j,onItemFocus:p.useCallback($=>v($),[v]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>P($=>$+1),[]),onFocusableItemRemove:p.useCallback(()=>P($=>$-1),[]),children:r.jsx(vn.div,{tabIndex:k||R===0?-1:0,"data-orientation":s,...g,ref:b,style:{outline:"none",...e.style},onMouseDown:Xt(e.onMouseDown,()=>{A.current=!0}),onFocus:Xt(e.onFocus,$=>{const I=!A.current;if($.target===$.currentTarget&&I&&!k){const M=new CustomEvent(Th,Z5);if($.currentTarget.dispatchEvent(M),!M.defaultPrevented){const D=T().filter(q=>q.focusable),H=D.find(q=>q.active),K=D.find(q=>q.id===j),U=[H,K,...D].filter(Boolean).map(q=>q.ref.current);ZN(U,h)}}A.current=!1}),onBlur:Xt(e.onBlur,()=>E(!1))})})}),QN="RovingFocusGroupItem",XN=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:c,...u}=e,f=gi(),m=i||f,h=rM(QN,n),g=h.currentTabStopId===m,y=GN(n),{onFocusableItemAdd:b,onFocusableItemRemove:C,currentTabStopId:j}=h;return p.useEffect(()=>{if(s)return b(),()=>C()},[s,b,C]),r.jsx(kg.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:Xt(e.onMouseDown,v=>{s?h.onItemFocus(m):v.preventDefault()}),onFocus:Xt(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:Xt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){h.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=iM(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?lM(S,T+1):S.slice(T+1)}setTimeout(()=>ZN(S))}}),children:typeof c=="function"?c({isCurrentTabStop:g,hasTabStop:j!=null}):c})})});XN.displayName=QN;var oM={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function aM(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function iM(e,t,n){const s=aM(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return oM[s]}function ZN(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function lM(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var cM=JN,uM=XN,np="Tabs",[dM]=da(np,[YN]),eC=YN(),[fM,ry]=dM(np),tC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:c="horizontal",dir:u,activationMode:f="automatic",...m}=e,h=qN(u),[g,y]=Sf({prop:s,onChange:o,defaultProp:i??"",caller:np});return r.jsx(fM,{scope:n,baseId:gi(),value:g,onValueChange:y,orientation:c,dir:h,activationMode:f,children:r.jsx(vn.div,{dir:h,"data-orientation":c,...m,ref:t})})});tC.displayName=np;var nC="TabsList",rC=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=ry(nC,n),c=eC(n);return r.jsx(cM,{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})})});rC.displayName=nC;var sC="TabsTrigger",oC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,c=ry(sC,n),u=eC(n),f=lC(c.baseId,s),m=cC(c.baseId,s),h=s===c.value;return r.jsx(uM,{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:f,...i,ref:t,onMouseDown:Xt(e.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?c.onValueChange(s):g.preventDefault()}),onKeyDown:Xt(e.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&c.onValueChange(s)}),onFocus:Xt(e.onFocus,()=>{const g=c.activationMode!=="manual";!h&&!o&&g&&c.onValueChange(s)})})})});oC.displayName=sC;var aC="TabsContent",iC=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...c}=e,u=ry(aC,n),f=lC(u.baseId,s),m=cC(u.baseId,s),h=s===u.value,g=p.useRef(h);return p.useEffect(()=>{const y=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(y)},[]),r.jsx(fa,{present:o||h,children:({present:y})=>r.jsx(vn.div,{"data-state":h?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":f,hidden:!y,id:m,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:g.current?"0s":void 0},children:y&&i})})});iC.displayName=aC;function lC(e,t){return`${e}-trigger-${t}`}function cC(e,t){return`${e}-content-${t}`}var uC=tC,dC=rC,Sg=oC,Ng=iC;function sy({value:e,onValueChange:t,items:n,className:s}){return r.jsxs(uC,{value:e,onValueChange:t,className:s,children:[r.jsx(dC,{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(Sg,{value:o.value,className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:[r.jsx("span",{children:o.label}),typeof o.count=="number"?r.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:o.count}):null]},o.value))}),n.map(o=>r.jsx(Ng,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const pM="modulepreload",mM=function(e){return"/"+e},wj={},hM=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]"),f=(u==null?void 0:u.nonce)||(u==null?void 0:u.getAttribute("nonce"));o=c(n.map(m=>{if(m=mM(m),m in wj)return;wj[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":pM,h||(y.as="script"),y.crossOrigin="",y.href=m,f&&y.setAttribute("nonce",f),document.head.appendChild(y),h)return new Promise((b,C)=>{y.addEventListener("load",b),y.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function i(c){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=c,window.dispatchEvent(u),!u.defaultPrevented)throw c}return o.then(c=>{for(const u of c||[])u.status==="rejected"&&i(u.reason);return t().catch(i)})};function gM({definition:e,className:t,nodeRoutes:n={}}){const s=p.useRef(null),[o,i]=p.useState(null),[c,u]=p.useState(!0),f=zt(),m=document.documentElement.classList.contains("dark")?"dark":"default";return p.useEffect(()=>{let h=!1;async function g(){if(s.current)try{const y=(await hM(async()=>{const{default:j}=await import("./mermaid.core-_rgvEzla.js").then(v=>v.bF);return{default:j}},[])).default;if(y.initialize({startOnLoad:!1,theme:"base",themeVariables:xM(m==="dark")}),h)return;const b=`mermaid-${Date.now()}`,{svg:C}=await y.render(b,e);if(h||!s.current)return;s.current.innerHTML=C,yM(s.current,n,f),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,f,n,m]),o?r.jsxs("div",{className:we("rounded-lg border border-border bg-card p-4",t),children:[r.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),r.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):r.jsxs("div",{className:we("rounded-lg border border-border bg-card p-4",t),children:[c&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),r.jsx("div",{ref:s,className:"overflow-auto"})]})}function xM(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"),f=n("--muted"),m=n("--muted-foreground"),h=n("--secondary");return{background:s,primaryColor:s,primaryTextColor:o,primaryBorderColor:i,secondaryColor:f,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:f,tertiaryTextColor:m,tertiaryBorderColor:i,lineColor:e?m:i,textColor:o,mainBkg:s,nodeBkg:s,nodeTextColor:o,nodeBorder:i,clusterBkg:f,clusterBorder:i,edgeLabelBackground:s,titleColor:o,activeTaskBkgColor:c,activeTaskBorderColor:c,altBackground:f,labelColor:o,errorBkgColor:h,errorTextColor:u}}function yM(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",f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),u())})}}function bM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const vM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,wM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jM={};function jj(e,t){return(jM.jsx?wM:vM).test(e)}const kM=/[ \t\n\f\r]/g;function SM(e){return typeof e=="object"?e.type==="text"?kj(e.value):!1:kj(e)}function kj(e){return e.replace(kM,"")===""}class _c{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}_c.prototype.normal={};_c.prototype.property={};_c.prototype.space=void 0;function fC(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new _c(n,s,t)}function Cg(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 NM=0;const mt=ga(),gn=ga(),Eg=ga(),Re=ga(),Vt=ga(),ki=ga(),vr=ga();function ga(){return 2**++NM}const Tg=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:gn,commaOrSpaceSeparated:vr,commaSeparated:ki,number:Re,overloadedBoolean:Eg,spaceSeparated:Vt},Symbol.toStringTag,{value:"Module"})),Rh=Object.keys(Tg);class oy extends mr{constructor(t,n,s,o){let i=-1;if(super(t,n),Sj(this,"space",o),typeof s=="number")for(;++i<Rh.length;){const c=Rh[i];Sj(this,Rh[i],(s&Tg[c])===Tg[c])}}}oy.prototype.defined=!0;function Sj(e,t,n){n&&(e[t]=n)}function Wi(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new oy(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Cg(s)]=s,n[Cg(i.attribute)]=s}return new _c(t,n,e.space)}const pC=Wi({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:Re,ariaColIndex:Re,ariaColSpan:Re,ariaControls:Vt,ariaCurrent:null,ariaDescribedBy:Vt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:Vt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:Vt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vt,ariaLevel:Re,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:Vt,ariaPlaceholder:null,ariaPosInSet:Re,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:Vt,ariaRowCount:Re,ariaRowIndex:Re,ariaRowSpan:Re,ariaSelected:gn,ariaSetSize:Re,ariaSort:null,ariaValueMax:Re,ariaValueMin:Re,ariaValueNow:Re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mC(e,t){return t in e?e[t]:t}function hC(e,t){return mC(e,t.toLowerCase())}const CM=Wi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ki,acceptCharset:Vt,accessKey:Vt,action:null,allow:null,allowFullScreen:mt,allowPaymentRequest:mt,allowUserMedia:mt,alt:null,as:null,async:mt,autoCapitalize:null,autoComplete:Vt,autoFocus:mt,autoPlay:mt,blocking:Vt,capture:null,charSet:null,checked:mt,cite:null,className:Vt,cols:Re,colSpan:null,content:null,contentEditable:gn,controls:mt,controlsList:Vt,coords:Re|ki,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mt,defer:mt,dir:null,dirName:null,disabled:mt,download:Eg,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mt,formTarget:null,headers:Vt,height:Re,hidden:Eg,high:Re,href:null,hrefLang:null,htmlFor:Vt,httpEquiv:Vt,id:null,imageSizes:null,imageSrcSet:null,inert:mt,inputMode:null,integrity:null,is:null,isMap:mt,itemId:null,itemProp:Vt,itemRef:Vt,itemScope:mt,itemType:Vt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mt,low:Re,manifest:null,max:null,maxLength:Re,media:null,method:null,min:null,minLength:Re,multiple:mt,muted:mt,name:null,nonce:null,noModule:mt,noValidate:mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mt,optimum:Re,pattern:null,ping:Vt,placeholder:null,playsInline:mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mt,referrerPolicy:null,rel:Vt,required:mt,reversed:mt,rows:Re,rowSpan:Re,sandbox:Vt,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootClonable:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shape:null,size:Re,sizes:null,slot:null,span:Re,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Re,step:null,style:null,tabIndex:Re,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:gn,width:Re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vt,axis:null,background:null,bgColor:null,border:Re,borderColor:null,bottomMargin:Re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mt,declare:mt,event:null,face:null,frame:null,frameBorder:null,hSpace:Re,leftMargin:Re,link:null,longDesc:null,lowSrc:null,marginHeight:Re,marginWidth:Re,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:Re,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:Re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:mt,disableRemotePlayback:mt,prefix:null,property:null,results:Re,security:null,unselectable:null},space:"html",transform:hC}),EM=Wi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:vr,accentHeight:Re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Re,amplitude:Re,arabicForm:null,ascent:Re,attributeName:null,attributeType:null,azimuth:Re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Re,by:null,calcMode:null,capHeight:Re,className:Vt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Re,diffuseConstant:Re,direction:null,display:null,dur:null,divisor:Re,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Re,enableBackground:null,end:null,event:null,exponent:Re,externalResourcesRequired:null,fill:null,fillOpacity:Re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ki,g2:ki,glyphName:ki,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Re,horizOriginX:Re,horizOriginY:Re,id:null,ideographic:Re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Re,k:Re,k1:Re,k2:Re,k3:Re,k4:Re,kernelMatrix:vr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Re,overlineThickness:Re,paintOrder:null,panose1:null,path:null,pathLength:Re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Re,pointsAtY:Re,pointsAtZ:Re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:vr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:vr,rev:vr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:vr,requiredFeatures:vr,requiredFonts:vr,requiredFormats:vr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Re,specularExponent:Re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Re,strikethroughThickness:Re,string:null,stroke:null,strokeDashArray:vr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Re,strokeOpacity:Re,strokeWidth:null,style:null,surfaceScale:Re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:vr,tabIndex:Re,tableValues:null,target:null,targetX:Re,targetY:Re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:vr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Re,underlineThickness:Re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Re,values:null,vAlphabetic:Re,vMathematical:Re,vectorEffect:null,vHanging:Re,vIdeographic:Re,version:null,vertAdvY:Re,vertOriginX:Re,vertOriginY:Re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mC}),gC=Wi({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()}}),xC=Wi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:hC}),yC=Wi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),TM={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"},RM=/[A-Z]/g,Nj=/-[a-z]/g,PM=/^data[-\w.:]+$/i;function AM(e,t){const n=Cg(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"&&PM.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Nj,$M);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Nj.test(i)){let c=i.replace(RM,DM);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}o=oy}return new o(s,t)}function DM(e){return"-"+e.toLowerCase()}function $M(e){return e.charAt(1).toUpperCase()}const LM=fC([pC,CM,gC,xC,yC],"html"),ay=fC([pC,EM,gC,xC,yC],"svg");function OM(e){return e.join(" ").trim()}var ti={},Ph,Cj;function IM(){if(Cj)return Ph;Cj=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,u=/^\s+|\s+$/g,f=`
|
|
546
|
+
`,m="/",h="*",g="",y="comment",b="declaration";function C(v,k){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];k=k||{};var E=1,S=1;function T(_){var U=_.match(t);U&&(E+=U.length);var q=_.lastIndexOf(f);S=~q?_.length-q:S+_.length}function A(){var _={line:E,column:S};return function(U){return U.position=new R(_),I(),U}}function R(_){this.start=_,this.end={line:E,column:S},this.source=k.source}R.prototype.content=v;function P(_){var U=new Error(k.source+":"+E+":"+S+": "+_);if(U.reason=_,U.filename=k.source,U.line=E,U.column=S,U.source=v,!k.silent)throw U}function $(_){var U=_.exec(v);if(U){var q=U[0];return T(q),v=v.slice(q.length),U}}function I(){$(n)}function M(_){var U;for(_=_||[];U=D();)U!==!1&&_.push(U);return _}function D(){var _=A();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var U=2;g!=v.charAt(U)&&(h!=v.charAt(U)||m!=v.charAt(U+1));)++U;if(U+=2,g===v.charAt(U-1))return P("End of comment missing");var q=v.slice(2,U-2);return S+=2,T(q),v=v.slice(U),S+=2,_({type:y,comment:q})}}function H(){var _=A(),U=$(s);if(U){if(D(),!$(o))return P("property missing ':'");var q=$(i),Z=_({type:b,property:j(U[0].replace(e,g)),value:q?j(q[0].replace(e,g)):g});return $(c),Z}}function K(){var _=[];M(_);for(var U;U=H();)U!==!1&&(_.push(U),M(_));return _}return I(),K()}function j(v){return v?v.replace(u,g):g}return Ph=C,Ph}var Ej;function _M(){if(Ej)return ti;Ej=1;var e=ti&&ti.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ti,"__esModule",{value:!0}),ti.default=n;const t=e(IM());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(f=>{if(f.type!=="declaration")return;const{property:m,value:h}=f;u?o(m,h,f):h&&(i=i||{},i[m]=h)}),i}return ti}var Ll={},Tj;function MM(){if(Tj)return Ll;Tj=1,Object.defineProperty(Ll,"__esModule",{value:!0}),Ll.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,"-")},f=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 Ll.camelCase=f,Ll}var Ol,Rj;function FM(){if(Rj)return Ol;Rj=1;var e=Ol&&Ol.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(_M()),n=MM();function s(o,i){var c={};return!o||typeof o!="string"||(0,t.default)(o,function(u,f){u&&f&&(c[(0,n.camelCase)(u,i)]=f)}),c}return s.default=s,Ol=s,Ol}var zM=FM();const BM=df(zM),bC=vC("end"),iy=vC("start");function vC(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 UM(e){const t=iy(e),n=bC(e);if(t&&n)return{start:t,end:n}}function tc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Pj(e.position):"start"in e||"end"in e?Pj(e):"line"in e||"column"in e?Rg(e):""}function Rg(e){return Aj(e&&e.line)+":"+Aj(e&&e.column)}function Pj(e){return Rg(e&&e.start)+"-"+Rg(e&&e.end)}function Aj(e){return e&&typeof e=="number"?e:1}class Gn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",i={},c=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(c=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof s=="string"){const f=s.indexOf(":");f===-1?i.ruleId=s:(i.source=s.slice(0,f),i.ruleId=s.slice(f+1))}if(!i.place&&i.ancestors&&i.ancestors){const f=i.ancestors[i.ancestors.length-1];f&&(i.place=f.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=tc(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=c&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Gn.prototype.file="";Gn.prototype.name="";Gn.prototype.reason="";Gn.prototype.message="";Gn.prototype.stack="";Gn.prototype.column=void 0;Gn.prototype.line=void 0;Gn.prototype.ancestors=void 0;Gn.prototype.cause=void 0;Gn.prototype.fatal=void 0;Gn.prototype.place=void 0;Gn.prototype.ruleId=void 0;Gn.prototype.source=void 0;const ly={}.hasOwnProperty,VM=new Map,HM=/[A-Z]/g,WM=new Set(["table","tbody","thead","tfoot","tr"]),KM=new Set(["td","th"]),wC="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function qM(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=tF(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=eF(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"?ay:LM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=jC(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function jC(e,t,n){if(t.type==="element")return GM(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return YM(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return QM(e,t,n);if(t.type==="mdxjsEsm")return JM(e,t);if(t.type==="root")return XM(e,t,n);if(t.type==="text")return ZM(e,t)}function GM(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=ay,e.schema=o),e.ancestors.push(t);const i=SC(e,t.tagName,!1),c=nF(e,t);let u=uy(e,t);return WM.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!SM(f):!0})),kC(e,c,i,t),cy(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function YM(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)}xc(e,t.position)}function JM(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);xc(e,t.position)}function QM(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=ay,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:SC(e,t.name,!0),c=rF(e,t),u=uy(e,t);return kC(e,c,i,t),cy(c,u),e.ancestors.pop(),e.schema=s,e.create(t,i,c,n)}function XM(e,t,n){const s={};return cy(s,uy(e,t)),e.create(t,e.Fragment,s,n)}function ZM(e,t){return t.value}function kC(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function cy(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function eF(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 tF(e,t){return n;function n(s,o,i,c){const u=Array.isArray(i.children),f=iy(s);return t(o,i,c,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function nF(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&ly.call(t.properties,o)){const i=sF(e,o,t.properties[o]);if(i){const[c,u]=i;e.tableCellAlignToStyle&&c==="align"&&typeof u=="string"&&KM.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 rF(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 xc(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 xc(e,t.position);else i=s.value===null?!0:s.value;n[o]=i}return n}function uy(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:VM;for(;++s<t.children.length;){const i=t.children[s];let c;if(e.passKeys){const f=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(f){const m=o.get(f)||0;c=f+"-"+m,o.set(f,m+1)}}const u=jC(e,i,c);u!==void 0&&n.push(u)}return n}function sF(e,t,n){const s=AM(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?bM(n):OM(n)),s.property==="style"){let o=typeof n=="object"?n:oF(e,String(n));return e.stylePropertyNameCase==="css"&&(o=aF(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?TM[s.property]||s.property:s.attribute,n]}}function oF(e,t){try{return BM(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new Gn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=wC+"#cannot-parse-style-attribute",o}}function SC(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=jj(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=jj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return ly.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);xc(e)}function xc(e,t){const n=new Gn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=wC+"#cannot-handle-mdx-estrees-without-createevaluater",n}function aF(e){const t={};let n;for(n in e)ly.call(e,n)&&(t[iF(n)]=e[n]);return t}function iF(e){let t=e.replace(HM,lF);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function lF(e){return"-"+e.toLowerCase()}const Ah={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"]},cF={};function uF(e,t){const n=cF,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return NC(e,s,o)}function NC(e,t,n){if(dF(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 Dj(e.children,t,n)}return Array.isArray(e)?Dj(e,t,n):""}function Dj(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=NC(e[o],t,n);return s.join("")}function dF(e){return!!(e&&typeof e=="object")}const $j=document.createElement("i");function dy(e){const t="&"+e+";";$j.innerHTML=t;const n=$j.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ss(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 Mr(e,t){return e.length>0?(Ss(e,e.length,0,t),e):t}const Lj={}.hasOwnProperty;function fF(e){const t={};let n=-1;for(;++n<e.length;)pF(t,e[n]);return t}function pF(e,t){let n;for(n in t){const o=(Lj.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let c;if(i)for(c in i){Lj.call(o,c)||(o[c]=[]);const u=i[c];mF(o[c],Array.isArray(u)?u:u?[u]:[])}}}function mF(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);Ss(e,0,0,s)}function CC(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 Si(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const bs=Po(/[A-Za-z]/),Er=Po(/[\dA-Za-z]/),hF=Po(/[#-'*+\--9=?A-Z^-~]/);function Pg(e){return e!==null&&(e<32||e===127)}const Ag=Po(/\d/),gF=Po(/[\dA-Fa-f]/),xF=Po(/[!-/:-@[-`{-~]/);function lt(e){return e!==null&&e<-2}function dr(e){return e!==null&&(e<0||e===32)}function $t(e){return e===-2||e===-1||e===32}const yF=Po(new RegExp("\\p{P}|\\p{S}","u")),bF=Po(/\s/);function Po(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ki(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let c="";if(i===37&&Er(e.charCodeAt(n+1))&&Er(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(c=String.fromCharCode(i));else if(i>55295&&i<57344){const u=e.charCodeAt(n+1);i<56320&&u>56319&&u<57344?(c=String.fromCharCode(i,u),o=1):c="�"}else c=String.fromCharCode(i);c&&(t.push(e.slice(s,n),encodeURIComponent(c)),s=n+o+1,c=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Ht(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let i=0;return c;function c(f){return $t(f)?(e.enter(n),u(f)):t(f)}function u(f){return $t(f)&&i++<o?(e.consume(f),u):(e.exit(n),t(f))}}const vF={tokenize:wF};function wF(e){const t=e.attempt(this.parser.constructs.contentInitial,s,o);let n;return t;function s(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Ht(e,t,"linePrefix")}function o(u){return e.enter("paragraph"),i(u)}function i(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,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 jF={tokenize:kF},Oj={tokenize:SF};function kF(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,f,m)(S)}return m(S)}function f(S){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&E();const T=t.events.length;let A=T,R;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){R=t.events[A][1].end;break}k(s);let P=T;for(;P<t.events.length;)t.events[P][1].end={...R},P++;return Ss(t.events,A+1,0,t.events.slice(T)),t.events.length=P,m(S)}return u(S)}function m(S){if(s===n.length){if(!o)return y(S);if(o.currentConstruct&&o.currentConstruct.concrete)return C(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Oj,h,g)(S)}function h(S){return o&&E(),k(s),y(S)}function g(S){return t.parser.lazy[t.now().line]=s!==n.length,c=t.now().offset,C(S)}function y(S){return t.containerState={},e.attempt(Oj,b,C)(S)}function b(S){return s++,n.push([t.currentConstruct,t.containerState]),y(S)}function C(S){if(S===null){o&&E(),k(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),j(S)}function j(S){if(S===null){v(e.exit("chunkFlow"),!0),k(0),e.consume(S);return}return lt(S)?(e.consume(S),v(e.exit("chunkFlow")),s=0,t.interrupt=void 0,u):(e.consume(S),j)}function v(S,T){const A=t.sliceStream(S);if(T&&A.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(A),t.parser.lazy[S.start.line]){let R=o.events.length;for(;R--;)if(o.events[R][1].start.offset<c&&(!o.events[R][1].end||o.events[R][1].end.offset>c))return;const P=t.events.length;let $=P,I,M;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(I){M=t.events[$][1].end;break}I=!0}for(k(s),R=P;R<t.events.length;)t.events[R][1].end={...M},R++;Ss(t.events,$+1,0,t.events.slice(P)),t.events.length=R}}function k(S){let T=n.length;for(;T-- >S;){const A=n[T];t.containerState=A[1],A[0].exit.call(t,e)}n.length=S}function E(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function SF(e,t,n){return Ht(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ij(e){if(e===null||dr(e)||bF(e))return 1;if(yF(e))return 2}function fy(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 Dg={name:"attention",resolveAll:NF,tokenize:CF};function NF(e,t){let n=-1,s,o,i,c,u,f,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;f=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};_j(g,-f),_j(y,f),c={type:f>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},u={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:y},i={type:f>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:f>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=Mr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Mr(m,[["enter",o,t],["enter",c,t],["exit",c,t],["enter",i,t]]),m=Mr(m,fy(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Mr(m,[["exit",i,t],["enter",u,t],["exit",u,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(h=2,m=Mr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):h=0,Ss(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 CF(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=Ij(s);let i;return c;function c(f){return i=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===i)return e.consume(f),u;const m=e.exit("attentionSequence"),h=Ij(f),g=!h||h===2&&o||n.includes(f),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(f)}}function _j(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const EF={name:"autolink",tokenize:TF};function TF(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 bs(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,f):(b===43||b===45||b===46||Er(b))&&s++<32?(e.consume(b),u):(s=0,m(b))}function f(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||Pg(b)?n(b):(e.consume(b),f)}function m(b){return b===64?(e.consume(b),h):hF(b)?(e.consume(b),m):n(b)}function h(b){return Er(b)?g(b):n(b)}function g(b){return b===46?(e.consume(b),s=0,h):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):y(b)}function y(b){if((b===45||Er(b))&&s++<63){const C=b===45?y:g;return e.consume(b),C}return n(b)}}const rp={partial:!0,tokenize:RF};function RF(e,t,n){return s;function s(i){return $t(i)?Ht(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||lt(i)?t(i):n(i)}}const EC={continuation:{tokenize:AF},exit:DF,name:"blockQuote",tokenize:PF};function PF(e,t,n){const s=this;return o;function o(c){if(c===62){const u=s.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),i}return n(c)}function i(c){return $t(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function AF(e,t,n){const s=this;return o;function o(c){return $t(c)?Ht(e,i,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):i(c)}function i(c){return e.attempt(EC,t,n)(c)}}function DF(e){e.exit("blockQuote")}const TC={name:"characterEscape",tokenize:$F};function $F(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 xF(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const RC={name:"characterReference",tokenize:LF};function LF(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"),f}function f(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=gF,h):(e.enter("characterReferenceValue"),i=7,c=Ag,h(g))}function h(g){if(g===59&&o){const y=e.exit("characterReferenceValue");return c===Er&&!dy(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 Mj={partial:!0,tokenize:IF},Fj={concrete:!0,name:"codeFenced",tokenize:OF};function OF(e,t,n){const s=this,o={partial:!0,tokenize:A};let i=0,c=0,u;return f;function f(R){return m(R)}function m(R){const P=s.events[s.events.length-1];return i=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,u=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(R)}function h(R){return R===u?(c++,e.consume(R),h):c<3?n(R):(e.exit("codeFencedFenceSequence"),$t(R)?Ht(e,g,"whitespace")(R):g(R))}function g(R){return R===null||lt(R)?(e.exit("codeFencedFence"),s.interrupt?t(R):e.check(Mj,j,T)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),y(R))}function y(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):$t(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ht(e,b,"whitespace")(R)):R===96&&R===u?n(R):(e.consume(R),y)}function b(R){return R===null||lt(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(R))}function C(R){return R===null||lt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===u?n(R):(e.consume(R),C)}function j(R){return e.attempt(o,T,v)(R)}function v(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),k}function k(R){return i>0&&$t(R)?Ht(e,E,"linePrefix",i+1)(R):E(R)}function E(R){return R===null||lt(R)?e.check(Mj,j,T)(R):(e.enter("codeFlowValue"),S(R))}function S(R){return R===null||lt(R)?(e.exit("codeFlowValue"),E(R)):(e.consume(R),S)}function T(R){return e.exit("codeFenced"),t(R)}function A(R,P,$){let I=0;return M;function M(U){return R.enter("lineEnding"),R.consume(U),R.exit("lineEnding"),D}function D(U){return R.enter("codeFencedFence"),$t(U)?Ht(R,H,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):H(U)}function H(U){return U===u?(R.enter("codeFencedFenceSequence"),K(U)):$(U)}function K(U){return U===u?(I++,R.consume(U),K):I>=c?(R.exit("codeFencedFenceSequence"),$t(U)?Ht(R,_,"whitespace")(U):_(U)):$(U)}function _(U){return U===null||lt(U)?(R.exit("codeFencedFence"),P(U)):$(U)}}}function IF(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 Dh={name:"codeIndented",tokenize:MF},_F={partial:!0,tokenize:FF};function MF(e,t,n){const s=this;return o;function o(m){return e.enter("codeIndented"),Ht(e,i,"linePrefix",5)(m)}function i(m){const h=s.events[s.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?c(m):n(m)}function c(m){return m===null?f(m):lt(m)?e.attempt(_F,c,f)(m):(e.enter("codeFlowValue"),u(m))}function u(m){return m===null||lt(m)?(e.exit("codeFlowValue"),c(m)):(e.consume(m),u)}function f(m){return e.exit("codeIndented"),t(m)}}function FF(e,t,n){const s=this;return o;function o(c){return s.parser.lazy[s.now().line]?n(c):lt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),o):Ht(e,i,"linePrefix",5)(c)}function i(c){const u=s.events[s.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):lt(c)?o(c):n(c)}}const zF={name:"codeText",previous:UF,resolve:BF,tokenize:VF};function BF(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 UF(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function VF(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"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(i=e.enter("codeTextSequence"),o=0,h(g)):lt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||lt(g)?(e.exit("codeTextData"),f(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 HF{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&&Il(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),Il(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Il(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);Il(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Il(this.left,n.reverse())}}}function Il(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 PC(e){const t={};let n=-1,s,o,i,c,u,f,m;const h=new HF(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"&&(f=s[1]._tokenizer.events,i=0,i<f.length&&f[i][1].type==="lineEndingBlank"&&(i+=2),i<f.length&&f[i][1].type==="content"))for(;++i<f.length&&f[i][1].type!=="content";)f[i][1].type==="chunkText"&&(f[i][1]._isInFirstContentOfListItem=!0,i++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,WF(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 Ss(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function WF(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,f=[],m={};let h,g,y=-1,b=n,C=0,j=0;const v=[j];for(;b;){for(;e.get(++o)[1]!==b;);i.push(o),b._tokenizer||(h=s.sliceStream(b),b.next||h.push(null),g&&c.defineSkip(b.start),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(h),b._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=b,b=b.next}for(b=n;++y<u.length;)u[y][0]==="exit"&&u[y-1][0]==="enter"&&u[y][1].type===u[y-1][1].type&&u[y][1].start.line!==u[y][1].end.line&&(j=y+1,v.push(j),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(c.events=[],b?(b._tokenizer=void 0,b.previous=void 0):v.pop(),y=v.length;y--;){const k=u.slice(v[y],v[y+1]),E=i.pop();f.push([E,E+k.length-1]),e.splice(E,2,k)}for(f.reverse(),y=-1;++y<f.length;)m[C+f[y][0]]=C+f[y][1],C+=f[y][1]-f[y][0]-1;return m}const KF={resolve:GF,tokenize:YF},qF={partial:!0,tokenize:JF};function GF(e){return PC(e),e}function YF(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(qF,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 JF(e,t,n){const s=this;return o;function o(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Ht(e,i,"linePrefix")}function i(c){if(c===null||lt(c))return n(c);const u=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(c):e.interrupt(s.parser.constructs.flow,n,t)(c)}}function AC(e,t,n,s,o,i,c,u,f){const m=f||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||Pg(k)?n(k):(e.enter(s),e.enter(c),e.enter(u),e.enter("chunkString",{contentType:"string"}),j(k))}function y(k){return k===62?(e.enter(i),e.consume(k),e.exit(i),e.exit(o),e.exit(s),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),y(k)):k===null||k===60||lt(k)?n(k):(e.consume(k),k===92?C:b)}function C(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function j(k){return!h&&(k===null||k===41||dr(k))?(e.exit("chunkString"),e.exit(u),e.exit(c),e.exit(s),t(k)):h<m&&k===40?(e.consume(k),h++,j):k===41?(e.consume(k),h--,j):k===null||k===32||k===40||Pg(k)?n(k):(e.consume(k),k===92?v:j)}function v(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function DC(e,t,n,s,o,i){const c=this;let u=0,f;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&&!f||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),f||(f=!$t(b)),b===92?y:g)}function y(b){return b===91||b===92||b===93?(e.consume(b),u++,g):g(b)}}function $C(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,f):n(y)}function f(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),f(c)):y===null?n(y):lt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),Ht(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===c||y===null||lt(y)?(e.exit("chunkString"),m(y)):(e.consume(y),y===92?g:h)}function g(y){return y===c||y===92?(e.consume(y),h):h(y)}}function nc(e,t){let n;return s;function s(o){return lt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):$t(o)?Ht(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const QF={name:"definition",tokenize:ZF},XF={partial:!0,tokenize:e6};function ZF(e,t,n){const s=this;let o;return i;function i(b){return e.enter("definition"),c(b)}function c(b){return DC.call(s,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return o=Si(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return dr(b)?nc(e,m)(b):m(b)}function m(b){return AC(e,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function h(b){return e.attempt(XF,g,g)(b)}function g(b){return $t(b)?Ht(e,y,"whitespace")(b):y(b)}function y(b){return b===null||lt(b)?(e.exit("definition"),s.parser.defined.push(o),t(b)):n(b)}}function e6(e,t,n){return s;function s(u){return dr(u)?nc(e,o)(u):n(u)}function o(u){return $C(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function i(u){return $t(u)?Ht(e,c,"whitespace")(u):c(u)}function c(u){return u===null||lt(u)?t(u):n(u)}}const t6={name:"hardBreakEscape",tokenize:n6};function n6(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 r6={name:"headingAtx",resolve:s6,tokenize:o6};function s6(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"},Ss(e,s,n-s+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function o6(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||dr(h)?(e.exit("atxHeadingSequence"),u(h)):n(h)}function u(h){return h===35?(e.enter("atxHeadingSequence"),f(h)):h===null||lt(h)?(e.exit("atxHeading"),t(h)):$t(h)?Ht(e,u,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function f(h){return h===35?(e.consume(h),f):(e.exit("atxHeadingSequence"),u(h))}function m(h){return h===null||h===35||dr(h)?(e.exit("atxHeadingText"),u(h)):(e.consume(h),m)}}const a6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],zj=["pre","script","style","textarea"],i6={concrete:!0,name:"htmlFlow",resolveTo:u6,tokenize:d6},l6={partial:!0,tokenize:p6},c6={partial:!0,tokenize:f6};function u6(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 d6(e,t,n){const s=this;let o,i,c,u,f;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,j):B===63?(e.consume(B),o=3,s.interrupt?t:L):bs(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,C):bs(B)?(e.consume(B),o=4,s.interrupt?t:L):n(B)}function b(B){return B===45?(e.consume(B),s.interrupt?t:L):n(B)}function C(B){const ue="CDATA[";return B===ue.charCodeAt(u++)?(e.consume(B),u===ue.length?s.interrupt?t:H:C):n(B)}function j(B){return bs(B)?(e.consume(B),c=String.fromCharCode(B),v):n(B)}function v(B){if(B===null||B===47||B===62||dr(B)){const ue=B===47,ge=c.toLowerCase();return!ue&&!i&&zj.includes(ge)?(o=1,s.interrupt?t(B):H(B)):a6.includes(c.toLowerCase())?(o=6,ue?(e.consume(B),k):s.interrupt?t(B):H(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:H):n(B)}function E(B){return $t(B)?(e.consume(B),E):M(B)}function S(B){return B===47?(e.consume(B),M):B===58||B===95||bs(B)?(e.consume(B),T):$t(B)?(e.consume(B),S):M(B)}function T(B){return B===45||B===46||B===58||B===95||Er(B)?(e.consume(B),T):A(B)}function A(B){return B===61?(e.consume(B),R):$t(B)?(e.consume(B),A):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),f=B,P):$t(B)?(e.consume(B),R):$(B)}function P(B){return B===f?(e.consume(B),f=null,I):B===null||lt(B)?n(B):(e.consume(B),P)}function $(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||dr(B)?A(B):(e.consume(B),$)}function I(B){return B===47||B===62||$t(B)?S(B):n(B)}function M(B){return B===62?(e.consume(B),D):n(B)}function D(B){return B===null||lt(B)?H(B):$t(B)?(e.consume(B),D):n(B)}function H(B){return B===45&&o===2?(e.consume(B),q):B===60&&o===1?(e.consume(B),Z):B===62&&o===4?(e.consume(B),V):B===63&&o===3?(e.consume(B),L):B===93&&o===5?(e.consume(B),G):lt(B)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(l6,re,K)(B)):B===null||lt(B)?(e.exit("htmlFlowData"),K(B)):(e.consume(B),H)}function K(B){return e.check(c6,_,re)(B)}function _(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),U}function U(B){return B===null||lt(B)?K(B):(e.enter("htmlFlowData"),H(B))}function q(B){return B===45?(e.consume(B),L):H(B)}function Z(B){return B===47?(e.consume(B),c="",F):H(B)}function F(B){if(B===62){const ue=c.toLowerCase();return zj.includes(ue)?(e.consume(B),V):H(B)}return bs(B)&&c.length<8?(e.consume(B),c+=String.fromCharCode(B),F):H(B)}function G(B){return B===93?(e.consume(B),L):H(B)}function L(B){return B===62?(e.consume(B),V):B===45&&o===2?(e.consume(B),L):H(B)}function V(B){return B===null||lt(B)?(e.exit("htmlFlowData"),re(B)):(e.consume(B),V)}function re(B){return e.exit("htmlFlow"),t(B)}}function f6(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 p6(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(rp,t,n)}}const m6={name:"htmlText",tokenize:h6};function h6(e,t,n){const s=this;let o,i,c;return u;function u(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),f}function f(L){return L===33?(e.consume(L),m):L===47?(e.consume(L),A):L===63?(e.consume(L),S):bs(L)?(e.consume(L),$):n(L)}function m(L){return L===45?(e.consume(L),h):L===91?(e.consume(L),i=0,C):bs(L)?(e.consume(L),E):n(L)}function h(L){return L===45?(e.consume(L),b):n(L)}function g(L){return L===null?n(L):L===45?(e.consume(L),y):lt(L)?(c=g,Z(L)):(e.consume(L),g)}function y(L){return L===45?(e.consume(L),b):g(L)}function b(L){return L===62?q(L):L===45?y(L):g(L)}function C(L){const V="CDATA[";return L===V.charCodeAt(i++)?(e.consume(L),i===V.length?j:C):n(L)}function j(L){return L===null?n(L):L===93?(e.consume(L),v):lt(L)?(c=j,Z(L)):(e.consume(L),j)}function v(L){return L===93?(e.consume(L),k):j(L)}function k(L){return L===62?q(L):L===93?(e.consume(L),k):j(L)}function E(L){return L===null||L===62?q(L):lt(L)?(c=E,Z(L)):(e.consume(L),E)}function S(L){return L===null?n(L):L===63?(e.consume(L),T):lt(L)?(c=S,Z(L)):(e.consume(L),S)}function T(L){return L===62?q(L):S(L)}function A(L){return bs(L)?(e.consume(L),R):n(L)}function R(L){return L===45||Er(L)?(e.consume(L),R):P(L)}function P(L){return lt(L)?(c=P,Z(L)):$t(L)?(e.consume(L),P):q(L)}function $(L){return L===45||Er(L)?(e.consume(L),$):L===47||L===62||dr(L)?I(L):n(L)}function I(L){return L===47?(e.consume(L),q):L===58||L===95||bs(L)?(e.consume(L),M):lt(L)?(c=I,Z(L)):$t(L)?(e.consume(L),I):q(L)}function M(L){return L===45||L===46||L===58||L===95||Er(L)?(e.consume(L),M):D(L)}function D(L){return L===61?(e.consume(L),H):lt(L)?(c=D,Z(L)):$t(L)?(e.consume(L),D):I(L)}function H(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),o=L,K):lt(L)?(c=H,Z(L)):$t(L)?(e.consume(L),H):(e.consume(L),_)}function K(L){return L===o?(e.consume(L),o=void 0,U):L===null?n(L):lt(L)?(c=K,Z(L)):(e.consume(L),K)}function _(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||dr(L)?I(L):(e.consume(L),_)}function U(L){return L===47||L===62||dr(L)?I(L):n(L)}function q(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function Z(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),F}function F(L){return $t(L)?Ht(e,G,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):G(L)}function G(L){return e.enter("htmlTextData"),c(L)}}const py={name:"labelEnd",resolveAll:b6,resolveTo:v6,tokenize:w6},g6={tokenize:j6},x6={tokenize:k6},y6={tokenize:S6};function b6(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&&Ss(e,0,e.length,n),e}function v6(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 f={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",f,t],["enter",m,t]],u=Mr(u,e.slice(i+1,i+s+3)),u=Mr(u,[["enter",h,t]]),u=Mr(u,fy(t.parser.constructs.insideSpan.null,e.slice(i+s+4,c-3),t)),u=Mr(u,[["exit",h,t],e[c-2],e[c-1],["exit",m,t]]),u=Mr(u,e.slice(c+1)),u=Mr(u,[["exit",f,t]]),Ss(e,i,e.length,u),e}function w6(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(Si(s.sliceSerialize({start:i.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(y),e.exit("labelMarker"),e.exit("labelEnd"),f):n(y)}function f(y){return y===40?e.attempt(g6,h,c?h:g)(y):y===91?e.attempt(x6,h,c?m:g)(y):c?h(y):g(y)}function m(y){return e.attempt(y6,h,g)(y)}function h(y){return t(y)}function g(y){return i._balanced=!0,n(y)}}function j6(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return dr(g)?nc(e,i)(g):i(g)}function i(g){return g===41?h(g):AC(e,c,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return dr(g)?nc(e,f)(g):h(g)}function u(g){return n(g)}function f(g){return g===34||g===39||g===40?$C(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return dr(g)?nc(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 k6(e,t,n){const s=this;return o;function o(u){return DC.call(s,e,i,c,"reference","referenceMarker","referenceString")(u)}function i(u){return s.parser.defined.includes(Si(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function c(u){return n(u)}}function S6(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 N6={name:"labelStartImage",resolveAll:py.resolveAll,tokenize:C6};function C6(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 E6={name:"labelStartLink",resolveAll:py.resolveAll,tokenize:T6};function T6(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 $h={name:"lineEnding",tokenize:R6};function R6(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Ht(e,t,"linePrefix")}}const Rd={name:"thematicBreak",tokenize:P6};function P6(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"),f(m)):s>=3&&(m===null||lt(m))?(e.exit("thematicBreak"),t(m)):n(m)}function f(m){return m===o?(e.consume(m),s++,f):(e.exit("thematicBreakSequence"),$t(m)?Ht(e,u,"whitespace")(m):u(m))}}const ir={continuation:{tokenize:L6},exit:I6,name:"list",tokenize:$6},A6={partial:!0,tokenize:_6},D6={partial:!0,tokenize:O6};function $6(e,t,n){const s=this,o=s.events[s.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,c=0;return u;function u(b){const C=s.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||b===s.containerState.marker:Ag(b)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Rd,n,m)(b):m(b);if(!s.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Ag(b)&&++c<10?(e.consume(b),f):(!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(rp,s.interrupt?n:h,e.attempt(A6,y,g))}function h(b){return s.containerState.initialBlankLine=!0,i++,y(b)}function g(b){return $t(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),y):n(b)}function y(b){return s.containerState.size=i+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function L6(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(rp,o,i);function o(u){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Ht(e,t,"listItemIndent",s.containerState.size+1)(u)}function i(u){return s.containerState.furtherBlankLines||!$t(u)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,c(u)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(D6,t,c)(u))}function c(u){return s.containerState._closeFlow=!0,s.interrupt=void 0,Ht(e,e.attempt(ir,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function O6(e,t,n){const s=this;return Ht(e,o,"listItemIndent",s.containerState.size+1);function o(i){const c=s.events[s.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===s.containerState.size?t(i):n(i)}}function I6(e){e.exit(this.containerState.type)}function _6(e,t,n){const s=this;return Ht(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const c=s.events[s.events.length-1];return!$t(i)&&c&&c[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Bj={name:"setextUnderline",resolveTo:M6,tokenize:F6};function M6(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 F6(e,t,n){const s=this;let o;return i;function i(m){let h=s.events.length,g;for(;h--;)if(s.events[h][1].type!=="lineEnding"&&s.events[h][1].type!=="linePrefix"&&s.events[h][1].type!=="content"){g=s.events[h][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=m,c(m)):n(m)}function c(m){return e.enter("setextHeadingLineSequence"),u(m)}function u(m){return m===o?(e.consume(m),u):(e.exit("setextHeadingLineSequence"),$t(m)?Ht(e,f,"lineSuffix")(m):f(m))}function f(m){return m===null||lt(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const z6={tokenize:B6};function B6(e){const t=this,n=e.attempt(rp,s,e.attempt(this.parser.constructs.flowInitial,o,Ht(e,e.attempt(this.parser.constructs.flow,o,e.attempt(KF,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 U6={resolveAll:OC()},V6=LC("string"),H6=LC("text");function LC(e){return{resolveAll:OC(e==="text"?W6: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),f}function f(h){return m(h)?(n.exit("data"),i(h)):(n.consume(h),f)}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 OC(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 W6(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,f;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)f=!0,u++;else if(m!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(u=0),u){const m={type:n===e.length||f||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 K6={42:ir,43:ir,45:ir,48:ir,49:ir,50:ir,51:ir,52:ir,53:ir,54:ir,55:ir,56:ir,57:ir,62:EC},q6={91:QF},G6={[-2]:Dh,[-1]:Dh,32:Dh},Y6={35:r6,42:Rd,45:[Bj,Rd],60:i6,61:Bj,95:Rd,96:Fj,126:Fj},J6={38:RC,92:TC},Q6={[-5]:$h,[-4]:$h,[-3]:$h,33:N6,38:RC,42:Dg,60:[EF,m6],91:E6,92:[t6,TC],93:py,95:Dg,96:zF},X6={null:[Dg,U6]},Z6={null:[42,95]},ez={null:[]},tz=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Z6,contentInitial:q6,disable:ez,document:K6,flow:Y6,flowInitial:G6,insideSpan:X6,string:J6,text:Q6},Symbol.toStringTag,{value:"Module"}));function nz(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 f={attempt:P(A),check:P(R),consume:E,enter:S,exit:T,interrupt:P(R,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:C,parser:e,previous:null,sliceSerialize:y,sliceStream:b,write:g};let h=t.tokenize.call(m,f);return t.resolveAll&&i.push(t),m;function g(D){return c=Mr(c,D),v(),c[c.length-1]!==null?[]:($(t,0),m.events=fy(i,m.events,m),m.events)}function y(D,H){return sz(b(D),H)}function b(D){return rz(c,D)}function C(){const{_bufferIndex:D,_index:H,line:K,column:_,offset:U}=s;return{_bufferIndex:D,_index:H,line:K,column:_,offset:U}}function j(D){o[D.line]=D.column,M()}function v(){let D;for(;s._index<c.length;){const H=c[s._index];if(typeof H=="string")for(D=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===D&&s._bufferIndex<H.length;)k(H.charCodeAt(s._bufferIndex));else k(H)}}function k(D){h=h(D)}function E(D){lt(D)?(s.line++,s.column=1,s.offset+=D===-3?2:1,M()):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,H){const K=H||{};return K.type=D,K.start=C(),m.events.push(["enter",K,m]),u.push(K),K}function T(D){const H=u.pop();return H.end=C(),m.events.push(["exit",H,m]),H}function A(D,H){$(D,H.from)}function R(D,H){H.restore()}function P(D,H){return K;function K(_,U,q){let Z,F,G,L;return Array.isArray(_)?re(_):"tokenize"in _?re([_]):V(_);function V(se){return ye;function ye(Se){const Ee=Se!==null&&se[Se],Ae=Se!==null&&se.null,Ke=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ae)?Ae:Ae?[Ae]:[]];return re(Ke)(Se)}}function re(se){return Z=se,F=0,se.length===0?q:B(se[F])}function B(se){return ye;function ye(Se){return L=I(),G=se,se.partial||(m.currentConstruct=se),se.name&&m.parser.constructs.disable.null.includes(se.name)?ge():se.tokenize.call(H?Object.assign(Object.create(m),H):m,f,ue,ge)(Se)}}function ue(se){return D(G,L),U}function ge(se){return L.restore(),++F<Z.length?B(Z[F]):q}}}function $(D,H){D.resolveAll&&!i.includes(D)&&i.push(D),D.resolve&&Ss(m.events,H,m.events.length-H,D.resolve(m.events.slice(H),m)),D.resolveTo&&(m.events=D.resolveTo(m.events,m))}function I(){const D=C(),H=m.previous,K=m.currentConstruct,_=m.events.length,U=Array.from(u);return{from:_,restore:q};function q(){s=D,m.previous=H,m.currentConstruct=K,m.events.length=_,u=U,M()}}function M(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function rz(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 sz(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=`
|
|
547
|
+
`;break}case-3:{c=`\r
|
|
548
|
+
`;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 oz(e){const s={constructs:fF([tz,...(e||{}).extensions||[]]),content:o(vF),defined:[],document:o(jF),flow:o(z6),lazy:{},string:o(V6),text:o(H6)};return s;function o(i){return c;function c(u){return nz(s,i,u)}}}function az(e){for(;!PC(e););return e}const Uj=/[\0\t\n\r]/g;function iz(){let e=1,t="",n=!0,s;return o;function o(i,c,u){const f=[];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(Uj.lastIndex=g,m=Uj.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)f.push(-3),s=void 0;else switch(s&&(f.push(-5),s=void 0),g<y&&(f.push(i.slice(g,y)),e+=y-g),b){case 0:{f.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,f.push(-2);e++<h;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:s=!0,e=1}g=y+1}return u&&(s&&f.push(-5),t&&f.push(t),f.push(null)),f}}const lz=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function cz(e){return e.replace(lz,uz)}function uz(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return CC(n.slice(i?2:1),i?16:10)}return dy(n)||e}const IC={}.hasOwnProperty;function dz(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),fz(n)(az(oz(n).document().write(iz()(e,t,!0))))}function fz(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Ye),autolinkProtocol:I,autolinkEmail:I,atxHeading:i(X),blockQuote:i(Ae),characterEscape:I,characterReference:I,codeFenced:i(Ke),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:i(Ke,c),codeText:i(ct,c),codeTextData:I,data:I,codeFlowValue:I,definition:i(et),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:i(ot),hardBreakEscape:i(Me),hardBreakTrailing:i(Me),htmlFlow:i(Ce,c),htmlFlowData:I,htmlText:i(Ce,c),htmlTextData:I,image:i(Ie),label:c,link:i(Ye),listItem:i(Ze),listItemValue:y,listOrdered:i(Fe,g),listUnordered:i(Fe),paragraph:i(Qe),reference:B,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:i(X),strong:i(Ot),thematicBreak:i(dt)},exit:{atxHeading:f(),atxHeadingSequence:A,autolink:f(),autolinkEmail:Ee,autolinkProtocol:Se,blockQuote:f(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:ge,characterReferenceMarkerNumeric:ge,characterReferenceValue:se,characterReference:ye,codeFenced:f(v),codeFencedFence:j,codeFencedFenceInfo:b,codeFencedFenceMeta:C,codeFlowValue:M,codeIndented:f(k),codeText:f(U),codeTextData:M,data:M,definition:f(),definitionDestinationString:T,definitionLabelString:E,definitionTitleString:S,emphasis:f(),hardBreakEscape:f(H),hardBreakTrailing:f(H),htmlFlow:f(K),htmlFlowData:M,htmlText:f(_),htmlTextData:M,image:f(Z),label:G,labelText:F,lineEnding:D,link:f(q),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:ue,resourceDestinationString:L,resourceTitleString:V,resource:re,setextHeading:f($),setextHeadingLineSequence:P,setextHeadingText:R,strong:f(),thematicBreak:f()}};_C(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(le){let Y={type:"root",children:[]};const fe={stack:[Y],tokenStack:[],config:t,enter:u,exit:m,buffer:c,resume:h,data:n},ne=[];let he=-1;for(;++he<le.length;)if(le[he][1].type==="listOrdered"||le[he][1].type==="listUnordered")if(le[he][0]==="enter")ne.push(he);else{const De=ne.pop();he=o(le,De,he)}for(he=-1;++he<le.length;){const De=t[le[he][0]];IC.call(De,le[he][1].type)&&De[le[he][1].type].call(Object.assign({sliceSerialize:le[he][2].sliceSerialize},fe),le[he][1])}if(fe.tokenStack.length>0){const De=fe.tokenStack[fe.tokenStack.length-1];(De[1]||Vj).call(fe,void 0,De[0])}for(Y.position={start:po(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:po(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},he=-1;++he<t.transforms.length;)Y=t.transforms[he](Y)||Y;return Y}function o(le,Y,fe){let ne=Y-1,he=-1,De=!1,ut,ae,be,$e;for(;++ne<=fe;){const at=le[ne];switch(at[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{at[0]==="enter"?he++:he--,$e=void 0;break}case"lineEndingBlank":{at[0]==="enter"&&(ut&&!$e&&!he&&!be&&(be=ne),$e=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:$e=void 0}if(!he&&at[0]==="enter"&&at[1].type==="listItemPrefix"||he===-1&&at[0]==="exit"&&(at[1].type==="listUnordered"||at[1].type==="listOrdered")){if(ut){let Be=ne;for(ae=void 0;Be--;){const kt=le[Be];if(kt[1].type==="lineEnding"||kt[1].type==="lineEndingBlank"){if(kt[0]==="exit")continue;ae&&(le[ae][1].type="lineEndingBlank",De=!0),kt[1].type="lineEnding",ae=Be}else if(!(kt[1].type==="linePrefix"||kt[1].type==="blockQuotePrefix"||kt[1].type==="blockQuotePrefixWhitespace"||kt[1].type==="blockQuoteMarker"||kt[1].type==="listItemIndent"))break}be&&(!ae||be<ae)&&(ut._spread=!0),ut.end=Object.assign({},ae?le[ae][1].start:at[1].end),le.splice(ae||ne,0,["exit",ut,at[2]]),ne++,fe++}if(at[1].type==="listItemPrefix"){const Be={type:"listItem",_spread:!1,start:Object.assign({},at[1].start),end:void 0};ut=Be,le.splice(ne,0,["enter",Be,at[2]]),ne++,fe++,be=void 0,$e=!0}}}return le[Y][1]._spread=De,fe}function i(le,Y){return fe;function fe(ne){u.call(this,le(ne),ne),Y&&Y.call(this,ne)}}function c(){this.stack.push({type:"fragment",children:[]})}function u(le,Y,fe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Y,fe||void 0]),le.position={start:po(Y.start),end:void 0}}function f(le){return Y;function Y(fe){le&&le.call(this,fe),m.call(this,fe)}}function m(le,Y){const fe=this.stack.pop(),ne=this.tokenStack.pop();if(ne)ne[0].type!==le.type&&(Y?Y.call(this,le,ne[0]):(ne[1]||Vj).call(this,le,ne[0]));else throw new Error("Cannot close `"+le.type+"` ("+tc({start:le.start,end:le.end})+"): it’s not open");fe.position.end=po(le.end)}function h(){return uF(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=le}function C(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le.replace(/(\r?\n|\r)$/g,"")}function E(le){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=Si(this.sliceSerialize(le)).toLowerCase()}function S(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function T(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function A(le){const Y=this.stack[this.stack.length-1];if(!Y.depth){const fe=this.sliceSerialize(le).length;Y.depth=fe}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function P(le){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function I(le){const fe=this.stack[this.stack.length-1].children;let ne=fe[fe.length-1];(!ne||ne.type!=="text")&&(ne=yt(),ne.position={start:po(le.start),end:void 0},fe.push(ne)),this.stack.push(ne)}function M(le){const Y=this.stack.pop();Y.value+=this.sliceSerialize(le),Y.position.end=po(le.end)}function D(le){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=Y.children[Y.children.length-1];fe.position.end=po(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(I.call(this,le),M.call(this,le))}function H(){this.data.atHardBreak=!0}function K(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function _(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function U(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.value=le}function q(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function Z(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Y,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function F(le){const Y=this.sliceSerialize(le),fe=this.stack[this.stack.length-2];fe.label=cz(Y),fe.identifier=Si(Y).toLowerCase()}function G(){const le=this.stack[this.stack.length-1],Y=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ne=le.children;fe.children=ne}else fe.alt=Y}function L(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.url=le}function V(){const le=this.resume(),Y=this.stack[this.stack.length-1];Y.title=le}function re(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function ue(le){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=Si(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ge(le){this.data.characterReferenceType=le.type}function se(le){const Y=this.sliceSerialize(le),fe=this.data.characterReferenceType;let ne;fe?(ne=CC(Y,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ne=dy(Y);const he=this.stack[this.stack.length-1];he.value+=ne}function ye(le){const Y=this.stack.pop();Y.position.end=po(le.end)}function Se(le){M.call(this,le);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(le)}function Ee(le){M.call(this,le);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(le)}function Ae(){return{type:"blockquote",children:[]}}function Ke(){return{type:"code",lang:null,meta:null,value:""}}function ct(){return{type:"inlineCode",value:""}}function et(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ot(){return{type:"emphasis",children:[]}}function X(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function Ie(){return{type:"image",title:null,url:"",alt:null}}function Ye(){return{type:"link",title:null,url:"",children:[]}}function Fe(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function Ze(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Qe(){return{type:"paragraph",children:[]}}function Ot(){return{type:"strong",children:[]}}function yt(){return{type:"text",value:""}}function dt(){return{type:"thematicBreak"}}}function po(e){return{line:e.line,column:e.column,offset:e.offset}}function _C(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?_C(e,s):pz(e,s)}}function pz(e,t){let n;for(n in t)if(IC.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 Vj(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+tc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+tc({start:t.start,end:t.end})+") is still open")}function mz(e){const t=this;t.parser=n;function n(s){return dz(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function hz(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 gz(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
549
|
+
`}]}function xz(e,t){const n=t.value?t.value+`
|
|
550
|
+
`:"",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 yz(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bz(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vz(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=Ki(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 f={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,f);const m={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,m),e.applyData(t,m)}function wz(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 jz(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function MC(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 kz(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MC(e,t);const o={src:Ki(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 Sz(e,t){const n={src:Ki(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 Nz(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 Cz(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return MC(e,t);const o={href:Ki(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 Ez(e,t){const n={href:Ki(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 Tz(e,t,n){const s=e.all(t),o=n?Rz(n):FC(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:`
|
|
551
|
+
`}),h.type==="element"&&h.tagName==="p"&&!o?c.push(...h.children):c.push(h)}const f=s[s.length-1];f&&(o||f.type!=="element"||f.tagName!=="p")&&c.push({type:"text",value:`
|
|
552
|
+
`});const m={type:"element",tagName:"li",properties:i,children:c};return e.patch(t,m),e.applyData(t,m)}function Rz(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=FC(n[s])}return t}function FC(e){const t=e.spread;return t??e.children.length>1}function Pz(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 Az(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dz(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function $z(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Lz(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=iy(t.children[1]),f=bC(t.children[t.children.length-1]);u&&f&&(c.position={start:u,end:f}),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 Oz(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 f=-1;const m=[];for(;++f<u;){const g=t.children[f],y={},b=c?c[f]:void 0;b&&(y.align=b);let C={type:"element",tagName:i,properties:y,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),m.push(C)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,h),e.applyData(t,h)}function Iz(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Hj=9,Wj=32;function _z(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const i=[];for(;s;)i.push(Kj(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return i.push(Kj(t.slice(o),o>0,!1)),i.join("")}function Kj(e,t,n){let s=0,o=e.length;if(t){let i=e.codePointAt(s);for(;i===Hj||i===Wj;)s++,i=e.codePointAt(s)}if(n){let i=e.codePointAt(o-1);for(;i===Hj||i===Wj;)o--,i=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function Mz(e,t){const n={type:"text",value:_z(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Fz(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const zz={blockquote:hz,break:gz,code:xz,delete:yz,emphasis:bz,footnoteReference:vz,heading:wz,html:jz,imageReference:kz,image:Sz,inlineCode:Nz,linkReference:Cz,link:Ez,listItem:Tz,list:Pz,paragraph:Az,root:Dz,strong:$z,table:Lz,tableCell:Iz,tableRow:Oz,text:Mz,thematicBreak:Fz,toml:ld,yaml:ld,definition:ld,footnoteDefinition:ld};function ld(){}const zC=-1,sp=0,rc=1,sf=2,my=3,hy=4,gy=5,xy=6,BC=7,UC=8,qj=typeof self=="object"?self:globalThis,Bz=(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 sp:case zC:return n(c,o);case rc:{const u=n([],o);for(const f of c)u.push(s(f));return u}case sf:{const u=n({},o);for(const[f,m]of c)u[s(f)]=s(m);return u}case my:return n(new Date(c),o);case hy:{const{source:u,flags:f}=c;return n(new RegExp(u,f),o)}case gy:{const u=n(new Map,o);for(const[f,m]of c)u.set(s(f),s(m));return u}case xy:{const u=n(new Set,o);for(const f of c)u.add(s(f));return u}case BC:{const{name:u,message:f}=c;return n(new qj[u](f),o)}case UC: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 qj[i](c),o)};return s},Gj=e=>Bz(new Map,e)(0),ni="",{toString:Uz}={},{keys:Vz}=Object,_l=e=>{const t=typeof e;if(t!=="object"||!e)return[sp,t];const n=Uz.call(e).slice(8,-1);switch(n){case"Array":return[rc,ni];case"Object":return[sf,ni];case"Date":return[my,ni];case"RegExp":return[hy,ni];case"Map":return[gy,ni];case"Set":return[xy,ni];case"DataView":return[rc,n]}return n.includes("Array")?[rc,n]:n.includes("Error")?[BC,n]:[sf,n]},cd=([e,t])=>e===sp&&(t==="function"||t==="symbol"),Hz=(e,t,n,s)=>{const o=(c,u)=>{const f=s.push(c)-1;return n.set(u,f),f},i=c=>{if(n.has(c))return n.get(c);let[u,f]=_l(c);switch(u){case sp:{let h=c;switch(f){case"bigint":u=UC,h=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);h=null;break;case"undefined":return o([zC],c)}return o([u,h],c)}case rc:{if(f){let y=c;return f==="DataView"?y=new Uint8Array(c.buffer):f==="ArrayBuffer"&&(y=new Uint8Array(c)),o([f,[...y]],c)}const h=[],g=o([u,h],c);for(const y of c)h.push(i(y));return g}case sf:{if(f)switch(f){case"BigInt":return o([f,c.toString()],c);case"Boolean":case"Number":case"String":return o([f,c.valueOf()],c)}if(t&&"toJSON"in c)return i(c.toJSON());const h=[],g=o([u,h],c);for(const y of Vz(c))(e||!cd(_l(c[y])))&&h.push([i(y),i(c[y])]);return g}case my:return o([u,c.toISOString()],c);case hy:{const{source:h,flags:g}=c;return o([u,{source:h,flags:g}],c)}case gy:{const h=[],g=o([u,h],c);for(const[y,b]of c)(e||!(cd(_l(y))||cd(_l(b))))&&h.push([i(y),i(b)]);return g}case xy:{const h=[],g=o([u,h],c);for(const y of c)(e||!cd(_l(y)))&&h.push(i(y));return g}}const{message:m}=c;return o([u,{name:f,message:m}],c)};return i},Yj=(e,{json:t,lossy:n}={})=>{const s=[];return Hz(!(t||n),!!t,new Map,s)(e),s},of=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Gj(Yj(e,t)):structuredClone(e):(e,t)=>Gj(Yj(e,t));function Wz(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 Kz(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function qz(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Wz,s=e.options.footnoteBackLabel||Kz,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",c=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[f]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),y=Ki(g.toLowerCase());let b=0;const C=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++b<=j;){C.length>0&&C.push({type:"text",value:" "});let E=typeof n=="string"?n:n(f,b);typeof E=="string"&&(E={type:"text",value:E}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+y+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(f,b),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const E=v.children[v.children.length-1];E&&E.type==="text"?E.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...C)}else h.push(...C);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+y},children:e.wrap(h,!0)};e.patch(m,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...of(c),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
553
|
+
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
|
|
554
|
+
`}]}}const VC=(function(e){if(e==null)return Qz;if(typeof e=="function")return op(e);if(typeof e=="object")return Array.isArray(e)?Gz(e):Yz(e);if(typeof e=="string")return Jz(e);throw new Error("Expected function, string, or object as test")});function Gz(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=VC(e[n]);return op(s);function s(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function Yz(e){const t=e;return op(n);function n(s){const o=s;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function Jz(e){return op(t);function t(n){return n&&n.type===e}}function op(e){return t;function t(n,s,o){return!!(Xz(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function Qz(){return!0}function Xz(e){return e!==null&&typeof e=="object"&&"type"in e}const HC=[],Zz=!0,Jj=!1,eB="skip";function tB(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const i=VC(o),c=s?-1:1;u(e,void 0,[])();function u(f,m,h){const g=f&&typeof f=="object"?f:{};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 ("+(f.type+(b?"<"+b+">":""))+")"})}return y;function y(){let b=HC,C,j,v;if((!t||i(f,m,h[h.length-1]||void 0))&&(b=nB(n(f,h)),b[0]===Jj))return b;if("children"in f&&f.children){const k=f;if(k.children&&b[0]!==eB)for(j=(s?k.children.length:-1)+c,v=h.concat(k);j>-1&&j<k.children.length;){const E=k.children[j];if(C=u(E,j,v)(),C[0]===Jj)return C;j=typeof C[1]=="number"?C[1]:j+c}}return b}}}function nB(e){return Array.isArray(e)?e:typeof e=="number"?[Zz,e]:e==null?HC:[e]}function WC(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),tB(e,i,u,o);function u(f,m){const h=m[m.length-1],g=h?h.children.indexOf(f):void 0;return c(f,g,h)}}const $g={}.hasOwnProperty,rB={};function sB(e,t){const n=t||rB,s=new Map,o=new Map,i=new Map,c={...zz,...n.handlers},u={all:m,applyData:aB,definitionById:s,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:c,one:f,options:n,patch:oB,wrap:lB};return WC(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 f(h,g){const y=h.type,b=u.handlers[y];if($g.call(u.handlers,y)&&b)return b(u,h,g);if(u.options.passThrough&&u.options.passThrough.includes(y)){if("children"in h){const{children:j,...v}=h,k=of(v);return k.children=u.all(h),k}return of(h)}return(u.options.unknownHandler||iB)(u,h,g)}function m(h){const g=[];if("children"in h){const y=h.children;let b=-1;for(;++b<y.length;){const C=u.one(y[b],h);if(C){if(b&&y[b-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=Qj(C.value)),!Array.isArray(C)&&C.type==="element")){const j=C.children[0];j&&j.type==="text"&&(j.value=Qj(j.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function oB(e,t){e.position&&(t.position=UM(e))}function aB(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,of(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function iB(e,t){const n=t.data||{},s="value"in t&&!($g.call(n,"hProperties")||$g.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 lB(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
|
|
555
|
+
`});++s<e.length;)s&&n.push({type:"text",value:`
|
|
556
|
+
`}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
557
|
+
`}),n}function Qj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Xj(e,t){const n=sB(e,t),s=n.one(e,void 0),o=qz(n),i=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
|
|
558
|
+
`},o),i}function cB(e,t){return e&&"run"in e?async function(n,s){const o=Xj(n,{file:s,...t});await e.run(o,s)}:function(n,s){return Xj(n,{file:s,...e||t})}}function Zj(e){if(e)throw e}var Lh,e0;function uB(){if(e0)return Lh;e0=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},i=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var y;for(y in m);return typeof y>"u"||e.call(m,y)},c=function(m,h){n&&h.name==="__proto__"?n(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},u=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(s)return s(m,h).value}else return;return m[h]};return Lh=function f(){var m,h,g,y,b,C,j=arguments[0],v=1,k=arguments.length,E=!1;for(typeof j=="boolean"&&(E=j,j=arguments[1]||{},v=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});v<k;++v)if(m=arguments[v],m!=null)for(h in m)g=u(j,h),y=u(m,h),j!==y&&(E&&y&&(i(y)||(b=o(y)))?(b?(b=!1,C=g&&o(g)?g:[]):C=g&&i(g)?g:{},c(j,{name:h,newValue:f(E,C,y)})):typeof y<"u"&&c(j,{name:h,newValue:y}));return j},Lh}var dB=uB();const Oh=df(dB);function Lg(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 fB(){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(f,...m){const h=e[++i];let g=-1;if(f){c(f);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,h?pB(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 pB(e,t){let n;return s;function s(...c){const u=e.length>c.length;let f;u&&c.push(o);try{f=e.apply(this,c)}catch(m){const h=m;if(u&&n)throw h;return o(h)}u||(f&&f.then&&typeof f.then=="function"?f.then(i,o):f instanceof Error?o(f):i(f))}function o(c,...u){n||(n=!0,t(c,...u))}function i(c){o(null,c)}}const xs={basename:mB,dirname:hB,extname:gB,join:xB,sep:"/"};function mB(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mc(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 hB(e){if(Mc(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 gB(e){Mc(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 xB(...e){let t=-1,n;for(;++t<e.length;)Mc(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":yB(n)}function yB(e){Mc(e);const t=e.codePointAt(0)===47;let n=bB(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function bB(e,t){let n="",s=0,o=-1,i=0,c=-1,u,f;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(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",s=0):(n=n.slice(0,f),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 Mc(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const vB={cwd:wB};function wB(){return"/"}function Og(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jB(e){if(typeof e=="string")e=new URL(e);else if(!Og(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 kB(e)}function kB(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 Ih=["history","path","basename","stem","extname","dirname"];class KC{constructor(t){let n;t?Og(t)?n={path:t}:typeof t=="string"||SB(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":vB.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Ih.length;){const i=Ih[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)Ih.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?xs.basename(this.path):void 0}set basename(t){Mh(t,"basename"),_h(t,"basename"),this.path=xs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xs.dirname(this.path):void 0}set dirname(t){t0(this.basename,"dirname"),this.path=xs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xs.extname(this.path):void 0}set extname(t){if(_h(t,"extname"),t0(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=xs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Og(t)&&(t=jB(t)),Mh(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xs.basename(this.path,this.extname):void 0}set stem(t){Mh(t,"stem"),_h(t,"stem"),this.path=xs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Gn(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function _h(e,t){if(e&&e.includes(xs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xs.sep+"`")}function Mh(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function t0(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function SB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NB=(function(e){const s=this.constructor.prototype,o=s[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,s),i}),CB={}.hasOwnProperty;class yy extends NB{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=fB()}copy(){const t=new yy;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Oh(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bh("data",this.frozen),this.namespace[t]=n,this):CB.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bh("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=ud(t),s=this.parser||this.Parser;return Fh("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Fh("process",this.parser||this.Parser),zh("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,c){const u=ud(t),f=s.parse(u);s.run(f,u,function(h,g,y){if(h||!g||!y)return m(h);const b=g,C=s.stringify(b,y);RB(C)?y.value=C:y.result=C,m(h,y)});function m(h,g){h||!g?c(h):i?i(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Fh("processSync",this.parser||this.Parser),zh("processSync",this.compiler||this.Compiler),this.process(t,o),r0("processSync","process",n),s;function o(i,c){n=!0,Zj(i),s=c}}run(t,n,s){n0(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 f=ud(n);o.run(t,f,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){Zj(c),o=u,s=!0}}stringify(t,n){this.freeze();const s=ud(n),o=this.compiler||this.Compiler;return zh("stringify",o),n0(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if(Bh("use",this.frozen),t!=null)if(typeof t=="function")f(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")f(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;f(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=Oh(!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 f(m,h){let g=-1,y=-1;for(;++g<s.length;)if(s[g][0]===m){y=g;break}if(y===-1)s.push([m,...h]);else if(h.length>0){let[b,...C]=h;const j=s[y][1];Lg(j)&&Lg(b)&&(b=Oh(!0,j,b)),s[y]=[m,b,...C]}}}}const EB=new yy().freeze();function Fh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zh(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bh(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 n0(e){if(!Lg(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 ud(e){return TB(e)?e:new KC(e)}function TB(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function RB(e){return typeof e=="string"||PB(e)}function PB(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AB="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",s0=[],o0={allowDangerousHtml:!0},DB=/^(https?|ircs?|mailto|xmpp)$/i,$B=[{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 LB(e){const t=OB(e),n=IB(e);return _B(t.runSync(t.parse(n),n),e)}function OB(e){const t=e.rehypePlugins||s0,n=e.remarkPlugins||s0,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...o0}:o0;return EB().use(mz).use(n).use(cB,s).use(t)}function IB(e){const t=e.children||"",n=new KC;return typeof t=="string"&&(n.value=t),n}function _B(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,i=t.disallowedElements,c=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||MB;for(const h of $B)Object.hasOwn(t,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+AB+h.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),WC(e,m),qM(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 Ah)if(Object.hasOwn(Ah,b)&&Object.hasOwn(h.properties,b)){const C=h.properties[b],j=Ah[b];(j===null||j.includes(h.tagName))&&(h.properties[b]=f(String(C||""),b,h))}}if(h.type==="element"){let b=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!b&&s&&typeof g=="number"&&(b=!s(h,g,y)),b&&y&&typeof g=="number")return u&&h.children?y.children.splice(g,1,...h.children):y.children.splice(g,1),g}}}function MB(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||DB.test(e.slice(0,t))?e:""}function xn({content:e,className:t,emptyState:n="No markdown content yet."}){const s=e.replace(/<!--[\s\S]*?-->/g,"");return s.trim()?r.jsx("div",{className:we("prose-syntaur max-w-none",t),children:r.jsx(LB,{children:s})}):r.jsx("div",{className:"rounded-md border border-dashed border-border/80 bg-muted/30 px-3 py-4 text-sm text-muted-foreground",children:n})}function Wr(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function FB(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{if(e)try{const f=await fetch(Wr(e));if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),kc(f=>{f.type==="todos-updated"&&f.projectSlug===e&&u()}),{data:t,loading:s,error:i,refetch:u}}async function zB(e,t,n){await fetch(Wr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function BB(e,t,n){await fetch(`${Wr(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function UB(e,t,n){await fetch(`${Wr(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function VB(e,t,n){await fetch(`${Wr(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function HB(e,t){await fetch(`${Wr(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function WB(e,t){await fetch(`${Wr(e)}/${t}`,{method:"DELETE"})}async function KB(e,t,n){const s=await fetch(`${Wr(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}function qC(e,t,n){return`${Wr(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function qB(e,t,n){for(const s of n){const o=await fetch(`${Wr(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(s.name||"file"),"x-attachment-mime":s.type||"application/octet-stream"},body:s});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function GB(e,t,n){const s=await fetch(qC(e,t,n),{method:"DELETE"});if(!s.ok)throw new Error(await s.text().catch(()=>"")||`HTTP ${s.status}`)}async function GC(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 YB(e,t){return await GC(`${Wr(e)}/promote`,t)}async function JB(e,t,n){await GC(`${Wr(e)}/${t}/move`,{to:n})}const a0=[{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 YC({status:e,onChange:t}){const[n,s]=p.useState(!1),o=p.useRef(null);p.useEffect(()=>{if(!n)return;function c(u){o.current&&!o.current.contains(u.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);const i=a0.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:a0.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 JC({item:e,copiedId:t,selected:n,editing:s,onBeginEdit:o,onEndEdit:i,onPatchDescription:c,onAddAttachments:u,onDeleteAttachment:f,attachmentUrl:m,onToggleSelected:h,onMoveOne:g,onStatusChange:y,onCopyId:b,onDelete:C,hotkeyRowProps:j,onDragOrigin:v,onDragStart:k,onDragEnd:E,isDragging:S}){return r.jsxs("div",{draggable:!0,"data-todo-id":e.id,...j??{},onMouseDown:v,onDragStart:T=>k(T,e.id),onDragEnd:E,className:`surface-panel flex items-start gap-3 px-3 py-2 cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${S?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:T=>h(e.id,T),onClick:T=>T.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(YC,{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(QC,{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(t8,{item:e})]}),r.jsx(XC,{item:e,attachmentUrl:m,onAdd:T=>u(e.id,T),onDelete:T=>f(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(Od,{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(gf,{className:"h-3 w-3"})}),r.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:T=>C(T,e.id,e.description),children:r.jsx(Tn,{className:"h-3 w-3"})})]})]})}function QC({description:e,status:t,editing:n,onBeginEdit:s,onEndEdit:o,onSave:i}){return n?r.jsx(QB,{initialValue:e,onSave:i,onExit:o}):r.jsx("button",{type:"button","data-no-drag":!0,onClick:c=>{c.stopPropagation(),s()},title:"Click to edit",className:we("text-left text-sm rounded-sm transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",t==="completed"?"line-through text-muted-foreground":"text-foreground"),children:e})}function QB({initialValue:e,onSave:t,onExit:n}){const s=p.useRef(e),[o,i]=p.useState(e),[c,u]=p.useState(!1),[f,m]=p.useState(!1),h=p.useRef(null),g=p.useRef(!1);p.useEffect(()=>{const j=h.current;j&&(j.focus(),j.select())},[]);const y=p.useCallback(()=>{var j;m(!0),window.setTimeout(()=>m(!1),260),(j=h.current)==null||j.focus()},[]),b=p.useCallback(async()=>{if(g.current)return;const j=o.trim();if(j.length===0){y();return}if(j===s.current){n();return}g.current=!0,u(!0);try{await t(j)}catch{}finally{u(!1),n()}},[o,n,t,y]);function C(j){j.key==="Enter"?(j.preventDefault(),b()):j.key==="Escape"&&(j.preventDefault(),g.current=!0,n())}return r.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:c,value:o,onClick:j=>j.stopPropagation(),onChange:j=>i(j.target.value),onKeyDown:C,onBlur:()=>void b(),className:we("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-sm text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",f&&"syntaur-input-shake",c&&"opacity-70")})}function XB(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function ZB(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 XC({item:e,attachmentUrl:t,onAdd:n,onDelete:s}){const o=e.attachments??[],[i,c]=p.useState(!1),[u,f]=p.useState(!1),m=p.useRef(null),h=p.useRef(null);p.useEffect(()=>{var y;i&&((y=h.current)==null||y.focus())},[i]);const g=p.useCallback(async y=>{if(y.length){f(!0);try{await n(y),c(!1)}finally{f(!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(e8,{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(wk,{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=ZB(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 e8({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:[XB(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(wk,{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(rx,{className:"h-3 w-3"})})]})}function t8({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(aa,{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(Qg,{className:"h-2.5 w-2.5"}),r.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),r.jsx(cr,{children:e.branch})]})}):null,e.planDir?r.jsx(aa,{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(),Oc(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(bk,{className:"h-2.5 w-2.5"})})}),r.jsxs(cr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?r.jsx(aa,{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(cr,{children:r.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?r.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?r.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?r.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const ZC="__one_off__";function by({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o,defaultProject:i,defaultTitle:c,allowOneOff:u=!0}){const[f,m]=p.useState("new"),[h,g]=p.useState(!1),[y,b]=p.useState(null),[C,j]=p.useState(null),[v,k]=p.useState(null),[E,S]=p.useState(""),[T,A]=p.useState(""),[R,P]=p.useState(""),[$,I]=p.useState(""),[M,D]=p.useState(""),[H,K]=p.useState(""),[_,U]=p.useState(null),[q,Z]=p.useState(!1),F=t.length>1;p.useEffect(()=>{if(!e){m("new"),b(null),S(""),A(""),P(""),I(""),D(""),K(""),U(null);return}S(i??""),A(c??"");let ue=!1;return(async()=>{try{const ge=await fetch("/api/projects");if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const se=await ge.json();ue||j(se.filter(ye=>!ye.archived))}catch(ge){ue||k(ge instanceof Error?ge.message:String(ge))}})(),()=>{ue=!0}},[e,i,c]),p.useEffect(()=>{if(!M){U(null);return}let ue=!1;return Z(!0),(async()=>{try{const ge=await fetch(`/api/projects/${encodeURIComponent(M)}/assignments`);if(!ge.ok)throw new Error(`HTTP ${ge.status}`);const se=await ge.json();ue||U(se)}catch{ue||U([])}finally{ue||Z(!1)}})(),()=>{ue=!0}},[M]);const G=p.useMemo(()=>C??[],[C]);async function L(ue){if(ue.preventDefault(),!E){b('Pick a target project (or "One-off").');return}if(F&&!T.trim()){b("Title is required when promoting multiple todos.");return}const ge=E===ZC?{oneOff:!0}:{project:E};if(n.kind==="aggregate"){const ye={groups:n.groups,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await B(ye);return}const se={todoIds:t,mode:"new-assignment",target:ge,title:T.trim()||void 0,type:R.trim()||void 0,priority:$||void 0};await re(se)}async function V(ue){if(ue.preventDefault(),n.kind==="aggregate"){b("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!M||!H){b("Pick both project and assignment.");return}const ge={todoIds:t,mode:"to-assignment",target:{assignment:`${M}/${H}`}};await re(ge)}async function re(ue){g(!0),b(null);try{let ge;if(n.kind==="workspace")ge=await p3(n.workspace,ue);else if(n.kind==="project")ge=await YB(n.projectId,ue);else throw new Error("Aggregate scope requires runBulkMutation.");o(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}async function B(ue){g(!0),b(null);try{const ge=await m3(ue);o(ge),s(!1)}catch(ge){b(ge instanceof Error?ge.message:String(ge))}finally{g(!1)}}return r.jsx(zn,{open:e,onOpenChange:ue=>h?void 0:s(ue),children:r.jsxs($n,{className:"max-w-xl",children:[r.jsxs(pr,{children:[r.jsxs(Ln,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{children:["Convert the selected todo",t.length===1?"":"s"," to a new or existing assignment. Source todo",t.length===1?"":"s"," will be marked ",r.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),r.jsxs(uC,{value:f,onValueChange:ue=>m(ue),children:[r.jsxs(dC,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[r.jsx(Sg,{value:"new",className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"New assignment"}),r.jsx(Sg,{value:"existing",className:we("inline-flex items-center gap-2 rounded-sm px-3 py-1.5 text-sm font-medium text-muted-foreground transition","data-[state=active]:bg-foreground data-[state=active]:text-background"),children:"Existing assignment"})]}),r.jsx(Ng,{value:"new",children:r.jsxs("form",{onSubmit:L,className:"space-y-4",children:[r.jsx(ri,{label:"Target project",children:r.jsx(i0,{value:E,onChange:S,projects:G,error:v,disabled:h,allowOneOff:u})}),r.jsx(ri,{label:F?"Title (required)":"Title (defaults to first todo)",children:r.jsx("input",{type:"text",value:T,onChange:ue=>A(ue.target.value),disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ri,{label:"Type",children:r.jsx("input",{type:"text",value:R,onChange:ue=>P(ue.target.value),placeholder:"feature",disabled:h,className:"editor-input bg-background/95 font-sans"})}),r.jsx(ri,{label:"Priority",children:r.jsxs("select",{value:$,onChange:ue=>I(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(c0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})}),r.jsx(Ng,{value:"existing",children:r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsx(ri,{label:"Project",children:r.jsx(i0,{value:M,onChange:ue=>{D(ue),K("")},projects:G,error:v,disabled:h})}),r.jsx(ri,{label:q?"Assignment (loading...)":"Assignment",children:r.jsxs("select",{value:H,onChange:ue=>K(ue.target.value),disabled:h||!M||q,className:"editor-input bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:M?"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(c0,{onCancel:()=>s(!1),submitting:h,submitLabel:"Promote"})]})})]})]})})}function ri({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 i0({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:ZC,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 c0({onCancel:e,submitting:t,submitLabel:n}){return r.jsxs(Vr,{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 eE({open:e,selectedIds:t,scope:n,onOpenChange:s,onDone:o}){const[i,c]=p.useState("project"),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(!1),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null);p.useEffect(()=>{if(!e){c("project"),f(""),h(""),C(null),v(null);return}let P=!1;return(async()=>{try{const $=await fetch("/api/projects");if(!$.ok)throw new Error(`HTTP ${$.status}`);const I=await $.json();P||E(I.filter(M=>!M.archived))}catch($){P||v($ instanceof Error?$.message:String($))}})(),()=>{P=!0}},[e]);const S=p.useMemo(()=>k?n.kind==="project"?k.filter(P=>P.slug!==n.projectId):k:[],[k,n]);function T(){if(i==="global")return{global:!0};if(i==="workspace"){const P=u.trim();return P?{workspace:P}:"Workspace name is required."}return m?{project:m}:"Pick a target project."}async function A(P,$){try{return n.kind==="workspace"?await h3(n.workspace,P,$):await JB(n.projectId,P,$),{ok:!0}}catch(I){return{ok:!1,error:I instanceof Error?I.message:String(I)}}}async function R(P){P.preventDefault(),v(null);const $=T();if(typeof $=="string"){v($);return}y(!0),C(null);const I=[],M=[];for(const D of t){const H=await A(D,$);H.ok?I.push(D):M.push({id:D,error:H.error})}y(!1),o(),M.length===0?s(!1):C({succeeded:I,failed:M})}return r.jsx(zn,{open:e,onOpenChange:P=>g?void 0:s(P),children:r.jsx($n,{className:"max-w-xl",children:r.jsxs("form",{onSubmit:R,className:"space-y-4",children:[r.jsxs(pr,{children:[r.jsxs(Ln,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),r.jsxs(Hr,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),r.jsxs("fieldset",{className:"space-y-2",disabled:g,children:[r.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),r.jsx(Uh,{kind:"project",checked:i==="project",onChange:()=>c("project"),label:"Project"}),r.jsx(Uh,{kind:"workspace",checked:i==="workspace",onChange:()=>c("workspace"),label:"Workspace"}),r.jsx(Uh,{kind:"global",checked:i==="global",onChange:()=>c("global"),label:"Global"})]}),i==="project"?r.jsx(u0,{label:"Target project",children:r.jsxs("select",{value:m,onChange:P=>h(P.target.value),disabled:g,className:"editor-textarea w-full bg-background/95 font-sans",children:[r.jsx("option",{value:"",children:"Select project..."}),S.map(P=>r.jsxs("option",{value:P.slug,children:[P.title," (",P.slug,")"]},P.slug))]})}):null,i==="workspace"?r.jsx(u0,{label:"Target workspace name",children:r.jsx("input",{type:"text",value:u,onChange:P=>f(P.target.value),disabled:g,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,j?r.jsx(n8,{message:j}):null,b?r.jsxs("div",{className:"rounded-md border border-warning-foreground/30 bg-warning px-3 py-2 text-sm text-warning-foreground space-y-1",children:[r.jsxs("div",{className:"font-medium",children:["Moved ",b.succeeded.length," of ",t.length,"; ",b.failed.length," failed."]}),r.jsx("ul",{className:"text-xs space-y-0.5",children:b.failed.map(P=>r.jsxs("li",{children:["[t:",P.id,"] ",P.error]},P.id))})]}):null,r.jsxs(Vr,{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 u0({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 Uh({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 n8({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 vy({label:e,count:t,expanded:n,onToggle:s,isDropTarget:o=!1,onDragOver:i,onDragLeave:c,onDrop:u,children:f}){return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/40 transition",o&&"ring-2 ring-ring/30"),onDragOver:i,onDragLeave:c,onDrop:u,children:[r.jsxs("button",{type:"button",onClick:s,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[r.jsx(fr,{className:we("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),r.jsx("span",{className:"font-semibold text-foreground",children:e}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&r.jsx("div",{className:"space-y-1 px-2 pb-2",children:f})]})}const tE=[{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 ap(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function wy(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[ap(n.status)].push(n);return tE.map(n=>({config:n,items:t[n.id]}))}const nE="syntaur.todos.sections.collapsed.v1",d0=Object.fromEntries(tE.map(e=>[e.id,e.defaultCollapsed]));function Vh(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(nE);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function r8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(nE,JSON.stringify(e))}catch{}}function jy(e){const[t,n]=p.useState(()=>Vh()[e]??{});p.useEffect(()=>{n(Vh()[e]??{})},[e]);const s=p.useCallback(i=>t[i]??d0[i],[t]),o=p.useCallback(i=>{const c=Vh(),u=c[e]??{},f=u[i]??d0[i],m={...u,[i]:!f};c[e]=m,r8(c),n(m)},[e]);return{isCollapsed:s,toggle:o}}function s8({projectId:e}){const{data:t,loading:n,error:s,refetch:o}=FB(e),[i,c]=p.useState(""),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(new Set),[S,T]=p.useState(!1),[A,R]=p.useState(!1),[P,$]=p.useState(null),I=p.useRef(null);To("list:todos");const M=jy("project:"+e),[D,H]=p.useState(null),[K,_]=p.useState(null),U=p.useRef(null);async function q(Y,fe){Y.stopPropagation(),await Oc(fe)&&(C(fe),setTimeout(()=>C(ne=>ne===fe?null:ne),1500))}const Z=p.useMemo(()=>{if(!(t!=null&&t.items))return[];const Y=new Set;for(const fe of t.items)for(const ne of fe.tags)Y.add(ne);return Array.from(Y).sort()},[t]),F=p.useMemo(()=>{if(!(t!=null&&t.items))return[];let Y=t.items;if(i.trim()){const fe=i.toLowerCase();Y=Y.filter(ne=>ne.description.toLowerCase().includes(fe)||ne.tags.some(he=>he.toLowerCase().includes(fe))||ne.id.includes(fe))}return u&&(Y=Y.filter(fe=>fe.status===u)),m&&(Y=Y.filter(fe=>fe.tags.includes(m))),Y},[t,i,u,m]);p.useEffect(()=>{E(new Set)},[i,u,m,e]);const G=p.useMemo(()=>F.filter(Y=>k.has(Y.id)).length,[F,k]),L=F.length>0&&G===F.length,V=G>0&&!L;function re(Y){E(fe=>{const ne=new Set(fe);return ne.has(Y)?ne.delete(Y):ne.add(Y),ne})}function B(){E(Y=>{const fe=new Set(Y);if(L)for(const ne of F)fe.delete(ne.id);else for(const ne of F)fe.add(ne.id);return fe})}function ue(){E(new Set)}const ge=P?[P]:Array.from(k);function se(){E(new Set),$(null),o()}function ye(){E(new Set),o()}async function Se(){g.trim()&&(await zB(e,g.trim()),y(""),o())}async function Ee(Y,fe,ne){Y.stopPropagation(),window.confirm(`Delete "${ne}"? This can't be undone.`)&&(await WB(e,fe),o())}async function Ae(Y,fe){switch(fe){case"open":await HB(e,Y);break;case"in_progress":await VB(e,Y);break;case"completed":await BB(e,Y);break;case"blocked":await UB(e,Y);break}o()}async function Ke(Y,fe){await KB(e,Y,fe),o()}async function ct(Y,fe){await qB(e,Y,fe),o()}async function et(Y,fe){await GB(e,Y,fe),o()}const ot=wy(F),X=ot.filter(Y=>!M.isCollapsed(Y.config.id)).flatMap(Y=>Y.items),{hotkeyRowProps:Me}=Nc(X,{scope:"list:todos",bindO:!1,onOpen:Y=>v(Y.id)});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var Y;return(Y=I.current)==null?void 0:Y.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Ce,Ie]=Ns(),Ye=Ce.get("focus");p.useEffect(()=>{if(!Ye||!(t!=null&&t.items))return;const Y=t.items.find(ne=>ne.id===Ye);if(!Y)return;const fe=ap(Y.status);M.isCollapsed(fe)&&M.toggle(fe)},[Ye,t==null?void 0:t.items]),p.useEffect(()=>{if(!Ye)return;const Y=document.querySelector(`[data-todo-id="${window.CSS.escape(Ye)}"]`);if(!Y)return;Y.scrollIntoView({block:"nearest"}),Y.classList.add("ring-2","ring-primary/60");const fe=window.setTimeout(()=>{Y.classList.remove("ring-2","ring-primary/60"),Ie(ne=>{const he=new URLSearchParams(ne);return he.delete("focus"),he},{replace:!0})},1500);return()=>window.clearTimeout(fe)},[Ye,X.length,Ie]);const Fe=D?(t==null?void 0:t.items.find(Y=>Y.id===D))??null:null;function Ze(Y,fe){const ne=U.current;if(ne!=null&&ne.closest(Ri)){Y.preventDefault();return}Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",fe),H(fe)}function Qe(){H(null),_(null)}function Ot(Y,fe){!Fe||fe.statuses.includes(Fe.status)||(Y.preventDefault(),Y.dataTransfer.dropEffect="move",_(fe.id))}function yt(Y,fe){K===fe.id&&!Y.currentTarget.contains(Y.relatedTarget)&&_(null)}function dt(Y,fe){Y.preventDefault();const ne=Fe;Qe(),!(!ne||fe.statuses.includes(ne.status))&&Ae(ne.id,fe.dropStatus)}if(n)return r.jsx(xt,{label:"Loading todos..."});if(s)return r.jsx(Tt,{error:s});const le=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Mn,{label:"Open",value:le.open,icon:Fr}),r.jsx(Mn,{label:"In Progress",value:le.in_progress,icon:Fr,tone:"info"}),r.jsx(Mn,{label:"Blocked",value:le.blocked,icon:nx,tone:"warn"}),r.jsx(Mn,{label:"Total",value:le.total,icon:Fr})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:Y=>y(Y.target.value),onKeyDown:Y=>Y.key==="Enter"&&Se(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:Se,disabled:!g.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(No,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:I,type:"text",placeholder:"Search...",value:i,onChange:Y=>c(Y.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:u,onChange:Y=>f(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),Z.length>0&&r.jsxs("select",{value:m,onChange:Y=>h(Y.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),Z.map(Y=>r.jsxs("option",{value:Y,children:["#",Y]},Y))]})]}),k.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[k.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{$(null),R(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:ue,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,F.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:L,ref:Y=>{Y&&(Y.indeterminate=V)},onChange:B,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",F.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let Y=-1;return ot.map(({config:fe,items:ne})=>{const he=!M.isCollapsed(fe.id);return r.jsx(vy,{label:fe.label,count:ne.length,expanded:he,onToggle:()=>M.toggle(fe.id),isDropTarget:K===fe.id,onDragOver:De=>Ot(De,fe),onDragLeave:De=>yt(De,fe),onDrop:De=>dt(De,fe),children:he&&ne.map(De=>(Y+=1,r.jsx(JC,{item:De,copiedId:b,selected:k.has(De.id),editing:j===De.id,onBeginEdit:ut=>v(ut),onEndEdit:()=>v(null),onPatchDescription:Ke,onAddAttachments:ct,onDeleteAttachment:et,attachmentUrl:(ut,ae)=>qC(e,ut,ae),onToggleSelected:ut=>re(ut),onMoveOne:(ut,ae)=>{ae.stopPropagation(),$(ut),R(!0)},onStatusChange:Ae,onCopyId:q,onDelete:Ee,hotkeyRowProps:Me(Y),onDragOrigin:ut=>{U.current=ut.target},onDragStart:Ze,onDragEnd:Qe,isDragging:D===De.id},De.id)))},fe.id)})})()}),r.jsx(by,{open:S,selectedIds:Array.from(k),scope:{kind:"project",projectId:e},onOpenChange:T,onDone:ye}),r.jsx(eE,{open:A,selectedIds:ge,scope:{kind:"project",projectId:e},onOpenChange:Y=>{R(Y),Y||$(null)},onDone:se})]})}const o8={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},f0=new Set(["title"]);function rE({visibility:e,onChange:t}){const[n,s]=p.useState(!1);function o(c){if(f0.has(c))return;const f=e.hidden.includes(c)?e.hidden.filter(m=>m!==c):[...e.hidden,c];t({hidden:f})}const i=e.hidden.length;return r.jsxs(zn,{open:n,onOpenChange:s,children:[r.jsx(o$,{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(AP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsxs("span",{children:["Columns",i>0?` (${vh.length-i}/${vh.length})`:""]})]})}),r.jsxs($n,{className:"max-w-sm",children:[r.jsx(pr,{children:r.jsx(Ln,{children:"Columns"})}),r.jsx("div",{className:"space-y-2",children:vh.map(c=>{const u=e.hidden.includes(c),f=f0.has(c);return r.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${f?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[r.jsx("input",{type:"checkbox",checked:!u,onChange:()=>o(c),disabled:f,className:"h-4 w-4 rounded border-border accent-foreground"}),r.jsx("span",{children:o8[c]}),f?r.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},c)})})]})]})}const Ni={...pc,custom:!1},sE=`view-prefs.cache.v${pc.version}`;let yc=a8(),si=null;const bc=new Set;let oE=0;function ky(){return++oE}function Sy(e){return e===oE}function a8(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(sE);if(!e)return null;const t=JSON.parse(e);return t.version!==pc.version?null:t}catch{return null}}function i8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(sE,JSON.stringify(e))}catch{}}function Ny(e){yc=e,i8(e);for(const t of bc)t(e)}function Cy(e){if(!e||typeof e!="object")return Ni;const t=e;return t.version!==pc.version||!t.global||!t.projects?Ni:{version:pc.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function Ey(){if(si)return si;const e=ky();return si=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=Cy(t);return Sy(e)&&Ny(n),si=null,yc??n}).catch(()=>(si=null,yc??Ni)),si}function aE(e){const[t,n]=p.useState(()=>yc??Ni);return p.useEffect(()=>{let s=!1;return Ey().then(o=>{s||n(o)}),bc.add(n),()=>{s=!0,bc.delete(n)}},[]),I1(t,e??null)}function l8(){const[e,t]=p.useState(()=>yc??Ni);return p.useEffect(()=>{let n=!1;return Ey().then(s=>{n||t(s)}),bc.add(t),()=>{n=!0,bc.delete(t)}},[]),e}async function iE(e){const t=ky(),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=Cy(await n.json());return Sy(t)&&Ny(s),s}function lE(e){return iE({global:e})}function cE(e,t){return iE({projects:{[e]:t}})}async function c8(){const e=ky(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=Cy(await t.json());return Sy(e)&&Ny(n),n}const p0=80;function uE({open:e,onOpenChange:t,initialName:n="",onSubmit:s,title:o="Save view"}){const[i,c]=p.useState(n),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{e&&(c(n),h(null),f(!1))},[e,n]);const g=i.trim(),y=g.length>0&&g.length<=p0;return r.jsx(zn,{open:e,onOpenChange:t,children:r.jsx($n,{className:"max-w-md",children:r.jsxs("form",{className:"space-y-4",onSubmit:async b=>{if(b.preventDefault(),!(!y||u)){f(!0),h(null);try{await s(g)}catch(C){h(C instanceof Error?C.message:String(C)),f(!1)}}},children:[r.jsx(pr,{children:r.jsx(Ln,{children:o})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:p0,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(Vr,{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 dE({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:s}){const{views:o,loading:i}=Pc(),[c,u]=p.useState(!1),f=p.useRef(null);p.useEffect(()=>{if(!c)return;function y(C){f.current&&!f.current.contains(C.target)&&u(!1)}function b(C){C.key==="Escape"&&u(!1)}return document.addEventListener("mousedown",y),document.addEventListener("keydown",b),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",b)}},[c]);const m=p.useMemo(()=>o.filter(y=>V1(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:f,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(fr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),c&&r.jsx("div",{className:"absolute right-0 top-full z-30 mt-1 min-w-[240px] rounded-md border border-border/70 bg-background shadow-lg py-1",children:m.length===0?r.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[r.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),r.jsx("button",{type:"button",onClick:()=>{u(!1),s()},className:"shell-action w-full justify-center",children:"Save current view"})]}):m.map(y=>{const b=y.id===t;return r.jsxs("button",{type:"button",onClick:()=>{u(!1),n(y)},className:we("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",b&&"font-semibold text-foreground"),children:[r.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:b?r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),r.jsx("span",{className:"truncate",children:y.name})]},y.id)})})]})}const u8=new Set(["overview","assignments","todos","dependencies","knowledge"]),m0="__unknown_type__";function h0(){const{slug:e,workspace:t}=Bt(),n=fn(),s=zt();To("project"),Yt({keys:"a",scope:"project",description:"Create assignment",handler:()=>s(`${n}/projects/${e}/create/assignment`)}),Yt({keys:"e",scope:"project",description:"Edit project",handler:()=>s(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:c,refetch:u}=Kk(e),f=pa(),m=Qf(),{data:h}=Sc(),[g,y]=Ns(),b=g.get("tab"),C=b&&u8.has(b)?b:"overview";function j(oe){y(Ue=>{const nt=new URLSearchParams(Ue);return oe==="overview"?nt.delete("tab"):nt.set("tab",oe),nt},{replace:!0})}const v=e?`p:${e}`:null,k=aE(v),[E,S]=p.useState(()=>yh(k.defaultView)),[T,A]=p.useState(()=>ze(k.filters.status)),[R,P]=p.useState(()=>ze(k.filters.assignee)),[$,I]=p.useState(()=>ze(k.filters.priority)),[M,D]=p.useState(()=>ze(k.filters.type)),[H,K]=p.useState(()=>ze(k.filters.tags)),[_,U]=p.useState(null),[q,Z]=p.useState(()=>k.grouping),[F,G]=p.useState(()=>k.sortField),[L,V]=p.useState(()=>k.sortDirection),[re,B]=p.useState(()=>({collapsed:[]})),[ue,ge]=p.useState(()=>({hidden:[]})),[se,ye]=p.useState(()=>({hidden:[]})),[Se,Ee]=p.useState(null),[Ae,Ke]=p.useState(!1),[ct,et]=p.useState(!1),{toast:ot,showToast:X,dismissToast:Me}=Ro(),Ce={kind:"project",slug:e??"",workspace:t??null},Ie=g.get("loadView"),{view:Ye,loading:Fe,error:Ze}=jo(Ie),{view:Qe,loading:Ot,error:yt}=jo(Se),dt=p.useRef(null);p.useEffect(()=>{Se&&!Ot&&!yt&&!Qe&&Ee(null)},[Qe,yt,Se,Ot]),p.useEffect(()=>{Ee(null),dt.current=null,U(null)},[e,t]),p.useEffect(()=>{S(yh(k.defaultView)),A(ze(k.filters.status)),P(ze(k.filters.assignee)),I(ze(k.filters.priority)),D(ze(k.filters.type)),K(ze(k.filters.tags)),Z(k.grouping),G(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 le=p.useCallback(oe=>{v&&cE(v,oe).catch(Ue=>{console.warn("Failed to persist project view prefs:",Ue)})},[v]),Y=p.useCallback(oe=>{S(oe),le({defaultView:oe})},[le]),fe=p.useCallback(oe=>{A(oe),le({filters:{status:oe}})},[le]),ne=p.useCallback(oe=>{P(oe),le({filters:{assignee:oe}})},[le]),he=p.useCallback(oe=>{I(oe),le({filters:{priority:oe}})},[le]),De=p.useCallback(oe=>{D(oe),le({filters:{type:oe}})},[le]),ut=p.useCallback(oe=>{K(oe),le({filters:{tags:oe}})},[le]),ae=p.useCallback(oe=>{Z(oe),le({grouping:oe})},[le]),be=p.useCallback(oe=>{G(oe),le({sortField:oe})},[le]),$e=p.useCallback(oe=>{V(oe),le({sortDirection:oe})},[le]),at=p.useCallback(()=>({viewMode:E,filters:{status:T,priority:$,type:M,assignee:R,tags:H,project:"all",activity:"all",dateRange:ia(_)},sortField:F,sortDirection:L,listSectionVisibility:re,kanbanColumnVisibility:ue,tableColumnVisibility:se}),[E,T,$,M,R,H,_,F,L,re,ue,se]),Be=p.useCallback(oe=>{FN(oe,{setViewMode:Ue=>S(yh(Ue)),setStatusFilter:fe,setPriorityFilter:he,setTypeFilter:De,setAssigneeFilter:ne,setTagsFilter:ut,setDateRange:U,setSortField:be,setSortDirection:$e,setListSectionVisibility:B,setKanbanColumnVisibility:ge,setTableColumnVisibility:ye}),Ee(oe.id)},[fe,he,De,ne,ut,be,$e]),kt=p.useCallback(oe=>{Be(oe),dt.current=oe.id,y(Ue=>{const nt=new URLSearchParams(Ue);return nt.set("loadView",oe.id),nt},{replace:!0})},[Be,y]),St=p.useCallback(async oe=>{try{const Ue=Pi({name:oe,context:{workspace:t??null,projectSlug:e??null},state:at()}),nt=await Ci(Ue),bt=nt.views[nt.views.length-1];Ee((bt==null?void 0:bt.id)??null),bt&&(dt.current=bt.id,y(er=>{const qr=new URLSearchParams(er);return qr.set("loadView",bt.id),qr},{replace:!0})),Ke(!1),et(!1),X(`Saved view "${oe}"`,"success")}catch(Ue){throw X(Ue instanceof Error?Ue.message:"Failed to save view","error"),Ue}},[at,y,X,e,t]),_t=p.useCallback(async()=>{if(!(!Se||!Qe))try{const oe=ze(Qe.config.filters.project)[0]??null,Ue=Pi({name:Qe.name,context:{workspace:t??null,projectSlug:oe},state:at()}),nt=tf(Qe.config,Ue.config,Ue.config);await Gd(Se,{config:nt}),X("View updated","success")}catch(oe){X(oe instanceof Error?oe.message:"Failed to update view","error")}},[at,Qe,Se,X,t]);p.useEffect(()=>{if(!Ie){dt.current=null;return}if(dt.current!==Ie&&(Se&&Se!==Ie&&Ee(null),!Fe)){if(Ze){X("Couldn't load saved view — try again","error");return}if(Ye){if(dt.current=Ie,!V1(Ye,{kind:"project",slug:e??"",workspace:t??null})){s(BN(Ye),{replace:!0});return}Be(Ye),y(oe=>{const Ue=new URLSearchParams(oe);return Ue.delete("loadView"),Ue},{replace:!0});return}dt.current=Ie,X("Saved view no longer exists","error"),y(oe=>{const Ue=new URLSearchParams(oe);return Ue.delete("loadView"),Ue},{replace:!0})}},[Ie,Ye,Fe,Ze,Se,Be,y,X,s,e,t]);function pe(oe){F===oe?$e(L==="asc"?"desc":"asc"):(be(oe),$e("asc"))}const te=p.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(oe=>{const Ue=`${n}/projects/${o.slug}/assignments/${oe.slug}`;return[[oe.slug,Ue],[oe.title,Ue]]})):{},[o]);async function xe(oe){await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:oe})}),u()}async function Le(oe){try{const Ue=await fetch(`/api/projects/${e}/${oe?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ue.ok){const nt=await Ue.json().catch(()=>null);X((nt==null?void 0:nt.error)||`HTTP ${Ue.status}`,"error");return}u(),X(oe?"Project archived":"Project restored","success")}catch(Ue){X(Ue instanceof Error?Ue.message:"Failed to update archive state","error")}}async function tt(oe){await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:oe})}),u()}if(i)return r.jsx(xt,{label:"Loading project workspace…"});if(c||!o)return r.jsx(Tt,{error:c||"Project not found."});const ve=(()=>{const oe=new Set;for(const nt of o.assignments)nt.assignee&&oe.add(nt.assignee);const Ue=[{value:"__unassigned__",label:"Unassigned"}];for(const nt of Array.from(oe).sort())Ue.push({value:nt,label:nt});return Ue})(),Nt=Array.from(new Set(o.assignments.flatMap(oe=>oe.tags??[]))).sort().map(oe=>({value:oe,label:oe})),It=o.assignments.filter(oe=>R_(oe,{status:T,priority:$,type:M,assignee:R,tags:H,dateRange:ia(_)})),Zt=Lc(It,F,L),jt=new Set(m.definitions.map(oe=>oe.id)),wn=q==="type"?[...m.definitions.map(oe=>({id:oe.id,title:ji(m,oe.id),description:oe.description})),...It.some(oe=>!oe.type||!jt.has(oe.type))?[{id:m0,title:"Other",description:"Assignments with no recognized type."}]:[]]:WN(f.order).map(oe=>({id:oe,title:$c(f,oe),description:Jf(oe)}));function Rt({field:oe,children:Ue}){const nt=F===oe;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>pe(oe),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ue,nt?L==="asc"?r.jsx(xk,{className:"h-3 w-3"}):r.jsx(fr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":k.density,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(bn,{status:o.status}),o.statusOverride&&r.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>xe(null),title:"Clear manual status override and return to derived status",children:"Clear Override"}),r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value&&xe(oe.target.value)},title:"Override project status",children:[r.jsx("option",{value:"",children:"Set Status…"}),f.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:()=>Le(!o.archived),title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),h&&h.workspaces.length>0&&r.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:oe=>{oe.target.value==="_ungrouped"?tt(null):oe.target.value&&tt(oe.target.value)},title:"Move project to a different workspace",children:[r.jsx("option",{value:"",children:"Move to Workspace…"}),h.workspaces.filter(oe=>oe!==o.workspace).map(oe=>r.jsx("option",{value:oe,children:oe},oe)),o.workspace&&r.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),r.jsxs(Te,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(dw,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Project"})]}),r.jsxs(Te,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Assignment"})]}),r.jsx(ny,{externalIds:o.externalIds}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Fn(o.created),". Last source update ",Br(o.updated),"."]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[r.jsx(Mn,{label:"Assignments",value:o.progress.total}),r.jsx(Mn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),r.jsx(Mn,{label:"Review",value:o.progress.review??0,tone:"info"}),r.jsx(Mn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),r.jsx(Mn,{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(sy,{value:C,onValueChange:j,items:[{value:"overview",label:"Overview",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Project Overview",children:r.jsx(xn,{content:o.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(oe=>!oe.archived).length,content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:f.statuses.map(oe=>({value:oe.id,label:oe.label})),value:T,onChange:fe}),r.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:ve,value:R,onChange:ne}),r.jsx(yn,{ariaLabel:"Priority filter",className:"max-w-[170px]",allLabel:"All priorities",options:[{value:"critical",label:"Critical"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}],value:$,onChange:he}),r.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:m.definitions.map(oe=>({value:oe.id,label:ji(m,oe.id)})),value:M,onChange:De}),r.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:Nt,value:H,onChange:ut}),r.jsx(Xf,{className:"max-w-[190px]",value:_,onChange:U}),E==="kanban"&&r.jsxs("select",{value:q==="type"?"type":"status",onChange:oe=>ae(oe.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[r.jsx("option",{value:"status",children:"Group: Status"}),r.jsx("option",{value:"type",children:"Group: Type"})]}),r.jsx(tp,{value:E,onChange:oe=>Y(oe),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),r.jsx(dE,{scope:Ce,loadedViewId:Se,onApply:kt,onOpenSaveDialog:()=>{et(!1),Ke(!0)}}),r.jsx("button",{type:"button",onClick:()=>{Qe?_t():(et(!1),Ke(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:Qe?`Update ${Qe.name}`:"Save current view",children:Qe?`Update '${Qe.name}'`:"Save view"}),Qe?r.jsx("button",{type:"button",onClick:()=>{et(!0),Ke(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),children:It.length===0?r.jsx(Et,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:r.jsx(Te,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):E==="kanban"?r.jsx(Yf,{columns:wn,items:Zt,getItemId:oe=>oe.slug,getColumnId:oe=>q==="type"?oe.type&&jt.has(oe.type)?oe.type:m0:oe.status,dragDisabled:!0,renderCard:oe=>r.jsx(d8,{projectSlug:o.slug,assignment:oe}),emptyMessage:oe=>`No ${oe.title.toLowerCase()} assignments.`,hiddenColumnIds:ue.hidden,onHideColumn:oe=>ge(Ue=>({hidden:Ue.hidden.includes(oe)?Ue.hidden.filter(bt=>bt!==oe):[...Ue.hidden,oe]}))}):(()=>{const oe=new Set(se.hidden),Ue=nt=>nt==="title"||!oe.has(nt);return r.jsxs("div",{className:"overflow-x-auto",children:[r.jsx("div",{className:"mb-3 flex items-center justify-end",children:r.jsx(rE,{visibility:se,onChange:ye})}),r.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Ue("title")?r.jsx(Rt,{field:"title",children:"Assignment"}):null,Ue("status")?r.jsx(Rt,{field:"status",children:"Status"}):null,r.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ue("priority")?r.jsx(Rt,{field:"priority",children:"Priority"}):null,Ue("assignee")?r.jsx(Rt,{field:"assignee",children:"Assignee"}):null,Ue("dependencies")?r.jsx(Rt,{field:"dependencies",children:"Dependencies"}):null,Ue("created")?r.jsx(Rt,{field:"created",children:"Created"}):null,Ue("updated")?r.jsx(Rt,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Zt.map(nt=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ue("title")?r.jsx("td",{className:"py-4",children:r.jsx(Te,{to:`${n}/projects/${o.slug}/assignments/${nt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:nt.title})}):null,Ue("status")?r.jsx("td",{className:"py-4",children:r.jsx(bn,{status:nt.status,className:"max-w-[150px]"})}):null,r.jsx("td",{className:"py-4",children:r.jsx(ma,{type:nt.type,compact:!0})}),Ue("priority")?r.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:nt.priority}):null,Ue("assignee")?r.jsx("td",{className:"py-4 text-muted-foreground",children:nt.assignee??"—"}):null,Ue("dependencies")?r.jsx("td",{className:"py-4 text-muted-foreground",children:nt.dependsOn.length}):null,Ue("created")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Fn(nt.created)}):null,Ue("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Fn(nt.updated)}):null]},nt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:r.jsx(s8,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?r.jsx(He,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:r.jsx(gM,{definition:o.dependencyGraph,nodeRoutes:te})}):r.jsx(Et,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(He,{title:"Resources",description:"Shared project references.",actions:r.jsxs(Te,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?r.jsx(Et,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):r.jsx("div",{className:"space-y-3",children:o.resources.map(oe=>r.jsxs(Te,{to:`/projects/${o.slug}/resources/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.category," · ",oe.source]})]},oe.slug))})}),r.jsx(He,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:r.jsxs(Te,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[r.jsx(Lt,{className:"h-4 w-4"}),r.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?r.jsx(Et,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):r.jsx("div",{className:"space-y-3",children:o.memories.map(oe=>r.jsxs(Te,{to:`/projects/${o.slug}/memories/${oe.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:oe.name}),r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[oe.scope," · ",oe.source]})]},oe.slug))})})]})}]})}),r.jsxs("div",{className:"space-y-5",children:[r.jsx(He,{title:"Progress Summary",children:r.jsx(nf,{progress:o.progress,showLegend:!0})}),r.jsx(He,{title:"Attention",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Blocked"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.blockedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.failedCount})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),r.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.openQuestions})]})]})}),r.jsx(He,{title:"Quick Links",children:r.jsxs("div",{className:"space-y-2 text-sm",children:[r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[r.jsx(dw,{className:"h-4 w-4"}),"Edit project source"]}),r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create assignment"]}),r.jsxs(Te,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[r.jsx(jP,{className:"h-4 w-4"}),"Review project rules"]}),r.jsxs("button",{type:"button",onClick:()=>j("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Qg,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?r.jsxs(He,{title:"Archive Metadata",children:[r.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Br(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?r.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),r.jsx(ha,{toast:ot,onDismiss:Me}),r.jsx(uE,{open:Ae,onOpenChange:oe=>{Ke(oe),oe||et(!1)},initialName:ct&&Qe?`${Qe.name} (copy)`:"",title:ct?"Save as new view":"Save view",onSubmit:St})]})}function d8({projectSlug:e,assignment:t}){const n=fn();return r.jsxs(Te,{to:`${n}/projects/${e}/assignments/${t.slug}`,className:"vp-card block rounded-lg border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),r.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:t.id,children:[t.id.slice(0,8),r.jsx("span",{onClick:s=>{s.preventDefault(),s.stopPropagation()},children:r.jsx(zr,{value:t.id})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Fn(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(ma,{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 fE({sessionId:e,disabled:t=!1,disabledReason:n,onError:s,onNotice:o}){const[i,c]=p.useState(!1),[u,f]=p.useState(!1);async function m(){var g;if(t||u)return;f(!0);const h=(async()=>{const y=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!y.ok){const C=await y.json().catch(()=>null);throw new Error((C==null?void 0:C.error)??`HTTP ${y.status}`)}const b=await y.json().catch(()=>null);if(!b||typeof b.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:b.command,fallbackWarning:typeof b.fallbackWarning=="string"&&b.fallbackWarning?b.fallbackWarning:void 0}})();try{const y=typeof((g=navigator.clipboard)==null?void 0:g.write)=="function"&&typeof ClipboardItem<"u";let b;if(y)await navigator.clipboard.write([new ClipboardItem({"text/plain":h.then(C=>new Blob([C.command],{type:"text/plain"}))})]),b=(await h).fallbackWarning;else{const C=await h;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(C.command),b=C.fallbackWarning}c(!0),setTimeout(()=>c(!1),1500),b&&(o==null||o(b))}catch(y){let b=y instanceof Error?y:new Error(String(y));try{await h}catch(C){b=C instanceof Error?C:new Error(String(C))}s==null||s(b)}finally{f(!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(fw,{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(fw,{className:"h-3 w-3","aria-hidden":"true"})})}function Ml(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 f8(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 p8(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 pE(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 mE(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 m8(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 h8(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 g8(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 Ty extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function Ry(e){const t=await e.json().catch(()=>null);return new Ty((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function x8(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 y8(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 b8(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 Ry(s);return(await s.json()).assignment}async function v8(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 Ry(n);return(await n.json()).assignment}async function w8(e){const{url:t}=f8(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await Ry(n);return await n.json()}async function ip(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 j8(e,t,n){const s=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return ip(s)}async function k8(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return ip(n)}async function S8(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await ip(n)).sourceAssignments}async function N8(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await ip(t)).sourceAssignments}function gE(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[o,i]=p.useState(null),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(null),[v,k]=p.useState(null);async function E(R,P,$,I){if(!e){t(!0);try{const M=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:R.kind,id:R.id}})});if(!M.ok){window.location.href=Ml(R,P,void 0,$,I);return}const D=await M.json();if(D.ok){window.location.href=Ml(R,P,void 0,$,I);return}if(D.reason==="workspace-path-invalid"){D.recreate?(m(D.recreate),g({target:R,mode:P,agentId:$,prompt:I})):u(D.message);return}s(D),i({target:R,mode:P,agentId:$,prompt:I})}catch(M){console.warn("preflight failed, firing without override:",M),window.location.href=Ml(R,P,void 0,$,I)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=Ml(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),s(null),i(null))}async function T(){if(!(!f||!h||y)){b(!0),j(null);try{const R=await w8({kind:f.kind,id:f.id,projectSlug:f.projectSlug,assignmentSlug:f.assignmentSlug}),{target:P,mode:$,agentId:I,prompt:M}=h;m(null),g(null),window.location.href=Ml(P,$,void 0,I,M),!R.exact&&!R.alreadyExisted&&k(`Recreated from ${R.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(R){j(R instanceof Ty&&R.stderr?`${R.message}
|
|
559
|
+
${R.stderr}`:R instanceof Error?R.message:String(R))}finally{b(!1)}}}const A=r.jsxs(r.Fragment,{children:[r.jsx(li,{open:n!==null,onOpenChange:R=>!R&&(s(null),i(null)),children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsxs(ra,{children:[n==null?void 0:n.terminal," is not installed"]}),r.jsxs(sa,{children:[(n==null?void 0:n.terminal)==="cmux"?r.jsxs(r.Fragment,{children:["To use cmux, install ",r.jsx("strong",{children:"cmux.app"})," into"," ",r.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",r.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",r.jsx(Te,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{s(null),i(null)},children:"Settings"}),"."]})]}),r.jsxs(ui,{children:[r.jsx(cc,{className:"shell-action mt-0",children:"Cancel"}),r.jsxs(yo,{className:"shell-action mt-0 shell-action--cta",onClick:R=>{R.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),r.jsx(li,{open:c!==null,onOpenChange:R=>!R&&u(null),children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsx(ra,{children:"Can't open in agent"}),r.jsxs(sa,{children:[c," Set a valid worktree or repository, then try again."]})]}),r.jsx(ui,{children:r.jsx(yo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>u(null),children:"OK"})})]})}),r.jsx(li,{open:f!==null,onOpenChange:R=>{!R&&!y&&(m(null),g(null),j(null))},children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsx(ra,{children:"Worktree was deleted"}),r.jsxs(sa,{children:["The worktree at ",r.jsx("code",{children:f==null?void 0:f.deletedPath})," no longer exists. Recreate it",f!=null&&f.branch?r.jsxs(r.Fragment,{children:[" ","on branch ",r.jsx("code",{children:f.branch})]}):null," ","so this can open?"]})]}),C&&r.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:C}),r.jsxs(ui,{children:[r.jsx(cc,{className:"shell-action mt-0",disabled:y,children:"No"}),r.jsx(yo,{className:"shell-action mt-0 shell-action--cta",disabled:y,onClick:R=>{R.preventDefault(),T()},children:y?"Recreating…":"Yes, recreate"})]})]})}),r.jsx(li,{open:v!==null,onOpenChange:R=>!R&&k(null),children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsx(ra,{children:"Worktree recreated"}),r.jsx(sa,{children:v})]}),r.jsx(ui,{children:r.jsx(yo,{className:"shell-action mt-0 shell-action--cta",onClick:()=>k(null),children:"OK"})})]})})]});return{open:E,pending:e,dialogs:A}}function xE({session:e,onMarkStopped:t}){const n=gE(),s={kind:"session",id:e.sessionId},o="size-3.5",i=we("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),c="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",u=!e.resumeSupported&&!e.forkSupported;return r.jsxs(r.Fragment,{children:[r.jsx(aa,{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(pi,{className:o}),r.jsx("span",{children:"Reopen"})]})})}),r.jsx(cr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?r.jsxs(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(pi,{className:o}),r.jsx("span",{children:"Resume"})]})})}),r.jsx(cr,{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(pi,{className:o}),r.jsx("span",{children:"Resume"})]})}),r.jsx(cr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&r.jsxs(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(_P,{className:o}),r.jsx("span",{children:"Fork"})]})}),r.jsx(cr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&r.jsxs(Nr,{children:[r.jsx(Cr,{asChild:!0,children:r.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[r.jsx(tx,{className:o}),r.jsx("span",{children:"Mark stopped"})]})}),r.jsx(cr,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})}),n.dialogs]})}async function C8(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function yE({sessions:e,loading:t,error:n,onError:s,onNotice:o}){return t&&!e?null:n&&!e?r.jsx(He,{title:"Agent Sessions",children:r.jsx(Et,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?r.jsx(He,{title:"Agent Sessions",children:r.jsx(Et,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):r.jsx(He,{title:"Agent Sessions",children:r.jsx("div",{className:"space-y-2",children:e.map(i=>r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(mf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"font-medium text-foreground",children:i.agent}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground",title:i.sessionId,children:[i.sessionId.slice(0,8),r.jsx(zr,{value:i.sessionId,onError:s}),r.jsx(fE,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:s,onNotice:o})]})]}),r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(bn,{status:i.status}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Br(i.started)})]}),r.jsx(xE,{session:i,onMarkStopped:C8})]},i.sessionId))})})}const Hh="Cost / Usage";function bE({summary:e,error:t}){return t&&!e?r.jsx(He,{title:Hh,children:r.jsx(Et,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?r.jsx(He,{title:Hh,children:r.jsx(Et,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):r.jsx(He,{title:Hh,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(g0,{label:"Total cost",value:_d(e.totalCost)}),r.jsx(g0,{label:"Total tokens",value:Id(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(yf,{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:[Id(n.totalTokens)," · ",_d(n.totalCost)]})]},n.model))})]}):null,r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",_A(e.lastEventDay)]})]})}):null}function g0({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 vE({open:e,action:t,assignmentTitle:n,loading:s=!1,onConfirm:o,onOpenChange:i}){const[c,u]=p.useState("");p.useEffect(()=>{e||u("")},[e,t==null?void 0:t.command]);const f=p.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const m=`${t.label} "${n}"`,h=s?"Applying...":t.label,g=c.trim()||void 0;return r.jsx(zn,{open:e,onOpenChange:y=>s?void 0:i(y),children:r.jsx($n,{className:"max-w-xl",children:r.jsxs("form",{className:"space-y-5",onSubmit:y=>{y.preventDefault(),o(g)},children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:m}),r.jsx(Hr,{children:t.description})]}),t.warning?r.jsx("div",{className:"rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:t.warning}):null,r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:f}),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(Vr,{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 xa({open:e,title:t,description:n,confirmLabel:s,cancelLabel:o="Cancel",loading:i=!1,destructive:c=!1,onConfirm:u,onOpenChange:f}){return r.jsx(li,{open:e,onOpenChange:m=>i?void 0:f(m),children:r.jsxs(na,{children:[r.jsxs(ci,{children:[r.jsx(ra,{children:t}),r.jsx(sa,{children:n})]}),r.jsxs(ui,{children:[r.jsx(cc,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),r.jsx(yo,{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 E8=/^[a-z0-9][a-z0-9_-]*$/,wE=["first","last","none"];class jE extends Error{constructor(n,s){super(n);Km(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=s}}const Py={agents:[],custom:!1};let di=null,oi=null,af=0;const Ig=new Set;function kE(e){di=e;for(const t of Ig)t(e)}function T8(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"&&wE.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 Ay(e){if(!e||typeof e!="object")return Py;const t=e,n=Array.isArray(t.agents)?t.agents:[],s=[];for(const o of n){const i=T8(o);i&&s.push(i)}return{agents:s,custom:t.custom===!0}}function R8(){if(di)return Promise.resolve(di);if(oi)return oi;const e=++af;return oi=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{oi=null;const n=Ay(t);return e!==af?di??n:(di=n,n)}).catch(()=>(oi=null,Py)),oi}function SE(){const[e,t]=p.useState(()=>di??Py);return p.useEffect(()=>{let n=!1;return R8().then(s=>{n||t(s)}),Ig.add(t),()=>{n=!0,Ig.delete(t)}},[]),e}async function NE(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new jE(n,t==null?void 0:t.fieldErrors)}async function P8(e){++af;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await NE(t);const n=Ay(await t.json());return kE(n),n}async function A8(){++af;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await NE(e);const t=Ay(await e.json());return kE(t),t}const x0=/[A-Za-z0-9_-]/,D8=/^[a-z0-9]+(-[a-z0-9]+)*$/,y0=/(^|\s)@([A-Za-z0-9_-]+)/g,_g="assignment";function CE(e,t){const n=Math.max(0,Math.min(t,e.length));let s=n;for(;s>0&&x0.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&&x0.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function EE(e,t){const n=[_g,...t.filter(c=>c!==_g)],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 TE(e,t,n){const s=`@${n}`;return{text:e.slice(0,t.start)+s+e.slice(t.end),caret:t.start+s.length}}function RE(e,t){const n=t instanceof Set?t:new Set(t),s=[];y0.lastIndex=0;let o;for(;(o=y0.exec(e))!==null;){const i=o[2];i!==_g&&(D8.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 b0=2e3;function $8({open:e,assignmentId:t,agentId:n,onConfirm:s,onOpenChange:o}){const[i,c]=p.useState(""),[u,f]=p.useState([]),[m,h]=p.useState(!1),[g,y]=p.useState(null),[b,C]=p.useState(0),[j,v]=p.useState(0),[k,E]=p.useState(!1),S=p.useRef(null);p.useEffect(()=>{if(!e)return;let _=!1;h(!0),y(null),E(!1);const U=new URLSearchParams({assignment:t});return n&&U.set("agent",n),fetch(`/api/launch/prompt?${U.toString()}`).then(async q=>{if(!q.ok){const Z=await q.json().catch(()=>null);throw new Error((Z==null?void 0:Z.error)??`HTTP ${q.status}`)}return await q.json()}).then(q=>{_||(c(q.template??""),f(q.knownPlaybookSlugs??[]),C((q.template??"").length))}).catch(q=>{_||y(q instanceof Error?q.message:String(q))}).finally(()=>{_||h(!1)}),()=>{_=!0}},[e,t,n]);const T=CE(i,b),A=T?EE(T.partial,u):[],R=e&&!m&&!k&&A.length>0,P=RE(i,u),$=i.length>b0;function I(_){c(_.target.value),C(_.target.selectionStart??_.target.value.length),v(0),E(!1)}function M(_){C(_.currentTarget.selectionStart??i.length),v(0)}function D(_){if(!T||!_)return;const U=TE(i,T,_);c(U.text),C(U.caret),v(0),requestAnimationFrame(()=>{const q=S.current;q&&(q.focus(),q.setSelectionRange(U.caret,U.caret))})}function H(_){R&&(_.key==="ArrowDown"?(_.preventDefault(),v(U=>Math.min(U+1,A.length-1))):_.key==="ArrowUp"?(_.preventDefault(),v(U=>Math.max(U-1,0))):(_.key==="Enter"||_.key==="Tab")&&(_.preventDefault(),D(A[j])))}function K(){$||m||(s(i),o(!1))}return r.jsx(zn,{open:e,onOpenChange:o,children:r.jsxs($n,{onEscapeKeyDown:_=>{R&&(_.preventDefault(),E(!0))},children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:"Edit launch prompt"}),r.jsxs(Hr,{children:["The first message the agent starts with. ",r.jsx("code",{children:"@assignment"})," and"," ",r.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),g?r.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",g]}):r.jsxs("div",{className:"relative",children:[r.jsx("textarea",{ref:S,value:i,disabled:m,rows:4,spellCheck:!1,placeholder:m?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:I,onKeyDown:H,onKeyUp:M,onClick:M,className:we("w-full rounded-md border border-border/60 bg-background/90 p-3 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30 min-h-[80px] resize-y",$&&"border-error-foreground")}),R&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:A.map((_,U)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":U===j,onMouseDown:q=>{q.preventDefault(),D(_)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",U===j&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:_})]})},_))})]}),P.length>0&&!g&&r.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:P.map(_=>r.jsx("li",{children:_},_))}),$&&r.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",b0," characters (",i.length,")."]}),r.jsxs(Vr,{children:[r.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),r.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:m||$||g!==null,onClick:K,children:"Launch"})]})]})})}function PE({target:e,worktreePath:t=null,repository:n=null,size:s="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,c=gE(),[u,f]=p.useState(null),h=SE().agents,[g,y]=p.useState(null);p.useEffect(()=>{h.length!==0&&y(P=>P&&h.some(I=>I.id===P)?P:(h.find(I=>I.default)??h[0]).id)},[h]);const b=e.kind==="assignment"&&h.length>1,C=h.find(P=>P.id===g)??null,j=p.useRef(null),[v,k]=p.useState(!1);p.useEffect(()=>{if(!v)return;function P(I){j.current&&!j.current.contains(I.target)&&k(!1)}function $(I){I.key==="Escape"&&k(!1)}return document.addEventListener("mousedown",P),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",$)}},[v]);function E(P){e.kind==="assignment"?f({agentId:P}):c.open(e,void 0,P)}const S=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",T="Set a workspace path first — see the Workspace Before Code playbook",A=we("shell-action",s==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(i)return r.jsxs("button",{type:"button",disabled:!0,title:T,className:A,"aria-disabled":!0,children:[r.jsx(pi,{className:"size-3.5"}),r.jsx("span",{children:"Open in agent"})]});const R=e.kind==="session"?"Open":"Open in agent";return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative inline-flex",ref:j,children:[r.jsxs("div",{className:"inline-flex items-stretch",children:[r.jsxs("button",{type:"button",onClick:()=>E(g??void 0),disabled:c.pending,title:(o??S)+(b&&C?` (${C.label})`:""),className:we(A,b&&"rounded-r-none"),children:[r.jsx(pi,{className:"size-3.5"}),r.jsx("span",{children:R})]}),b&&r.jsx("button",{type:"button",onClick:()=>k(P=>!P),disabled:c.pending,"aria-haspopup":"menu","aria-expanded":v,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:we(A,"-ml-px rounded-l-none",s==="compact"?"px-1":"px-1.5"),children:r.jsx(fr,{className:we("size-3.5 opacity-70 transition-transform",v&&"rotate-180")})})]}),v&&b&&r.jsxs("div",{role:"menu","aria-label":"Open with agent",className:"absolute right-0 top-full z-30 mt-1 min-w-[180px] overflow-hidden rounded-md border border-border/70 bg-background py-1 shadow-lg",children:[r.jsx("div",{className:"px-2.5 pb-1 pt-0.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70",children:"Open with agent"}),h.map(P=>r.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":P.id===g,onClick:()=>{y(P.id),k(!1),E(P.id)},className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-sm text-foreground transition-colors hover:bg-accent",children:[r.jsx(Rr,{className:we("size-3.5 shrink-0",P.id===g?"opacity-100":"opacity-0")}),r.jsx("span",{className:"truncate",children:P.label}),P.default&&r.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},P.id))]})]}),c.dialogs,e.kind==="assignment"&&u&&r.jsx($8,{open:!0,assignmentId:e.id,agentId:u.agentId,onConfirm:P=>{c.open(e,void 0,u.agentId,P)},onOpenChange:P=>{P||f(null)}})]})}const Wh="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 AE({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,f]=p.useState(!1),[m,h]=p.useState("new-branch"),[g,y]=p.useState(null),[b,C]=p.useState(null),[j,v]=p.useState(""),[k,E]=p.useState(!1),[S,T]=p.useState(""),[A,R]=p.useState([]),[P,$]=p.useState(!1),[I,M]=p.useState(null),[D,H]=p.useState(""),[K,_]=p.useState(null),[U,q]=p.useState(null),[Z,F]=p.useState(""),[G,L]=p.useState(s),[V,re]=p.useState(!1),[B,ue]=p.useState(null);p.useEffect(()=>{if(!u)return;let X=!1;return h("new-branch"),y(null),C(null),v(""),E(!1),T(""),R([]),$(!1),M(null),H(""),_(null),q(null),F(""),L(s),ue(null),(c.kind==="project-nested"?x8(c.projectSlug):y8(c.assignmentId)).then(Ie=>{if(!X)if(y(Ie),Ie.length===0)E(!0);else{const Ye=Ie.find(Ze=>Ze.source==="project"),Fe=Ie.find(Ze=>Ze.source==="sibling");v((Ye==null?void 0:Ye.path)??(Fe==null?void 0:Fe.path)??Ie[0].path)}}).catch(Ie=>{X||(C(Ie.message),y([]),E(!0))}),(c.kind==="project-nested"?S8(c.projectSlug,c.assignmentSlug):N8(c.assignmentId)).then(Ie=>{X||_(Ie)}).catch(Ie=>{X||(q(Ie.message),_([]))}),()=>{X=!0}},[u,s,o,e,t,n]);const ge=m==="branch-off"?(K??[]).find(X=>X.id===Z)??null:null,se=m==="branch-off"?(ge==null?void 0:ge.repository)??"":k?S.trim():j;p.useEffect(()=>{if(!u||m!=="new-branch")return;if(!se){R([]),M(null),$(!1),H("");return}let X=!1;return $(!0),M(null),H(""),(c.kind==="project-nested"?j8(c.projectSlug,c.assignmentSlug,se):k8(c.assignmentId,se)).then(Ce=>{if(X)return;R(Ce.branches);const Ie=(Ce.defaultBranch&&Ce.branches.includes(Ce.defaultBranch)?Ce.defaultBranch:Ce.branches.includes(o)?o:Ce.branches[0])??"";H(Ie),$(!1)}).catch(Ce=>{X||(R([]),M(Ce.message),$(!1))}),()=>{X=!0}},[u,m,se,o,e,t,n]);const ye=p8(G.trim()),Se=p.useMemo(()=>!se||!G.trim()?"":`${se.replace(/\/+$/,"")}/.worktrees/${G.trim()}`,[se,G]),Ee=g!==null&&g.length===0,Ae=K!==null&&K.length===0,Ke=X=>{X!==m&&(h(X),F(""),ue(null),X==="branch-off"&&(H(""),R([]),M(null),$(!1)))},ct=X=>{F(X);const Me=(K??[]).find(Ce=>Ce.id===X);H((Me==null?void 0:Me.branch)??"")},et=V||ye!==null||!se||!D.trim()||(m==="new-branch"?g===null||P:K===null||!Z),ot=async()=>{re(!0),ue(null);try{const X={repository:se,branch:G.trim(),parentBranch:D.trim()};c.kind==="project-nested"?await b8(c.projectSlug,c.assignmentSlug,X):await v8(c.assignmentId,X),f(!1),i()}catch(X){X instanceof Ty?ue({message:X.message,stderr:X.stderr}):X instanceof Error?ue({message:X.message}):ue({message:String(X)})}finally{re(!1)}};return r.jsxs(zn,{open:u,onOpenChange:X=>V?void 0:f(X),children:[r.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>f(!0),children:[r.jsx(IP,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.jsx("span",{children:"Create worktree"})]}),r.jsxs($n,{children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:"Create worktree"}),r.jsxs(Hr,{children:["Creates a git worktree at ",r.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),r.jsxs("div",{className:"grid gap-4 text-sm",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[r.jsx("button",{type:"button",disabled:V,onClick:()=>Ke("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),r.jsx("button",{type:"button",disabled:V,onClick:()=>Ke("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${m==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),m==="new-branch"?r.jsxs(r.Fragment,{children:[Ee?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:Wh,value:j,onChange:X=>v(X.target.value),disabled:V||g===null||k,children:(g??[]).map(X=>r.jsxs("option",{value:X.path,children:[X.path,X.source==="project"?" (project)":X.sourceAssignmentSlug?` (sibling — ${X.sourceAssignmentSlug})`:" (sibling)"]},`${X.source}:${X.path}`))}),Ee?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(X=>!X),children:k?"Use a listed repository":"Enter a custom repository path (advanced)"}),k?r.jsx("input",{className:"mt-1 w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",placeholder:"/absolute/path/to/repo",value:S,onChange:X=>T(X.target.value),disabled: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:Wh,value:D,onChange:X=>H(X.target.value),disabled:V||P||A.length===0,children:P?r.jsx("option",{value:"",children:"Loading branches…"}):A.length===0?r.jsx("option",{value:"",children:I?"Could not load branches":se?"No branches found":"— pick a repository —"}):A.map(X=>r.jsx("option",{value:X,children:X},X))}),I?r.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",I]}):null]})]}):r.jsxs(r.Fragment,{children:[U?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: ",U]}):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:Wh,value:Z,onChange:X=>ct(X.target.value),disabled:V||K===null,children:[r.jsx("option",{value:"",children:"— select an assignment —"}),(K??[]).map(X=>r.jsxs("option",{value:X.id,children:[X.title," (",X.branch,")"]},X.id))]})]}),ge?r.jsxs("div",{className:"grid gap-2 rounded-md border border-border/70 bg-muted/40 px-3 py-2 text-xs",children:[r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Repository (from source)"}),r.jsx("code",{className:"break-all",children:ge.repository})]}),r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("span",{className:"font-medium text-muted-foreground",children:"Parent branch (from source)"}),r.jsx("code",{children:ge.branch})]})]}):null]}),r.jsxs("label",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),r.jsx("input",{className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",value:G,onChange:X=>L(X.target.value),disabled:V}),ye?r.jsx("span",{className:"text-[11px] text-error-foreground",children:ye}):null]}),r.jsxs("div",{className:"grid gap-1",children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),r.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:Se||r.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),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(Vr,{children:[r.jsx(i$,{disabled:V,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",disabled:et,onClick:()=>void ot(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:V?"Working…":"Create worktree"})]})]})]})}function L8(e){const t=e.split(`
|
|
560
|
+
`),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(`
|
|
561
|
+
`).replace(/\n{3,}/g,`
|
|
562
|
+
|
|
563
|
+
`).trim();return{acceptanceCriteria:o,summaryBody:i}}function O8(e){const t=e.split(`
|
|
564
|
+
`),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(`
|
|
565
|
+
`).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
|
|
566
|
+
|
|
567
|
+
`).trim(),i=[...t.slice(0,n),...t.slice(s)].join(`
|
|
568
|
+
`).replace(/\n{3,}/g,`
|
|
569
|
+
|
|
570
|
+
`).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function I8({projectSlug:e,dependencies:t,blockedReason:n}){const[s,o]=p.useState(!1);if(t.length===0)return null;const i=t.filter(u=>u.status!=="completed"&&u.status!=="review"),c=i.length===0;return c&&!s?r.jsxs("button",{type:"button",onClick:()=>o(!0),className:"flex w-full items-center gap-2 rounded-lg border border-success-foreground/30 bg-success/70 px-4 py-2.5 text-left transition hover:bg-success",children:[r.jsx(Yg,{className:"h-4 w-4 shrink-0 text-success-foreground"}),r.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),r.jsx(fr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):r.jsxs("div",{className:"space-y-3",children:[i.length>0&&r.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[r.jsx(Ld,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),r.jsxs("div",{className:"text-sm text-warning-foreground",children:[r.jsxs("strong",{children:[i.length," ",i.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&r.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),r.jsx(He,{title:"Dependencies",description:`${t.length-i.length} of ${t.length} resolved`,actions:c?r.jsx("button",{type:"button",onClick:()=>o(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:r.jsx("div",{className:"divide-y divide-border/40",children:t.map(u=>r.jsxs(Te,{to:`/projects/${e}/assignments/${u.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(bn,{status:u.status}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:u.title}),r.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u.slug})]}),u.assignee&&r.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:u.assignee}),r.jsx($d,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},u.slug))})})]})}function _8({links:e}){const t=fn();if(e.length===0)return null;const n=e.filter(o=>!o.isReverse),s=e.filter(o=>o.isReverse);return r.jsx(He,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:r.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(o=>r.jsxs(Te,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(mk,{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($d,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),s.map(o=>r.jsxs(Te,{to:`${t}/projects/${o.projectSlug}/assignments/${o.assignmentSlug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[r.jsx(Dd,{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($d,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function M8(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 F8(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function DE({projectSlug:e,assignmentSlug:t,entries:n}){const[s,o]=p.useState(n);p.useEffect(()=>{o(n)},[n]);const i=p.useMemo(()=>M8(s),[s]),[c,u]=p.useState(""),[f,m]=p.useState("note"),[h,g]=p.useState(!1),[y,b]=p.useState(null);async function C(v){var S;if(v.preventDefault(),!c.trim())return;g(!0),b(null);const k=`tmp-${Date.now()}`,E={id:k,timestamp:new Date().toISOString(),author:"human",type:f,body:c,resolved:f==="question"?!1:void 0};o(T=>[...T,E]);try{const T=await fetch(F8(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:c,type:f})});if(!T.ok){const P=await T.text();throw new Error(P||`HTTP ${T.status}`)}const A=await T.json().catch(()=>null),R=(S=A==null?void 0:A.comment)==null?void 0:S.id;o(P=>P.map($=>$.id===k?{...$,id:R??$.id}:$)),u(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(T){b(T instanceof Error?T.message:String(T)),o(A=>A.filter(R=>R.id!==k))}finally{g(!1)}}async function j(v,k){o(E=>E.map(S=>S.id===v?{...S,resolved:k}:S));try{const E=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(v)}/resolved`,S=await fetch(E,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:k})});if(!S.ok)throw new Error(`HTTP ${S.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(E){b(E instanceof Error?E.message:String(E)),o(S=>S.map(T=>T.id===v?{...T,resolved:!k}:T))}}return r.jsx(He,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:r.jsxs("div",{className:"space-y-4",children:[i.map(v=>r.jsx($E,{node:v,onToggleResolved:j,depth:0},v.entry.id)),r.jsxs("form",{onSubmit:C,className:"mt-6 space-y-2 border-t border-border pt-4",children:[r.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),r.jsx("textarea",{value:c,onChange:v=>u(v.target.value),className:"w-full rounded border border-border bg-background p-2 text-sm",rows:3,placeholder:"Ask a question, leave a note, or give feedback…"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("select",{value:f,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 $E({node:e,depth:t,onToggleResolved:n}){const{entry:s,replies:o}=e,i=s.type==="question";return r.jsxs("div",{className:we("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:s.id}),r.jsx("span",{children:"·"}),r.jsx("span",{children:s.timestamp}),r.jsx("span",{children:"·"}),r.jsx("span",{className:"font-medium text-foreground",children:s.author}),r.jsx("span",{children:"·"}),r.jsx("span",{className:we("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",i&&"bg-warning text-warning-foreground",s.type==="feedback"&&"bg-info text-info-foreground",s.type==="note"&&"bg-muted text-muted-foreground"),children:s.type}),i?r.jsxs("button",{type:"button",onClick:()=>n(s.id,!s.resolved),className:we("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",s.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:s.resolved?"Mark unresolved":"Mark resolved",children:[s.resolved?r.jsx(Yg,{className:"h-3 w-3"}):r.jsx(CP,{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(YP,{className:"h-3 w-3"}),s.replyTo]}):null]}),r.jsx(xn,{content:s.body}),o.length>0?r.jsx("div",{className:"space-y-2",children:o.map(c=>r.jsx($E,{node:c,depth:t+1,onToggleResolved:n},c.entry.id))}):null]})}const z8=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function v0(){var ut,ae,be,$e,at,Be,kt,St,_t,pe;const{slug:e,aslug:t}=Bt(),n=zt(),s=fn(),[o,i]=Ns(),[c,u]=p.useState(null),{toast:f,showToast:m,dismissToast:h}=Ro(),[g,y]=p.useState(null),[b,C]=p.useState(null),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(!1),[A,R]=p.useState(!1),[P,$]=p.useState(0),I=o.get("tab")??"summary",M=pa(),{data:D,loading:H,error:K,refetch:_}=GA(e,t),{data:U}=Kk(e),{data:q}=ix(),{data:Z,loading:F,error:G}=JA(e,t),{data:L,loading:V,error:re}=XA(e,t),B=p.useMemo(()=>{if(!D||!U)return[];const te=new Map(U.assignments.map(xe=>[xe.slug,xe]));return D.dependsOn.map(xe=>{const Le=te.get(xe);return{slug:xe,title:(Le==null?void 0:Le.title)??xe,status:(Le==null?void 0:Le.status)??"pending",priority:(Le==null?void 0:Le.priority)??"medium",assignee:(Le==null?void 0:Le.assignee)??null}})},[D,U]),ue=B.filter(te=>te.status!=="completed"&&te.status!=="review");To("assignment");const ge=p.useMemo(()=>((U==null?void 0:U.assignments)??[]).map(te=>te.slug),[U]),se=t?ge.indexOf(t):-1,ye=se>0?ge[se-1]:null,Se=se>=0&&se<ge.length-1?ge[se+1]:null,Ee=`${s}/projects/${e}/assignments/${t}`;Yt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Ee}/edit`)}),Yt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Ee}/plan/edit`)}),Yt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Ee}/handoff/edit`)}),Yt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Ee}/decision-record/edit`)}),Yt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Ee}/scratchpad/edit`)}),Yt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!ye,handler:()=>ye&&n(`${s}/projects/${e}/assignments/${ye}`)}),Yt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!Se,handler:()=>Se&&n(`${s}/projects/${e}/assignments/${Se}`)});const Ae=p.useMemo(()=>D?L8(D.body):{acceptanceCriteria:[],summaryBody:""},[D]),Ke=p.useMemo(()=>O8(Ae.summaryBody),[Ae.summaryBody]),ct=Ae.acceptanceCriteria,et=ct.filter(te=>te.checked).length,ot=ct.length>0&&et===ct.length,X=p.useRef(ot),Me=p.useRef(!1);if(p.useEffect(()=>{if(D){if(!Me.current){X.current=ot,Me.current=!0;return}ot&&!X.current&&$(te=>te+1),X.current=ot}},[ot,D]),H)return r.jsx(xt,{label:"Loading assignment workspace…"});if(K||!D||!e||!t)return r.jsx(Tt,{error:K||"Assignment not found."});const Ce=e,Ie=t,Ye=ct.length>0?{checked:et,total:ct.length}:void 0,Fe=D.availableTransitions??[],Ze=Fe.filter(te=>!te.disabled&&te.targetStatus!==D.status),Qe=z8.map(te=>Ze.find(xe=>xe.command===te)).find(Boolean)??Ze[0]??null,Ot=[];if(q!=null&&q.sessions)for(const te of q.sessions)for(const xe of te.windows)for(const Le of xe.panes)((ut=Le.assignment)==null?void 0:ut.project)===e&&((ae=Le.assignment)==null?void 0:ae.slug)===t&&Ot.push({sessionName:te.name,command:Le.command,urls:Le.urls});async function yt(te){u(null);try{await mE(Ce,Ie,te),_()}catch(xe){u(xe.message)}}async function dt(te){u(null);try{const xe=await fetch(`/api/projects/${Ce}/assignments/${Ie}/${te?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!xe.ok){const Le=await xe.json().catch(()=>null);throw new Error((Le==null?void 0:Le.error)||`HTTP ${xe.status}`)}_(),m(te?"Assignment archived":"Assignment restored","success")}catch(xe){u(xe.message)}}async function le(){R(!0);try{await m8(Ce,Ie),n(`${s}/projects/${Ce}`)}catch(te){u(te.message),R(!1),T(!1)}}async function Y(te,xe){u(null),y(te.command);try{return await pE(Ce,Ie,te,xe),_(),!0}catch(Le){return u(Le.message),!1}finally{y(null)}}function fe(te){if(hE(te)){C(te);return}Y(te)}async function ne(te,xe){v(null),E(te);try{const Le=await fetch(`/api/projects/${Ce}/assignments/${Ie}/acceptance-criteria/${te}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:xe})}),tt=await Le.json();if(!Le.ok)throw new Error(tt.error||`HTTP ${Le.status}`);_()}catch(Le){v(Le.message)}finally{E(null)}}const he=[...Ze.filter(te=>te!==Qe).map(te=>({key:`transition-${te.command}`,label:te.label,onSelect:()=>fe(te),disabled:g===te.command})),...Fe.filter(te=>te.disabled||te.targetStatus===D.status).map(te=>({key:`transition-${te.command}`,label:te.label,disabled:!0,disabledReason:te.targetStatus===D.status?`Already ${D.status.replace(/_/g," ")}`:te.disabledReason??te.warning??te.description})),...M.statuses.map(te=>({key:`override-${te.id}`,label:`Override → ${te.label}`,onSelect:()=>yt(te.id),disabled:te.id===D.status,disabledReason:te.id===D.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:OP,href:`${s}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:QP,href:`${s}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:th,href:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:$d,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?Ad:hf,onSelect:()=>dt(!D.archived)},{key:"delete",label:"Delete assignment",icon:Tn,destructive:!0,onSelect:()=>T(!0)}],De=(Qe==null?void 0:Qe.command)==="review";return r.jsxs("div",{className:"space-y-5",children:[r.jsx(ha,{toast:f,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(ma,{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 ",Dk(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(ny,{externalIds:D.externalIds}),r.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[r.jsx(PE,{target:{kind:"assignment",id:D.id},worktreePath:((be=D.workspace)==null?void 0:be.worktreePath)??null,repository:(($e=D.workspace)==null?void 0:$e.repository)??null}),!((at=D.workspace)!=null&&at.worktreePath)&&e&&t&&r.jsx(AE,{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:()=>fe(Qe),className:we("shell-action disabled:cursor-not-allowed disabled:opacity-50",Qe.warning&&"border-warning-foreground/40",De&&P>0&&"send-to-review-glow"),children:r.jsx("span",{children:g===Qe.command?"Working…":Qe.label})},De?`review-${P}`:Qe.command),r.jsx(Yx,{items:he,align:"end"})]})]}),c?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:c}):null,D.blockedReason?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsx("strong",{children:"Blocked reason:"})," ",D.blockedReason]}):null,D.override&&D.derived&&D.derived.derivedStatus!==D.status?r.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[r.jsxs("strong",{children:["Pinned to ",D.status]})," by ",D.override.source,D.override.reason?r.jsxs(r.Fragment,{children:[" — “",D.override.reason,"”"]}):null," · ","would otherwise be ",r.jsx("strong",{children:D.derived.derivedStatus})]}):null,(Be=D.derived)!=null&&Be.nextAction?r.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",D.derived.nextAction]}):null]}),D.derived&&(Object.keys(D.derived.customFacts??{}).length>0||(D.derived.attestations??[]).length>0)?r.jsx(He,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:r.jsxs("div",{className:"space-y-3",children:[Object.keys(D.derived.customFacts??{}).length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(D.derived.customFacts??{}).map(([te,xe])=>r.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[te,": ",r.jsx("span",{className:"font-medium text-foreground",children:String(xe)})]},te))}),(D.derived.attestations??[]).map(te=>r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-[11px] font-medium text-foreground",children:te.fact}),r.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",te.binds,")"]}),te.records.length===0?r.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):te.records.map(xe=>r.jsxs("span",{title:`${xe.verdict}${xe.note?` — ${xe.note}`:""}${xe.stale?" (stale — revision moved)":""} · ${xe.at}`,className:we("rounded-full border px-2 py-0.5 text-[11px]",xe.stale?"border-border/40 text-muted-foreground line-through":xe.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[xe.actor,": ",xe.verdict==="approved"?"approved":"changes",xe.stale?" (stale)":""]},xe.actor))]},te.fact))]})}):null,B.length>0&&r.jsx(I8,{projectSlug:e,dependencies:B,blockedReason:D.blockedReason}),D.enrichedLinks&&D.enrichedLinks.length>0&&r.jsx(_8,{links:D.enrichedLinks}),D.referencedBy&&D.referencedBy.length>0&&r.jsx(He,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:r.jsx("ul",{className:"space-y-2",children:D.referencedBy.map(te=>{const xe=te.sourceProjectSlug===null?`/assignments/${te.sourceId}`:`${s}/projects/${te.sourceProjectSlug}/assignments/${te.sourceSlug}`;return r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Te,{to:xe,className:"text-foreground hover:text-primary",children:te.sourceTitle}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",te.mentions," mention",te.mentions===1?"":"s",")"]}),te.sourceProjectSlug===null?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},te.sourceId)})})}),r.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[r.jsx("div",{className:"space-y-4",children:r.jsx(sy,{value:I,onValueChange:te=>i({tab:te}),items:[{value:"summary",label:"Summary",content:r.jsxs("div",{className:"space-y-5",children:[Ae.acceptanceCriteria.length>0?r.jsx(He,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:r.jsxs("div",{className:"space-y-3",children:[j?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,Ae.acceptanceCriteria.map((te,xe)=>{const Le=k!==null;return r.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[r.jsx("input",{type:"checkbox",checked:te.checked,disabled:Le,onChange:tt=>ne(xe,tt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),r.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":te.checked,children:te.text})]},`${xe}-${te.text}`)})]})}):null,Ke.hasSection?r.jsx(He,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:r.jsx(xn,{content:Ke.todosMarkdown,emptyState:"No todos yet."})}):null,r.jsx(He,{title:"Assignment Summary",children:r.jsx(xn,{content:Ke.remaining,emptyState:Ae.acceptanceCriteria.length>0||Ke.hasSection?"No additional summary markdown beyond the acceptance criteria and todos.":"This assignment does not have summary markdown yet."})})]})},{value:"plan",label:"Plan",count:D.plan?1:0,content:D.plan?r.jsx("div",{className:"space-y-5",children:r.jsxs(He,{title:"Plan",description:"Shows plan.md only. Versioned plans (plan-v2.md, ...) linked from the Todos section are not yet rendered here — open them from the filesystem.",actions:r.jsxs(Te,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/plan/edit`,children:[r.jsx(th,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Plan"})]}),children:[r.jsx("div",{className:"mb-4",children:r.jsx(bn,{status:D.plan.status})}),r.jsx(xn,{content:D.plan.body,emptyState:"No plan content yet."})]})}):r.jsx(Et,{title:"No plan yet",description:"Plan files are optional and versioned. Run /plan-assignment to create plan.md (or plan-v2.md, ...) and link it from the Todos section."})},{value:"scratchpad",label:"Scratchpad",count:D.scratchpad?1:0,content:D.scratchpad?r.jsx(He,{title:"Scratchpad",actions:r.jsxs(Te,{className:"shell-action",to:`${s}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[r.jsx(th,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit Scratchpad"})]}),children:r.jsx(xn,{content:D.scratchpad.body,emptyState:"Scratchpad is empty."})}):r.jsx(Et,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((kt=D.handoff)==null?void 0:kt.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.handoff?r.jsx(He,{children:r.jsx(xn,{content:D.handoff.body,emptyState:"No handoff history yet."})}):r.jsx(Et,{title:"No handoff log yet",description:"Handoffs appear here when an agent runs /complete-assignment or you append one manually."})})},{value:"progress",label:"Progress",count:((St=D.progress)==null?void 0:St.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.progress&&D.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:r.jsx("ol",{className:"space-y-4",children:D.progress.entries.map((te,xe)=>r.jsxs("li",{className:"border-l-2 border-border pl-3",children:[r.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:te.timestamp}),r.jsx(xn,{content:te.body})]},`${te.timestamp}-${xe}`))})}):r.jsx(Et,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((_t=D.comments)==null?void 0:_t.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.comments&&D.comments.entries.length>0?r.jsx(DE,{projectSlug:e,assignmentSlug:t,entries:D.comments.entries}):r.jsx(Et,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((pe=D.decisionRecord)==null?void 0:pe.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:D.decisionRecord?r.jsx(He,{children:r.jsx(xn,{content:D.decisionRecord.body,emptyState:"No decision history yet."})}):r.jsx(Et,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),r.jsxs("div",{className:"min-w-0 space-y-5",children:[r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(mo,{label:"ID",value:D.id,copyable:!0}),r.jsx(mo,{label:"Priority",value:D.priority}),D.assignee&&r.jsx(mo,{label:"Assignee",value:D.assignee}),r.jsx(mo,{label:"Updated",value:`${Ak(D.updated)} · Created ${Pk(D.created)}`}),D.workspace.repository&&r.jsx(mo,{label:"Repository",value:D.workspace.repository,copyable:!0}),D.workspace.worktreePath&&r.jsx(mo,{label:"Worktree",value:D.workspace.worktreePath,copyable:!0}),D.workspace.branch&&r.jsx(mo,{label:"Branch",value:D.workspace.branch,copyable:!0}),D.workspace.parentBranch&&r.jsx(mo,{label:"Parent branch",value:D.workspace.parentBranch,copyable:!0}),D.externalIds.map((te,xe)=>r.jsx(B8,{entry:te},`${te.system}:${te.id}:${xe}`))]})}),Ot.length>0&&r.jsx(He,{title:"Servers",children:r.jsx("div",{className:"space-y-2",children:Ot.map((te,xe)=>r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[r.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:te.command,children:te.command}),r.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:te.sessionName,children:te.sessionName}),te.urls.map(Le=>r.jsxs("a",{href:Le,target:"_blank",rel:"noopener noreferrer",title:Le,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:Le.replace("http://localhost:",":")}),r.jsx($i,{className:"h-2.5 w-2.5 shrink-0"})]},Le))]},xe))})}),r.jsx(yE,{sessions:Z==null?void 0:Z.sessions,loading:F,error:G,onError:te=>m(te.message,"error"),onNotice:te=>m(te,"success")}),r.jsx(bE,{summary:L==null?void 0:L.summary,loading:V,error:re})]})]}),r.jsx(vE,{open:b!==null,action:b,assignmentTitle:D.title,loading:g===(b==null?void 0:b.command),onOpenChange:te=>{te||C(null)},onConfirm:async te=>{if(!b)return;await Y(b,te)&&C(null)}}),r.jsx(xa,{open:S,title:"Delete assignment?",description:`This will permanently delete "${D.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:A,onOpenChange:te=>{te||T(!1)},onConfirm:le})]})}function mo({label:e,value:t,copyable:n}){return r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsx("dt",{className:"text-muted-foreground",children:e}),r.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[r.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(zr,{value:t})]})]})}function B8({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($i,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function U8(){var R,P,$,I,M,D,H,K;const{id:e}=Bt(),[t,n]=Ns(),s=t.get("tab")??"summary",{data:o,loading:i,error:c,refetch:u}=YA(e),{data:f,loading:m,error:h}=QA(e),{data:g,loading:y,error:b}=ZA(o==null?void 0:o.slug),[C,j]=p.useState(!1),[v,k]=p.useState(null),{toast:E,showToast:S,dismissToast:T}=Ro();async function A(_){if(e){k(null);try{const U=await fetch(`/api/assignments/${e}/${_?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!U.ok){const q=await U.json().catch(()=>null);throw new Error((q==null?void 0:q.error)||`HTTP ${U.status}`)}u(),S(_?"Assignment archived":"Assignment restored","success")}catch(U){k(U instanceof Error?U.message:"Archive failed")}}}return i?r.jsx(xt,{}):c?r.jsx(Tt,{error:c}):o?r.jsxs("div",{className:"space-y-6",children:[r.jsx(ha,{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(ma,{type:o.type}),r.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),r.jsx(ny,{externalIds:o.externalIds}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx(PE,{target:{kind:"assignment",id:o.id},worktreePath:((R=o.workspace)==null?void 0:R.worktreePath)??null,repository:((P=o.workspace)==null?void 0:P.repository)??null,size:"compact"}),!(($=o.workspace)!=null&&$.worktreePath)&&r.jsx(AE,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>u()}),r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[r.jsx(gf,{className:"h-3 w-3"}),"Move to workspace…"]}),r.jsx(Te,{to:`/assignments/${o.id}/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>A(!o.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:o.archived?"Restore this assignment":"Archive this assignment",children:[o.archived?r.jsx(Ad,{className:"h-3 w-3"}):r.jsx(hf,{className:"h-3 w-3"}),o.archived?"Restore":"Archive"]})]})]}),r.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:o.title}),o.blockedReason?r.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",o.blockedReason]}):null,v?r.jsx("p",{className:"text-sm text-status-failed-foreground",children:v}):null]}),r.jsx(He,{title:"Details",children:r.jsxs("dl",{className:"space-y-3 text-sm",children:[r.jsx(ho,{label:"ID",value:o.id,copyable:!0}),r.jsx(ho,{label:"Priority",value:o.priority}),o.assignee&&r.jsx(ho,{label:"Assignee",value:o.assignee}),r.jsx(ho,{label:"Updated",value:`${Ak(o.updated)} · Created ${Pk(o.created)}`}),o.workspace.repository&&r.jsx(ho,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&r.jsx(ho,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&r.jsx(ho,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&r.jsx(ho,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((_,U)=>r.jsx(V8,{entry:_},`${_.system}:${_.id}:${U}`))]})}),o.referencedBy&&o.referencedBy.length>0?r.jsx(He,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:r.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(_=>r.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Te,{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.jsx(yE,{sessions:f==null?void 0:f.sessions,loading:m,error:h,onError:_=>S(_.message,"error"),onNotice:_=>S(_,"success")}),r.jsx(bE,{summary:g==null?void 0:g.summary,loading:y,error:b}),r.jsx(sy,{value:s,onValueChange:_=>n({tab:_}),items:[{value:"summary",label:"Summary",content:r.jsx("div",{className:"space-y-5",children:r.jsx(He,{title:"Assignment",children:r.jsx(xn,{content:o.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((I=o.progress)==null?void 0:I.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.progress&&o.progress.entries.length>0?r.jsx(He,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:r.jsx("ol",{className:"space-y-4",children:o.progress.entries.map((_,U)=>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(xn,{content:_.body})]},`${_.timestamp}-${U}`))})}):r.jsx(Et,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((M=o.comments)==null?void 0:M.entryCount)??0,content:r.jsx("div",{className:"space-y-5",children:r.jsx(DE,{projectSlug:null,assignmentSlug:o.id,entries:((D=o.comments)==null?void 0:D.entries)??[]})})},{value:"plan",label:"Plan",content:r.jsx("div",{className:"space-y-5",children:o.plan?r.jsxs(He,{children:[r.jsx(xn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/plan/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit plan"})})]}):r.jsx(Et,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:r.jsx("div",{className:"space-y-5",children:o.scratchpad?r.jsxs(He,{children:[r.jsx(xn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/scratchpad/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Edit scratchpad"})})]}):r.jsx(Et,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((H=o.handoff)==null?void 0:H.handoffCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.handoff?r.jsxs(He,{children:[r.jsx(xn,{content:o.handoff.body,emptyState:"No handoff history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/handoff/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append handoff"})})]}):r.jsx(Et,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((K=o.decisionRecord)==null?void 0:K.decisionCount)??0,content:r.jsx("div",{className:"space-y-5",children:o.decisionRecord?r.jsxs(He,{children:[r.jsx(xn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),r.jsx("div",{className:"mt-3 flex justify-end",children:r.jsx(Te,{to:`/assignments/${o.id}/decision-record/edit`,className:"rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:"Append decision"})})]}):r.jsx(Et,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]}),r.jsx(ty,{open:C,onOpenChange:j,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async _=>{const U=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:_})});if(!U.ok){const q=await U.json().catch(()=>({}));throw new Error(q.error||"Failed to move assignment")}u()}})]}):r.jsx(Tt,{error:"Assignment not found"})}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:"truncate",title:t,children:t}),n&&t!=="—"&&r.jsx(zr,{value:t})]})]})}function V8({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($i,{className:"h-2.5 w-2.5 shrink-0"})]}):r.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function H8({currentStatus:e,availableTransitions:t,onSelect:n,disabled:s=!1,className:o}){const[i,c]=p.useState(!1),[u,f]=p.useState(null),[m,h]=p.useState(0),g=p.useRef(null),y=p.useRef(null),b=p.useId(),C=ef(e),j=C.icon,v=p.useCallback(A=>{c(!1),A&&requestAnimationFrame(()=>{var R;(R=g.current)==null||R.focus()})},[]),k=p.useCallback(()=>{var R;const A=(R=g.current)==null?void 0:R.getBoundingClientRect();A&&f({top:A.top,left:A.left,width:A.width,bottom:A.bottom})},[]);p.useLayoutEffect(()=>{i&&k()},[i,k]),p.useEffect(()=>{if(!i)return;const A=()=>k();return window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[i,k]),p.useEffect(()=>{if(!i)return;const A=R=>{var $,I;const P=R.target;P&&(($=y.current)!=null&&$.contains(P)||(I=g.current)!=null&&I.contains(P)||v(!1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[i,v]),p.useEffect(()=>{i&&h(0)},[i,t.length]);function E(A){(A.key==="Enter"||A.key===" "||A.key==="ArrowDown")&&(A.preventDefault(),c(!0))}function S(A){if(t.length===0){A.key==="Escape"&&(A.preventDefault(),v(!0));return}if(A.key==="ArrowDown")A.preventDefault(),h(R=>(R+1)%t.length);else if(A.key==="ArrowUp")A.preventDefault(),h(R=>(R-1+t.length)%t.length);else if(A.key==="Home")A.preventDefault(),h(0);else if(A.key==="End")A.preventDefault(),h(t.length-1);else if(A.key==="Enter"){A.preventDefault();const R=t[m];R&&(n(R),v(!0))}else A.key==="Escape"&&(A.preventDefault(),v(!0))}function T(A){n(A),v(!1)}return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:g,type:"button","data-no-drag":!0,disabled:s,"aria-haspopup":"menu","aria-expanded":i,"aria-controls":i?b:void 0,onClick:()=>{s||c(A=>!A)},onKeyDown:E,title:`Status: ${C.label}. Click to change.`,className:we(LN(e,o),"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",s&&"cursor-not-allowed opacity-60"),children:[r.jsx(j,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"min-w-0 truncate",children:C.label})]}),i&&u&&typeof document<"u"?Ms.createPortal(r.jsx("div",{ref:y,id:b,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:S,style:{position:"fixed",top:u.bottom+6,left:u.left,minWidth:Math.max(u.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:t.length===0?r.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No transitions available from this status."}):t.map((A,R)=>{const P=ef(A.targetStatus),$=P.icon,I=R===m;return r.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>h(R),onClick:()=>T(A),title:A.warning||A.description,className:we("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",I?"bg-foreground/5":"hover:bg-foreground/5"),children:[r.jsxs("span",{className:"flex items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx($,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate",children:A.label})]}),r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:P.label})]}),A.warning?r.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:A.warning}):null]},`${A.command}:${A.targetStatus}`)})}),document.body):null]})}function LE({title:e,detailHref:t,onSave:n,disabled:s=!1}){const[o,i]=p.useState(!1);return o?r.jsx(W8,{initialTitle:e,disabled:s,onSave:n,onExit:()=>i(!1)}):r.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[r.jsx("button",{type:"button","data-no-drag":!0,disabled:s,onClick:()=>{s||i(!0)},className:we("text-left text-base font-semibold text-foreground transition hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 rounded-sm",s&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),r.jsx(Te,{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($i,{className:"h-3.5 w-3.5"})})]})}function W8({initialTitle:e,disabled:t,onSave:n,onExit:s}){const o=p.useRef(e),[i,c]=p.useState(e),[u,f]=p.useState(!1),[m,h]=p.useState(!1),g=p.useRef(null),y=p.useRef(!1);p.useEffect(()=>{const v=g.current;v&&(v.focus(),v.select())},[]);const b=p.useCallback(()=>{var v;h(!0),window.setTimeout(()=>h(!1),260),(v=g.current)==null||v.focus()},[]),C=p.useCallback(async()=>{if(y.current)return;const v=i.trim();if(v.length===0){b();return}if(v===o.current){s();return}y.current=!0,f(!0);try{await n(v)}catch{}finally{f(!1),s()}},[i,s,n,b]);function j(v){v.key==="Enter"?(v.preventDefault(),C()):v.key==="Escape"&&(v.preventDefault(),y.current=!0,s())}return r.jsx("input",{ref:g,type:"text","data-no-drag":!0,disabled:t||u,value:i,onChange:v=>c(v.target.value),onKeyDown:j,onBlur:()=>void C(),className:we("w-full rounded-sm border border-border bg-background px-1.5 py-0.5 text-base font-semibold text-foreground outline-none transition focus:border-ring focus:ring-1 focus:ring-ring",m&&"syntaur-input-shake",u&&"opacity-70")})}function OE(e){const t=zt(),n=p.useRef(null),s=p.useRef(!1),o=p.useCallback(()=>{const c=n.current,u=!!(c!=null&&c.querySelector('[aria-expanded="true"]')),f=!!document.querySelector('[role="menu"]'),m=document.activeElement,h=!!(m&&(c!=null&&c.contains(m))&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"));s.current=u||f||h},[]),i=p.useCallback(c=>{if(s.current)return;const u=c.target;!u||u.closest(Ri)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const w0=/[A-Za-z0-9_-]/;function j0(e,t){const n=Math.max(0,Math.min(t,e.length)),s=K8(e,n);if(s)return s;let o=n;for(;o>0&&w0.test(e[o-1]);)o--;let i=n;for(;i<e.length&&w0.test(e[i]);)i++;const c=e.slice(o,n),u=e.slice(0,o),f=u.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(f)return{kind:"value",field:f[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 K8(e,t){let n=-1;for(let f=t-1;f>=0;f--)if(e[f]==='"'&&(f===0||e[f-1]!=="\\")){n=f;break}if(n<0)return null;for(let f=n+1;f<t;f++)if(e[f]==='"'&&e[f-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 q8(e,t){const n=$N(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 G8(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 Y8(e,t,n){let s;return t.kind==="field"?s=`${n}:`:s=M1(n),{text:e.slice(0,t.tokenStart)+s+e.slice(t.tokenEnd),caret:t.tokenStart+s.length}}const J8=180;function Q8(e,t){const[n,s]=p.useState(e);return p.useEffect(()=>{const o=setTimeout(()=>s(e),t);return()=>clearTimeout(o)},[e,t]),n}function X8({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 f=p.useRef(null),m=p.useRef(null),h=Q8(e,J8),[g,y]=p.useState([]),[b,C]=p.useState([]),[j,v]=p.useState("field"),[k,E]=p.useState(-1),[S,T]=p.useState(!1),A=p.useRef(e.length);p.useEffect(()=>{if(h.trim()===""){y([]),n==null||n(null);return}const _=Ox(h,s);_.errors.length>0?(y(_.errors),n==null||n(null)):(y([]),n==null||n(_.query))},[h,s,n]);const R=p.useCallback((_,U)=>{const q=j0(_,U);if(!q){C([]),T(!1);return}if(q.kind==="field"){const Z=q8(q.partial,o);C(Z),v("field"),T(Z.length>0)}else{const Z=G8(q.field,q.partial,i,s);C(Z),v("value"),T(Z.length>0)}E(-1)},[o,i,s]),P=p.useCallback(_=>{const U=_.target.value,q=_.target.selectionStart??U.length;A.current=q,t(U),R(U,q)},[t,R]),$=p.useCallback(_=>{const U=f.current,q=(U==null?void 0:U.selectionStart)??A.current,Z=j0(e,q);if(!Z)return;const{text:F,caret:G}=Y8(e,Z,_);t(F),T(!1),C([]),requestAnimationFrame(()=>{f.current&&(f.current.focus(),f.current.setSelectionRange(G,G),A.current=G)})},[e,t]),I=p.useCallback(_=>{if(!(!S||b.length===0))switch(_.key){case"ArrowDown":_.preventDefault(),E(U=>Math.min(U+1,b.length-1));break;case"ArrowUp":_.preventDefault(),E(U=>Math.max(U-1,-1));break;case"Enter":case"Tab":k>=0&&(_.preventDefault(),$(b[k]));break;case"Escape":T(!1),C([]);break}},[S,b,k,$]),M=p.useRef(null),D=p.useCallback(()=>{M.current=setTimeout(()=>T(!1),120)},[]);p.useEffect(()=>()=>{M.current!==null&&clearTimeout(M.current)},[]);const H=p.useCallback(()=>{var U;const _=((U=f.current)==null?void 0:U.selectionStart)??e.length;R(e,_)},[e,R]);p.useEffect(()=>{var _,U;S&&((U=(_=m.current)==null?void 0:_.querySelector('[aria-selected="true"]'))==null||U.scrollIntoView({block:"nearest"}))},[k,S]);const K=g.length>0&&h.trim()!=="";return r.jsxs("div",{className:`relative flex flex-col gap-1 ${u??""}`,children:[r.jsx("input",{ref:f,type:"text",value:e,onChange:P,onKeyDown:I,onBlur:D,onFocus:H,placeholder:c,"aria-label":"AQL query input","aria-expanded":S,"aria-haspopup":"listbox","aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,className:["h-9 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-sm text-foreground outline-none transition",K?"border-destructive focus:border-destructive focus:ring-2 focus:ring-destructive/30":"border-border/60 focus:border-primary focus:ring-2 focus:ring-ring/30"].join(" ")}),S&&b.length>0&&r.jsx("ul",{ref:m,role:"listbox","aria-label":j==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:b.map((_,U)=>r.jsx("li",{role:"option","aria-selected":U===k,onMouseDown:q=>{q.preventDefault(),$(_)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",U===k?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:_},_))}),K&&r.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:g.map((_,U)=>r.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",_.pos,": ",_.message]},U))})]})}const k0=Lx;function dd(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function Z8(e,t){return e.toString()===t.toString()}function S0(){const{workspace:e}=Bt(),t=fn(),n=zt(),s=p.useRef(null);To("list:assignments");const{data:o,loading:i,error:c,refetch:u}=vf(),f=pa(),m=Qf(),[h,g]=Ns(),y=e?`w:${e}`:null,b=aE(y),C=p.useRef(void 0),j=p.useMemo(()=>WN(f.order),[f]),v=p.useMemo(()=>{const z={};for(const Q of j)z[Q]=$c(f,Q);return z},[j,f]),k=p.useMemo(()=>j.map(z=>({id:z,title:v[z]??z,description:Jf(z)})),[j,v]),E=p.useMemo(()=>m.definitions.map(z=>({id:z.id,title:ji(m,z.id),description:z.description})),[m]),S="__unknown_type__",T=p.useMemo(()=>new Set(["all",...j]),[j]),A=h.get("view"),R=h.get("status"),P=h.get("stale"),$=A&&k0.includes(A)?A:"kanban";function I(z){if(!z)return[];const Q=[];for(const me of z.split(",")){const _e=me.trim();!_e||_e==="all"||!T.has(_e)||Q.includes(_e)||Q.push(_e)}return Q}const M=p.useCallback(z=>{g(Q=>{const me=new URLSearchParams(Q);return z==="kanban"?me.delete("view"):me.set("view",z),me})},[g]),[D,H]=p.useState(""),[K,_]=p.useState(()=>I(R)),[U,q]=p.useState(()=>ze(b.filters.priority)),[Z,F]=p.useState(()=>ze(b.filters.type)),[G,L]=p.useState(()=>ze(b.filters.assignee)),[V,re]=p.useState(()=>ze(b.filters.project)),[B,ue]=p.useState(()=>ze(b.filters.tags)),[ge,se]=p.useState(null),[ye,Se]=p.useState(()=>dd(P)),[Ee,Ae]=p.useState(()=>Xl({status:I(R),priority:ze(b.filters.priority),type:ze(b.filters.type),assignee:ze(b.filters.assignee),project:ze(b.filters.project),tags:ze(b.filters.tags),activity:dd(P)})),[Ke,ct]=p.useState(()=>b.sortField),[et,ot]=p.useState(()=>b.sortDirection),[X,Me]=p.useState(()=>({hidden:[]})),[Ce,Ie]=p.useState(()=>({hidden:[]})),[Ye,Fe]=p.useState(()=>b.grouping),Ze=Ye==="type"?"type":"status",[Qe,Ot]=p.useState(()=>new Set),[yt,dt]=p.useState([]),{toast:le,showToast:Y,dismissToast:fe}=Ro(),[ne,he]=p.useState(null),[De,ut]=p.useState(null),[ae,be]=p.useState(null),[$e,at]=p.useState(null),[Be,kt]=p.useState(null),[St,_t]=p.useState(null),[pe,te]=p.useState(null),[xe,Le]=p.useState(null),[tt,ve]=p.useState(null),[Nt,It]=p.useState(!1),[Zt,jt]=p.useState(!1),wn=e?{kind:"workspace",workspace:e}:{kind:"global"},Rt=h.get("loadView"),{view:oe,loading:Ue,error:nt}=jo(Rt),{view:bt,loading:er,error:qr}=jo(tt),Es=p.useRef(null);p.useEffect(()=>{dt((o==null?void 0:o.assignments)??[])},[o]),p.useEffect(()=>{tt&&!er&&!qr&&!bt&&ve(null)},[bt,qr,tt,er]),p.useEffect(()=>{ve(null),Es.current=null,se(null),H("")},[e]);const Fc=p.useRef({status:R,stale:P});p.useEffect(()=>{const z=I(R),Q=dd(P);Q4(z,K)||_(z),Q!==ye&&Se(Q);const me=Fc.current,_e=me.status!==R||me.stale!==P;Fc.current={status:R,stale:P},_e&&on({status:z,activity:Q})},[ye,P,K,R]),p.useEffect(()=>{C.current===y&&g(z=>{const Q=new URLSearchParams(z);return K.length===0?Q.delete("status"):Q.set("status",K.join(",")),ye==="all"?Q.delete("stale"):ye==="stale"?Q.set("stale","1"):Q.set("stale","0"),Z8(z,Q)?z:Q})},[ye,y,g,K]),p.useEffect(()=>{q(ze(b.filters.priority)),F(ze(b.filters.type)),L(ze(b.filters.assignee)),re(ze(b.filters.project)),ue(ze(b.filters.tags)),ct(b.sortField),ot(b.sortDirection),Fe(b.grouping)},[b.filters.priority,b.filters.type,b.filters.assignee,b.filters.project,b.filters.tags,b.sortField,b.sortDirection,b.grouping]),p.useEffect(()=>{if(C.current===y)return;let z=!1;return Ey().then(Q=>{if(z||C.current===y)return;const me=I1(Q,y),_e=me.defaultView,ft=ze(me.filters.status),vt=me.filters.activity??"all",Mt=new URLSearchParams(window.location.search);let hr=!1;const un=new URLSearchParams(Mt);Mt.get("view")===null&&_e!=="kanban"&&k0.includes(_e)&&(un.set("view",_e),hr=!0),Mt.get("status")===null&&ft.length>0&&(un.set("status",ft.join(",")),_(ft),hr=!0),Mt.get("stale")===null&&vt!=="all"&&(un.set("stale",vt==="stale"?"1":"0"),Se(vt),hr=!0),hr&&g(un,{replace:!0});const pn=I(un.get("status")),mn=un.get("stale")===null?vt:dd(un.get("stale"));Ae(Xl({status:pn,priority:ze(me.filters.priority),type:ze(me.filters.type),assignee:ze(me.filters.assignee),project:ze(me.filters.project),tags:ze(me.filters.tags),activity:mn==="fresh"||mn==="stale"?mn:"all"})),queueMicrotask(()=>{C.current=y})}),()=>{z=!0}},[y]);const ht=p.useCallback(z=>{(y===null?lE(z):cE(y,z)).catch(me=>{console.warn("Failed to persist view prefs:",me)})},[y]),zc=p.useCallback(z=>{M(z),ht({defaultView:z})},[M,ht]),Ji=p.useRef(null);Ji.current={status:K,priority:U,type:Z,assignee:G,project:V,tags:B,activity:ye,dateRange:ge,search:D};const Bc=p.useCallback((z={})=>{const Q=Ji.current;return{status:Q.status,priority:Q.priority,type:Q.type,assignee:Q.assignee,project:Q.project,tags:Q.tags,activity:Q.activity,dateRange:ia(Q.dateRange),search:Q.search,...z}},[]),on=p.useCallback((z={})=>{Ae(Xl(Bc(z)))},[Bc]),Uc=p.useCallback(z=>{_(z),ht({filters:{status:z}}),on({status:z})},[ht,on]),Vc=p.useCallback(z=>{q(z),ht({filters:{priority:z}}),on({priority:z})},[ht,on]),Hc=p.useCallback(z=>{F(z),ht({filters:{type:z}}),on({type:z})},[ht,on]),pp=p.useCallback(z=>{L(z),ht({filters:{assignee:z}}),on({assignee:z})},[ht,on]),mp=p.useCallback(z=>{re(z),ht({filters:{project:z}}),on({project:z})},[ht,on]),en=p.useCallback(z=>{ue(z),ht({filters:{tags:z}}),on({tags:z})},[ht,on]),hp=p.useCallback(z=>{Se(z),ht({filters:{activity:z}}),on({activity:z})},[ht,on]),Qi=p.useCallback(z=>{H(z),on({search:z})},[on]),Wc=p.useCallback(z=>{se(z),on({dateRange:ia(z)})},[on]),Ks=p.useCallback(z=>{ct(z),ht({sortField:z})},[ht]),ya=p.useCallback(z=>{ot(z),ht({sortDirection:z})},[ht]),Kc=p.useCallback(z=>{Fe(z),ht({grouping:z})},[ht]),ba=p.useCallback(z=>{Ae(z);const Q=Zl(z);Q&&(_(ze(Q.status)),q(ze(Q.priority)),F(ze(Q.type)),L(ze(Q.assignee)),re(ze(Q.project)),ue(ze(Q.tags)),H(Q.search??""),Se(Q.activity&&Q.activity!=="all"?Q.activity:"all"),se(Zf(Q.dateRange)))},[]),cn=p.useMemo(()=>Zl(Ee)!==null,[Ee]),va=p.useCallback(()=>{const Q=Zl(Ee)!==null?{status:K,priority:U,type:Z,assignee:G,project:V,tags:B,activity:ye,dateRange:ia(ge),search:D}:{};return{viewMode:$,filters:{...Q,query:Ee},sortField:Ke,sortDirection:et,listSectionVisibility:{collapsed:[...Qe]},kanbanColumnVisibility:X,tableColumnVisibility:Ce}},[$,Ee,K,U,Z,G,V,B,ye,ge,D,Ke,et,Qe,X,Ce]),Bn=p.useCallback(z=>{FN(z,{setViewMode:M,setQuery:Ae,setStatusFilter:Q=>{_(Q),ht({filters:{status:Q}})},setPriorityFilter:Q=>{q(Q),ht({filters:{priority:Q}})},setTypeFilter:Q=>{F(Q),ht({filters:{type:Q}})},setAssigneeFilter:Q=>{L(Q),ht({filters:{assignee:Q}})},setProjectFilter:Q=>{re(Q),ht({filters:{project:Q}})},setTagsFilter:Q=>{ue(Q),ht({filters:{tags:Q}})},setActivityFilter:Q=>{Se(Q),ht({filters:{activity:Q}})},setDateRange:se,setSearch:H,setSortField:Ks,setSortDirection:ya,setListSectionVisibility:Q=>Ot(new Set(Q.collapsed)),setKanbanColumnVisibility:Me,setTableColumnVisibility:Ie}),ve(z.id)},[M,ht,Ks,ya]),gp=p.useCallback(z=>{Bn(z),Es.current=z.id,g(Q=>{const me=new URLSearchParams(Q);return me.set("loadView",z.id),me},{replace:!0})},[Bn,g]),xp=p.useCallback(async z=>{try{const Q=Pi({name:z,context:{workspace:e??null,projectSlug:null},state:va()}),me=await Ci(Q),_e=me.views[me.views.length-1];ve((_e==null?void 0:_e.id)??null),_e&&(Es.current=_e.id,g(ft=>{const vt=new URLSearchParams(ft);return vt.set("loadView",_e.id),vt},{replace:!0})),It(!1),jt(!1),Y(`Saved view "${z}"`,"success")}catch(Q){throw Y(Q instanceof Error?Q.message:"Failed to save view","error"),Q}},[va,g,Y,e]),yp=p.useCallback(async()=>{if(!(!tt||!bt))try{const z=Pi({name:bt.name,context:{workspace:e??null,projectSlug:null},state:va()}),Q=tf(bt.config,z.config,z.config);await Gd(tt,{config:Q}),Y("View updated","success")}catch(z){Y(z instanceof Error?z.message:"Failed to update view","error")}},[va,bt,tt,Y,e]);p.useEffect(()=>{if(!Rt){Es.current=null;return}if(Es.current!==Rt&&(tt&&tt!==Rt&&ve(null),!Ue)){if(nt){Y("Couldn't load saved view — try again","error");return}if(oe){Es.current=Rt,Bn(oe),g(z=>{const Q=new URLSearchParams(z);return Q.delete("loadView"),Q},{replace:!0});return}Es.current=Rt,Y("Saved view no longer exists","error"),g(z=>{const Q=new URLSearchParams(z);return Q.delete("loadView"),Q},{replace:!0})}},[Rt,oe,Ue,nt,tt,Bn,g,Y]);const Yn=p.useMemo(()=>yt.filter(z=>e?e==="_ungrouped"?z.projectWorkspace===null:z.projectWorkspace===e:!0),[yt,e]),wa=p.useMemo(()=>Array.from(new Set(Yn.map(z=>z.status))).sort(),[Yn]),qs=p.useMemo(()=>Array.from(new Set(Yn.map(z=>z.priority))).sort(),[Yn]),Ao=p.useMemo(()=>Array.from(new Set(Yn.map(z=>z.assignee??"__unassigned__"))).sort(),[Yn]),qc=p.useMemo(()=>Array.from(new Map(Yn.filter(z=>z.projectSlug!==null).map(z=>[z.projectSlug,z.projectTitle]))).sort(([,z],[,Q])=>z.localeCompare(Q)),[Yn]),Gc=p.useMemo(()=>Array.from(new Set(Yn.flatMap(z=>z.tags??[]))).sort(),[Yn]),Do=p.useMemo(()=>DN(f.factDeclarations),[f.factDeclarations]),Xi=p.useMemo(()=>Ee.trim()===""?null:Ox(Ee,Do).query,[Ee,Do]),Jt=p.useMemo(()=>PN(yt,Xi,{workspace:e}),[yt,Xi,e]),Gr=p.useMemo(()=>Lc(Jt,Ke,et),[Jt,Ke,et]),Zi=p.useMemo(()=>{if(Ye==="none")return[{id:"__all__",label:"All assignments",items:Jt}];if(Ye==="type"){const z=m.definitions.map(_e=>({id:_e.id,label:ji(m,_e.id),items:Jt.filter(ft=>ft.type===_e.id)})),Q=new Set(m.definitions.map(_e=>_e.id)),me=Jt.filter(_e=>!_e.type||!Q.has(_e.type));return me.length>0&&z.push({id:S,label:"Other",items:me}),z}if(Ye==="priority")return["critical","high","medium","low"].map(Q=>({id:Q,label:Q.charAt(0).toUpperCase()+Q.slice(1),items:Jt.filter(me=>me.priority===Q)}));if(Ye==="assignee")return Array.from(new Set(Jt.map(Q=>Q.assignee??"__unassigned__"))).sort().map(Q=>({id:Q,label:Q==="__unassigned__"?"Unassigned":Q,items:Jt.filter(me=>(me.assignee??"__unassigned__")===Q)}));if(Ye==="project"){const z=new Map;for(const Q of Jt){const me=Q.projectSlug??"__standalone__",_e=Q.projectTitle??"Standalone";z.has(me)||z.set(me,_e)}return Array.from(z.entries()).sort(([,Q],[,me])=>Q.localeCompare(me)).map(([Q,me])=>({id:Q,label:me,items:Jt.filter(_e=>(_e.projectSlug??"__standalone__")===Q)}))}return j.map(z=>({id:z,label:v[z]??z,items:Jt.filter(Q=>Q.status===z)}))},[Ye,Jt,m,j,v]),el=p.useMemo(()=>{const z=new Set(m.definitions.map(me=>me.id));return Jt.some(me=>!me.type||!z.has(me.type))?[...E,{id:S,title:"Other",description:"Assignments with no recognized type."}]:E},[E,m,Jt]),{visibleItems:At,visibleIndexByKey:tl}=p.useMemo(()=>{let z;if($==="table")z=Gr;else if($==="kanban"){const me=new Set(m.definitions.map(_e=>_e.id));Ze==="type"?z=[...m.definitions.flatMap(_e=>Jt.filter(ft=>ft.type===_e.id)),...Jt.filter(_e=>!_e.type||!me.has(_e.type))]:z=j.flatMap(_e=>Jt.filter(ft=>ft.status===_e))}else z=Zi.flatMap(me=>me.items);const Q=new Map;return z.forEach((me,_e)=>Q.set(ln(me),_e)),{visibleItems:z,visibleIndexByKey:Q}},[$,Gr,Zi,Ze,m,Jt,j]),{hotkeyRowProps:ja}=Nc(At,{scope:"list:assignments",onOpen:z=>{if(z.projectSlug===null){n(`/assignments/${z.id}`);return}const Q=z.projectWorkspace?`/w/${z.projectWorkspace}`:t;n(`${Q}/projects/${z.projectSlug}/assignments/${z.slug}`)}});if(Yt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var z;return(z=s.current)==null?void 0:z.focus()}}),Yt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>u()}),i)return r.jsx(xt,{label:"Loading assignments board…"});if(c||!o)return r.jsx(Tt,{error:c||"Assignments board is unavailable."});async function ka({item:z,toColumnId:Q,action:me,reason:_e}){he(ln(z));const ft=yt;dt(vt=>vt.map(Mt=>ln(Mt)===ln(z)?{...Mt,status:Q,blockedReason:Q==="blocked"?_e??Mt.blockedReason:null}:Mt));try{if(z.projectSlug===null){if(!me)throw new Error("Standalone assignments require a transition action, not status override.");const Mt=await fetch(`/api/assignments/${encodeURIComponent(z.id)}/transitions/${encodeURIComponent(me.command)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_e?{reason:_e}:{})});if(!Mt.ok)throw new Error((await Mt.json()).error??`HTTP ${Mt.status}`);const un=(await Mt.json()).assignment;dt(pn=>pn.map(mn=>ln(mn)===ln(z)?{...mn,status:un.status,blockedReason:un.blockedReason,availableTransitions:un.availableTransitions,updated:un.updated}:mn));return}const vt=me?await pE(z.projectSlug,z.slug,me,_e):await mE(z.projectSlug,z.slug,Q);return dt(Mt=>Mt.map(hr=>ln(hr)===ln(z)?{...hr,status:vt.status,blockedReason:vt.blockedReason,availableTransitions:vt.availableTransitions,updated:vt.updated}:hr)),u(),!0}catch(vt){return dt(ft),Y(vt.message,"error"),!1}finally{he(null)}}async function Gs({item:z,toColumnId:Q,action:me}){if(z.status===Q)return;const _e=me??Fl(z,Q);if(_e!=null&&_e.disabled){Y(_e.disabledReason||`Cannot move this assignment to ${Q}.`,"error");return}if(_e&&hE(_e)){at({item:z,toColumnId:Q,action:_e});return}await ka({item:z,toColumnId:Q,action:_e})}async function Sa(z,Q){if(Q===z.title)return;const me=ln(z),_e=yt;dt(ft=>ft.map(vt=>ln(vt)===me?{...vt,title:Q}:vt)),he(me);try{const ft=z.projectSlug===null?await g8({id:z.id,title:Q}):await h8({projectSlug:z.projectSlug,assignmentSlug:z.slug,title:Q});dt(vt=>vt.map(Mt=>ln(Mt)===me?{...Mt,title:ft.title,updated:ft.updated}:Mt)),u()}catch(ft){throw dt(_e),Y(ft.message,"error"),ft}finally{he(null)}}function Yc(z){Ot(Q=>{const me=new Set(Q);return me.has(z)?me.delete(z):me.add(z),me})}function nl(z){Ke===z?ya(et==="asc"?"desc":"asc"):(Ks(z),ya("asc"))}const On=De?yt.find(z=>ln(z)===De)??null:null;function cs(z,Q){z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",Q),ut(Q)}function Pr(){ut(null),be(null)}function us(z,Q){if(!On)return;const me=Fl(On,Q);On.status===Q||me!=null&&me.disabled||(z.preventDefault(),z.dataTransfer.dropEffect="move",be(Q))}function $o(z,Q){ae===Q&&!z.currentTarget.contains(z.relatedTarget)&&be(null)}function Lo(z,Q){if(z.preventDefault(),!On||On.status===Q){Pr();return}Pr(),Gs({item:On,toColumnId:Q})}function Un({field:z,children:Q}){const me=Ke===z;return r.jsx("th",{className:"pb-3 font-medium",children:r.jsxs("button",{type:"button",onClick:()=>nl(z),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Q,me?et==="asc"?r.jsx(xk,{className:"h-3 w-3"}):r.jsx(fr,{className:"h-3 w-3"}):null]})})}return r.jsxs("div",{className:"space-y-5","data-density":b.density,children:[r.jsx("div",{className:"flex items-center justify-end",children:r.jsxs(Te,{to:`${t}/assignments/new`,className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Assignment"]})}),r.jsxs(Zx,{children:[r.jsx(X8,{className:"w-full md:min-w-[320px] md:flex-1",value:Ee,onChange:ba,registry:Do,declarations:f.factDeclarations,valueSources:{statuses:f.order,priorities:qs,types:m.definitions.map(z=>z.id),assignees:Ao.filter(z=>z!=="__unassigned__"),projects:qc.map(([z])=>z),tags:Gc}}),cn?null:r.jsx("span",{className:"inline-flex items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-700 dark:text-amber-300",title:"This query uses features the chips can't represent (OR / NOT / grouping / advanced fields). Edit it in the query box; the chips are read-only until it becomes chip-representable again.",children:"advanced query — edit in the box"}),r.jsx(ep,{ref:s,value:D,onChange:cn?Qi:()=>{},placeholder:"Search assignments or projects"}),r.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!cn,options:wa.map(z=>({value:z,label:v[z]??z})),value:K,onChange:Uc}),r.jsx(yn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!cn,options:qs.map(z=>({value:z,label:z[0].toUpperCase()+z.slice(1)})),value:U,onChange:Vc}),r.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!cn,options:m.definitions.map(z=>({value:z.id,label:ji(m,z.id)})),value:Z,onChange:Hc}),r.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!cn,options:[{value:"__unassigned__",label:"Unassigned"},...Ao.filter(z=>z!=="__unassigned__").map(z=>({value:z,label:z}))],value:G,onChange:pp}),r.jsx(yn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!cn,options:[{value:"__standalone__",label:"Standalone"},...qc.map(([z,Q])=>({value:z,label:Q}))],value:V,onChange:mp}),r.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!cn,options:Gc.map(z=>({value:z,label:z})),value:B,onChange:en}),r.jsx(Xf,{className:"max-w-[200px]",value:ge,onChange:cn?Wc:()=>{}}),r.jsxs("select",{value:ye,disabled:!cn,onChange:z=>hp(z.target.value),className:"editor-input max-w-[180px]",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]}),r.jsx("select",{value:$==="kanban"?Ze:Ye,onChange:z=>Kc(z.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:Y4.map(z=>{const Q=$==="kanban"&&z!=="status"&&z!=="type",me=z==="none"?"No grouping":`Group: ${z.charAt(0).toUpperCase()+z.slice(1)}`;return r.jsx("option",{value:z,disabled:Q,children:Q?`${me} (list only)`:me},z)})}),r.jsx(tp,{value:$,onChange:z=>zc(z),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),$==="table"?r.jsx(rE,{visibility:Ce,onChange:Ie}):null,r.jsx(dE,{scope:wn,loadedViewId:tt,onApply:gp,onOpenSaveDialog:()=>{jt(!1),It(!0)}}),r.jsx("button",{type:"button",onClick:()=>{bt?yp():(jt(!1),It(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:bt?`Update ${bt.name}`:"Save current view",children:bt?`Update '${bt.name}'`:"Save view"}),bt?r.jsx("button",{type:"button",onClick:()=>{jt(!0),It(!0)},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:"Save as new view",children:"Save as new…"}):null]}),o.assignments.length===0?r.jsx(Et,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:r.jsxs(Te,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[r.jsx(Jg,{className:"h-4 w-4"}),r.jsx("span",{children:"Browse Projects"})]})}):Jt.length===0?r.jsx(Et,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again."}):$==="table"?(()=>{const z=new Set(Ce.hidden),Q=me=>me==="title"||!z.has(me);return r.jsx(He,{title:`${Gr.length} assignment${Gr.length===1?"":"s"}`,children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Q("title")?r.jsx(Un,{field:"title",children:"Assignment"}):null,Q("status")?r.jsx(Un,{field:"status",children:"Status"}):null,r.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),Q("priority")?r.jsx(Un,{field:"priority",children:"Priority"}):null,Q("assignee")?r.jsx(Un,{field:"assignee",children:"Assignee"}):null,Q("dependencies")?r.jsx(Un,{field:"dependencies",children:"Dependencies"}):null,Q("created")?r.jsx(Un,{field:"created",children:"Created"}):null,Q("updated")?r.jsx(Un,{field:"updated",children:"Updated"}):null]})}),r.jsx("tbody",{children:Gr.map((me,_e)=>r.jsxs(tU,{detailHref:gc(me),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...ja(_e),children:[Q("title")?r.jsxs("td",{className:"py-4 pr-4",children:[r.jsx(LE,{title:me.title,detailHref:gc(me),onSave:ft=>Sa(me,ft),disabled:ne===ln(me)}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:me.projectTitle??r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),r.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:me.id,children:[me.id.slice(0,8),r.jsx(zr,{value:me.id})]})]}):null,Q("status")?r.jsx("td",{className:"py-4 pr-4",children:r.jsx("select",{value:me.status,disabled:ne===ln(me),onChange:ft=>Gs({item:me,toColumnId:ft.target.value}),className:we("appearance-none rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-wide outline-none","cursor-pointer bg-[length:12px] bg-[right_6px_center] bg-no-repeat pr-6",`bg-[url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E")]`,(Zd[me.status]??Zd.pending).className,ne===ln(me)&&"animate-pulse opacity-60"),children:j.map(ft=>{const vt=me.status===ft?void 0:Fl(me,ft),Mt=(vt==null?void 0:vt.disabled)??!1;return r.jsx("option",{value:ft,disabled:Mt,title:Mt?(vt==null?void 0:vt.disabledReason)??void 0:void 0,children:v[ft]},ft)})})}):null,r.jsx("td",{className:"py-4 pr-4",children:r.jsx(ma,{type:me.type,compact:!0})}),Q("priority")?r.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:me.priority}):null,Q("assignee")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:me.assignee??"Unassigned"}):null,Q("dependencies")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:me.dependsOn.length}):null,Q("created")?r.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Fn(me.created)}):null,Q("updated")?r.jsx("td",{className:"py-4 text-muted-foreground",children:Fn(me.updated)}):null]},ln(me)))})]})})})})():$==="list"?r.jsx("div",{className:"space-y-3",children:Zi.map(({id:z,label:Q,items:me})=>{var un;if(me.length===0&&!(On&&Ye==="status"))return null;const _e=!Qe.has(z),ft=Ye==="status",vt=ft&&On?On.status!==z&&!((un=Fl(On,z))!=null&&un.disabled):!1,Mt=ft&&On?On.status!==z&&!vt:!1,hr=ft&&ae===z;return r.jsxs("div",{className:we("rounded-lg border border-border/60 bg-card/90 transition",hr&&vt&&"ring-2 ring-ring/30",Mt&&"border-dashed opacity-65"),onDragOver:ft?pn=>us(pn,z):void 0,onDragLeave:ft?pn=>$o(pn,z):void 0,onDrop:ft?pn=>Lo(pn,z):void 0,children:[r.jsxs("button",{type:"button",onClick:()=>Yc(z),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[r.jsx(fr,{className:`h-4 w-4 text-muted-foreground transition-transform ${_e?"":"-rotate-90"}`}),r.jsx("span",{className:"font-semibold text-foreground",children:Q}),r.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:me.length})]}),_e&&me.length>0&&r.jsx("div",{className:"space-y-3 px-4 pb-4",children:me.map(pn=>{const mn=ln(pn),Oo=De===mn,Jc=tl.get(mn)??-1,Na=ft;return r.jsx("div",{draggable:Na,onDragStart:Na?ds=>cs(ds,mn):void 0,onDragEnd:Na?Pr:void 0,...Jc>=0?ja(Jc):{},className:we("transition",Na&&"cursor-grab active:cursor-grabbing",Oo&&"scale-[0.98] opacity-50"),children:r.jsx(N0,{assignment:pn,dragging:Oo,transitioning:ne===mn,onPillSelect:ds=>void Gs({item:pn,toColumnId:ds.targetStatus,action:ds}),onRenameTitle:ds=>Sa(pn,ds)})},mn)})})]},z)})}):r.jsx(Yf,{columns:Ze==="type"?el:k,items:Jt,getItemId:ln,getColumnId:z=>Ze==="type"?z.type&&m.definitions.some(Q=>Q.id===z.type)?z.type:S:z.status,canDrop:({item:z,fromColumnId:Q,toColumnId:me})=>{if(Q===me)return{allowed:!0};const _e=Fl(z,me);return _e!=null&&_e.disabled?{allowed:!1,reason:_e.disabledReason||_e.description}:{allowed:!0,reason:_e?_e.warning||_e.description:`Move to ${me} (direct status change).`}},onMove:Ze==="type"?void 0:({item:z,toColumnId:Q})=>Gs({item:z,toColumnId:Q}),dragDisabled:Ze==="type",getExternalDragData:z=>z.projectSlug===null?{type:"standalone-assignment",id:z.id}:{type:"project-assignment",id:z.id},onCardContextMenu:(z,Q)=>{Q.preventDefault(),kt({item:z,anchor:{x:Q.clientX,y:Q.clientY}})},emptyMessage:z=>`No ${z.title.toLowerCase()} assignments.`,hiddenColumnIds:X.hidden,onHideColumn:z=>Me(Q=>({hidden:Q.hidden.includes(z)?Q.hidden.filter(_e=>_e!==z):[...Q.hidden,z]})),renderCard:(z,{dragging:Q})=>{const me=tl.get(ln(z))??-1;return r.jsx("div",{...me>=0?ja(me):{},children:r.jsx(N0,{assignment:z,dragging:Q,transitioning:ne===ln(z),onPillSelect:_e=>void Gs({item:z,toColumnId:_e.targetStatus,action:_e}),onRenameTitle:_e=>Sa(z,_e)})})}}),r.jsx(ha,{toast:le,onDismiss:fe}),r.jsx(uE,{open:Nt,onOpenChange:z=>{It(z),z||jt(!1)},initialName:Zt&&bt?`${bt.name} (copy)`:"",title:Zt?"Save as new view":"Save view",onSubmit:xp}),r.jsx(vE,{open:$e!==null,action:($e==null?void 0:$e.action)??null,assignmentTitle:($e==null?void 0:$e.item.title)??"Assignment",loading:ne===($e?ln($e.item):null),onOpenChange:z=>{z||at(null)},onConfirm:async z=>{if(!$e)return;const Q=$e;await ka({item:Q.item,toColumnId:Q.toColumnId,action:Q.action,reason:z})&&at(null)}}),r.jsx(KN,{anchor:(Be==null?void 0:Be.anchor)??null,items:Be?eU(Be.item,{onEdit:()=>{const z=Be.item,Q=z.projectSlug===null?`/assignments/${z.id}`:`${z.projectWorkspace?`/w/${z.projectWorkspace}`:t}/projects/${z.projectSlug}/assignments/${z.slug}`;n(Q)},onDelete:()=>_t(Be.item),onMove:()=>Le(Be.item)}):[],onClose:()=>kt(null)}),r.jsx(xa,{open:St!==null,title:"Delete assignment?",description:St?`"${St.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:pe!==null,onOpenChange:z=>{!z&&pe===null&&_t(null)},onConfirm:async()=>{if(!St||St.projectSlug===null){_t(null);return}const z=ln(St);te(z);try{const Q=await fetch(`/api/projects/${encodeURIComponent(St.projectSlug)}/assignments/${encodeURIComponent(St.slug)}`,{method:"DELETE"});if(!Q.ok){const me=await Q.json().catch(()=>({}));throw new Error(me.error||"Failed to delete assignment")}_t(null),u()}catch(Q){alert(Q instanceof Error?Q.message:"Failed to delete assignment")}finally{te(null)}}}),r.jsx(ty,{open:xe!==null,onOpenChange:z=>{z||Le(null)},currentWorkspace:(xe==null?void 0:xe.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async z=>{if(!xe)return;const Q=await fetch(`/api/assignments/${encodeURIComponent(xe.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:z})});if(!Q.ok){const me=await Q.json().catch(()=>({}));throw new Error(me.error||"Failed to move assignment")}u()}})]})}function eU(e,t){const n=[{key:"edit",label:"Edit",icon:Oi,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:Tn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:gf,onSelect:t.onMove}),n}function tU({detailHref:e,children:t,className:n,...s}){const o=OE(e);return r.jsx("tr",{...s,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function N0({assignment:e,dragging:t,transitioning:n,onPillSelect:s,onRenameTitle:o}){var f;const i=gc(e),c=!!(s&&o),u=OE(i);return r.jsxs("div",{ref:c?u.containerRef:void 0,className:we("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",c&&"cursor-pointer"),onMouseDown:c?u.onMouseDown:void 0,onClick:c?u.onClick:void 0,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[c?r.jsx(LE,{title:e.title,detailHref:i,onSave:o,disabled:n}):r.jsx(Te,{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:[(f=e.id)==null?void 0:f.slice(0,8),e.id&&r.jsx(zr,{value:e.id})]})]}),c?r.jsx(H8,{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(ma,{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:Fn(e.updated)})]})]})}function Fl(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function ln(e){return e.id||e.slug||"unknown"}function Kr(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],s=e.slice(t[0].length),o=n.split(`
|
|
571
|
+
`),i=[],c=new Map;let u=null,f=[];const m=()=>{u&&(i.push(u),c.set(u,f))};for(const h of o){const g=h.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(g&&!h.startsWith(" ")){m(),u=g[1],f=[h];continue}u&&f.push(h)}return m(),{order:i,blocks:c,body:s}}function qi(e){return`---
|
|
572
|
+
${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
|
|
573
|
+
`)}
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
${e.body.replace(/^\n+/,"")}`}function Cn(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const s=n[0].match(/^[^:]+:\s*(.*)$/);if(!s)return"";const o=s[1].trim();return o==="null"?"":o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'")?o.slice(1,-1):o}function nU(e,t){return Cn(e,t)==="true"}function sc(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 rU(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":/^\d{4}-\d{2}-\d{2}T/.test(e)?`"${e}"`:/[:#{}[\],&*?|>!%@`]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function En(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${rU(n)}`])}function oc(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 ac(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function lp(e){const t=Kr(e);return{title:Cn(t,"title"),slug:Cn(t,"slug"),workspace:Cn(t,"workspace"),archived:nU(t,"archived"),archivedAt:Cn(t,"archivedAt"),archivedReason:Cn(t,"archivedReason"),tags:sc(t,"tags").join(", "),body:t.body}}function sU(e,t){const n=Kr(e),s={...lp(e),...t};return En(n,"title",s.title),En(n,"slug",s.slug),En(n,"workspace",s.workspace||null),En(n,"archived",s.archived),En(n,"archivedAt",s.archivedAt||null),En(n,"archivedReason",s.archivedReason||null),oc(n,"tags",ac(s.tags)),n.body=s.body,qi(n)}function cp(e){const t=Kr(e);return{title:Cn(t,"title"),slug:Cn(t,"slug"),status:Cn(t,"status"),priority:Cn(t,"priority")||"medium",assignee:Cn(t,"assignee"),dependsOn:sc(t,"dependsOn").join(", "),links:sc(t,"links").join(", "),blockedReason:Cn(t,"blockedReason"),tags:sc(t,"tags").join(", "),body:t.body}}function oU(e,t){const n=Kr(e),s={...cp(e),...t};return En(n,"title",s.title),En(n,"slug",s.slug),En(n,"status",s.status),En(n,"priority",s.priority),En(n,"assignee",s.assignee||null),oc(n,"dependsOn",ac(s.dependsOn)),oc(n,"links",ac(s.links)),En(n,"blockedReason",s.blockedReason||null),oc(n,"tags",ac(s.tags)),n.body=s.body,qi(n)}function up(e){const t=Kr(e);return{assignment:Cn(t,"assignment"),status:Cn(t,"status"),body:t.body}}function aU(e,t){const n=Kr(e),s={...up(e),...t};return En(n,"assignment",s.assignment),En(n,"status",s.status),n.body=s.body,qi(n)}function dp(e){const t=Kr(e);return{assignment:Cn(t,"assignment"),body:t.body}}function iU(e,t){const n=Kr(e),s={...dp(e),...t};return En(n,"assignment",s.assignment),n.body=s.body,qi(n)}function fp(e){const t=Kr(e);return{name:Cn(t,"name"),slug:Cn(t,"slug"),description:Cn(t,"description"),whenToUse:Cn(t,"when_to_use"),tags:sc(t,"tags").join(", "),body:t.body}}function lU(e,t){const n=Kr(e),s={...fp(e),...t};return En(n,"name",s.name),En(n,"slug",s.slug),En(n,"description",s.description||null),En(n,"when_to_use",s.whenToUse||null),oc(n,"tags",ac(s.tags)),n.body=s.body,qi(n)}function Dy(e){return{body:Kr(e).body}}function IE(e){return Dy(e)}function _E(e,t){const n=Kr(e);return t.body!==void 0&&(n.body=t.body),qi(n)}function cU(e,t){return _E(e,t)}function Gt(e,t,n){switch(e){case"project":return sU(t,n);case"assignment":return oU(t,n);case"plan":return aU(t,n);case"scratchpad":return iU(t,n);case"playbook":return lU(t,n);case"memory":return _E(t,n);case"resource":return cU(t,n);default:return t}}function Gi({initialContent:e,documentType:t,mode:n="edit",onSave:s,saving:o,error:i,title:c,description:u,onCancel:f,helpTitle:m,helpBody:h,allowSlugEdit:g=!1}){const[y,b]=p.useState(e),[C,j]=p.useState(!1),[v,k]=p.useState("edit");p.useEffect(()=>{b(e)},[e]);const E=pU(t,y),S=y!==e,T=fU(t,y),A=S?"Unsaved changes":n==="create"?"Draft":"Saved",R=t!=="memory"&&t!=="resource";return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[r.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-lg font-semibold text-foreground",children:c}),r.jsx("span",{className:"rounded-full border border-border/70 bg-background/80 px-2.5 py-1 text-xs font-medium text-muted-foreground",children:A})]}),u?r.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:u}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("button",{type:"button",onClick:f,className:"shell-action",children:[r.jsx(Dd,{className:"h-4 w-4"}),r.jsx("span",{children:"Back"})]}),R?r.jsxs("button",{type:"button",onClick:()=>j(P=>!P),className:"shell-action",children:[r.jsx(LP,{className:"h-4 w-4"}),r.jsx("span",{children:C?"Structured":"Raw Markdown"})]}):null,r.jsxs("button",{type:"button",onClick:()=>s(y),disabled:o||E.length>0,className:"inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-semibold text-background transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx(bf,{className:"h-4 w-4"}),r.jsx("span",{children:o?"Saving…":"Save"})]})]})]}),i?r.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:i}):null,E.length>0?r.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:r.jsx("ul",{className:"space-y-1",children:E.map(P=>r.jsx("li",{children:P},P))})}):null]}),r.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[r.jsx("button",{type:"button",onClick:()=>k("edit"),className:`shell-action ${v==="edit"?"shell-action--cta":""}`,children:"Edit"}),r.jsxs("button",{type:"button",onClick:()=>k("preview"),className:`shell-action ${v==="preview"?"shell-action--cta":""}`,children:[r.jsx(uw,{className:"h-4 w-4"}),"Preview"]})]}),r.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[r.jsx("div",{className:v==="preview"?"hidden md:block":"",children:r.jsx("div",{className:"surface-panel space-y-3",children:C?r.jsx("textarea",{value:y,onChange:P=>b(P.target.value),className:"min-h-[720px] w-full rounded-md border border-border/70 bg-background/90 p-4 font-mono text-sm text-foreground outline-none transition focus:border-primary focus:ring-2 focus:ring-ring/30",spellCheck:!1}):r.jsx(uU,{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(uw,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),r.jsx(xn,{content:T,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function uU({documentType:e,content:t,onChange:n,allowSlugEdit:s}){if(e==="project"){const i=lp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(zl,{children:[r.jsx(Ft,{label:"Project title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,f={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(f.slug=wr(u)),n(Gt(e,t,f))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:c=>n(Gt(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is the folder name and URL-safe identifier. It is locked after creation so links and file paths stay stable."})]})}),r.jsx(Ft,{label:"Tags",children:r.jsx("input",{value:i.tags,onChange:c=>n(Gt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(dU,{value:i.workspace,onChange:c=>n(Gt(e,t,{workspace:c}))})]}),r.jsx(Ft,{label:"Project body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const i=cp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(zl,{children:[r.jsx(Ft,{label:"Assignment title",children:r.jsx("input",{value:i.title,onChange:c=>{const u=c.target.value,f={title:u};s&&(i.slug===wr(i.title)||!i.slug.trim())&&(f.slug=wr(u)),n(Gt(e,t,f))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:i.slug,disabled:!s,onChange:c=>n(Gt(e,t,{slug:wr(c.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the assignment folder name and URL. It is auto-generated from the title until you change it, and it cannot be renamed after creation.":"The slug is locked after creation because assignment paths and dependency references use it as a stable identifier."})]})}),r.jsx(Ft,{label:"Status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Gt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"pending",children:"Pending"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"blocked",children:"Blocked"}),r.jsx("option",{value:"review",children:"Review"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"failed",children:"Failed"})]})}),r.jsx(Ft,{label:"Priority",children:r.jsxs("select",{value:i.priority,onChange:c=>n(Gt(e,t,{priority:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"low",children:"Low"}),r.jsx("option",{value:"medium",children:"Medium"}),r.jsx("option",{value:"high",children:"High"}),r.jsx("option",{value:"critical",children:"Critical"})]})}),r.jsx(Ft,{label:"Assignee",children:r.jsx("input",{value:i.assignee,onChange:c=>n(Gt(e,t,{assignee:c.target.value})),placeholder:"Agent name",className:"editor-input"})}),r.jsx(Ft,{label:"Depends on",className:"md:col-span-2",children:r.jsx("input",{value:i.dependsOn,onChange:c=>n(Gt(e,t,{dependsOn:c.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),r.jsx(Ft,{label:"Links",className:"md:col-span-2",children:r.jsx("input",{value:i.links,onChange:c=>n(Gt(e,t,{links:c.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),r.jsx(Ft,{label:"Blocked reason",className:"md:col-span-2",children:r.jsx("input",{value:i.blockedReason,onChange:c=>n(Gt(e,t,{blockedReason:c.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),r.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:i.tags,onChange:c=>n(Gt(e,t,{tags:c.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),r.jsx(Ft,{label:"Assignment body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const i=up(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(zl,{children:[r.jsx(Ft,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),r.jsx(Ft,{label:"Plan status",children:r.jsxs("select",{value:i.status,onChange:c=>n(Gt(e,t,{status:c.target.value})),className:"editor-input",children:[r.jsx("option",{value:"draft",children:"Draft"}),r.jsx("option",{value:"approved",children:"Approved"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"})]})})]}),r.jsx(Ft,{label:"Plan body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const i=dp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(zl,{children:r.jsx(Ft,{label:"Assignment",children:r.jsx("input",{value:i.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),r.jsx(Ft,{label:"Scratchpad body",children:r.jsx("textarea",{value:i.body,onChange:c=>n(Gt(e,t,{body:c.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const i=e==="memory"?Dy(t):IE(t),c=e==="memory"?"Memory body":"Resource body";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ft,{label:c,children:r.jsx("textarea",{value:i.body,onChange:u=>n(Gt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const o=fp(t);return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(zl,{children:[r.jsx(Ft,{label:"Playbook name",children:r.jsx("input",{value:o.name,onChange:i=>{const c=i.target.value,u={name:c};s&&(o.slug===wr(o.name)||!o.slug.trim())&&(u.slug=wr(c)),n(Gt(e,t,u))},className:"editor-input"})}),r.jsx(Ft,{label:"Slug",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("input",{value:o.slug,disabled:!s,onChange:i=>n(Gt(e,t,{slug:wr(i.target.value)})),className:`editor-input ${s?"":"editor-input-disabled"}`}),r.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:s?"The slug becomes the filename. It is auto-generated from the name until you change it.":"The slug is locked after creation because it is the filename."})]})}),r.jsx(Ft,{label:"Description",className:"md:col-span-2",children:r.jsx("input",{value:o.description,onChange:i=>n(Gt(e,t,{description:i.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),r.jsx(Ft,{label:"Tags",className:"md:col-span-2",children:r.jsx("input",{value:o.tags,onChange:i=>n(Gt(e,t,{tags:i.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),r.jsx(Ft,{label:"When to use",className:"md:col-span-2",children:r.jsx("input",{value:o.whenToUse,onChange:i=>n(Gt(e,t,{whenToUse:i.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),r.jsx(Ft,{label:"Playbook rules",children:r.jsx("textarea",{value:o.body,onChange:i=>n(Gt(e,t,{body:i.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function zl({children:e}){return r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ft({label:e,children:t,className:n}){return r.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function dU({value:e,onChange:t}){const{data:n}=Sc(),s=(n==null?void 0:n.workspaces)??[];return r.jsx(Ft,{label:"Workspace",children:r.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"editor-input",children:[r.jsx("option",{value:"",children:"Ungrouped"}),s.map(o=>r.jsx("option",{value:o,children:o},o))]})})}function fU(e,t){switch(e){case"project":return lp(t).body;case"assignment":return cp(t).body;case"plan":return up(t).body;case"scratchpad":return dp(t).body;case"playbook":return fp(t).body;case"memory":return Dy(t).body;case"resource":return IE(t).body}}function pU(e,t){switch(e){case"project":{const n=lp(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!bd(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"assignment":{const n=cp(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!bd(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"plan":return up(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return dp(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=fp(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!bd(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(s=>!!s)}case"memory":case"resource":return[]}}function C0(){const e=zt(),{workspace:t}=Bt(),n=fn(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{fetch("/api/templates/project").then(y=>y.json()).then(y=>{let b=y.content;t&&t!=="_ungrouped"&&(b=b.replace(/^(tags: \[\])$/m,`$1
|
|
577
|
+
workspace: ${t}`)),o(b),c(!1)}).catch(y=>{h(y.message),c(!1)})},[t]);async function g(y){f(!0),h(null);try{const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),f(!1);return}e(`${n}/projects/${C.slug}`)}catch(b){h(b.message),f(!1);return}f(!1)}return i?r.jsx(xt,{label:"Loading project template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Gi,{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 E0(){const{slug:e}=Bt(),t=fn(),n=zt(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{fetch("/api/templates/assignment").then(y=>y.json()).then(y=>{o(y.content),c(!1)}).catch(y=>{h(y.message),c(!1)})},[]);async function g(y){if(!e){h("Project slug is required.");return}f(!0),h(null);try{const b=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),C=await b.json();if(!b.ok){h(C.error||`HTTP ${b.status}`),f(!1);return}n(`${t}/projects/${e}/assignments/${C.slug}`)}catch(b){h(b.message),f(!1);return}f(!1)}return i?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Gi,{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 T0(){const{workspace:e}=Bt(),t=fn(),n=zt(),[s,o]=p.useState(null),[i,c]=p.useState(!0),[u,f]=p.useState(!1),[m,h]=p.useState(null);p.useEffect(()=>{const y=new URLSearchParams({standalone:"1"});e&&y.set("workspace",e),fetch(`/api/templates/assignment?${y.toString()}`).then(b=>b.json()).then(b=>{o(b.content),c(!1)}).catch(b=>{h(b.message),c(!1)})},[e]);async function g(y){var b;f(!0),h(null);try{const C=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:y})}),j=await C.json();if(!C.ok){h(j.error||`HTTP ${C.status}`),f(!1);return}const v=(b=j==null?void 0:j.assignment)==null?void 0:b.id;if(!v){h("Server did not return the new assignment id."),f(!1);return}n(`/assignments/${v}`)}catch(C){h(C.message),f(!1);return}f(!1)}return i?r.jsx(xt,{label:"Loading assignment template…"}):m&&!s?r.jsx(Tt,{error:m}):r.jsx(Gi,{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 Yi({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,documentType:i,helpTitle:c,helpBody:u}){const f=zt(),{data:m,loading:h,error:g}=qk(e),[y,b]=p.useState(!1),[C,j]=p.useState(null);async function v(k){b(!0),j(null);try{const E=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:k})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}f(n)}catch(E){j(E.message),b(!1);return}b(!1)}return h?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):g||!m?r.jsx(Tt,{error:g||`${s} is unavailable.`}):r.jsx(Gi,{initialContent:m.content,documentType:i,onSave:v,saving:y,error:C,title:s,description:o,onCancel:()=>f(n),helpTitle:c,helpBody:u})}function R0(){const{slug:e}=Bt(),t=fn(),n=e??"";return r.jsx(Yi,{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 Kh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,c=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,u=o?`/assignments/${n}`:`${s}/projects/${e}/assignments/${t}`;return r.jsx(Yi,{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 qh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,c=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,u=o?`/assignments/${n}?tab=plan`:`${s}/projects/${e}/assignments/${t}?tab=plan`;return r.jsx(Yi,{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 Gh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,c=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,u=o?`/assignments/${n}?tab=scratchpad`:`${s}/projects/${e}/assignments/${t}?tab=scratchpad`;return r.jsx(Yi,{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 ME({loadUrl:e,saveUrl:t,redirectTo:n,title:s,description:o,helpTitle:i,helpBody:c}){const u=zt(),{data:f,loading:m,error:h}=qk(e),[g,y]=p.useState(""),[b,C]=p.useState(""),[j,v]=p.useState(!1),[k,E]=p.useState(null);async function S(){v(!0),E(null);try{const T=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:g,body:b})}),A=await T.json();if(!T.ok){E(A.error||`HTTP ${T.status}`),v(!1);return}u(n)}catch(T){E(T.message),v(!1);return}v(!1)}return m?r.jsx(xt,{label:`Loading ${s.toLowerCase()}…`}):h||!f?r.jsx(Tt,{error:h||`${s} is unavailable.`}):r.jsxs("div",{className:"space-y-4",children:[r.jsx(He,{title:s,description:o,children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),r.jsx("input",{value:g,onChange:T=>y(T.target.value),placeholder:"Optional title",className:"editor-input"})]}),r.jsxs("label",{className:"block space-y-2",children:[r.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),r.jsx("textarea",{value:b,onChange:T=>C(T.target.value),className:"editor-textarea",spellCheck:!1})]}),k?r.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:k}):null,r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx("button",{type:"button",onClick:()=>u(n),className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:S,disabled:j||!b.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:j?"Appending…":"Append Entry"})]})]})}),r.jsx(He,{title:"Current Document",children:r.jsx(xn,{content:f.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Yh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,c=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,u=o?`/assignments/${n}?tab=handoff`:`${s}/projects/${e}/assignments/${t}?tab=handoff`;return r.jsx(ME,{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 Jh(){const{slug:e,aslug:t,id:n}=Bt(),s=fn(),o=!!n,i=o?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,c=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,u=o?`/assignments/${n}?tab=decisions`:`${s}/projects/${e}/assignments/${t}?tab=decisions`;return r.jsx(ME,{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 P0(){const{workspace:e}=Bt(),{data:t}=Co(),{data:n,loading:s,error:o,refetch:i}=ix(),[c,u]=p.useState(!1),[f,m]=p.useState(""),[h,g]=p.useState(!1),y=Xn();p.useEffect(()=>{const E=y.hash.match(/^#server-(.+)/);if(!E)return;const S=decodeURIComponent(E[1]),T=document.querySelector(`[data-server-name="${window.CSS.escape(S)}"]`);if(!T)return;T.scrollIntoView({block:"nearest"}),T.classList.add("ring-2","ring-primary/60");const A=window.setTimeout(()=>T.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(A)},[y.hash,n]);const b=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const E=new Set(t.filter(S=>e==="_ungrouped"?S.workspace===null:S.workspace===e).map(S=>S.slug));return n.sessions.filter(S=>S.windows.some(T=>T.panes.some(A=>A.assignment&&A.assignment.project!==null&&E.has(A.assignment.project))))})();async function C(E){if(E.preventDefault(),!!f.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.trim()})}),m(""),u(!1),i()}catch{}}async function j(){g(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),i()}finally{g(!1)}}async function v(E){await fetch(`/api/servers/${encodeURIComponent(E)}`,{method:"DELETE"}),i()}async function k(E){await fetch(`/api/servers/${encodeURIComponent(E)}/refresh`,{method:"POST"}),i()}return s?r.jsx(xt,{label:"Loading servers…"}):o?r.jsx(Tt,{error:o}):n?n.tmuxAvailable?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c?r.jsxs("form",{onSubmit:C,className:"flex items-center gap-2",children:[r.jsx("input",{type:"text",value:f,onChange:E=>m(E.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),r.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),r.jsx("button",{type:"button",className:"shell-action",onClick:()=>u(!1),children:"Cancel"})]}):r.jsxs("button",{className:"shell-action",onClick:()=>u(!0),children:[r.jsx(Lt,{className:"h-3.5 w-3.5"}),"Track Session"]}),r.jsxs("button",{className:"shell-action",onClick:j,disabled:h,children:[r.jsx(jk,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`}),"Refresh All"]})]}),b.length===0?r.jsx(Et,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):r.jsx("div",{className:"mt-4 space-y-4",children:b.map(E=>r.jsx(mU,{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(pi,{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 mU({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(ex,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${e.alive?"border border-success-foreground/30 bg-success text-success-foreground":"border border-error-foreground/30 bg-error text-error-foreground"}`,children:e.alive?"alive":"dead"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:r.jsx(jk,{className:"h-3.5 w-3.5"})}),r.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&r.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(o=>r.jsxs("div",{children:[r.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",o.index,": ",o.name]}),r.jsx("div",{className:"space-y-1.5",children:o.panes.map(i=>r.jsx(hU,{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(XP,{className:"h-4 w-4"}),r.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function hU({pane:e,sessionName:t,windowIndex:n,onRefetch:s}){const o=fn(),i=e.cwd.replace(/^\/Users\/[^/]+/,"~");return r.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[r.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),r.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:i}),r.jsx(zr,{value:e.cwd})]}),e.branch&&r.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[r.jsx(Qg,{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($i,{className:"h-2.5 w-2.5"})]},c))}),r.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?r.jsxs(Te,{to:e.assignment.project===null?`/assignments/${e.assignment.slug}`:`${o}/projects/${e.assignment.project}/assignments/${e.assignment.slug}`,className:"inline-flex items-center gap-1 rounded border border-primary/30 bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary hover:bg-primary/20",children:[r.jsx(BP,{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 FE(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 gU(e,t){const n=Date.parse(e),s=Math.floor((n-t)/1e3);return Number.isNaN(s)?"–":s<=0?"expired":FE(s)}function xU(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 yU(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function A0(){const{data:e,loading:t,error:n,refetch:s}=Gk(),[o,i]=p.useState(()=>Date.now()),[c,u]=p.useState(null),[f,m]=p.useState(!1);if(p.useEffect(()=>{const g=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(g)},[]),t)return r.jsx(xt,{label:"Loading inventories…"});if(n)return r.jsx(Tt,{title:"Could not load inventories",error:n,action:r.jsx("button",{type:"button",onClick:s,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return r.jsx(Et,{title:"No inventories yet",description:"Create one with `syntaur lease create-inventory <slug> --kind <kind>`, then add members with `syntaur lease member add <slug> <id>`."});async function h(){if(c){m(!0);try{const g=await fetch(`/api/leases/${encodeURIComponent(c.slug)}/force-release/${encodeURIComponent(c.lease.lease_id)}`,{method:"POST"});if(!g.ok){const y=await g.json().catch(()=>null);throw new Error((y==null?void 0:y.error)??`HTTP ${g.status}`)}s(),u(null)}catch(g){window.alert(g instanceof Error?`Force release failed: ${g.message}`:"Force release failed")}finally{m(!1)}}}return r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex items-start justify-between",children:r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Claimable shared resources (dev envs, test DBs, named locks, …). Global in v1 — the same set appears on every workspace."})]})}),r.jsx("div",{className:"grid gap-4",children:e.inventories.map(g=>r.jsx(bU,{detail:g,now:o,onForceRelease:y=>u({slug:g.inventory.slug,lease:y})},g.inventory.slug))}),r.jsx(xa,{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:f,onConfirm:h,onOpenChange:g=>{g||u(null)}})]})}function bU({detail:e,now:t,onForceRelease:n}){const{inventory:s,members:o,active_leases:i}=e,c=o.filter(f=>f.status==="idle").length,u=o.filter(f=>f.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(xf,{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=",FE(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(f=>r.jsx(vU,{member:f},f.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(f=>r.jsx(wU,{lease:f,now:t,onForceRelease:()=>n(f)},f.lease_id))})]})]})}function vU({member:e}){const t=yU(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 ${xU(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 wU({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(TP,{className:"h-3 w-3"}),gU(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(eA,{className:"h-3 w-3"}),"Force release"]})]})]})}function jU(){return new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10)}function kU(){return new Date().toISOString().slice(0,10)}function D0(){const[e,t]=p.useState(jU()),[n,s]=p.useState(kU()),[o,i]=p.useState(""),[c,u]=p.useState("project"),[f,m]=p.useState(null),[h,g]=p.useState(!0),[y,b]=p.useState(null),[C,j]=p.useState([]);return p.useEffect(()=>{const v=new AbortController;g(!0),b(null);const k=new URLSearchParams({since:e,until:n,groupBy:c});return o&&k.set("project",o),fetch(`/api/usage?${k.toString()}`,{signal:v.signal}).then(E=>{if(!E.ok)throw new Error(`HTTP ${E.status}`);return E.json()}).then(E=>{if(m(E),!o){const S=new Set;for(const T of E.daily)T.project_slug&&S.add(T.project_slug);j([...S].sort())}g(!1)}).catch(E=>{E instanceof Error&&E.name==="AbortError"||(b(E instanceof Error?E.message:String(E)),g(!1))}),()=>{v.abort()}},[e,n,o,c]),r.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[r.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[r.jsx(yf,{className:"w-6 h-6 text-amber-400"}),r.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),r.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Since"}),r.jsx("input",{type:"date",value:e,onChange:v=>t(v.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Until"}),r.jsx("input",{type:"date",value:n,onChange:v=>s(v.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm"})]}),r.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[r.jsx("span",{className:"text-zinc-400",children:"Project"}),r.jsxs("select",{value:o,onChange:v=>i(v.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"",children:"All"}),C.map(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:c,onChange:v=>u(v.target.value),className:"bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm",children:[r.jsx("option",{value:"project",children:"Project"}),r.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),h&&r.jsx("p",{className:"text-zinc-400",children:"Loading…"}),y&&r.jsxs("p",{className:"text-red-400",children:["Error: ",y]}),f&&!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"}),f.summary.length===0?r.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data in this window. Run"," ",r.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):r.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[r.jsx("thead",{className:"bg-zinc-900 text-zinc-400",children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),c==="assignment"&&r.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),r.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),r.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),r.jsx("tbody",{children:f.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)"}),c==="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:Id(v.totalTokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:_d(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"}),f.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:f.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:Id(v.total_tokens)}),r.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:_d(v.total_cost)})]},k))})]})]})]})]})}function $0(){const{workspace:e}=Bt(),{data:t}=Co(),{data:n,loading:s,error:o}=wf(),[i,c]=p.useState(""),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState("started_desc"),[b,C]=p.useState(0),[j,v]=p.useState(new Set),[k,E]=p.useState(!1),[S,T]=p.useState(null),[A,R]=p.useState(null),P=(n==null?void 0:n.sessions.some(_=>_.status==="active"))??!1;p.useEffect(()=>{if(!P)return;const _=window.setInterval(()=>C(U=>U+1),3e4);return()=>window.clearInterval(_)},[P]),p.useEffect(()=>{v(_=>{if(_.size===0)return _;const U=new Set((n==null?void 0:n.sessions.map(Z=>Z.sessionId))??[]),q=new Set([..._].filter(Z=>U.has(Z)));return q.size===_.size?_:q})},[n]);const $=p.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const _=i.trim().toLowerCase();return[...n.sessions.filter(q=>{var G;if(e&&t){const L=((G=t.find(V=>V.slug===q.projectSlug))==null?void 0:G.workspace)??null;if(e==="_ungrouped"){if(L!==null)return!1}else if(L!==e)return!1}const Z=NU(q.started);return u&&(!Z||Z<u)||m&&(!Z||Z>m)?!1:_?[q.projectSlug??"",q.assignmentSlug??"",q.agent,q.sessionId,q.path,q.description??"",q.transcriptPath??""].join(" ").toLowerCase().includes(_):!0})].sort((q,Z)=>CU(q,Z,g))},[n,i,g,u,m,b,e,t]);function I(_){v(U=>{const q=new Set(U);return q.has(_)?q.delete(_):q.add(_),q})}function M(){j.size===$.length&&$.length>0?v(new Set):v(new Set($.map(_=>_.sessionId)))}async function D(_){T(null),E(!0);try{const U=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:_})}),q=await U.json().catch(()=>null);if(!U.ok)throw new Error((q==null?void 0:q.error)||`HTTP ${U.status}`);v(Z=>new Set([...Z].filter(F=>!_.includes(F)))),R(null)}catch(U){T(U.message)}finally{E(!1)}}async function H(_){try{const U=await fetch(`/api/agent-sessions/${encodeURIComponent(_)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!U.ok){const q=await U.json().catch(()=>null);T((q==null?void 0:q.error)||`Failed to mark session stopped: HTTP ${U.status}`)}}catch(U){T(U.message)}}if(s)return r.jsx(xt,{label:"Loading agent sessions..."});if(o)return r.jsx(Tt,{error:o});if(!n)return null;const K=n.sessions.length>0;return r.jsxs(r.Fragment,{children:[r.jsxs(Zx,{children:[r.jsx(ep,{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:_=>f(_.target.value),className:"editor-input min-w-[150px]"})]}),r.jsxs("label",{className:"flex min-w-[150px] flex-col gap-1 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:["Started To",r.jsx("input",{type:"date",value:m,onChange:_=>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,j.size>0&&r.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded border border-border/40 bg-muted/30 px-4 py-2 text-sm",children:[r.jsxs("span",{className:"text-muted-foreground",children:[j.size," session",j.size!==1?"s":""," selected"]}),r.jsxs("button",{className:"shell-action text-destructive",onClick:()=>R({sessionIds:[...j],title:`Delete ${j.size} selected session${j.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:j.size===1?"Delete Session":"Delete Sessions"}),disabled:k,children:[r.jsx(Tn,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),r.jsx("button",{className:"shell-action",onClick:()=>v(new Set),children:"Clear Selection"})]}),K?$.length===0?r.jsx(Et,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):r.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[1280px] table-fixed text-sm",children:[r.jsxs("colgroup",{children:[r.jsx("col",{style:{width:"32px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"160px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"110px"}}),r.jsx("col",{style:{width:"130px"}}),r.jsx("col",{style:{width:"140px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"200px"}}),r.jsx("col",{style:{width:"40px"}})]}),r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[r.jsx("th",{className:"pb-2 pr-3",children:r.jsx("button",{onClick:M,className:"text-muted-foreground hover:text-foreground",children:j.size===$.length&&$.length>0?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(tx,{className:"h-4 w-4"})})}),r.jsx("th",{className:"pb-2 pr-3",children:"Project"}),r.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),r.jsx("th",{className:"pb-2 pr-3",children:"Description"}),r.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),r.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),r.jsx("th",{className:"pb-2 pr-3",children:"Started"}),r.jsx("th",{className:"pb-2 pr-3",children:"Path"}),r.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),r.jsx("th",{className:"pb-2"})]})}),r.jsx("tbody",{children:$.map(_=>r.jsx(SU,{session:_,selected:j.has(_.sessionId),onToggle:()=>I(_.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:H,onCopyError:T},_.sessionId))})]})}):r.jsx(Et,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),r.jsx(xa,{open:A!==null,title:(A==null?void 0:A.title)??"Delete session?",description:(A==null?void 0:A.description)??"",confirmLabel:(A==null?void 0:A.confirmLabel)??"Delete",destructive:!0,loading:k,onOpenChange:_=>{_||R(null)},onConfirm:async()=>{A&&await D(A.sessionIds)}})]})}function SU({session:e,selected:t,onToggle:n,onDelete:s,onMarkStopped:o,onCopyError:i}){const c=fn(),u=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,f=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",m=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return r.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[r.jsx("td",{className:"py-2 pr-3",children:r.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?r.jsx(Fr,{className:"h-4 w-4"}):r.jsx(tx,{className:"h-4 w-4"})})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?r.jsx(Te,{to:`${c}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:Sn(e.projectSlug),children:Sn(e.projectSlug)}):e.assignmentSlug?r.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wide text-muted-foreground",children:"Standalone"}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.projectSlug&&e.assignmentSlug?r.jsx(Te,{to:`${c}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:Sn(e.assignmentSlug),children:Sn(e.assignmentSlug)}):e.assignmentSlug?r.jsx(Te,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:e.description?r.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(mf,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:u}),r.jsx(zr,{value:e.sessionId}),r.jsx(fE,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:h=>i(h.message),onNotice:h=>i(h)})]})}),r.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:r.jsx("span",{className:"truncate block",children:Br(e.started)})}),r.jsx("td",{className:"py-2 pr-3",children:r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:f}),e.path&&r.jsx(zr,{value:e.path})]})}),r.jsx("td",{className:"py-2 pr-3",children:e.transcriptPath?r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:m}),r.jsx(zr,{value:e.transcriptPath})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx("td",{className:"py-2",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(xE,{session:e,onMarkStopped:o}),r.jsx("button",{onClick:s,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})})]})}function NU(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 fd(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 CU(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 fd(e)-fd(t);case"duration_desc":return fd(t)-fd(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 EU(){const{data:e,loading:t,error:n,refetch:s}=lx(),[o,i]=p.useState(""),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.useState(null),y=p.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!o.trim())return e.playbooks;const j=o.toLowerCase();return e.playbooks.filter(v=>v.name.toLowerCase().includes(j)||v.description.toLowerCase().includes(j)||v.slug.toLowerCase().includes(j)||v.tags.some(k=>k.toLowerCase().includes(j)))},[e,o]);async function b(j,v,k){if(j.preventDefault(),j.stopPropagation(),!c){u(v);try{const E=k?"disable":"enable",S=await fetch(`/api/playbooks/${encodeURIComponent(v)}/${E}`,{method:"POST"});if(!S.ok){const T=await S.json().catch(()=>({}));throw new Error(T.error||`Failed to ${E} playbook`)}s()}catch(E){console.error(E),alert(E instanceof Error?E.message:"Failed to update playbook")}finally{u(null)}}}async function C(){if(f){g(f.slug);try{const j=await fetch(`/api/playbooks/${encodeURIComponent(f.slug)}`,{method:"DELETE"});if(!j.ok){const v=await j.json().catch(()=>({}));throw new Error(v.error||"Failed to delete playbook")}m(null),s()}catch(j){console.error(j),alert(j instanceof Error?j.message:"Failed to delete playbook")}finally{g(null)}}}return t?r.jsx(xt,{label:"Loading playbooks..."}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(No,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange:j=>i(j.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs(Te,{to:"/playbooks/create",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create Playbook"]})]}),r.jsxs(Te,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[r.jsx(bk,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:"auto-generated"})]}),r.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[11px]",children:"~/.syntaur/playbooks/manifest.md"})," in your CLAUDE.md for agent context."]})]})]}),y.length===0?r.jsx(Et,{title:"No playbooks found",description:(e==null?void 0:e.playbooks.length)===0?"Playbooks define rules and workflows for how agents should operate. Create your first one to get started.":"No playbooks match your search.",actions:(e==null?void 0:e.playbooks.length)===0?r.jsxs(Te,{to:"/playbooks/create",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:y.map(j=>{const v=c===j.slug,k=[{key:"delete",label:"Delete",icon:Tn,destructive:!0,onSelect:()=>m({slug:j.slug,name:j.name})}];return r.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${j.enabled?"":"opacity-75"}`,children:[r.jsx("div",{className:"absolute right-3 top-3 z-10",children:r.jsx(Yx,{items:k})}),r.jsxs(Te,{to:`/playbooks/${j.slug}`,className:"group flex flex-col gap-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(hk,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:j.name}),j.description?r.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:j.description}):null]})]}),r.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[j.tags.slice(0,3).map(E=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-[10px] text-muted-foreground",children:[r.jsx(kk,{className:"h-2.5 w-2.5"}),E]},E)),j.tags.length>3?r.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",j.tags.length-3]}):null]})})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":j.enabled,"aria-label":j.enabled?"Disable playbook":"Enable playbook",onClick:E=>b(E,j.slug,j.enabled),disabled:v,className:`absolute bottom-3 right-3 z-10 inline-flex h-5 w-9 items-center rounded-full border opacity-100 transition disabled:opacity-50 ${j.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${j.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},j.slug)})}),r.jsx(xa,{open:f!==null,title:"Delete playbook?",description:f?`"${f.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:h!==null,onConfirm:C,onOpenChange:j=>{j||m(null)}})]})}function TU(){const{slug:e}=Bt(),t=zt(),{data:n,loading:s,error:o,refetch:i}=e3(e),[c,u]=p.useState(!1),[f,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(!1),[C,j]=p.useState(""),[v,k]=p.useState(!1),[E,S]=p.useState(null),T=e==="manifest";p.useEffect(()=>{y&&(j(e??""),S(null))},[y,e]);const A=wr(C),R=A.length>0&&bd(A)&&A!=="manifest",P=A!==e;async function $(){if(!(!e||!R||!P)){k(!0),S(null);try{const D=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:A})});if(!D.ok){const H=await D.json().catch(()=>({}));throw new Error(H.error||"Failed to rename playbook")}b(!1),t(`/playbooks/${A}`)}catch(D){S(D instanceof Error?D.message:"Failed to rename playbook")}finally{k(!1)}}}async function I(){if(e){m(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{m(!1)}}}async function M(){if(!(!e||!n)){g(!0);try{const D=n.enabled?"disable":"enable",H=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${D}`,{method:"POST"});if(!H.ok){const K=await H.json().catch(()=>({}));throw new Error(K.error||`Failed to ${D} playbook`)}i()}catch(D){console.error(D),alert(D instanceof Error?D.message:"Failed to update playbook")}finally{g(!1)}}}return s?r.jsx(xt,{label:"Loading playbook..."}):o?r.jsx(Tt,{error:o}):n?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:T?"Playbook Manifest":n.name}),T?r.jsx("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:"auto-generated"}):null]}),!T&&n.description?r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,T?r.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.syntaur/playbooks/manifest.md"})," ","in your CLAUDE.md for agent context."]}):null,!T&&n.whenToUse?r.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(n.created)]}),r.jsxs("span",{children:["Updated ",Br(n.updated)]})]}),n.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(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(kk,{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:M,disabled:h,className:`inline-flex h-5 w-9 items-center rounded-full border transition disabled:opacity-50 ${n.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:r.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${n.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]}),r.jsxs(Te,{to:`/playbooks/${e}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Oi,{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(nA,{className:"h-3 w-3"}),"Rename"]}),c?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:I,disabled:f,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:f?"Deleting...":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:n.body})}),r.jsx(zn,{open:y,onOpenChange:D=>v?void 0:b(D),children:r.jsxs($n,{children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:"Rename playbook"}),r.jsx(Hr,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),r.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:C,onChange:D=>j(D.target.value),disabled:v,className:"h-9 w-full rounded-md border border-border/70 bg-background px-3 text-sm text-foreground focus:border-foreground/40 focus:outline-none",placeholder:"my-new-slug"}),C&&A!==C?r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:A||"—"})]}):null,C&&!R?r.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),E?r.jsx("p",{className:"text-sm text-destructive",role:"alert",children:E}):null,r.jsxs(Vr,{children:[r.jsx("button",{type:"button",onClick:()=>b(!1),disabled:v,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),r.jsx("button",{type:"button",onClick:$,disabled:v||!R||!P,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Renaming…":"Rename"})]})]})})]}):null}function RU(){const e=zt(),[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(!1),[u,f]=p.useState(null);p.useEffect(()=>{fetch("/api/playbooks/template/new").then(h=>h.json()).then(h=>{n(h.content),o(!1)}).catch(h=>{f(h.message),o(!1)})},[]);async function m(h){c(!0),f(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){f(y.error||`HTTP ${g.status}`),c(!1);return}e(`/playbooks/${y.slug}`)}catch(g){f(g.message),c(!1);return}c(!1)}return s?r.jsx(xt,{label:"Loading playbook template..."}):u&&!t?r.jsx(Tt,{error:u}):r.jsx(Gi,{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 PU(){const{slug:e}=Bt(),t=zt(),[n,s]=p.useState(null),[o,i]=p.useState(!0),[c,u]=p.useState(!1),[f,m]=p.useState(null);p.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(g=>g.json()).then(g=>{s(g.content),i(!1)}).catch(g=>{m(g.message),i(!1)})},[e]);async function h(g){if(e){u(!0),m(null);try{const y=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),b=await y.json();if(!y.ok){m(b.error||`HTTP ${y.status}`),u(!1);return}t(`/playbooks/${e}`)}catch(y){m(y.message),u(!1);return}u(!1)}}return o?r.jsx(xt,{label:"Loading playbook..."}):f&&!n?r.jsx(Tt,{error:f}):r.jsx(Gi,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:h,saving:c,error:f,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function AU(){const{data:e,loading:t,error:n}=t3(),[s,o]=p.useState(""),[i,c]=p.useState("all"),[u,f]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.memories)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.scope).filter(Boolean))).sort(),[g]),C=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.scope!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(xt,{label:"Loading memories…"}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(No,{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=>f(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All scopes"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Te,{to:"/memories/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Memory"]})]}),j.length===0?r.jsx(Et,{title:g.length===0?"No memories yet":"No memories match these filters",description:g.length===0?"Memories capture patterns and learnings discovered while working in a project. Agents create them via /create-memory or you can add one manually.":"Clear the current filters or create a new memory.",actions:g.length===0?r.jsxs(Te,{to:"/memories/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Memory"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Te,{to:`/projects/${v.projectSlug}/memories/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Te,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.scope||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Fn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function DU(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:s,loading:o,error:i}=n3(e,t),[c,u]=p.useState(!1),[f,m]=p.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{m(!1)}}}return o?r.jsx(xt,{label:"Loading memory…"}):i?r.jsx(Tt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Te,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.scope?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",s.scope]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,s.sourceAssignment?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",s.sourceAssignment]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]}),s.tags&&s.tags.length>0?r.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.tags.map(g=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 text-xs text-muted-foreground",children:g},g))}):null]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Te,{to:`/projects/${e}/memories/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Oi,{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:f,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:f?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:s.body})})]}):null}function $U(){const e=zt(),[t]=Ns(),n=t.get("project"),{data:s,loading:o,error:i}=Co(),[c,u]=p.useState(n??""),[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[C,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!f.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/memories/${S.slug}`)}catch(E){j(E.message),b(!1)}}}return o?r.jsx(xt,{label:"Loading projects…"}):i?r.jsx(Tt,{error:i}):!s||s.length===0?r.jsx(Tt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Memories capture patterns and learnings discovered during work in a project. They are available to every assignment in that project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:f,onChange:k=>m(k.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the memory body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!f.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 LU(){const{slug:e,itemSlug:t}=Bt();return r.jsx(Yi,{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 OU(){const{data:e,loading:t,error:n}=r3(),[s,o]=p.useState(""),[i,c]=p.useState("all"),[u,f]=p.useState("all"),[m,h]=p.useState("all"),g=(e==null?void 0:e.resources)??[],y=p.useMemo(()=>Array.from(new Set(g.map(v=>v.projectSlug))).sort(),[g]),b=p.useMemo(()=>Array.from(new Set(g.map(v=>v.category).filter(Boolean))).sort(),[g]),C=p.useMemo(()=>Array.from(new Set(g.map(v=>v.source).filter(Boolean))).sort(),[g]),j=p.useMemo(()=>g.filter(v=>{if(i!=="all"&&v.projectSlug!==i||u!=="all"&&v.category!==u||m!=="all"&&v.source!==m)return!1;if(s.trim()){const k=s.toLowerCase();if(!v.name.toLowerCase().includes(k)&&!v.slug.toLowerCase().includes(k)&&!v.projectTitle.toLowerCase().includes(k))return!1}return!0}),[g,s,i,u,m]);return t?r.jsx(xt,{label:"Loading resources…"}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(No,{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=>f(v.target.value),className:"editor-input max-w-[160px]",children:[r.jsx("option",{value:"all",children:"All categories"}),b.map(v=>r.jsx("option",{value:v,children:v},v))]}),r.jsxs("select",{value:m,onChange:v=>h(v.target.value),className:"editor-input max-w-[140px]",children:[r.jsx("option",{value:"all",children:"All sources"}),C.map(v=>r.jsx("option",{value:v,children:v},v))]})]}),r.jsxs(Te,{to:"/resources/new",className:"inline-flex h-9 items-center gap-2 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Resource"]})]}),j.length===0?r.jsx(Et,{title:g.length===0?"No resources yet":"No resources match these filters",description:g.length===0?"Resources are reference materials shared across a project — specs, requirements, links, or any reference content.":"Clear the current filters or create a new resource.",actions:g.length===0?r.jsxs(Te,{to:"/resources/new",className:"inline-flex items-center gap-2 rounded-md bg-foreground px-3 py-2 text-sm font-medium text-background transition hover:bg-foreground/90",children:[r.jsx(Lt,{className:"h-4 w-4"}),"New Resource"]}):void 0}):r.jsx("div",{className:"surface-panel overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),r.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),r.jsx("tbody",{children:j.map(v=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-3 py-3",children:r.jsx(Te,{to:`/projects/${v.projectSlug}/resources/${v.slug}`,className:"font-semibold text-foreground hover:text-primary",children:v.name||v.slug})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:r.jsx(Te,{to:`/projects/${v.projectSlug}`,className:"hover:text-foreground hover:underline",children:v.projectTitle})}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.category||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.source||"—"}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:v.relatedAssignments.length}),r.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Fn(v.updated)})]},`${v.projectSlug}/${v.slug}`))})]})})]})}function IU(){const{slug:e,itemSlug:t}=Bt(),n=zt(),{data:s,loading:o,error:i}=s3(e,t),[c,u]=p.useState(!1),[f,m]=p.useState(!1);async function h(){if(!(!e||!t)){m(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{m(!1)}}}return o?r.jsx(xt,{label:"Loading resource…"}):i?r.jsx(Tt,{error:i}):s?r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:s.name||s.slug}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Te,{to:`/projects/${s.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:s.projectTitle}),s.category?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",s.category]}):null,s.source?r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",s.source]}):null,r.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[s.relatedAssignments.length," related"]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[r.jsxs("span",{children:["Created ",Br(s.created)]}),r.jsxs("span",{children:["Updated ",Br(s.updated)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(Te,{to:`/projects/${e}/resources/${t}/edit`,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:[r.jsx(Oi,{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:f,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:f?"Deleting…":"Confirm"}),r.jsx("button",{type:"button",onClick:()=>u(!1),className:"inline-flex h-8 items-center rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-foreground transition hover:bg-muted",children:"Cancel"})]}):r.jsxs("button",{type:"button",onClick:()=>u(!0),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-border/70 bg-background px-3 text-xs font-medium text-destructive transition hover:bg-destructive/10",children:[r.jsx(Tn,{className:"h-3 w-3"}),"Delete"]})]})]}),r.jsx("div",{className:"surface-panel p-4",children:r.jsx(xn,{content:s.body})})]}):null}function _U(){const e=zt(),[t]=Ns(),n=t.get("project"),{data:s,loading:o,error:i}=Co(),[c,u]=p.useState(n??""),[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(!1),[C,j]=p.useState(null);p.useEffect(()=>{!c&&s&&s.length>0&&u(n??s[0].slug)},[s,n,c]);async function v(k){if(k.preventDefault(),!(!c||!f.trim())){b(!0),j(null);try{const E=await fetch(`/api/projects/${c}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f.trim(),body:h||void 0})}),S=await E.json();if(!E.ok){j(S.error||`HTTP ${E.status}`),b(!1);return}e(`/projects/${S.projectSlug}/resources/${S.slug}`)}catch(E){j(E.message),b(!1)}}}return o?r.jsx(xt,{label:"Loading projects…"}):i?r.jsx(Tt,{error:i}):!s||s.length===0?r.jsx(Tt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):r.jsxs("form",{onSubmit:v,className:"space-y-5",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),r.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Resources are reference material — specs, requirements, links — shared across every assignment in a project."})]}),r.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),r.jsx("select",{id:"project",value:c,onChange:k=>u(k.target.value),className:"editor-input",required:!0,children:s.map(k=>r.jsx("option",{value:k.slug,children:k.title},k.slug))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),r.jsx("input",{id:"name",type:"text",value:f,onChange:k=>m(k.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),r.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),r.jsx("textarea",{id:"body",value:h,onChange:k=>g(k.target.value),rows:14,placeholder:"Write the resource body in markdown. Leave blank to start from a template.",className:"editor-input font-mono text-sm"})]}),C?r.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:C}):null,r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"submit",disabled:y||!f.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 MU(){const{slug:e,itemSlug:t}=Bt();return r.jsx(Yi,{loadUrl:`/api/projects/${e}/resources/${t}/edit`,saveUrl:`/api/projects/${e}/resources/${t}`,redirectTo:`/projects/${e}/resources/${t}`,title:"Edit Resource",description:"Edit the body. The frontmatter (name, category, source, related assignments) is preserved unchanged on save.",documentType:"resource",helpTitle:"Resource editing",helpBody:"Resource edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}function FU({value:e,onChange:t,ariaLabel:n}){const s=n??"Pick a color",o=n?`${n} (hex)`:"Color hex value";return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"color",value:e||"#64748b",onChange:i=>t(i.target.value),className:"h-7 w-7 shrink-0 cursor-pointer rounded-md border border-border/60 bg-transparent p-0.5",title:"Pick a color","aria-label":s}),r.jsx("input",{type:"text",value:e,onChange:i=>t(i.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":o})]})}const Mg=["projects","playbooks","todos","servers","config"];function zU(e){const t=new Set;for(const n of e.split(",").map(s=>s.trim()))Mg.includes(n)&&t.add(n);return t}function L0(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function BU(){const[e,t]=p.useState(!0),[n,s]=p.useState(null),[o,i]=p.useState(""),[c,u]=p.useState(new Set(Mg)),[f,m]=p.useState(!1),[h,g]=p.useState(!1),[y,b]=p.useState(null),[C,j]=p.useState(null),v=p.useCallback(async()=>{try{const R=await fetch("/api/backup");if(!R.ok)throw new Error(`HTTP ${R.status}`);const P=await R.json();s(P),i(P.repo??""),u(zU(P.categories)),m(!1)}catch(R){j({type:"error",message:`Failed to load backup config: ${R instanceof Error?R.message:String(R)}`})}finally{t(!1)}},[]);p.useEffect(()=>{v()},[v]);function k(R){u(P=>{const $=new Set(P);return $.has(R)?$.delete(R):$.add(R),$}),m(!0)}async function E(){g(!0),j(null);try{const R=Array.from(c),P=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:R})}),$=await P.json();if(!P.ok)throw new Error($.error||`HTTP ${P.status}`);s($),m(!1),j({type:"success",message:"Backup configuration saved."})}catch(R){j({type:"error",message:`Save failed: ${R instanceof Error?R.message:String(R)}`})}finally{g(!1)}}async function S(){b("push"),j(null);try{const R=await fetch("/api/backup/push",{method:"POST"}),P=await R.json();if(!R.ok||P.success===!1)throw new Error(P.error||P.message||`HTTP ${R.status}`);j({type:"success",message:P.message||"Backup complete."}),await v()}catch(R){j({type:"error",message:`Backup failed: ${R instanceof Error?R.message:String(R)}`})}finally{b(null)}}async function T(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){b("pull"),j(null);try{const P=await fetch("/api/backup/pull",{method:"POST"}),$=await P.json();if(!P.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${P.status}`);j({type:"success",message:$.message||"Restore complete."}),await v()}catch(P){j({type:"error",message:`Restore failed: ${P instanceof Error?P.message:String(P)}`})}finally{b(null)}}}if(e)return r.jsx(He,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const A=!!o.trim()&&c.size>0&&!y&&!f;return r.jsx(He,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:r.jsxs("div",{className:"space-y-4",children:[C&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${C.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:C.message}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),r.jsx("input",{type:"text",value:o,onChange:R=>{i(R.target.value),m(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",r.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:Mg.map(R=>{const P=c.has(R);return r.jsxs("button",{type:"button",onClick:()=>k(R),className:`shell-action text-xs ${P?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[r.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${P?"bg-primary":"bg-muted-foreground/40"}`}),R]},R)})})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),L0((n==null?void 0:n.lastBackup)??null)]}),r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),L0((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||!f,children:[r.jsx(bf,{className:"h-3.5 w-3.5"}),h?"Saving...":"Save Config"]}),r.jsxs("button",{className:"shell-action",onClick:S,disabled:!A,title:A?"Back up now":f?"Save config first":"Set repo and pick categories",children:[r.jsx(rA,{className:"h-3.5 w-3.5"}),y==="push"?"Backing up...":"Back Up Now"]}),r.jsxs("button",{className:"shell-action",onClick:T,disabled:!A,title:A?"Restore from backup":f?"Save config first":"Set repo and pick categories",children:[r.jsx(DP,{className:"h-3.5 w-3.5"}),y==="pull"?"Restoring...":"Restore"]}),f&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),r.jsxs("p",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-muted/20 p-3 text-xs text-muted-foreground",children:[r.jsx(RP,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),r.jsxs("span",{children:["Restore never overwrites ",r.jsx("code",{className:"rounded bg-muted px-1",children:"config.md"})," (would clobber backup settings). The agent sessions database is not backed up — only markdown files."]})]})]})})}function UU({open:e,affected:t,remaining:n,ruleReferences:s,headlineReferences:o,onResolve:i,onCancel:c}){var A,R;const[u,f]=p.useState(n.length>0?"remap":"delete"),[m,h]=p.useState(((A=n[0])==null?void 0:A.id)??""),[g,y]=p.useState(((R=n[0])==null?void 0:R.id)??""),[b,C]=p.useState(!1),j=t.count>0;p.useEffect(()=>{var P,$;e&&(f(n.length>0?"remap":"delete"),h(((P=n[0])==null?void 0:P.id)??""),y((($=n[0])==null?void 0:$.id)??""),C(!1))},[e,n]);const v=!o||g!==""&&g!==t.id,k=u==="remap"&&n.length>0&&m!==""&&m!==t.id||u==="delete"&&(!j||b)&&v;function E(){k&&(u==="remap"?i({id:t.id,mode:"remap",target:m},m):i({id:t.id,mode:"delete"},o?g:""))}const S=t.assignments.slice(0,10),T=t.count-S.length;return r.jsx(zn,{open:e,onOpenChange:P=>P?void 0:c(),children:r.jsxs($n,{className:"max-w-xl",children:[r.jsxs(pr,{children:[r.jsxs(Ln,{children:['Delete status "',t.label,'"',j?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),r.jsx(Hr,{children:j?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),j&&r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsxs("ul",{className:"space-y-1 text-sm",children:[S.map(P=>r.jsx("li",{children:r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:P.display})},`${P.projectSlug??"standalone"}/${P.assignmentSlug}`)),T>0&&r.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",T," more not shown"]})]})}),s.length>0&&r.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-3",children:[r.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"Workflow rules referencing this status:"}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:s.map((P,$)=>r.jsxs("li",{children:[r.jsx("span",{className:"text-foreground",children:P.section}),r.jsx("span",{className:"mx-1",children:"·"}),P.detail]},$))}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:u==="remap"?"These will be remapped to the target status.":"Ladder rungs and transitions referencing this status will be removed"+(o?"; headline rules must be remapped below.":".")})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="remap",onChange:()=>f("remap"),disabled:n.length===0,className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium",children:j?"Remap to another status":"Remap rules to another status"}),r.jsxs("select",{value:m,onChange:P=>h(P.target.value),onClick:()=>f("remap"),disabled:u!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),n.length===0&&r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:"No other saved statuses to remap to. Add another status first, or use Delete."})]})]}),r.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[r.jsx("input",{type:"radio",name:"status-delete-mode",checked:u==="delete",onChange:()=>f("delete"),className:"mt-1"}),r.jsxs("span",{className:"flex-1",children:[r.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:j?"Delete these assignments":"Drop the referencing rules"}),r.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:j?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),u==="delete"&&o&&r.jsxs("span",{className:"mt-2 block",children:[r.jsx("span",{className:"block text-xs font-medium",children:"Remap headline rules to"}),r.jsxs("select",{value:g,onChange:P=>y(P.target.value),disabled:n.length===0,className:"mt-1 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&r.jsx("option",{value:"",children:"(no other statuses)"}),n.map(P=>r.jsxs("option",{value:P.id,children:[P.label," (",P.id,")"]},P.id))]}),r.jsx("span",{className:"mt-1 block text-xs text-muted-foreground",children:"The headline projection cannot reference a deleted status, so it must point somewhere."})]}),u==="delete"&&j&&r.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[r.jsx("input",{type:"checkbox",checked:b,onChange:P=>C(P.target.checked)}),r.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),r.jsxs(Vr,{children:[r.jsx("button",{type:"button",onClick:c,className:"shell-action",children:"Cancel"}),r.jsx("button",{type:"button",onClick:E,disabled:!k,className:`shell-action ${u==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:u==="remap"?j?`Remap ${t.count} → ${m||"..."}`:`Remap rules → ${m||"..."}`:j?`Delete ${t.count}`:"Drop rules"})]})]})})}function VU({open:e,references:t,onConfirm:n,onCancel:s}){return r.jsx(zn,{open:e,onOpenChange:o=>o?void 0:s(),children:r.jsxs($n,{className:"max-w-xl",children:[r.jsxs(pr,{children:[r.jsx(Ln,{children:"Delete fact — referenced by derive rules"}),r.jsx(Hr,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),r.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:r.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>r.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[r.jsx("span",{className:"text-foreground",children:o.location}),r.jsx("span",{className:"mx-1",children:"·"}),r.jsx("span",{children:o.when})]},i))})}),r.jsxs(Vr,{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 HU(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 WU(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 KU(e,t){return t.headline.parked===e||t.headline.blocked===e}function qU(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 GU(e,t,n){return e.map(s=>({...s,from:s.from===t?n:s.from,to:s.to===t?n:s.to}))}function YU(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 JU(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function QU(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 O0(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 XU(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:s,bindAction:o,unbindAction:i}=Eo(),[c,u]=p.useState(null),[f,m]=p.useState(null),[h,g]=p.useState(!1),y=Object.values(t).some(S=>typeof S=="string"&&S.length>0);function b(S,T){m({type:S,message:T}),setTimeout(()=>m(null),2500)}function C(S){u({kind:S,combo:null,conflict:null,saving:!1,error:null})}function j(S){if(!c||S.key==="Escape")return;if(S.key==="Enter"&&c.combo){S.preventDefault(),v();return}if(S.key==="Enter")return;S.preventDefault(),S.stopPropagation();const T=Yk(S.nativeEvent);if(!T)return;const A=s(T,c.kind);u({...c,combo:T,conflict:A,error:null})}async function v(){var S;if(c!=null&&c.combo){if((S=c.conflict)!=null&&S.description){u({...c,error:`Reserved: ${c.conflict.description}`});return}u({...c,saving:!0,error:null});try{await o(c.kind,c.combo),u(null),b("success",`Bound ${$l[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 ${$l[S]} binding`)}catch(T){b("error",T instanceof Error?T.message:"Failed to clear binding")}}async function E(){if(!h){g(!0);try{await k$(),b("success","All hotkey bindings cleared")}catch(S){b("error",S instanceof Error?S.message:"Failed to reset bindings")}finally{g(!1)}}}return r.jsxs(He,{title:"Hotkey Bindings",description:"Each canonical create action ships with a default hotkey that fires the action without opening the palette. Override any of them below — Clear restores the default.",actions:y?r.jsxs("button",{className:"shell-action text-xs",onClick:()=>void E(),disabled:h,children:[r.jsx(Bs,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[f?r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${f.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:f.message}):null,r.jsx("ul",{className:"space-y-2",children:jf.map(S=>{var $,I;const T=n.find(M=>M.bindableKind===S),A=e[S],R=typeof t[S]=="string"&&!!t[S],P=(c==null?void 0:c.kind)===S;return r.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[r.jsx(rg,{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)??$l[S]}),T!=null&&T.subtitle?r.jsx("div",{className:"text-xs text-muted-foreground",children:T.subtitle}):null]}),A?r.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:js(A)}),r.jsx("span",{className:`text-[10px] uppercase tracking-wide ${R?"text-primary":"text-muted-foreground"}`,children:R?"custom":"default"})]}):r.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>C(S),children:A?"Rebind":"Bind"}),R?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void k(S),"aria-label":`Restore default ${$l[S]} binding`,children:[r.jsx(rx,{className:"h-3 w-3"}),"Restore default"]}):null]}),P?r.jsx("div",{className:"mt-2 w-full rounded-md border border-primary/40 bg-primary/5 px-3 py-3 text-center outline-none",tabIndex:0,autoFocus:!0,onKeyDown:j,onBlur:()=>{(c==null?void 0:c.kind)===S&&!c.saving&&u(null)},children:c!=null&&c.combo?r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:js(c.combo)}),($=c.conflict)!=null&&$.description?r.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",c.conflict.description]}):(I=c.conflict)!=null&&I.kind?r.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',$l[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 ZU={kanban:"Kanban",list:"List",table:"Table"},e7={comfortable:"Comfortable",compact:"Compact"},t7={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},n7={asc:"Ascending",desc:"Descending"};function r7(){const e=l8(),t=e.global,[n,s]=p.useState(!1),[o,i]=p.useState(null);function c(m,h){i({type:m,message:h}),setTimeout(()=>i(null),2e3)}async function u(m,h){if(t[m]!==h){s(!0);try{await lE({[m]:h}),c("success","Saved")}catch(g){c("error",g instanceof Error?g.message:"Failed to save")}finally{s(!1)}}}async function f(){if(e.custom){s(!0);try{await c8(),c("success","Reset to defaults")}catch(m){c("error",m instanceof Error?m.message:"Failed to reset")}finally{s(!1)}}}return r.jsxs(He,{title:"View defaults",description:"Defaults for the assignments board, list, and table views. Per-project overrides are saved automatically as you use them.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:f,disabled:n,children:[r.jsx(Bs,{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:Lx.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:ZU[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:G4.map(m=>r.jsx("button",{type:"button",onClick:()=>u("density",m),disabled:n,"aria-pressed":t.density===m,className:`px-3 py-1 text-xs ${t.density===m?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:e7[m]},m))})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),r.jsx("dd",{className:"mt-1.5",children:r.jsx("select",{value:t.sortField,onChange:m=>u("sortField",m.target.value),disabled:n,className:"editor-input max-w-[220px]",children:O1.map(m=>r.jsx("option",{value:m,children:t7[m]??m},m))})})]}),r.jsxs("div",{children:[r.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),r.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:q4.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:n7[m]},m))})]})]})]})}function s7({value:e,onChange:t,knownSlugs:n,rows:s=2,placeholder:o,className:i,wrapperClassName:c,singleLine:u,"aria-label":f}){const[m,h]=p.useState(0),[g,y]=p.useState(0),[b,C]=p.useState(!1),j=p.useRef(null),v=CE(e,m),k=v?EE(v.partial,n):[],E=!b&&k.length>0,S=Math.min(g,Math.max(0,k.length-1)),T=I=>u?I.replace(/[\r\n]+/g," "):I;function A(I){t(T(I.target.value)),h(I.target.selectionStart??I.target.value.length),y(0),C(!1)}function R(I){h(I.currentTarget.selectionStart??e.length)}function P(I){if(!v||!I)return;const M=TE(e,v,I);t(T(M.text)),h(M.caret),y(0),C(!0),requestAnimationFrame(()=>{const D=j.current;D&&(D.focus(),D.setSelectionRange(M.caret,M.caret))})}function $(I){E&&(I.key==="ArrowDown"?(I.preventDefault(),y(M=>Math.min(M+1,k.length-1))):I.key==="ArrowUp"?(I.preventDefault(),y(M=>Math.max(M-1,0))):I.key==="Enter"||I.key==="Tab"?(I.preventDefault(),P(k[S])):I.key==="Escape"&&(I.preventDefault(),C(!0)))}return r.jsxs("div",{className:we("relative",c),children:[r.jsx("textarea",{ref:j,value:e,rows:s,placeholder:o,"aria-label":f,onChange:A,onKeyDown:$,onKeyUp:R,onClick:R,className:i}),E&&r.jsx("ul",{role:"listbox",className:"absolute left-0 right-0 top-full z-30 mt-1 max-h-48 overflow-auto rounded-md border border-border/70 bg-background py-1 shadow-lg",children:k.map((I,M)=>r.jsx("li",{children:r.jsxs("button",{type:"button",role:"option","aria-selected":M===S,onMouseDown:D=>{D.preventDefault(),P(I)},className:we("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",M===S&&"bg-accent"),children:[r.jsx("span",{className:"text-muted-foreground",children:"@"}),r.jsx("span",{className:"truncate",children:I})]})},I))})]})}const o7={first:"first",last:"last",none:"none"};function zE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function Bl(e){return e.map(t=>({rowKey:zE(),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 a7(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 i7(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 l7(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 c7(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function u7(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 d7({row:e,index:t,canRemove:n,playbooks:s,onPatch:o,onSetDefault:i,onRemove:c}){const{attributes:u,listeners:f,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=_f({id:e.rowKey}),C={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};function j(T){const A={label:T};if(e.autoSlugFromLabel){const R=wr(T);R&&E8.test(R)?A.id=R:A.id=`agent-${t+1}`}o(A)}function v(T){o({id:T,autoSlugFromLabel:!1})}const k=T=>e.fieldErrors[T]?"border-error-foreground/60":"",E=p.useMemo(()=>s.map(T=>T.slug),[s]),S=p.useMemo(()=>RE(e.launchPrompt,E),[e.launchPrompt,E]);return r.jsxs("div",{ref:m,style:C,className:`surface-panel space-y-2 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{ref:h,...u,...f,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(Li,{className:"h-4 w-4"})}),r.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[r.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?r.jsx("input",{type:"text",value:e.id,onChange:T=>v(T.target.value),className:`editor-input w-32 font-mono text-xs ${k("id")}`,"aria-label":"Agent id"}):r.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),r.jsx("button",{type:"button",onClick:c,disabled:!n,"aria-label":"Remove agent",className:"rounded p-1 text-muted-foreground/60 transition hover:bg-foreground/[0.04] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&r.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),r.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),r.jsx("input",{type:"text",value:e.label,onChange:T=>j(T.target.value),className:`editor-input mt-0.5 w-full ${k("label")}`}),e.fieldErrors.label&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),r.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:T=>o({command:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("command")}`}),e.fieldErrors.command&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),r.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:T=>o({argsText:T.target.value}),className:`editor-input mt-0.5 w-full font-mono ${k("args")}`}),e.fieldErrors.args&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),r.jsx("select",{value:e.promptArgPosition,onChange:T=>o({promptArgPosition:T.target.value}),className:`editor-input mt-0.5 w-full ${k("promptArgPosition")}`,children:wE.map(T=>r.jsx("option",{value:T,children:o7[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(s7,{value:e.launchPrompt,onChange:T=>o({launchPrompt:T}),knownSlugs:E,singleLine:!0,rows:5,placeholder:"@assignment Run @<playbook> end-to-end. (optional)",wrapperClassName:"mt-0.5",className:`editor-input w-full resize-y font-mono leading-relaxed min-h-[6rem] ${k("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&r.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),S.length>0&&!e.fieldErrors.launchPrompt&&r.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:S.map(T=>r.jsx("li",{children:T},T))})]}),r.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:T=>o({resolveFromShellAliases:T.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",r.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function f7(){const e=SE(),t=lx(),n=p.useMemo(()=>{var $;return((($=t.data)==null?void 0:$.playbooks)??[]).filter(I=>I.enabled).map(I=>({slug:I.slug,name:I.name}))},[t.data]),[s,o]=p.useState(()=>Bl(e.agents)),[i,c]=p.useState(()=>Bl(e.agents)),[u,f]=p.useState(!1),[m,h]=p.useState(null),[g,y]=p.useState(null);p.useEffect(()=>{const $=Bl(e.agents);o($),c($),h(null)},[e.agents]);const b=p.useMemo(()=>!u7(s,i),[s,i]),C=Pf(wo(Bi,{activationConstraint:{distance:8}}),wo(zi));function j($,I){y({type:$,message:I}),setTimeout(()=>y(null),2500)}function v($,I){o(M=>M.map(D=>D.rowKey===$?{...D,...I,fieldErrors:p7(D.fieldErrors,I)}:D))}function k($){o(I=>I.map(M=>({...M,default:M.rowKey===$})))}function E(){o($=>{const I=new Set($.map(U=>U.id)),M="new-agent";let D=M,H=1;for(;I.has(D);)H+=1,D=`${M}-${H}`;const K=H===1?"New Agent":`New Agent ${H}`,_={rowKey:zE(),id:D,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:K,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...$,_]})}function S($){o(I=>I.filter(M=>M.rowKey!==$))}async function T(){f(!0),h(null);try{const $=i7(s),I=a7($),M=await P8(I),D=Bl(M.agents);o(D),c(D),j("success","Agents saved")}catch($){if($ instanceof jE)h($.message),o(I=>l7(c7(I),$.fieldErrors)),j("error",$.message);else{const I=$ instanceof Error?$.message:"Failed to save";h(I),j("error",I)}}finally{f(!1)}}function A(){o(i),h(null)}async function R(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){f(!0),h(null);try{const $=await A8(),I=Bl($.agents);o(I),c(I),j("success","Reset to defaults")}catch($){const I=$ instanceof Error?$.message:"Failed to reset";h(I),j("error",I)}finally{f(!1)}}}function P($){const{active:I,over:M}=$;!M||I.id===M.id||o(D=>{const H=D.findIndex(_=>_.rowKey===I.id),K=D.findIndex(_=>_.rowKey===M.id);return H===-1||K===-1?D:Ui(D,H,K)})}return r.jsxs(He,{title:"Agents",description:"Configure which agents the dashboard and 'Open in agent' actions can launch. The default agent is used when no other one is specified.",actions:e.custom?r.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:R,disabled:u,children:[r.jsx(Bs,{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(Xg,{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(Of,{sensors:C,collisionDetection:Af,onDragEnd:P,children:r.jsx(If,{items:s.map($=>$.rowKey),strategy:$x,children:r.jsx("div",{className:"space-y-2",children:s.map(($,I)=>r.jsx(d7,{row:$,index:I,canRemove:s.length>1,playbooks:n,onPatch:M=>v($.rowKey,M),onSetDefault:()=>k($.rowKey),onRemove:()=>S($.rowKey)},$.rowKey))})})}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("button",{type:"button",onClick:E,disabled:u,className:"shell-action text-xs",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add agent"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:A,disabled:!b||u,className:"shell-action text-xs",children:"Discard"}),r.jsxs("button",{type:"button",onClick:T,disabled:!b||u,className:"shell-action text-xs",children:[r.jsx(bf,{className:"h-3 w-3"}),"Save"]})]})]})]})}function p7(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 BE=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],lf={terminal:"terminal-app",custom:!1};let fi=null,ai=null,cf=0;const Fg=new Set;function UE(e){fi=e;for(const t of Fg)t(e)}function $y(e){if(!e||typeof e!="object")return lf;const t=e;return{terminal:typeof t.terminal=="string"&&BE.includes(t.terminal)?t.terminal:lf.terminal,custom:t.custom===!0}}function m7(){if(fi)return Promise.resolve(fi);if(ai)return ai;const e=++cf;return ai=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{ai=null;const n=$y(t);return e!==cf?fi??n:(fi=n,n)}).catch(()=>(ai=null,lf)),ai}function h7(){const[e,t]=p.useState(()=>fi??lf);return p.useEffect(()=>{let n=!1;return m7().then(s=>{n||t(s)}),Fg.add(t),()=>{n=!0,Fg.delete(t)}},[]),e}async function g7(e){++cf;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=$y(await t.json());return UE(n),n}async function x7(){++cf;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=$y(await e.json());return UE(t),t}const pd={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function y7(){const{terminal:e,custom:t}=h7(),[n,s]=p.useState(!1),[o,i]=p.useState(null);function c(m){i(m),setTimeout(()=>i(null),2500)}async function u(m){if(!(m===e&&t)){s(!0);try{await g7(m),c({type:"success",message:`Terminal set to ${pd[m]}.`})}catch(h){c({type:"error",message:h instanceof Error?h.message:"Save failed."})}finally{s(!1)}}}async function f(){s(!0);try{const m=await x7();c({type:"success",message:`Reset to OS default (${pd[m.terminal]}).`})}catch(m){c({type:"error",message:m instanceof Error?m.message:"Reset failed."})}finally{s(!1)}}return r.jsxs(He,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${pd[e]}) when unset.`,actions:t?r.jsxs("button",{className:"shell-action text-xs",onClick:f,disabled:n,type:"button",children:[r.jsx(Bs,{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:BE.map(m=>r.jsx("option",{value:m,children:pd[m]},m))})]})]})}function Ul(e){return e===zd?"Ungrouped":e}function b7(){const{data:e,loading:t,error:n,refetch:s}=Sc(),{hidden:o,custom:i,loading:c,error:u,reload:f}=US(),[m,h]=p.useState(!1),[g,y]=p.useState(null);function b(k){y(k),setTimeout(()=>y(null),2500)}const C=e?[...e.workspaces,...e.hasUngrouped?[zd]:[]]:[];async function j(k,E){const S=E?o.filter(T=>T!==k):[...o,k];h(!0);try{await $$(S),b({type:"success",message:E?`Showing "${Ul(k)}" in the left nav.`:`Hiding "${Ul(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 L$(),b({type:"success",message:"All workspaces shown in the left nav."})}catch(k){b({type:"error",message:k instanceof Error?k.message:"Reset failed."})}finally{h(!1)}}return r.jsxs(He,{title:"Workspace visibility",description:"Choose which workspaces appear in the left nav. Hidden workspaces stay fully reachable by direct URL — this only controls the sidebar.",actions:i?r.jsxs("button",{className:"shell-action text-xs",onClick:v,disabled:m,type:"button",children:[r.jsx(Bs,{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&&f()},children:[r.jsx(Bs,{className:"h-3 w-3"}),"Retry"]})]}):C.length===0?r.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):r.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:C.map(k=>{const E=!P$(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:Ul(k),children:[Ul(k),k===zd&&r.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`Show "${Ul(k)}" in the left nav`,onClick:()=>j(k,!E),disabled:m,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-60 ${E?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${E?"translate-x-4":"translate-x-0"}`})})]},k)})})]})}function v7(e){return jg(e)}function I0(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function w7(e){const t=new Map;for(let n=0;n<e.length;n++){const s=I0(jg(e.slice(0,n))),o=I0(jg(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 j7=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],k7=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function S7(){return{name:"",type:"bool",binds:null}}function N7({rows:e,onChange:t,saving:n}){const s=w7(e),o=p.useCallback(()=>{t([...e,S7()])},[e,t]),i=p.useCallback((u,f,m)=>{t(e.map((h,g)=>g===u?{...h,[f]:m}:h))},[e,t]),c=p.useCallback(u=>{t(e.filter((f,m)=>m!==u))},[e,t]);return r.jsxs(He,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",children:[r.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Names must match ",r.jsx("code",{className:"font-mono",children:"^[a-z][a-zA-Z0-9]*"})," — start with a lowercase letter, then letters or numbers only (no spaces, hyphens, or underscores)."]}),r.jsxs("div",{className:"space-y-2",children:[e.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),e.map((u,f)=>{const m=s.get(f),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(f,"name",g.target.value),placeholder:"factName",disabled:n,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm font-mono focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),r.jsx("select",{value:u.type,onChange:g=>{const y=g.target.value;t(e.map((b,C)=>C===f?{...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:j7.map(g=>r.jsx("option",{value:g.value,children:g.label},g.value))}),h?r.jsx("select",{value:u.binds??"none",onChange:g=>i(f,"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:k7.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(Ld,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),r.jsx(cr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:m})]}),r.jsx("button",{type:"button",onClick:()=>c(f),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]}),m&&r.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:m})]},f)})]}),r.jsxs("button",{type:"button",onClick:o,disabled:n,className:"mt-2 shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Lt,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function VE(e,t=qf){var s,o;if(e==="*")return null;const n=Ff(e);if(!n.ast)return((s=n.errors[0])==null?void 0:s.message)??"unparseable condition";try{return Ql(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 Qh(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 C7(e){if(e.kind==="atom"){const t=Qh(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=Qh(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 f=Qh(u);if(!f)return null;c.push(f)}o.push({join:s,comparisons:c})}else return null;return{outerJoin:t,groups:o}}return null}function _0(e){const t=e.trim();if(t===""||t==="*")return null;const n=Ff(t);return n.ast?C7(n.ast):null}const E7=/^[A-Za-z_][A-Za-z0-9_-]*$/;function T7(e){return e===""||!E7.test(e)||/^(and|or|not)$/i.test(e)}function R7(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function P7(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:T7(e.value)?R7(e.value):e.value}function A7(e){const t=P7(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function D7(e){return e.groups.map(n=>{const s=n.comparisons.map(A7).join(` ${n.join} `);return n.comparisons.length>1?`(${s})`:s}).join(` ${e.outerJoin} `)}function $7(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":VE(e,t)}function L7(e){return L_($_(e))}function O7(e){const t=Jx(e),n=[];for(const s of $N(e)){const o=t[s.toLowerCase()];o&&n.push({name:s,kind:o.kind})}return n}function HE(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function zg(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function Vl(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:zg(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:HE(t.kind)}:{field:"",op:":",value:""}]}]}}function WE({value:e,onChange:t,fieldOptions:n,registry:s,disabled:o}){const i=p.useMemo(()=>_0(e),[e]),c=e.trim()===""||i!==null,[u,f]=p.useState(c?"builder":"raw"),[m,h]=p.useState(()=>i??Vl(n)),g=p.useRef(e);p.useEffect(()=>{if(e===g.current)return;const R=_0(e);R&&h(R),!(e.trim()===""||R)&&u==="builder"&&f("raw"),g.current=e},[e]);const y=$7(e,s);function b(R){g.current=R,t(R)}function C(R){h(R),b(D7(R))}function j(R){C({outerJoin:R,groups:m.groups.map(P=>({...P,join:R==="AND"?"OR":"AND"}))})}function v(R,P,$){const I=m.groups.map((M,D)=>D===R?{...M,comparisons:M.comparisons.map((H,K)=>K===P?{...H,...$}:H)}:M);C({...m,groups:I})}function k(R){const P=Vl(n).groups[0].comparisons[0],$=m.groups.map((I,M)=>M===R?{...I,comparisons:[...I.comparisons,{...P}]}:I);C({...m,groups:$})}function E(R,P){let $=m.groups.map((I,M)=>M===R?{...I,comparisons:I.comparisons.filter((D,H)=>H!==P)}:I);$=$.filter(I=>I.comparisons.length>0),$.length===0&&($=Vl(n).groups),C({...m,groups:$})}function S(){const R=m.outerJoin==="AND"?"OR":"AND";C({...m,groups:[...m.groups,{join:R,comparisons:[Vl(n).groups[0].comparisons[0]]}]})}function T(){if(u==="builder"){f("raw");return}c&&(h(i??Vl(n)),f("builder"))}const A="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";return r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),r.jsxs("button",{type:"button",onClick:T,disabled:o||u==="raw"&&!c,title:u==="raw"&&!c?"Condition too complex for the builder — edit as raw AQL":u==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[u==="builder"?r.jsx(PP,{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:`${A} w-full font-mono`}):r.jsxs("div",{className:"space-y-2",children:[m.groups.map((R,P)=>r.jsxs("div",{children:[P>0&&r.jsxs("div",{className:"my-1 flex items-center gap-2",children:[r.jsx("span",{className:"h-px flex-1 bg-border/60"}),r.jsx("button",{type:"button",onClick:()=>j(m.outerJoin==="AND"?"OR":"AND"),disabled:o,className:"shell-action text-[10px] uppercase tracking-wide",children:m.outerJoin}),r.jsx("span",{className:"h-px flex-1 bg-border/60"})]}),r.jsxs("div",{className:"rounded-md border border-border/50 bg-background/60 p-2 space-y-1.5",children:[R.comparisons.map(($,I)=>{const M=n.find(K=>K.name===$.field),D=(M==null?void 0:M.kind)??"string",H=zg(D);return r.jsxs("div",{className:"flex items-center gap-1.5",children:[I>0&&r.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:R.join}),r.jsxs("select",{value:$.field,onChange:K=>{const _=n.find(Z=>Z.name===K.target.value),U=(_==null?void 0:_.kind)??"string",q=zg(U);v(P,I,{field:K.target.value,op:q.includes($.op)?$.op:q[0],value:U==="bool"?"true":$.value,valueType:HE(U)})},disabled:o,className:`${A} font-mono`,children:[n.length===0&&r.jsx("option",{value:"",children:"(no fields)"}),!n.some(K=>K.name===$.field)&&$.field!==""&&r.jsx("option",{value:$.field,children:$.field}),n.map(K=>r.jsx("option",{value:K.name,children:K.name},K.name))]}),r.jsx("select",{value:$.op,onChange:K=>v(P,I,{op:K.target.value}),disabled:o,className:`${A} font-mono`,children:H.map(K=>r.jsx("option",{value:K,children:K},K))}),D==="bool"?r.jsxs("select",{value:$.value||"true",onChange:K=>v(P,I,{value:K.target.value}),disabled:o,className:`${A} font-mono`,children:[r.jsx("option",{value:"true",children:"true"}),r.jsx("option",{value:"false",children:"false"})]}):r.jsx("input",{type:"text",value:$.value,onChange:K=>v(P,I,{value:K.target.value}),disabled:o,placeholder:"value",className:`${A} w-24 font-mono`}),r.jsx("button",{type:"button",onClick:()=>E(P,I),disabled:o,className:"ml-auto inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove condition",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]},I)}),r.jsxs("button",{type:"button",onClick:()=>k(P),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),R.join," condition"]})]})]},P)),r.jsxs("button",{type:"button",onClick:S,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),m.outerJoin," group"]})]}),r.jsx("datalist",{id:"aql-field-names",children:n.map(R=>r.jsx("option",{value:R.name},R.name))}),r.jsx("p",{className:"font-mono text-[11px] text-muted-foreground truncate",title:e,children:e.trim()===""?r.jsx("span",{className:"italic",children:"empty condition"}):e}),y&&r.jsx("p",{className:"text-xs text-error-foreground",children:y})]})}let M0=0;function uf(){return M0+=1,`dr_${M0}_${Math.random().toString(36).slice(2,8)}`}function Xh(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:uf(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:uf(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function Bg(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 I7(e){return e.findIndex(t=>t.when.trim()==="*")}function KE(e,t,n){return P_(e,{statuses:t},s=>VE(s,n))}const F0=["active","blocked","parked"];function _7({value:e,deriveCustom:t,statuses:n,acceptedFacts:s,onChange:o,onReset:i,disabled:c}){const u=p.useMemo(()=>Jx(s),[s]),f=p.useMemo(()=>O7(s),[s]),m=Pf(wo(Bi,{activationConstraint:{distance:8}}),wo(zi,{coordinateGetter:$1})),h=p.useMemo(()=>{try{return KE(Bg(e),n,u)}catch{return["derive rules are malformed"]}},[e,n,u]),g=I7(e.phaseLadder),y=g>=0?e.phaseLadder[g]:null,b=e.phaseLadder.filter((I,M)=>M!==g);function C(I,M){o({...e,phaseLadder:[...I?[I]:[],...M]})}function j(I,M){const D=e.phaseLadder.map(H=>H.rowKey===I?{...H,...M}:H);o({...e,phaseLadder:D})}function v(){var M;const I={rowKey:uf(),phase:((M=n[0])==null?void 0:M.id)??"",when:"",next:""};C(y,[...b,I])}function k(I){o({...e,phaseLadder:e.phaseLadder.filter(M=>M.rowKey!==I)})}function E(I){const{active:M,over:D}=I;if(!D||M.id===D.id)return;const H=b.findIndex(_=>_.rowKey===M.id),K=b.findIndex(_=>_.rowKey===D.id);H===-1||K===-1||C(y,Ui(b,H,K))}function S(I,M){o({...e,disposition:e.disposition.map(D=>D.rowKey===I?{...D,...M}:D)})}function T(){const I={rowKey:uf(),when:"",is:"active"},M=e.disposition.findIndex(H=>H.when===null),D=[...e.disposition];M>=0?D.splice(M,0,I):D.push(I),o({...e,disposition:D})}function A(I){o({...e,disposition:e.disposition.filter(M=>M.rowKey!==I)})}function R(I,M){o({...e,headline:{...e.headline,[I]:M}})}const P="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";function $(I,M,D){return r.jsxs("select",{value:I,onChange:H=>M(H.target.value),disabled:c,"aria-label":D,className:`${P} font-mono`,children:[!n.some(H=>H.id===I)&&I!==""&&r.jsx("option",{value:I,children:I}),n.map(H=>r.jsxs("option",{value:H.id,children:[H.label," (",H.id,")"]},H.id))]})}return r.jsxs(He,{title:"Derive Rules",description:"The phase ladder, disposition rules, and headline projection that map facts to a status. Highest matching rung wins — drag to reorder priority.",actions:t?r.jsxs("button",{type:"button",className:"shell-action text-xs inline-flex items-center gap-1",onClick:i,disabled:c,children:[r.jsx(Bs,{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((I,M)=>r.jsx("li",{children:I},M))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Phase ladder"}),y&&r.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2 opacity-90",children:[r.jsx("span",{className:"mt-1 text-muted-foreground/40",children:r.jsx(Li,{className:"h-4 w-4 opacity-30"})}),r.jsxs("div",{className:"min-w-[10rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase (catch-all, lowest priority)"}),$(y.phase,I=>j(y.rowKey,{phase:I}),"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:I=>j(y.rowKey,{next:I.target.value}),disabled:c,className:`${P} w-full`})]})]}),r.jsx(Of,{sensors:m,collisionDetection:Af,onDragEnd:E,children:r.jsx(If,{items:b.map(I=>I.rowKey),strategy:$x,children:r.jsx("div",{className:"space-y-2",children:b.map(I=>r.jsx(M7,{rung:I,disabled:c,statusSelect:$,fieldOptions:f,registry:u,onUpdate:M=>j(I.rowKey,M),onRemove:()=>k(I.rowKey)},I.rowKey))})})}),r.jsxs("button",{type:"button",onClick:v,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add rung"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),r.jsx("div",{className:"space-y-2",children:e.disposition.map(I=>I.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:I.is,onChange:M=>S(I.rowKey,{is:M.target.value}),disabled:c,className:`${P} font-mono`,children:F0.map(M=>r.jsx("option",{value:M,children:M},M))})]},I.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(WE,{value:I.when,onChange:M=>S(I.rowKey,{when:M}),fieldOptions:f,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:I.is,onChange:M=>S(I.rowKey,{is:M.target.value}),disabled:c,className:`${P} font-mono`,children:F0.map(M=>r.jsx("option",{value:M,children:M},M))}),r.jsx("button",{type:"button",onClick:()=>A(I.rowKey),disabled:c,className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove disposition rule",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})]},I.rowKey))}),r.jsxs("button",{type:"button",onClick:T,disabled:c,className:"shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add disposition rule"]})]}),r.jsxs("div",{className:"mt-5 space-y-2",children:[r.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Headline projection"}),r.jsxs("div",{className:"surface-panel grid grid-cols-1 gap-3 px-3 py-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When parked, show"}),$(e.headline.parked,I=>R("parked",I),"Parked headline status")]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),$(e.headline.blocked,I=>R("blocked",I),"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 M7({rung:e,disabled:t,statusSelect:n,fieldOptions:s,registry:o,onUpdate:i,onRemove:c}){const{attributes:u,listeners:f,setNodeRef:m,setActivatorNodeRef:h,transform:g,transition:y,isDragging:b}=_f({id:e.rowKey}),C={transform:rs.Transform.toString(g),transition:y,zIndex:b?50:void 0,position:b?"relative":void 0};return r.jsxs("div",{ref:m,style:C,className:`surface-panel flex flex-wrap items-start gap-3 px-3 py-2 ${b?"opacity-60 shadow-lg":""}`,children:[r.jsx("button",{ref:h,...u,...f,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(Li,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-[10rem] space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase"}),n(e.phase,j=>i({phase:j}),"Rung phase")]}),r.jsx("div",{className:"min-w-[14rem] flex-1",children:r.jsx(WE,{value:e.when,onChange:j=>i({when:j}),fieldOptions:s,registry:o,disabled:t})}),r.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),r.jsx("input",{type:"text",value:e.next,onChange:j=>i({next:j.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),r.jsx("button",{type:"button",onClick:c,disabled:t,className:"mt-5 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove rung",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})}const F7=new Map([["pending:start","in_progress"],["pending:block","blocked"],["draft:shape","ready_for_planning"],["draft:start","in_progress"],["ready_for_planning:plan-ready","ready_to_implement"],["ready_for_planning:start","in_progress"],["ready_to_implement:implement","in_progress"],["in_progress:block","blocked"],["in_progress:review","review"],["in_progress:complete","completed"],["in_progress:fail","failed"],["blocked:unblock","in_progress"],["review:start","in_progress"],["review:complete","completed"],["review:fail","failed"],["completed:reopen","in_progress"],["failed:reopen","in_progress"]]);let z0=0;function qE(){return z0+=1,`tr_${z0}_${Math.random().toString(36).slice(2,8)}`}function z7(e){return{rowKey:qE(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function B0(e){return e.map(z7)}function B7(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 U7(e){return e.map(B7)}function GE(){const e=[];for(const[t,n]of F7){const s=t.indexOf(":");e.push({from:t.slice(0,s),command:t.slice(s+1),to:n})}return e}function YE(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function U0(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 JE(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 V7({value:e,customizing:t,statuses:n,knownCommands:s,onChange:o,onCustomize:i,disabled:c}){const u=p.useMemo(()=>new Set(n.map(S=>S.id)),[n]),f=p.useMemo(()=>{const S=new Map(n.map(T=>[T.id,T.label]));return T=>S.get(T)??T},[n]),[m,h]=p.useState(""),g="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";if(!t&&e.length===0){const S=YE(GE(),u),T=U0(S);return r.jsx(He,{title:"Transitions",description:"Which commands move an assignment between statuses. Showing the built-in defaults.",actions:r.jsx("button",{type:"button",onClick:i,disabled:c,className:"shell-action text-xs",children:"Customize defaults"}),children:T.length===0?r.jsx("p",{className:"text-sm italic text-muted-foreground",children:"No built-in transitions apply to the current statuses."}):r.jsx("div",{className:"space-y-3",children:T.map(A=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsx("h4",{className:"mb-1 text-xs font-semibold text-foreground",children:f(A.from)}),r.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:A.rows.map((R,P)=>r.jsxs("li",{children:[R.command," → ",f(R.to)," ",r.jsxs("span",{className:"opacity-60",children:["(",R.to,")"]})]},P))})]},A.from))})})}const y=JE(e,u),b=U0(e),C=n.filter(S=>!b.some(T=>T.from===S.id));function j(S,T){o(e.map(A=>A.rowKey===S?{...A,...T}:A))}function v(S){o(e.filter(T=>T.rowKey!==S))}function k(S){var A;const T={rowKey:qE(),from:S,command:s[0]??"",to:((A=n[0])==null?void 0:A.id)??"",label:"",description:"",requiresReason:!1};o([...e,T])}function E(){m&&(k(m),h(""))}return r.jsxs(He,{title:"Transitions",description:"Which commands move an assignment between statuses, grouped by the from-status.",children:[y.length>0&&r.jsxs("div",{className:"mb-3 rounded-md border border-error-foreground/30 bg-error/10 px-3 py-2 text-xs text-error-foreground",children:[r.jsx("p",{className:"font-medium",children:"These transitions won't save until fixed:"}),r.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:y.map((S,T)=>r.jsx("li",{children:S},T))})]}),r.jsx("div",{className:"space-y-3",children:b.map(S=>r.jsxs("div",{className:"surface-panel px-3 py-2",children:[r.jsxs("h4",{className:"mb-2 text-xs font-semibold text-foreground",children:[f(S.from)," ",r.jsxs("span",{className:"font-mono text-muted-foreground",children:["(",S.from,")"]})]}),r.jsx("div",{className:"space-y-2",children:S.rows.map(T=>r.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.jsx("input",{type:"text",list:"transition-command-names",value:T.command,onChange:A=>j(T.rowKey,{command:A.target.value}),disabled:c,placeholder:"command",className:`${g} w-28 font-mono`}),r.jsx("span",{className:"text-muted-foreground",children:"→"}),r.jsxs("select",{value:T.to,onChange:A=>j(T.rowKey,{to:A.target.value}),disabled:c,"aria-label":"Target status",className:`${g} font-mono`,children:[!u.has(T.to)&&T.to!==""&&r.jsx("option",{value:T.to,children:T.to}),n.map(A=>r.jsxs("option",{value:A.id,children:[A.label," (",A.id,")"]},A.id))]}),r.jsx("input",{type:"text",value:T.label,onChange:A=>j(T.rowKey,{label:A.target.value}),disabled:c,placeholder:"label (optional)",className:`${g} w-32`}),r.jsx("input",{type:"text",value:T.description,onChange:A=>j(T.rowKey,{description:A.target.value}),disabled:c,placeholder:"description (optional)",className:`${g} w-40`}),r.jsxs("label",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[r.jsx("button",{type:"button",role:"switch","aria-checked":T.requiresReason,"aria-label":"Requires reason",onClick:()=>j(T.rowKey,{requiresReason:!T.requiresReason}),disabled:c,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${T.requiresReason?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${T.requiresReason?"translate-x-4":"translate-x-0"}`})}),"needs reason"]}),r.jsx("button",{type:"button",onClick:()=>v(T.rowKey),disabled:c,className:"ml-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Remove transition",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]},T.rowKey))}),r.jsxs("button",{type:"button",onClick:()=>k(S.from),disabled:c,className:"mt-2 shell-action text-xs inline-flex items-center gap-1",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add transition"]})]},S.from))}),C.length>0&&r.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r.jsxs("select",{value:m,onChange:S=>h(S.target.value),disabled:c,"aria-label":"Add rules for status",className:`${g} font-mono`,children:[r.jsx("option",{value:"",children:"Add rules for status…"}),C.map(S=>r.jsxs("option",{value:S.id,children:[S.label," (",S.id,")"]},S.id))]}),r.jsxs("button",{type:"button",onClick:E,disabled:c||!m,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add status rules"]})]}),r.jsx("datalist",{id:"transition-command-names",children:s.map(S=>r.jsx("option",{value:S},S))})]})}function QE(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function H7(e){const t=e.statuses.map(n=>({rowKey:QE(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return QU(t,e.order)}function W7({row:e,isSaved:t,onUpdate:n,onRemove:s}){const{attributes:o,listeners:i,setNodeRef:c,setActivatorNodeRef:u,transform:f,transition:m,isDragging:h}=_f({id:e.rowKey}),g={transform:rs.Transform.toString(f),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(Li,{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(cr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):r.jsx("input",{type:"text",value:e.id,onChange:y=>n("id",y.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[8rem] flex-1",children:r.jsx("input",{type:"text",value:e.label,onChange:y=>n("label",y.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),r.jsx("div",{className:"min-w-[10rem] flex-1",children:r.jsx("input",{type:"text",value:e.description,onChange:y=>n("description",y.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),r.jsx(FU,{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(cr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),r.jsx("button",{type:"button",role:"switch","aria-checked":e.terminal,"aria-label":`Done state for ${e.label||e.id}`,onClick:()=>n("terminal",!e.terminal),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background ${e.terminal?"bg-primary":"bg-muted"}`,children:r.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${e.terminal?"translate-x-4":"translate-x-0"}`})})]}),r.jsx("button",{type:"button",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",onClick:s,title:"Remove status","aria-label":`Remove status ${e.id}`,children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]})}function K7(){var _t;const[e,t]=p.useState(!0),[n,s]=p.useState(null),[o,i]=p.useState(!1),[c,u]=p.useState([]),[f,m]=p.useState(!1),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(new Set),[v,k]=p.useState(new Map),[E,S]=p.useState({open:!1}),[T,A]=p.useState([]),[R,P]=p.useState([]),[$,I]=p.useState({open:!1}),[M,D]=p.useState(()=>Xh(Cd)),[H,K]=p.useState(!1),[_,U]=p.useState(!1),[q,Z]=p.useState(!1),[F,G]=p.useState([]),[L,V]=p.useState(!1),[re,B]=p.useState([]),ue=Pf(wo(Bi,{activationConstraint:{distance:8}}),wo(zi,{coordinateGetter:$1})),{preset:ge,setPreset:se,resetPreset:ye}=ax(),[Se,Ee]=p.useState(!1),[Ae,Ke]=p.useState(null);async function ct(pe){if(!(pe===ge||Se)){Ee(!0),Ke(null);try{await se(pe),Ke({type:"success",message:"Theme updated"}),setTimeout(()=>Ke(null),2e3)}catch(te){Ke({type:"error",message:te instanceof Error?te.message:"Failed to save theme"})}finally{Ee(!1)}}}async function et(){Ee(!0),Ke(null);try{await ye(),Ke({type:"success",message:"Theme reset to default"}),setTimeout(()=>Ke(null),2e3)}catch(pe){Ke({type:"error",message:pe instanceof Error?pe.message:"Failed to reset theme"})}finally{Ee(!1)}}const ot=p.useCallback(pe=>{const te=H7(pe);u(te),i(pe.custom),j(new Set(te.map(xe=>xe.id))),k(new Map),A(pe.rawFacts??[]),P([]),D(Xh(pe.derive??Cd)),K(pe.deriveCustom??!1),U(!1),Z(!1),G(B0(pe.transitions??[])),V(pe.transitionsCustom??!1),B(pe.knownCommands??[]),b(!1)},[]),X=p.useCallback(async()=>{try{const pe=await fetch("/api/config/statuses");if(!pe.ok)throw new Error(`HTTP ${pe.status}`);const te=await pe.json();ot(te),s(null)}catch(pe){s(pe instanceof Error?pe.message:"Failed to load config")}finally{t(!1)}},[ot]);p.useEffect(()=>{X()},[X]);function Me(){setTimeout(()=>g(null),3e3)}const Ce=p.useMemo(()=>c.map(pe=>({id:pe.id,label:pe.label})),[c]),Ie=p.useMemo(()=>new Set(c.map(pe=>pe.id)),[c]),Ye=p.useMemo(()=>L7(T),[T]),Fe=p.useMemo(()=>Jx(Ye),[Ye]),Ze=p.useMemo(()=>v7(T),[T]),Qe=p.useMemo(()=>{try{return KE(Bg(M),c,Fe)}catch{return["derive rules are malformed"]}},[M,c,Fe]),Ot=p.useMemo(()=>L?JE(F,Ie):[],[F,L,Ie]),yt=Ze.length+Qe.length+Ot.length,dt=p.useCallback(pe=>{A(pe),b(!0)},[]),le=p.useCallback(pe=>{D(pe),U(!0),Z(!1),K(!0),b(!0)},[]),Y=p.useCallback(()=>{D(Xh(Cd)),Z(!0),U(!0),K(!1),b(!0)},[]),fe=p.useCallback(pe=>{G(pe),b(!0)},[]),ne=p.useCallback(()=>{G(pe=>pe.length>0?pe:B0(YE(GE(),Ie))),V(!0),b(!0)},[Ie]);async function he(pe=R){m(!0),g(null);try{const{body:te}=HU({statuses:c,order:c.map(ve=>ve.id),pendingResolutions:v,facts:T,factRemovalAcks:pe,derive:q?null:_?Bg(M):void 0,transitions:L?U7(F):void 0}),xe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(te)});if(!xe.ok){const ve=await xe.json().catch(()=>null);if(xe.status===409&&(ve==null?void 0:ve.error)==="unresolved-fact-references"&&ve.references){I({open:!0,references:ve.references}),m(!1);return}if((ve==null?void 0:ve.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(ve.problems??[]).join("; ")}`);if((ve==null?void 0:ve.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(ve.problems??[]).join("; ")}`);if((ve==null?void 0:ve.error)==="invalid-facts")throw new Error(`Invalid facts: ${(ve.problems??[]).join("; ")}`);if(xe.status===409&&(ve==null?void 0:ve.error)==="unresolved-orphans"){const Nt=Array.isArray(ve.unresolved)?ve.unresolved.map(It=>It.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${Nt}. Click the trash icon on each row to choose remap or delete.`)}if(xe.status===409&&(ve==null?void 0:ve.error)==="concurrent-edit"){const Nt=ve.applied?` (${ve.applied.remapped} remapped, ${ve.applied.deleted} deleted before the conflict)`:"";g({type:"error",message:`Concurrent edit detected${Nt}: ${ve.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await X();return}if(xe.status===500&&(ve==null?void 0:ve.error)==="config-write-failed"&&(ve!=null&&ve.applied)){const{remapped:Nt,deleted:It}=ve.applied,Zt=ve.message?`: ${ve.message}`:"";g({type:"error",message:`Resolutions applied (${Nt} remapped, ${It} deleted) but the status config write failed${Zt}. Click Save again to retry.`}),await X();return}throw(ve==null?void 0:ve.error)==="invalid-remap-target"?new Error(`Invalid remap target (${ve.reason}): ${ve.id} → ${ve.target}.`):(ve==null?void 0:ve.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(ve.ids??[]).join(", ")}`):(ve==null?void 0:ve.error)==="stale-resolution"?new Error(`Stale resolution for id "${ve.id??"?"}".`):(ve==null?void 0:ve.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${ve.message??"unknown"}`):(ve==null?void 0:ve.error)==="remap-write-failed"||(ve==null?void 0:ve.error)==="delete-failed"||(ve==null?void 0:ve.error)==="scan-failed"?new Error(`${ve.error}: ${ve.cause??"unknown"}`):new Error((ve==null?void 0:ve.error)??`Save failed (HTTP ${xe.status})`)}const Le=await xe.json();ot(Le),uj();const tt=Le.applied?` (${Le.applied.remapped} remapped, ${Le.applied.deleted} deleted)`:"";g({type:"success",message:`Status config saved${tt}`}),Me()}catch(te){g({type:"error",message:te instanceof Error?te.message:"Save failed"})}finally{m(!1)}}async function De(){m(!0),g(null);try{const pe=await fetch("/api/config/statuses",{method:"DELETE"});if(!pe.ok)throw new Error("Reset failed");const te=await pe.json();ot(te),uj(),g({type:"success",message:"Reset to defaults"}),Me()}catch(pe){g({type:"error",message:pe instanceof Error?pe.message:"Reset failed"})}finally{m(!1)}}function ut(pe,te,xe){u(Le=>{const tt=[...Le];return tt[pe]={...tt[pe],[te]:xe},tt}),b(!0)}function ae(){const pe=`status_${c.length+1}`;u(te=>[...te,{rowKey:QE(),id:pe,label:"New Status",description:"",color:"",terminal:!1}]),b(!0)}function be(pe){u(te=>{const xe=te.filter(tt=>tt.id!==pe),Le=new Set(xe.map(tt=>tt.id));return k(tt=>O0(tt,Le)),xe}),b(!0)}async function $e(pe){const te=c[pe].id,xe=WU(te,M,F),Le=KU(te,M);if(!C.has(te)){if(xe.length===0){be(te);return}S({open:!0,affected:{id:te,count:0,truncated:!1,assignments:[]},pendingId:te,ruleReferences:xe,headlineReferences:Le});return}try{const tt=await fetch(`/api/config/statuses/affected/${encodeURIComponent(te)}`);if(!tt.ok)throw new Error(`HTTP ${tt.status}`);const ve=await tt.json();if(ve.count===0&&xe.length===0){be(te);return}S({open:!0,affected:ve,pendingId:te,ruleReferences:xe,headlineReferences:Le})}catch(tt){g({type:"error",message:`Could not check affected assignments for "${te}": ${tt instanceof Error?tt.message:String(tt)}`})}}function at(pe,te){if(!E.open)return;const{pendingId:xe,affected:Le,ruleReferences:tt}=E;if(xe!==pe.id){S({open:!1});return}if(!c.some(ve=>ve.id===xe)){g({type:"error",message:`Row for "${xe}" was already removed — modal action ignored.`}),S({open:!1});return}pe.mode==="remap"?(D(ve=>qU(ve,xe,te)),G(ve=>GU(ve,xe,te))):(D(ve=>YU(ve,xe,te)),G(ve=>JU(ve,xe))),tt.some(ve=>ve.section!=="transitions")&&(U(!0),K(!0)),u(ve=>{const Nt=ve.filter(Zt=>Zt.id!==xe),It=new Set(Nt.map(Zt=>Zt.id));return k(Zt=>{const jt=O0(Zt,It),wn=new Map(jt);return Le.count>0&&wn.set(xe,pe),wn}),Nt}),b(!0),S({open:!1})}function Be(){if(!$.open)return;const pe=$.references.map(xe=>xe.factName),te=Array.from(new Set([...R,...pe]));P(te),I({open:!1}),he(te)}function kt(){S({open:!1})}function St(pe){const{active:te,over:xe}=pe;!xe||te.id===xe.id||(u(Le=>{const tt=Le.findIndex(Nt=>Nt.rowKey===te.id),ve=Le.findIndex(Nt=>Nt.rowKey===xe.id);return tt===-1||ve===-1?Le:Ui(Le,tt,ve)}),b(!0))}return e?r.jsx(xt,{label:"Loading settings..."}):n?r.jsx(Tt,{error:n}):r.jsx(aa,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs(He,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:ge!=="default"?r.jsxs("button",{className:"shell-action text-xs",onClick:et,disabled:Se,children:[r.jsx(Bs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[Ae&&r.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${Ae.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:Ae.message}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:Ik.map(pe=>{const te=pe.slug===ge;return r.jsxs("button",{type:"button",onClick:()=>ct(pe.slug),disabled:Se,"aria-pressed":te,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${te?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.primary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.secondary}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.coral}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.teal}}),r.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:pe.swatches.amber}}),te&&r.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:r.jsx(Rr,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:pe.label}),r.jsx("div",{className:"text-xs text-muted-foreground",children:pe.description})]})]},pe.slug)})})]}),r.jsx(XU,{}),r.jsx(y7,{}),r.jsx(b7,{}),r.jsx(f7,{}),r.jsx(r7,{}),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(Xg,{className:"h-4 w-4"}),o?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),r.jsxs("button",{className:"shell-action text-xs",onClick:De,disabled:f||!o&&!y,children:[r.jsx(Bs,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),h&&r.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),r.jsx(He,{title:"Status Definitions",description:"Define the statuses assignments can have. Drag rows to set the display order used by Kanban columns, progress bars, and dropdowns.",actions:r.jsxs("button",{className:"shell-action text-xs",onClick:ae,children:[r.jsx(Lt,{className:"h-3 w-3"}),"Add Status"]}),children:r.jsx(Of,{sensors:ue,collisionDetection:Af,onDragEnd:St,children:r.jsx(If,{items:c.map(pe=>pe.rowKey),strategy:$x,children:r.jsx("div",{className:"space-y-2",children:c.map((pe,te)=>r.jsx(W7,{row:pe,isSaved:C.has(pe.id),onUpdate:(xe,Le)=>ut(te,xe,Le),onRemove:()=>$e(te)},pe.rowKey))})})})}),r.jsx(_7,{value:M,deriveCustom:H,statuses:Ce,acceptedFacts:Ye,onChange:le,onReset:Y,disabled:f}),r.jsx(V7,{value:F,customizing:L,statuses:Ce,knownCommands:re,onChange:fe,onCustomize:ne,disabled:f}),r.jsx(N7,{rows:T,onChange:dt,saving:f}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:()=>void he(),disabled:f||!y||yt>0,children:[r.jsx(bf,{className:"h-3.5 w-3.5"}),f?"Saving...":"Save Configuration"]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),X()},disabled:f,children:"Discard Changes"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:yt>0?"Fix the highlighted errors to save":"Unsaved changes"})]})]}),r.jsx(BU,{}),E.open&&r.jsx(UU,{open:E.open,affected:{...E.affected,label:((_t=c.find(pe=>pe.id===E.affected.id))==null?void 0:_t.label)??E.affected.id},remaining:c.filter(pe=>pe.id!==E.affected.id&&C.has(pe.id)).map(pe=>({id:pe.id,label:pe.label})),ruleReferences:E.ruleReferences,headlineReferences:E.headlineReferences,onResolve:at,onCancel:kt}),r.jsx(VU,{open:$.open,references:$.open?$.references:[],onConfirm:Be,onCancel:()=>{I({open:!1}),m(!1)}})]})})}const _s=e=>`${e.workspace}::${e.id}`;function V0(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function q7(){var ut;const{data:e,loading:t,error:n,refetch:s}=Jk(),o=zt(),[i,c]=p.useState(""),u=p.useRef(null);To("list:todos");const[f,m]=p.useState(""),[h,g]=p.useState(""),[y,b]=p.useState(""),[C,j]=p.useState("_global"),[v,k]=p.useState(null),[E,S]=p.useState(null),[T,A]=p.useState(new Set),[R,P]=p.useState(!1),$=p.useRef(null),[I,M]=p.useState(null),D=jy("all"),[H,K]=p.useState(null),[_,U]=p.useState(null),q=p.useRef(null);p.useEffect(()=>{let ae=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const $e=await be.json();ae||M($e.filter(at=>!at.archived))}catch{}})(),()=>{ae=!0}},[]);async function Z(ae,be){ae.stopPropagation(),await Oc(be)&&(k(be),setTimeout(()=>k($e=>$e===be?null:$e),1500))}const F=p.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const ae=[];for(const be of e.workspaces)for(const $e of be.items)ae.push({...$e,workspace:be.workspace});return ae},[e]),G=p.useMemo(()=>{const ae=new Set;for(const be of F)for(const $e of be.tags)ae.add($e);return Array.from(ae).sort()},[F]),L=p.useMemo(()=>{let ae=F;if(i.trim()){const be=i.toLowerCase();ae=ae.filter($e=>$e.description.toLowerCase().includes(be)||$e.tags.some(at=>at.toLowerCase().includes(be))||$e.id.includes(be))}return f&&(ae=ae.filter(be=>be.status===f)),h&&(ae=ae.filter(be=>be.tags.includes(h))),ae},[F,i,f,h]);p.useEffect(()=>{A(new Set),$.current=null},[i,f,h]);const V=p.useMemo(()=>L.filter(ae=>T.has(_s(ae))),[L,T]),re=L.length>0&&V.length===L.length,B=V.length>0&&!re,ue=p.useMemo(()=>{if(V.length===0)return null;const ae=new Set(V.map(be=>be.workspace));return ae.size===1?[...ae][0]:null},[V]),ge=p.useMemo(()=>{if(!ue||!I)return;const ae=I.filter(be=>be.workspace===ue);return ae.length===1?ae[0].slug:void 0},[ue,I]),se=((ut=V[0])==null?void 0:ut.description)??"",ye=p.useMemo(()=>{if(ue)return null;const ae=new Map;for(const be of V)ae.has(be.workspace)||ae.set(be.workspace,[]),ae.get(be.workspace).push(be.id);return Array.from(ae,([be,$e])=>({workspace:be,todoIds:$e}))},[V,ue]),Se=ue?{kind:"workspace",workspace:ue}:{kind:"aggregate",groups:ye??[]};function Ee(ae,be,$e){const at=_s(ae),Be=!!($e&&"shiftKey"in $e&&$e.shiftKey),kt=$.current?Ze.findIndex(St=>_s(St)===$.current):-1;if(Be&&kt!==-1){const St=Math.min(kt,be),_t=Math.max(kt,be);A(pe=>{const te=new Set(pe);for(let xe=St;xe<=_t;xe++){const Le=Ze[xe];Le&&te.add(_s(Le))}return te})}else A(St=>{const _t=new Set(St);return _t.has(at)?_t.delete(at):_t.add(at),_t});$.current=at}function Ae(){A(ae=>{const be=new Set(ae);if(re)for(const $e of L)be.delete(_s($e));else for(const $e of L)be.add(_s($e));return be})}function Ke(){A(new Set),$.current=null}function ct(ae){Ke(),s(),ae!=null&&ae.assignmentRef&&o(V0(ae.assignmentRef))}const et=p.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const ae={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)ae.open+=be.counts.open,ae.in_progress+=be.counts.in_progress,ae.completed+=be.counts.completed,ae.blocked+=be.counts.blocked,ae.total+=be.counts.total;return ae},[e]);async function ot(){y.trim()&&(await cx(C,y.trim()),b(""),s())}async function X(ae,be,$e){switch($e){case"open":await eS(ae,be);break;case"in_progress":await Zk(ae,be);break;case"completed":await Qk(ae,be);break;case"blocked":await Xk(ae,be);break}s()}async function Me(ae,be){await tS(ae,be),s()}async function Ce(ae,be,$e){await nS(ae,be,$e),s()}async function Ie(ae,be,$e){await rS(ae,be,$e),s()}async function Ye(ae,be,$e){await sS(ae,be,$e),s()}const Fe=wy(L),Ze=Fe.filter(ae=>!D.isCollapsed(ae.config.id)).flatMap(ae=>ae.items),{hotkeyRowProps:Qe}=Nc(Ze,{scope:"list:todos",bindO:!1,onOpen:ae=>S(_s(ae))});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ae;return(ae=u.current)==null?void 0:ae.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>s()});const[Ot,yt]=Ns(),dt=Ot.get("focus");p.useEffect(()=>{if(!dt)return;const ae=F.find($e=>$e.id===dt);if(!ae)return;const be=ap(ae.status);D.isCollapsed(be)&&D.toggle(be)},[dt,F]),p.useEffect(()=>{if(!dt)return;const ae=document.querySelector(`[data-todo-id="${CSS.escape(dt)}"]`);if(!ae)return;ae.scrollIntoView({block:"nearest"}),ae.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{ae.classList.remove("ring-2","ring-primary/60"),yt($e=>{const at=new URLSearchParams($e);return at.delete("focus"),at})},1500);return()=>window.clearTimeout(be)},[dt,Ze.length,yt]);const le=H?L.find(ae=>_s(ae)===H)??null:null;function Y(ae,be){const $e=q.current;if($e!=null&&$e.closest(Ri)){ae.preventDefault();return}ae.dataTransfer.effectAllowed="move",ae.dataTransfer.setData("text/plain",be),K(be)}function fe(){K(null),U(null)}function ne(ae,be){!le||be.statuses.includes(le.status)||(ae.preventDefault(),ae.dataTransfer.dropEffect="move",U(be.id))}function he(ae,be){_===be.id&&!ae.currentTarget.contains(ae.relatedTarget)&&U(null)}function De(ae,be){ae.preventDefault();const $e=le;fe(),!(!$e||be.statuses.includes($e.status))&&X($e.workspace,$e.id,be.dropStatus)}return t?r.jsx(xt,{label:"Loading todos..."}):n?r.jsx(Tt,{error:n}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Mn,{label:"Open",value:et.open,icon:Fr}),r.jsx(Mn,{label:"In Progress",value:et.in_progress,icon:Zg,tone:"info"}),r.jsx(Mn,{label:"Blocked",value:et.blocked,icon:nx,tone:"warn"}),r.jsx(Mn,{label:"Completed",value:et.completed,icon:Fr,tone:"default"})]}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsxs("select",{value:C,onChange:ae=>j(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(ae=>ae.workspace!=="_global").map(ae=>r.jsx("option",{value:ae.workspace,children:ae.workspace},ae.workspace))]}),r.jsx("input",{type:"text",placeholder:"Add a todo...",value:y,onChange:ae=>b(ae.target.value),onKeyDown:ae=>ae.key==="Enter"&&ot(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),r.jsxs("button",{onClick:ot,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(No,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:u,type:"text",placeholder:"Search todos...",value:i,onChange:ae=>c(ae.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:f,onChange:ae=>m(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:h,onChange:ae=>g(ae.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ae=>r.jsxs("option",{value:ae,children:["#",ae]},ae))]})]}),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(ae=>ae.workspace)).size," workspaces"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>P(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),r.jsx("button",{type:"button",onClick:Ke,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:re,ref:ae=>{ae&&(ae.indeterminate=B)},onChange:Ae,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",L.length,")"]}),r.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ae=-1;return Fe.map(({config:be,items:$e})=>{const at=!D.isCollapsed(be.id);return r.jsx(vy,{label:be.label,count:$e.length,expanded:at,onToggle:()=>D.toggle(be.id),isDropTarget:_===be.id,onDragOver:Be=>ne(Be,be),onDragLeave:Be=>he(Be,be),onDrop:Be=>De(Be,be),children:at&&$e.map(Be=>{ae+=1;const kt=ae,St=_s(Be),_t=T.has(St);return r.jsxs("div",{draggable:!0,"data-todo-id":Be.id,...Qe(kt),onMouseDown:pe=>{q.current=pe.target},onDragStart:pe=>Y(pe,St),onDragEnd:fe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${_t?"ring-1 ring-foreground/20":""} ${H===St?"opacity-50 shadow-lg":""}`,children:[r.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Be.id}`,title:"Select",checked:_t,onChange:()=>{},onClick:pe=>{pe.stopPropagation(),Ee(Be,kt,pe)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),r.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),r.jsx("div",{className:"mt-0.5 shrink-0",children:r.jsx(YC,{status:Be.status,onChange:pe=>X(Be.workspace,Be.id,pe)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[r.jsx(QC,{description:Be.description,status:Be.status,editing:E===St,onBeginEdit:()=>S(St),onEndEdit:()=>S(null),onSave:pe=>Ce(Be.workspace,Be.id,pe)}),Be.tags.length>0&&r.jsx("span",{className:"text-xs text-muted-foreground",children:Be.tags.map(pe=>`#${pe}`).join(" ")}),Be.linkedAssignmentRef?r.jsxs(Te,{to:V0(Be.linkedAssignmentRef),"data-no-drag":!0,className:"inline-flex items-center gap-0.5 rounded-full border border-status-completed-foreground/40 bg-status-completed/30 px-1.5 py-0.5 text-[10px] font-mono text-status-completed-foreground hover:bg-status-completed/50",onClick:pe=>pe.stopPropagation(),children:[r.jsx(mk,{className:"h-2.5 w-2.5"}),Be.linkedAssignmentRef.includes("/")?Be.linkedAssignmentRef:`oneoff:${Be.linkedAssignmentRef.slice(0,8)}`]}):null]}),r.jsx(XC,{item:Be,attachmentUrl:(pe,te)=>ux(Be.workspace,pe,te),onAdd:pe=>Ie(Be.workspace,Be.id,pe),onDelete:pe=>Ye(Be.workspace,Be.id,pe)})]}),r.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Be.workspace!=="_global"&&r.jsx(Te,{to:`/w/${Be.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:pe=>pe.stopPropagation(),children:Be.workspace})}),v===Be.id?r.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[r.jsx(Rr,{className:"h-3 w-3"})," Copied to clipboard"]}):r.jsxs(r.Fragment,{children:[r.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:pe=>Z(pe,Be.id),children:["t:",Be.id]}),r.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:pe=>Z(pe,Be.id),children:r.jsx(Od,{className:"h-3 w-3"})})]}),r.jsx("button",{onClick:pe=>{pe.stopPropagation(),Me(Be.workspace,Be.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Be.workspace}-${Be.id}`)})},be.id)})})()}),r.jsx(by,{open:R,selectedIds:V.map(ae=>ae.id),scope:Se,onOpenChange:P,onDone:ct,defaultProject:ge,defaultTitle:se,allowOneOff:!0})]})}const G7={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 Y7({bundle:e}){const t=G7[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 J7({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(Y7,{bundle:n},n.id))]})}function Q7(e){const[t,n]=p.useState(null),[s,o]=p.useState(!0),[i,c]=p.useState(null),u=p.useCallback(async()=>{try{const f=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!f.ok)throw new Error(`HTTP ${f.status}`);n(await f.json()),c(null)}catch(f){c(f instanceof Error?f.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return p.useEffect(()=>{u()},[u]),kc(f=>{f.type==="todos-updated"&&!f.projectSlug&&u()}),{data:t,loading:s,error:i,refetch:u}}function X7(){const{workspace:e}=Bt(),t=e||"_global",{data:n,loading:s,error:o,refetch:i}=f3(t),{data:c}=Q7(t),[u,f]=p.useState(""),[m,h]=p.useState(""),[g,y]=p.useState(""),[b,C]=p.useState(""),[j,v]=p.useState(null),[k,E]=p.useState(null),[S,T]=p.useState(new Set),[A,R]=p.useState(!1),[P,$]=p.useState(!1),[I,M]=p.useState(null),D=p.useRef(null);To("list:todos");const H=jy("workspace:"+t),[K,_]=p.useState(null),[U,q]=p.useState(null),Z=p.useRef(null);async function F(ne,he){ne.stopPropagation(),await Oc(he)&&(v(he),setTimeout(()=>v(De=>De===he?null:De),1500))}const G=p.useMemo(()=>{if(!(n!=null&&n.items))return[];const ne=new Set;for(const he of n.items)for(const De of he.tags)ne.add(De);return Array.from(ne).sort()},[n]),L=p.useMemo(()=>{if(!(n!=null&&n.items))return[];let ne=n.items;if(u.trim()){const he=u.toLowerCase();ne=ne.filter(De=>De.description.toLowerCase().includes(he)||De.tags.some(ut=>ut.toLowerCase().includes(he))||De.id.includes(he))}return m&&(ne=ne.filter(he=>he.status===m)),g&&(ne=ne.filter(he=>he.tags.includes(g))),ne},[n,u,m,g]);p.useEffect(()=>{T(new Set)},[u,m,g,t]);const V=p.useMemo(()=>L.filter(ne=>S.has(ne.id)).length,[L,S]),re=L.length>0&&V===L.length,B=V>0&&!re;function ue(ne){T(he=>{const De=new Set(he);return De.has(ne)?De.delete(ne):De.add(ne),De})}function ge(){T(ne=>{const he=new Set(ne);if(re)for(const De of L)he.delete(De.id);else for(const De of L)he.add(De.id);return he})}function se(){T(new Set)}const ye=I?[I]:Array.from(S);function Se(){T(new Set),M(null),i()}function Ee(){T(new Set),i()}async function Ae(){b.trim()&&(await cx(t,b.trim()),C(""),i())}async function Ke(ne,he,De){ne.stopPropagation(),window.confirm(`Delete "${De}"? This can't be undone.`)&&(await tS(t,he),i())}async function ct(ne,he){switch(he){case"open":await eS(t,ne);break;case"in_progress":await Zk(t,ne);break;case"completed":await Qk(t,ne);break;case"blocked":await Xk(t,ne);break}i()}async function et(ne,he){await nS(t,ne,he),i()}async function ot(ne,he){await rS(t,ne,he),i()}async function X(ne,he){await sS(t,ne,he),i()}const Me=wy(L),Ce=Me.filter(ne=>!H.isCollapsed(ne.config.id)).flatMap(ne=>ne.items),{hotkeyRowProps:Ie}=Nc(Ce,{scope:"list:todos",bindO:!1,onOpen:ne=>E(ne.id)});Yt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ne;return(ne=D.current)==null?void 0:ne.focus()}}),Yt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[Ye,Fe]=Ns(),Ze=Ye.get("focus");p.useEffect(()=>{if(!Ze||!(n!=null&&n.items))return;const ne=n.items.find(De=>De.id===Ze);if(!ne)return;const he=ap(ne.status);H.isCollapsed(he)&&H.toggle(he)},[Ze,n==null?void 0:n.items]),p.useEffect(()=>{if(!Ze)return;const ne=document.querySelector(`[data-todo-id="${window.CSS.escape(Ze)}"]`);if(!ne)return;ne.scrollIntoView({block:"nearest"}),ne.classList.add("ring-2","ring-primary/60");const he=window.setTimeout(()=>{ne.classList.remove("ring-2","ring-primary/60"),Fe(De=>{const ut=new URLSearchParams(De);return ut.delete("focus"),ut})},1500);return()=>window.clearTimeout(he)},[Ze,Ce.length,Fe]);const Qe=K?(n==null?void 0:n.items.find(ne=>ne.id===K))??null:null;function Ot(ne,he){const De=Z.current;if(De!=null&&De.closest(Ri)){ne.preventDefault();return}ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("text/plain",he),_(he)}function yt(){_(null),q(null)}function dt(ne,he){!Qe||he.statuses.includes(Qe.status)||(ne.preventDefault(),ne.dataTransfer.dropEffect="move",q(he.id))}function le(ne,he){U===he.id&&!ne.currentTarget.contains(ne.relatedTarget)&&q(null)}function Y(ne,he){ne.preventDefault();const De=Qe;yt(),!(!De||he.statuses.includes(De.status))&&ct(De.id,he.dropStatus)}if(s)return r.jsx(xt,{label:"Loading todos..."});if(o)return r.jsx(Tt,{error:o});const fe=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[r.jsx(Mn,{label:"Open",value:fe.open,icon:Fr}),r.jsx(Mn,{label:"In Progress",value:fe.in_progress,icon:Fr,tone:"info"}),r.jsx(Mn,{label:"Blocked",value:fe.blocked,icon:nx,tone:"warn"}),r.jsx(Mn,{label:"Total",value:fe.total,icon:Fr})]}),c&&r.jsx(J7,{bundles:c.bundles}),r.jsx("div",{className:"surface-panel p-3",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:ne=>C(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&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(Lt,{className:"h-4 w-4"}),"Add"]})]})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(No,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{ref:D,type:"text",placeholder:"Search...",value:u,onChange:ne=>f(ne.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),r.jsxs("select",{value:m,onChange:ne=>h(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All statuses"}),r.jsx("option",{value:"open",children:"Open"}),r.jsx("option",{value:"in_progress",children:"In Progress"}),r.jsx("option",{value:"completed",children:"Completed"}),r.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&r.jsxs("select",{value:g,onChange:ne=>y(ne.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[r.jsx("option",{value:"",children:"All tags"}),G.map(ne=>r.jsxs("option",{value:ne,children:["#",ne]},ne))]})]}),S.size>0?r.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[r.jsxs("span",{className:"text-sm font-medium",children:[S.size," selected"]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),r.jsx("button",{type:"button",onClick:()=>{M(null),$(!0)},className:"shell-action",children:"Move to…"}),r.jsx("button",{type:"button",onClick:se,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.length>0&&r.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[r.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:re,ref:ne=>{ne&&(ne.indeterminate=B)},onChange:ge,className:"h-4 w-4 cursor-pointer accent-foreground"}),r.jsxs("span",{children:["Select all in current filter (",L.length,")"]})]}),r.jsx("div",{className:"space-y-3",children:(()=>{let ne=-1;return Me.map(({config:he,items:De})=>{const ut=!H.isCollapsed(he.id);return r.jsx(vy,{label:he.label,count:De.length,expanded:ut,onToggle:()=>H.toggle(he.id),isDropTarget:U===he.id,onDragOver:ae=>dt(ae,he),onDragLeave:ae=>le(ae,he),onDrop:ae=>Y(ae,he),children:ut&&De.map(ae=>(ne+=1,r.jsx(JC,{item:ae,copiedId:j,selected:S.has(ae.id),editing:k===ae.id,onBeginEdit:be=>E(be),onEndEdit:()=>E(null),onPatchDescription:et,onAddAttachments:ot,onDeleteAttachment:X,attachmentUrl:(be,$e)=>ux(t,be,$e),onToggleSelected:be=>ue(be),onMoveOne:(be,$e)=>{$e.stopPropagation(),M(be),$(!0)},onStatusChange:ct,onCopyId:F,onDelete:Ke,hotkeyRowProps:Ie(ne),onDragOrigin:be=>{Z.current=be.target},onDragStart:Ot,onDragEnd:yt,isDragging:K===ae.id},ae.id)))},he.id)})})()}),r.jsx(by,{open:A,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:R,onDone:Ee}),r.jsx(eE,{open:P,selectedIds:ye,scope:{kind:"workspace",workspace:t},onOpenChange:ne=>{$(ne),ne||M(null)},onDone:Se})]})}function XE(){const{views:e}=Pc();async function t(i,c,u){const f=e.find(g=>g.id===i.id)??i,m=MN(u,f.workspace).config,h=tf(f.config,m,f.config);await Gd(i.id,{name:c,config:h})}async function n(i,c,u){const f=e.find(g=>g.id===i.id)??i,m=Qx(u,f.workspace).config,h=tf(f.config,m,f.config);await Gd(i.id,{name:c,config:h})}async function s(i){await Ci({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await IO(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:s,remove:o}}const H0=80,Z7={kanban:"Kanban",list:"List",table:"Table"},e9={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function ZE({open:e,onOpenChange:t,workspace:n,initialView:s,onSubmit:o}){const i=!!s,c=pa(),u=Qf(),{data:f}=Co(),{data:m}=vf(),[h,g]=p.useState(""),[y,b]=p.useState(Za.viewMode),[C,j]=p.useState([]),[v,k]=p.useState([]),[E,S]=p.useState([]),[T,A]=p.useState([]),[R,P]=p.useState([]),[$,I]=p.useState([]),[M,D]=p.useState("all"),[H,K]=p.useState(null),[_,U]=p.useState(""),[q,Z]=p.useState(Za.sortField),[F,G]=p.useState(Za.sortDirection),[L,V]=p.useState(!1),[re,B]=p.useState(null);function ue(){b(Za.viewMode),j([]),k([]),S([]),A([]),P([]),I([]),D("all"),K(null),U(""),Z(Za.sortField),G(Za.sortDirection)}p.useEffect(()=>{if(e)if(B(null),V(!1),s){const X=s.config.filters;g(s.name),b(s.config.viewMode),j(ze(X.status)),k(ze(X.priority)),S(ze(X.type)),A(ze(X.project)),P(ze(X.assignee)),I(ze(X.tags)),D(X.activity??"all"),K(Zf(X.dateRange)),U(X.search??""),Z(s.config.sortField),G(s.config.sortDirection)}else g(""),ue()},[e,s]);const ge=X=>Me=>X?X==="_ungrouped"?Me.projectWorkspace===null:Me.projectWorkspace===X:!0,se=p.useMemo(()=>{const X=Ce=>n?n==="_ungrouped"?Ce.workspace===null:Ce.workspace===n:!0,Me=(f??[]).filter(X);return[{value:"__standalone__",label:"No project"},...Me.map(Ce=>({value:Ce.slug,label:Ce.title}))]},[f,n]),ye=p.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ie of(m==null?void 0:m.assignments)??[])Me(Ie)&&Ie.assignee&&X.add(Ie.assignee);const Ce=[{value:"__unassigned__",label:"Unassigned"}];for(const Ie of Array.from(X).sort())Ce.push({value:Ie,label:Ie});return Ce},[m,n]),Se=p.useMemo(()=>{const X=new Set,Me=ge(n);for(const Ce of(m==null?void 0:m.assignments)??[])if(Me(Ce))for(const Ie of Ce.tags??[])X.add(Ie);return Array.from(X).sort().map(Ce=>({value:Ce,label:Ce}))},[m,n]),Ee=p.useMemo(()=>c.order.map(X=>({value:X,label:$c(c,X)})),[c]),Ae=p.useMemo(()=>f5.map(X=>({value:X,label:X[0].toUpperCase()+X.slice(1)})),[]),Ke=p.useMemo(()=>u.definitions.map(X=>({value:X.id,label:ji(u,X.id)})),[u]),ct=Lx.map(X=>({value:X,label:Z7[X]})),et=h.trim(),ot=et.length>0&&et.length<=H0;return r.jsx(zn,{open:e,onOpenChange:t,children:r.jsx($n,{className:"max-w-lg",children:r.jsxs("form",{className:"space-y-4",onSubmit:async X=>{if(X.preventDefault(),!ot||L)return;V(!0),B(null);const Me={viewMode:y,filters:{status:C,priority:v,type:E,project:T,assignee:R,tags:$,activity:M,dateRange:ia(H),search:_},sortField:q,sortDirection:F};try{await o(et,Me)}catch(Ce){B(Ce instanceof Error?Ce.message:String(Ce)),V(!1)}},children:[r.jsx(pr,{children:r.jsx(Ln,{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:H0,onChange:X=>g(X.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),r.jsx(tp,{value:y,onChange:X=>b(X),options:ct})]}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(gs,{label:"Status",children:r.jsx(yn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:Ee,value:C,onChange:j})}),r.jsx(gs,{label:"Priority",children:r.jsx(yn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:Ae,value:v,onChange:k})}),r.jsx(gs,{label:"Type",children:r.jsx(yn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Ke,value:E,onChange:S})}),r.jsx(gs,{label:"Project",children:r.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:se,value:T,onChange:A})}),r.jsx(gs,{label:"Assignee",children:r.jsx(yn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ye,value:R,onChange:P})}),r.jsx(gs,{label:"Tags",children:r.jsx(yn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:Se,value:$,onChange:I})}),r.jsx(gs,{label:"Activity",children:r.jsxs("select",{value:M,onChange:X=>D(X.target.value),className:"editor-input w-full",children:[r.jsx("option",{value:"all",children:"All activity"}),r.jsx("option",{value:"stale",children:"Stale only"}),r.jsx("option",{value:"fresh",children:"Fresh only"})]})}),r.jsx(gs,{label:"Date range",children:r.jsx(Xf,{className:"w-full",value:H,onChange:K})}),r.jsx(gs,{label:"Search",className:"sm:col-span-2",children:r.jsx("input",{type:"text",value:_,onChange:X=>U(X.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),r.jsx(gs,{label:"Sort by",className:"sm:col-span-2",children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx("select",{value:q,onChange:X=>Z(X.target.value),className:"editor-input w-full",children:O1.map(X=>r.jsx("option",{value:X,children:e9[X]??X},X))}),r.jsx("button",{type:"button",onClick:()=>G(X=>X==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:F==="asc"?"Ascending":"Descending",children:F==="asc"?"Asc":"Desc"})]})})]}),re?r.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:re}):null,r.jsxs(Vr,{className:"sm:justify-between",children:[r.jsx("button",{type:"button",onClick:ue,className:"shell-action",disabled:L,children:"Clear all"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:L,children:"Cancel"}),r.jsx("button",{type:"submit",disabled:!ot||L,className:"shell-action shell-action--cta disabled:opacity-50",children:L?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function gs({label:e,className:t,children:n}){return r.jsxs("label",{className:`space-y-1 ${t??""}`,children:[r.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const t9={kanban:"Kanban",list:"List",table:"Table"},n9={assignment:"Assignment",session:"Session"},r9={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function W0(){const{workspace:e}=Bt(),{views:t,loading:n}=Pc(),{submitEdit:s,submitEditSession:o,duplicate:i,remove:c}=XE(),{toast:u,showToast:f,dismissToast:m}=Ro(),[h,g]=p.useState(null),[y,b]=p.useState(!1),[C,j]=p.useState(!1),[v,k]=p.useState(!1),[E,S]=p.useState(null);async function T(K,_){const{workspace:U,config:q}=MN(_,e??null);try{await Ci({name:K,workspace:U,config:q}),j(!1),f(`Created view "${K}"`)}catch(Z){throw f(Z instanceof Error?Z.message:"Failed to create saved view"),Z}}async function A(K,_){const{workspace:U,config:q}=Qx(_,e??null);try{await Ci({name:K,workspace:U,config:q,entityType:"session"}),k(!1),f(`Created session view "${K}"`)}catch(Z){throw f(Z instanceof Error?Z.message:"Failed to create session view"),Z}}async function R(K,_,U){try{await s(K,_,U),S(null),f(`Updated view "${_}"`)}catch(q){throw f(q instanceof Error?q.message:"Failed to update saved view"),q}}async function P(K,_,U){try{await o(K,_,U),S(null),f(`Updated session view "${_}"`)}catch(q){throw f(q instanceof Error?q.message:"Failed to update session view"),q}}async function $(K){try{await i(K),f(`Duplicated "${K.name}"`)}catch(_){f(_ instanceof Error?_.message:"Failed to duplicate saved view")}}async function I(){if(h){b(!0);try{await c(h),g(null)}catch(K){f(K instanceof Error?K.message:"Failed to delete saved view")}finally{b(!1)}}}const M=r.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create view"]}),D=r.jsxs("button",{type:"button",onClick:()=>k(!0),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Lt,{className:"h-4 w-4"}),"Create session view"]}),H=(E==null?void 0:E.entityType)==="session";return r.jsxs("div",{className:"space-y-4",children:[r.jsx(rf,{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,M]})}),n?r.jsx(xt,{label:"Loading saved views…"}):t.length===0?r.jsx(Et,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:r.jsxs("div",{className:"flex items-center gap-2",children:[D,M]})}):r.jsx(He,{children:r.jsx("ul",{className:"divide-y divide-border/60",children:t.map(K=>r.jsx(s9,{view:K,onRequestDelete:()=>g(K),onRequestEdit:()=>S(K),onRequestDuplicate:()=>void $(K)},K.id))})}),r.jsx(ZE,{open:C||!H&&E!==null,onOpenChange:K=>{K||(j(!1),H||S(null))},workspace:E&&!H?E.workspace:e??null,initialView:E&&!H?E:null,onSubmit:E&&!H?(K,_)=>R(E,K,_):T}),r.jsx(VN,{open:v||H&&E!==null,onOpenChange:K=>{K||(k(!1),H&&S(null))},workspace:E&&H?E.workspace:e??null,initialView:E&&H?E:null,onSubmit:E&&H?(K,_)=>P(E,K,_):A}),r.jsx(xa,{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:I,onOpenChange:K=>{!K&&!y&&g(null)}}),r.jsx(ha,{toast:u,onDismiss:m})]})}function s9({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:s}){const o=zt(),i=()=>o(zN(e)),c=UN(e.config.filters),u=e.workspace?Sn(e.workspace):null,f=e.entityType??"assignment",m=f==="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 ${r9[f]??"bg-muted text-muted-foreground"}`,children:n9[f]??f}),!m&&r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground",children:t9[e.config.viewMode]}),u?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:u}):null]}),r.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[c,h?` · ${h}`:""]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),r.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:s,className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const o9={kanban:"Kanban",list:"List",table:"Table"};function K0(){const{id:e,workspace:t}=Bt(),n=zt(),{view:s,ready:o,error:i,refetch:c}=jo(e),{submitEdit:u,duplicate:f,remove:m}=XE(),{toast:h,showToast:g,dismissToast:y}=Ro(),[b,C]=p.useState(!1),[j,v]=p.useState(!1),[k,E]=p.useState(!1);if(p.useEffect(()=>{!o||!s||(t??null)!==(s.workspace??null)&&n(zN(s),{replace:!0})},[o,s,t,n]),!o)return r.jsx(xt,{label:"Loading view…"});if(i)return r.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[r.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),r.jsx("button",{type:"button",onClick:()=>c(),className:"shell-action mt-3",children:"Retry"})]});if(!s)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(rf,{title:"View not found",description:"This saved view no longer exists."}),r.jsxs(Te,{to:Td(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[r.jsx(Dd,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=s.workspace?Sn(s.workspace):null;async function T(P,$){const I=s;try{await u(I,P,$),C(!1),g(`Updated view "${P}"`)}catch(M){throw g(M instanceof Error?M.message:"Failed to update saved view"),M}}async function A(){const P=s;try{await f(P),g(`Duplicated "${P.name}"`)}catch($){g($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function R(){const P=s;E(!0);try{await m(P),v(!1),n(Td(P.workspace))}catch($){g($ instanceof Error?$.message:"Failed to delete saved view")}finally{E(!1)}}return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Te,{to:Td(s.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[r.jsx(Dd,{className:"h-4 w-4"})," Saved Views"]}),r.jsx(rf,{title:s.name,description:UN(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:o9[s.config.viewMode]}),S?r.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full border border-border/70 bg-muted/60 px-2 py-0.5 text-xs text-muted-foreground",children:S}):null,r.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action",children:"Edit"}),r.jsx("button",{type:"button",onClick:()=>void A(),className:"shell-action",children:"Duplicate"}),r.jsx("button",{type:"button",onClick:()=>n(BN(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(IN,{view:s}),b?r.jsx(ZE,{open:b,onOpenChange:C,workspace:s.workspace,initialView:s,onSubmit:T}):null,r.jsx(xa,{open:j,title:"Delete saved view?",description:`Delete '${s.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:k,destructive:!0,onConfirm:R,onOpenChange:P=>{!P&&!k&&v(!1)}}),r.jsx(ha,{toast:h,onDismiss:y})]})}function a9(){return r.jsx(lP,{children:r.jsx(N$,{children:r.jsx(_R,{children:r.jsxs(Ge,{element:r.jsx(eL,{}),children:[r.jsx(Ge,{path:"/",element:r.jsx(R5,{})}),r.jsx(Ge,{path:"/projects",element:r.jsx(hj,{})}),r.jsx(Ge,{path:"/archive",element:r.jsx(H5,{})}),r.jsx(Ge,{path:"/assignments",element:r.jsx(S0,{})}),r.jsx(Ge,{path:"/assignments/new",element:r.jsx(T0,{})}),r.jsx(Ge,{path:"/assignments/:id",element:r.jsx(U8,{})}),r.jsx(Ge,{path:"/assignments/:id/edit",element:r.jsx(Kh,{})}),r.jsx(Ge,{path:"/assignments/:id/plan/edit",element:r.jsx(qh,{})}),r.jsx(Ge,{path:"/assignments/:id/scratchpad/edit",element:r.jsx(Gh,{})}),r.jsx(Ge,{path:"/assignments/:id/handoff/edit",element:r.jsx(Yh,{})}),r.jsx(Ge,{path:"/assignments/:id/decision-record/edit",element:r.jsx(Jh,{})}),r.jsx(Ge,{path:"/servers",element:r.jsx(P0,{})}),r.jsx(Ge,{path:"/inventories",element:r.jsx(A0,{})}),r.jsx(Ge,{path:"/usage",element:r.jsx(D0,{})}),r.jsx(Ge,{path:"/agent-sessions",element:r.jsx($0,{})}),r.jsx(Ge,{path:"/playbooks",element:r.jsx(EU,{})}),r.jsx(Ge,{path:"/playbooks/create",element:r.jsx(RU,{})}),r.jsx(Ge,{path:"/playbooks/:slug",element:r.jsx(TU,{})}),r.jsx(Ge,{path:"/playbooks/:slug/edit",element:r.jsx(PU,{})}),r.jsx(Ge,{path:"/memories",element:r.jsx(AU,{})}),r.jsx(Ge,{path:"/memories/new",element:r.jsx($U,{})}),r.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug",element:r.jsx(DU,{})}),r.jsx(Ge,{path:"/projects/:slug/memories/:itemSlug/edit",element:r.jsx(LU,{})}),r.jsx(Ge,{path:"/resources",element:r.jsx(OU,{})}),r.jsx(Ge,{path:"/resources/new",element:r.jsx(_U,{})}),r.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug",element:r.jsx(IU,{})}),r.jsx(Ge,{path:"/projects/:slug/resources/:itemSlug/edit",element:r.jsx(MU,{})}),r.jsx(Ge,{path:"/todos",element:r.jsx(q7,{})}),r.jsx(Ge,{path:"/views",element:r.jsx(W0,{})}),r.jsx(Ge,{path:"/views/:id",element:r.jsx(K0,{})}),r.jsx(Ge,{path:"/help",element:r.jsx(A5,{})}),r.jsx(Ge,{path:"/settings",element:r.jsx(K7,{})}),r.jsx(Ge,{path:"/create/project",element:r.jsx(C0,{})}),r.jsx(Ge,{path:"/projects/:slug",element:r.jsx(h0,{})}),r.jsx(Ge,{path:"/projects/:slug/edit",element:r.jsx(R0,{})}),r.jsx(Ge,{path:"/projects/:slug/create/assignment",element:r.jsx(E0,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug",element:r.jsx(v0,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/edit",element:r.jsx(Kh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(qh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Gh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Yh,{})}),r.jsx(Ge,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Jh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects",element:r.jsx(hj,{})}),r.jsx(Ge,{path:"/w/:workspace/assignments",element:r.jsx(S0,{})}),r.jsx(Ge,{path:"/w/:workspace/assignments/new",element:r.jsx(T0,{})}),r.jsx(Ge,{path:"/w/:workspace/servers",element:r.jsx(P0,{})}),r.jsx(Ge,{path:"/w/:workspace/inventories",element:r.jsx(A0,{})}),r.jsx(Ge,{path:"/w/:workspace/usage",element:r.jsx(D0,{})}),r.jsx(Ge,{path:"/w/:workspace/agent-sessions",element:r.jsx($0,{})}),r.jsx(Ge,{path:"/w/:workspace/todos",element:r.jsx(X7,{})}),r.jsx(Ge,{path:"/w/:workspace/views",element:r.jsx(W0,{})}),r.jsx(Ge,{path:"/w/:workspace/views/:id",element:r.jsx(K0,{})}),r.jsx(Ge,{path:"/w/:workspace/create/project",element:r.jsx(C0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug",element:r.jsx(h0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/edit",element:r.jsx(R0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/create/assignment",element:r.jsx(E0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:r.jsx(v0,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:r.jsx(Kh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:r.jsx(qh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:r.jsx(Gh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:r.jsx(Yh,{})}),r.jsx(Ge,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:r.jsx(Jh,{})})]})})})})}VA();_T.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx(HA,{children:r.jsx(a9,{})})}));export{hM as _,l9 as a,df as g};
|