syntaur 0.60.0 → 0.61.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +21 -0
  3. package/dashboard/dist/assets/{_basePickBy-CuAo8UW0.js → _basePickBy-CpFuPIT8.js} +1 -1
  4. package/dashboard/dist/assets/{_baseUniq-4Xj4MGEd.js → _baseUniq-DUrsBbod.js} +1 -1
  5. package/dashboard/dist/assets/{arc-D-cLsL4Z.js → arc-D432bgcA.js} +1 -1
  6. package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-MFXpgrLd.js → architectureDiagram-2XIMDMQ5--gLudksM.js} +1 -1
  7. package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-C--nvhZ1.js → blockDiagram-WCTKOSBZ-MGtlXwaM.js} +1 -1
  8. package/dashboard/dist/assets/{c4Diagram-IC4MRINW-Buf6Z0Mz.js → c4Diagram-IC4MRINW-BYOcEzmn.js} +1 -1
  9. package/dashboard/dist/assets/channel-HTXYrjhV.js +1 -0
  10. package/dashboard/dist/assets/{chunk-4BX2VUAB-BI-SnYdf.js → chunk-4BX2VUAB-B8mKqMx3.js} +1 -1
  11. package/dashboard/dist/assets/{chunk-55IACEB6-Bk-wRH9v.js → chunk-55IACEB6-Cx1rZTFA.js} +1 -1
  12. package/dashboard/dist/assets/{chunk-FMBD7UC4-BkrKPw8u.js → chunk-FMBD7UC4-Bx55uyLu.js} +1 -1
  13. package/dashboard/dist/assets/{chunk-JSJVCQXG-klefEqKn.js → chunk-JSJVCQXG-BRDbVMuU.js} +1 -1
  14. package/dashboard/dist/assets/{chunk-KX2RTZJC-Cg2N1i9P.js → chunk-KX2RTZJC-6xpnX7LD.js} +1 -1
  15. package/dashboard/dist/assets/{chunk-NQ4KR5QH-wplW9rdD.js → chunk-NQ4KR5QH-B90im-ae.js} +1 -1
  16. package/dashboard/dist/assets/{chunk-QZHKN3VN-CszX6pq9.js → chunk-QZHKN3VN-CIozyGqe.js} +1 -1
  17. package/dashboard/dist/assets/{chunk-WL4C6EOR-CyLBEb4A.js → chunk-WL4C6EOR-DysZoi-Z.js} +1 -1
  18. package/dashboard/dist/assets/classDiagram-VBA2DB6C-Ci3W9L6H.js +1 -0
  19. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-Ci3W9L6H.js +1 -0
  20. package/dashboard/dist/assets/clone-B3CnX-J-.js +1 -0
  21. package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-BPsMA7I5.js → cose-bilkent-S5V4N54A-CxwMsTG4.js} +1 -1
  22. package/dashboard/dist/assets/{dagre-KLK3FWXG-iwgQVY1-.js → dagre-KLK3FWXG-BRZfhvx6.js} +1 -1
  23. package/dashboard/dist/assets/{diagram-E7M64L7V-BnkjX2sn.js → diagram-E7M64L7V-BKAvlo24.js} +1 -1
  24. package/dashboard/dist/assets/{diagram-IFDJBPK2-BxuQhq0R.js → diagram-IFDJBPK2-Colncoj8.js} +1 -1
  25. package/dashboard/dist/assets/{diagram-P4PSJMXO-_sPQtDFF.js → diagram-P4PSJMXO-CtWHVVRh.js} +1 -1
  26. package/dashboard/dist/assets/{erDiagram-INFDFZHY-Xbs_F1mT.js → erDiagram-INFDFZHY-DsDvyrXT.js} +1 -1
  27. package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-C4txvcVj.js → flowDiagram-PKNHOUZH-DFZFPrVO.js} +1 -1
  28. package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-BNfmrW_s.js → ganttDiagram-A5KZAMGK-DMgPno3v.js} +1 -1
  29. package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-vNtati3x.js → gitGraphDiagram-K3NZZRJ6-DL7Z4Kd-.js} +1 -1
  30. package/dashboard/dist/assets/{graph-BoTq5ZU0.js → graph-DjCGNe8r.js} +1 -1
  31. package/dashboard/dist/assets/index-B_1c_Ctq.js +644 -0
  32. package/dashboard/dist/assets/{index-Dw6mWdZZ.css → index-CdBsPuM_.css} +1 -1
  33. package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-BJw8hObN.js → infoDiagram-LFFYTUFH-ms6VllLp.js} +1 -1
  34. package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56--ofJ5_wH.js → ishikawaDiagram-PHBUUO56-E1P19ow4.js} +1 -1
  35. package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-BrEpTfTe.js → journeyDiagram-4ABVD52K-I8hleVZ7.js} +1 -1
  36. package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-CnwoQq2m.js → kanban-definition-K7BYSVSG-CrFYF8VU.js} +1 -1
  37. package/dashboard/dist/assets/{layout-DUQcYnn8.js → layout-BT_qm2gQ.js} +1 -1
  38. package/dashboard/dist/assets/{linear-tcsDRZ6Z.js → linear-D1rmw3D_.js} +1 -1
  39. package/dashboard/dist/assets/{mermaid.core-IuoVhjqY.js → mermaid.core-DfYtUVoE.js} +4 -4
  40. package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-BFmfPV07.js → mindmap-definition-YRQLILUH-CcN1oeHQ.js} +1 -1
  41. package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-HAnc0XBk.js → pieDiagram-SKSYHLDU-BbZTHYrC.js} +1 -1
  42. package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-V07MDab7.js → quadrantDiagram-337W2JSQ-ChjNzTQr.js} +1 -1
  43. package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-CaH7f5Jg.js → requirementDiagram-Z7DCOOCP-DighcHqU.js} +1 -1
  44. package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DlMUAnA2.js → sankeyDiagram-WA2Y5GQK-Bw4_y6_j.js} +1 -1
  45. package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-Vw15xOlT.js → sequenceDiagram-2WXFIKYE-DHZQ0Yib.js} +1 -1
  46. package/dashboard/dist/assets/{stateDiagram-RAJIS63D-ZNkeO5HO.js → stateDiagram-RAJIS63D-BawDJGJV.js} +1 -1
  47. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO--P1IwIK8.js +1 -0
  48. package/dashboard/dist/assets/{timeline-definition-YZTLITO2-CvOXGvQg.js → timeline-definition-YZTLITO2-7GEcb3Ip.js} +1 -1
  49. package/dashboard/dist/assets/{treemap-KZPCXAKY-DkX_WNTB.js → treemap-KZPCXAKY-BNijr4yg.js} +1 -1
  50. package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-0uKyUB2W.js → vennDiagram-LZ73GAT5-OAAr6jJ3.js} +1 -1
  51. package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-CcPkniF6.js → xychartDiagram-JWTSCODW-Bz61FhCg.js} +1 -1
  52. package/dashboard/dist/index.html +2 -2
  53. package/dist/dashboard/server.js +2950 -2392
  54. package/dist/dashboard/server.js.map +1 -1
  55. package/dist/index.js +4075 -3022
  56. package/dist/index.js.map +1 -1
  57. package/dist/launch/index.js +1051 -977
  58. package/dist/launch/index.js.map +1 -1
  59. package/package.json +1 -1
  60. package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
  61. package/platforms/codex/.codex-plugin/plugin.json +1 -1
  62. package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
  63. package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
  64. package/dashboard/dist/assets/channel-HCmWgCw9.js +0 -1
  65. package/dashboard/dist/assets/classDiagram-VBA2DB6C-DtqtjiBT.js +0 -1
  66. package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-DtqtjiBT.js +0 -1
  67. package/dashboard/dist/assets/clone-CDSahJag.js +0 -1
  68. package/dashboard/dist/assets/index-oQabaQT9.js +0 -644
  69. package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-7-xErwgu.js +0 -1
@@ -0,0 +1,644 @@
1
+ var AI=Object.defineProperty;var PI=(e,t,n)=>t in e?AI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $x=(e,t,n)=>PI(e,typeof t!="symbol"?t+"":t,n);function _I(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[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"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function kd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function yae(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?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(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Ix={exports:{}},uu={},Mx={exports:{}},kt={};/**
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 Qk;function DI(){if(Qk)return kt;Qk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function g(F){return F===null||typeof F!="object"?null:(F=h&&F[h]||F["@@iterator"],typeof F=="function"?F:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,v={};function b(F,G,H){this.props=F,this.context=G,this.refs=v,this.updater=H||y}b.prototype.isReactComponent={},b.prototype.setState=function(F,G){if(typeof F!="object"&&typeof F!="function"&&F!=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,F,G,"setState")},b.prototype.forceUpdate=function(F){this.updater.enqueueForceUpdate(this,F,"forceUpdate")};function j(){}j.prototype=b.prototype;function N(F,G,H){this.props=F,this.context=G,this.refs=v,this.updater=H||y}var S=N.prototype=new j;S.constructor=N,k(S,b.prototype),S.isPureReactComponent=!0;var C=Array.isArray,D=Object.prototype.hasOwnProperty,T={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function $(F,G,H){var Q,te={},Z=null,ae=null;if(G!=null)for(Q in G.ref!==void 0&&(ae=G.ref),G.key!==void 0&&(Z=""+G.key),G)D.call(G,Q)&&!R.hasOwnProperty(Q)&&(te[Q]=G[Q]);var ne=arguments.length-2;if(ne===1)te.children=H;else if(1<ne){for(var de=Array(ne),ye=0;ye<ne;ye++)de[ye]=arguments[ye+2];te.children=de}if(F&&F.defaultProps)for(Q in ne=F.defaultProps,ne)te[Q]===void 0&&(te[Q]=ne[Q]);return{$$typeof:e,type:F,key:Z,ref:ae,props:te,_owner:T.current}}function _(F,G){return{$$typeof:e,type:F.type,key:G,ref:F.ref,props:F.props,_owner:F._owner}}function U(F){return typeof F=="object"&&F!==null&&F.$$typeof===e}function I(F){var G={"=":"=0",":":"=2"};return"$"+F.replace(/[=:]/g,function(H){return G[H]})}var V=/\/+/g;function O(F,G){return typeof F=="object"&&F!==null&&F.key!=null?I(""+F.key):G.toString(36)}function P(F,G,H,Q,te){var Z=typeof F;(Z==="undefined"||Z==="boolean")&&(F=null);var ae=!1;if(F===null)ae=!0;else switch(Z){case"string":case"number":ae=!0;break;case"object":switch(F.$$typeof){case e:case t:ae=!0}}if(ae)return ae=F,te=te(ae),F=Q===""?"."+O(ae,0):Q,C(te)?(H="",F!=null&&(H=F.replace(V,"$&/")+"/"),P(te,G,H,"",function(ye){return ye})):te!=null&&(U(te)&&(te=_(te,H+(!te.key||ae&&ae.key===te.key?"":(""+te.key).replace(V,"$&/")+"/")+F)),G.push(te)),1;if(ae=0,Q=Q===""?".":Q+":",C(F))for(var ne=0;ne<F.length;ne++){Z=F[ne];var de=Q+O(Z,ne);ae+=P(Z,G,H,de,te)}else if(de=g(F),typeof de=="function")for(F=de.call(F),ne=0;!(Z=F.next()).done;)Z=Z.value,de=Q+O(Z,ne++),ae+=P(Z,G,H,de,te);else if(Z==="object")throw G=String(F),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(F).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return ae}function L(F,G,H){if(F==null)return F;var Q=[],te=0;return P(F,Q,"","",function(Z){return G.call(H,Z,te++)}),Q}function B(F){if(F._status===-1){var G=F._result;G=G(),G.then(function(H){(F._status===0||F._status===-1)&&(F._status=1,F._result=H)},function(H){(F._status===0||F._status===-1)&&(F._status=2,F._result=H)}),F._status===-1&&(F._status=0,F._result=G)}if(F._status===1)return F._result.default;throw F._result}var q={current:null},z={transition:null},W={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:z,ReactCurrentOwner:T};function M(){throw Error("act(...) is not supported in production builds of React.")}return kt.Children={map:L,forEach:function(F,G,H){L(F,function(){G.apply(this,arguments)},H)},count:function(F){var G=0;return L(F,function(){G++}),G},toArray:function(F){return L(F,function(G){return G})||[]},only:function(F){if(!U(F))throw Error("React.Children.only expected to receive a single React element child.");return F}},kt.Component=b,kt.Fragment=n,kt.Profiler=o,kt.PureComponent=N,kt.StrictMode=r,kt.Suspense=u,kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=W,kt.act=M,kt.cloneElement=function(F,G,H){if(F==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+F+".");var Q=k({},F.props),te=F.key,Z=F.ref,ae=F._owner;if(G!=null){if(G.ref!==void 0&&(Z=G.ref,ae=T.current),G.key!==void 0&&(te=""+G.key),F.type&&F.type.defaultProps)var ne=F.type.defaultProps;for(de in G)D.call(G,de)&&!R.hasOwnProperty(de)&&(Q[de]=G[de]===void 0&&ne!==void 0?ne[de]:G[de])}var de=arguments.length-2;if(de===1)Q.children=H;else if(1<de){ne=Array(de);for(var ye=0;ye<de;ye++)ne[ye]=arguments[ye+2];Q.children=ne}return{$$typeof:e,type:F.type,key:te,ref:Z,props:Q,_owner:ae}},kt.createContext=function(F){return F={$$typeof:a,_currentValue:F,_currentValue2:F,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},F.Provider={$$typeof:i,_context:F},F.Consumer=F},kt.createElement=$,kt.createFactory=function(F){var G=$.bind(null,F);return G.type=F,G},kt.createRef=function(){return{current:null}},kt.forwardRef=function(F){return{$$typeof:l,render:F}},kt.isValidElement=U,kt.lazy=function(F){return{$$typeof:p,_payload:{_status:-1,_result:F},_init:B}},kt.memo=function(F,G){return{$$typeof:f,type:F,compare:G===void 0?null:G}},kt.startTransition=function(F){var G=z.transition;z.transition={};try{F()}finally{z.transition=G}},kt.unstable_act=M,kt.useCallback=function(F,G){return q.current.useCallback(F,G)},kt.useContext=function(F){return q.current.useContext(F)},kt.useDebugValue=function(){},kt.useDeferredValue=function(F){return q.current.useDeferredValue(F)},kt.useEffect=function(F,G){return q.current.useEffect(F,G)},kt.useId=function(){return q.current.useId()},kt.useImperativeHandle=function(F,G,H){return q.current.useImperativeHandle(F,G,H)},kt.useInsertionEffect=function(F,G){return q.current.useInsertionEffect(F,G)},kt.useLayoutEffect=function(F,G){return q.current.useLayoutEffect(F,G)},kt.useMemo=function(F,G){return q.current.useMemo(F,G)},kt.useReducer=function(F,G,H){return q.current.useReducer(F,G,H)},kt.useRef=function(F){return q.current.useRef(F)},kt.useState=function(F){return q.current.useState(F)},kt.useSyncExternalStore=function(F,G,H){return q.current.useSyncExternalStore(F,G,H)},kt.useTransition=function(){return q.current.useTransition()},kt.version="18.3.1",kt}var Jk;function Sd(){return Jk||(Jk=1,Mx.exports=DI()),Mx.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 Zk;function $I(){if(Zk)return uu;Zk=1;var e=Sd(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=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 a(l,u,f){var p,h={},g=null,y=null;f!==void 0&&(g=""+f),u.key!==void 0&&(g=""+u.key),u.ref!==void 0&&(y=u.ref);for(p in u)r.call(u,p)&&!i.hasOwnProperty(p)&&(h[p]=u[p]);if(l&&l.defaultProps)for(p in u=l.defaultProps,u)h[p]===void 0&&(h[p]=u[p]);return{$$typeof:t,type:l,key:g,ref:y,props:h,_owner:o.current}}return uu.Fragment=n,uu.jsx=a,uu.jsxs=a,uu}var e1;function II(){return e1||(e1=1,Ix.exports=$I()),Ix.exports}var s=II(),m=Sd();const $t=kd(m),NE=_I({__proto__:null,default:$t},[m]);var Qf={},Lx={exports:{}},pr={},Ox={exports:{}},Fx={};/**
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 t1;function MI(){return t1||(t1=1,(function(e){function t(z,W){var M=z.length;z.push(W);e:for(;0<M;){var F=M-1>>>1,G=z[F];if(0<o(G,W))z[F]=W,z[M]=G,M=F;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var W=z[0],M=z.pop();if(M!==W){z[0]=M;e:for(var F=0,G=z.length,H=G>>>1;F<H;){var Q=2*(F+1)-1,te=z[Q],Z=Q+1,ae=z[Z];if(0>o(te,M))Z<G&&0>o(ae,te)?(z[F]=ae,z[Z]=M,F=Z):(z[F]=te,z[Q]=M,F=Q);else if(Z<G&&0>o(ae,M))z[F]=ae,z[Z]=M,F=Z;else break e}}return W}function o(z,W){var M=z.sortIndex-W.sortIndex;return M!==0?M:z.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var u=[],f=[],p=1,h=null,g=3,y=!1,k=!1,v=!1,b=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,N=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(z){for(var W=n(f);W!==null;){if(W.callback===null)r(f);else if(W.startTime<=z)r(f),W.sortIndex=W.expirationTime,t(u,W);else break;W=n(f)}}function C(z){if(v=!1,S(z),!k)if(n(u)!==null)k=!0,B(D);else{var W=n(f);W!==null&&q(C,W.startTime-z)}}function D(z,W){k=!1,v&&(v=!1,j($),$=-1),y=!0;var M=g;try{for(S(W),h=n(u);h!==null&&(!(h.expirationTime>W)||z&&!I());){var F=h.callback;if(typeof F=="function"){h.callback=null,g=h.priorityLevel;var G=F(h.expirationTime<=W);W=e.unstable_now(),typeof G=="function"?h.callback=G:h===n(u)&&r(u),S(W)}else r(u);h=n(u)}if(h!==null)var H=!0;else{var Q=n(f);Q!==null&&q(C,Q.startTime-W),H=!1}return H}finally{h=null,g=M,y=!1}}var T=!1,R=null,$=-1,_=5,U=-1;function I(){return!(e.unstable_now()-U<_)}function V(){if(R!==null){var z=e.unstable_now();U=z;var W=!0;try{W=R(!0,z)}finally{W?O():(T=!1,R=null)}}else T=!1}var O;if(typeof N=="function")O=function(){N(V)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,L=P.port2;P.port1.onmessage=V,O=function(){L.postMessage(null)}}else O=function(){b(V,0)};function B(z){R=z,T||(T=!0,O())}function q(z,W){$=b(function(){z(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_continueExecution=function(){k||y||(k=!0,B(D))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(z){switch(g){case 1:case 2:case 3:var W=3;break;default:W=g}var M=g;g=W;try{return z()}finally{g=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,W){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var M=g;g=z;try{return W()}finally{g=M}},e.unstable_scheduleCallback=function(z,W,M){var F=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?F+M:F):M=F,z){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=M+G,z={id:p++,callback:W,priorityLevel:z,startTime:M,expirationTime:G,sortIndex:-1},M>F?(z.sortIndex=M,t(f,z),n(u)===null&&z===n(f)&&(v?(j($),$=-1):v=!0,q(C,M-F))):(z.sortIndex=G,t(u,z),k||y||(k=!0,B(D))),z},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(z){var W=g;return function(){var M=g;g=W;try{return z.apply(this,arguments)}finally{g=M}}}})(Fx)),Fx}var n1;function LI(){return n1||(n1=1,Ox.exports=MI()),Ox.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 r1;function OI(){if(r1)return pr;r1=1;var e=Sd(),t=LI();function n(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,x=1;x<arguments.length;x++)d+="&args[]="+encodeURIComponent(arguments[x]);return"Minified React error #"+c+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var r=new Set,o={};function i(c,d){a(c,d),a(c+"Capture",d)}function a(c,d){for(o[c]=d,c=0;c<d.length;c++)r.add(d[c])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),u=Object.prototype.hasOwnProperty,f=/^[: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]*$/,p={},h={};function g(c){return u.call(h,c)?!0:u.call(p,c)?!1:f.test(c)?h[c]=!0:(p[c]=!0,!1)}function y(c,d,x,w){if(x!==null&&x.type===0)return!1;switch(typeof d){case"function":case"symbol":return!0;case"boolean":return w?!1:x!==null?!x.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function k(c,d,x,w){if(d===null||typeof d>"u"||y(c,d,x,w))return!0;if(w)return!1;if(x!==null)switch(x.type){case 3:return!d;case 4:return d===!1;case 5:return isNaN(d);case 6:return isNaN(d)||1>d}return!1}function v(c,d,x,w,E,A,K){this.acceptsBooleans=d===2||d===3||d===4,this.attributeName=w,this.attributeNamespace=E,this.mustUseProperty=x,this.propertyName=c,this.type=d,this.sanitizeURL=A,this.removeEmptyString=K}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){b[c]=new v(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var d=c[0];b[d]=new v(d,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){b[c]=new v(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){b[c]=new v(c,2,!1,c,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(c){b[c]=new v(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){b[c]=new v(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){b[c]=new v(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){b[c]=new v(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){b[c]=new v(c,5,!1,c.toLowerCase(),null,!1,!1)});var j=/[\-:]([a-z])/g;function N(c){return c[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(c){var d=c.replace(j,N);b[d]=new v(d,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var d=c.replace(j,N);b[d]=new v(d,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var d=c.replace(j,N);b[d]=new v(d,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){b[c]=new v(c,1,!1,c.toLowerCase(),null,!1,!1)}),b.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){b[c]=new v(c,1,!1,c.toLowerCase(),null,!0,!0)});function S(c,d,x,w){var E=b.hasOwnProperty(d)?b[d]:null;(E!==null?E.type!==0:w||!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(k(d,x,E,w)&&(x=null),w||E===null?g(d)&&(x===null?c.removeAttribute(d):c.setAttribute(d,""+x)):E.mustUseProperty?c[E.propertyName]=x===null?E.type===3?!1:"":x:(d=E.attributeName,w=E.attributeNamespace,x===null?c.removeAttribute(d):(E=E.type,x=E===3||E===4&&x===!0?"":""+x,w?c.setAttributeNS(w,d,x):c.setAttribute(d,x))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,D=Symbol.for("react.element"),T=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),U=Symbol.for("react.provider"),I=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),z=Symbol.iterator;function W(c){return c===null||typeof c!="object"?null:(c=z&&c[z]||c["@@iterator"],typeof c=="function"?c:null)}var M=Object.assign,F;function G(c){if(F===void 0)try{throw Error()}catch(x){var d=x.stack.trim().match(/\n( *(at )?)/);F=d&&d[1]||""}return`
34
+ `+F+c}var H=!1;function Q(c,d){if(!c||H)return"";H=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(d)if(d=function(){throw Error()},Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(ge){var w=ge}Reflect.construct(c,[],d)}else{try{d.call()}catch(ge){w=ge}c.call(d.prototype)}else{try{throw Error()}catch(ge){w=ge}c()}}catch(ge){if(ge&&w&&typeof ge.stack=="string"){for(var E=ge.stack.split(`
35
+ `),A=w.stack.split(`
36
+ `),K=E.length-1,J=A.length-1;1<=K&&0<=J&&E[K]!==A[J];)J--;for(;1<=K&&0<=J;K--,J--)if(E[K]!==A[J]){if(K!==1||J!==1)do if(K--,J--,0>J||E[K]!==A[J]){var se=`
37
+ `+E[K].replace(" at new "," at ");return c.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",c.displayName)),se}while(1<=K&&0<=J);break}}}finally{H=!1,Error.prepareStackTrace=x}return(c=c?c.displayName||c.name:"")?G(c):""}function te(c){switch(c.tag){case 5:return G(c.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return c=Q(c.type,!1),c;case 11:return c=Q(c.type.render,!1),c;case 1:return c=Q(c.type,!0),c;default:return""}}function Z(c){if(c==null)return null;if(typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case R:return"Fragment";case T:return"Portal";case _:return"Profiler";case $:return"StrictMode";case O:return"Suspense";case P:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case I:return(c.displayName||"Context")+".Consumer";case U:return(c._context.displayName||"Context")+".Provider";case V:var d=c.render;return c=c.displayName,c||(c=d.displayName||d.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case L:return d=c.displayName||null,d!==null?d:Z(c.type)||"Memo";case B:d=c._payload,c=c._init;try{return Z(c(d))}catch{}}return null}function ae(c){var d=c.type;switch(c.tag){case 24:return"Cache";case 9:return(d.displayName||"Context")+".Consumer";case 10:return(d._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=d.render,c=c.displayName||c.name||"",d.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return d;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Z(d);case 8:return d===$?"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 d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d}return null}function ne(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function de(c){var d=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function ye(c){var d=de(c)?"checked":"value",x=Object.getOwnPropertyDescriptor(c.constructor.prototype,d),w=""+c[d];if(!c.hasOwnProperty(d)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var E=x.get,A=x.set;return Object.defineProperty(c,d,{configurable:!0,get:function(){return E.call(this)},set:function(K){w=""+K,A.call(this,K)}}),Object.defineProperty(c,d,{enumerable:x.enumerable}),{getValue:function(){return w},setValue:function(K){w=""+K},stopTracking:function(){c._valueTracker=null,delete c[d]}}}}function Se(c){c._valueTracker||(c._valueTracker=ye(c))}function Te(c){if(!c)return!1;var d=c._valueTracker;if(!d)return!0;var x=d.getValue(),w="";return c&&(w=de(c)?c.checked?"true":"false":c.value),c=w,c!==x?(d.setValue(c),!0):!1}function ke(c){if(c=c||(typeof document<"u"?document:void 0),typeof c>"u")return null;try{return c.activeElement||c.body}catch{return c.body}}function Fe(c,d){var x=d.checked;return M({},d,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??c._wrapperState.initialChecked})}function oe(c,d){var x=d.defaultValue==null?"":d.defaultValue,w=d.checked!=null?d.checked:d.defaultChecked;x=ne(d.value!=null?d.value:x),c._wrapperState={initialChecked:w,initialValue:x,controlled:d.type==="checkbox"||d.type==="radio"?d.checked!=null:d.value!=null}}function we(c,d){d=d.checked,d!=null&&S(c,"checked",d,!1)}function je(c,d){we(c,d);var x=ne(d.value),w=d.type;if(x!=null)w==="number"?(x===0&&c.value===""||c.value!=x)&&(c.value=""+x):c.value!==""+x&&(c.value=""+x);else if(w==="submit"||w==="reset"){c.removeAttribute("value");return}d.hasOwnProperty("value")?Be(c,d.type,x):d.hasOwnProperty("defaultValue")&&Be(c,d.type,ne(d.defaultValue)),d.checked==null&&d.defaultChecked!=null&&(c.defaultChecked=!!d.defaultChecked)}function De(c,d,x){if(d.hasOwnProperty("value")||d.hasOwnProperty("defaultValue")){var w=d.type;if(!(w!=="submit"&&w!=="reset"||d.value!==void 0&&d.value!==null))return;d=""+c._wrapperState.initialValue,x||d===c.value||(c.value=d),c.defaultValue=d}x=c.name,x!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,x!==""&&(c.name=x)}function Be(c,d,x){(d!=="number"||ke(c.ownerDocument)!==c)&&(x==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+x&&(c.defaultValue=""+x))}var tt=Array.isArray;function Ue(c,d,x,w){if(c=c.options,d){d={};for(var E=0;E<x.length;E++)d["$"+x[E]]=!0;for(x=0;x<c.length;x++)E=d.hasOwnProperty("$"+c[x].value),c[x].selected!==E&&(c[x].selected=E),E&&w&&(c[x].defaultSelected=!0)}else{for(x=""+ne(x),d=null,E=0;E<c.length;E++){if(c[E].value===x){c[E].selected=!0,w&&(c[E].defaultSelected=!0);return}d!==null||c[E].disabled||(d=c[E])}d!==null&&(d.selected=!0)}}function it(c,d){if(d.dangerouslySetInnerHTML!=null)throw Error(n(91));return M({},d,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function xt(c,d){var x=d.value;if(x==null){if(x=d.children,d=d.defaultValue,x!=null){if(d!=null)throw Error(n(92));if(tt(x)){if(1<x.length)throw Error(n(93));x=x[0]}d=x}d==null&&(d=""),x=d}c._wrapperState={initialValue:ne(x)}}function at(c,d){var x=ne(d.value),w=ne(d.defaultValue);x!=null&&(x=""+x,x!==c.value&&(c.value=x),d.defaultValue==null&&c.defaultValue!==x&&(c.defaultValue=x)),w!=null&&(c.defaultValue=""+w)}function st(c){var d=c.textContent;d===c._wrapperState.initialValue&&d!==""&&d!==null&&(c.value=d)}function ce(c){switch(c){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 xe(c,d){return c==null||c==="http://www.w3.org/1999/xhtml"?ce(d):c==="http://www.w3.org/2000/svg"&&d==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var Le,Ve=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(d,x,w,E){MSApp.execUnsafeLocalFunction(function(){return c(d,x,w,E)})}:c})(function(c,d){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=d;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+d.valueOf().toString()+"</svg>",d=Le.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;d.firstChild;)c.appendChild(d.firstChild)}});function Ke(c,d){if(d){var x=c.firstChild;if(x&&x===c.lastChild&&x.nodeType===3){x.nodeValue=d;return}}c.textContent=d}var ct={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},le=["Webkit","ms","Moz","O"];Object.keys(ct).forEach(function(c){le.forEach(function(d){d=d+c.charAt(0).toUpperCase()+c.substring(1),ct[d]=ct[c]})});function re(c,d,x){return d==null||typeof d=="boolean"||d===""?"":x||typeof d!="number"||d===0||ct.hasOwnProperty(c)&&ct[c]?(""+d).trim():d+"px"}function pe(c,d){c=c.style;for(var x in d)if(d.hasOwnProperty(x)){var w=x.indexOf("--")===0,E=re(x,d[x],w);x==="float"&&(x="cssFloat"),w?c.setProperty(x,E):c[x]=E}}var Re=M({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 We(c,d){if(d){if(Re[c]&&(d.children!=null||d.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(d.dangerouslySetInnerHTML!=null){if(d.children!=null)throw Error(n(60));if(typeof d.dangerouslySetInnerHTML!="object"||!("__html"in d.dangerouslySetInnerHTML))throw Error(n(61))}if(d.style!=null&&typeof d.style!="object")throw Error(n(62))}}function X(c,d){if(c.indexOf("-")===-1)return typeof d.is=="string";switch(c){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 be=null;function He(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var ft=null,Ze=null,yt=null;function mt(c){if(c=Yc(c)){if(typeof ft!="function")throw Error(n(280));var d=c.stateNode;d&&(d=ff(d),ft(c.stateNode,c.type,d))}}function me(c){Ze?yt?yt.push(c):yt=[c]:Ze=c}function Ce(){if(Ze){var c=Ze,d=yt;if(yt=Ze=null,mt(c),d)for(c=0;c<d.length;c++)mt(d[c])}}function Ge(c,d){return c(d)}function Ct(){}var Mt=!1;function Nn(c,d,x){if(Mt)return c(d,x);Mt=!0;try{return Ge(c,d,x)}finally{Mt=!1,(Ze!==null||yt!==null)&&(Ct(),Ce())}}function Et(c,d){var x=c.stateNode;if(x===null)return null;var w=ff(x);if(w===null)return null;x=w[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(c=c.type,w=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!w;break e;default:c=!1}if(c)return null;if(x&&typeof x!="function")throw Error(n(231,d,typeof x));return x}var Cn=!1;if(l)try{var Ft={};Object.defineProperty(Ft,"passive",{get:function(){Cn=!0}}),window.addEventListener("test",Ft,Ft),window.removeEventListener("test",Ft,Ft)}catch{Cn=!1}function En(c,d,x,w,E,A,K,J,se){var ge=Array.prototype.slice.call(arguments,3);try{d.apply(x,ge)}catch(Pe){this.onError(Pe)}}var en=!1,ue=null,Ee=!1,rt=null,Tn={onError:function(c){en=!0,ue=c}};function kr(c,d,x,w,E,A,K,J,se){en=!1,ue=null,En.apply(Tn,arguments)}function no(c,d,x,w,E,A,K,J,se){if(kr.apply(this,arguments),en){if(en){var ge=ue;en=!1,ue=null}else throw Error(n(198));Ee||(Ee=!0,rt=ge)}}function bt(c){var d=c,x=c;if(c.alternate)for(;d.return;)d=d.return;else{c=d;do d=c,(d.flags&4098)!==0&&(x=d.return),c=d.return;while(c)}return d.tag===3?x:null}function Pi(c){if(c.tag===13){var d=c.memoizedState;if(d===null&&(c=c.alternate,c!==null&&(d=c.memoizedState)),d!==null)return d.dehydrated}return null}function Do(c){if(bt(c)!==c)throw Error(n(188))}function _a(c){var d=c.alternate;if(!d){if(d=bt(c),d===null)throw Error(n(188));return d!==c?null:c}for(var x=c,w=d;;){var E=x.return;if(E===null)break;var A=E.alternate;if(A===null){if(w=E.return,w!==null){x=w;continue}break}if(E.child===A.child){for(A=E.child;A;){if(A===x)return Do(E),c;if(A===w)return Do(E),d;A=A.sibling}throw Error(n(188))}if(x.return!==w.return)x=E,w=A;else{for(var K=!1,J=E.child;J;){if(J===x){K=!0,x=E,w=A;break}if(J===w){K=!0,w=E,x=A;break}J=J.sibling}if(!K){for(J=A.child;J;){if(J===x){K=!0,x=A,w=E;break}if(J===w){K=!0,w=A,x=E;break}J=J.sibling}if(!K)throw Error(n(189))}}if(x.alternate!==w)throw Error(n(190))}if(x.tag!==3)throw Error(n(188));return x.stateNode.current===x?c:d}function tn(c){return c=_a(c),c!==null?$o(c):null}function $o(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var d=$o(c);if(d!==null)return d;c=c.sibling}return null}var Da=t.unstable_scheduleCallback,$a=t.unstable_cancelCallback,_c=t.unstable_shouldYield,Ia=t.unstable_requestPaint,Bt=t.unstable_now,_i=t.unstable_getCurrentPriorityLevel,ro=t.unstable_ImmediatePriority,Io=t.unstable_UserBlockingPriority,As=t.unstable_NormalPriority,Mo=t.unstable_LowPriority,Ma=t.unstable_IdlePriority,Lo=null,rr=null;function ar(c){if(rr&&typeof rr.onCommitFiberRoot=="function")try{rr.onCommitFiberRoot(Lo,c,void 0,(c.current.flags&128)===128)}catch{}}var On=Math.clz32?Math.clz32:$c,Oo=Math.log,Dc=Math.LN2;function $c(c){return c>>>=0,c===0?32:31-(Oo(c)/Dc|0)|0}var Fo=64,Vn=4194304;function so(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function Vr(c,d){var x=c.pendingLanes;if(x===0)return 0;var w=0,E=c.suspendedLanes,A=c.pingedLanes,K=x&268435455;if(K!==0){var J=K&~E;J!==0?w=so(J):(A&=K,A!==0&&(w=so(A)))}else K=x&~E,K!==0?w=so(K):A!==0&&(w=so(A));if(w===0)return 0;if(d!==0&&d!==w&&(d&E)===0&&(E=w&-w,A=d&-d,E>=A||E===16&&(A&4194240)!==0))return d;if((w&4)!==0&&(w|=x&16),d=c.entangledLanes,d!==0)for(c=c.entanglements,d&=w;0<d;)x=31-On(d),E=1<<x,w|=c[x],d&=~E;return w}function La(c,d){switch(c){case 1:case 2:case 4:return d+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 d+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 Di(c,d){for(var x=c.suspendedLanes,w=c.pingedLanes,E=c.expirationTimes,A=c.pendingLanes;0<A;){var K=31-On(A),J=1<<K,se=E[K];se===-1?((J&x)===0||(J&w)!==0)&&(E[K]=La(J,d)):se<=d&&(c.expiredLanes|=J),A&=~J}}function zo(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function Bo(){var c=Fo;return Fo<<=1,(Fo&4194240)===0&&(Fo=64),c}function Ps(c){for(var d=[],x=0;31>x;x++)d.push(c);return d}function zt(c,d,x){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-On(d),c[d]=x}function oo(c,d){var x=c.pendingLanes&~d;c.pendingLanes=d,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=d,c.mutableReadLanes&=d,c.entangledLanes&=d,d=c.entanglements;var w=c.eventTimes;for(c=c.expirationTimes;0<x;){var E=31-On(x),A=1<<E;d[E]=0,w[E]=-1,c[E]=-1,x&=~A}}function _s(c,d){var x=c.entangledLanes|=d;for(c=c.entanglements;x;){var w=31-On(x),E=1<<w;E&d|c[w]&d&&(c[w]|=d),x&=~E}}var Lt=0;function Jd(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Ic,$i,Mc,io,Lc,Oa=!1,Uo=[],Ds=null,$s=null,dn=null,Ii=new Map,ao=new Map,Is=[],ag="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 Zd(c,d){switch(c){case"focusin":case"focusout":Ds=null;break;case"dragenter":case"dragleave":$s=null;break;case"mouseover":case"mouseout":dn=null;break;case"pointerover":case"pointerout":Ii.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":ao.delete(d.pointerId)}}function Sr(c,d,x,w,E,A){return c===null||c.nativeEvent!==A?(c={blockedOn:d,domEventName:x,eventSystemFlags:w,nativeEvent:A,targetContainers:[E]},d!==null&&(d=Yc(d),d!==null&&$i(d)),c):(c.eventSystemFlags|=w,d=c.targetContainers,E!==null&&d.indexOf(E)===-1&&d.push(E),c)}function Y(c,d,x,w,E){switch(d){case"focusin":return Ds=Sr(Ds,c,d,x,w,E),!0;case"dragenter":return $s=Sr($s,c,d,x,w,E),!0;case"mouseover":return dn=Sr(dn,c,d,x,w,E),!0;case"pointerover":var A=E.pointerId;return Ii.set(A,Sr(Ii.get(A)||null,c,d,x,w,E)),!0;case"gotpointercapture":return A=E.pointerId,ao.set(A,Sr(ao.get(A)||null,c,d,x,w,E)),!0}return!1}function ee(c){var d=Li(c.target);if(d!==null){var x=bt(d);if(x!==null){if(d=x.tag,d===13){if(d=Pi(x),d!==null){c.blockedOn=d,Lc(c.priority,function(){Mc(x)});return}}else if(d===3&&x.stateNode.current.memoizedState.isDehydrated){c.blockedOn=x.tag===3?x.stateNode.containerInfo:null;return}}}c.blockedOn=null}function ve(c){if(c.blockedOn!==null)return!1;for(var d=c.targetContainers;0<d.length;){var x=Vo(c.domEventName,c.eventSystemFlags,d[0],c.nativeEvent);if(x===null){x=c.nativeEvent;var w=new x.constructor(x.type,x);be=w,x.target.dispatchEvent(w),be=null}else return d=Yc(x),d!==null&&$i(d),c.blockedOn=x,!1;d.shift()}return!0}function ze(c,d,x){ve(c)&&x.delete(d)}function gt(){Oa=!1,Ds!==null&&ve(Ds)&&(Ds=null),$s!==null&&ve($s)&&($s=null),dn!==null&&ve(dn)&&(dn=null),Ii.forEach(ze),ao.forEach(ze)}function St(c,d){c.blockedOn===d&&(c.blockedOn=null,Oa||(Oa=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,gt)))}function Pt(c){function d(E){return St(E,c)}if(0<Uo.length){St(Uo[0],c);for(var x=1;x<Uo.length;x++){var w=Uo[x];w.blockedOn===c&&(w.blockedOn=null)}}for(Ds!==null&&St(Ds,c),$s!==null&&St($s,c),dn!==null&&St(dn,c),Ii.forEach(d),ao.forEach(d),x=0;x<Is.length;x++)w=Is[x],w.blockedOn===c&&(w.blockedOn=null);for(;0<Is.length&&(x=Is[0],x.blockedOn===null);)ee(x),x.blockedOn===null&&Is.shift()}var Rn=C.ReactCurrentBatchConfig,Fn=!0;function An(c,d,x,w){var E=Lt,A=Rn.transition;Rn.transition=null;try{Lt=1,Ho(c,d,x,w)}finally{Lt=E,Rn.transition=A}}function Nr(c,d,x,w){var E=Lt,A=Rn.transition;Rn.transition=null;try{Lt=4,Ho(c,d,x,w)}finally{Lt=E,Rn.transition=A}}function Ho(c,d,x,w){if(Fn){var E=Vo(c,d,x,w);if(E===null)Sg(c,d,w,Mi,x),Zd(c,w);else if(Y(E,c,d,x,w))w.stopPropagation();else if(Zd(c,w),d&4&&-1<ag.indexOf(c)){for(;E!==null;){var A=Yc(E);if(A!==null&&Ic(A),A=Vo(c,d,x,w),A===null&&Sg(c,d,w,Mi,x),A===E)break;E=A}E!==null&&w.stopPropagation()}else Sg(c,d,w,null,x)}}var Mi=null;function Vo(c,d,x,w){if(Mi=null,c=He(w),c=Li(c),c!==null)if(d=bt(c),d===null)c=null;else if(x=d.tag,x===13){if(c=Pi(d),c!==null)return c;c=null}else if(x===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;c=null}else d!==c&&(c=null);return Mi=c,null}function os(c){switch(c){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(_i()){case ro:return 1;case Io:return 4;case As:case Mo:return 16;case Ma:return 536870912;default:return 16}default:return 16}}var Wo=null,lg=null,ef=null;function O0(){if(ef)return ef;var c,d=lg,x=d.length,w,E="value"in Wo?Wo.value:Wo.textContent,A=E.length;for(c=0;c<x&&d[c]===E[c];c++);var K=x-c;for(w=1;w<=K&&d[x-w]===E[A-w];w++);return ef=E.slice(c,1<w?1-w:void 0)}function tf(c){var d=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&d===13&&(c=13)):c=d,c===10&&(c=13),32<=c||c===13?c:0}function nf(){return!0}function F0(){return!1}function Cr(c){function d(x,w,E,A,K){this._reactName=x,this._targetInst=E,this.type=w,this.nativeEvent=A,this.target=K,this.currentTarget=null;for(var J in c)c.hasOwnProperty(J)&&(x=c[J],this[J]=x?x(A):A[J]);return this.isDefaultPrevented=(A.defaultPrevented!=null?A.defaultPrevented:A.returnValue===!1)?nf:F0,this.isPropagationStopped=F0,this}return M(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var x=this.nativeEvent;x&&(x.preventDefault?x.preventDefault():typeof x.returnValue!="unknown"&&(x.returnValue=!1),this.isDefaultPrevented=nf)},stopPropagation:function(){var x=this.nativeEvent;x&&(x.stopPropagation?x.stopPropagation():typeof x.cancelBubble!="unknown"&&(x.cancelBubble=!0),this.isPropagationStopped=nf)},persist:function(){},isPersistent:nf}),d}var Fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cg=Cr(Fa),Oc=M({},Fa,{view:0,detail:0}),r$=Cr(Oc),ug,dg,Fc,rf=M({},Oc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pg,button:0,buttons:0,relatedTarget:function(c){return c.relatedTarget===void 0?c.fromElement===c.srcElement?c.toElement:c.fromElement:c.relatedTarget},movementX:function(c){return"movementX"in c?c.movementX:(c!==Fc&&(Fc&&c.type==="mousemove"?(ug=c.screenX-Fc.screenX,dg=c.screenY-Fc.screenY):dg=ug=0,Fc=c),ug)},movementY:function(c){return"movementY"in c?c.movementY:dg}}),z0=Cr(rf),s$=M({},rf,{dataTransfer:0}),o$=Cr(s$),i$=M({},Oc,{relatedTarget:0}),fg=Cr(i$),a$=M({},Fa,{animationName:0,elapsedTime:0,pseudoElement:0}),l$=Cr(a$),c$=M({},Fa,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),u$=Cr(c$),d$=M({},Fa,{data:0}),B0=Cr(d$),f$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},p$={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"},h$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m$(c){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(c):(c=h$[c])?!!d[c]:!1}function pg(){return m$}var g$=M({},Oc,{key:function(c){if(c.key){var d=f$[c.key]||c.key;if(d!=="Unidentified")return d}return c.type==="keypress"?(c=tf(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?p$[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pg,charCode:function(c){return c.type==="keypress"?tf(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?tf(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),x$=Cr(g$),y$=M({},rf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),U0=Cr(y$),b$=M({},Oc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pg}),v$=Cr(b$),w$=M({},Fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),j$=Cr(w$),k$=M({},rf,{deltaX:function(c){return"deltaX"in c?c.deltaX:"wheelDeltaX"in c?-c.wheelDeltaX:0},deltaY:function(c){return"deltaY"in c?c.deltaY:"wheelDeltaY"in c?-c.wheelDeltaY:"wheelDelta"in c?-c.wheelDelta:0},deltaZ:0,deltaMode:0}),S$=Cr(k$),N$=[9,13,27,32],hg=l&&"CompositionEvent"in window,zc=null;l&&"documentMode"in document&&(zc=document.documentMode);var C$=l&&"TextEvent"in window&&!zc,H0=l&&(!hg||zc&&8<zc&&11>=zc),V0=" ",W0=!1;function q0(c,d){switch(c){case"keyup":return N$.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function K0(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var za=!1;function E$(c,d){switch(c){case"compositionend":return K0(d);case"keypress":return d.which!==32?null:(W0=!0,V0);case"textInput":return c=d.data,c===V0&&W0?null:c;default:return null}}function T$(c,d){if(za)return c==="compositionend"||!hg&&q0(c,d)?(c=O0(),ef=lg=Wo=null,za=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1<d.char.length)return d.char;if(d.which)return String.fromCharCode(d.which)}return null;case"compositionend":return H0&&d.locale!=="ko"?null:d.data;default:return null}}var R$={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 G0(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d==="input"?!!R$[c.type]:d==="textarea"}function Y0(c,d,x,w){me(w),d=cf(d,"onChange"),0<d.length&&(x=new cg("onChange","change",null,x,w),c.push({event:x,listeners:d}))}var Bc=null,Uc=null;function A$(c){pj(c,0)}function sf(c){var d=Wa(c);if(Te(d))return c}function P$(c,d){if(c==="change")return d}var X0=!1;if(l){var mg;if(l){var gg="oninput"in document;if(!gg){var Q0=document.createElement("div");Q0.setAttribute("oninput","return;"),gg=typeof Q0.oninput=="function"}mg=gg}else mg=!1;X0=mg&&(!document.documentMode||9<document.documentMode)}function J0(){Bc&&(Bc.detachEvent("onpropertychange",Z0),Uc=Bc=null)}function Z0(c){if(c.propertyName==="value"&&sf(Uc)){var d=[];Y0(d,Uc,c,He(c)),Nn(A$,d)}}function _$(c,d,x){c==="focusin"?(J0(),Bc=d,Uc=x,Bc.attachEvent("onpropertychange",Z0)):c==="focusout"&&J0()}function D$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return sf(Uc)}function $$(c,d){if(c==="click")return sf(d)}function I$(c,d){if(c==="input"||c==="change")return sf(d)}function M$(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var is=typeof Object.is=="function"?Object.is:M$;function Hc(c,d){if(is(c,d))return!0;if(typeof c!="object"||c===null||typeof d!="object"||d===null)return!1;var x=Object.keys(c),w=Object.keys(d);if(x.length!==w.length)return!1;for(w=0;w<x.length;w++){var E=x[w];if(!u.call(d,E)||!is(c[E],d[E]))return!1}return!0}function ej(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function tj(c,d){var x=ej(c);c=0;for(var w;x;){if(x.nodeType===3){if(w=c+x.textContent.length,c<=d&&w>=d)return{node:x,offset:d-c};c=w}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=ej(x)}}function nj(c,d){return c&&d?c===d?!0:c&&c.nodeType===3?!1:d&&d.nodeType===3?nj(c,d.parentNode):"contains"in c?c.contains(d):c.compareDocumentPosition?!!(c.compareDocumentPosition(d)&16):!1:!1}function rj(){for(var c=window,d=ke();d instanceof c.HTMLIFrameElement;){try{var x=typeof d.contentWindow.location.href=="string"}catch{x=!1}if(x)c=d.contentWindow;else break;d=ke(c.document)}return d}function xg(c){var d=c&&c.nodeName&&c.nodeName.toLowerCase();return d&&(d==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||d==="textarea"||c.contentEditable==="true")}function L$(c){var d=rj(),x=c.focusedElem,w=c.selectionRange;if(d!==x&&x&&x.ownerDocument&&nj(x.ownerDocument.documentElement,x)){if(w!==null&&xg(x)){if(d=w.start,c=w.end,c===void 0&&(c=d),"selectionStart"in x)x.selectionStart=d,x.selectionEnd=Math.min(c,x.value.length);else if(c=(d=x.ownerDocument||document)&&d.defaultView||window,c.getSelection){c=c.getSelection();var E=x.textContent.length,A=Math.min(w.start,E);w=w.end===void 0?A:Math.min(w.end,E),!c.extend&&A>w&&(E=w,w=A,A=E),E=tj(x,A);var K=tj(x,w);E&&K&&(c.rangeCount!==1||c.anchorNode!==E.node||c.anchorOffset!==E.offset||c.focusNode!==K.node||c.focusOffset!==K.offset)&&(d=d.createRange(),d.setStart(E.node,E.offset),c.removeAllRanges(),A>w?(c.addRange(d),c.extend(K.node,K.offset)):(d.setEnd(K.node,K.offset),c.addRange(d)))}}for(d=[],c=x;c=c.parentNode;)c.nodeType===1&&d.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<d.length;x++)c=d[x],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var O$=l&&"documentMode"in document&&11>=document.documentMode,Ba=null,yg=null,Vc=null,bg=!1;function sj(c,d,x){var w=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;bg||Ba==null||Ba!==ke(w)||(w=Ba,"selectionStart"in w&&xg(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Vc&&Hc(Vc,w)||(Vc=w,w=cf(yg,"onSelect"),0<w.length&&(d=new cg("onSelect","select",null,d,x),c.push({event:d,listeners:w}),d.target=Ba)))}function of(c,d){var x={};return x[c.toLowerCase()]=d.toLowerCase(),x["Webkit"+c]="webkit"+d,x["Moz"+c]="moz"+d,x}var Ua={animationend:of("Animation","AnimationEnd"),animationiteration:of("Animation","AnimationIteration"),animationstart:of("Animation","AnimationStart"),transitionend:of("Transition","TransitionEnd")},vg={},oj={};l&&(oj=document.createElement("div").style,"AnimationEvent"in window||(delete Ua.animationend.animation,delete Ua.animationiteration.animation,delete Ua.animationstart.animation),"TransitionEvent"in window||delete Ua.transitionend.transition);function af(c){if(vg[c])return vg[c];if(!Ua[c])return c;var d=Ua[c],x;for(x in d)if(d.hasOwnProperty(x)&&x in oj)return vg[c]=d[x];return c}var ij=af("animationend"),aj=af("animationiteration"),lj=af("animationstart"),cj=af("transitionend"),uj=new Map,dj="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 qo(c,d){uj.set(c,d),i(d,[c])}for(var wg=0;wg<dj.length;wg++){var jg=dj[wg],F$=jg.toLowerCase(),z$=jg[0].toUpperCase()+jg.slice(1);qo(F$,"on"+z$)}qo(ij,"onAnimationEnd"),qo(aj,"onAnimationIteration"),qo(lj,"onAnimationStart"),qo("dblclick","onDoubleClick"),qo("focusin","onFocus"),qo("focusout","onBlur"),qo(cj,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("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 Wc="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(" "),B$=new Set("cancel close invalid load scroll toggle".split(" ").concat(Wc));function fj(c,d,x){var w=c.type||"unknown-event";c.currentTarget=x,no(w,d,void 0,c),c.currentTarget=null}function pj(c,d){d=(d&4)!==0;for(var x=0;x<c.length;x++){var w=c[x],E=w.event;w=w.listeners;e:{var A=void 0;if(d)for(var K=w.length-1;0<=K;K--){var J=w[K],se=J.instance,ge=J.currentTarget;if(J=J.listener,se!==A&&E.isPropagationStopped())break e;fj(E,J,ge),A=se}else for(K=0;K<w.length;K++){if(J=w[K],se=J.instance,ge=J.currentTarget,J=J.listener,se!==A&&E.isPropagationStopped())break e;fj(E,J,ge),A=se}}}if(Ee)throw c=rt,Ee=!1,rt=null,c}function Gt(c,d){var x=d[Ag];x===void 0&&(x=d[Ag]=new Set);var w=c+"__bubble";x.has(w)||(hj(d,c,2,!1),x.add(w))}function kg(c,d,x){var w=0;d&&(w|=4),hj(x,c,w,d)}var lf="_reactListening"+Math.random().toString(36).slice(2);function qc(c){if(!c[lf]){c[lf]=!0,r.forEach(function(x){x!=="selectionchange"&&(B$.has(x)||kg(x,!1,c),kg(x,!0,c))});var d=c.nodeType===9?c:c.ownerDocument;d===null||d[lf]||(d[lf]=!0,kg("selectionchange",!1,d))}}function hj(c,d,x,w){switch(os(d)){case 1:var E=An;break;case 4:E=Nr;break;default:E=Ho}x=E.bind(null,d,x,c),E=void 0,!Cn||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(E=!0),w?E!==void 0?c.addEventListener(d,x,{capture:!0,passive:E}):c.addEventListener(d,x,!0):E!==void 0?c.addEventListener(d,x,{passive:E}):c.addEventListener(d,x,!1)}function Sg(c,d,x,w,E){var A=w;if((d&1)===0&&(d&2)===0&&w!==null)e:for(;;){if(w===null)return;var K=w.tag;if(K===3||K===4){var J=w.stateNode.containerInfo;if(J===E||J.nodeType===8&&J.parentNode===E)break;if(K===4)for(K=w.return;K!==null;){var se=K.tag;if((se===3||se===4)&&(se=K.stateNode.containerInfo,se===E||se.nodeType===8&&se.parentNode===E))return;K=K.return}for(;J!==null;){if(K=Li(J),K===null)return;if(se=K.tag,se===5||se===6){w=A=K;continue e}J=J.parentNode}}w=w.return}Nn(function(){var ge=A,Pe=He(x),_e=[];e:{var Ae=uj.get(c);if(Ae!==void 0){var Ye=cg,et=c;switch(c){case"keypress":if(tf(x)===0)break e;case"keydown":case"keyup":Ye=x$;break;case"focusin":et="focus",Ye=fg;break;case"focusout":et="blur",Ye=fg;break;case"beforeblur":case"afterblur":Ye=fg;break;case"click":if(x.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ye=z0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ye=o$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ye=v$;break;case ij:case aj:case lj:Ye=l$;break;case cj:Ye=j$;break;case"scroll":Ye=r$;break;case"wheel":Ye=S$;break;case"copy":case"cut":case"paste":Ye=u$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ye=U0}var nt=(d&4)!==0,fn=!nt&&c==="scroll",fe=nt?Ae!==null?Ae+"Capture":null:Ae;nt=[];for(var ie=ge,he;ie!==null;){he=ie;var Oe=he.stateNode;if(he.tag===5&&Oe!==null&&(he=Oe,fe!==null&&(Oe=Et(ie,fe),Oe!=null&&nt.push(Kc(ie,Oe,he)))),fn)break;ie=ie.return}0<nt.length&&(Ae=new Ye(Ae,et,null,x,Pe),_e.push({event:Ae,listeners:nt}))}}if((d&7)===0){e:{if(Ae=c==="mouseover"||c==="pointerover",Ye=c==="mouseout"||c==="pointerout",Ae&&x!==be&&(et=x.relatedTarget||x.fromElement)&&(Li(et)||et[lo]))break e;if((Ye||Ae)&&(Ae=Pe.window===Pe?Pe:(Ae=Pe.ownerDocument)?Ae.defaultView||Ae.parentWindow:window,Ye?(et=x.relatedTarget||x.toElement,Ye=ge,et=et?Li(et):null,et!==null&&(fn=bt(et),et!==fn||et.tag!==5&&et.tag!==6)&&(et=null)):(Ye=null,et=ge),Ye!==et)){if(nt=z0,Oe="onMouseLeave",fe="onMouseEnter",ie="mouse",(c==="pointerout"||c==="pointerover")&&(nt=U0,Oe="onPointerLeave",fe="onPointerEnter",ie="pointer"),fn=Ye==null?Ae:Wa(Ye),he=et==null?Ae:Wa(et),Ae=new nt(Oe,ie+"leave",Ye,x,Pe),Ae.target=fn,Ae.relatedTarget=he,Oe=null,Li(Pe)===ge&&(nt=new nt(fe,ie+"enter",et,x,Pe),nt.target=he,nt.relatedTarget=fn,Oe=nt),fn=Oe,Ye&&et)t:{for(nt=Ye,fe=et,ie=0,he=nt;he;he=Ha(he))ie++;for(he=0,Oe=fe;Oe;Oe=Ha(Oe))he++;for(;0<ie-he;)nt=Ha(nt),ie--;for(;0<he-ie;)fe=Ha(fe),he--;for(;ie--;){if(nt===fe||fe!==null&&nt===fe.alternate)break t;nt=Ha(nt),fe=Ha(fe)}nt=null}else nt=null;Ye!==null&&mj(_e,Ae,Ye,nt,!1),et!==null&&fn!==null&&mj(_e,fn,et,nt,!0)}}e:{if(Ae=ge?Wa(ge):window,Ye=Ae.nodeName&&Ae.nodeName.toLowerCase(),Ye==="select"||Ye==="input"&&Ae.type==="file")var ot=P$;else if(G0(Ae))if(X0)ot=I$;else{ot=D$;var ut=_$}else(Ye=Ae.nodeName)&&Ye.toLowerCase()==="input"&&(Ae.type==="checkbox"||Ae.type==="radio")&&(ot=$$);if(ot&&(ot=ot(c,ge))){Y0(_e,ot,x,Pe);break e}ut&&ut(c,Ae,ge),c==="focusout"&&(ut=Ae._wrapperState)&&ut.controlled&&Ae.type==="number"&&Be(Ae,"number",Ae.value)}switch(ut=ge?Wa(ge):window,c){case"focusin":(G0(ut)||ut.contentEditable==="true")&&(Ba=ut,yg=ge,Vc=null);break;case"focusout":Vc=yg=Ba=null;break;case"mousedown":bg=!0;break;case"contextmenu":case"mouseup":case"dragend":bg=!1,sj(_e,x,Pe);break;case"selectionchange":if(O$)break;case"keydown":case"keyup":sj(_e,x,Pe)}var dt;if(hg)e:{switch(c){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else za?q0(c,x)&&(pt="onCompositionEnd"):c==="keydown"&&x.keyCode===229&&(pt="onCompositionStart");pt&&(H0&&x.locale!=="ko"&&(za||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&za&&(dt=O0()):(Wo=Pe,lg="value"in Wo?Wo.value:Wo.textContent,za=!0)),ut=cf(ge,pt),0<ut.length&&(pt=new B0(pt,c,null,x,Pe),_e.push({event:pt,listeners:ut}),dt?pt.data=dt:(dt=K0(x),dt!==null&&(pt.data=dt)))),(dt=C$?E$(c,x):T$(c,x))&&(ge=cf(ge,"onBeforeInput"),0<ge.length&&(Pe=new B0("onBeforeInput","beforeinput",null,x,Pe),_e.push({event:Pe,listeners:ge}),Pe.data=dt))}pj(_e,d)})}function Kc(c,d,x){return{instance:c,listener:d,currentTarget:x}}function cf(c,d){for(var x=d+"Capture",w=[];c!==null;){var E=c,A=E.stateNode;E.tag===5&&A!==null&&(E=A,A=Et(c,x),A!=null&&w.unshift(Kc(c,A,E)),A=Et(c,d),A!=null&&w.push(Kc(c,A,E))),c=c.return}return w}function Ha(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function mj(c,d,x,w,E){for(var A=d._reactName,K=[];x!==null&&x!==w;){var J=x,se=J.alternate,ge=J.stateNode;if(se!==null&&se===w)break;J.tag===5&&ge!==null&&(J=ge,E?(se=Et(x,A),se!=null&&K.unshift(Kc(x,se,J))):E||(se=Et(x,A),se!=null&&K.push(Kc(x,se,J)))),x=x.return}K.length!==0&&c.push({event:d,listeners:K})}var U$=/\r\n?/g,H$=/\u0000|\uFFFD/g;function gj(c){return(typeof c=="string"?c:""+c).replace(U$,`
38
+ `).replace(H$,"")}function uf(c,d,x){if(d=gj(d),gj(c)!==d&&x)throw Error(n(425))}function df(){}var Ng=null,Cg=null;function Eg(c,d){return c==="textarea"||c==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.__html!=null}var Tg=typeof setTimeout=="function"?setTimeout:void 0,V$=typeof clearTimeout=="function"?clearTimeout:void 0,xj=typeof Promise=="function"?Promise:void 0,W$=typeof queueMicrotask=="function"?queueMicrotask:typeof xj<"u"?function(c){return xj.resolve(null).then(c).catch(q$)}:Tg;function q$(c){setTimeout(function(){throw c})}function Rg(c,d){var x=d,w=0;do{var E=x.nextSibling;if(c.removeChild(x),E&&E.nodeType===8)if(x=E.data,x==="/$"){if(w===0){c.removeChild(E),Pt(d);return}w--}else x!=="$"&&x!=="$?"&&x!=="$!"||w++;x=E}while(x);Pt(d)}function Ko(c){for(;c!=null;c=c.nextSibling){var d=c.nodeType;if(d===1||d===3)break;if(d===8){if(d=c.data,d==="$"||d==="$!"||d==="$?")break;if(d==="/$")return null}}return c}function yj(c){c=c.previousSibling;for(var d=0;c;){if(c.nodeType===8){var x=c.data;if(x==="$"||x==="$!"||x==="$?"){if(d===0)return c;d--}else x==="/$"&&d++}c=c.previousSibling}return null}var Va=Math.random().toString(36).slice(2),Ms="__reactFiber$"+Va,Gc="__reactProps$"+Va,lo="__reactContainer$"+Va,Ag="__reactEvents$"+Va,K$="__reactListeners$"+Va,G$="__reactHandles$"+Va;function Li(c){var d=c[Ms];if(d)return d;for(var x=c.parentNode;x;){if(d=x[lo]||x[Ms]){if(x=d.alternate,d.child!==null||x!==null&&x.child!==null)for(c=yj(c);c!==null;){if(x=c[Ms])return x;c=yj(c)}return d}c=x,x=c.parentNode}return null}function Yc(c){return c=c[Ms]||c[lo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function Wa(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function ff(c){return c[Gc]||null}var Pg=[],qa=-1;function Go(c){return{current:c}}function Yt(c){0>qa||(c.current=Pg[qa],Pg[qa]=null,qa--)}function Wt(c,d){qa++,Pg[qa]=c.current,c.current=d}var Yo={},Yn=Go(Yo),lr=Go(!1),Oi=Yo;function Ka(c,d){var x=c.type.contextTypes;if(!x)return Yo;var w=c.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===d)return w.__reactInternalMemoizedMaskedChildContext;var E={},A;for(A in x)E[A]=d[A];return w&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=d,c.__reactInternalMemoizedMaskedChildContext=E),E}function cr(c){return c=c.childContextTypes,c!=null}function pf(){Yt(lr),Yt(Yn)}function bj(c,d,x){if(Yn.current!==Yo)throw Error(n(168));Wt(Yn,d),Wt(lr,x)}function vj(c,d,x){var w=c.stateNode;if(d=d.childContextTypes,typeof w.getChildContext!="function")return x;w=w.getChildContext();for(var E in w)if(!(E in d))throw Error(n(108,ae(c)||"Unknown",E));return M({},x,w)}function hf(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Yo,Oi=Yn.current,Wt(Yn,c),Wt(lr,lr.current),!0}function wj(c,d,x){var w=c.stateNode;if(!w)throw Error(n(169));x?(c=vj(c,d,Oi),w.__reactInternalMemoizedMergedChildContext=c,Yt(lr),Yt(Yn),Wt(Yn,c)):Yt(lr),Wt(lr,x)}var co=null,mf=!1,_g=!1;function jj(c){co===null?co=[c]:co.push(c)}function Y$(c){mf=!0,jj(c)}function Xo(){if(!_g&&co!==null){_g=!0;var c=0,d=Lt;try{var x=co;for(Lt=1;c<x.length;c++){var w=x[c];do w=w(!0);while(w!==null)}co=null,mf=!1}catch(E){throw co!==null&&(co=co.slice(c+1)),Da(ro,Xo),E}finally{Lt=d,_g=!1}}return null}var Ga=[],Ya=0,gf=null,xf=0,Wr=[],qr=0,Fi=null,uo=1,fo="";function zi(c,d){Ga[Ya++]=xf,Ga[Ya++]=gf,gf=c,xf=d}function kj(c,d,x){Wr[qr++]=uo,Wr[qr++]=fo,Wr[qr++]=Fi,Fi=c;var w=uo;c=fo;var E=32-On(w)-1;w&=~(1<<E),x+=1;var A=32-On(d)+E;if(30<A){var K=E-E%5;A=(w&(1<<K)-1).toString(32),w>>=K,E-=K,uo=1<<32-On(d)+E|x<<E|w,fo=A+c}else uo=1<<A|x<<E|w,fo=c}function Dg(c){c.return!==null&&(zi(c,1),kj(c,1,0))}function $g(c){for(;c===gf;)gf=Ga[--Ya],Ga[Ya]=null,xf=Ga[--Ya],Ga[Ya]=null;for(;c===Fi;)Fi=Wr[--qr],Wr[qr]=null,fo=Wr[--qr],Wr[qr]=null,uo=Wr[--qr],Wr[qr]=null}var Er=null,Tr=null,nn=!1,as=null;function Sj(c,d){var x=Xr(5,null,null,0);x.elementType="DELETED",x.stateNode=d,x.return=c,d=c.deletions,d===null?(c.deletions=[x],c.flags|=16):d.push(x)}function Nj(c,d){switch(c.tag){case 5:var x=c.type;return d=d.nodeType!==1||x.toLowerCase()!==d.nodeName.toLowerCase()?null:d,d!==null?(c.stateNode=d,Er=c,Tr=Ko(d.firstChild),!0):!1;case 6:return d=c.pendingProps===""||d.nodeType!==3?null:d,d!==null?(c.stateNode=d,Er=c,Tr=null,!0):!1;case 13:return d=d.nodeType!==8?null:d,d!==null?(x=Fi!==null?{id:uo,overflow:fo}:null,c.memoizedState={dehydrated:d,treeContext:x,retryLane:1073741824},x=Xr(18,null,null,0),x.stateNode=d,x.return=c,c.child=x,Er=c,Tr=null,!0):!1;default:return!1}}function Ig(c){return(c.mode&1)!==0&&(c.flags&128)===0}function Mg(c){if(nn){var d=Tr;if(d){var x=d;if(!Nj(c,d)){if(Ig(c))throw Error(n(418));d=Ko(x.nextSibling);var w=Er;d&&Nj(c,d)?Sj(w,x):(c.flags=c.flags&-4097|2,nn=!1,Er=c)}}else{if(Ig(c))throw Error(n(418));c.flags=c.flags&-4097|2,nn=!1,Er=c}}}function Cj(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Er=c}function yf(c){if(c!==Er)return!1;if(!nn)return Cj(c),nn=!0,!1;var d;if((d=c.tag!==3)&&!(d=c.tag!==5)&&(d=c.type,d=d!=="head"&&d!=="body"&&!Eg(c.type,c.memoizedProps)),d&&(d=Tr)){if(Ig(c))throw Ej(),Error(n(418));for(;d;)Sj(c,d),d=Ko(d.nextSibling)}if(Cj(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));e:{for(c=c.nextSibling,d=0;c;){if(c.nodeType===8){var x=c.data;if(x==="/$"){if(d===0){Tr=Ko(c.nextSibling);break e}d--}else x!=="$"&&x!=="$!"&&x!=="$?"||d++}c=c.nextSibling}Tr=null}}else Tr=Er?Ko(c.stateNode.nextSibling):null;return!0}function Ej(){for(var c=Tr;c;)c=Ko(c.nextSibling)}function Xa(){Tr=Er=null,nn=!1}function Lg(c){as===null?as=[c]:as.push(c)}var X$=C.ReactCurrentBatchConfig;function Xc(c,d,x){if(c=x.ref,c!==null&&typeof c!="function"&&typeof c!="object"){if(x._owner){if(x=x._owner,x){if(x.tag!==1)throw Error(n(309));var w=x.stateNode}if(!w)throw Error(n(147,c));var E=w,A=""+c;return d!==null&&d.ref!==null&&typeof d.ref=="function"&&d.ref._stringRef===A?d.ref:(d=function(K){var J=E.refs;K===null?delete J[A]:J[A]=K},d._stringRef=A,d)}if(typeof c!="string")throw Error(n(284));if(!x._owner)throw Error(n(290,c))}return c}function bf(c,d){throw c=Object.prototype.toString.call(d),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":c))}function Tj(c){var d=c._init;return d(c._payload)}function Rj(c){function d(fe,ie){if(c){var he=fe.deletions;he===null?(fe.deletions=[ie],fe.flags|=16):he.push(ie)}}function x(fe,ie){if(!c)return null;for(;ie!==null;)d(fe,ie),ie=ie.sibling;return null}function w(fe,ie){for(fe=new Map;ie!==null;)ie.key!==null?fe.set(ie.key,ie):fe.set(ie.index,ie),ie=ie.sibling;return fe}function E(fe,ie){return fe=si(fe,ie),fe.index=0,fe.sibling=null,fe}function A(fe,ie,he){return fe.index=he,c?(he=fe.alternate,he!==null?(he=he.index,he<ie?(fe.flags|=2,ie):he):(fe.flags|=2,ie)):(fe.flags|=1048576,ie)}function K(fe){return c&&fe.alternate===null&&(fe.flags|=2),fe}function J(fe,ie,he,Oe){return ie===null||ie.tag!==6?(ie=Tx(he,fe.mode,Oe),ie.return=fe,ie):(ie=E(ie,he),ie.return=fe,ie)}function se(fe,ie,he,Oe){var ot=he.type;return ot===R?Pe(fe,ie,he.props.children,Oe,he.key):ie!==null&&(ie.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===B&&Tj(ot)===ie.type)?(Oe=E(ie,he.props),Oe.ref=Xc(fe,ie,he),Oe.return=fe,Oe):(Oe=Hf(he.type,he.key,he.props,null,fe.mode,Oe),Oe.ref=Xc(fe,ie,he),Oe.return=fe,Oe)}function ge(fe,ie,he,Oe){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==he.containerInfo||ie.stateNode.implementation!==he.implementation?(ie=Rx(he,fe.mode,Oe),ie.return=fe,ie):(ie=E(ie,he.children||[]),ie.return=fe,ie)}function Pe(fe,ie,he,Oe,ot){return ie===null||ie.tag!==7?(ie=Gi(he,fe.mode,Oe,ot),ie.return=fe,ie):(ie=E(ie,he),ie.return=fe,ie)}function _e(fe,ie,he){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ie=Tx(""+ie,fe.mode,he),ie.return=fe,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case D:return he=Hf(ie.type,ie.key,ie.props,null,fe.mode,he),he.ref=Xc(fe,null,ie),he.return=fe,he;case T:return ie=Rx(ie,fe.mode,he),ie.return=fe,ie;case B:var Oe=ie._init;return _e(fe,Oe(ie._payload),he)}if(tt(ie)||W(ie))return ie=Gi(ie,fe.mode,he,null),ie.return=fe,ie;bf(fe,ie)}return null}function Ae(fe,ie,he,Oe){var ot=ie!==null?ie.key:null;if(typeof he=="string"&&he!==""||typeof he=="number")return ot!==null?null:J(fe,ie,""+he,Oe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case D:return he.key===ot?se(fe,ie,he,Oe):null;case T:return he.key===ot?ge(fe,ie,he,Oe):null;case B:return ot=he._init,Ae(fe,ie,ot(he._payload),Oe)}if(tt(he)||W(he))return ot!==null?null:Pe(fe,ie,he,Oe,null);bf(fe,he)}return null}function Ye(fe,ie,he,Oe,ot){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number")return fe=fe.get(he)||null,J(ie,fe,""+Oe,ot);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case D:return fe=fe.get(Oe.key===null?he:Oe.key)||null,se(ie,fe,Oe,ot);case T:return fe=fe.get(Oe.key===null?he:Oe.key)||null,ge(ie,fe,Oe,ot);case B:var ut=Oe._init;return Ye(fe,ie,he,ut(Oe._payload),ot)}if(tt(Oe)||W(Oe))return fe=fe.get(he)||null,Pe(ie,fe,Oe,ot,null);bf(ie,Oe)}return null}function et(fe,ie,he,Oe){for(var ot=null,ut=null,dt=ie,pt=ie=0,Un=null;dt!==null&&pt<he.length;pt++){dt.index>pt?(Un=dt,dt=null):Un=dt.sibling;var Dt=Ae(fe,dt,he[pt],Oe);if(Dt===null){dt===null&&(dt=Un);break}c&&dt&&Dt.alternate===null&&d(fe,dt),ie=A(Dt,ie,pt),ut===null?ot=Dt:ut.sibling=Dt,ut=Dt,dt=Un}if(pt===he.length)return x(fe,dt),nn&&zi(fe,pt),ot;if(dt===null){for(;pt<he.length;pt++)dt=_e(fe,he[pt],Oe),dt!==null&&(ie=A(dt,ie,pt),ut===null?ot=dt:ut.sibling=dt,ut=dt);return nn&&zi(fe,pt),ot}for(dt=w(fe,dt);pt<he.length;pt++)Un=Ye(dt,fe,pt,he[pt],Oe),Un!==null&&(c&&Un.alternate!==null&&dt.delete(Un.key===null?pt:Un.key),ie=A(Un,ie,pt),ut===null?ot=Un:ut.sibling=Un,ut=Un);return c&&dt.forEach(function(oi){return d(fe,oi)}),nn&&zi(fe,pt),ot}function nt(fe,ie,he,Oe){var ot=W(he);if(typeof ot!="function")throw Error(n(150));if(he=ot.call(he),he==null)throw Error(n(151));for(var ut=ot=null,dt=ie,pt=ie=0,Un=null,Dt=he.next();dt!==null&&!Dt.done;pt++,Dt=he.next()){dt.index>pt?(Un=dt,dt=null):Un=dt.sibling;var oi=Ae(fe,dt,Dt.value,Oe);if(oi===null){dt===null&&(dt=Un);break}c&&dt&&oi.alternate===null&&d(fe,dt),ie=A(oi,ie,pt),ut===null?ot=oi:ut.sibling=oi,ut=oi,dt=Un}if(Dt.done)return x(fe,dt),nn&&zi(fe,pt),ot;if(dt===null){for(;!Dt.done;pt++,Dt=he.next())Dt=_e(fe,Dt.value,Oe),Dt!==null&&(ie=A(Dt,ie,pt),ut===null?ot=Dt:ut.sibling=Dt,ut=Dt);return nn&&zi(fe,pt),ot}for(dt=w(fe,dt);!Dt.done;pt++,Dt=he.next())Dt=Ye(dt,fe,pt,Dt.value,Oe),Dt!==null&&(c&&Dt.alternate!==null&&dt.delete(Dt.key===null?pt:Dt.key),ie=A(Dt,ie,pt),ut===null?ot=Dt:ut.sibling=Dt,ut=Dt);return c&&dt.forEach(function(RI){return d(fe,RI)}),nn&&zi(fe,pt),ot}function fn(fe,ie,he,Oe){if(typeof he=="object"&&he!==null&&he.type===R&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case D:e:{for(var ot=he.key,ut=ie;ut!==null;){if(ut.key===ot){if(ot=he.type,ot===R){if(ut.tag===7){x(fe,ut.sibling),ie=E(ut,he.props.children),ie.return=fe,fe=ie;break e}}else if(ut.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===B&&Tj(ot)===ut.type){x(fe,ut.sibling),ie=E(ut,he.props),ie.ref=Xc(fe,ut,he),ie.return=fe,fe=ie;break e}x(fe,ut);break}else d(fe,ut);ut=ut.sibling}he.type===R?(ie=Gi(he.props.children,fe.mode,Oe,he.key),ie.return=fe,fe=ie):(Oe=Hf(he.type,he.key,he.props,null,fe.mode,Oe),Oe.ref=Xc(fe,ie,he),Oe.return=fe,fe=Oe)}return K(fe);case T:e:{for(ut=he.key;ie!==null;){if(ie.key===ut)if(ie.tag===4&&ie.stateNode.containerInfo===he.containerInfo&&ie.stateNode.implementation===he.implementation){x(fe,ie.sibling),ie=E(ie,he.children||[]),ie.return=fe,fe=ie;break e}else{x(fe,ie);break}else d(fe,ie);ie=ie.sibling}ie=Rx(he,fe.mode,Oe),ie.return=fe,fe=ie}return K(fe);case B:return ut=he._init,fn(fe,ie,ut(he._payload),Oe)}if(tt(he))return et(fe,ie,he,Oe);if(W(he))return nt(fe,ie,he,Oe);bf(fe,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,ie!==null&&ie.tag===6?(x(fe,ie.sibling),ie=E(ie,he),ie.return=fe,fe=ie):(x(fe,ie),ie=Tx(he,fe.mode,Oe),ie.return=fe,fe=ie),K(fe)):x(fe,ie)}return fn}var Qa=Rj(!0),Aj=Rj(!1),vf=Go(null),wf=null,Ja=null,Og=null;function Fg(){Og=Ja=wf=null}function zg(c){var d=vf.current;Yt(vf),c._currentValue=d}function Bg(c,d,x){for(;c!==null;){var w=c.alternate;if((c.childLanes&d)!==d?(c.childLanes|=d,w!==null&&(w.childLanes|=d)):w!==null&&(w.childLanes&d)!==d&&(w.childLanes|=d),c===x)break;c=c.return}}function Za(c,d){wf=c,Og=Ja=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&d)!==0&&(ur=!0),c.firstContext=null)}function Kr(c){var d=c._currentValue;if(Og!==c)if(c={context:c,memoizedValue:d,next:null},Ja===null){if(wf===null)throw Error(n(308));Ja=c,wf.dependencies={lanes:0,firstContext:c}}else Ja=Ja.next=c;return d}var Bi=null;function Ug(c){Bi===null?Bi=[c]:Bi.push(c)}function Pj(c,d,x,w){var E=d.interleaved;return E===null?(x.next=x,Ug(d)):(x.next=E.next,E.next=x),d.interleaved=x,po(c,w)}function po(c,d){c.lanes|=d;var x=c.alternate;for(x!==null&&(x.lanes|=d),x=c,c=c.return;c!==null;)c.childLanes|=d,x=c.alternate,x!==null&&(x.childLanes|=d),x=c,c=c.return;return x.tag===3?x.stateNode:null}var Qo=!1;function Hg(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _j(c,d){c=c.updateQueue,d.updateQueue===c&&(d.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function ho(c,d){return{eventTime:c,lane:d,tag:0,payload:null,callback:null,next:null}}function Jo(c,d,x){var w=c.updateQueue;if(w===null)return null;if(w=w.shared,(_t&2)!==0){var E=w.pending;return E===null?d.next=d:(d.next=E.next,E.next=d),w.pending=d,po(c,x)}return E=w.interleaved,E===null?(d.next=d,Ug(w)):(d.next=E.next,E.next=d),w.interleaved=d,po(c,x)}function jf(c,d,x){if(d=d.updateQueue,d!==null&&(d=d.shared,(x&4194240)!==0)){var w=d.lanes;w&=c.pendingLanes,x|=w,d.lanes=x,_s(c,x)}}function Dj(c,d){var x=c.updateQueue,w=c.alternate;if(w!==null&&(w=w.updateQueue,x===w)){var E=null,A=null;if(x=x.firstBaseUpdate,x!==null){do{var K={eventTime:x.eventTime,lane:x.lane,tag:x.tag,payload:x.payload,callback:x.callback,next:null};A===null?E=A=K:A=A.next=K,x=x.next}while(x!==null);A===null?E=A=d:A=A.next=d}else E=A=d;x={baseState:w.baseState,firstBaseUpdate:E,lastBaseUpdate:A,shared:w.shared,effects:w.effects},c.updateQueue=x;return}c=x.lastBaseUpdate,c===null?x.firstBaseUpdate=d:c.next=d,x.lastBaseUpdate=d}function kf(c,d,x,w){var E=c.updateQueue;Qo=!1;var A=E.firstBaseUpdate,K=E.lastBaseUpdate,J=E.shared.pending;if(J!==null){E.shared.pending=null;var se=J,ge=se.next;se.next=null,K===null?A=ge:K.next=ge,K=se;var Pe=c.alternate;Pe!==null&&(Pe=Pe.updateQueue,J=Pe.lastBaseUpdate,J!==K&&(J===null?Pe.firstBaseUpdate=ge:J.next=ge,Pe.lastBaseUpdate=se))}if(A!==null){var _e=E.baseState;K=0,Pe=ge=se=null,J=A;do{var Ae=J.lane,Ye=J.eventTime;if((w&Ae)===Ae){Pe!==null&&(Pe=Pe.next={eventTime:Ye,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var et=c,nt=J;switch(Ae=d,Ye=x,nt.tag){case 1:if(et=nt.payload,typeof et=="function"){_e=et.call(Ye,_e,Ae);break e}_e=et;break e;case 3:et.flags=et.flags&-65537|128;case 0:if(et=nt.payload,Ae=typeof et=="function"?et.call(Ye,_e,Ae):et,Ae==null)break e;_e=M({},_e,Ae);break e;case 2:Qo=!0}}J.callback!==null&&J.lane!==0&&(c.flags|=64,Ae=E.effects,Ae===null?E.effects=[J]:Ae.push(J))}else Ye={eventTime:Ye,lane:Ae,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Pe===null?(ge=Pe=Ye,se=_e):Pe=Pe.next=Ye,K|=Ae;if(J=J.next,J===null){if(J=E.shared.pending,J===null)break;Ae=J,J=Ae.next,Ae.next=null,E.lastBaseUpdate=Ae,E.shared.pending=null}}while(!0);if(Pe===null&&(se=_e),E.baseState=se,E.firstBaseUpdate=ge,E.lastBaseUpdate=Pe,d=E.shared.interleaved,d!==null){E=d;do K|=E.lane,E=E.next;while(E!==d)}else A===null&&(E.shared.lanes=0);Vi|=K,c.lanes=K,c.memoizedState=_e}}function $j(c,d,x){if(c=d.effects,d.effects=null,c!==null)for(d=0;d<c.length;d++){var w=c[d],E=w.callback;if(E!==null){if(w.callback=null,w=x,typeof E!="function")throw Error(n(191,E));E.call(w)}}}var Qc={},Ls=Go(Qc),Jc=Go(Qc),Zc=Go(Qc);function Ui(c){if(c===Qc)throw Error(n(174));return c}function Vg(c,d){switch(Wt(Zc,d),Wt(Jc,c),Wt(Ls,Qc),c=d.nodeType,c){case 9:case 11:d=(d=d.documentElement)?d.namespaceURI:xe(null,"");break;default:c=c===8?d.parentNode:d,d=c.namespaceURI||null,c=c.tagName,d=xe(d,c)}Yt(Ls),Wt(Ls,d)}function el(){Yt(Ls),Yt(Jc),Yt(Zc)}function Ij(c){Ui(Zc.current);var d=Ui(Ls.current),x=xe(d,c.type);d!==x&&(Wt(Jc,c),Wt(Ls,x))}function Wg(c){Jc.current===c&&(Yt(Ls),Yt(Jc))}var an=Go(0);function Sf(c){for(var d=c;d!==null;){if(d.tag===13){var x=d.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||x.data==="$?"||x.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var qg=[];function Kg(){for(var c=0;c<qg.length;c++)qg[c]._workInProgressVersionPrimary=null;qg.length=0}var Nf=C.ReactCurrentDispatcher,Gg=C.ReactCurrentBatchConfig,Hi=0,ln=null,Pn=null,zn=null,Cf=!1,eu=!1,tu=0,Q$=0;function Xn(){throw Error(n(321))}function Yg(c,d){if(d===null)return!1;for(var x=0;x<d.length&&x<c.length;x++)if(!is(c[x],d[x]))return!1;return!0}function Xg(c,d,x,w,E,A){if(Hi=A,ln=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,Nf.current=c===null||c.memoizedState===null?tI:nI,c=x(w,E),eu){A=0;do{if(eu=!1,tu=0,25<=A)throw Error(n(301));A+=1,zn=Pn=null,d.updateQueue=null,Nf.current=rI,c=x(w,E)}while(eu)}if(Nf.current=Rf,d=Pn!==null&&Pn.next!==null,Hi=0,zn=Pn=ln=null,Cf=!1,d)throw Error(n(300));return c}function Qg(){var c=tu!==0;return tu=0,c}function Os(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?ln.memoizedState=zn=c:zn=zn.next=c,zn}function Gr(){if(Pn===null){var c=ln.alternate;c=c!==null?c.memoizedState:null}else c=Pn.next;var d=zn===null?ln.memoizedState:zn.next;if(d!==null)zn=d,Pn=c;else{if(c===null)throw Error(n(310));Pn=c,c={memoizedState:Pn.memoizedState,baseState:Pn.baseState,baseQueue:Pn.baseQueue,queue:Pn.queue,next:null},zn===null?ln.memoizedState=zn=c:zn=zn.next=c}return zn}function nu(c,d){return typeof d=="function"?d(c):d}function Jg(c){var d=Gr(),x=d.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var w=Pn,E=w.baseQueue,A=x.pending;if(A!==null){if(E!==null){var K=E.next;E.next=A.next,A.next=K}w.baseQueue=E=A,x.pending=null}if(E!==null){A=E.next,w=w.baseState;var J=K=null,se=null,ge=A;do{var Pe=ge.lane;if((Hi&Pe)===Pe)se!==null&&(se=se.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),w=ge.hasEagerState?ge.eagerState:c(w,ge.action);else{var _e={lane:Pe,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};se===null?(J=se=_e,K=w):se=se.next=_e,ln.lanes|=Pe,Vi|=Pe}ge=ge.next}while(ge!==null&&ge!==A);se===null?K=w:se.next=J,is(w,d.memoizedState)||(ur=!0),d.memoizedState=w,d.baseState=K,d.baseQueue=se,x.lastRenderedState=w}if(c=x.interleaved,c!==null){E=c;do A=E.lane,ln.lanes|=A,Vi|=A,E=E.next;while(E!==c)}else E===null&&(x.lanes=0);return[d.memoizedState,x.dispatch]}function Zg(c){var d=Gr(),x=d.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var w=x.dispatch,E=x.pending,A=d.memoizedState;if(E!==null){x.pending=null;var K=E=E.next;do A=c(A,K.action),K=K.next;while(K!==E);is(A,d.memoizedState)||(ur=!0),d.memoizedState=A,d.baseQueue===null&&(d.baseState=A),x.lastRenderedState=A}return[A,w]}function Mj(){}function Lj(c,d){var x=ln,w=Gr(),E=d(),A=!is(w.memoizedState,E);if(A&&(w.memoizedState=E,ur=!0),w=w.queue,ex(zj.bind(null,x,w,c),[c]),w.getSnapshot!==d||A||zn!==null&&zn.memoizedState.tag&1){if(x.flags|=2048,ru(9,Fj.bind(null,x,w,E,d),void 0,null),Bn===null)throw Error(n(349));(Hi&30)!==0||Oj(x,d,E)}return E}function Oj(c,d,x){c.flags|=16384,c={getSnapshot:d,value:x},d=ln.updateQueue,d===null?(d={lastEffect:null,stores:null},ln.updateQueue=d,d.stores=[c]):(x=d.stores,x===null?d.stores=[c]:x.push(c))}function Fj(c,d,x,w){d.value=x,d.getSnapshot=w,Bj(d)&&Uj(c)}function zj(c,d,x){return x(function(){Bj(d)&&Uj(c)})}function Bj(c){var d=c.getSnapshot;c=c.value;try{var x=d();return!is(c,x)}catch{return!0}}function Uj(c){var d=po(c,1);d!==null&&ds(d,c,1,-1)}function Hj(c){var d=Os();return typeof c=="function"&&(c=c()),d.memoizedState=d.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:nu,lastRenderedState:c},d.queue=c,c=c.dispatch=eI.bind(null,ln,c),[d.memoizedState,c]}function ru(c,d,x,w){return c={tag:c,create:d,destroy:x,deps:w,next:null},d=ln.updateQueue,d===null?(d={lastEffect:null,stores:null},ln.updateQueue=d,d.lastEffect=c.next=c):(x=d.lastEffect,x===null?d.lastEffect=c.next=c:(w=x.next,x.next=c,c.next=w,d.lastEffect=c)),c}function Vj(){return Gr().memoizedState}function Ef(c,d,x,w){var E=Os();ln.flags|=c,E.memoizedState=ru(1|d,x,void 0,w===void 0?null:w)}function Tf(c,d,x,w){var E=Gr();w=w===void 0?null:w;var A=void 0;if(Pn!==null){var K=Pn.memoizedState;if(A=K.destroy,w!==null&&Yg(w,K.deps)){E.memoizedState=ru(d,x,A,w);return}}ln.flags|=c,E.memoizedState=ru(1|d,x,A,w)}function Wj(c,d){return Ef(8390656,8,c,d)}function ex(c,d){return Tf(2048,8,c,d)}function qj(c,d){return Tf(4,2,c,d)}function Kj(c,d){return Tf(4,4,c,d)}function Gj(c,d){if(typeof d=="function")return c=c(),d(c),function(){d(null)};if(d!=null)return c=c(),d.current=c,function(){d.current=null}}function Yj(c,d,x){return x=x!=null?x.concat([c]):null,Tf(4,4,Gj.bind(null,d,c),x)}function tx(){}function Xj(c,d){var x=Gr();d=d===void 0?null:d;var w=x.memoizedState;return w!==null&&d!==null&&Yg(d,w[1])?w[0]:(x.memoizedState=[c,d],c)}function Qj(c,d){var x=Gr();d=d===void 0?null:d;var w=x.memoizedState;return w!==null&&d!==null&&Yg(d,w[1])?w[0]:(c=c(),x.memoizedState=[c,d],c)}function Jj(c,d,x){return(Hi&21)===0?(c.baseState&&(c.baseState=!1,ur=!0),c.memoizedState=x):(is(x,d)||(x=Bo(),ln.lanes|=x,Vi|=x,c.baseState=!0),d)}function J$(c,d){var x=Lt;Lt=x!==0&&4>x?x:4,c(!0);var w=Gg.transition;Gg.transition={};try{c(!1),d()}finally{Lt=x,Gg.transition=w}}function Zj(){return Gr().memoizedState}function Z$(c,d,x){var w=ni(c);if(x={lane:w,action:x,hasEagerState:!1,eagerState:null,next:null},ek(c))tk(d,x);else if(x=Pj(c,d,x,w),x!==null){var E=or();ds(x,c,w,E),nk(x,d,w)}}function eI(c,d,x){var w=ni(c),E={lane:w,action:x,hasEagerState:!1,eagerState:null,next:null};if(ek(c))tk(d,E);else{var A=c.alternate;if(c.lanes===0&&(A===null||A.lanes===0)&&(A=d.lastRenderedReducer,A!==null))try{var K=d.lastRenderedState,J=A(K,x);if(E.hasEagerState=!0,E.eagerState=J,is(J,K)){var se=d.interleaved;se===null?(E.next=E,Ug(d)):(E.next=se.next,se.next=E),d.interleaved=E;return}}catch{}finally{}x=Pj(c,d,E,w),x!==null&&(E=or(),ds(x,c,w,E),nk(x,d,w))}}function ek(c){var d=c.alternate;return c===ln||d!==null&&d===ln}function tk(c,d){eu=Cf=!0;var x=c.pending;x===null?d.next=d:(d.next=x.next,x.next=d),c.pending=d}function nk(c,d,x){if((x&4194240)!==0){var w=d.lanes;w&=c.pendingLanes,x|=w,d.lanes=x,_s(c,x)}}var Rf={readContext:Kr,useCallback:Xn,useContext:Xn,useEffect:Xn,useImperativeHandle:Xn,useInsertionEffect:Xn,useLayoutEffect:Xn,useMemo:Xn,useReducer:Xn,useRef:Xn,useState:Xn,useDebugValue:Xn,useDeferredValue:Xn,useTransition:Xn,useMutableSource:Xn,useSyncExternalStore:Xn,useId:Xn,unstable_isNewReconciler:!1},tI={readContext:Kr,useCallback:function(c,d){return Os().memoizedState=[c,d===void 0?null:d],c},useContext:Kr,useEffect:Wj,useImperativeHandle:function(c,d,x){return x=x!=null?x.concat([c]):null,Ef(4194308,4,Gj.bind(null,d,c),x)},useLayoutEffect:function(c,d){return Ef(4194308,4,c,d)},useInsertionEffect:function(c,d){return Ef(4,2,c,d)},useMemo:function(c,d){var x=Os();return d=d===void 0?null:d,c=c(),x.memoizedState=[c,d],c},useReducer:function(c,d,x){var w=Os();return d=x!==void 0?x(d):d,w.memoizedState=w.baseState=d,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:d},w.queue=c,c=c.dispatch=Z$.bind(null,ln,c),[w.memoizedState,c]},useRef:function(c){var d=Os();return c={current:c},d.memoizedState=c},useState:Hj,useDebugValue:tx,useDeferredValue:function(c){return Os().memoizedState=c},useTransition:function(){var c=Hj(!1),d=c[0];return c=J$.bind(null,c[1]),Os().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,x){var w=ln,E=Os();if(nn){if(x===void 0)throw Error(n(407));x=x()}else{if(x=d(),Bn===null)throw Error(n(349));(Hi&30)!==0||Oj(w,d,x)}E.memoizedState=x;var A={value:x,getSnapshot:d};return E.queue=A,Wj(zj.bind(null,w,A,c),[c]),w.flags|=2048,ru(9,Fj.bind(null,w,A,x,d),void 0,null),x},useId:function(){var c=Os(),d=Bn.identifierPrefix;if(nn){var x=fo,w=uo;x=(w&~(1<<32-On(w)-1)).toString(32)+x,d=":"+d+"R"+x,x=tu++,0<x&&(d+="H"+x.toString(32)),d+=":"}else x=Q$++,d=":"+d+"r"+x.toString(32)+":";return c.memoizedState=d},unstable_isNewReconciler:!1},nI={readContext:Kr,useCallback:Xj,useContext:Kr,useEffect:ex,useImperativeHandle:Yj,useInsertionEffect:qj,useLayoutEffect:Kj,useMemo:Qj,useReducer:Jg,useRef:Vj,useState:function(){return Jg(nu)},useDebugValue:tx,useDeferredValue:function(c){var d=Gr();return Jj(d,Pn.memoizedState,c)},useTransition:function(){var c=Jg(nu)[0],d=Gr().memoizedState;return[c,d]},useMutableSource:Mj,useSyncExternalStore:Lj,useId:Zj,unstable_isNewReconciler:!1},rI={readContext:Kr,useCallback:Xj,useContext:Kr,useEffect:ex,useImperativeHandle:Yj,useInsertionEffect:qj,useLayoutEffect:Kj,useMemo:Qj,useReducer:Zg,useRef:Vj,useState:function(){return Zg(nu)},useDebugValue:tx,useDeferredValue:function(c){var d=Gr();return Pn===null?d.memoizedState=c:Jj(d,Pn.memoizedState,c)},useTransition:function(){var c=Zg(nu)[0],d=Gr().memoizedState;return[c,d]},useMutableSource:Mj,useSyncExternalStore:Lj,useId:Zj,unstable_isNewReconciler:!1};function ls(c,d){if(c&&c.defaultProps){d=M({},d),c=c.defaultProps;for(var x in c)d[x]===void 0&&(d[x]=c[x]);return d}return d}function nx(c,d,x,w){d=c.memoizedState,x=x(w,d),x=x==null?d:M({},d,x),c.memoizedState=x,c.lanes===0&&(c.updateQueue.baseState=x)}var Af={isMounted:function(c){return(c=c._reactInternals)?bt(c)===c:!1},enqueueSetState:function(c,d,x){c=c._reactInternals;var w=or(),E=ni(c),A=ho(w,E);A.payload=d,x!=null&&(A.callback=x),d=Jo(c,A,E),d!==null&&(ds(d,c,E,w),jf(d,c,E))},enqueueReplaceState:function(c,d,x){c=c._reactInternals;var w=or(),E=ni(c),A=ho(w,E);A.tag=1,A.payload=d,x!=null&&(A.callback=x),d=Jo(c,A,E),d!==null&&(ds(d,c,E,w),jf(d,c,E))},enqueueForceUpdate:function(c,d){c=c._reactInternals;var x=or(),w=ni(c),E=ho(x,w);E.tag=2,d!=null&&(E.callback=d),d=Jo(c,E,w),d!==null&&(ds(d,c,w,x),jf(d,c,w))}};function rk(c,d,x,w,E,A,K){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(w,A,K):d.prototype&&d.prototype.isPureReactComponent?!Hc(x,w)||!Hc(E,A):!0}function sk(c,d,x){var w=!1,E=Yo,A=d.contextType;return typeof A=="object"&&A!==null?A=Kr(A):(E=cr(d)?Oi:Yn.current,w=d.contextTypes,A=(w=w!=null)?Ka(c,E):Yo),d=new d(x,A),c.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=Af,c.stateNode=d,d._reactInternals=c,w&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=A),d}function ok(c,d,x,w){c=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(x,w),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(x,w),d.state!==c&&Af.enqueueReplaceState(d,d.state,null)}function rx(c,d,x,w){var E=c.stateNode;E.props=x,E.state=c.memoizedState,E.refs={},Hg(c);var A=d.contextType;typeof A=="object"&&A!==null?E.context=Kr(A):(A=cr(d)?Oi:Yn.current,E.context=Ka(c,A)),E.state=c.memoizedState,A=d.getDerivedStateFromProps,typeof A=="function"&&(nx(c,d,A,x),E.state=c.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(d=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),d!==E.state&&Af.enqueueReplaceState(E,E.state,null),kf(c,x,E,w),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}function tl(c,d){try{var x="",w=d;do x+=te(w),w=w.return;while(w);var E=x}catch(A){E=`
39
+ Error generating stack: `+A.message+`
40
+ `+A.stack}return{value:c,source:d,stack:E,digest:null}}function sx(c,d,x){return{value:c,source:null,stack:x??null,digest:d??null}}function ox(c,d){try{console.error(d.value)}catch(x){setTimeout(function(){throw x})}}var sI=typeof WeakMap=="function"?WeakMap:Map;function ik(c,d,x){x=ho(-1,x),x.tag=3,x.payload={element:null};var w=d.value;return x.callback=function(){Lf||(Lf=!0,vx=w),ox(c,d)},x}function ak(c,d,x){x=ho(-1,x),x.tag=3;var w=c.type.getDerivedStateFromError;if(typeof w=="function"){var E=d.value;x.payload=function(){return w(E)},x.callback=function(){ox(c,d)}}var A=c.stateNode;return A!==null&&typeof A.componentDidCatch=="function"&&(x.callback=function(){ox(c,d),typeof w!="function"&&(ei===null?ei=new Set([this]):ei.add(this));var K=d.stack;this.componentDidCatch(d.value,{componentStack:K!==null?K:""})}),x}function lk(c,d,x){var w=c.pingCache;if(w===null){w=c.pingCache=new sI;var E=new Set;w.set(d,E)}else E=w.get(d),E===void 0&&(E=new Set,w.set(d,E));E.has(x)||(E.add(x),c=yI.bind(null,c,d,x),d.then(c,c))}function ck(c){do{var d;if((d=c.tag===13)&&(d=c.memoizedState,d=d!==null?d.dehydrated!==null:!0),d)return c;c=c.return}while(c!==null);return null}function uk(c,d,x,w,E){return(c.mode&1)===0?(c===d?c.flags|=65536:(c.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:(d=ho(-1,1),d.tag=2,Jo(x,d,1))),x.lanes|=1),c):(c.flags|=65536,c.lanes=E,c)}var oI=C.ReactCurrentOwner,ur=!1;function sr(c,d,x,w){d.child=c===null?Aj(d,null,x,w):Qa(d,c.child,x,w)}function dk(c,d,x,w,E){x=x.render;var A=d.ref;return Za(d,E),w=Xg(c,d,x,w,A,E),x=Qg(),c!==null&&!ur?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,mo(c,d,E)):(nn&&x&&Dg(d),d.flags|=1,sr(c,d,w,E),d.child)}function fk(c,d,x,w,E){if(c===null){var A=x.type;return typeof A=="function"&&!Ex(A)&&A.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(d.tag=15,d.type=A,pk(c,d,A,w,E)):(c=Hf(x.type,null,w,d,d.mode,E),c.ref=d.ref,c.return=d,d.child=c)}if(A=c.child,(c.lanes&E)===0){var K=A.memoizedProps;if(x=x.compare,x=x!==null?x:Hc,x(K,w)&&c.ref===d.ref)return mo(c,d,E)}return d.flags|=1,c=si(A,w),c.ref=d.ref,c.return=d,d.child=c}function pk(c,d,x,w,E){if(c!==null){var A=c.memoizedProps;if(Hc(A,w)&&c.ref===d.ref)if(ur=!1,d.pendingProps=w=A,(c.lanes&E)!==0)(c.flags&131072)!==0&&(ur=!0);else return d.lanes=c.lanes,mo(c,d,E)}return ix(c,d,x,w,E)}function hk(c,d,x){var w=d.pendingProps,E=w.children,A=c!==null?c.memoizedState:null;if(w.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null,transitions:null},Wt(rl,Rr),Rr|=x;else{if((x&1073741824)===0)return c=A!==null?A.baseLanes|x:x,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:c,cachePool:null,transitions:null},d.updateQueue=null,Wt(rl,Rr),Rr|=c,null;d.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=A!==null?A.baseLanes:x,Wt(rl,Rr),Rr|=w}else A!==null?(w=A.baseLanes|x,d.memoizedState=null):w=x,Wt(rl,Rr),Rr|=w;return sr(c,d,E,x),d.child}function mk(c,d){var x=d.ref;(c===null&&x!==null||c!==null&&c.ref!==x)&&(d.flags|=512,d.flags|=2097152)}function ix(c,d,x,w,E){var A=cr(x)?Oi:Yn.current;return A=Ka(d,A),Za(d,E),x=Xg(c,d,x,w,A,E),w=Qg(),c!==null&&!ur?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~E,mo(c,d,E)):(nn&&w&&Dg(d),d.flags|=1,sr(c,d,x,E),d.child)}function gk(c,d,x,w,E){if(cr(x)){var A=!0;hf(d)}else A=!1;if(Za(d,E),d.stateNode===null)_f(c,d),sk(d,x,w),rx(d,x,w,E),w=!0;else if(c===null){var K=d.stateNode,J=d.memoizedProps;K.props=J;var se=K.context,ge=x.contextType;typeof ge=="object"&&ge!==null?ge=Kr(ge):(ge=cr(x)?Oi:Yn.current,ge=Ka(d,ge));var Pe=x.getDerivedStateFromProps,_e=typeof Pe=="function"||typeof K.getSnapshotBeforeUpdate=="function";_e||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(J!==w||se!==ge)&&ok(d,K,w,ge),Qo=!1;var Ae=d.memoizedState;K.state=Ae,kf(d,w,K,E),se=d.memoizedState,J!==w||Ae!==se||lr.current||Qo?(typeof Pe=="function"&&(nx(d,x,Pe,w),se=d.memoizedState),(J=Qo||rk(d,x,J,w,Ae,se,ge))?(_e||typeof K.UNSAFE_componentWillMount!="function"&&typeof K.componentWillMount!="function"||(typeof K.componentWillMount=="function"&&K.componentWillMount(),typeof K.UNSAFE_componentWillMount=="function"&&K.UNSAFE_componentWillMount()),typeof K.componentDidMount=="function"&&(d.flags|=4194308)):(typeof K.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=w,d.memoizedState=se),K.props=w,K.state=se,K.context=ge,w=J):(typeof K.componentDidMount=="function"&&(d.flags|=4194308),w=!1)}else{K=d.stateNode,_j(c,d),J=d.memoizedProps,ge=d.type===d.elementType?J:ls(d.type,J),K.props=ge,_e=d.pendingProps,Ae=K.context,se=x.contextType,typeof se=="object"&&se!==null?se=Kr(se):(se=cr(x)?Oi:Yn.current,se=Ka(d,se));var Ye=x.getDerivedStateFromProps;(Pe=typeof Ye=="function"||typeof K.getSnapshotBeforeUpdate=="function")||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(J!==_e||Ae!==se)&&ok(d,K,w,se),Qo=!1,Ae=d.memoizedState,K.state=Ae,kf(d,w,K,E);var et=d.memoizedState;J!==_e||Ae!==et||lr.current||Qo?(typeof Ye=="function"&&(nx(d,x,Ye,w),et=d.memoizedState),(ge=Qo||rk(d,x,ge,w,Ae,et,se)||!1)?(Pe||typeof K.UNSAFE_componentWillUpdate!="function"&&typeof K.componentWillUpdate!="function"||(typeof K.componentWillUpdate=="function"&&K.componentWillUpdate(w,et,se),typeof K.UNSAFE_componentWillUpdate=="function"&&K.UNSAFE_componentWillUpdate(w,et,se)),typeof K.componentDidUpdate=="function"&&(d.flags|=4),typeof K.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof K.componentDidUpdate!="function"||J===c.memoizedProps&&Ae===c.memoizedState||(d.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||J===c.memoizedProps&&Ae===c.memoizedState||(d.flags|=1024),d.memoizedProps=w,d.memoizedState=et),K.props=w,K.state=et,K.context=se,w=ge):(typeof K.componentDidUpdate!="function"||J===c.memoizedProps&&Ae===c.memoizedState||(d.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||J===c.memoizedProps&&Ae===c.memoizedState||(d.flags|=1024),w=!1)}return ax(c,d,x,w,A,E)}function ax(c,d,x,w,E,A){mk(c,d);var K=(d.flags&128)!==0;if(!w&&!K)return E&&wj(d,x,!1),mo(c,d,A);w=d.stateNode,oI.current=d;var J=K&&typeof x.getDerivedStateFromError!="function"?null:w.render();return d.flags|=1,c!==null&&K?(d.child=Qa(d,c.child,null,A),d.child=Qa(d,null,J,A)):sr(c,d,J,A),d.memoizedState=w.state,E&&wj(d,x,!0),d.child}function xk(c){var d=c.stateNode;d.pendingContext?bj(c,d.pendingContext,d.pendingContext!==d.context):d.context&&bj(c,d.context,!1),Vg(c,d.containerInfo)}function yk(c,d,x,w,E){return Xa(),Lg(E),d.flags|=256,sr(c,d,x,w),d.child}var lx={dehydrated:null,treeContext:null,retryLane:0};function cx(c){return{baseLanes:c,cachePool:null,transitions:null}}function bk(c,d,x){var w=d.pendingProps,E=an.current,A=!1,K=(d.flags&128)!==0,J;if((J=K)||(J=c!==null&&c.memoizedState===null?!1:(E&2)!==0),J?(A=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),Wt(an,E&1),c===null)return Mg(d),c=d.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((d.mode&1)===0?d.lanes=1:c.data==="$!"?d.lanes=8:d.lanes=1073741824,null):(K=w.children,c=w.fallback,A?(w=d.mode,A=d.child,K={mode:"hidden",children:K},(w&1)===0&&A!==null?(A.childLanes=0,A.pendingProps=K):A=Vf(K,w,0,null),c=Gi(c,w,x,null),A.return=d,c.return=d,A.sibling=c,d.child=A,d.child.memoizedState=cx(x),d.memoizedState=lx,c):ux(d,K));if(E=c.memoizedState,E!==null&&(J=E.dehydrated,J!==null))return iI(c,d,K,w,J,E,x);if(A){A=w.fallback,K=d.mode,E=c.child,J=E.sibling;var se={mode:"hidden",children:w.children};return(K&1)===0&&d.child!==E?(w=d.child,w.childLanes=0,w.pendingProps=se,d.deletions=null):(w=si(E,se),w.subtreeFlags=E.subtreeFlags&14680064),J!==null?A=si(J,A):(A=Gi(A,K,x,null),A.flags|=2),A.return=d,w.return=d,w.sibling=A,d.child=w,w=A,A=d.child,K=c.child.memoizedState,K=K===null?cx(x):{baseLanes:K.baseLanes|x,cachePool:null,transitions:K.transitions},A.memoizedState=K,A.childLanes=c.childLanes&~x,d.memoizedState=lx,w}return A=c.child,c=A.sibling,w=si(A,{mode:"visible",children:w.children}),(d.mode&1)===0&&(w.lanes=x),w.return=d,w.sibling=null,c!==null&&(x=d.deletions,x===null?(d.deletions=[c],d.flags|=16):x.push(c)),d.child=w,d.memoizedState=null,w}function ux(c,d){return d=Vf({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function Pf(c,d,x,w){return w!==null&&Lg(w),Qa(d,c.child,null,x),c=ux(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function iI(c,d,x,w,E,A,K){if(x)return d.flags&256?(d.flags&=-257,w=sx(Error(n(422))),Pf(c,d,K,w)):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):(A=w.fallback,E=d.mode,w=Vf({mode:"visible",children:w.children},E,0,null),A=Gi(A,E,K,null),A.flags|=2,w.return=d,A.return=d,w.sibling=A,d.child=w,(d.mode&1)!==0&&Qa(d,c.child,null,K),d.child.memoizedState=cx(K),d.memoizedState=lx,A);if((d.mode&1)===0)return Pf(c,d,K,null);if(E.data==="$!"){if(w=E.nextSibling&&E.nextSibling.dataset,w)var J=w.dgst;return w=J,A=Error(n(419)),w=sx(A,w,void 0),Pf(c,d,K,w)}if(J=(K&c.childLanes)!==0,ur||J){if(w=Bn,w!==null){switch(K&-K){case 4:E=2;break;case 16:E=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:E=32;break;case 536870912:E=268435456;break;default:E=0}E=(E&(w.suspendedLanes|K))!==0?0:E,E!==0&&E!==A.retryLane&&(A.retryLane=E,po(c,E),ds(w,c,E,-1))}return Cx(),w=sx(Error(n(421))),Pf(c,d,K,w)}return E.data==="$?"?(d.flags|=128,d.child=c.child,d=bI.bind(null,c),E._reactRetry=d,null):(c=A.treeContext,Tr=Ko(E.nextSibling),Er=d,nn=!0,as=null,c!==null&&(Wr[qr++]=uo,Wr[qr++]=fo,Wr[qr++]=Fi,uo=c.id,fo=c.overflow,Fi=d),d=ux(d,w.children),d.flags|=4096,d)}function vk(c,d,x){c.lanes|=d;var w=c.alternate;w!==null&&(w.lanes|=d),Bg(c.return,d,x)}function dx(c,d,x,w,E){var A=c.memoizedState;A===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:w,tail:x,tailMode:E}:(A.isBackwards=d,A.rendering=null,A.renderingStartTime=0,A.last=w,A.tail=x,A.tailMode=E)}function wk(c,d,x){var w=d.pendingProps,E=w.revealOrder,A=w.tail;if(sr(c,d,w.children,x),w=an.current,(w&2)!==0)w=w&1|2,d.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=d.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&vk(c,x,d);else if(c.tag===19)vk(c,x,d);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===d)break e;for(;c.sibling===null;){if(c.return===null||c.return===d)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}w&=1}if(Wt(an,w),(d.mode&1)===0)d.memoizedState=null;else switch(E){case"forwards":for(x=d.child,E=null;x!==null;)c=x.alternate,c!==null&&Sf(c)===null&&(E=x),x=x.sibling;x=E,x===null?(E=d.child,d.child=null):(E=x.sibling,x.sibling=null),dx(d,!1,E,x,A);break;case"backwards":for(x=null,E=d.child,d.child=null;E!==null;){if(c=E.alternate,c!==null&&Sf(c)===null){d.child=E;break}c=E.sibling,E.sibling=x,x=E,E=c}dx(d,!0,x,null,A);break;case"together":dx(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function _f(c,d){(d.mode&1)===0&&c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2)}function mo(c,d,x){if(c!==null&&(d.dependencies=c.dependencies),Vi|=d.lanes,(x&d.childLanes)===0)return null;if(c!==null&&d.child!==c.child)throw Error(n(153));if(d.child!==null){for(c=d.child,x=si(c,c.pendingProps),d.child=x,x.return=d;c.sibling!==null;)c=c.sibling,x=x.sibling=si(c,c.pendingProps),x.return=d;x.sibling=null}return d.child}function aI(c,d,x){switch(d.tag){case 3:xk(d),Xa();break;case 5:Ij(d);break;case 1:cr(d.type)&&hf(d);break;case 4:Vg(d,d.stateNode.containerInfo);break;case 10:var w=d.type._context,E=d.memoizedProps.value;Wt(vf,w._currentValue),w._currentValue=E;break;case 13:if(w=d.memoizedState,w!==null)return w.dehydrated!==null?(Wt(an,an.current&1),d.flags|=128,null):(x&d.child.childLanes)!==0?bk(c,d,x):(Wt(an,an.current&1),c=mo(c,d,x),c!==null?c.sibling:null);Wt(an,an.current&1);break;case 19:if(w=(x&d.childLanes)!==0,(c.flags&128)!==0){if(w)return wk(c,d,x);d.flags|=128}if(E=d.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),Wt(an,an.current),w)break;return null;case 22:case 23:return d.lanes=0,hk(c,d,x)}return mo(c,d,x)}var jk,fx,kk,Sk;jk=function(c,d){for(var x=d.child;x!==null;){if(x.tag===5||x.tag===6)c.appendChild(x.stateNode);else if(x.tag!==4&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===d)break;for(;x.sibling===null;){if(x.return===null||x.return===d)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},fx=function(){},kk=function(c,d,x,w){var E=c.memoizedProps;if(E!==w){c=d.stateNode,Ui(Ls.current);var A=null;switch(x){case"input":E=Fe(c,E),w=Fe(c,w),A=[];break;case"select":E=M({},E,{value:void 0}),w=M({},w,{value:void 0}),A=[];break;case"textarea":E=it(c,E),w=it(c,w),A=[];break;default:typeof E.onClick!="function"&&typeof w.onClick=="function"&&(c.onclick=df)}We(x,w);var K;x=null;for(ge in E)if(!w.hasOwnProperty(ge)&&E.hasOwnProperty(ge)&&E[ge]!=null)if(ge==="style"){var J=E[ge];for(K in J)J.hasOwnProperty(K)&&(x||(x={}),x[K]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(o.hasOwnProperty(ge)?A||(A=[]):(A=A||[]).push(ge,null));for(ge in w){var se=w[ge];if(J=E!=null?E[ge]:void 0,w.hasOwnProperty(ge)&&se!==J&&(se!=null||J!=null))if(ge==="style")if(J){for(K in J)!J.hasOwnProperty(K)||se&&se.hasOwnProperty(K)||(x||(x={}),x[K]="");for(K in se)se.hasOwnProperty(K)&&J[K]!==se[K]&&(x||(x={}),x[K]=se[K])}else x||(A||(A=[]),A.push(ge,x)),x=se;else ge==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,J=J?J.__html:void 0,se!=null&&J!==se&&(A=A||[]).push(ge,se)):ge==="children"?typeof se!="string"&&typeof se!="number"||(A=A||[]).push(ge,""+se):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(o.hasOwnProperty(ge)?(se!=null&&ge==="onScroll"&&Gt("scroll",c),A||J===se||(A=[])):(A=A||[]).push(ge,se))}x&&(A=A||[]).push("style",x);var ge=A;(d.updateQueue=ge)&&(d.flags|=4)}},Sk=function(c,d,x,w){x!==w&&(d.flags|=4)};function su(c,d){if(!nn)switch(c.tailMode){case"hidden":d=c.tail;for(var x=null;d!==null;)d.alternate!==null&&(x=d),d=d.sibling;x===null?c.tail=null:x.sibling=null;break;case"collapsed":x=c.tail;for(var w=null;x!==null;)x.alternate!==null&&(w=x),x=x.sibling;w===null?d||c.tail===null?c.tail=null:c.tail.sibling=null:w.sibling=null}}function Qn(c){var d=c.alternate!==null&&c.alternate.child===c.child,x=0,w=0;if(d)for(var E=c.child;E!==null;)x|=E.lanes|E.childLanes,w|=E.subtreeFlags&14680064,w|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)x|=E.lanes|E.childLanes,w|=E.subtreeFlags,w|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=w,c.childLanes=x,d}function lI(c,d,x){var w=d.pendingProps;switch($g(d),d.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qn(d),null;case 1:return cr(d.type)&&pf(),Qn(d),null;case 3:return w=d.stateNode,el(),Yt(lr),Yt(Yn),Kg(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(c===null||c.child===null)&&(yf(d)?d.flags|=4:c===null||c.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,as!==null&&(kx(as),as=null))),fx(c,d),Qn(d),null;case 5:Wg(d);var E=Ui(Zc.current);if(x=d.type,c!==null&&d.stateNode!=null)kk(c,d,x,w,E),c.ref!==d.ref&&(d.flags|=512,d.flags|=2097152);else{if(!w){if(d.stateNode===null)throw Error(n(166));return Qn(d),null}if(c=Ui(Ls.current),yf(d)){w=d.stateNode,x=d.type;var A=d.memoizedProps;switch(w[Ms]=d,w[Gc]=A,c=(d.mode&1)!==0,x){case"dialog":Gt("cancel",w),Gt("close",w);break;case"iframe":case"object":case"embed":Gt("load",w);break;case"video":case"audio":for(E=0;E<Wc.length;E++)Gt(Wc[E],w);break;case"source":Gt("error",w);break;case"img":case"image":case"link":Gt("error",w),Gt("load",w);break;case"details":Gt("toggle",w);break;case"input":oe(w,A),Gt("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!A.multiple},Gt("invalid",w);break;case"textarea":xt(w,A),Gt("invalid",w)}We(x,A),E=null;for(var K in A)if(A.hasOwnProperty(K)){var J=A[K];K==="children"?typeof J=="string"?w.textContent!==J&&(A.suppressHydrationWarning!==!0&&uf(w.textContent,J,c),E=["children",J]):typeof J=="number"&&w.textContent!==""+J&&(A.suppressHydrationWarning!==!0&&uf(w.textContent,J,c),E=["children",""+J]):o.hasOwnProperty(K)&&J!=null&&K==="onScroll"&&Gt("scroll",w)}switch(x){case"input":Se(w),De(w,A,!0);break;case"textarea":Se(w),st(w);break;case"select":case"option":break;default:typeof A.onClick=="function"&&(w.onclick=df)}w=E,d.updateQueue=w,w!==null&&(d.flags|=4)}else{K=E.nodeType===9?E:E.ownerDocument,c==="http://www.w3.org/1999/xhtml"&&(c=ce(x)),c==="http://www.w3.org/1999/xhtml"?x==="script"?(c=K.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild)):typeof w.is=="string"?c=K.createElement(x,{is:w.is}):(c=K.createElement(x),x==="select"&&(K=c,w.multiple?K.multiple=!0:w.size&&(K.size=w.size))):c=K.createElementNS(c,x),c[Ms]=d,c[Gc]=w,jk(c,d,!1,!1),d.stateNode=c;e:{switch(K=X(x,w),x){case"dialog":Gt("cancel",c),Gt("close",c),E=w;break;case"iframe":case"object":case"embed":Gt("load",c),E=w;break;case"video":case"audio":for(E=0;E<Wc.length;E++)Gt(Wc[E],c);E=w;break;case"source":Gt("error",c),E=w;break;case"img":case"image":case"link":Gt("error",c),Gt("load",c),E=w;break;case"details":Gt("toggle",c),E=w;break;case"input":oe(c,w),E=Fe(c,w),Gt("invalid",c);break;case"option":E=w;break;case"select":c._wrapperState={wasMultiple:!!w.multiple},E=M({},w,{value:void 0}),Gt("invalid",c);break;case"textarea":xt(c,w),E=it(c,w),Gt("invalid",c);break;default:E=w}We(x,E),J=E;for(A in J)if(J.hasOwnProperty(A)){var se=J[A];A==="style"?pe(c,se):A==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,se!=null&&Ve(c,se)):A==="children"?typeof se=="string"?(x!=="textarea"||se!=="")&&Ke(c,se):typeof se=="number"&&Ke(c,""+se):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(o.hasOwnProperty(A)?se!=null&&A==="onScroll"&&Gt("scroll",c):se!=null&&S(c,A,se,K))}switch(x){case"input":Se(c),De(c,w,!1);break;case"textarea":Se(c),st(c);break;case"option":w.value!=null&&c.setAttribute("value",""+ne(w.value));break;case"select":c.multiple=!!w.multiple,A=w.value,A!=null?Ue(c,!!w.multiple,A,!1):w.defaultValue!=null&&Ue(c,!!w.multiple,w.defaultValue,!0);break;default:typeof E.onClick=="function"&&(c.onclick=df)}switch(x){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(d.flags|=4)}d.ref!==null&&(d.flags|=512,d.flags|=2097152)}return Qn(d),null;case 6:if(c&&d.stateNode!=null)Sk(c,d,c.memoizedProps,w);else{if(typeof w!="string"&&d.stateNode===null)throw Error(n(166));if(x=Ui(Zc.current),Ui(Ls.current),yf(d)){if(w=d.stateNode,x=d.memoizedProps,w[Ms]=d,(A=w.nodeValue!==x)&&(c=Er,c!==null))switch(c.tag){case 3:uf(w.nodeValue,x,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&uf(w.nodeValue,x,(c.mode&1)!==0)}A&&(d.flags|=4)}else w=(x.nodeType===9?x:x.ownerDocument).createTextNode(w),w[Ms]=d,d.stateNode=w}return Qn(d),null;case 13:if(Yt(an),w=d.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(nn&&Tr!==null&&(d.mode&1)!==0&&(d.flags&128)===0)Ej(),Xa(),d.flags|=98560,A=!1;else if(A=yf(d),w!==null&&w.dehydrated!==null){if(c===null){if(!A)throw Error(n(318));if(A=d.memoizedState,A=A!==null?A.dehydrated:null,!A)throw Error(n(317));A[Ms]=d}else Xa(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Qn(d),A=!1}else as!==null&&(kx(as),as=null),A=!0;if(!A)return d.flags&65536?d:null}return(d.flags&128)!==0?(d.lanes=x,d):(w=w!==null,w!==(c!==null&&c.memoizedState!==null)&&w&&(d.child.flags|=8192,(d.mode&1)!==0&&(c===null||(an.current&1)!==0?_n===0&&(_n=3):Cx())),d.updateQueue!==null&&(d.flags|=4),Qn(d),null);case 4:return el(),fx(c,d),c===null&&qc(d.stateNode.containerInfo),Qn(d),null;case 10:return zg(d.type._context),Qn(d),null;case 17:return cr(d.type)&&pf(),Qn(d),null;case 19:if(Yt(an),A=d.memoizedState,A===null)return Qn(d),null;if(w=(d.flags&128)!==0,K=A.rendering,K===null)if(w)su(A,!1);else{if(_n!==0||c!==null&&(c.flags&128)!==0)for(c=d.child;c!==null;){if(K=Sf(c),K!==null){for(d.flags|=128,su(A,!1),w=K.updateQueue,w!==null&&(d.updateQueue=w,d.flags|=4),d.subtreeFlags=0,w=x,x=d.child;x!==null;)A=x,c=w,A.flags&=14680066,K=A.alternate,K===null?(A.childLanes=0,A.lanes=c,A.child=null,A.subtreeFlags=0,A.memoizedProps=null,A.memoizedState=null,A.updateQueue=null,A.dependencies=null,A.stateNode=null):(A.childLanes=K.childLanes,A.lanes=K.lanes,A.child=K.child,A.subtreeFlags=0,A.deletions=null,A.memoizedProps=K.memoizedProps,A.memoizedState=K.memoizedState,A.updateQueue=K.updateQueue,A.type=K.type,c=K.dependencies,A.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),x=x.sibling;return Wt(an,an.current&1|2),d.child}c=c.sibling}A.tail!==null&&Bt()>sl&&(d.flags|=128,w=!0,su(A,!1),d.lanes=4194304)}else{if(!w)if(c=Sf(K),c!==null){if(d.flags|=128,w=!0,x=c.updateQueue,x!==null&&(d.updateQueue=x,d.flags|=4),su(A,!0),A.tail===null&&A.tailMode==="hidden"&&!K.alternate&&!nn)return Qn(d),null}else 2*Bt()-A.renderingStartTime>sl&&x!==1073741824&&(d.flags|=128,w=!0,su(A,!1),d.lanes=4194304);A.isBackwards?(K.sibling=d.child,d.child=K):(x=A.last,x!==null?x.sibling=K:d.child=K,A.last=K)}return A.tail!==null?(d=A.tail,A.rendering=d,A.tail=d.sibling,A.renderingStartTime=Bt(),d.sibling=null,x=an.current,Wt(an,w?x&1|2:x&1),d):(Qn(d),null);case 22:case 23:return Nx(),w=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==w&&(d.flags|=8192),w&&(d.mode&1)!==0?(Rr&1073741824)!==0&&(Qn(d),d.subtreeFlags&6&&(d.flags|=8192)):Qn(d),null;case 24:return null;case 25:return null}throw Error(n(156,d.tag))}function cI(c,d){switch($g(d),d.tag){case 1:return cr(d.type)&&pf(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return el(),Yt(lr),Yt(Yn),Kg(),c=d.flags,(c&65536)!==0&&(c&128)===0?(d.flags=c&-65537|128,d):null;case 5:return Wg(d),null;case 13:if(Yt(an),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(n(340));Xa()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return Yt(an),null;case 4:return el(),null;case 10:return zg(d.type._context),null;case 22:case 23:return Nx(),null;case 24:return null;default:return null}}var Df=!1,Jn=!1,uI=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function nl(c,d){var x=c.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(w){un(c,d,w)}else x.current=null}function px(c,d,x){try{x()}catch(w){un(c,d,w)}}var Nk=!1;function dI(c,d){if(Ng=Fn,c=rj(),xg(c)){if("selectionStart"in c)var x={start:c.selectionStart,end:c.selectionEnd};else e:{x=(x=c.ownerDocument)&&x.defaultView||window;var w=x.getSelection&&x.getSelection();if(w&&w.rangeCount!==0){x=w.anchorNode;var E=w.anchorOffset,A=w.focusNode;w=w.focusOffset;try{x.nodeType,A.nodeType}catch{x=null;break e}var K=0,J=-1,se=-1,ge=0,Pe=0,_e=c,Ae=null;t:for(;;){for(var Ye;_e!==x||E!==0&&_e.nodeType!==3||(J=K+E),_e!==A||w!==0&&_e.nodeType!==3||(se=K+w),_e.nodeType===3&&(K+=_e.nodeValue.length),(Ye=_e.firstChild)!==null;)Ae=_e,_e=Ye;for(;;){if(_e===c)break t;if(Ae===x&&++ge===E&&(J=K),Ae===A&&++Pe===w&&(se=K),(Ye=_e.nextSibling)!==null)break;_e=Ae,Ae=_e.parentNode}_e=Ye}x=J===-1||se===-1?null:{start:J,end:se}}else x=null}x=x||{start:0,end:0}}else x=null;for(Cg={focusedElem:c,selectionRange:x},Fn=!1,Qe=d;Qe!==null;)if(d=Qe,c=d.child,(d.subtreeFlags&1028)!==0&&c!==null)c.return=d,Qe=c;else for(;Qe!==null;){d=Qe;try{var et=d.alternate;if((d.flags&1024)!==0)switch(d.tag){case 0:case 11:case 15:break;case 1:if(et!==null){var nt=et.memoizedProps,fn=et.memoizedState,fe=d.stateNode,ie=fe.getSnapshotBeforeUpdate(d.elementType===d.type?nt:ls(d.type,nt),fn);fe.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:var he=d.stateNode.containerInfo;he.nodeType===1?he.textContent="":he.nodeType===9&&he.documentElement&&he.removeChild(he.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Oe){un(d,d.return,Oe)}if(c=d.sibling,c!==null){c.return=d.return,Qe=c;break}Qe=d.return}return et=Nk,Nk=!1,et}function ou(c,d,x){var w=d.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var E=w=w.next;do{if((E.tag&c)===c){var A=E.destroy;E.destroy=void 0,A!==void 0&&px(d,x,A)}E=E.next}while(E!==w)}}function $f(c,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var x=d=d.next;do{if((x.tag&c)===c){var w=x.create;x.destroy=w()}x=x.next}while(x!==d)}}function hx(c){var d=c.ref;if(d!==null){var x=c.stateNode;switch(c.tag){case 5:c=x;break;default:c=x}typeof d=="function"?d(c):d.current=c}}function Ck(c){var d=c.alternate;d!==null&&(c.alternate=null,Ck(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&(delete d[Ms],delete d[Gc],delete d[Ag],delete d[K$],delete d[G$])),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function Ek(c){return c.tag===5||c.tag===3||c.tag===4}function Tk(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||Ek(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function mx(c,d,x){var w=c.tag;if(w===5||w===6)c=c.stateNode,d?x.nodeType===8?x.parentNode.insertBefore(c,d):x.insertBefore(c,d):(x.nodeType===8?(d=x.parentNode,d.insertBefore(c,x)):(d=x,d.appendChild(c)),x=x._reactRootContainer,x!=null||d.onclick!==null||(d.onclick=df));else if(w!==4&&(c=c.child,c!==null))for(mx(c,d,x),c=c.sibling;c!==null;)mx(c,d,x),c=c.sibling}function gx(c,d,x){var w=c.tag;if(w===5||w===6)c=c.stateNode,d?x.insertBefore(c,d):x.appendChild(c);else if(w!==4&&(c=c.child,c!==null))for(gx(c,d,x),c=c.sibling;c!==null;)gx(c,d,x),c=c.sibling}var Wn=null,cs=!1;function Zo(c,d,x){for(x=x.child;x!==null;)Rk(c,d,x),x=x.sibling}function Rk(c,d,x){if(rr&&typeof rr.onCommitFiberUnmount=="function")try{rr.onCommitFiberUnmount(Lo,x)}catch{}switch(x.tag){case 5:Jn||nl(x,d);case 6:var w=Wn,E=cs;Wn=null,Zo(c,d,x),Wn=w,cs=E,Wn!==null&&(cs?(c=Wn,x=x.stateNode,c.nodeType===8?c.parentNode.removeChild(x):c.removeChild(x)):Wn.removeChild(x.stateNode));break;case 18:Wn!==null&&(cs?(c=Wn,x=x.stateNode,c.nodeType===8?Rg(c.parentNode,x):c.nodeType===1&&Rg(c,x),Pt(c)):Rg(Wn,x.stateNode));break;case 4:w=Wn,E=cs,Wn=x.stateNode.containerInfo,cs=!0,Zo(c,d,x),Wn=w,cs=E;break;case 0:case 11:case 14:case 15:if(!Jn&&(w=x.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){E=w=w.next;do{var A=E,K=A.destroy;A=A.tag,K!==void 0&&((A&2)!==0||(A&4)!==0)&&px(x,d,K),E=E.next}while(E!==w)}Zo(c,d,x);break;case 1:if(!Jn&&(nl(x,d),w=x.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=x.memoizedProps,w.state=x.memoizedState,w.componentWillUnmount()}catch(J){un(x,d,J)}Zo(c,d,x);break;case 21:Zo(c,d,x);break;case 22:x.mode&1?(Jn=(w=Jn)||x.memoizedState!==null,Zo(c,d,x),Jn=w):Zo(c,d,x);break;default:Zo(c,d,x)}}function Ak(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var x=c.stateNode;x===null&&(x=c.stateNode=new uI),d.forEach(function(w){var E=vI.bind(null,c,w);x.has(w)||(x.add(w),w.then(E,E))})}}function us(c,d){var x=d.deletions;if(x!==null)for(var w=0;w<x.length;w++){var E=x[w];try{var A=c,K=d,J=K;e:for(;J!==null;){switch(J.tag){case 5:Wn=J.stateNode,cs=!1;break e;case 3:Wn=J.stateNode.containerInfo,cs=!0;break e;case 4:Wn=J.stateNode.containerInfo,cs=!0;break e}J=J.return}if(Wn===null)throw Error(n(160));Rk(A,K,E),Wn=null,cs=!1;var se=E.alternate;se!==null&&(se.return=null),E.return=null}catch(ge){un(E,d,ge)}}if(d.subtreeFlags&12854)for(d=d.child;d!==null;)Pk(d,c),d=d.sibling}function Pk(c,d){var x=c.alternate,w=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(us(d,c),Fs(c),w&4){try{ou(3,c,c.return),$f(3,c)}catch(nt){un(c,c.return,nt)}try{ou(5,c,c.return)}catch(nt){un(c,c.return,nt)}}break;case 1:us(d,c),Fs(c),w&512&&x!==null&&nl(x,x.return);break;case 5:if(us(d,c),Fs(c),w&512&&x!==null&&nl(x,x.return),c.flags&32){var E=c.stateNode;try{Ke(E,"")}catch(nt){un(c,c.return,nt)}}if(w&4&&(E=c.stateNode,E!=null)){var A=c.memoizedProps,K=x!==null?x.memoizedProps:A,J=c.type,se=c.updateQueue;if(c.updateQueue=null,se!==null)try{J==="input"&&A.type==="radio"&&A.name!=null&&we(E,A),X(J,K);var ge=X(J,A);for(K=0;K<se.length;K+=2){var Pe=se[K],_e=se[K+1];Pe==="style"?pe(E,_e):Pe==="dangerouslySetInnerHTML"?Ve(E,_e):Pe==="children"?Ke(E,_e):S(E,Pe,_e,ge)}switch(J){case"input":je(E,A);break;case"textarea":at(E,A);break;case"select":var Ae=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!A.multiple;var Ye=A.value;Ye!=null?Ue(E,!!A.multiple,Ye,!1):Ae!==!!A.multiple&&(A.defaultValue!=null?Ue(E,!!A.multiple,A.defaultValue,!0):Ue(E,!!A.multiple,A.multiple?[]:"",!1))}E[Gc]=A}catch(nt){un(c,c.return,nt)}}break;case 6:if(us(d,c),Fs(c),w&4){if(c.stateNode===null)throw Error(n(162));E=c.stateNode,A=c.memoizedProps;try{E.nodeValue=A}catch(nt){un(c,c.return,nt)}}break;case 3:if(us(d,c),Fs(c),w&4&&x!==null&&x.memoizedState.isDehydrated)try{Pt(d.containerInfo)}catch(nt){un(c,c.return,nt)}break;case 4:us(d,c),Fs(c);break;case 13:us(d,c),Fs(c),E=c.child,E.flags&8192&&(A=E.memoizedState!==null,E.stateNode.isHidden=A,!A||E.alternate!==null&&E.alternate.memoizedState!==null||(bx=Bt())),w&4&&Ak(c);break;case 22:if(Pe=x!==null&&x.memoizedState!==null,c.mode&1?(Jn=(ge=Jn)||Pe,us(d,c),Jn=ge):us(d,c),Fs(c),w&8192){if(ge=c.memoizedState!==null,(c.stateNode.isHidden=ge)&&!Pe&&(c.mode&1)!==0)for(Qe=c,Pe=c.child;Pe!==null;){for(_e=Qe=Pe;Qe!==null;){switch(Ae=Qe,Ye=Ae.child,Ae.tag){case 0:case 11:case 14:case 15:ou(4,Ae,Ae.return);break;case 1:nl(Ae,Ae.return);var et=Ae.stateNode;if(typeof et.componentWillUnmount=="function"){w=Ae,x=Ae.return;try{d=w,et.props=d.memoizedProps,et.state=d.memoizedState,et.componentWillUnmount()}catch(nt){un(w,x,nt)}}break;case 5:nl(Ae,Ae.return);break;case 22:if(Ae.memoizedState!==null){$k(_e);continue}}Ye!==null?(Ye.return=Ae,Qe=Ye):$k(_e)}Pe=Pe.sibling}e:for(Pe=null,_e=c;;){if(_e.tag===5){if(Pe===null){Pe=_e;try{E=_e.stateNode,ge?(A=E.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none"):(J=_e.stateNode,se=_e.memoizedProps.style,K=se!=null&&se.hasOwnProperty("display")?se.display:null,J.style.display=re("display",K))}catch(nt){un(c,c.return,nt)}}}else if(_e.tag===6){if(Pe===null)try{_e.stateNode.nodeValue=ge?"":_e.memoizedProps}catch(nt){un(c,c.return,nt)}}else if((_e.tag!==22&&_e.tag!==23||_e.memoizedState===null||_e===c)&&_e.child!==null){_e.child.return=_e,_e=_e.child;continue}if(_e===c)break e;for(;_e.sibling===null;){if(_e.return===null||_e.return===c)break e;Pe===_e&&(Pe=null),_e=_e.return}Pe===_e&&(Pe=null),_e.sibling.return=_e.return,_e=_e.sibling}}break;case 19:us(d,c),Fs(c),w&4&&Ak(c);break;case 21:break;default:us(d,c),Fs(c)}}function Fs(c){var d=c.flags;if(d&2){try{e:{for(var x=c.return;x!==null;){if(Ek(x)){var w=x;break e}x=x.return}throw Error(n(160))}switch(w.tag){case 5:var E=w.stateNode;w.flags&32&&(Ke(E,""),w.flags&=-33);var A=Tk(c);gx(c,A,E);break;case 3:case 4:var K=w.stateNode.containerInfo,J=Tk(c);mx(c,J,K);break;default:throw Error(n(161))}}catch(se){un(c,c.return,se)}c.flags&=-3}d&4096&&(c.flags&=-4097)}function fI(c,d,x){Qe=c,_k(c)}function _k(c,d,x){for(var w=(c.mode&1)!==0;Qe!==null;){var E=Qe,A=E.child;if(E.tag===22&&w){var K=E.memoizedState!==null||Df;if(!K){var J=E.alternate,se=J!==null&&J.memoizedState!==null||Jn;J=Df;var ge=Jn;if(Df=K,(Jn=se)&&!ge)for(Qe=E;Qe!==null;)K=Qe,se=K.child,K.tag===22&&K.memoizedState!==null?Ik(E):se!==null?(se.return=K,Qe=se):Ik(E);for(;A!==null;)Qe=A,_k(A),A=A.sibling;Qe=E,Df=J,Jn=ge}Dk(c)}else(E.subtreeFlags&8772)!==0&&A!==null?(A.return=E,Qe=A):Dk(c)}}function Dk(c){for(;Qe!==null;){var d=Qe;if((d.flags&8772)!==0){var x=d.alternate;try{if((d.flags&8772)!==0)switch(d.tag){case 0:case 11:case 15:Jn||$f(5,d);break;case 1:var w=d.stateNode;if(d.flags&4&&!Jn)if(x===null)w.componentDidMount();else{var E=d.elementType===d.type?x.memoizedProps:ls(d.type,x.memoizedProps);w.componentDidUpdate(E,x.memoizedState,w.__reactInternalSnapshotBeforeUpdate)}var A=d.updateQueue;A!==null&&$j(d,A,w);break;case 3:var K=d.updateQueue;if(K!==null){if(x=null,d.child!==null)switch(d.child.tag){case 5:x=d.child.stateNode;break;case 1:x=d.child.stateNode}$j(d,K,x)}break;case 5:var J=d.stateNode;if(x===null&&d.flags&4){x=J;var se=d.memoizedProps;switch(d.type){case"button":case"input":case"select":case"textarea":se.autoFocus&&x.focus();break;case"img":se.src&&(x.src=se.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(d.memoizedState===null){var ge=d.alternate;if(ge!==null){var Pe=ge.memoizedState;if(Pe!==null){var _e=Pe.dehydrated;_e!==null&&Pt(_e)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Jn||d.flags&512&&hx(d)}catch(Ae){un(d,d.return,Ae)}}if(d===c){Qe=null;break}if(x=d.sibling,x!==null){x.return=d.return,Qe=x;break}Qe=d.return}}function $k(c){for(;Qe!==null;){var d=Qe;if(d===c){Qe=null;break}var x=d.sibling;if(x!==null){x.return=d.return,Qe=x;break}Qe=d.return}}function Ik(c){for(;Qe!==null;){var d=Qe;try{switch(d.tag){case 0:case 11:case 15:var x=d.return;try{$f(4,d)}catch(se){un(d,x,se)}break;case 1:var w=d.stateNode;if(typeof w.componentDidMount=="function"){var E=d.return;try{w.componentDidMount()}catch(se){un(d,E,se)}}var A=d.return;try{hx(d)}catch(se){un(d,A,se)}break;case 5:var K=d.return;try{hx(d)}catch(se){un(d,K,se)}}}catch(se){un(d,d.return,se)}if(d===c){Qe=null;break}var J=d.sibling;if(J!==null){J.return=d.return,Qe=J;break}Qe=d.return}}var pI=Math.ceil,If=C.ReactCurrentDispatcher,xx=C.ReactCurrentOwner,Yr=C.ReactCurrentBatchConfig,_t=0,Bn=null,hn=null,qn=0,Rr=0,rl=Go(0),_n=0,iu=null,Vi=0,Mf=0,yx=0,au=null,dr=null,bx=0,sl=1/0,go=null,Lf=!1,vx=null,ei=null,Of=!1,ti=null,Ff=0,lu=0,wx=null,zf=-1,Bf=0;function or(){return(_t&6)!==0?Bt():zf!==-1?zf:zf=Bt()}function ni(c){return(c.mode&1)===0?1:(_t&2)!==0&&qn!==0?qn&-qn:X$.transition!==null?(Bf===0&&(Bf=Bo()),Bf):(c=Lt,c!==0||(c=window.event,c=c===void 0?16:os(c.type)),c)}function ds(c,d,x,w){if(50<lu)throw lu=0,wx=null,Error(n(185));zt(c,x,w),((_t&2)===0||c!==Bn)&&(c===Bn&&((_t&2)===0&&(Mf|=x),_n===4&&ri(c,qn)),fr(c,w),x===1&&_t===0&&(d.mode&1)===0&&(sl=Bt()+500,mf&&Xo()))}function fr(c,d){var x=c.callbackNode;Di(c,d);var w=Vr(c,c===Bn?qn:0);if(w===0)x!==null&&$a(x),c.callbackNode=null,c.callbackPriority=0;else if(d=w&-w,c.callbackPriority!==d){if(x!=null&&$a(x),d===1)c.tag===0?Y$(Lk.bind(null,c)):jj(Lk.bind(null,c)),W$(function(){(_t&6)===0&&Xo()}),x=null;else{switch(Jd(w)){case 1:x=ro;break;case 4:x=Io;break;case 16:x=As;break;case 536870912:x=Ma;break;default:x=As}x=Wk(x,Mk.bind(null,c))}c.callbackPriority=d,c.callbackNode=x}}function Mk(c,d){if(zf=-1,Bf=0,(_t&6)!==0)throw Error(n(327));var x=c.callbackNode;if(ol()&&c.callbackNode!==x)return null;var w=Vr(c,c===Bn?qn:0);if(w===0)return null;if((w&30)!==0||(w&c.expiredLanes)!==0||d)d=Uf(c,w);else{d=w;var E=_t;_t|=2;var A=Fk();(Bn!==c||qn!==d)&&(go=null,sl=Bt()+500,qi(c,d));do try{gI();break}catch(J){Ok(c,J)}while(!0);Fg(),If.current=A,_t=E,hn!==null?d=0:(Bn=null,qn=0,d=_n)}if(d!==0){if(d===2&&(E=zo(c),E!==0&&(w=E,d=jx(c,E))),d===1)throw x=iu,qi(c,0),ri(c,w),fr(c,Bt()),x;if(d===6)ri(c,w);else{if(E=c.current.alternate,(w&30)===0&&!hI(E)&&(d=Uf(c,w),d===2&&(A=zo(c),A!==0&&(w=A,d=jx(c,A))),d===1))throw x=iu,qi(c,0),ri(c,w),fr(c,Bt()),x;switch(c.finishedWork=E,c.finishedLanes=w,d){case 0:case 1:throw Error(n(345));case 2:Ki(c,dr,go);break;case 3:if(ri(c,w),(w&130023424)===w&&(d=bx+500-Bt(),10<d)){if(Vr(c,0)!==0)break;if(E=c.suspendedLanes,(E&w)!==w){or(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=Tg(Ki.bind(null,c,dr,go),d);break}Ki(c,dr,go);break;case 4:if(ri(c,w),(w&4194240)===w)break;for(d=c.eventTimes,E=-1;0<w;){var K=31-On(w);A=1<<K,K=d[K],K>E&&(E=K),w&=~A}if(w=E,w=Bt()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*pI(w/1960))-w,10<w){c.timeoutHandle=Tg(Ki.bind(null,c,dr,go),w);break}Ki(c,dr,go);break;case 5:Ki(c,dr,go);break;default:throw Error(n(329))}}}return fr(c,Bt()),c.callbackNode===x?Mk.bind(null,c):null}function jx(c,d){var x=au;return c.current.memoizedState.isDehydrated&&(qi(c,d).flags|=256),c=Uf(c,d),c!==2&&(d=dr,dr=x,d!==null&&kx(d)),c}function kx(c){dr===null?dr=c:dr.push.apply(dr,c)}function hI(c){for(var d=c;;){if(d.flags&16384){var x=d.updateQueue;if(x!==null&&(x=x.stores,x!==null))for(var w=0;w<x.length;w++){var E=x[w],A=E.getSnapshot;E=E.value;try{if(!is(A(),E))return!1}catch{return!1}}}if(x=d.child,d.subtreeFlags&16384&&x!==null)x.return=d,d=x;else{if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function ri(c,d){for(d&=~yx,d&=~Mf,c.suspendedLanes|=d,c.pingedLanes&=~d,c=c.expirationTimes;0<d;){var x=31-On(d),w=1<<x;c[x]=-1,d&=~w}}function Lk(c){if((_t&6)!==0)throw Error(n(327));ol();var d=Vr(c,0);if((d&1)===0)return fr(c,Bt()),null;var x=Uf(c,d);if(c.tag!==0&&x===2){var w=zo(c);w!==0&&(d=w,x=jx(c,w))}if(x===1)throw x=iu,qi(c,0),ri(c,d),fr(c,Bt()),x;if(x===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=d,Ki(c,dr,go),fr(c,Bt()),null}function Sx(c,d){var x=_t;_t|=1;try{return c(d)}finally{_t=x,_t===0&&(sl=Bt()+500,mf&&Xo())}}function Wi(c){ti!==null&&ti.tag===0&&(_t&6)===0&&ol();var d=_t;_t|=1;var x=Yr.transition,w=Lt;try{if(Yr.transition=null,Lt=1,c)return c()}finally{Lt=w,Yr.transition=x,_t=d,(_t&6)===0&&Xo()}}function Nx(){Rr=rl.current,Yt(rl)}function qi(c,d){c.finishedWork=null,c.finishedLanes=0;var x=c.timeoutHandle;if(x!==-1&&(c.timeoutHandle=-1,V$(x)),hn!==null)for(x=hn.return;x!==null;){var w=x;switch($g(w),w.tag){case 1:w=w.type.childContextTypes,w!=null&&pf();break;case 3:el(),Yt(lr),Yt(Yn),Kg();break;case 5:Wg(w);break;case 4:el();break;case 13:Yt(an);break;case 19:Yt(an);break;case 10:zg(w.type._context);break;case 22:case 23:Nx()}x=x.return}if(Bn=c,hn=c=si(c.current,null),qn=Rr=d,_n=0,iu=null,yx=Mf=Vi=0,dr=au=null,Bi!==null){for(d=0;d<Bi.length;d++)if(x=Bi[d],w=x.interleaved,w!==null){x.interleaved=null;var E=w.next,A=x.pending;if(A!==null){var K=A.next;A.next=E,w.next=K}x.pending=w}Bi=null}return c}function Ok(c,d){do{var x=hn;try{if(Fg(),Nf.current=Rf,Cf){for(var w=ln.memoizedState;w!==null;){var E=w.queue;E!==null&&(E.pending=null),w=w.next}Cf=!1}if(Hi=0,zn=Pn=ln=null,eu=!1,tu=0,xx.current=null,x===null||x.return===null){_n=1,iu=d,hn=null;break}e:{var A=c,K=x.return,J=x,se=d;if(d=qn,J.flags|=32768,se!==null&&typeof se=="object"&&typeof se.then=="function"){var ge=se,Pe=J,_e=Pe.tag;if((Pe.mode&1)===0&&(_e===0||_e===11||_e===15)){var Ae=Pe.alternate;Ae?(Pe.updateQueue=Ae.updateQueue,Pe.memoizedState=Ae.memoizedState,Pe.lanes=Ae.lanes):(Pe.updateQueue=null,Pe.memoizedState=null)}var Ye=ck(K);if(Ye!==null){Ye.flags&=-257,uk(Ye,K,J,A,d),Ye.mode&1&&lk(A,ge,d),d=Ye,se=ge;var et=d.updateQueue;if(et===null){var nt=new Set;nt.add(se),d.updateQueue=nt}else et.add(se);break e}else{if((d&1)===0){lk(A,ge,d),Cx();break e}se=Error(n(426))}}else if(nn&&J.mode&1){var fn=ck(K);if(fn!==null){(fn.flags&65536)===0&&(fn.flags|=256),uk(fn,K,J,A,d),Lg(tl(se,J));break e}}A=se=tl(se,J),_n!==4&&(_n=2),au===null?au=[A]:au.push(A),A=K;do{switch(A.tag){case 3:A.flags|=65536,d&=-d,A.lanes|=d;var fe=ik(A,se,d);Dj(A,fe);break e;case 1:J=se;var ie=A.type,he=A.stateNode;if((A.flags&128)===0&&(typeof ie.getDerivedStateFromError=="function"||he!==null&&typeof he.componentDidCatch=="function"&&(ei===null||!ei.has(he)))){A.flags|=65536,d&=-d,A.lanes|=d;var Oe=ak(A,J,d);Dj(A,Oe);break e}}A=A.return}while(A!==null)}Bk(x)}catch(ot){d=ot,hn===x&&x!==null&&(hn=x=x.return);continue}break}while(!0)}function Fk(){var c=If.current;return If.current=Rf,c===null?Rf:c}function Cx(){(_n===0||_n===3||_n===2)&&(_n=4),Bn===null||(Vi&268435455)===0&&(Mf&268435455)===0||ri(Bn,qn)}function Uf(c,d){var x=_t;_t|=2;var w=Fk();(Bn!==c||qn!==d)&&(go=null,qi(c,d));do try{mI();break}catch(E){Ok(c,E)}while(!0);if(Fg(),_t=x,If.current=w,hn!==null)throw Error(n(261));return Bn=null,qn=0,_n}function mI(){for(;hn!==null;)zk(hn)}function gI(){for(;hn!==null&&!_c();)zk(hn)}function zk(c){var d=Vk(c.alternate,c,Rr);c.memoizedProps=c.pendingProps,d===null?Bk(c):hn=d,xx.current=null}function Bk(c){var d=c;do{var x=d.alternate;if(c=d.return,(d.flags&32768)===0){if(x=lI(x,d,Rr),x!==null){hn=x;return}}else{if(x=cI(x,d),x!==null){x.flags&=32767,hn=x;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{_n=6,hn=null;return}}if(d=d.sibling,d!==null){hn=d;return}hn=d=c}while(d!==null);_n===0&&(_n=5)}function Ki(c,d,x){var w=Lt,E=Yr.transition;try{Yr.transition=null,Lt=1,xI(c,d,x,w)}finally{Yr.transition=E,Lt=w}return null}function xI(c,d,x,w){do ol();while(ti!==null);if((_t&6)!==0)throw Error(n(327));x=c.finishedWork;var E=c.finishedLanes;if(x===null)return null;if(c.finishedWork=null,c.finishedLanes=0,x===c.current)throw Error(n(177));c.callbackNode=null,c.callbackPriority=0;var A=x.lanes|x.childLanes;if(oo(c,A),c===Bn&&(hn=Bn=null,qn=0),(x.subtreeFlags&2064)===0&&(x.flags&2064)===0||Of||(Of=!0,Wk(As,function(){return ol(),null})),A=(x.flags&15990)!==0,(x.subtreeFlags&15990)!==0||A){A=Yr.transition,Yr.transition=null;var K=Lt;Lt=1;var J=_t;_t|=4,xx.current=null,dI(c,x),Pk(x,c),L$(Cg),Fn=!!Ng,Cg=Ng=null,c.current=x,fI(x),Ia(),_t=J,Lt=K,Yr.transition=A}else c.current=x;if(Of&&(Of=!1,ti=c,Ff=E),A=c.pendingLanes,A===0&&(ei=null),ar(x.stateNode),fr(c,Bt()),d!==null)for(w=c.onRecoverableError,x=0;x<d.length;x++)E=d[x],w(E.value,{componentStack:E.stack,digest:E.digest});if(Lf)throw Lf=!1,c=vx,vx=null,c;return(Ff&1)!==0&&c.tag!==0&&ol(),A=c.pendingLanes,(A&1)!==0?c===wx?lu++:(lu=0,wx=c):lu=0,Xo(),null}function ol(){if(ti!==null){var c=Jd(Ff),d=Yr.transition,x=Lt;try{if(Yr.transition=null,Lt=16>c?16:c,ti===null)var w=!1;else{if(c=ti,ti=null,Ff=0,(_t&6)!==0)throw Error(n(331));var E=_t;for(_t|=4,Qe=c.current;Qe!==null;){var A=Qe,K=A.child;if((Qe.flags&16)!==0){var J=A.deletions;if(J!==null){for(var se=0;se<J.length;se++){var ge=J[se];for(Qe=ge;Qe!==null;){var Pe=Qe;switch(Pe.tag){case 0:case 11:case 15:ou(8,Pe,A)}var _e=Pe.child;if(_e!==null)_e.return=Pe,Qe=_e;else for(;Qe!==null;){Pe=Qe;var Ae=Pe.sibling,Ye=Pe.return;if(Ck(Pe),Pe===ge){Qe=null;break}if(Ae!==null){Ae.return=Ye,Qe=Ae;break}Qe=Ye}}}var et=A.alternate;if(et!==null){var nt=et.child;if(nt!==null){et.child=null;do{var fn=nt.sibling;nt.sibling=null,nt=fn}while(nt!==null)}}Qe=A}}if((A.subtreeFlags&2064)!==0&&K!==null)K.return=A,Qe=K;else e:for(;Qe!==null;){if(A=Qe,(A.flags&2048)!==0)switch(A.tag){case 0:case 11:case 15:ou(9,A,A.return)}var fe=A.sibling;if(fe!==null){fe.return=A.return,Qe=fe;break e}Qe=A.return}}var ie=c.current;for(Qe=ie;Qe!==null;){K=Qe;var he=K.child;if((K.subtreeFlags&2064)!==0&&he!==null)he.return=K,Qe=he;else e:for(K=ie;Qe!==null;){if(J=Qe,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:$f(9,J)}}catch(ot){un(J,J.return,ot)}if(J===K){Qe=null;break e}var Oe=J.sibling;if(Oe!==null){Oe.return=J.return,Qe=Oe;break e}Qe=J.return}}if(_t=E,Xo(),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot(Lo,c)}catch{}w=!0}return w}finally{Lt=x,Yr.transition=d}}return!1}function Uk(c,d,x){d=tl(x,d),d=ik(c,d,1),c=Jo(c,d,1),d=or(),c!==null&&(zt(c,1,d),fr(c,d))}function un(c,d,x){if(c.tag===3)Uk(c,c,x);else for(;d!==null;){if(d.tag===3){Uk(d,c,x);break}else if(d.tag===1){var w=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(ei===null||!ei.has(w))){c=tl(x,c),c=ak(d,c,1),d=Jo(d,c,1),c=or(),d!==null&&(zt(d,1,c),fr(d,c));break}}d=d.return}}function yI(c,d,x){var w=c.pingCache;w!==null&&w.delete(d),d=or(),c.pingedLanes|=c.suspendedLanes&x,Bn===c&&(qn&x)===x&&(_n===4||_n===3&&(qn&130023424)===qn&&500>Bt()-bx?qi(c,0):yx|=x),fr(c,d)}function Hk(c,d){d===0&&((c.mode&1)===0?d=1:(d=Vn,Vn<<=1,(Vn&130023424)===0&&(Vn=4194304)));var x=or();c=po(c,d),c!==null&&(zt(c,d,x),fr(c,x))}function bI(c){var d=c.memoizedState,x=0;d!==null&&(x=d.retryLane),Hk(c,x)}function vI(c,d){var x=0;switch(c.tag){case 13:var w=c.stateNode,E=c.memoizedState;E!==null&&(x=E.retryLane);break;case 19:w=c.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(d),Hk(c,x)}var Vk;Vk=function(c,d,x){if(c!==null)if(c.memoizedProps!==d.pendingProps||lr.current)ur=!0;else{if((c.lanes&x)===0&&(d.flags&128)===0)return ur=!1,aI(c,d,x);ur=(c.flags&131072)!==0}else ur=!1,nn&&(d.flags&1048576)!==0&&kj(d,xf,d.index);switch(d.lanes=0,d.tag){case 2:var w=d.type;_f(c,d),c=d.pendingProps;var E=Ka(d,Yn.current);Za(d,x),E=Xg(null,d,w,c,E,x);var A=Qg();return d.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,cr(w)?(A=!0,hf(d)):A=!1,d.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,Hg(d),E.updater=Af,d.stateNode=E,E._reactInternals=d,rx(d,w,c,x),d=ax(null,d,w,!0,A,x)):(d.tag=0,nn&&A&&Dg(d),sr(null,d,E,x),d=d.child),d;case 16:w=d.elementType;e:{switch(_f(c,d),c=d.pendingProps,E=w._init,w=E(w._payload),d.type=w,E=d.tag=jI(w),c=ls(w,c),E){case 0:d=ix(null,d,w,c,x);break e;case 1:d=gk(null,d,w,c,x);break e;case 11:d=dk(null,d,w,c,x);break e;case 14:d=fk(null,d,w,ls(w.type,c),x);break e}throw Error(n(306,w,""))}return d;case 0:return w=d.type,E=d.pendingProps,E=d.elementType===w?E:ls(w,E),ix(c,d,w,E,x);case 1:return w=d.type,E=d.pendingProps,E=d.elementType===w?E:ls(w,E),gk(c,d,w,E,x);case 3:e:{if(xk(d),c===null)throw Error(n(387));w=d.pendingProps,A=d.memoizedState,E=A.element,_j(c,d),kf(d,w,null,x);var K=d.memoizedState;if(w=K.element,A.isDehydrated)if(A={element:w,isDehydrated:!1,cache:K.cache,pendingSuspenseBoundaries:K.pendingSuspenseBoundaries,transitions:K.transitions},d.updateQueue.baseState=A,d.memoizedState=A,d.flags&256){E=tl(Error(n(423)),d),d=yk(c,d,w,x,E);break e}else if(w!==E){E=tl(Error(n(424)),d),d=yk(c,d,w,x,E);break e}else for(Tr=Ko(d.stateNode.containerInfo.firstChild),Er=d,nn=!0,as=null,x=Aj(d,null,w,x),d.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(Xa(),w===E){d=mo(c,d,x);break e}sr(c,d,w,x)}d=d.child}return d;case 5:return Ij(d),c===null&&Mg(d),w=d.type,E=d.pendingProps,A=c!==null?c.memoizedProps:null,K=E.children,Eg(w,E)?K=null:A!==null&&Eg(w,A)&&(d.flags|=32),mk(c,d),sr(c,d,K,x),d.child;case 6:return c===null&&Mg(d),null;case 13:return bk(c,d,x);case 4:return Vg(d,d.stateNode.containerInfo),w=d.pendingProps,c===null?d.child=Qa(d,null,w,x):sr(c,d,w,x),d.child;case 11:return w=d.type,E=d.pendingProps,E=d.elementType===w?E:ls(w,E),dk(c,d,w,E,x);case 7:return sr(c,d,d.pendingProps,x),d.child;case 8:return sr(c,d,d.pendingProps.children,x),d.child;case 12:return sr(c,d,d.pendingProps.children,x),d.child;case 10:e:{if(w=d.type._context,E=d.pendingProps,A=d.memoizedProps,K=E.value,Wt(vf,w._currentValue),w._currentValue=K,A!==null)if(is(A.value,K)){if(A.children===E.children&&!lr.current){d=mo(c,d,x);break e}}else for(A=d.child,A!==null&&(A.return=d);A!==null;){var J=A.dependencies;if(J!==null){K=A.child;for(var se=J.firstContext;se!==null;){if(se.context===w){if(A.tag===1){se=ho(-1,x&-x),se.tag=2;var ge=A.updateQueue;if(ge!==null){ge=ge.shared;var Pe=ge.pending;Pe===null?se.next=se:(se.next=Pe.next,Pe.next=se),ge.pending=se}}A.lanes|=x,se=A.alternate,se!==null&&(se.lanes|=x),Bg(A.return,x,d),J.lanes|=x;break}se=se.next}}else if(A.tag===10)K=A.type===d.type?null:A.child;else if(A.tag===18){if(K=A.return,K===null)throw Error(n(341));K.lanes|=x,J=K.alternate,J!==null&&(J.lanes|=x),Bg(K,x,d),K=A.sibling}else K=A.child;if(K!==null)K.return=A;else for(K=A;K!==null;){if(K===d){K=null;break}if(A=K.sibling,A!==null){A.return=K.return,K=A;break}K=K.return}A=K}sr(c,d,E.children,x),d=d.child}return d;case 9:return E=d.type,w=d.pendingProps.children,Za(d,x),E=Kr(E),w=w(E),d.flags|=1,sr(c,d,w,x),d.child;case 14:return w=d.type,E=ls(w,d.pendingProps),E=ls(w.type,E),fk(c,d,w,E,x);case 15:return pk(c,d,d.type,d.pendingProps,x);case 17:return w=d.type,E=d.pendingProps,E=d.elementType===w?E:ls(w,E),_f(c,d),d.tag=1,cr(w)?(c=!0,hf(d)):c=!1,Za(d,x),sk(d,w,E),rx(d,w,E,x),ax(null,d,w,!0,c,x);case 19:return wk(c,d,x);case 22:return hk(c,d,x)}throw Error(n(156,d.tag))};function Wk(c,d){return Da(c,d)}function wI(c,d,x,w){this.tag=c,this.key=x,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xr(c,d,x,w){return new wI(c,d,x,w)}function Ex(c){return c=c.prototype,!(!c||!c.isReactComponent)}function jI(c){if(typeof c=="function")return Ex(c)?1:0;if(c!=null){if(c=c.$$typeof,c===V)return 11;if(c===L)return 14}return 2}function si(c,d){var x=c.alternate;return x===null?(x=Xr(c.tag,d,c.key,c.mode),x.elementType=c.elementType,x.type=c.type,x.stateNode=c.stateNode,x.alternate=c,c.alternate=x):(x.pendingProps=d,x.type=c.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=c.flags&14680064,x.childLanes=c.childLanes,x.lanes=c.lanes,x.child=c.child,x.memoizedProps=c.memoizedProps,x.memoizedState=c.memoizedState,x.updateQueue=c.updateQueue,d=c.dependencies,x.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},x.sibling=c.sibling,x.index=c.index,x.ref=c.ref,x}function Hf(c,d,x,w,E,A){var K=2;if(w=c,typeof c=="function")Ex(c)&&(K=1);else if(typeof c=="string")K=5;else e:switch(c){case R:return Gi(x.children,E,A,d);case $:K=8,E|=8;break;case _:return c=Xr(12,x,d,E|2),c.elementType=_,c.lanes=A,c;case O:return c=Xr(13,x,d,E),c.elementType=O,c.lanes=A,c;case P:return c=Xr(19,x,d,E),c.elementType=P,c.lanes=A,c;case q:return Vf(x,E,A,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case U:K=10;break e;case I:K=9;break e;case V:K=11;break e;case L:K=14;break e;case B:K=16,w=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return d=Xr(K,x,d,E),d.elementType=c,d.type=w,d.lanes=A,d}function Gi(c,d,x,w){return c=Xr(7,c,w,d),c.lanes=x,c}function Vf(c,d,x,w){return c=Xr(22,c,w,d),c.elementType=q,c.lanes=x,c.stateNode={isHidden:!1},c}function Tx(c,d,x){return c=Xr(6,c,null,d),c.lanes=x,c}function Rx(c,d,x){return d=Xr(4,c.children!==null?c.children:[],c.key,d),d.lanes=x,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function kI(c,d,x,w,E){this.tag=d,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ps(0),this.expirationTimes=Ps(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ps(0),this.identifierPrefix=w,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Ax(c,d,x,w,E,A,K,J,se){return c=new kI(c,d,x,J,se),d===1?(d=1,A===!0&&(d|=8)):d=0,A=Xr(3,null,null,d),c.current=A,A.stateNode=c,A.memoizedState={element:w,isDehydrated:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hg(A),c}function SI(c,d,x){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:w==null?null:""+w,children:c,containerInfo:d,implementation:x}}function qk(c){if(!c)return Yo;c=c._reactInternals;e:{if(bt(c)!==c||c.tag!==1)throw Error(n(170));var d=c;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(cr(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(n(171))}if(c.tag===1){var x=c.type;if(cr(x))return vj(c,x,d)}return d}function Kk(c,d,x,w,E,A,K,J,se){return c=Ax(x,w,!0,c,E,A,K,J,se),c.context=qk(null),x=c.current,w=or(),E=ni(x),A=ho(w,E),A.callback=d??null,Jo(x,A,E),c.current.lanes=E,zt(c,E,w),fr(c,w),c}function Wf(c,d,x,w){var E=d.current,A=or(),K=ni(E);return x=qk(x),d.context===null?d.context=x:d.pendingContext=x,d=ho(A,K),d.payload={element:c},w=w===void 0?null:w,w!==null&&(d.callback=w),c=Jo(E,d,K),c!==null&&(ds(c,E,K,A),jf(c,E,K)),K}function qf(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return c.child.stateNode;default:return c.child.stateNode}}function Gk(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var x=c.retryLane;c.retryLane=x!==0&&x<d?x:d}}function Px(c,d){Gk(c,d),(c=c.alternate)&&Gk(c,d)}function NI(){return null}var Yk=typeof reportError=="function"?reportError:function(c){console.error(c)};function _x(c){this._internalRoot=c}Kf.prototype.render=_x.prototype.render=function(c){var d=this._internalRoot;if(d===null)throw Error(n(409));Wf(c,d,null,null)},Kf.prototype.unmount=_x.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var d=c.containerInfo;Wi(function(){Wf(null,c,null,null)}),d[lo]=null}};function Kf(c){this._internalRoot=c}Kf.prototype.unstable_scheduleHydration=function(c){if(c){var d=io();c={blockedOn:null,target:c,priority:d};for(var x=0;x<Is.length&&d!==0&&d<Is[x].priority;x++);Is.splice(x,0,c),x===0&&ee(c)}};function Dx(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function Gf(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function Xk(){}function CI(c,d,x,w,E){if(E){if(typeof w=="function"){var A=w;w=function(){var ge=qf(K);A.call(ge)}}var K=Kk(d,w,c,0,null,!1,!1,"",Xk);return c._reactRootContainer=K,c[lo]=K.current,qc(c.nodeType===8?c.parentNode:c),Wi(),K}for(;E=c.lastChild;)c.removeChild(E);if(typeof w=="function"){var J=w;w=function(){var ge=qf(se);J.call(ge)}}var se=Ax(c,0,!1,null,null,!1,!1,"",Xk);return c._reactRootContainer=se,c[lo]=se.current,qc(c.nodeType===8?c.parentNode:c),Wi(function(){Wf(d,se,x,w)}),se}function Yf(c,d,x,w,E){var A=x._reactRootContainer;if(A){var K=A;if(typeof E=="function"){var J=E;E=function(){var se=qf(K);J.call(se)}}Wf(d,K,c,E)}else K=CI(x,d,c,E,w);return qf(K)}Ic=function(c){switch(c.tag){case 3:var d=c.stateNode;if(d.current.memoizedState.isDehydrated){var x=so(d.pendingLanes);x!==0&&(_s(d,x|1),fr(d,Bt()),(_t&6)===0&&(sl=Bt()+500,Xo()))}break;case 13:Wi(function(){var w=po(c,1);if(w!==null){var E=or();ds(w,c,1,E)}}),Px(c,1)}},$i=function(c){if(c.tag===13){var d=po(c,134217728);if(d!==null){var x=or();ds(d,c,134217728,x)}Px(c,134217728)}},Mc=function(c){if(c.tag===13){var d=ni(c),x=po(c,d);if(x!==null){var w=or();ds(x,c,d,w)}Px(c,d)}},io=function(){return Lt},Lc=function(c,d){var x=Lt;try{return Lt=c,d()}finally{Lt=x}},ft=function(c,d,x){switch(d){case"input":if(je(c,x),d=x.name,x.type==="radio"&&d!=null){for(x=c;x.parentNode;)x=x.parentNode;for(x=x.querySelectorAll("input[name="+JSON.stringify(""+d)+'][type="radio"]'),d=0;d<x.length;d++){var w=x[d];if(w!==c&&w.form===c.form){var E=ff(w);if(!E)throw Error(n(90));Te(w),je(w,E)}}}break;case"textarea":at(c,x);break;case"select":d=x.value,d!=null&&Ue(c,!!x.multiple,d,!1)}},Ge=Sx,Ct=Wi;var EI={usingClientEntryPoint:!1,Events:[Yc,Wa,ff,me,Ce,Sx]},cu={findFiberByHostInstance:Li,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},TI={bundleType:cu.bundleType,version:cu.version,rendererPackageName:cu.rendererPackageName,rendererConfig:cu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(c){return c=tn(c),c===null?null:c.stateNode},findFiberByHostInstance:cu.findFiberByHostInstance||NI,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 Xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xf.isDisabled&&Xf.supportsFiber)try{Lo=Xf.inject(TI),rr=Xf}catch{}}return pr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=EI,pr.createPortal=function(c,d){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Dx(d))throw Error(n(200));return SI(c,d,null,x)},pr.createRoot=function(c,d){if(!Dx(c))throw Error(n(299));var x=!1,w="",E=Yk;return d!=null&&(d.unstable_strictMode===!0&&(x=!0),d.identifierPrefix!==void 0&&(w=d.identifierPrefix),d.onRecoverableError!==void 0&&(E=d.onRecoverableError)),d=Ax(c,1,!1,null,null,x,!1,w,E),c[lo]=d.current,qc(c.nodeType===8?c.parentNode:c),new _x(d)},pr.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var d=c._reactInternals;if(d===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=tn(d),c=c===null?null:c.stateNode,c},pr.flushSync=function(c){return Wi(c)},pr.hydrate=function(c,d,x){if(!Gf(d))throw Error(n(200));return Yf(null,c,d,!0,x)},pr.hydrateRoot=function(c,d,x){if(!Dx(c))throw Error(n(405));var w=x!=null&&x.hydratedSources||null,E=!1,A="",K=Yk;if(x!=null&&(x.unstable_strictMode===!0&&(E=!0),x.identifierPrefix!==void 0&&(A=x.identifierPrefix),x.onRecoverableError!==void 0&&(K=x.onRecoverableError)),d=Kk(d,null,c,1,x??null,E,!1,A,K),c[lo]=d.current,qc(c),w)for(c=0;c<w.length;c++)x=w[c],E=x._getVersion,E=E(x._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[x,E]:d.mutableSourceEagerHydrationData.push(x,E);return new Kf(d)},pr.render=function(c,d,x){if(!Gf(d))throw Error(n(200));return Yf(null,c,d,!1,x)},pr.unmountComponentAtNode=function(c){if(!Gf(c))throw Error(n(40));return c._reactRootContainer?(Wi(function(){Yf(null,null,c,!1,function(){c._reactRootContainer=null,c[lo]=null})}),!0):!1},pr.unstable_batchedUpdates=Sx,pr.unstable_renderSubtreeIntoContainer=function(c,d,x,w){if(!Gf(x))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return Yf(c,d,x,!1,w)},pr.version="18.3.1-next-f1338f8080-20240426",pr}var s1;function CE(){if(s1)return Lx.exports;s1=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(),Lx.exports=OI(),Lx.exports}var o1;function FI(){if(o1)return Qf;o1=1;var e=CE();return Qf.createRoot=e.createRoot,Qf.hydrateRoot=e.hydrateRoot,Qf}var zI=FI();/**
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 i1="popstate";function a1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function BI(e={}){function t(r,o){var f;let i=(f=o.state)==null?void 0:f.masked,{pathname:a,search:l,hash:u}=i||r.location;return lb("",{pathname:a,search:l,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:Xu(o)}return HI(t,n,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function xs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function UI(){return Math.random().toString(36).substring(2,10)}function l1(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 lb(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?uc(t):t,state:n,key:t&&t.key||r||UI(),unstable_mask:o}}function Xu({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 uc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function HI(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,a=o.history,l="POP",u=null,f=p();f==null&&(f=0,a.replaceState({...a.state,idx:f},""));function p(){return(a.state||{idx:null}).idx}function h(){l="POP";let b=p(),j=b==null?null:b-f;f=b,u&&u({action:l,location:v.location,delta:j})}function g(b,j){l="PUSH";let N=a1(b)?b:lb(v.location,b,j);f=p()+1;let S=l1(N,f),C=v.createHref(N.unstable_mask||N);try{a.pushState(S,"",C)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;o.location.assign(C)}i&&u&&u({action:l,location:v.location,delta:1})}function y(b,j){l="REPLACE";let N=a1(b)?b:lb(v.location,b,j);f=p();let S=l1(N,f),C=v.createHref(N.unstable_mask||N);a.replaceState(S,"",C),i&&u&&u({action:l,location:v.location,delta:0})}function k(b){return VI(b)}let v={get action(){return l},get location(){return e(o,a)},listen(b){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener(i1,h),u=b,()=>{o.removeEventListener(i1,h),u=null}},createHref(b){return t(o,b)},createURL:k,encodeLocation(b){let j=k(b);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:g,replace:y,go(b){return a.go(b)}};return v}function VI(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),cn(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Xu(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function EE(e,t,n="/"){return WI(e,t,n,!1)}function WI(e,t,n,r){let o=typeof t=="string"?uc(t):t,i=Co(o.pathname||"/",n);if(i==null)return null;let a=TE(e);qI(a);let l=null;for(let u=0;l==null&&u<a.length;++u){let f=rM(i);l=tM(a[u],f,r)}return l}function TE(e,t=[],n=[],r="",o=!1){let i=(a,l,u=o,f)=>{let p={relativePath:f===void 0?a.path||"":f,caseSensitive:a.caseSensitive===!0,childrenIndex:l,route:a};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&u)return;cn(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let h=Ks([r,p.relativePath]),g=n.concat(p);a.children&&a.children.length>0&&(cn(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),TE(a.children,t,g,h,u)),!(a.path==null&&!a.index)&&t.push({path:h,score:ZI(h,a.index),routesMeta:g})};return e.forEach((a,l)=>{var u;if(a.path===""||!((u=a.path)!=null&&u.includes("?")))i(a,l);else for(let f of RE(a.path))i(a,l,!0,f)}),t}function RE(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let a=RE(r.join("/")),l=[];return l.push(...a.map(u=>u===""?i:[i,u].join("/"))),o&&l.push(...a),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function qI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:eM(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var KI=/^:[\w-]+$/,GI=3,YI=2,XI=1,QI=10,JI=-2,c1=e=>e==="*";function ZI(e,t){let n=e.split("/"),r=n.length;return n.some(c1)&&(r+=JI),t&&(r+=YI),n.filter(o=>!c1(o)).reduce((o,i)=>o+(KI.test(i)?GI:i===""?XI:QI),r)}function eM(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function tM(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let l=0;l<r.length;++l){let u=r[l],f=l===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",h=Jp({path:u.relativePath,caseSensitive:u.caseSensitive,end:f},p),g=u.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=Jp({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},p)),!h)return null;Object.assign(o,h.params),a.push({params:o,pathname:Ks([i,h.pathname]),pathnameBase:aM(Ks([i,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(i=Ks([i,h.pathnameBase]))}return a}function Jp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=nM(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let i=o[0],a=i.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((f,{paramName:p,isOptional:h},g)=>{if(p==="*"){let k=l[g]||"";a=i.slice(0,i.length-k.length).replace(/(.)\/+$/,"$1")}const y=l[g];return h&&!y?f[p]=void 0:f[p]=(y||"").replace(/%2F/g,"/"),f},{}),pathname:i,pathnameBase:a,pattern:e}}function nM(e,t=!1,n=!0){xs(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 r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,u,f,p)=>{if(r.push({paramName:l,isOptional:u!=null}),u){let h=p.charAt(f+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function rM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return xs(!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 Co(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var sM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function oM(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?uc(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=u1(n.substring(1),"/"):i=u1(n,t)):i=t,{pathname:i,search:lM(r),hash:cM(o)}}function u1(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 zx(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. 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 iM(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function AE(e){let t=iM(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Sv(e,t,n,r=!1){let o;typeof e=="string"?o=uc(e):(o={...e},cn(!o.pathname||!o.pathname.includes("?"),zx("?","pathname","search",o)),cn(!o.pathname||!o.pathname.includes("#"),zx("#","pathname","hash",o)),cn(!o.search||!o.search.includes("#"),zx("#","search","hash",o)));let i=e===""||o.pathname==="",a=i?"/":o.pathname,l;if(a==null)l=n;else{let h=t.length-1;if(!r&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),h-=1;o.pathname=g.join("/")}l=h>=0?t[h]:"/"}let u=oM(o,l),f=a&&a!=="/"&&a.endsWith("/"),p=(i||a===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(f||p)&&(u.pathname+="/"),u}var Ks=e=>e.join("/").replace(/\/\/+/g,"/"),aM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),lM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,cM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,uM=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function dM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function fM(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var PE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _E(e,t){let n=e;if(typeof n!="string"||!sM.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(PE)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=Co(a.pathname,t);a.origin===i.origin&&l!=null?n=l+a.search+a.hash:o=!0}catch{xs(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var DE=["POST","PUT","PATCH","DELETE"];new Set(DE);var pM=["GET",...DE];new Set(pM);var dc=m.createContext(null);dc.displayName="DataRouter";var Uh=m.createContext(null);Uh.displayName="DataRouterState";var hM=m.createContext(!1),$E=m.createContext({isTransitioning:!1});$E.displayName="ViewTransition";var mM=m.createContext(new Map);mM.displayName="Fetchers";var gM=m.createContext(null);gM.displayName="Await";var ts=m.createContext(null);ts.displayName="Navigation";var Nd=m.createContext(null);Nd.displayName="Location";var Ss=m.createContext({outlet:null,matches:[],isDataRoute:!1});Ss.displayName="Route";var Nv=m.createContext(null);Nv.displayName="RouteError";var IE="REACT_ROUTER_ERROR",xM="REDIRECT",yM="ROUTE_ERROR_RESPONSE";function bM(e){if(e.startsWith(`${IE}:${xM}:{`))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 vM(e){if(e.startsWith(`${IE}:${yM}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new uM(t.status,t.statusText,t.data)}catch{}}function wM(e,{relative:t}={}){cn(Cd(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(ts),{hash:o,pathname:i,search:a}=Ed(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:Ks([n,i])),r.createHref({pathname:l,search:a,hash:o})}function Cd(){return m.useContext(Nd)!=null}function er(){return cn(Cd(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(Nd).location}var ME="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function LE(e){m.useContext(ts).static||m.useLayoutEffect(e)}function Ht(){let{isDataRoute:e}=m.useContext(Ss);return e?MM():jM()}function jM(){cn(Cd(),"useNavigate() may be used only in the context of a <Router> component.");let e=m.useContext(dc),{basename:t,navigator:n}=m.useContext(ts),{matches:r}=m.useContext(Ss),{pathname:o}=er(),i=JSON.stringify(AE(r)),a=m.useRef(!1);return LE(()=>{a.current=!0}),m.useCallback((u,f={})=>{if(xs(a.current,ME),!a.current)return;if(typeof u=="number"){n.go(u);return}let p=Sv(u,JSON.parse(i),o,f.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Ks([t,p.pathname])),(f.replace?n.replace:n.push)(p,f.state,f)},[t,n,i,o,e])}var kM=m.createContext(null);function SM(e){let t=m.useContext(Ss).outlet;return m.useMemo(()=>t&&m.createElement(kM.Provider,{value:e},t),[t,e])}function Vt(){let{matches:e}=m.useContext(Ss),t=e[e.length-1];return t?t.params:{}}function Ed(e,{relative:t}={}){let{matches:n}=m.useContext(Ss),{pathname:r}=er(),o=JSON.stringify(AE(n));return m.useMemo(()=>Sv(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function NM(e,t){return OE(e,t)}function OE(e,t,n){var b;cn(Cd(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=m.useContext(ts),{matches:o}=m.useContext(Ss),i=o[o.length-1],a=i?i.params:{},l=i?i.pathname:"/",u=i?i.pathnameBase:"/",f=i&&i.route;{let j=f&&f.path||"";zE(l,!f||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let p=er(),h;if(t){let j=typeof t=="string"?uc(t):t;cn(u==="/"||((b=j.pathname)==null?void 0:b.startsWith(u)),`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 "${u}" but pathname "${j.pathname}" was given in the \`location\` prop.`),h=j}else h=p;let g=h.pathname||"/",y=g;if(u!=="/"){let j=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=EE(e,{pathname:y});xs(f||k!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),xs(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.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 v=AM(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},a,j.params),pathname:Ks([u,r.encodeLocation?r.encodeLocation(j.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?u:Ks([u,r.encodeLocation?r.encodeLocation(j.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,n);return t&&v?m.createElement(Nd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},v):v}function CM(){let e=IM(),t=dM(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:i},"ErrorBoundary")," or"," ",m.createElement("code",{style:i},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:o},n):null,a)}var EM=m.createElement(CM,null),FE=class extends m.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=vM(e.digest);n&&(e=n)}let t=e!==void 0?m.createElement(Ss.Provider,{value:this.props.routeContext},m.createElement(Nv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?m.createElement(TM,{error:e},t):t}};FE.contextType=hM;var Bx=new WeakMap;function TM({children:e,error:t}){let{basename:n}=m.useContext(ts);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=bM(t.digest);if(r){let o=Bx.get(t);if(o)throw o;let i=_E(r.location,n);if(PE&&!Bx.get(t))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw Bx.set(t,a),a}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function RM({routeContext:e,match:t,children:n}){let r=m.useContext(dc);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),m.createElement(Ss.Provider,{value:e},n)}function AM(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,i=r==null?void 0:r.errors;if(i!=null){let p=o.findIndex(h=>h.route.id&&(i==null?void 0:i[h.route.id])!==void 0);cn(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let a=!1,l=-1;if(n&&r){a=r.renderFallback;for(let p=0;p<o.length;p++){let h=o[p];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(l=p),h.route.id){let{loaderData:g,errors:y}=r,k=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!y||y[h.route.id]===void 0);if(h.route.lazy||k){n.isStatic&&(a=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let u=n==null?void 0:n.onError,f=r&&u?(p,h)=>{var g,y;u(p,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:fM(r.matches),errorInfo:h})}:void 0;return o.reduceRight((p,h,g)=>{let y,k=!1,v=null,b=null;r&&(y=i&&h.route.id?i[h.route.id]:void 0,v=h.route.errorElement||EM,a&&(l<0&&g===0?(zE("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,b=null):l===g&&(k=!0,b=h.route.hydrateFallbackElement||null)));let j=t.concat(o.slice(0,g+1)),N=()=>{let S;return y?S=v:k?S=b:h.route.Component?S=m.createElement(h.route.Component,null):h.route.element?S=h.route.element:S=p,m.createElement(RM,{match:h,routeContext:{outlet:p,matches:j,isDataRoute:r!=null},children:S})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?m.createElement(FE,{location:r.location,revalidation:r.revalidation,component:v,error:y,children:N(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:f}):N()},null)}function Cv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function PM(e){let t=m.useContext(dc);return cn(t,Cv(e)),t}function _M(e){let t=m.useContext(Uh);return cn(t,Cv(e)),t}function DM(e){let t=m.useContext(Ss);return cn(t,Cv(e)),t}function Ev(e){let t=DM(e),n=t.matches[t.matches.length-1];return cn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function $M(){return Ev("useRouteId")}function IM(){var r;let e=m.useContext(Nv),t=_M("useRouteError"),n=Ev("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function MM(){let{router:e}=PM("useNavigate"),t=Ev("useNavigate"),n=m.useRef(!1);return LE(()=>{n.current=!0}),m.useCallback(async(o,i={})=>{xs(n.current,ME),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var d1={};function zE(e,t,n){!t&&!d1[e]&&(d1[e]=!0,xs(!1,n))}m.memo(LM);function LM({routes:e,future:t,state:n,isStatic:r,onError:o}){return OE(e,void 0,{state:n,isStatic:r,onError:o})}function OM(e){return SM(e.context)}function Je(e){cn(!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 FM({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){cn(!Cd(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=m.useMemo(()=>({basename:l,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[l,o,i,a]);typeof n=="string"&&(n=uc(n));let{pathname:f="/",search:p="",hash:h="",state:g=null,key:y="default",unstable_mask:k}=n,v=m.useMemo(()=>{let b=Co(f,l);return b==null?null:{location:{pathname:b,search:p,hash:h,state:g,key:y,unstable_mask:k},navigationType:r}},[l,f,p,h,g,y,r,k]);return xs(v!=null,`<Router basename="${l}"> is not able to match the URL "${f}${p}${h}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:m.createElement(ts.Provider,{value:u},m.createElement(Nd.Provider,{children:t,value:v}))}function zM({children:e,location:t}){return NM(cb(e),t)}function cb(e,t=[]){let n=[];return m.Children.forEach(e,(r,o)=>{if(!m.isValidElement(r))return;let i=[...t,o];if(r.type===m.Fragment){n.push.apply(n,cb(r.props.children,i));return}cn(r.type===Je,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),cn(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=cb(r.props.children,i)),n.push(a)}),n}var Tp="get",Rp="application/x-www-form-urlencoded";function Hh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function BM(e){return Hh(e)&&e.tagName.toLowerCase()==="button"}function UM(e){return Hh(e)&&e.tagName.toLowerCase()==="form"}function HM(e){return Hh(e)&&e.tagName.toLowerCase()==="input"}function VM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function WM(e,t){return e.button===0&&(!t||t==="_self")&&!VM(e)}function ub(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function qM(e,t){let n=ub(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var Jf=null;function KM(){if(Jf===null)try{new FormData(document.createElement("form"),0),Jf=!1}catch{Jf=!0}return Jf}var GM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ux(e){return e!=null&&!GM.has(e)?(xs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Rp}"`),null):e}function YM(e,t){let n,r,o,i,a;if(UM(e)){let l=e.getAttribute("action");r=l?Co(l,t):null,n=e.getAttribute("method")||Tp,o=Ux(e.getAttribute("enctype"))||Rp,i=new FormData(e)}else if(BM(e)||HM(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||l.getAttribute("action");if(r=u?Co(u,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Tp,o=Ux(e.getAttribute("formenctype"))||Ux(l.getAttribute("enctype"))||Rp,i=new FormData(l,e),!KM()){let{name:f,type:p,value:h}=e;if(p==="image"){let g=f?`${f}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}else f&&i.append(f,h)}}else{if(Hh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Tp,r=null,o=Rp,a=e}return i&&o==="text/plain"&&(a=i,i=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:i,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Tv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function XM(e,t,n,r){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}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Co(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function QM(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 JM(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 ZM(e,t,n){let r=await Promise.all(e.map(async o=>{let i=t.routes[o.route.id];if(i){let a=await QM(i,n);return a.links?a.links():[]}return[]}));return rL(r.flat(1).filter(JM).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function f1(e,t,n,r,o,i){let a=(u,f)=>n[f]?u.route.id!==n[f].route.id:!0,l=(u,f)=>{var p;return n[f].pathname!==u.pathname||((p=n[f].route.path)==null?void 0:p.endsWith("*"))&&n[f].params["*"]!==u.params["*"]};return i==="assets"?t.filter((u,f)=>a(u,f)||l(u,f)):i==="data"?t.filter((u,f)=>{var h;let p=r.routes[u.route.id];if(!p||!p.hasLoader)return!1;if(a(u,f)||l(u,f))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function eL(e,t,{includeHydrateFallback:n}={}){return tL(e.map(r=>{let o=t.routes[r.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 tL(e){return[...new Set(e)]}function nL(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function rL(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(nL(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function BE(){let e=m.useContext(dc);return Tv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function sL(){let e=m.useContext(Uh);return Tv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Rv=m.createContext(void 0);Rv.displayName="FrameworkContext";function UE(){let e=m.useContext(Rv);return Tv(e,"You must render this element inside a <HydratedRouter> element"),e}function oL(e,t){let n=m.useContext(Rv),[r,o]=m.useState(!1),[i,a]=m.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:f,onMouseLeave:p,onTouchStart:h}=t,g=m.useRef(null);m.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let v=j=>{j.forEach(N=>{a(N.isIntersecting)})},b=new IntersectionObserver(v,{threshold:.5});return g.current&&b.observe(g.current),()=>{b.disconnect()}}},[e]),m.useEffect(()=>{if(r){let v=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(v)}}},[r]);let y=()=>{o(!0)},k=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:du(l,y),onBlur:du(u,k),onMouseEnter:du(f,y),onMouseLeave:du(p,k),onTouchStart:du(h,y)}]:[!1,g,{}]}function du(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function iL({page:e,...t}){let{router:n}=BE(),r=m.useMemo(()=>EE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?m.createElement(lL,{page:e,matches:r,...t}):null}function aL(e){let{manifest:t,routeModules:n}=UE(),[r,o]=m.useState([]);return m.useEffect(()=>{let i=!1;return ZM(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function lL({page:e,matches:t,...n}){let r=er(),{future:o,manifest:i,routeModules:a}=UE(),{basename:l}=BE(),{loaderData:u,matches:f}=sL(),p=m.useMemo(()=>f1(e,t,f,i,r,"data"),[e,t,f,i,r]),h=m.useMemo(()=>f1(e,t,f,i,r,"assets"),[e,t,f,i,r]),g=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let v=new Set,b=!1;if(t.forEach(N=>{var C;let S=i.routes[N.route.id];!S||!S.hasLoader||(!p.some(D=>D.route.id===N.route.id)&&N.route.id in u&&((C=a[N.route.id])!=null&&C.shouldRevalidate)||S.hasClientLoader?b=!0:v.add(N.route.id))}),v.size===0)return[];let j=XM(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return b&&v.size>0&&j.searchParams.set("_routes",t.filter(N=>v.has(N.route.id)).map(N=>N.route.id).join(",")),[j.pathname+j.search]},[l,o.unstable_trailingSlashAwareDataRequests,u,r,i,p,t,e,a]),y=m.useMemo(()=>eL(h,i),[h,i]),k=aL(h);return m.createElement(m.Fragment,null,g.map(v=>m.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...n})),y.map(v=>m.createElement("link",{key:v,rel:"modulepreload",href:v,...n})),k.map(({key:v,link:b})=>m.createElement("link",{key:v,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function cL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var uL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{uL&&(window.__reactRouterVersion="7.13.1")}catch{}function dL({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=m.useRef();o.current==null&&(o.current=BI({window:r,v5Compat:!0}));let i=o.current,[a,l]=m.useState({action:i.action,location:i.location}),u=m.useCallback(f=>{n===!1?l(f):m.startTransition(()=>l(f))},[n]);return m.useLayoutEffect(()=>i.listen(u),[i,u]),m.createElement(FM,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var HE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$e=m.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,unstable_mask:l,state:u,target:f,to:p,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...k},v){let{basename:b,navigator:j,unstable_useTransitions:N}=m.useContext(ts),S=typeof p=="string"&&HE.test(p),C=_E(p,b);p=C.to;let D=wM(p,{relative:o}),T=er(),R=null;if(l){let L=Sv(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);b!=="/"&&(L.pathname=L.pathname==="/"?b:Ks([b,L.pathname])),R=j.createHref(L)}let[$,_,U]=oL(r,k),I=mL(p,{replace:a,unstable_mask:l,state:u,target:f,preventScrollReset:h,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:N});function V(L){t&&t(L),L.defaultPrevented||I(L)}let O=!(C.isExternal||i),P=m.createElement("a",{...k,...U,href:(O?R:void 0)||C.absoluteURL||D,onClick:O?V:t,ref:cL(v,_),target:f,"data-discover":!S&&n==="render"?"true":void 0});return $&&!S?m.createElement(m.Fragment,null,P,m.createElement(iL,{page:D})):P});$e.displayName="Link";var fL=m.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:l,children:u,...f},p){let h=Ed(a,{relative:f.relative}),g=er(),y=m.useContext(Uh),{navigator:k,basename:v}=m.useContext(ts),b=y!=null&&vL(h)&&l===!0,j=k.encodeLocation?k.encodeLocation(h).pathname:h.pathname,N=g.pathname,S=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(N=N.toLowerCase(),S=S?S.toLowerCase():null,j=j.toLowerCase()),S&&v&&(S=Co(S,v)||S);const C=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let D=N===j||!o&&N.startsWith(j)&&N.charAt(C)==="/",T=S!=null&&(S===j||!o&&S.startsWith(j)&&S.charAt(j.length)==="/"),R={isActive:D,isPending:T,isTransitioning:b},$=D?t:void 0,_;typeof r=="function"?_=r(R):_=[r,D?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let U=typeof i=="function"?i(R):i;return m.createElement($e,{...f,"aria-current":$,className:_,ref:p,style:U,to:a,viewTransition:l},typeof u=="function"?u(R):u)});fL.displayName="NavLink";var pL=m.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=Tp,action:l,onSubmit:u,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g,...y},k)=>{let{unstable_useTransitions:v}=m.useContext(ts),b=yL(),j=bL(l,{relative:f}),N=a.toLowerCase()==="get"?"get":"post",S=typeof l=="string"&&HE.test(l),C=D=>{if(u&&u(D),D.defaultPrevented)return;D.preventDefault();let T=D.nativeEvent.submitter,R=(T==null?void 0:T.getAttribute("formmethod"))||a,$=()=>b(T||D.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:o,state:i,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g});v&&n!==!1?m.startTransition(()=>$()):$()};return m.createElement("form",{ref:k,method:N,action:j,onSubmit:r?u:C,...y,"data-discover":!S&&e==="render"?"true":void 0})});pL.displayName="Form";function hL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function VE(e){let t=m.useContext(dc);return cn(t,hL(e)),t}function mL(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:f}={}){let p=Ht(),h=er(),g=Ed(e,{relative:a});return m.useCallback(y=>{if(WM(y,t)){y.preventDefault();let k=n!==void 0?n:Xu(h)===Xu(g),v=()=>p(e,{replace:k,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:u});f?m.startTransition(()=>v()):v()}},[h,p,g,n,r,o,t,e,i,a,l,u,f])}function Ns(e){xs(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=m.useRef(ub(e)),n=m.useRef(!1),r=er(),o=m.useMemo(()=>qM(r.search,n.current?null:t.current),[r.search]),i=Ht(),a=m.useCallback((l,u)=>{const f=ub(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,i("?"+f,u)},[i,o]);return[o,a]}var gL=0,xL=()=>`__${String(++gL)}__`;function yL(){let{router:e}=VE("useSubmit"),{basename:t}=m.useContext(ts),n=$M(),r=e.fetch,o=e.navigate;return m.useCallback(async(i,a={})=>{let{action:l,method:u,encType:f,formData:p,body:h}=YM(i,t);if(a.navigate===!1){let g=a.fetcherKey||xL();await r(g,n,a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||u,formEncType:a.encType||f,flushSync:a.flushSync})}else await o(a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||u,formEncType:a.encType||f,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function bL(e,{relative:t}={}){let{basename:n}=m.useContext(ts),r=m.useContext(Ss);cn(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...Ed(e||".",{relative:t})},a=er();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),u=l.getAll("index");if(u.some(p=>p==="")){l.delete("index"),u.filter(h=>h).forEach(h=>l.append("index",h));let p=l.toString();i.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:Ks([n,i.pathname])),Xu(i)}function vL(e,{relative:t}={}){let n=m.useContext($E);cn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=VE("useViewTransitionState"),o=Ed(e,{relative:t});if(!n.isTransitioning)return!1;let i=Co(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Co(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Jp(o.pathname,a)!=null||Jp(o.pathname,i)!=null}var wo=CE();const wL=kd(wo);/**
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 jL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),WE=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.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 kL={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 SL=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...l},u)=>m.createElement("svg",{ref:u,...kL,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:WE("lucide",o),...l},[...a.map(([f,p])=>m.createElement(f,p)),...Array.isArray(i)?i:[i]]));/**
67
+ * @license lucide-react v0.460.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const Ie=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(SL,{ref:i,iconNode:t,className:WE(`lucide-${jL(e)}`,r),...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 Vh=Ie("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
77
+ * @license lucide-react v0.460.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const Zp=Ie("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
82
+ * @license lucide-react v0.460.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const Wh=Ie("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
87
+ * @license lucide-react v0.460.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const eh=Ie("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
92
+ * @license lucide-react v0.460.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const qh=Ie("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
97
+ * @license lucide-react v0.460.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const qE=Ie("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
102
+ * @license lucide-react v0.460.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const th=Ie("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
107
+ * @license lucide-react v0.460.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const NL=Ie("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
112
+ * @license lucide-react v0.460.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const CL=Ie("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/**
117
+ * @license lucide-react v0.460.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const KE=Ie("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
122
+ * @license lucide-react v0.460.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Av=Ie("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
127
+ * @license lucide-react v0.460.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const EL=Ie("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
132
+ * @license lucide-react v0.460.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const GE=Ie("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
137
+ * @license lucide-react v0.460.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const zr=Ie("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
142
+ * @license lucide-react v0.460.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const vr=Ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
147
+ * @license lucide-react v0.460.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const TL=Ie("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
152
+ * @license lucide-react v0.460.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const YE=Ie("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
157
+ * @license lucide-react v0.460.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const XE=Ie("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
162
+ * @license lucide-react v0.460.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const nh=Ie("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
167
+ * @license lucide-react v0.460.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Pv=Ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
172
+ * @license lucide-react v0.460.0 - ISC
173
+ *
174
+ * This source code is licensed under the ISC license.
175
+ * See the LICENSE file in the root directory of this source tree.
176
+ */const db=Ie("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
177
+ * @license lucide-react v0.460.0 - ISC
178
+ *
179
+ * This source code is licensed under the ISC license.
180
+ * See the LICENSE file in the root directory of this source tree.
181
+ */const RL=Ie("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
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 AL=Ie("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/**
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 PL=Ie("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 _L=Ie("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/**
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 DL=Ie("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 $L=Ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 IL=Ie("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
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 Kh=Ie("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
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 ML=Ie("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 QE=Ie("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 rh=Ie("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
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 LL=Ie("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
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 OL=Ie("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
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 fc=Ie("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
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 p1=Ie("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 FL=Ie("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
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 zL=Ie("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/**
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 JE=Ie("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
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 BL=Ie("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/**
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 UL=Ie("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
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 _v=Ie("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
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 HL=Ie("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/**
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 Dv=Ie("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
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 VL=Ie("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/**
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 pc=Ie("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
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 WL=Ie("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/**
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 qL=Ie("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
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 $v=Ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 fb=Ie("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
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 KL=Ie("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
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 ZE=Ie("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
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 GL=Ie("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
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 YL=Ie("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/**
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 XL=Ie("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
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 QL=Ie("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
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 JL=Ie("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
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 Iv=Ie("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 ZL=Ie("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
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 e4=Ie("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
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 Mv=Ie("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
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 t4=Ie("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/**
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 Hx=Ie("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/**
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 e2=Ie("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
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 hc=Ie("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
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 n4=Ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 It=Ie("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 t2=Ie("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
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 r4=Ie("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/**
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 s4=Ie("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
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 Qs=Ie("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
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 Gh=Ie("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
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 o4=Ie("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Ni=Ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 i4=Ie("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/**
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 a4=Ie("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
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 l4=Ie("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
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 c4=Ie("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
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 u4=Ie("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
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 gs=Ie("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
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 Vx=Ie("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
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 h1=Ie("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
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 Lv=Ie("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
487
+ * @license lucide-react v0.460.0 - ISC
488
+ *
489
+ * This source code is licensed under the ISC license.
490
+ * See the LICENSE file in the root directory of this source tree.
491
+ */const d4=Ie("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/**
492
+ * @license lucide-react v0.460.0 - ISC
493
+ *
494
+ * This source code is licensed under the ISC license.
495
+ * See the LICENSE file in the root directory of this source tree.
496
+ */const n2=Ie("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
497
+ * @license lucide-react v0.460.0 - ISC
498
+ *
499
+ * This source code is licensed under the ISC license.
500
+ * See the LICENSE file in the root directory of this source tree.
501
+ */const _l=Ie("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
502
+ * @license lucide-react v0.460.0 - ISC
503
+ *
504
+ * This source code is licensed under the ISC license.
505
+ * See the LICENSE file in the root directory of this source tree.
506
+ */const bn=Ie("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
507
+ * @license lucide-react v0.460.0 - ISC
508
+ *
509
+ * This source code is licensed under the ISC license.
510
+ * See the LICENSE file in the root directory of this source tree.
511
+ */const Yh=Ie("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
512
+ * @license lucide-react v0.460.0 - ISC
513
+ *
514
+ * This source code is licensed under the ISC license.
515
+ * See the LICENSE file in the root directory of this source tree.
516
+ */const f4=Ie("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
517
+ * @license lucide-react v0.460.0 - ISC
518
+ *
519
+ * This source code is licensed under the ISC license.
520
+ * See the LICENSE file in the root directory of this source tree.
521
+ */const p4=Ie("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
522
+ * @license lucide-react v0.460.0 - ISC
523
+ *
524
+ * This source code is licensed under the ISC license.
525
+ * See the LICENSE file in the root directory of this source tree.
526
+ */const h4=Ie("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
527
+ * @license lucide-react v0.460.0 - ISC
528
+ *
529
+ * This source code is licensed under the ISC license.
530
+ * See the LICENSE file in the root directory of this source tree.
531
+ */const Td=Ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function r2(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=r2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function m4(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=r2(e))&&(r&&(r+=" "),r+=t);return r}const Ov="-",g4=e=>{const t=y4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Ov);return l[0]===""&&l.length!==1&&l.shift(),s2(l,t)||x4(a)},getConflictingClassGroupIds:(a,l)=>{const u=n[a]||[];return l&&r[a]?[...u,...r[a]]:u}}},s2=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?s2(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Ov);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},m1=/^\[(.+)\]$/,x4=e=>{if(m1.test(e)){const t=m1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},y4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return v4(Object.entries(e.classGroups),n).forEach(([i,a])=>{pb(a,r,i,t)}),r},pb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:g1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(b4(o)){pb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{pb(a,g1(t,i),n,r)})})},g1=(e,t)=>{let n=e;return t.split(Ov).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},b4=e=>e.isThemeGetter,v4=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,l])=>[t+a,l])):i);return[n,o]}):e,w4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=r.get(i))!==void 0)return o(i,a),a},set(i,a){n.has(i)?n.set(i,a):o(i,a)}}},o2="!",j4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const u=[];let f=0,p=0,h;for(let b=0;b<l.length;b++){let j=l[b];if(f===0){if(j===o&&(r||l.slice(b,b+i)===t)){u.push(l.slice(p,b)),p=b+i;continue}if(j==="/"){h=b;continue}}j==="["?f++:j==="]"&&f--}const g=u.length===0?l:l.substring(p),y=g.startsWith(o2),k=y?g.substring(1):g,v=h&&h>p?h-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:a}):a},k4=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},S4=e=>({cache:w4(e.cacheSize),parseClassName:j4(e),...g4(e)}),N4=/\s+/,C4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(N4);let l="";for(let u=a.length-1;u>=0;u-=1){const f=a[u],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let k=!!y,v=r(k?g.substring(0,y):g);if(!v){if(!k){l=f+(l.length>0?" "+l:l);continue}if(v=r(g),!v){l=f+(l.length>0?" "+l:l);continue}k=!1}const b=k4(p).join(":"),j=h?b+o2:b,N=j+v;if(i.includes(N))continue;i.push(N);const S=o(v,k);for(let C=0;C<S.length;++C){const D=S[C];i.push(j+D)}l=f+(l.length>0?" "+l:l)}return l};function E4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=i2(t))&&(r&&(r+=" "),r+=n);return r}const i2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=i2(e[r]))&&(n&&(n+=" "),n+=t);return n};function T4(e,...t){let n,r,o,i=a;function a(u){const f=t.reduce((p,h)=>h(p),e());return n=S4(f),r=n.cache.get,o=n.cache.set,i=l,l(u)}function l(u){const f=r(u);if(f)return f;const p=C4(u,n);return o(u,p),p}return function(){return i(E4.apply(null,arguments))}}const Xt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},a2=/^\[(?:([a-z-]+):)?(.+)\]$/i,R4=/^\d+\/\d+$/,A4=new Set(["px","full","screen"]),P4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_4=/\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$/,D4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,xo=e=>Dl(e)||A4.has(e)||R4.test(e),ii=e=>mc(e,"length",H4),Dl=e=>!!e&&!Number.isNaN(Number(e)),Wx=e=>mc(e,"number",Dl),fu=e=>!!e&&Number.isInteger(Number(e)),M4=e=>e.endsWith("%")&&Dl(e.slice(0,-1)),vt=e=>a2.test(e),ai=e=>P4.test(e),L4=new Set(["length","size","percentage"]),O4=e=>mc(e,L4,l2),F4=e=>mc(e,"position",l2),z4=new Set(["image","url"]),B4=e=>mc(e,z4,W4),U4=e=>mc(e,"",V4),pu=()=>!0,mc=(e,t,n)=>{const r=a2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},H4=e=>_4.test(e)&&!D4.test(e),l2=()=>!1,V4=e=>$4.test(e),W4=e=>I4.test(e),q4=()=>{const e=Xt("colors"),t=Xt("spacing"),n=Xt("blur"),r=Xt("brightness"),o=Xt("borderColor"),i=Xt("borderRadius"),a=Xt("borderSpacing"),l=Xt("borderWidth"),u=Xt("contrast"),f=Xt("grayscale"),p=Xt("hueRotate"),h=Xt("invert"),g=Xt("gap"),y=Xt("gradientColorStops"),k=Xt("gradientColorStopPositions"),v=Xt("inset"),b=Xt("margin"),j=Xt("opacity"),N=Xt("padding"),S=Xt("saturate"),C=Xt("scale"),D=Xt("sepia"),T=Xt("skew"),R=Xt("space"),$=Xt("translate"),_=()=>["auto","contain","none"],U=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",vt,t],V=()=>[vt,t],O=()=>["",xo,ii],P=()=>["auto",Dl,vt],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],z=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",vt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],F=()=>[Dl,vt];return{cacheSize:500,separator:":",theme:{colors:[pu],spacing:[xo,ii],blur:["none","",ai,vt],brightness:F(),borderColor:[e],borderRadius:["none","","full",ai,vt],borderSpacing:V(),borderWidth:O(),contrast:F(),grayscale:W(),hueRotate:F(),invert:W(),gap:V(),gradientColorStops:[e],gradientColorStopPositions:[M4,ii],inset:I(),margin:I(),opacity:F(),padding:V(),saturate:F(),scale:F(),sepia:W(),skew:F(),space:V(),translate:V()},classGroups:{aspect:[{aspect:["auto","square","video",vt]}],container:["container"],columns:[{columns:[ai]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"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:[...L(),vt]}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",fu,vt]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",vt]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",fu,vt]}],"grid-cols":[{"grid-cols":[pu]}],"col-start-end":[{col:["auto",{span:["full",fu,vt]},vt]}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":[pu]}],"row-start-end":[{row:["auto",{span:[fu,vt]},vt]}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",vt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",vt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[R]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[R]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",vt,t]}],"min-w":[{"min-w":[vt,t,"min","max","fit"]}],"max-w":[{"max-w":[vt,t,"none","full","min","max","fit","prose",{screen:[ai]},ai]}],h:[{h:[vt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[vt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[vt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[vt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ai,ii]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wx]}],"font-family":[{font:[pu]}],"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",vt]}],"line-clamp":[{"line-clamp":["none",Dl,Wx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",xo,vt]}],"list-image":[{"list-image":["none",vt]}],"list-style-type":[{list:["none","disc","decimal",vt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",xo,ii]}],"underline-offset":[{"underline-offset":["auto",xo,vt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",vt]}],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",vt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),F4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",O4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},B4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[k]}],"gradient-via-pos":[{via:[k]}],"gradient-to-pos":[{to:[k]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],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:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:B()}],"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:["",...B()]}],"outline-offset":[{"outline-offset":[xo,vt]}],"outline-w":[{outline:[xo,ii]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[xo,ii]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ai,U4]}],"shadow-color":[{shadow:[pu]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",ai,vt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[f]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",vt]}],duration:[{duration:F()}],ease:[{ease:["linear","in","out","in-out",vt]}],delay:[{delay:F()}],animate:[{animate:["none","spin","ping","pulse","bounce",vt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[fu,vt]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[T]}],"skew-y":[{"skew-y":[T]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",vt]}],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",vt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",vt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[xo,ii,Wx]}],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"]}}},K4=T4(q4);function Ne(...e){return K4(m4(e))}function Gn(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 es(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 c2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function u2(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 d2(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 r=Math.floor(n/60);if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function Kl(e){return e.toLocaleString("en-US")}function Gl(e){if(!Number.isFinite(e))return"$0.00";const t=e!==0&&Math.abs(e)<1?4:2;return e.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:t})}function G4(e){if(!e)return"—";const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return e;const[,n,r,o]=t,i=new Date(Number(n),Number(r)-1,Number(o));return Number.isNaN(i.getTime())?e:i.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function Dn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function f2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function Y4(e){let t=f2(e);const n=t.match(/^\/w\/[^/]+(\/.*)?$/);return n&&(t=n[1]||"/"),t==="/"?"/":t.startsWith("/archive")?"/archive":t.startsWith("/projects")?/^\/projects\/[^/]+\/assignments\//.test(t)?"/assignments":"/projects":t.startsWith("/assignments")?"/assignments":t.startsWith("/servers")?"/servers":t.startsWith("/inventories")?"/inventories":t.startsWith("/usage")?"/usage":t.startsWith("/agent-sessions")?"/agent-sessions":t.startsWith("/playbooks")?"/playbooks":t.startsWith("/memories")?"/memories":t.startsWith("/resources")?"/resources":t.startsWith("/todos")?"/todos":t.startsWith("/views")?"/views":t.startsWith("/help")?"/help":t.startsWith("/settings")?"/settings":t.startsWith("/workflow")?"/workflow":null}function p2(e,t){return Y4(e)===t}function h2(e){let n=f2(e).split("/").filter(Boolean);const r=[];let o="Overview",i=null,a="";if(n[0]==="w"&&n[1]&&(a=`/w/${n[1]}`,r.push({label:Dn(n[1]),path:`${a}/projects`}),n=n.slice(2)),n.length===0)return{title:o,breadcrumbs:r,projectSlug:i};if(n[0]==="projects"){if(r.push({label:"Projects",path:`${a}/projects`}),o="Projects",n[1]&&(i=n[1],r.push({label:Dn(n[1]),path:`${a}/projects/${n[1]}`}),o=Dn(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])r.push({label:Dn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=Dn(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 l=n[2]==="memories"?"Memories":"Resources",u=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:u}),r.push({label:Dn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=Dn(n[3]),n[4]==="edit"&&(o=n[2]==="memories"?"Edit Memory":"Edit Resource")}}else n[0]==="servers"?(o="Servers",r.push({label:"Servers",path:`${a}/servers`})):n[0]==="inventories"?(o="Inventories",r.push({label:"Inventories",path:`${a}/inventories`})):n[0]==="usage"?(o="Usage",r.push({label:"Usage",path:`${a}/usage`})):n[0]==="agent-sessions"?(o="Agent Sessions",r.push({label:"Agent Sessions",path:`${a}/agent-sessions`})):n[0]==="assignments"?(o="Assignments",r.push({label:"Assignments",path:`${a}/assignments`})):n[0]==="archive"?(o="Archive",r.push({label:"Archive",path:"/archive"})):n[0]==="playbooks"?(r.push({label:"Playbooks",path:"/playbooks"}),o="Playbooks",n[1]==="create"?o="Create Playbook":n[1]&&n[2]==="edit"?(r.push({label:Dn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:Dn(n[1]),path:`/playbooks/${n[1]}`}),o=Dn(n[1]))):n[0]==="memories"?(r.push({label:"Memories",path:"/memories"}),o="Memories",n[1]==="new"&&(o="New Memory")):n[0]==="resources"?(r.push({label:"Resources",path:"/resources"}),o="Resources",n[1]==="new"&&(o="New Resource")):n[0]==="todos"?(o="Todos",r.push({label:"Todos",path:`${a}/todos`})):n[0]==="views"?(o="Saved Views",r.push({label:"Saved Views",path:`${a}/views`}),n[1]&&(o="View")):n[0]==="help"?(o="Help",r.push({label:"Help",path:"/help"})):n[0]==="settings"?(o="Settings",r.push({label:"Settings",path:"/settings"})):n[0]==="workflow"?(o="Workflow",r.push({label:"Workflow",path:"/workflow"})):n[0]==="create"&&n[1]==="project"&&(o="Create Project",r.push({label:"Create Project",path:`${a}/create/project`}));return{title:o,breadcrumbs:r,projectSlug:i}}function x1({items:e,onNavigate:t}){const n=er();return s.jsx("nav",{className:"space-y-1",children:e.map(r=>{const o=r.icon,i=p2(n.pathname,r.to)&&!n.pathname.startsWith("/w/");return s.jsxs($e,{to:r.to,onClick:t,className:Ne("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:[s.jsx(o,{className:"h-4 w-4"}),s.jsx("span",{children:r.label})]},r.to)})})}const m2=[{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)"}}],X4=m2.map(e=>e.slug),sh="default";function g2(e){return typeof e=="string"&&X4.includes(e)}const x2={preset:sh,custom:!1};let Au=null,il=null;function Fv(e){if(!e||typeof e!="object")return x2;const t=e;return{preset:g2(t.preset)?t.preset:sh,custom:t.custom===!0}}function Q4(){return Au?Promise.resolve(Au):il||(il=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=Fv(e);return Au=t,il=null,t}).catch(()=>(il=null,x2)),il)}async function J4(e){const t=await fetch("/api/config/theme",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({preset:e})});if(!t.ok){const r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));throw new Error(r.error??"Failed to save theme")}const n=Fv(await t.json());return Au=n,n}async function Z4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=Fv(await e.json());return Au=t,t}const hb="syntaur-theme",Ap="syntaur-preset",y2=m.createContext(null);function mb(){try{const e=window.localStorage.getItem(hb);return e==="light"||e==="dark"?e:null}catch{return null}}function b2(){try{const e=window.localStorage.getItem(Ap);return g2(e)?e:sh}catch{return sh}}function v2(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function w2(e){document.documentElement.classList.toggle("dark",e==="dark")}function j2(e){document.documentElement.dataset.theme=e}function eO(){typeof document>"u"||(w2(mb()??v2()),j2(b2()))}function tO({children:e}){const[t,n]=m.useState(()=>mb()),[r,o]=m.useState(()=>mb()??v2()),[i,a]=m.useState(()=>b2());m.useEffect(()=>{w2(r)},[r]),m.useEffect(()=>{j2(i)},[i]),m.useEffect(()=>{let p=!1;return Q4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Ap,h.preset)}catch{}}}),()=>{p=!0}},[]),m.useEffect(()=>{if(!window.matchMedia)return;const p=window.matchMedia("(prefers-color-scheme: dark)"),h=()=>{t||o(p.matches?"dark":"light")};return h(),p.addEventListener("change",h),()=>{p.removeEventListener("change",h)}},[t]);async function l(p){a(p);try{window.localStorage.setItem(Ap,p)}catch{}await J4(p)}async function u(){const p=await Z4();a(p.preset);try{window.localStorage.setItem(Ap,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(hb,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(hb,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:u};return s.jsx(y2.Provider,{value:f,children:e})}function zv(){const e=m.useContext(y2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const nO=2e3,Pu=new Set;let mr=null,oa=null,Pp=!1;function rO(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}let sO=rO;function oO(){oa&&clearTimeout(oa),oa=setTimeout(()=>{oa=null,k2()},nO)}function k2(){mr&&(mr.readyState===WebSocket.OPEN||mr.readyState===WebSocket.CONNECTING)||(Pp=!1,mr=new WebSocket(sO()),mr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Pu)n(t)}catch{}},mr.onclose=()=>{if(mr=null,Pp||Pu.size===0){Pp=!1;return}oO()},mr.onerror=()=>{mr==null||mr.close()})}function iO(e){return Pu.add(e),k2(),()=>{Pu.delete(e),Pu.size===0&&(oa&&(clearTimeout(oa),oa=null),mr&&(Pp=!0,mr.close(),mr=null))}}function gc(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>iO(o=>t.current(o)),[])}const Xh=["7d","30d","90d","all","custom"],S2="30d",aO=/^\d{4}-\d{2}-\d{2}$/,Rd=["project","workspace","model","tool"],lO={"7d":7,"30d":30,"90d":90};function _u(e){if(typeof e!="string"||!aO.test(e))return!1;const[t,n,r]=e.split("-").map(Number);if(n<1||n>12||r<1||r>31)return!1;const o=new Date(Date.UTC(t,n-1,r));return o.getUTCFullYear()===t&&o.getUTCMonth()===n-1&&o.getUTCDate()===r}function y1(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}function cO(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function uO(e,t=new Date){const n=e.window??S2;if(n==="all")return{};if(n==="custom"){const o={};return e.since&&(o.since=e.since),e.until&&(o.until=e.until),o}const r=new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return{since:y1(cO(r,-(lO[n]-1))),until:y1(r)}}function dO(e){const t=[];if(!e||typeof e!="object"||Array.isArray(e))return{ok:!1,errors:["filters must be an object"]};const n=e;n.window!==void 0&&!Xh.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!_u(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of Rd)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return _u(n.since)&&_u(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Ad(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Xh.includes(n.window)&&(t.window=n.window),_u(n.since)&&(t.since=n.since),_u(n.until)&&(t.until=n.until);for(const r of Rd)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function gb(e){const t=Ad(e),n=new URLSearchParams;t.window&&n.set("window",t.window),t.window==="custom"&&(t.since&&n.set("since",t.since),t.until&&n.set("until",t.until));for(const r of Rd)t[r]&&n.set(r,t[r]);return n}function fO(e){const t={};for(const n of["window","since","until",...Rd]){const r=e.get(n);r!==null&&(t[n]=r)}return Ad(t)}function N2(e,t=new Date){const n=Ad(e),{since:r,until:o}=uO(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of Rd)n[a]&&i.set(a,n[a]);return i}const pO={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function b1(e){const t=Ad(e),n=t.window??S2,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:pO[n]),t.workspace&&r.push(`workspace: ${t.workspace}`),t.project&&r.push(`project: ${t.project}`),t.model&&r.push(`model: ${t.model}`),t.tool&&r.push(`tool: ${t.tool}`),r.join(" · ")}function Zt(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[u,f]=m.useState(null),[p,h]=m.useState(0),g=n?e:null,y=m.useCallback(()=>{h(v=>v+1)},[]),k=m.useRef(g);return r&&k.current!==g&&(k.current=g,i(null),f(null)),m.useEffect(()=>{if(!g){l(!1),i(null);return}let v=!1;return l(!0),f(null),fetch(g).then(async b=>{if(!b.ok){const j=await b.json().catch(()=>null);throw new Error((j==null?void 0:j.error)||`HTTP ${b.status}`)}return b.json()}).then(b=>{v||(i(b),l(!1))}).catch(b=>{v||(f(b.message),l(!1))}),()=>{v=!0}},[g,p]),gc(v=>{!t||!g||((v.type==="project-updated"||v.type==="assignment-updated")&&y(),v.type==="servers-updated"&&t==="servers"&&y(),v.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&y(),v.type==="playbooks-updated"&&t==="playbooks"&&y(),v.type==="leases-updated"&&t==="inventories"&&y())}),{data:o,loading:a,error:u,refetch:y}}function Zs(e=!0){return Zt("/api/projects","projects",e)}function Na(){return Zt("/api/workspaces","projects")}function pn(){const{workspace:e}=Vt();return e?`/w/${e}`:""}function hO(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(),r=n?`/api/overview?${n}`:"/api/overview";return Zt(r,"overview")}function Qh(e=!0){return Zt("/api/assignments","assignments",e)}function mO(e=!0){return Zt("/api/archived","assignments",e)}function C2(){return Zt("/api/help")}function E2(e){const t=e?`/api/projects/${e}`:null;return Zt(t,"project")}function gO(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return Zt(n,"assignment")}function xO(e){const t=e?`/api/assignments/${e}`:null;return Zt(t,"assignment")}function T2(e){return Zt(e)}function Bv(e=!0){return Zt("/api/servers","servers",e)}function R2(){return Zt("/api/leases","inventories")}function Jh(){return Zt("/api/agent-sessions","agent-sessions")}function yO(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return Zt(n,"agent-sessions")}function bO(e){const t=e?`/api/assignments/${e}/sessions`:null;return Zt(t,"agent-sessions")}function vO(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return Zt(n,void 0,!0,!0)}function wO(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return Zt(t,void 0,!0,!0)}function Uv(e=!0){return Zt("/api/playbooks","playbooks",e)}function jO(e){const t=N2(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return Zt(n,void 0,!0,!0)}function A2(e=!0){return Zt("/api/usage/facets",void 0,e)}function kO(e){const t=e?`/api/playbooks/${e}`:null;return Zt(t,"playbooks")}function SO(){return Zt("/api/memories","project")}function NO(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return Zt(n,"project")}function CO(){return Zt("/api/resources","project")}function EO(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return Zt(n,"project")}const Zh=["new-workspace","new-project","new-todo","new-assignment"];function TO(e){return typeof e=="string"&&Zh.includes(e)}const RO=["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","[","]"],AO=["mod","ctrl","alt","shift"];function xr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(xr).filter(l=>l.length>0).join(" ");const n=t.split("+").map(l=>l.trim()).filter(l=>l.length>0);if(n.length===0)return"";if(n.length===1)return n[0].toLowerCase();const r=n[n.length-1].toLowerCase(),o=n.slice(0,-1).map(l=>l.toLowerCase()),i=new Set,a=[];for(const l of AO)o.includes(l)&&!i.has(l)&&(a.push(l),i.add(l));for(const l of o)i.has(l)||(a.push(l),i.add(l));return[...a,r].join("+")}function PO(e){const t=xr(e);return t?RO.includes(t):!1}const _O={"new-workspace":xr("Mod+Shift+Alt+w"),"new-project":xr("Mod+Shift+Alt+p"),"new-todo":xr("Mod+Shift+Alt+t"),"new-assignment":xr("Mod+Shift+Alt+a")};function DO(e){const t={..._O};for(const n of Zh){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function ra(){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 $O(e){const t=e.split("+").map(o=>o.trim()),n=t[t.length-1]??"",r=new Set(t.slice(0,-1).map(o=>o.toLowerCase()));return{key:n.toLowerCase(),mod:r.has("mod"),shift:r.has("shift"),alt:r.has("alt"),ctrl:r.has("ctrl")}}function Zf(e,t){const n=$O(t);if(e.key.toLowerCase()!==n.key)return!1;const o=ra()?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 P2(e){const t=[],n=ra()?e.metaKey:e.ctrlKey;n&&t.push("mod"),e.ctrlKey&&!n&&t.push("ctrl"),e.altKey&&t.push("alt");const r=e.key;let o;r===" "||r==="Spacebar"?o="space":(r.length,o=r.toLowerCase());const i=o.length===1&&/^[a-z0-9]$/.test(o);e.shiftKey&&i&&t.push("shift");const a=[...t,o].join("+");return xr(a)}function Gs(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?ra()?"⌘":"Ctrl":r==="shift"?ra()?"⇧":"Shift":r==="alt"?ra()?"⌥":"Alt":r==="ctrl"?ra()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(ra()?"":"+")}function IO(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),gc(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function _2(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch("/api/todos");if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),gc(u=>{e&&u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function Hv(e,t,n){await Ci(`/api/todos/${encodeURIComponent(e)}`,{description:t,tags:n})}async function D2(e,t,n){await Ci(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{summary:"Completed."})}async function $2(e,t,n){await Ci(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{reason:n})}async function I2(e,t,n){await Ci(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{session:n})}async function M2(e,t){await Ci(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{})}async function L2(e,t){await MO(`/api/todos/${encodeURIComponent(e)}/${t}`)}async function O2(e,t,n){const r=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function Vv(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function F2(e,t,n){for(const r of n){const o=await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function z2(e,t,n){const r=await fetch(Vv(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Ci(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function MO(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function LO(e,t){return await Ci(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function OO(e){return await Ci("/api/todos/promote-bulk",e)}async function FO(e,t,n){await Ci(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const em=["assignment","project","todo","server","playbook"],da={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},B2=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],xb="all",U2=/^[a-z][a-z0-9]*$/;function Wv(e){return typeof e=="string"&&em.includes(e)}function zO(e){return e==="all"||Wv(e)}function BO(e){if(!e||typeof e!="object")return HO();const t=e,n=zO(t.defaultScope)?t.defaultScope:da.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:da.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))U2.test(i)&&i!==xb&&!B2.includes(i)&&Wv(a)&&(o[i]=a)}else o={...da.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function UO(e){if(!e||typeof e!="object")return{ok:!1,errors:["aliases must be an object"]};const t=[];for(const[n,r]of Object.entries(e))U2.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===xb&&t.push(`alias key "${xb}" is reserved (the "search everything" escape)`),B2.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),Wv(r)||t.push(`alias "${n}" must map to one of: ${em.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function HO(){return{defaultScope:da.defaultScope,aliases:{...da.aliases},externalIds:da.externalIds}}const qv={search:da,custom:!1};let Sl=null,al=null,oh=0;const yb=new Set;function H2(e){Sl=e;for(const t of yb)t(e)}function Kv(e){if(!e||typeof e!="object")return qv;const t=e;return{search:BO(t.search),custom:t.custom===!0}}function VO(){if(Sl)return Promise.resolve(Sl);if(al)return al;const e=++oh;return al=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{al=null;const n=Kv(t);return e!==oh?Sl??n:(Sl=n,n)}).catch(()=>(al=null,qv)),al}function Gv(){const[e,t]=m.useState(()=>Sl??qv);return m.useEffect(()=>{let n=!1;return VO().then(r=>{n||t(r)}),yb.add(t),()=>{n=!0,yb.delete(t)}},[]),e}async function WO(e){var r;++oh;const t=await fetch("/api/config/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const o=await t.json().catch(()=>null);throw new Error(((r=o==null?void 0:o.errors)==null?void 0:r.join("; "))??(o==null?void 0:o.error)??`HTTP ${t.status}`)}const n=Kv(await t.json());return H2(n),n}async function qO(){++oh;const e=await fetch("/api/config/search",{method:"DELETE"});if(!e.ok){const n=await e.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${e.status}`)}const t=Kv(await e.json());return H2(t),t}const KO=new Set(["/projects","/assignments","/servers","/todos"]);function _p(e,t){return KO.has(e)?`${t}${e}`:e}const GO=[{id:"page-overview",title:"Overview",basePath:"/",keywords:["home","dashboard"]},{id:"page-projects",title:"Projects",basePath:"/projects",keywords:[]},{id:"page-assignments",title:"Assignments",basePath:"/assignments",keywords:[]},{id:"page-todos",title:"Todos",basePath:"/todos",keywords:["tasks"]},{id:"page-servers",title:"Servers",basePath:"/servers",keywords:["sessions"]},{id:"page-playbooks",title:"Playbooks",basePath:"/playbooks",keywords:[]},{id:"page-memories",title:"Memories",basePath:"/memories",keywords:["knowledge","learnings"]},{id:"page-resources",title:"Resources",basePath:"/resources",keywords:["knowledge","reference"]},{id:"page-workflow",title:"Workflow",basePath:"/workflow",keywords:["statuses","transitions","derive","facts"]},{id:"page-settings",title:"Settings",basePath:"/settings",keywords:[]},{id:"page-help",title:"Help",basePath:"/help",keywords:["shortcuts"]}];function YO(e){if(!(e!=null&&e.length))return[];const t=[];for(const n of e)n.id&&(t.push(n.id),n.system&&t.push(`${n.system}:${n.id}`));return t}function XO(e){const t=[],n=e.externalIds!==!1,r=i=>n?YO(i):[],o=i=>n?i:void 0;for(const i of GO)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:_p(i.basePath,e.wsPrefix)});for(const i of e.projects??[]){const a=i.workspace?`/w/${i.workspace}`:"";t.push({type:"project",id:`project-${i.slug}`,title:i.title,subtitle:i.slug,keywords:[...i.tags??[],...r(i.externalIds)],route:`${a}/projects/${i.slug}`,tags:i.tags,project:i.slug,externalIds:o(i.externalIds)}),t.push({type:"todo",id:`project-todos-${i.slug}`,title:`${i.title} todos`,subtitle:`${i.slug} · project`,keywords:[...i.tags??[],"project","todos"],route:`${a}/projects/${i.slug}?tab=todos`})}for(const i of e.assignments??[]){const a=i.projectWorkspace?`/w/${i.projectWorkspace}`:"";t.push({type:"assignment",id:i.projectSlug===null?`assignment-standalone-${i.id}`:`assignment-${i.projectSlug}-${i.slug}`,title:i.title,subtitle:`${i.projectTitle} · ${i.status}`,keywords:[i.projectSlug??"standalone",i.assignee??"",...r(i.externalIds)].filter(l=>!!l),route:i.projectSlug===null?`/assignments/${i.id}`:`${a}/projects/${i.projectSlug}/assignments/${i.slug}`,status:i.status,tags:i.tags,assignee:i.assignee,assignmentType:i.type,project:i.projectSlug,externalIds:o(i.externalIds)})}for(const i of e.playbooks??[])t.push({type:"playbook",id:`playbook-${i.slug}`,title:i.name,subtitle:i.description,keywords:i.tags,route:`/playbooks/${i.slug}`,tags:i.tags});for(const i of e.servers??[])t.push({type:"server",id:`server-${i.name}`,title:i.name,subtitle:i.alive?"alive":"dead",route:`${_p("/servers",e.wsPrefix)}#server-${encodeURIComponent(i.name)}`});for(const i of e.todos??[]){const a=i.workspace&&i.workspace!=="_ungrouped"?`/w/${i.workspace}`:e.wsPrefix,l=_p("/todos",a);t.push({type:"todo",id:`todo-${i.id}`,title:i.description,subtitle:i.status,keywords:i.tags,route:`${l}?focus=${encodeURIComponent(i.id)}`,status:i.status,tags:i.tags})}return t}function QO(e){return!e.standalone&&!!e.projectWorkspace&&e.fileKind!=="memory"&&e.fileKind!=="resource"?`/w/${e.projectWorkspace}`:""}function JO(e){return e.map((t,n)=>({type:"content",id:`content-${t.path}-${n}`,title:`${t.assignmentSlug??t.itemSlug??""} › ${t.section??t.fileKind}`,subtitle:t.projectSlug??(t.standalone?"standalone":void 0),route:`${QO(t)}${t.route}`,project:t.projectSlug,snippet:t.snippet,snippetMatches:t.matches}))}function Pr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Dp(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function ZO(e,t,n){const r=t?"disable":"enable",o=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${r}`,{method:"POST"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error||`Failed to ${r} playbook`)}n()}async function qx(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 r=await n.json().catch(()=>({}));throw new Error(r.error||`Failed to create todo (HTTP ${n.status})`)}}async function v1(){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 w1(){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 Kx(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 Yi(e,t,n){const r=e.match(/^(---\n)([\s\S]*?)(\n---)/);if(!r)return`---
532
+ ${t}: ${JSON.stringify(n)}
533
+ ---
534
+ ${e}`;const o=r[1],i=r[2],a=r[3],l=e.slice(r[0].length),u=JSON.stringify(n),f=new RegExp(`^${t}:\\s*.*$`,"m");let p;return f.test(i)?p=i.replace(f,`${t}: ${u}`):p=`${i}
535
+ ${t}: ${u}`,`${o}${p}${a}${l}`}const e5=/^[a-z0-9][a-z0-9-]*$/;function t5(e){const{playbooks:t,projectSlug:n,currentProjectTitle:r,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:a,navigate:l,toggleTheme:u}=e,f=[];if(f.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:e5,message:"Use lowercase letters, digits, and hyphens (e.g. acme-app). Must start with a letter or digit."}}],submit:async(p,h)=>{const g=(p.name??"").trim();if(!g)throw new Error("Name is required");const y=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:g})});if(!y.ok){const k=await y.json().catch(()=>({}));throw new Error(k.error||`Failed to create workspace (HTTP ${y.status})`)}h.navigate(`/w/${g}/projects`)}}}),f.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:p,hasUngrouped:h}=await v1(),g=[{value:"_ungrouped",label:"Ungrouped",hint:"no workspace"}];for(const y of p)g.push({value:y,label:y,hint:"workspace"});return g}},{kind:"text",id:"title",label:"Project title",placeholder:"e.g. Marketing site rebuild",required:!0}],submit:async(p,h)=>{const g=(p.workspace??"").trim(),y=(p.title??"").trim();if(!y)throw new Error("Title is required");const k=Pr(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");let v=await Kx("/api/templates/project");v=Yi(v,"slug",k),v=Yi(v,"title",y),g&&g!=="_ungrouped"&&(v=Yi(v,"workspace",g));const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:v})}),j=await b.json().catch(()=>({}));if(!b.ok)throw new Error(j.error||`Failed to create project (HTTP ${b.status})`);const N=g&&g!=="_ungrouped"?`/w/${g}/projects/${j.slug??k}`:`/projects/${j.slug??k}`;h.navigate(N)}}}),f.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:p},h]=await Promise.all([v1(),w1()]),g=[{value:"_ungrouped",label:"Global",hint:"no workspace"}];for(const y of p)g.push({value:y,label:y,hint:"workspace"});for(const y of h){const k=y.workspace??"_ungrouped";g.push({value:k,label:`${y.title}`,hint:`project · ${y.workspace??"ungrouped"}`})}return g}},{kind:"text",id:"description",label:"Description",placeholder:"Describe the todo…",required:!0}],submit:async p=>{const h=(p.scope??"_ungrouped").trim()||"_ungrouped",g=(p.description??"").trim();if(!g)throw new Error("Description is required");await Hv(h,g)}}}),f.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 p=await w1(),h=[{value:"_standalone",label:"Standalone",hint:"one-off / not in a project"}];for(const g of p)h.push({value:g.slug,label:g.title,hint:g.workspace?`workspace · ${g.workspace}`:"ungrouped"});return h}},{kind:"text",id:"title",label:"Assignment title",placeholder:"What needs to get done?",required:!0}],submit:async(p,h)=>{var S;const g=(p.project??"_standalone").trim()||"_standalone",y=(p.title??"").trim();if(!y)throw new Error("Title is required");const k=Pr(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");if(g==="_standalone"){let C=await Kx("/api/templates/assignment?standalone=1");C=Yi(C,"slug",k),C=Yi(C,"title",y);const D=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:C})}),T=await D.json().catch(()=>({}));if(!D.ok)throw new Error(T.error||`Failed to create assignment (HTTP ${D.status})`);const R=((S=T==null?void 0:T.assignment)==null?void 0:S.id)??(T==null?void 0:T.id);R?h.navigate(`/assignments/${R}`):h.navigate("/assignments");return}let v=await Kx("/api/templates/assignment");v=Yi(v,"slug",k),v=Yi(v,"title",y);const b=await fetch(`/api/projects/${encodeURIComponent(g)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:v})}),j=await b.json().catch(()=>({}));if(!b.ok)throw new Error(j.error||`Failed to create assignment (HTTP ${b.status})`);const N=j.slug??k;h.navigate(`/projects/${g}/assignments/${N}`)}}}),f.push({id:"create-project-route",title:"New Project (advanced editor)",subtitle:"Open the markdown editor",group:"Create",keywords:["new","create","project","advanced","editor"],run:()=>l(`${i}/create/project`)}),f.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:()=>l(`${i}/assignments/new`)}),n&&f.push({id:`create-assignment-in-${n}`,title:`New Assignment in ${r??n}`,subtitle:n,group:"Create",keywords:["new","create","assignment",n],run:()=>l(`${i}/projects/${n}/create/assignment`)}),f.push({id:"create-playbook",title:"New Playbook",group:"Create",keywords:["new","create","playbook"],run:()=>l("/playbooks/create")}),f.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 p=>{const h=p.trim();h&&await qx("_ungrouped",h)}}}),i){const p=i.replace(/^\/w\//,"");f.push({id:`create-todo-workspace-${p}`,title:`New Todo in workspace ${p}`,subtitle:p,group:"Create",keywords:["new","create","todo","workspace",p],requiresInput:{placeholder:`Describe the todo for workspace ${p}…`,runWithInput:async h=>{const g=h.trim();g&&await qx(p,g)}}})}n&&o&&f.push({id:`create-todo-project-${n}`,title:`New Todo in project ${r??n}`,subtitle:`${n} · workspace ${o}`,group:"Create",keywords:["new","create","todo","project",n,o],requiresInput:{placeholder:`Describe the todo for project ${r??n}…`,runWithInput:async p=>{const h=p.trim();h&&await qx(o,h)}}});for(const p of t)f.push({id:`toggle-playbook-${p.slug}`,title:`Toggle Playbook: ${p.name}`,subtitle:p.enabled?"enabled":"disabled",group:"Toggle",keywords:["toggle","playbook",p.slug,...p.tags??[]],run:()=>ZO(p.slug,p.enabled,a)});return f.push({id:"toggle-theme",title:"Toggle theme",subtitle:"Light / dark",group:"Theme",keywords:["theme","toggle","light","dark","appearance"],run:()=>u()}),f}const n5=["low","medium","high","critical"],tm={status:{kind:"enum"},priority:{kind:"ordinal",order:n5},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 r5(e,t){return e[t.toLowerCase()]??null}function _r(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class Dr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function V2(e){const[t,n,r]=e.split("-").map(a=>parseInt(a,10)),o=new Date(t,n-1,r).getTime(),i=new Date(t,n-1,r+1).getTime();return[o,i]}function bb(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 Du(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 Gx(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function s5(e){return e==null||e===""}function $p(e,t,n,r){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>s5(_r(e,t,o)):o=>Gx(_r(e,t,o),n.raw);case"substring":return o=>{const i=_r(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 Dr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return a=>{const l=_r(e,t,a),u=typeof l=="boolean"?l:l==="true"?!0:l==="false"||l===null||l===void 0||l===""?!1:null;return u!==null&&u===i}}case"number":{const o=n.num??Du(n.raw);if(o===null)throw new Dr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>Du(_r(e,t,i))===o}case"ordinal":return o=>Gx(_r(e,t,o),n.raw);case"list":return o=>{const i=_r(e,t,o);return Array.isArray(i)&&i.some(a=>Gx(a,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=V2(n.raw);return a=>{const l=bb(_r(e,t,a));return l!==null&&l>=o&&l<i}}throw new Dr([{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 Dr([{pos:r,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function o5(e,t,n,r){const o=(i,a)=>{switch(n){case"<":return i<a;case">":return i>a;case"<=":return i<=a;case">=":return i>=a;case"=":return i===a;case"!=":return i!==a;default:return!1}};switch(e.kind){case"number":{const i=r.num??Du(r.raw);if(i===null)throw new Dr([{pos:r.pos,message:`"${r.raw}" is not a number (field "${t}")`}]);return a=>{const l=Du(_r(e,t,a));return l!==null&&o(l,i)}}case"ordinal":{const i=e.order??[],a=i.findIndex(l=>l.toLowerCase()===r.raw.toLowerCase());if(a<0)throw new Dr([{pos:r.pos,message:`"${r.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return l=>{const u=_r(e,t,l),f=typeof u=="string"?i.findIndex(p=>p.toLowerCase()===u.toLowerCase()):-1;return f>=0&&o(f,a)}}case"timestamp":{if(r.type==="duration"){const a=(r.sign===0?-1:r.sign??-1)*(r.num??0);return(l,u)=>{const f=bb(_r(e,t,l));return f!==null&&o(f,u.now+a)}}if(r.type==="date"){const[i,a]=V2(r.raw);return l=>{const u=bb(_r(e,t,l));if(u===null)return!1;switch(n){case"<":return u<i;case"<=":return u<a;case">":return u>=a;case">=":return u>=i;case"=":return u>=i&&u<a;case"!=":return u<i||u>=a;default:return!1}}}throw new Dr([{pos:r.pos,message:`Compare timestamp field "${t}" to a duration (e.g. -36h) or a date (YYYY-MM-DD)`}])}case"duration":{if(r.type!=="duration")throw new Dr([{pos:r.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=r.num??0;return a=>{const l=Du(_r(e,t,a));return l!==null&&o(l,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return $p(e,t,r,r.pos);if(n==="!="){const i=$p(e,t,r,r.pos);return(a,l)=>!i(a,l)}throw new Dr([{pos:r.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=$p(e,t,r,r.pos);return n==="="?i:(a,l)=>!i(a,l)}throw new Dr([{pos:r.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function i5(e,t){const n=r5(t,e.field);if(!n)throw new Dr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const r=e.values.map(o=>$p(n,e.field,o,e.pos));return r.length===1?r[0]:(o,i)=>r.some(a=>a(o,i))}return o5(n,e.field,e.op,e.values[0])}function $u(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return i5(e,t);case"not":{const n=$u(e.child,t);return(r,o)=>!n(r,o)}case"and":{const n=e.children.map(r=>$u(r,t));return(r,o)=>n.every(i=>i(r,o))}case"or":{const n=e.children.map(r=>$u(r,t));return(r,o)=>n.some(i=>i(r,o))}}}class sa extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const a5={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},l5=/[A-Za-z_]/,c5=/[A-Za-z0-9_-]/,u5=/^\d{4}-\d{2}-\d{2}/;function nm(e){const t=[];let n=0;const r=(o,i)=>{let a=n;for(;a<e.length&&/\d/.test(e[a]);)a++;const l=e.slice(n,a);let u="";for(;a<e.length&&/[a-z]/i.test(e[a]);)u+=e[a],a++;if(n=a,u.length>0){const f=a5[u.toLowerCase()];if(f===void 0)throw new sa(o,`Unknown duration unit "${u}" (expected h, d, w, m, mo, or y)`);return{type:"DURATION",text:e.slice(o,a),pos:o,num:parseInt(l,10)*f,sign:i}}return i!==0?{type:"NUMBER",text:e.slice(o,a),pos:o,num:i*parseInt(l,10)}:{type:"NUMBER",text:l,pos:o,num:parseInt(l,10)}};for(;n<e.length;){const o=e[n],i=n;if(o===" "||o===" "||o===`
536
+ `||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 sa(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 a=o;let l=n+1,u="";for(;l<e.length&&e[l]!==a;)e[l]==="\\"&&l+1<e.length?(u+=e[l+1],l+=2):(u+=e[l],l++);if(l>=e.length)throw new sa(i,"Unterminated string literal");t.push({type:"STRING",text:u,pos:i}),n=l+1;continue}if(o==="-"||o==="+"){if(/\d/.test(e[n+1]??"")){const a=o==="-"?-1:1;n++,t.push(r(i,a));continue}if(o==="-"){t.push({type:"MINUS",text:"-",pos:i}),n++;continue}throw new sa(i,'Unexpected "+"')}if(/\d/.test(o)){const a=e.slice(n).match(u5);if(a){t.push({type:"DATE",text:a[0],pos:i}),n+=a[0].length;continue}t.push(r(i,0));continue}if(l5.test(o)){let a=n+1;for(;a<e.length&&c5.test(e[a]);)a++;const l=e.slice(n,a),u=l.toLowerCase();u==="and"?t.push({type:"AND",text:l,pos:i}):u==="or"?t.push({type:"OR",text:l,pos:i}):u==="not"?t.push({type:"NOT",text:l,pos:i}):t.push({type:"IDENT",text:l,pos:i}),n=a;continue}throw new sa(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Qi extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const d5=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),f5=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class p5{constructor(t){$x(this,"pos",0);this.tokens=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(t,n){const r=this.peek();if(r.type!==t)throw new Qi(r.pos,`Expected ${n}, got "${r.text||r.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 Qi(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(f5.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 Qi(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 Qi(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 r=this.valueOrList();return{kind:"atom",field:t.text,op:":",values:r,pos:t.pos}}if(n.type==="OP"){this.next();const r=this.value();return{kind:"atom",field:t.text,op:n.text,values:[r],pos:t.pos}}throw new Qi(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(!d5.has(t.type))throw new Qi(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 rm(e){try{const t=nm(e);return{ast:new p5(t).parseQuery(),errors:[]}}catch(t){if(t instanceof sa||t instanceof Qi)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Yl(e,t=tm){const n=rm(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:$u(n.ast,t),ast:n.ast},errors:[]}}catch(r){if(r instanceof Dr)return{query:null,errors:r.errors};throw r}}function rn(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 j1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function sm(...e){return t=>{let n=!1;const r=e.map(o=>{const i=j1(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():j1(e[o],null)}}}}function Zn(...e){return m.useCallback(sm(...e),e)}function h5(e,t){const n=m.createContext(t),r=i=>{const{children:a,...l}=i,u=m.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:u,children:a})};r.displayName=e+"Provider";function o(i){const a=m.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Ca(e,t=[]){let n=[];function r(i,a){const l=m.createContext(a),u=n.length;n=[...n,a];const f=h=>{var j;const{scope:g,children:y,...k}=h,v=((j=g==null?void 0:g[e])==null?void 0:j[u])||l,b=m.useMemo(()=>k,Object.values(k));return s.jsx(v.Provider,{value:b,children:y})};f.displayName=i+"Provider";function p(h,g){var v;const y=((v=g==null?void 0:g[e])==null?void 0:v[u])||l,k=m.useContext(y);if(k)return k;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[f,p]}const o=()=>{const i=n.map(a=>m.createContext(a));return function(l){const u=(l==null?void 0:l[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,m5(o,...t)]}function m5(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=r.reduce((l,{useScope:u,scopeName:f})=>{const h=u(i)[`__scope${f}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var vi=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},g5=NE[" useId ".trim().toString()]||(()=>{}),x5=0;function $l(e){const[t,n]=m.useState(g5());return vi(()=>{n(r=>r??String(x5++))},[e]),e||(t?`radix-${t}`:"")}var y5=NE[" useInsertionEffect ".trim().toString()]||vi;function om({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=b5({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:o;{const p=m.useRef(e!==void 0);m.useEffect(()=>{const h=p.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"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.`),p.current=l},[l,r])}const f=m.useCallback(p=>{var h;if(l){const g=v5(p)?p(e):p;g!==e&&((h=a.current)==null||h.call(a,g))}else i(p)},[l,e,i,a]);return[u,f]}function b5({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return y5(()=>{i.current=t},[t]),m.useEffect(()=>{var a;o.current!==n&&((a=i.current)==null||a.call(i,n),o.current=n)},[n,o]),[n,r,i]}function v5(e){return typeof e=="function"}function w5(e){const t=j5(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(S5);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function j5(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=C5(o),l=N5(i,o.props);return o.type!==m.Fragment&&(l.ref=r?sm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var k5=Symbol("radix.slottable");function S5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===k5}function N5(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function C5(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 E5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],wn=E5.reduce((e,t)=>{const n=w5(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:a,...l}=o,u=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(u,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function T5(e,t){e&&wo.flushSync(()=>e.dispatchEvent(t))}function xa(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function R5(e,t=globalThis==null?void 0:globalThis.document){const n=xa(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var A5="DismissableLayer",vb="dismissableLayer.update",P5="dismissableLayer.pointerDownOutside",_5="dismissableLayer.focusOutside",k1,W2=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yv=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...u}=e,f=m.useContext(W2),[p,h]=m.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=m.useState({}),k=Zn(t,R=>h(R)),v=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),j=v.indexOf(b),N=p?v.indexOf(p):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,C=N>=j,D=I5(R=>{const $=R.target,_=[...f.branches].some(U=>U.contains($));!C||_||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},g),T=M5(R=>{const $=R.target;[...f.branches].some(U=>U.contains($))||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},g);return R5(R=>{N===f.layers.size-1&&(r==null||r(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},g),m.useEffect(()=>{if(p)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(k1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),S1(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=k1)}},[p,g,n,f]),m.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),S1())},[p,f]),m.useEffect(()=>{const R=()=>y({});return document.addEventListener(vb,R),()=>document.removeEventListener(vb,R)},[]),s.jsx(wn.div,{...u,ref:k,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:rn(e.onFocusCapture,T.onFocusCapture),onBlurCapture:rn(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:rn(e.onPointerDownCapture,D.onPointerDownCapture)})});Yv.displayName=A5;var D5="DismissableLayerBranch",$5=m.forwardRef((e,t)=>{const n=m.useContext(W2),r=m.useRef(null),o=Zn(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(wn.div,{...e,ref:o})});$5.displayName=D5;function I5(e,t=globalThis==null?void 0:globalThis.document){const n=xa(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let u=function(){q2(P5,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function M5(e,t=globalThis==null?void 0:globalThis.document){const n=xa(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&q2(_5,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function S1(){const e=new CustomEvent(vb);document.dispatchEvent(e)}function q2(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?T5(o,i):o.dispatchEvent(i)}var Yx="focusScope.autoFocusOnMount",Xx="focusScope.autoFocusOnUnmount",N1={bubbles:!1,cancelable:!0},L5="FocusScope",K2=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,u]=m.useState(null),f=xa(o),p=xa(i),h=m.useRef(null),g=Zn(t,v=>u(v)),y=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let v=function(S){if(y.paused||!l)return;const C=S.target;l.contains(C)?h.current=C:hi(h.current,{select:!0})},b=function(S){if(y.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||hi(h.current,{select:!0}))},j=function(S){if(document.activeElement===document.body)for(const D of S)D.removedNodes.length>0&&hi(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const N=new MutationObserver(j);return l&&N.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),N.disconnect()}}},[r,l,y.paused]),m.useEffect(()=>{if(l){E1.add(y);const v=document.activeElement;if(!l.contains(v)){const j=new CustomEvent(Yx,N1);l.addEventListener(Yx,f),l.dispatchEvent(j),j.defaultPrevented||(O5(H5(G2(l)),{select:!0}),document.activeElement===v&&hi(l))}return()=>{l.removeEventListener(Yx,f),setTimeout(()=>{const j=new CustomEvent(Xx,N1);l.addEventListener(Xx,p),l.dispatchEvent(j),j.defaultPrevented||hi(v??document.body,{select:!0}),l.removeEventListener(Xx,p),E1.remove(y)},0)}}},[l,f,p,y]);const k=m.useCallback(v=>{if(!n&&!r||y.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,j=document.activeElement;if(b&&j){const N=v.currentTarget,[S,C]=F5(N);S&&C?!v.shiftKey&&j===C?(v.preventDefault(),n&&hi(S,{select:!0})):v.shiftKey&&j===S&&(v.preventDefault(),n&&hi(C,{select:!0})):j===N&&v.preventDefault()}},[n,r,y.paused]);return s.jsx(wn.div,{tabIndex:-1,...a,ref:g,onKeyDown:k})});K2.displayName=L5;function O5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(hi(r,{select:t}),document.activeElement!==n)return}function F5(e){const t=G2(e),n=C1(t,e),r=C1(t.reverse(),e);return[n,r]}function G2(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function C1(e,t){for(const n of e)if(!z5(n,{upTo:t}))return n}function z5(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 B5(e){return e instanceof HTMLInputElement&&"select"in e}function hi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&B5(e)&&t&&e.select()}}var E1=U5();function U5(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=T1(e,t),e.unshift(t)},remove(t){var n;e=T1(e,t),(n=e[0])==null||n.resume()}}}function T1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function H5(e){return e.filter(t=>t.tagName!=="A")}var V5="Portal",Xv=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,i]=m.useState(!1);vi(()=>i(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?wL.createPortal(s.jsx(wn.div,{...r,ref:t}),a):null});Xv.displayName=V5;function W5(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Ea=e=>{const{present:t,children:n}=e,r=q5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=Zn(r.ref,K5(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Ea.displayName="Presence";function q5(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),a=e?"mounted":"unmounted",[l,u]=W5(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=ep(r.current);i.current=l==="mounted"?f:"none"},[l]),vi(()=>{const f=r.current,p=o.current;if(p!==e){const g=i.current,y=ep(f);e?u("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?u("UNMOUNT"):u(p&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),vi(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,h=y=>{const v=ep(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&v&&(u("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},g=y=>{y.target===t&&(i.current=ep(r.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{p.clearTimeout(f),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function ep(e){return(e==null?void 0:e.animationName)||"none"}function K5(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 Qx=0;function G5(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??R1()),document.body.insertAdjacentElement("beforeend",e[1]??R1()),Qx++,()=>{Qx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Qx--}},[])}function R1(){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 Hs=function(){return Hs=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Hs.apply(this,arguments)};function Y2(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Y5(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Ip="right-scroll-bar-position",Mp="width-before-scroll-bar",X5="with-scroll-bars-hidden",Q5="--removed-body-scroll-bar-size";function Jx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function J5(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Z5=typeof window<"u"?m.useLayoutEffect:m.useEffect,A1=new WeakMap;function eF(e,t){var n=J5(null,function(r){return e.forEach(function(o){return Jx(o,r)})});return Z5(function(){var r=A1.get(n);if(r){var o=new Set(r),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||Jx(l,null)}),i.forEach(function(l){o.has(l)||Jx(l,a)})}A1.set(n,e)},[e]),n}function tF(e){return e}function nF(e,t){t===void 0&&(t=tF);var n=[],r=!1,o={read:function(){if(r)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 a=t(i,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var u=function(){var p=a;a=[],p.forEach(i)},f=function(){return Promise.resolve().then(u)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function rF(e){e===void 0&&(e={});var t=nF(null);return t.options=Hs({async:!0,ssr:!1},e),t}var X2=function(e){var t=e.sideCar,n=Y2(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,Hs({},n))};X2.isSideCarExport=!0;function sF(e,t){return e.useMedium(t),X2}var Q2=rF(),Zx=function(){},im=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Zx,onWheelCapture:Zx,onTouchMoveCapture:Zx}),o=r[0],i=r[1],a=e.forwardProps,l=e.children,u=e.className,f=e.removeScrollBar,p=e.enabled,h=e.shards,g=e.sideCar,y=e.noRelative,k=e.noIsolation,v=e.inert,b=e.allowPinchZoom,j=e.as,N=j===void 0?"div":j,S=e.gapMode,C=Y2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=g,T=eF([n,t]),R=Hs(Hs({},C),o);return m.createElement(m.Fragment,null,p&&m.createElement(D,{sideCar:Q2,removeScrollBar:f,shards:h,noRelative:y,noIsolation:k,inert:v,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:S}),a?m.cloneElement(m.Children.only(l),Hs(Hs({},R),{ref:T})):m.createElement(N,Hs({},R,{className:u,ref:T}),l))});im.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};im.classNames={fullWidth:Mp,zeroRight:Ip};var oF=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function iF(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=oF();return t&&e.setAttribute("nonce",t),e}function aF(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function lF(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var cF=function(){var e=0,t=null;return{add:function(n){e==0&&(t=iF())&&(aF(t,n),lF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},uF=function(){var e=cF();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},J2=function(){var e=uF(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},dF={left:0,top:0,right:0,gap:0},ey=function(e){return parseInt(e||"",10)||0},fF=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ey(n),ey(r),ey(o)]},pF=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return dF;var t=fF(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},hF=J2(),Il="data-scroll-locked",mF=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
537
+ .`.concat(X5,` {
538
+ overflow: hidden `).concat(r,`;
539
+ padding-right: `).concat(l,"px ").concat(r,`;
540
+ }
541
+ body[`).concat(Il,`] {
542
+ overflow: hidden `).concat(r,`;
543
+ overscroll-behavior: contain;
544
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
545
+ padding-left: `.concat(o,`px;
546
+ padding-top: `).concat(i,`px;
547
+ padding-right: `).concat(a,`px;
548
+ margin-left:0;
549
+ margin-top:0;
550
+ margin-right: `).concat(l,"px ").concat(r,`;
551
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
552
+ }
553
+
554
+ .`).concat(Ip,` {
555
+ right: `).concat(l,"px ").concat(r,`;
556
+ }
557
+
558
+ .`).concat(Mp,` {
559
+ margin-right: `).concat(l,"px ").concat(r,`;
560
+ }
561
+
562
+ .`).concat(Ip," .").concat(Ip,` {
563
+ right: 0 `).concat(r,`;
564
+ }
565
+
566
+ .`).concat(Mp," .").concat(Mp,` {
567
+ margin-right: 0 `).concat(r,`;
568
+ }
569
+
570
+ body[`).concat(Il,`] {
571
+ `).concat(Q5,": ").concat(l,`px;
572
+ }
573
+ `)},P1=function(){var e=parseInt(document.body.getAttribute(Il)||"0",10);return isFinite(e)?e:0},gF=function(){m.useEffect(function(){return document.body.setAttribute(Il,(P1()+1).toString()),function(){var e=P1()-1;e<=0?document.body.removeAttribute(Il):document.body.setAttribute(Il,e.toString())}},[])},xF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;gF();var i=m.useMemo(function(){return pF(o)},[o]);return m.createElement(hF,{styles:mF(i,!t,o,n?"":"!important")})},wb=!1;if(typeof window<"u")try{var tp=Object.defineProperty({},"passive",{get:function(){return wb=!0,!0}});window.addEventListener("test",tp,tp),window.removeEventListener("test",tp,tp)}catch{wb=!1}var ll=wb?{passive:!1}:!1,yF=function(e){return e.tagName==="TEXTAREA"},Z2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!yF(e)&&n[t]==="visible")},bF=function(e){return Z2(e,"overflowY")},vF=function(e){return Z2(e,"overflowX")},_1=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=eT(e,r);if(o){var i=tT(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},wF=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jF=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},eT=function(e,t){return e==="v"?bF(t):vF(t)},tT=function(e,t){return e==="v"?wF(t):jF(t)},kF=function(e,t){return e==="h"&&t==="rtl"?-1:1},SF=function(e,t,n,r,o){var i=kF(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,u=t.contains(l),f=!1,p=a>0,h=0,g=0;do{if(!l)break;var y=tT(e,l),k=y[0],v=y[1],b=y[2],j=v-b-i*k;(k||j)&&eT(e,l)&&(h+=j,g+=k);var N=l.parentNode;l=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(p&&Math.abs(h)<1||!p&&Math.abs(g)<1)&&(f=!0),f},np=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},D1=function(e){return[e.deltaX,e.deltaY]},$1=function(e){return e&&"current"in e?e.current:e},NF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},CF=function(e){return`
574
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
575
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
576
+ `)},EF=0,cl=[];function TF(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(EF++)[0],i=m.useState(J2)[0],a=m.useRef(e);m.useEffect(function(){a.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=Y5([e.lockRef.current],(e.shards||[]).map($1),!0).filter(Boolean);return v.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(v,b){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!a.current.allowPinchZoom;var j=np(v),N=n.current,S="deltaX"in v?v.deltaX:N[0]-j[0],C="deltaY"in v?v.deltaY:N[1]-j[1],D,T=v.target,R=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in v&&R==="h"&&T.type==="range")return!1;var $=window.getSelection(),_=$&&$.anchorNode,U=_?_===T||_.contains(T):!1;if(U)return!1;var I=_1(R,T);if(!I)return!0;if(I?D=R:(D=R==="v"?"h":"v",I=_1(R,T)),!I)return!1;if(!r.current&&"changedTouches"in v&&(S||C)&&(r.current=D),!D)return!0;var V=r.current||D;return SF(V,b,v,V==="h"?S:C)},[]),u=m.useCallback(function(v){var b=v;if(!(!cl.length||cl[cl.length-1]!==i)){var j="deltaY"in b?D1(b):np(b),N=t.current.filter(function(D){return D.name===b.type&&(D.target===b.target||b.target===D.shadowParent)&&NF(D.delta,j)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var S=(a.current.shards||[]).map($1).filter(Boolean).filter(function(D){return D.contains(b.target)}),C=S.length>0?l(b,S[0]):!a.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),f=m.useCallback(function(v,b,j,N){var S={name:v,delta:b,target:j,should:N,shadowParent:RF(j)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),p=m.useCallback(function(v){n.current=np(v),r.current=void 0},[]),h=m.useCallback(function(v){f(v.type,D1(v),v.target,l(v,e.lockRef.current))},[]),g=m.useCallback(function(v){f(v.type,np(v),v.target,l(v,e.lockRef.current))},[]);m.useEffect(function(){return cl.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,ll),document.addEventListener("touchmove",u,ll),document.addEventListener("touchstart",p,ll),function(){cl=cl.filter(function(v){return v!==i}),document.removeEventListener("wheel",u,ll),document.removeEventListener("touchmove",u,ll),document.removeEventListener("touchstart",p,ll)}},[]);var y=e.removeScrollBar,k=e.inert;return m.createElement(m.Fragment,null,k?m.createElement(i,{styles:CF(o)}):null,y?m.createElement(xF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const AF=sF(Q2,TF);var nT=m.forwardRef(function(e,t){return m.createElement(im,Hs({},e,{ref:t,sideCar:AF}))});nT.classNames=im.classNames;var PF=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ul=new WeakMap,rp=new WeakMap,sp={},ty=0,rT=function(e){return e&&(e.host||rT(e.parentNode))},_F=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=rT(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},DF=function(e,t,n,r){var o=_F(t,Array.isArray(e)?e:[e]);sp[n]||(sp[n]=new WeakMap);var i=sp[n],a=[],l=new Set,u=new Set(o),f=function(h){!h||l.has(h)||(l.add(h),f(h.parentNode))};o.forEach(f);var p=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))p(g);else try{var y=g.getAttribute(r),k=y!==null&&y!=="false",v=(ul.get(g)||0)+1,b=(i.get(g)||0)+1;ul.set(g,v),i.set(g,b),a.push(g),v===1&&k&&rp.set(g,!0),b===1&&g.setAttribute(n,"true"),k||g.setAttribute(r,"true")}catch(j){console.error("aria-hidden: cannot operate on ",g,j)}})};return p(t),l.clear(),ty++,function(){a.forEach(function(h){var g=ul.get(h)-1,y=i.get(h)-1;ul.set(h,g),i.set(h,y),g||(rp.has(h)||h.removeAttribute(r),rp.delete(h)),y||h.removeAttribute(n)}),ty--,ty||(ul=new WeakMap,ul=new WeakMap,rp=new WeakMap,sp={})}},$F=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=PF(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),DF(r,o,n,"aria-hidden")):function(){return null}};function IF(e){const t=MF(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(OF);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function MF(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=zF(o),l=FF(i,o.props);return o.type!==m.Fragment&&(l.ref=r?sm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var LF=Symbol("radix.slottable");function OF(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===LF}function FF(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function zF(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 am="Dialog",[sT,oT]=Ca(am),[BF,Cs]=sT(am),iT=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=m.useRef(null),u=m.useRef(null),[f,p]=om({prop:r,defaultProp:o??!1,onChange:i,caller:am});return s.jsx(BF,{scope:t,triggerRef:l,contentRef:u,contentId:$l(),titleId:$l(),descriptionId:$l(),open:f,onOpenChange:p,onOpenToggle:m.useCallback(()=>p(h=>!h),[p]),modal:a,children:n})};iT.displayName=am;var aT="DialogTrigger",lT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Cs(aT,n),i=Zn(t,o.triggerRef);return s.jsx(wn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Zv(o.open),...r,ref:i,onClick:rn(e.onClick,o.onOpenToggle)})});lT.displayName=aT;var Qv="DialogPortal",[UF,cT]=sT(Qv,{forceMount:void 0}),uT=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Cs(Qv,t);return s.jsx(UF,{scope:t,forceMount:n,children:m.Children.map(r,a=>s.jsx(Ea,{present:n||i.open,children:s.jsx(Xv,{asChild:!0,container:o,children:a})}))})};uT.displayName=Qv;var ih="DialogOverlay",dT=m.forwardRef((e,t)=>{const n=cT(ih,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Cs(ih,e.__scopeDialog);return i.modal?s.jsx(Ea,{present:r||i.open,children:s.jsx(VF,{...o,ref:t})}):null});dT.displayName=ih;var HF=IF("DialogOverlay.RemoveScroll"),VF=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Cs(ih,n);return s.jsx(nT,{as:HF,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(wn.div,{"data-state":Zv(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ya="DialogContent",fT=m.forwardRef((e,t)=>{const n=cT(ya,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Cs(ya,e.__scopeDialog);return s.jsx(Ea,{present:r||i.open,children:i.modal?s.jsx(WF,{...o,ref:t}):s.jsx(qF,{...o,ref:t})})});fT.displayName=ya;var WF=m.forwardRef((e,t)=>{const n=Cs(ya,e.__scopeDialog),r=m.useRef(null),o=Zn(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return $F(i)},[]),s.jsx(pT,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:rn(e.onCloseAutoFocus,i=>{var a;i.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:rn(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:rn(e.onFocusOutside,i=>i.preventDefault())})}),qF=m.forwardRef((e,t)=>{const n=Cs(ya,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return s.jsx(pT,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var a,l;(a=e.onCloseAutoFocus)==null||a.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var u,f;(u=e.onInteractOutside)==null||u.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),pT=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=Cs(ya,n),u=m.useRef(null),f=Zn(t,u);return G5(),s.jsxs(s.Fragment,{children:[s.jsx(K2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:s.jsx(Yv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Zv(l.open),...a,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(GF,{titleId:l.titleId}),s.jsx(XF,{contentRef:u,descriptionId:l.descriptionId})]})]})}),Jv="DialogTitle",hT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Cs(Jv,n);return s.jsx(wn.h2,{id:o.titleId,...r,ref:t})});hT.displayName=Jv;var mT="DialogDescription",gT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Cs(mT,n);return s.jsx(wn.p,{id:o.descriptionId,...r,ref:t})});gT.displayName=mT;var xT="DialogClose",yT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Cs(xT,n);return s.jsx(wn.button,{type:"button",...r,ref:t,onClick:rn(e.onClick,()=>o.onOpenChange(!1))})});yT.displayName=xT;function Zv(e){return e?"open":"closed"}var bT="DialogTitleWarning",[KF,vT]=h5(bT,{contentName:ya,titleName:Jv,docsSlug:"dialog"}),GF=({titleId:e})=>{const t=vT(bT),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
577
+
578
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
579
+
580
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},YF="DialogDescriptionWarning",XF=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vT(YF).contentName}}.`;return m.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},wT=iT,jT=lT,kT=uT,ew=dT,tw=fT,nw=hT,rw=gT,sw=yT;const Ln=wT,QF=jT,JF=kT,ST=sw,NT=m.forwardRef(({className:e,...t},n)=>s.jsx(ew,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));NT.displayName=ew.displayName;const jn=m.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(JF,{children:[s.jsx(NT,{}),s.jsx(tw,{ref:r,className:Ne("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})]}));jn.displayName=tw.displayName;function tr({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function Ur({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const kn=m.forwardRef(({className:e,...t},n)=>s.jsx(nw,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));kn.displayName=nw.displayName;const ns=m.forwardRef(({className:e,...t},n)=>s.jsx(rw,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));ns.displayName=rw.displayName;const ZF=-1,e6=-40;function ny(e,t){if(e.length===0)return 0;if(t.length===0)return-1/0;let n=0,r=0,o=-2,i=0;for(let a=0;a<e.length;a++){const l=e[a];let u=!1;for(;r<t.length;)if(t[r]===l){if(n+=100,r===o+1&&(n+=20),r===0)n+=30;else{const f=t[r-1];(f===" "||f==="-"||f==="_"||f==="/")&&(n+=15)}i>0&&(n+=Math.max(e6,i*ZF)),o=r,i=0,r++,u=!0;break}else i++,r++;if(!u)return-1/0}return n}const I1={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function ow(e,t,n=50){const r=e.toLowerCase();if(!r)return t.slice(0,n).map(a=>({...a,score:0}));const i=t.map(a=>{var h;const l=ny(r,a.title.toLowerCase())*1,u=a.subtitle?ny(r,a.subtitle.toLowerCase())*.5:-1/0,f=(h=a.keywords)!=null&&h.length?ny(r,a.keywords.join(" ").toLowerCase())*.3:-1/0,p=Math.max(l,u,f);return{...a,score:p}}).filter(a=>a.score>-1/0);return i.sort((a,l)=>l.score!==a.score?l.score-a.score:a.title.length!==l.title.length?a.title.length-l.title.length:a.title!==l.title?a.title<l.title?-1:1:(I1[a.type]??99)-(I1[l.type]??99)),i.slice(0,n)}const t6={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},M1=Symbol("absent");function op(e){return e.replace(/\s+/g," ").trim()}const L1=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function n6(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function r6(e){const t=e.externalIds;return Array.isArray(t)?t.filter(n=>{const r=n==null?void 0:n.system;return typeof r=="string"&&r.toLowerCase()==="jira"}).map(n=>String(n.id)).join(" "):""}const Qu={kind:{kind:"enum",get:e=>e.type},status:{kind:"enum"},tag:{kind:"list",get:e=>e.tags},tags:{kind:"list"},assignee:{kind:"string",noneSentinel:!0,get:e=>"assignee"in e?e.assignee:M1},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:M1},externalid:{kind:"substring",get:n6},jira:{kind:"substring",get:r6},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function s6(e,t=t6,n){const r=(n==null?void 0:n.defaultScope)??"all",o=e.match(/^\s*all:\s*/i),i=o!==null,a=i?e.slice(o[0].length):e,l=i6(a,t),u={aqlExpr:l.aqlExpr,fuzzy:l.fuzzy};if(r!=="all"&&!i&&e.trim()!==""&&!o6(l.aqlExpr)){const f=`kind:${r}`;u.aqlExpr=l.aqlExpr?l.explicit?`${f} (${l.aqlExpr})`:`${f} ${l.aqlExpr}`:f}return u}function o6(e){if(!e)return!1;let t;try{t=nm(e)}catch{return!1}for(let n=0;n<t.length-1;n++)if(t[n].type==="IDENT"&&t[n].text.toLowerCase()==="kind"&&t[n+1].type==="COLON")return!0;return!1}function i6(e,t){let n;try{n=nm(e)}catch(h){if(h instanceof sa)return{aqlExpr:"",fuzzy:op(e),explicit:!1};throw h}const r=n.length,o=(h,g)=>e.slice(n[h].pos,g<r?n[g].pos:e.length);let i=!1;for(let h=0;h<r;h++){const g=n[h];if(g.type==="OR"||g.type==="LPAREN"&&(h===0||n[h-1].type!=="COLON")){i=!0;break}}if(i){const h=op(c6(e,n,r,t));return Yl(h,Qu).query?{aqlExpr:h,fuzzy:"",explicit:!0}:{aqlExpr:"",fuzzy:op(e),explicit:!0}}const a=[],l=[];let u=0,f=0;const p=h=>{if(h>f){const g=op(o(f,h));g&&l.push(g)}};for(;u<r-1;){const h=a6(n,u,t);if(h){p(u),a.push(h.atom),u=h.end,f=u;continue}const g=l6(n,u,r);if(g!==null){const y=o(u,g).trim();if(Yl(y,Qu).query){p(u),a.push(y),u=g,f=u;continue}u=g;continue}u++}return p(r-1),{aqlExpr:a.join(" "),fuzzy:l.join(" "),explicit:!1}}function a6(e,t,n){var l;let r=t,o="";e[r].type==="MINUS"?(o="-",r++):e[r].type==="NOT"&&(o="NOT ",r++);const i=e[r];if(!i||i.type!=="IDENT")return null;const a=n[i.text.toLowerCase()];return!a||((l=e[r+1])==null?void 0:l.type)!=="COLON"?null:{atom:`${o}kind:${a}`,end:r+2}}function l6(e,t,n){let r=t;(e[r].type==="MINUS"||e[r].type==="NOT")&&r++;const o=e[r];if(!o||o.type!=="IDENT"||!Object.prototype.hasOwnProperty.call(Qu,o.text.toLowerCase()))return null;const i=e[r+1];if(!i)return null;if(i.type==="COLON"){const a=e[r+2];if(!a)return null;if(a.type==="LPAREN"){let l=0;for(let u=r+2;u<n;u++)if(e[u].type==="LPAREN")l++;else if(e[u].type==="RPAREN"){if(l--,l===0)return u+1}else if(e[u].type==="EOF")return null;return null}return L1.has(a.type)?r+3:null}if(i.type==="OP"){const a=e[r+2];return a&&L1.has(a.type)?r+3:null}return null}function c6(e,t,n,r){var a;let o="",i=0;for(let l=0;l<n;l++){const u=t[l];u.type==="IDENT"&&Object.prototype.hasOwnProperty.call(r,u.text.toLowerCase())&&((a=t[l+1])==null?void 0:a.type)==="COLON"&&(o+=e.slice(i,u.pos)+`kind:${r[u.text.toLowerCase()]} `,i=t[l+1].pos+1)}return o+=e.slice(i),o}const iw=["kanban","list","table"],CT=["title","status","priority","assignee","dependencies","created","updated"],u6=["asc","desc"],d6=["comfortable","compact"],f6=["none","status","type","priority","assignee","project"],p6=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function qe(e){const t=e===void 0?[]:Array.isArray(e)?e:[e],n=[];for(const r of t){if(typeof r!="string")continue;const o=r.trim();!o||o==="all"||n.includes(o)||n.push(o)}return n}function h6(e,t){const n=qe(e),r=qe(t);return n.length===r.length&&n.every(o=>r.includes(o))}const m6={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Ju={version:1,global:m6,projects:{}};function ry(e){return e==="table"?"table":"kanban"}function g6(e,t){return t?{...e,...t}:{...e}}function ET(e,t){const n=e.global;if(t===null)return n;const r=e.projects[t];return r?{defaultView:r.defaultView??n.defaultView,sortField:r.sortField??n.sortField,sortDirection:r.sortDirection??n.sortDirection,density:n.density,grouping:r.grouping??n.grouping,filters:g6(n.filters,r.filters)}:n}const x6=/^[A-Za-z_][A-Za-z0-9_-]*$/,y6=new Set(["and","or","not"]);function aw(e){return x6.test(e)&&!y6.has(e.toLowerCase())?e:TT(e)}function TT(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const RT="__unassigned__",AT="__standalone__",b6={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function v6(e){return e.startsWith("older_")?"<":">="}const lw=["status","type","priority","assignee","project","tags"],w6=["created","updated"];function j6(e){var i;const t={};for(const a of lw){const l=qe(e[a]);l.length&&(t[a]=l)}const n=(i=e.search)==null?void 0:i.trim();n&&(t.search=n);let r=e.activity&&e.activity!=="all"?e.activity:void 0;const o=e.dateRange;if(o){const a=k6(o);if(a)r||(r=a);else{const l=S6(o);l&&(t.dateRange=l)}}return r&&(t.activity=r),t}function k6(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function S6(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 r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Iu(e){const t=j6(e),n=[];for(const r of lw){const o=t[r]??[];o.length&&n.push(N6(r,o))}return t.search&&n.push(`search:${TT(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...E6(t.dateRange)),n.join(" AND ")}function N6(e,t){const n=t.map(r=>C6(e,r));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function C6(e,t){return e==="assignee"&&t===RT||e==="project"&&t===AT?"none":aw(t)}function E6(e){if(e.preset)return[`${e.field} ${v6(e.preset)} -${b6[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function Mu(e){const t=rm(e);if(!t.ast)return null;const n=T6(t.ast);if(n===null)return null;const r={},o=new Set,i=new Map;for(const a of n){const l=R6(a);if(!l)return null;switch(l.kind){case"value":{if(o.has(l.field))return null;o.add(l.field),r[l.field]=l.values;break}case"search":{if(o.has("search"))return null;o.add("search"),r.search=l.text;break}case"activity":{if(o.has("activity"))return null;o.add("activity"),r.activity=l.activity;break}case"datePreset":{const u=`date:${l.field}`;if(o.has(u)||i.has(l.field))return null;o.add(u),r.dateRange={field:l.field,preset:l.preset};break}case"dateBound":{const u=`date:${l.field}`;if(o.has(u))return null;const f=i.get(l.field)??{};if(l.bound==="from"){if(f.from!==void 0)return null;f.from=l.date}else{if(f.to!==void 0)return null;f.to=l.date}i.set(l.field,f);break}}}if(i.size>1)return null;for(const[a,l]of i){if(r.dateRange)return null;const u={field:a};l.from!==void 0&&(u.from=l.from),l.to!==void 0&&(u.to=l.to),r.dateRange=u}return r}function T6(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 R6(e){const t=e.field.toLowerCase();if(e.op===":"){if(lw.includes(t)){const o=t,i=[];for(const a of e.values){const l=$6(o,a);if(l===null)return null;i.push(l)}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(!w6.includes(t))return null;const n=t;if(e.values.length!==1)return null;const r=e.values[0];return r.type==="duration"?A6(n,e.op,r):r.type==="date"?e.op===">="?{kind:"dateBound",field:n,bound:"from",date:r.raw}:e.op==="<="?{kind:"dateBound",field:n,bound:"to",date:r.raw}:null:null}function A6(e,t,n){if(n.sign!==-1)return null;const r=P6(n.raw);if(e==="updated"){if(t==="<"&&r==="7d")return{kind:"activity",activity:"stale"};if(t===">="&&r==="7d")return{kind:"activity",activity:"fresh"}}const o=D6(t,r);return o?{kind:"datePreset",field:e,preset:o}:null}function P6(e){return e.replace(/^[-+]/,"")}const _6={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function D6(e,t){return e!==">="&&e!=="<"?null:_6[e][t]??null}function $6(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?RT:e==="project"&&n.toLowerCase()==="none"?AT:n}const I6=new Set(["status","type","tag","assignee","externalid"]),sy=new Set(["IDENT","STRING","NUMBER","DATE","DURATION","STAR"]),O1=8;function M6(e,t,n){var k,v,b,j,N;let r;try{r=nm(e)}catch{return[]}const o=r.length,i=S=>{const C=S+1<o?r[S+1].pos:e.length;return r[S].pos+e.slice(r[S].pos,C).replace(/\s+$/,"").length};let a=-1;for(let S=0;S<o-1;S++)if(t>r[S].pos&&t<=i(S)){a=S;break}let l=a>=0?a-1:-1;if(a<0)for(let S=0;S<o-1&&i(S)<=t;S++)l=S;let u=null,f=null,p="";if(a>=0&&r[a].type==="COLON"&&((k=r[a-1])==null?void 0:k.type)==="IDENT"?(u=r[a-1].text.toLowerCase(),f=[t,t]):a>=0&&sy.has(r[a].type)&&((v=r[a-1])==null?void 0:v.type)==="COLON"&&((b=r[a-2])==null?void 0:b.type)==="IDENT"?(u=r[a-2].text.toLowerCase(),f=[r[a].pos,i(a)],p=r[a].text):a<0&&l>=0&&r[l].type==="COLON"&&((j=r[l-1])==null?void 0:j.type)==="IDENT"&&(u=r[l-1].text.toLowerCase(),f=[t,t]),u!==null){if(!I6.has(u))return[];const S=n.values[u]??[],C=p.toLowerCase(),D=[];for(const T of S)if(!(C&&!T.toLowerCase().startsWith(C))&&T.toLowerCase()!==C&&(D.push({label:T,insert:aw(T),replace:f,kind:"value"}),D.length>=O1))break;return D}if(a>=0&&!sy.has(r[a].type))return[];if(a>=0&&r[a].type==="IDENT"&&((N=r[a+1])==null?void 0:N.type)==="COLON")return[];if(l>=0){const S=r[l].type;if(!(S==="AND"||S==="OR"||S==="NOT"||S==="MINUS"||S==="LPAREN"||S==="RPAREN"||sy.has(S)))return[]}const h=(a>=0?r[a].text:"").toLowerCase(),g=a>=0?[r[a].pos,i(a)]:[t,t],y=[];for(const[S,C]of Object.entries(n.aliases))h&&!S.toLowerCase().startsWith(h)||y.push({label:`${S}: (${C})`,insert:`${S}:`,replace:g,kind:"prefix"});for(const S of n.fields)h&&!S.toLowerCase().startsWith(h)||y.push({label:`${S}:`,insert:`${S}:`,replace:g,kind:"field"});return y.slice(0,O1)}const L6=200,O6=2;function F6(e,t){const[n,r]=m.useState(e),[o,i]=m.useState([]),[a,l]=m.useState(!1),[u,f]=m.useState(null),p=m.useRef(null);m.useEffect(()=>{const y=setTimeout(()=>r(e),L6);return()=>clearTimeout(y)},[e]);const h=n.trim(),g=t&&h.length>=O6;return m.useEffect(()=>{if(!g){p.current=null,i([]),l(!1),f(null);return}const y=new AbortController;p.current=h,l(!0),f(null);const k=()=>p.current===h&&!y.signal.aborted;return fetch(`/api/search?q=${encodeURIComponent(h)}`,{signal:y.signal}).then(async v=>{if(!v.ok){const b=await v.json().catch(()=>null);throw new Error((b==null?void 0:b.error)||`HTTP ${v.status}`)}return v.json()}).then(v=>{k()&&(i(v.hits??[]),l(!1))}).catch(v=>{v.name!=="AbortError"&&k()&&(f(v.message),i([]),l(!1))}),()=>{y.abort()}},[g,h]),{hits:o,loading:a,error:u}}const Lp={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 z6(e,t,n=()=>null){const r=[],o=new Set(t.statuses.map(l=>l.id));e.phaseLadder.length===0&&r.push("phaseLadder must have at least one rung");for(const l of e.phaseLadder){o.has(l.phase)||r.push(`phaseLadder rung "${l.phase}" is not a defined status id`);const u=l.when==="*"?null:n(l.when);u&&r.push(`phaseLadder rung "${l.phase}": invalid condition — ${u}`)}const i=new Set(["active","blocked","parked"]);for(const l of e.disposition)if(i.has(l.is)||r.push(`disposition "${l.is}" is not valid (expected active, blocked, or parked — terminal is never a rule)`),l.when!==null){const u=n(l.when);u&&r.push(`disposition rule "${l.is}": invalid condition — ${u}`)}const a=e.disposition.map((l,u)=>l.when===null?u:-1).filter(l=>l>=0);a.length===0?r.push("disposition rules must end with an `else:` arm (a rule with when: null)"):a.length>1?r.push("disposition rules must have exactly one `else:` arm (when: null)"):a[0]!==e.disposition.length-1&&r.push("the `else:` arm (when: null) must be the LAST disposition rule — rules after it are unreachable");for(const l of["parked","blocked"])o.has(e.headline[l])||r.push(`headline.${l} → "${e.headline[l]}" is not a defined status id (add the definition or run migrate-derive)`);return r}const PT={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:Lp,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let Lu=null,Ji=null;function B6(){return Lu?Promise.resolve(Lu):Ji||(Ji=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Lu=e,Ji=null,e)).catch(()=>(Ji=null,PT)),Ji)}function Es(){const[e,t]=m.useState(()=>Lu??PT);return m.useEffect(()=>{B6().then(t)},[]),e}function F1(){Lu=null,Ji=null}function No(e,t){const n=e.statuses.find(r=>r.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}const _T={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 Op=null,dl=null;function U6(){return Op?Promise.resolve(Op):dl||(dl=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Op=e,dl=null,e)).catch(()=>(dl=null,_T)),dl)}function Pd(){const[e,t]=m.useState(()=>Op??_T);return m.useEffect(()=>{U6().then(t)},[]),e}function Ml(e,t){if(!t)return"—";const n=e.definitions.find(r=>r.id===t);return(n==null?void 0:n.label)??t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function H6(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}const V6={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo",content:"Content"};function W6(e,t){const n=e.map(o=>({start:Math.max(0,Math.min(o.start,t)),end:Math.max(0,Math.min(o.end,t))})).filter(o=>o.end>o.start).sort((o,i)=>o.start-i.start||o.end-i.end),r=[];for(const o of n){const i=r[r.length-1];i&&o.start<=i.end?i.end=Math.max(i.end,o.end):r.push({...o})}return r}function q6(e,t){if(!t||t.length===0)return e;const n=W6(t,e.length);if(n.length===0)return e;const r=[];let o=0;return n.forEach((i,a)=>{i.start>o&&r.push(s.jsx(m.Fragment,{children:e.slice(o,i.start)},`t${a}`)),r.push(s.jsx("mark",{className:"rounded bg-yellow-200/70 px-0.5 text-foreground dark:bg-yellow-500/30",children:e.slice(i.start,i.end)},`m${a}`)),o=i.end}),o<e.length&&r.push(s.jsx(m.Fragment,{children:e.slice(o)},"tail")),r}function K6({entries:e}){const{paletteOpen:t,closePalette:n}=Ei(),r=Ht(),[o,i]=m.useState(""),[a,l]=m.useState(0),[u,f]=m.useState(0),[p,h]=m.useState(!0),[g,y]=m.useState(0),k=m.useRef(null),v=m.useRef(null),b=m.useId(),{search:j}=Gv(),N=Es(),S=Pd(),{aqlExpr:C,fuzzy:D}=m.useMemo(()=>s6(o,j.aliases,{defaultScope:j.defaultScope}),[o,j.aliases,j.defaultScope]),T=m.useMemo(()=>{const z=new Set,W=new Set,M=new Set;for(const G of e){for(const H of G.tags??[])z.add(H);G.assignee&&W.add(G.assignee);for(const H of G.externalIds??[])H.id&&(M.add(H.id),H.system&&M.add(`${H.system}:${H.id}`))}const F=Object.keys(Qu);return{aliases:j.aliases,fields:j.externalIds?F:F.filter(G=>G!=="jira"&&G!=="externalid"),values:{status:N.statuses.map(G=>G.id),type:S.definitions.map(G=>G.id),tag:[...z],assignee:[...W],externalid:j.externalIds?[...M]:[]}}},[e,j.aliases,j.externalIds,N.statuses,S.definitions]),R=m.useMemo(()=>M6(o,u,T),[o,u,T]),$=p&&R.length>0&&o.trim()!=="",_=m.useMemo(()=>{let z=e,W=D;if(C){const M=Yl(C,Qu);if(M.query){const F=Date.now(),{predicate:G}=M.query;z=e.filter(H=>G(H,{now:F}))}else W=o}return ow(W,z,50)},[e,C,D,o]),{hits:U}=F6(o,t),I=m.useMemo(()=>JO(U),[U]),V=m.useMemo(()=>[..._,...I],[_,I]);m.useEffect(()=>{l(0)},[o,t]),m.useEffect(()=>{y(0)},[R]),m.useEffect(()=>{t||(i(""),f(0),h(!0))},[t]),m.useEffect(()=>{var W;const z=(W=k.current)==null?void 0:W.querySelector(`[data-palette-idx="${a}"]`);z==null||z.scrollIntoView({block:"nearest"})},[a]);function O(z){r(z.route),n()}function P(z,W){const M=W===a,F=z.type==="content";return s.jsxs("button",{type:"button","data-palette-idx":W,onClick:()=>O(z),onMouseEnter:()=>l(W),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${M?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.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:V6[z.type]??z.type}),s.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"truncate",children:z.title}),F&&z.snippet?s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:q6(z.snippet,z.snippetMatches)}):null]}),z.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:z.subtitle}):null]},z.id)}function L(z){const W=o.slice(0,z.replace[0])+z.insert+o.slice(z.replace[1]),M=z.replace[0]+z.insert.length;i(W),f(M),requestAnimationFrame(()=>{const F=v.current;F&&(F.focus(),F.setSelectionRange(M,M))})}function B(z){if($){if(z.key==="Tab"||z.key==="ArrowRight"&&u>=o.length){z.preventDefault();const W=R[g];W&&L(W);return}if(z.key==="ArrowDown"){z.preventDefault(),y(W=>Math.min(R.length-1,W+1));return}if(z.key==="ArrowUp"){z.preventDefault(),y(W=>Math.max(0,W-1));return}if(z.key==="Enter"){z.preventDefault();const W=V[a];W&&O(W);return}return}if(z.key==="ArrowDown")z.preventDefault(),l(W=>Math.min(V.length-1,W+1));else if(z.key==="ArrowUp")z.preventDefault(),l(W=>Math.max(0,W-1));else if(z.key==="Enter"){z.preventDefault();const W=V[a];W&&O(W)}}const q=$&&R[g]?`${b}-option-${g}`:void 0;return s.jsx(Ln,{open:t,onOpenChange:z=>z?null:n(),children:s.jsxs(jn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:z=>{$&&(z.preventDefault(),h(!1))},children:[s.jsx(kn,{className:"sr-only",children:"Command palette"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:v,autoFocus:!0,type:"text",role:"combobox","aria-expanded":$,"aria-controls":$?b:void 0,"aria-activedescendant":q,"aria-autocomplete":"list",value:o,onChange:z=>{i(z.target.value),f(z.target.selectionStart??z.target.value.length),h(!0)},onSelect:z=>f(z.currentTarget.selectionStart??0),onKeyDown:B,placeholder:"Search… try a: p: jira:PROJ-123 tag:backend",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary"}),$?s.jsx("div",{role:"listbox",id:b,"aria-label":"Query suggestions",className:"absolute left-0 right-0 top-full z-50 max-h-64 overflow-y-auto border-b border-border/70 bg-background shadow-lg",children:R.map((z,W)=>{const M=W===g;return s.jsxs("button",{id:`${b}-option-${W}`,role:"option","aria-selected":M,type:"button",onMouseDown:F=>{F.preventDefault(),L(z)},onMouseEnter:()=>y(W),className:`flex w-full items-center justify-between gap-3 px-4 py-1.5 text-left text-sm ${M?"bg-accent text-accent-foreground":"text-foreground"}`,children:[s.jsx("code",{className:"truncate",children:z.label}),s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:z.kind})]},`${z.kind}-${z.insert}-${W}`)})}):null]}),C?s.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Filtering"})," ",s.jsx("code",{className:"text-foreground",children:C}),D?s.jsxs("span",{children:[" · ranking “",D,"”"]}):null]}):o.trim()===""?s.jsxs("div",{className:"border-b border-border/70 px-4 py-1.5 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Prefixes"})," ",Object.keys(j.aliases).map(z=>s.jsxs("code",{className:"mr-1",children:[z,":"]},z))," · ",s.jsx("code",{children:"status:"})," ",s.jsx("code",{children:"tag:"})," ",s.jsx("code",{children:"assignee:"})," ",s.jsx("code",{children:"type:"})," ",j.externalIds?s.jsx("code",{children:"jira:"}):null]}):null,s.jsx("div",{ref:k,className:"max-h-[60vh] overflow-y-auto p-1",children:V.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):s.jsxs(s.Fragment,{children:[_.map((z,W)=>P(z,W)),I.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-3 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground",children:"Content"}),I.map((z,W)=>P(z,_.length+W))]}):null]})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:$?"⇥/→ accept · ↑↓ suggestions · Esc close":"↑↓ navigate · ↵ open · Esc close"}),s.jsxs("span",{children:[V.length," result",V.length===1?"":"s"]})]})]})})}function G6({label:e,onBack:t,disabled:n,stepCounter:r}){return s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-3 py-2",children:[s.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:[s.jsx(TL,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Back"})]}),s.jsx("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),r?s.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground/80",children:["step ",r.current," of ",r.total]}):null]})}function Y6({step:e,initialValue:t,disabled:n,onSubmit:r}){const[o,i]=m.useState(t??""),[a,l]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{var k;(k=u.current)==null||k.focus()},[]);const f=o.trim(),p=e.required!==!1,h=e.pattern&&f.length>0&&!e.pattern.regex.test(f),g=!n&&(!p||f.length>0)&&!h;function y(k){if(k.key==="Enter"){if(k.preventDefault(),!g){l(!0);return}r(f)}}return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:u,type:"text",value:o,onChange:k=>{i(k.target.value),l(!1)},onKeyDown:y,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:border-primary disabled:opacity-60"}),a&&e.pattern&&h?s.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 X6({step:e,disabled:t,onSubmit:n}){const[r,o]=m.useState({phase:"loading"}),[i,a]=m.useState(""),[l,u]=m.useState(0),[f,p]=m.useState(0),h=m.useRef(null),g=m.useRef(null);m.useEffect(()=>{var v;(v=h.current)==null||v.focus()},[]),m.useEffect(()=>{let v=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(b=>{v||o({phase:"loaded",options:b})}).catch(b=>{if(v)return;const j=b instanceof Error?b.message:"Failed to load options";o({phase:"error",message:j})}),()=>{v=!0}},[e,f]);const y=m.useMemo(()=>{if(r.phase!=="loaded")return[];const v=r.options.map(b=>({type:"option",title:b.label,subtitle:b.hint,keywords:[b.value],option:b}));return ow(i,v,100)},[r,i]);m.useEffect(()=>{u(0)},[y.length]),m.useEffect(()=>{var b;const v=(b=g.current)==null?void 0:b.querySelector(`[data-picker-idx="${l}"]`);v==null||v.scrollIntoView({block:"nearest"})},[l]);function k(v){if(r.phase==="loaded"){if(v.key==="ArrowDown")v.preventDefault(),u(b=>Math.min(y.length-1,b+1));else if(v.key==="ArrowUp")v.preventDefault(),u(b=>Math.max(0,b-1));else if(v.key==="Enter"){v.preventDefault();const b=y[l];b&&n(b.option.value)}}}return s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:h,type:"text",value:i,onChange:v=>a(v.target.value),onKeyDown:k,placeholder:`Filter ${e.label.toLowerCase()}…`,disabled:t||r.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:border-primary disabled:opacity-60"}),s.jsx("div",{ref:g,className:"max-h-[60vh] min-h-[120px] overflow-y-auto p-1",children:r.phase==="loading"?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading…"}):r.phase==="error"?s.jsxs("div",{className:"px-4 py-4 text-sm",children:[s.jsxs("div",{className:"mb-2 text-destructive",children:["Failed to load: ",r.message]}),s.jsx("button",{type:"button",onClick:()=>p(v=>v+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):y.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:r.options.length===0?e.emptyMessage??"No options available":"No matches"}):y.map((v,b)=>{const j=b===l;return s.jsxs("button",{type:"button","data-picker-idx":b,onClick:()=>n(v.option.value),onMouseEnter:()=>u(b),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 ${j?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.option.label}),v.option.hint?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:v.option.hint}):null]},v.option.value)})})]})}function Q6({entries:e}){var Q,te;const t=Ht(),{actionsPaletteOpen:n,closeActionsPalette:r,customBindings:o,bindAction:i,findConflict:a,pendingActionKind:l,consumePendingActionKind:u}=Ei(),[f,p]=m.useState(""),[h,g]=m.useState(0),[y,k]=m.useState(null),[v,b]=m.useState(""),[j,N]=m.useState(null),[S,C]=m.useState(null),[D,T]=m.useState(!1),[R,$]=m.useState(null),_=m.useRef(null),U=m.useMemo(()=>e.map(Z=>({type:Z.group.toLowerCase(),title:Z.title,subtitle:Z.subtitle,keywords:Z.keywords,action:Z})),[e]),I=m.useMemo(()=>ow(f,U,50),[f,U]);m.useEffect(()=>{g(0)},[f,n]),m.useEffect(()=>{n||(p(""),k(null),b(""),N(null),C(null),T(!1),$(null))},[n]),m.useEffect(()=>{if(!n||!l)return;const Z=u();if(!Z)return;const ae=e.find(ne=>ne.bindableKind===Z);ae&&V(ae)},[n,l]),m.useEffect(()=>{var ae;const Z=(ae=_.current)==null?void 0:ae.querySelector(`[data-palette-idx="${h}"]`);Z==null||Z.scrollIntoView({block:"nearest"})},[h]);async function V(Z){if(!D){if(Z.flow&&Z.flow.steps.length>0){N({action:Z,stepIndex:0,values:{}}),$(null);return}if(Z.requiresInput){k(Z),b(""),$(null);return}if(Z.run){T(!0),$(null);try{await Z.run(),r()}catch(ae){$(ae instanceof Error?ae.message:"Action failed")}finally{T(!1)}}}}async function O(Z){if(!j)return;const ae=j.action.flow.steps[j.stepIndex],ne={...j.values,[ae.id]:Z};if(j.stepIndex+1<j.action.flow.steps.length){N({action:j.action,stepIndex:j.stepIndex+1,values:ne});return}T(!0),$(null);try{await j.action.flow.submit(ne,{navigate:t}),r()}catch(de){$(de instanceof Error?de.message:"Action failed")}finally{T(!1)}}function P(){if(j&&!D){if(j.stepIndex===0){N(null),$(null);return}N({action:j.action,stepIndex:j.stepIndex-1,values:j.values}),$(null)}}async function L(){if(D||!(y!=null&&y.requiresInput))return;const Z=v.trim();if(Z){T(!0),$(null);try{await y.requiresInput.runWithInput(Z),r()}catch(ae){$(ae instanceof Error?ae.message:"Action failed")}finally{T(!1)}}}function B(Z){if(Z.key==="ArrowDown")Z.preventDefault(),g(ae=>Math.min(I.length-1,ae+1));else if(Z.key==="ArrowUp")Z.preventDefault(),g(ae=>Math.max(0,ae-1));else if(Z.key==="Enter"&&(Z.metaKey||Z.ctrlKey)){Z.preventDefault();const ae=I[h];ae!=null&&ae.action.bindableKind&&C({action:ae.action,combo:null,conflict:null,saving:!1,error:null})}else if(Z.key==="Enter"){Z.preventDefault();const ae=I[h];ae&&V(ae.action)}}function q(Z){Z.key==="Enter"?(Z.preventDefault(),L()):Z.key==="Escape"&&(Z.preventDefault(),k(null),b(""))}function z(Z){if(!S||Z.key==="Escape"||Z.key==="Enter"&&!S.combo)return;if(Z.key==="Enter"&&S.combo){Z.preventDefault(),Z.stopPropagation(),W();return}Z.preventDefault(),Z.stopPropagation();const ae=P2(Z.nativeEvent);if(!ae)return;const ne=a(ae,S.action.bindableKind);C({...S,combo:ae,conflict:ne,error:null})}async function W(){var Z;if(!(!S||!S.combo||!S.action.bindableKind)){if((Z=S.conflict)!=null&&Z.description){C({...S,error:`Reserved: ${S.conflict.description}`});return}C({...S,saving:!0,error:null});try{await i(S.action.bindableKind,S.combo),C(null)}catch(ae){C({...S,saving:!1,error:ae instanceof Error?ae.message:"Failed to save binding"})}}}const M=y!==null,F=j!==null,G=S!==null,H=j?j.action.flow.steps[j.stepIndex]:null;return s.jsx(Ln,{open:n,onOpenChange:Z=>Z?null:r(),children:s.jsxs(jn,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:Z=>{if(!D){if(G){Z.preventDefault(),C(null);return}if(F){Z.preventDefault(),P();return}M&&(Z.preventDefault(),k(null),b(""),$(null))}},children:[s.jsx(kn,{className:"sr-only",children:"Actions palette"}),G&&S?s.jsxs("div",{onKeyDown:z,tabIndex:-1,autoFocus:!0,children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[s.jsx(fb,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsxs("span",{className:"text-sm text-foreground",children:["Bind hotkey for ",S.action.title]})]}),s.jsx("div",{className:"px-4 py-6 text-center",children:S.combo?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"text-2xl font-semibold tracking-wide text-foreground",children:Gs(S.combo)}),(Q=S.conflict)!=null&&Q.description?s.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(te=S.conflict)!=null&&te.kind?s.jsxs("div",{className:"text-sm text-amber-500 dark:text-amber-400",children:['Already bound to "',S.conflict.kind,'". Press Enter to overwrite.']}):s.jsx("div",{className:"text-sm text-muted-foreground",children:"Press Enter to save, or another key to retry."}),S.error?s.jsx("div",{className:"text-sm text-destructive",children:S.error}):null]}):s.jsx("div",{className:"text-sm text-muted-foreground",children:"Press the key combination you want to bind…"})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"any key records · Enter saves · Esc cancels"}),s.jsx("span",{children:S.saving?"Saving…":""})]}),s.jsx("button",{type:"button",className:"sr-only",onClick:()=>void W(),"data-bind-confirm":!0}),s.jsx("input",{type:"hidden",onKeyDown:Z=>{Z.key==="Enter"&&W()}})]}):F&&H&&j?s.jsxs(s.Fragment,{children:[s.jsx(G6,{label:`${j.action.title} · ${H.label}`,onBack:P,disabled:D,stepCounter:{current:j.stepIndex+1,total:j.action.flow.steps.length}}),H.kind==="text"?s.jsx(Y6,{step:H,initialValue:j.values[H.id],disabled:D,onSubmit:O}):s.jsx(X6,{step:H,disabled:D,onSubmit:O}),R?s.jsx("div",{className:"border-t border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):null,s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:"↵ next · ← back · Esc back"}),s.jsx("span",{children:D?"Running…":""})]})]}):M?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/70 px-4 py-3",children:[s.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:y.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:y.title})]}),s.jsx("input",{autoFocus:!0,type:"text",value:v,onChange:Z=>b(Z.target.value),onKeyDown:q,placeholder:y.requiresInput.placeholder,disabled:D,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:border-primary disabled:opacity-60"}),R?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):null,s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:["↵"," submit ","·"," Esc back"]}),s.jsx("span",{children:D?"Running…":""})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:Z=>p(Z.target.value),onKeyDown:B,placeholder:"Run an action: new project, new todo, toggle…",disabled:D,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:border-primary disabled:opacity-60"}),R?s.jsx("div",{className:"border-b border-border/70 bg-destructive/10 px-4 py-2 text-xs text-destructive",children:R}):null,s.jsx("div",{ref:_,className:"max-h-[60vh] overflow-y-auto p-1",children:I.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:f?"No matches":"Start typing to search actions"}):I.map((Z,ae)=>{const ne=ae===h,de=Z.action.bindableKind,ye=de?o[de]:void 0;return s.jsxs("button",{type:"button","data-palette-idx":ae,onClick:()=>V(Z.action),onMouseEnter:()=>g(ae),disabled:D,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${ne?"bg-accent text-accent-foreground":"hover:bg-accent/50 text-foreground"}`,children:[s.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:Z.action.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Z.action.title}),Z.action.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:Z.action.subtitle}):null,ye?s.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:Gs(ye)}):null,de?s.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Se=>{Se.preventDefault(),Se.stopPropagation(),C({action:Z.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 ${ne?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:s.jsx(fb,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},Z.action.id)})}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 px-3 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:["↑↓"," navigate ","·"," ","↵"," run ","·"," ⌘↵ bind ","·"," Esc close"]}),s.jsx("span",{children:D?"Running…":`${I.length} action${I.length===1?"":"s"}`})]})]})]})})}const J6=[{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 Z6(e){const t=xr(e);return t?J6.find(n=>n.combo===t)??null:null}const hu={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},ez={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},tz=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function z1(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${Gs(t)} then ${Gs(n)}`}return Gs(e)}function nz(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:r,actionEntries:o}=Ei(),i=m.useMemo(()=>{const u=new Set;for(const f of Object.values(r))typeof f=="string"&&f&&u.add(xr(f));return u},[r]),a=m.useMemo(()=>{if(!e)return new Map;const u=n(),f=new Map;for(const p of u){if(i.has(xr(p.keys)))continue;const h=f.get(p.scope)??[];h.push({keys:p.keys,description:p.description}),f.set(p.scope,h)}return f},[e,n,i]),l=m.useMemo(()=>{const u=[];for(const[f,p]of Object.entries(r)){if(!p)continue;const h=o.find(g=>g.bindableKind===f);u.push({kind:f,combo:p,title:h?h.title:f})}return u},[r,o]);return s.jsx(Ln,{open:e,onOpenChange:u=>u?null:t(),children:s.jsxs(jn,{className:"max-w-2xl",children:[s.jsx(kn,{children:"Keyboard shortcuts"}),s.jsxs(ns,{children:["Press Esc to close. ",Gs("Mod+k")," opens the command palette. Press g twice to restart the chord timer."]}),s.jsxs("div",{className:"mt-2 max-h-[60vh] space-y-4 overflow-y-auto pr-1",children:[tz.map(u=>{const f=a.get(u);return!f||f.length===0?null:s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:ez[u]}),s.jsx("ul",{className:"space-y-1",children:f.map((p,h)=>s.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:[s.jsx("span",{className:"text-foreground",children:p.description}),s.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:z1(p.keys)})]},`${u}-${p.keys}-${h}`))})]},u)}),l.length>0?s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Custom bindings"}),s.jsx("ul",{className:"space-y-1",children:l.map(u=>s.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:[s.jsx("span",{className:"text-foreground",children:u.title}),s.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:z1(u.combo)})]},`custom-${u.kind}`))})]}):null]})]})})}const cw={bindings:{},custom:!1};let Ou=null,fl=null;const jb=new Set;function DT(e){Ou=e;for(const t of jb)t(e)}function uw(e){if(!e||typeof e!="object")return cw;const t=e,n={};if(t.bindings&&typeof t.bindings=="object"&&!Array.isArray(t.bindings))for(const[r,o]of Object.entries(t.bindings)){if(!TO(r)||typeof o!="string"||o.trim()==="")continue;const i=xr(o);i&&(n[r]=i)}return{bindings:n,custom:t.custom===!0}}function rz(){return Ou?Promise.resolve(Ou):fl||(fl=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=uw(e);return Ou=t,fl=null,t}).catch(()=>(fl=null,cw)),fl)}function sz(){const[e,t]=m.useState(()=>Ou??cw);return m.useEffect(()=>{let n=!1;return rz().then(r=>{n||t(r)}),jb.add(t),()=>{n=!0,jb.delete(t)}},[]),e}async function B1(e){const t={};for(const o of Zh){const i=e[o];if(typeof i!="string")continue;const a=xr(i);a&&(t[o]=a)}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 r=uw(await n.json());return DT(r),r}async function oz(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=uw(await e.json());return DT(t),t}const U1=1500;function iz(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const $T=m.createContext(null);function az({children:e}){const{toggleTheme:t}=zv(),n=er(),r=Ht(),o=iz(n.pathname),[i,a]=m.useState(!1),l=Zs(i),u=Qh(i),f=Uv(i),p=Bv(i),h=_2(i),{search:g}=Gv(),y=m.useMemo(()=>{var it,xt,at,st;const we=l.data??[],je=((it=u.data)==null?void 0:it.assignments)??[],De=((xt=f.data)==null?void 0:xt.playbooks)??[],Be=((at=p.data)==null?void 0:at.sessions)??[],Ue=(((st=h.data)==null?void 0:st.workspaces)??[]).flatMap(ce=>ce.items.map(xe=>({...xe,workspace:ce.workspace})));return XO({projects:we,assignments:je,playbooks:De,servers:Be,todos:Ue,wsPrefix:o,externalIds:g.externalIds})},[l.data,u.data,f.data,p.data,h.data,o,g.externalIds]),v=m.useMemo(()=>h2(n.pathname),[n.pathname]).projectSlug,b=m.useMemo(()=>{var we;return v?((we=l.data)==null?void 0:we.find(je=>je.slug===v))??null:null},[l.data,v]),j=(b==null?void 0:b.title)??null,N=(b==null?void 0:b.workspace)??null,S=m.useMemo(()=>{var we;return t5({playbooks:((we=f.data)==null?void 0:we.playbooks)??[],projectSlug:v,currentProjectTitle:j,currentProjectWorkspace:N,wsPrefix:o,refetchPlaybooks:f.refetch,navigate:r,toggleTheme:t})},[f.data,f.refetch,v,j,N,o,r,t]),C=m.useRef(new Map),D=m.useRef(["global"]),T=m.useRef({phase:"idle"}),R=m.useRef(null),$=m.useRef(1),[_,U]=m.useState(!1),[I,V]=m.useState(!1),[O,P]=m.useState(!1),[L,B]=m.useState(null);m.useEffect(()=>{(_||O)&&a(!0)},[_,O]);const{bindings:q}=sz(),z=m.useMemo(()=>DO(q),[q]),W=m.useCallback(we=>{const je=$.current++;return C.current.set(je,{...we,id:je}),je},[]),M=m.useCallback(we=>{C.current.delete(we)},[]),F=m.useCallback(we=>{D.current.push(we)},[]),G=m.useCallback(we=>{const je=D.current;for(let De=je.length-1;De>=0;De--)if(je[De]===we){je.splice(De,1);return}},[]),H=m.useCallback(()=>U(!0),[]),Q=m.useCallback(()=>U(!1),[]),te=m.useCallback(()=>V(!0),[]),Z=m.useCallback(()=>V(!1),[]),ae=m.useCallback(()=>P(!0),[]),ne=m.useCallback(()=>{P(!1),B(null)},[]),de=m.useCallback(()=>Array.from(C.current.values()),[]),ye=m.useCallback(()=>{let we=null;return B(je=>(we=je,null)),we},[]),Se=m.useCallback(we=>{B(we),P(!0)},[]),Te=m.useCallback((we,je)=>{const De=xr(we);if(!De)return null;if(PO(De)){const Be=Z6(De);return{description:(Be==null?void 0:Be.description)??"Reserved built-in shortcut"}}for(const[Be,tt]of Object.entries(z))if(!(je&&Be===je)&&tt===De)return{kind:Be};return null},[z]),ke=m.useCallback(async(we,je)=>{const De=xr(je);if(!De)throw new Error("Empty combo");const Be=Te(De,we);if(Be){const Ue=Be.description?`Reserved: ${Be.description}`:`Already bound to "${Be.kind}"`;throw new Error(Ue)}const tt={...q,[we]:De};return await B1(tt),De},[q,Te]),Fe=m.useCallback(async we=>{if(!q[we])return;const je={...q};delete je[we],await B1(je)},[q]);m.useEffect(()=>{T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),m.useEffect(()=>{function we(Ue){if(!(Ue instanceof HTMLElement))return!1;const it=Ue.tagName;return!!(it==="INPUT"||it==="TEXTAREA"||it==="SELECT"||Ue.isContentEditable||Ue.closest('[role="combobox"], [role="textbox"]'))}function je(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function De(){const Ue=D.current;return Ue[Ue.length-1]??"global"}function Be(Ue){return Ue.scope==="global"?!0:Ue.scope===De()}function tt(Ue){const it=Zf(Ue,"Mod+k"),xt=Zf(Ue,"Mod+Shift+k"),at=Ue.key==="Escape",st=it||xt||at;if(je()&&!st||we(Ue.target)&&!st)return;const ce=T.current;if(ce.phase==="awaiting-second")if(Date.now()-ce.startedAt>U1)T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const Ve=Array.from(C.current.values());for(const Ke of Ve){if(!Be(Ke))continue;const ct=Ke.keys.split(" ");if(!(ct.length!==2||ct[0]!=="g")&&Zf(Ue,ct[1])&&!(Ke.when&&!Ke.when())){Ue.preventDefault(),T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),Ke.handler(Ue);return}}T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const xe=Array.from(C.current.values());for(const Le of xe){if(!Be(Le))continue;const Ve=Le.keys.split(" ");if(Ve.length===1&&Zf(Ue,Ve[0])&&!(Le.when&&!Le.when())){Ue.preventDefault(),Le.handler(Ue);return}}Ue.key==="g"&&!Ue.metaKey&&!Ue.ctrlKey&&!Ue.altKey&&!Ue.shiftKey&&Array.from(C.current.values()).some(Ve=>Be(Ve)&&Ve.keys.startsWith("g "))&&(Ue.preventDefault(),T.current={phase:"awaiting-second",startedAt:Date.now()},R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{T.current={phase:"idle"},R.current=null},U1))}return window.addEventListener("keydown",tt),()=>{window.removeEventListener("keydown",tt),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),m.useEffect(()=>{const we=W({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>M(we)},[W,M,t]),m.useEffect(()=>{const we=W({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>te()});return()=>M(we)},[W,M,te]),m.useEffect(()=>{const we=W({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(_){Q();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||H()}});return()=>M(we)},[W,M,H,Q,_]),m.useEffect(()=>{const we=W({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(O){ne();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||ae()}});return()=>M(we)},[W,M,ae,ne,O]),m.useEffect(()=>{const je=[{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(De=>W({keys:`g ${De.suffix}`,scope:"global",description:De.desc,handler:()=>r(_p(De.basePath,o))}));return()=>je.forEach(M)},[W,M,r,o]),m.useEffect(()=>{const we=[];for(const[je,De]of Object.entries(z)){if(!De)continue;const Be=S.find(Ue=>Ue.bindableKind===je),tt=Be?`Custom: ${Be.title}`:`Custom: ${je}`;we.push(W({keys:De,scope:"global",description:tt,handler:()=>{B(je),P(!0)}}))}return()=>we.forEach(M)},[W,M,z,S]);const oe=m.useMemo(()=>({register:W,unregister:M,pushScope:F,popScope:G,openPalette:H,closePalette:Q,paletteOpen:_,openCheatsheet:te,closeCheatsheet:Z,cheatsheetOpen:I,openActionsPalette:ae,closeActionsPalette:ne,actionsPaletteOpen:O,listBindings:de,wsPrefix:o,paletteEntries:y,actionEntries:S,userBindings:q,customBindings:z,bindAction:ke,unbindAction:Fe,findConflict:Te,openActionsPaletteWithAction:Se,pendingActionKind:L,consumePendingActionKind:ye}),[W,M,F,G,H,Q,_,te,Z,I,ae,ne,O,de,o,y,S,q,z,ke,Fe,Te,Se,L,ye]);return s.jsxs($T.Provider,{value:oe,children:[e,s.jsx(K6,{entries:y}),s.jsx(Q6,{entries:S}),s.jsx(nz,{})]})}function Ei(){const e=m.useContext($T);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Jt({keys:e,handler:t,scope:n="global",description:r,when:o,enabled:i=!0}){const{register:a,unregister:l}=Ei(),u=m.useRef(t),f=m.useRef(o);m.useEffect(()=>{u.current=t,f.current=o},[t,o]),m.useEffect(()=>{if(!i)return;const p=a({keys:e,handler:h=>u.current(h),scope:n,description:r,when:f.current?()=>f.current():void 0});return()=>l(p)},[a,l,e,n,r,i])}function Ti(e){const{pushScope:t,popScope:n}=Ei();m.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function _d(e,t){const[n,r]=m.useState(e.length===0?-1:0),o=er();m.useEffect(()=>{r(e.length===0?-1:0)},[o.pathname]),m.useEffect(()=>{r(a=>e.length===0?-1:Math.min(Math.max(0,a),e.length-1))},[e.length]),m.useEffect(()=>{if(document.querySelectorAll("[data-hotkey-row-index]").forEach(l=>{const u=Number(l.getAttribute("data-hotkey-row-index"));l.setAttribute("data-hotkey-selected",u===n?"true":"false")}),n>=0){const l=document.querySelector(`[data-hotkey-row-index="${n}"]`);l==null||l.scrollIntoView({block:"nearest"})}},[n,e.length]),Jt({keys:"j",scope:t.scope,description:"Select next row",handler:()=>r(a=>e.length===0?-1:Math.min(e.length-1,a<0?0:a+1))}),Jt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>r(a=>e.length===0?-1:Math.max(0,a<0?0:a-1))}),Jt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Jt({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=m.useCallback(a=>({"data-hotkey-row-index":a,"data-hotkey-selected":a===n?"true":"false"}),[n]);return{selectedIndex:n,hotkeyRowProps:i}}function lz({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:r}){const o=pn(),{resolvedTheme:i,toggleTheme:a}=zv(),{openPalette:l}=Ei();return s.jsx("header",{className:"sticky top-0 z-30 border-b border-border/70 bg-background/70 backdrop-blur",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 lg:px-6",children:[s.jsx("button",{type:"button",onClick:r,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:s.jsx(e4,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[t.length>1?s.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((u,f)=>s.jsxs("span",{className:"flex items-center gap-1.5",children:[f>0?s.jsx("span",{children:"/"}):null,s.jsx($e,{to:u.path,className:"hover:text-foreground",children:u.label})]},u.path)),s.jsx("span",{children:"/"})]}):null,s.jsx("h1",{className:"min-w-0 truncate text-base font-semibold text-foreground",children:e})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:l,className:"shell-action","aria-label":"Open command palette",children:[s.jsx(Ni,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:Gs("Mod+k")})]}),s.jsx($e,{className:"shell-action hidden sm:inline-flex",to:"/help",children:"Help"}),s.jsxs($e,{className:"shell-action",to:`${o}/create/project`,"aria-label":"New Project",children:[s.jsx(It,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"New Project"})]}),n?s.jsxs($e,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,"aria-label":"New Assignment",children:[s.jsx(It,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"New Assignment"})]}):null,s.jsxs("button",{type:"button",onClick:a,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?s.jsx(d4,{className:"h-4 w-4"}):s.jsx(t4,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:i==="dark"?"Light":"Dark"})]})]})]})})}const cz=4e3;function wr(){const[e,t]=m.useState(null),n=m.useRef(null),r=m.useCallback(()=>{n.current!==null&&(clearTimeout(n.current),n.current=null),t(null)},[]),o=m.useCallback((i,a="error")=>{n.current!==null&&clearTimeout(n.current),t({id:Date.now()+Math.random(),message:i,kind:a}),n.current=setTimeout(()=>{t(null),n.current=null},cz)},[]);return m.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:r}}function Hr({toast:e,onDismiss:t}){if(!e)return null;const n=e.kind==="error";return s.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-50 flex max-w-sm",role:"status","aria-live":"polite",children:s.jsx("button",{type:"button",onClick:t,className:Ne("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)})}const ah="_ungrouped",uz=256;function dz(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e){if(typeof r!="string")continue;const o=r.trim();o.length!==0&&(o.length>uz||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function fz(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(r=>!n.has(r))}function pz(e,t){return t.includes(e)}const dw={hidden:[],custom:!1};let jo=null,Zi=null,Zu=0;const kb=new Set;function IT(e){jo=e;for(const t of kb)t(e)}function fw(e){if(!e||typeof e!="object")return dw;const t=e;return{hidden:dz(t.hidden),custom:t.custom===!0}}function hz(){if(jo)return Promise.resolve({value:jo,ok:!0});if(Zi)return Zi;const e=++Zu;return Zi=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Zi=null;const n=fw(t);return e!==Zu?{value:jo??n,ok:!0}:(jo=n,{value:n,ok:!0})}).catch(()=>(Zi=null,{value:dw,ok:!1})),Zi}function MT(){const[e,t]=m.useState(()=>jo??dw),[n,r]=m.useState(()=>jo===null),[o,i]=m.useState(!1),[a,l]=m.useState(0);m.useEffect(()=>{let f=!1;return r(jo===null),hz().then(p=>{f||(t(p.value),r(!1),i(!p.ok))}),kb.add(t),()=>{f=!0,kb.delete(t)}},[a]);function u(){mz(),l(f=>f+1)}return{...e,loading:n,error:o,reload:u}}function mz(){jo=null,Zi=null,++Zu}async function gz(e){++Zu;const t=await fetch("/api/config/workspace-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hidden:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.error)??`HTTP ${t.status}`)}const n=fw(await t.json());return IT(n),n}async function xz(){++Zu;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=fw(await e.json());return IT(t),t}var yz=Symbol("radix.slottable");function bz(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=yz,t}var LT="AlertDialog",[vz]=Ca(LT,[oT]),Ao=oT(),OT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ao(t);return s.jsx(wT,{...r,...n,modal:!0})};OT.displayName=LT;var wz="AlertDialogTrigger",jz=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ao(n);return s.jsx(jT,{...o,...r,ref:t})});jz.displayName=wz;var kz="AlertDialogPortal",FT=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ao(t);return s.jsx(kT,{...r,...n})};FT.displayName=kz;var Sz="AlertDialogOverlay",zT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ao(n);return s.jsx(ew,{...o,...r,ref:t})});zT.displayName=Sz;var Ll="AlertDialogContent",[Nz,Cz]=vz(Ll),Ez=bz("AlertDialogContent"),BT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=Ao(n),a=m.useRef(null),l=Zn(t,a),u=m.useRef(null);return s.jsx(KF,{contentName:Ll,titleName:UT,docsSlug:"alert-dialog",children:s.jsx(Nz,{scope:n,cancelRef:u,children:s.jsxs(tw,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:rn(o.onOpenAutoFocus,f=>{var p;f.preventDefault(),(p=u.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(Ez,{children:r}),s.jsx(Rz,{contentRef:a})]})})})});BT.displayName=Ll;var UT="AlertDialogTitle",HT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ao(n);return s.jsx(nw,{...o,...r,ref:t})});HT.displayName=UT;var VT="AlertDialogDescription",WT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ao(n);return s.jsx(rw,{...o,...r,ref:t})});WT.displayName=VT;var Tz="AlertDialogAction",qT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ao(n);return s.jsx(sw,{...o,...r,ref:t})});qT.displayName=Tz;var KT="AlertDialogCancel",GT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=Cz(KT,n),i=Ao(n),a=Zn(t,o);return s.jsx(sw,{...i,...r,ref:a})});GT.displayName=KT;var Rz=({contentRef:e})=>{const t=`\`${Ll}\` requires a description for the component to be accessible for screen reader users.
581
+
582
+ You can add a description to the \`${Ll}\` by passing a \`${VT}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
583
+
584
+ 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 \`${Ll}\`. 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.
585
+
586
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return m.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Az=OT,Pz=FT,YT=zT,XT=BT,QT=qT,JT=GT,ZT=HT,eR=WT;const Nl=Az,_z=Pz,tR=m.forwardRef(({className:e,...t},n)=>s.jsx(YT,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));tR.displayName=YT.displayName;const ia=m.forwardRef(({className:e,...t},n)=>s.jsxs(_z,{children:[s.jsx(tR,{}),s.jsx(XT,{ref:n,className:Ne("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})]}));ia.displayName=XT.displayName;function Cl({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function El({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const aa=m.forwardRef(({className:e,...t},n)=>s.jsx(ZT,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));aa.displayName=ZT.displayName;const la=m.forwardRef(({className:e,...t},n)=>s.jsx(eR,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));la.displayName=eR.displayName;const xi=m.forwardRef(({className:e,...t},n)=>s.jsx(QT,{ref:n,className:Ne(e),...t}));xi.displayName=QT.displayName;const ed=m.forwardRef(({className:e,...t},n)=>s.jsx(JT,{ref:n,className:Ne(e),...t}));ed.displayName=JT.displayName;const Dz=[{to:"/",label:"Overview",icon:QE},{to:"/playbooks",label:"Playbooks",icon:KE},{to:"/memories",label:"Memories",icon:EL},{to:"/resources",label:"Resources",icon:GL},{to:"/inventories",label:"Inventories",icon:Av},{to:"/schedules",label:"Schedules",icon:GE},{to:"/usage",label:"Usage",icon:Kh},{to:"/todos",label:"Todos",icon:gs},{to:"/views",label:"Saved Views",icon:ZE},{to:"/archive",label:"Archive",icon:Wh}],$z=[{suffix:"/projects",label:"Projects",icon:_v},{suffix:"/assignments",label:"Assignments",icon:QL},{suffix:"/servers",label:"Servers",icon:Mv},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Vh}],Iz=[{to:"/help",label:"Help",icon:YL},{to:"/workflow",label:"Workflow",icon:h4},{to:"/settings",label:"Settings",icon:c4}];function Mz({title:e,breadcrumbs:t,projectSlug:n,workspace:r,children:o}){const[i,a]=m.useState(!1);return Jt({keys:"Escape",scope:"global",description:"Close mobile navigation",enabled:i,handler:()=>a(!1)}),s.jsx("div",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"relative grid min-h-screen lg:grid-cols-[240px_minmax(0,1fr)]",children:[s.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:s.jsx(H1,{activeWorkspace:r})}),i?s.jsx("div",{className:"fixed inset-0 z-40 bg-overlay/40 lg:hidden",children:s.jsxs("div",{className:"h-full max-w-xs border-r border-border/70 bg-sidebar p-4 shadow-2xl",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx($e,{to:"/",className:"text-lg font-semibold text-foreground",onClick:()=>a(!1),children:"Syntaur"}),s.jsx("button",{type:"button",onClick:()=>a(!1),className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border/70 bg-background/80","aria-label":"Close navigation",children:s.jsx(Td,{className:"h-4 w-4"})})]}),s.jsx(H1,{activeWorkspace:r,onNavigate:()=>a(!1)})]})}):null,s.jsxs("div",{className:"min-w-0",children:[s.jsx(lz,{title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:()=>a(!0)}),s.jsx("main",{className:"mx-auto w-full max-w-[1480px] px-4 py-4 lg:px-6 lg:py-5",children:o})]})]})})}function H1({activeWorkspace:e,onNavigate:t}){const{data:n}=Na(),r=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=MT(),a=er(),[l,u]=m.useState(new Set),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState(null),[v,b]=m.useState(null),[j,N]=m.useState(null),[S,C]=m.useState(!1),D=Ht(),{toast:T,showToast:R,dismissToast:$}=wr();function _(O){u(P=>{const L=new Set(P);return L.has(O)?L.delete(O):L.add(O),L})}const U=fz([...r,...o?[ah]:[]],i);async function I(O){if(v){C(!0);try{const P=`/api/workspaces/${encodeURIComponent(v)}${O?"?cascade=true":""}`,L=await fetch(P,{method:"DELETE"});if(L.status===409){const B=await L.json().catch(()=>({}));N((B==null?void 0:B.blockedBy)??{projects:[],standalones:[]});return}if(!L.ok){const B=await L.json().catch(()=>({}));throw new Error(B.error||"Failed to delete workspace")}b(null),N(null)}catch(P){console.error(P),alert(P instanceof Error?P.message:"Failed to delete workspace")}finally{C(!1)}}}async function V(O,P){try{if(O.type==="project"){const L=await fetch(`/api/projects/${encodeURIComponent(O.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:P})});if(!L.ok){const B=await L.json().catch(()=>({}));throw new Error(B.error||"Failed to move project")}return}if(O.type==="standalone-assignment"){const L=await fetch(`/api/assignments/${encodeURIComponent(O.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:P})});if(!L.ok){const B=await L.json().catch(()=>({}));throw new Error(B.error||"Failed to move assignment")}return}if(O.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(L){console.error(L),alert(L instanceof Error?L.message:"Failed to move item")}}return s.jsxs("div",{className:"flex h-full flex-col gap-3",children:[s.jsx(Hr,{toast:T,onDismiss:$}),s.jsx("div",{className:"space-y-3",children:s.jsxs($e,{to:"/",className:"inline-flex items-center gap-3",onClick:t,children:[s.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:s.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:[s.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"}),s.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"}),s.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"}),s.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"})]})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Syntaur"}),s.jsx("p",{className:"text-xs text-muted-foreground/60",children:"Local-first project control"})]})]})}),s.jsx(x1,{items:Dz,onNavigate:t}),s.jsx("div",{className:"border-t border-border/40"}),s.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[U.length===0&&!f&&s.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),U.map(O=>{const P=O==="_ungrouped",L=P?"Ungrouped":Dn(O),B=P?"/w/_ungrouped":`/w/${O}`,q=l.has(O),z=e===O||e===null&&P&&a.pathname.startsWith("/w/_ungrouped"),W=y===O;return s.jsxs("div",{className:`rounded-md transition ${W?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:M=>{M.dataTransfer.types.includes("application/json")&&(M.preventDefault(),M.dataTransfer.dropEffect="move",k(O))},onDragLeave:M=>{M.currentTarget.contains(M.relatedTarget)||k(F=>F===O?null:F)},onDrop:async M=>{try{const F=M.dataTransfer.getData("application/json");if(!F)return;M.preventDefault();let G;try{G=JSON.parse(F)}catch{return}if(!(G!=null&&G.type)||!(G!=null&&G.id))return;await V(G,P?null:O)}finally{k(null)}},children:[s.jsxs("div",{className:"group flex items-center",children:[s.jsxs("button",{type:"button",onClick:()=>_(O),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${z?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[s.jsx(vr,{className:`h-3 w-3 transition-transform ${q?"-rotate-90":""}`}),L]}),P?null:s.jsx("button",{type:"button",onClick:M=>{M.stopPropagation(),b(O),N(null)},title:`Delete workspace "${O}"`,"aria-label":`Delete workspace "${O}"`,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:s.jsx(bn,{className:"h-3 w-3"})})]}),!q&&s.jsx("nav",{className:"ml-2 space-y-0.5",children:$z.map(M=>{const F=`${B}${M.suffix}`,G=p2(a.pathname,M.suffix)&&a.pathname.startsWith(B),H=M.icon;return s.jsxs($e,{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:[s.jsx(H,{className:"h-4 w-4"}),s.jsx("span",{children:M.label})]},F)})})]},O)}),f?s.jsx("form",{className:"px-3 py-1.5",onSubmit:async O=>{O.preventDefault();const P=h.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(P){p(!1),g("");try{const L=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:P})});if(!L.ok){const B=await L.json().catch(()=>null);R((B==null?void 0:B.error)||`HTTP ${L.status}`,"error");return}t==null||t(),D(`/w/${P}/projects`)}catch(L){R(L instanceof Error?L.message:"Failed to create workspace","error")}}},children:s.jsx("input",{autoFocus:!0,type:"text",value:h,onChange:O=>g(O.target.value),onKeyDown:O=>{O.key==="Escape"&&(p(!1),g(""))},onBlur:()=>{h.trim()||(p(!1),g(""))},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"})}):s.jsxs("button",{type:"button",onClick:()=>p(!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:[s.jsx(It,{className:"h-3 w-3"}),"New Workspace"]})]}),s.jsx("div",{className:"border-t border-border/40"}),s.jsx(x1,{items:Iz,onNavigate:t}),s.jsx(Nl,{open:v!==null,onOpenChange:O=>{S||O||(b(null),N(null))},children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsx(aa,{children:j?"Workspace has references":"Delete workspace?"}),s.jsx(la,{children:j?s.jsxs(s.Fragment,{children:["The workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:v})," is still referenced by:"]}):s.jsxs(s.Fragment,{children:["Remove the workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:v})," from the registry. This does not affect projects or standalones unless you choose to cascade."]})})]}),j?s.jsxs("div",{className:"space-y-2 text-sm",children:[j.projects.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Projects (",j.projects.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:j.projects.map(O=>s.jsx("li",{children:s.jsx($e,{to:`/projects/${O}`,className:"hover:underline",children:O})},O))})]}):null,j.standalones.length>0?s.jsxs("div",{children:[s.jsxs("p",{className:"font-medium text-foreground",children:["Standalones (",j.standalones.length,")"]}),s.jsx("ul",{className:"mt-1 list-disc pl-5 text-muted-foreground",children:j.standalones.map(O=>s.jsx("li",{children:s.jsx($e,{to:`/assignments/${O}`,className:"hover:underline",children:O})},O))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:['Choose "Clear references and delete" to set ',s.jsx("code",{children:"workspace:"})," / ",s.jsx("code",{children:"workspaceGroup:"})," to ",s.jsx("code",{children:"null"})," on each, then remove the workspace."]})]}):null,s.jsxs(El,{children:[s.jsx(ed,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),j?s.jsx(xi,{disabled:S,onClick:O=>{O.preventDefault(),I(!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"}):s.jsx(xi,{disabled:S,onClick:O=>{O.preventDefault(),I(!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 Lz(){const e=er(),{workspace:t}=Vt(),{title:n,breadcrumbs:r,projectSlug:o}=h2(e.pathname);return s.jsx(Mz,{title:n,breadcrumbs:r,projectSlug:o,workspace:t??null,children:s.jsx(OM,{})})}function Oz(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const lm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pw(e){return"nodeType"in e}function ir(e){var t,n;return e?xc(e)?e:pw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function hw(e){const{Document:t}=ir(e);return e instanceof t}function Dd(e){return xc(e)?!1:e instanceof ir(e).HTMLElement}function nR(e){return e instanceof ir(e).SVGElement}function yc(e){return e?xc(e)?e.document:pw(e)?hw(e)?e:Dd(e)||nR(e)?e.ownerDocument:document:document:document}const ys=lm?m.useLayoutEffect:m.useEffect;function cm(e){const t=m.useRef(e);return ys(()=>{t.current=e}),m.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Fz(){const e=m.useRef(null),t=m.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=m.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function td(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return ys(()=>{n.current!==e&&(n.current=e)},t),n}function $d(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function lh(e){const t=cm(e),n=m.useRef(null),r=m.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function ch(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let oy={};function Id(e,t){return m.useMemo(()=>{if(t)return t;const n=oy[e]==null?0:oy[e]+1;return oy[e]=n,e+"-"+n},[e,t])}function rR(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const l=Object.entries(a);for(const[u,f]of l){const p=i[u];p!=null&&(i[u]=p+e*f)}return i},{...t})}}const Ol=rR(1),nd=rR(-1);function zz(e){return"clientX"in e&&"clientY"in e}function um(e){if(!e)return!1;const{KeyboardEvent:t}=ir(e.target);return t&&e instanceof t}function Bz(e){if(!e)return!1;const{TouchEvent:t}=ir(e.target);return t&&e instanceof t}function uh(e){if(Bz(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 zz(e)?{x:e.clientX,y:e.clientY}:null}const bs=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[bs.Translate.toString(e),bs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),V1="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Uz(e){return e.matches(V1)?e:e.querySelector(V1)}const Hz={display:"none"};function Vz(e){let{id:t,value:n}=e;return $t.createElement("div",{id:t,style:Hz},n)}function Wz(e){let{id:t,announcement:n,ariaLiveType:r="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 $t.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function qz(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const sR=m.createContext(null);function Kz(e){const t=m.useContext(sR);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Gz(){const[e]=m.useState(()=>new Set),t=m.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[m.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var l;return(l=a[o])==null?void 0:l.call(a,i)})},[e]),t]}const Yz={draggable:`
587
+ To pick up a draggable item, press the space bar.
588
+ While dragging, use the arrow keys to move the item.
589
+ Press space again to drop the item in its new position, or press escape to cancel.
590
+ `},Xz={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 Qz(e){let{announcements:t=Xz,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Yz}=e;const{announce:i,announcement:a}=qz(),l=Id("DndLiveRegion"),[u,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),Kz(m.useMemo(()=>({onDragStart(h){let{active:g}=h;i(t.onDragStart({active:g}))},onDragMove(h){let{active:g,over:y}=h;t.onDragMove&&i(t.onDragMove({active:g,over:y}))},onDragOver(h){let{active:g,over:y}=h;i(t.onDragOver({active:g,over:y}))},onDragEnd(h){let{active:g,over:y}=h;i(t.onDragEnd({active:g,over:y}))},onDragCancel(h){let{active:g,over:y}=h;i(t.onDragCancel({active:g,over:y}))}}),[i,t])),!u)return null;const p=$t.createElement($t.Fragment,null,$t.createElement(Vz,{id:r,value:o.draggable}),$t.createElement(Wz,{id:l,announcement:a}));return n?wo.createPortal(p,n):p}var $n;(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"})($n||($n={}));function dh(){}function wi(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function dm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const vs=Object.freeze({x:0,y:0});function oR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jz(e,t){const n=uh(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function iR(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Zz(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function W1(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function aR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function q1(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 fm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=q1(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=oR(q1(u),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(iR)},eB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=W1(t),i=[];for(const a of r){const{id:l}=a,u=n.get(l);if(u){const f=W1(u),p=o.reduce((g,y,k)=>g+oR(f[k],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(iR)};function tB(e,t){const n=Math.max(t.top,e.top),r=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),a=o-r,l=i-n;if(r<o&&n<i){const u=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(u+f-p);return Number(h.toFixed(4))}return 0}const nB=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const u=tB(l,t);u>0&&o.push({id:a,data:{droppableContainer:i,value:u}})}}return o.sort(Zz)};function rB(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function lR(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:vs}function sB(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,l)=>({...a,top:a.top+e*l.y,bottom:a.bottom+e*l.y,left:a.left+e*l.x,right:a.right+e*l.x}),{...n})}}const oB=sB(1);function cR(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 iB(e,t,n){const r=cR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,u=e.left-a-(1-o)*parseFloat(n),f=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),p=o?e.width/o:e.width,h=i?e.height/i:e.height;return{width:p,height:h,top:f,right:u+p,bottom:f+h,left:u}}const aB={ignoreTransform:!1};function bc(e,t){t===void 0&&(t=aB);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=ir(e).getComputedStyle(e);f&&(n=iB(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:u}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:u}}function K1(e){return bc(e,{ignoreTransform:!0})}function lB(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function cB(e,t){return t===void 0&&(t=ir(e).getComputedStyle(e)),t.position==="fixed"}function uB(e,t){t===void 0&&(t=ir(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 pm(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(hw(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Dd(o)||nR(o)||n.includes(o))return n;const i=ir(e).getComputedStyle(o);return o!==e&&uB(o,i)&&n.push(o),cB(o,i)?n:r(o.parentNode)}return e?r(e):n}function uR(e){const[t]=pm(e,1);return t??null}function iy(e){return!lm||!e?null:xc(e)?e:pw(e)?hw(e)||e===yc(e).scrollingElement?window:Dd(e)?e:null:null}function dR(e){return xc(e)?e.scrollX:e.scrollLeft}function fR(e){return xc(e)?e.scrollY:e.scrollTop}function Sb(e){return{x:dR(e),y:fR(e)}}var Hn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Hn||(Hn={}));function pR(e){return!lm||!e?!1:e===document.scrollingElement}function hR(e){const t={x:0,y:0},n=pR(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:t}}const dB={x:.2,y:.2};function fB(e,t,n,r,o){let{top:i,left:a,right:l,bottom:u}=n;r===void 0&&(r=10),o===void 0&&(o=dB);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=hR(e),y={x:0,y:0},k={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+v.height?(y.y=Hn.Backward,k.y=r*Math.abs((t.top+v.height-i)/v.height)):!p&&u>=t.bottom-v.height&&(y.y=Hn.Forward,k.y=r*Math.abs((t.bottom-v.height-u)/v.height)),!g&&l>=t.right-v.width?(y.x=Hn.Forward,k.x=r*Math.abs((t.right-v.width-l)/v.width)):!h&&a<=t.left+v.width&&(y.x=Hn.Backward,k.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:y,speed:k}}function pB(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function mR(e){return e.reduce((t,n)=>Ol(t,Sb(n)),vs)}function hB(e){return e.reduce((t,n)=>t+dR(n),0)}function mB(e){return e.reduce((t,n)=>t+fR(n),0)}function gR(e,t){if(t===void 0&&(t=bc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);uR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const gB=[["x",["left","right"],hB],["y",["top","bottom"],mB]];class mw{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 r=pm(n),o=mR(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of gB)for(const u of a)Object.defineProperty(this,u,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[u]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Fu{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function xB(e){const{EventTarget:t}=ir(e);return e instanceof t?e:yc(e)}function ay(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Qr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Qr||(Qr={}));function G1(e){e.preventDefault()}function yB(e){e.stopPropagation()}var Tt;(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"})(Tt||(Tt={}));const xR={start:[Tt.Space,Tt.Enter],cancel:[Tt.Esc],end:[Tt.Space,Tt.Enter,Tt.Tab]},bB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Tt.Right:return{...n,x:n.x+25};case Tt.Left:return{...n,x:n.x-25};case Tt.Down:return{...n,y:n.y+25};case Tt.Up:return{...n,y:n.y-25}}};class vc{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 Fu(yc(n)),this.windowListeners=new Fu(ir(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Qr.Resize,this.handleCancel),this.windowListeners.add(Qr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Qr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&gR(r),n(vs)}handleKeyDown(t){if(um(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=xR,coordinateGetter:a=bB,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:vs;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=nd(h,p),y={x:0,y:0},{scrollableAncestors:k}=r.current;for(const v of k){const b=t.code,{isTop:j,isRight:N,isLeft:S,isBottom:C,maxScroll:D,minScroll:T}=hR(v),R=pB(v),$={x:Math.min(b===Tt.Right?R.right-R.width/2:R.right,Math.max(b===Tt.Right?R.left:R.left+R.width/2,h.x)),y:Math.min(b===Tt.Down?R.bottom-R.height/2:R.bottom,Math.max(b===Tt.Down?R.top:R.top+R.height/2,h.y))},_=b===Tt.Right&&!N||b===Tt.Left&&!S,U=b===Tt.Down&&!C||b===Tt.Up&&!j;if(_&&$.x!==h.x){const I=v.scrollLeft+g.x,V=b===Tt.Right&&I<=D.x||b===Tt.Left&&I>=T.x;if(V&&!g.y){v.scrollTo({left:I,behavior:l});return}V?y.x=v.scrollLeft-I:y.x=b===Tt.Right?v.scrollLeft-D.x:v.scrollLeft-T.x,y.x&&v.scrollBy({left:-y.x,behavior:l});break}else if(U&&$.y!==h.y){const I=v.scrollTop+g.y,V=b===Tt.Down&&I<=D.y||b===Tt.Up&&I>=T.y;if(V&&!g.x){v.scrollTo({top:I,behavior:l});return}V?y.y=v.scrollTop-I:y.y=b===Tt.Down?v.scrollTop-D.y:v.scrollTop-T.y,y.y&&v.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,Ol(nd(h,this.referenceCoordinates),y))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}vc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=xR,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),o==null||o({event:e.nativeEvent}),!0)}return!1}}];function Y1(e){return!!(e&&"distance"in e)}function X1(e){return!!(e&&"delay"in e)}class gw{constructor(t,n,r){var o;r===void 0&&(r=xB(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:a}=i;this.props=t,this.events=n,this.document=yc(a),this.documentListeners=new Fu(this.document),this.listeners=new Fu(r),this.windowListeners=new Fu(ir(a)),this.initialCoordinates=(o=uh(i))!=null?o:vs,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:r}}}=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(Qr.Resize,this.handleCancel),this.windowListeners.add(Qr.DragStart,G1),this.windowListeners.add(Qr.VisibilityChange,this.handleCancel),this.windowListeners.add(Qr.ContextMenu,G1),this.documentListeners.add(Qr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(X1(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Y1(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:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Qr.Click,yB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Qr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!o)return;const u=(n=uh(t))!=null?n:vs,f=nd(o,u);if(!r&&l){if(Y1(l)){if(l.tolerance!=null&&ay(f,l.tolerance))return this.handleCancel();if(ay(f,l.distance))return this.handleStart()}if(X1(l)&&ay(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(u)}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===Tt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const vB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class wc extends gw{constructor(t){const{event:n}=t,r=yc(n.target);super(t,vB,r)}}wc.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const wB={move:{name:"mousemove"},end:{name:"mouseup"}};var Nb;(function(e){e[e.RightClick=2]="RightClick"})(Nb||(Nb={}));class jB extends gw{constructor(t){super(t,wB,yc(t.event.target))}}jB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Nb.RightClick?!1:(r==null||r({event:n}),!0)}}];const ly={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class kB extends gw{constructor(t){super(t,ly)}static setup(){return window.addEventListener(ly.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ly.move.name,t)};function t(){}}}kB.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r==null||r({event:n}),!0)}}];var zu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(zu||(zu={}));var fh;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(fh||(fh={}));function SB(e){let{acceleration:t,activator:n=zu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=fh.TreeOrder,pointerCoordinates:u,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=CB({delta:h,disabled:!i}),[k,v]=Fz(),b=m.useRef({x:0,y:0}),j=m.useRef({x:0,y:0}),N=m.useMemo(()=>{switch(n){case zu.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case zu.DraggableRect:return o}},[n,o,u]),S=m.useRef(null),C=m.useCallback(()=>{const T=S.current;if(!T)return;const R=b.current.x*j.current.x,$=b.current.y*j.current.y;T.scrollBy(R,$)},[]),D=m.useMemo(()=>l===fh.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!N){v();return}for(const T of D){if((r==null?void 0:r(T))===!1)continue;const R=f.indexOf(T),$=p[R];if(!$)continue;const{direction:_,speed:U}=fB(T,$,N,t,g);for(const I of["x","y"])y[I][_[I]]||(U[I]=0,_[I]=0);if(U.x>0||U.y>0){v(),S.current=T,k(C,a),b.current=U,j.current=_;return}}b.current={x:0,y:0},j.current={x:0,y:0},v()},[t,C,r,v,i,a,JSON.stringify(N),JSON.stringify(y),k,f,D,p,JSON.stringify(g)])}const NB={x:{[Hn.Backward]:!1,[Hn.Forward]:!1},y:{[Hn.Backward]:!1,[Hn.Forward]:!1}};function CB(e){let{delta:t,disabled:n}=e;const r=ch(t);return $d(o=>{if(n||!r||!o)return NB;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Hn.Backward]:o.x[Hn.Backward]||i.x===-1,[Hn.Forward]:o.x[Hn.Forward]||i.x===1},y:{[Hn.Backward]:o.y[Hn.Backward]||i.y===-1,[Hn.Forward]:o.y[Hn.Forward]||i.y===1}}},[n,t,r])}function EB(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return $d(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function TB(e,t){return m.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var rd;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(rd||(rd={}));var Cb;(function(e){e.Optimized="optimized"})(Cb||(Cb={}));const Q1=new Map;function RB(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:u,strategy:f}=o,p=m.useRef(e),h=b(),g=td(h),y=m.useCallback(function(j){j===void 0&&(j=[]),!g.current&&a(N=>N===null?j:N.concat(j.filter(S=>!N.includes(S))))},[g]),k=m.useRef(null),v=$d(j=>{if(h&&!n)return Q1;if(!j||j===Q1||p.current!==e||i!=null){const N=new Map;for(let S of e){if(!S)continue;if(i&&i.length>0&&!i.includes(S.id)&&S.rect.current){N.set(S.id,S.rect.current);continue}const C=S.node.current,D=C?new mw(u(C),C):null;S.rect.current=D,D&&N.set(S.id,D)}return N}return j},[e,i,n,h,u]);return m.useEffect(()=>{p.current=e},[e]),m.useEffect(()=>{h||y()},[n,h]),m.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),m.useEffect(()=>{h||typeof l!="number"||k.current!==null||(k.current=setTimeout(()=>{y(),k.current=null},l))},[l,h,y,...r]),{droppableRects:v,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case rd.Always:return!1;case rd.BeforeDragging:return n;default:return!n}}}function xw(e,t){return $d(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function AB(e,t){return xw(e,t)}function PB(e){let{callback:t,disabled:n}=e;const r=cm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function hm(e){let{callback:t,disabled:n}=e;const r=cm(t),o=m.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return m.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function _B(e){return new mw(bc(e),e)}function J1(e,t,n){t===void 0&&(t=_B);const[r,o]=m.useState(null);function i(){o(u=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=u??n)!=null?f:null}const p=t(e);return JSON.stringify(u)===JSON.stringify(p)?u:p})}const a=PB({callback(u){if(e)for(const f of u){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=hm({callback:i});return ys(()=>{i(),e?(l==null||l.observe(e),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),a==null||a.disconnect())},[e]),r}function DB(e){const t=xw(e);return lR(e,t)}const Z1=[];function $B(e){const t=m.useRef(e),n=$d(r=>e?r&&r!==Z1&&e&&t.current&&e.parentNode===t.current.parentNode?r:pm(e):Z1,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function IB(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=iy(i.target);a&&n(l=>l?(l.set(a,Sb(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(u=>{const f=iy(u);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,Sb(f)]):null}).filter(u=>u!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(u=>{const f=iy(u);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>Ol(i,a),vs):mR(e):vs,[e,t])}function eS(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==vs;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?nd(e,n.current):vs}function MB(e){m.useEffect(()=>{if(!lm)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function LB(e,t){return m.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function yR(e){return m.useMemo(()=>e?lB(e):null,[e])}const tS=[];function OB(e,t){t===void 0&&(t=bc);const[n]=e,r=yR(n?ir(n):null),[o,i]=m.useState(tS);function a(){i(()=>e.length?e.map(u=>pR(u)?r:new mw(t(u),u)):tS)}const l=hm({callback:a});return ys(()=>{l==null||l.disconnect(),a(),e.forEach(u=>l==null?void 0:l.observe(u))},[e]),o}function bR(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Dd(t)?t:e}function FB(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Dd(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=hm({callback:o}),a=m.useCallback(f=>{const p=bR(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,u]=lh(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:u}),[n,l,u])}const zB=[{sensor:wc,options:{}},{sensor:vc,options:{}}],BB={current:{}},Fp={draggable:{measure:K1},droppable:{measure:K1,strategy:rd.WhileDragging,frequency:Cb.Optimized},dragOverlay:{measure:bc}};class Bu 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const UB={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fp,measureDroppableContainers:dh,windowRect:null,measuringScheduled:!1},vR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dh,draggableNodes:new Map,over:null,measureDroppableContainers:dh},Md=m.createContext(vR),wR=m.createContext(UB);function HB(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bu}}}function VB(e,t){switch(t.type){case $n.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $n.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 $n.DragEnd:case $n.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $n.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Bu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case $n.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Bu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case $n.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Bu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function WB(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Md),i=ch(r),a=ch(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!um(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:u,node:f}=l;if(!u.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[u.current,f.current]){if(!p)continue;const h=Uz(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function jR(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function qB(e){return m.useMemo(()=>({draggable:{...Fp.draggable,...e==null?void 0:e.draggable},droppable:{...Fp.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Fp.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 KB(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=m.useRef(!1),{x:a,y:l}=typeof o=="boolean"?{x:o,y:o}:o;ys(()=>{if(!a&&!l||!t){i.current=!1;return}if(i.current||!r)return;const f=t==null?void 0:t.node.current;if(!f||f.isConnected===!1)return;const p=n(f),h=lR(p,r);if(a||(h.x=0),l||(h.y=0),i.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=uR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const mm=m.createContext({...vs,scaleX:1,scaleY:1});var mi;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(mi||(mi={}));const gm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:u=!0,children:f,sensors:p=zB,collisionDetection:h=nB,measuring:g,modifiers:y,...k}=t;const v=m.useReducer(VB,void 0,HB),[b,j]=v,[N,S]=Gz(),[C,D]=m.useState(mi.Uninitialized),T=C===mi.Initialized,{draggable:{active:R,nodes:$,translate:_},droppable:{containers:U}}=b,I=R!=null?$.get(R):null,V=m.useRef({initial:null,translated:null}),O=m.useMemo(()=>{var yt;return R!=null?{id:R,data:(yt=I==null?void 0:I.data)!=null?yt:BB,rect:V}:null},[R,I]),P=m.useRef(null),[L,B]=m.useState(null),[q,z]=m.useState(null),W=td(k,Object.values(k)),M=Id("DndDescribedBy",a),F=m.useMemo(()=>U.getEnabled(),[U]),G=qB(g),{droppableRects:H,measureDroppableContainers:Q,measuringScheduled:te}=RB(F,{dragging:T,dependencies:[_.x,_.y],config:G.droppable}),Z=EB($,R),ae=m.useMemo(()=>q?uh(q):null,[q]),ne=Ze(),de=AB(Z,G.draggable.measure);KB({activeNode:R!=null?$.get(R):null,config:ne.layoutShiftCompensation,initialRect:de,measure:G.draggable.measure});const ye=J1(Z,G.draggable.measure,de),Se=J1(Z?Z.parentElement:null),Te=m.useRef({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:$,draggingNode:null,draggingNodeRect:null,droppableContainers:U,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=U.getNodeFor((n=Te.current.over)==null?void 0:n.id),Fe=FB({measure:G.dragOverlay.measure}),oe=(r=Fe.nodeRef.current)!=null?r:Z,we=T?(o=Fe.rect)!=null?o:ye:null,je=!!(Fe.nodeRef.current&&Fe.rect),De=DB(je?null:ye),Be=yR(oe?ir(oe):null),tt=$B(T?ke??Z:null),Ue=OB(tt),it=jR(y,{transform:{x:_.x-De.x,y:_.y-De.y,scaleX:1,scaleY:1},activatorEvent:q,active:O,activeNodeRect:ye,containerNodeRect:Se,draggingNodeRect:we,over:Te.current.over,overlayNodeRect:Fe.rect,scrollableAncestors:tt,scrollableAncestorRects:Ue,windowRect:Be}),xt=ae?Ol(ae,_):null,at=IB(tt),st=eS(at),ce=eS(at,[ye]),xe=Ol(it,st),Le=we?oB(we,it):null,Ve=O&&Le?h({active:O,collisionRect:Le,droppableRects:H,droppableContainers:F,pointerCoordinates:xt}):null,Ke=aR(Ve,"id"),[ct,le]=m.useState(null),re=je?it:Ol(it,ce),pe=rB(re,(i=ct==null?void 0:ct.rect)!=null?i:null,ye),Re=m.useRef(null),We=m.useCallback((yt,mt)=>{let{sensor:me,options:Ce}=mt;if(P.current==null)return;const Ge=$.get(P.current);if(!Ge)return;const Ct=yt.nativeEvent,Mt=new me({active:P.current,activeNode:Ge,event:Ct,options:Ce,context:Te,onAbort(Et){if(!$.get(Et))return;const{onDragAbort:Ft}=W.current,En={id:Et};Ft==null||Ft(En),N({type:"onDragAbort",event:En})},onPending(Et,Cn,Ft,En){if(!$.get(Et))return;const{onDragPending:ue}=W.current,Ee={id:Et,constraint:Cn,initialCoordinates:Ft,offset:En};ue==null||ue(Ee),N({type:"onDragPending",event:Ee})},onStart(Et){const Cn=P.current;if(Cn==null)return;const Ft=$.get(Cn);if(!Ft)return;const{onDragStart:En}=W.current,en={activatorEvent:Ct,active:{id:Cn,data:Ft.data,rect:V}};wo.unstable_batchedUpdates(()=>{En==null||En(en),D(mi.Initializing),j({type:$n.DragStart,initialCoordinates:Et,active:Cn}),N({type:"onDragStart",event:en}),B(Re.current),z(Ct)})},onMove(Et){j({type:$n.DragMove,coordinates:Et})},onEnd:Nn($n.DragEnd),onCancel:Nn($n.DragCancel)});Re.current=Mt;function Nn(Et){return async function(){const{active:Ft,collisions:En,over:en,scrollAdjustedTranslate:ue}=Te.current;let Ee=null;if(Ft&&ue){const{cancelDrop:rt}=W.current;Ee={activatorEvent:Ct,active:Ft,collisions:En,delta:ue,over:en},Et===$n.DragEnd&&typeof rt=="function"&&await Promise.resolve(rt(Ee))&&(Et=$n.DragCancel)}P.current=null,wo.unstable_batchedUpdates(()=>{j({type:Et}),D(mi.Uninitialized),le(null),B(null),z(null),Re.current=null;const rt=Et===$n.DragEnd?"onDragEnd":"onDragCancel";if(Ee){const Tn=W.current[rt];Tn==null||Tn(Ee),N({type:rt,event:Ee})}})}}},[$]),X=m.useCallback((yt,mt)=>(me,Ce)=>{const Ge=me.nativeEvent,Ct=$.get(Ce);if(P.current!==null||!Ct||Ge.dndKit||Ge.defaultPrevented)return;const Mt={active:Ct};yt(me,mt.options,Mt)===!0&&(Ge.dndKit={capturedBy:mt.sensor},P.current=Ce,We(me,mt))},[$,We]),be=TB(p,X);MB(p),ys(()=>{ye&&C===mi.Initializing&&D(mi.Initialized)},[ye,C]),m.useEffect(()=>{const{onDragMove:yt}=W.current,{active:mt,activatorEvent:me,collisions:Ce,over:Ge}=Te.current;if(!mt||!me)return;const Ct={active:mt,activatorEvent:me,collisions:Ce,delta:{x:xe.x,y:xe.y},over:Ge};wo.unstable_batchedUpdates(()=>{yt==null||yt(Ct),N({type:"onDragMove",event:Ct})})},[xe.x,xe.y]),m.useEffect(()=>{const{active:yt,activatorEvent:mt,collisions:me,droppableContainers:Ce,scrollAdjustedTranslate:Ge}=Te.current;if(!yt||P.current==null||!mt||!Ge)return;const{onDragOver:Ct}=W.current,Mt=Ce.get(Ke),Nn=Mt&&Mt.rect.current?{id:Mt.id,rect:Mt.rect.current,data:Mt.data,disabled:Mt.disabled}:null,Et={active:yt,activatorEvent:mt,collisions:me,delta:{x:Ge.x,y:Ge.y},over:Nn};wo.unstable_batchedUpdates(()=>{le(Nn),Ct==null||Ct(Et),N({type:"onDragOver",event:Et})})},[Ke]),ys(()=>{Te.current={activatorEvent:q,active:O,activeNode:Z,collisionRect:Le,collisions:Ve,droppableRects:H,draggableNodes:$,draggingNode:oe,draggingNodeRect:we,droppableContainers:U,over:ct,scrollableAncestors:tt,scrollAdjustedTranslate:xe},V.current={initial:we,translated:Le}},[O,Z,Ve,Le,$,oe,we,H,U,ct,tt,xe]),SB({...ne,delta:_,draggingRect:Le,pointerCoordinates:xt,scrollableAncestors:tt,scrollableAncestorRects:Ue});const He=m.useMemo(()=>({active:O,activeNode:Z,activeNodeRect:ye,activatorEvent:q,collisions:Ve,containerNodeRect:Se,dragOverlay:Fe,draggableNodes:$,droppableContainers:U,droppableRects:H,over:ct,measureDroppableContainers:Q,scrollableAncestors:tt,scrollableAncestorRects:Ue,measuringConfiguration:G,measuringScheduled:te,windowRect:Be}),[O,Z,ye,q,Ve,Se,Fe,$,U,H,ct,Q,tt,Ue,G,te,Be]),ft=m.useMemo(()=>({activatorEvent:q,activators:be,active:O,activeNodeRect:ye,ariaDescribedById:{draggable:M},dispatch:j,draggableNodes:$,over:ct,measureDroppableContainers:Q}),[q,be,O,ye,j,M,$,ct,Q]);return $t.createElement(sR.Provider,{value:S},$t.createElement(Md.Provider,{value:ft},$t.createElement(wR.Provider,{value:He},$t.createElement(mm.Provider,{value:pe},f)),$t.createElement(WB,{disabled:(l==null?void 0:l.restoreFocus)===!1})),$t.createElement(Qz,{...l,hiddenTextDescribedById:M}));function Ze(){const yt=(L==null?void 0:L.autoScrollEnabled)===!1,mt=typeof u=="object"?u.enabled===!1:u===!1,me=T&&!yt&&!mt;return typeof u=="object"?{...u,enabled:me}:{enabled:me}}}),GB=m.createContext(null),nS="button",YB="Draggable";function XB(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=Id(YB),{activators:a,activatorEvent:l,active:u,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Md),{role:y=nS,roleDescription:k="draggable",tabIndex:v=0}=o??{},b=(u==null?void 0:u.id)===t,j=m.useContext(b?mm:GB),[N,S]=lh(),[C,D]=lh(),T=LB(a,t),R=td(n);ys(()=>(h.set(t,{id:t,key:i,node:N,activatorNode:C,data:R}),()=>{const _=h.get(t);_&&_.key===i&&h.delete(t)}),[h,t]);const $=m.useMemo(()=>({role:y,tabIndex:v,"aria-disabled":r,"aria-pressed":b&&y===nS?!0:void 0,"aria-roledescription":k,"aria-describedby":p.draggable}),[r,y,v,b,k,p.draggable]);return{active:u,activatorEvent:l,activeNodeRect:f,attributes:$,isDragging:b,listeners:r?void 0:T,node:N,over:g,setNodeRef:S,setActivatorNodeRef:D,transform:j}}function kR(){return m.useContext(wR)}const QB="Droppable",JB={timeout:25};function ZB(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=Id(QB),{active:a,dispatch:l,over:u,measureDroppableContainers:f}=m.useContext(Md),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:k,updateMeasurementsFor:v,timeout:b}={...JB,...o},j=td(v??r),N=m.useCallback(()=>{if(!h.current){h.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{f(Array.isArray(j.current)?j.current:[j.current]),y.current=null},b)},[b]),S=hm({callback:N,disabled:k||!a}),C=m.useCallback(($,_)=>{S&&(_&&(S.unobserve(_),h.current=!1),$&&S.observe($))},[S]),[D,T]=lh(C),R=td(t);return m.useEffect(()=>{!S||!D.current||(S.disconnect(),h.current=!1,S.observe(D.current))},[D,S]),m.useEffect(()=>(l({type:$n.RegisterDroppable,element:{id:r,key:i,disabled:n,node:D,rect:g,data:R}}),()=>l({type:$n.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:$n.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(u==null?void 0:u.id)===r,node:D,over:u,setNodeRef:T}}function e8(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=ch(n);return!n&&!r&&l&&o(l),ys(()=>{if(!i)return;const u=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(u==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),$t.createElement($t.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const t8={x:0,y:0,scaleX:1,scaleY:1};function n8(e){let{children:t}=e;return $t.createElement(Md.Provider,{value:vR},$t.createElement(mm.Provider,{value:t8},t))}const r8={position:"fixed",touchAction:"none"},s8=e=>um(e)?"transform 250ms ease":void 0,o8=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:u,transform:f,transition:p=s8}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...r8,width:l.width,height:l.height,top:l.top,left:l.left,transform:bs.Transform.toString(h),transformOrigin:o&&r?Jz(r,l):void 0,transition:typeof p=="function"?p(r):p,...u};return $t.createElement(n,{className:a,style:g,ref:t},i)}),i8=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,u]of Object.entries(i.active))u!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,u));if(i!=null&&i.dragOverlay)for(const[l,u]of Object.entries(i.dragOverlay))u!==void 0&&r.node.style.setProperty(l,u);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[u,f]of Object.entries(o))n.node.style.setProperty(u,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},a8=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:bs.Transform.toString(t)},{transform:bs.Transform.toString(n)}]},l8={duration:250,easing:"ease",keyframes:a8,sideEffects:i8({styles:{active:{opacity:"0"}}})};function c8(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return cm((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const u=l.node.current;if(!u)return;const f=bR(a);if(!f)return;const{transform:p}=ir(a).getComputedStyle(a),h=cR(p);if(!h)return;const g=typeof t=="function"?t:u8(t);return gR(u,o.draggable.measure),g({active:{id:i,data:l.data,node:u,rect:o.draggable.measure(u)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function u8(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...l8,...e};return i=>{let{active:a,dragOverlay:l,transform:u,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:u.scaleX!==1?a.rect.width*u.scaleX/l.rect.width:1,scaleY:u.scaleY!==1?a.rect.height*u.scaleY/l.rect.height:1},g={x:u.x-p.x,y:u.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:u,final:g}}),[k]=y,v=y[y.length-1];if(JSON.stringify(k)===JSON.stringify(v))return;const b=r==null?void 0:r({active:a,dragOverlay:l,...f}),j=l.node.animate(y,{duration:t,easing:n,fill:"forwards"});return new Promise(N=>{j.onfinish=()=>{b==null||b(),N()}})}}let rS=0;function d8(e){return m.useMemo(()=>{if(e!=null)return rS++,rS},[e])}const f8=$t.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:u,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:k,droppableContainers:v,dragOverlay:b,over:j,measuringConfiguration:N,scrollableAncestors:S,scrollableAncestorRects:C,windowRect:D}=kR(),T=m.useContext(mm),R=d8(h==null?void 0:h.id),$=jR(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:j,overlayNodeRect:b.rect,scrollableAncestors:S,scrollableAncestorRects:C,transform:T,windowRect:D}),_=xw(g),U=c8({config:r,draggableNodes:k,droppableContainers:v,measuringConfiguration:N}),I=_?b.setRef:void 0;return $t.createElement(n8,null,$t.createElement(e8,{animation:U},h&&R?$t.createElement(o8,{key:R,id:h.id,ref:I,as:l,activatorEvent:p,adjustScale:t,className:u,transition:i,rect:_,style:{zIndex:f,...o},transform:$},n):null))});function jc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function p8(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function ip(e){return e!==null&&e>=0}function h8(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 m8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const yw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=jc(t,r,n),a=t[o],l=i[o];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},ap={scaleX:1,scaleY:1},bw=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(o===n){const f=i[a];return f?{x:0,y:n<a?f.top+f.height-(l.top+l.height):f.top-l.top,...ap}:null}const u=g8(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-u,...ap}:o<n&&o>=a?{x:0,y:l.height+u,...ap}:{x:0,y:0,...ap}};function g8(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const SR="Sortable",NR=$t.createContext({activeIndex:-1,containerId:SR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:yw,disabled:{draggable:!1,droppable:!1}});function xm(e){let{children:t,id:n,items:r,strategy:o=yw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:u,over:f,measureDroppableContainers:p}=kR(),h=Id(SR,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),k=a!=null,v=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,j=m.useRef(y),N=!h8(y,j.current),S=b!==-1&&v===-1||N,C=m8(i);ys(()=>{N&&k&&p(y)},[N,y,k,p]),m.useEffect(()=>{j.current=y},[y]);const D=m.useMemo(()=>({activeIndex:v,containerId:h,disabled:C,disableTransforms:S,items:y,overIndex:b,useDragOverlay:g,sortedRects:p8(y,u),strategy:o}),[v,h,C.draggable,C.droppable,S,y,b,u,g,o]);return $t.createElement(NR.Provider,{value:D},t)}const x8=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return jc(n,r,o).indexOf(t)},y8=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:u,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===u},b8={duration:200,easing:"ease"},CR="transform",v8=bs.Transition.toString({property:CR,duration:0,easing:"linear"}),w8={roleDescription:"sortable"};function j8(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return ys(()=>{if(!t&&n!==l.current&&r.current){const u=o.current;if(u){const f=bc(r.current,{ignoreTransform:!0}),p={x:u.left-f.left,y:u.top-f.top,scaleX:u.width/f.width,scaleY:u.height/f.height};(p.x||p.y)&&a(p)}}n!==l.current&&(l.current=n)},[t,n,r,o]),m.useEffect(()=>{i&&a(null)},[i]),i}function ym(e){let{animateLayoutChanges:t=y8,attributes:n,disabled:r,data:o,getNewIndex:i=x8,id:a,strategy:l,resizeObserverConfig:u,transition:f=b8}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:k,sortedRects:v,overIndex:b,useDragOverlay:j,strategy:N}=m.useContext(NR),S=k8(r,y),C=p.indexOf(a),D=m.useMemo(()=>({sortable:{containerId:h,index:C,items:p},...o}),[h,o,C,p]),T=m.useMemo(()=>p.slice(p.indexOf(a)),[p,a]),{rect:R,node:$,isOver:_,setNodeRef:U}=ZB({id:a,data:D,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...u}}),{active:I,activatorEvent:V,activeNodeRect:O,attributes:P,setNodeRef:L,listeners:B,isDragging:q,over:z,setActivatorNodeRef:W,transform:M}=XB({id:a,data:D,attributes:{...w8,...n},disabled:S.draggable}),F=Oz(U,L),G=!!I,H=G&&!k&&ip(g)&&ip(b),Q=!j&&q,te=Q&&H?M:null,ae=H?te??(l??N)({rects:v,activeNodeRect:O,activeIndex:g,overIndex:b,index:C}):null,ne=ip(g)&&ip(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,de=I==null?void 0:I.id,ye=m.useRef({activeId:de,items:p,newIndex:ne,containerId:h}),Se=p!==ye.current.items,Te=t({active:I,containerId:h,isDragging:q,isSorting:G,id:a,index:C,items:p,newIndex:ye.current.newIndex,previousItems:ye.current.items,previousContainerId:ye.current.containerId,transition:f,wasDragging:ye.current.activeId!=null}),ke=j8({disabled:!Te,index:C,node:$,rect:R});return m.useEffect(()=>{G&&ye.current.newIndex!==ne&&(ye.current.newIndex=ne),h!==ye.current.containerId&&(ye.current.containerId=h),p!==ye.current.items&&(ye.current.items=p)},[G,ne,h,p]),m.useEffect(()=>{if(de===ye.current.activeId)return;if(de!=null&&ye.current.activeId==null){ye.current.activeId=de;return}const oe=setTimeout(()=>{ye.current.activeId=de},50);return()=>clearTimeout(oe)},[de]),{active:I,activeIndex:g,attributes:P,data:D,rect:R,index:C,newIndex:ne,items:p,isOver:_,isSorting:G,isDragging:q,listeners:B,node:$,overIndex:b,over:z,setNodeRef:F,setActivatorNodeRef:W,setDroppableNodeRef:U,setDraggableNodeRef:L,transform:ke??ae,transition:Fe()};function Fe(){if(ke||Se&&ye.current.newIndex===C)return v8;if(!(Q&&!um(V)||!f)&&(G||Te))return bs.Transition.toString({...f,property:CR})}}function k8(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ph(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 S8=[Tt.Down,Tt.Right,Tt.Up,Tt.Left],ER=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(S8.includes(e.code)){if(e.preventDefault(),!n||!r)return;const u=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case Tt.Down:r.top<g.top&&u.push(h);break;case Tt.Up:r.top>g.top&&u.push(h);break;case Tt.Left:r.left>g.left&&u.push(h);break;case Tt.Right:r.left<g.left&&u.push(h);break}});const f=eB({collisionRect:r,droppableRects:o,droppableContainers:u});let p=aR(f,"id");if(p===(a==null?void 0:a.id)&&f.length>1&&(p=f[1].id),p!=null){const h=i.get(n.id),g=i.get(p),y=g?o.get(g.id):null,k=g==null?void 0:g.node.current;if(k&&y&&h&&g){const b=pm(k).some((T,R)=>l[R]!==T),j=TR(h,g),N=N8(h,g),S=b||!j?{x:0,y:0}:{x:N?r.width-y.width:0,y:N?r.height-y.height:0},C={x:y.left,y:y.top};return S.x&&S.y?C:nd(C,S)}}}};function TR(e,t){return!ph(e)||!ph(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function N8(e,t){return!ph(e)||!ph(t)||!TR(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function jt({label:e="Loading dashboard data…"}){return s.jsx("div",{className:"flex min-h-[240px] items-center justify-center",children:s.jsx("div",{className:"chrome-card !px-4 !py-3",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:e})})})}function Rt({title:e="Something went wrong",error:t,action:n}){return s.jsx("div",{className:"rounded-lg border border-error-foreground/30 bg-error px-4 py-5",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"text-lg font-semibold text-error-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-error-foreground/90",children:t}),n?s.jsx("div",{className:"pt-2",children:n}):null]})})}function zp({command:e,description:t,example:n}){return s.jsxs("div",{className:"rounded-lg border border-border/70 bg-code px-3 py-3 text-code-foreground shadow-sm",children:[s.jsx("code",{className:"block overflow-x-auto font-mono text-sm",children:e}),t?s.jsx("p",{className:"mt-2 text-sm text-code-foreground/80",children:t}):null,n?s.jsx("p",{className:"mt-2 font-mono text-xs text-code-foreground/60",children:n}):null]})}function Xe({title:e,description:t,children:n,className:r,actions:o}){return s.jsxs("section",{className:Ne("surface-panel space-y-3",r),children:[e||o?s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:e}):null,t?s.jsx("p",{className:"text-sm text-muted-foreground",children:t}):null]}),o]}):null,n]})}function C8({help:e,compact:t=!1}){const n=t?(e==null?void 0:e.firstProjectChecklist.slice(0,3))??[]:(e==null?void 0:e.firstProjectChecklist)??[];return s.jsx(Xe,{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:s.jsx($e,{className:"text-sm font-semibold text-primary hover:underline",to:"/help",children:"Open full help"}),children:s.jsx("div",{className:"space-y-3",children:n.map((r,o)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.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}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:r.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:r.detail}),r.command?s.jsx(zp,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const cy={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."},fa={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 E8(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function T8({hero:e,itemsById:t}){const n=pn();if(e.kind==="clean")return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-border/60 bg-background/60 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:fa.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:cy.clean}),s.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."}),s.jsx("div",{className:"mt-4",children:s.jsx($e,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:fa.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=cy[e.copyKey]??cy[e.kind],a=E8(i,{total:e.total,title:o}),l=r?R8(r,n):`${n}/assignments`;return s.jsxs("section",{"aria-labelledby":"overview-hero-title",className:"rounded-xl border border-primary/20 bg-primary/5 p-6 shadow-sm",children:[s.jsx("p",{className:"eyebrow",children:"Top priority"}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:a}),r?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["In ",s.jsx("span",{className:"font-medium text-foreground",children:r.projectTitle??"Standalone"})," ","· status ",s.jsx("span",{className:"font-medium text-foreground",children:r.status})]}):null,s.jsx("div",{className:"mt-4",children:s.jsxs($e,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function R8(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const uy=["title","status","priority","assignee","dependencies","created","updated"],sd=24,RR=60;function A8(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=sd&&Number.isInteger(t.h)&&t.h>=1&&t.h<=RR}const P8={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},sS="2026-05-21T00:00:00Z";function dy(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...P8,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:sS,updatedAt:sS}}const yi={version:1,views:[dy("default-recently-updated","Recently updated",{}),dy("default-high-priority","High priority",{priority:"high"}),dy("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 AR(e,t){const n=qe(e.filters.project),r=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,a=e.filters.query,l=typeof a=="string"&&a.trim().length>0&&Mu(a)===null;return r&&(!o||o==="all")&&!i&&!l}function PR(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?AR(e.config,t.slug):!1}}const _R=`syntaur.savedViews.cache.v${yi.version}`;let Fl=_8(),ea=null,vw=null;const Eb=new Set,hh=new Set;let DR=0;function $R(){return++DR}function Tb(e){return e===DR}function _8(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(_R);if(!e)return null;const t=JSON.parse(e);return t.version!==yi.version?null:t}catch{return null}}function D8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(_R,JSON.stringify(e))}catch{}}function IR(e){Fl=e,vw=null,D8(e);for(const t of Eb)t(e);for(const t of hh)t(null)}function $8(e){vw=e;for(const t of hh)t(e)}function MR(e){if(!e||typeof e!="object")return yi;const t=e;return t.version!==yi.version||!Array.isArray(t.views)||!t.dashboard?yi:t}function oS(){if(ea)return ea;const e=$R();return ea=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=MR(t);return Tb(e)&&IR(n),ea=null,Fl??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Tb(e)&&$8(n),ea=null,Fl??yi}),ea}function ww(){const[e,t]=m.useState(()=>Fl??yi),[n,r]=m.useState(()=>Fl===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>vw);return m.useEffect(()=>{let f=!1;Fl===null&&r(!0),oS().then(g=>{f||(t(g),r(!1),i(!0))});const p=g=>{f||(t(g),r(!1),i(!0),l(null))},h=g=>{f||(l(g),r(!1),i(!0))};return Eb.add(p),hh.add(h),()=>{f=!0,Eb.delete(p),hh.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{ea=null,r(!0),l(null),i(!1),oS()}}}function Ld(){const{file:e,loading:t}=ww();return{views:e.views,loading:t}}function LR(){const{file:e,loading:t}=ww();return{layout:e.dashboard,loading:t}}function ji(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=ww();return e?{view:t.views.find(l=>l.id===e)??null,loading:n,ready:r,error:o,refetch:i}:{view:null,loading:!1,ready:!0,error:null,refetch:i}}async function bm(e,t,n){const r=$R(),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 a=await o.json().catch(()=>({error:`HTTP ${o.status}`}));throw new Error(a.error??`HTTP ${o.status}`)}const i=MR(await o.json());return Tb(r)&&IR(i),i}function Xl(e){return bm("POST","/api/saved-views",e)}function mh(e,t){return bm("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function I8(e){return bm("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Rb(e){return bm("PUT","/api/dashboard",{slots:e})}const M8=["top","right","bottom","left"],ki=Math.min,$r=Math.max,gh=Math.round,lp=Math.floor,Ys=e=>({x:e,y:e}),L8={left:"right",right:"left",bottom:"top",top:"bottom"};function Ab(e,t,n){return $r(e,ki(t,n))}function Eo(e,t){return typeof e=="function"?e(t):e}function To(e){return e.split("-")[0]}function kc(e){return e.split("-")[1]}function jw(e){return e==="x"?"y":"x"}function kw(e){return e==="y"?"height":"width"}function Ws(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Sw(e){return jw(Ws(e))}function O8(e,t,n){n===void 0&&(n=!1);const r=kc(e),o=Sw(e),i=kw(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=xh(a)),[a,xh(a)]}function F8(e){const t=xh(e);return[Pb(e),t,Pb(t)]}function Pb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const iS=["left","right"],aS=["right","left"],z8=["top","bottom"],B8=["bottom","top"];function U8(e,t,n){switch(e){case"top":case"bottom":return n?t?aS:iS:t?iS:aS;case"left":case"right":return t?z8:B8;default:return[]}}function H8(e,t,n,r){const o=kc(e);let i=U8(To(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Pb)))),i}function xh(e){const t=To(e);return L8[t]+e.slice(t.length)}function V8(e){return{top:0,right:0,bottom:0,left:0,...e}}function OR(e){return typeof e!="number"?V8(e):{top:e,right:e,bottom:e,left:e}}function yh(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function lS(e,t,n){let{reference:r,floating:o}=e;const i=Ws(t),a=Sw(t),l=kw(a),u=To(t),f=i==="y",p=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,g=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-o.width,y:h};break;default:y={x:r.x,y:r.y}}switch(kc(t)){case"start":y[a]-=g*(n&&f?-1:1);break;case"end":y[a]+=g*(n&&f?-1:1);break}return y}async function W8(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:u}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=Eo(t,e),k=OR(y),b=l[g?h==="floating"?"reference":"floating":h],j=yh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:f,rootBoundary:p,strategy:u})),N=h==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=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},D=yh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:S,strategy:u}):N);return{top:(j.top-D.top+k.top)/C.y,bottom:(D.bottom-j.bottom+k.bottom)/C.y,left:(j.left-D.left+k.left)/C.x,right:(D.right-j.right+k.right)/C.x}}const q8=50,K8=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:W8},u=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=lS(f,r,u),g=r,y=0;const k={};for(let v=0;v<i.length;v++){const b=i[v];if(!b)continue;const{name:j,fn:N}=b,{x:S,y:C,data:D,reset:T}=await N({x:p,y:h,initialPlacement:r,placement:g,strategy:o,middlewareData:k,rects:f,platform:l,elements:{reference:e,floating:t}});p=S??p,h=C??h,k[j]={...k[j],...D},T&&y<q8&&(y++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(f=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:p,y:h}=lS(f,g,u)),v=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:k}},G8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:u}=t,{element:f,padding:p=0}=Eo(e,t)||{};if(f==null)return{};const h=OR(p),g={x:n,y:r},y=Sw(o),k=kw(y),v=await a.getDimensions(f),b=y==="y",j=b?"top":"left",N=b?"bottom":"right",S=b?"clientHeight":"clientWidth",C=i.reference[k]+i.reference[y]-g[y]-i.floating[k],D=g[y]-i.reference[y],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let R=T?T[S]:0;(!R||!await(a.isElement==null?void 0:a.isElement(T)))&&(R=l.floating[S]||i.floating[k]);const $=C/2-D/2,_=R/2-v[k]/2-1,U=ki(h[j],_),I=ki(h[N],_),V=U,O=R-v[k]-I,P=R/2-v[k]/2+$,L=Ab(V,P,O),B=!u.arrow&&kc(o)!=null&&P!==L&&i.reference[k]/2-(P<V?U:I)-v[k]/2<0,q=B?P<V?P-V:P-O:0;return{[y]:g[y]+q,data:{[y]:L,centerOffset:P-L-q,...B&&{alignmentOffset:q}},reset:B}}}),Y8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:u,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:v=!0,...b}=Eo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const j=To(o),N=Ws(l),S=To(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(f.floating)),D=g||(S||!v?[xh(l)]:F8(l)),T=k!=="none";!g&&T&&D.push(...H8(l,v,k,C));const R=[l,...D],$=await u.detectOverflow(t,b),_=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&_.push($[j]),h){const P=O8(o,a,C);_.push($[P[0]],$[P[1]])}if(U=[...U,{placement:o,overflows:_}],!_.every(P=>P<=0)){var I,V;const P=(((I=i.flip)==null?void 0:I.index)||0)+1,L=R[P];if(L&&(!(h==="alignment"?N!==Ws(L):!1)||U.every(z=>Ws(z.placement)===N?z.overflows[0]>0:!0)))return{data:{index:P,overflows:U},reset:{placement:L}};let B=(V=U.filter(q=>q.overflows[0]<=0).sort((q,z)=>q.overflows[1]-z.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(y){case"bestFit":{var O;const q=(O=U.filter(z=>{if(T){const W=Ws(z.placement);return W===N||W==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(W=>W>0).reduce((W,M)=>W+M,0)]).sort((z,W)=>z[1]-W[1])[0])==null?void 0:O[0];q&&(B=q);break}case"initialPlacement":B=l;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function cS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uS(e){return M8.some(t=>e[t]>=0)}const X8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Eo(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=cS(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:uS(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=cS(a,n.floating);return{data:{escapedOffsets:l,escaped:uS(l)}}}default:return{}}}}},FR=new Set(["left","top"]);async function Q8(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=To(n),l=kc(n),u=Ws(n)==="y",f=FR.has(a)?-1:1,p=i&&u?-1:1,h=Eo(t,e);let{mainAxis:g,crossAxis:y,alignmentAxis:k}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof k=="number"&&(y=l==="end"?k*-1:k),u?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const J8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,u=await Q8(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:a}}}}},Z8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:u={fn:j=>{let{x:N,y:S}=j;return{x:N,y:S}}},...f}=Eo(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Ws(To(o)),y=jw(g);let k=p[y],v=p[g];if(a){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",S=k+h[j],C=k-h[N];k=Ab(S,k,C)}if(l){const j=g==="y"?"top":"left",N=g==="y"?"bottom":"right",S=v+h[j],C=v-h[N];v=Ab(S,v,C)}const b=u.fn({...t,[y]:k,[g]:v});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},e7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:u=!0,crossAxis:f=!0}=Eo(e,t),p={x:n,y:r},h=Ws(o),g=jw(h);let y=p[g],k=p[h];const v=Eo(l,t),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+b.mainAxis,D=i.reference[g]+i.reference[S]-b.mainAxis;y<C?y=C:y>D&&(y=D)}if(f){var j,N;const S=g==="y"?"width":"height",C=FR.has(To(o)),D=i.reference[h]-i.floating[S]+(C&&((j=a.offset)==null?void 0:j[h])||0)+(C?0:b.crossAxis),T=i.reference[h]+i.reference[S]+(C?0:((N=a.offset)==null?void 0:N[h])||0)-(C?b.crossAxis:0);k<D?k=D:k>T&&(k=T)}return{[g]:y,[h]:k}}}},t7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:u=()=>{},...f}=Eo(e,t),p=await a.detectOverflow(t,f),h=To(o),g=kc(o),y=Ws(o)==="y",{width:k,height:v}=i.floating;let b,j;h==="top"||h==="bottom"?(b=h,j=g===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(j=h,b=g==="end"?"top":"bottom");const N=v-p.top-p.bottom,S=k-p.left-p.right,C=ki(v-p[b],N),D=ki(k-p[j],S),T=!t.middlewareData.shift;let R=C,$=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&($=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),T&&!g){const U=$r(p.left,0),I=$r(p.right,0),V=$r(p.top,0),O=$r(p.bottom,0);y?$=k-2*(U!==0||I!==0?U+I:$r(p.left,p.right)):R=v-2*(V!==0||O!==0?V+O:$r(p.top,p.bottom))}await u({...t,availableWidth:$,availableHeight:R});const _=await a.getDimensions(l.floating);return k!==_.width||v!==_.height?{reset:{rects:!0}}:{}}}};function vm(){return typeof window<"u"}function Sc(e){return zR(e)?(e.nodeName||"").toLowerCase():"#document"}function Fr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function eo(e){var t;return(t=(zR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zR(e){return vm()?e instanceof Node||e instanceof Fr(e).Node:!1}function ws(e){return vm()?e instanceof Element||e instanceof Fr(e).Element:!1}function Po(e){return vm()?e instanceof HTMLElement||e instanceof Fr(e).HTMLElement:!1}function dS(e){return!vm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Fr(e).ShadowRoot}function Od(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=js(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function n7(e){return/^(table|td|th)$/.test(Sc(e))}function wm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const r7=/transform|translate|scale|rotate|perspective|filter/,s7=/paint|layout|strict|content/,Xi=e=>!!e&&e!=="none";let fy;function Nw(e){const t=ws(e)?js(e):e;return Xi(t.transform)||Xi(t.translate)||Xi(t.scale)||Xi(t.rotate)||Xi(t.perspective)||!Cw()&&(Xi(t.backdropFilter)||Xi(t.filter))||r7.test(t.willChange||"")||s7.test(t.contain||"")}function o7(e){let t=Si(e);for(;Po(t)&&!Ql(t);){if(Nw(t))return t;if(wm(t))return null;t=Si(t)}return null}function Cw(){return fy==null&&(fy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),fy}function Ql(e){return/^(html|body|#document)$/.test(Sc(e))}function js(e){return Fr(e).getComputedStyle(e)}function jm(e){return ws(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Si(e){if(Sc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||dS(e)&&e.host||eo(e);return dS(t)?t.host:t}function BR(e){const t=Si(e);return Ql(t)?e.ownerDocument?e.ownerDocument.body:e.body:Po(t)&&Od(t)?t:BR(t)}function od(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=BR(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Fr(o);if(i){const l=_b(a);return t.concat(a,a.visualViewport||[],Od(o)?o:[],l&&n?od(l):[])}else return t.concat(o,od(o,[],n))}function _b(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function UR(e){const t=js(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Po(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=gh(n)!==i||gh(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Ew(e){return ws(e)?e:e.contextElement}function zl(e){const t=Ew(e);if(!Po(t))return Ys(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=UR(t);let a=(i?gh(n.width):n.width)/r,l=(i?gh(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const i7=Ys(0);function HR(e){const t=Fr(e);return!Cw()||!t.visualViewport?i7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function a7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Fr(e)?!1:t}function ba(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ew(e);let a=Ys(1);t&&(r?ws(r)&&(a=zl(r)):a=zl(e));const l=a7(i,n,r)?HR(i):Ys(0);let u=(o.left+l.x)/a.x,f=(o.top+l.y)/a.y,p=o.width/a.x,h=o.height/a.y;if(i){const g=Fr(i),y=r&&ws(r)?Fr(r):r;let k=g,v=_b(k);for(;v&&r&&y!==k;){const b=zl(v),j=v.getBoundingClientRect(),N=js(v),S=j.left+(v.clientLeft+parseFloat(N.paddingLeft))*b.x,C=j.top+(v.clientTop+parseFloat(N.paddingTop))*b.y;u*=b.x,f*=b.y,p*=b.x,h*=b.y,u+=S,f+=C,k=Fr(v),v=_b(k)}}return yh({width:p,height:h,x:u,y:f})}function km(e,t){const n=jm(e).scrollLeft;return t?t.left+n:ba(eo(e)).left+n}function VR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-km(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function l7(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=eo(r),l=t?wm(t.floating):!1;if(r===a||l&&i)return n;let u={scrollLeft:0,scrollTop:0},f=Ys(1);const p=Ys(0),h=Po(r);if((h||!h&&!i)&&((Sc(r)!=="body"||Od(a))&&(u=jm(r)),h)){const y=ba(r);f=zl(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?VR(a,u):Ys(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-u.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-u.scrollTop*f.y+p.y+g.y}}function c7(e){return Array.from(e.getClientRects())}function u7(e){const t=eo(e),n=jm(e),r=e.ownerDocument.body,o=$r(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=$r(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+km(e);const l=-n.scrollTop;return js(r).direction==="rtl"&&(a+=$r(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const fS=25;function d7(e,t){const n=Fr(e),r=eo(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,u=0;if(o){i=o.width,a=o.height;const p=Cw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}const f=km(r);if(f<=0){const p=r.ownerDocument,h=p.body,g=getComputedStyle(h),y=p.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,k=Math.abs(r.clientWidth-h.clientWidth-y);k<=fS&&(i-=k)}else f<=fS&&(i+=f);return{width:i,height:a,x:l,y:u}}function f7(e,t){const n=ba(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Po(e)?zl(e):Ys(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,u=o*i.x,f=r*i.y;return{width:a,height:l,x:u,y:f}}function pS(e,t,n){let r;if(t==="viewport")r=d7(e,n);else if(t==="document")r=u7(eo(e));else if(ws(t))r=f7(t,n);else{const o=HR(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yh(r)}function WR(e,t){const n=Si(e);return n===t||!ws(n)||Ql(n)?!1:js(n).position==="fixed"||WR(n,t)}function p7(e,t){const n=t.get(e);if(n)return n;let r=od(e,[],!1).filter(l=>ws(l)&&Sc(l)!=="body"),o=null;const i=js(e).position==="fixed";let a=i?Si(e):e;for(;ws(a)&&!Ql(a);){const l=js(a),u=Nw(a);!u&&l.position==="fixed"&&(o=null),(i?!u&&!o:!u&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Od(a)&&!u&&WR(e,a))?r=r.filter(p=>p!==a):o=l,a=Si(a)}return t.set(e,r),r}function h7(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?wm(t)?[]:p7(t,this._c):[].concat(n),r],l=pS(t,a[0],o);let u=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=pS(t,a[g],o);u=$r(y.top,u),f=ki(y.right,f),p=ki(y.bottom,p),h=$r(y.left,h)}return{width:f-h,height:p-u,x:h,y:u}}function m7(e){const{width:t,height:n}=UR(e);return{width:t,height:n}}function g7(e,t,n){const r=Po(t),o=eo(t),i=n==="fixed",a=ba(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=Ys(0);function f(){u.x=km(o)}if(r||!r&&!i)if((Sc(t)!=="body"||Od(o))&&(l=jm(t)),r){const y=ba(t,!0,i,t);u.x=y.x+t.clientLeft,u.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?VR(o,l):Ys(0),h=a.left+l.scrollLeft-u.x-p.x,g=a.top+l.scrollTop-u.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function py(e){return js(e).position==="static"}function hS(e,t){if(!Po(e)||js(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return eo(e)===n&&(n=n.ownerDocument.body),n}function qR(e,t){const n=Fr(e);if(wm(e))return n;if(!Po(e)){let o=Si(e);for(;o&&!Ql(o);){if(ws(o)&&!py(o))return o;o=Si(o)}return n}let r=hS(e,t);for(;r&&n7(r)&&py(r);)r=hS(r,t);return r&&Ql(r)&&py(r)&&!Nw(r)?n:r||o7(e)||n}const x7=async function(e){const t=this.getOffsetParent||qR,n=this.getDimensions,r=await n(e.floating);return{reference:g7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function y7(e){return js(e).direction==="rtl"}const b7={convertOffsetParentRelativeRectToViewportRelativeRect:l7,getDocumentElement:eo,getClippingRect:h7,getOffsetParent:qR,getElementRects:x7,getClientRects:c7,getDimensions:m7,getScale:zl,isElement:ws,isRTL:y7};function KR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function v7(e,t){let n=null,r;const o=eo(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const k=lp(h),v=lp(o.clientWidth-(p+g)),b=lp(o.clientHeight-(h+y)),j=lp(p),S={rootMargin:-k+"px "+-v+"px "+-b+"px "+-j+"px",threshold:$r(0,ki(1,u))||1};let C=!0;function D(T){const R=T[0].intersectionRatio;if(R!==u){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!KR(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(D,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,S)}n.observe(e)}return a(!0),i}function w7(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,f=Ew(e),p=o||i?[...f?od(f):[],...t?od(t):[]]:[];p.forEach(j=>{o&&j.addEventListener("scroll",n,{passive:!0}),i&&j.addEventListener("resize",n)});const h=f&&l?v7(f,n):null;let g=-1,y=null;a&&(y=new ResizeObserver(j=>{let[N]=j;N&&N.target===f&&y&&t&&(y.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var S;(S=y)==null||S.observe(t)})),n()}),f&&!u&&y.observe(f),t&&y.observe(t));let k,v=u?ba(e):null;u&&b();function b(){const j=ba(e);v&&!KR(v,j)&&n(),v=j,k=requestAnimationFrame(b)}return n(),()=>{var j;p.forEach(N=>{o&&N.removeEventListener("scroll",n),i&&N.removeEventListener("resize",n)}),h==null||h(),(j=y)==null||j.disconnect(),y=null,u&&cancelAnimationFrame(k)}}const j7=J8,k7=Z8,S7=Y8,N7=t7,C7=X8,mS=G8,E7=e7,T7=(e,t,n)=>{const r=new Map,o={platform:b7,...n},i={...o.platform,_c:r};return K8(e,t,{...o,platform:i})};var R7=typeof document<"u",A7=function(){},Bp=R7?m.useLayoutEffect:A7;function bh(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bh(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!bh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function GR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gS(e,t){const n=GR(e);return Math.round(t*n)/n}function hy(e){const t=m.useRef(e);return Bp(()=>{t.current=e}),t}function P7(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:u,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);bh(g,r)||y(r);const[k,v]=m.useState(null),[b,j]=m.useState(null),N=m.useCallback(z=>{z!==T.current&&(T.current=z,v(z))},[]),S=m.useCallback(z=>{z!==R.current&&(R.current=z,j(z))},[]),C=i||k,D=a||b,T=m.useRef(null),R=m.useRef(null),$=m.useRef(p),_=u!=null,U=hy(u),I=hy(o),V=hy(f),O=m.useCallback(()=>{if(!T.current||!R.current)return;const z={placement:t,strategy:n,middleware:g};I.current&&(z.platform=I.current),T7(T.current,R.current,z).then(W=>{const M={...W,isPositioned:V.current!==!1};P.current&&!bh($.current,M)&&($.current=M,wo.flushSync(()=>{h(M)}))})},[g,t,n,I,V]);Bp(()=>{f===!1&&$.current.isPositioned&&($.current.isPositioned=!1,h(z=>({...z,isPositioned:!1})))},[f]);const P=m.useRef(!1);Bp(()=>(P.current=!0,()=>{P.current=!1}),[]),Bp(()=>{if(C&&(T.current=C),D&&(R.current=D),C&&D){if(U.current)return U.current(C,D,O);O()}},[C,D,O,U,_]);const L=m.useMemo(()=>({reference:T,floating:R,setReference:N,setFloating:S}),[N,S]),B=m.useMemo(()=>({reference:C,floating:D}),[C,D]),q=m.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const W=gS(B.floating,p.x),M=gS(B.floating,p.y);return l?{...z,transform:"translate("+W+"px, "+M+"px)",...GR(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:M}},[n,l,B.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:O,refs:L,elements:B,floatingStyles:q}),[p,O,L,B,q])}const _7=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?mS({element:r.current,padding:o}).fn(n):{}:r?mS({element:r,padding:o}).fn(n):{}}}},D7=(e,t)=>{const n=j7(e);return{name:n.name,fn:n.fn,options:[e,t]}},$7=(e,t)=>{const n=k7(e);return{name:n.name,fn:n.fn,options:[e,t]}},I7=(e,t)=>({fn:E7(e).fn,options:[e,t]}),M7=(e,t)=>{const n=S7(e);return{name:n.name,fn:n.fn,options:[e,t]}},L7=(e,t)=>{const n=N7(e);return{name:n.name,fn:n.fn,options:[e,t]}},O7=(e,t)=>{const n=C7(e);return{name:n.name,fn:n.fn,options:[e,t]}},F7=(e,t)=>{const n=_7(e);return{name:n.name,fn:n.fn,options:[e,t]}};var z7="Arrow",YR=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(wn.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});YR.displayName=z7;var B7=YR;function U7(e){const[t,n]=m.useState(void 0);return vi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const u=i.borderBoxSize,f=Array.isArray(u)?u[0]:u;a=f.inlineSize,l=f.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Tw="Popper",[XR,QR]=Ca(Tw),[H7,JR]=XR(Tw),ZR=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(H7,{scope:t,anchor:r,onAnchorChange:o,children:n})};ZR.displayName=Tw;var eA="PopperAnchor",tA=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=JR(eA,n),a=m.useRef(null),l=Zn(t,a),u=m.useRef(null);return m.useEffect(()=>{const f=u.current;u.current=(r==null?void 0:r.current)||a.current,f!==u.current&&i.onAnchorChange(u.current)}),r?null:s.jsx(wn.div,{...o,ref:l})});tA.displayName=eA;var Rw="PopperContent",[V7,W7]=XR(Rw),nA=m.forwardRef((e,t)=>{var ae,ne,de,ye,Se,Te;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:k,...v}=e,b=JR(Rw,n),[j,N]=m.useState(null),S=Zn(t,ke=>N(ke)),[C,D]=m.useState(null),T=U7(C),R=(T==null?void 0:T.width)??0,$=(T==null?void 0:T.height)??0,_=r+(i!=="center"?"-"+i:""),U=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},I=Array.isArray(f)?f:[f],V=I.length>0,O={padding:U,boundary:I.filter(K7),altBoundary:V},{refs:P,floatingStyles:L,placement:B,isPositioned:q,middlewareData:z}=P7({strategy:"fixed",placement:_,whileElementsMounted:(...ke)=>w7(...ke,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[D7({mainAxis:o+$,alignmentAxis:a}),u&&$7({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?I7():void 0,...O}),u&&M7({...O}),L7({...O,apply:({elements:ke,rects:Fe,availableWidth:oe,availableHeight:we})=>{const{width:je,height:De}=Fe.reference,Be=ke.floating.style;Be.setProperty("--radix-popper-available-width",`${oe}px`),Be.setProperty("--radix-popper-available-height",`${we}px`),Be.setProperty("--radix-popper-anchor-width",`${je}px`),Be.setProperty("--radix-popper-anchor-height",`${De}px`)}}),C&&F7({element:C,padding:l}),G7({arrowWidth:R,arrowHeight:$}),g&&O7({strategy:"referenceHidden",...O})]}),[W,M]=oA(B),F=xa(k);vi(()=>{q&&(F==null||F())},[q,F]);const G=(ae=z.arrow)==null?void 0:ae.x,H=(ne=z.arrow)==null?void 0:ne.y,Q=((de=z.arrow)==null?void 0:de.centerOffset)!==0,[te,Z]=m.useState();return vi(()=>{j&&Z(window.getComputedStyle(j).zIndex)},[j]),s.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...L,transform:q?L.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:te,"--radix-popper-transform-origin":[(ye=z.transformOrigin)==null?void 0:ye.x,(Se=z.transformOrigin)==null?void 0:Se.y].join(" "),...((Te=z.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(V7,{scope:n,placedSide:W,onArrowChange:D,arrowX:G,arrowY:H,shouldHideArrow:Q,children:s.jsx(wn.div,{"data-side":W,"data-align":M,...v,ref:S,style:{...v.style,animation:q?void 0:"none"}})})})});nA.displayName=Rw;var rA="PopperArrow",q7={top:"bottom",right:"left",bottom:"top",left:"right"},sA=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=W7(rA,r),a=q7[i.placedSide];return s.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]: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:s.jsx(B7,{...o,ref:n,style:{...o.style,display:"block"}})})});sA.displayName=rA;function K7(e){return e!==null}var G7=e=>({name:"transformOrigin",options:e,fn(t){var b,j,N;const{placement:n,rects:r,middlewareData:o}=t,a=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=a?0:e.arrowWidth,u=a?0:e.arrowHeight,[f,p]=oA(n),h={start:"0%",center:"50%",end:"100%"}[p],g=(((j=o.arrow)==null?void 0:j.x)??0)+l/2,y=(((N=o.arrow)==null?void 0:N.y)??0)+u/2;let k="",v="";return f==="bottom"?(k=a?h:`${g}px`,v=`${-u}px`):f==="top"?(k=a?h:`${g}px`,v=`${r.floating.height+u}px`):f==="right"?(k=`${-u}px`,v=a?h:`${y}px`):f==="left"&&(k=`${r.floating.width+u}px`,v=a?h:`${y}px`),{data:{x:k,y:v}}}});function oA(e){const[t,n="center"]=e.split("-");return[t,n]}var Y7=ZR,X7=tA,Q7=nA,J7=sA,Z7=Symbol("radix.slottable");function eU(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Z7,t}var tU=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"}),nU="VisuallyHidden",iA=m.forwardRef((e,t)=>s.jsx(wn.span,{...e,ref:t,style:{...tU,...e.style}}));iA.displayName=nU;var rU=iA,[Sm]=Ca("Tooltip",[QR]),Nm=QR(),aA="TooltipProvider",sU=700,Db="tooltip.open",[oU,Aw]=Sm(aA),lA=e=>{const{__scopeTooltip:t,delayDuration:n=sU,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),u=m.useRef(0);return m.useEffect(()=>{const f=u.current;return()=>window.clearTimeout(f)},[]),s.jsx(oU,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(u.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};lA.displayName=aA;var id="Tooltip",[iU,Fd]=Sm(id),cA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,u=Aw(id,e.__scopeTooltip),f=Nm(t),[p,h]=m.useState(null),g=$l(),y=m.useRef(0),k=a??u.disableHoverableContent,v=l??u.delayDuration,b=m.useRef(!1),[j,N]=om({prop:r,defaultProp:o??!1,onChange:R=>{R?(u.onOpen(),document.dispatchEvent(new CustomEvent(Db))):u.onClose(),i==null||i(R)},caller:id}),S=m.useMemo(()=>j?b.current?"delayed-open":"instant-open":"closed",[j]),C=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,N(!0)},[N]),D=m.useCallback(()=>{window.clearTimeout(y.current),y.current=0,N(!1)},[N]),T=m.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,N(!0),y.current=0},v)},[v,N]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(Y7,{...f,children:s.jsx(iU,{scope:t,contentId:g,open:j,stateAttribute:S,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{u.isOpenDelayedRef.current?T():C()},[u.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{k?D():(window.clearTimeout(y.current),y.current=0)},[D,k]),onOpen:C,onClose:D,disableHoverableContent:k,children:n})})};cA.displayName=id;var $b="TooltipTrigger",uA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Fd($b,n),i=Aw($b,n),a=Nm(n),l=m.useRef(null),u=Zn(t,l,o.onTriggerChange),f=m.useRef(!1),p=m.useRef(!1),h=m.useCallback(()=>f.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),s.jsx(X7,{asChild:!0,...a,children:s.jsx(wn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:rn(e.onPointerMove,g=>{g.pointerType!=="touch"&&!p.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:rn(e.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:rn(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:rn(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:rn(e.onBlur,o.onClose),onClick:rn(e.onClick,o.onClose)})})});uA.displayName=$b;var Pw="TooltipPortal",[aU,lU]=Sm(Pw,{forceMount:void 0}),dA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Fd(Pw,t);return s.jsx(aU,{scope:t,forceMount:n,children:s.jsx(Ea,{present:n||i.open,children:s.jsx(Xv,{asChild:!0,container:o,children:r})})})};dA.displayName=Pw;var Jl="TooltipContent",fA=m.forwardRef((e,t)=>{const n=lU(Jl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Fd(Jl,e.__scopeTooltip);return s.jsx(Ea,{present:r||a.open,children:a.disableHoverableContent?s.jsx(pA,{side:o,...i,ref:t}):s.jsx(cU,{side:o,...i,ref:t})})}),cU=m.forwardRef((e,t)=>{const n=Fd(Jl,e.__scopeTooltip),r=Aw(Jl,e.__scopeTooltip),o=m.useRef(null),i=Zn(t,o),[a,l]=m.useState(null),{trigger:u,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((k,v)=>{const b=k.currentTarget,j={x:k.clientX,y:k.clientY},N=hU(j,b.getBoundingClientRect()),S=mU(j,N),C=gU(v.getBoundingClientRect()),D=yU([...S,...C]);l(D),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(u&&p){const k=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",k),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",k),p.removeEventListener("pointerleave",v)}}},[u,p,y,g]),m.useEffect(()=>{if(a){const k=v=>{const b=v.target,j={x:v.clientX,y:v.clientY},N=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),S=!xU(j,a);N?g():S&&(g(),f())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[u,p,a,f,g]),s.jsx(pA,{...e,ref:i})}),[uU,dU]=Sm(id,{isInside:!1}),fU=eU("TooltipContent"),pA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,u=Fd(Jl,n),f=Nm(n),{onClose:p}=u;return m.useEffect(()=>(document.addEventListener(Db,p),()=>document.removeEventListener(Db,p)),[p]),m.useEffect(()=>{if(u.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[u.trigger,p]),s.jsx(Yv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(Q7,{"data-state":u.stateAttribute,...f,...l,ref:t,style:{...l.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:[s.jsx(fU,{children:r}),s.jsx(uU,{scope:n,isInside:!0,children:s.jsx(rU,{id:u.contentId,role:"tooltip",children:o||r})})]})})});fA.displayName=Jl;var hA="TooltipArrow",pU=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Nm(n);return dU(hA,n).isInside?null:s.jsx(J7,{...o,...r,ref:t})});pU.displayName=hA;function hU(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function mU(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function gU(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function xU(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],u=t[a],f=l.x,p=l.y,h=u.x,g=u.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function yU(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),bU(t)}function bU(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.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 vU=lA,wU=cA,jU=uA,kU=dA,mA=fA;const pa=vU,Ir=wU,Mr=jU,gr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(kU,{children:s.jsx(mA,{ref:r,sideOffset:t,className:Ne("z-50 overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));gr.displayName=mA.displayName;function _w({items:e,align:t="end"}){const[n,r]=m.useState(!1),[o,i]=m.useState(null),a=m.useRef(null);if(m.useEffect(()=>{if(!n){i(null);return}function u(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(u,f){const p=u.icon,h=Ne("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",u.disabled?"opacity-50 cursor-not-allowed":u.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?u.active?s.jsx(zr,{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):s.jsx("span",{className:"h-4 w-4 shrink-0","aria-hidden":"true"}):p?s.jsx(p,{className:"h-4 w-4 shrink-0"}):null,y=s.jsxs(s.Fragment,{children:[g,s.jsx("span",{className:"block min-w-0 truncate",children:u.label})]});if(u.disabled){const k=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:h,children:y})});return u.disabledReason?s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:k}),s.jsx(gr,{side:"left",children:u.disabledReason})]},u.key):s.jsx("div",{children:k},u.key)}return u.href?s.jsx($e,{to:u.href,className:h,onClick:()=>r(!1),children:y},u.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var k;(k=u.onSelect)==null||k.call(u),r(!1)},children:y},u.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(u=>!u),className:"shell-action",title:"More actions","aria-label":"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(OL,{className:"h-4 w-4"})}),n&&s.jsx("div",{className:Ne("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:s.jsx(pa,{delayDuration:200,children:e.map(u=>{if(u.submenu&&u.submenu.length>0){const f=u.icon,p=o===u.key;return s.jsxs("div",{children:[s.jsxs("button",{type:"button",className:Ne("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition hover:bg-foreground/5"),"aria-expanded":p,onClick:()=>i(p?null:u.key),children:[f?s.jsx(f,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 flex-1 truncate",children:u.label}),p?s.jsx(vr,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(YE,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?u.submenu.map(h=>l(h,!0)):null]},u.key)}return l(u,!1)})})})]})}function xS(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const SU={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 NU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function CU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function EU(e,t,n=Date.now()){if(!t)return!0;const r=t.field==="created"?e.created??e.updated:e.updated,o=Date.parse(r);if(Number.isNaN(o))return!1;if(t.preset){const l=SU[t.preset];return l===void 0?!0:t.preset.startsWith("older_")?n-o>l:o>=n-l&&o<=n}const i=t.from&&t.from.length>0?t.from:void 0,a=t.to&&t.to.length>0?t.to:void 0;return!i&&!a?!0:!(i&&o<NU(i)||a&&o>CU(a))}function TU(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=qe(t.status),l=qe(t.priority),u=qe(t.type),f=qe(t.assignee),p=qe(t.project),h=qe(t.tags),{activity:g}=t;if(r){if(r==="_ungrouped"){if(e.projectWorkspace!=null)return!1}else if(e.projectWorkspace!==r)return!1}if(a.length&&!a.includes(e.status)||l.length&&!l.includes(e.priority)||u.length&&!u.includes(e.type??"")||g==="stale"&&!xS(e.updated)||g==="fresh"&&xS(e.updated))return!1;if(f.length){const y=e.assignee??"__unassigned__";if(!f.includes(y))return!1}if(p.length&&!p.some(k=>k==="__standalone__"?e.projectSlug==null:e.projectSlug===k))return!1;if(h.length){const y=e.tags??[];if(!h.some(k=>y.includes(k)))return!1}if(!EU(e,t.dateRange))return!1;if(o){const y=o.trim().toLowerCase();if(y&&!`${e.title??""} ${e.slug??""} ${e.projectTitle??"standalone"} ${e.projectSlug??""}`.toLowerCase().includes(y))return!1}return!0}function ad(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const yS={critical:0,high:1,medium:2,low:3};function cp(e){return Date.parse(e??"")||0}function zd(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"title":a=o.title.localeCompare(i.title);break;case"status":a=o.status.localeCompare(i.status);break;case"priority":a=(yS[o.priority]??99)-(yS[i.priority]??99);break;case"assignee":a=(o.assignee??"").localeCompare(i.assignee??"");break;case"dependencies":a=o.dependsOn.length-i.dependsOn.length;break;case"created":a=cp(o.created)-cp(i.created);break;case"updated":a=cp(o.updated)-cp(i.updated);break}return n==="asc"?a:-a})}function RU(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 gA(e,t,n={}){const{workspace:r,includeArchived:o=!1,now:i=Date.now()}=n,a={now:i};return e.filter(l=>{if(l.archived===!0&&!o)return!1;if(r){if(r==="_ungrouped"){if(l.projectWorkspace!=null)return!1}else if(l.projectWorkspace!==r)return!1}if(!t)return!0;const u=RU(l);return t.predicate(u,a)})}const Cm={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 Em(e){const t=e.name,n={fact:t,approved:`${t}Approved`,changesRequested:`${t}ChangesRequested`,by:`${t}By`,approvedBy:`${t}ApprovedBy`},r=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:r}}function AU(e){const t=[];for(const n of e??[]){if(!n||typeof n.name!="string")continue;const r=n.name.trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(r))continue;const o=(n.type??"").trim();if(o==="bool"||o==="number")t.push({name:r,type:o});else if(o==="attestation"){const i=(n.binds??"none").toString().trim()||"none";(i==="plan"||i==="commit"||i==="none")&&t.push({name:r,type:"attestation",binds:i})}}return t}function Ib(e){const t=[],n=new Map;for(const r of Object.keys(Cm))n.set(r,"built-in");for(const r of Object.keys(tm))n.set(r,"built-in");for(const r of e??[]){const o=((r==null?void 0:r.name)??"").trim();if(!/^[a-z][a-zA-Z0-9]*$/.test(o)){t.push(`fact "${(r==null?void 0:r.name)??""}": invalid name — must match /^[a-z][a-zA-Z0-9]*$/`);continue}const i=(r.type??"").trim();if(i!=="bool"&&i!=="number"&&i!=="attestation"){t.push(`fact "${o}": invalid type "${r.type??""}" — expected bool, number, or attestation`);continue}if(i==="attestation"){const f=(r.binds??"none").toString().trim()||"none";if(f!=="plan"&&f!=="commit"&&f!=="none"){t.push(`fact "${o}": invalid binds "${r.binds}" — expected plan, commit, or none`);continue}}const l=Em(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,u=l.find(f=>n.has(f));if(u!==void 0){const f=n.get(u);f==="built-in"?t.push(`fact "${o}": exported field "${u}" collides with a built-in field`):f===o?t.push(`fact "${o}": duplicate declaration (a fact named "${o}" is already declared)`):t.push(`fact "${o}": exported field "${u}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function PU(e){const t=new Set([...Object.keys(Cm),...Object.keys(tm)]),n=[];for(const r of e){const o=Em(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function xA(e,t){const n=Em(t);t.type==="attestation"?(e[n.exports.fact.toLowerCase()]={kind:"bool",get:r=>r[n.exports.fact]},e[n.exports.approved.toLowerCase()]={kind:"bool",get:r=>r[n.exports.approved]},e[n.exports.changesRequested.toLowerCase()]={kind:"bool",get:r=>r[n.exports.changesRequested]},e[n.exports.by.toLowerCase()]={kind:"list",get:r=>r[n.exports.by]},e[n.exports.approvedBy.toLowerCase()]={kind:"list",get:r=>r[n.exports.approvedBy]}):e[n.exports.fact.toLowerCase()]={kind:t.type,get:r=>r[n.exports.fact]}}function Dw(e){const t={...Cm};for(const n of e)xA(t,n);return t}function yA(e){const t={...tm};for(const n of e)xA(t,n);return t}function bA(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 r of e){const o=Em(r);r.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 Nt({title:e,description:t,actions:n}){return s.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",children:s.jsxs("div",{className:"mx-auto max-w-xl space-y-2",children:[s.jsx("h3",{className:"text-base font-semibold text-foreground",children:e}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:t}),n?s.jsx("div",{className:"flex flex-wrap justify-center gap-3 pt-2",children:n}):null]})})}const Zl='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Tm({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:u,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1,boundedColumns:k=!1}){const v=k&&!g,b=m.useMemo(()=>new Set(p??[]),[p]),j=m.useMemo(()=>e.filter(B=>!b.has(B.id)),[e,b]),N=m.useMemo(()=>e.filter(B=>b.has(B.id)),[e,b]),[S,C]=m.useState(null),[D,T]=m.useState(null),R=m.useRef(null),$=m.useMemo(()=>new Map(t.map(B=>[n(B),B])),[n,t]),_=m.useMemo(()=>j.map(B=>({column:B,items:t.filter(q=>r(q)===B.id)})),[j,r,t]),U=S?$.get(S)??null:null;function I(B){if(!U)return{allowed:!1};const q=r(U);return(i==null?void 0:i({item:U,fromColumnId:q,toColumnId:B}))??{allowed:!0}}function V(){C(null),T(null)}function O(B,q,z){if(y)return;const W=(l==null?void 0:l(q))??null;!a&&!W||(B.dataTransfer.effectAllowed="move",B.dataTransfer.setData("text/plain",z),W&&B.dataTransfer.setData("application/json",JSON.stringify(W)),a&&C(z))}function P(B,q,z){y||!a||!U||!I(q).allowed||(B.preventDefault(),B.dataTransfer.dropEffect="move",T(M=>(M==null?void 0:M.columnId)===q&&M.index===z?M:{columnId:q,index:z}))}async function L(B,q,z){var H;if(B.preventDefault(),y||!a||!U){V();return}const W=r(U),F=(((H=_.find(Q=>Q.column.id===W))==null?void 0:H.items)??[]).findIndex(Q=>n(Q)===n(U));if(!I(q).allowed||F<0){V();return}if(W===q&&(z===F||z===F+1)){V();return}try{await a({item:U,fromColumnId:W,toColumnId:q,fromIndex:F,toIndex:z})}finally{V()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[N.length>0&&h?s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Hidden:"}),N.map(B=>s.jsxs("button",{type:"button",onClick:()=>h(B.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${B.title}" column`,children:[B.title," ×"]},B.id))]}):null,s.jsx("div",{className:Ne("grid min-w-max grid-flow-col items-start gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:_.map(({column:B,items:q})=>{const z=I(B.id),W=(D==null?void 0:D.columnId)===B.id;return s.jsxs("section",{className:Ne("flex flex-col rounded-lg border border-border/60 bg-card/85 shadow-sm",g?"min-h-[200px] p-2":"min-h-[320px] p-3",v?"max-h-[70vh]":"",U&&!z.allowed?"border-dashed opacity-65":"",U&&z.allowed?"border-primary/30 bg-accent/30":"",W?"ring-2 ring-ring/30":""),title:U&&!z.allowed?z.reason:void 0,children:[s.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:Ne("font-semibold uppercase tracking-[0.16em] text-muted-foreground",g?"text-xs":"text-sm"),children:B.title}),B.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:B.description}):null]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs font-semibold text-foreground",children:q.length}),h?s.jsx("button",{type:"button",onClick:()=>h(B.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 "${B.title}" column`,"aria-label":`Hide column ${B.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:Ne("flex flex-1 flex-col gap-3",v?"min-h-0 overflow-y-auto pr-1":""),onDragOver:M=>P(M,B.id,q.length),onDrop:M=>L(M,B.id,q.length),children:[q.length===0?y?s.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 f=="function"?f(B):f}):s.jsx(_U,{active:(D==null?void 0:D.columnId)===B.id&&D.index===0,disabled:!!U&&!z.allowed,children:typeof f=="function"?f(B):f}):null,q.map((M,F)=>{const G=n(M),H=S===G;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:Ne("h-2 rounded-full transition",(D==null?void 0:D.columnId)===B.id&&D.index===F?"bg-primary/70":"bg-transparent"),onDragOver:Q=>P(Q,B.id,F),onDrop:Q=>L(Q,B.id,F)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Q=>{R.current=Q.target},onDragStart:Q=>{const te=R.current;if(te!=null&&te.closest(Zl)){Q.preventDefault();return}O(Q,M,G)},onDragEnd:V,onContextMenu:Q=>{if(!u)return;const te=Q.target;te!=null&&te.closest(Zl)||u(M,Q)},className:Ne("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",H?"scale-[0.98] opacity-50":""),children:o(M,{dragging:H})})]},G)}),q.length>0&&!y?s.jsx("div",{className:Ne("mt-1 rounded-md border border-dashed px-3 py-2 text-center text-xs text-muted-foreground transition",(D==null?void 0:D.columnId)===B.id&&D.index===q.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",U&&!z.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},B.id)})})]})}function _U({active:e,disabled:t,children:n}){return s.jsx("div",{className:Ne("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 ko="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Bl="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",vA="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",Mb="border-status-review-foreground/30 bg-status-review text-status-review-foreground",wA="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",jA="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",kA="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Up=ko,DU={draft:ko,pending:ko,ready_for_planning:ko,ready_to_implement:Bl,in_progress:Bl,blocked:vA,review:Mb,code_review:Mb,completed:wA,failed:jA,active:Bl,stopped:ko,archived:kA};function $U(e){return DU[e]??Up}const IU={slate:Up,gray:Up,grey:Up};function SA(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function MU(e){let t=e.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(n=>n+n).join("")),t.length!==6||/[^0-9a-fA-F]/.test(t)?null:{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}}function LU(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=MU(n);if(r){const{r:o,g:i,b:a}=r;return{className:"",style:{backgroundColor:`rgba(${o}, ${i}, ${a}, 0.15)`,borderColor:`rgba(${o}, ${i}, ${a}, 0.4)`,color:n}}}}else{const r=IU[n.toLowerCase()];if(r)return{className:r}}return{className:$U(e)}}function ld(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=LU(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??SA(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function Lb(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function NA(e){const t=new Map(e.statuses.map(a=>[a.id,a])),n=e.order.length>0?e.order:e.statuses.map(a=>a.id),r=new Set,o=[],i=(a,l)=>{r.has(a)||(r.add(a),o.push({id:a,label:(l==null?void 0:l.label)??SA(a),terminal:Lb(l??{id:a})}))};for(const a of n)i(a,t.get(a));for(const a of e.statuses)i(a.id,a);return o}const CA={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:ko,icon:hc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:ko,icon:_L},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:ko,icon:QE},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Bl,icon:n4},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Bl,icon:Iv},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:vA,icon:nh},review:{label:"Review",description:"Ready for inspection or approval.",className:Mb,icon:o4},completed:{label:"Completed",description:"Finished successfully.",className:wA,icon:Pv},failed:{label:"Failed",description:"Could not be completed as planned.",className:jA,icon:nh},active:{label:"Active",description:"The project has active or review work in flight.",className:Bl,icon:db},stopped:{label:"Stopped",description:"Session ended without completing.",className:ko,icon:AL},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:kA,icon:db}},EA="inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-0.5 text-xs font-medium tracking-normal shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0)] dark:shadow-[inset_0_0_0_1px_oklch(100%_0_0_/_0.04)]";function Ob(e){var t;return((t=CA[e])==null?void 0:t.icon)??db}function vn({status:e,className:t,showIcon:n=!0,progress:r}){var y;const o=Es(),i=ld(o.statuses,e),a=Ob(e),l=i.label,u=((y=o.statuses.find(k=>k.id===e))==null?void 0:y.description)??Bd(e),f=r&&r.total>0,p=f?Math.min(1,Math.max(0,r.checked/r.total)):0,h=f?`${l} — ${u} (${r.checked}/${r.total} criteria)`:`${l} — ${u}`,g=n?f?s.jsxs("span",{className:"relative inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:[s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",className:"absolute inset-0 h-full w-full -rotate-90",children:[s.jsx("circle",{cx:"8",cy:"8",r:"7",fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1.5"}),s.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-p)})]}),s.jsx(a,{className:"h-2.5 w-2.5"})]}):s.jsx(a,{className:"h-3.5 w-3.5 shrink-0"}):null;return s.jsxs("span",{title:h,className:Ne(EA,i.className,t),style:i.style,children:[g,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Bd(e){var t;return((t=CA[e])==null?void 0:t.description)??`Status: ${e}`}function Ta({type:e,className:t,compact:n=!1}){const r=Pd();if(!e)return null;const o=H6(r,e),i=(o==null?void 0:o.label)??e.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),a=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 s.jsx("span",{title:(o==null?void 0:o.description)??`Type: ${i}`,style:a,className:Ne("inline-flex items-center whitespace-nowrap rounded-full border text-xs capitalize",n?"px-2 py-0.5":"px-2.5 py-1",!a&&"border-border/60 text-muted-foreground",t),children:i})}async function Ud(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return OU(e)}function OU(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:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Ud(e)?(a(!0),setTimeout(()=>a(!1),1500)):o==null||o(new Error("Copy to clipboard failed in this context.")))}return n?s.jsx("button",{type:"button",disabled:!0,"aria-disabled":"true",className:"cursor-not-allowed text-muted-foreground/50",title:r??"Copy unavailable","aria-label":t??"Copy",children:s.jsx(rh,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:l,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?s.jsx(zr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(rh,{className:"h-3 w-3","aria-hidden":"true"})})}function FU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function zU({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=Es(),[l,u]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{u(new Set(o.collapsed))},[o]);const f=p=>{u(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})};return s.jsx("div",{className:Ne("space-y-2",i?"space-y-1.5":"space-y-3"),children:t.map(p=>{const h=zd(e.filter(k=>k.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=No(a,p);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/90",children:[s.jsxs("button",{type:"button",onClick:()=>f(p),className:Ne("flex w-full items-center gap-2 text-left",i?"px-3 py-2 text-xs":"px-4 py-3 text-sm"),children:[s.jsx(vr,{className:Ne("text-muted-foreground transition-transform",i?"h-3.5 w-3.5":"h-4 w-4",g?"":"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:y}),s.jsx("span",{className:Ne("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:h.length})]}),g&&s.jsx("ul",{className:Ne("divide-y divide-border/40 border-t border-border/40",i?"text-xs":"text-sm"),children:h.map(k=>{const v=FU(k);return s.jsx("li",{children:s.jsxs($e,{to:v,className:Ne("flex items-center gap-3 hover:bg-muted/40",i?"px-3 py-1.5":"px-4 py-2.5"),children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:k.title}),k.projectTitle?s.jsx("span",{className:"hidden truncate text-muted-foreground sm:inline",children:k.projectTitle}):null,s.jsx("span",{className:"shrink-0 text-muted-foreground",children:Gn(k.updated)})]})},`${k.projectSlug??"standalone"}:${k.id}`)})})]},p)})})}function BU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function UU({items:e,sortField:t,sortDirection:n,tableColumnVisibility:r,compact:o=!1}){const i=new Set(r.hidden);i.delete("title");const a=p=>!i.has(p),l=zd(e,t,n),u=o?"py-2 pr-3":"py-3 pr-4",f=o?"text-xs":"text-sm";return s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:Ne("w-full text-left",f),children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[a("title")?s.jsx("th",{className:Ne("font-medium",u),children:"Assignment"}):null,a("status")?s.jsx("th",{className:Ne("font-medium",u),children:"Status"}):null,a("priority")?s.jsx("th",{className:Ne("font-medium",u),children:"Priority"}):null,a("assignee")?s.jsx("th",{className:Ne("font-medium",u),children:"Assignee"}):null,a("dependencies")?s.jsx("th",{className:Ne("font-medium",u),children:"Dependencies"}):null,a("created")?s.jsx("th",{className:Ne("font-medium",u),children:"Created"}):null,a("updated")?s.jsx("th",{className:Ne("font-medium",u),children:"Updated"}):null]})}),s.jsx("tbody",{children:l.map(p=>{const h=BU(p),g=`${p.projectSlug??"standalone"}:${p.id}`;return s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a("title")?s.jsxs("td",{className:u,children:[s.jsx($e,{to:h,className:"font-semibold text-foreground hover:text-primary",children:p.title}),p.projectTitle?s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:p.projectTitle}):null]}):null,a("status")?s.jsx("td",{className:u,children:s.jsx(vn,{status:p.status,className:"max-w-[150px]"})}):null,a("priority")?s.jsx("td",{className:Ne("capitalize text-muted-foreground",u),children:p.priority}):null,a("assignee")?s.jsx("td",{className:Ne("text-muted-foreground",u),children:p.assignee??"Unassigned"}):null,a("dependencies")?s.jsx("td",{className:Ne("text-muted-foreground",u),children:p.dependsOn.length}):null,a("created")?s.jsx("td",{className:Ne("text-muted-foreground",u),children:Gn(p.created)}):null,a("updated")?s.jsx("td",{className:Ne("text-muted-foreground",u),children:Gn(p.updated)}):null]},g)})})]})})}function TA({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i}=Qh(),a=Es(),l=m.useMemo(()=>a.order.map(p=>({id:p,title:No(a,p),description:Bd(p)})),[a]),u=m.useMemo(()=>yA(a.factDeclarations),[a.factDeclarations]),f=m.useMemo(()=>{if(!r)return[];const p=e.config.filters.query??Iu(e.config.filters);let h=null;p.trim()!==""&&(h=Yl(p,u).query);const g=gA(r.assignments,h,{workspace:e.workspace});return zd(g,e.config.sortField,e.config.sortDirection)},[r,e,u]);if(o&&!r)return s.jsx(jt,{label:"Loading assignments…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load assignments"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});if(f.length===0)return s.jsx(Nt,{title:"No assignments match this view.",description:n??"Adjust the view's filters to surface different work."});switch(e.config.viewMode){case"kanban":return s.jsx(Tm,{compact:t,dragDisabled:!0,columns:l,items:f,getItemId:p=>p.slug||p.id,getColumnId:p=>p.status,hiddenColumnIds:e.config.kanbanColumnVisibility.hidden,renderCard:p=>t?s.jsx(HU,{item:p}):s.jsx(VU,{item:p})});case"list":return s.jsx(zU,{items:f,statusOrder:a.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(UU,{items:f,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function HU({item:e}){const t=ad(e);return s.jsxs("div",{className:Ne("rounded-md border border-border/60 bg-background/85 p-2 shadow-sm"),children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx($e,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(vn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[10px] uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Gn(e.updated)})]}),e.id?s.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),s.jsx(Zr,{value:e.id})]}):null]})}function VU({item:e}){const t=ad(e);return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx($e,{to:t,className:"block truncate text-sm font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.projectTitle??"Standalone"})]}),s.jsx(vn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(Ta,{type:e.type,compact:!0}),s.jsx("span",{className:"text-xs capitalize text-muted-foreground",children:e.priority})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:e.assignee??"Unassigned"}),s.jsx("span",{className:"shrink-0",children:Gn(e.updated)})]})]})}function WU({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=ji(e);return r?s.jsx(jt,{label:"Loading view…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o.message}),s.jsx("button",{type:"button",onClick:()=>i(),className:"shell-action mt-3",children:"Retry"})]}):n?s.jsx(TA,{view:n,compact:!0,emptyDescription:"Adjust the view's filters to surface different work, or pick another widget for this slot."}):s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"View no longer exists"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"The saved view this slot was bound to has been deleted."}),s.jsx("button",{type:"button",onClick:t,className:"shell-action mt-3",children:"Pick another widget"})]})}function RA({sessions:e}){return s.jsxs("aside",{"aria-labelledby":"overview-sessions-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsx("header",{className:"border-b border-border/40 px-4 py-3",children:s.jsx("h3",{id:"overview-sessions-title",className:"text-sm font-semibold text-foreground",children:"Recent Sessions"})}),e.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:fa.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:fa.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(qU,{session:t})},t.sessionId))})]})}function qU({session:e}){const t=pn(),[n,r]=m.useState(!1),o=KU(e,t),i=GU(e),a=!e.path;return s.jsxs("div",{className:"flex items-start gap-3 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx($e,{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}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:[i," · ",d2(e.started)]}),n&&e.path?s.jsxs("div",{className:"mt-1 space-y-0.5",children:[s.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}),s.jsx("p",{className:"text-[10px] text-muted-foreground",children:fa.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(Zr,{value:e.path,label:fa.recentSessionsCopyPathLabel,disabled:a,disabledReason:fa.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function KU(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function GU(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const YU={last_24h:1440*60*1e3,last_7d:10080*60*1e3,last_30d:720*60*60*1e3,last_90d:2160*60*60*1e3,older_7d:10080*60*1e3,older_30d:720*60*60*1e3};function ta(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function XU(e,t,n=Date.now()){const r=ta(e);if(t.preset){const a=YU[t.preset];return a?t.preset.startsWith("older_")?r<n-a:r>=n-a:!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)&&r<o||i!==null&&Number.isFinite(i)&&r>i)}function QU(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),u=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!XU(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(u.size>0&&!Array.from(u).some(g=>g.toLowerCase()===p.agent.toLowerCase()))return!1;if(f.size>0){let h=!1;for(const g of f){switch(g){case"active":p.status==="active"&&(h=!0);break;case"ended":(p.status==="completed"||p.status==="stopped")&&(h=!0);break;case"tracked":h=!0;break}if(h)break}if(!h)return!1}return!0})}function JU(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=ta(o.started)-ta(i.started);break;case"lastActivity":a=ta(o.updatedAt)-ta(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",u=i.projectSlug??"";a=l.localeCompare(u);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=ta(o.started)-ta(i.started);break}return n==="asc"?a:-a})}function ZU(e,t){return t==null||Number.isNaN(t)||t<=0?e:e.slice(0,t)}function eH({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=Jh(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,u=l.filters,f={dateRange:u.dateRange?{...u.dateRange,field:"started"}:void 0,project:qe(u.project),agent:qe(u.agent),sessionStatus:qe(u.sessionStatus),limit:l.limit};let p=QU(a,f);return p=JU(p,l.sortField,l.sortDirection),p=ZU(p,l.limit),p},[n,e]);return r&&!n?s.jsx(jt,{label:"Loading sessions…"}):o?s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load sessions"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:o})]}):i.length===0?s.jsx(Nt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(RA,{sessions:i})}function tH({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=Ld(),[i,a]=m.useState(!1),l=m.useRef(null),u=m.useMemo(()=>r.filter(h=>h.entityType==="session"),[r]);m.useEffect(()=>{if(!i)return;function h(y){l.current&&!l.current.contains(y.target)&&a(!1)}function g(y){y.key==="Escape"&&a(!1)}return document.addEventListener("mousedown",h),document.addEventListener("keydown",g),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",g)}},[i]);const f=e?r.find(h=>h.id===e)??null:null,p=o?"Session views…":f?f.name:"Session views";return s.jsxs("div",{className:"relative",ref:l,children:[s.jsxs("button",{type:"button",disabled:o,onClick:()=>a(h=>!h),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:[s.jsx("span",{className:"max-w-[160px] truncate",children:p}),s.jsx(vr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),i&&s.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:[s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(null)},className:Ne("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:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:e?null:s.jsx(zr,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),u.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),u.map(h=>{const g=h.id===e;return s.jsxs("button",{type:"button",onClick:()=>{a(!1),t(h.id)},className:Ne("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",g&&"font-semibold text-foreground"),children:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:g?s.jsx(zr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:h.name})]},h.id)})]}),s.jsx("div",{className:"my-1 border-t border-border/40"}),s.jsxs("button",{type:"button",onClick:()=>{a(!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:[s.jsx(It,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const nH={__unassigned__:"Unassigned",__standalone__:"No project"};function yn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null),h=m.useRef([]),g=m.useMemo(()=>{const N=new Set(e.map(C=>C.value)),S=t.filter(C=>!N.has(C)).map(C=>({value:C,label:nH[C]??C}));return[...e,...S]},[e,t]),y=m.useMemo(()=>new Set(t),[t]);m.useEffect(()=>{if(!l)return;function N(S){f.current&&!f.current.contains(S.target)&&u(!1)}return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),m.useEffect(()=>{var N;l&&((N=h.current[0])==null||N.focus())},[l]);const k=m.useMemo(()=>{if(t.length===0)return r;if(t.length===1){const N=g.find(S=>S.value===t[0]);return N?N.label:t[0]}return`${t.length} selected`},[t,g,r]);function v(N){n(y.has(N)?t.filter(S=>S!==N):[...t,N])}function b(N){var C;const S=Math.max(0,Math.min(N,g.length-1));(C=h.current[S])==null||C.focus()}function j(N){var T;const S=h.current,C=document.activeElement,D=S.findIndex(R=>R===C);N.key==="ArrowDown"?(N.preventDefault(),b(D<0?0:D+1)):N.key==="ArrowUp"?(N.preventDefault(),b(D<0?g.length-1:D-1)):N.key==="Home"?(N.preventDefault(),b(0)):N.key==="End"?(N.preventDefault(),b(g.length-1)):N.key==="Escape"&&(N.preventDefault(),u(!1),(T=p.current)==null||T.focus())}return s.jsxs("div",{className:"relative",ref:f,children:[s.jsxs("button",{type:"button",ref:p,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-label":a,onClick:()=>u(N=>!N),onKeyDown:N=>{!l&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),u(!0))},className:Ne("editor-input inline-flex items-center justify-between gap-1.5 text-left",t.length>0&&"border-foreground/40 text-foreground",o),children:[s.jsx("span",{className:"truncate",children:k}),s.jsx(vr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),l?s.jsxs("div",{role:"menu","aria-label":a,onKeyDown:j,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:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 pb-1",children:[s.jsx("button",{type:"button",role:"menuitem",className:"text-xs text-muted-foreground hover:text-foreground disabled:opacity-40",disabled:t.length===g.length,onClick:()=>n(g.map(N=>N.value)),children:"Select all"}),s.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"})]}),g.length===0?s.jsx("p",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"No options"}):g.map((N,S)=>{const C=y.has(N.value);return s.jsxs("button",{ref:D=>{h.current[S]=D},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>v(N.value),className:Ne("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition hover:bg-foreground/5",C?"text-foreground":"text-muted-foreground"),children:[s.jsx("span",{className:Ne("flex h-4 w-4 shrink-0 items-center justify-center rounded border",C?"border-foreground bg-foreground text-background":"border-border/70"),"aria-hidden":"true",children:C?s.jsx(zr,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const bS={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"},rH=["updated","created"];function Rm({value:e,onChange:t,className:n,ariaLabel:r="Date range filter"}){const[o,i]=m.useState(!1),a=m.useRef(null),l=(e==null?void 0:e.field)??"updated",u=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(u);m.useEffect(()=>p(u),[u]),m.useEffect(()=>{if(!o)return;function j(S){a.current&&!a.current.contains(S.target)&&i(!1)}function N(S){S.key==="Escape"&&i(!1)}return document.addEventListener("mousedown",j),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",j),document.removeEventListener("keydown",N)}},[o]);const h=!!(e&&(e.preset||e.from||e.to)),g=m.useMemo(()=>!h||!e?"Any date":e.preset?`${l}: ${bS[e.preset]??e.preset}`:`${l}: ${e.from||"…"} → ${e.to||"…"}`,[h,e,l]);function y(j){t(e?{...e,field:j}:{field:j,preset:"",from:"",to:""})}function k(j){p(!1),t({field:l,preset:j,from:"",to:""})}function v(){p(!1),t(null)}function b(j,N){const S={field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""};t({...S,[j]:N})}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsxs("button",{type:"button","aria-haspopup":"dialog","aria-expanded":o,"aria-label":r,onClick:()=>i(j=>!j),className:Ne("editor-input inline-flex items-center justify-between gap-1.5 text-left",h&&"border-foreground/40 text-foreground",n),children:[s.jsx("span",{className:"truncate",children:g}),s.jsx(vr,{className:"h-3.5 w-3.5 shrink-0 opacity-60","aria-hidden":"true"})]}),o?s.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:[s.jsx("div",{className:"mb-2 inline-flex rounded-md border border-border/60 bg-background/80 p-0.5",children:rH.map(j=>s.jsx("button",{type:"button","aria-pressed":l===j,onClick:()=>y(j),className:Ne("rounded-sm px-2.5 py-1 text-xs font-medium capitalize transition",l===j?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:j},j))}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(my,{label:"Any date",selected:!h,onClick:v}),p6.map(j=>s.jsx(my,{label:bS[j],selected:(e==null?void 0:e.preset)===j,onClick:()=>k(j)},j)),s.jsx(my,{label:"Custom range…",selected:f,onClick:()=>{p(!0),t({field:l,preset:"",from:(e==null?void 0:e.from)??"",to:(e==null?void 0:e.to)??""})}})]}),f?s.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-border/60 pt-2",children:[s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["From",s.jsx("input",{type:"date",value:(e==null?void 0:e.from)??"",max:(e==null?void 0:e.to)||void 0,onChange:j=>b("from",j.target.value),className:"editor-input w-40"})]}),s.jsxs("label",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:["To",s.jsx("input",{type:"date",value:(e==null?void 0:e.to)??"",min:(e==null?void 0:e.from)||void 0,onChange:j=>b("to",j.target.value),className:"editor-input w-40"})]})]}):null]}):null]})}function my({label:e,selected:t,onClick:n}){return s.jsxs("button",{type:"button",onClick:n,className:Ne("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:[s.jsx("span",{children:e}),t?s.jsx(zr,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const sH=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function oH(e,t){const n={};for(const[r,o]of Object.entries(e))sH.has(r)||(n[r]=o);return{...n,...t}}function vh(e,t,n){return{...e,viewMode:t.viewMode,filters:oH(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 iH(e,t){var g,y;const n={},r=qe(e.status);r.length&&(n.status=r);const o=qe(e.type);o.length&&(n.type=o);const i=qe(e.priority);i.length&&(n.priority=i);const a=qe(e.assignee);a.length&&(n.assignee=a);const l=qe(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const k=qe(e.project);k.length&&(n.project=k)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const u=qe(e.sessionStatus);u.length&&(n.sessionStatus=u);const f=qe(e.agent);f.length&&(n.agent=f),e.dateRange&&(n.dateRange=e.dateRange);const p=(g=e.search)==null?void 0:g.trim();p&&(n.search=p);const h=(y=e.query)==null?void 0:y.trim();return h&&(n.query=h),n}function ec(e){const t={viewMode:e.state.viewMode,filters:iH(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 pl={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},up={sortField:"started",sortDirection:"desc"};function AA(e,t){const{config:n}=ec({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:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function $w(e,t){const{config:n}=ec({name:"",context:{workspace:t,projectSlug:null},state:{viewMode:"list",filters:e.filters,sortField:e.sortField,sortDirection:e.sortDirection,listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}}}),r={...n};return e.limit!==void 0&&e.limit>0&&(r.limit=e.limit),{workspace:t,config:r}}function ha(e){if(!e)return;if(e.preset)return{field:e.field,preset:e.preset};const t=e.from&&e.from.length>0?e.from:void 0,n=e.to&&e.to.length>0?e.to:void 0;if(!t&&!n)return;const r={field:e.field};return t&&(r.from=t),n&&(r.to=n),r}function Am(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function PA(e,t){var r,o,i,a,l,u,f,p,h,g,y,k,v,b,j;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,qe(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,qe(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,qe(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,qe(n.filters.assignee)),(u=t.setProjectFilter)==null||u.call(t,qe(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,qe(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Am(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Iu(n.filters)),t.setActivityFilter){const N=n.filters.activity??"all";t.setActivityFilter(N==="fresh"||N==="stale"?N:"all")}(y=t.setSortField)==null||y.call(t,n.sortField),(k=t.setSortDirection)==null||k.call(t,n.sortDirection),(v=t.setListSectionVisibility)==null||v.call(t,{collapsed:[...n.listSectionVisibility.collapsed]}),(b=t.setKanbanColumnVisibility)==null||b.call(t,{hidden:[...n.kanbanColumnVisibility.hidden]}),(j=t.setTableColumnVisibility)==null||j.call(t,{hidden:[...n.tableColumnVisibility.hidden]})}function Hp(e){return e?`/w/${e}/views`:"/views"}function _A(e){return`${Hp(e.workspace)}/${encodeURIComponent(e.id)}`}function DA(e){const t=e.workspace?`/w/${e.workspace}`:"",n=qe(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&AR(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const aH=["critical","high","medium","low"],lH={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 cH(e){if(e.preset)return`${e.field} ${lH[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function $A(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&Mu(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=qe(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(cH(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const vS=80,uH=["started","lastActivity","projectName","agentName"],dH={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},fH=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function IA({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=Zs(),{data:a}=Jh(),[l,u]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState(null),[j,N]=m.useState(up.sortField),[S,C]=m.useState(up.sortDirection),[D,T]=m.useState(""),[R,$]=m.useState(!1),[_,U]=m.useState(null);function I(){p([]),g([]),k([]),b(null),N(up.sortField),C(up.sortDirection),T("")}m.useEffect(()=>{if(e)if(U(null),$(!1),n){const z=n.config.filters;u(n.name),p(qe(z.project)),g(qe(z.agent)),k(qe(z.sessionStatus)),b(Am(z.dateRange)),N(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else u(""),I()},[e,n]);const V=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(W=>({value:W.slug,label:W.title}))],[i]),O=m.useMemo(()=>{const z=new Set;for(const W of(a==null?void 0:a.sessions)??[])W.agent&&z.add(W.agent);return Array.from(z).sort().map(W=>({value:W,label:W}))},[a]),P=l.trim(),L=P.length>0&&P.length<=vS,B=D.trim()===""?void 0:parseInt(D.trim(),10),q=D.trim()===""||Number.isFinite(B)&&B!==void 0&&B>0&&B<=500;return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsx(jn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async z=>{if(z.preventDefault(),!L||!q||R)return;$(!0),U(null);const W=ha(v),M=W?{...W,field:"started"}:void 0,F={filters:{project:f,agent:h,sessionStatus:y,dateRange:M},sortField:j,sortDirection:S,limit:B};try{await r(P,F)}catch(G){U(G instanceof Error?G.message:String(G)),$(!1)}},children:[s.jsx(tr,{children:s.jsx(kn,{children:o?"Edit session view":"Create session view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-session-view-name",children:"Name"}),s.jsx("input",{id:"create-session-view-name",type:"text",value:l,autoFocus:!0,required:!0,maxLength:vS,onChange:z=>u(z.target.value),placeholder:"View name",className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(hl,{label:"Date range (session start)",children:s.jsx(Rm,{className:"w-full",value:v,onChange:b})}),s.jsx(hl,{label:"Project",children:s.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:V,value:f,onChange:p})}),s.jsx(hl,{label:"Agent",children:s.jsx(yn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:O,value:h,onChange:g})}),s.jsx(hl,{label:"Session status",children:s.jsx(yn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:fH,value:y,onChange:k})}),s.jsx(hl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:j,onChange:z=>N(z.target.value),className:"editor-input w-full",children:uH.map(z=>s.jsx("option",{value:z,children:dH[z]??z},z))}),s.jsx("button",{type:"button",onClick:()=>C(z=>z==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),s.jsxs(hl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:D,onChange:z=>T(z.target.value),placeholder:"No limit",className:"editor-input w-full"}),q?null:s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:"Limit must be between 1 and 500"})]})]}),_?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:_}):null,s.jsxs(Ur,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:I,className:"shell-action",disabled:R,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:R,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!L||!q||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function hl({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}function gy({title:e,message:t,onPickAnother:n}){return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:e}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}),n?s.jsx("button",{type:"button",onClick:n,className:"shell-action mt-3",children:"Pick another widget"}):null]})}function pH({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=Jh(),{view:a,loading:l,ready:u}=ji(e??null),{layout:f}=LR(),{showToast:p}=wr(),[h,g]=m.useState(!1),y=m.useCallback(async b=>{if(!t)return;const j=f.slots.map(N=>N.id===t?{...N,widget:b?{kind:"agent-sessions",viewId:b}:{kind:"agent-sessions"}}:N);try{await Rb(j)}catch(N){p(N instanceof Error?N.message:"Failed to update widget")}},[f,t,p]);async function k(b,j){const{workspace:N,config:S}=$w(j,null);try{const D=(await Xl({name:b,workspace:N,config:S,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");D&&await y(D.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let v;return e?l&&!u?v=s.jsx(jt,{label:"Loading view…"}):a?a.entityType!=="session"?v=s.jsx(gy,{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}):v=s.jsx(eH,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):v=s.jsx(gy,{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&&!r?v=s.jsx(jt,{label:"Loading sessions…"}):i?v=s.jsx(gy,{title:"Couldn't load sessions",message:i}):v=s.jsx(RA,{sessions:(r==null?void 0:r.sessions)??[]}),s.jsxs("div",{className:"space-y-2",children:[t?s.jsx("div",{className:"flex items-center justify-between gap-2",children:s.jsx(tH,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,v,s.jsx(IA,{open:h,onOpenChange:g,workspace:null,onSubmit:k})]})}const hH=5;function mH(){const{data:e,loading:t,error:n}=R2();if(t&&!e)return s.jsx(jt,{label:"Loading inventories…"});if(n)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load inventories"}),s.jsx("p",{className:"mt-1 text-xs",children:n})]});const o=((e==null?void 0:e.inventories)??[]).slice(0,hH);return s.jsxs("aside",{"aria-labelledby":"overview-inventories-title",className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between border-b border-border/40 px-4 py-3",children:[s.jsx("h3",{id:"overview-inventories-title",className:"text-sm font-semibold text-foreground",children:"Inventories"}),s.jsx($e,{to:"/inventories",className:"text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),o.length===0?s.jsxs("div",{className:"px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No inventories yet."}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Create one to track leased resources across agents."})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:o.map(i=>{const a=i.inventory,l=i.active_leases.length,u=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs($e,{to:`/inventories/${encodeURIComponent(a.slug)}`,className:"flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:f}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[l,"/",u," leased"]})]})},a.slug)})})]})}function gH(e){let t=0,n=0;for(const r of e.daily)t+=r.total_tokens,n+=r.total_cost;return{tokens:t,cost:n}}function wS({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=jO(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${gb(n).toString()}`;let u;if(o&&!r)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)u=s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load usage"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i})]});else if(!r||r.daily.length===0)u=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=gH(r),h=t==="cost"?{label:"Total spend",value:Gl(p)}:{label:"Total tokens",value:Kl(f)},g=t==="cost"?{label:"Tokens",value:Kl(f)}:{label:"Spend",value:Gl(p)};u=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(jS,{label:h.label,value:h.value,emphasize:!0}),s.jsx(jS,{label:g.label,value:g.value})]})}return s.jsxs("aside",{className:"rounded-xl border border-border/60 bg-background/60 shadow-sm",children:[s.jsxs("header",{className:"flex items-center justify-between gap-2 border-b border-border/40 px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:a}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",title:b1(n),children:b1(n)})]}),s.jsx($e,{to:l,className:"shrink-0 text-xs text-muted-foreground hover:text-foreground",children:"View all →"})]}),s.jsx("div",{className:"px-4 py-4",children:u})]})}function jS({label:e,value:t,emphasize:n}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:n?"text-2xl font-semibold tabular-nums text-foreground":"text-lg font-semibold tabular-nums text-foreground",children:t})]})}const xH={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function yH(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const ml="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function kS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Zs(),{data:a}=Na(),{data:l}=A2(t),[u,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,j]=m.useState(""),[N,S]=m.useState(""),[C,D]=m.useState(""),[T,R]=m.useState(!1),[$,_]=m.useState(null);m.useEffect(()=>{if(!t)return;const L=yH(e);f(L.window??"30d"),h(L.since??""),y(L.until??""),v(L.project??""),j(L.workspace??""),S(L.model??""),D(L.tool??""),R(!1),_(null)},[t,e]);function U(){return Ad({window:u,since:u==="custom"?p:void 0,until:u==="custom"?g:void 0,project:k||void 0,workspace:b||void 0,model:N||void 0,tool:C||void 0})}async function I(L){if(L.preventDefault(),T)return;const B=U(),q=dO(B);if(!q.ok){_(q.errors.join("; "));return}R(!0),_(null);const z=e.kind==="token-usage"?{kind:"token-usage",filters:B}:e.kind==="spend"?{kind:"spend",filters:B}:e;try{await n(z)}catch(W){_(W instanceof Error?W.message:String(W)),R(!1)}}const V=(i==null?void 0:i.map(L=>L.slug))??[],O=(a==null?void 0:a.workspaces)??[],P=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(Ln,{open:t,onOpenChange:L=>{L||r()},children:s.jsx(jn,{className:"max-w-md",children:s.jsxs("form",{onSubmit:I,children:[s.jsx(tr,{children:s.jsx(kn,{children:o})}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Window"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:Xh.map(L=>s.jsx("button",{type:"button",onClick:()=>f(L),className:"rounded px-2.5 py-1 text-sm border "+(L===u?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:xH[L]},L))})]}),u==="custom"?s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:p,onChange:L=>h(L.target.value),className:ml})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:g,onChange:L=>y(L.target.value),className:ml})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:b,onChange:L=>{j(L.target.value),L.target.value&&v("")},className:ml,children:[s.jsx("option",{value:"",children:"All workspaces"}),P?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,O.map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:k,onChange:L=>{v(L.target.value),L.target.value&&j("")},className:ml,children:[s.jsx("option",{value:"",children:"All projects"}),V.map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:N,onChange:L=>S(L.target.value),className:ml,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(L=>s.jsx("option",{value:L,children:L},L))]})]}),s.jsxs("label",{className:"flex flex-1 flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:C,onChange:L=>D(L.target.value),className:ml,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(L=>s.jsx("option",{value:L,children:L},L))]})]})]}),$?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:$}):null]}),s.jsxs(Ur,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:r,disabled:T,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:T,className:"shell-action shell-action--cta",children:T?"Saving…":"Save"})]})]})})})}const Iw={"saved-view":{title:"Saved view",icon:ZE,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(WU,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Vh,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(pH,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Av,render:()=>m.createElement(mH)},"token-usage":{title:"Token Usage",icon:qL,render:e=>e.kind!=="token-usage"?null:m.createElement(wS,{filters:e.filters,metric:"tokens"}),ConfigEditor:kS},spend:{title:"Spend",icon:Kh,render:e=>e.kind!=="spend"?null:m.createElement(wS,{filters:e.filters,metric:"cost"}),ConfigEditor:kS}},MA=50,Fb=16,bH=2,ca=6,wh=11,zb={w:6,h:2};function Vp(e,t,n){return Math.min(Math.max(e,t),n)}const vH=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function wH(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of vH)if(e>=t.minWidth)return t.columns;return 1}function Wp(e,t){return t<=0?1:Vp(Math.round(e/sd*t),1,t)}function Bb(e){if(A8(e))return e;switch(e){case"small":return{w:8,h:ca};case"wide":return{w:16,h:ca};case"tall":return{w:8,h:wh};case"large":return{w:16,h:wh};default:return{w:8,h:ca}}}function jH(e,t){return t>0?Math.round(e/t):0}function kH(e,t=MA){return Math.round(e/t)}const SH=[{label:"Third",w:8,h:ca},{label:"Half",w:12,h:ca},{label:"Two-thirds",w:16,h:ca},{label:"Full",w:24,h:ca},{label:"Half tall",w:12,h:wh},{label:"Full tall",w:24,h:wh}];function NH({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[u,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:k,setNodeRef:v,setActivatorNodeRef:b,transform:j,transition:N,isDragging:S}=ym({id:e.id}),C=Bb(e.size),D=p?p.renderW:Wp(C.w,t),T=p?p.h:C.h,R={transform:bs.Translate.toString(j),transition:N,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${D}`,gridRow:`span ${T}`};function $(B){g.current=null;try{B.currentTarget.releasePointerCapture(B.pointerId)}catch{}h(null)}function _(B){return{onPointerDown:q=>{if(g.current)return;q.preventDefault(),q.stopPropagation(),q.currentTarget.setPointerCapture(q.pointerId);const z=Wp(C.w,t);g.current={pointerId:q.pointerId,startX:q.clientX,startY:q.clientY,startRenderW:z,startH:C.h,axis:B,lastRenderW:z,lastH:C.h},h({renderW:z,h:C.h})},onPointerMove:q=>{const z=g.current;if(!z||q.pointerId!==z.pointerId)return;let W=z.startRenderW,M=z.startH;(z.axis==="w"||z.axis==="both")&&(W=Vp(z.startRenderW+jH(q.clientX-z.startX,n),1,t)),(z.axis==="h"||z.axis==="both")&&(M=Vp(z.startH+kH(q.clientY-z.startY),bH,RR)),z.lastRenderW=W,z.lastH=M,h({renderW:W,h:M})},onPointerUp:q=>{const z=g.current;if(!z||q.pointerId!==z.pointerId)return;const W=Bb(e.size),F={w:z.axis==="h"?W.w:Vp(Math.round(z.lastRenderW/t*sd),1,sd),h:z.lastH};$(q),(F.w!==W.w||F.h!==W.h)&&a(F)},onPointerCancel:q=>{const z=g.current;z&&q.pointerId===z.pointerId&&$(q)},onLostPointerCapture:q=>{const z=g.current;z&&q.pointerId===z.pointerId&&$(q)}}}const U="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",I=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(U,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),..._("w")}):null,s.jsx("div",{"aria-hidden":"true",className:Ne(U,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),..._("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(U,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),..._("both")}):null]}),V=s.jsx("button",{ref:b,...y,...k,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:s.jsx(pc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:v,style:{...R,gridColumn:`span ${Wp(zb.w,t)}`,gridRow:`span ${zb.h}`},className:Ne("relative flex items-center justify-center rounded-lg border border-dashed border-border bg-card/40 p-3 shadow-sm transition-colors hover:border-primary/40 hover:bg-card/60",S&&"opacity-0"),children:[s.jsx("div",{className:"absolute left-2 top-2",children:V}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:B=>B.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(bn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(It,{className:"h-4 w-4"}),"Add widget"]})]});const O=Iw[e.widget.kind];if(!O)return s.jsxs("div",{ref:v,style:R,className:Ne("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("div",{className:"flex items-start gap-2",children:[V,s.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]})]}),I]});const P=O.icon,L=O.ConfigEditor;return s.jsxs("div",{ref:v,style:R,className:Ne("relative overflow-auto rounded-lg border border-border/60 bg-card/85 p-3 shadow-sm",S&&"opacity-0"),children:[s.jsxs("header",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[V,s.jsx(P,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(EH,{slot:e,fallback:O.title})})]}),s.jsx(_w,{items:[{key:"replace",label:"Replace…",icon:r4,onSelect:r},...O.ConfigEditor?[{key:"configure",label:"Configure…",icon:l4,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:ZL,submenu:SH.map(B=>({key:`size-${B.label}`,label:B.label,active:C.w===B.w&&C.h===B.h,onSelect:()=>a({w:B.w,h:B.h})}))},{key:"remove",label:"Remove",icon:bn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:O.render(e.widget,{slotId:e.id,onPickAnother:r})}),L?s.jsx(L,{config:e.widget,open:u,onSave:async B=>{await l(B),f(!1)},onCancel:()=>f(!1)}):null,I]})}function CH({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?Iw[e.widget.kind]:null,o=r==null?void 0:r.icon,i=e.widget===null?"Empty widget slot":(r==null?void 0:r.title)??`Unknown widget kind: ${e.widget.kind}`,a=e.widget===null?zb:Bb(e.size),l=Wp(a.w,t),u=n>0?l*n+(l-1)*Fb:void 0;return s.jsx("div",{"aria-hidden":"true",className:"min-w-[200px] rounded-lg border border-border/70 bg-card/95 p-3 shadow-xl ring-1 ring-foreground/10",style:{width:u?`${Math.max(u,200)}px`:void 0},children:s.jsxs("div",{className:"flex items-center gap-2 text-xs uppercase tracking-[0.12em] text-muted-foreground",children:[s.jsx(pc,{className:"h-4 w-4","aria-hidden":"true"}),o?s.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null,s.jsx("span",{className:"min-w-0 flex-1 truncate",children:i})]})})}function EH({slot:e,fallback:t}){var o,i;const n=((o=e.widget)==null?void 0:o.kind)==="saved-view"?e.widget.viewId:null,{view:r}=ji(n);return((i=e.widget)==null?void 0:i.kind)==="saved-view"&&r?s.jsx(s.Fragment,{children:r.name}):s.jsx(s.Fragment,{children:t})}const TH=["agent-sessions","inventories","token-usage","spend"];function RH({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=Ld();function i(a){n(a),t(!1)}return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(jn,{className:"max-w-xl",children:[s.jsxs(tr,{children:[s.jsx(kn,{children:"Add a widget"}),s.jsx(ns,{children:"Choose a built-in widget, an assignment view, or a session view."})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Built-in widgets"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:TH.map(a=>{const l=Iw[a],u=l.icon;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:a}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx(u,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"font-medium text-foreground",children:l.title})]})},a)})})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-[0.12em] text-muted-foreground",children:"Saved views"}),o?s.jsx("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm text-muted-foreground",children:"Loading saved views…"}):r.length===0?s.jsxs("div",{className:"rounded-md border border-border/60 px-3 py-4 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"No saved views yet"}),s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Save a view from the assignments page first."," ",s.jsx($e,{to:"/views",className:"text-foreground underline hover:opacity-80",children:"Manage views →"})]})]}):s.jsxs("div",{className:"space-y-3",children:[r.some(a=>a.entityType!=="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Assignments"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType!=="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"saved-view",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.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: ${a.workspace}`,children:a.workspace}):null,s.jsx("span",{className:"shrink-0 rounded-full border border-border/60 px-2 py-0.5 text-[10px] capitalize text-muted-foreground",children:a.config.viewMode})]})},a.id))})]}),r.some(a=>a.entityType==="session")&&s.jsxs("div",{children:[s.jsx("h4",{className:"mb-1 px-3 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground",children:"Sessions"}),s.jsx("ul",{className:"divide-y divide-border/40 rounded-md border border-border/60",children:r.filter(a=>a.entityType==="session").map(a=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>i({kind:"agent-sessions",viewId:a.id}),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left text-sm hover:bg-muted/40",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:a.name}),a.workspace!==null?s.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: ${a.workspace}`,children:a.workspace}):null]})},a.id))})]})]}),!o&&r.some(a=>a.workspace!==null)?s.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 AH=(e,{currentCoordinates:t,context:n})=>{var h;const r=e.code==="ArrowRight"||e.code==="ArrowDown"?1:e.code==="ArrowLeft"||e.code==="ArrowUp"?-1:0;if(r===0)return;e.preventDefault();const o=n.over??n.active,i=(h=o==null?void 0:o.data.current)==null?void 0:h.sortable,a=i==null?void 0:i.items;if(!o||!a)return t;const l=a.indexOf(o.id);if(l===-1)return t;const u=a[l+r],f=u===void 0?null:n.droppableRects.get(u),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function PH(e){const t=new Set(e.map(o=>o.id));let n=-1;for(const o of t){const i=/^slot-(\d+)$/.exec(o);if(i){const a=parseInt(i[1],10);a>n&&(n=a)}}let r=n+1;for(;t.has(`slot-${r}`);)r++;return`slot-${r}`}function _H(e,t){const n={id:PH(e),widget:null};return[...e,n]}function DH(e,t){return e.filter(n=>n.id!==t)}function $H(){const{data:e,error:t,refetch:n}=hO(),{data:r}=C2(),{layout:o}=LR(),[i,a]=m.useState(!1),[l,u]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,k]=m.useState(null),v=m.useRef(null),[b,j]=m.useState(sd),[N,S]=m.useState(0);m.useEffect(()=>{const q=v.current;if(!q)return;const z=new ResizeObserver(W=>{for(const M of W){const F=M.contentRect.width,G=wH(F),H=G>0?(F-(G-1)*Fb)/G:0;j(G),S(H)}});return z.observe(q),()=>z.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=dm(wi(wc,{activationConstraint:{distance:8}}),wi(vc,{coordinateGetter:AH}));Ti("list:overview"),Jt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const D=m.useCallback(q=>{u(q),a(!0)},[]),T=m.useCallback(async(q,z)=>{p(null),g(q);try{await Rb(q)}catch(W){g(z),p(W instanceof Error?W.message:String(W))}},[]),R=m.useCallback(q=>{if(l===null)return;const z=h.map((W,M)=>M===l?{...W,widget:q}:W);u(null),T(z,h)},[h,l,T]),$=m.useCallback(q=>{const z=h.map((W,M)=>M===q?{...W,widget:null,size:void 0}:W);T(z,h)},[h,T]),_=m.useCallback(q=>{const z=DH(h,q);T(z,h)},[h,T]),U=m.useCallback(()=>{const q=_H(h);T(q,h)},[h,T]),I=m.useCallback((q,z)=>{const W=h.map((M,F)=>F===q?{...M,size:z}:M);T(W,h)},[h,T]),V=m.useCallback(q=>{const{active:z,over:W}=q;if(k(null),!W||z.id===W.id)return;const M=h.findIndex(H=>H.id===z.id),F=h.findIndex(H=>H.id===W.id);if(M===-1||F===-1)return;const G=jc(h,M,F);T(G,h)},[h,T]),O=m.useCallback(q=>{k(String(q.active.id))},[]),P=h.find(q=>q.id===y)??null,L=m.useCallback(async(q,z)=>{const W=h,M=h.map((F,G)=>G===q?{...F,widget:z}:F);p(null),g(M);try{await Rb(M)}catch(F){g(W);const G=F instanceof Error?F.message:String(F);throw p(G),F instanceof Error?F:new Error(G)}},[h]),B={};if(e)for(const q of Object.keys(e.segments))for(const z of e.segments[q].items)B[z.id]=z;return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("header",{className:"space-y-2",children:[s.jsx("p",{className:"eyebrow",children:"Workspace Overview"}),s.jsx("h1",{className:"text-4xl font-semibold tracking-display text-foreground md:text-5xl",children:"What needs you today"})]}),e?s.jsx(T8,{hero:e.hero,itemsById:B}):t?s.jsx(Rt,{error:t}):s.jsx(jt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(C8,{help:r}):null,f?s.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: ",f]}):null,s.jsxs(gm,{sensors:C,collisionDetection:fm,onDragStart:O,onDragCancel:()=>k(null),onDragEnd:V,children:[s.jsx(xm,{items:h.map(q=>q.id),strategy:yw,children:s.jsx("div",{ref:v,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${MA}px`,gridAutoFlow:"dense",gap:`${Fb}px`},children:h.map((q,z)=>s.jsx(NH,{slot:q,index:z,activeColumns:b,colWidthPx:N,onReplace:()=>D(z),onRemove:()=>$(z),onRemoveSlot:()=>_(q.id),onResize:W=>I(z,W),onConfigChange:W=>L(z,W)},q.id))})}),s.jsx(f8,{dropAnimation:null,children:P?s.jsx(CH,{slot:P,activeColumns:b,colWidthPx:N}):null})]}),s.jsxs("button",{type:"button",onClick:U,className:"shell-action inline-flex items-center gap-2",children:[s.jsx(It,{className:"h-4 w-4"}),"Add slot"]}),e!=null&&e.serverStats?s.jsxs("p",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Mv,{className:"h-3 w-3","aria-hidden":"true"}),s.jsxs("span",{children:["● ",e.serverStats.totalPorts," ports ·"," ",e.serverStats.deadSessions>0?`${e.serverStats.deadSessions} dead`:"all healthy"]})]}):null,s.jsx(RH,{open:i,onOpenChange:q=>{a(q),q||u(null)},onSelect:R})]})}function IH({term:e,description:t}){return s.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 MH(){const{data:e,loading:t,error:n}=C2(),{openCheatsheet:r}=Ei();return t?s.jsx(jt,{label:"Loading help…"}):n||!e?s.jsx(Rt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xe,{title:"Keyboard Shortcuts",description:"Navigate the dashboard without reaching for the mouse.",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("button",{type:"button",onClick:r,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"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["or press ",s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-1.5 py-0.5 font-mono text-[11px]",children:"?"})," ","anywhere. ",Gs("Mod+k")," opens the command palette."]})]})}),s.jsx(Xe,{title:"What Syntaur Is",description:e.whatIsSyntaur.summary,children:s.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:e.whatIsSyntaur.bullets.map(o=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3 text-sm leading-6 text-muted-foreground",children:o},o))})}),s.jsx(Xe,{title:"Getting Started",children:s.jsx("div",{className:"space-y-3",children:e.workflow.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.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}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(zp,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx($e,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsxs(Xe,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(IH,{term:o.term,description:o.description},o.term))}),s.jsx("div",{className:"grid gap-3 pt-2",children:e.coreConcepts.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.term}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.term))})]}),s.jsx(Xe,{title:"Status Guide",children:s.jsx("div",{className:"space-y-3",children:e.statusGuide.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(vn,{status:o.status}),s.jsx("p",{className:"font-semibold text-foreground",children:o.meaning})]}),s.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:o.useWhen})]},o.status))})})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(Xe,{title:"Ownership And File Rules",children:s.jsx("div",{className:"space-y-3",children:e.ownershipRules.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description}),s.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.files.map(i=>s.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))})}),s.jsx(Xe,{title:"How To Navigate The Dashboard",children:s.jsx("div",{className:"space-y-3",children:e.navigation.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.label}),s.jsx($e,{className:"text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open"})]}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.description})]},o.label))})})]}),s.jsx(Xe,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(zp,{command:o.command,description:o.description,example:o.example},o.command))})}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[s.jsx(Xe,{title:"FAQ",children:s.jsx("div",{className:"space-y-3",children:e.faq.map(o=>s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.question}),s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.answer})]},o.question))})}),s.jsx(Xe,{title:"First Project Checklist",children:s.jsx("div",{className:"space-y-3",children:e.firstProjectChecklist.map((o,i)=>s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.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}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:o.title}),s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:o.detail}),o.command?s.jsx(zp,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx($e,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function Mw({children:e}){return s.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 Pm=m.forwardRef(({value:e,onChange:t,placeholder:n="Search"},r)=>s.jsxs("label",{className:"relative flex min-w-[220px] flex-1 items-center",children:[s.jsx(Ni,{className:"pointer-events-none absolute left-3 h-4 w-4 text-muted-foreground"}),s.jsx("input",{ref:r,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"})]}));Pm.displayName="SearchInput";function _m({value:e,options:t,onChange:n}){return s.jsx("div",{className:"inline-flex rounded-md border border-border/60 bg-background/80 p-1",children:t.map(r=>s.jsx("button",{type:"button","aria-pressed":e===r.value,onClick:()=>n(r.value),className:Ne("rounded-sm px-2.5 py-1.5 text-sm font-medium transition",e===r.value?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}const LH={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"},SS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function jh({progress:e,className:t,showLegend:n=!1}){const r=Es(),i=m.useMemo(()=>{let a=0;const l=Object.keys(e).filter(f=>f!=="total");return(r.order.length>0?[...r.order,...l.filter(f=>!r.order.includes(f))]:l).map(f=>({key:f,className:LH[f]??SS[a++%SS.length]}))},[r.order,e]).filter(a=>(e[a.key]??0)>0);return s.jsxs("div",{className:Ne("space-y-2",t),children:[s.jsx("div",{className:"flex h-1.5 w-full overflow-hidden rounded-lg border border-border/70 bg-muted/60",children:e.total===0?s.jsx("div",{className:"h-full w-full bg-muted"}):i.map(a=>s.jsx("div",{className:a.className,style:{width:`${(e[a.key]??0)/e.total*100}%`},title:`${Dn(a.key)}: ${e[a.key]??0}`},a.key))}),n?i.length>0?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:i.map(a=>s.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/80 px-2 py-1",children:[s.jsx("span",{className:Ne("h-2 w-2 rounded-full",a.className)}),s.jsx("span",{children:Dn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):s.jsx("p",{className:"text-xs text-muted-foreground/70",children:"No assignments yet"}):null]})}const OH=["pending","active","blocked","failed","completed"],Lw=OH,FH=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function LA(e){return e&&e.length>0?e:[...FH]}function zH(e,t,n){if(t<0||t>=e.length)return e;const r=[...e],[o]=r.splice(t,1),i=t<n?n-1:n;return r.splice(Math.max(0,Math.min(i,r.length)),0,o),r}const BH=220,dp=8;function OA({anchor:e,items:t,onClose:n}){const r=m.useRef(null),[o,i]=m.useState(null);return m.useLayoutEffect(()=>{if(!e){i(null);return}const a=r.current,l=(a==null?void 0:a.offsetWidth)??BH,u=(a==null?void 0:a.offsetHeight)??0,f=Math.max(dp,window.innerWidth-l-dp),p=Math.max(dp,window.innerHeight-u-dp);i({left:Math.min(e.x,f),top:Math.min(e.y,p)})},[e]),m.useEffect(()=>{if(!e)return;function a(f){r.current&&!r.current.contains(f.target)&&n()}function l(f){f.key==="Escape"&&n()}function u(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",u,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",u,!0)}},[e,n]),!e||t.length===0?null:s.jsx("div",{ref:r,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:s.jsx(pa,{delayDuration:200,children:t.map(a=>{const l=a.icon,u=Ne("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition",a.disabled?"cursor-not-allowed opacity-50":a.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),f=s.jsxs(s.Fragment,{children:[l?s.jsx(l,{className:"h-4 w-4 shrink-0"}):null,s.jsx("span",{className:"block min-w-0 truncate",children:a.label})]});if(a.disabled){const p=s.jsx("span",{tabIndex:0,className:"inline-block w-full outline-none focus-visible:ring-1 focus-visible:ring-ring",children:s.jsx("button",{type:"button",disabled:!0,className:u,children:f})});return a.disabledReason?s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:p}),s.jsx(gr,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx($e,{to:a.href,className:u,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:u,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const UH="__ungrouped__";function Ow({open:e,onOpenChange:t,currentWorkspace:n,onSubmit:r,title:o="Move to workspace",description:i="Pick the workspace this item should belong to."}){const{data:a,loading:l}=Na(),[u,f]=m.useState(n),[p,h]=m.useState(!1),[g,y]=m.useState(null);m.useEffect(()=>{e&&(f(n),y(null))},[e,n]);const k=m.useMemo(()=>[...((a==null?void 0:a.workspaces)??[]).map(N=>({key:N,label:N,value:N})),{key:UH,label:"Ungrouped",value:null}],[a]),v=!p&&u!==n;async function b(){if(v){h(!0),y(null);try{await r(u),t(!1)}catch(j){y(j instanceof Error?j.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(Ln,{open:e,onOpenChange:j=>p?void 0:t(j),children:s.jsxs(jn,{children:[s.jsxs(tr,{children:[s.jsx(kn,{children:o}),s.jsx(ns,{children:i})]}),s.jsx("div",{className:"my-2 max-h-[320px] overflow-y-auto rounded-md border border-border/60",children:l&&k.length===0?s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-sm text-muted-foreground",children:[s.jsx(Iv,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):k.map(j=>{const N=j.value===n,S=j.value===u;return s.jsxs("button",{type:"button",disabled:N||p,onClick:()=>f(j.value),className:Ne("flex w-full items-center justify-between px-3 py-2 text-left text-sm transition",N?"cursor-not-allowed bg-foreground/5 text-muted-foreground":S?"bg-accent/40 text-foreground":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:Ne("block min-w-0 truncate",j.value===null?"italic text-muted-foreground":""),children:[j.label,N?s.jsx("span",{className:"ml-2 text-xs",children:"(current)"}):null]}),S?s.jsx(zr,{className:"h-4 w-4 text-foreground"}):null]},j.key)})}),g?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:g}):null,s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),disabled:p,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:b,disabled:!v,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function NS(){const{workspace:e}=Vt(),t=pn(),n=Ht(),{data:r,loading:o,error:i,refetch:a}=Zs(),{toast:l,showToast:u,dismissToast:f}=wr(),p=m.useRef(null);Ti("list:projects");const[h,g]=m.useState(""),[y,k]=m.useState("all"),[v,b]=m.useState("all"),[j,N]=m.useState("updated"),[S,C]=Ns(),D=S.get("view"),T=D==="table"||D==="kanban"?D:"cards",R=F=>{C(G=>{const H=new URLSearchParams(G);return F==="cards"?H.delete("view"):H.set("view",F),H})},[$,_]=m.useState({}),[U,I]=m.useState(null),[V,O]=m.useState(null),P=m.useMemo(()=>r?r.filter(F=>{if(e){if(e==="_ungrouped"){if(F.workspace!==null)return!1}else if(F.workspace!==e)return!1}return y!=="all"&&F.status!==y||v!=="all"&&!F.tags.includes(v)?!1:h.trim()?`${F.title} ${F.tags.join(" ")} ${F.slug}`.toLowerCase().includes(h.toLowerCase()):!0}).sort((F,G)=>VH(F,G,j)):[],[r,h,y,v,j,e]),L=P.map(F=>`${F.slug}:${F.status}`).join("|");m.useEffect(()=>{_(WH(P))},[L,j]);const B=m.useMemo(()=>{const F=new Map(P.map(G=>[G.slug,G]));return Lw.flatMap(G=>($[G]??P.filter(Q=>Q.status===G).map(Q=>Q.slug)).map(Q=>F.get(Q)).filter(Q=>!!Q))},[P,$]),{visibleItems:q,visibleIndexByKey:z}=m.useMemo(()=>{const F=T==="kanban"?B:P,G=new Map;return F.forEach((H,Q)=>G.set(H.slug,Q)),{visibleItems:F,visibleIndexByKey:G}},[T,P,B]),{hotkeyRowProps:W}=_d(q,{scope:"list:projects",onOpen:F=>n(`${t}/projects/${F.slug}`)});if(Jt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var F;return(F=p.current)==null?void 0:F.focus()}}),Jt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(jt,{label:"Loading projects…"});if(i||!r)return s.jsx(Rt,{error:i||"Project list is unavailable."});const M=Array.from(new Set(r.flatMap(F=>F.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Hr,{toast:l,onDismiss:f}),s.jsxs(Mw,{children:[s.jsx(Pm,{ref:p,value:h,onChange:g,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:y,onChange:F=>k(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All statuses"}),s.jsx("option",{value:"pending",children:"Pending"}),s.jsx("option",{value:"active",children:"Active"}),s.jsx("option",{value:"blocked",children:"Blocked"}),s.jsx("option",{value:"failed",children:"Failed"}),s.jsx("option",{value:"completed",children:"Completed"})]}),s.jsxs("select",{value:v,onChange:F=>b(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),M.map(F=>s.jsx("option",{value:F,children:F},F))]}),s.jsxs("select",{value:j,onChange:F=>N(F.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"updated",children:"Sort: Updated"}),s.jsx("option",{value:"created",children:"Sort: Created"}),s.jsx("option",{value:"title",children:"Sort: Title"}),s.jsx("option",{value:"attention",children:"Sort: Attention"})]}),s.jsx(_m,{value:T,onChange:F=>R(F),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),P.length===0?r.length===0?s.jsxs("div",{className:"rounded-frame border border-border/60 bg-card px-6 py-16 text-center",children:[s.jsx("p",{className:"eyebrow mx-auto justify-center",children:"Start here"}),s.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"}),s.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."}),s.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-3",children:[s.jsx($e,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx($e,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(Nt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx($e,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):T==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:P.map((F,G)=>s.jsxs($e,{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",...W(G),children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:F.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Gn(F.updated)]})]}),s.jsx(vn,{status:F.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(jh,{progress:F.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:F.tags.map(H=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:H},H))}),s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Needs attention"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount})]}),s.jsxs("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:[s.jsx("p",{className:"text-muted-foreground",children:"Assignments"}),s.jsx("p",{className:"mt-1 font-semibold text-foreground",children:F.progress.total})]})]})]})]},F.slug))}):T==="table"?s.jsx(Xe,{title:`${P.length} project${P.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"pb-3 font-medium",children:"Project"}),s.jsx("th",{className:"pb-3 font-medium",children:"Status"}),s.jsx("th",{className:"pb-3 font-medium",children:"Progress"}),s.jsx("th",{className:"pb-3 font-medium",children:"Attention"}),s.jsx("th",{className:"pb-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:P.map((F,G)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...W(G),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx($e,{to:`${t}/projects/${F.slug}`,className:"font-semibold text-foreground hover:text-primary",children:F.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:F.tags.map(H=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:H},H))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(vn,{status:F.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(jh,{progress:F.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:F.needsAttention.blockedCount+F.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:Gn(F.updated)})]},F.slug))})]})})}):s.jsx(Tm,{columns:CS,items:B,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:async({item:F,fromColumnId:G,toColumnId:H,fromIndex:Q,toIndex:te})=>{var Z;if(G===H){const ae=$[G]??P.filter(ne=>ne.status===G).map(ne=>ne.slug);_(ne=>({...ne,[G]:zH(ae,Q,te)}));return}try{const ae=await fetch(`/api/projects/${F.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:H})});if(!ae.ok){const de=await ae.json().catch(()=>null);u((de==null?void 0:de.error)||`HTTP ${ae.status}`,"error");return}a();const ne=((Z=CS.find(de=>de.id===H))==null?void 0:Z.title)??H;u(`Moved "${F.title}" to ${ne}`,"success")}catch(ae){u(ae instanceof Error?ae.message:"Failed to move project","error")}},getExternalDragData:F=>({type:"project",id:F.slug}),onCardContextMenu:(F,G)=>{G.preventDefault(),I({project:F,anchor:{x:G.clientX,y:G.clientY}})},emptyMessage:F=>`No ${F.title.toLowerCase()} projects.`,renderCard:(F,{dragging:G})=>{const H=z.get(F.slug)??-1;return s.jsx("div",{...H>=0?W(H):{},children:s.jsx(qH,{project:F,dragging:G})})}}),s.jsx(OA,{anchor:(U==null?void 0:U.anchor)??null,items:U?[{key:"edit",label:"Edit",icon:hc,onSelect:()=>n(`${t}/projects/${U.project.slug}`)},{key:"move",label:"Move to workspace…",icon:qh,onSelect:()=>O(U.project)}]:[],onClose:()=>I(null)}),s.jsx(Ow,{open:V!==null,onOpenChange:F=>{F||O(null)},currentWorkspace:(V==null?void 0:V.workspace)??null,title:"Move project to workspace",onSubmit:async F=>{if(!V)return;const G=await fetch(`/api/projects/${encodeURIComponent(V.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:F})});if(!G.ok){const H=await G.json().catch(()=>({}));throw new Error(H.error||"Failed to move project")}a()}}),s.jsx("div",{className:"rounded-lg border border-border/60 bg-card/80 p-3 text-sm text-muted-foreground",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx($v,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",T==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const HH={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},CS=Lw.map(e=>({id:e,title:HH[e],description:Bd(e)}));function VH(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return ES(t)-ES(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function ES(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function WH(e){return Object.fromEntries(Lw.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function qH({project:e,dragging:t}){const n=pn();return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx($e,{to:`${n}/projects/${e.slug}`,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Gn(e.updated)]})]}),s.jsx(vn,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(jh,{progress:e.progress})}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.tags.map(r=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:r},r)),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.progress.total," assignments"]}),s.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"]})]}),s.jsx("div",{className:"mt-4 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:t?"Reordering within status":"Derived project lane"})]})}function kh({title:e,description:t,actions:n,className:r}){return s.jsxs("div",{className:Ne("flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",r),children:[s.jsxs("div",{className:"space-y-1",children:[e?s.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground sm:text-2xl",children:e}):null,t?s.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:t}):null]}),n?s.jsx("div",{className:"flex flex-wrap items-center gap-3",children:n}):null]})}function KH(){return s.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:[s.jsx(Wh,{className:"h-3 w-3"}),"Archived"]})}function TS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function GH(){const{data:e,loading:t,error:n,refetch:r}=mO(),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=wr();async function y(S,C,D){i(C),l(null);try{const T=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"}});if(!T.ok){const R=await T.json().catch(()=>null);throw new Error((R==null?void 0:R.error)||`HTTP ${T.status}`)}r(),h(D,"success")}catch(T){l(T instanceof Error?T.message:"Restore failed")}finally{i(null)}}function k(S){return y(`/api/projects/${S.slug}/unarchive`,`project:${S.slug}`,"Project restored")}function v(S){const C=S.projectSlug?`/api/projects/${S.projectSlug}/assignments/${S.slug}/unarchive`:`/api/assignments/${S.id}/unarchive`;return y(C,`assignment:${S.id}`,"Assignment restored")}if(t)return s.jsx(jt,{label:"Loading archived content…"});if(n)return s.jsx(Rt,{error:n});const b=(e==null?void 0:e.projects)??[],j=(e==null?void 0:e.assignments)??[],N=b.length===0&&j.length===0;return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Hr,{toast:p,onDismiss:g}),s.jsx(kh,{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."}),a?s.jsx("div",{className:"rounded border border-status-failed-foreground/30 bg-status-failed px-3 py-2 text-sm text-status-failed-foreground",children:a}):null,N?s.jsx(Nt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(Xe,{title:"Archived Projects",description:"Restoring a project unhides every cascade-hidden assignment; individually-archived children stay archived.",children:s.jsx("ul",{className:"divide-y divide-border",children:b.map(S=>{const C=u[S.slug]??!1;return s.jsxs("li",{className:"py-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("button",{type:"button",onClick:()=>f(D=>({...D,[S.slug]:!C})),className:"inline-flex items-center gap-1.5 text-left text-sm font-medium text-foreground hover:text-foreground/80","aria-expanded":C,children:[C?s.jsx(vr,{className:"h-4 w-4"}):s.jsx(YE,{className:"h-4 w-4"}),s.jsx(_v,{className:"h-4 w-4 text-muted-foreground"}),S.title,s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",S.assignments.length," assignment",S.assignments.length===1?"":"s",")"]})]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Archived ",S.archivedAt?es(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx($e,{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"}),s.jsxs("button",{type:"button",onClick:()=>k(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:[s.jsx(Zp,{className:"h-3 w-3"}),"Restore"]})]})]}),C&&S.assignments.length>0&&s.jsx("ul",{className:"mt-2 space-y-1 pl-9",children:S.assignments.map(D=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx($e,{to:TS(D),className:"text-foreground hover:text-foreground/80",children:D.title}),s.jsx(vn,{status:D.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:D.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},D.id))})]},S.slug)})})}),j.length>0&&s.jsx(Xe,{title:"Archived Assignments",description:"Individually-archived assignments whose project is still active.",children:s.jsx("ul",{className:"divide-y divide-border",children:j.map(S=>s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsx($e,{to:TS(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),s.jsx(vn,{status:S.status,showIcon:!1}),s.jsx(KH,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?es(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>v(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:[s.jsx(Zp,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const RS="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",AS="block min-w-0 truncate";function Fw({externalIds:e,className:t}){return e.length===0?null:s.jsx("span",{className:Ne("flex flex-wrap items-center gap-1.5",t),children:e.map((n,r)=>{const o=`${n.system}:${n.id}`,i=`${n.system}:${n.id}:${r}`;return n.url!=null&&n.url.length>0?s.jsxs("a",{href:n.url??void 0,target:"_blank",rel:"noopener noreferrer",className:Ne(RS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:AS,children:o}),s.jsx(fc,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:RS,title:o,children:s.jsx("span",{className:AS,children:o})},i)})})}const YH={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 Kn({label:e,value:t,description:n,icon:r,tone:o="default",to:i}){const a=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.1em] text-muted-foreground",children:e}),s.jsx("p",{className:"text-2xl font-semibold text-foreground",children:t})]}),r?s.jsx("span",{className:"rounded-md border border-border/60 bg-background/80 p-1.5 text-muted-foreground",children:s.jsx(r,{className:"h-5 w-5"})}):null]}),n?s.jsx("p",{className:"mt-2 text-sm leading-5 text-muted-foreground",children:n}):null]}),f=Ne(YH[(t===0||t==="0")&&(o==="warn"||o==="danger")?"default":o],i?"block transition hover:-translate-y-0.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40":"");return i?s.jsx($e,{to:i,className:f,children:a}):s.jsx("article",{className:f,children:a})}function PS(e){const t=XH(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),u=l.find(JH);if(u){const f=u.props.children,p=l.map(h=>h===u?m.Children.count(f)>1?m.Children.only(null):m.isValidElement(f)?f.props.children:null:h);return s.jsx(t,{...a,ref:o,children:m.isValidElement(f)?m.cloneElement(f,void 0,p):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}function XH(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=e9(o),l=ZH(i,o.props);return o.type!==m.Fragment&&(l.ref=r?sm(r,a):a),m.cloneElement(o,l)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QH=Symbol("radix.slottable");function JH(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QH}function ZH(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const u=i(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function e9(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 t9(e){const t=e+"CollectionProvider",[n,r]=Ca(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:b,children:j}=v,N=$t.useRef(null),S=$t.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:S,collectionRef:N,children:j})};a.displayName=t;const l=e+"CollectionSlot",u=PS(l),f=$t.forwardRef((v,b)=>{const{scope:j,children:N}=v,S=i(l,j),C=Zn(b,S.collectionRef);return s.jsx(u,{ref:C,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=PS(p),y=$t.forwardRef((v,b)=>{const{scope:j,children:N,...S}=v,C=$t.useRef(null),D=Zn(b,C),T=i(p,j);return $t.useEffect(()=>(T.itemMap.set(C,{ref:C,...S}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:D,children:N})});y.displayName=p;function k(v){const b=i(e+"CollectionConsumer",v);return $t.useCallback(()=>{const N=b.collectionRef.current;if(!N)return[];const S=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((T,R)=>S.indexOf(T.ref.current)-S.indexOf(R.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:a,Slot:f,ItemSlot:y},k,r]}var n9=m.createContext(void 0);function FA(e){const t=m.useContext(n9);return e||t||"ltr"}var xy="rovingFocusGroup.onEntryFocus",r9={bubbles:!1,cancelable:!0},Hd="RovingFocusGroup",[Ub,zA,s9]=t9(Hd),[o9,BA]=Ca(Hd,[s9]),[i9,a9]=o9(Hd),UA=m.forwardRef((e,t)=>s.jsx(Ub.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ub.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(l9,{...e,ref:t})})}));UA.displayName=Hd;var l9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=Zn(t,g),k=FA(i),[v,b]=om({prop:a,defaultProp:l??null,onChange:u,caller:Hd}),[j,N]=m.useState(!1),S=xa(f),C=zA(n),D=m.useRef(!1),[T,R]=m.useState(0);return m.useEffect(()=>{const $=g.current;if($)return $.addEventListener(xy,S),()=>$.removeEventListener(xy,S)},[S]),s.jsx(i9,{scope:n,orientation:r,dir:k,loop:o,currentTabStopId:v,onItemFocus:m.useCallback($=>b($),[b]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R($=>$+1),[]),onFocusableItemRemove:m.useCallback(()=>R($=>$-1),[]),children:s.jsx(wn.div,{tabIndex:j||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:rn(e.onMouseDown,()=>{D.current=!0}),onFocus:rn(e.onFocus,$=>{const _=!D.current;if($.target===$.currentTarget&&_&&!j){const U=new CustomEvent(xy,r9);if($.currentTarget.dispatchEvent(U),!U.defaultPrevented){const I=C().filter(B=>B.focusable),V=I.find(B=>B.active),O=I.find(B=>B.id===v),L=[V,O,...I].filter(Boolean).map(B=>B.ref.current);WA(L,p)}}D.current=!1}),onBlur:rn(e.onBlur,()=>N(!1))})})}),HA="RovingFocusGroupItem",VA=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,u=$l(),f=i||u,p=a9(HA,n),h=p.currentTabStopId===f,g=zA(n),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:v}=p;return m.useEffect(()=>{if(r)return y(),()=>k()},[r,y,k]),s.jsx(Ub.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:s.jsx(wn.span,{tabIndex:h?0:-1,"data-orientation":p.orientation,...l,ref:t,onMouseDown:rn(e.onMouseDown,b=>{r?p.onItemFocus(f):b.preventDefault()}),onFocus:rn(e.onFocus,()=>p.onItemFocus(f)),onKeyDown:rn(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const j=d9(b,p.orientation,p.dir);if(j!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let S=g().filter(C=>C.focusable).map(C=>C.ref.current);if(j==="last")S.reverse();else if(j==="prev"||j==="next"){j==="prev"&&S.reverse();const C=S.indexOf(b.currentTarget);S=p.loop?f9(S,C+1):S.slice(C+1)}setTimeout(()=>WA(S))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:v!=null}):a})})});VA.displayName=HA;var c9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function u9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function d9(e,t,n){const r=u9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return c9[r]}function WA(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function f9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var p9=UA,h9=VA,Dm="Tabs",[m9]=Ca(Dm,[BA]),qA=BA(),[g9,zw]=m9(Dm),KA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:u="automatic",...f}=e,p=FA(l),[h,g]=om({prop:r,onChange:o,defaultProp:i??"",caller:Dm});return s.jsx(g9,{scope:n,baseId:$l(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:u,children:s.jsx(wn.div,{dir:p,"data-orientation":a,...f,ref:t})})});KA.displayName=Dm;var GA="TabsList",YA=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=zw(GA,n),a=qA(n);return s.jsx(p9,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(wn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});YA.displayName=GA;var XA="TabsTrigger",QA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=zw(XA,n),l=qA(n),u=eP(a.baseId,r),f=tP(a.baseId,r),p=r===a.value;return s.jsx(h9,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(wn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...i,ref:t,onMouseDown:rn(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?a.onValueChange(r):h.preventDefault()}),onKeyDown:rn(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&a.onValueChange(r)}),onFocus:rn(e.onFocus,()=>{const h=a.activationMode!=="manual";!p&&!o&&h&&a.onValueChange(r)})})})});QA.displayName=XA;var JA="TabsContent",ZA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=zw(JA,n),u=eP(l.baseId,r),f=tP(l.baseId,r),p=r===l.value,h=m.useRef(p);return m.useEffect(()=>{const g=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(g)},[]),s.jsx(Ea,{present:o||p,children:({present:g})=>s.jsx(wn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});ZA.displayName=JA;function eP(e,t){return`${e}-trigger-${t}`}function tP(e,t){return`${e}-content-${t}`}var nP=KA,rP=YA,Hb=QA,Vb=ZA;function $m({value:e,onValueChange:t,items:n,className:r}){const o=m.useRef(null),[i,a]=m.useState(!1),l=m.useCallback(()=>{const u=o.current;u&&a(u.scrollLeft+u.clientWidth<u.scrollWidth-1)},[]);return m.useEffect(()=>{const u=o.current;if(!u)return;l(),u.addEventListener("scroll",l,{passive:!0});const f=new ResizeObserver(l);return f.observe(u),()=>{u.removeEventListener("scroll",l),f.disconnect()}},[l,n.length]),s.jsxs(nP,{value:e,onValueChange:t,className:r,children:[s.jsxs("div",{className:"relative",children:[s.jsx(rP,{ref:o,className:"flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(u=>s.jsxs(Hb,{value:u.value,className:Ne("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:[s.jsx("span",{children:u.label}),typeof u.count=="number"?s.jsx("span",{className:"rounded-full bg-background/20 px-2 py-0.5 text-xs data-[state=active]:bg-background/20",children:u.count}):null,u.problemCount&&u.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,title:`${u.problemCount} ${u.problemCount===1?"error":"errors"}`,children:u.problemCount}):null]},u.value))}),i?s.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 w-8 rounded-r-md bg-gradient-to-l from-card to-transparent"}):null]}),n.map(u=>s.jsx(Vb,{value:u.value,className:"pt-3",children:u.content},u.value))]})}const x9="modulepreload",y9=function(e){return"/"+e},_S={},b9=function(t,n,r){let o=Promise.resolve();if(n&&n.length>0){let a=function(f){return Promise.all(f.map(p=>Promise.resolve(p).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=y9(f),f in _S)return;_S[f]=!0;const p=f.endsWith(".css"),h=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${h}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":x9,p||(g.as="script"),g.crossOrigin="",g.href=f,u&&g.setAttribute("nonce",u),document.head.appendChild(g),p)return new Promise((y,k)=>{g.addEventListener("load",y),g.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return o.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function v9({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),u=Ht(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await b9(async()=>{const{default:v}=await import("./mermaid.core-DfYtUVoE.js").then(b=>b.bs);return{default:v}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:w9(f==="dark")}),p)return;const y=`mermaid-${Date.now()}`,{svg:k}=await g.render(y,e);if(p||!r.current)return;r.current.innerHTML=k,j9(r.current,n,u),l(!1)}catch(g){p||(i(g instanceof Error?g.message:"Failed to render graph"),l(!1))}}return l(!0),i(null),h(),()=>{p=!0}},[e,u,n,f]),o?s.jsxs("div",{className:Ne("rounded-lg border border-border bg-card p-4",t),children:[s.jsxs("p",{className:"text-sm text-error-foreground",children:["Failed to render dependency graph: ",o]}),s.jsx("pre",{className:"mt-2 text-xs text-muted-foreground overflow-auto",children:e})]}):s.jsxs("div",{className:Ne("rounded-lg border border-border bg-card p-4",t),children:[a&&s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading graph..."}),s.jsx("div",{ref:r,className:"overflow-auto"})]})}function w9(e){const t=document.documentElement,n=h=>{const g=getComputedStyle(t).getPropertyValue(h).trim();return g?`oklch(${g})`:""},r=n("--card"),o=n("--card-foreground"),i=n("--border"),a=n("--primary"),l=n("--primary-foreground"),u=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:u,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:u,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:u,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:u,labelColor:o,errorBkgColor:p,errorTextColor:l}}function j9(e,t,n){var r;for(const o of e.querySelectorAll(".node")){const i=((r=o.textContent)==null?void 0:r.replace(/\s+/g," ").trim())??"",a=t[i];if(!a)continue;o.style.cursor="pointer",o.setAttribute("role","link"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label",`Open ${i}`);const l=()=>n(a);o.addEventListener("click",l),o.addEventListener("keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),l())})}}function k9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const S9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,C9={};function DS(e,t){return(C9.jsx?N9:S9).test(e)}const E9=/[ \t\n\f\r]/g;function T9(e){return typeof e=="object"?e.type==="text"?$S(e.value):!1:$S(e)}function $S(e){return e.replace(E9,"")===""}class Vd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Vd.prototype.normal={};Vd.prototype.property={};Vd.prototype.space=void 0;function sP(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Vd(n,r,t)}function Wb(e){return e.toLowerCase()}class jr{constructor(t,n){this.attribute=n,this.property=t}}jr.prototype.attribute="";jr.prototype.booleanish=!1;jr.prototype.boolean=!1;jr.prototype.commaOrSpaceSeparated=!1;jr.prototype.commaSeparated=!1;jr.prototype.defined=!1;jr.prototype.mustUseProperty=!1;jr.prototype.number=!1;jr.prototype.overloadedBoolean=!1;jr.prototype.property="";jr.prototype.spaceSeparated=!1;jr.prototype.space=void 0;let R9=0;const wt=Ra(),gn=Ra(),qb=Ra(),Me=Ra(),qt=Ra(),Ul=Ra(),Ar=Ra();function Ra(){return 2**++R9}const Kb=Object.freeze(Object.defineProperty({__proto__:null,boolean:wt,booleanish:gn,commaOrSpaceSeparated:Ar,commaSeparated:Ul,number:Me,overloadedBoolean:qb,spaceSeparated:qt},Symbol.toStringTag,{value:"Module"})),yy=Object.keys(Kb);class Bw extends jr{constructor(t,n,r,o){let i=-1;if(super(t,n),IS(this,"space",o),typeof r=="number")for(;++i<yy.length;){const a=yy[i];IS(this,yy[i],(r&Kb[a])===Kb[a])}}}Bw.prototype.defined=!0;function IS(e,t,n){n&&(e[t]=n)}function Nc(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new Bw(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Wb(r)]=r,n[Wb(i.attribute)]=r}return new Vd(t,n,e.space)}const oP=Nc({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:qt,ariaCurrent:null,ariaDescribedBy:qt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:qt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:qt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qt,ariaLevel:Me,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:qt,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:qt,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:gn,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function iP(e,t){return t in e?e[t]:t}function aP(e,t){return iP(e,t.toLowerCase())}const A9=Nc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ul,acceptCharset:qt,accessKey:qt,action:null,allow:null,allowFullScreen:wt,allowPaymentRequest:wt,allowUserMedia:wt,alt:null,as:null,async:wt,autoCapitalize:null,autoComplete:qt,autoFocus:wt,autoPlay:wt,blocking:qt,capture:null,charSet:null,checked:wt,cite:null,className:qt,cols:Me,colSpan:null,content:null,contentEditable:gn,controls:wt,controlsList:qt,coords:Me|Ul,crossOrigin:null,data:null,dateTime:null,decoding:null,default:wt,defer:wt,dir:null,dirName:null,disabled:wt,download:qb,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:wt,formTarget:null,headers:qt,height:Me,hidden:qb,high:Me,href:null,hrefLang:null,htmlFor:qt,httpEquiv:qt,id:null,imageSizes:null,imageSrcSet:null,inert:wt,inputMode:null,integrity:null,is:null,isMap:wt,itemId:null,itemProp:qt,itemRef:qt,itemScope:wt,itemType:qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:wt,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:wt,muted:wt,name:null,nonce:null,noModule:wt,noValidate:wt,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:wt,optimum:Me,pattern:null,ping:qt,placeholder:null,playsInline:wt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:wt,referrerPolicy:null,rel:qt,required:wt,reversed:wt,rows:Me,rowSpan:Me,sandbox:qt,scope:null,scoped:wt,seamless:wt,selected:wt,shadowRootClonable:wt,shadowRootDelegatesFocus:wt,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:wt,useMap:null,value:gn,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qt,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:wt,declare:wt,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:wt,noHref:wt,noShade:wt,noWrap:wt,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:wt,disableRemotePlayback:wt,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:aP}),P9=Nc({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:Ar,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:qt,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:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:wt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,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:Ul,g2:Ul,glyphName:Ul,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Ar,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,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:Me,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:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ar,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ar,rev:Ar,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ar,requiredFeatures:Ar,requiredFonts:Ar,requiredFormats:Ar,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:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Ar,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ar,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ar,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:iP}),lP=Nc({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()}}),cP=Nc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:aP}),uP=Nc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),_9={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"},D9=/[A-Z]/g,MS=/-[a-z]/g,$9=/^data[-\w.:]+$/i;function I9(e,t){const n=Wb(t);let r=t,o=jr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&$9.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(MS,L9);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!MS.test(i)){let a=i.replace(D9,M9);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=Bw}return new o(r,t)}function M9(e){return"-"+e.toLowerCase()}function L9(e){return e.charAt(1).toUpperCase()}const O9=sP([oP,A9,lP,cP,uP],"html"),Uw=sP([oP,P9,lP,cP,uP],"svg");function F9(e){return e.join(" ").trim()}var gl={},by,LS;function z9(){if(LS)return by;LS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
591
+ `,f="/",p="*",h="",g="comment",y="declaration";function k(b,j){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];j=j||{};var N=1,S=1;function C(P){var L=P.match(t);L&&(N+=L.length);var B=P.lastIndexOf(u);S=~B?P.length-B:S+P.length}function D(){var P={line:N,column:S};return function(L){return L.position=new T(P),_(),L}}function T(P){this.start=P,this.end={line:N,column:S},this.source=j.source}T.prototype.content=b;function R(P){var L=new Error(j.source+":"+N+":"+S+": "+P);if(L.reason=P,L.filename=j.source,L.line=N,L.column=S,L.source=b,!j.silent)throw L}function $(P){var L=P.exec(b);if(L){var B=L[0];return C(B),b=b.slice(B.length),L}}function _(){$(n)}function U(P){var L;for(P=P||[];L=I();)L!==!1&&P.push(L);return P}function I(){var P=D();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var L=2;h!=b.charAt(L)&&(p!=b.charAt(L)||f!=b.charAt(L+1));)++L;if(L+=2,h===b.charAt(L-1))return R("End of comment missing");var B=b.slice(2,L-2);return S+=2,C(B),b=b.slice(L),S+=2,P({type:g,comment:B})}}function V(){var P=D(),L=$(r);if(L){if(I(),!$(o))return R("property missing ':'");var B=$(i),q=P({type:y,property:v(L[0].replace(e,h)),value:B?v(B[0].replace(e,h)):h});return $(a),q}}function O(){var P=[];U(P);for(var L;L=V();)L!==!1&&(P.push(L),U(P));return P}return _(),O()}function v(b){return b?b.replace(l,h):h}return by=k,by}var OS;function B9(){if(OS)return gl;OS=1;var e=gl&&gl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(gl,"__esModule",{value:!0}),gl.default=n;const t=e(z9());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const a=(0,t.default)(r),l=typeof o=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:f,value:p}=u;l?o(f,p,u):p&&(i=i||{},i[f]=p)}),i}return gl}var mu={},FS;function U9(){if(FS)return mu;FS=1,Object.defineProperty(mu,"__esModule",{value:!0}),mu.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(f){return!f||n.test(f)||e.test(f)},a=function(f,p){return p.toUpperCase()},l=function(f,p){return"".concat(p,"-")},u=function(f,p){return p===void 0&&(p={}),i(f)?f:(f=f.toLowerCase(),p.reactCompat?f=f.replace(o,l):f=f.replace(r,l),f.replace(t,a))};return mu.camelCase=u,mu}var gu,zS;function H9(){if(zS)return gu;zS=1;var e=gu&&gu.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(B9()),n=U9();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,u){l&&u&&(a[(0,n.camelCase)(l,i)]=u)}),a}return r.default=r,gu=r,gu}var V9=H9();const W9=kd(V9),dP=fP("end"),Hw=fP("start");function fP(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function q9(e){const t=Hw(e),n=dP(e);if(t&&n)return{start:t,end:n}}function Uu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?BS(e.position):"start"in e||"end"in e?BS(e):"line"in e||"column"in e?Gb(e):""}function Gb(e){return US(e&&e.line)+":"+US(e&&e.column)}function BS(e){return Gb(e&&e.start)+"-"+Gb(e&&e.end)}function US(e){return e&&typeof e=="number"?e:1}class nr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!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&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?i.ruleId=r:(i.source=r.slice(0,u),i.ruleId=r.slice(u+1))}if(!i.place&&i.ancestors&&i.ancestors){const u=i.ancestors[i.ancestors.length-1];u&&(i.place=u.position)}const l=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=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=Uu(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=a&&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}}nr.prototype.file="";nr.prototype.name="";nr.prototype.reason="";nr.prototype.message="";nr.prototype.stack="";nr.prototype.column=void 0;nr.prototype.line=void 0;nr.prototype.ancestors=void 0;nr.prototype.cause=void 0;nr.prototype.fatal=void 0;nr.prototype.place=void 0;nr.prototype.ruleId=void 0;nr.prototype.source=void 0;const Vw={}.hasOwnProperty,K9=new Map,G9=/[A-Z]/g,Y9=new Set(["table","tbody","thead","tfoot","tr"]),X9=new Set(["td","th"]),pP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Q9(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=oV(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");r=sV(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,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"?Uw:O9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=hP(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function hP(e,t,n){if(t.type==="element")return J9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Z9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tV(e,t,n);if(t.type==="mdxjsEsm")return eV(e,t);if(t.type==="root")return nV(e,t,n);if(t.type==="text")return rV(e,t)}function J9(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Uw,e.schema=o),e.ancestors.push(t);const i=gP(e,t.tagName,!1),a=iV(e,t);let l=qw(e,t);return Y9.has(t.tagName)&&(l=l.filter(function(u){return typeof u=="string"?!T9(u):!0})),mP(e,a,i,t),Ww(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function Z9(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}cd(e,t.position)}function eV(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cd(e,t.position)}function tV(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Uw,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:gP(e,t.name,!0),a=aV(e,t),l=qw(e,t);return mP(e,a,i,t),Ww(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function nV(e,t,n){const r={};return Ww(r,qw(e,t)),e.create(t,e.Fragment,r,n)}function rV(e,t){return t.value}function mP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ww(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function sV(e,t,n){return r;function r(o,i,a,l){const f=Array.isArray(a.children)?n:t;return l?f(i,a,l):f(i,a)}}function oV(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),u=Hw(r);return t(o,i,a,l,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function iV(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Vw.call(t.properties,o)){const i=lV(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&X9.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function aV(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else cd(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else cd(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function qw(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:K9;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const u=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(u){const f=o.get(u)||0;a=u+"-"+f,o.set(u,f+1)}}const l=hP(e,i,a);l!==void 0&&n.push(l)}return n}function lV(e,t,n){const r=I9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?k9(n):F9(n)),r.property==="style"){let o=typeof n=="object"?n:cV(e,String(n));return e.stylePropertyNameCase==="css"&&(o=uV(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?_9[r.property]||r.property:r.attribute,n]}}function cV(e,t){try{return W9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new nr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=pP+"#cannot-parse-style-attribute",o}}function gP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const l=DS(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=DS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Vw.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);cd(e)}function cd(e,t){const n=new nr("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=pP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function uV(e){const t={};let n;for(n in e)Vw.call(e,n)&&(t[dV(n)]=e[n]);return t}function dV(e){let t=e.replace(G9,fV);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function fV(e){return"-"+e.toLowerCase()}const vy={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"]},pV={};function hV(e,t){const n=pV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return xP(e,r,o)}function xP(e,t,n){if(mV(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 HS(e.children,t,n)}return Array.isArray(e)?HS(e,t,n):""}function HS(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=xP(e[o],t,n);return r.join("")}function mV(e){return!!(e&&typeof e=="object")}const VS=document.createElement("i");function Kw(e){const t="&"+e+";";VS.innerHTML=t;const n=VS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Js(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Jr(e,t){return e.length>0?(Js(e,e.length,0,t),e):t}const WS={}.hasOwnProperty;function gV(e){const t={};let n=-1;for(;++n<e.length;)xV(t,e[n]);return t}function xV(e,t){let n;for(n in t){const o=(WS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){WS.call(o,a)||(o[a]=[]);const l=i[a];yV(o[a],Array.isArray(l)?l:l?[l]:[])}}}function yV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Js(e,0,0,r)}function yP(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 Hl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vs=Ri(/[A-Za-z]/),Or=Ri(/[\dA-Za-z]/),bV=Ri(/[#-'*+\--9=?A-Z^-~]/);function Yb(e){return e!==null&&(e<32||e===127)}const Xb=Ri(/\d/),vV=Ri(/[\dA-Fa-f]/),wV=Ri(/[!-/:-@[-`{-~]/);function ht(e){return e!==null&&e<-2}function br(e){return e!==null&&(e<0||e===32)}function Ot(e){return e===-2||e===-1||e===32}const jV=Ri(new RegExp("\\p{P}|\\p{S}","u")),kV=Ri(/\s/);function Ri(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Cc(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Or(e.charCodeAt(n+1))&&Or(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Kt(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(u){return Ot(u)?(e.enter(n),l(u)):t(u)}function l(u){return Ot(u)&&i++<o?(e.consume(u),l):(e.exit(n),t(u))}}const SV={tokenize:NV};function NV(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Kt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const u=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=u),n=u,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ht(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const CV={tokenize:EV},qS={tokenize:TV};function EV(e){const t=this,n=[];let r=0,o,i,a;return l;function l(S){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,u,f)(S)}return f(S)}function u(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&N();const C=t.events.length;let D=C,T;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){T=t.events[D][1].end;break}j(r);let R=C;for(;R<t.events.length;)t.events[R][1].end={...T},R++;return Js(t.events,D+1,0,t.events.slice(C)),t.events.length=R,f(S)}return l(S)}function f(S){if(r===n.length){if(!o)return g(S);if(o.currentConstruct&&o.currentConstruct.concrete)return k(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(qS,p,h)(S)}function p(S){return o&&N(),j(r),g(S)}function h(S){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,k(S)}function g(S){return t.containerState={},e.attempt(qS,y,k)(S)}function y(S){return r++,n.push([t.currentConstruct,t.containerState]),g(S)}function k(S){if(S===null){o&&N(),j(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),v(S)}function v(S){if(S===null){b(e.exit("chunkFlow"),!0),j(0),e.consume(S);return}return ht(S)?(e.consume(S),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(S),v)}function b(S,C){const D=t.sliceStream(S);if(C&&D.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(D),t.parser.lazy[S.start.line]){let T=o.events.length;for(;T--;)if(o.events[T][1].start.offset<a&&(!o.events[T][1].end||o.events[T][1].end.offset>a))return;const R=t.events.length;let $=R,_,U;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(_){U=t.events[$][1].end;break}_=!0}for(j(r),T=R;T<t.events.length;)t.events[T][1].end={...U},T++;Js(t.events,$+1,0,t.events.slice(R)),t.events.length=T}}function j(S){let C=n.length;for(;C-- >S;){const D=n[C];t.containerState=D[1],D[0].exit.call(t,e)}n.length=S}function N(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function TV(e,t,n){return Kt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function KS(e){if(e===null||br(e)||kV(e))return 1;if(jV(e))return 2}function Gw(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Qb={name:"attention",resolveAll:RV,tokenize:AV};function RV(e,t){let n=-1,r,o,i,a,l,u,f,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},g={...e[n][1].start};GS(h,-u),GS(g,u),a={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:u>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:u>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},f=[],e[r][1].end.offset-e[r][1].start.offset&&(f=Jr(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Jr(f,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),f=Jr(f,Gw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Jr(f,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,f=Jr(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Js(e,r-1,n-r+3,f),n=r+f.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function AV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=KS(r);let i;return a;function a(u){return i=u,e.enter("attentionSequence"),l(u)}function l(u){if(u===i)return e.consume(u),l;const f=e.exit("attentionSequence"),p=KS(u),h=!p||p===2&&o||n.includes(u),g=!o||o===2&&p||n.includes(r);return f._open=!!(i===42?h:h&&(o||!g)),f._close=!!(i===42?g:g&&(p||!h)),t(u)}}function GS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PV={name:"autolink",tokenize:_V};function _V(e,t,n){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(y){return Vs(y)?(e.consume(y),a):y===64?n(y):f(y)}function a(y){return y===43||y===45||y===46||Or(y)?(r=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),r=0,u):(y===43||y===45||y===46||Or(y))&&r++<32?(e.consume(y),l):(r=0,f(y))}function u(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||Yb(y)?n(y):(e.consume(y),u)}function f(y){return y===64?(e.consume(y),p):bV(y)?(e.consume(y),f):n(y)}function p(y){return Or(y)?h(y):n(y)}function h(y){return y===46?(e.consume(y),r=0,p):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):g(y)}function g(y){if((y===45||Or(y))&&r++<63){const k=y===45?g:h;return e.consume(y),k}return n(y)}}const Im={partial:!0,tokenize:DV};function DV(e,t,n){return r;function r(i){return Ot(i)?Kt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ht(i)?t(i):n(i)}}const bP={continuation:{tokenize:IV},exit:MV,name:"blockQuote",tokenize:$V};function $V(e,t,n){const r=this;return o;function o(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ot(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function IV(e,t,n){const r=this;return o;function o(a){return Ot(a)?Kt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(bP,t,n)(a)}}function MV(e){e.exit("blockQuote")}const vP={name:"characterEscape",tokenize:LV};function LV(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return wV(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const wP={name:"characterReference",tokenize:OV};function OV(e,t,n){const r=this;let o=0,i,a;return l;function l(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),u}function u(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),i=31,a=Or,p(h))}function f(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=vV,p):(e.enter("characterReferenceValue"),i=7,a=Xb,p(h))}function p(h){if(h===59&&o){const g=e.exit("characterReferenceValue");return a===Or&&!Kw(r.sliceSerialize(g))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(h)&&o++<i?(e.consume(h),p):n(h)}}const YS={partial:!0,tokenize:zV},XS={concrete:!0,name:"codeFenced",tokenize:FV};function FV(e,t,n){const r=this,o={partial:!0,tokenize:D};let i=0,a=0,l;return u;function u(T){return f(T)}function f(T){const R=r.events[r.events.length-1];return i=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(T)}function p(T){return T===l?(a++,e.consume(T),p):a<3?n(T):(e.exit("codeFencedFenceSequence"),Ot(T)?Kt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||ht(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(YS,v,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||ht(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Ot(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Kt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function y(T){return T===null||ht(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||ht(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),k)}function v(T){return e.attempt(o,C,b)(T)}function b(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),j}function j(T){return i>0&&Ot(T)?Kt(e,N,"linePrefix",i+1)(T):N(T)}function N(T){return T===null||ht(T)?e.check(YS,v,C)(T):(e.enter("codeFlowValue"),S(T))}function S(T){return T===null||ht(T)?(e.exit("codeFlowValue"),N(T)):(e.consume(T),S)}function C(T){return e.exit("codeFenced"),t(T)}function D(T,R,$){let _=0;return U;function U(L){return T.enter("lineEnding"),T.consume(L),T.exit("lineEnding"),I}function I(L){return T.enter("codeFencedFence"),Ot(L)?Kt(T,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):V(L)}function V(L){return L===l?(T.enter("codeFencedFenceSequence"),O(L)):$(L)}function O(L){return L===l?(_++,T.consume(L),O):_>=a?(T.exit("codeFencedFenceSequence"),Ot(L)?Kt(T,P,"whitespace")(L):P(L)):$(L)}function P(L){return L===null||ht(L)?(T.exit("codeFencedFence"),R(L)):$(L)}}}function zV(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const wy={name:"codeIndented",tokenize:UV},BV={partial:!0,tokenize:HV};function UV(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),Kt(e,i,"linePrefix",5)(f)}function i(f){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(f):n(f)}function a(f){return f===null?u(f):ht(f)?e.attempt(BV,a,u)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||ht(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function u(f){return e.exit("codeIndented"),t(f)}}function HV(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):ht(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Kt(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):ht(a)?o(a):n(a)}}const VV={name:"codeText",previous:qV,resolve:WV,tokenize:KV};function WV(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function qV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function KV(e,t,n){let r=0,o,i;return a;function a(h){return e.enter("codeText"),e.enter("codeTextSequence"),l(h)}function l(h){return h===96?(e.consume(h),r++,l):(e.exit("codeTextSequence"),u(h))}function u(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),u):h===96?(i=e.enter("codeTextSequence"),o=0,p(h)):ht(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||ht(h)?(e.exit("codeTextData"),u(h)):(e.consume(h),f)}function p(h){return h===96?(e.consume(h),o++,p):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(i.type="codeTextData",f(h))}}class GV{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 r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&xu(this.left,r),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),xu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xu(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);xu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xu(this.left,n.reverse())}}}function xu(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 jP(e){const t={};let n=-1,r,o,i,a,l,u,f;const p=new GV(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,i=0,i<u.length&&u[i][1].type==="lineEndingBlank"&&(i+=2),i<u.length&&u[i][1].type==="content"))for(;++i<u.length&&u[i][1].type!=="content";)u[i][1].type==="chunkText"&&(u[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,YV(p,n)),n=t[n],f=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...p.get(o)[1].start},l=p.slice(o,n),l.unshift(r),p.splice(o,n-o+1,l))}}return Js(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function YV(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,u=[],f={};let p,h,g=-1,y=n,k=0,v=0;const b=[v];for(;y;){for(;e.get(++o)[1]!==y;);i.push(o),y._tokenizer||(p=r.sliceStream(y),y.next||p.push(null),h&&a.defineSkip(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=y,y=y.next}for(y=n;++g<l.length;)l[g][0]==="exit"&&l[g-1][0]==="enter"&&l[g][1].type===l[g-1][1].type&&l[g][1].start.line!==l[g][1].end.line&&(v=g+1,b.push(v),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):b.pop(),g=b.length;g--;){const j=l.slice(b[g],b[g+1]),N=i.pop();u.push([N,N+j.length-1]),e.splice(N,2,j)}for(u.reverse(),g=-1;++g<u.length;)f[k+u[g][0]]=k+u[g][1],k+=u[g][1]-u[g][0]-1;return f}const XV={resolve:JV,tokenize:ZV},QV={partial:!0,tokenize:eW};function JV(e){return jP(e),e}function ZV(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?i(l):ht(l)?e.check(QV,a,i)(l):(e.consume(l),o)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function eW(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Kt(e,i,"linePrefix")}function i(a){if(a===null||ht(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function kP(e,t,n,r,o,i,a,l,u){const f=u||Number.POSITIVE_INFINITY;let p=0;return h;function h(j){return j===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(j),e.exit(i),g):j===null||j===32||j===41||Yb(j)?n(j):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(j))}function g(j){return j===62?(e.enter(i),e.consume(j),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===62?(e.exit("chunkString"),e.exit(l),g(j)):j===null||j===60||ht(j)?n(j):(e.consume(j),j===92?k:y)}function k(j){return j===60||j===62||j===92?(e.consume(j),y):y(j)}function v(j){return!p&&(j===null||j===41||br(j))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(j)):p<f&&j===40?(e.consume(j),p++,v):j===41?(e.consume(j),p--,v):j===null||j===32||j===40||Yb(j)?n(j):(e.consume(j),j===92?b:v)}function b(j){return j===40||j===41||j===92?(e.consume(j),v):v(j)}}function SP(e,t,n,r,o,i){const a=this;let l=0,u;return f;function f(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(i),p}function p(y){return l>999||y===null||y===91||y===93&&!u||y===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(y):y===93?(e.exit(i),e.enter(o),e.consume(y),e.exit(o),e.exit(r),t):ht(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===null||y===91||y===93||ht(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),u||(u=!Ot(y)),y===92?g:h)}function g(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}}function NP(e,t,n,r,o,i){let a;return l;function l(g){return g===34||g===39||g===40?(e.enter(r),e.enter(o),e.consume(g),e.exit(o),a=g===40?41:g,u):n(g)}function u(g){return g===a?(e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):(e.enter(i),f(g))}function f(g){return g===a?(e.exit(i),u(a)):g===null?n(g):ht(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Kt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||ht(g)?(e.exit("chunkString"),f(g)):(e.consume(g),g===92?h:p)}function h(g){return g===a||g===92?(e.consume(g),p):p(g)}}function Hu(e,t){let n;return r;function r(o){return ht(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ot(o)?Kt(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const tW={name:"definition",tokenize:rW},nW={partial:!0,tokenize:sW};function rW(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),a(y)}function a(y){return SP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return o=Hl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),u):n(y)}function u(y){return br(y)?Hu(e,f)(y):f(y)}function f(y){return kP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(nW,h,h)(y)}function h(y){return Ot(y)?Kt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||ht(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function sW(e,t,n){return r;function r(l){return br(l)?Hu(e,o)(l):n(l)}function o(l){return NP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ot(l)?Kt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ht(l)?t(l):n(l)}}const oW={name:"hardBreakEscape",tokenize:iW};function iW(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ht(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const aW={name:"headingAtx",resolve:lW,tokenize:cW};function lW(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Js(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function cW(e,t,n){let r=0;return o;function o(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||br(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),u(p)):p===null||ht(p)?(e.exit("atxHeading"),t(p)):Ot(p)?Kt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function u(p){return p===35?(e.consume(p),u):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||br(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const uW=["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"],QS=["pre","script","style","textarea"],dW={concrete:!0,name:"htmlFlow",resolveTo:hW,tokenize:mW},fW={partial:!0,tokenize:xW},pW={partial:!0,tokenize:gW};function hW(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 mW(e,t,n){const r=this;let o,i,a,l,u;return f;function f(H){return p(H)}function p(H){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(H),h}function h(H){return H===33?(e.consume(H),g):H===47?(e.consume(H),i=!0,v):H===63?(e.consume(H),o=3,r.interrupt?t:M):Vs(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function g(H){return H===45?(e.consume(H),o=2,y):H===91?(e.consume(H),o=5,l=0,k):Vs(H)?(e.consume(H),o=4,r.interrupt?t:M):n(H)}function y(H){return H===45?(e.consume(H),r.interrupt?t:M):n(H)}function k(H){const Q="CDATA[";return H===Q.charCodeAt(l++)?(e.consume(H),l===Q.length?r.interrupt?t:V:k):n(H)}function v(H){return Vs(H)?(e.consume(H),a=String.fromCharCode(H),b):n(H)}function b(H){if(H===null||H===47||H===62||br(H)){const Q=H===47,te=a.toLowerCase();return!Q&&!i&&QS.includes(te)?(o=1,r.interrupt?t(H):V(H)):uW.includes(a.toLowerCase())?(o=6,Q?(e.consume(H),j):r.interrupt?t(H):V(H)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):i?N(H):S(H))}return H===45||Or(H)?(e.consume(H),a+=String.fromCharCode(H),b):n(H)}function j(H){return H===62?(e.consume(H),r.interrupt?t:V):n(H)}function N(H){return Ot(H)?(e.consume(H),N):U(H)}function S(H){return H===47?(e.consume(H),U):H===58||H===95||Vs(H)?(e.consume(H),C):Ot(H)?(e.consume(H),S):U(H)}function C(H){return H===45||H===46||H===58||H===95||Or(H)?(e.consume(H),C):D(H)}function D(H){return H===61?(e.consume(H),T):Ot(H)?(e.consume(H),D):S(H)}function T(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(e.consume(H),u=H,R):Ot(H)?(e.consume(H),T):$(H)}function R(H){return H===u?(e.consume(H),u=null,_):H===null||ht(H)?n(H):(e.consume(H),R)}function $(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||br(H)?D(H):(e.consume(H),$)}function _(H){return H===47||H===62||Ot(H)?S(H):n(H)}function U(H){return H===62?(e.consume(H),I):n(H)}function I(H){return H===null||ht(H)?V(H):Ot(H)?(e.consume(H),I):n(H)}function V(H){return H===45&&o===2?(e.consume(H),B):H===60&&o===1?(e.consume(H),q):H===62&&o===4?(e.consume(H),F):H===63&&o===3?(e.consume(H),M):H===93&&o===5?(e.consume(H),W):ht(H)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(fW,G,O)(H)):H===null||ht(H)?(e.exit("htmlFlowData"),O(H)):(e.consume(H),V)}function O(H){return e.check(pW,P,G)(H)}function P(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),L}function L(H){return H===null||ht(H)?O(H):(e.enter("htmlFlowData"),V(H))}function B(H){return H===45?(e.consume(H),M):V(H)}function q(H){return H===47?(e.consume(H),a="",z):V(H)}function z(H){if(H===62){const Q=a.toLowerCase();return QS.includes(Q)?(e.consume(H),F):V(H)}return Vs(H)&&a.length<8?(e.consume(H),a+=String.fromCharCode(H),z):V(H)}function W(H){return H===93?(e.consume(H),M):V(H)}function M(H){return H===62?(e.consume(H),F):H===45&&o===2?(e.consume(H),M):V(H)}function F(H){return H===null||ht(H)?(e.exit("htmlFlowData"),G(H)):(e.consume(H),F)}function G(H){return e.exit("htmlFlow"),t(H)}}function gW(e,t,n){const r=this;return o;function o(a){return ht(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function xW(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Im,t,n)}}const yW={name:"htmlText",tokenize:bW};function bW(e,t,n){const r=this;let o,i,a;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),u}function u(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),D):M===63?(e.consume(M),S):Vs(M)?(e.consume(M),$):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),i=0,k):Vs(M)?(e.consume(M),N):n(M)}function p(M){return M===45?(e.consume(M),y):n(M)}function h(M){return M===null?n(M):M===45?(e.consume(M),g):ht(M)?(a=h,q(M)):(e.consume(M),h)}function g(M){return M===45?(e.consume(M),y):h(M)}function y(M){return M===62?B(M):M===45?g(M):h(M)}function k(M){const F="CDATA[";return M===F.charCodeAt(i++)?(e.consume(M),i===F.length?v:k):n(M)}function v(M){return M===null?n(M):M===93?(e.consume(M),b):ht(M)?(a=v,q(M)):(e.consume(M),v)}function b(M){return M===93?(e.consume(M),j):v(M)}function j(M){return M===62?B(M):M===93?(e.consume(M),j):v(M)}function N(M){return M===null||M===62?B(M):ht(M)?(a=N,q(M)):(e.consume(M),N)}function S(M){return M===null?n(M):M===63?(e.consume(M),C):ht(M)?(a=S,q(M)):(e.consume(M),S)}function C(M){return M===62?B(M):S(M)}function D(M){return Vs(M)?(e.consume(M),T):n(M)}function T(M){return M===45||Or(M)?(e.consume(M),T):R(M)}function R(M){return ht(M)?(a=R,q(M)):Ot(M)?(e.consume(M),R):B(M)}function $(M){return M===45||Or(M)?(e.consume(M),$):M===47||M===62||br(M)?_(M):n(M)}function _(M){return M===47?(e.consume(M),B):M===58||M===95||Vs(M)?(e.consume(M),U):ht(M)?(a=_,q(M)):Ot(M)?(e.consume(M),_):B(M)}function U(M){return M===45||M===46||M===58||M===95||Or(M)?(e.consume(M),U):I(M)}function I(M){return M===61?(e.consume(M),V):ht(M)?(a=I,q(M)):Ot(M)?(e.consume(M),I):_(M)}function V(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,O):ht(M)?(a=V,q(M)):Ot(M)?(e.consume(M),V):(e.consume(M),P)}function O(M){return M===o?(e.consume(M),o=void 0,L):M===null?n(M):ht(M)?(a=O,q(M)):(e.consume(M),O)}function P(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||br(M)?_(M):(e.consume(M),P)}function L(M){return M===47||M===62||br(M)?_(M):n(M)}function B(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function q(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),z}function z(M){return Ot(M)?Kt(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):W(M)}function W(M){return e.enter("htmlTextData"),a(M)}}const Yw={name:"labelEnd",resolveAll:kW,resolveTo:SW,tokenize:NW},vW={tokenize:CW},wW={tokenize:EW},jW={tokenize:TW};function kW(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Js(e,0,e.length,n),e}function SW(e,t){let n=e.length,r=0,o,i,a,l;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(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const u={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=Jr(l,e.slice(i+1,i+r+3)),l=Jr(l,[["enter",p,t]]),l=Jr(l,Gw(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Jr(l,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),l=Jr(l,e.slice(a+1)),l=Jr(l,[["exit",u,t]]),Js(e,i,e.length,l),e}function NW(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return l;function l(g){return i?i._inactive?h(g):(a=r.parser.defined.includes(Hl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),u):n(g)}function u(g){return g===40?e.attempt(vW,p,a?p:h)(g):g===91?e.attempt(wW,p,a?f:h)(g):a?p(g):h(g)}function f(g){return e.attempt(jW,p,h)(g)}function p(g){return t(g)}function h(g){return i._balanced=!0,n(g)}}function CW(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return br(h)?Hu(e,i)(h):i(h)}function i(h){return h===41?p(h):kP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return br(h)?Hu(e,u)(h):p(h)}function l(h){return n(h)}function u(h){return h===34||h===39||h===40?NP(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return br(h)?Hu(e,p)(h):p(h)}function p(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function EW(e,t,n){const r=this;return o;function o(l){return SP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Hl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function TW(e,t,n){return r;function r(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 RW={name:"labelStartImage",resolveAll:Yw.resolveAll,tokenize:AW};function AW(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const PW={name:"labelStartLink",resolveAll:Yw.resolveAll,tokenize:_W};function _W(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const jy={name:"lineEnding",tokenize:DW};function DW(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Kt(e,t,"linePrefix")}}const qp={name:"thematicBreak",tokenize:$W};function $W(e,t,n){let r=0,o;return i;function i(f){return e.enter("thematicBreak"),a(f)}function a(f){return o=f,l(f)}function l(f){return f===o?(e.enter("thematicBreakSequence"),u(f)):r>=3&&(f===null||ht(f))?(e.exit("thematicBreak"),t(f)):n(f)}function u(f){return f===o?(e.consume(f),r++,u):(e.exit("thematicBreakSequence"),Ot(f)?Kt(e,l,"whitespace")(f):l(f))}}const hr={continuation:{tokenize:OW},exit:zW,name:"list",tokenize:LW},IW={partial:!0,tokenize:BW},MW={partial:!0,tokenize:FW};function LW(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return l;function l(y){const k=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:Xb(y)){if(r.containerState.type||(r.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(qp,n,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(y)}return n(y)}function u(y){return Xb(y)&&++a<10?(e.consume(y),u):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):n(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(Im,r.interrupt?n:p,e.attempt(IW,g,h))}function p(y){return r.containerState.initialBlankLine=!0,i++,g(y)}function h(y){return Ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),g):n(y)}function g(y){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function OW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Im,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Kt(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ot(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(MW,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Kt(e,e.attempt(hr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function FW(e,t,n){const r=this;return Kt(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function zW(e){e.exit(this.containerState.type)}function BW(e,t,n){const r=this;return Kt(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!Ot(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const JS={name:"setextUnderline",resolveTo:UW,tokenize:HW};function UW(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=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 a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function HW(e,t,n){const r=this;let o;return i;function i(f){let p=r.events.length,h;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){h=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=f,a(f)):n(f)}function a(f){return e.enter("setextHeadingLineSequence"),l(f)}function l(f){return f===o?(e.consume(f),l):(e.exit("setextHeadingLineSequence"),Ot(f)?Kt(e,u,"lineSuffix")(f):u(f))}function u(f){return f===null||ht(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const VW={tokenize:WW};function WW(e){const t=this,n=e.attempt(Im,r,e.attempt(this.parser.constructs.flowInitial,o,Kt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(XV,o)),"linePrefix")));return n;function r(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 qW={resolveAll:EP()},KW=CP("string"),GW=CP("text");function CP(e){return{resolveAll:EP(e==="text"?YW:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,l);return a;function a(p){return f(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),u}function u(p){return f(p)?(n.exit("data"),i(p)):(n.consume(p),u)}function f(p){if(p===null)return!0;const h=o[p];let g=-1;if(h)for(;++g<h.length;){const y=h[g];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function EP(e){return t;function t(n,r){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,r):n}}function YW(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 r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,l=0,u;for(;i--;){const f=o[i];if(typeof f=="string"){for(a=f.length;f.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(f===-2)u=!0,l++;else if(f!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||u||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...f.start},r.start.offset===r.end.offset?Object.assign(r,f):(e.splice(n,0,["enter",f,t],["exit",f,t]),n+=2)}n++}return e}const XW={42:hr,43:hr,45:hr,48:hr,49:hr,50:hr,51:hr,52:hr,53:hr,54:hr,55:hr,56:hr,57:hr,62:bP},QW={91:tW},JW={[-2]:wy,[-1]:wy,32:wy},ZW={35:aW,42:qp,45:[JS,qp],60:dW,61:JS,95:qp,96:XS,126:XS},eq={38:wP,92:vP},tq={[-5]:jy,[-4]:jy,[-3]:jy,33:RW,38:wP,42:Qb,60:[PV,yW],91:PW,92:[oW,vP],93:Yw,95:Qb,96:VV},nq={null:[Qb,qW]},rq={null:[42,95]},sq={null:[]},oq=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:rq,contentInitial:QW,disable:sq,document:XW,flow:ZW,flowInitial:JW,insideSpan:nq,string:eq,text:tq},Symbol.toStringTag,{value:"Module"}));function iq(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],l=[];const u={attempt:R(D),check:R(T),consume:N,enter:S,exit:C,interrupt:R(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:v,events:[],now:k,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:h};let p=t.tokenize.call(f,u);return t.resolveAll&&i.push(t),f;function h(I){return a=Jr(a,I),b(),a[a.length-1]!==null?[]:($(t,0),f.events=Gw(i,f.events,f),f.events)}function g(I,V){return lq(y(I),V)}function y(I){return aq(a,I)}function k(){const{_bufferIndex:I,_index:V,line:O,column:P,offset:L}=r;return{_bufferIndex:I,_index:V,line:O,column:P,offset:L}}function v(I){o[I.line]=I.column,U()}function b(){let I;for(;r._index<a.length;){const V=a[r._index];if(typeof V=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<V.length;)j(V.charCodeAt(r._bufferIndex));else j(V)}}function j(I){p=p(I)}function N(I){ht(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,U()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=I}function S(I,V){const O=V||{};return O.type=I,O.start=k(),f.events.push(["enter",O,f]),l.push(O),O}function C(I){const V=l.pop();return V.end=k(),f.events.push(["exit",V,f]),V}function D(I,V){$(I,V.from)}function T(I,V){V.restore()}function R(I,V){return O;function O(P,L,B){let q,z,W,M;return Array.isArray(P)?G(P):"tokenize"in P?G([P]):F(P);function F(Z){return ae;function ae(ne){const de=ne!==null&&Z[ne],ye=ne!==null&&Z.null,Se=[...Array.isArray(de)?de:de?[de]:[],...Array.isArray(ye)?ye:ye?[ye]:[]];return G(Se)(ne)}}function G(Z){return q=Z,z=0,Z.length===0?B:H(Z[z])}function H(Z){return ae;function ae(ne){return M=_(),W=Z,Z.partial||(f.currentConstruct=Z),Z.name&&f.parser.constructs.disable.null.includes(Z.name)?te():Z.tokenize.call(V?Object.assign(Object.create(f),V):f,u,Q,te)(ne)}}function Q(Z){return I(W,M),L}function te(Z){return M.restore(),++z<q.length?H(q[z]):B}}}function $(I,V){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Js(f.events,V,f.events.length-V,I.resolve(f.events.slice(V),f)),I.resolveTo&&(f.events=I.resolveTo(f.events,f))}function _(){const I=k(),V=f.previous,O=f.currentConstruct,P=f.events.length,L=Array.from(l);return{from:P,restore:B};function B(){r=I,f.previous=V,f.currentConstruct=O,f.events.length=P,l=L,U()}}function U(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function aq(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function lq(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
592
+ `;break}case-3:{a=`\r
593
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function cq(e){const r={constructs:gV([oq,...(e||{}).extensions||[]]),content:o(SV),defined:[],document:o(CV),flow:o(VW),lazy:{},string:o(KW),text:o(GW)};return r;function o(i){return a;function a(l){return iq(r,i,l)}}}function uq(e){for(;!jP(e););return e}const ZS=/[\0\t\n\r]/g;function dq(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const u=[];let f,p,h,g,y;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(ZS.lastIndex=h,f=ZS.exec(i),g=f&&f.index!==void 0?f.index:i.length,y=i.charCodeAt(g),!f){t=i.slice(h);break}if(y===10&&h===g&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),h<g&&(u.push(i.slice(h,g)),e+=g-h),y){case 0:{u.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,u.push(-2);e++<p;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return l&&(r&&u.push(-5),t&&u.push(t),u.push(null)),u}}const fq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function pq(e){return e.replace(fq,hq)}function hq(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return yP(n.slice(i?2:1),i?16:10)}return Kw(n)||e}const TP={}.hasOwnProperty;function mq(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),gq(n)(uq(cq(n).document().write(dq()(e,t,!0))))}function gq(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(Be),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(oe),blockQuote:i(ye),characterEscape:_,characterReference:_,codeFenced:i(Se),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Se,a),codeText:i(Te,a),codeTextData:_,data:_,codeFlowValue:_,definition:i(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Fe),hardBreakEscape:i(we),hardBreakTrailing:i(we),htmlFlow:i(je,a),htmlFlowData:_,htmlText:i(je,a),htmlTextData:_,image:i(De),label:a,link:i(Be),listItem:i(Ue),listItemValue:g,listOrdered:i(tt,h),listUnordered:i(tt),paragraph:i(it),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(oe),strong:i(xt),thematicBreak:i(st)},exit:{atxHeading:u(),atxHeadingSequence:D,autolink:u(),autolinkEmail:de,autolinkProtocol:ne,blockQuote:u(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:Z,characterReference:ae,codeFenced:u(b),codeFencedFence:v,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:U,codeIndented:u(j),codeText:u(L),codeTextData:U,data:U,definition:u(),definitionDestinationString:C,definitionLabelString:N,definitionTitleString:S,emphasis:u(),hardBreakEscape:u(V),hardBreakTrailing:u(V),htmlFlow:u(O),htmlFlowData:U,htmlText:u(P),htmlTextData:U,image:u(q),label:W,labelText:z,lineEnding:I,link:u(B),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:Q,resourceDestinationString:M,resourceTitleString:F,resource:G,setextHeading:u($),setextHeadingLineSequence:R,setextHeadingText:T,strong:u(),thematicBreak:u()}};RP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let xe={type:"root",children:[]};const Le={stack:[xe],tokenStack:[],config:t,enter:l,exit:f,buffer:a,resume:p,data:n},Ve=[];let Ke=-1;for(;++Ke<ce.length;)if(ce[Ke][1].type==="listOrdered"||ce[Ke][1].type==="listUnordered")if(ce[Ke][0]==="enter")Ve.push(Ke);else{const ct=Ve.pop();Ke=o(ce,ct,Ke)}for(Ke=-1;++Ke<ce.length;){const ct=t[ce[Ke][0]];TP.call(ct,ce[Ke][1].type)&&ct[ce[Ke][1].type].call(Object.assign({sliceSerialize:ce[Ke][2].sliceSerialize},Le),ce[Ke][1])}if(Le.tokenStack.length>0){const ct=Le.tokenStack[Le.tokenStack.length-1];(ct[1]||eN).call(Le,void 0,ct[0])}for(xe.position={start:li(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:li(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},Ke=-1;++Ke<t.transforms.length;)xe=t.transforms[Ke](xe)||xe;return xe}function o(ce,xe,Le){let Ve=xe-1,Ke=-1,ct=!1,le,re,pe,Re;for(;++Ve<=Le;){const We=ce[Ve];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?Ke++:Ke--,Re=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(le&&!Re&&!Ke&&!pe&&(pe=Ve),Re=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Re=void 0}if(!Ke&&We[0]==="enter"&&We[1].type==="listItemPrefix"||Ke===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(le){let X=Ve;for(re=void 0;X--;){const be=ce[X];if(be[1].type==="lineEnding"||be[1].type==="lineEndingBlank"){if(be[0]==="exit")continue;re&&(ce[re][1].type="lineEndingBlank",ct=!0),be[1].type="lineEnding",re=X}else if(!(be[1].type==="linePrefix"||be[1].type==="blockQuotePrefix"||be[1].type==="blockQuotePrefixWhitespace"||be[1].type==="blockQuoteMarker"||be[1].type==="listItemIndent"))break}pe&&(!re||pe<re)&&(le._spread=!0),le.end=Object.assign({},re?ce[re][1].start:We[1].end),ce.splice(re||Ve,0,["exit",le,We[2]]),Ve++,Le++}if(We[1].type==="listItemPrefix"){const X={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};le=X,ce.splice(Ve,0,["enter",X,We[2]]),Ve++,Le++,pe=void 0,Re=!0}}}return ce[xe][1]._spread=ct,Le}function i(ce,xe){return Le;function Le(Ve){l.call(this,ce(Ve),Ve),xe&&xe.call(this,Ve)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ce,xe,Le){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([xe,Le||void 0]),ce.position={start:li(xe.start),end:void 0}}function u(ce){return xe;function xe(Le){ce&&ce.call(this,Le),f.call(this,Le)}}function f(ce,xe){const Le=this.stack.pop(),Ve=this.tokenStack.pop();if(Ve)Ve[0].type!==ce.type&&(xe?xe.call(this,ce,Ve[0]):(Ve[1]||eN).call(this,ce,Ve[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Uu({start:ce.start,end:ce.end})+"): it’s not open");Le.position.end=li(ce.end)}function p(){return hV(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ce){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=ce}function k(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=ce}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce.replace(/(\r?\n|\r)$/g,"")}function N(ce){const xe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=xe,Le.identifier=Hl(this.sliceSerialize(ce)).toLowerCase()}function S(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ce}function C(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ce}function D(ce){const xe=this.stack[this.stack.length-1];if(!xe.depth){const Le=this.sliceSerialize(ce).length;xe.depth=Le}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function R(ce){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function _(ce){const Le=this.stack[this.stack.length-1].children;let Ve=Le[Le.length-1];(!Ve||Ve.type!=="text")&&(Ve=at(),Ve.position={start:li(ce.start),end:void 0},Le.push(Ve)),this.stack.push(Ve)}function U(ce){const xe=this.stack.pop();xe.value+=this.sliceSerialize(ce),xe.position.end=li(ce.end)}function I(ce){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=xe.children[xe.children.length-1];Le.position.end=li(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(_.call(this,ce),U.call(this,ce))}function V(){this.data.atHardBreak=!0}function O(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function P(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function L(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.value=ce}function B(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=xe,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function q(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=xe,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function z(ce){const xe=this.sliceSerialize(ce),Le=this.stack[this.stack.length-2];Le.label=pq(xe),Le.identifier=Hl(xe).toLowerCase()}function W(){const ce=this.stack[this.stack.length-1],xe=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const Ve=ce.children;Le.children=Ve}else Le.alt=xe}function M(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.url=ce}function F(){const ce=this.resume(),xe=this.stack[this.stack.length-1];xe.title=ce}function G(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function Q(ce){const xe=this.resume(),Le=this.stack[this.stack.length-1];Le.label=xe,Le.identifier=Hl(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function te(ce){this.data.characterReferenceType=ce.type}function Z(ce){const xe=this.sliceSerialize(ce),Le=this.data.characterReferenceType;let Ve;Le?(Ve=yP(xe,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ve=Kw(xe);const Ke=this.stack[this.stack.length-1];Ke.value+=Ve}function ae(ce){const xe=this.stack.pop();xe.position.end=li(ce.end)}function ne(ce){U.call(this,ce);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(ce)}function de(ce){U.call(this,ce);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(ce)}function ye(){return{type:"blockquote",children:[]}}function Se(){return{type:"code",lang:null,meta:null,value:""}}function Te(){return{type:"inlineCode",value:""}}function ke(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Fe(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function je(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function Be(){return{type:"link",title:null,url:"",children:[]}}function tt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Ue(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function it(){return{type:"paragraph",children:[]}}function xt(){return{type:"strong",children:[]}}function at(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function li(e){return{line:e.line,column:e.column,offset:e.offset}}function RP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?RP(e,r):xq(e,r)}}function xq(e,t){let n;for(n in t)if(TP.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function eN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Uu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Uu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Uu({start:t.start,end:t.end})+") is still open")}function yq(e){const t=this;t.parser=n;function n(r){return mq(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function bq(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 vq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
594
+ `}]}function wq(e,t){const n=t.value?t.value+`
595
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,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 jq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Sq(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Cc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,u);const f={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(t,f),e.applyData(t,f)}function Nq(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 Cq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function AP(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const a=o[o.length-1];return a&&a.type==="text"?a.value+=r:o.push({type:"text",value:r}),o}function Eq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AP(e,t);const o={src:Cc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function Tq(e,t){const n={src:Cc(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 r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Rq(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Aq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return AP(e,t);const o={href:Cc(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Pq(e,t){const n={href:Cc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _q(e,t,n){const r=e.all(t),o=n?Dq(n):PP(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let h;p&&p.type==="element"&&p.tagName==="p"?h=p:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(o||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
596
+ `}),p.type==="element"&&p.tagName==="p"&&!o?a.push(...p.children):a.push(p)}const u=r[r.length-1];u&&(o||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:`
597
+ `});const f={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,f),e.applyData(t,f)}function Dq(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=PP(n[r])}return t}function PP(e){const t=e.spread;return t??e.children.length>1}function $q(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const a=r[o];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.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(r,!0)};return e.patch(t,i),e.applyData(t,i)}function Iq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Lq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Oq(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),o.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Hw(t.children[1]),u=dP(t.children[t.children.length-1]);l&&u&&(a.position={start:l,end:u}),o.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function Fq(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let u=-1;const f=[];for(;++u<l;){const h=t.children[u],g={},y=a?a[u]:void 0;y&&(g.align=y);let k={type:"element",tagName:i,properties:g,children:[]};h&&(k.children=e.all(h),e.patch(h,k),k=e.applyData(h,k)),f.push(k)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,p),e.applyData(t,p)}function zq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const tN=9,nN=32;function Bq(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(rN(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(rN(t.slice(o),o>0,!1)),i.join("")}function rN(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===tN||i===nN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===tN||i===nN;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function Uq(e,t){const n={type:"text",value:Bq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Hq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Vq={blockquote:bq,break:vq,code:wq,delete:jq,emphasis:kq,footnoteReference:Sq,heading:Nq,html:Cq,imageReference:Eq,image:Tq,inlineCode:Rq,linkReference:Aq,link:Pq,listItem:_q,list:$q,paragraph:Iq,root:Mq,strong:Lq,table:Oq,tableCell:zq,tableRow:Fq,text:Uq,thematicBreak:Hq,toml:fp,yaml:fp,definition:fp,footnoteDefinition:fp};function fp(){}const _P=-1,Mm=0,Vu=1,Sh=2,Xw=3,Qw=4,Jw=5,Zw=6,DP=7,$P=8,sN=typeof self=="object"?self:globalThis,Wq=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,a]=t[o];switch(i){case Mm:case _P:return n(a,o);case Vu:{const l=n([],o);for(const u of a)l.push(r(u));return l}case Sh:{const l=n({},o);for(const[u,f]of a)l[r(u)]=r(f);return l}case Xw:return n(new Date(a),o);case Qw:{const{source:l,flags:u}=a;return n(new RegExp(l,u),o)}case Jw:{const l=n(new Map,o);for(const[u,f]of a)l.set(r(u),r(f));return l}case Zw:{const l=n(new Set,o);for(const u of a)l.add(r(u));return l}case DP:{const{name:l,message:u}=a;return n(new sN[l](u),o)}case $P:return n(BigInt(a),o);case"BigInt":return n(Object(BigInt(a)),o);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new sN[i](a),o)};return r},oN=e=>Wq(new Map,e)(0),xl="",{toString:qq}={},{keys:Kq}=Object,yu=e=>{const t=typeof e;if(t!=="object"||!e)return[Mm,t];const n=qq.call(e).slice(8,-1);switch(n){case"Array":return[Vu,xl];case"Object":return[Sh,xl];case"Date":return[Xw,xl];case"RegExp":return[Qw,xl];case"Map":return[Jw,xl];case"Set":return[Zw,xl];case"DataView":return[Vu,n]}return n.includes("Array")?[Vu,n]:n.includes("Error")?[DP,n]:[Sh,n]},pp=([e,t])=>e===Mm&&(t==="function"||t==="symbol"),Gq=(e,t,n,r)=>{const o=(a,l)=>{const u=r.push(a)-1;return n.set(l,u),u},i=a=>{if(n.has(a))return n.get(a);let[l,u]=yu(a);switch(l){case Mm:{let p=a;switch(u){case"bigint":l=$P,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);p=null;break;case"undefined":return o([_P],a)}return o([l,p],a)}case Vu:{if(u){let g=a;return u==="DataView"?g=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(g=new Uint8Array(a)),o([u,[...g]],a)}const p=[],h=o([l,p],a);for(const g of a)p.push(i(g));return h}case Sh:{if(u)switch(u){case"BigInt":return o([u,a.toString()],a);case"Boolean":case"Number":case"String":return o([u,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],h=o([l,p],a);for(const g of Kq(a))(e||!pp(yu(a[g])))&&p.push([i(g),i(a[g])]);return h}case Xw:return o([l,a.toISOString()],a);case Qw:{const{source:p,flags:h}=a;return o([l,{source:p,flags:h}],a)}case Jw:{const p=[],h=o([l,p],a);for(const[g,y]of a)(e||!(pp(yu(g))||pp(yu(y))))&&p.push([i(g),i(y)]);return h}case Zw:{const p=[],h=o([l,p],a);for(const g of a)(e||!pp(yu(g)))&&p.push(i(g));return h}}const{message:f}=a;return o([l,{name:u,message:f}],a)};return i},iN=(e,{json:t,lossy:n}={})=>{const r=[];return Gq(!(t||n),!!t,new Map,r)(e),r},Nh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?oN(iN(e,t)):structuredClone(e):(e,t)=>oN(iN(e,t));function Yq(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 Xq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Qq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Yq,r=e.options.footnoteBackLabel||Xq,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let u=-1;for(;++u<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[u]);if(!f)continue;const p=e.all(f),h=String(f.identifier).toUpperCase(),g=Cc(h.toLowerCase());let y=0;const k=[],v=e.footnoteCounts.get(h);for(;v!==void 0&&++y<=v;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(u,y);typeof N=="string"&&(N={type:"text",value:N}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+g+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,y),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const N=b.children[b.children.length-1];N&&N.type==="text"?N.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...k)}else p.push(...k);const j={type:"element",tagName:"li",properties:{id:t+"fn-"+g},children:e.wrap(p,!0)};e.patch(f,j),l.push(j)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Nh(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
598
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
599
+ `}]}}const IP=(function(e){if(e==null)return tK;if(typeof e=="function")return Lm(e);if(typeof e=="object")return Array.isArray(e)?Jq(e):Zq(e);if(typeof e=="string")return eK(e);throw new Error("Expected function, string, or object as test")});function Jq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=IP(e[n]);return Lm(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function Zq(e){const t=e;return Lm(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function eK(e){return Lm(t);function t(n){return n&&n.type===e}}function Lm(e){return t;function t(n,r,o){return!!(nK(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function tK(){return!0}function nK(e){return e!==null&&typeof e=="object"&&"type"in e}const MP=[],rK=!0,aN=!1,sK="skip";function oK(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=IP(o),a=r?-1:1;l(e,void 0,[])();function l(u,f,p){const h=u&&typeof u=="object"?u:{};if(typeof h.type=="string"){const y=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(u.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=MP,k,v,b;if((!t||i(u,f,p[p.length-1]||void 0))&&(y=iK(n(u,p)),y[0]===aN))return y;if("children"in u&&u.children){const j=u;if(j.children&&y[0]!==sK)for(v=(r?j.children.length:-1)+a,b=p.concat(j);v>-1&&v<j.children.length;){const N=j.children[v];if(k=l(N,v,b)(),k[0]===aN)return k;v=typeof k[1]=="number"?k[1]:v+a}}return y}}}function iK(e){return Array.isArray(e)?e:typeof e=="number"?[rK,e]:e==null?MP:[e]}function LP(e,t,n,r){let o,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,o=n):(i=t,a=n,o=r),oK(e,i,l,o);function l(u,f){const p=f[f.length-1],h=p?p.children.indexOf(u):void 0;return a(u,h,p)}}const Jb={}.hasOwnProperty,aK={};function lK(e,t){const n=t||aK,r=new Map,o=new Map,i=new Map,a={...Vq,...n.handlers},l={all:f,applyData:uK,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:u,options:n,patch:cK,wrap:fK};return LP(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const h=p.type==="definition"?r:o,g=String(p.identifier).toUpperCase();h.has(g)||h.set(g,p)}}),l;function u(p,h){const g=p.type,y=l.handlers[g];if(Jb.call(l.handlers,g)&&y)return y(l,p,h);if(l.options.passThrough&&l.options.passThrough.includes(g)){if("children"in p){const{children:v,...b}=p,j=Nh(b);return j.children=l.all(p),j}return Nh(p)}return(l.options.unknownHandler||dK)(l,p,h)}function f(p){const h=[];if("children"in p){const g=p.children;let y=-1;for(;++y<g.length;){const k=l.one(g[y],p);if(k){if(y&&g[y-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=lN(k.value)),!Array.isArray(k)&&k.type==="element")){const v=k.children[0];v&&v.type==="text"&&(v.value=lN(v.value))}Array.isArray(k)?h.push(...k):h.push(k)}}}return h}}function cK(e,t){e.position&&(t.position=q9(e))}function uK(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Nh(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function dK(e,t){const n=t.data||{},r="value"in t&&!(Jb.call(n,"hProperties")||Jb.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fK(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
600
+ `});++r<e.length;)r&&n.push({type:"text",value:`
601
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
602
+ `}),n}function lN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function cN(e,t){const n=lK(e,t),r=n.one(e,void 0),o=Qq(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
603
+ `},o),i}function pK(e,t){return e&&"run"in e?async function(n,r){const o=cN(n,{file:r,...t});await e.run(o,r)}:function(n,r){return cN(n,{file:r,...e||t})}}function uN(e){if(e)throw e}var ky,dN;function hK(){if(dN)return ky;dN=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},i=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var p=e.call(f,"constructor"),h=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!p&&!h)return!1;var g;for(g in f);return typeof g>"u"||e.call(f,g)},a=function(f,p){n&&p.name==="__proto__"?n(f,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):f[p.name]=p.newValue},l=function(f,p){if(p==="__proto__")if(e.call(f,p)){if(r)return r(f,p).value}else return;return f[p]};return ky=function u(){var f,p,h,g,y,k,v=arguments[0],b=1,j=arguments.length,N=!1;for(typeof v=="boolean"&&(N=v,v=arguments[1]||{},b=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});b<j;++b)if(f=arguments[b],f!=null)for(p in f)h=l(v,p),g=l(f,p),v!==g&&(N&&g&&(i(g)||(y=o(g)))?(y?(y=!1,k=h&&o(h)?h:[]):k=h&&i(h)?h:{},a(v,{name:p,newValue:u(N,k,g)})):typeof g<"u"&&a(v,{name:p,newValue:g}));return v},ky}var mK=hK();const Sy=kd(mK);function Zb(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 gK(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...o);function l(u,...f){const p=e[++i];let h=-1;if(u){a(u);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,p?xK(p,l)(...f):a(null,...f)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function xK(e,t){let n;return r;function r(...a){const l=e.length>a.length;let u;l&&a.push(o);try{u=e.apply(this,a)}catch(f){const p=f;if(l&&n)throw p;return o(p)}l||(u&&u.then&&typeof u.then=="function"?u.then(i,o):u instanceof Error?o(u):i(u))}function o(a,...l){n||(n=!0,t(a,...l))}function i(a){o(null,a)}}const Bs={basename:yK,dirname:bK,extname:vK,join:wK,sep:"/"};function yK(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Wd(e);let n=0,r=-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 r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function bK(e){if(Wd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function vK(e){Wd(e);let t=e.length,n=-1,r=0,o=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===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===r+1?"":e.slice(o,n)}function wK(...e){let t=-1,n;for(;++t<e.length;)Wd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":jK(n)}function jK(e){Wd(e);const t=e.codePointAt(0)===47;let n=kK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function kK(e,t){let n="",r=0,o=-1,i=0,a=-1,l,u;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),o=a,i=0;continue}}else if(n.length>0){n="",r=0,o=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function Wd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const SK={cwd:NK};function NK(){return"/"}function ev(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function CK(e){if(typeof e=="string")e=new URL(e);else if(!ev(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 EK(e)}function EK(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===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 Ny=["history","path","basename","stem","extname","dirname"];class OP{constructor(t){let n;t?ev(t)?n={path:t}:typeof t=="string"||TK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":SK.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ny.length;){const i=Ny[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Ny.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Bs.basename(this.path):void 0}set basename(t){Ey(t,"basename"),Cy(t,"basename"),this.path=Bs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Bs.dirname(this.path):void 0}set dirname(t){fN(this.basename,"dirname"),this.path=Bs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Bs.extname(this.path):void 0}set extname(t){if(Cy(t,"extname"),fN(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Bs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ev(t)&&(t=CK(t)),Ey(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Bs.basename(this.path,this.extname):void 0}set stem(t){Ey(t,"stem"),Cy(t,"stem"),this.path=Bs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new nr(t,n,r);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 Cy(e,t){if(e&&e.includes(Bs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Bs.sep+"`")}function Ey(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function fN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function TK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const RK=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),AK={}.hasOwnProperty;class e0 extends RK{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=gK()}copy(){const t=new e0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Sy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ay("data",this.frozen),this.namespace[t]=n,this):AK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ay("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,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=hp(t),r=this.parser||this.Parser;return Ty("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ty("process",this.parser||this.Parser),Ry("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const l=hp(t),u=r.parse(l);r.run(u,l,function(p,h,g){if(p||!h||!g)return f(p);const y=h,k=r.stringify(y,g);DK(k)?g.value=k:g.result=k,f(p,g)});function f(p,h){p||!h?a(p):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ty("processSync",this.parser||this.Parser),Ry("processSync",this.compiler||this.Compiler),this.process(t,o),hN("processSync","process",n),r;function o(i,a){n=!0,uN(i),r=a}}run(t,n,r){pN(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const u=hp(n);o.run(t,u,f);function f(p,h,g){const y=h||t;p?l(p):a?a(y):r(void 0,y,g)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),hN("runSync","run",r),o;function i(a,l){uN(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=hp(n),o=this.compiler||this.Compiler;return Ry("stringify",o),pN(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Ay("use",this.frozen),t!=null)if(typeof t=="function")u(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(f){if(typeof f=="function")u(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...h]=f;u(p,h)}else a(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function a(f){if(!("plugins"in f)&&!("settings"in f))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");l(f.plugins),f.settings&&(o.settings=Sy(!0,o.settings,f.settings))}function l(f){let p=-1;if(f!=null)if(Array.isArray(f))for(;++p<f.length;){const h=f[p];i(h)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function u(f,p){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===f){g=h;break}if(g===-1)r.push([f,...p]);else if(p.length>0){let[y,...k]=p;const v=r[g][1];Zb(v)&&Zb(y)&&(y=Sy(!0,v,y)),r[g]=[f,y,...k]}}}}const PK=new e0().freeze();function Ty(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ry(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ay(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 pN(e){if(!Zb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hp(e){return _K(e)?e:new OP(e)}function _K(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function DK(e){return typeof e=="string"||$K(e)}function $K(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const IK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",mN=[],gN={allowDangerousHtml:!0},MK=/^(https?|ircs?|mailto|xmpp)$/i,LK=[{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 OK(e){const t=FK(e),n=zK(e);return BK(t.runSync(t.parse(n),n),e)}function FK(e){const t=e.rehypePlugins||mN,n=e.remarkPlugins||mN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...gN}:gN;return PK().use(yq).use(n).use(pK,r).use(t)}function zK(e){const t=e.children||"",n=new OP;return typeof t=="string"&&(n.value=t),n}function BK(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,u=t.urlTransform||UK;for(const p of LK)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+IK+p.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),LP(e,f),Q9(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function f(p,h,g){if(p.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:p.value},h;if(p.type==="element"){let y;for(y in vy)if(Object.hasOwn(vy,y)&&Object.hasOwn(p.properties,y)){const k=p.properties[y],v=vy[y];(v===null||v.includes(p.tagName))&&(p.properties[y]=u(String(k||""),y,p))}}if(p.type==="element"){let y=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!y&&r&&typeof h=="number"&&(y=!r(p,h,g)),y&&g&&typeof h=="number")return l&&p.children?g.children.splice(h,1,...p.children):g.children.splice(h,1),h}}}function UK(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||MK.test(e.slice(0,t))?e:""}function yl(e){return e.trim().toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function vo(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(vo).join(""):m.isValidElement(e)?vo(e.props.children):m.Children.toArray(e).map(vo).join("")}const HK={h1:({children:e,...t})=>s.jsx("h1",{id:yl(vo(e)),...t,children:e}),h2:({children:e,...t})=>s.jsx("h2",{id:yl(vo(e)),...t,children:e}),h3:({children:e,...t})=>s.jsx("h3",{id:yl(vo(e)),...t,children:e}),h4:({children:e,...t})=>s.jsx("h4",{id:yl(vo(e)),...t,children:e}),h5:({children:e,...t})=>s.jsx("h5",{id:yl(vo(e)),...t,children:e}),h6:({children:e,...t})=>s.jsx("h6",{id:yl(vo(e)),...t,children:e})};function xn({content:e,className:t,emptyState:n="No markdown content yet."}){const r=e.replace(/<!--[\s\S]*?-->/g,"");return r.trim()?s.jsx("div",{className:Ne("prose-syntaur max-w-none",t),children:s.jsx(OK,{components:HK,children:r})}):s.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 rs(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function VK(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{if(e)try{const u=await fetch(rs(e));if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),gc(u=>{u.type==="todos-updated"&&u.projectSlug===e&&l()}),{data:t,loading:r,error:i,refetch:l}}async function WK(e,t,n){await Aa(rs(e),{description:t,tags:n})}async function qK(e,t,n){await Aa(`${rs(e)}/${t}/complete`,{summary:"Completed."})}async function KK(e,t,n){await Aa(`${rs(e)}/${t}/block`,{reason:n})}async function GK(e,t,n){await Aa(`${rs(e)}/${t}/start`,{session:n})}async function YK(e,t){await Aa(`${rs(e)}/${t}/reopen`,{})}async function XK(e,t){await eG(`${rs(e)}/${t}`)}async function QK(e,t,n){const r=await fetch(`${rs(e)}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:n})});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}function FP(e,t,n){return`${rs(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function JK(e,t,n){for(const r of n){const o=await fetch(`${rs(e)}/${t}/attachments`,{method:"POST",headers:{"Content-Type":"application/octet-stream","x-attachment-filename":encodeURIComponent(r.name||"file"),"x-attachment-mime":r.type||"application/octet-stream"},body:r});if(!o.ok)throw new Error(await o.text().catch(()=>"")||`HTTP ${o.status}`)}}async function ZK(e,t,n){const r=await fetch(FP(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function Aa(e,t){const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.text().catch(()=>"");let o=null;try{o=r?JSON.parse(r):null}catch{}const i=(o==null?void 0:o.error)||r||`HTTP ${n.status}`,a=new Error(i);throw a.status=n.status,a}return n.json().catch(()=>({}))}async function eG(e){const t=await fetch(e,{method:"DELETE"});if(!t.ok){const n=await t.text().catch(()=>"");let r=null;try{r=n?JSON.parse(n):null}catch{}const o=(r==null?void 0:r.error)||n||`HTTP ${t.status}`,i=new Error(o);throw i.status=t.status,i}}async function tG(e,t){return await Aa(`${rs(e)}/promote`,t)}async function nG(e,t,n){await Aa(`${rs(e)}/${t}/move`,{to:n})}const xN=[{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 zP({status:e,onChange:t}){const[n,r]=m.useState(!1),o=m.useRef(null);m.useEffect(()=>{if(!n)return;function a(l){o.current&&!o.current.contains(l.target)&&r(!1)}return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]);const i=xN.find(a=>a.value===e);return s.jsxs("div",{className:"relative",ref:o,onClick:a=>a.stopPropagation(),children:[s.jsx("button",{onClick:()=>r(!n),className:`text-lg leading-none ${i.color} hover:opacity-70 transition`,title:i.label,children:i.icon}),n&&s.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:xN.filter(a=>a.value!==e).map(a=>s.jsxs("button",{onClick:()=>{t(a.value),r(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-sm hover:bg-foreground/5 transition ${a.color}`,children:[s.jsx("span",{className:"text-base leading-none",children:a.icon}),s.jsx("span",{children:a.label})]},a.value))})]})}function BP({item:e,copiedId:t,selected:n,editing:r,onBeginEdit:o,onEndEdit:i,onPatchDescription:a,onAddAttachments:l,onDeleteAttachment:u,attachmentUrl:f,onToggleSelected:p,onMoveOne:h,onStatusChange:g,onCopyId:y,onDelete:k,hotkeyRowProps:v,onDragOrigin:b,onDragStart:j,onDragEnd:N,isDragging:S}){return s.jsxs("div",{draggable:!0,"data-todo-id":e.id,...v??{},onMouseDown:b,onDragStart:C=>j(C,e.id),onDragEnd:N,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:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${e.id}`,title:"Select",checked:n,onChange:C=>p(e.id,C),onClick:C=>C.stopPropagation(),className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),s.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(zP,{status:e.status,onChange:C=>g(e.id,C)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[s.jsx(UP,{description:e.description,status:e.status,editing:r,onBeginEdit:()=>o(e.id),onEndEdit:i,onSave:C=>a(e.id,C)}),e.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:e.tags.map(C=>`#${C}`).join(" ")}),e.session&&s.jsxs("span",{className:"text-xs text-info-foreground/70 font-mono",children:["session:",e.session.slice(0,8)]}),s.jsx(aG,{item:e})]}),s.jsx(HP,{item:e,attachmentUrl:f,onAdd:C=>l(e.id,C),onDelete:C=>u(e.id,C)})]}),t===e.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(zr,{className:"h-3 w-3"})," Copied to clipboard"]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-no-drag":!0,className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:C=>y(C,e.id),children:["t:",e.id]}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:C=>y(C,e.id),children:s.jsx(rh,{className:"h-3 w-3"})}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-foreground transition",title:"Move to...",onClick:C=>h(e.id,C),children:s.jsx(qh,{className:"h-3 w-3"})}),s.jsx("button",{"data-no-drag":!0,className:"text-muted-foreground/40 hover:text-destructive transition",title:"Delete todo",onClick:C=>k(C,e.id,e.description),children:s.jsx(bn,{className:"h-3 w-3"})})]})]})}function UP({description:e,status:t,editing:n,onBeginEdit:r,onEndEdit:o,onSave:i}){return n?s.jsx(rG,{initialValue:e,onSave:i,onExit:o}):s.jsx("button",{type:"button","data-no-drag":!0,onClick:a=>{a.stopPropagation(),r()},title:"Click to edit",className:Ne("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 rG({initialValue:e,onSave:t,onExit:n}){const r=m.useRef(e),[o,i]=m.useState(e),[a,l]=m.useState(!1),[u,f]=m.useState(!1),p=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{const v=p.current;v&&(v.focus(),v.select())},[]);const g=m.useCallback(()=>{var v;f(!0),window.setTimeout(()=>f(!1),260),(v=p.current)==null||v.focus()},[]),y=m.useCallback(async()=>{var b;if(h.current)return;const v=o.trim();if(v.length===0){g();return}if(v===r.current){n();return}h.current=!0,l(!0);try{await t(v),n()}catch{l(!1),h.current=!1,(b=p.current)==null||b.focus()}},[o,n,t,g]);function k(v){v.key==="Enter"?(v.preventDefault(),y()):v.key==="Escape"&&(v.preventDefault(),h.current=!0,n())}return s.jsx("input",{ref:p,type:"text","data-no-drag":!0,disabled:a,value:o,onClick:v=>v.stopPropagation(),onChange:v=>i(v.target.value),onKeyDown:k,onBlur:()=>void y(),className:Ne("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",u&&"syntaur-input-shake",a&&"opacity-70")})}function sG(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function oG(e){const t=e.clipboardData,n=[];if(t.files&&t.files.length&&n.push(...Array.from(t.files)),!n.length&&t.items){for(const r of Array.from(t.items))if(r.kind==="file"){const o=r.getAsFile();o&&n.push(o)}}return n}function HP({item:e,attachmentUrl:t,onAdd:n,onDelete:r}){const o=e.attachments??[],[i,a]=m.useState(!1),[l,u]=m.useState(!1),f=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{var g;i&&((g=p.current)==null||g.focus())},[i]);const h=m.useCallback(async g=>{if(g.length){u(!0);try{await n(g),a(!1)}finally{u(!1)}}},[n]);return s.jsxs("div",{className:"mt-1","data-no-drag":!0,onClick:g=>g.stopPropagation(),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(g=>s.jsx(iG,{att:g,url:t(e.id,g.id),onDelete:()=>void r(g.id)},g.id)),s.jsxs("button",{type:"button","data-no-drag":!0,title:"Attach files",onClick:()=>a(g=>!g),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:[s.jsx(e2,{className:"h-3 w-3"}),o.length===0?"Attach":""]})]}),i&&s.jsxs("div",{ref:p,"data-no-drag":!0,tabIndex:0,role:"button","aria-label":"Add attachments: drop, paste, or click",onPaste:g=>{const y=oG(g);y.length&&(g.preventDefault(),h(y))},onDragOver:g=>{Array.from(g.dataTransfer.types).includes("Files")&&g.preventDefault()},onDrop:g=>{const y=Array.from(g.dataTransfer.files);y.length&&(g.preventDefault(),h(y))},onClick:()=>{var g;return(g=f.current)==null?void 0:g.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:[l?"Uploading…":"Drop, paste (⌘V / Ctrl+V), or click to add files",s.jsx("input",{ref:f,type:"file",multiple:!0,className:"hidden",onChange:g=>{const y=Array.from(g.target.files??[]);g.target.value="",h(y)}})]})]})}function iG({att:e,url:t,onDelete:n}){return s.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:[sG(e.mime)?s.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:e.filename,children:s.jsx("img",{src:t,alt:e.filename,className:"h-6 w-6 rounded object-cover"})}):s.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-foreground hover:text-primary",children:[s.jsx(e2,{className:"h-3 w-3"}),s.jsx("span",{className:"block max-w-[160px] truncate",children:e.filename})]}),s.jsx("button",{type:"button",title:"Remove attachment",onClick:n,className:"text-muted-foreground/60 hover:text-destructive transition",children:s.jsx(Td,{className:"h-3 w-3"})})]})}function aG({item:e}){return!(e.branch||e.planDir||e.worktreePath||e.createdAt||e.updatedAt)?null:s.jsxs("span",{className:"inline-flex items-center gap-1 align-middle",children:[e.branch?s.jsx(pa,{delayDuration:120,children:s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.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:[s.jsx(Dv,{className:"h-2.5 w-2.5"}),s.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),s.jsx(gr,{children:e.branch})]})}):null,e.planDir?s.jsx(pa,{delayDuration:120,children:s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Ud(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:s.jsx(JE,{className:"h-2.5 w-2.5"})})}),s.jsxs(gr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?s.jsx(pa,{delayDuration:120,children:s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),s.jsx(gr,{children:s.jsxs("div",{className:"space-y-0.5 text-xs font-mono",children:[e.worktreePath?s.jsxs("div",{children:["worktree: ",e.worktreePath]}):null,e.createdAt?s.jsxs("div",{children:["created: ",e.createdAt]}):null,e.updatedAt?s.jsxs("div",{children:["updated: ",e.updatedAt]}):null]})})]})}):null]})}const VP="__one_off__";function t0({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o,defaultProject:i,defaultTitle:a,allowOneOff:l=!0}){const[u,f]=m.useState("new"),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,v]=m.useState(null),[b,j]=m.useState(null),[N,S]=m.useState(""),[C,D]=m.useState(""),[T,R]=m.useState(""),[$,_]=m.useState(""),[U,I]=m.useState(""),[V,O]=m.useState(""),[P,L]=m.useState(null),[B,q]=m.useState(!1),z=t.length>1;m.useEffect(()=>{if(!e){f("new"),y(null),S(""),D(""),R(""),_(""),I(""),O(""),L(null);return}S(i??""),D(a??"");let Q=!1;return(async()=>{try{const te=await fetch("/api/projects");if(!te.ok)throw new Error(`HTTP ${te.status}`);const Z=await te.json();Q||v(Z.filter(ae=>!ae.archived))}catch(te){Q||j(te instanceof Error?te.message:String(te))}})(),()=>{Q=!0}},[e,i,a]),m.useEffect(()=>{if(!U){L(null);return}let Q=!1;return q(!0),(async()=>{try{const te=await fetch(`/api/projects/${encodeURIComponent(U)}/assignments`);if(!te.ok)throw new Error(`HTTP ${te.status}`);const Z=await te.json();Q||L(Z)}catch{Q||L([])}finally{Q||q(!1)}})(),()=>{Q=!0}},[U]);const W=m.useMemo(()=>k??[],[k]);async function M(Q){if(Q.preventDefault(),!N){y('Pick a target project (or "One-off").');return}if(z&&!C.trim()){y("Title is required when promoting multiple todos.");return}const te=N===VP?{oneOff:!0}:{project:N};if(n.kind==="aggregate"){const ae={groups:n.groups,mode:"new-assignment",target:te,title:C.trim()||void 0,type:T.trim()||void 0,priority:$||void 0};await H(ae);return}const Z={todoIds:t,mode:"new-assignment",target:te,title:C.trim()||void 0,type:T.trim()||void 0,priority:$||void 0};await G(Z)}async function F(Q){if(Q.preventDefault(),n.kind==="aggregate"){y("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!U||!V){y("Pick both project and assignment.");return}const te={todoIds:t,mode:"to-assignment",target:{assignment:`${U}/${V}`}};await G(te)}async function G(Q){h(!0),y(null);try{let te;if(n.kind==="workspace")te=await LO(n.workspace,Q);else if(n.kind==="project")te=await tG(n.projectId,Q);else throw new Error("Aggregate scope requires runBulkMutation.");o(te),r(!1)}catch(te){y(te instanceof Error?te.message:String(te))}finally{h(!1)}}async function H(Q){h(!0),y(null);try{const te=await OO(Q);o(te),r(!1)}catch(te){y(te instanceof Error?te.message:String(te))}finally{h(!1)}}return s.jsx(Ln,{open:e,onOpenChange:Q=>p?void 0:r(Q),children:s.jsxs(jn,{className:"max-w-xl",children:[s.jsxs(tr,{children:[s.jsxs(kn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(ns,{children:["Convert the selected todo",t.length===1?"":"s"," to a new or existing assignment. Source todo",t.length===1?"":"s"," will be marked ",s.jsx("strong",{children:"in progress"})," and linked to the new assignment (auto-completed when the assignment closes)."]})]}),s.jsxs(nP,{value:u,onValueChange:Q=>f(Q),children:[s.jsxs(rP,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[s.jsx(Hb,{value:"new",className:Ne("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"}),s.jsx(Hb,{value:"existing",className:Ne("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"})]}),s.jsx(Vb,{value:"new",children:s.jsxs("form",{onSubmit:M,className:"space-y-4",children:[s.jsx(bl,{label:"Target project",children:s.jsx(yN,{value:N,onChange:S,projects:W,error:b,disabled:p,allowOneOff:l})}),s.jsx(bl,{label:z?"Title (required)":"Title (defaults to first todo)",children:s.jsx("input",{type:"text",value:C,onChange:Q=>D(Q.target.value),disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(bl,{label:"Type",children:s.jsx("input",{type:"text",value:T,onChange:Q=>R(Q.target.value),placeholder:"feature",disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsx(bl,{label:"Priority",children:s.jsxs("select",{value:$,onChange:Q=>_(Q.target.value),disabled:p,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"—"}),s.jsx("option",{value:"low",children:"low"}),s.jsx("option",{value:"medium",children:"medium"}),s.jsx("option",{value:"high",children:"high"}),s.jsx("option",{value:"critical",children:"critical"})]})})]}),g?s.jsx(bN,{message:g}):null,s.jsx(vN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})}),s.jsx(Vb,{value:"existing",children:s.jsxs("form",{onSubmit:F,className:"space-y-4",children:[s.jsx(bl,{label:"Project",children:s.jsx(yN,{value:U,onChange:Q=>{I(Q),O("")},projects:W,error:b,disabled:p})}),s.jsx(bl,{label:B?"Assignment (loading...)":"Assignment",children:s.jsxs("select",{value:V,onChange:Q=>O(Q.target.value),disabled:p||!U||B,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:U?"Select assignment...":"Pick a project first"}),(P??[]).map(Q=>s.jsxs("option",{value:Q.slug,children:[Q.title," (",Q.status,")"]},Q.slug))]})}),g?s.jsx(bN,{message:g}):null,s.jsx(vN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})})]})]})})}function bl({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function yN({value:e,onChange:t,projects:n,error:r,disabled:o,allowOneOff:i}){return r?s.jsxs("div",{className:"text-sm text-destructive",children:["Failed to load projects: ",r]}):s.jsxs("select",{value:e,onChange:a=>t(a.target.value),disabled:o,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"Select project..."}),i?s.jsx("option",{value:VP,children:"One-off (no project)"}):null,n.map(a=>s.jsxs("option",{value:a.slug,children:[a.title," (",a.slug,")"]},a.slug))]})}function bN({message:e}){return s.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function vN({onCancel:e,submitting:t,submitLabel:n}){return s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:e,disabled:t,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:t,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:t?"Submitting...":n})]})}function WP({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o}){const[i,a]=m.useState("project"),[l,u]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(!1),[y,k]=m.useState(null),[v,b]=m.useState(null),[j,N]=m.useState(null);m.useEffect(()=>{if(!e){a("project"),u(""),p(""),k(null),b(null);return}let R=!1;return(async()=>{try{const $=await fetch("/api/projects");if(!$.ok)throw new Error(`HTTP ${$.status}`);const _=await $.json();R||N(_.filter(U=>!U.archived))}catch($){R||b($ instanceof Error?$.message:String($))}})(),()=>{R=!0}},[e]);const S=m.useMemo(()=>j?n.kind==="project"?j.filter(R=>R.slug!==n.projectId):j:[],[j,n]);function C(){if(i==="global")return{global:!0};if(i==="workspace"){const R=l.trim();return R?{workspace:R}:"Workspace name is required."}return f?{project:f}:"Pick a target project."}async function D(R,$){try{return n.kind==="workspace"?await FO(n.workspace,R,$):await nG(n.projectId,R,$),{ok:!0}}catch(_){return{ok:!1,error:_ instanceof Error?_.message:String(_)}}}async function T(R){R.preventDefault(),b(null);const $=C();if(typeof $=="string"){b($);return}g(!0),k(null);const _=[],U=[];for(const I of t){const V=await D(I,$);V.ok?_.push(I):U.push({id:I,error:V.error})}g(!1),o(),U.length===0?r(!1):k({succeeded:_,failed:U})}return s.jsx(Ln,{open:e,onOpenChange:R=>h?void 0:r(R),children:s.jsx(jn,{className:"max-w-xl",children:s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsxs(tr,{children:[s.jsxs(kn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(ns,{children:["Move the selected todo",t.length===1?"":"s"," to a different scope. id, tags, branch, timestamps, and plan dir are preserved."]})]}),s.jsxs("fieldset",{className:"space-y-2",disabled:h,children:[s.jsx("legend",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground mb-1",children:"Target scope"}),s.jsx(Py,{kind:"project",checked:i==="project",onChange:()=>a("project"),label:"Project"}),s.jsx(Py,{kind:"workspace",checked:i==="workspace",onChange:()=>a("workspace"),label:"Workspace"}),s.jsx(Py,{kind:"global",checked:i==="global",onChange:()=>a("global"),label:"Global"})]}),i==="project"?s.jsx(wN,{label:"Target project",children:s.jsxs("select",{value:f,onChange:R=>p(R.target.value),disabled:h,className:"editor-textarea w-full bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:"Select project..."}),S.map(R=>s.jsxs("option",{value:R.slug,children:[R.title," (",R.slug,")"]},R.slug))]})}):null,i==="workspace"?s.jsx(wN,{label:"Target workspace name",children:s.jsx("input",{type:"text",value:l,onChange:R=>u(R.target.value),disabled:h,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,v?s.jsx(lG,{message:v}):null,y?s.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:[s.jsxs("div",{className:"font-medium",children:["Moved ",y.succeeded.length," of ",t.length,"; ",y.failed.length," failed."]}),s.jsx("ul",{className:"text-xs space-y-0.5",children:y.failed.map(R=>s.jsxs("li",{children:["[t:",R.id,"] ",R.error]},R.id))})]}):null,s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:()=>r(!1),disabled:h,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:y?"Close":"Cancel"}),y===null?s.jsx("button",{type:"submit",disabled:h,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:h?"Moving...":"Move"}):null]})]})})})}function wN({label:e,children:t}){return s.jsxs("label",{className:"block space-y-1.5",children:[s.jsx("span",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),t]})}function Py({kind:e,checked:t,onChange:n,label:r}){return s.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[s.jsx("input",{type:"radio",name:"move-target-kind",value:e,checked:t,onChange:n}),s.jsx("span",{children:r})]})}function lG({message:e}){return s.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:e})}function n0({label:e,count:t,expanded:n,onToggle:r,isDropTarget:o=!1,onDragOver:i,onDragLeave:a,onDrop:l,children:u}){return s.jsxs("div",{className:Ne("rounded-lg border border-border/60 bg-card/40 transition",o&&"ring-2 ring-ring/30"),onDragOver:i,onDragLeave:a,onDrop:l,children:[s.jsxs("button",{type:"button",onClick:r,"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-2.5 text-left",children:[s.jsx(vr,{className:Ne("h-4 w-4 text-muted-foreground transition-transform",!n&&"-rotate-90")}),s.jsx("span",{className:"font-semibold text-foreground",children:e}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:t})]}),n&&s.jsx("div",{className:"space-y-1 px-2 pb-2",children:u})]})}const qP=[{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 Om(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function r0(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Om(n.status)].push(n);return qP.map(n=>({config:n,items:t[n.id]}))}const KP="syntaur.todos.sections.collapsed.v1",jN=Object.fromEntries(qP.map(e=>[e.id,e.defaultCollapsed]));function _y(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(KP);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function cG(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(KP,JSON.stringify(e))}catch{}}function s0(e){const[t,n]=m.useState(()=>_y()[e]??{});m.useEffect(()=>{n(_y()[e]??{})},[e]);const r=m.useCallback(i=>t[i]??jN[i],[t]),o=m.useCallback(i=>{const a=_y(),l=a[e]??{},u=l[i]??jN[i],f={...l,[i]:!u};a[e]=f,cG(a),n(f)},[e]);return{isCollapsed:r,toggle:o}}function uG({projectId:e}){var ct;const{data:t,loading:n,error:r,refetch:o}=VK(e),{toast:i,showToast:a,dismissToast:l}=wr(),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,j]=m.useState(null),[N,S]=m.useState(null),[C,D]=m.useState(new Set),[T,R]=m.useState(!1),[$,_]=m.useState(!1),[U,I]=m.useState(null),V=m.useRef(null);Ti("list:todos");const O=s0("project:"+e),[P,L]=m.useState(null),[B,q]=m.useState(null),z=m.useRef(null);async function W(le,re){le.stopPropagation(),await Ud(re)&&(j(re),setTimeout(()=>j(pe=>pe===re?null:pe),1500))}const M=m.useMemo(()=>{if(!(t!=null&&t.items))return[];const le=new Set;for(const re of t.items)for(const pe of re.tags)le.add(pe);return Array.from(le).sort()},[t]),F=m.useMemo(()=>{if(!(t!=null&&t.items))return[];let le=t.items;if(u.trim()){const re=u.toLowerCase();le=le.filter(pe=>pe.description.toLowerCase().includes(re)||pe.tags.some(Re=>Re.toLowerCase().includes(re))||pe.id.includes(re))}return p&&(le=le.filter(re=>re.status===p)),g&&(le=le.filter(re=>re.tags.includes(g))),le},[t,u,p,g]);m.useEffect(()=>{D(new Set)},[u,p,g,e]);const G=m.useMemo(()=>F.filter(le=>C.has(le.id)).length,[F,C]),H=F.length>0&&G===F.length,Q=G>0&&!H;function te(le){D(re=>{const pe=new Set(re);return pe.has(le)?pe.delete(le):pe.add(le),pe})}function Z(){D(le=>{const re=new Set(le);if(H)for(const pe of F)re.delete(pe.id);else for(const pe of F)re.add(pe.id);return re})}function ae(){D(new Set)}const ne=U?[U]:Array.from(C);function de(){D(new Set),I(null),o()}function ye(){D(new Set),o()}function Se(le){a(le instanceof Error?le.message:"Action failed","error")}async function Te(){if(k.trim())try{await WK(e,k.trim()),v(""),o()}catch(le){Se(le)}}async function ke(le,re,pe){if(le.stopPropagation(),!!window.confirm(`Delete "${pe}"? This can't be undone.`))try{await XK(e,re),o()}catch(Re){Se(Re)}}async function Fe(le,re){try{switch(re){case"open":await YK(e,le);break;case"in_progress":await GK(e,le);break;case"completed":await qK(e,le);break;case"blocked":await KK(e,le);break}o()}catch(pe){Se(pe)}}async function oe(le,re){try{await QK(e,le,re),o()}catch(pe){throw Se(pe),pe}}async function we(le,re){try{await JK(e,le,re),o()}catch(pe){Se(pe)}}async function je(le,re){try{await ZK(e,le,re),o()}catch(pe){Se(pe)}}const De=r0(F),Be=De.filter(le=>!O.isCollapsed(le.config.id)).flatMap(le=>le.items),{hotkeyRowProps:tt}=_d(Be,{scope:"list:todos",bindO:!1,onOpen:le=>S(le.id)});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var le;return(le=V.current)==null?void 0:le.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Ue,it]=Ns(),xt=Ue.get("focus");m.useEffect(()=>{if(!xt||!(t!=null&&t.items))return;const le=t.items.find(pe=>pe.id===xt);if(!le)return;const re=Om(le.status);O.isCollapsed(re)&&O.toggle(re)},[xt,t==null?void 0:t.items]),m.useEffect(()=>{if(!xt)return;const le=document.querySelector(`[data-todo-id="${window.CSS.escape(xt)}"]`);if(!le)return;le.scrollIntoView({block:"nearest"}),le.classList.add("ring-2","ring-primary/60");const re=window.setTimeout(()=>{le.classList.remove("ring-2","ring-primary/60"),it(pe=>{const Re=new URLSearchParams(pe);return Re.delete("focus"),Re},{replace:!0})},1500);return()=>window.clearTimeout(re)},[xt,Be.length,it]);const at=P?(t==null?void 0:t.items.find(le=>le.id===P))??null:null;function st(le,re){const pe=z.current;if(pe!=null&&pe.closest(Zl)){le.preventDefault();return}le.dataTransfer.effectAllowed="move",le.dataTransfer.setData("text/plain",re),L(re)}function ce(){L(null),q(null)}function xe(le,re){!at||re.statuses.includes(at.status)||(le.preventDefault(),le.dataTransfer.dropEffect="move",q(re.id))}function Le(le,re){B===re.id&&!le.currentTarget.contains(le.relatedTarget)&&q(null)}function Ve(le,re){le.preventDefault();const pe=at;ce(),!(!pe||re.statuses.includes(pe.status))&&Fe(pe.id,re.dropStatus)}if(n)return s.jsx(jt,{label:"Loading todos..."});if(r)return s.jsx(Rt,{error:r});const Ke=(t==null?void 0:t.counts)||{open:0,in_progress:0,blocked:0,total:0};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Hr,{toast:i,onDismiss:l}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Kn,{label:"Open",value:Ke.open,icon:gs}),s.jsx(Kn,{label:"In Progress",value:Ke.in_progress,icon:gs,tone:"info"}),s.jsx(Kn,{label:"Blocked",value:Ke.blocked,icon:Yh,tone:"warn"}),s.jsx(Kn,{label:"Total",value:Ke.total,icon:gs})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text","aria-label":"New todo description",placeholder:"Add a todo...",value:k,onChange:le=>v(le.target.value),onKeyDown:le=>{le.key==="Enter"&&k.trim()&&Te()},className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/80 focus:border-foreground/30 focus:outline-none"}),s.jsxs("button",{onClick:Te,disabled:!k.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:[s.jsx(It,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ni,{"aria-hidden":"true",className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:V,type:"text","aria-label":"Search todos",placeholder:"Search...",value:u,onChange:le=>f(le.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/80 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{"aria-label":"Filter by status",value:p,onChange:le=>h(le.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:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),M.length>0&&s.jsxs("select",{"aria-label":"Filter by tag",value:g,onChange:le=>y(le.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:[s.jsx("option",{value:"",children:"All tags"}),M.map(le=>s.jsxs("option",{value:le,children:["#",le]},le))]})]}),C.size>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[C.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>R(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{I(null),_(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:ae,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,F.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:H,ref:le=>{le&&(le.indeterminate=Q)},onChange:Z,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",F.length,")"]})]}),F.length===0?(((ct=t==null?void 0:t.items)==null?void 0:ct.length)??0)===0?s.jsx(Nt,{title:"No todos yet",description:"Add your first todo using the field above to start tracking work for this project."}):s.jsx(Nt,{title:"No todos match your filters",description:"No todos match the current search, status, or tag filters. Try clearing or adjusting them."}):s.jsx("div",{className:"space-y-3",children:(()=>{let le=-1;return De.map(({config:re,items:pe})=>{const Re=!O.isCollapsed(re.id);return s.jsx(n0,{label:re.label,count:pe.length,expanded:Re,onToggle:()=>O.toggle(re.id),isDropTarget:B===re.id,onDragOver:We=>xe(We,re),onDragLeave:We=>Le(We,re),onDrop:We=>Ve(We,re),children:Re&&pe.map(We=>(le+=1,s.jsx(BP,{item:We,copiedId:b,selected:C.has(We.id),editing:N===We.id,onBeginEdit:X=>S(X),onEndEdit:()=>S(null),onPatchDescription:oe,onAddAttachments:we,onDeleteAttachment:je,attachmentUrl:(X,be)=>FP(e,X,be),onToggleSelected:X=>te(X),onMoveOne:(X,be)=>{be.stopPropagation(),I(X),_(!0)},onStatusChange:Fe,onCopyId:W,onDelete:ke,hotkeyRowProps:tt(le),onDragOrigin:X=>{z.current=X.target},onDragStart:st,onDragEnd:ce,isDragging:P===We.id},We.id)))},re.id)})})()}),s.jsx(t0,{open:T,selectedIds:Array.from(C),scope:{kind:"project",projectId:e},onOpenChange:R,onDone:ye}),s.jsx(WP,{open:$,selectedIds:ne,scope:{kind:"project",projectId:e},onOpenChange:le=>{_(le),le||I(null)},onDone:de})]})}const dG={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},kN=new Set(["title"]);function GP({visibility:e,onChange:t}){const[n,r]=m.useState(!1);function o(a){if(kN.has(a))return;const u=e.hidden.includes(a)?e.hidden.filter(f=>f!==a):[...e.hidden,a];t({hidden:u})}const i=e.hidden.length;return s.jsxs(Ln,{open:n,onOpenChange:r,children:[s.jsx(QF,{asChild:!0,children:s.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:[s.jsx(ML,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsxs("span",{children:["Columns",i>0?` (${uy.length-i}/${uy.length})`:""]})]})}),s.jsxs(jn,{className:"max-w-sm",children:[s.jsx(tr,{children:s.jsx(kn,{children:"Columns"})}),s.jsx("div",{className:"space-y-2",children:uy.map(a=>{const l=e.hidden.includes(a),u=kN.has(a);return s.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${u?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[s.jsx("input",{type:"checkbox",checked:!l,onChange:()=>o(a),disabled:u,className:"h-4 w-4 rounded border-border accent-foreground"}),s.jsx("span",{children:dG[a]}),u?s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},a)})})]})]})}const Vl={...Ju,custom:!1},YP=`view-prefs.cache.v${Ju.version}`;let ud=fG(),vl=null;const dd=new Set;let XP=0;function o0(){return++XP}function i0(e){return e===XP}function fG(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(YP);if(!e)return null;const t=JSON.parse(e);return t.version!==Ju.version?null:t}catch{return null}}function pG(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(YP,JSON.stringify(e))}catch{}}function a0(e){ud=e,pG(e);for(const t of dd)t(e)}function l0(e){if(!e||typeof e!="object")return Vl;const t=e;return t.version!==Ju.version||!t.global||!t.projects?Vl:{version:Ju.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function c0(){if(vl)return vl;const e=o0();return vl=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=l0(t);return i0(e)&&a0(n),vl=null,ud??n}).catch(()=>(vl=null,ud??Vl)),vl}function QP(e){const[t,n]=m.useState(()=>ud??Vl);return m.useEffect(()=>{let r=!1;return c0().then(o=>{r||n(o)}),dd.add(n),()=>{r=!0,dd.delete(n)}},[]),ET(t,e??null)}function hG(){const[e,t]=m.useState(()=>ud??Vl);return m.useEffect(()=>{let n=!1;return c0().then(r=>{n||t(r)}),dd.add(t),()=>{n=!0,dd.delete(t)}},[]),e}async function JP(e){const t=o0(),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 r=l0(await n.json());return i0(t)&&a0(r),r}function ZP(e){return JP({global:e})}function e_(e,t){return JP({projects:{[e]:t}})}async function mG(){const e=o0(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=l0(await t.json());return i0(e)&&a0(n),n}const SN=80;function t_({open:e,onOpenChange:t,initialName:n="",onSubmit:r,title:o="Save view"}){const[i,a]=m.useState(n),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{e&&(a(n),p(null),u(!1))},[e,n]);const h=i.trim(),g=h.length>0&&h.length<=SN;return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsx(jn,{className:"max-w-md",children:s.jsxs("form",{className:"space-y-4",onSubmit:async y=>{if(y.preventDefault(),!(!g||l)){u(!0),p(null);try{await r(h)}catch(k){p(k instanceof Error?k.message:String(k)),u(!1)}}},children:[s.jsx(tr,{children:s.jsx(kn,{children:o})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:SN,onChange:y=>a(y.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"}),f?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:f}):null]}),s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:l,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!g||l,className:"shell-action shell-action--cta disabled:opacity-50",children:l?"Saving…":"Save"})]})]})})})}function n_({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:r}){const{views:o,loading:i}=Ld(),[a,l]=m.useState(!1),u=m.useRef(null);m.useEffect(()=>{if(!a)return;function g(k){u.current&&!u.current.contains(k.target)&&l(!1)}function y(k){k.key==="Escape"&&l(!1)}return document.addEventListener("mousedown",g),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",y)}},[a]);const f=m.useMemo(()=>o.filter(g=>PR(g,e)),[o,e]),p=t?o.find(g=>g.id===t)??null:null,h=i?"Saved views…":p?p.name:"Saved views";return s.jsxs("div",{className:"relative",ref:u,children:[s.jsxs("button",{type:"button",disabled:i,onClick:()=>l(g=>!g),className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background disabled:opacity-50","aria-haspopup":"true","aria-expanded":a,title:h,children:[s.jsx("span",{className:"max-w-[160px] truncate",children:h}),s.jsx(vr,{className:"h-3.5 w-3.5","aria-hidden":"true"})]}),a&&s.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:f.length===0?s.jsxs("div",{className:"px-3 py-3 text-sm text-muted-foreground",children:[s.jsx("p",{className:"mb-2",children:"No saved views yet — Save the current view to start."}),s.jsx("button",{type:"button",onClick:()=>{l(!1),r()},className:"shell-action w-full justify-center",children:"Save current view"})]}):f.map(g=>{const y=g.id===t;return s.jsxs("button",{type:"button",onClick:()=>{l(!1),n(g)},className:Ne("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:[s.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center",children:y?s.jsx(zr,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:g.name})]},g.id)})})]})}const gG=new Set(["overview","assignments","todos","dependencies","knowledge"]),NN="__unknown_type__";function CN(){const{slug:e,workspace:t}=Vt(),n=pn(),r=Ht();Ti("project"),Jt({keys:"a",scope:"project",description:"Create assignment",handler:()=>r(`${n}/projects/${e}/create/assignment`)}),Jt({keys:"e",scope:"project",description:"Edit project",handler:()=>r(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:a,refetch:l}=E2(e),u=Es(),f=Pd(),{data:p}=Na(),[h,g]=Ns(),y=h.get("tab"),k=y&&gG.has(y)?y:"overview";function v(ue){g(Ee=>{const rt=new URLSearchParams(Ee);return ue==="overview"?rt.delete("tab"):rt.set("tab",ue),rt},{replace:!0})}const b=e?`p:${e}`:null,j=QP(b),[N,S]=m.useState(()=>ry(j.defaultView)),[C,D]=m.useState(()=>qe(j.filters.status)),[T,R]=m.useState(()=>qe(j.filters.assignee)),[$,_]=m.useState(()=>qe(j.filters.priority)),[U,I]=m.useState(()=>qe(j.filters.type)),[V,O]=m.useState(()=>qe(j.filters.tags)),[P,L]=m.useState(null),[B,q]=m.useState(()=>j.grouping),[z,W]=m.useState(()=>j.sortField),[M,F]=m.useState(()=>j.sortDirection),[G,H]=m.useState(()=>({collapsed:[]})),[Q,te]=m.useState(()=>({hidden:[]})),[Z,ae]=m.useState(()=>({hidden:[]})),[ne,de]=m.useState(null),[ye,Se]=m.useState(!1),[Te,ke]=m.useState(!1),{toast:Fe,showToast:oe,dismissToast:we}=wr(),je={kind:"project",slug:e??"",workspace:t??null},De=h.get("loadView"),{view:Be,loading:tt,error:Ue}=ji(De),{view:it,loading:xt,error:at}=ji(ne),st=m.useRef(null);m.useEffect(()=>{ne&&!xt&&!at&&!it&&de(null)},[it,at,ne,xt]),m.useEffect(()=>{de(null),st.current=null,L(null)},[e,t]),m.useEffect(()=>{S(ry(j.defaultView)),D(qe(j.filters.status)),R(qe(j.filters.assignee)),_(qe(j.filters.priority)),I(qe(j.filters.type)),O(qe(j.filters.tags)),q(j.grouping),W(j.sortField),F(j.sortDirection)},[e,j.defaultView,j.filters.status,j.filters.assignee,j.filters.priority,j.filters.type,j.filters.tags,j.grouping,j.sortField,j.sortDirection]);const ce=m.useCallback(ue=>{b&&e_(b,ue).catch(Ee=>{console.warn("Failed to persist project view prefs:",Ee)})},[b]),xe=m.useCallback(ue=>{S(ue),ce({defaultView:ue})},[ce]),Le=m.useCallback(ue=>{D(ue),ce({filters:{status:ue}})},[ce]),Ve=m.useCallback(ue=>{R(ue),ce({filters:{assignee:ue}})},[ce]),Ke=m.useCallback(ue=>{_(ue),ce({filters:{priority:ue}})},[ce]),ct=m.useCallback(ue=>{I(ue),ce({filters:{type:ue}})},[ce]),le=m.useCallback(ue=>{O(ue),ce({filters:{tags:ue}})},[ce]),re=m.useCallback(ue=>{q(ue),ce({grouping:ue})},[ce]),pe=m.useCallback(ue=>{W(ue),ce({sortField:ue})},[ce]),Re=m.useCallback(ue=>{F(ue),ce({sortDirection:ue})},[ce]),We=m.useCallback(()=>({viewMode:N,filters:{status:C,priority:$,type:U,assignee:T,tags:V,project:"all",activity:"all",dateRange:ha(P)},sortField:z,sortDirection:M,listSectionVisibility:G,kanbanColumnVisibility:Q,tableColumnVisibility:Z}),[N,C,$,U,T,V,P,z,M,G,Q,Z]),X=m.useCallback(ue=>{PA(ue,{setViewMode:Ee=>S(ry(Ee)),setStatusFilter:Le,setPriorityFilter:Ke,setTypeFilter:ct,setAssigneeFilter:Ve,setTagsFilter:le,setDateRange:L,setSortField:pe,setSortDirection:Re,setListSectionVisibility:H,setKanbanColumnVisibility:te,setTableColumnVisibility:ae}),de(ue.id)},[Le,Ke,ct,Ve,le,pe,Re]),be=m.useCallback(ue=>{X(ue),st.current=ue.id,g(Ee=>{const rt=new URLSearchParams(Ee);return rt.set("loadView",ue.id),rt},{replace:!0})},[X,g]),He=m.useCallback(async ue=>{try{const Ee=ec({name:ue,context:{workspace:t??null,projectSlug:e??null},state:We()}),rt=await Xl(Ee),Tn=rt.views[rt.views.length-1];de((Tn==null?void 0:Tn.id)??null),Tn&&(st.current=Tn.id,g(kr=>{const no=new URLSearchParams(kr);return no.set("loadView",Tn.id),no},{replace:!0})),Se(!1),ke(!1),oe(`Saved view "${ue}"`,"success")}catch(Ee){throw oe(Ee instanceof Error?Ee.message:"Failed to save view","error"),Ee}},[We,g,oe,e,t]),ft=m.useCallback(async()=>{if(!(!ne||!it))try{const ue=qe(it.config.filters.project)[0]??null,Ee=ec({name:it.name,context:{workspace:t??null,projectSlug:ue},state:We()}),rt=vh(it.config,Ee.config,Ee.config);await mh(ne,{config:rt}),oe("View updated","success")}catch(ue){oe(ue instanceof Error?ue.message:"Failed to update view","error")}},[We,it,ne,oe,t]);m.useEffect(()=>{if(!De){st.current=null;return}if(st.current!==De&&(ne&&ne!==De&&de(null),!tt)){if(Ue){oe("Couldn't load saved view — try again","error");return}if(Be){if(st.current=De,!PR(Be,{kind:"project",slug:e??"",workspace:t??null})){r(DA(Be),{replace:!0});return}X(Be),g(ue=>{const Ee=new URLSearchParams(ue);return Ee.delete("loadView"),Ee},{replace:!0});return}st.current=De,oe("Saved view no longer exists","error"),g(ue=>{const Ee=new URLSearchParams(ue);return Ee.delete("loadView"),Ee},{replace:!0})}},[De,Be,tt,Ue,ne,X,g,oe,r,e,t]);function Ze(ue){z===ue?Re(M==="asc"?"desc":"asc"):(pe(ue),Re("asc"))}const yt=m.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(ue=>{const Ee=`${n}/projects/${o.slug}/assignments/${ue.slug}`;return[[ue.slug,Ee],[ue.title,Ee]]})):{},[o]),[mt,me]=m.useState(!1);async function Ce(ue){me(!0);try{const Ee=await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:ue})});if(!Ee.ok){const rt=await Ee.json().catch(()=>null);oe((rt==null?void 0:rt.error)||`HTTP ${Ee.status}`,"error");return}l(),oe(ue?"Status override set":"Status override cleared","success")}catch(Ee){oe(Ee instanceof Error?Ee.message:"Failed to update status","error")}finally{me(!1)}}async function Ge(ue){me(!0);try{const Ee=await fetch(`/api/projects/${e}/${ue?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ee.ok){const rt=await Ee.json().catch(()=>null);oe((rt==null?void 0:rt.error)||`HTTP ${Ee.status}`,"error");return}l(),oe(ue?"Project archived":"Project restored","success")}catch(Ee){oe(Ee instanceof Error?Ee.message:"Failed to update archive state","error")}finally{me(!1)}}async function Ct(ue){me(!0);try{const Ee=await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:ue})});if(!Ee.ok){const rt=await Ee.json().catch(()=>null);oe((rt==null?void 0:rt.error)||`HTTP ${Ee.status}`,"error");return}l(),oe(ue?`Moved to "${ue}"`:"Moved to ungrouped","success")}catch(Ee){oe(Ee instanceof Error?Ee.message:"Failed to move workspace","error")}finally{me(!1)}}if(i)return s.jsx(jt,{label:"Loading project workspace…"});if(a||!o)return s.jsx(Rt,{error:a||"Project not found."});const Mt=(()=>{const ue=new Set;for(const rt of o.assignments)rt.assignee&&ue.add(rt.assignee);const Ee=[{value:"__unassigned__",label:"Unassigned"}];for(const rt of Array.from(ue).sort())Ee.push({value:rt,label:rt});return Ee})(),Nn=Array.from(new Set(o.assignments.flatMap(ue=>ue.tags??[]))).sort().map(ue=>({value:ue,label:ue})),Et=o.assignments.filter(ue=>TU(ue,{status:C,priority:$,type:U,assignee:T,tags:V,dateRange:ha(P)})),Cn=zd(Et,z,M),Ft=new Set(f.definitions.map(ue=>ue.id)),En=B==="type"?[...f.definitions.map(ue=>({id:ue.id,title:Ml(f,ue.id),description:ue.description})),...Et.some(ue=>!ue.type||!Ft.has(ue.type))?[{id:NN,title:"Other",description:"Assignments with no recognized type."}]:[]]:LA(u.order).map(ue=>({id:ue,title:No(u,ue),description:Bd(ue)}));function en({field:ue,children:Ee}){const rt=z===ue;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>Ze(ue),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Ee,rt?M==="asc"?s.jsx(XE,{className:"h-3 w-3"}):s.jsx(vr,{className:"h-3 w-3"}):null]})})}return s.jsxs("div",{className:"space-y-5","data-density":j.density,children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(vn,{status:o.status}),o.statusOverride&&s.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>Ce(null),disabled:mt,title:"Clear manual status override and return to derived status",children:"Clear Override"}),s.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm disabled:cursor-not-allowed disabled:opacity-50",value:"",disabled:mt,onChange:ue=>{ue.target.value&&Ce(ue.target.value)},title:"Override project status",children:[s.jsx("option",{value:"",children:"Set Status…"}),u.statuses.map(ue=>s.jsx("option",{value:ue.id,children:ue.label},ue.id)),s.jsx("option",{value:"active",children:"Active"})]}),s.jsx("button",{type:"button",className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>Ge(!o.archived),disabled:mt,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"}),p&&p.workspaces.length>0&&s.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm disabled:cursor-not-allowed disabled:opacity-50",value:"",disabled:mt,onChange:ue=>{ue.target.value==="_ungrouped"?Ct(null):ue.target.value&&Ct(ue.target.value)},title:"Move project to a different workspace",children:[s.jsx("option",{value:"",children:"Move to Workspace…"}),p.workspaces.filter(ue=>ue!==o.workspace).map(ue=>s.jsx("option",{value:ue,children:ue},ue)),o.workspace&&s.jsx("option",{value:"_ungrouped",children:"Ungrouped"})]}),s.jsxs($e,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(Vx,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Project"})]}),s.jsx(Fw,{externalIds:o.externalIds}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",Gn(o.created),". Last source update ",es(o.updated),"."]})]}),s.jsxs("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 xl:grid-cols-5",children:[s.jsx(Kn,{label:"Assignments",value:o.progress.total}),s.jsx(Kn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),s.jsx(Kn,{label:"Review",value:o.progress.review??0,tone:"info"}),s.jsx(Kn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),s.jsx(Kn,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),s.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_300px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx($m,{value:k,onValueChange:v,items:[{value:"overview",label:"Overview",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Xe,{title:"Project Overview",children:o.body&&o.body.trim()?s.jsx(xn,{content:o.body}):s.jsx(Nt,{title:"No overview yet",description:"Add a short summary so collaborators and agents know what this project is about.",actions:s.jsxs($e,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(Vx,{className:"h-4 w-4"}),s.jsx("span",{children:"Add overview"})]})})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(ue=>!ue.archived).length,content:s.jsx("div",{className:"space-y-5",children:s.jsx(Xe,{title:"Assignment Queue",description:"Board and table views over the source assignment files.",actions:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:u.statuses.map(ue=>({value:ue.id,label:ue.label})),value:C,onChange:Le}),s.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Mt,value:T,onChange:Ve}),s.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:Ke}),s.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:f.definitions.map(ue=>({value:ue.id,label:Ml(f,ue.id)})),value:U,onChange:ct}),s.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:Nn,value:V,onChange:le}),s.jsx(Rm,{className:"max-w-[190px]",value:P,onChange:L}),N==="kanban"&&s.jsxs("select",{value:B==="type"?"type":"status",onChange:ue=>re(ue.target.value),className:"editor-input max-w-[170px]",title:"Group kanban by",children:[s.jsx("option",{value:"status",children:"Group: Status"}),s.jsx("option",{value:"type",children:"Group: Type"})]}),s.jsx(_m,{value:N,onChange:ue=>xe(ue),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),s.jsx(n_,{scope:je,loadedViewId:ne,onApply:be,onOpenSaveDialog:()=>{ke(!1),Se(!0)}}),s.jsx("button",{type:"button",onClick:()=>{it?ft():(ke(!1),Se(!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:it?`Update ${it.name}`:"Save current view",children:it?`Update '${it.name}'`:"Save view"}),it?s.jsx("button",{type:"button",onClick:()=>{ke(!0),Se(!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:Et.length===0?s.jsx(Nt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:s.jsx($e,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):N==="kanban"?s.jsx(Tm,{columns:En,items:Cn,getItemId:ue=>ue.slug,getColumnId:ue=>B==="type"?ue.type&&Ft.has(ue.type)?ue.type:NN:ue.status,dragDisabled:!0,boundedColumns:!0,renderCard:ue=>s.jsx(xG,{projectSlug:o.slug,assignment:ue}),emptyMessage:ue=>`No ${ue.title.toLowerCase()} assignments.`,hiddenColumnIds:Q.hidden,onHideColumn:ue=>te(Ee=>({hidden:Ee.hidden.includes(ue)?Ee.hidden.filter(Tn=>Tn!==ue):[...Ee.hidden,ue]}))}):(()=>{const ue=new Set(Z.hidden),Ee=rt=>rt==="title"||!ue.has(rt);return s.jsxs("div",{className:"overflow-x-auto",children:[s.jsx("div",{className:"mb-3 flex items-center justify-end",children:s.jsx(GP,{visibility:Z,onChange:ae})}),s.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[Ee("title")?s.jsx(en,{field:"title",children:"Assignment"}):null,Ee("status")?s.jsx(en,{field:"status",children:"Status"}):null,s.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Ee("priority")?s.jsx(en,{field:"priority",children:"Priority"}):null,Ee("assignee")?s.jsx(en,{field:"assignee",children:"Assignee"}):null,Ee("dependencies")?s.jsx(en,{field:"dependencies",children:"Dependencies"}):null,Ee("created")?s.jsx(en,{field:"created",children:"Created"}):null,Ee("updated")?s.jsx(en,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:Cn.map(rt=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Ee("title")?s.jsx("td",{className:"py-4",children:s.jsx($e,{to:`${n}/projects/${o.slug}/assignments/${rt.slug}`,className:"font-semibold text-foreground hover:text-primary",children:rt.title})}):null,Ee("status")?s.jsx("td",{className:"py-4",children:s.jsx(vn,{status:rt.status,className:"max-w-[150px]"})}):null,s.jsx("td",{className:"py-4",children:s.jsx(Ta,{type:rt.type,compact:!0})}),Ee("priority")?s.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:rt.priority}):null,Ee("assignee")?s.jsx("td",{className:"py-4 text-muted-foreground",children:rt.assignee??"—"}):null,Ee("dependencies")?s.jsx("td",{className:"py-4 text-muted-foreground",children:rt.dependsOn.length}):null,Ee("created")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Gn(rt.created)}):null,Ee("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Gn(rt.updated)}):null]},rt.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:s.jsx(uG,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?s.jsx(Xe,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:s.jsx(v9,{definition:o.dependencyGraph,nodeRoutes:yt})}):s.jsx(Nt,{title:"No dependency graph yet",description:"Dependencies appear here once assignments declare dependsOn relationships."})},{value:"knowledge",label:"Knowledge",content:s.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[s.jsx(Xe,{title:"Resources",description:"Shared project references.",actions:s.jsxs($e,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[s.jsx(It,{className:"h-4 w-4"}),s.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?s.jsx(Nt,{title:"No resources yet",description:"Resources live at the project level and stay available to every assignment."}):s.jsx("div",{className:"space-y-3",children:o.resources.map(ue=>s.jsxs($e,{to:`/projects/${o.slug}/resources/${ue.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:ue.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[ue.category," · ",ue.source]})]},ue.slug))})}),s.jsx(Xe,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:s.jsxs($e,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[s.jsx(It,{className:"h-4 w-4"}),s.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?s.jsx(Nt,{title:"No memories yet",description:"Memories capture patterns discovered during execution so later assignments can reuse them."}):s.jsx("div",{className:"space-y-3",children:o.memories.map(ue=>s.jsxs($e,{to:`/projects/${o.slug}/memories/${ue.slug}`,className:"block rounded-md border border-border/60 bg-background/80 p-3 transition hover:border-primary/40",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:ue.name}),s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[ue.scope," · ",ue.source]})]},ue.slug))})})]})}]})}),s.jsxs("div",{className:"space-y-5",children:[s.jsx(Xe,{title:"Progress Summary",children:s.jsx(jh,{progress:o.progress,showLegend:!0})}),s.jsx(Xe,{title:"Attention",children:(()=>{const ue=[{label:"Blocked",count:o.needsAttention.blockedCount,alert:!0},{label:"Failed",count:o.needsAttention.failedCount,alert:!0},{label:"Unanswered questions",count:o.needsAttention.openQuestions,alert:!1}].filter(Ee=>Ee.count>0);return ue.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing needs attention."}):s.jsx("dl",{className:"space-y-3 text-sm",children:ue.map(Ee=>s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:Ee.label}),s.jsx("dd",{className:`font-semibold ${Ee.alert?"text-warning-foreground":"text-foreground"}`,children:Ee.count})]},Ee.label))})})()}),s.jsx(Xe,{title:"Quick Links",children:s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs($e,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(Vx,{className:"h-4 w-4"}),"Edit project source"]}),s.jsxs($e,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx(It,{className:"h-4 w-4"}),"Create assignment"]}),s.jsxs($e,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[s.jsx(CL,{className:"h-4 w-4"}),"Review project rules"]}),s.jsxs("button",{type:"button",onClick:()=>v("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[s.jsx(Dv,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?s.jsxs(Xe,{title:"Archive Metadata",children:[s.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?es(o.archivedAt):"with no timestamp recorded","."]}),o.archivedReason?s.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:o.archivedReason}):null]}):null]})]}),s.jsx(Hr,{toast:Fe,onDismiss:we}),s.jsx(t_,{open:ye,onOpenChange:ue=>{Se(ue),ue||ke(!1)},initialName:Te&&it?`${it.name} (copy)`:"",title:Te?"Save as new view":"Save view",onSubmit:He})]})}function xG({projectSlug:e,assignment:t}){const n=pn();return s.jsxs($e,{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:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"font-semibold text-foreground",children:t.title}),s.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),s.jsx("span",{onClick:r=>{r.preventDefault(),r.stopPropagation()},children:s.jsx(Zr,{value:t.id})})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",Gn(t.updated)]})]}),s.jsx(vn,{status:t.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(Ta,{type:t.type}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:t.priority}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:t.assignee??"Unassigned"}),s.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 r_({sessionId:e,disabled:t=!1,disabledReason:n,onError:r,onNotice:o}){const[i,a]=m.useState(!1),[l,u]=m.useState(!1);async function f(){var h;if(t||l)return;u(!0);const p=(async()=>{const g=await fetch(`/api/launch/command?session=${encodeURIComponent(e)}&mode=resume`);if(!g.ok){const k=await g.json().catch(()=>null);throw new Error((k==null?void 0:k.error)??`HTTP ${g.status}`)}const y=await g.json().catch(()=>null);if(!y||typeof y.command!="string")throw new Error("Malformed response from launch command endpoint");return{command:y.command,fallbackWarning:typeof y.fallbackWarning=="string"&&y.fallbackWarning?y.fallbackWarning:void 0}})();try{const g=typeof((h=navigator.clipboard)==null?void 0:h.write)=="function"&&typeof ClipboardItem<"u";let y;if(g)await navigator.clipboard.write([new ClipboardItem({"text/plain":p.then(k=>new Blob([k.command],{type:"text/plain"}))})]),y=(await p).fallbackWarning;else{const k=await p;if(!navigator.clipboard||typeof navigator.clipboard.writeText!="function")throw new Error("Clipboard API is unavailable in this context.");await navigator.clipboard.writeText(k.command),y=k.fallbackWarning}a(!0),setTimeout(()=>a(!1),1500),y&&(o==null||o(y))}catch(g){let y=g instanceof Error?g:new Error(String(g));try{await p}catch(k){y=k instanceof Error?k:new Error(String(k))}r==null||r(y)}finally{u(!1)}}return t?s.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:s.jsx(h1,{className:"h-3 w-3","aria-hidden":"true"})}):s.jsx("button",{type:"button",onClick:f,disabled:l,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?s.jsx(zr,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(h1,{className:"h-3 w-3","aria-hidden":"true"})})}function bu(e,t,n,r,o){let i=`syntaur://open?${e.kind}=${encodeURIComponent(e.id)}`;return e.kind==="session"&&t&&(i+=`&mode=${encodeURIComponent(t)}`),n&&(i+=`&terminal=${encodeURIComponent(n)}`),r&&e.kind==="assignment"&&(i+=`&agent=${encodeURIComponent(r)}`),o!==void 0&&e.kind==="assignment"&&(i+=`&prompt=${encodeURIComponent(o)}`),i}function yG(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 bG(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 s_(e,t,n,r){const o=await fetch(`/api/projects/${e}/assignments/${t}/transitions/${n.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r?{reason:r}:{})}),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 o_(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:n})}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${r.status}`);return o.assignment}async function vG(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}`,{method:"DELETE"}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error((r==null?void 0:r.error)||`HTTP ${n.status}`)}function i_(e){return e.requiresReason||e.command==="block"}async function wG(e,t,n){const r=await fetch(`/api/assignments/${e}/transitions/${t.command}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n?{reason:n}:{})}),o=await r.json().catch(()=>null);if(!r.ok)throw new Error((o==null?void 0:o.error)||`HTTP ${r.status}`);return o.assignment}async function jG(e,t){const n=await fetch(`/api/assignments/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})}),r=await n.json().catch(()=>null);if(!n.ok)throw new Error((r==null?void 0:r.error)||`HTTP ${n.status}`);return r.assignment}async function kG(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 SG(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 u0 extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function d0(e){const t=await e.json().catch(()=>null);return new u0((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function NG(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 CG(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 EG(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/worktree`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw await d0(r);return(await r.json()).assignment}async function TG(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 d0(n);return(await n.json()).assignment}async function RG(e){const{url:t}=yG(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await d0(n);return await n.json()}async function Fm(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 AG(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Fm(r)}async function PG(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Fm(n)}async function _G(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Fm(n)).sourceAssignments}async function DG(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Fm(t)).sourceAssignments}function a_(){const[e,t]=m.useState(!1),[n,r]=m.useState(null),[o,i]=m.useState(null),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(null),[b,j]=m.useState(null);async function N(T,R,$,_){if(!e){t(!0);try{const U=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:T.kind,id:T.id}})});if(!U.ok){window.location.href=bu(T,R,void 0,$,_);return}const I=await U.json();if(I.ok){window.location.href=bu(T,R,void 0,$,_);return}if(I.reason==="workspace-path-invalid"){I.recreate?(f(I.recreate),h({target:T,mode:R,agentId:$,prompt:_})):l(I.message);return}r(I),i({target:T,mode:R,agentId:$,prompt:_})}catch(U){console.warn("preflight failed, firing without override:",U),window.location.href=bu(T,R,void 0,$,_)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=bu(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),r(null),i(null))}async function C(){if(!(!u||!p||g)){y(!0),v(null);try{const T=await RG({kind:u.kind,id:u.id,projectSlug:u.projectSlug,assignmentSlug:u.assignmentSlug}),{target:R,mode:$,agentId:_,prompt:U}=p;f(null),h(null),window.location.href=bu(R,$,void 0,_,U),!T.exact&&!T.alreadyExisted&&j(`Recreated from ${T.baseUsed} — the original branch couldn't be restored exactly, but the directory is back and your agent is opening.`)}catch(T){v(T instanceof u0&&T.stderr?`${T.message}
604
+ ${T.stderr}`:T instanceof Error?T.message:String(T))}finally{y(!1)}}}const D=s.jsxs(s.Fragment,{children:[s.jsx(Nl,{open:n!==null,onOpenChange:T=>!T&&(r(null),i(null)),children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsxs(aa,{children:[n==null?void 0:n.terminal," is not installed"]}),s.jsxs(la,{children:[(n==null?void 0:n.terminal)==="cmux"?s.jsxs(s.Fragment,{children:["To use cmux, install ",s.jsx("strong",{children:"cmux.app"})," into"," ",s.jsx("code",{children:"/Applications"}),"."," "]}):null,"Open in ",s.jsx("strong",{children:n==null?void 0:n.suggestedFallback})," instead? You can change the default in"," ",s.jsx($e,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{r(null),i(null)},children:"Settings"}),"."]})]}),s.jsxs(El,{children:[s.jsx(ed,{className:"shell-action mt-0",children:"Cancel"}),s.jsxs(xi,{className:"shell-action mt-0 shell-action--cta",onClick:T=>{T.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),s.jsx(Nl,{open:a!==null,onOpenChange:T=>!T&&l(null),children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsx(aa,{children:"Can't open in agent"}),s.jsxs(la,{children:[a," Set a valid worktree or repository, then try again."]})]}),s.jsx(El,{children:s.jsx(xi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>l(null),children:"OK"})})]})}),s.jsx(Nl,{open:u!==null,onOpenChange:T=>{!T&&!g&&(f(null),h(null),v(null))},children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsx(aa,{children:"Worktree was deleted"}),s.jsxs(la,{children:["The worktree at ",s.jsx("code",{children:u==null?void 0:u.deletedPath})," no longer exists. Recreate it",u!=null&&u.branch?s.jsxs(s.Fragment,{children:[" ","on branch ",s.jsx("code",{children:u.branch})]}):null," ","so this can open?"]})]}),k&&s.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap rounded bg-muted p-2 text-xs text-destructive",children:k}),s.jsxs(El,{children:[s.jsx(ed,{className:"shell-action mt-0",disabled:g,children:"No"}),s.jsx(xi,{className:"shell-action mt-0 shell-action--cta",disabled:g,onClick:T=>{T.preventDefault(),C()},children:g?"Recreating…":"Yes, recreate"})]})]})}),s.jsx(Nl,{open:b!==null,onOpenChange:T=>!T&&j(null),children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsx(aa,{children:"Worktree recreated"}),s.jsx(la,{children:b})]}),s.jsx(El,{children:s.jsx(xi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>j(null),children:"OK"})})]})})]});return{open:N,pending:e,dialogs:D}}function l_({session:e,onMarkStopped:t}){const n=a_(),r={kind:"session",id:e.sessionId},o="size-3.5",i=Ne("shell-action","inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50"),a="inline-flex outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm",l=!e.resumeSupported&&!e.forkSupported;return s.jsxs(s.Fragment,{children:[s.jsx(pa,{delayDuration:200,children:s.jsxs("div",{className:"inline-flex items-center gap-1",children:[l&&s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("span",{tabIndex:0,className:a,children:s.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[s.jsx(_l,{className:o}),s.jsx("span",{children:"Reopen"})]})})}),s.jsx(gr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("span",{tabIndex:0,className:a,children:s.jsxs("button",{type:"button",disabled:!0,"aria-disabled":!0,className:i,children:[s.jsx(_l,{className:o}),s.jsx("span",{children:"Resume"})]})})}),s.jsx(gr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"resume"),children:[s.jsx(_l,{className:o}),s.jsx("span",{children:"Resume"})]})}),s.jsx(gr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"fork"),children:[s.jsx(VL,{className:o}),s.jsx("span",{children:"Fork"})]})}),s.jsx(gr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>t(e.sessionId),children:[s.jsx(Lv,{className:o}),s.jsx("span",{children:"Mark stopped"})]})}),s.jsx(gr,{side:"top",children:e.resumeSupported?"Tell the dashboard this session has ended so Resume re-enables":"Tell the dashboard this session has ended"})]})]})}),n.dialogs]})}async function $G(e){const t=await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!t.ok)throw new Error(await t.text().catch(()=>"")||`HTTP ${t.status}`)}function c_({sessions:e,loading:t,error:n,onError:r,onNotice:o}){return t&&!e?null:n&&!e?s.jsx(Xe,{title:"Agent Sessions",children:s.jsx(Nt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?s.jsx(Xe,{title:"Agent Sessions",children:s.jsx(Nt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):s.jsx(Xe,{title:"Agent Sessions",children:s.jsx("div",{className:"space-y-2",children:e.map(i=>s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Vh,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"font-medium text-foreground",children:i.agent}),s.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),s.jsx(Zr,{value:i.sessionId,onError:r}),s.jsx(r_,{sessionId:i.sessionId,disabled:!i.resumeSupported,disabledReason:"Resume not supported for this agent",onError:r,onNotice:o})]})]}),s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(vn,{status:i.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:es(i.started)})]}),s.jsx(l_,{session:i,onMarkStopped:a=>$G(a).catch(l=>r==null?void 0:r(l instanceof Error?l:new Error(String(l))))})]},i.sessionId))})})}const Dy="Cost / Usage";function u_({summary:e,error:t}){return t&&!e?s.jsx(Xe,{title:Dy,children:s.jsx(Nt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?s.jsx(Xe,{title:Dy,children:s.jsx(Nt,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):s.jsx(Xe,{title:Dy,children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(EN,{label:"Total cost",value:Gl(e.totalCost)}),s.jsx(EN,{label:"Total tokens",value:Kl(e.totalTokens)})]}),e.byModel.length>1?s.jsxs("div",{className:"space-y-1.5 border-t border-border pt-3",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"By model"}),s.jsx("div",{className:"space-y-1",children:e.byModel.map(n=>s.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(Kh,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate font-mono text-xs text-foreground",title:n.model,children:n.model})]}),s.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:[Kl(n.totalTokens)," · ",Gl(n.totalCost)]})]},n.model))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",G4(e.lastEventDay)]})]})}):null}function EN({label:e,value:t}){return s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("p",{className:"text-lg font-semibold tabular-nums text-foreground",children:t})]})}function d_({open:e,action:t,assignmentTitle:n,loading:r=!1,onConfirm:o,onOpenChange:i}){const[a,l]=m.useState("");m.useEffect(()=>{e||l("")},[e,t==null?void 0:t.command]);const u=m.useMemo(()=>t&&t.command==="block"?"Blocked Reason":"Reason",[t]);if(!t)return null;const f=`${t.label} "${n}"`,p=r?"Applying...":t.label,h=a.trim()||void 0;return s.jsx(Ln,{open:e,onOpenChange:g=>r?void 0:i(g),children:s.jsx(jn,{className:"max-w-xl",children:s.jsxs("form",{className:"space-y-5",onSubmit:g=>{g.preventDefault(),o(h)},children:[s.jsxs(tr,{children:[s.jsx(kn,{children:f}),s.jsx(ns,{children:t.description})]}),t.warning?s.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,s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground",children:u}),s.jsx("textarea",{value:a,onChange:g=>l(g.target.value),autoFocus:!0,rows:4,disabled:r,placeholder:"Optional context for why this assignment is blocked.",className:"editor-textarea min-h-[120px] bg-background/95 font-sans"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave this blank to continue without a written reason."})]}),s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:()=>i(!1),disabled:r,className:"shell-action disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"submit",disabled:r,className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p})]})]})})})}function Ai({open:e,title:t,description:n,confirmLabel:r,cancelLabel:o="Cancel",loading:i=!1,destructive:a=!1,onConfirm:l,onOpenChange:u}){return s.jsx(Nl,{open:e,onOpenChange:f=>i?void 0:u(f),children:s.jsxs(ia,{children:[s.jsxs(Cl,{children:[s.jsx(aa,{children:t}),s.jsx(la,{children:n})]}),s.jsxs(El,{children:[s.jsx(ed,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),s.jsx(xi,{disabled:i,className:`shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50 ${a?"border-destructive/80 bg-destructive text-destructive-foreground hover:bg-destructive/90":"shell-action--cta"}`,onClick:f=>{f.preventDefault(),l()},children:i?"Working...":r})]})]})})}const IG=/^[a-z0-9][a-z0-9_-]*$/,f_=["first","last","none"];class p_ extends Error{constructor(n,r){super(n);$x(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=r}}const f0={agents:[],custom:!1};let Tl=null,wl=null,Ch=0;const tv=new Set;function h_(e){Tl=e;for(const t of tv)t(e)}function MG(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(r=>typeof r=="string")&&(n.args=t.args),typeof t.promptArgPosition=="string"&&f_.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 p0(e){if(!e||typeof e!="object")return f0;const t=e,n=Array.isArray(t.agents)?t.agents:[],r=[];for(const o of n){const i=MG(o);i&&r.push(i)}return{agents:r,custom:t.custom===!0}}function LG(){if(Tl)return Promise.resolve(Tl);if(wl)return wl;const e=++Ch;return wl=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{wl=null;const n=p0(t);return e!==Ch?Tl??n:(Tl=n,n)}).catch(()=>(wl=null,f0)),wl}function m_(){const[e,t]=m.useState(()=>Tl??f0);return m.useEffect(()=>{let n=!1;return LG().then(r=>{n||t(r)}),tv.add(t),()=>{n=!0,tv.delete(t)}},[]),e}async function g_(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new p_(n,t==null?void 0:t.fieldErrors)}async function OG(e){++Ch;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await g_(t);const n=p0(await t.json());return h_(n),n}async function FG(){++Ch;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await g_(e);const t=p0(await e.json());return h_(t),t}const TN=/[A-Za-z0-9_-]/,zG=/^[a-z0-9]+(-[a-z0-9]+)*$/,RN=/(^|\s)@([A-Za-z0-9_-]+)/g,nv="assignment";function x_(e,t){const n=Math.max(0,Math.min(t,e.length));let r=n;for(;r>0&&TN.test(e[r-1]);)r--;const o=r-1;if(o<0||e[o]!=="@"||o>0&&!/\s/.test(e[o-1]))return null;let i=n;for(;i<e.length&&TN.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function y_(e,t){const n=[nv,...t.filter(a=>a!==nv)],r=e.toLowerCase();if(r==="")return n;const o=[],i=[];for(const a of n){const l=a.toLowerCase();l.startsWith(r)?o.push(a):l.includes(r)&&i.push(a)}return[...o,...i]}function b_(e,t,n){const r=`@${n}`;return{text:e.slice(0,t.start)+r+e.slice(t.end),caret:t.start+r.length}}function v_(e,t){const n=t instanceof Set?t:new Set(t),r=[];RN.lastIndex=0;let o;for(;(o=RN.exec(e))!==null;){const i=o[2];i!==nv&&(zG.test(i)?n.has(i)||r.push(`Playbook "${i}" is not installed — "@${i}" will be left as literal text.`):r.push(`"@${i}" is not a valid playbook token — it will be left as literal text.`))}return r}const AN=2e3;function BG({open:e,assignmentId:t,agentId:n,onConfirm:r,onOpenChange:o}){const[i,a]=m.useState(""),[l,u]=m.useState([]),[f,p]=m.useState(!1),[h,g]=m.useState(null),[y,k]=m.useState(0),[v,b]=m.useState(0),[j,N]=m.useState(!1),S=m.useRef(null);m.useEffect(()=>{if(!e)return;let P=!1;p(!0),g(null),N(!1);const L=new URLSearchParams({assignment:t});return n&&L.set("agent",n),fetch(`/api/launch/prompt?${L.toString()}`).then(async B=>{if(!B.ok){const q=await B.json().catch(()=>null);throw new Error((q==null?void 0:q.error)??`HTTP ${B.status}`)}return await B.json()}).then(B=>{P||(a(B.template??""),u(B.knownPlaybookSlugs??[]),k((B.template??"").length))}).catch(B=>{P||g(B instanceof Error?B.message:String(B))}).finally(()=>{P||p(!1)}),()=>{P=!0}},[e,t,n]);const C=x_(i,y),D=C?y_(C.partial,l):[],T=e&&!f&&!j&&D.length>0,R=v_(i,l),$=i.length>AN;function _(P){a(P.target.value),k(P.target.selectionStart??P.target.value.length),b(0),N(!1)}function U(P){k(P.currentTarget.selectionStart??i.length),b(0)}function I(P){if(!C||!P)return;const L=b_(i,C,P);a(L.text),k(L.caret),b(0),N(!0),requestAnimationFrame(()=>{const B=S.current;B&&(B.focus(),B.setSelectionRange(L.caret,L.caret))})}function V(P){T&&(P.key==="ArrowDown"?(P.preventDefault(),b(L=>Math.min(L+1,D.length-1))):P.key==="ArrowUp"?(P.preventDefault(),b(L=>Math.max(L-1,0))):(P.key==="Enter"||P.key==="Tab")&&(P.preventDefault(),I(D[v])))}function O(){$||f||(r(i),o(!1))}return s.jsx(Ln,{open:e,onOpenChange:o,children:s.jsxs(jn,{onEscapeKeyDown:P=>{T&&(P.preventDefault(),N(!0))},children:[s.jsxs(tr,{children:[s.jsx(kn,{children:"Edit launch prompt"}),s.jsxs(ns,{children:["The first message the agent starts with. ",s.jsx("code",{children:"@assignment"})," and"," ",s.jsx("code",{children:"@<playbook>"})," tokens resolve at launch. This edit applies to this launch only."]})]}),h?s.jsxs("p",{className:"text-sm text-error-foreground",children:["Couldn't load the prompt: ",h]}):s.jsxs("div",{className:"relative",children:[s.jsx("textarea",{ref:S,value:i,disabled:f,rows:4,spellCheck:!1,placeholder:f?"Loading…":"@assignment Run @<playbook> end-to-end.",onChange:_,onKeyDown:V,onKeyUp:U,onClick:U,className:Ne("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")}),T&&s.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:D.map((P,L)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":L===v,onMouseDown:B=>{B.preventDefault(),I(P)},className:Ne("flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-sm transition-colors hover:bg-accent",L===v&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:P})]})},P))})]}),R.length>0&&!h&&s.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:R.map(P=>s.jsx("li",{children:P},P))}),$&&s.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",AN," characters (",i.length,")."]}),s.jsxs(Ur,{children:[s.jsx("button",{type:"button",className:"shell-action mt-0",onClick:()=>o(!1),children:"Cancel"}),s.jsx("button",{type:"button",className:"shell-action mt-0 shell-action--cta",disabled:f||$||h!==null,onClick:O,children:"Launch"})]})]})})}function w_({target:e,worktreePath:t=null,repository:n=null,size:r="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,a=a_(),[l,u]=m.useState(null),p=m_().agents,[h,g]=m.useState(null);m.useEffect(()=>{p.length!==0&&g(R=>R&&p.some(_=>_.id===R)?R:(p.find(_=>_.default)??p[0]).id)},[p]);const y=e.kind==="assignment"&&p.length>1,k=p.find(R=>R.id===h)??null,v=m.useRef(null),[b,j]=m.useState(!1);m.useEffect(()=>{if(!b)return;function R(_){v.current&&!v.current.contains(_.target)&&j(!1)}function $(_){_.key==="Escape"&&j(!1)}return document.addEventListener("mousedown",R),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",$)}},[b]);function N(R){var $,_;if(e.kind==="assignment"){const U=p.find(V=>V.id===R)??p.find(V=>V.default)??p[0];!!(($=U==null?void 0:U.launchPrompt)!=null&&$.trim())||!!((_=U==null?void 0:U.playbook)!=null&&_.trim())?a.open(e,void 0,R):u({agentId:R})}else a.open(e,void 0,R)}const S=e.kind==="assignment"?"Open this assignment in your configured terminal + agent":"Resume this session in its agent",C="Set a workspace path first — see the Workspace Before Code playbook",D=Ne("shell-action",r==="compact"&&"inline-flex items-center justify-center px-2 py-1 text-xs","disabled:cursor-not-allowed disabled:opacity-50");if(i)return s.jsxs("button",{type:"button",disabled:!0,title:C,className:D,"aria-disabled":!0,children:[s.jsx(_l,{className:"size-3.5"}),s.jsx("span",{children:"Open in agent"})]});const T=e.kind==="session"?"Open":"Open in agent";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative inline-flex",ref:v,children:[s.jsxs("div",{className:"inline-flex items-stretch",children:[s.jsxs("button",{type:"button",onClick:()=>N(h??void 0),disabled:a.pending,title:(o??S)+(y&&k?` (${k.label})`:""),className:Ne(D,y&&"rounded-r-none"),children:[s.jsx(_l,{className:"size-3.5"}),s.jsx("span",{children:T})]}),y&&s.jsx("button",{type:"button",onClick:()=>j(R=>!R),disabled:a.pending,"aria-haspopup":"menu","aria-expanded":b,"aria-label":"Choose which agent to launch",title:"Choose which agent to launch",className:Ne(D,"-ml-px rounded-l-none",r==="compact"?"px-1":"px-1.5"),children:s.jsx(vr,{className:Ne("size-3.5 opacity-70 transition-transform",b&&"rotate-180")})})]}),b&&y&&s.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:[s.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"}),p.map(R=>s.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":R.id===h,onClick:()=>{g(R.id),j(!1),N(R.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:[s.jsx(zr,{className:Ne("size-3.5 shrink-0",R.id===h?"opacity-100":"opacity-0")}),s.jsx("span",{className:"truncate",children:R.label}),R.default&&s.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground/60",children:"default"})]},R.id))]})]}),a.dialogs,e.kind==="assignment"&&l&&s.jsx(BG,{open:!0,assignmentId:e.id,agentId:l.agentId,onConfirm:R=>{a.open(e,void 0,l.agentId,R)},onOpenChange:R=>{R||u(null)}})]})}const $y="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 j_({projectSlug:e,assignmentSlug:t,assignmentId:n,defaultBranch:r,defaultParentBranch:o="main",onCreated:i}){const a=e&&t?{kind:"project-nested",projectSlug:e,assignmentSlug:t}:{kind:"standalone",assignmentId:n},[l,u]=m.useState(!1),[f,p]=m.useState("new-branch"),[h,g]=m.useState(null),[y,k]=m.useState(null),[v,b]=m.useState(""),[j,N]=m.useState(!1),[S,C]=m.useState(""),[D,T]=m.useState([]),[R,$]=m.useState(!1),[_,U]=m.useState(null),[I,V]=m.useState(""),[O,P]=m.useState(null),[L,B]=m.useState(null),[q,z]=m.useState(""),[W,M]=m.useState(r),[F,G]=m.useState(!1),[H,Q]=m.useState(null);m.useEffect(()=>{if(!l)return;let oe=!1;return p("new-branch"),g(null),k(null),b(""),N(!1),C(""),T([]),$(!1),U(null),V(""),P(null),B(null),z(""),M(r),Q(null),(a.kind==="project-nested"?NG(a.projectSlug):CG(a.assignmentId)).then(De=>{if(!oe)if(g(De),De.length===0)N(!0);else{const Be=De.find(Ue=>Ue.source==="project"),tt=De.find(Ue=>Ue.source==="sibling");b((Be==null?void 0:Be.path)??(tt==null?void 0:tt.path)??De[0].path)}}).catch(De=>{oe||(k(De.message),g([]),N(!0))}),(a.kind==="project-nested"?_G(a.projectSlug,a.assignmentSlug):DG(a.assignmentId)).then(De=>{oe||P(De)}).catch(De=>{oe||(B(De.message),P([]))}),()=>{oe=!0}},[l,r,o,e,t,n]);const te=f==="branch-off"?(O??[]).find(oe=>oe.id===q)??null:null,Z=f==="branch-off"?(te==null?void 0:te.repository)??"":j?S.trim():v;m.useEffect(()=>{if(!l||f!=="new-branch")return;if(!Z){T([]),U(null),$(!1),V("");return}let oe=!1;return $(!0),U(null),V(""),(a.kind==="project-nested"?AG(a.projectSlug,a.assignmentSlug,Z):PG(a.assignmentId,Z)).then(je=>{if(oe)return;T(je.branches);const De=(je.defaultBranch&&je.branches.includes(je.defaultBranch)?je.defaultBranch:je.branches.includes(o)?o:je.branches[0])??"";V(De),$(!1)}).catch(je=>{oe||(T([]),U(je.message),$(!1))}),()=>{oe=!0}},[l,f,Z,o,e,t,n]);const ae=bG(W.trim()),ne=m.useMemo(()=>!Z||!W.trim()?"":`${Z.replace(/\/+$/,"")}/.worktrees/${W.trim()}`,[Z,W]),de=h!==null&&h.length===0,ye=O!==null&&O.length===0,Se=oe=>{oe!==f&&(p(oe),z(""),Q(null),oe==="branch-off"&&(V(""),T([]),U(null),$(!1)))},Te=oe=>{z(oe);const we=(O??[]).find(je=>je.id===oe);V((we==null?void 0:we.branch)??"")},ke=F||ae!==null||!Z||!I.trim()||(f==="new-branch"?h===null||R:O===null||!q),Fe=async()=>{G(!0),Q(null);try{const oe={repository:Z,branch:W.trim(),parentBranch:I.trim()};a.kind==="project-nested"?await EG(a.projectSlug,a.assignmentSlug,oe):await TG(a.assignmentId,oe),u(!1),i()}catch(oe){oe instanceof u0?Q({message:oe.message,stderr:oe.stderr}):oe instanceof Error?Q({message:oe.message}):Q({message:String(oe)})}finally{G(!1)}};return s.jsxs(Ln,{open:l,onOpenChange:oe=>F?void 0:u(oe),children:[s.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>u(!0),children:[s.jsx(HL,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Create worktree"})]}),s.jsxs(jn,{children:[s.jsxs(tr,{children:[s.jsx(kn,{children:"Create worktree"}),s.jsxs(ns,{children:["Creates a git worktree at ",s.jsx("code",{children:"<repo>/.worktrees/<branch>"})," and records the workspace fields on this assignment's frontmatter."]})]}),s.jsxs("div",{className:"grid gap-4 text-sm",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-border/70 p-1",children:[s.jsx("button",{type:"button",disabled:F,onClick:()=>Se("new-branch"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${f==="new-branch"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"New branch from repo"}),s.jsx("button",{type:"button",disabled:F,onClick:()=>Se("branch-off"),className:`rounded px-2 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed ${f==="branch-off"?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"}`,children:"Branch off another assignment"})]}),f==="new-branch"?s.jsxs(s.Fragment,{children:[de?s.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"," ",s.jsx("code",{children:"repositories:"})," list to ",s.jsx("code",{children:"project.md"}),"."]}):null,y?s.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: ",y]}):null,s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Repository"}),s.jsx("select",{className:$y,value:v,onChange:oe=>b(oe.target.value),disabled:F||h===null||j,children:(h??[]).map(oe=>s.jsxs("option",{value:oe.path,children:[oe.path,oe.source==="project"?" (project)":oe.sourceAssignmentSlug?` (sibling — ${oe.sourceAssignmentSlug})`:" (sibling)"]},`${oe.source}:${oe.path}`))}),de?null:s.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:F,onClick:()=>N(oe=>!oe),children:j?"Use a listed repository":"Enter a custom repository path (advanced)"}),j?s.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:oe=>C(oe.target.value),disabled:F}):null]}),s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Parent branch"}),s.jsx("select",{className:$y,value:I,onChange:oe=>V(oe.target.value),disabled:F||R||D.length===0,children:R?s.jsx("option",{value:"",children:"Loading branches…"}):D.length===0?s.jsx("option",{value:"",children:_?"Could not load branches":Z?"No branches found":"— pick a repository —"}):D.map(oe=>s.jsx("option",{value:oe,children:oe},oe))}),_?s.jsxs("span",{className:"text-[11px] text-error-foreground",children:["Could not load branches: ",_]}):null]})]}):s.jsxs(s.Fragment,{children:[L?s.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: ",L]}):null,ye?s.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”."}):s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Source assignment"}),s.jsxs("select",{className:$y,value:q,onChange:oe=>Te(oe.target.value),disabled:F||O===null,children:[s.jsx("option",{value:"",children:"— select an assignment —"}),(O??[]).map(oe=>s.jsxs("option",{value:oe.id,children:[oe.title," (",oe.branch,")"]},oe.id))]})]}),te?s.jsxs("div",{className:"grid gap-2 rounded-md border border-border/70 bg-muted/40 px-3 py-2 text-xs",children:[s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx("span",{className:"font-medium text-muted-foreground",children:"Repository (from source)"}),s.jsx("code",{className:"break-all",children:te.repository})]}),s.jsxs("div",{className:"grid gap-0.5",children:[s.jsx("span",{className:"font-medium text-muted-foreground",children:"Parent branch (from source)"}),s.jsx("code",{children:te.branch})]})]}):null]}),s.jsxs("label",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"New branch name"}),s.jsx("input",{className:"w-full rounded-md border border-border/70 bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",type:"text",value:W,onChange:oe=>M(oe.target.value),disabled:F}),ae?s.jsx("span",{className:"text-[11px] text-error-foreground",children:ae}):null]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Worktree path"}),s.jsx("code",{className:"rounded-md border border-border bg-muted px-2 py-1 text-xs break-all",children:ne||s.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),H?s.jsxs("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-2 text-xs text-error-foreground",children:[s.jsx("div",{className:"font-medium",children:H.message}),H.stderr?s.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:H.stderr}):null]}):null]}),s.jsxs(Ur,{children:[s.jsx(ST,{disabled:F,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",disabled:ke,onClick:()=>void Fe(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:F?"Working…":"Create worktree"})]})]})]})}function UG(e){const t=e.split(`
605
+ `),n=t.findIndex(a=>/^##\s+Acceptance Criteria\s*$/i.test(a.trim()));if(n===-1)return{acceptanceCriteria:[],summaryBody:e};let r=t.length;for(let a=n+1;a<t.length;a+=1)if(/^#{1,2}\s+\S/.test(t[a].trim())){r=a;break}const o=t.slice(n+1,r).map(a=>a.match(/^\s*[-*]\s+\[( |x|X)\]\s+(.*)$/)).filter(a=>!!a).map(a=>({checked:a[1].toLowerCase()==="x",text:a[2].trim()})),i=[...t.slice(0,n),...t.slice(r)].join(`
606
+ `).replace(/\n{3,}/g,`
607
+
608
+ `).trim();return{acceptanceCriteria:o,summaryBody:i}}function HG(e){const t=e.split(`
609
+ `),n=t.findIndex(a=>/^##\s+Todos\s*$/i.test(a.trim()));if(n===-1)return{hasSection:!1,todosMarkdown:"",remaining:e};let r=t.length;for(let a=n+1;a<t.length;a+=1)if(/^#{1,2}\s+\S/.test(t[a].trim())){r=a;break}const o=t.slice(n+1,r).join(`
610
+ `).replace(/<!--[\s\S]*?-->/g,"").replace(/\n{3,}/g,`
611
+
612
+ `).trim(),i=[...t.slice(0,n),...t.slice(r)].join(`
613
+ `).replace(/\n{3,}/g,`
614
+
615
+ `).trim();return{hasSection:!0,todosMarkdown:o,remaining:i}}function VG({projectSlug:e,dependencies:t,blockedReason:n}){const[r,o]=m.useState(!1);if(t.length===0)return null;const i=t.filter(l=>l.status!=="completed"&&l.status!=="review"),a=i.length===0;return a&&!r?s.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:[s.jsx(Pv,{className:"h-4 w-4 shrink-0 text-success-foreground"}),s.jsxs("span",{className:"text-sm font-medium text-success-foreground",children:["All ",t.length," ",t.length===1?"dependency":"dependencies"," resolved"]}),s.jsx(vr,{className:"ml-auto h-4 w-4 text-success-foreground"})]}):s.jsxs("div",{className:"space-y-3",children:[i.length>0&&s.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-warning-foreground/30 bg-warning px-4 py-3",children:[s.jsx(nh,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning-foreground"}),s.jsxs("div",{className:"text-sm text-warning-foreground",children:[s.jsxs("strong",{children:[i.length," ",i.length===1?"dependency is":"dependencies are"," not yet completed."]}),n&&s.jsxs("p",{className:"mt-1 text-warning-foreground/80",children:["Blocked reason: ",n]})]})]}),s.jsx(Xe,{title:"Dependencies",description:`${t.length-i.length} of ${t.length} resolved`,actions:a?s.jsx("button",{type:"button",onClick:()=>o(!1),className:"text-xs text-muted-foreground hover:text-foreground",children:"Collapse"}):void 0,children:s.jsx("div",{className:"divide-y divide-border/40",children:t.map(l=>s.jsxs($e,{to:`/projects/${e}/assignments/${l.slug}`,className:"flex items-center gap-3 px-1 py-2.5 transition hover:bg-muted/40 first:pt-0 last:pb-0",children:[s.jsx(vn,{status:l.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:l.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:l.slug})]}),l.assignee&&s.jsx("span",{className:"hidden text-xs text-muted-foreground sm:inline",children:l.assignee}),s.jsx(th,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},l.slug))})})]})}function WG({links:e}){const t=pn();if(e.length===0)return null;const n=e.filter(o=>!o.isReverse),r=e.filter(o=>o.isReverse);return s.jsx(Xe,{title:"Linked Assignments",description:`${e.length} ${e.length===1?"link":"links"}`,children:s.jsxs("div",{className:"divide-y divide-border/40",children:[n.map(o=>s.jsxs($e,{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:[s.jsx(qE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(vn,{status:o.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),s.jsx(th,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),r.map(o=>s.jsxs($e,{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:[s.jsx(eh,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(vn,{status:o.status}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:o.title}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:o.slug})]}),s.jsx(th,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function qG(e){const t=new Map;for(const r of e)t.set(r.id,{entry:r,replies:[]});const n=[];for(const r of e){const o=t.get(r.id);r.replyTo&&t.has(r.replyTo)?t.get(r.replyTo).replies.push(o):n.push(o)}return n}function KG(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function k_({projectSlug:e,assignmentSlug:t,entries:n}){const[r,o]=m.useState(n);m.useEffect(()=>{o(n)},[n]);const i=m.useMemo(()=>qG(r),[r]),[a,l]=m.useState(""),[u,f]=m.useState("note"),[p,h]=m.useState(!1),[g,y]=m.useState(null);async function k(b){var S;if(b.preventDefault(),!a.trim())return;h(!0),y(null);const j=`tmp-${Date.now()}`,N={id:j,timestamp:new Date().toISOString(),author:"human",type:u,body:a,resolved:u==="question"?!1:void 0};o(C=>[...C,N]);try{const C=await fetch(KG(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:a,type:u})});if(!C.ok){const R=await C.text();throw new Error(R||`HTTP ${C.status}`)}const D=await C.json().catch(()=>null),T=(S=D==null?void 0:D.comment)==null?void 0:S.id;o(R=>R.map($=>$.id===j?{...$,id:T??$.id}:$)),l(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){y(C instanceof Error?C.message:String(C)),o(D=>D.filter(T=>T.id!==j))}finally{h(!1)}}async function v(b,j){o(N=>N.map(S=>S.id===b?{...S,resolved:j}:S));try{const N=e===null?`/api/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments/${encodeURIComponent(b)}/resolved`,S=await fetch(N,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({resolved:j})});if(!S.ok)throw new Error(`HTTP ${S.status}`);window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(N){y(N instanceof Error?N.message:String(N)),o(S=>S.map(C=>C.id===b?{...C,resolved:!j}:C))}}return s.jsx(Xe,{title:"Comments",description:"Threaded questions, notes, and feedback. Questions can be resolved once answered.",children:s.jsxs("div",{className:"space-y-4",children:[i.map(b=>s.jsx(S_,{node:b,onToggleResolved:v,depth:0},b.entry.id)),s.jsxs("form",{onSubmit:k,className:"mt-6 space-y-2 border-t border-border pt-4",children:[s.jsx("label",{className:"block text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Add comment"}),s.jsx("textarea",{value:a,onChange:b=>l(b.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…"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("select",{value:u,onChange:b=>f(b.target.value),className:"rounded border border-border bg-background px-2 py-1 text-xs",children:[s.jsx("option",{value:"note",children:"note"}),s.jsx("option",{value:"question",children:"question"}),s.jsx("option",{value:"feedback",children:"feedback"})]}),s.jsx("button",{type:"submit",disabled:p||!a.trim(),className:"shell-action",children:p?"Posting…":"Post comment"}),g?s.jsx("span",{className:"text-xs text-error-foreground",children:g}):null]})]})]})})}function S_({node:e,depth:t,onToggleResolved:n}){const{entry:r,replies:o}=e,i=r.type==="question";return s.jsxs("div",{className:Ne("space-y-2",t>0&&"ml-4 border-l border-border pl-4"),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-mono",children:r.id}),s.jsx("span",{children:"·"}),s.jsx("span",{children:r.timestamp}),s.jsx("span",{children:"·"}),s.jsx("span",{className:"font-medium text-foreground",children:r.author}),s.jsx("span",{children:"·"}),s.jsx("span",{className:Ne("rounded px-1.5 py-0.5 font-mono text-[10px] uppercase",i&&"bg-warning text-warning-foreground",r.type==="feedback"&&"bg-info text-info-foreground",r.type==="note"&&"bg-muted text-muted-foreground"),children:r.type}),i?s.jsxs("button",{type:"button",onClick:()=>n(r.id,!r.resolved),className:Ne("inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium",r.resolved?"bg-success text-success-foreground hover:bg-success/80":"bg-muted text-muted-foreground hover:bg-muted/80"),title:r.resolved?"Mark unresolved":"Mark resolved",children:[r.resolved?s.jsx(Pv,{className:"h-3 w-3"}):s.jsx(PL,{className:"h-3 w-3"}),r.resolved?"resolved":"open"]}):null,r.replyTo?s.jsxs("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[s.jsx(s4,{className:"h-3 w-3"}),r.replyTo]}):null]}),s.jsx(xn,{content:r.body}),o.length>0?s.jsx("div",{className:"space-y-2",children:o.map(a=>s.jsx(S_,{node:a,depth:t+1,onToggleResolved:n},a.entry.id))}):null]})}function N_(e){const t=er();m.useEffect(()=>{const n=t.hash.slice(1);if(!n)return;let r=0,o;const i=()=>{const a=document.getElementById(n);return a?(a.scrollIntoView({block:"start"}),!0):!1};return r=requestAnimationFrame(()=>{i()||(o=setTimeout(i,80))}),()=>{cancelAnimationFrame(r),o&&clearTimeout(o)}},[t.hash,t.pathname,e])}const GG=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function PN(){var pe,Re,We,X,be,He,ft,Ze,yt,mt;const{slug:e,aslug:t}=Vt(),n=Ht(),r=pn(),[o,i]=Ns(),[a,l]=m.useState(null),{toast:u,showToast:f,dismissToast:p}=wr(),[h,g]=m.useState(null),[y,k]=m.useState(null),[v,b]=m.useState(null),[j,N]=m.useState(null),[S,C]=m.useState({}),[D,T]=m.useState(!1),[R,$]=m.useState(!1),[_,U]=m.useState(0),I=o.get("tab")??"summary";N_(I);const V=Es(),{data:O,loading:P,error:L,refetch:B}=gO(e,t),{data:q}=E2(e),{data:z}=Bv(),{data:W,loading:M,error:F}=yO(e,t),{data:G,loading:H,error:Q}=vO(e,t),te=m.useMemo(()=>{if(!O||!q)return[];const me=new Map(q.assignments.map(Ce=>[Ce.slug,Ce]));return O.dependsOn.map(Ce=>{const Ge=me.get(Ce);return{slug:Ce,title:(Ge==null?void 0:Ge.title)??Ce,status:(Ge==null?void 0:Ge.status)??"pending",priority:(Ge==null?void 0:Ge.priority)??"medium",assignee:(Ge==null?void 0:Ge.assignee)??null}})},[O,q]),Z=te.filter(me=>me.status!=="completed"&&me.status!=="review");Ti("assignment");const ae=m.useMemo(()=>((q==null?void 0:q.assignments)??[]).map(me=>me.slug),[q]),ne=t?ae.indexOf(t):-1,de=ne>0?ae[ne-1]:null,ye=ne>=0&&ne<ae.length-1?ae[ne+1]:null,Se=`${r}/projects/${e}/assignments/${t}`;Jt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Se}/edit`)}),Jt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Se}/plan/edit`)}),Jt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Se}/handoff/edit`)}),Jt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Se}/decision-record/edit`)}),Jt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Se}/scratchpad/edit`)}),Jt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!de,handler:()=>de&&n(`${r}/projects/${e}/assignments/${de}`)}),Jt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!ye,handler:()=>ye&&n(`${r}/projects/${e}/assignments/${ye}`)});const Te=m.useMemo(()=>O?UG(O.body):{acceptanceCriteria:[],summaryBody:""},[O]);m.useEffect(()=>{C({})},[O]);const ke=m.useMemo(()=>HG(Te.summaryBody),[Te.summaryBody]),Fe=Te.acceptanceCriteria,oe=Fe.filter(me=>me.checked).length,we=Fe.length>0&&oe===Fe.length,je=m.useRef(we),De=m.useRef(!1);if(m.useEffect(()=>{if(O){if(!De.current){je.current=we,De.current=!0;return}we&&!je.current&&U(me=>me+1),je.current=we}},[we,O]),P)return s.jsx(jt,{label:"Loading assignment workspace…"});if(L||!O||!e||!t)return s.jsx(Rt,{error:L||"Assignment not found."});const Be=e,tt=t,Ue=Fe.length>0?{checked:oe,total:Fe.length}:void 0,it=O.availableTransitions??[],xt=it.filter(me=>!me.disabled&&me.targetStatus!==O.status),at=GG.map(me=>xt.find(Ce=>Ce.command===me)).find(Boolean)??xt[0]??null,st=[];if(z!=null&&z.sessions)for(const me of z.sessions)for(const Ce of me.windows)for(const Ge of Ce.panes)((pe=Ge.assignment)==null?void 0:pe.project)===e&&((Re=Ge.assignment)==null?void 0:Re.slug)===t&&st.push({sessionName:me.name,command:Ge.command,urls:Ge.urls});async function ce(me){l(null);try{await o_(Be,tt,me),B()}catch(Ce){l(Ce.message)}}async function xe(me){l(null);try{const Ce=await fetch(`/api/projects/${Be}/assignments/${tt}/${me?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ce.ok){const Ge=await Ce.json().catch(()=>null);throw new Error((Ge==null?void 0:Ge.error)||`HTTP ${Ce.status}`)}B(),f(me?"Assignment archived":"Assignment restored","success")}catch(Ce){l(Ce.message)}}async function Le(){$(!0);try{await vG(Be,tt),n(`${r}/projects/${Be}`)}catch(me){l(me.message),$(!1),T(!1)}}async function Ve(me,Ce){l(null),g(me.command);try{return await s_(Be,tt,me,Ce),B(),!0}catch(Ge){return l(Ge.message),!1}finally{g(null)}}function Ke(me){if(i_(me)){k(me);return}Ve(me)}async function ct(me,Ce){b(null),N(me),C(Ge=>({...Ge,[me]:Ce}));try{const Ge=await fetch(`/api/projects/${Be}/assignments/${tt}/acceptance-criteria/${me}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Ce})}),Ct=await Ge.json();if(!Ge.ok)throw new Error(Ct.error||`HTTP ${Ge.status}`);B()}catch(Ge){C(Mt=>{const Nn={...Mt};return delete Nn[me],Nn});const Ct=Ge.message;b(Ct),f(Ct||"Failed to update acceptance criterion","error")}finally{N(null)}}const le=[...xt.filter(me=>me!==at).map(me=>({key:`transition-${me.command}`,label:me.label,onSelect:()=>Ke(me),disabled:h===me.command})),...it.filter(me=>me.disabled||me.targetStatus===O.status).map(me=>({key:`transition-${me.command}`,label:me.label,disabled:!0,disabledReason:me.targetStatus===O.status?`Already ${O.status.replace(/_/g," ")}`:me.disabledReason??me.warning??me.description})),...V.statuses.map(me=>({key:`override-${me.id}`,label:`Override → ${me.label}`,onSelect:()=>ce(me.id),disabled:me.id===O.status,disabledReason:me.id===O.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:zL,href:`${r}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:i4,href:`${r}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:Hx,href:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:th,href:`${r}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:WL,href:`${r}/projects/${e}/assignments/${t}/decision-record/edit`},{key:O.archived?"unarchive":"archive",label:O.archived?"Restore assignment":"Archive assignment",icon:O.archived?Zp:Wh,onSelect:()=>xe(!O.archived)},{key:"delete",label:"Delete assignment",icon:bn,destructive:!0,onSelect:()=>T(!0)}],re=(at==null?void 0:at.command)==="review";return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Hr,{toast:u,onDismiss:p}),s.jsxs("div",{className:"sticky top-12 z-20 rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm backdrop-blur",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(vn,{status:O.status,progress:Ue}),O.phase&&O.phase!==O.status&&s.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: ",O.phase]}),O.disposition&&O.disposition!=="active"&&s.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:O.disposition}),s.jsx(Ta,{type:O.type}),s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:O.title}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",d2(O.updated)]}),Z.length>0&&s.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",Z.length," unmet dep",Z.length===1?"":"s"]}),s.jsx(Fw,{externalIds:O.externalIds}),s.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[s.jsx(w_,{target:{kind:"assignment",id:O.id},worktreePath:((We=O.workspace)==null?void 0:We.worktreePath)??null,repository:((X=O.workspace)==null?void 0:X.repository)??null}),!((be=O.workspace)!=null&&be.worktreePath)&&e&&t&&s.jsx(j_,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>B()}),at&&s.jsx("button",{type:"button",title:at.warning||at.description,disabled:h===at.command,onClick:()=>Ke(at),className:Ne("shell-action disabled:cursor-not-allowed disabled:opacity-50",at.warning&&"border-warning-foreground/40",re&&_>0&&"send-to-review-glow"),children:s.jsx("span",{children:h===at.command?"Working…":at.label})},re?`review-${_}`:at.command),s.jsx(_w,{items:le,align:"end"})]})]}),a?s.jsx("p",{className:"mt-4 rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:a}):null,O.blockedReason?s.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[s.jsx("strong",{children:"Blocked reason:"})," ",O.blockedReason]}):null,O.override&&O.derived&&O.derived.derivedStatus!==O.status?s.jsxs("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:[s.jsxs("strong",{children:["Pinned to ",O.status]})," by ",O.override.source,O.override.reason?s.jsxs(s.Fragment,{children:[" — “",O.override.reason,"”"]}):null," · ","would otherwise be ",s.jsx("strong",{children:O.derived.derivedStatus})]}):null,(He=O.derived)!=null&&He.nextAction?s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",O.derived.nextAction]}):null]}),O.derived&&(Object.keys(O.derived.customFacts??{}).length>0||(O.derived.attestations??[]).length>0)?s.jsx(Xe,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:s.jsxs("div",{className:"space-y-3",children:[Object.keys(O.derived.customFacts??{}).length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(O.derived.customFacts??{}).map(([me,Ce])=>s.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[me,": ",s.jsx("span",{className:"font-medium text-foreground",children:String(Ce)})]},me))}),(O.derived.attestations??[]).map(me=>s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:me.fact}),s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",me.binds,")"]}),me.records.length===0?s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):me.records.map(Ce=>s.jsxs("span",{title:`${Ce.verdict}${Ce.note?` — ${Ce.note}`:""}${Ce.stale?" (stale — revision moved)":""} · ${Ce.at}`,className:Ne("rounded-full border px-2 py-0.5 text-[11px]",Ce.stale?"border-border/40 text-muted-foreground line-through":Ce.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[Ce.actor,": ",Ce.verdict==="approved"?"approved":"changes",Ce.stale?" (stale)":""]},Ce.actor))]},me.fact))]})}):null,te.length>0&&s.jsx(VG,{projectSlug:e,dependencies:te,blockedReason:O.blockedReason}),O.enrichedLinks&&O.enrichedLinks.length>0&&s.jsx(WG,{links:O.enrichedLinks}),O.referencedBy&&O.referencedBy.length>0&&s.jsx(Xe,{title:"Referenced by",description:"Other assignments whose Todos, progress, comments, or handoffs link to this one.",children:s.jsx("ul",{className:"space-y-2",children:O.referencedBy.map(me=>{const Ce=me.sourceProjectSlug===null?`/assignments/${me.sourceId}`:`${r}/projects/${me.sourceProjectSlug}/assignments/${me.sourceSlug}`;return s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx($e,{to:Ce,className:"text-foreground hover:text-primary",children:me.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",me.mentions," mention",me.mentions===1?"":"s",")"]}),me.sourceProjectSlug===null?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"}):null]},me.sourceId)})})}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx($m,{value:I,onValueChange:me=>i({tab:me}),items:[{value:"summary",label:"Summary",content:s.jsxs("div",{className:"space-y-5",children:[Te.acceptanceCriteria.length>0?s.jsx(Xe,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:s.jsxs("div",{className:"space-y-3",children:[v?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:v}):null,Te.acceptanceCriteria.map((me,Ce)=>{const Ge=j!==null,Ct=Ce in S?S[Ce]:me.checked;return s.jsxs("label",{className:"flex items-start gap-3 rounded-md border border-border/60 bg-background/80 px-3 py-3",children:[s.jsx("input",{type:"checkbox",checked:Ct,disabled:Ge,onChange:Mt=>ct(Ce,Mt.target.checked),className:"mt-1 h-4 w-4 rounded border-border text-primary"}),s.jsx("span",{className:"criterion-label text-sm leading-6","data-checked":Ct,children:me.text})]},`${Ce}-${me.text}`)})]})}):null,ke.hasSection?s.jsx(Xe,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:s.jsx(xn,{content:ke.todosMarkdown,emptyState:"No todos yet."})}):null,s.jsx(Xe,{title:"Assignment Summary",children:s.jsx(xn,{content:ke.remaining,emptyState:Te.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:O.plan?1:0,content:O.plan?s.jsx("div",{className:"space-y-5",children:s.jsxs(Xe,{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:s.jsxs($e,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/plan/edit`,children:[s.jsx(Hx,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Plan"})]}),children:[s.jsx("div",{className:"mb-4",children:s.jsx(vn,{status:O.plan.status})}),s.jsx(xn,{content:O.plan.body,emptyState:"No plan content yet."})]})}):s.jsx(Nt,{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:O.scratchpad?1:0,content:O.scratchpad?s.jsx(Xe,{title:"Scratchpad",actions:s.jsxs($e,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[s.jsx(Hx,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Scratchpad"})]}),children:s.jsx(xn,{content:O.scratchpad.body,emptyState:"Scratchpad is empty."})}):s.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((ft=O.handoff)==null?void 0:ft.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:O.handoff?s.jsx(Xe,{children:s.jsx(xn,{content:O.handoff.body,emptyState:"No handoff history yet."})}):s.jsx(Nt,{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:((Ze=O.progress)==null?void 0:Ze.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:O.progress&&O.progress.entries.length>0?s.jsx(Xe,{title:"Progress",description:"Reverse-chronological log of work done on this assignment. Agents append entries via progress.md.",children:s.jsx("ol",{className:"space-y-4",children:O.progress.entries.map((me,Ce)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:me.timestamp}),s.jsx(xn,{content:me.body})]},`${me.timestamp}-${Ce}`))})}):s.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((yt=O.comments)==null?void 0:yt.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:O.comments&&O.comments.entries.length>0?s.jsx(k_,{projectSlug:e,assignmentSlug:t,entries:O.comments.entries}):s.jsx(Nt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((mt=O.decisionRecord)==null?void 0:mt.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:O.decisionRecord?s.jsx(Xe,{children:s.jsx(xn,{content:O.decisionRecord.body,emptyState:"No decision history yet."})}):s.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here when you append one via the Append Decision action."})})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Xe,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(ci,{label:"ID",value:O.id,copyable:!0}),s.jsx(ci,{label:"Priority",value:O.priority}),O.assignee&&s.jsx(ci,{label:"Assignee",value:O.assignee}),s.jsx(ci,{label:"Updated",value:`${u2(O.updated)} · Created ${c2(O.created)}`}),O.workspace.repository&&s.jsx(ci,{label:"Repository",value:O.workspace.repository,copyable:!0}),O.workspace.worktreePath&&s.jsx(ci,{label:"Worktree",value:O.workspace.worktreePath,copyable:!0}),O.workspace.branch&&s.jsx(ci,{label:"Branch",value:O.workspace.branch,copyable:!0}),O.workspace.parentBranch&&s.jsx(ci,{label:"Parent branch",value:O.workspace.parentBranch,copyable:!0}),O.externalIds.map((me,Ce)=>s.jsx(YG,{entry:me},`${me.system}:${me.id}:${Ce}`))]})}),st.length>0&&s.jsx(Xe,{title:"Servers",children:s.jsx("div",{className:"space-y-2",children:st.map((me,Ce)=>s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm",children:[s.jsx("span",{className:"min-w-0 max-w-full truncate rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",title:me.command,children:me.command}),s.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:me.sessionName,children:me.sessionName}),me.urls.map(Ge=>s.jsxs("a",{href:Ge,target:"_blank",rel:"noopener noreferrer",title:Ge,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:[s.jsx("span",{className:"min-w-0 truncate",children:Ge.replace("http://localhost:",":")}),s.jsx(fc,{className:"h-2.5 w-2.5 shrink-0"})]},Ge))]},Ce))})}),s.jsx(c_,{sessions:W==null?void 0:W.sessions,loading:M,error:F,onError:me=>f(me.message,"error"),onNotice:me=>f(me,"success")}),s.jsx(u_,{summary:G==null?void 0:G.summary,loading:H,error:Q})]})]}),s.jsx(d_,{open:y!==null,action:y,assignmentTitle:O.title,loading:h===(y==null?void 0:y.command),onOpenChange:me=>{me||k(null)},onConfirm:async me=>{if(!y)return;await Ve(y,me)&&k(null)}}),s.jsx(Ai,{open:D,title:"Delete assignment?",description:`This will permanently delete "${O.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:R,onOpenChange:me=>{me||T(!1)},onConfirm:Le})]})}function ci({label:e,value:t,copyable:n}){return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e}),s.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[s.jsx("span",{className:"block min-w-0 truncate",title:t,children:t}),n&&t!=="—"&&s.jsx(Zr,{value:t})]})]})}function YG({entry:e}){const t=e.url!=null&&e.url.length>0;return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e.system}),s.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?s.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:[s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),s.jsx(fc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function XG(){var T,R,$,_,U,I,V,O;const{id:e}=Vt(),[t,n]=Ns(),r=t.get("tab")??"summary";N_(r);const{data:o,loading:i,error:a,refetch:l}=xO(e),{data:u,loading:f,error:p}=bO(e),{data:h,loading:g,error:y}=wO(o==null?void 0:o.slug),[k,v]=m.useState(!1),[b,j]=m.useState(null),{toast:N,showToast:S,dismissToast:C}=wr();async function D(P){if(e){j(null);try{const L=await fetch(`/api/assignments/${e}/${P?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!L.ok){const B=await L.json().catch(()=>null);throw new Error((B==null?void 0:B.error)||`HTTP ${L.status}`)}l(),S(P?"Assignment archived":"Assignment restored","success")}catch(L){j(L instanceof Error?L.message:"Archive failed")}}}return i?s.jsx(jt,{}):a?s.jsx(Rt,{error:a}):o?s.jsxs("div",{className:"space-y-6",children:[s.jsx(Hr,{toast:N,onDismiss:C}),s.jsxs("header",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(vn,{status:o.status}),s.jsx(Ta,{type:o.type}),s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),s.jsx(Fw,{externalIds:o.externalIds}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(w_,{target:{kind:"assignment",id:o.id},worktreePath:((T=o.workspace)==null?void 0:T.worktreePath)??null,repository:((R=o.workspace)==null?void 0:R.repository)??null,size:"compact"}),!(($=o.workspace)!=null&&$.worktreePath)&&s.jsx(j_,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>l()}),s.jsxs("button",{type:"button",onClick:()=>v(!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:[s.jsx(qh,{className:"h-3 w-3"}),"Move to workspace…"]}),s.jsx($e,{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"}),s.jsxs("button",{type:"button",onClick:()=>D(!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?s.jsx(Zp,{className:"h-3 w-3"}):s.jsx(Wh,{className:"h-3 w-3"}),o.archived?"Restore":"Archive"]})]})]}),s.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:o.title}),o.blockedReason?s.jsxs("p",{className:"text-sm text-warning-foreground",children:["Blocked: ",o.blockedReason]}):null,b?s.jsx("p",{className:"text-sm text-status-failed-foreground",children:b}):null]}),o.referencedBy&&o.referencedBy.length>0?s.jsx(Xe,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:s.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(P=>s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx($e,{to:P.sourceProjectSlug===null?`/assignments/${P.sourceId}`:`/projects/${P.sourceProjectSlug}/assignments/${P.sourceSlug}`,className:"text-foreground hover:text-primary",children:P.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",P.mentions," mention",P.mentions===1?"":"s",")"]})]},P.sourceId))})}):null,s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_280px]",children:[s.jsx("div",{className:"space-y-4",children:s.jsx($m,{value:r,onValueChange:P=>n({tab:P}),items:[{value:"summary",label:"Summary",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Xe,{title:"Assignment",children:s.jsx(xn,{content:o.body,emptyState:"This assignment does not have summary markdown yet."})})})},{value:"progress",label:"Progress",count:((_=o.progress)==null?void 0:_.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.progress&&o.progress.entries.length>0?s.jsx(Xe,{title:"Progress",description:"Reverse-chronological log of work done on this assignment.",children:s.jsx("ol",{className:"space-y-4",children:o.progress.entries.map((P,L)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:P.timestamp}),s.jsx(xn,{content:P.body})]},`${P.timestamp}-${L}`))})}):s.jsx(Nt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((U=o.comments)==null?void 0:U.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:s.jsx(k_,{projectSlug:null,assignmentSlug:o.id,entries:((I=o.comments)==null?void 0:I.entries)??[]})})},{value:"plan",label:"Plan",content:s.jsx("div",{className:"space-y-5",children:o.plan?s.jsxs(Xe,{children:[s.jsx(xn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx($e,{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"})})]}):s.jsx(Nt,{title:"No plan file yet",description:"Create one via the CLI or `/plan-assignment`."})})},{value:"scratchpad",label:"Scratchpad",content:s.jsx("div",{className:"space-y-5",children:o.scratchpad?s.jsxs(Xe,{children:[s.jsx(xn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx($e,{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"})})]}):s.jsx(Nt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((V=o.handoff)==null?void 0:V.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.handoff?s.jsxs(Xe,{children:[s.jsx(xn,{content:o.handoff.body,emptyState:"No handoff history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx($e,{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"})})]}):s.jsx(Nt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((O=o.decisionRecord)==null?void 0:O.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.decisionRecord?s.jsxs(Xe,{children:[s.jsx(xn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx($e,{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"})})]}):s.jsx(Nt,{title:"No decision record yet",description:"Decision records appear here once appended."})})}]})}),s.jsxs("div",{className:"min-w-0 space-y-5",children:[s.jsx(Xe,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(ui,{label:"ID",value:o.id,copyable:!0}),s.jsx(ui,{label:"Priority",value:o.priority}),o.assignee&&s.jsx(ui,{label:"Assignee",value:o.assignee}),s.jsx(ui,{label:"Updated",value:`${u2(o.updated)} · Created ${c2(o.created)}`}),o.workspace.repository&&s.jsx(ui,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&s.jsx(ui,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&s.jsx(ui,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&s.jsx(ui,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((P,L)=>s.jsx(QG,{entry:P},`${P.system}:${P.id}:${L}`))]})}),s.jsx(c_,{sessions:u==null?void 0:u.sessions,loading:f,error:p,onError:P=>S(P.message,"error"),onNotice:P=>S(P,"success")}),s.jsx(u_,{summary:h==null?void 0:h.summary,loading:g,error:y})]})]}),s.jsx(Ow,{open:k,onOpenChange:v,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async P=>{const L=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:P})});if(!L.ok){const B=await L.json().catch(()=>({}));throw new Error(B.error||"Failed to move assignment")}l()}})]}):s.jsx(Rt,{error:"Assignment not found"})}function ui({label:e,value:t,copyable:n}){return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e}),s.jsxs("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:[s.jsx("span",{className:"truncate",title:t,children:t}),n&&t!=="—"&&s.jsx(Zr,{value:t})]})]})}function QG({entry:e}){const t=e.url!=null&&e.url.length>0;return s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsx("dt",{className:"text-muted-foreground",children:e.system}),s.jsx("dd",{className:"flex items-center gap-1.5 max-w-[60%] text-right text-foreground break-all",children:t?s.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:[s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id}),s.jsx(fc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function JG({currentStatus:e,availableTransitions:t,onSelect:n,overrideTargets:r,onOverride:o,disabled:i=!1,className:a}){const[l,u]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(0),y=m.useRef(null),k=m.useRef(null),v=m.useId(),b=Es(),j=ld(b.statuses,e),N=Ob(e),S=r??[],C=t.length+S.length,D=m.useCallback(I=>{u(!1),I&&requestAnimationFrame(()=>{var V;(V=y.current)==null||V.focus()})},[]),T=m.useCallback(()=>{var V;const I=(V=y.current)==null?void 0:V.getBoundingClientRect();I&&p({top:I.top,left:I.left,width:I.width,bottom:I.bottom})},[]);m.useLayoutEffect(()=>{l&&T()},[l,T]),m.useEffect(()=>{if(!l)return;const I=()=>T();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[l,T]),m.useEffect(()=>{if(!l)return;const I=V=>{var P,L;const O=V.target;O&&((P=k.current)!=null&&P.contains(O)||(L=y.current)!=null&&L.contains(O)||D(!1))};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[l,D]),m.useEffect(()=>{l&&g(0)},[l,C]);function R(I){return!I.disabled&&I.id!==e}function $(I){if(I<t.length){const O=t[I];O&&(n(O),D(!0));return}const V=S[I-t.length];V&&R(V)&&(o==null||o(V.id),D(!0))}function _(I){(I.key==="Enter"||I.key===" "||I.key==="ArrowDown")&&(I.preventDefault(),u(!0))}function U(I){if(C===0){I.key==="Escape"&&(I.preventDefault(),D(!0));return}I.key==="ArrowDown"?(I.preventDefault(),g(V=>(V+1)%C)):I.key==="ArrowUp"?(I.preventDefault(),g(V=>(V-1+C)%C)):I.key==="Home"?(I.preventDefault(),g(0)):I.key==="End"?(I.preventDefault(),g(C-1)):I.key==="Enter"?(I.preventDefault(),$(h)):I.key==="Escape"&&(I.preventDefault(),D(!0))}return s.jsxs(s.Fragment,{children:[s.jsxs("button",{ref:y,type:"button","data-no-drag":!0,disabled:i,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?v:void 0,onClick:()=>{i||u(I=>!I)},onKeyDown:_,title:`Status: ${j.label}. Click to change.`,style:j.style,className:Ne(EA,j.className,a,"cursor-pointer transition hover:brightness-95 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",i&&"cursor-not-allowed opacity-60"),children:[s.jsx(N,{className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"min-w-0 truncate",children:j.label})]}),l&&f&&typeof document<"u"?wo.createPortal(s.jsx("div",{ref:k,id:v,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:U,style:{position:"fixed",top:f.bottom+6,left:f.left,minWidth:Math.max(f.width,180),zIndex:60},className:"rounded-md border border-border/70 bg-popover py-1 text-sm text-popover-foreground shadow-lg",children:C===0?s.jsx("div",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No status changes available from this status."}):s.jsxs(s.Fragment,{children:[t.map((I,V)=>{const O=Ob(I.targetStatus),P=V===h;return s.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>g(V),onClick:()=>$(V),title:I.warning||I.description,className:Ne("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",P?"bg-foreground/5":"hover:bg-foreground/5"),children:[s.jsxs("span",{className:"flex items-center justify-between gap-2",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(O,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:I.label})]}),s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:No(b,I.targetStatus)})]}),I.warning?s.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:I.warning}):null]},`${I.command}:${I.targetStatus}`)}),S.length>0&&t.length>0?s.jsx("div",{className:"my-1 border-t border-border/60",role:"separator"}):null,S.map((I,V)=>{const O=t.length+V,P=O===h,L=!R(I),B=ld(b.statuses,I.id);return s.jsx("button",{type:"button",role:"menuitem","data-no-drag":!0,disabled:L,onMouseEnter:()=>g(O),onClick:()=>$(O),title:L?I.disabledReason??(I.id===e?"Already in this status":void 0):`Set status to ${I.label}`,className:Ne("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm transition",L?"cursor-not-allowed text-muted-foreground/60":P?"bg-foreground/5":"hover:bg-foreground/5"),children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{"aria-hidden":"true",className:Ne("h-2.5 w-2.5 flex-shrink-0 rounded-full border border-border/40",B.style?void 0:B.className),style:B.style?{backgroundColor:B.style.color}:void 0}),s.jsxs("span",{className:"truncate",children:["Override → ",I.label]})]})},`override-${I.id}`)})]})}),document.body):null]})}function C_({title:e,detailHref:t,onSave:n,disabled:r=!1}){const[o,i]=m.useState(!1);return o?s.jsx(ZG,{initialTitle:e,disabled:r,onSave:n,onExit:()=>i(!1)}):s.jsxs("div",{className:"group flex items-baseline gap-1.5",children:[s.jsx("button",{type:"button","data-no-drag":!0,disabled:r,onClick:()=>{r||i(!0)},className:Ne("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",r&&"cursor-not-allowed opacity-60"),title:"Click to rename",children:e}),s.jsx($e,{to:t,"data-no-drag":!0,"aria-label":"Open detail page",title:"Open detail page",onClick:a=>a.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:s.jsx(fc,{className:"h-3.5 w-3.5"})})]})}function ZG({initialTitle:e,disabled:t,onSave:n,onExit:r}){const o=m.useRef(e),[i,a]=m.useState(e),[l,u]=m.useState(!1),[f,p]=m.useState(!1),h=m.useRef(null),g=m.useRef(!1);m.useEffect(()=>{const b=h.current;b&&(b.focus(),b.select())},[]);const y=m.useCallback(()=>{var b;p(!0),window.setTimeout(()=>p(!1),260),(b=h.current)==null||b.focus()},[]),k=m.useCallback(async()=>{if(g.current)return;const b=i.trim();if(b.length===0){y();return}if(b===o.current){r();return}g.current=!0,u(!0);try{await n(b)}catch{}finally{u(!1),r()}},[i,r,n,y]);function v(b){b.key==="Enter"?(b.preventDefault(),k()):b.key==="Escape"&&(b.preventDefault(),g.current=!0,r())}return s.jsx("input",{ref:h,type:"text","data-no-drag":!0,disabled:t||l,value:i,onChange:b=>a(b.target.value),onKeyDown:v,onBlur:()=>void k(),className:Ne("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",f&&"syntaur-input-shake",l&&"opacity-70")})}function E_(e){const t=Ht(),n=m.useRef(null),r=m.useRef(!1),o=m.useCallback(()=>{const a=n.current,l=!!(a!=null&&a.querySelector('[aria-expanded="true"]')),u=!!document.querySelector('[role="menu"]'),f=document.activeElement,p=!!(f&&(a!=null&&a.contains(f))&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"));r.current=l||u||p},[]),i=m.useCallback(a=>{if(r.current)return;const l=a.target;!l||l.closest(Zl)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const _N=/[A-Za-z0-9_-]/;function DN(e,t){const n=Math.max(0,Math.min(t,e.length)),r=eY(e,n);if(r)return r;let o=n;for(;o>0&&_N.test(e[o-1]);)o--;let i=n;for(;i<e.length&&_N.test(e[i]);)i++;const a=e.slice(o,n),l=e.slice(0,o),u=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(u)return{kind:"value",field:u[1].toLowerCase(),partial:a,tokenStart:o,tokenEnd:i};const f=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*\([^)]*,\s*$/);return f?{kind:"value",field:f[1].toLowerCase(),partial:a,tokenStart:o,tokenEnd:i}:{kind:"field",partial:a,tokenStart:o,tokenEnd:i}}function eY(e,t){let n=-1;for(let u=t-1;u>=0;u--)if(e[u]==='"'&&(u===0||e[u-1]!=="\\")){n=u;break}if(n<0)return null;for(let u=n+1;u<t;u++)if(e[u]==='"'&&e[u-1]!=="\\")return null;let r=t;for(;r<e.length&&!(e[r]==='"'&&e[r-1]!=="\\");)r++;const o=e.slice(n+1,t),a=e.slice(0,n).match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);return{kind:"value",field:a?a[1].toLowerCase():"",partial:o,tokenStart:n,tokenEnd:r<e.length?r+1:r}}function tY(e,t){const n=bA(t),r=e.toLowerCase();if(r==="")return n;const o=[],i=[];for(const a of n){const l=a.toLowerCase();l.startsWith(r)?o.push(a):l.includes(r)&&i.push(a)}return[...o,...i]}function nY(e,t,n,r){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 l=r[o];(l==null?void 0:l.kind)==="bool"&&(i=["true","false"]);break}}if(!i.length)return[];const a=t.toLowerCase();return a===""?i:i.filter(l=>l.toLowerCase().startsWith(a))}function rY(e,t,n){let r;return t.kind==="field"?r=`${n}:`:r=aw(n),{text:e.slice(0,t.tokenStart)+r+e.slice(t.tokenEnd),caret:t.tokenStart+r.length}}const sY=180;function oY(e,t){const[n,r]=m.useState(e);return m.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function iY({value:e,onChange:t,onCompiled:n,registry:r,declarations:o,valueSources:i,placeholder:a="AQL query (e.g. status:active AND priority:high)",className:l}){const u=m.useRef(null),f=m.useRef(null),p=oY(e,sY),[h,g]=m.useState([]),[y,k]=m.useState([]),[v,b]=m.useState("field"),[j,N]=m.useState(-1),[S,C]=m.useState(!1),D=m.useRef(e.length);m.useEffect(()=>{if(p.trim()===""){g([]),n==null||n(null);return}const P=Yl(p,r);P.errors.length>0?(g(P.errors),n==null||n(null)):(g([]),n==null||n(P.query))},[p,r,n]);const T=m.useCallback((P,L)=>{const B=DN(P,L);if(!B){k([]),C(!1);return}if(B.kind==="field"){const q=tY(B.partial,o);k(q),b("field"),C(q.length>0)}else{const q=nY(B.field,B.partial,i,r);k(q),b("value"),C(q.length>0)}N(-1)},[o,i,r]),R=m.useCallback(P=>{const L=P.target.value,B=P.target.selectionStart??L.length;D.current=B,t(L),T(L,B)},[t,T]),$=m.useCallback(P=>{const L=u.current,B=(L==null?void 0:L.selectionStart)??D.current,q=DN(e,B);if(!q)return;const{text:z,caret:W}=rY(e,q,P);t(z),C(!1),k([]),requestAnimationFrame(()=>{u.current&&(u.current.focus(),u.current.setSelectionRange(W,W),D.current=W)})},[e,t]),_=m.useCallback(P=>{if(!(!S||y.length===0))switch(P.key){case"ArrowDown":P.preventDefault(),N(L=>Math.min(L+1,y.length-1));break;case"ArrowUp":P.preventDefault(),N(L=>Math.max(L-1,-1));break;case"Enter":case"Tab":j>=0&&(P.preventDefault(),$(y[j]));break;case"Escape":C(!1),k([]);break}},[S,y,j,$]),U=m.useRef(null),I=m.useCallback(()=>{U.current=setTimeout(()=>C(!1),120)},[]);m.useEffect(()=>()=>{U.current!==null&&clearTimeout(U.current)},[]);const V=m.useCallback(()=>{var L;const P=((L=u.current)==null?void 0:L.selectionStart)??e.length;T(e,P)},[e,T]);m.useEffect(()=>{var P,L;S&&((L=(P=f.current)==null?void 0:P.querySelector('[aria-selected="true"]'))==null||L.scrollIntoView({block:"nearest"}))},[j,S]);const O=h.length>0&&p.trim()!=="";return s.jsxs("div",{className:`relative flex flex-col gap-1 ${l??""}`,children:[s.jsx("input",{ref:u,type:"text",value:e,onChange:R,onKeyDown:_,onBlur:I,onFocus:V,placeholder:a,"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",O?"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&&y.length>0&&s.jsx("ul",{ref:f,role:"listbox","aria-label":v==="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:y.map((P,L)=>s.jsx("li",{role:"option","aria-selected":L===j,onMouseDown:B=>{B.preventDefault(),$(P)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",L===j?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:P},P))}),O&&s.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:h.map((P,L)=>s.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",P.pos,": ",P.message]},L))})]})}const $N=iw;function mp(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function aY(e,t){return e.toString()===t.toString()}function IN(){const{workspace:e}=Vt(),t=pn(),n=Ht(),r=m.useRef(null);Ti("list:assignments");const{data:o,loading:i,error:a,refetch:l}=Qh(),u=Es(),f=Pd(),[p,h]=Ns(),g=e?`w:${e}`:null,y=QP(g),k=m.useRef(void 0),v=m.useMemo(()=>LA(u.order),[u]),b=m.useMemo(()=>{const Y={};for(const ee of v)Y[ee]=No(u,ee);return Y},[v,u]),j=m.useMemo(()=>v.map(Y=>({id:Y,title:b[Y]??Y,description:Bd(Y)})),[v,b]),N=m.useMemo(()=>f.definitions.map(Y=>({id:Y.id,title:Ml(f,Y.id),description:Y.description})),[f]),S="__unknown_type__",C=m.useMemo(()=>new Set(["all",...v]),[v]),D=p.get("view"),T=p.get("status"),R=p.get("stale"),$=D&&$N.includes(D)?D:"kanban";function _(Y){if(!Y)return[];const ee=[];for(const ve of Y.split(",")){const ze=ve.trim();!ze||ze==="all"||!C.has(ze)||ee.includes(ze)||ee.push(ze)}return ee}const U=m.useCallback(Y=>{h(ee=>{const ve=new URLSearchParams(ee);return Y==="kanban"?ve.delete("view"):ve.set("view",Y),ve})},[h]),[I,V]=m.useState(""),[O,P]=m.useState(()=>_(T)),[L,B]=m.useState(()=>qe(y.filters.priority)),[q,z]=m.useState(()=>qe(y.filters.type)),[W,M]=m.useState(()=>qe(y.filters.assignee)),[F,G]=m.useState(()=>qe(y.filters.project)),[H,Q]=m.useState(()=>qe(y.filters.tags)),[te,Z]=m.useState(null),[ae,ne]=m.useState(()=>mp(R)),[de,ye]=m.useState(()=>Iu({status:_(T),priority:qe(y.filters.priority),type:qe(y.filters.type),assignee:qe(y.filters.assignee),project:qe(y.filters.project),tags:qe(y.filters.tags),activity:mp(R)})),[Se,Te]=m.useState(()=>y.sortField),[ke,Fe]=m.useState(()=>y.sortDirection),[oe,we]=m.useState(()=>({hidden:[]})),[je,De]=m.useState(()=>({hidden:[]})),[Be,tt]=m.useState(()=>y.grouping),Ue=Be==="type"?"type":"status",[it,xt]=m.useState(()=>new Set),[at,st]=m.useState([]),{toast:ce,showToast:xe,dismissToast:Le}=wr(),[Ve,Ke]=m.useState(null),[ct,le]=m.useState(null),[re,pe]=m.useState(null),[Re,We]=m.useState(null),[X,be]=m.useState(null),[He,ft]=m.useState(null),[Ze,yt]=m.useState(null),[mt,me]=m.useState(null),[Ce,Ge]=m.useState(null),[Ct,Mt]=m.useState(!1),[Nn,Et]=m.useState(!1),Cn=e?{kind:"workspace",workspace:e}:{kind:"global"},Ft=p.get("loadView"),{view:En,loading:en,error:ue}=ji(Ft),{view:Ee,loading:rt,error:Tn}=ji(Ce),kr=m.useRef(null);m.useEffect(()=>{st((o==null?void 0:o.assignments)??[])},[o]),m.useEffect(()=>{Ce&&!rt&&!Tn&&!Ee&&Ge(null)},[Ee,Tn,Ce,rt]),m.useEffect(()=>{Ge(null),kr.current=null,Z(null),V("")},[e]);const no=m.useRef({status:T,stale:R});m.useEffect(()=>{const Y=_(T),ee=mp(R);h6(Y,O)||P(Y),ee!==ae&&ne(ee);const ve=no.current,ze=ve.status!==T||ve.stale!==R;no.current={status:T,stale:R},ze&&tn({status:Y,activity:ee})},[ae,R,O,T]),m.useEffect(()=>{k.current===g&&h(Y=>{const ee=new URLSearchParams(Y);return O.length===0?ee.delete("status"):ee.set("status",O.join(",")),ae==="all"?ee.delete("stale"):ae==="stale"?ee.set("stale","1"):ee.set("stale","0"),aY(Y,ee)?Y:ee})},[ae,g,h,O]),m.useEffect(()=>{B(qe(y.filters.priority)),z(qe(y.filters.type)),M(qe(y.filters.assignee)),G(qe(y.filters.project)),Q(qe(y.filters.tags)),Te(y.sortField),Fe(y.sortDirection),tt(y.grouping)},[y.filters.priority,y.filters.type,y.filters.assignee,y.filters.project,y.filters.tags,y.sortField,y.sortDirection,y.grouping]),m.useEffect(()=>{if(k.current===g)return;let Y=!1;return c0().then(ee=>{if(Y||k.current===g)return;const ve=ET(ee,g),ze=ve.defaultView,gt=qe(ve.filters.status),St=ve.filters.activity??"all",Pt=new URLSearchParams(window.location.search);let Rn=!1;const Fn=new URLSearchParams(Pt);Pt.get("view")===null&&ze!=="kanban"&&$N.includes(ze)&&(Fn.set("view",ze),Rn=!0),Pt.get("status")===null&&gt.length>0&&(Fn.set("status",gt.join(",")),P(gt),Rn=!0),Pt.get("stale")===null&&St!=="all"&&(Fn.set("stale",St==="stale"?"1":"0"),ne(St),Rn=!0),Rn&&h(Fn,{replace:!0});const An=_(Fn.get("status")),Nr=Fn.get("stale")===null?St:mp(Fn.get("stale"));ye(Iu({status:An,priority:qe(ve.filters.priority),type:qe(ve.filters.type),assignee:qe(ve.filters.assignee),project:qe(ve.filters.project),tags:qe(ve.filters.tags),activity:Nr==="fresh"||Nr==="stale"?Nr:"all"})),queueMicrotask(()=>{k.current=g})}),()=>{Y=!0}},[g]);const bt=m.useCallback(Y=>{(g===null?ZP(Y):e_(g,Y)).catch(ve=>{console.warn("Failed to persist view prefs:",ve)})},[g]),Pi=m.useCallback(Y=>{U(Y),bt({defaultView:Y})},[U,bt]),Do=m.useRef(null);Do.current={status:O,priority:L,type:q,assignee:W,project:F,tags:H,activity:ae,dateRange:te,search:I};const _a=m.useCallback((Y={})=>{const ee=Do.current;return{status:ee.status,priority:ee.priority,type:ee.type,assignee:ee.assignee,project:ee.project,tags:ee.tags,activity:ee.activity,dateRange:ha(ee.dateRange),search:ee.search,...Y}},[]),tn=m.useCallback((Y={})=>{ye(Iu(_a(Y)))},[_a]),$o=m.useCallback(Y=>{P(Y),bt({filters:{status:Y}}),tn({status:Y})},[bt,tn]),Da=m.useCallback(Y=>{B(Y),bt({filters:{priority:Y}}),tn({priority:Y})},[bt,tn]),$a=m.useCallback(Y=>{z(Y),bt({filters:{type:Y}}),tn({type:Y})},[bt,tn]),_c=m.useCallback(Y=>{M(Y),bt({filters:{assignee:Y}}),tn({assignee:Y})},[bt,tn]),Ia=m.useCallback(Y=>{G(Y),bt({filters:{project:Y}}),tn({project:Y})},[bt,tn]),Bt=m.useCallback(Y=>{Q(Y),bt({filters:{tags:Y}}),tn({tags:Y})},[bt,tn]),_i=m.useCallback(Y=>{ne(Y),bt({filters:{activity:Y}}),tn({activity:Y})},[bt,tn]),ro=m.useCallback(Y=>{V(Y),tn({search:Y})},[tn]),Io=m.useCallback(Y=>{Z(Y),tn({dateRange:ha(Y)})},[tn]),As=m.useCallback(Y=>{Te(Y),bt({sortField:Y})},[bt]),Mo=m.useCallback(Y=>{Fe(Y),bt({sortDirection:Y})},[bt]),Ma=m.useCallback(Y=>{tt(Y),bt({grouping:Y})},[bt]),Lo=m.useCallback(()=>{ro(""),$o([]),Bt([]),Io(null),_i("all")},[ro,$o,Bt,Io,_i]),rr=m.useCallback(Y=>{ye(Y);const ee=Mu(Y);ee&&(P(qe(ee.status)),B(qe(ee.priority)),z(qe(ee.type)),M(qe(ee.assignee)),G(qe(ee.project)),Q(qe(ee.tags)),V(ee.search??""),ne(ee.activity&&ee.activity!=="all"?ee.activity:"all"),Z(Am(ee.dateRange)))},[]),ar=m.useMemo(()=>Mu(de)!==null,[de]),On=m.useCallback(()=>{const ee=Mu(de)!==null?{status:O,priority:L,type:q,assignee:W,project:F,tags:H,activity:ae,dateRange:ha(te),search:I}:{};return{viewMode:$,filters:{...ee,query:de},sortField:Se,sortDirection:ke,listSectionVisibility:{collapsed:[...it]},kanbanColumnVisibility:oe,tableColumnVisibility:je}},[$,de,O,L,q,W,F,H,ae,te,I,Se,ke,it,oe,je]),Oo=m.useCallback(Y=>{PA(Y,{setViewMode:U,setQuery:ye,setStatusFilter:ee=>{P(ee),bt({filters:{status:ee}})},setPriorityFilter:ee=>{B(ee),bt({filters:{priority:ee}})},setTypeFilter:ee=>{z(ee),bt({filters:{type:ee}})},setAssigneeFilter:ee=>{M(ee),bt({filters:{assignee:ee}})},setProjectFilter:ee=>{G(ee),bt({filters:{project:ee}})},setTagsFilter:ee=>{Q(ee),bt({filters:{tags:ee}})},setActivityFilter:ee=>{ne(ee),bt({filters:{activity:ee}})},setDateRange:Z,setSearch:V,setSortField:As,setSortDirection:Mo,setListSectionVisibility:ee=>xt(new Set(ee.collapsed)),setKanbanColumnVisibility:we,setTableColumnVisibility:De}),Ge(Y.id)},[U,bt,As,Mo]),Dc=m.useCallback(Y=>{Oo(Y),kr.current=Y.id,h(ee=>{const ve=new URLSearchParams(ee);return ve.set("loadView",Y.id),ve},{replace:!0})},[Oo,h]),$c=m.useCallback(async Y=>{try{const ee=ec({name:Y,context:{workspace:e??null,projectSlug:null},state:On()}),ve=await Xl(ee),ze=ve.views[ve.views.length-1];Ge((ze==null?void 0:ze.id)??null),ze&&(kr.current=ze.id,h(gt=>{const St=new URLSearchParams(gt);return St.set("loadView",ze.id),St},{replace:!0})),Mt(!1),Et(!1),xe(`Saved view "${Y}"`,"success")}catch(ee){throw xe(ee instanceof Error?ee.message:"Failed to save view","error"),ee}},[On,h,xe,e]),Fo=m.useCallback(async()=>{if(!(!Ce||!Ee))try{const Y=ec({name:Ee.name,context:{workspace:e??null,projectSlug:null},state:On()}),ee=vh(Ee.config,Y.config,Y.config);await mh(Ce,{config:ee}),xe("View updated","success")}catch(Y){xe(Y instanceof Error?Y.message:"Failed to update view","error")}},[On,Ee,Ce,xe,e]);m.useEffect(()=>{if(!Ft){kr.current=null;return}if(kr.current!==Ft&&(Ce&&Ce!==Ft&&Ge(null),!en)){if(ue){xe("Couldn't load saved view — try again","error");return}if(En){kr.current=Ft,Oo(En),h(Y=>{const ee=new URLSearchParams(Y);return ee.delete("loadView"),ee},{replace:!0});return}kr.current=Ft,xe("Saved view no longer exists","error"),h(Y=>{const ee=new URLSearchParams(Y);return ee.delete("loadView"),ee},{replace:!0})}},[Ft,En,en,ue,Ce,Oo,h,xe]);const Vn=m.useMemo(()=>at.filter(Y=>e?e==="_ungrouped"?Y.projectWorkspace===null:Y.projectWorkspace===e:!0),[at,e]),so=m.useMemo(()=>Array.from(new Set(Vn.map(Y=>Y.status))).sort(),[Vn]),Vr=m.useMemo(()=>Array.from(new Set(Vn.map(Y=>Y.priority))).sort(),[Vn]),La=m.useMemo(()=>Array.from(new Set(Vn.map(Y=>Y.assignee??"__unassigned__"))).sort(),[Vn]),Di=m.useMemo(()=>Array.from(new Map(Vn.filter(Y=>Y.projectSlug!==null).map(Y=>[Y.projectSlug,Y.projectTitle]))).sort(([,Y],[,ee])=>Y.localeCompare(ee)),[Vn]),zo=m.useMemo(()=>Array.from(new Set(Vn.flatMap(Y=>Y.tags??[]))).sort(),[Vn]),Bo=m.useMemo(()=>yA(u.factDeclarations),[u.factDeclarations]),Ps=m.useMemo(()=>de.trim()===""?null:Yl(de,Bo).query,[de,Bo]),zt=m.useMemo(()=>gA(at,Ps,{workspace:e}),[at,Ps,e]),oo=m.useMemo(()=>zd(zt,Se,ke),[zt,Se,ke]),_s=m.useMemo(()=>{if(Be==="none")return[{id:"__all__",label:"All assignments",items:zt}];if(Be==="type"){const Y=f.definitions.map(ze=>({id:ze.id,label:Ml(f,ze.id),items:zt.filter(gt=>gt.type===ze.id)})),ee=new Set(f.definitions.map(ze=>ze.id)),ve=zt.filter(ze=>!ze.type||!ee.has(ze.type));return ve.length>0&&Y.push({id:S,label:"Other",items:ve}),Y}if(Be==="priority")return["critical","high","medium","low"].map(ee=>({id:ee,label:ee.charAt(0).toUpperCase()+ee.slice(1),items:zt.filter(ve=>ve.priority===ee)}));if(Be==="assignee")return Array.from(new Set(zt.map(ee=>ee.assignee??"__unassigned__"))).sort().map(ee=>({id:ee,label:ee==="__unassigned__"?"Unassigned":ee,items:zt.filter(ve=>(ve.assignee??"__unassigned__")===ee)}));if(Be==="project"){const Y=new Map;for(const ee of zt){const ve=ee.projectSlug??"__standalone__",ze=ee.projectTitle??"Standalone";Y.has(ve)||Y.set(ve,ze)}return Array.from(Y.entries()).sort(([,ee],[,ve])=>ee.localeCompare(ve)).map(([ee,ve])=>({id:ee,label:ve,items:zt.filter(ze=>(ze.projectSlug??"__standalone__")===ee)}))}return v.map(Y=>({id:Y,label:b[Y]??Y,items:zt.filter(ee=>ee.status===Y)}))},[Be,zt,f,v,b]),Lt=m.useMemo(()=>{const Y=new Set(f.definitions.map(ve=>ve.id));return zt.some(ve=>!ve.type||!Y.has(ve.type))?[...N,{id:S,title:"Other",description:"Assignments with no recognized type."}]:N},[N,f,zt]),{visibleItems:Jd,visibleIndexByKey:Ic}=m.useMemo(()=>{let Y;if($==="table")Y=oo;else if($==="kanban"){const ve=new Set(f.definitions.map(ze=>ze.id));Ue==="type"?Y=[...f.definitions.flatMap(ze=>zt.filter(gt=>gt.type===ze.id)),...zt.filter(ze=>!ze.type||!ve.has(ze.type))]:Y=v.flatMap(ze=>zt.filter(gt=>gt.status===ze))}else Y=_s.flatMap(ve=>ve.items);const ee=new Map;return Y.forEach((ve,ze)=>ee.set(mn(ve),ze)),{visibleItems:Y,visibleIndexByKey:ee}},[$,oo,_s,Ue,f,zt,v]),{hotkeyRowProps:$i}=_d(Jd,{scope:"list:assignments",onOpen:Y=>{if(Y.projectSlug===null){n(`/assignments/${Y.id}`);return}const ee=Y.projectWorkspace?`/w/${Y.projectWorkspace}`:t;n(`${ee}/projects/${Y.projectSlug}/assignments/${Y.slug}`)}});if(Jt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var Y;return(Y=r.current)==null?void 0:Y.focus()}}),Jt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>l()}),i)return s.jsx(jt,{label:"Loading assignments board…"});if(a||!o)return s.jsx(Rt,{error:a||"Assignments board is unavailable."});async function Mc({item:Y,toColumnId:ee,action:ve,reason:ze}){if(!ve){const St=u.statuses.find(Pt=>Pt.id===ee);if(Lb(St??{id:ee}))return xe(`Reach “${No(u,ee)}” through its complete/fail transition.`,"error"),!1}Ke(mn(Y));const gt=at;st(St=>St.map(Pt=>mn(Pt)===mn(Y)?{...Pt,status:ee,blockedReason:ee==="blocked"?ze??Pt.blockedReason:null}:Pt));try{const St=Y.projectSlug===null?ve?await wG(Y.id,ve,ze):await jG(Y.id,ee):ve?await s_(Y.projectSlug,Y.slug,ve,ze):await o_(Y.projectSlug,Y.slug,ee);return st(Pt=>Pt.map(Rn=>mn(Rn)===mn(Y)?{...Rn,status:St.status,blockedReason:St.blockedReason,availableTransitions:St.availableTransitions,updated:St.updated}:Rn)),l(),xe(`Moved to ${No(u,St.status)}`,"success"),!0}catch(St){return st(gt),xe(St.message,"error"),!1}finally{Ke(null)}}async function io({item:Y,toColumnId:ee,action:ve}){if(Y.status===ee)return;const ze=ve??vu(Y,ee);if(ze!=null&&ze.disabled){xe(ze.disabledReason||`Cannot move this assignment to ${ee}.`,"error");return}if(ze&&i_(ze)){We({item:Y,toColumnId:ee,action:ze});return}await Mc({item:Y,toColumnId:ee,action:ze})}function Lc(Y){return NA(u).map(ee=>ee.id===Y.status?{id:ee.id,label:ee.label,disabled:!0,disabledReason:"Already in this status"}:ee.terminal&&!Y.availableTransitions.find(ze=>ze.targetStatus===ee.id&&!ze.disabled)?{id:ee.id,label:ee.label,disabled:!0,disabledReason:`Reach ${ee.label} via its transition when available`}:{id:ee.id,label:ee.label})}function Oa(Y,ee){io({item:Y,toColumnId:ee})}async function Uo(Y,ee){if(ee===Y.title)return;const ve=mn(Y),ze=at;st(gt=>gt.map(St=>mn(St)===ve?{...St,title:ee}:St)),Ke(ve);try{const gt=Y.projectSlug===null?await SG({id:Y.id,title:ee}):await kG({projectSlug:Y.projectSlug,assignmentSlug:Y.slug,title:ee});st(St=>St.map(Pt=>mn(Pt)===ve?{...Pt,title:gt.title,updated:gt.updated}:Pt)),l()}catch(gt){throw st(ze),xe(gt.message,"error"),gt}finally{Ke(null)}}function Ds(Y){xt(ee=>{const ve=new Set(ee);return ve.has(Y)?ve.delete(Y):ve.add(Y),ve})}function $s(Y){Se===Y?Mo(ke==="asc"?"desc":"asc"):(As(Y),Mo("asc"))}const dn=ct?at.find(Y=>mn(Y)===ct)??null:null;function Ii(Y,ee){Y.dataTransfer.effectAllowed="move",Y.dataTransfer.setData("text/plain",ee),le(ee)}function ao(){le(null),pe(null)}function Is(Y,ee){if(!dn)return;const ve=vu(dn,ee);dn.status===ee||ve!=null&&ve.disabled||(Y.preventDefault(),Y.dataTransfer.dropEffect="move",pe(ee))}function ag(Y,ee){re===ee&&!Y.currentTarget.contains(Y.relatedTarget)&&pe(null)}function Zd(Y,ee){if(Y.preventDefault(),!dn||dn.status===ee){ao();return}ao(),io({item:dn,toColumnId:ee})}function Sr({field:Y,children:ee}){const ve=Se===Y;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>$s(Y),className:"inline-flex items-center gap-1 hover:text-foreground",children:[ee,ve?ke==="asc"?s.jsx(XE,{className:"h-3 w-3"}):s.jsx(vr,{className:"h-3 w-3"}):null]})})}return s.jsxs("div",{className:"space-y-5","data-density":y.density,children:[s.jsx("div",{className:"flex items-center justify-end",children:s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"New Assignment"]})}),s.jsxs(Mw,{children:[s.jsx(iY,{className:"w-full md:min-w-[320px] md:flex-1",value:de,onChange:rr,registry:Bo,declarations:u.factDeclarations,valueSources:{statuses:u.order,priorities:Vr,types:f.definitions.map(Y=>Y.id),assignees:La.filter(Y=>Y!=="__unassigned__"),projects:Di.map(([Y])=>Y),tags:zo}}),ar?null:s.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"}),s.jsx(Pm,{ref:r,value:I,onChange:ar?ro:()=>{},placeholder:"Search assignments or projects"}),s.jsx(yn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!ar,options:so.map(Y=>({value:Y,label:b[Y]??Y})),value:O,onChange:$o}),s.jsx(yn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!ar,options:Vr.map(Y=>({value:Y,label:Y[0].toUpperCase()+Y.slice(1)})),value:L,onChange:Da}),s.jsx(yn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!ar,options:f.definitions.map(Y=>({value:Y.id,label:Ml(f,Y.id)})),value:q,onChange:$a}),s.jsx(yn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!ar,options:[{value:"__unassigned__",label:"Unassigned"},...La.filter(Y=>Y!=="__unassigned__").map(Y=>({value:Y,label:Y}))],value:W,onChange:_c}),s.jsx(yn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!ar,options:[{value:"__standalone__",label:"Standalone"},...Di.map(([Y,ee])=>({value:Y,label:ee}))],value:F,onChange:Ia}),s.jsx(yn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!ar,options:zo.map(Y=>({value:Y,label:Y})),value:H,onChange:Bt}),s.jsx(Rm,{className:"max-w-[200px]",value:te,onChange:ar?Io:()=>{}}),s.jsxs("select",{value:ae,disabled:!ar,onChange:Y=>_i(Y.target.value),className:"editor-input max-w-[180px]","aria-label":"Filter by activity",title:"Filter by activity",children:[s.jsx("option",{value:"all",children:"All activity"}),s.jsx("option",{value:"stale",children:"Stale only"}),s.jsx("option",{value:"fresh",children:"Fresh only"})]}),s.jsx("select",{value:$==="kanban"?Ue:Be,onChange:Y=>Ma(Y.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:f6.map(Y=>{const ee=$==="kanban"&&Y!=="status"&&Y!=="type",ve=Y==="none"?"No grouping":`Group: ${Y.charAt(0).toUpperCase()+Y.slice(1)}`;return s.jsx("option",{value:Y,disabled:ee,children:ee?`${ve} (list only)`:ve},Y)})}),s.jsx(_m,{value:$,onChange:Y=>Pi(Y),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),$==="table"?s.jsx(GP,{visibility:je,onChange:De}):null,s.jsx(n_,{scope:Cn,loadedViewId:Ce,onApply:Dc,onOpenSaveDialog:()=>{Et(!1),Mt(!0)}}),s.jsx("button",{type:"button",onClick:()=>{Ee?Fo():(Et(!1),Mt(!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:Ee?`Update ${Ee.name}`:"Save current view",children:Ee?`Update '${Ee.name}'`:"Save view"}),Ee?s.jsx("button",{type:"button",onClick:()=>{Et(!0),Mt(!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?s.jsx(Nt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:s.jsxs($e,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[s.jsx(_v,{className:"h-4 w-4"}),s.jsx("span",{children:"Browse Projects"})]})}):zt.length===0?s.jsx(Nt,{title:"No assignments match these filters",description:"Adjust the search term or filters to show assignments across all projects again.",actions:s.jsxs("button",{type:"button",onClick:Lo,className:"shell-action shell-action--cta",children:[s.jsx(BL,{className:"h-4 w-4"}),s.jsx("span",{children:"Clear all filters"})]})}):$==="table"?(()=>{const Y=new Set(je.hidden),ee=ve=>ve==="title"||!Y.has(ve);return s.jsx(Xe,{title:`${oo.length} assignment${oo.length===1?"":"s"}`,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[ee("title")?s.jsx(Sr,{field:"title",children:"Assignment"}):null,ee("status")?s.jsx(Sr,{field:"status",children:"Status"}):null,s.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),ee("priority")?s.jsx(Sr,{field:"priority",children:"Priority"}):null,ee("assignee")?s.jsx(Sr,{field:"assignee",children:"Assignee"}):null,ee("dependencies")?s.jsx(Sr,{field:"dependencies",children:"Dependencies"}):null,ee("created")?s.jsx(Sr,{field:"created",children:"Created"}):null,ee("updated")?s.jsx(Sr,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:oo.map((ve,ze)=>s.jsxs(cY,{detailHref:ad(ve),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...$i(ze),children:[ee("title")?s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(C_,{title:ve.title,detailHref:ad(ve),onSave:gt=>Uo(ve,gt),disabled:Ve===mn(ve)}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:ve.projectTitle??s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),s.jsxs("p",{className:"mt-0.5 inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:ve.id,children:[ve.id.slice(0,8),s.jsx(Zr,{value:ve.id})]})]}):null,ee("status")?s.jsx("td",{className:"py-4 pr-4",children:s.jsx("select",{value:ve.status,disabled:Ve===mn(ve),onChange:gt=>io({item:ve,toColumnId:gt.target.value}),className:Ne("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")]`,ld(u.statuses,ve.status).className,Ve===mn(ve)&&"animate-pulse opacity-60"),style:ld(u.statuses,ve.status).style,children:v.map(gt=>{const St=ve.status===gt,Pt=St?void 0:vu(ve,gt),Rn=u.statuses.find(Ho=>Ho.id===gt),Fn=!St&&Lb(Rn??{id:gt})&&!Pt,An=((Pt==null?void 0:Pt.disabled)??!1)||Fn,Nr=Fn?`Reach ${b[gt]??gt} via its transition when available`:(Pt==null?void 0:Pt.disabledReason)??void 0;return s.jsx("option",{value:gt,disabled:An,title:An?Nr:void 0,children:b[gt]},gt)})})}):null,s.jsx("td",{className:"py-4 pr-4",children:s.jsx(Ta,{type:ve.type,compact:!0})}),ee("priority")?s.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:ve.priority}):null,ee("assignee")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.assignee??"Unassigned"}):null,ee("dependencies")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.dependsOn.length}):null,ee("created")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:Gn(ve.created)}):null,ee("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:Gn(ve.updated)}):null]},mn(ve)))})]})})})})():$==="list"?s.jsx("div",{className:"space-y-3",children:_s.map(({id:Y,label:ee,items:ve})=>{var Fn;if(ve.length===0&&!(dn&&Be==="status"))return null;const ze=!it.has(Y),gt=Be==="status",St=gt&&dn?dn.status!==Y&&!((Fn=vu(dn,Y))!=null&&Fn.disabled):!1,Pt=gt&&dn?dn.status!==Y&&!St:!1,Rn=gt&&re===Y;return s.jsxs("div",{className:Ne("rounded-lg border border-border/60 bg-card/90 transition",Rn&&St&&"ring-2 ring-ring/30",Pt&&"border-dashed opacity-65"),onDragOver:gt?An=>Is(An,Y):void 0,onDragLeave:gt?An=>ag(An,Y):void 0,onDrop:gt?An=>Zd(An,Y):void 0,children:[s.jsxs("button",{type:"button",onClick:()=>Ds(Y),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[s.jsx(vr,{className:`h-4 w-4 text-muted-foreground transition-transform ${ze?"":"-rotate-90"}`}),s.jsx("span",{className:"font-semibold text-foreground",children:ee}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:ve.length})]}),ze&&ve.length>0&&s.jsx("div",{className:"space-y-3 px-4 pb-4",children:ve.map(An=>{const Nr=mn(An),Ho=ct===Nr,Mi=Ic.get(Nr)??-1,Vo=gt;return s.jsx("div",{draggable:Vo,onDragStart:Vo?os=>Ii(os,Nr):void 0,onDragEnd:Vo?ao:void 0,...Mi>=0?$i(Mi):{},className:Ne("transition",Vo&&"cursor-grab active:cursor-grabbing",Ho&&"scale-[0.98] opacity-50"),children:s.jsx(MN,{assignment:An,dragging:Ho,transitioning:Ve===Nr,onPillSelect:os=>void io({item:An,toColumnId:os.targetStatus,action:os}),overrideTargets:Lc(An),onOverride:os=>Oa(An,os),onRenameTitle:os=>Uo(An,os)})},Nr)})})]},Y)})}):s.jsx(Tm,{columns:Ue==="type"?Lt:j,items:zt,getItemId:mn,getColumnId:Y=>Ue==="type"?Y.type&&f.definitions.some(ee=>ee.id===Y.type)?Y.type:S:Y.status,canDrop:({item:Y,fromColumnId:ee,toColumnId:ve})=>{if(ee===ve)return{allowed:!0};const ze=vu(Y,ve);return ze!=null&&ze.disabled?{allowed:!1,reason:ze.disabledReason||ze.description}:{allowed:!0,reason:ze?ze.warning||ze.description:`Move to ${ve} (direct status change).`}},onMove:Ue==="type"?void 0:({item:Y,toColumnId:ee})=>io({item:Y,toColumnId:ee}),dragDisabled:Ue==="type",getExternalDragData:Y=>Y.projectSlug===null?{type:"standalone-assignment",id:Y.id}:{type:"project-assignment",id:Y.id},onCardContextMenu:(Y,ee)=>{ee.preventDefault(),be({item:Y,anchor:{x:ee.clientX,y:ee.clientY}})},emptyMessage:Y=>`No ${Y.title.toLowerCase()} assignments.`,hiddenColumnIds:oe.hidden,onHideColumn:Y=>we(ee=>({hidden:ee.hidden.includes(Y)?ee.hidden.filter(ze=>ze!==Y):[...ee.hidden,Y]})),renderCard:(Y,{dragging:ee})=>{const ve=Ic.get(mn(Y))??-1;return s.jsx("div",{...ve>=0?$i(ve):{},children:s.jsx(MN,{assignment:Y,dragging:ee,transitioning:Ve===mn(Y),onPillSelect:ze=>void io({item:Y,toColumnId:ze.targetStatus,action:ze}),overrideTargets:Lc(Y),onOverride:ze=>Oa(Y,ze),onRenameTitle:ze=>Uo(Y,ze)})})}}),s.jsx(Hr,{toast:ce,onDismiss:Le}),s.jsx(t_,{open:Ct,onOpenChange:Y=>{Mt(Y),Y||Et(!1)},initialName:Nn&&Ee?`${Ee.name} (copy)`:"",title:Nn?"Save as new view":"Save view",onSubmit:$c}),s.jsx(d_,{open:Re!==null,action:(Re==null?void 0:Re.action)??null,assignmentTitle:(Re==null?void 0:Re.item.title)??"Assignment",loading:Ve===(Re?mn(Re.item):null),onOpenChange:Y=>{Y||We(null)},onConfirm:async Y=>{if(!Re)return;const ee=Re;await Mc({item:ee.item,toColumnId:ee.toColumnId,action:ee.action,reason:Y})&&We(null)}}),s.jsx(OA,{anchor:(X==null?void 0:X.anchor)??null,items:X?lY(X.item,{onEdit:()=>{const Y=X.item,ee=Y.projectSlug===null?`/assignments/${Y.id}`:`${Y.projectWorkspace?`/w/${Y.projectWorkspace}`:t}/projects/${Y.projectSlug}/assignments/${Y.slug}`;n(ee)},onDelete:()=>ft(X.item),onMove:()=>me(X.item)}):[],onClose:()=>be(null)}),s.jsx(Ai,{open:He!==null,title:"Delete assignment?",description:He?`"${He.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:Ze!==null,onOpenChange:Y=>{!Y&&Ze===null&&ft(null)},onConfirm:async()=>{if(!He||He.projectSlug===null){ft(null);return}const Y=mn(He);yt(Y);try{const ee=await fetch(`/api/projects/${encodeURIComponent(He.projectSlug)}/assignments/${encodeURIComponent(He.slug)}`,{method:"DELETE"});if(!ee.ok){const ve=await ee.json().catch(()=>({}));throw new Error(ve.error||"Failed to delete assignment")}ft(null),l(),xe("Assignment deleted","success")}catch(ee){xe(ee instanceof Error?ee.message:"Failed to delete assignment","error")}finally{yt(null)}}}),s.jsx(Ow,{open:mt!==null,onOpenChange:Y=>{Y||me(null)},currentWorkspace:(mt==null?void 0:mt.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async Y=>{if(!mt)return;const ee=await fetch(`/api/assignments/${encodeURIComponent(mt.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:Y})});if(!ee.ok){const ve=await ee.json().catch(()=>({}));throw new Error(ve.error||"Failed to move assignment")}l()}})]})}function lY(e,t){const n=[{key:"edit",label:"Edit",icon:hc,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:bn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:qh,onSelect:t.onMove}),n}function cY({detailHref:e,children:t,className:n,...r}){const o=E_(e);return s.jsx("tr",{...r,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function MN({assignment:e,dragging:t,transitioning:n,onPillSelect:r,overrideTargets:o,onOverride:i,onRenameTitle:a}){var p;const l=ad(e),u=!!(r&&a),f=E_(l);return s.jsxs("div",{ref:u?f.containerRef:void 0,className:Ne("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",u&&"cursor-pointer"),onMouseDown:u?f.onMouseDown:void 0,onClick:u?f.onClick:void 0,children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[u?s.jsx(C_,{title:e.title,detailHref:l,onSave:a,disabled:n}):s.jsx($e,{to:l,className:"text-base font-semibold text-foreground hover:text-primary",children:e.title}),s.jsx("p",{className:"text-sm text-muted-foreground",children:e.projectTitle??s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase text-muted-foreground",children:"Standalone"})}),s.jsxs("p",{className:"inline-flex items-center gap-1.5 font-mono text-xs text-muted-foreground/70",title:e.id??"",children:[(p=e.id)==null?void 0:p.slice(0,8),e.id&&s.jsx(Zr,{value:e.id})]})]}),u?s.jsx(JG,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:r,overrideTargets:o,onOverride:i,disabled:n,className:"max-w-[150px]"}):s.jsx(vn,{status:e.status,className:"max-w-[150px]"})]}),e.blockedReason?s.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,s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(Ta,{type:e.type}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs capitalize text-muted-foreground",children:e.priority}),s.jsx("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:e.assignee??"Unassigned"}),e.dependsOn.length>0?s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," ",e.dependsOn.length===1?"dependency":"dependencies"]}):null]}),s.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 text-xs uppercase tracking-[0.08em] text-muted-foreground",children:[s.jsx("span",{children:n?"Updating":t?"Dragging":"Source-first"}),s.jsx("span",{children:Gn(e.updated)})]})]})}function vu(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function mn(e){return e.id||e.slug||"unknown"}function ss(e){const t=e.match(/^---\n([\s\S]*?)\n---\n?/);if(!t)return{order:[],blocks:new Map,body:e};const n=t[1],r=e.slice(t[0].length),o=n.split(`
616
+ `),i=[],a=new Map;let l=null,u=[];const f=()=>{l&&(i.push(l),a.set(l,u))};for(const p of o){const h=p.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(h&&!p.startsWith(" ")){f(),l=h[1],u=[p];continue}l&&u.push(p)}return f(),{order:i,blocks:a,body:r}}function Ec(e){return`---
617
+ ${e.order.map(n=>e.blocks.get(n)).filter(n=>!!n).flat().join(`
618
+ `)}
619
+ ---
620
+
621
+ ${e.body.replace(/^\n+/,"")}`}const uY=/[:#{}[\],&*?|>!%@`]/;function rv(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\(["\\])/g,"$1"):e.length>=2&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1).replace(/''/g,"'"):e}function T_(e){return uY.test(e)||/^\s|\s$/.test(e)||/^["']|["']$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function In(e,t){const n=e.blocks.get(t);if(!(n!=null&&n[0]))return"";const r=n[0].match(/^[^:]+:\s*(.*)$/);if(!r)return"";const o=r[1].trim();return o==="null"?"":rv(o)}function dY(e,t){return In(e,t)==="true"}function fY(e){const t=[];let n="",r=null;for(let o=0;o<e.length;o+=1){const i=e[o];if(r){n+=i,i==="\\"&&r==='"'&&o+1<e.length?(n+=e[o+1],o+=1):i===r&&(r=null);continue}if(i==='"'||i==="'"){r=i,n+=i;continue}if(i===","){t.push(n),n="";continue}n+=i}return t.push(n),t}function Wu(e,t){const n=e.blocks.get(t);if(!(n!=null&&n.length))return[];if(n[0].trim().endsWith("[]"))return[];const o=n[0].match(/^[^:]+:\s*\[(.*)\]\s*$/);return o?fY(o[1]).map(i=>rv(i.trim())).filter(i=>i.length>0):n.slice(1).map(i=>i.trim()).filter(i=>i.startsWith("- ")).map(i=>rv(i.slice(2).trim()))}function pY(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":T_(e)}function Mn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${pY(n)}`])}function qu(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(r=>` - ${T_(r)}`)])}function Ku(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function zm(e){const t=ss(e);return{title:In(t,"title"),slug:In(t,"slug"),workspace:In(t,"workspace"),archived:dY(t,"archived"),archivedAt:In(t,"archivedAt"),archivedReason:In(t,"archivedReason"),tags:Wu(t,"tags").join(", "),body:t.body}}function hY(e,t){const n=ss(e),r={...zm(e),...t};return Mn(n,"title",r.title),Mn(n,"slug",r.slug),Mn(n,"workspace",r.workspace||null),Mn(n,"archived",r.archived),Mn(n,"archivedAt",r.archivedAt||null),Mn(n,"archivedReason",r.archivedReason||null),qu(n,"tags",Ku(r.tags)),n.body=r.body,Ec(n)}function Bm(e){const t=ss(e);return{title:In(t,"title"),slug:In(t,"slug"),status:In(t,"status"),priority:In(t,"priority")||"medium",assignee:In(t,"assignee"),dependsOn:Wu(t,"dependsOn").join(", "),links:Wu(t,"links").join(", "),blockedReason:In(t,"blockedReason"),tags:Wu(t,"tags").join(", "),body:t.body}}function mY(e,t){const n=ss(e),r={...Bm(e),...t};return Mn(n,"title",r.title),Mn(n,"slug",r.slug),Mn(n,"status",r.status),Mn(n,"priority",r.priority),Mn(n,"assignee",r.assignee||null),qu(n,"dependsOn",Ku(r.dependsOn)),qu(n,"links",Ku(r.links)),Mn(n,"blockedReason",r.blockedReason||null),qu(n,"tags",Ku(r.tags)),n.body=r.body,Ec(n)}function Um(e){const t=ss(e);return{assignment:In(t,"assignment"),status:In(t,"status"),body:t.body}}function gY(e,t){const n=ss(e),r={...Um(e),...t};return Mn(n,"assignment",r.assignment),Mn(n,"status",r.status),n.body=r.body,Ec(n)}function Hm(e){const t=ss(e);return{assignment:In(t,"assignment"),body:t.body}}function xY(e,t){const n=ss(e),r={...Hm(e),...t};return Mn(n,"assignment",r.assignment),n.body=r.body,Ec(n)}function Vm(e){const t=ss(e);return{name:In(t,"name"),slug:In(t,"slug"),description:In(t,"description"),whenToUse:In(t,"when_to_use"),tags:Wu(t,"tags").join(", "),body:t.body}}function yY(e,t){const n=ss(e),r={...Vm(e),...t};return Mn(n,"name",r.name),Mn(n,"slug",r.slug),Mn(n,"description",r.description||null),Mn(n,"when_to_use",r.whenToUse||null),qu(n,"tags",Ku(r.tags)),n.body=r.body,Ec(n)}function h0(e){return{body:ss(e).body}}function R_(e){return h0(e)}function A_(e,t){const n=ss(e);return t.body!==void 0&&(n.body=t.body),Ec(n)}function bY(e,t){return A_(e,t)}function Qt(e,t,n){switch(e){case"project":return hY(t,n);case"assignment":return mY(t,n);case"plan":return gY(t,n);case"scratchpad":return xY(t,n);case"playbook":return yY(t,n);case"memory":return A_(t,n);case"resource":return bY(t,n);default:return t}}function Tc({initialContent:e,documentType:t,mode:n="edit",onSave:r,saving:o,error:i,title:a,description:l,onCancel:u,helpTitle:f,helpBody:p,allowSlugEdit:h=!1}){const[g,y]=m.useState(e),[k,v]=m.useState(!1),[b,j]=m.useState("edit");m.useEffect(()=>{y(e)},[e]);const N=kY(t,g),S=g!==e,C=jY(t,g),D=S?"Unsaved changes":n==="create"?"Draft":"Saved",T=t!=="memory"&&t!=="resource";return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"rounded-lg border border-border/70 bg-card/90 p-3 shadow-sm",children:[s.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:a}),s.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:D})]}),l?s.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:l}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("button",{type:"button",onClick:u,className:"shell-action",children:[s.jsx(eh,{className:"h-4 w-4"}),s.jsx("span",{children:"Back"})]}),T?s.jsxs("button",{type:"button",onClick:()=>v(R=>!R),className:"shell-action",children:[s.jsx(FL,{className:"h-4 w-4"}),s.jsx("span",{children:k?"Structured":"Raw Markdown"})]}):null,s.jsxs("button",{type:"button",onClick:()=>r(g),disabled:o||N.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:[s.jsx(Gh,{className:"h-4 w-4"}),s.jsx("span",{children:o?"Saving…":"Save"})]})]})]}),i?s.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,N.length>0?s.jsx("div",{className:"mt-4 rounded-md border border-warning-foreground/30 bg-warning px-4 py-3 text-sm text-warning-foreground",children:s.jsx("ul",{className:"space-y-1",children:N.map(R=>s.jsx("li",{children:R},R))})}):null]}),s.jsxs("div",{className:"flex items-center gap-2 md:hidden",children:[s.jsx("button",{type:"button",onClick:()=>j("edit"),className:`shell-action ${b==="edit"?"shell-action--cta":""}`,children:"Edit"}),s.jsxs("button",{type:"button",onClick:()=>j("preview"),className:`shell-action ${b==="preview"?"shell-action--cta":""}`,children:[s.jsx(p1,{className:"h-4 w-4"}),"Preview"]})]}),s.jsxs("div",{className:"grid gap-3 xl:grid-cols-[minmax(0,1.2fr)_minmax(320px,0.8fr)]",children:[s.jsx("div",{className:b==="preview"?"hidden md:block":"",children:s.jsx("div",{className:"surface-panel space-y-3",children:k?s.jsx("textarea",{value:g,onChange:R=>y(R.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}):s.jsx(vY,{documentType:t,content:g,onChange:y,allowSlugEdit:h})})}),s.jsx("div",{className:b==="edit"?"hidden md:block":"",children:s.jsxs("div",{className:"surface-panel sticky top-16 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(p1,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),s.jsx(xn,{content:C,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function vY({documentType:e,content:t,onChange:n,allowSlugEdit:r}){const o=Es();if(e==="project"){const a=zm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(wu,{children:[s.jsx(Ut,{label:"Project title",children:s.jsx("input",{value:a.title,onChange:l=>{const u=l.target.value,f={title:u};r&&(a.slug===Pr(a.title)||!a.slug.trim())&&(f.slug=Pr(u)),n(Qt(e,t,f))},className:"editor-input"})}),s.jsx(Ut,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:l=>n(Qt(e,t,{slug:Pr(l.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"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."})]})}),s.jsx(Ut,{label:"Tags",children:s.jsx("input",{value:a.tags,onChange:l=>n(Qt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(wY,{value:a.workspace,onChange:l=>n(Qt(e,t,{workspace:l}))})]}),s.jsx(Ut,{label:"Project body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const a=Bm(t),l=NA(o),u=!l.some(f=>f.id===a.status);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(wu,{children:[s.jsx(Ut,{label:"Assignment title",children:s.jsx("input",{value:a.title,onChange:f=>{const p=f.target.value,h={title:p};r&&(a.slug===Pr(a.title)||!a.slug.trim())&&(h.slug=Pr(p)),n(Qt(e,t,h))},className:"editor-input"})}),s.jsx(Ut,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:f=>n(Qt(e,t,{slug:Pr(f.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"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."})]})}),s.jsx(Ut,{label:"Status",children:s.jsxs("select",{value:a.status,onChange:f=>n(Qt(e,t,{status:f.target.value})),className:"editor-input",children:[u?s.jsx("option",{value:a.status,children:No(o,a.status)}):null,l.map(f=>s.jsx("option",{value:f.id,children:f.label},f.id))]})}),s.jsx(Ut,{label:"Priority",children:s.jsxs("select",{value:a.priority,onChange:f=>n(Qt(e,t,{priority:f.target.value})),className:"editor-input",children:[s.jsx("option",{value:"low",children:"Low"}),s.jsx("option",{value:"medium",children:"Medium"}),s.jsx("option",{value:"high",children:"High"}),s.jsx("option",{value:"critical",children:"Critical"})]})}),s.jsx(Ut,{label:"Assignee",children:s.jsx("input",{value:a.assignee,onChange:f=>n(Qt(e,t,{assignee:f.target.value})),placeholder:"Agent name",className:"editor-input"})}),s.jsx(Ut,{label:"Depends on",className:"md:col-span-2",children:s.jsx("input",{value:a.dependsOn,onChange:f=>n(Qt(e,t,{dependsOn:f.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),s.jsx(Ut,{label:"Links",className:"md:col-span-2",children:s.jsx("input",{value:a.links,onChange:f=>n(Qt(e,t,{links:f.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),s.jsx(Ut,{label:"Blocked reason",className:"md:col-span-2",children:s.jsx("input",{value:a.blockedReason,onChange:f=>n(Qt(e,t,{blockedReason:f.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),s.jsx(Ut,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:a.tags,onChange:f=>n(Qt(e,t,{tags:f.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),s.jsx(Ut,{label:"Assignment body",children:s.jsx("textarea",{value:a.body,onChange:f=>n(Qt(e,t,{body:f.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const a=Um(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(wu,{children:[s.jsx(Ut,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),s.jsx(Ut,{label:"Plan status",children:s.jsxs("select",{value:a.status,onChange:l=>n(Qt(e,t,{status:l.target.value})),className:"editor-input",children:[s.jsx("option",{value:"draft",children:"Draft"}),s.jsx("option",{value:"approved",children:"Approved"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"})]})})]}),s.jsx(Ut,{label:"Plan body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const a=Hm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(wu,{children:s.jsx(Ut,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),s.jsx(Ut,{label:"Scratchpad body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Qt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const a=e==="memory"?h0(t):R_(t),l=e==="memory"?"Memory body":"Resource body";return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ut,{label:l,children:s.jsx("textarea",{value:a.body,onChange:u=>n(Qt(e,t,{body:u.target.value})),className:"editor-textarea",spellCheck:!1})}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"Frontmatter (name, scope/category, source, related assignments, tags) is preserved server-side on save."})]})}const i=Vm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(wu,{children:[s.jsx(Ut,{label:"Playbook name",children:s.jsx("input",{value:i.name,onChange:a=>{const l=a.target.value,u={name:l};r&&(i.slug===Pr(i.name)||!i.slug.trim())&&(u.slug=Pr(l)),n(Qt(e,t,u))},className:"editor-input"})}),s.jsx(Ut,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:i.slug,disabled:!r,onChange:a=>n(Qt(e,t,{slug:Pr(a.target.value)})),className:`editor-input ${r?"":"editor-input-disabled"}`}),s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:r?"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."})]})}),s.jsx(Ut,{label:"Description",className:"md:col-span-2",children:s.jsx("input",{value:i.description,onChange:a=>n(Qt(e,t,{description:a.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),s.jsx(Ut,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:i.tags,onChange:a=>n(Qt(e,t,{tags:a.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(Ut,{label:"When to use",className:"md:col-span-2",children:s.jsx("input",{value:i.whenToUse,onChange:a=>n(Qt(e,t,{whenToUse:a.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),s.jsx(Ut,{label:"Playbook rules",children:s.jsx("textarea",{value:i.body,onChange:a=>n(Qt(e,t,{body:a.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function wu({children:e}){return s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ut({label:e,children:t,className:n}){return s.jsxs("label",{className:`block space-y-2 ${n??""}`,children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:e}),t]})}function wY({value:e,onChange:t}){const{data:n}=Na(),r=(n==null?void 0:n.workspaces)??[];return s.jsx(Ut,{label:"Workspace",children:s.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"editor-input",children:[s.jsx("option",{value:"",children:"Ungrouped"}),r.map(o=>s.jsx("option",{value:o,children:o},o))]})})}function jY(e,t){switch(e){case"project":return zm(t).body;case"assignment":return Bm(t).body;case"plan":return Um(t).body;case"scratchpad":return Hm(t).body;case"playbook":return Vm(t).body;case"memory":return h0(t).body;case"resource":return R_(t).body}}function kY(e,t){switch(e){case"project":{const n=zm(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Dp(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"assignment":{const n=Bm(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Dp(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"plan":return Um(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return Hm(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Vm(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Dp(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"memory":case"resource":return[]}}function LN(){const e=Ht(),{workspace:t}=Vt(),n=pn(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{fetch("/api/templates/project").then(g=>g.json()).then(g=>{let y=g.content;t&&t!=="_ungrouped"&&(y=y.replace(/^(tags: \[\])$/m,`$1
622
+ workspace: ${t}`)),o(y),a(!1)}).catch(g=>{p(g.message),a(!1)})},[t]);async function h(g){u(!0),p(null);try{const y=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),k=await y.json();if(!y.ok){p(k.error||`HTTP ${y.status}`),u(!1);return}e(`${n}/projects/${k.slug}`)}catch(y){p(y.message),u(!1);return}u(!1)}return i?s.jsx(jt,{label:"Loading project template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Tc,{initialContent:r||"",documentType:"project",mode:"create",onSave:h,saving:l,error:f,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 ON(){const{slug:e}=Vt(),t=pn(),n=Ht(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{fetch("/api/templates/assignment").then(g=>g.json()).then(g=>{o(g.content),a(!1)}).catch(g=>{p(g.message),a(!1)})},[]);async function h(g){if(!e){p("Project slug is required.");return}u(!0),p(null);try{const y=await fetch(`/api/projects/${e}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),k=await y.json();if(!y.ok){p(k.error||`HTTP ${y.status}`),u(!1);return}n(`${t}/projects/${e}/assignments/${k.slug}`)}catch(y){p(y.message),u(!1);return}u(!1)}return i?s.jsx(jt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Tc,{initialContent:r||"",documentType:"assignment",mode:"create",onSave:h,saving:l,error:f,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 FN(){const{workspace:e}=Vt(),t=pn(),n=Ht(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,u]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{const g=new URLSearchParams({standalone:"1"});e&&g.set("workspace",e),fetch(`/api/templates/assignment?${g.toString()}`).then(y=>y.json()).then(y=>{o(y.content),a(!1)}).catch(y=>{p(y.message),a(!1)})},[e]);async function h(g){var y;u(!0),p(null);try{const k=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),v=await k.json();if(!k.ok){p(v.error||`HTTP ${k.status}`),u(!1);return}const b=(y=v==null?void 0:v.assignment)==null?void 0:y.id;if(!b){p("Server did not return the new assignment id."),u(!1);return}n(`/assignments/${b}`)}catch(k){p(k.message),u(!1);return}u(!1)}return i?s.jsx(jt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Rt,{error:f}):s.jsx(Tc,{initialContent:r||"",documentType:"assignment",mode:"create",onSave:h,saving:l,error:f,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 Rc({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,documentType:i,helpTitle:a,helpBody:l}){const u=Ht(),{data:f,loading:p,error:h}=T2(e),[g,y]=m.useState(!1),[k,v]=m.useState(null);async function b(j){y(!0),v(null);try{const N=await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})}),S=await N.json();if(!N.ok){v(S.error||`HTTP ${N.status}`),y(!1);return}u(n)}catch(N){v(N.message),y(!1);return}y(!1)}return p?s.jsx(jt,{label:`Loading ${r.toLowerCase()}…`}):h||!f?s.jsx(Rt,{error:h||`${r} is unavailable.`}):s.jsx(Tc,{initialContent:f.content,documentType:i,onSave:b,saving:g,error:k,title:r,description:o,onCancel:()=>u(n),helpTitle:a,helpBody:l})}function zN(){const{slug:e}=Vt(),t=pn(),n=e??"";return s.jsx(Rc,{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 Iy(){const{slug:e,aslug:t,id:n}=Vt(),r=pn(),o=!!n,i=o?`/api/assignments/${n}/edit`:`/api/projects/${e}/assignments/${t}/edit`,a=o?`/api/assignments/${n}`:`/api/projects/${e}/assignments/${t}`,l=o?`/assignments/${n}`:`${r}/projects/${e}/assignments/${t}`;return s.jsx(Rc,{loadUrl:i,saveUrl:a,redirectTo:l,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 My(){const{slug:e,aslug:t,id:n}=Vt(),r=pn(),o=!!n,i=o?`/api/assignments/${n}/plan/edit`:`/api/projects/${e}/assignments/${t}/plan/edit`,a=o?`/api/assignments/${n}/plan`:`/api/projects/${e}/assignments/${t}/plan`,l=o?`/assignments/${n}?tab=plan`:`${r}/projects/${e}/assignments/${t}?tab=plan`;return s.jsx(Rc,{loadUrl:i,saveUrl:a,redirectTo:l,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 Ly(){const{slug:e,aslug:t,id:n}=Vt(),r=pn(),o=!!n,i=o?`/api/assignments/${n}/scratchpad/edit`:`/api/projects/${e}/assignments/${t}/scratchpad/edit`,a=o?`/api/assignments/${n}/scratchpad`:`/api/projects/${e}/assignments/${t}/scratchpad`,l=o?`/assignments/${n}?tab=scratchpad`:`${r}/projects/${e}/assignments/${t}?tab=scratchpad`;return s.jsx(Rc,{loadUrl:i,saveUrl:a,redirectTo:l,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 P_({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,helpTitle:i,helpBody:a}){const l=Ht(),{data:u,loading:f,error:p}=T2(e),[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState(!1),[j,N]=m.useState(null);async function S(){b(!0),N(null);try{const C=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:h,body:y})}),D=await C.json();if(!C.ok){N(D.error||`HTTP ${C.status}`),b(!1);return}l(n)}catch(C){N(C.message),b(!1);return}b(!1)}return f?s.jsx(jt,{label:`Loading ${r.toLowerCase()}…`}):p||!u?s.jsx(Rt,{error:p||`${r} is unavailable.`}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Xe,{title:r,description:o,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("label",{className:"block space-y-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry title"}),s.jsx("input",{value:h,onChange:C=>g(C.target.value),placeholder:"Optional title",className:"editor-input"})]}),s.jsxs("label",{className:"block space-y-2",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:"Entry body"}),s.jsx("textarea",{value:y,onChange:C=>k(C.target.value),className:"editor-textarea",spellCheck:!1})]}),j?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:j}):null,s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx("button",{type:"button",onClick:()=>l(n),className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:S,disabled:v||!y.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:v?"Appending…":"Append Entry"})]})]})}),s.jsx(Xe,{title:"Current Document",children:s.jsx(xn,{content:u.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function Oy(){const{slug:e,aslug:t,id:n}=Vt(),r=pn(),o=!!n,i=o?`/api/assignments/${n}/handoff/edit`:`/api/projects/${e}/assignments/${t}/handoff/edit`,a=o?`/api/assignments/${n}/handoff/entries`:`/api/projects/${e}/assignments/${t}/handoff/entries`,l=o?`/assignments/${n}?tab=handoff`:`${r}/projects/${e}/assignments/${t}?tab=handoff`;return s.jsx(P_,{loadUrl:i,saveUrl:a,redirectTo:l,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 Fy(){const{slug:e,aslug:t,id:n}=Vt(),r=pn(),o=!!n,i=o?`/api/assignments/${n}/decision-record/edit`:`/api/projects/${e}/assignments/${t}/decision-record/edit`,a=o?`/api/assignments/${n}/decision-record/entries`:`/api/projects/${e}/assignments/${t}/decision-record/entries`,l=o?`/assignments/${n}?tab=decisions`:`${r}/projects/${e}/assignments/${t}?tab=decisions`;return s.jsx(P_,{loadUrl:i,saveUrl:a,redirectTo:l,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 BN(){const{workspace:e}=Vt(),{data:t}=Zs(),{data:n,loading:r,error:o,refetch:i}=Bv(),{toast:a,showToast:l,dismissToast:u}=wr(),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState(!1),[v,b]=m.useState(null),[j,N]=m.useState(!1),S=er();m.useEffect(()=>{const _=S.hash.match(/^#server-(.+)/);if(!_)return;const U=decodeURIComponent(_[1]),I=document.querySelector(`[data-server-name="${window.CSS.escape(U)}"]`);if(!I)return;I.scrollIntoView({block:"nearest"}),I.classList.add("ring-2","ring-primary/60");const V=window.setTimeout(()=>I.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(V)},[S.hash,n]);const C=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const _=new Set(t.filter(U=>e==="_ungrouped"?U.workspace===null:U.workspace===e).map(U=>U.slug));return n.sessions.filter(U=>U.windows.some(I=>I.panes.some(V=>V.assignment&&V.assignment.project!==null&&_.has(V.assignment.project))))})();async function D(_){if(_.preventDefault(),!!h.trim())try{const U=await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h.trim()})});if(!U.ok){const I=await U.json().catch(()=>null);l((I==null?void 0:I.error)||`HTTP ${U.status}`,"error");return}g(""),p(!1),i(),l(`Tracking "${h.trim()}"`,"success")}catch(U){l(U instanceof Error?U.message:"Failed to register session","error")}}async function T(){k(!0);try{const _=await fetch("/api/servers/refresh",{method:"POST"});if(!_.ok){const U=await _.json().catch(()=>null);l((U==null?void 0:U.error)||`HTTP ${_.status}`,"error");return}i()}catch(_){l(_ instanceof Error?_.message:"Failed to refresh sessions","error")}finally{k(!1)}}async function R(_){N(!0);try{const U=await fetch(`/api/servers/${encodeURIComponent(_)}`,{method:"DELETE"});if(!U.ok){const I=await U.json().catch(()=>null);l((I==null?void 0:I.error)||`HTTP ${U.status}`,"error");return}b(null),i(),l(`Stopped tracking "${_}"`,"success")}catch(U){l(U instanceof Error?U.message:"Failed to remove session","error")}finally{N(!1)}}async function $(_){try{const U=await fetch(`/api/servers/${encodeURIComponent(_)}/refresh`,{method:"POST"});if(!U.ok){const I=await U.json().catch(()=>null);l((I==null?void 0:I.error)||`HTTP ${U.status}`,"error");return}i()}catch(U){l(U instanceof Error?U.message:"Failed to refresh session","error")}}return r?s.jsx(jt,{label:"Loading servers…"}):o?s.jsx(Rt,{error:o}):n?n.tmuxAvailable?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f?s.jsxs("form",{onSubmit:D,className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:h,onChange:_=>g(_.target.value),placeholder:"tmux session name",className:"editor-input text-sm",autoFocus:!0}),s.jsx("button",{type:"submit",className:"shell-action",children:"Add"}),s.jsx("button",{type:"button",className:"shell-action",onClick:()=>p(!1),children:"Cancel"})]}):s.jsxs("button",{className:"shell-action",onClick:()=>p(!0),children:[s.jsx(It,{className:"h-3.5 w-3.5"}),"Track Session"]}),s.jsxs("button",{className:"shell-action",onClick:T,disabled:y,children:[s.jsx(t2,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`}),"Refresh All"]})]}),C.length===0?s.jsx(Nt,{title:"No sessions tracked",description:"Register a tmux session to start tracking your dev servers."}):s.jsx("div",{className:"mt-4 space-y-4",children:C.map(_=>s.jsx(SY,{session:_,onRefresh:()=>$(_.name),onRemove:()=>b(_.name),onRefetch:i},_.name))}),s.jsx(Ai,{open:v!==null,title:"Stop tracking session?",description:`Remove "${v??""}" from tracked servers. This does not stop the tmux session itself.`,confirmLabel:"Stop Tracking",destructive:!0,loading:j,onOpenChange:_=>{!_&&!j&&b(null)},onConfirm:async()=>{v&&await R(v)}}),s.jsx(Hr,{toast:a,onDismiss:u})]}):s.jsx(s.Fragment,{children:s.jsxs("div",{className:"surface-panel mt-4 flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx(_l,{className:"h-10 w-10 text-muted-foreground/40"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"tmux is not installed"}),s.jsxs("p",{className:"max-w-md text-sm text-muted-foreground",children:["Server tracking requires tmux. Install it with ",s.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"brew install tmux"})," to get started."]})]})}):null}function SY({session:e,onRefresh:t,onRemove:n,onRefetch:r}){return s.jsxs("div",{className:"surface-panel","data-server-name":e.name,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Mv,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),s.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"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last refreshed: ",new Date(e.lastRefreshed).toLocaleString()]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{className:"shell-action",onClick:t,title:"Refresh",children:s.jsx(t2,{className:"h-3.5 w-3.5"})}),s.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})]}),e.alive&&e.windows.length>0&&s.jsx("div",{className:"mt-3 space-y-3",children:e.windows.map(o=>s.jsxs("div",{children:[s.jsxs("p",{className:"mb-1.5 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:["Window ",o.index,": ",o.name]}),s.jsx("div",{className:"space-y-1.5",children:o.panes.map(i=>s.jsx(NY,{pane:i,sessionName:e.name,windowIndex:o.index,onRefetch:r},`${o.index}:${i.index}`))})]},o.index))}),!e.alive&&s.jsxs("div",{className:"mt-3 flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(a4,{className:"h-4 w-4"}),s.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function NY({pane:e,sessionName:t,windowIndex:n,onRefetch:r}){const o=pn(),i=e.cwd.replace(/^\/Users\/[^/]+/,"~");return s.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2 text-sm",children:[s.jsxs("span",{className:"shrink-0 font-mono text-xs text-muted-foreground/60",children:[":",e.index]}),s.jsx("span",{className:"shrink-0 rounded bg-muted/60 px-1.5 py-0.5 font-mono text-xs",children:e.command}),s.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("span",{className:"block min-w-0 truncate",title:e.cwd,children:i}),s.jsx(Zr,{value:e.cwd})]}),e.branch&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Dv,{className:"h-3 w-3"}),e.branch,e.worktree&&s.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&&s.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:e.urls.map(a=>s.jsxs("a",{href:a,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:[a.replace("http://localhost:",":"),s.jsx(fc,{className:"h-2.5 w-2.5"})]},a))}),s.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?s.jsxs($e,{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:[s.jsx(XL,{className:"h-2.5 w-2.5"}),e.assignment.title,e.assignment.project===null?s.jsx("span",{className:"ml-1 rounded bg-muted px-1 py-0.5 text-[9px] uppercase tracking-wide text-muted-foreground",children:"Standalone"}):null]}):s.jsx("span",{className:"text-xs text-muted-foreground/40",children:"unlinked"})})]})}function __(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 CY(e,t){const n=Date.parse(e),r=Math.floor((n-t)/1e3);return Number.isNaN(r)?"–":r<=0?"expired":__(r)}function EY(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 TY(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function UN(){const{data:e,loading:t,error:n,refetch:r}=R2(),[o,i]=m.useState(()=>Date.now()),[a,l]=m.useState(null),[u,f]=m.useState(!1);if(m.useEffect(()=>{const h=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(h)},[]),t)return s.jsx(jt,{label:"Loading inventories…"});if(n)return s.jsx(Rt,{title:"Could not load inventories",error:n,action:s.jsx("button",{type:"button",onClick:r,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});if(!e||e.inventories.length===0)return s.jsx(Nt,{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 p(){if(a){f(!0);try{const h=await fetch(`/api/leases/${encodeURIComponent(a.slug)}/force-release/${encodeURIComponent(a.lease.lease_id)}`,{method:"POST"});if(!h.ok){const g=await h.json().catch(()=>null);throw new Error((g==null?void 0:g.error)??`HTTP ${h.status}`)}r(),l(null)}catch(h){window.alert(h instanceof Error?`Force release failed: ${h.message}`:"Force release failed")}finally{f(!1)}}}return s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{className:"flex items-start justify-between",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Inventories"}),s.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."})]})}),s.jsx("div",{className:"grid gap-4",children:e.inventories.map(h=>s.jsx(RY,{detail:h,now:o,onForceRelease:g=>l({slug:h.inventory.slug,lease:g})},h.inventory.slug))}),s.jsx(Ai,{open:a!==null,title:"Force release this lease?",description:a?`This will revoke lease ${a.lease.lease_id} and (if it's still the current holder) free member ${a.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:u,onConfirm:p,onOpenChange:h=>{h||l(null)}})]})}function RY({detail:e,now:t,onForceRelease:n}){const{inventory:r,members:o,active_leases:i}=e,a=o.filter(u=>u.status==="idle").length,l=o.filter(u=>u.status==="leased").length;return s.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsxs("h2",{className:"text-lg font-semibold",children:[s.jsx(Av,{className:"mr-2 inline h-4 w-4 text-muted-foreground"}),r.display_name??r.slug]}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:[s.jsx("code",{className:"font-mono",children:r.slug})," · kind=",r.kind," · default TTL=",__(r.default_ttl_s)]})]}),s.jsx("div",{className:"text-right text-xs text-muted-foreground",children:s.jsxs("div",{children:[a," idle · ",l," leased · ",o.length," total"]})})]}),s.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:o.map(u=>s.jsx(AY,{member:u},u.member_id))}),i.length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Active leases"}),s.jsx("div",{className:"mt-2 space-y-2",children:i.map(u=>s.jsx(PY,{lease:u,now:t,onForceRelease:()=>n(u)},u.lease_id))})]})]})}function AY({member:e}){const t=TY(e.metadata_json);return s.jsxs("div",{className:"rounded-md border bg-muted/40 px-3 py-2 text-sm",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"font-mono",children:e.member_id}),s.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${EY(e.status)}`,children:e.status})]}),t&&s.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:Object.entries(t).map(([n,r])=>s.jsxs("div",{className:"truncate",children:[s.jsx("span",{className:"font-mono",children:n}),"=",s.jsx("span",{className:"font-mono",children:String(r)})]},n))})]})}function PY({lease:e,now:t,onForceRelease:n}){return s.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/20 px-3 py-2 text-sm",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.lease_id.slice(0,8),"…"]}),s.jsx("span",{className:"font-mono",children:e.member_id}),e.requested_for&&s.jsxs("span",{className:"text-xs text-muted-foreground",children:["for ",e.requested_for]})]})}),s.jsxs("div",{className:"ml-3 flex items-center gap-3",children:[s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(DL,{className:"h-3 w-3"}),CY(e.expires_at,t)]}),s.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:[s.jsx(u4,{className:"h-3 w-3"}),"Force release"]})]})]})}function _Y(e){switch(e.kind){case"at":return`at ${e.at}`;case"in":return`in ${Math.round((e.durationMs??0)/1e3)}s`;case"cron":return`cron ${e.expr}${e.tz?` (${e.tz})`:""}`;case"after-reset":return`after ${e.provider} reset`;case"when-status":return`when ${e.assignmentId??"this"} → ${e.status}`;case"when-plan-lands":return`when ${e.assignmentId??"this"} plan lands`;default:return e.kind}}async function DY(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function $Y(e){const t=await fetch("/api/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`);return n.schedule}async function IY(e){const t=await fetch(`/api/schedules/${encodeURIComponent(e)}/cancel`,{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>null);throw new Error((n==null?void 0:n.error)??`HTTP ${t.status}`)}}function MY(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[o,i]=m.useState(null),a=m.useCallback(async()=>{try{t(await DY()),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch schedules")}finally{r(!1)}},[]);return m.useEffect(()=>{a()},[a]),gc(l=>{l.type==="schedules-updated"&&a()}),{data:e,loading:n,error:o,refetch:a}}const LY=[{value:"cron",label:"Cron expression"},{value:"at",label:"At a timestamp"},{value:"in",label:"After a delay"},{value:"after-reset",label:"After quota reset"},{value:"when-status",label:"When assignment reaches status"},{value:"when-plan-lands",label:"When plan lands"}];function OY({open:e,onOpenChange:t,onCreated:n}){const[r,o]=m.useState(""),[i,a]=m.useState("claude"),[l,u]=m.useState("cron"),[f,p]=m.useState(!0),[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState("0 3 * * *"),[j,N]=m.useState(""),[S,C]=m.useState(""),[D,T]=m.useState("5"),[R,$]=m.useState("claude"),[_,U]=m.useState(""),[I,V]=m.useState("rolling-5h"),[O,P]=m.useState("ready_to_implement"),[L,B]=m.useState(""),[q,z]=m.useState(!1),[W,M]=m.useState(null);function F(){switch(l){case"cron":return{kind:l,expr:v,...j?{tz:j}:{}};case"at":return{kind:l,at:S};case"in":return{kind:l,durationMs:Math.round(Number(D)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:l,provider:R,anchor:{windowStartIso:_||new Date().toISOString(),windowKind:I}};case"when-status":return{kind:l,status:O,...L?{assignmentId:L}:{}};case"when-plan-lands":return{kind:l,...L?{assignmentId:L}:{}}}}async function G(){z(!0),M(null);try{const te={assignmentId:r.trim(),agentId:i.trim(),trigger:F(),unattended:f,terminalPreference:h.trim()||null,promptTemplate:y.trim()||null};if(!te.assignmentId)throw new Error("Assignment id is required");await $Y(te),n(),t(!1)}catch(te){M(te instanceof Error?te.message:"Create failed")}finally{z(!1)}}const H="w-full rounded border bg-background px-2 py-1 text-sm",Q="block text-xs font-medium text-muted-foreground";return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsxs(jn,{className:"max-h-[90vh] overflow-y-auto",children:[s.jsxs(tr,{className:"flex-row items-center justify-between space-y-0",children:[s.jsx(kn,{children:"New schedule"}),s.jsx(ST,{className:"text-muted-foreground transition hover:text-foreground","aria-label":"Close",children:s.jsx(Td,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Assignment id / slug"}),s.jsx("input",{autoFocus:!0,className:H,value:r,onChange:te=>o(te.target.value),placeholder:"scheduled-agents"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Agent"}),s.jsx("input",{className:H,value:i,onChange:te=>a(te.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Terminal (optional)"}),s.jsx("input",{className:H,value:h,onChange:te=>g(te.target.value),placeholder:"default"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Trigger"}),s.jsx("select",{className:H,value:l,onChange:te=>u(te.target.value),children:LY.map(te=>s.jsx("option",{value:te.value,children:te.label},te.value))})]}),l==="cron"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Cron expr"}),s.jsx("input",{className:H,value:v,onChange:te=>b(te.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Timezone (optional)"}),s.jsx("input",{className:H,value:j,onChange:te=>N(te.target.value),placeholder:"local"})]})]}),l==="at"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"ISO timestamp"}),s.jsx("input",{className:H,value:S,onChange:te=>C(te.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),l==="in"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Delay (hours)"}),s.jsx("input",{className:H,type:"number",value:D,onChange:te=>T(te.target.value)})]}),l==="after-reset"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Provider"}),s.jsxs("select",{className:H,value:R,onChange:te=>$(te.target.value),children:[s.jsx("option",{value:"claude",children:"claude"}),s.jsx("option",{value:"codex",children:"codex"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Window kind"}),s.jsxs("select",{className:H,value:I,onChange:te=>V(te.target.value),children:[s.jsx("option",{value:"rolling-5h",children:"rolling-5h"}),s.jsx("option",{value:"weekly",children:"weekly"})]})]}),s.jsxs("div",{className:"col-span-2",children:[s.jsx("label",{className:Q,children:"Window start (optional ISO)"}),s.jsx("input",{className:H,value:_,onChange:te=>U(te.target.value),placeholder:"now"})]})]}),l==="when-status"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Status"}),s.jsx("input",{className:H,value:O,onChange:te=>P(te.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Watch assignment (optional)"}),s.jsx("input",{className:H,value:L,onChange:te=>B(te.target.value),placeholder:"this assignment"})]})]}),l==="when-plan-lands"&&s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Watch assignment (optional)"}),s.jsx("input",{className:H,value:L,onChange:te=>B(te.target.value),placeholder:"this assignment"})]}),s.jsxs("div",{children:[s.jsx("label",{className:Q,children:"Prompt template (optional)"}),s.jsx("input",{className:H,value:y,onChange:te=>k(te.target.value),placeholder:"plan @assignment"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:f,onChange:te=>p(te.target.checked)}),"Unattended (hard limits + kill switch apply)"]}),W&&s.jsx("p",{className:"text-sm text-destructive",children:W})]}),s.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"rounded border px-3 py-1 text-sm",children:"Cancel"}),s.jsx("button",{type:"button",onClick:G,disabled:q,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:q?"Creating…":"Create"})]})]})})}const FY=new Set(["completed","failed","launch_failed","cancelled","killed"]);function zY(e){return e==="running"?"bg-green-500/15 text-green-400 border-green-500/30":e==="eligible"?"bg-blue-500/15 text-blue-400 border-blue-500/30":e==="held"?"bg-amber-500/15 text-amber-400 border-amber-500/30":e==="launch_failed"||e==="failed"||e==="killed"?"bg-red-500/15 text-red-400 border-red-500/30":"bg-zinc-500/15 text-zinc-400 border-zinc-500/30"}function BY(){const{data:e,loading:t,error:n,refetch:r}=MY(),[o,i]=m.useState(!1);if(t)return s.jsx(jt,{label:"Loading schedules…"});if(n)return s.jsx(Rt,{title:"Could not load schedules",error:n,action:s.jsx("button",{type:"button",onClick:r,className:"rounded border px-3 py-1 text-sm",children:"Retry"})});async function a(l){try{await IY(l.id),r()}catch(u){window.alert(u instanceof Error?`Cancel failed: ${u.message}`:"Cancel failed")}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Schedules"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Run work on an assignment unattended — on a clock, after a quota reset, or when an assignment reaches a status. The scheduler tick is the sole authority; this page calls the same CLI verbs."})]}),s.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex items-center gap-1 rounded bg-primary px-3 py-1.5 text-sm text-primary-foreground",children:[s.jsx(It,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?s.jsx(Nt,{title:"No schedules yet",description:"Create one above, or with `syntaur schedule create --assignment <id> --cron '0 3 * * *'`."}):s.jsx("div",{className:"grid gap-2",children:e.map(l=>s.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-card p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(GE,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"font-mono text-sm",children:l.assignmentId}),s.jsx("span",{className:`rounded border px-1.5 py-0.5 text-xs ${zY(l.attempt.state)}`,children:l.attempt.state}),!l.unattended&&s.jsx("span",{className:"text-xs text-muted-foreground",children:"interactive"})]}),s.jsxs("div",{className:"mt-0.5 text-xs text-muted-foreground",children:[_Y(l.trigger)," · agent ",s.jsx("code",{className:"font-mono",children:l.agentId}),l.attempt.lastError&&s.jsxs("span",{className:"text-destructive",children:[" · ",l.attempt.lastError]})]})]}),!FY.has(l.attempt.state)&&s.jsxs("button",{type:"button",onClick:()=>a(l),className:"flex items-center gap-1 rounded border border-destructive/40 px-2 py-1 text-xs text-destructive hover:bg-destructive/10",children:[s.jsx(NL,{className:"h-3 w-3"}),"Cancel"]})]},l.id))}),s.jsx(OY,{open:o,onOpenChange:i,onCreated:r})]})}const UY={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},di="rounded-md border border-border/60 bg-background px-2 py-1 text-sm text-foreground focus:border-primary focus:outline-none focus:ring-2 focus:ring-ring/30";function HN(){const[e,t]=Ns(),n=fO(e),r=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Zs(),{data:a}=Na(),{data:l}=A2(),[u,f]=m.useState(null),[p,h]=m.useState(!0),[g,y]=m.useState(null),[k,v]=m.useState(0);m.useEffect(()=>{if(!e.get("window")){const N=gb({window:"30d",...n});o==="assignment"&&N.set("groupBy","assignment"),t(N,{replace:!0})}},[]);const b=N2({window:r,...n}).toString();m.useEffect(()=>{const N=new AbortController;h(!0),y(null);const S=b?`/api/usage?${b}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(S,{signal:N.signal}).then(async C=>{if(!C.ok){const D=await C.json().catch(()=>({}));throw new Error(D.error??`HTTP ${C.status}`)}return C.json()}).then(C=>{f(C),h(!1)}).catch(C=>{C instanceof Error&&C.name==="AbortError"||(y(C instanceof Error?C.message:String(C)),h(!1))}),()=>N.abort()},[b,o,k]);function j(N,S=o){const C=gb(N);S==="assignment"&&C.set("groupBy","assignment"),t(C)}return s.jsxs("div",{className:"p-6 max-w-7xl mx-auto",children:[s.jsxs("header",{className:"flex items-center gap-3 mb-6",children:[s.jsx(Kh,{className:"w-6 h-6 text-primary"}),s.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Token usage"})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-card border border-border/60",children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Window"}),s.jsx("select",{value:r,onChange:N=>j({...n,window:N.target.value}),className:di,children:Xh.map(N=>s.jsx("option",{value:N,children:UY[N]},N))})]}),r==="custom"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Since"}),s.jsx("input",{type:"date",value:n.since??"",onChange:N=>j({...n,window:"custom",since:N.target.value||void 0}),className:di})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Until"}),s.jsx("input",{type:"date",value:n.until??"",onChange:N=>j({...n,window:"custom",until:N.target.value||void 0}),className:di})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Workspace"}),s.jsxs("select",{value:n.workspace??"",onChange:N=>j({...n,workspace:N.target.value||void 0,project:void 0}),className:di,children:[s.jsx("option",{value:"",children:"All"}),a!=null&&a.hasUngrouped?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,((a==null?void 0:a.workspaces)??[]).map(N=>s.jsx("option",{value:N,children:N},N))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Project"}),s.jsxs("select",{value:n.project??"",onChange:N=>j({...n,project:N.target.value||void 0,workspace:void 0}),className:di,children:[s.jsx("option",{value:"",children:"All"}),(i??[]).map(N=>s.jsx("option",{value:N.slug,children:N.slug},N.slug))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Model"}),s.jsxs("select",{value:n.model??"",onChange:N=>j({...n,model:N.target.value||void 0}),className:di,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.models)??[]).map(N=>s.jsx("option",{value:N,children:N},N))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Tool"}),s.jsxs("select",{value:n.tool??"",onChange:N=>j({...n,tool:N.target.value||void 0}),className:di,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.tools)??[]).map(N=>s.jsx("option",{value:N,children:N},N))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-muted-foreground",children:"Group by"}),s.jsxs("select",{value:o,onChange:N=>j(n,N.target.value),className:di,children:[s.jsx("option",{value:"project",children:"Project"}),s.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),p&&s.jsx(jt,{label:"Loading usage…"}),g&&s.jsx(Rt,{error:g,action:s.jsx("button",{type:"button",className:"shell-action",onClick:()=>v(N=>N+1),children:"Retry"})}),u&&!p&&!g&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{className:"mb-8",children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Summary"}),u.summary.length===0?s.jsxs("p",{className:"text-muted-foreground text-sm",children:["No usage data for these filters. Run"," ",s.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-primary",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):s.jsxs("table",{className:"w-full text-sm border border-border/60 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),o==="assignment"&&s.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Cost"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Last event"})]})}),s.jsx("tbody",{children:u.summary.map((N,S)=>s.jsxs("tr",{className:"border-t border-border/60",children:[s.jsx("td",{className:"px-3 py-2",children:N.projectSlug||"(unattributed)"}),o==="assignment"&&s.jsx("td",{className:"px-3 py-2",children:N.assignmentSlug||"(unattributed)"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Kl(N.totalTokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Gl(N.totalCost)}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:N.lastEventDay})]},S))})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),u.daily.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No daily rows."}):s.jsxs("table",{className:"w-full text-sm border border-border/60 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-muted/50 text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-3 py-2",children:"Day"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Tool"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Model"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Project"}),s.jsx("th",{className:"text-left px-3 py-2",children:"Assignment"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Tokens"}),s.jsx("th",{className:"text-right px-3 py-2",children:"Cost"})]})}),s.jsx("tbody",{children:u.daily.map((N,S)=>s.jsxs("tr",{className:"border-t border-border/60",children:[s.jsx("td",{className:"px-3 py-2 tabular-nums",children:N.day}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:N.tool}),s.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:N.model}),s.jsx("td",{className:"px-3 py-2",children:N.project_slug||"–"}),s.jsx("td",{className:"px-3 py-2",children:N.assignment_slug||"–"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Kl(N.total_tokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Gl(N.total_cost)})]},S))})]})]})]})]})}function VN(){const{workspace:e}=Vt(),{data:t}=Zs(),{data:n,loading:r,error:o}=Jh(),[i,a]=m.useState(""),[l,u]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState("started_desc"),[y,k]=m.useState(0),[v,b]=m.useState(new Set),[j,N]=m.useState(!1),[S,C]=m.useState(null),[D,T]=m.useState(null),R=(n==null?void 0:n.sessions.some(P=>P.status==="active"))??!1;m.useEffect(()=>{if(!R)return;const P=window.setInterval(()=>k(L=>L+1),3e4);return()=>window.clearInterval(P)},[R]),m.useEffect(()=>{b(P=>{if(P.size===0)return P;const L=new Set((n==null?void 0:n.sessions.map(q=>q.sessionId))??[]),B=new Set([...P].filter(q=>L.has(q)));return B.size===P.size?P:B})},[n]);const $=m.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const P=i.trim().toLowerCase();return[...n.sessions.filter(B=>{var W;if(e&&t){const M=((W=t.find(F=>F.slug===B.projectSlug))==null?void 0:W.workspace)??null;if(e==="_ungrouped"){if(M!==null)return!1}else if(M!==e)return!1}const q=VY(B.started);return l&&(!q||q<l)||f&&(!q||q>f)?!1:P?[B.projectSlug??"",B.assignmentSlug??"",B.agent,B.sessionId,B.path,B.description??"",B.transcriptPath??""].join(" ").toLowerCase().includes(P):!0})].sort((B,q)=>WY(B,q,h))},[n,i,h,l,f,y,e,t]);function _(P){b(L=>{const B=new Set(L);return B.has(P)?B.delete(P):B.add(P),B})}function U(){v.size===$.length&&$.length>0?b(new Set):b(new Set($.map(P=>P.sessionId)))}async function I(P){C(null),N(!0);try{const L=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:P})}),B=await L.json().catch(()=>null);if(!L.ok)throw new Error((B==null?void 0:B.error)||`HTTP ${L.status}`);b(q=>new Set([...q].filter(z=>!P.includes(z)))),T(null)}catch(L){C(L.message)}finally{N(!1)}}async function V(P){try{const L=await fetch(`/api/agent-sessions/${encodeURIComponent(P)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!L.ok){const B=await L.json().catch(()=>null);C((B==null?void 0:B.error)||`Failed to mark session stopped: HTTP ${L.status}`)}}catch(L){C(L.message)}}if(r)return s.jsx(jt,{label:"Loading agent sessions..."});if(o)return s.jsx(Rt,{error:o});if(!n)return null;const O=n.sessions.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs(Mw,{children:[s.jsx(Pm,{value:i,onChange:a,placeholder:"Search project, assignment, agent, session ID, path, or description"}),s.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",s.jsx("input",{type:"date",value:l,onChange:P=>u(P.target.value),className:"editor-input min-w-[150px]"})]}),s.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",s.jsx("input",{type:"date",value:f,onChange:P=>p(P.target.value),className:"editor-input min-w-[150px]"})]}),s.jsxs("select",{value:h,onChange:P=>g(P.target.value),className:"editor-input max-w-[200px]",children:[s.jsx("option",{value:"started_desc",children:"Newest first"}),s.jsx("option",{value:"started_asc",children:"Oldest first"}),s.jsx("option",{value:"assignment_asc",children:"Assignment A-Z"}),s.jsx("option",{value:"agent_asc",children:"Agent A-Z"})]})]}),S?s.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,v.size>0&&s.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:[s.jsxs("span",{className:"text-muted-foreground",children:[v.size," session",v.size!==1?"s":""," selected"]}),s.jsxs("button",{className:"shell-action text-destructive",onClick:()=>T({sessionIds:[...v],title:`Delete ${v.size} selected session${v.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:v.size===1?"Delete Session":"Delete Sessions"}),disabled:j,children:[s.jsx(bn,{className:"mr-1 inline h-3.5 w-3.5"}),"Delete Selected"]}),s.jsx("button",{className:"shell-action",onClick:()=>b(new Set),children:"Clear Selection"})]}),O?$.length===0?s.jsx(Nt,{title:"No agent sessions match these filters",description:"Adjust the status, search term, date range, or sorting controls to show sessions again."}):s.jsx("div",{className:"surface-panel mt-4 overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[960px] table-fixed text-sm lg:min-w-[1280px]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/40 text-left text-xs uppercase tracking-wider text-muted-foreground",children:[s.jsx("th",{className:"w-[32px] pb-2 pr-3",children:s.jsx("button",{onClick:U,className:"text-muted-foreground hover:text-foreground",children:v.size===$.length&&$.length>0?s.jsx(gs,{className:"h-4 w-4"}):s.jsx(Lv,{className:"h-4 w-4"})})}),s.jsx("th",{className:"w-[140px] pb-2 pr-3",children:"Project"}),s.jsx("th",{className:"w-[160px] pb-2 pr-3",children:"Assignment"}),s.jsx("th",{className:"w-[200px] pb-2 pr-3",children:"Description"}),s.jsx("th",{className:"w-[110px] pb-2 pr-3",children:"Agent"}),s.jsx("th",{className:"hidden w-[130px] pb-2 pr-3 lg:table-cell",children:"Session ID"}),s.jsx("th",{className:"w-[140px] pb-2 pr-3",children:"Started"}),s.jsx("th",{className:"hidden w-[200px] pb-2 pr-3 lg:table-cell",children:"Path"}),s.jsx("th",{className:"hidden w-[200px] pb-2 pr-3 lg:table-cell",children:"Transcript"}),s.jsx("th",{className:"w-[40px] pb-2"})]})}),s.jsx("tbody",{children:$.map(P=>s.jsx(HY,{session:P,selected:v.has(P.sessionId),onToggle:()=>_(P.sessionId),onDelete:()=>T({sessionIds:[P.sessionId],title:`Delete session ${P.sessionId.slice(0,8)}...?`,description:`Remove this ${P.agent} session record${P.assignmentSlug?` for ${P.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:V,onCopyError:C},P.sessionId))})]})}):s.jsx(Nt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),s.jsx(Ai,{open:D!==null,title:(D==null?void 0:D.title)??"Delete session?",description:(D==null?void 0:D.description)??"",confirmLabel:(D==null?void 0:D.confirmLabel)??"Delete",destructive:!0,loading:j,onOpenChange:P=>{P||T(null)},onConfirm:async()=>{D&&await I(D.sessionIds)}})]})}function HY({session:e,selected:t,onToggle:n,onDelete:r,onMarkStopped:o,onCopyError:i}){const a=pn(),l=e.sessionId.length>12?e.sessionId.slice(0,8)+"...":e.sessionId,u=e.path?e.path.replace(/^\/Users\/[^/]+/,"~"):"—",f=e.transcriptPath?e.transcriptPath.replace(/^\/Users\/[^/]+/,"~"):"—";return s.jsxs("tr",{className:"border-b border-border/20 last:border-0",children:[s.jsx("td",{className:"py-2 pr-3",children:s.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:t?s.jsx(gs,{className:"h-4 w-4"}):s.jsx(Lv,{className:"h-4 w-4"})})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?s.jsx($e,{to:`${a}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:Dn(e.projectSlug),children:Dn(e.projectSlug)}):e.assignmentSlug?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] font-mono uppercase tracking-wide text-muted-foreground",children:"Standalone"}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug&&e.assignmentSlug?s.jsx($e,{to:`${a}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:Dn(e.assignmentSlug),children:Dn(e.assignmentSlug)}):e.assignmentSlug?s.jsx($e,{to:`/assignments/${e.assignmentSlug}`,className:"block truncate font-mono text-primary hover:underline",title:e.assignmentSlug,children:e.assignmentSlug}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:e.description?s.jsx("div",{className:"truncate text-xs text-muted-foreground",title:e.description,children:e.description}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2 pr-3",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(Vh,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"block min-w-0 truncate",children:e.agent})]})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.sessionId,children:l}),s.jsx(Zr,{value:e.sessionId}),s.jsx(r_,{sessionId:e.sessionId,disabled:!e.resumeSupported,disabledReason:"Resume not supported for this agent",onError:p=>i(p.message),onNotice:p=>i(p)})]})}),s.jsx("td",{className:"py-2 pr-3 text-xs text-muted-foreground",children:s.jsx("span",{className:"truncate block",children:es(e.started)})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:u}),e.path&&s.jsx(Zr,{value:e.path})]})}),s.jsx("td",{className:"hidden py-2 pr-3 lg:table-cell",children:e.transcriptPath?s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"block min-w-0 truncate font-mono text-xs text-muted-foreground",title:e.transcriptPath,children:f}),s.jsx(Zr,{value:e.transcriptPath})]}):s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"py-2",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(l_,{session:e,onMarkStopped:o}),s.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})})]})}function VY(e){const t=new Date(e);if(Number.isNaN(t.getTime()))return null;const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0");return`${n}-${r}-${o}`}function gp(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 WY(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 gp(e)-gp(t);case"duration_desc":return gp(t)-gp(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 qY(){const{data:e,loading:t,error:n,refetch:r}=Uv(),[o,i]=m.useState(""),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(null),g=m.useMemo(()=>{if(!(e!=null&&e.playbooks))return[];if(!o.trim())return e.playbooks;const v=o.toLowerCase();return e.playbooks.filter(b=>b.name.toLowerCase().includes(v)||b.description.toLowerCase().includes(v)||b.slug.toLowerCase().includes(v)||b.tags.some(j=>j.toLowerCase().includes(v)))},[e,o]);async function y(v,b,j){if(v.preventDefault(),v.stopPropagation(),!a){l(b);try{const N=j?"disable":"enable",S=await fetch(`/api/playbooks/${encodeURIComponent(b)}/${N}`,{method:"POST"});if(!S.ok){const C=await S.json().catch(()=>({}));throw new Error(C.error||`Failed to ${N} playbook`)}r()}catch(N){console.error(N),alert(N instanceof Error?N.message:"Failed to update playbook")}finally{l(null)}}}async function k(){if(u){h(u.slug);try{const v=await fetch(`/api/playbooks/${encodeURIComponent(u.slug)}`,{method:"DELETE"});if(!v.ok){const b=await v.json().catch(()=>({}));throw new Error(b.error||"Failed to delete playbook")}f(null),r()}catch(v){console.error(v),alert(v instanceof Error?v.message:"Failed to delete playbook")}finally{h(null)}}}return t?s.jsx(jt,{label:"Loading playbooks..."}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search playbooks...",value:o,onChange:v=>i(v.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"})]}),s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"Create Playbook"]})]}),s.jsxs($e,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[s.jsx(JE,{className:"h-5 w-5 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:"Playbook Manifest"}),s.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"})]}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Index of all playbooks with descriptions. Include ",s.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."]})]})]}),g.length===0?s.jsx(Nt,{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?s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"Create Playbook"]}):void 0}):s.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:g.map(v=>{const b=a===v.slug,j=[{key:"delete",label:"Delete",icon:bn,destructive:!0,onSelect:()=>f({slug:v.slug,name:v.name})}];return s.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${v.enabled?"":"opacity-75"}`,children:[s.jsx("div",{className:"absolute right-3 top-3 z-10",children:s.jsx(_w,{items:j})}),s.jsxs($e,{to:`/playbooks/${v.slug}`,className:"group flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(KE,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground group-hover:underline",children:v.name}),v.description?s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:v.description}):null]})]}),s.jsx("div",{className:"flex items-center gap-2 pt-1 pr-20",children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.tags.slice(0,3).map(N=>s.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:[s.jsx(n2,{className:"h-2.5 w-2.5"}),N]},N)),v.tags.length>3?s.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",v.tags.length-3]}):null]})})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":v.enabled,"aria-label":v.enabled?"Disable playbook":"Enable playbook",onClick:N=>y(N,v.slug,v.enabled),disabled:b,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 ${v.enabled?"border-status-completed-foreground/60 bg-status-completed-foreground/80":"border-foreground/40 bg-foreground/15"}`,children:s.jsx("span",{className:`block h-4 w-4 rounded-full shadow-sm transition-transform ${v.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},v.slug)})}),s.jsx(Ai,{open:u!==null,title:"Delete playbook?",description:u?`"${u.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:p!==null,onConfirm:k,onOpenChange:v=>{v||f(null)}})]})}function KY(){const{slug:e}=Vt(),t=Ht(),{data:n,loading:r,error:o,refetch:i}=kO(e),[a,l]=m.useState(!1),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(!1),[k,v]=m.useState(""),[b,j]=m.useState(!1),[N,S]=m.useState(null),C=e==="manifest";m.useEffect(()=>{g&&(v(e??""),S(null))},[g,e]);const D=Pr(k),T=D.length>0&&Dp(D)&&D!=="manifest",R=D!==e;async function $(){if(!(!e||!T||!R)){j(!0),S(null);try{const I=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:D})});if(!I.ok){const V=await I.json().catch(()=>({}));throw new Error(V.error||"Failed to rename playbook")}y(!1),t(`/playbooks/${D}`)}catch(I){S(I instanceof Error?I.message:"Failed to rename playbook")}finally{j(!1)}}}async function _(){if(e){f(!0);try{(await fetch(`/api/playbooks/${e}`,{method:"DELETE"})).ok&&t("/playbooks")}finally{f(!1)}}}async function U(){if(!(!e||!n)){h(!0);try{const I=n.enabled?"disable":"enable",V=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${I}`,{method:"POST"});if(!V.ok){const O=await V.json().catch(()=>({}));throw new Error(O.error||`Failed to ${I} playbook`)}i()}catch(I){console.error(I),alert(I instanceof Error?I.message:"Failed to update playbook")}finally{h(!1)}}}return r?s.jsx(jt,{label:"Loading playbook..."}):o?s.jsx(Rt,{error:o}):n?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:C?"Playbook Manifest":n.name}),C?s.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]}),!C&&n.description?s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null,C?s.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["This file is rebuilt automatically when playbooks are added or removed. Include"," ",s.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,!C&&n.whenToUse?s.jsxs("p",{className:"mt-2 text-sm text-muted-foreground italic",children:["When to use: ",n.whenToUse]}):null,s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",es(n.created)]}),s.jsxs("span",{children:["Updated ",es(n.updated)]})]}),n.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map(I=>s.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:[s.jsx(n2,{className:"h-3 w-3"}),I]},I))}):null]}),C?null:s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:n.enabled?"Enabled":"Disabled"}),s.jsx("button",{type:"button",role:"switch","aria-checked":n.enabled,"aria-label":n.enabled?"Disable playbook":"Enable playbook",onClick:U,disabled:p,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:s.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"}`})})]}),s.jsxs($e,{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:[s.jsx(hc,{className:"h-3 w-3"}),"Edit"]}),s.jsxs("button",{type:"button",onClick:()=>y(!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:[s.jsx(f4,{className:"h-3 w-3"}),"Rename"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:_,disabled:u,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:u?"Deleting...":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!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"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!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:[s.jsx(bn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(xn,{content:n.body})}),s.jsx(Ln,{open:g,onOpenChange:I=>b?void 0:y(I),children:s.jsxs(jn,{children:[s.jsxs(tr,{children:[s.jsx(kn,{children:"Rename playbook"}),s.jsx(ns,{children:"The slug changes both the file name and the canonical slug stored in frontmatter. The URL will update on save."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"rename-slug-input",className:"block text-xs font-medium text-muted-foreground",children:"New slug"}),s.jsx("input",{id:"rename-slug-input",type:"text",autoFocus:!0,value:k,onChange:I=>v(I.target.value),disabled:b,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"}),k&&D!==k?s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Will be normalized to ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:D||"—"})]}):null,k&&!T?s.jsx("p",{className:"text-xs text-destructive",children:'Slugs must be lowercase, hyphen-separated, with no special characters, and cannot be "manifest".'}):null]}),N?s.jsx("p",{className:"text-sm text-destructive",role:"alert",children:N}):null,s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:()=>y(!1),disabled:b,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",onClick:$,disabled:b||!T||!R,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:b?"Renaming…":"Rename"})]})]})})]}):null}function GY(){const e=Ht(),[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(!1),[l,u]=m.useState(null);m.useEffect(()=>{fetch("/api/playbooks/template/new").then(p=>p.json()).then(p=>{n(p.content),o(!1)}).catch(p=>{u(p.message),o(!1)})},[]);async function f(p){a(!0),u(null);try{const h=await fetch("/api/playbooks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:p})}),g=await h.json();if(!h.ok){u(g.error||`HTTP ${h.status}`),a(!1);return}e(`/playbooks/${g.slug}`)}catch(h){u(h.message),a(!1);return}a(!1)}return r?s.jsx(jt,{label:"Loading playbook template..."}):l&&!t?s.jsx(Rt,{error:l}):s.jsx(Tc,{initialContent:t||"",documentType:"playbook",mode:"create",onSave:f,saving:i,error:l,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 YY(){const{slug:e}=Vt(),t=Ht(),[n,r]=m.useState(null),[o,i]=m.useState(!0),[a,l]=m.useState(!1),[u,f]=m.useState(null);m.useEffect(()=>{e&&fetch(`/api/playbooks/${e}/edit`).then(h=>h.json()).then(h=>{r(h.content),i(!1)}).catch(h=>{f(h.message),i(!1)})},[e]);async function p(h){if(e){l(!0),f(null);try{const g=await fetch(`/api/playbooks/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),y=await g.json();if(!g.ok){f(y.error||`HTTP ${g.status}`),l(!1);return}t(`/playbooks/${e}`)}catch(g){f(g.message),l(!1);return}l(!1)}}return o?s.jsx(jt,{label:"Loading playbook..."}):u&&!n?s.jsx(Rt,{error:u}):s.jsx(Tc,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:p,saving:a,error:u,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function XY(){const{data:e,loading:t,error:n}=SO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,u]=m.useState("all"),[f,p]=m.useState("all"),h=(e==null?void 0:e.memories)??[],g=m.useMemo(()=>Array.from(new Set(h.map(b=>b.projectSlug))).sort(),[h]),y=m.useMemo(()=>Array.from(new Set(h.map(b=>b.scope).filter(Boolean))).sort(),[h]),k=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),v=m.useMemo(()=>h.filter(b=>{if(i!=="all"&&b.projectSlug!==i||l!=="all"&&b.scope!==l||f!=="all"&&b.source!==f)return!1;if(r.trim()){const j=r.toLowerCase();if(!b.name.toLowerCase().includes(j)&&!b.slug.toLowerCase().includes(j)&&!b.projectTitle.toLowerCase().includes(j))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(jt,{label:"Loading memories…"}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search memories…",value:r,onChange:b=>o(b.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"})]}),s.jsxs("select",{value:i,onChange:b=>a(b.target.value),className:"editor-input max-w-[170px]",children:[s.jsx("option",{value:"all",children:"All projects"}),g.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:l,onChange:b=>u(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All scopes"}),y.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:f,onChange:b=>p(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All sources"}),k.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"New Memory"]})]}),v.length===0?s.jsx(Nt,{title:h.length===0?"No memories yet":"No memories match these filters",description:h.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:h.length===0?s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"New Memory"]}):void 0}):s.jsx("div",{className:"surface-panel overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Scope"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:v.map(b=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[s.jsx("td",{className:"px-3 py-3",children:s.jsx($e,{to:`/projects/${b.projectSlug}/memories/${b.slug}`,className:"font-semibold text-foreground hover:text-primary",children:b.name||b.slug})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:s.jsx($e,{to:`/projects/${b.projectSlug}`,className:"hover:text-foreground hover:underline",children:b.projectTitle})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.scope||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.source||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.relatedAssignments.length}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Gn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function QY(){const{slug:e,itemSlug:t}=Vt(),n=Ht(),{data:r,loading:o,error:i}=NO(e,t),[a,l]=m.useState(!1),[u,f]=m.useState(!1);async function p(){if(!(!e||!t)){f(!0);try{(await fetch(`/api/projects/${e}/memories/${t}`,{method:"DELETE"})).ok&&n("/memories")}finally{f(!1)}}}return o?s.jsx(jt,{label:"Loading memory…"}):i?s.jsx(Rt,{error:i}):r?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r.name||r.slug}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx($e,{to:`/projects/${r.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:r.projectTitle}),r.scope?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Scope: ",r.scope]}):null,r.source?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",r.source]}):null,r.sourceAssignment?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["From: ",r.sourceAssignment]}):null,s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[r.relatedAssignments.length," related"]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",es(r.created)]}),s.jsxs("span",{children:["Updated ",es(r.updated)]})]}),r.tags&&r.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:r.tags.map(h=>s.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:h},h))}):null]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs($e,{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:[s.jsx(hc,{className:"h-3 w-3"}),"Edit"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:p,disabled:u,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:u?"Deleting…":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!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"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!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:[s.jsx(bn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(xn,{content:r.body})})]}):null}function JY(){const e=Ht(),[t]=Ns(),n=t.get("project"),{data:r,loading:o,error:i}=Zs(),[a,l]=m.useState(n??""),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,v]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(j){if(j.preventDefault(),!(!a||!u.trim())){y(!0),v(null);try{const N=await fetch(`/api/projects/${a}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.trim(),body:p||void 0})}),S=await N.json();if(!N.ok){v(S.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${S.projectSlug}/memories/${S.slug}`)}catch(N){v(N.message),y(!1)}}}return o?s.jsx(jt,{label:"Loading projects…"}):i?s.jsx(Rt,{error:i}):!r||r.length===0?s.jsx(Rt,{error:"You need at least one project before you can create a memory. Create a project from the sidebar."}):s.jsxs("form",{onSubmit:b,className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Memory"}),s.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."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),s.jsx("select",{id:"project",value:a,onChange:j=>l(j.target.value),className:"editor-input",required:!0,children:r.map(j=>s.jsx("option",{value:j.slug,children:j.title},j.slug))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),s.jsx("input",{id:"name",type:"text",value:u,onChange:j=>f(j.target.value),placeholder:"e.g. PostgreSQL connection pooling",className:"editor-input",required:!0,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),s.jsx("textarea",{id:"body",value:p,onChange:j=>h(j.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"})]}),k?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!u.trim()||!a,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:g?"Creating…":"Create Memory"}),s.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 ZY(){const{slug:e,itemSlug:t}=Vt();return s.jsx(Rc,{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 eX(){const{data:e,loading:t,error:n}=CO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,u]=m.useState("all"),[f,p]=m.useState("all"),h=(e==null?void 0:e.resources)??[],g=m.useMemo(()=>Array.from(new Set(h.map(b=>b.projectSlug))).sort(),[h]),y=m.useMemo(()=>Array.from(new Set(h.map(b=>b.category).filter(Boolean))).sort(),[h]),k=m.useMemo(()=>Array.from(new Set(h.map(b=>b.source).filter(Boolean))).sort(),[h]),v=m.useMemo(()=>h.filter(b=>{if(i!=="all"&&b.projectSlug!==i||l!=="all"&&b.category!==l||f!=="all"&&b.source!==f)return!1;if(r.trim()){const j=r.toLowerCase();if(!b.name.toLowerCase().includes(j)&&!b.slug.toLowerCase().includes(j)&&!b.projectTitle.toLowerCase().includes(j))return!1}return!0}),[h,r,i,l,f]);return t?s.jsx(jt,{label:"Loading resources…"}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{type:"text",placeholder:"Search resources…",value:r,onChange:b=>o(b.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"})]}),s.jsxs("select",{value:i,onChange:b=>a(b.target.value),className:"editor-input max-w-[170px]",children:[s.jsx("option",{value:"all",children:"All projects"}),g.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:l,onChange:b=>u(b.target.value),className:"editor-input max-w-[160px]",children:[s.jsx("option",{value:"all",children:"All categories"}),y.map(b=>s.jsx("option",{value:b,children:b},b))]}),s.jsxs("select",{value:f,onChange:b=>p(b.target.value),className:"editor-input max-w-[140px]",children:[s.jsx("option",{value:"all",children:"All sources"}),k.map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"New Resource"]})]}),v.length===0?s.jsx(Nt,{title:h.length===0?"No resources yet":"No resources match these filters",description:h.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:h.length===0?s.jsxs($e,{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:[s.jsx(It,{className:"h-4 w-4"}),"New Resource"]}):void 0}):s.jsx("div",{className:"surface-panel overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border/60 text-muted-foreground",children:[s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Name"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Project"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Category"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Source"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"# Related"}),s.jsx("th",{className:"px-3 pb-3 pt-3 font-medium",children:"Updated"})]})}),s.jsx("tbody",{children:v.map(b=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[s.jsx("td",{className:"px-3 py-3",children:s.jsx($e,{to:`/projects/${b.projectSlug}/resources/${b.slug}`,className:"font-semibold text-foreground hover:text-primary",children:b.name||b.slug})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:s.jsx($e,{to:`/projects/${b.projectSlug}`,className:"hover:text-foreground hover:underline",children:b.projectTitle})}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.category||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.source||"—"}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:b.relatedAssignments.length}),s.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:Gn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function tX(){const{slug:e,itemSlug:t}=Vt(),n=Ht(),{data:r,loading:o,error:i}=EO(e,t),[a,l]=m.useState(!1),[u,f]=m.useState(!1);async function p(){if(!(!e||!t)){f(!0);try{(await fetch(`/api/projects/${e}/resources/${t}`,{method:"DELETE"})).ok&&n("/resources")}finally{f(!1)}}}return o?s.jsx(jt,{label:"Loading resource…"}):i?s.jsx(Rt,{error:i}):r?s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r.name||r.slug}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx($e,{to:`/projects/${r.projectSlug}`,className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5 hover:text-foreground",children:r.projectTitle}),r.category?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Category: ",r.category]}):null,r.source?s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:["Source: ",r.source]}):null,s.jsxs("span",{className:"rounded-full border border-border/60 bg-muted/50 px-2 py-0.5",children:[r.relatedAssignments.length," related"]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[s.jsxs("span",{children:["Created ",es(r.created)]}),s.jsxs("span",{children:["Updated ",es(r.updated)]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs($e,{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:[s.jsx(hc,{className:"h-3 w-3"}),"Edit"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:p,disabled:u,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:u?"Deleting…":"Confirm"}),s.jsx("button",{type:"button",onClick:()=>l(!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"})]}):s.jsxs("button",{type:"button",onClick:()=>l(!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:[s.jsx(bn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(xn,{content:r.body})})]}):null}function nX(){const e=Ht(),[t]=Ns(),n=t.get("project"),{data:r,loading:o,error:i}=Zs(),[a,l]=m.useState(n??""),[u,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,v]=m.useState(null);m.useEffect(()=>{!a&&r&&r.length>0&&l(n??r[0].slug)},[r,n,a]);async function b(j){if(j.preventDefault(),!(!a||!u.trim())){y(!0),v(null);try{const N=await fetch(`/api/projects/${a}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:u.trim(),body:p||void 0})}),S=await N.json();if(!N.ok){v(S.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${S.projectSlug}/resources/${S.slug}`)}catch(N){v(N.message),y(!1)}}}return o?s.jsx(jt,{label:"Loading projects…"}):i?s.jsx(Rt,{error:i}):!r||r.length===0?s.jsx(Rt,{error:"You need at least one project before you can create a resource. Create a project from the sidebar."}):s.jsxs("form",{onSubmit:b,className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"New Resource"}),s.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."})]}),s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"project",className:"block text-sm font-medium text-foreground",children:"Project"}),s.jsx("select",{id:"project",value:a,onChange:j=>l(j.target.value),className:"editor-input",required:!0,children:r.map(j=>s.jsx("option",{value:j.slug,children:j.title},j.slug))})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground",children:"Name"}),s.jsx("input",{id:"name",type:"text",value:u,onChange:j=>f(j.target.value),placeholder:"e.g. Auth Requirements",className:"editor-input",required:!0,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground/80",children:"The slug is auto-derived from the name. Letters, digits, and hyphens."})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{htmlFor:"body",className:"block text-sm font-medium text-foreground",children:"Body"}),s.jsx("textarea",{id:"body",value:p,onChange:j=>h(j.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"})]}),k?s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:k}):null,s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"submit",disabled:g||!u.trim()||!a,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:g?"Creating…":"Create Resource"}),s.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 rX(){const{slug:e,itemSlug:t}=Vt();return s.jsx(Rc,{loadUrl:`/api/projects/${e}/resources/${t}/edit`,saveUrl:`/api/projects/${e}/resources/${t}`,redirectTo:`/projects/${e}/resources/${t}`,title:"Edit Resource",description:"Edit the body. The frontmatter (name, category, source, related assignments) is preserved unchanged on save.",documentType:"resource",helpTitle:"Resource editing",helpBody:"Resource edits are body-only. Frontmatter changes from the editor are ignored server-side; the file's existing frontmatter is preserved and `updated` is bumped automatically."})}const sv=["projects","playbooks","todos","servers","config"];function sX(e){const t=new Set;for(const n of e.split(",").map(r=>r.trim()))sv.includes(n)&&t.add(n);return t}function WN(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function oX(){const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(""),[a,l]=m.useState(new Set(sv)),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,v]=m.useState(null),b=m.useCallback(async()=>{try{const T=await fetch("/api/backup");if(!T.ok)throw new Error(`HTTP ${T.status}`);const R=await T.json();r(R),i(R.repo??""),l(sX(R.categories)),f(!1)}catch(T){v({type:"error",message:`Failed to load backup config: ${T instanceof Error?T.message:String(T)}`})}finally{t(!1)}},[]);m.useEffect(()=>{b()},[b]);function j(T){l(R=>{const $=new Set(R);return $.has(T)?$.delete(T):$.add(T),$}),f(!0)}async function N(){h(!0),v(null);try{const T=Array.from(a),R=await fetch("/api/backup/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({repo:o.trim()||null,categories:T})}),$=await R.json();if(!R.ok)throw new Error($.error||`HTTP ${R.status}`);r($),f(!1),v({type:"success",message:"Backup configuration saved."})}catch(T){v({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{h(!1)}}async function S(){y("push"),v(null);try{const T=await fetch("/api/backup/push",{method:"POST"}),R=await T.json();if(!T.ok||R.success===!1)throw new Error(R.error||R.message||`HTTP ${T.status}`);v({type:"success",message:R.message||"Backup complete."}),await b()}catch(T){v({type:"error",message:`Backup failed: ${T instanceof Error?T.message:String(T)}`})}finally{y(null)}}async function C(){if(window.confirm("Restore will overwrite local files for the selected categories with the contents of the GitHub repo. This cannot be undone. Continue?")){y("pull"),v(null);try{const R=await fetch("/api/backup/pull",{method:"POST"}),$=await R.json();if(!R.ok||$.success===!1)throw new Error($.error||$.message||`HTTP ${R.status}`);v({type:"success",message:$.message||"Restore complete."}),await b()}catch(R){v({type:"error",message:`Restore failed: ${R instanceof Error?R.message:String(R)}`})}finally{y(null)}}}if(e)return s.jsx(Xe,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})});const D=!!o.trim()&&a.size>0&&!g&&!u;return s.jsx(Xe,{title:"GitHub Backup",description:"Back up Syntaur files to a GitHub repository and restore from it",children:s.jsxs("div",{className:"space-y-4",children:[k&&s.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${k.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:k.message}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Repository URL"}),s.jsx("input",{type:"text",value:o,onChange:T=>{i(T.target.value),f(!0)},placeholder:"git@github.com:you/syntaur-backup.git",className:"editor-input w-full text-sm"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["SSH or HTTPS URL. Requires ",s.jsx("code",{className:"rounded bg-muted px-1",children:"git"})," installed and credentials configured locally."]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Categories to back up"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:sv.map(T=>{const R=a.has(T);return s.jsxs("button",{type:"button",onClick:()=>j(T),className:`shell-action text-xs ${R?"bg-primary/10 text-primary hover:bg-primary/20":"bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:[s.jsx("span",{className:`mr-1 inline-block h-2 w-2 rounded-full ${R?"bg-primary":"bg-muted-foreground/40"}`}),T]},T)})})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-2 text-xs text-muted-foreground sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last backup: "}),WN((n==null?void 0:n.lastBackup)??null)]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),WN((n==null?void 0:n.lastRestore)??null)]}),(n==null?void 0:n.locked)&&s.jsx("div",{className:"sm:col-span-2 text-warning-foreground",children:"⚠ A backup operation is in progress or the lock file is stale."})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:[s.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20",onClick:N,disabled:p||!u,children:[s.jsx(Gh,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Config"]}),s.jsxs("button",{className:"shell-action",onClick:S,disabled:!D,title:D?"Back up now":u?"Save config first":"Set repo and pick categories",children:[s.jsx(p4,{className:"h-3.5 w-3.5"}),g==="push"?"Backing up...":"Back Up Now"]}),s.jsxs("button",{className:"shell-action",onClick:C,disabled:!D,title:D?"Restore from backup":u?"Save config first":"Set repo and pick categories",children:[s.jsx(LL,{className:"h-3.5 w-3.5"}),g==="pull"?"Restoring...":"Restore"]}),u&&s.jsx("span",{className:"text-xs text-muted-foreground",children:"Unsaved changes"})]}),s.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:[s.jsx($L,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsxs("span",{children:["Restore never overwrites ",s.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 iX(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:r,bindAction:o,unbindAction:i}=Ei(),[a,l]=m.useState(null),[u,f]=m.useState(null),[p,h]=m.useState(!1),g=Object.values(t).some(S=>typeof S=="string"&&S.length>0);function y(S,C){f({type:S,message:C}),setTimeout(()=>f(null),2500)}function k(S){l({kind:S,combo:null,conflict:null,saving:!1,error:null})}function v(S){if(!a||S.key==="Escape")return;if(S.key==="Enter"&&a.combo){S.preventDefault(),b();return}if(S.key==="Enter")return;S.preventDefault(),S.stopPropagation();const C=P2(S.nativeEvent);if(!C)return;const D=r(C,a.kind);l({...a,combo:C,conflict:D,error:null})}async function b(){var S;if(a!=null&&a.combo){if((S=a.conflict)!=null&&S.description){l({...a,error:`Reserved: ${a.conflict.description}`});return}l({...a,saving:!0,error:null});try{await o(a.kind,a.combo),l(null),y("success",`Bound ${hu[a.kind]}`)}catch(C){l({...a,saving:!1,error:C instanceof Error?C.message:"Failed to save"})}}}async function j(S){try{await i(S),y("success",`Cleared ${hu[S]} binding`)}catch(C){y("error",C instanceof Error?C.message:"Failed to clear binding")}}async function N(){if(!p){h(!0);try{await oz(),y("success","All hotkey bindings cleared")}catch(S){y("error",S instanceof Error?S.message:"Failed to reset bindings")}finally{h(!1)}}}return s.jsxs(Xe,{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:g?s.jsxs("button",{className:"shell-action text-xs",onClick:()=>void N(),disabled:p,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[u?s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${u.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:u.message}):null,s.jsx("ul",{className:"space-y-2",children:Zh.map(S=>{var $,_;const C=n.find(U=>U.bindableKind===S),D=e[S],T=typeof t[S]=="string"&&!!t[S],R=(a==null?void 0:a.kind)===S;return s.jsxs("li",{className:"flex flex-wrap items-center gap-3 rounded-md border border-border/40 bg-background/60 px-3 py-2",children:[s.jsx(fb,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-sm text-foreground",children:(C==null?void 0:C.title)??hu[S]}),C!=null&&C.subtitle?s.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle}):null]}),D?s.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s.jsx("kbd",{className:"rounded border border-border/70 bg-muted px-2 py-0.5 font-mono text-xs text-foreground",children:Gs(D)}),s.jsx("span",{className:`text-[10px] uppercase tracking-wide ${T?"text-primary":"text-muted-foreground"}`,children:T?"custom":"default"})]}):s.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"unbound"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("button",{type:"button",className:"shell-action text-xs",onClick:()=>k(S),children:D?"Rebind":"Bind"}),T?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void j(S),"aria-label":`Restore default ${hu[S]} binding`,children:[s.jsx(Td,{className:"h-3 w-3"}),"Restore default"]}):null]}),R?s.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:v,onBlur:()=>{(a==null?void 0:a.kind)===S&&!a.saving&&l(null)},children:a!=null&&a.combo?s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-base font-semibold tracking-wide text-foreground",children:Gs(a.combo)}),($=a.conflict)!=null&&$.description?s.jsxs("div",{className:"text-xs text-destructive",children:["Reserved: ",a.conflict.description]}):(_=a.conflict)!=null&&_.kind?s.jsxs("div",{className:"text-xs text-amber-500 dark:text-amber-400",children:['Already bound to "',hu[a.conflict.kind],'". Press Enter to overwrite.']}):s.jsx("div",{className:"text-xs text-muted-foreground",children:"Press Enter to save, Esc to cancel, any other key to retry."}),a.error?s.jsx("div",{className:"text-xs text-destructive",children:a.error}):null]}):s.jsx("div",{className:"text-xs text-muted-foreground",children:"Press the key combination you want to bind…"})}):null]},S)})})]})}const aX={kanban:"Kanban",list:"List",table:"Table"},lX={comfortable:"Comfortable",compact:"Compact"},cX={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},uX={asc:"Ascending",desc:"Descending"};function dX(){const e=hG(),t=e.global,[n,r]=m.useState(!1),[o,i]=m.useState(null);function a(f,p){i({type:f,message:p}),setTimeout(()=>i(null),2e3)}async function l(f,p){if(t[f]!==p){r(!0);try{await ZP({[f]:p}),a("success","Saved")}catch(h){a("error",h instanceof Error?h.message:"Failed to save")}finally{r(!1)}}}async function u(){if(e.custom){r(!0);try{await mG(),a("success","Reset to defaults")}catch(f){a("error",f instanceof Error?f.message:"Failed to reset")}finally{r(!1)}}}return s.jsxs(Xe,{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?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:u,disabled:n,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[o&&s.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}),s.jsxs("dl",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Default view"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:iw.map(f=>s.jsx("button",{type:"button",onClick:()=>l("defaultView",f),disabled:n,"aria-pressed":t.defaultView===f,className:`px-3 py-1 text-xs ${t.defaultView===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:aX[f]},f))})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Density"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:d6.map(f=>s.jsx("button",{type:"button",onClick:()=>l("density",f),disabled:n,"aria-pressed":t.density===f,className:`px-3 py-1 text-xs ${t.density===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:lX[f]},f))})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Sort by"}),s.jsx("dd",{className:"mt-1.5",children:s.jsx("select",{value:t.sortField,onChange:f=>l("sortField",f.target.value),disabled:n,className:"editor-input max-w-[220px]",children:CT.map(f=>s.jsx("option",{value:f,children:cX[f]??f},f))})})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Direction"}),s.jsx("dd",{className:"mt-1.5 inline-flex rounded-md border border-border/60 p-0.5",children:u6.map(f=>s.jsx("button",{type:"button",onClick:()=>l("sortDirection",f),disabled:n,"aria-pressed":t.sortDirection===f,className:`px-3 py-1 text-xs ${t.sortDirection===f?"rounded bg-foreground text-background":"text-muted-foreground hover:text-foreground"}`,children:uX[f]},f))})]})]})]})}function fX({value:e,onChange:t,knownSlugs:n,rows:r=2,placeholder:o,className:i,wrapperClassName:a,singleLine:l,"aria-label":u}){const[f,p]=m.useState(0),[h,g]=m.useState(0),[y,k]=m.useState(!1),v=m.useRef(null),b=x_(e,f),j=b?y_(b.partial,n):[],N=!y&&j.length>0,S=Math.min(h,Math.max(0,j.length-1)),C=_=>l?_.replace(/[\r\n]+/g," "):_;function D(_){t(C(_.target.value)),p(_.target.selectionStart??_.target.value.length),g(0),k(!1)}function T(_){p(_.currentTarget.selectionStart??e.length)}function R(_){if(!b||!_)return;const U=b_(e,b,_);t(C(U.text)),p(U.caret),g(0),k(!0),requestAnimationFrame(()=>{const I=v.current;I&&(I.focus(),I.setSelectionRange(U.caret,U.caret))})}function $(_){N&&(_.key==="ArrowDown"?(_.preventDefault(),g(U=>Math.min(U+1,j.length-1))):_.key==="ArrowUp"?(_.preventDefault(),g(U=>Math.max(U-1,0))):_.key==="Enter"||_.key==="Tab"?(_.preventDefault(),R(j[S])):_.key==="Escape"&&(_.preventDefault(),k(!0)))}return s.jsxs("div",{className:Ne("relative",a),children:[s.jsx("textarea",{ref:v,value:e,rows:r,placeholder:o,"aria-label":u,onChange:D,onKeyDown:$,onKeyUp:T,onClick:T,className:i}),N&&s.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:j.map((_,U)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":U===S,onMouseDown:I=>{I.preventDefault(),R(_)},className:Ne("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===S&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:_})]})},_))})]})}const pX={first:"first",last:"last",none:"none"};function D_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function ju(e){return e.map(t=>({rowKey:D_(),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 hX(e){return e.map(t=>{const n={id:t.id,label:t.label,command:t.command},r=t.argsText.split(/[,\s]+/).filter(Boolean);return r.length>0&&(n.args=r),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 mX(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,r)=>({...n,default:t===-1?r===0:r===t}))}function gX(e,t){return!t||t.length===0?e:e.map((n,r)=>{const o={};for(const i of t){if(i.index!==void 0){i.index===r&&(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 xX(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function yX(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e[n],o=t[n];if(r.id!==o.id||r.label!==o.label||r.command!==o.command||r.argsText!==o.argsText||r.promptArgPosition!==o.promptArgPosition||r.resolveFromShellAliases!==o.resolveFromShellAliases||r.default!==o.default||r.model!==o.model||r.playbook!==o.playbook||r.launchPrompt!==o.launchPrompt)return!1}return!0}function bX({row:e,index:t,canRemove:n,playbooks:r,onPatch:o,onSetDefault:i,onRemove:a}){const{attributes:l,listeners:u,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=ym({id:e.rowKey}),k={transform:bs.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function v(C){const D={label:C};if(e.autoSlugFromLabel){const T=Pr(C);T&&IG.test(T)?D.id=T:D.id=`agent-${t+1}`}o(D)}function b(C){o({id:C,autoSlugFromLabel:!1})}const j=C=>e.fieldErrors[C]?"border-error-foreground/60":"",N=m.useMemo(()=>r.map(C=>C.slug),[r]),S=m.useMemo(()=>v_(e.launchPrompt,N),[e.launchPrompt,N]);return s.jsxs("div",{ref:f,style:k,className:`surface-panel space-y-2 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{ref:p,...l,...u,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(pc,{className:"h-4 w-4"})}),s.jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("input",{type:"radio",name:"agents-default",checked:e.default,onChange:i,className:"h-3 w-3 cursor-pointer accent-foreground"}),"Default"]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] font-mono uppercase tracking-wide text-muted-foreground/70",children:"id"}),e.idEditable?s.jsx("input",{type:"text",value:e.id,onChange:C=>b(C.target.value),className:`editor-input w-32 font-mono text-xs ${j("id")}`,"aria-label":"Agent id"}):s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id}),s.jsx("button",{type:"button",onClick:a,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:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})]}),e.fieldErrors.id&&s.jsx("p",{className:"ml-7 text-[11px] text-error-foreground",children:e.fieldErrors.id}),s.jsxs("div",{className:"ml-7 grid grid-cols-1 gap-2 sm:grid-cols-2",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Label"}),s.jsx("input",{type:"text",value:e.label,onChange:C=>v(C.target.value),className:`editor-input mt-0.5 w-full ${j("label")}`}),e.fieldErrors.label&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.label})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Command"}),s.jsx("input",{type:"text",value:e.command,placeholder:"claude or /usr/local/bin/claude",onChange:C=>o({command:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("command")}`}),e.fieldErrors.command&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.command})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Args (comma- or space-separated)"}),s.jsx("input",{type:"text",value:e.argsText,placeholder:"--dangerously-skip-permissions",onChange:C=>o({argsText:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("args")}`}),e.fieldErrors.args&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.args})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Prompt arg position"}),s.jsx("select",{value:e.promptArgPosition,onChange:C=>o({promptArgPosition:C.target.value}),className:`editor-input mt-0.5 w-full ${j("promptArgPosition")}`,children:f_.map(C=>s.jsx("option",{value:C,children:pX[C]},C))}),e.fieldErrors.promptArgPosition&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.promptArgPosition})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Model"}),s.jsx("input",{type:"text",value:e.model,placeholder:"opus (optional)",onChange:C=>o({model:C.target.value}),className:`editor-input mt-0.5 w-full font-mono ${j("model")}`}),e.fieldErrors.model&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.model})]}),s.jsxs("div",{className:"col-span-full",children:[s.jsx("label",{className:"text-[11px] uppercase tracking-wide text-muted-foreground/80",children:"Launch prompt"}),s.jsx(fX,{value:e.launchPrompt,onChange:C=>o({launchPrompt:C}),knownSlugs:N,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] ${j("launchPrompt")}`,"aria-label":"Launch prompt"}),e.fieldErrors.launchPrompt&&s.jsx("p",{className:"mt-0.5 text-[11px] text-error-foreground",children:e.fieldErrors.launchPrompt}),S.length>0&&!e.fieldErrors.launchPrompt&&s.jsx("ul",{className:"mt-0.5 space-y-0.5 text-[11px] text-error-foreground",children:S.map(C=>s.jsx("li",{children:C},C))})]}),s.jsxs("label",{className:"col-span-full inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox",checked:e.resolveFromShellAliases,onChange:C=>o({resolveFromShellAliases:C.target.checked}),className:"h-3.5 w-3.5 cursor-pointer accent-foreground"}),"Resolve from shell aliases (look up ",s.jsx("code",{className:"font-mono",children:"command"})," in your interactive shell before launching)"]})]})]})}function vX(){const e=m_(),t=Uv(),n=m.useMemo(()=>{var $;return((($=t.data)==null?void 0:$.playbooks)??[]).filter(_=>_.enabled).map(_=>({slug:_.slug,name:_.name}))},[t.data]),[r,o]=m.useState(()=>ju(e.agents)),[i,a]=m.useState(()=>ju(e.agents)),[l,u]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(null);m.useEffect(()=>{const $=ju(e.agents);o($),a($),p(null)},[e.agents]);const y=m.useMemo(()=>!yX(r,i),[r,i]),k=dm(wi(wc,{activationConstraint:{distance:8}}),wi(vc));function v($,_){g({type:$,message:_}),setTimeout(()=>g(null),2500)}function b($,_){o(U=>U.map(I=>I.rowKey===$?{...I,..._,fieldErrors:wX(I.fieldErrors,_)}:I))}function j($){o(_=>_.map(U=>({...U,default:U.rowKey===$})))}function N(){o($=>{const _=new Set($.map(L=>L.id)),U="new-agent";let I=U,V=1;for(;_.has(I);)V+=1,I=`${U}-${V}`;const O=V===1?"New Agent":`New Agent ${V}`,P={rowKey:D_(),id:I,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:O,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...$,P]})}function S($){o(_=>_.filter(U=>U.rowKey!==$))}async function C(){u(!0),p(null);try{const $=mX(r),_=hX($),U=await OG(_),I=ju(U.agents);o(I),a(I),v("success","Agents saved")}catch($){if($ instanceof p_)p($.message),o(_=>gX(xX(_),$.fieldErrors)),v("error",$.message);else{const _=$ instanceof Error?$.message:"Failed to save";p(_),v("error",_)}}finally{u(!1)}}function D(){o(i),p(null)}async function T(){if(e.custom&&window.confirm("Reset agents to built-in defaults? Any custom agents will be deleted from your config.")){u(!0),p(null);try{const $=await FG(),_=ju($.agents);o(_),a(_),v("success","Reset to defaults")}catch($){const _=$ instanceof Error?$.message:"Failed to reset";p(_),v("error",_)}finally{u(!1)}}}function R($){const{active:_,over:U}=$;!U||_.id===U.id||o(I=>{const V=I.findIndex(P=>P.rowKey===_.id),O=I.findIndex(P=>P.rowKey===U.id);return V===-1||O===-1?I:jc(I,V,O)})}return s.jsxs(Xe,{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?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:T,disabled:l,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[!e.custom&&s.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:[s.jsx($v,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),s.jsxs("span",{children:["Using built-in defaults — first save will write your own list to"," ",s.jsx("code",{className:"font-mono",children:"~/.syntaur/config.md"}),"."]})]}),h&&s.jsx("div",{className:`rounded-md border px-3 py-1.5 text-xs ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),f&&(!h||h.type!=="error")&&s.jsx("div",{className:"rounded-md border border-error-foreground/30 bg-error px-3 py-1.5 text-xs text-error-foreground",children:f}),s.jsx(gm,{sensors:k,collisionDetection:fm,onDragEnd:R,children:s.jsx(xm,{items:r.map($=>$.rowKey),strategy:bw,children:s.jsx("div",{className:"space-y-2",children:r.map(($,_)=>s.jsx(bX,{row:$,index:_,canRemove:r.length>1,playbooks:n,onPatch:U=>b($.rowKey,U),onSetDefault:()=>j($.rowKey),onRemove:()=>S($.rowKey)},$.rowKey))})})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("button",{type:"button",onClick:N,disabled:l,className:"shell-action text-xs",children:[s.jsx(It,{className:"h-3 w-3"}),"Add agent"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:D,disabled:!y||l,className:"shell-action text-xs",children:"Discard"}),s.jsxs("button",{type:"button",onClick:C,disabled:!y||l,className:"shell-action text-xs",children:[s.jsx(Gh,{className:"h-3 w-3"}),"Save"]})]})]})]})}function wX(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 $_=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Eh={terminal:"terminal-app",custom:!1};let Rl=null,jl=null,Th=0;const ov=new Set;function I_(e){Rl=e;for(const t of ov)t(e)}function m0(e){if(!e||typeof e!="object")return Eh;const t=e;return{terminal:typeof t.terminal=="string"&&$_.includes(t.terminal)?t.terminal:Eh.terminal,custom:t.custom===!0}}function jX(){if(Rl)return Promise.resolve(Rl);if(jl)return jl;const e=++Th;return jl=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{jl=null;const n=m0(t);return e!==Th?Rl??n:(Rl=n,n)}).catch(()=>(jl=null,Eh)),jl}function kX(){const[e,t]=m.useState(()=>Rl??Eh);return m.useEffect(()=>{let n=!1;return jX().then(r=>{n||t(r)}),ov.add(t),()=>{n=!0,ov.delete(t)}},[]),e}async function SX(e){++Th;const t=await fetch("/api/config/terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({terminal:e})});if(!t.ok){const r=await t.json().catch(()=>null);throw new Error((r==null?void 0:r.error)??`HTTP ${t.status}`)}const n=m0(await t.json());return I_(n),n}async function NX(){++Th;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=m0(await e.json());return I_(t),t}const xp={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function CX(){const{terminal:e,custom:t}=kX(),[n,r]=m.useState(!1),[o,i]=m.useState(null);function a(f){i(f),setTimeout(()=>i(null),2500)}async function l(f){if(!(f===e&&t)){r(!0);try{await SX(f),a({type:"success",message:`Terminal set to ${xp[f]}.`})}catch(p){a({type:"error",message:p instanceof Error?p.message:"Save failed."})}finally{r(!1)}}}async function u(){r(!0);try{const f=await NX();a({type:"success",message:`Reset to OS default (${xp[f.terminal]}).`})}catch(f){a({type:"error",message:f instanceof Error?f.message:"Reset failed."})}finally{r(!1)}}return s.jsxs(Xe,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${xp[e]}) when unset.`,actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:u,disabled:n,type:"button",children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset to OS default"]}):void 0,children:[o&&s.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}),s.jsxs("label",{className:"block text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Launch in"}),s.jsx("select",{value:e,onChange:f=>l(f.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:$_.map(f=>s.jsx("option",{value:f,children:xp[f]},f))})]})]})}const qN={all:"Everything",assignment:"Assignments",project:"Projects",todo:"Todos",server:"Servers",playbook:"Playbooks"},EX=["all",...em];function zy(e){return Object.entries(e).map(([t,n])=>({prefix:t,kind:n}))}function TX(e){const t=[],n={},r=new Set;for(const{prefix:i,kind:a}of e){const l=i.trim();if(l===""){t.push("An alias prefix is empty.");continue}if(r.has(l)){t.push(`Duplicate prefix "${l}".`);continue}r.add(l),n[l]=a}const o=UO(n);return o.ok||t.push(...o.errors),{map:n,errors:t}}function RX(){const{search:e,custom:t}=Gv(),[n,r]=m.useState(e.defaultScope),[o,i]=m.useState(e.externalIds),[a,l]=m.useState(()=>zy(e.aliases)),[u,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),k=JSON.stringify(e);m.useEffect(()=>{u||(r(e.defaultScope),i(e.externalIds),l(zy(e.aliases)))},[k]);const{map:v,errors:b}=TX(a);function j(_){y(_),setTimeout(()=>y(null),2500)}function N(){l(_=>[..._,{prefix:"",kind:"assignment"}]),f(!0)}function S(_){l(U=>U.filter((I,V)=>V!==_)),f(!0)}function C(_,U){l(I=>I.map((V,O)=>O===_?{...V,...U}:V)),f(!0)}function D(_){r(_.defaultScope),i(_.externalIds),l(zy(_.aliases)),f(!1)}async function T(){if(!(b.length>0)){h(!0);try{const _=await WO({defaultScope:n,aliases:v,externalIds:o});D(_.search),j({type:"success",message:"Search settings saved."})}catch(_){j({type:"error",message:_ instanceof Error?_.message:"Save failed."})}finally{h(!1)}}}async function R(){h(!0);try{const _=await qO();D(_.search),j({type:"success",message:"Reset to defaults."})}catch(_){j({type:"error",message:_ instanceof Error?_.message:"Reset failed."})}finally{h(!1)}}const $=u&&b.length===0&&!p;return s.jsxs(Xe,{title:"Search",description:"Customize the Cmd+K command palette: default scope, type-alias prefixes, and external-ID indexing.",actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:R,disabled:p,type:"button",children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset to defaults"]}):void 0,children:[g&&s.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}),s.jsxs("div",{className:"space-y-5",children:[s.jsxs("label",{className:"block text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Default scope"}),s.jsx("select",{value:n,onChange:_=>{r(_.target.value),f(!0)},disabled:p,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:EX.map(_=>s.jsx("option",{value:_,children:qN[_]},_))}),s.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:["Searches with no type prefix are limited to this. An ",s.jsx("code",{children:"all:"})," prefix (or empty box) always searches everything."]})]}),s.jsxs("div",{className:"text-sm",children:[s.jsx("span",{className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Type-alias prefixes"}),s.jsx("div",{className:"space-y-2",children:a.map((_,U)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:_.prefix,onChange:I=>C(U,{prefix:I.target.value}),placeholder:"prefix",disabled:p,spellCheck:!1,className:"w-24 rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"}),s.jsx("span",{className:"text-muted-foreground",children:"→"}),s.jsx("select",{value:_.kind,onChange:I=>C(U,{kind:I.target.value}),disabled:p,className:"rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60",children:em.map(I=>s.jsx("option",{value:I,children:qN[I]},I))}),s.jsx("button",{type:"button",onClick:()=>S(U),disabled:p,"aria-label":`Remove alias ${_.prefix}`,className:"rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-60",children:s.jsx(Td,{className:"h-3.5 w-3.5"})})]},U))}),s.jsxs("button",{type:"button",onClick:N,disabled:p,className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-60",children:[s.jsx(It,{className:"h-3 w-3"}),"Add alias"]})]}),s.jsxs("label",{className:"flex items-start gap-2 text-sm",children:[s.jsx("input",{type:"checkbox",checked:o,onChange:_=>{i(_.target.checked),f(!0)},disabled:p,className:"mt-0.5"}),s.jsxs("span",{children:[s.jsx("span",{className:"font-medium",children:"Index external IDs"}),s.jsxs("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:["Fold external IDs (e.g. Jira keys) into search and enable"," ",s.jsx("code",{children:"jira:"}),"/",s.jsx("code",{children:"externalid:"})," and bare-ID matching."]})]})]}),u&&b.length>0&&s.jsx("ul",{className:"space-y-1 text-xs text-error-foreground",children:b.map((_,U)=>s.jsx("li",{children:_},U))}),s.jsx("div",{children:s.jsx("button",{type:"button",onClick:T,disabled:!$,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50",children:p?"Saving…":"Save search settings"})})]})]})}function ku(e){return e===ah?"Ungrouped":e}function AX(){const{data:e,loading:t,error:n,refetch:r}=Na(),{hidden:o,custom:i,loading:a,error:l,reload:u}=MT(),[f,p]=m.useState(!1),[h,g]=m.useState(null);function y(j){g(j),setTimeout(()=>g(null),2500)}const k=e?[...e.workspaces,...e.hasUngrouped?[ah]:[]]:[];async function v(j,N){const S=N?o.filter(C=>C!==j):[...o,j];p(!0);try{await gz(S),y({type:"success",message:N?`Showing "${ku(j)}" in the left nav.`:`Hiding "${ku(j)}" from the left nav.`})}catch(C){y({type:"error",message:C instanceof Error?C.message:"Save failed."})}finally{p(!1)}}async function b(){p(!0);try{await xz(),y({type:"success",message:"All workspaces shown in the left nav."})}catch(j){y({type:"error",message:j instanceof Error?j.message:"Reset failed."})}finally{p(!1)}}return s.jsxs(Xe,{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?s.jsxs("button",{className:"shell-action text-xs",onClick:b,disabled:f,type:"button",children:[s.jsx(Qs,{className:"h-3 w-3"}),"Show all"]}):void 0,children:[h&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${h.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:h.message}),t||a?s.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading workspaces…"}):n||l?s.jsxs("div",{className:"flex items-center gap-3 text-sm text-error-foreground",children:[s.jsx("span",{children:n?"Failed to load workspaces.":"Failed to load the visibility preference."}),s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>{n&&r(),l&&u()},children:[s.jsx(Qs,{className:"h-3 w-3"}),"Retry"]})]}):k.length===0?s.jsx("div",{className:"text-sm text-muted-foreground",children:"No workspaces yet."}):s.jsx("ul",{className:"flex flex-col divide-y divide-border/40",children:k.map(j=>{const N=!pz(j,o);return s.jsxs("li",{className:"flex items-center justify-between gap-3 py-2",children:[s.jsxs("span",{className:"truncate text-sm",title:ku(j),children:[ku(j),j===ah&&s.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(standalone, ungrouped)"})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":N,"aria-label":`Show "${ku(j)}" in the left nav`,onClick:()=>v(j,!N),disabled:f,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 ${N?"bg-primary":"bg-muted"}`,children:s.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm ring-0 transition-transform ${N?"translate-x-4":"translate-x-0"}`})})]},j)})})]})}function PX(){const{preset:e,setPreset:t,resetPreset:n}=zv(),[r,o]=m.useState(!1),[i,a]=m.useState(null);async function l(f){if(!(f===e||r)){o(!0),a(null);try{await t(f),a({type:"success",message:"Theme updated"}),setTimeout(()=>a(null),2e3)}catch(p){a({type:"error",message:p instanceof Error?p.message:"Failed to save theme"})}finally{o(!1)}}}async function u(){o(!0),a(null);try{await n(),a({type:"success",message:"Theme reset to default"}),setTimeout(()=>a(null),2e3)}catch(f){a({type:"error",message:f instanceof Error?f.message:"Failed to reset theme"})}finally{o(!1)}}return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Xe,{title:"Theme",description:"Pick a color theme for the dashboard. The default is the Syntaur brand.",actions:e!=="default"?s.jsxs("button",{className:"shell-action text-xs",onClick:u,disabled:r,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset"]}):void 0,children:[i&&s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${i.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:i.message}),s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",children:m2.map(f=>{const p=f.slug===e;return s.jsxs("button",{type:"button",onClick:()=>l(f.slug),disabled:r,"aria-pressed":p,className:`group relative flex flex-col gap-2 rounded-lg border bg-card/95 p-3 text-left transition disabled:opacity-60 ${p?"border-primary ring-2 ring-primary/40":"border-border/60 hover:border-primary/40"}`,children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.primary}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.secondary}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.coral}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.teal}}),s.jsx("span",{className:"h-5 w-5 rounded-full ring-1 ring-border/60",style:{background:f.swatches.amber}}),p&&s.jsx("span",{className:"ml-auto inline-flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground",children:s.jsx(zr,{className:"h-3 w-3"})})]}),s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium text-foreground",children:f.label}),s.jsx("div",{className:"text-xs text-muted-foreground",children:f.description})]})]},f.slug)})})]}),s.jsx(iX,{}),s.jsx(CX,{}),s.jsx(RX,{}),s.jsx(AX,{}),s.jsx(vX,{}),s.jsx(dX,{}),s.jsx(oX,{})]})}function _X({open:e,affected:t,remaining:n,ruleReferences:r,headlineReferences:o,onResolve:i,onCancel:a}){var D,T;const[l,u]=m.useState(n.length>0?"remap":"delete"),[f,p]=m.useState(((D=n[0])==null?void 0:D.id)??""),[h,g]=m.useState(((T=n[0])==null?void 0:T.id)??""),[y,k]=m.useState(!1),v=t.count>0;m.useEffect(()=>{var R,$;e&&(u(n.length>0?"remap":"delete"),p(((R=n[0])==null?void 0:R.id)??""),g((($=n[0])==null?void 0:$.id)??""),k(!1))},[e,n]);const b=!o||h!==""&&h!==t.id,j=l==="remap"&&n.length>0&&f!==""&&f!==t.id||l==="delete"&&(!v||y)&&b;function N(){j&&(l==="remap"?i({id:t.id,mode:"remap",target:f},f):i({id:t.id,mode:"delete"},o?h:""))}const S=t.assignments.slice(0,10),C=t.count-S.length;return s.jsx(Ln,{open:e,onOpenChange:R=>R?void 0:a(),children:s.jsxs(jn,{className:"max-w-xl",children:[s.jsxs(tr,{children:[s.jsxs(kn,{children:['Delete status "',t.label,'"',v?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),s.jsx(ns,{children:v?"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."})]}),v&&s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsxs("ul",{className:"space-y-1 text-sm",children:[S.map(R=>s.jsx("li",{children:s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:R.display})},`${R.projectSlug??"standalone"}/${R.assignmentSlug}`)),C>0&&s.jsxs("li",{className:"text-xs italic text-muted-foreground",children:["+",C," more not shown"]})]})}),r.length>0&&s.jsxs("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 p-3",children:[s.jsx("p",{className:"mb-1 text-xs font-medium text-foreground",children:"Workflow rules referencing this status:"}),s.jsx("ul",{className:"space-y-0.5 font-mono text-xs text-muted-foreground",children:r.map((R,$)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-foreground",children:R.section}),s.jsx("span",{className:"mx-1",children:"·"}),R.detail]},$))}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:l==="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.":".")})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="remap",onChange:()=>u("remap"),disabled:n.length===0,className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium",children:v?"Remap to another status":"Remap rules to another status"}),s.jsxs("select",{value:f,onChange:R=>p(R.target.value),onClick:()=>u("remap"),disabled:l!=="remap"||n.length===0,className:"mt-2 block w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm",children:[n.length===0&&s.jsx("option",{value:"",children:"(no other statuses)"}),n.map(R=>s.jsxs("option",{value:R.id,children:[R.label," (",R.id,")"]},R.id))]}),n.length===0&&s.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."})]})]}),s.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",name:"status-delete-mode",checked:l==="delete",onChange:()=>u("delete"),className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:v?"Delete these assignments":"Drop the referencing rules"}),s.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:v?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),l==="delete"&&o&&s.jsxs("span",{className:"mt-2 block",children:[s.jsx("span",{className:"block text-xs font-medium",children:"Remap headline rules to"}),s.jsxs("select",{value:h,onChange:R=>g(R.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&&s.jsx("option",{value:"",children:"(no other statuses)"}),n.map(R=>s.jsxs("option",{value:R.id,children:[R.label," (",R.id,")"]},R.id))]}),s.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."})]}),l==="delete"&&v&&s.jsxs("label",{className:"mt-2 flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:y,onChange:R=>k(R.target.checked)}),s.jsxs("span",{className:"text-xs",children:["I understand this will permanently delete ",t.count," assignment",t.count===1?"":"s","."]})]})]})]})]}),s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:a,className:"shell-action",children:"Cancel"}),s.jsx("button",{type:"button",onClick:N,disabled:!j,className:`shell-action ${l==="delete"?"bg-error text-error-foreground hover:opacity-90":"shell-action--cta"} disabled:cursor-not-allowed disabled:opacity-50`,children:l==="remap"?v?`Remap ${t.count} → ${f||"..."}`:`Remap rules → ${f||"..."}`:v?`Delete ${t.count}`:"Drop rules"})]})]})})}function DX({open:e,references:t,onConfirm:n,onCancel:r}){return s.jsx(Ln,{open:e,onOpenChange:o=>o?void 0:r(),children:s.jsxs(jn,{className:"max-w-xl",children:[s.jsxs(tr,{children:[s.jsx(kn,{children:"Delete fact — referenced by derive rules"}),s.jsx(ns,{children:"Removing this fact will break the following derive conditions. The doctor check will flag them as invalid until they are fixed."})]}),s.jsx("div",{className:"rounded-md border border-border/60 bg-background/80 p-3",children:s.jsx("ul",{className:"space-y-2 text-sm",children:t.map((o,i)=>s.jsxs("li",{className:"font-mono text-xs text-muted-foreground",children:[s.jsx("span",{className:"text-foreground",children:o.location}),s.jsx("span",{className:"mx-1",children:"·"}),s.jsx("span",{children:o.when})]},i))})}),s.jsxs(Ur,{children:[s.jsx("button",{type:"button",onClick:r,className:"shell-action",children:"Cancel"}),s.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 $X({value:e,onChange:t,ariaLabel:n}){const r=n??"Pick a color",o=n?`${n} (hex)`:"Color hex value";return s.jsxs("div",{className:"flex items-center gap-2",children:[s.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":r}),s.jsx("input",{type:"text",value:e,onChange:i=>t(i.target.value),placeholder:"#64748b",className:"editor-input w-[5.5rem] font-mono text-xs","aria-label":o})]})}function IX({row:e,isSaved:t,onUpdate:n,onRemove:r}){const{attributes:o,listeners:i,setNodeRef:a,setActivatorNodeRef:l,transform:u,transition:f,isDragging:p}=ym({id:e.rowKey}),h={transform:bs.Transform.toString(u),transition:f,zIndex:p?50:void 0,position:p?"relative":void 0};return s.jsxs("div",{ref:a,style:h,className:`surface-panel flex flex-wrap items-center gap-3 px-3 py-2 ${p?"opacity-60 shadow-lg":""}`,children:[s.jsx("button",{ref:l,...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:s.jsx(pc,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:t?s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.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"})}),s.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:"To rename a saved status, delete the row and create a new one (this triggers the orphan-resolution flow if assignments still reference it)."})]}):s.jsx("input",{type:"text",value:e.id,onChange:g=>n("id",g.target.value),"aria-label":"Status ID",className:"editor-input w-full text-sm"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:s.jsx("input",{type:"text",value:e.label,onChange:g=>n("label",g.target.value),"aria-label":"Status label",className:"editor-input w-full text-sm"})}),s.jsx("div",{className:"min-w-[10rem] flex-1",children:s.jsx("input",{type:"text",value:e.description,onChange:g=>n("description",g.target.value),"aria-label":"Status description",placeholder:"description (optional)",className:"editor-input w-full text-sm"})}),s.jsx($X,{value:e.color,onChange:g=>n("color",g),ariaLabel:`Color for ${e.label||e.id}`}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),s.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:'When enabled, assignments in this status count as finished — they fill the "done" portion of progress bars and satisfy dependency requirements.'})]}),s.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:s.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"}`})})]}),s.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:r,title:"Remove status","aria-label":`Remove status ${e.id}`,children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})}function MX({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:r,onRemove:o,onReorder:i}){const a=dm(wi(wc,{activationConstraint:{distance:8}}),wi(vc,{coordinateGetter:ER}));function l(u){const{active:f,over:p}=u;if(!p||f.id===p.id)return;const h=e.findIndex(y=>y.rowKey===f.id),g=e.findIndex(y=>y.rowKey===p.id);h===-1||g===-1||i(jc(e,h,g))}return s.jsx(Xe,{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:s.jsxs("button",{className:"shell-action text-xs",onClick:r,children:[s.jsx(It,{className:"h-3 w-3"}),"Add Status"]}),children:s.jsx(gm,{sensors:a,collisionDetection:fm,onDragEnd:l,children:s.jsx(xm,{items:e.map(u=>u.rowKey),strategy:bw,children:s.jsx("div",{className:"space-y-2",children:e.map((u,f)=>s.jsx(IX,{row:u,isSaved:t.has(u.id),onUpdate:(p,h)=>n(f,p,h),onRemove:()=>o(f)},u.rowKey))})})})})}function LX(e){const t=Array.from(e.pendingResolutions.values()),r={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&&(r.transitions=e.transitions),e.derive!==void 0&&(r.derive=e.derive),e.facts!==void 0&&(r.facts=e.facts),e.factRemovalAcks&&e.factRemovalAcks.length>0&&(r.factRemovalAcks=e.factRemovalAcks),{body:r,resolutions:t}}function OX(e,t,n){const r=[];t.phaseLadder.forEach((o,i)=>{o.phase===e&&r.push({section:"phaseLadder",detail:`phaseLadder rung ${i} ("${o.phase}")`})}),t.headline.parked===e&&r.push({section:"headline",detail:"headline.parked"}),t.headline.blocked===e&&r.push({section:"headline",detail:"headline.blocked"});for(const o of n)(o.from===e||o.to===e)&&r.push({section:"transitions",detail:`transition ${o.from} --${o.command}--> ${o.to}`});return r}function FX(e,t){return t.headline.parked===e||t.headline.blocked===e}function zX(e,t,n){return{phaseLadder:e.phaseLadder.map(r=>r.phase===t?{...r,phase:n}:r),disposition:e.disposition,headline:{parked:e.headline.parked===t?n:e.headline.parked,blocked:e.headline.blocked===t?n:e.headline.blocked}}}function BX(e,t,n){return e.map(r=>({...r,from:r.from===t?n:r.from,to:r.to===t?n:r.to}))}function UX(e,t,n){return{phaseLadder:e.phaseLadder.filter(r=>r.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 HX(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function VX(e,t){const n=new Map;t.forEach((o,i)=>{n.has(o)||n.set(o,i)});const r=t.length;return e.map((o,i)=>({s:o,originalIndex:i,r:n.get(o.id)??r})).sort((o,i)=>o.r-i.r||o.originalIndex-i.originalIndex).map(o=>o.s)}function KN(e,t){const n=new Map;for(const[r,o]of e.entries())t.has(o.id)||o.mode==="remap"&&!t.has(o.target)||n.set(r,o);return n}function M_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function WX(e){const t=e.statuses.map(n=>({rowKey:M_(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return VX(t,e.order)}function qX(e){return Ib(e)}function GN(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function KX(e){const t=new Map;for(let n=0;n<e.length;n++){const r=GN(Ib(e.slice(0,n))),o=GN(Ib(e.slice(0,n+1)));for(const[i,a]of o.entries()){const l=r.get(i)??0;if(a>l){t.set(n,i);break}}}return t}const GX=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],YX=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function XX(){return{name:"",type:"bool",binds:null}}function QX({rows:e,onChange:t,saving:n}){const r=KX(e),o=m.useCallback(()=>{t([...e,XX()])},[e,t]),i=m.useCallback((l,u,f)=>{t(e.map((p,h)=>h===l?{...p,[u]:f}:p))},[e,t]),a=m.useCallback(l=>{t(e.filter((u,f)=>f!==l))},[e,t]);return s.jsxs(Xe,{title:"Facts",description:"Declare custom facts and attestation fields for derive rules and the fact vocabulary.",children:[s.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:["Names must match ",s.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)."]}),s.jsxs("div",{className:"space-y-2",children:[e.length===0&&s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No custom facts declared."}),e.map((l,u)=>{const f=r.get(u),p=l.type==="attestation";return s.jsxs("div",{className:`rounded-md border p-2 ${f?"border-error-foreground/40 bg-error/5":"border-border/60 bg-background/80"}`,children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"flex-1 grid grid-cols-1 sm:grid-cols-3 gap-2",children:[s.jsx("input",{type:"text",value:l.name,onChange:h=>i(u,"name",h.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"}),s.jsx("select",{value:l.type,onChange:h=>{const g=h.target.value;t(e.map((y,k)=>k===u?{...y,type:g,binds:g==="attestation"?y.binds:null}:y))},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:GX.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}),p?s.jsx("select",{value:l.binds??"none",onChange:h=>i(u,"binds",h.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:YX.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}):s.jsx("span",{className:"text-sm text-muted-foreground py-1",children:"—"})]}),f&&s.jsxs(Ir,{children:[s.jsx(Mr,{asChild:!0,children:s.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:s.jsx(nh,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),s.jsx(gr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:f})]}),s.jsx("button",{type:"button",onClick:()=>a(u),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:s.jsx(bn,{className:"h-3.5 w-3.5"})})]}),f&&s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:f})]},u)})]}),s.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:[s.jsx(It,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function L_(e,t=Cm){var r,o;if(e==="*")return null;const n=rm(e);if(!n.ast)return((r=n.errors[0])==null?void 0:r.message)??"unparseable condition";try{return $u(n.ast,t),null}catch(i){if(i instanceof Dr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function By(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 JX(e){if(e.kind==="atom"){const t=By(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",r=e.kind==="and"?"OR":"AND",o=[];for(const i of e.children)if(i.kind==="atom"){const a=By(i);if(!a)return null;o.push({join:r,comparisons:[a]})}else if(i.kind===n){const a=[];for(const l of i.children){if(l.kind!=="atom")return null;const u=By(l);if(!u)return null;a.push(u)}o.push({join:r,comparisons:a})}else return null;return{outerJoin:t,groups:o}}return null}function YN(e){const t=e.trim();if(t===""||t==="*")return null;const n=rm(t);return n.ast?JX(n.ast):null}const ZX=/^[A-Za-z_][A-Za-z0-9_-]*$/;function eQ(e){return e===""||!ZX.test(e)||/^(and|or|not)$/i.test(e)}function tQ(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function nQ(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:eQ(e.value)?tQ(e.value):e.value}function rQ(e){const t=nQ(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function sQ(e){return e.groups.map(n=>{const r=n.comparisons.map(rQ).join(` ${n.join} `);return n.comparisons.length>1?`(${r})`:r}).join(` ${e.outerJoin} `)}function oQ(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":L_(e,t)}function iQ(e){return PU(AU(e))}function aQ(e){const t=Dw(e),n=[];for(const r of bA(e)){const o=t[r.toLowerCase()];o&&n.push({name:r,kind:o.kind})}return n}function O_(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function iv(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function Su(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:iv(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:O_(t.kind)}:{field:"",op:":",value:""}]}]}}function F_({value:e,onChange:t,fieldOptions:n,registry:r,disabled:o}){const i=m.useMemo(()=>YN(e),[e]),a=e.trim()===""||i!==null,[l,u]=m.useState(a?"builder":"raw"),[f,p]=m.useState(()=>i??Su(n)),h=m.useRef(e);m.useEffect(()=>{if(e===h.current)return;const T=YN(e);T&&p(T),!(e.trim()===""||T)&&l==="builder"&&u("raw"),h.current=e},[e]);const g=oQ(e,r);function y(T){h.current=T,t(T)}function k(T){p(T),y(sQ(T))}function v(T){k({outerJoin:T,groups:f.groups.map(R=>({...R,join:T==="AND"?"OR":"AND"}))})}function b(T,R,$){const _=f.groups.map((U,I)=>I===T?{...U,comparisons:U.comparisons.map((V,O)=>O===R?{...V,...$}:V)}:U);k({...f,groups:_})}function j(T){const R=Su(n).groups[0].comparisons[0],$=f.groups.map((_,U)=>U===T?{..._,comparisons:[..._.comparisons,{...R}]}:_);k({...f,groups:$})}function N(T,R){let $=f.groups.map((_,U)=>U===T?{..._,comparisons:_.comparisons.filter((I,V)=>V!==R)}:_);$=$.filter(_=>_.comparisons.length>0),$.length===0&&($=Su(n).groups),k({...f,groups:$})}function S(){const T=f.outerJoin==="AND"?"OR":"AND";k({...f,groups:[...f.groups,{join:T,comparisons:[Su(n).groups[0].comparisons[0]]}]})}function C(){if(l==="builder"){u("raw");return}a&&(p(i??Su(n)),u("builder"))}const D="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 s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Condition"}),s.jsxs("button",{type:"button",onClick:C,disabled:o||l==="raw"&&!a,title:l==="raw"&&!a?"Condition too complex for the builder — edit as raw AQL":l==="builder"?"Switch to raw AQL":"Switch to builder",className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[l==="builder"?s.jsx(IL,{className:"h-3 w-3"}):s.jsx(JL,{className:"h-3 w-3"}),l==="builder"?"Raw AQL":"Builder"]})]}),l==="raw"?s.jsx("input",{type:"text",list:"aql-field-names",value:e,onChange:T=>y(T.target.value),disabled:o,placeholder:"e.g. planApproved:true AND implementationStarted:true",className:`${D} w-full font-mono`}):s.jsxs("div",{className:"space-y-2",children:[f.groups.map((T,R)=>s.jsxs("div",{children:[R>0&&s.jsxs("div",{className:"my-1 flex items-center gap-2",children:[s.jsx("span",{className:"h-px flex-1 bg-border/60"}),s.jsx("button",{type:"button",onClick:()=>v(f.outerJoin==="AND"?"OR":"AND"),disabled:o,className:"shell-action text-[10px] uppercase tracking-wide",children:f.outerJoin}),s.jsx("span",{className:"h-px flex-1 bg-border/60"})]}),s.jsxs("div",{className:"rounded-md border border-border/50 bg-background/60 p-2 space-y-1.5",children:[T.comparisons.map(($,_)=>{const U=n.find(O=>O.name===$.field),I=(U==null?void 0:U.kind)??"string",V=iv(I);return s.jsxs("div",{className:"flex items-center gap-1.5",children:[_>0&&s.jsx("span",{className:"w-9 shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:T.join}),s.jsxs("select",{value:$.field,onChange:O=>{const P=n.find(q=>q.name===O.target.value),L=(P==null?void 0:P.kind)??"string",B=iv(L);b(R,_,{field:O.target.value,op:B.includes($.op)?$.op:B[0],value:L==="bool"?"true":$.value,valueType:O_(L)})},disabled:o,className:`${D} font-mono`,children:[n.length===0&&s.jsx("option",{value:"",children:"(no fields)"}),!n.some(O=>O.name===$.field)&&$.field!==""&&s.jsx("option",{value:$.field,children:$.field}),n.map(O=>s.jsx("option",{value:O.name,children:O.name},O.name))]}),s.jsx("select",{value:$.op,onChange:O=>b(R,_,{op:O.target.value}),disabled:o,className:`${D} font-mono`,children:V.map(O=>s.jsx("option",{value:O,children:O},O))}),I==="bool"?s.jsxs("select",{value:$.value||"true",onChange:O=>b(R,_,{value:O.target.value}),disabled:o,className:`${D} font-mono`,children:[s.jsx("option",{value:"true",children:"true"}),s.jsx("option",{value:"false",children:"false"})]}):s.jsx("input",{type:"text",value:$.value,onChange:O=>b(R,_,{value:O.target.value}),disabled:o,placeholder:"value",className:`${D} w-24 font-mono`}),s.jsx("button",{type:"button",onClick:()=>N(R,_),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:s.jsx(bn,{className:"h-3.5 w-3.5"})})]},_)}),s.jsxs("button",{type:"button",onClick:()=>j(R),disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(It,{className:"h-3 w-3"}),T.join," condition"]})]})]},R)),s.jsxs("button",{type:"button",onClick:S,disabled:o,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(It,{className:"h-3 w-3"}),f.outerJoin," group"]})]}),s.jsx("datalist",{id:"aql-field-names",children:n.map(T=>s.jsx("option",{value:T.name},T.name))}),s.jsx("p",{className:"font-mono text-[11px] text-muted-foreground truncate",title:e,children:e.trim()===""?s.jsx("span",{className:"italic",children:"empty condition"}):e}),g&&s.jsx("p",{className:"text-xs text-error-foreground",children:g})]})}let XN=0;function Rh(){return XN+=1,`dr_${XN}_${Math.random().toString(36).slice(2,8)}`}function Uy(e){const t=[...e.disposition].sort((n,r)=>n.when===null&&r.when!==null?1:n.when!==null&&r.when===null?-1:0);return{phaseLadder:e.phaseLadder.map(n=>({rowKey:Rh(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Rh(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function av(e){const t=e.phaseLadder.map(r=>r.next.trim()?{phase:r.phase,when:r.when,next:r.next.trim()}:{phase:r.phase,when:r.when}),n=e.disposition.map(r=>({when:r.when,is:r.is}));return{phaseLadder:t,disposition:n,headline:{terminal:"passthrough",active:"phase",parked:e.headline.parked,blocked:e.headline.blocked}}}function lQ(e){return e.findIndex(t=>t.when.trim()==="*")}function z_(e,t,n){return z6(e,{statuses:t},r=>L_(r,n))}const QN=["active","blocked","parked"];function cQ({value:e,deriveCustom:t,statuses:n,acceptedFacts:r,onChange:o,onReset:i,disabled:a}){const l=m.useMemo(()=>Dw(r),[r]),u=m.useMemo(()=>aQ(r),[r]),f=dm(wi(wc,{activationConstraint:{distance:8}}),wi(vc,{coordinateGetter:ER})),p=m.useMemo(()=>{try{return z_(av(e),n,l)}catch{return["derive rules are malformed"]}},[e,n,l]),h=lQ(e.phaseLadder),g=h>=0?e.phaseLadder[h]:null,y=e.phaseLadder.filter((_,U)=>U!==h);function k(_,U){o({...e,phaseLadder:[..._?[_]:[],...U]})}function v(_,U){const I=e.phaseLadder.map(V=>V.rowKey===_?{...V,...U}:V);o({...e,phaseLadder:I})}function b(){var U;const _={rowKey:Rh(),phase:((U=n[0])==null?void 0:U.id)??"",when:"",next:""};k(g,[...y,_])}function j(_){o({...e,phaseLadder:e.phaseLadder.filter(U=>U.rowKey!==_)})}function N(_){const{active:U,over:I}=_;if(!I||U.id===I.id)return;const V=y.findIndex(P=>P.rowKey===U.id),O=y.findIndex(P=>P.rowKey===I.id);V===-1||O===-1||k(g,jc(y,V,O))}function S(_,U){o({...e,disposition:e.disposition.map(I=>I.rowKey===_?{...I,...U}:I)})}function C(){const _={rowKey:Rh(),when:"",is:"active"},U=e.disposition.findIndex(V=>V.when===null),I=[...e.disposition];U>=0?I.splice(U,0,_):I.push(_),o({...e,disposition:I})}function D(_){o({...e,disposition:e.disposition.filter(U=>U.rowKey!==_)})}function T(_,U){o({...e,headline:{...e.headline,[_]:U}})}const R="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 $(_,U,I){return s.jsxs("select",{value:_,onChange:V=>U(V.target.value),disabled:a,"aria-label":I,className:`${R} font-mono`,children:[!n.some(V=>V.id===_)&&_!==""&&s.jsx("option",{value:_,children:_}),n.map(V=>s.jsxs("option",{value:V.id,children:[V.label," (",V.id,")"]},V.id))]})}return s.jsxs(Xe,{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?s.jsxs("button",{type:"button",className:"shell-action text-xs inline-flex items-center gap-1",onClick:i,disabled:a,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset to default rules"]}):void 0,children:[!t&&s.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."}),p.length>0&&s.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:[s.jsx("p",{className:"font-medium",children:"These derive rules won't save until fixed:"}),s.jsx("ul",{className:"mt-1 list-disc pl-4 space-y-0.5",children:p.map((_,U)=>s.jsx("li",{children:_},U))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Phase ladder"}),g&&s.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2 opacity-90",children:[s.jsx("span",{className:"mt-1 text-muted-foreground/40",children:s.jsx(pc,{className:"h-4 w-4 opacity-30"})}),s.jsxs("div",{className:"min-w-[10rem] flex-1 space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase (catch-all, lowest priority)"}),$(g.phase,_=>v(g.rowKey,{phase:_}),"Catch-all phase"),s.jsx("span",{className:"ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"matches everything"})]}),s.jsxs("div",{className:"min-w-[12rem] flex-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),s.jsx("input",{type:"text",value:g.next,onChange:_=>v(g.rowKey,{next:_.target.value}),disabled:a,className:`${R} w-full`})]})]}),s.jsx(gm,{sensors:f,collisionDetection:fm,onDragEnd:N,children:s.jsx(xm,{items:y.map(_=>_.rowKey),strategy:bw,children:s.jsx("div",{className:"space-y-2",children:y.map(_=>s.jsx(uQ,{rung:_,disabled:a,statusSelect:$,fieldOptions:u,registry:l,onUpdate:U=>v(_.rowKey,U),onRemove:()=>j(_.rowKey)},_.rowKey))})})}),s.jsxs("button",{type:"button",onClick:b,disabled:a,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(It,{className:"h-3 w-3"}),"Add rung"]})]}),s.jsxs("div",{className:"mt-5 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Disposition (first match wins)"}),s.jsx("div",{className:"space-y-2",children:e.disposition.map(_=>_.when===null?s.jsxs("div",{className:"surface-panel flex items-center gap-3 px-3 py-2",children:[s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:"otherwise"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),s.jsx("select",{value:_.is,onChange:U=>S(_.rowKey,{is:U.target.value}),disabled:a,className:`${R} font-mono`,children:QN.map(U=>s.jsx("option",{value:U,children:U},U))})]},_.rowKey):s.jsxs("div",{className:"surface-panel flex flex-wrap items-start gap-3 px-3 py-2",children:[s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx(F_,{value:_.when,onChange:U=>S(_.rowKey,{when:U}),fieldOptions:u,registry:l,disabled:a})}),s.jsxs("div",{className:"flex items-center gap-2 pt-5",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"is"}),s.jsx("select",{value:_.is,onChange:U=>S(_.rowKey,{is:U.target.value}),disabled:a,className:`${R} font-mono`,children:QN.map(U=>s.jsx("option",{value:U,children:U},U))}),s.jsx("button",{type:"button",onClick:()=>D(_.rowKey),disabled:a,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:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})]},_.rowKey))}),s.jsxs("button",{type:"button",onClick:C,disabled:a,className:"shell-action text-xs inline-flex items-center gap-1",children:[s.jsx(It,{className:"h-3 w-3"}),"Add disposition rule"]})]}),s.jsxs("div",{className:"mt-5 space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Headline projection"}),s.jsxs("div",{className:"surface-panel grid grid-cols-1 gap-3 px-3 py-2 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"When parked, show"}),$(e.headline.parked,_=>T("parked",_),"Parked headline status")]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"When blocked, show"}),$(e.headline.blocked,_=>T("blocked",_),"Blocked headline status")]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Terminal statuses: ",s.jsx("span",{className:"font-mono",children:"passthrough"})]}),s.jsxs("div",{className:"text-xs text-muted-foreground",children:["Active: ",s.jsx("span",{className:"font-mono",children:"phase"})]})]})]})]})}function uQ({rung:e,disabled:t,statusSelect:n,fieldOptions:r,registry:o,onUpdate:i,onRemove:a}){const{attributes:l,listeners:u,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=ym({id:e.rowKey}),k={transform:bs.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};return s.jsxs("div",{ref:f,style:k,className:`surface-panel flex flex-wrap items-start gap-3 px-3 py-2 ${y?"opacity-60 shadow-lg":""}`,children:[s.jsx("button",{ref:p,...l,...u,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:s.jsx(pc,{className:"h-4 w-4"})}),s.jsxs("div",{className:"min-w-[10rem] space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Phase"}),n(e.phase,v=>i({phase:v}),"Rung phase")]}),s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx(F_,{value:e.when,onChange:v=>i({when:v}),fieldOptions:r,registry:o,disabled:t})}),s.jsxs("div",{className:"min-w-[12rem] flex-1 space-y-1",children:[s.jsx("label",{className:"text-xs text-muted-foreground",children:"Next action"}),s.jsx("input",{type:"text",value:e.next,onChange:v=>i({next:v.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"})]}),s.jsx("button",{type:"button",onClick:a,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:s.jsx(bn,{className:"h-3.5 w-3.5"})})]})}const dQ=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 JN=0;function B_(){return JN+=1,`tr_${JN}_${Math.random().toString(36).slice(2,8)}`}function fQ(e){return{rowKey:B_(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function lv(e){return e.map(fQ)}function pQ(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 hQ(e){return e.map(pQ)}function U_(){const e=[];for(const[t,n]of dQ){const r=t.indexOf(":");e.push({from:t.slice(0,r),command:t.slice(r+1),to:n})}return e}function mQ(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function H_(e,t){const n=[];for(const r of e)t.has(r.from)||n.push(`transition ${r.from} --${r.command}--> ${r.to}: "${r.from}" is not a defined status`),t.has(r.to)||n.push(`transition ${r.from} --${r.command}--> ${r.to}: "${r.to}" is not a defined status`);return n}function gQ(e,t){var i;const n=(i=t[0])==null?void 0:i.id,r=new Set;for(const a of e)a.to&&r.add(a.to);const o=new Set;for(const a of t)a.id!==n&&(r.has(a.id)||o.add(a.id));return o}function ZN(e,t){const n=new Set(t.map(l=>l.id)),r=gQ(e,t),o=[],i=new Set;for(const l of t)i.has(l.id)||(i.add(l.id),o.push({id:l.id,label:l.label,color:l.color,terminal:l.terminal??!1,orphan:r.has(l.id),missing:!1}));for(const l of e)for(const u of[l.from,l.to])u&&!i.has(u)&&(i.add(u),o.push({id:u,label:u,terminal:!1,orphan:!1,missing:!0}));const a=e.map(l=>({rowKey:l.rowKey,from:l.from,to:l.to,command:l.command,label:l.label,requiresReason:l.requiresReason,undefinedRef:!n.has(l.from)||!n.has(l.to)}));return{nodes:o,edges:a}}function Sn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=Sn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var xQ={value:()=>{}};function Wm(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Kp(n)}function Kp(e){this._=e}function yQ(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Kp.prototype=Wm.prototype={constructor:Kp,on:function(e,t){var n=this._,r=yQ(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=bQ(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(o=(e=r[i]).type)n[o]=eC(n[o],e.name,t);else if(t==null)for(o in n)n[o]=eC(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Kp(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function bQ(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function eC(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=xQ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var cv="http://www.w3.org/1999/xhtml";const tC={svg:"http://www.w3.org/2000/svg",xhtml:cv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),tC.hasOwnProperty(t)?{space:tC[t],local:e}:e}function vQ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===cv&&t.documentElement.namespaceURI===cv?t.createElement(e):t.createElementNS(n,e)}}function wQ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function V_(e){var t=qm(e);return(t.local?wQ:vQ)(t)}function jQ(){}function g0(e){return e==null?jQ:function(){return this.querySelector(e)}}function kQ(e){typeof e!="function"&&(e=g0(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=new Array(a),u,f,p=0;p<a;++p)(u=i[p])&&(f=e.call(u,u.__data__,p,i))&&("__data__"in u&&(f.__data__=u.__data__),l[p]=f);return new Br(r,this._parents)}function SQ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function NQ(){return[]}function W_(e){return e==null?NQ:function(){return this.querySelectorAll(e)}}function CQ(e){return function(){return SQ(e.apply(this,arguments))}}function EQ(e){typeof e=="function"?e=CQ(e):e=W_(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,u,f=0;f<l;++f)(u=a[f])&&(r.push(e.call(u,u.__data__,f,a)),o.push(u));return new Br(r,o)}function q_(e){return function(){return this.matches(e)}}function K_(e){return function(t){return t.matches(e)}}var TQ=Array.prototype.find;function RQ(e){return function(){return TQ.call(this.children,e)}}function AQ(){return this.firstElementChild}function PQ(e){return this.select(e==null?AQ:RQ(typeof e=="function"?e:K_(e)))}var _Q=Array.prototype.filter;function DQ(){return Array.from(this.children)}function $Q(e){return function(){return _Q.call(this.children,e)}}function IQ(e){return this.selectAll(e==null?DQ:$Q(typeof e=="function"?e:K_(e)))}function MQ(e){typeof e!="function"&&(e=q_(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],u,f=0;f<a;++f)(u=i[f])&&e.call(u,u.__data__,f,i)&&l.push(u);return new Br(r,this._parents)}function G_(e){return new Array(e.length)}function LQ(){return new Br(this._enter||this._groups.map(G_),this._parents)}function Ah(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ah.prototype={constructor:Ah,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function OQ(e){return function(){return e}}function FQ(e,t,n,r,o,i){for(var a=0,l,u=t.length,f=i.length;a<f;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Ah(e,i[a]);for(;a<u;++a)(l=t[a])&&(o[a]=l)}function zQ(e,t,n,r,o,i,a){var l,u,f=new Map,p=t.length,h=i.length,g=new Array(p),y;for(l=0;l<p;++l)(u=t[l])&&(g[l]=y=a.call(u,u.__data__,l,t)+"",f.has(y)?o[l]=u:f.set(y,u));for(l=0;l<h;++l)y=a.call(e,i[l],l,i)+"",(u=f.get(y))?(r[l]=u,u.__data__=i[l],f.delete(y)):n[l]=new Ah(e,i[l]);for(l=0;l<p;++l)(u=t[l])&&f.get(g[l])===u&&(o[l]=u)}function BQ(e){return e.__data__}function UQ(e,t){if(!arguments.length)return Array.from(this,BQ);var n=t?zQ:FQ,r=this._parents,o=this._groups;typeof e!="function"&&(e=OQ(e));for(var i=o.length,a=new Array(i),l=new Array(i),u=new Array(i),f=0;f<i;++f){var p=r[f],h=o[f],g=h.length,y=HQ(e.call(p,p&&p.__data__,f,r)),k=y.length,v=l[f]=new Array(k),b=a[f]=new Array(k),j=u[f]=new Array(g);n(p,h,v,b,j,y,t);for(var N=0,S=0,C,D;N<k;++N)if(C=v[N]){for(N>=S&&(S=N+1);!(D=b[S])&&++S<k;);C._next=D||null}}return a=new Br(a,r),a._enter=l,a._exit=u,a}function HQ(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function VQ(){return new Br(this._exit||this._groups.map(G_),this._parents)}function WQ(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function qQ(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),l=new Array(o),u=0;u<a;++u)for(var f=n[u],p=r[u],h=f.length,g=l[u]=new Array(h),y,k=0;k<h;++k)(y=f[k]||p[k])&&(g[k]=y);for(;u<o;++u)l[u]=n[u];return new Br(l,this._parents)}function KQ(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],a;--o>=0;)(a=r[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function GQ(e){e||(e=YQ);function t(h,g){return h&&g?e(h.__data__,g.__data__):!h-!g}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,u=o[i]=new Array(l),f,p=0;p<l;++p)(f=a[p])&&(u[p]=f);u.sort(t)}return new Br(o,this._parents).order()}function YQ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function XQ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function QQ(){return Array.from(this)}function JQ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function ZQ(){let e=0;for(const t of this)++e;return e}function eJ(){return!this.node()}function tJ(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,l;i<a;++i)(l=o[i])&&e.call(l,l.__data__,i,o);return this}function nJ(e){return function(){this.removeAttribute(e)}}function rJ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sJ(e,t){return function(){this.setAttribute(e,t)}}function oJ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function iJ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function aJ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function lJ(e,t){var n=qm(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?rJ:nJ:typeof t=="function"?n.local?aJ:iJ:n.local?oJ:sJ)(n,t))}function Y_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function cJ(e){return function(){this.style.removeProperty(e)}}function uJ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dJ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function fJ(e,t,n){return arguments.length>1?this.each((t==null?cJ:typeof t=="function"?dJ:uJ)(e,t,n??"")):tc(this.node(),e)}function tc(e,t){return e.style.getPropertyValue(t)||Y_(e).getComputedStyle(e,null).getPropertyValue(t)}function pJ(e){return function(){delete this[e]}}function hJ(e,t){return function(){this[e]=t}}function mJ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function gJ(e,t){return arguments.length>1?this.each((t==null?pJ:typeof t=="function"?mJ:hJ)(e,t)):this.node()[e]}function X_(e){return e.trim().split(/^|\s+/)}function x0(e){return e.classList||new Q_(e)}function Q_(e){this._node=e,this._names=X_(e.getAttribute("class")||"")}Q_.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function J_(e,t){for(var n=x0(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Z_(e,t){for(var n=x0(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function xJ(e){return function(){J_(this,e)}}function yJ(e){return function(){Z_(this,e)}}function bJ(e,t){return function(){(t.apply(this,arguments)?J_:Z_)(this,e)}}function vJ(e,t){var n=X_(e+"");if(arguments.length<2){for(var r=x0(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?bJ:t?xJ:yJ)(n,t))}function wJ(){this.textContent=""}function jJ(e){return function(){this.textContent=e}}function kJ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function SJ(e){return arguments.length?this.each(e==null?wJ:(typeof e=="function"?kJ:jJ)(e)):this.node().textContent}function NJ(){this.innerHTML=""}function CJ(e){return function(){this.innerHTML=e}}function EJ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function TJ(e){return arguments.length?this.each(e==null?NJ:(typeof e=="function"?EJ:CJ)(e)):this.node().innerHTML}function RJ(){this.nextSibling&&this.parentNode.appendChild(this)}function AJ(){return this.each(RJ)}function PJ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _J(){return this.each(PJ)}function DJ(e){var t=typeof e=="function"?e:V_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function $J(){return null}function IJ(e,t){var n=typeof e=="function"?e:V_(e),r=t==null?$J:typeof t=="function"?t:g0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function MJ(){var e=this.parentNode;e&&e.removeChild(this)}function LJ(){return this.each(MJ)}function OJ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FJ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zJ(e){return this.select(e?FJ:OJ)}function BJ(e){return arguments.length?this.property("__data__",e):this.node().__data__}function UJ(e){return function(t){e.call(this,t,this.__data__)}}function HJ(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function VJ(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function WJ(e,t,n){return function(){var r=this.__on,o,i=UJ(t);if(r){for(var a=0,l=r.length;a<l;++a)if((o=r[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function qJ(e,t,n){var r=HJ(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,f=l.length,p;u<f;++u)for(o=0,p=l[u];o<i;++o)if((a=r[o]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?WJ:VJ,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function e3(e,t,n){var r=Y_(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function KJ(e,t){return function(){return e3(this,e,t)}}function GJ(e,t){return function(){return e3(this,e,t.apply(this,arguments))}}function YJ(e,t){return this.each((typeof t=="function"?GJ:KJ)(e,t))}function*XJ(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,a;o<i;++o)(a=r[o])&&(yield a)}var t3=[null];function Br(e,t){this._groups=e,this._parents=t}function qd(){return new Br([[document.documentElement]],t3)}function QJ(){return this}Br.prototype=qd.prototype={constructor:Br,select:kQ,selectAll:EQ,selectChild:PQ,selectChildren:IQ,filter:MQ,data:UQ,enter:LQ,exit:VQ,join:WQ,merge:qQ,selection:QJ,order:KQ,sort:GQ,call:XQ,nodes:QQ,node:JQ,size:ZQ,empty:eJ,each:tJ,attr:lJ,style:fJ,property:gJ,classed:vJ,text:SJ,html:TJ,raise:AJ,lower:_J,append:DJ,insert:IJ,remove:LJ,clone:zJ,datum:BJ,on:qJ,dispatch:YJ,[Symbol.iterator]:XJ};function Lr(e){return typeof e=="string"?new Br([[document.querySelector(e)]],[document.documentElement]):new Br([[e]],t3)}function JJ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fs(e,t){if(e=JJ(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const ZJ={passive:!1},fd={capture:!0,passive:!1};function Hy(e){e.stopImmediatePropagation()}function Wl(e){e.preventDefault(),e.stopImmediatePropagation()}function n3(e){var t=e.document.documentElement,n=Lr(e).on("dragstart.drag",Wl,fd);"onselectstart"in t?n.on("selectstart.drag",Wl,fd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function r3(e,t){var n=e.document.documentElement,r=Lr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Wl,fd),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const yp=e=>()=>e;function uv(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:u,dy:f,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}uv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function eZ(e){return!e.ctrlKey&&!e.button}function tZ(){return this.parentNode}function nZ(e,t){return t??{x:e.x,y:e.y}}function rZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function s3(){var e=eZ,t=tZ,n=nZ,r=rZ,o={},i=Wm("start","drag","end"),a=0,l,u,f,p,h=0;function g(C){C.on("mousedown.drag",y).filter(r).on("touchstart.drag",b).on("touchmove.drag",j,ZJ).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(C,D){if(!(p||!e.call(this,C,D))){var T=S(this,t.call(this,C,D),C,D,"mouse");T&&(Lr(C.view).on("mousemove.drag",k,fd).on("mouseup.drag",v,fd),n3(C.view),Hy(C),f=!1,l=C.clientX,u=C.clientY,T("start",C))}}function k(C){if(Wl(C),!f){var D=C.clientX-l,T=C.clientY-u;f=D*D+T*T>h}o.mouse("drag",C)}function v(C){Lr(C.view).on("mousemove.drag mouseup.drag",null),r3(C.view,f),Wl(C),o.mouse("end",C)}function b(C,D){if(e.call(this,C,D)){var T=C.changedTouches,R=t.call(this,C,D),$=T.length,_,U;for(_=0;_<$;++_)(U=S(this,R,C,D,T[_].identifier,T[_]))&&(Hy(C),U("start",C,T[_]))}}function j(C){var D=C.changedTouches,T=D.length,R,$;for(R=0;R<T;++R)($=o[D[R].identifier])&&(Wl(C),$("drag",C,D[R]))}function N(C){var D=C.changedTouches,T=D.length,R,$;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),R=0;R<T;++R)($=o[D[R].identifier])&&(Hy(C),$("end",C,D[R]))}function S(C,D,T,R,$,_){var U=i.copy(),I=fs(_||T,D),V,O,P;if((P=n.call(C,new uv("beforestart",{sourceEvent:T,target:g,identifier:$,active:a,x:I[0],y:I[1],dx:0,dy:0,dispatch:U}),R))!=null)return V=P.x-I[0]||0,O=P.y-I[1]||0,function L(B,q,z){var W=I,M;switch(B){case"start":o[$]=L,M=a++;break;case"end":delete o[$],--a;case"drag":I=fs(z||q,D),M=a;break}U.call(B,C,new uv(B,{sourceEvent:q,subject:P,target:g,identifier:$,active:M,x:I[0]+V,y:I[1]+O,dx:I[0]-W[0],dy:I[1]-W[1],dispatch:U}),R)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:yp(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:yp(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:yp(C),g):n},g.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:yp(!!C),g):r},g.on=function(){var C=i.on.apply(i,arguments);return C===i?g:C},g.clickDistance=function(C){return arguments.length?(h=(C=+C)*C,g):Math.sqrt(h)},g}function y0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function o3(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Kd(){}var pd=.7,Ph=1/pd,ql="\\s*([+-]?\\d+)\\s*",hd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Xs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sZ=/^#([0-9a-f]{3,8})$/,oZ=new RegExp(`^rgb\\(${ql},${ql},${ql}\\)$`),iZ=new RegExp(`^rgb\\(${Xs},${Xs},${Xs}\\)$`),aZ=new RegExp(`^rgba\\(${ql},${ql},${ql},${hd}\\)$`),lZ=new RegExp(`^rgba\\(${Xs},${Xs},${Xs},${hd}\\)$`),cZ=new RegExp(`^hsl\\(${hd},${Xs},${Xs}\\)$`),uZ=new RegExp(`^hsla\\(${hd},${Xs},${Xs},${hd}\\)$`),nC={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};y0(Kd,va,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:rC,formatHex:rC,formatHex8:dZ,formatHsl:fZ,formatRgb:sC,toString:sC});function rC(){return this.rgb().formatHex()}function dZ(){return this.rgb().formatHex8()}function fZ(){return i3(this).formatHsl()}function sC(){return this.rgb().formatRgb()}function va(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sZ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?oC(t):n===3?new yr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?bp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?bp(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=oZ.exec(e))?new yr(t[1],t[2],t[3],1):(t=iZ.exec(e))?new yr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=aZ.exec(e))?bp(t[1],t[2],t[3],t[4]):(t=lZ.exec(e))?bp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=cZ.exec(e))?lC(t[1],t[2]/100,t[3]/100,1):(t=uZ.exec(e))?lC(t[1],t[2]/100,t[3]/100,t[4]):nC.hasOwnProperty(e)?oC(nC[e]):e==="transparent"?new yr(NaN,NaN,NaN,0):null}function oC(e){return new yr(e>>16&255,e>>8&255,e&255,1)}function bp(e,t,n,r){return r<=0&&(e=t=n=NaN),new yr(e,t,n,r)}function pZ(e){return e instanceof Kd||(e=va(e)),e?(e=e.rgb(),new yr(e.r,e.g,e.b,e.opacity)):new yr}function dv(e,t,n,r){return arguments.length===1?pZ(e):new yr(e,t,n,r??1)}function yr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}y0(yr,dv,o3(Kd,{brighter(e){return e=e==null?Ph:Math.pow(Ph,e),new yr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pd:Math.pow(pd,e),new yr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yr(ma(this.r),ma(this.g),ma(this.b),_h(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:iC,formatHex:iC,formatHex8:hZ,formatRgb:aC,toString:aC}));function iC(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}`}function hZ(){return`#${ua(this.r)}${ua(this.g)}${ua(this.b)}${ua((isNaN(this.opacity)?1:this.opacity)*255)}`}function aC(){const e=_h(this.opacity);return`${e===1?"rgb(":"rgba("}${ma(this.r)}, ${ma(this.g)}, ${ma(this.b)}${e===1?")":`, ${e})`}`}function _h(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ma(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ua(e){return e=ma(e),(e<16?"0":"")+e.toString(16)}function lC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ps(e,t,n,r)}function i3(e){if(e instanceof ps)return new ps(e.h,e.s,e.l,e.opacity);if(e instanceof Kd||(e=va(e)),!e)return new ps;if(e instanceof ps)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-o,u=(i+o)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=u<.5?i+o:2-i-o,a*=60):l=u>0&&u<1?0:a,new ps(a,l,u,e.opacity)}function mZ(e,t,n,r){return arguments.length===1?i3(e):new ps(e,t,n,r??1)}function ps(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}y0(ps,mZ,o3(Kd,{brighter(e){return e=e==null?Ph:Math.pow(Ph,e),new ps(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pd:Math.pow(pd,e),new ps(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new yr(Vy(e>=240?e-240:e+120,o,r),Vy(e,o,r),Vy(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ps(cC(this.h),vp(this.s),vp(this.l),_h(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=_h(this.opacity);return`${e===1?"hsl(":"hsla("}${cC(this.h)}, ${vp(this.s)*100}%, ${vp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function cC(e){return e=(e||0)%360,e<0?e+360:e}function vp(e){return Math.max(0,Math.min(1,e||0))}function Vy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Km=e=>()=>e;function a3(e,t){return function(n){return e+n*t}}function gZ(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function bae(e,t){var n=t-e;return n?a3(e,n>180||n<-180?n-360*Math.round(n/360):n):Km(isNaN(e)?t:e)}function xZ(e){return(e=+e)==1?l3:function(t,n){return n-t?gZ(t,n,e):Km(isNaN(t)?n:t)}}function l3(e,t){var n=t-e;return n?a3(e,n):Km(isNaN(e)?t:e)}const Dh=(function e(t){var n=xZ(t);function r(o,i){var a=n((o=dv(o)).r,(i=dv(i)).r),l=n(o.g,i.g),u=n(o.b,i.b),f=l3(o.opacity,i.opacity);return function(p){return o.r=a(p),o.g=l(p),o.b=u(p),o.opacity=f(p),o+""}}return r.gamma=e,r})(1);function yZ(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function bZ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vZ(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)o[a]=Gu(e[a],t[a]);for(;a<n;++a)i[a]=t[a];return function(l){for(a=0;a<r;++a)i[a]=o[a](l);return i}}function wZ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Us(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function jZ(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Gu(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var fv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wy=new RegExp(fv.source,"g");function kZ(e){return function(){return e}}function SZ(e){return function(t){return e(t)+""}}function c3(e,t){var n=fv.lastIndex=Wy.lastIndex=0,r,o,i,a=-1,l=[],u=[];for(e=e+"",t=t+"";(r=fv.exec(e))&&(o=Wy.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(o=o[0])?l[a]?l[a]+=o:l[++a]=o:(l[++a]=null,u.push({i:a,x:Us(r,o)})),n=Wy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?SZ(u[0].x):kZ(t):(t=u.length,function(f){for(var p=0,h;p<t;++p)l[(h=u[p]).i]=h.x(f);return l.join("")})}function Gu(e,t){var n=typeof t,r;return t==null||n==="boolean"?Km(t):(n==="number"?Us:n==="string"?(r=va(t))?(t=r,Dh):c3:t instanceof va?Dh:t instanceof Date?wZ:bZ(t)?yZ:Array.isArray(t)?vZ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?jZ:Us)(e,t)}var uC=180/Math.PI,pv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function u3(e,t,n,r,o,i){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,u/=l),e*r<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*uC,skewX:Math.atan(u)*uC,scaleX:a,scaleY:l}}var wp;function NZ(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?pv:u3(t.a,t.b,t.c,t.d,t.e,t.f)}function CZ(e){return e==null||(wp||(wp=document.createElementNS("http://www.w3.org/2000/svg","g")),wp.setAttribute("transform",e),!(e=wp.transform.baseVal.consolidate()))?pv:(e=e.matrix,u3(e.a,e.b,e.c,e.d,e.e,e.f))}function d3(e,t,n,r){function o(f){return f.length?f.pop()+" ":""}function i(f,p,h,g,y,k){if(f!==h||p!==g){var v=y.push("translate(",null,t,null,n);k.push({i:v-4,x:Us(f,h)},{i:v-2,x:Us(p,g)})}else(h||g)&&y.push("translate("+h+t+g+n)}function a(f,p,h,g){f!==p?(f-p>180?p+=360:p-f>180&&(f+=360),g.push({i:h.push(o(h)+"rotate(",null,r)-2,x:Us(f,p)})):p&&h.push(o(h)+"rotate("+p+r)}function l(f,p,h,g){f!==p?g.push({i:h.push(o(h)+"skewX(",null,r)-2,x:Us(f,p)}):p&&h.push(o(h)+"skewX("+p+r)}function u(f,p,h,g,y,k){if(f!==h||p!==g){var v=y.push(o(y)+"scale(",null,",",null,")");k.push({i:v-4,x:Us(f,h)},{i:v-2,x:Us(p,g)})}else(h!==1||g!==1)&&y.push(o(y)+"scale("+h+","+g+")")}return function(f,p){var h=[],g=[];return f=e(f),p=e(p),i(f.translateX,f.translateY,p.translateX,p.translateY,h,g),a(f.rotate,p.rotate,h,g),l(f.skewX,p.skewX,h,g),u(f.scaleX,f.scaleY,p.scaleX,p.scaleY,h,g),f=p=null,function(y){for(var k=-1,v=g.length,b;++k<v;)h[(b=g[k]).i]=b.x(y);return h.join("")}}}var EZ=d3(NZ,"px, ","px)","deg)"),TZ=d3(CZ,", ",")",")"),RZ=1e-12;function dC(e){return((e=Math.exp(e))+1/e)/2}function AZ(e){return((e=Math.exp(e))-1/e)/2}function PZ(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gp=(function e(t,n,r){function o(i,a){var l=i[0],u=i[1],f=i[2],p=a[0],h=a[1],g=a[2],y=p-l,k=h-u,v=y*y+k*k,b,j;if(v<RZ)j=Math.log(g/f)/t,b=function(R){return[l+R*y,u+R*k,f*Math.exp(t*R*j)]};else{var N=Math.sqrt(v),S=(g*g-f*f+r*v)/(2*f*n*N),C=(g*g-f*f-r*v)/(2*g*n*N),D=Math.log(Math.sqrt(S*S+1)-S),T=Math.log(Math.sqrt(C*C+1)-C);j=(T-D)/t,b=function(R){var $=R*j,_=dC(D),U=f/(n*N)*(_*PZ(t*$+D)-AZ(D));return[l+U*y,u+U*k,f*_/dC(t*$+D)]}}return b.duration=j*1e3*t/Math.SQRT2,b}return o.rho=function(i){var a=Math.max(.001,+i),l=a*a,u=l*l;return e(a,l,u)},o})(Math.SQRT2,2,4);var nc=0,Eu=0,Nu=0,f3=1e3,$h,Tu,Ih=0,wa=0,Gm=0,md=typeof performance=="object"&&performance.now?performance:Date,p3=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function b0(){return wa||(p3(_Z),wa=md.now()+Gm)}function _Z(){wa=0}function Mh(){this._call=this._time=this._next=null}Mh.prototype=h3.prototype={constructor:Mh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?b0():+n)+(t==null?0:+t),!this._next&&Tu!==this&&(Tu?Tu._next=this:$h=this,Tu=this),this._call=e,this._time=n,hv()},stop:function(){this._call&&(this._call=null,this._time=1/0,hv())}};function h3(e,t,n){var r=new Mh;return r.restart(e,t,n),r}function DZ(){b0(),++nc;for(var e=$h,t;e;)(t=wa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nc}function fC(){wa=(Ih=md.now())+Gm,nc=Eu=0;try{DZ()}finally{nc=0,IZ(),wa=0}}function $Z(){var e=md.now(),t=e-Ih;t>f3&&(Gm-=t,Ih=e)}function IZ(){for(var e,t=$h,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$h=n);Tu=e,hv(r)}function hv(e){if(!nc){Eu&&(Eu=clearTimeout(Eu));var t=e-wa;t>24?(e<1/0&&(Eu=setTimeout(fC,e-md.now()-Gm)),Nu&&(Nu=clearInterval(Nu))):(Nu||(Ih=md.now(),Nu=setInterval($Z,f3)),nc=1,p3(fC))}}function pC(e,t,n){var r=new Mh;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var MZ=Wm("start","end","cancel","interrupt"),LZ=[],m3=0,hC=1,mv=2,Yp=3,mC=4,gv=5,Xp=6;function Ym(e,t,n,r,o,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;OZ(e,n,{name:t,index:r,group:o,on:MZ,tween:LZ,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:m3})}function v0(e,t){var n=Ts(e,t);if(n.state>m3)throw new Error("too late; already scheduled");return n}function to(e,t){var n=Ts(e,t);if(n.state>Yp)throw new Error("too late; already running");return n}function Ts(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function OZ(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=h3(i,0,n.time);function i(f){n.state=hC,n.timer.restart(a,n.delay,n.time),n.delay<=f&&a(f-n.delay)}function a(f){var p,h,g,y;if(n.state!==hC)return u();for(p in r)if(y=r[p],y.name===n.name){if(y.state===Yp)return pC(a);y.state===mC?(y.state=Xp,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+p<t&&(y.state=Xp,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[p])}if(pC(function(){n.state===Yp&&(n.state=mC,n.timer.restart(l,n.delay,n.time),l(f))}),n.state=mv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mv){for(n.state=Yp,o=new Array(g=n.tween.length),p=0,h=-1;p<g;++p)(y=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(o[++h]=y);o.length=h+1}}function l(f){for(var p=f<n.duration?n.ease.call(null,f/n.duration):(n.timer.restart(u),n.state=gv,1),h=-1,g=o.length;++h<g;)o[h].call(e,p);n.state===gv&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Xp,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Qp(e,t){var n=e.__transition,r,o,i=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){i=!1;continue}o=r.state>mv&&r.state<gv,r.state=Xp,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function FZ(e){return this.each(function(){Qp(this,e)})}function zZ(e,t){var n,r;return function(){var o=to(this,e),i=o.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}o.tween=r}}function BZ(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=to(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},u=0,f=o.length;u<f;++u)if(o[u].name===t){o[u]=l;break}u===f&&o.push(l)}i.tween=o}}function UZ(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ts(this.node(),n).tween,o=0,i=r.length,a;o<i;++o)if((a=r[o]).name===e)return a.value;return null}return this.each((t==null?zZ:BZ)(n,e,t))}function w0(e,t,n){var r=e._id;return e.each(function(){var o=to(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Ts(o,r).value[t]}}function g3(e,t){var n;return(typeof t=="number"?Us:t instanceof va?Dh:(n=va(t))?(t=n,Dh):c3)(e,t)}function HZ(e){return function(){this.removeAttribute(e)}}function VZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function WZ(e,t,n){var r,o=n+"",i;return function(){var a=this.getAttribute(e);return a===o?null:a===r?i:i=t(r=a,n)}}function qZ(e,t,n){var r,o=n+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===o?null:a===r?i:i=t(r=a,n)}}function KZ(e,t,n){var r,o,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=l+"",a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l)))}}function GZ(e,t,n){var r,o,i;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=l+"",a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l)))}}function YZ(e,t){var n=qm(e),r=n==="transform"?TZ:g3;return this.attrTween(e,typeof t=="function"?(n.local?GZ:KZ)(n,r,w0(this,"attr."+e,t)):t==null?(n.local?VZ:HZ)(n):(n.local?qZ:WZ)(n,r,t))}function XZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function QZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function JZ(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&QZ(e,i)),n}return o._value=t,o}function ZZ(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&XZ(e,i)),n}return o._value=t,o}function eee(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=qm(e);return this.tween(n,(r.local?JZ:ZZ)(r,t))}function tee(e,t){return function(){v0(this,e).delay=+t.apply(this,arguments)}}function nee(e,t){return t=+t,function(){v0(this,e).delay=t}}function ree(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tee:nee)(t,e)):Ts(this.node(),t).delay}function see(e,t){return function(){to(this,e).duration=+t.apply(this,arguments)}}function oee(e,t){return t=+t,function(){to(this,e).duration=t}}function iee(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?see:oee)(t,e)):Ts(this.node(),t).duration}function aee(e,t){if(typeof t!="function")throw new Error;return function(){to(this,e).ease=t}}function lee(e){var t=this._id;return arguments.length?this.each(aee(t,e)):Ts(this.node(),t).ease}function cee(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;to(this,e).ease=n}}function uee(e){if(typeof e!="function")throw new Error;return this.each(cee(this._id,e))}function dee(e){typeof e!="function"&&(e=q_(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],u,f=0;f<a;++f)(u=i[f])&&e.call(u,u.__data__,f,i)&&l.push(u);return new Ro(r,this._parents,this._name,this._id)}function fee(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),a=new Array(r),l=0;l<i;++l)for(var u=t[l],f=n[l],p=u.length,h=a[l]=new Array(p),g,y=0;y<p;++y)(g=u[y]||f[y])&&(h[y]=g);for(;l<r;++l)a[l]=t[l];return new Ro(a,this._parents,this._name,this._id)}function pee(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function hee(e,t,n){var r,o,i=pee(t)?v0:to;return function(){var a=i(this,e),l=a.on;l!==r&&(o=(r=l).copy()).on(t,n),a.on=o}}function mee(e,t){var n=this._id;return arguments.length<2?Ts(this.node(),n).on.on(e):this.each(hee(n,e,t))}function gee(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xee(){return this.on("end.remove",gee(this._id))}function yee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=g0(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var l=r[a],u=l.length,f=i[a]=new Array(u),p,h,g=0;g<u;++g)(p=l[g])&&(h=e.call(p,p.__data__,g,l))&&("__data__"in p&&(h.__data__=p.__data__),f[g]=h,Ym(f[g],t,n,g,f,Ts(p,n)));return new Ro(i,this._parents,t,n)}function bee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=W_(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var u=r[l],f=u.length,p,h=0;h<f;++h)if(p=u[h]){for(var g=e.call(p,p.__data__,h,u),y,k=Ts(p,n),v=0,b=g.length;v<b;++v)(y=g[v])&&Ym(y,t,n,v,g,k);i.push(g),a.push(p)}return new Ro(i,a,t,n)}var vee=qd.prototype.constructor;function wee(){return new vee(this._groups,this._parents)}function jee(e,t){var n,r,o;return function(){var i=tc(this,e),a=(this.style.removeProperty(e),tc(this,e));return i===a?null:i===n&&a===r?o:o=t(n=i,r=a)}}function x3(e){return function(){this.style.removeProperty(e)}}function kee(e,t,n){var r,o=n+"",i;return function(){var a=tc(this,e);return a===o?null:a===r?i:i=t(r=a,n)}}function See(e,t,n){var r,o,i;return function(){var a=tc(this,e),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(e),tc(this,e))),a===u?null:a===r&&u===o?i:(o=u,i=t(r=a,l))}}function Nee(e,t){var n,r,o,i="style."+t,a="end."+i,l;return function(){var u=to(this,e),f=u.on,p=u.value[i]==null?l||(l=x3(t)):void 0;(f!==n||o!==p)&&(r=(n=f).copy()).on(a,o=p),u.on=r}}function Cee(e,t,n){var r=(e+="")=="transform"?EZ:g3;return t==null?this.styleTween(e,jee(e,r)).on("end.style."+e,x3(e)):typeof t=="function"?this.styleTween(e,See(e,r,w0(this,"style."+e,t))).each(Nee(this._id,e)):this.styleTween(e,kee(e,r,t),n).on("end.style."+e,null)}function Eee(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Tee(e,t,n){var r,o;function i(){var a=t.apply(this,arguments);return a!==o&&(r=(o=a)&&Eee(e,a,n)),r}return i._value=t,i}function Ree(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Tee(e,t,n??""))}function Aee(e){return function(){this.textContent=e}}function Pee(e){return function(){var t=e(this);this.textContent=t??""}}function _ee(e){return this.tween("text",typeof e=="function"?Pee(w0(this,"text",e)):Aee(e==null?"":e+""))}function Dee(e){return function(t){this.textContent=e.call(this,t)}}function $ee(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Dee(o)),t}return r._value=e,r}function Iee(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,$ee(e))}function Mee(){for(var e=this._name,t=this._id,n=y3(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,u,f=0;f<l;++f)if(u=a[f]){var p=Ts(u,t);Ym(u,e,n,f,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ro(r,this._parents,e,n)}function Lee(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},u={value:function(){--o===0&&i()}};n.each(function(){var f=to(this,r),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),f.on=t}),o===0&&i()})}var Oee=0;function Ro(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function y3(){return++Oee}var yo=qd.prototype;Ro.prototype={constructor:Ro,select:yee,selectAll:bee,selectChild:yo.selectChild,selectChildren:yo.selectChildren,filter:dee,merge:fee,selection:wee,transition:Mee,call:yo.call,nodes:yo.nodes,node:yo.node,size:yo.size,empty:yo.empty,each:yo.each,on:mee,attr:YZ,attrTween:eee,style:Cee,styleTween:Ree,text:_ee,textTween:Iee,remove:xee,tween:UZ,delay:ree,duration:iee,ease:lee,easeVarying:uee,end:Lee,[Symbol.iterator]:yo[Symbol.iterator]};function Fee(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var zee={time:null,delay:0,duration:250,ease:Fee};function Bee(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Uee(e){var t,n;e instanceof Ro?(t=e._id,e=e._name):(t=y3(),(n=zee).time=b0(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,u,f=0;f<l;++f)(u=a[f])&&Ym(u,e,t,f,a,n||Bee(u,t));return new Ro(r,this._parents,e,t)}qd.prototype.interrupt=FZ;qd.prototype.transition=Uee;const jp=e=>()=>e;function Hee(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function So(e,t,n){this.k=e,this.x=t,this.y=n}So.prototype={constructor:So,scale:function(e){return e===1?this:new So(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new So(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xm=new So(1,0,0);b3.prototype=So.prototype;function b3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xm;return e.__zoom}function qy(e){e.stopImmediatePropagation()}function Cu(e){e.preventDefault(),e.stopImmediatePropagation()}function Vee(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Wee(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function gC(){return this.__zoom||Xm}function qee(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Kee(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gee(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function v3(){var e=Vee,t=Wee,n=Gee,r=qee,o=Kee,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Gp,f=Wm("start","zoom","end"),p,h,g,y=500,k=150,v=0,b=10;function j(P){P.property("__zoom",gC).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",U).filter(o).on("touchstart.zoom",I).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}j.transform=function(P,L,B,q){var z=P.selection?P.selection():P;z.property("__zoom",gC),P!==z?D(P,L,B,q):z.interrupt().each(function(){T(this,arguments).event(q).start().zoom(null,typeof L=="function"?L.apply(this,arguments):L).end()})},j.scaleBy=function(P,L,B,q){j.scaleTo(P,function(){var z=this.__zoom.k,W=typeof L=="function"?L.apply(this,arguments):L;return z*W},B,q)},j.scaleTo=function(P,L,B,q){j.transform(P,function(){var z=t.apply(this,arguments),W=this.__zoom,M=B==null?C(z):typeof B=="function"?B.apply(this,arguments):B,F=W.invert(M),G=typeof L=="function"?L.apply(this,arguments):L;return n(S(N(W,G),M,F),z,a)},B,q)},j.translateBy=function(P,L,B,q){j.transform(P,function(){return n(this.__zoom.translate(typeof L=="function"?L.apply(this,arguments):L,typeof B=="function"?B.apply(this,arguments):B),t.apply(this,arguments),a)},null,q)},j.translateTo=function(P,L,B,q,z){j.transform(P,function(){var W=t.apply(this,arguments),M=this.__zoom,F=q==null?C(W):typeof q=="function"?q.apply(this,arguments):q;return n(Xm.translate(F[0],F[1]).scale(M.k).translate(typeof L=="function"?-L.apply(this,arguments):-L,typeof B=="function"?-B.apply(this,arguments):-B),W,a)},q,z)};function N(P,L){return L=Math.max(i[0],Math.min(i[1],L)),L===P.k?P:new So(L,P.x,P.y)}function S(P,L,B){var q=L[0]-B[0]*P.k,z=L[1]-B[1]*P.k;return q===P.x&&z===P.y?P:new So(P.k,q,z)}function C(P){return[(+P[0][0]+ +P[1][0])/2,(+P[0][1]+ +P[1][1])/2]}function D(P,L,B,q){P.on("start.zoom",function(){T(this,arguments).event(q).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(q).end()}).tween("zoom",function(){var z=this,W=arguments,M=T(z,W).event(q),F=t.apply(z,W),G=B==null?C(F):typeof B=="function"?B.apply(z,W):B,H=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),Q=z.__zoom,te=typeof L=="function"?L.apply(z,W):L,Z=u(Q.invert(G).concat(H/Q.k),te.invert(G).concat(H/te.k));return function(ae){if(ae===1)ae=te;else{var ne=Z(ae),de=H/ne[2];ae=new So(de,G[0]-ne[0]*de,G[1]-ne[1]*de)}M.zoom(null,ae)}})}function T(P,L,B){return!B&&P.__zooming||new R(P,L)}function R(P,L){this.that=P,this.args=L,this.active=0,this.sourceEvent=null,this.extent=t.apply(P,L),this.taps=0}R.prototype={event:function(P){return P&&(this.sourceEvent=P),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(P,L){return this.mouse&&P!=="mouse"&&(this.mouse[1]=L.invert(this.mouse[0])),this.touch0&&P!=="touch"&&(this.touch0[1]=L.invert(this.touch0[0])),this.touch1&&P!=="touch"&&(this.touch1[1]=L.invert(this.touch1[0])),this.that.__zoom=L,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(P){var L=Lr(this.that).datum();f.call(P,this.that,new Hee(P,{sourceEvent:this.sourceEvent,target:j,transform:this.that.__zoom,dispatch:f}),L)}};function $(P,...L){if(!e.apply(this,arguments))return;var B=T(this,L).event(P),q=this.__zoom,z=Math.max(i[0],Math.min(i[1],q.k*Math.pow(2,r.apply(this,arguments)))),W=fs(P);if(B.wheel)(B.mouse[0][0]!==W[0]||B.mouse[0][1]!==W[1])&&(B.mouse[1]=q.invert(B.mouse[0]=W)),clearTimeout(B.wheel);else{if(q.k===z)return;B.mouse=[W,q.invert(W)],Qp(this),B.start()}Cu(P),B.wheel=setTimeout(M,k),B.zoom("mouse",n(S(N(q,z),B.mouse[0],B.mouse[1]),B.extent,a));function M(){B.wheel=null,B.end()}}function _(P,...L){if(g||!e.apply(this,arguments))return;var B=P.currentTarget,q=T(this,L,!0).event(P),z=Lr(P.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",H,!0),W=fs(P,B),M=P.clientX,F=P.clientY;n3(P.view),qy(P),q.mouse=[W,this.__zoom.invert(W)],Qp(this),q.start();function G(Q){if(Cu(Q),!q.moved){var te=Q.clientX-M,Z=Q.clientY-F;q.moved=te*te+Z*Z>v}q.event(Q).zoom("mouse",n(S(q.that.__zoom,q.mouse[0]=fs(Q,B),q.mouse[1]),q.extent,a))}function H(Q){z.on("mousemove.zoom mouseup.zoom",null),r3(Q.view,q.moved),Cu(Q),q.event(Q).end()}}function U(P,...L){if(e.apply(this,arguments)){var B=this.__zoom,q=fs(P.changedTouches?P.changedTouches[0]:P,this),z=B.invert(q),W=B.k*(P.shiftKey?.5:2),M=n(S(N(B,W),q,z),t.apply(this,L),a);Cu(P),l>0?Lr(this).transition().duration(l).call(D,M,q,P):Lr(this).call(j.transform,M,q,P)}}function I(P,...L){if(e.apply(this,arguments)){var B=P.touches,q=B.length,z=T(this,L,P.changedTouches.length===q).event(P),W,M,F,G;for(qy(P),M=0;M<q;++M)F=B[M],G=fs(F,this),G=[G,this.__zoom.invert(G),F.identifier],z.touch0?!z.touch1&&z.touch0[2]!==G[2]&&(z.touch1=G,z.taps=0):(z.touch0=G,W=!0,z.taps=1+!!p);p&&(p=clearTimeout(p)),W&&(z.taps<2&&(h=G[0],p=setTimeout(function(){p=null},y)),Qp(this),z.start())}}function V(P,...L){if(this.__zooming){var B=T(this,L).event(P),q=P.changedTouches,z=q.length,W,M,F,G;for(Cu(P),W=0;W<z;++W)M=q[W],F=fs(M,this),B.touch0&&B.touch0[2]===M.identifier?B.touch0[0]=F:B.touch1&&B.touch1[2]===M.identifier&&(B.touch1[0]=F);if(M=B.that.__zoom,B.touch1){var H=B.touch0[0],Q=B.touch0[1],te=B.touch1[0],Z=B.touch1[1],ae=(ae=te[0]-H[0])*ae+(ae=te[1]-H[1])*ae,ne=(ne=Z[0]-Q[0])*ne+(ne=Z[1]-Q[1])*ne;M=N(M,Math.sqrt(ae/ne)),F=[(H[0]+te[0])/2,(H[1]+te[1])/2],G=[(Q[0]+Z[0])/2,(Q[1]+Z[1])/2]}else if(B.touch0)F=B.touch0[0],G=B.touch0[1];else return;B.zoom("touch",n(S(M,F,G),B.extent,a))}}function O(P,...L){if(this.__zooming){var B=T(this,L).event(P),q=P.changedTouches,z=q.length,W,M;for(qy(P),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),W=0;W<z;++W)M=q[W],B.touch0&&B.touch0[2]===M.identifier?delete B.touch0:B.touch1&&B.touch1[2]===M.identifier&&delete B.touch1;if(B.touch1&&!B.touch0&&(B.touch0=B.touch1,delete B.touch1),B.touch0)B.touch0[1]=this.__zoom.invert(B.touch0[0]);else if(B.end(),B.taps===2&&(M=fs(M,this),Math.hypot(h[0]-M[0],h[1]-M[1])<b)){var F=Lr(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return j.wheelDelta=function(P){return arguments.length?(r=typeof P=="function"?P:jp(+P),j):r},j.filter=function(P){return arguments.length?(e=typeof P=="function"?P:jp(!!P),j):e},j.touchable=function(P){return arguments.length?(o=typeof P=="function"?P:jp(!!P),j):o},j.extent=function(P){return arguments.length?(t=typeof P=="function"?P:jp([[+P[0][0],+P[0][1]],[+P[1][0],+P[1][1]]]),j):t},j.scaleExtent=function(P){return arguments.length?(i[0]=+P[0],i[1]=+P[1],j):[i[0],i[1]]},j.translateExtent=function(P){return arguments.length?(a[0][0]=+P[0][0],a[1][0]=+P[1][0],a[0][1]=+P[0][1],a[1][1]=+P[1][1],j):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},j.constrain=function(P){return arguments.length?(n=P,j):n},j.duration=function(P){return arguments.length?(l=+P,j):l},j.interpolate=function(P){return arguments.length?(u=P,j):u},j.on=function(){var P=f.on.apply(f,arguments);return P===f?j:P},j.clickDistance=function(P){return arguments.length?(v=(P=+P)*P,j):Math.sqrt(v)},j.tapDistance=function(P){return arguments.length?(b=+P,j):b},j}const ks={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],w3=["Enter"," ","Escape"],j3={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var rc;(function(e){e.Strict="strict",e.Loose="loose"})(rc||(rc={}));var ga;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ga||(ga={}));var xd;(function(e){e.Partial="partial",e.Full="full"})(xd||(xd={}));const k3={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var gi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(gi||(gi={}));var yd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(yd||(yd={}));var lt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(lt||(lt={}));const xC={[lt.Left]:lt.Right,[lt.Right]:lt.Left,[lt.Top]:lt.Bottom,[lt.Bottom]:lt.Top};function S3(e){return e===null?null:e?"valid":"invalid"}const N3=e=>"id"in e&&"source"in e&&"target"in e,Yee=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),j0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Gd=(e,t=[0,0])=>{const{width:n,height:r}=_o(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},Xee=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let a=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(o):j0(o)?o:t.nodeLookup.get(o.id));const l=a?Lh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Qm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Jm(n)},Yd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Qm(n,Lh(o)),r=!0)}),r?Jm(n):{x:0,y:0,width:0,height:0}},k0=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{const l={...Ac(t,[n,r,o]),width:t.width/o,height:t.height/o},u=[];for(const f of e.values()){const{measured:p,selectable:h=!0,hidden:g=!1}=f;if(a&&!h||g)continue;const y=p.width??f.width??f.initialWidth??null,k=p.height??f.height??f.initialHeight??null,v=bd(l,oc(f)),b=(y??0)*(k??0),j=i&&v>0;(!f.internals.handleBounds||j||v>=b||f.dragging)&&u.push(f)}return u},Qee=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Jee(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Zee({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},a){if(e.size===0)return!0;const l=Jee(e,a),u=Yd(l),f=N0(u,t,n,(a==null?void 0:a.minZoom)??o,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(f,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function C3({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:u,y:f}=l?l.internals.positionAbsolute:{x:0,y:0},p=a.origin??r;let h=a.extent||o;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",ks.error005());else{const y=l.measured.width,k=l.measured.height;y&&k&&(h=[[u,f],[u+y,f+k]])}else l&&ka(a.extent)&&(h=[[a.extent[0][0]+u,a.extent[0][1]+f],[a.extent[1][0]+u,a.extent[1][1]+f]]);const g=ka(h)?ja(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",ks.error015())),{position:{x:g.x-u+(a.measured.width??0)*p[0],y:g.y-f+(a.measured.height??0)*p[1]},positionAbsolute:g}}async function ete({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(g=>g.id)),a=[];for(const g of n){if(g.deletable===!1)continue;const y=i.has(g.id),k=!y&&g.parentId&&a.find(v=>v.id===g.parentId);(y||k)&&a.push(g)}const l=new Set(t.map(g=>g.id)),u=r.filter(g=>g.deletable!==!1),p=Qee(a,u);for(const g of u)l.has(g.id)&&!p.find(k=>k.id===g.id)&&p.push(g);if(!o)return{edges:p,nodes:a};const h=await o({nodes:a,edges:p});return typeof h=="boolean"?h?{edges:p,nodes:a}:{edges:[],nodes:[]}:h}const sc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ja=(e={x:0,y:0},t,n)=>({x:sc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:sc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function E3(e,t,n){const{width:r,height:o}=_o(n),{x:i,y:a}=n.internals.positionAbsolute;return ja(e,[[i,a],[i+r,a+o]],t)}const yC=(e,t,n)=>e<t?sc(Math.abs(e-t),1,t)/t:e>n?-sc(Math.abs(e-n),1,t)/t:0,S0=(e,t,n=15,r=40)=>{const o=yC(e.x,r,t.width-r)*n,i=yC(e.y,r,t.height-r)*n;return[o,i]},Qm=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),xv=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Jm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),oc=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=j0(e)?e.internals.positionAbsolute:Gd(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Lh=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=j0(e)?e.internals.positionAbsolute:Gd(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},T3=(e,t)=>Jm(Qm(xv(e),xv(t))),bd=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},bC=e=>hs(e.width)&&hs(e.height)&&hs(e.x)&&hs(e.y),hs=e=>!isNaN(e)&&isFinite(e),R3=(e,t)=>(n,r)=>{},Xd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ac=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Xd(l,a):l},ic=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function kl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function tte(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=kl(e,n),o=kl(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=kl(e.top??e.y??0,n),o=kl(e.bottom??e.y??0,n),i=kl(e.left??e.x??0,t),a=kl(e.right??e.x??0,t);return{top:r,right:a,bottom:o,left:i,x:i+a,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function nte(e,t,n,r,o,i){const{x:a,y:l}=ic(e,[t,n,r]),{x:u,y:f}=ic({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-u,h=i-f;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(h)}}const N0=(e,t,n,r,o,i)=>{const a=tte(i,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,f=Math.min(l,u),p=sc(f,r,o),h=e.x+e.width/2,g=e.y+e.height/2,y=t/2-h*p,k=n/2-g*p,v=nte(e,y,k,p,t,n),b={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:y-b.left+b.right,y:k-b.top+b.bottom,zoom:p}},vd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ka(e){return e!=null&&e!=="parent"}function _o(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function A3(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function P3(e,t={width:0,height:0},n,r,o){const i={...e},a=r.get(n);if(a){const l=a.origin||o;i.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function vC(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rte(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ste(e){return{...j3,...e||{}}}function Yu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:a}=ms(e),l=Ac({x:i-((o==null?void 0:o.left)??0),y:a-((o==null?void 0:o.top)??0)},r),{x:u,y:f}=n?Xd(l,t):l;return{xSnapped:u,ySnapped:f,...l}}const C0=e=>({width:e.offsetWidth,height:e.offsetHeight}),_3=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},ote=["INPUT","SELECT","TEXTAREA"];function D3(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:ote.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const $3=e=>"clientX"in e,ms=(e,t)=>{var i,a;const n=$3(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},wC=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:o,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...C0(a)}})};function I3({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){const u=e*.125+o*.375+a*.375+n*.125,f=t*.125+i*.375+l*.375+r*.125,p=Math.abs(u-e),h=Math.abs(f-t);return[u,f,p,h]}function kp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function jC({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case lt.Left:return[t-kp(t-r,i),n];case lt.Right:return[t+kp(r-t,i),n];case lt.Top:return[t,n-kp(n-o,i)];case lt.Bottom:return[t,n+kp(o-n,i)]}}function M3({sourceX:e,sourceY:t,sourcePosition:n=lt.Bottom,targetX:r,targetY:o,targetPosition:i=lt.Top,curvature:a=.25}){const[l,u]=jC({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[f,p]=jC({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[h,g,y,k]=I3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${u} ${f},${p} ${r},${o}`,h,g,y,k]}function L3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,o,a]}function ite({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const a=o&&n?r+1e3:r,l=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return a+l}function ate({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=Qm(Lh(e),Lh(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return bd(a,Jm(i))>0}const lte=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cte=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),ute=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",ks.error006()),t;const r=n.getEdgeId||lte;let o;return N3(e)?o={...e}:o={...e,id:r(e)},cte(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function O3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,a,l]=L3({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}const kC={[lt.Left]:{x:-1,y:0},[lt.Right]:{x:1,y:0},[lt.Top]:{x:0,y:-1},[lt.Bottom]:{x:0,y:1}},dte=({source:e,sourcePosition:t=lt.Bottom,target:n})=>t===lt.Left||t===lt.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},SC=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fte({source:e,sourcePosition:t=lt.Bottom,target:n,targetPosition:r=lt.Top,center:o,offset:i,stepPosition:a}){const l=kC[t],u=kC[r],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+u.x*i,y:n.y+u.y*i},h=dte({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let k=[],v,b;const j={x:0,y:0},N={x:0,y:0},[,,S,C]=L3({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){g==="x"?(v=o.x??f.x+(p.x-f.x)*a,b=o.y??(f.y+p.y)/2):(v=o.x??(f.x+p.x)/2,b=o.y??f.y+(p.y-f.y)*a);const $=[{x:v,y:f.y},{x:v,y:p.y}],_=[{x:f.x,y:b},{x:p.x,y:b}];l[g]===y?k=g==="x"?$:_:k=g==="x"?_:$}else{const $=[{x:f.x,y:p.y}],_=[{x:p.x,y:f.y}];if(g==="x"?k=l.x===y?_:$:k=l.y===y?$:_,t===r){const P=Math.abs(e[g]-n[g]);if(P<=i){const L=Math.min(i-1,i-P);l[g]===y?j[g]=(f[g]>e[g]?-1:1)*L:N[g]=(p[g]>n[g]?-1:1)*L}}if(t!==r){const P=g==="x"?"y":"x",L=l[g]===u[P],B=f[P]>p[P],q=f[P]<p[P];(l[g]===1&&(!L&&B||L&&q)||l[g]!==1&&(!L&&q||L&&B))&&(k=g==="x"?$:_)}const U={x:f.x+j.x,y:f.y+j.y},I={x:p.x+N.x,y:p.y+N.y},V=Math.max(Math.abs(U.x-k[0].x),Math.abs(I.x-k[0].x)),O=Math.max(Math.abs(U.y-k[0].y),Math.abs(I.y-k[0].y));V>=O?(v=(U.x+I.x)/2,b=k[0].y):(v=k[0].x,b=(U.y+I.y)/2)}const D={x:f.x+j.x,y:f.y+j.y},T={x:p.x+N.x,y:p.y+N.y};return[[e,...D.x!==k[0].x||D.y!==k[0].y?[D]:[],...k,...T.x!==k[k.length-1].x||T.y!==k[k.length-1].y?[T]:[],n],v,b,S,C]}function pte(e,t,n,r){const o=Math.min(SC(e,t)/2,SC(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const f=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+o*f},${a}Q ${i},${a} ${i},${a+o*p}`}const l=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${i},${a+o*u}Q ${i},${a} ${i+o*l},${a}`}function yv({sourceX:e,sourceY:t,sourcePosition:n=lt.Bottom,targetX:r,targetY:o,targetPosition:i=lt.Top,borderRadius:a=5,centerX:l,centerY:u,offset:f=20,stepPosition:p=.5}){const[h,g,y,k,v]=fte({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:u},offset:f,stepPosition:p});let b=`M${h[0].x} ${h[0].y}`;for(let j=1;j<h.length-1;j++)b+=pte(h[j-1],h[j],h[j+1],a);return b+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[b,g,y,k,v]}function NC(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hte(e){var h;const{sourceNode:t,targetNode:n}=e;if(!NC(t)||!NC(n))return null;const r=t.internals.handleBounds||CC(t.handles),o=n.internals.handleBounds||CC(n.handles),i=EC((r==null?void 0:r.source)??[],e.sourceHandle),a=EC(e.connectionMode===rc.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!a)return(h=e.onError)==null||h.call(e,"008",ks.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||lt.Bottom,u=(a==null?void 0:a.position)||lt.Top,f=Sa(t,i,l),p=Sa(n,a,u);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:u}}function CC(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Sa(e,t,n=lt.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??_o(e);if(r)return{x:o+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case lt.Top:return{x:o+a/2,y:i};case lt.Right:return{x:o+a,y:i+l/2};case lt.Bottom:return{x:o+a/2,y:i+l};case lt.Left:return{x:o,y:i+l/2}}}function EC(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function bv(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mte(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||o].forEach(u=>{if(u&&typeof u=="object"){const f=bv(u,t);i.has(f)||(a.push({id:f,color:u.color||n,...u}),i.add(f))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const F3=1e3,gte=10,E0={nodeOrigin:[0,0],nodeExtent:gd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xte={...E0,checkEquality:!0};function T0(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function yte(e,t,n){const r=T0(E0,n);for(const o of e.values())if(o.parentId)A0(o,e,t,r);else{const i=Gd(o,r.nodeOrigin),a=ka(o.extent)?o.extent:r.nodeExtent,l=ja(i,a,_o(o));o.internals.positionAbsolute=l}}function bte(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function R0(e){return e==="manual"}function vv(e,t,n,r={}){var p,h;const o=T0(xte,r),i={i:0},a=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!R0(o.zIndexMode)?F3:0;let u=e.length>0,f=!1;t.clear(),n.clear();for(const g of e){let y=a.get(g.id);if(o.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const k=Gd(g,o.nodeOrigin),v=ka(g.extent)?g.extent:o.nodeExtent,b=ja(k,v,_o(g));y={...o.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(h=g.measured)==null?void 0:h.height},internals:{positionAbsolute:b,handleBounds:bte(g,y),z:z3(g,l,o.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(u=!1),g.parentId&&A0(y,t,n,r,i),f||(f=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:f}}function vte(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function A0(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:u}=T0(E0,r),f=e.parentId,p=t.get(f);if(!p){console.warn(`Parent node ${f} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}vte(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*gte),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const h=i&&!R0(u)?F3:0,{x:g,y,z:k}=wte(e,p,a,l,h,u),{positionAbsolute:v}=e.internals,b=g!==v.x||y!==v.y;(b||k!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y}:v,z:k}})}function z3(e,t,n){const r=hs(e.zIndex)?e.zIndex:0;return R0(n)?r:r+(e.selected?t:0)}function wte(e,t,n,r,o,i){const{x:a,y:l}=t.internals.positionAbsolute,u=_o(e),f=Gd(e,n),p=ka(e.extent)?ja(f,e.extent,u):f;let h=ja({x:a+p.x,y:l+p.y},r,u);e.extent==="parent"&&(h=E3(h,u,t));const g=z3(e,o,i),y=t.internals.z??0;return{x:h.x,y:h.y,z:y>=g?y+1:g}}function P0(e,t,n,r=[0,0]){var a;const o=[],i=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const f=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??oc(u),p=T3(f,l.rect);i.set(l.parentId,{expandedRect:p,parent:u})}return i.size>0&&i.forEach(({expandedRect:l,parent:u},f)=>{var S;const p=u.internals.positionAbsolute,h=_o(u),g=u.origin??r,y=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,k=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,v=Math.max(h.width,Math.round(l.width)),b=Math.max(h.height,Math.round(l.height)),j=(v-h.width)*g[0],N=(b-h.height)*g[1];(y>0||k>0||j||N)&&(o.push({id:f,type:"position",position:{x:u.position.x-y+j,y:u.position.y-k+N}}),(S=n.get(f))==null||S.forEach(C=>{e.some(D=>D.id===C.id)||o.push({id:C.id,type:"position",position:{x:C.position.x+y,y:C.position.y+k}})})),(h.width<l.width||h.height<l.height||y||k)&&o.push({id:f,type:"dimensions",setAttributes:!0,dimensions:{width:v+(y?g[0]*y-j:0),height:b+(k?g[1]*k-N:0)}})}),o}function jte(e,t,n,r,o,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let u=!1;if(!l)return{changes:[],updatedInternals:u};const f=[],p=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(p.transform),g=[];for(const y of e.values()){const k=t.get(y.id);if(!k)continue;if(k.hidden){t.set(k.id,{...k,internals:{...k.internals,handleBounds:void 0}}),u=!0;continue}const v=C0(y.nodeElement),b=k.measured.width!==v.width||k.measured.height!==v.height;if(!!(v.width&&v.height&&(b||!k.internals.handleBounds||y.force))){const N=y.nodeElement.getBoundingClientRect(),S=ka(k.extent)?k.extent:i;let{positionAbsolute:C}=k.internals;k.parentId&&k.extent==="parent"?C=E3(C,v,t.get(k.parentId)):S&&(C=ja(C,S,v));const D={...k,measured:v,internals:{...k.internals,positionAbsolute:C,handleBounds:{source:wC("source",y.nodeElement,N,h,k.id),target:wC("target",y.nodeElement,N,h,k.id)}}};t.set(k.id,D),k.parentId&&A0(D,t,n,{nodeOrigin:o,zIndexMode:a}),u=!0,b&&(f.push({id:k.id,type:"dimensions",dimensions:v}),k.expandParent&&k.parentId&&g.push({id:k.id,parentId:k.parentId,rect:oc(D,o)}))}}if(g.length>0){const y=P0(g,t,n,o);f.push(...y)}return{changes:f,updatedInternals:u}}async function kte({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function TC(e,t,n,r,o,i){let a=o;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${o}-${e}`;const u=r.get(a)||new Map;if(r.set(a,u.set(n,t)),i){a=`${o}-${e}-${i}`;const f=r.get(a)||new Map;r.set(a,f.set(n,t))}}function B3(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:a=null,targetHandle:l=null}=r,u={edgeId:r.id,source:o,target:i,sourceHandle:a,targetHandle:l},f=`${o}-${a}--${i}-${l}`,p=`${i}-${l}--${o}-${a}`;TC("source",u,p,e,o,a),TC("target",u,f,e,i,l),t.set(r.id,r)}}function U3(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:U3(n,t):!1}function RC(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Ste(e,t,n,r){const o=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!U3(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(i);l&&o.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return o}function Ky({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,u;const o=[];for(const[f,p]of t){const h=(a=n.get(f))==null?void 0:a.internals.userNode;h&&o.push({...h,position:p.position,dragging:r})}if(!e)return[o[0],o];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((u=t.get(e))==null?void 0:u.position)||i.position,dragging:r}:o[0],o]}function Nte({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},a=Xd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function Cte({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,u=!1,f={x:0,y:0},p=null,h=!1,g=null,y=!1,k=!1,v=null;function b({noDragClassName:N,handleSelector:S,domNode:C,isSelectable:D,nodeId:T,nodeClickDistance:R=0}){g=Lr(C);function $({x:V,y:O}){const{nodeLookup:P,nodeExtent:L,snapGrid:B,snapToGrid:q,nodeOrigin:z,onNodeDrag:W,onSelectionDrag:M,onError:F,updateNodePositions:G}=t();i={x:V,y:O};let H=!1;const Q=l.size>1,te=Q&&L?xv(Yd(l)):null,Z=Q&&q?Nte({dragItems:l,snapGrid:B,x:V,y:O}):null;for(const[ae,ne]of l){if(!P.has(ae))continue;let de={x:V-ne.distance.x,y:O-ne.distance.y};q&&(de=Z?{x:Math.round(de.x+Z.x),y:Math.round(de.y+Z.y)}:Xd(de,B));let ye=null;if(Q&&L&&!ne.extent&&te){const{positionAbsolute:ke}=ne.internals,Fe=ke.x-te.x+L[0][0],oe=ke.x+ne.measured.width-te.x2+L[1][0],we=ke.y-te.y+L[0][1],je=ke.y+ne.measured.height-te.y2+L[1][1];ye=[[Fe,we],[oe,je]]}const{position:Se,positionAbsolute:Te}=C3({nodeId:ae,nextPosition:de,nodeLookup:P,nodeExtent:ye||L,nodeOrigin:z,onError:F});H=H||ne.position.x!==Se.x||ne.position.y!==Se.y,ne.position=Se,ne.internals.positionAbsolute=Te}if(k=k||H,!!H&&(G(l,!0),v&&(r||W||!T&&M))){const[ae,ne]=Ky({nodeId:T,dragItems:l,nodeLookup:P});r==null||r(v,l,ae,ne),W==null||W(v,ae,ne),T||M==null||M(v,ne)}}async function _(){if(!p)return;const{transform:V,panBy:O,autoPanSpeed:P,autoPanOnNodeDrag:L}=t();if(!L){u=!1,cancelAnimationFrame(a);return}const[B,q]=S0(f,p,P);(B!==0||q!==0)&&(i.x=(i.x??0)-B/V[2],i.y=(i.y??0)-q/V[2],await O({x:B,y:q})&&$(i)),a=requestAnimationFrame(_)}function U(V){var Q;const{nodeLookup:O,multiSelectionActive:P,nodesDraggable:L,transform:B,snapGrid:q,snapToGrid:z,selectNodesOnDrag:W,onNodeDragStart:M,onSelectionDragStart:F,unselectNodesAndEdges:G}=t();h=!0,(!W||!D)&&!P&&T&&((Q=O.get(T))!=null&&Q.selected||G()),D&&W&&T&&(e==null||e(T));const H=Yu(V.sourceEvent,{transform:B,snapGrid:q,snapToGrid:z,containerBounds:p});if(i=H,l=Ste(O,L,H,T),l.size>0&&(n||M||!T&&F)){const[te,Z]=Ky({nodeId:T,dragItems:l,nodeLookup:O});n==null||n(V.sourceEvent,l,te,Z),M==null||M(V.sourceEvent,te,Z),T||F==null||F(V.sourceEvent,Z)}}const I=s3().clickDistance(R).on("start",V=>{const{domNode:O,nodeDragThreshold:P,transform:L,snapGrid:B,snapToGrid:q}=t();p=(O==null?void 0:O.getBoundingClientRect())||null,y=!1,k=!1,v=V.sourceEvent,P===0&&U(V),i=Yu(V.sourceEvent,{transform:L,snapGrid:B,snapToGrid:q,containerBounds:p}),f=ms(V.sourceEvent,p)}).on("drag",V=>{const{autoPanOnNodeDrag:O,transform:P,snapGrid:L,snapToGrid:B,nodeDragThreshold:q,nodeLookup:z}=t(),W=Yu(V.sourceEvent,{transform:P,snapGrid:L,snapToGrid:B,containerBounds:p});if(v=V.sourceEvent,(V.sourceEvent.type==="touchmove"&&V.sourceEvent.touches.length>1||T&&!z.has(T))&&(y=!0),!y){if(!u&&O&&h&&(u=!0,_()),!h){const M=ms(V.sourceEvent,p),F=M.x-f.x,G=M.y-f.y;Math.sqrt(F*F+G*G)>q&&U(V)}(i.x!==W.xSnapped||i.y!==W.ySnapped)&&l&&h&&(f=ms(V.sourceEvent,p),$(W))}}).on("end",V=>{if(!h||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,h=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:O,updateNodePositions:P,onNodeDragStop:L,onSelectionDragStop:B}=t();if(k&&(P(l,!1),k=!1),o||L||!T&&B){const[q,z]=Ky({nodeId:T,dragItems:l,nodeLookup:O,dragging:!1});o==null||o(V.sourceEvent,l,q,z),L==null||L(V.sourceEvent,q,z),T||B==null||B(V.sourceEvent,z)}}}).filter(V=>{const O=V.target;return!V.button&&(!N||!RC(O,`.${N}`,C))&&(!S||RC(O,S,C))});g.call(I)}function j(){g==null||g.on(".drag",null)}return{update:b,destroy:j}}function Ete(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())bd(o,oc(i))>0&&r.push(i);return r}const Tte=250;function Rte(e,t,n,r){var l,u;let o=[],i=1/0;const a=Ete(e,n,t+Tte);for(const f of a){const p=[...((l=f.internals.handleBounds)==null?void 0:l.source)??[],...((u=f.internals.handleBounds)==null?void 0:u.target)??[]];for(const h of p){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:g,y}=Sa(f,h,h.position,!0),k=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));k>t||(k<i?(o=[{...h,x:g,y}],i=k):k===i&&o.push({...h,x:g,y}))}}if(!o.length)return null;if(o.length>1){const f=r.type==="source"?"target":"source";return o.find(p=>p.type===f)??o[0]}return o[0]}function H3(e,t,n,r,o,i=!1){var f,p,h;const a=r.get(e);if(!a)return null;const l=o==="strict"?(f=a.internals.handleBounds)==null?void 0:f[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((h=a.internals.handleBounds)==null?void 0:h.target)??[]],u=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return u&&i?{...u,...Sa(a,u,u.position,!0)}:u}function V3(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ate(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const W3=()=>!0;function Pte(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:u,lib:f,autoPanOnConnect:p,flowId:h,panBy:g,cancelConnection:y,onConnectStart:k,onConnect:v,onConnectEnd:b,isValidConnection:j=W3,onReconnectEnd:N,updateConnection:S,getTransform:C,getFromHandle:D,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:$}){const _=_3(e.target);let U=0,I;const{x:V,y:O}=ms(e),P=V3(i,$),L=l==null?void 0:l.getBoundingClientRect();let B=!1;if(!L||!P)return;const q=H3(o,P,r,u,t);if(!q)return;let z=ms(e,L),W=!1,M=null,F=!1,G=null;function H(){if(!p||!L)return;const[Se,Te]=S0(z,L,T);g({x:Se,y:Te}),U=requestAnimationFrame(H)}const Q={...q,nodeId:o,type:P,position:q.position},te=u.get(o);let ae={inProgress:!0,isValid:null,from:Sa(te,Q,lt.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:te,to:z,toHandle:null,toPosition:xC[Q.position],toNode:null,pointer:z};function ne(){B=!0,S(ae),k==null||k(e,{nodeId:o,handleId:r,handleType:P})}R===0&&ne();function de(Se){if(!B){const{x:je,y:De}=ms(Se),Be=je-V,tt=De-O;if(!(Be*Be+tt*tt>R*R))return;ne()}if(!D()||!Q){ye(Se);return}const Te=C();z=ms(Se,L),I=Rte(Ac(z,Te,!1,[1,1]),n,u,Q),W||(H(),W=!0);const ke=q3(Se,{handle:I,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:j,doc:_,lib:f,flowId:h,nodeLookup:u});G=ke.handleDomNode,M=ke.connection,F=Ate(!!I,ke.isValid);const Fe=u.get(o),oe=Fe?Sa(Fe,Q,lt.Left,!0):ae.from,we={...ae,from:oe,isValid:F,to:ke.toHandle&&F?ic({x:ke.toHandle.x,y:ke.toHandle.y},Te):z,toHandle:ke.toHandle,toPosition:F&&ke.toHandle?ke.toHandle.position:xC[Q.position],toNode:ke.toHandle?u.get(ke.toHandle.nodeId):null,pointer:z};S(we),ae=we}function ye(Se){if(!("touches"in Se&&Se.touches.length>0)){if(B){(I||G)&&M&&F&&(v==null||v(M));const{inProgress:Te,...ke}=ae,Fe={...ke,toPosition:ae.toHandle?ae.toPosition:null};b==null||b(Se,Fe),i&&(N==null||N(Se,Fe))}y(),cancelAnimationFrame(U),W=!1,F=!1,M=null,G=null,_.removeEventListener("mousemove",de),_.removeEventListener("mouseup",ye),_.removeEventListener("touchmove",de),_.removeEventListener("touchend",ye)}}_.addEventListener("mousemove",de),_.addEventListener("mouseup",ye),_.addEventListener("touchmove",de),_.addEventListener("touchend",ye)}function q3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:l,flowId:u,isValidConnection:f=W3,nodeLookup:p}){const h=i==="target",g=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:k}=ms(e),v=a.elementFromPoint(y,k),b=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:g,j={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=V3(void 0,b),S=b.getAttribute("data-nodeid"),C=b.getAttribute("data-handleid"),D=b.classList.contains("connectable"),T=b.classList.contains("connectableend");if(!S||!N)return j;const R={source:h?S:r,sourceHandle:h?C:o,target:h?r:S,targetHandle:h?o:C};j.connection=R;const _=D&&T&&(n===rc.Strict?h&&N==="source"||!h&&N==="target":S!==r||C!==o);j.isValid=_&&f(R),j.toHandle=H3(S,N,C,p,n,!0)}return j}const wv={onPointerDown:Pte,isValid:q3};function _te({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Lr(e);function i({translateExtent:l,width:u,height:f,zoomStep:p=1,pannable:h=!0,zoomable:g=!0,inversePan:y=!1}){const k=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const C=n(),D=S.sourceEvent.ctrlKey&&vd()?10:1,T=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*p,R=C[2]*Math.pow(2,T*D);t.scaleTo(R)};let v=[0,0];const b=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(v=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},j=S=>{const C=n();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const D=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],T=[D[0]-v[0],D[1]-v[1]];v=D;const R=r()*Math.max(C[2],Math.log(C[2]))*(y?-1:1),$={x:C[0]-T[0]*R,y:C[1]-T[1]*R},_=[[0,0],[u,f]];t.setViewportConstrained({x:$.x,y:$.y,zoom:C[2]},_,l)},N=v3().on("start",b).on("zoom",h?j:null).on("zoom.wheel",g?k:null);o.call(N,{})}function a(){o.on("zoom",null)}return{update:i,destroy:a,pointer:fs}}const Zm=e=>({x:e.x,y:e.y,zoom:e.k}),Gy=({x:e,y:t,zoom:n})=>Xm.translate(e,t).scale(n),Al=(e,t)=>e.target.closest(`.${t}`),K3=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Dte=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Yy=(e,t=0,n=Dte,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},G3=e=>{const t=e.ctrlKey&&vd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $te({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:f}){return p=>{if(Al(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(p.ctrlKey&&a){const b=fs(p),j=G3(p),N=h*Math.pow(2,j);r.scaleTo(n,N,b,p);return}const g=p.deltaMode===1?20:1;let y=o===ga.Vertical?0:p.deltaX*g,k=o===ga.Horizontal?0:p.deltaY*g;!vd()&&p.shiftKey&&o!==ga.Vertical&&(y=p.deltaY*g,k=0),r.translateBy(n,-(y/h)*i,-(k/h)*i,{internal:!0});const v=Zm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,v),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,v))}}function Ite({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Al(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}function Mte({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Zm(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Lte({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&K3(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((l=i.sourceEvent)!=null&&l.internal)&&(o==null||o(i.sourceEvent,Zm(i.transform)))}}function Ote({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&K3(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const u=Zm(a.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(a.sourceEvent,u)},n?150:0)}}}function Fte({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:u,lib:f,connectionInProgress:p}){return h=>{var b;const g=e||t,y=n&&h.ctrlKey,k=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(Al(h,`${f}-flow__node`)||Al(h,`${f}-flow__edge`)))return!0;if(!r&&!g&&!o&&!i&&!n||a||p&&!k||Al(h,l)&&k||Al(h,u)&&(!k||o&&k&&!e)||!n&&h.ctrlKey&&k)return!1;if(!n&&h.type==="touchstart"&&((b=h.touches)==null?void 0:b.length)>1)return h.preventDefault(),!1;if(!g&&!o&&!y&&k||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||k)&&v}}function zte({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:u}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),h=v3().scaleExtent([t,n]).translateExtent(r),g=Lr(e).call(h);N({x:o.x,y:o.y,zoom:sc(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),k=g.on("dblclick.zoom");h.wheelDelta(G3);async function v(I,V){return g?new Promise(O=>{h==null||h.interpolate((V==null?void 0:V.interpolate)==="linear"?Gu:Gp).transform(Yy(g,V==null?void 0:V.duration,V==null?void 0:V.ease,()=>O(!0)),I)}):!1}function b({noWheelClassName:I,noPanClassName:V,onPaneContextMenu:O,userSelectionActive:P,panOnScroll:L,panOnDrag:B,panOnScrollMode:q,panOnScrollSpeed:z,preventScrolling:W,zoomOnPinch:M,zoomOnScroll:F,zoomOnDoubleClick:G,zoomActivationKeyPressed:H,lib:Q,onTransformChange:te,connectionInProgress:Z,paneClickDistance:ae,selectionOnDrag:ne}){P&&!f.isZoomingOrPanning&&j();const de=L&&!H&&!P;h.clickDistance(ne?1/0:!hs(ae)||ae<0?0:ae);const ye=de?$te({zoomPanValues:f,noWheelClassName:I,d3Selection:g,d3Zoom:h,panOnScrollMode:q,panOnScrollSpeed:z,zoomOnPinch:M,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):Ite({noWheelClassName:I,preventScrolling:W,d3ZoomHandler:y});g.on("wheel.zoom",ye,{passive:!1});const Se=Mte({zoomPanValues:f,onDraggingChange:u,onPanZoomStart:a});h.on("start",Se);const Te=Lte({zoomPanValues:f,panOnDrag:B,onPaneContextMenu:!!O,onPanZoom:i,onTransformChange:te});h.on("zoom",Te);const ke=Ote({zoomPanValues:f,panOnDrag:B,panOnScroll:L,onPaneContextMenu:O,onPanZoomEnd:l,onDraggingChange:u});h.on("end",ke);const Fe=Fte({zoomActivationKeyPressed:H,panOnDrag:B,zoomOnScroll:F,panOnScroll:L,zoomOnDoubleClick:G,zoomOnPinch:M,userSelectionActive:P,noPanClassName:V,noWheelClassName:I,lib:Q,connectionInProgress:Z});h.filter(Fe),G?g.on("dblclick.zoom",k):g.on("dblclick.zoom",null)}function j(){h.on("zoom",null)}async function N(I,V,O){const P=Gy(I),L=h==null?void 0:h.constrain()(P,V,O);return L&&await v(L),L}async function S(I,V){const O=Gy(I);return await v(O,V),O}function C(I){if(g){const V=Gy(I),O=g.property("__zoom");(O.k!==I.zoom||O.x!==I.x||O.y!==I.y)&&(h==null||h.transform(g,V,null,{sync:!0}))}}function D(){const I=g?b3(g.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}async function T(I,V){return g?new Promise(O=>{h==null||h.interpolate((V==null?void 0:V.interpolate)==="linear"?Gu:Gp).scaleTo(Yy(g,V==null?void 0:V.duration,V==null?void 0:V.ease,()=>O(!0)),I)}):!1}async function R(I,V){return g?new Promise(O=>{h==null||h.interpolate((V==null?void 0:V.interpolate)==="linear"?Gu:Gp).scaleBy(Yy(g,V==null?void 0:V.duration,V==null?void 0:V.ease,()=>O(!0)),I)}):!1}function $(I){h==null||h.scaleExtent(I)}function _(I){h==null||h.translateExtent(I)}function U(I){const V=!hs(I)||I<0?0:I;h==null||h.clickDistance(V)}return{update:b,destroy:j,setViewport:S,setViewportConstrained:N,getViewport:D,scaleTo:T,scaleBy:R,setScaleExtent:$,setTranslateExtent:_,syncViewport:C,setClickDistance:U}}var ac;(function(e){e.Line="line",e.Handle="handle"})(ac||(ac={}));function Bte({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const a=e-t,l=n-r,u=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(u[0]=u[0]*-1),l&&i&&(u[1]=u[1]*-1),u}function AC(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function fi(e,t){return Math.max(0,t-e)}function pi(e,t){return Math.max(0,e-t)}function Sp(e,t,n){return Math.max(0,t-e,e-n)}function PC(e,t){return e?!t:t}function Ute(e,t,n,r,o,i,a,l){let{affectsX:u,affectsY:f}=t;const{isHorizontal:p,isVertical:h}=t,g=p&&h,{xSnapped:y,ySnapped:k}=n,{minWidth:v,maxWidth:b,minHeight:j,maxHeight:N}=r,{x:S,y:C,width:D,height:T,aspectRatio:R}=e;let $=Math.floor(p?y-e.pointerX:0),_=Math.floor(h?k-e.pointerY:0);const U=D+(u?-$:$),I=T+(f?-_:_),V=-i[0]*D,O=-i[1]*T;let P=Sp(U,v,b),L=Sp(I,j,N);if(a){let z=0,W=0;u&&$<0?z=fi(S+$+V,a[0][0]):!u&&$>0&&(z=pi(S+U+V,a[1][0])),f&&_<0?W=fi(C+_+O,a[0][1]):!f&&_>0&&(W=pi(C+I+O,a[1][1])),P=Math.max(P,z),L=Math.max(L,W)}if(l){let z=0,W=0;u&&$>0?z=pi(S+$,l[0][0]):!u&&$<0&&(z=fi(S+U,l[1][0])),f&&_>0?W=pi(C+_,l[0][1]):!f&&_<0&&(W=fi(C+I,l[1][1])),P=Math.max(P,z),L=Math.max(L,W)}if(o){if(p){const z=Sp(U/R,j,N)*R;if(P=Math.max(P,z),a){let W=0;!u&&!f||u&&!f&&g?W=pi(C+O+U/R,a[1][1])*R:W=fi(C+O+(u?$:-$)/R,a[0][1])*R,P=Math.max(P,W)}if(l){let W=0;!u&&!f||u&&!f&&g?W=fi(C+U/R,l[1][1])*R:W=pi(C+(u?$:-$)/R,l[0][1])*R,P=Math.max(P,W)}}if(h){const z=Sp(I*R,v,b)/R;if(L=Math.max(L,z),a){let W=0;!u&&!f||f&&!u&&g?W=pi(S+I*R+V,a[1][0])/R:W=fi(S+(f?_:-_)*R+V,a[0][0])/R,L=Math.max(L,W)}if(l){let W=0;!u&&!f||f&&!u&&g?W=fi(S+I*R,l[1][0])/R:W=pi(S+(f?_:-_)*R,l[0][0])/R,L=Math.max(L,W)}}}_=_+(_<0?L:-L),$=$+($<0?P:-P),o&&(g?U>I*R?_=(PC(u,f)?-$:$)/R:$=(PC(u,f)?-_:_)*R:p?(_=$/R,f=u):($=_*R,u=f));const B=u?S+$:S,q=f?C+_:C;return{width:D+(u?-$:$),height:T+(f?-_:_),x:i[0]*$*(u?-1:1)+B,y:i[1]*_*(f?-1:1)+q}}const Y3={width:0,height:0,x:0,y:0},Hte={...Y3,pointerX:0,pointerY:0,aspectRatio:1};function Vte(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,u=n[1]*a;return[[r-l,o-u],[r+i-l,o+a-u]]}function Wte({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Lr(e);let a={controlDirection:AC("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:f,boundaries:p,keepAspectRatio:h,resizeDirection:g,onResizeStart:y,onResize:k,onResizeEnd:v,shouldResize:b}){let j={...Y3},N={...Hte};a={boundaries:p,resizeDirection:g,keepAspectRatio:h,controlDirection:AC(f)};let S,C=null,D=[],T,R,$,_=!1;const U=s3().on("start",I=>{const{nodeLookup:V,transform:O,snapGrid:P,snapToGrid:L,nodeOrigin:B,paneDomNode:q}=n();if(S=V.get(t),!S)return;C=(q==null?void 0:q.getBoundingClientRect())??null;const{xSnapped:z,ySnapped:W}=Yu(I.sourceEvent,{transform:O,snapGrid:P,snapToGrid:L,containerBounds:C});j={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},N={...j,pointerX:z,pointerY:W,aspectRatio:j.width/j.height},T=void 0,R=ka(S.extent)?S.extent:void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(T=V.get(S.parentId)),T&&S.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),D=[],$=void 0;for(const[M,F]of V)if(F.parentId===t&&(D.push({id:M,position:{...F.position},extent:F.extent}),F.extent==="parent"||F.expandParent)){const G=Vte(F,S,F.origin??B);$?$=[[Math.min(G[0][0],$[0][0]),Math.min(G[0][1],$[0][1])],[Math.max(G[1][0],$[1][0]),Math.max(G[1][1],$[1][1])]]:$=G}y==null||y(I,{...j})}).on("drag",I=>{const{transform:V,snapGrid:O,snapToGrid:P,nodeOrigin:L}=n(),B=Yu(I.sourceEvent,{transform:V,snapGrid:O,snapToGrid:P,containerBounds:C}),q=[];if(!S)return;const{x:z,y:W,width:M,height:F}=j,G={},H=S.origin??L,{width:Q,height:te,x:Z,y:ae}=Ute(N,a.controlDirection,B,a.boundaries,a.keepAspectRatio,H,R,$),ne=Q!==M,de=te!==F,ye=Z!==z&&ne,Se=ae!==W&&de;if(!ye&&!Se&&!ne&&!de)return;if((ye||Se||H[0]===1||H[1]===1)&&(G.x=ye?Z:j.x,G.y=Se?ae:j.y,j.x=G.x,j.y=G.y,D.length>0)){const oe=Z-z,we=ae-W;for(const je of D)je.position={x:je.position.x-oe+H[0]*(Q-M),y:je.position.y-we+H[1]*(te-F)},q.push(je)}if((ne||de)&&(G.width=ne&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Q:j.width,G.height=de&&(!a.resizeDirection||a.resizeDirection==="vertical")?te:j.height,j.width=G.width,j.height=G.height),T&&S.expandParent){const oe=H[0]*(G.width??0);G.x&&G.x<oe&&(j.x=oe,N.x=N.x-(G.x-oe));const we=H[1]*(G.height??0);G.y&&G.y<we&&(j.y=we,N.y=N.y-(G.y-we))}const Te=Bte({width:j.width,prevWidth:M,height:j.height,prevHeight:F,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ke={...j,direction:Te};(b==null?void 0:b(I,ke))!==!1&&(_=!0,k==null||k(I,ke),r(G,q))}).on("end",I=>{_&&(v==null||v(I,{...j}),o==null||o({...j}),_=!1)});i.call(U)}function u(){i.on(".drag",null)}return{update:l,destroy:u}}var Xy={exports:{}},Qy={},Jy={exports:{}},Zy={};/**
623
+ * @license React
624
+ * use-sync-external-store-shim.production.js
625
+ *
626
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
627
+ *
628
+ * This source code is licensed under the MIT license found in the
629
+ * LICENSE file in the root directory of this source tree.
630
+ */var _C;function qte(){if(_C)return Zy;_C=1;var e=Sd();function t(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function l(h,g){var y=g(),k=r({inst:{value:y,getSnapshot:g}}),v=k[0].inst,b=k[1];return i(function(){v.value=y,v.getSnapshot=g,u(v)&&b({inst:v})},[h,y,g]),o(function(){return u(v)&&b({inst:v}),h(function(){u(v)&&b({inst:v})})},[h]),a(y),y}function u(h){var g=h.getSnapshot;h=h.value;try{var y=g();return!n(h,y)}catch{return!0}}function f(h,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:l;return Zy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Zy}var DC;function Kte(){return DC||(DC=1,Jy.exports=qte()),Jy.exports}/**
631
+ * @license React
632
+ * use-sync-external-store-shim/with-selector.production.js
633
+ *
634
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
635
+ *
636
+ * This source code is licensed under the MIT license found in the
637
+ * LICENSE file in the root directory of this source tree.
638
+ */var $C;function Gte(){if($C)return Qy;$C=1;var e=Sd(),t=Kte();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,l=e.useMemo,u=e.useDebugValue;return Qy.useSyncExternalStoreWithSelector=function(f,p,h,g,y){var k=i(null);if(k.current===null){var v={hasValue:!1,value:null};k.current=v}else v=k.current;k=l(function(){function j(T){if(!N){if(N=!0,S=T,T=g(T),y!==void 0&&v.hasValue){var R=v.value;if(y(R,T))return C=R}return C=T}if(R=C,r(S,T))return R;var $=g(T);return y!==void 0&&y(R,$)?(S=T,R):(S=T,C=$)}var N=!1,S,C,D=h===void 0?null:h;return[function(){return j(p())},D===null?void 0:function(){return j(D())}]},[p,h,g,y]);var b=o(f,k[0],k[1]);return a(function(){v.hasValue=!0,v.value=b},[b]),u(b),b},Qy}var IC;function Yte(){return IC||(IC=1,Xy.exports=Gte()),Xy.exports}var Xte=Yte();const Qte=kd(Xte),Jte={},MC=e=>{let t;const n=new Set,r=(p,h)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const y=t;t=h??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(k=>k(t,y))}},o=()=>t,u={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Jte?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},f=t=e(r,o,u);return u},Zte=e=>e?MC(e):MC,{useDebugValue:ene}=$t,{useSyncExternalStoreWithSelector:tne}=Qte,nne=e=>e;function X3(e,t=nne,n){const r=tne(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ene(r),r}const LC=(e,t)=>{const n=Zte(e),r=(o,i=t)=>X3(n,o,i);return Object.assign(r,n),r},rne=(e,t)=>e?LC(e,t):LC;function sn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const eg=m.createContext(null),sne=eg.Provider,Q3=ks.error001("react");function At(e,t){const n=m.useContext(eg);if(n===null)throw new Error(Q3);return X3(n,e,t)}function on(){const e=m.useContext(eg);if(e===null)throw new Error(Q3);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const OC={display:"none"},one={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},J3="react-flow__node-desc",Z3="react-flow__edge-desc",ine="react-flow__aria-live",ane=e=>e.ariaLiveMessage,lne=e=>e.ariaLabelConfig;function cne({rfId:e}){const t=At(ane);return s.jsx("div",{id:`${ine}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:one,children:t})}function une({rfId:e,disableKeyboardA11y:t}){const n=At(lne);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${J3}-${e}`,style:OC,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${Z3}-${e}`,style:OC,children:n["edge.a11yDescription.default"]}),!t&&s.jsx(cne,{rfId:e})]})}const Qd=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const a=`${e}`.split("-");return s.jsx("div",{className:Sn(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});Qd.displayName="Panel";function dne({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:s.jsx(Qd,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:s.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const fne=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Np=e=>e.id;function pne(e,t){return sn(e.selectedNodes.map(Np),t.selectedNodes.map(Np))&&sn(e.selectedEdges.map(Np),t.selectedEdges.map(Np))}function hne({onSelectionChange:e}){const t=on(),{selectedNodes:n,selectedEdges:r}=At(fne,pne);return m.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const mne=e=>!!e.onSelectionChangeHandlers;function gne({onSelectionChange:e}){const t=At(mne);return e||t?s.jsx(hne,{onSelectionChange:e}):null}const eD=[0,0],xne={x:0,y:0,zoom:1},yne=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],FC=[...yne,"rfId"],bne=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),zC={translateExtent:gd,nodeOrigin:eD,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function vne(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:u}=At(bne,sn),f=on();m.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=zC,l()}),[]);const p=m.useRef(zC);return m.useEffect(()=>{for(const h of FC){const g=e[h],y=p.current[h];g!==y&&(typeof e[h]>"u"||(h==="nodes"?t(g):h==="edges"?n(g):h==="minZoom"?r(g):h==="maxZoom"?o(g):h==="translateExtent"?i(g):h==="nodeExtent"?a(g):h==="ariaLabelConfig"?f.setState({ariaLabelConfig:ste(g)}):h==="fitView"?f.setState({fitViewQueued:g}):h==="fitViewOptions"?f.setState({fitViewOptions:g}):f.setState({[h]:g})))}p.current=e},FC.map(h=>e[h])),null}function BC(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function wne(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const o=BC(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=BC())!=null&&r.matches?"dark":"light"}const UC=typeof document<"u"?document:null;function wd(e=null,t={target:UC,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),o=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const f=(Array.isArray(e)?e:[e]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
639
+ `).replace(`
640
+
641
+ `,`
642
+ +`).split(`
643
+ `)),p=f.reduce((h,g)=>h.concat(...g),[]);return[f,p]}return[[],[]]},[e]);return m.useEffect(()=>{const u=(t==null?void 0:t.target)??UC,f=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var b,j;if(o.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!o.current||o.current&&!f)&&D3(y))return!1;const v=VC(y.code,l);if(i.current.add(y[v]),HC(a,i.current,!1)){const N=((j=(b=y.composedPath)==null?void 0:b.call(y))==null?void 0:j[0])||y.target,S=(N==null?void 0:N.nodeName)==="BUTTON"||(N==null?void 0:N.nodeName)==="A";t.preventDefault!==!1&&(o.current||!S)&&y.preventDefault(),r(!0)}},h=y=>{const k=VC(y.code,l);HC(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(y[k]),y.key==="Meta"&&i.current.clear(),o.current=!1},g=()=>{i.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function HC(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function VC(e,t){return t.includes(e)?"code":"key"}const jne=()=>{const e=on();return m.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),u=N0(t,r,o,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:u}=a.getBoundingClientRect(),f={x:t.x-l,y:t.y-u},p=n.snapGrid??o,h=n.snapToGrid??i;return Ac(f,r,h,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),a=ic(t,n);return{x:a.x+o,y:a.y+i}}}),[])};function tD(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const u of a)kne(u,l);n.push(l)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function kne(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function nD(e,t){return tD(e,t)}function rD(e,t){return tD(e,t)}function na(e,t){return{id:e,type:"select",selected:t}}function Pl(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const a=t.has(o);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(na(i.id,a)))}return r}function WC({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),u=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function qC(e){return{id:e.id,type:"remove"}}const Sne=R3();function Nne(e,t,n={}){return ute(e,t,{...n,onError:n.onError??Sne})}const KC=e=>Yee(e),Cne=e=>N3(e);function sD(e){return m.forwardRef(e)}const Ene=typeof window<"u"?m.useLayoutEffect:m.useEffect;function GC(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>Tne(()=>n(o=>o+BigInt(1))));return Ene(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Tne(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oD=m.createContext(null);function Rne({children:e}){const t=on(),n=m.useCallback(l=>{const{nodes:u=[],setNodes:f,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:k}=t.getState();let v=u;for(const j of l)v=typeof j=="function"?j(v):j;let b=WC({items:v,lookup:g});for(const j of k.values())b=j(b);p&&f(v),b.length>0?h==null||h(b):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:j,nodes:N,setNodes:S}=t.getState();j&&S(N)})},[]),r=GC(n),o=m.useCallback(l=>{const{edges:u=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:h,edgeLookup:g}=t.getState();let y=u;for(const k of l)y=typeof k=="function"?k(y):k;p?f(y):h&&h(WC({items:y,lookup:g}))},[]),i=GC(o),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return s.jsx(oD.Provider,{value:a,children:e})}function Ane(){const e=m.useContext(oD);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Pne=e=>!!e.panZoom;function tg(){const e=jne(),t=on(),n=Ane(),r=At(Pne),o=m.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),a=h=>{n.nodeQueue.push(h)},l=h=>{n.edgeQueue.push(h)},u=h=>{var j,N;const{nodeLookup:g,nodeOrigin:y}=t.getState(),k=KC(h)?h:g.get(h.id),v=k.parentId?P3(k.position,k.measured,k.parentId,g,y):k.position,b={...k,position:v,width:((j=k.measured)==null?void 0:j.width)??k.width,height:((N=k.measured)==null?void 0:N.height)??k.height};return oc(b)},f=(h,g,y={replace:!1})=>{a(k=>k.map(v=>{if(v.id===h){const b=typeof g=="function"?g(v):g;return y.replace&&KC(b)?b:{...v,...b}}return v}))},p=(h,g,y={replace:!1})=>{l(k=>k.map(v=>{if(v.id===h){const b=typeof g=="function"?g(v):g;return y.replace&&Cne(b)?b:{...v,...b}}return v}))};return{getNodes:()=>t.getState().nodes.map(h=>({...h})),getNode:h=>{var g;return(g=i(h))==null?void 0:g.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:h=[]}=t.getState();return h.map(g=>({...g}))},getEdge:h=>t.getState().edgeLookup.get(h),setNodes:a,setEdges:l,addNodes:h=>{const g=Array.isArray(h)?h:[h];n.nodeQueue.push(y=>[...y,...g])},addEdges:h=>{const g=Array.isArray(h)?h:[h];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:h=[],edges:g=[],transform:y}=t.getState(),[k,v,b]=y;return{nodes:h.map(j=>({...j})),edges:g.map(j=>({...j})),viewport:{x:k,y:v,zoom:b}}},deleteElements:async({nodes:h=[],edges:g=[]})=>{const{nodes:y,edges:k,onNodesDelete:v,onEdgesDelete:b,triggerNodeChanges:j,triggerEdgeChanges:N,onDelete:S,onBeforeDelete:C}=t.getState(),{nodes:D,edges:T}=await ete({nodesToRemove:h,edgesToRemove:g,nodes:y,edges:k,onBeforeDelete:C}),R=T.length>0,$=D.length>0;if(R){const _=T.map(qC);b==null||b(T),N(_)}if($){const _=D.map(qC);v==null||v(D),j(_)}return($||R)&&(S==null||S({nodes:D,edges:T})),{deletedNodes:D,deletedEdges:T}},getIntersectingNodes:(h,g=!0,y)=>{const k=bC(h),v=k?h:u(h),b=y!==void 0;return v?(y||t.getState().nodes).filter(j=>{const N=t.getState().nodeLookup.get(j.id);if(N&&!k&&(j.id===h.id||!N.internals.positionAbsolute))return!1;const S=oc(b?j:N),C=bd(S,v);return g&&C>0||C>=S.width*S.height||C>=v.width*v.height}):[]},isNodeIntersecting:(h,g,y=!0)=>{const v=bC(h)?h:u(h);if(!v)return!1;const b=bd(v,g);return y&&b>0||b>=g.width*g.height||b>=v.width*v.height},updateNode:f,updateNodeData:(h,g,y={replace:!1})=>{f(h,k=>{const v=typeof g=="function"?g(k):g;return y.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},y)},updateEdge:p,updateEdgeData:(h,g,y={replace:!1})=>{p(h,k=>{const v=typeof g=="function"?g(k):g;return y.replace?{...k,data:v}:{...k,data:{...k.data,...v}}},y)},getNodesBounds:h=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return Xee(h,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:h,id:g,nodeId:y})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${y}-${h}${g?`-${g}`:""}`))==null?void 0:k.values())??[])},getNodeConnections:({type:h,handleId:g,nodeId:y})=>{var k;return Array.from(((k=t.getState().connectionLookup.get(`${y}${h?g?`-${h}-${g}`:`-${h}`:""}`))==null?void 0:k.values())??[])},fitView:async h=>{const g=t.getState().fitViewResolver??rte();return t.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return m.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const YC=e=>e.selected,_ne=typeof window<"u"?window:void 0;function Dne({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=on(),{deleteElements:r}=tg(),o=wd(e,{actInsideInputWithModifier:!1}),i=wd(t,{target:_ne});m.useEffect(()=>{if(o){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(YC),edges:a.filter(YC)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function $ne(e){const t=on();m.useEffect(()=>{const n=()=>{var o,i,a,l;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=C0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",ks.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const ng={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ine=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Mne({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=ga.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:f,minZoom:p,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:y=!0,children:k,noWheelClassName:v,noPanClassName:b,onViewportChange:j,isControlledViewport:N,paneClickDistance:S,selectionOnDrag:C}){const D=on(),T=m.useRef(null),{userSelectionActive:R,lib:$,connectionInProgress:_}=At(Ine,sn),U=wd(g),I=m.useRef();$ne(T);const V=m.useCallback(O=>{j==null||j({x:O[0],y:O[1],zoom:O[2]}),N||D.setState({transform:O})},[j,N]);return m.useEffect(()=>{if(T.current){I.current=zte({domNode:T.current,minZoom:p,maxZoom:h,translateExtent:f,viewport:u,onDraggingChange:B=>D.setState(q=>q.paneDragging===B?q:{paneDragging:B}),onPanZoomStart:(B,q)=>{const{onViewportChangeStart:z,onMoveStart:W}=D.getState();W==null||W(B,q),z==null||z(q)},onPanZoom:(B,q)=>{const{onViewportChange:z,onMove:W}=D.getState();W==null||W(B,q),z==null||z(q)},onPanZoomEnd:(B,q)=>{const{onViewportChangeEnd:z,onMoveEnd:W}=D.getState();W==null||W(B,q),z==null||z(q)}});const{x:O,y:P,zoom:L}=I.current.getViewport();return D.setState({panZoom:I.current,transform:[O,P,L],domNode:T.current.closest(".react-flow")}),()=>{var B;(B=I.current)==null||B.destroy()}}},[]),m.useEffect(()=>{var O;(O=I.current)==null||O.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:U,preventScrolling:y,noPanClassName:b,userSelectionActive:R,noWheelClassName:v,lib:$,onTransformChange:V,connectionInProgress:_,selectionOnDrag:C,paneClickDistance:S})},[e,t,n,r,o,i,a,l,U,y,b,R,v,$,V,_,C,S]),s.jsx("div",{className:"react-flow__renderer",ref:T,style:ng,children:k})}const Lne=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function One(){const{userSelectionActive:e,userSelectionRect:t}=At(Lne,sn);return e&&t?s.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const eb=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Fne=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function zne({isSelecting:e,selectionKeyPressed:t,selectionMode:n=xd.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:k,children:v}){const b=m.useRef(0),j=on(),{userSelectionActive:N,elementsSelectable:S,dragging:C,connectionInProgress:D,panBy:T,autoPanSpeed:R}=At(Fne,sn),$=S&&(e||N),_=m.useRef(null),U=m.useRef(),I=m.useRef(new Set),V=m.useRef(new Set),O=m.useRef(!1),P=m.useRef({x:0,y:0}),L=m.useRef(!1),B=ne=>{if(O.current||D){O.current=!1;return}f==null||f(ne),j.getState().resetSelectedElements(),j.setState({nodesSelectionActive:!1})},q=ne=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){ne.preventDefault();return}p==null||p(ne)},z=h?ne=>h(ne):void 0,W=ne=>{O.current&&(ne.stopPropagation(),O.current=!1)},M=ne=>{var je,De;const{domNode:de,transform:ye}=j.getState();if(U.current=de==null?void 0:de.getBoundingClientRect(),!U.current)return;const Se=ne.target===_.current;if(!Se&&!!ne.target.closest(".nokey")||!e||!(a&&Se||t)||ne.button!==0||!ne.isPrimary)return;(De=(je=ne.target)==null?void 0:je.setPointerCapture)==null||De.call(je,ne.pointerId),O.current=!1;const{x:Fe,y:oe}=ms(ne.nativeEvent,U.current),we=Ac({x:Fe,y:oe},ye);j.setState({userSelectionRect:{width:0,height:0,startX:we.x,startY:we.y,x:Fe,y:oe}}),Se||(ne.stopPropagation(),ne.preventDefault())};function F(ne,de){const{userSelectionRect:ye}=j.getState();if(!ye)return;const{transform:Se,nodeLookup:Te,edgeLookup:ke,connectionLookup:Fe,triggerNodeChanges:oe,triggerEdgeChanges:we,defaultEdgeOptions:je}=j.getState(),De={x:ye.startX,y:ye.startY},{x:Be,y:tt}=ic(De,Se),Ue={startX:De.x,startY:De.y,x:ne<Be?ne:Be,y:de<tt?de:tt,width:Math.abs(ne-Be),height:Math.abs(de-tt)},it=I.current,xt=V.current;I.current=new Set(k0(Te,Ue,Se,n===xd.Partial,!0).map(st=>st.id)),V.current=new Set;const at=(je==null?void 0:je.selectable)??!0;for(const st of I.current){const ce=Fe.get(st);if(ce)for(const{edgeId:xe}of ce.values()){const Le=ke.get(xe);Le&&(Le.selectable??at)&&V.current.add(xe)}}if(!vC(it,I.current)){const st=Pl(Te,I.current,!0);oe(st)}if(!vC(xt,V.current)){const st=Pl(ke,V.current);we(st)}j.setState({userSelectionRect:Ue,userSelectionActive:!0,nodesSelectionActive:!1})}function G(){if(!o||!U.current)return;const[ne,de]=S0(P.current,U.current,R);T({x:ne,y:de}).then(ye=>{if(!O.current||!ye){b.current=requestAnimationFrame(G);return}const{x:Se,y:Te}=P.current;F(Se,Te),b.current=requestAnimationFrame(G)})}const H=()=>{cancelAnimationFrame(b.current),b.current=0,L.current=!1};m.useEffect(()=>()=>H(),[]);const Q=ne=>{const{userSelectionRect:de,transform:ye,resetSelectedElements:Se}=j.getState();if(!U.current||!de)return;const{x:Te,y:ke}=ms(ne.nativeEvent,U.current);P.current={x:Te,y:ke};const Fe=ic({x:de.startX,y:de.startY},ye);if(!O.current){const oe=t?0:i;if(Math.hypot(Te-Fe.x,ke-Fe.y)<=oe)return;Se(),l==null||l(ne)}O.current=!0,L.current||(G(),L.current=!0),F(Te,ke)},te=ne=>{var de,ye;ne.button===0&&((ye=(de=ne.target)==null?void 0:de.releasePointerCapture)==null||ye.call(de,ne.pointerId),!N&&ne.target===_.current&&j.getState().userSelectionRect&&(B==null||B(ne)),j.setState({userSelectionActive:!1,userSelectionRect:null}),O.current&&(u==null||u(ne),j.setState({nodesSelectionActive:I.current.size>0})),H())},Z=ne=>{var de,ye;(ye=(de=ne.target)==null?void 0:de.releasePointerCapture)==null||ye.call(de,ne.pointerId),H()},ae=r===!0||Array.isArray(r)&&r.includes(0);return s.jsxs("div",{className:Sn(["react-flow__pane",{draggable:ae,dragging:C,selection:e}]),onClick:$?void 0:eb(B,_),onContextMenu:eb(q,_),onWheel:eb(z,_),onPointerEnter:$?void 0:g,onPointerMove:$?Q:y,onPointerUp:$?te:void 0,onPointerCancel:$?Z:void 0,onPointerDownCapture:$?M:void 0,onClickCapture:$?W:void 0,onPointerLeave:k,ref:_,style:ng,children:[v,s.jsx(One,{})]})}function jv({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:u}=t.getState(),f=l.get(e);if(!f){u==null||u("012",ks.error012(e));return}t.setState({nodesSelectionActive:!1}),f.selected?(n||f.selected&&a)&&(i({nodes:[f],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):o([e])}function iD({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){const l=on(),[u,f]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=Cte({getStoreItems:()=>l.getState(),onNodeMouseDown:h=>{jv({id:h,store:l,nodeRef:e})},onDragStart:()=>{f(!0)},onDragStop:()=>{f(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:a}),()=>{var h;(h=p.current)==null||h.destroy()}},[n,r,t,i,e,o,a]),u}const Bne=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function aD(){const e=on();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:u,nodeLookup:f,nodeOrigin:p}=e.getState(),h=new Map,g=Bne(a),y=o?i[0]:5,k=o?i[1]:5,v=n.direction.x*y*n.factor,b=n.direction.y*k*n.factor;for(const[,j]of f){if(!g(j))continue;let N={x:j.internals.positionAbsolute.x+v,y:j.internals.positionAbsolute.y+b};o&&(N=Xd(N,i));const{position:S,positionAbsolute:C}=C3({nodeId:j.id,nextPosition:N,nodeLookup:f,nodeExtent:r,nodeOrigin:p,onError:l});j.position=S,j.internals.positionAbsolute=C,h.set(j.id,j)}u(h)},[])}const _0=m.createContext(null),Une=_0.Provider;_0.Consumer;const lD=()=>m.useContext(_0),Hne=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Vne=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:u,isValid:f}=a,p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===rc.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!o,valid:p&&f}};function Wne({type:e="source",position:t=lt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:u,className:f,onMouseDown:p,onTouchStart:h,...g},y){var L,B;const k=a||null,v=e==="target",b=on(),j=lD(),{connectOnClick:N,noPanClassName:S,rfId:C}=At(Hne,sn),{connectingFrom:D,connectingTo:T,clickConnecting:R,isPossibleEndHandle:$,connectionInProcess:_,clickConnectionInProcess:U,valid:I}=At(Vne(j,k,e),sn);j||(B=(L=b.getState()).onError)==null||B.call(L,"010",ks.error010());const V=q=>{const{defaultEdgeOptions:z,onConnect:W,hasDefaultEdges:M}=b.getState(),F={...z,...q};if(M){const{edges:G,setEdges:H,onError:Q}=b.getState();H(Nne(F,G,{onError:Q}))}W==null||W(F),l==null||l(F)},O=q=>{if(!j)return;const z=$3(q.nativeEvent);if(o&&(z&&q.button===0||!z)){const W=b.getState();wv.onPointerDown(q.nativeEvent,{handleDomNode:q.currentTarget,autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:v,handleId:k,nodeId:j,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:(...M)=>{var F,G;return(G=(F=b.getState()).onConnectEnd)==null?void 0:G.call(F,...M)},updateConnection:W.updateConnection,onConnect:V,isValidConnection:n||((...M)=>{var F,G;return((G=(F=b.getState()).isValidConnection)==null?void 0:G.call(F,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}z?p==null||p(q):h==null||h(q)},P=q=>{const{onClickConnectStart:z,onClickConnectEnd:W,connectionClickStartHandle:M,connectionMode:F,isValidConnection:G,lib:H,rfId:Q,nodeLookup:te,connection:Z}=b.getState();if(!j||!M&&!o)return;if(!M){z==null||z(q.nativeEvent,{nodeId:j,handleId:k,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:j,type:e,id:k}});return}const ae=_3(q.target),ne=n||G,{connection:de,isValid:ye}=wv.isValid(q.nativeEvent,{handle:{nodeId:j,id:k,type:e},connectionMode:F,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:ne,flowId:Q,doc:ae,lib:H,nodeLookup:te});ye&&de&&V(de);const Se=structuredClone(Z);delete Se.inProgress,Se.toPosition=Se.toHandle?Se.toHandle.position:null,W==null||W(q,Se),b.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":k,"data-nodeid":j,"data-handlepos":t,"data-id":`${C}-${j}-${k}-${e}`,className:Sn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,f,{source:!v,target:v,connectable:r,connectablestart:o,connectableend:i,clickconnecting:R,connectingfrom:D,connectingto:T,valid:I,connectionindicator:r&&(!_||$)&&(_||U?i:o)}]),onMouseDown:O,onTouchStart:O,onClick:N?P:void 0,ref:y,...g,children:u})}const lc=m.memo(sD(Wne));function qne({data:e,isConnectable:t,sourcePosition:n=lt.Bottom}){return s.jsxs(s.Fragment,{children:[e==null?void 0:e.label,s.jsx(lc,{type:"source",position:n,isConnectable:t})]})}function Kne({data:e,isConnectable:t,targetPosition:n=lt.Top,sourcePosition:r=lt.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(lc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,s.jsx(lc,{type:"source",position:r,isConnectable:t})]})}function Gne(){return null}function Yne({data:e,isConnectable:t,targetPosition:n=lt.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(lc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Oh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},XC={input:qne,default:Kne,output:Yne,group:Gne};function Xne(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const Qne=e=>{const{width:t,height:n,x:r,y:o}=Yd(e.nodeLookup,{filter:i=>!!i.selected});return{width:hs(t)?t:null,height:hs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function Jne({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=on(),{width:o,height:i,transformString:a,userSelectionActive:l}=At(Qne,sn),u=aD(),f=m.useRef(null);m.useEffect(()=>{var y;n||(y=f.current)==null||y.focus({preventScroll:!0})},[n]);const p=!l&&o!==null&&i!==null;if(iD({nodeRef:f,disabled:!p}),!p)return null;const h=e?y=>{const k=r.getState().nodes.filter(v=>v.selected);e(y,k)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Oh,y.key)&&(y.preventDefault(),u({direction:Oh[y.key],factor:y.shiftKey?4:1}))};return s.jsx("div",{className:Sn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:s.jsx("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:o,height:i}})})}const QC=typeof window<"u"?window:void 0,Zne=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function cD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:k,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:S,panOnScroll:C,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:$,autoPanOnSelection:_,defaultViewport:U,translateExtent:I,minZoom:V,maxZoom:O,preventScrolling:P,onSelectionContextMenu:L,noWheelClassName:B,noPanClassName:q,disableKeyboardA11y:z,onViewportChange:W,isControlledViewport:M}){const{nodesSelectionActive:F,userSelectionActive:G}=At(Zne,sn),H=wd(f,{target:QC}),Q=wd(v,{target:QC}),te=Q||$,Z=Q||C,ae=p&&te!==!0,ne=H||G||ae;return Dne({deleteKeyCode:u,multiSelectionKeyCode:k}),s.jsx(Mne,{onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:S,panOnScroll:Z,panOnScrollSpeed:D,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!H&&te,defaultViewport:U,translateExtent:I,minZoom:V,maxZoom:O,zoomActivationKeyCode:b,preventScrolling:P,noWheelClassName:B,noPanClassName:q,onViewportChange:W,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:ae,children:s.jsxs(zne,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:te,autoPanOnSelection:_,isSelecting:!!ne,selectionMode:h,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:ae,children:[e,F&&s.jsx(Jne,{onSelectionContextMenu:L,noPanClassName:q,disableKeyboardA11y:z})]})})}cD.displayName="FlowRenderer";const ere=m.memo(cD),tre=e=>t=>e?k0(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function nre(e){return At(m.useCallback(tre(e),[e]),sn)}const rre=e=>e.updateNodeInternals;function sre(){const e=At(rre),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function ore({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=on(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),u=m.useRef(e.targetPosition),f=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const h=f.current!==t,g=l.current!==e.sourcePosition,y=u.current!==e.targetPosition;(h||g||y)&&(f.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function ire({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:p,resizeObserver:h,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:k,rfId:v,nodeTypes:b,nodeClickDistance:j,onError:N}){const{node:S,internals:C,isParent:D}=At(ne=>{const de=ne.nodeLookup.get(e),ye=ne.parentLookup.has(e);return{node:de,internals:de.internals,isParent:ye}},sn);let T=S.type||"default",R=(b==null?void 0:b[T])||XC[T];R===void 0&&(N==null||N("003",ks.error003(T)),T="default",R=(b==null?void 0:b.default)||XC.default);const $=!!(S.draggable||l&&typeof S.draggable>"u"),_=!!(S.selectable||u&&typeof S.selectable>"u"),U=!!(S.connectable||f&&typeof S.connectable>"u"),I=!!(S.focusable||p&&typeof S.focusable>"u"),V=on(),O=A3(S),P=ore({node:S,nodeType:T,hasDimensions:O,resizeObserver:h}),L=iD({nodeRef:P,disabled:S.hidden||!$,noDragClassName:g,handleSelector:S.dragHandle,nodeId:e,isSelectable:_,nodeClickDistance:j}),B=aD();if(S.hidden)return null;const q=_o(S),z=Xne(S),W=_||$||t||n||r||o,M=n?ne=>n(ne,{...C.userNode}):void 0,F=r?ne=>r(ne,{...C.userNode}):void 0,G=o?ne=>o(ne,{...C.userNode}):void 0,H=i?ne=>i(ne,{...C.userNode}):void 0,Q=a?ne=>a(ne,{...C.userNode}):void 0,te=ne=>{const{selectNodesOnDrag:de,nodeDragThreshold:ye}=V.getState();_&&(!de||!$||ye>0)&&jv({id:e,store:V,nodeRef:P}),t&&t(ne,{...C.userNode})},Z=ne=>{if(!(D3(ne.nativeEvent)||k)){if(w3.includes(ne.key)&&_){const de=ne.key==="Escape";jv({id:e,store:V,unselect:de,nodeRef:P})}else if($&&S.selected&&Object.prototype.hasOwnProperty.call(Oh,ne.key)){ne.preventDefault();const{ariaLabelConfig:de}=V.getState();V.setState({ariaLiveMessage:de["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),B({direction:Oh[ne.key],factor:ne.shiftKey?4:1})}}},ae=()=>{var Fe;if(k||!((Fe=P.current)!=null&&Fe.matches(":focus-visible")))return;const{transform:ne,width:de,height:ye,autoPanOnNodeFocus:Se,setCenter:Te}=V.getState();if(!Se)return;k0(new Map([[e,S]]),{x:0,y:0,width:de,height:ye},ne,!0).length>0||Te(S.position.x+q.width/2,S.position.y+q.height/2,{zoom:ne[2]})};return s.jsx("div",{className:Sn(["react-flow__node",`react-flow__node-${T}`,{[y]:$},S.className,{selected:S.selected,selectable:_,parent:D,draggable:$,dragging:L}]),ref:P,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:O?"visible":"hidden",...S.style,...z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:F,onMouseLeave:G,onContextMenu:H,onClick:te,onDoubleClick:Q,onKeyDown:I?Z:void 0,tabIndex:I?0:void 0,onFocus:I?ae:void 0,role:S.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":k?void 0:`${J3}-${v}`,"aria-label":S.ariaLabel,...S.domAttributes,children:s.jsx(Une,{value:e,children:s.jsx(R,{id:e,data:S.data,type:T,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:S.selected??!1,selectable:_,draggable:$,deletable:S.deletable??!0,isConnectable:U,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:L,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...q})})})}var are=m.memo(ire);const lre=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function uD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=At(lre,sn),a=nre(e.onlyRenderVisibleElements),l=sre();return s.jsx("div",{className:"react-flow__nodes",style:ng,children:a.map(u=>s.jsx(are,{id:u,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},u))})}uD.displayName="NodeRenderer";const cre=m.memo(uD);function ure(e){return At(m.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),a=n.nodeLookup.get(o.target);i&&a&&ate({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),sn)}const dre=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return s.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},fre=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return s.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},JC={[yd.Arrow]:dre,[yd.ArrowClosed]:fre};function pre(e){const t=on();return m.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(JC,e)?JC[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",ks.error009(e)),null)},[e])}const hre=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const u=pre(t);return u?s.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:s.jsx(u,{color:n,strokeWidth:a})}):null},dD=({defaultColor:e,rfId:t})=>{const n=At(i=>i.edges),r=At(i=>i.defaultEdgeOptions),o=m.useMemo(()=>mte(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?s.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:s.jsx("defs",{children:o.map(i=>s.jsx(hre,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};dD.displayName="MarkerDefinitions";var mre=m.memo(dD);function fD({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...p}){const[h,g]=m.useState({x:1,y:0,width:0,height:0}),y=Sn(["react-flow__edge-textwrapper",f]),k=m.useRef(null);return m.useEffect(()=>{if(k.current){const v=k.current.getBBox();g({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?s.jsxs("g",{transform:`translate(${e-h.width/2} ${t-h.height/2})`,className:y,visibility:h.width?"visible":"hidden",...p,children:[o&&s.jsx("rect",{width:h.width+2*a[0],x:-a[0],y:-a[1],height:h.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),s.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:k,style:r,children:n}),u]}):null}fD.displayName="EdgeText";const gre=m.memo(fD);function rg({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:f=20,...p}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...p,d:e,fill:"none",className:Sn(["react-flow__edge-path",p.className])}),f?s.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}):null,r&&hs(t)&&hs(n)?s.jsx(gre,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function ZC({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===lt.Left||e===lt.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function pD({sourceX:e,sourceY:t,sourcePosition:n=lt.Bottom,targetX:r,targetY:o,targetPosition:i=lt.Top}){const[a,l]=ZC({pos:n,x1:e,y1:t,x2:r,y2:o}),[u,f]=ZC({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,h,g,y]=I3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:f});return[`M${e},${t} C${a},${l} ${u},${f} ${r},${o}`,p,h,g,y]}function hD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:j})=>{const[N,S,C]=pD({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),D=e.isInternal?void 0:t;return s.jsx(rg,{id:D,path:N,labelX:S,labelY:C,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:j})})}const xre=hD({isInternal:!1}),mD=hD({isInternal:!0});xre.displayName="SimpleBezierEdge";mD.displayName="SimpleBezierEdgeInternal";function gD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,sourcePosition:y=lt.Bottom,targetPosition:k=lt.Top,markerEnd:v,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[S,C,D]=yv({sourceX:n,sourceY:r,sourcePosition:y,targetX:o,targetY:i,targetPosition:k,borderRadius:j==null?void 0:j.borderRadius,offset:j==null?void 0:j.offset,stepPosition:j==null?void 0:j.stepPosition}),T=e.isInternal?void 0:t;return s.jsx(rg,{id:T,path:S,labelX:C,labelY:D,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:v,markerStart:b,interactionWidth:N})})}const xD=gD({isInternal:!1}),yD=gD({isInternal:!0});xD.displayName="SmoothStepEdge";yD.displayName="SmoothStepEdgeInternal";function bD(e){return m.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return s.jsx(xD,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const yre=bD({isInternal:!1}),vD=bD({isInternal:!0});yre.displayName="StepEdge";vD.displayName="StepEdgeInternal";function wD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:v})=>{const[b,j,N]=O3({sourceX:n,sourceY:r,targetX:o,targetY:i}),S=e.isInternal?void 0:t;return s.jsx(rg,{id:S,path:b,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:v})})}const bre=wD({isInternal:!1}),jD=wD({isInternal:!0});bre.displayName="StraightEdge";jD.displayName="StraightEdgeInternal";function kD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=lt.Bottom,targetPosition:l=lt.Top,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[S,C,D]=M3({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l,curvature:j==null?void 0:j.curvature}),T=e.isInternal?void 0:t;return s.jsx(rg,{id:T,path:S,labelX:C,labelY:D,label:u,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:v,markerStart:b,interactionWidth:N})})}const vre=kD({isInternal:!1}),SD=kD({isInternal:!0});vre.displayName="BezierEdge";SD.displayName="BezierEdgeInternal";const eE={default:SD,straight:jD,step:vD,smoothstep:yD,simplebezier:mD},tE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},wre=(e,t,n)=>n===lt.Left?e-t:n===lt.Right?e+t:e,jre=(e,t,n)=>n===lt.Top?e-t:n===lt.Bottom?e+t:e,nE="react-flow__edgeupdater";function rE({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:a,type:l}){return s.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:a,className:Sn([nE,`${nE}-${l}`]),cx:wre(t,r,e),cy:jre(n,r,e),r,stroke:"transparent",fill:"transparent"})}function kre({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,setReconnecting:g,setUpdateHover:y}){const k=on(),v=(C,D)=>{if(C.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:$,connectionRadius:_,lib:U,onConnectStart:I,cancelConnection:V,nodeLookup:O,rfId:P,panBy:L,updateConnection:B}=k.getState(),q=D.type==="target",z=(F,G)=>{g(!1),h==null||h(F,n,D.type,G)},W=F=>f==null?void 0:f(n,F),M=(F,G)=>{g(!0),p==null||p(C,n,D.type),I==null||I(F,G)};wv.onPointerDown(C.nativeEvent,{autoPanOnConnect:T,connectionMode:$,connectionRadius:_,domNode:R,handleId:D.id,nodeId:D.nodeId,nodeLookup:O,isTarget:q,edgeUpdaterType:D.type,lib:U,flowId:P,cancelConnection:V,panBy:L,isValidConnection:(...F)=>{var G,H;return((H=(G=k.getState()).isValidConnection)==null?void 0:H.call(G,...F))??!0},onConnect:W,onConnectStart:M,onConnectEnd:(...F)=>{var G,H;return(H=(G=k.getState()).onConnectEnd)==null?void 0:H.call(G,...F)},onReconnectEnd:z,updateConnection:B,getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,dragThreshold:k.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},b=C=>v(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),j=C=>v(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),N=()=>y(!0),S=()=>y(!1);return s.jsxs(s.Fragment,{children:[(e===!0||e==="source")&&s.jsx(rE,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&s.jsx(rE,{position:u,centerX:i,centerY:a,radius:t,onMouseDown:j,onMouseEnter:N,onMouseOut:S,type:"target"})]})}function Sre({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,rfId:k,edgeTypes:v,noPanClassName:b,onError:j,disableKeyboardA11y:N}){let S=At(Te=>Te.edgeLookup.get(e));const C=At(Te=>Te.defaultEdgeOptions);S=C?{...C,...S}:S;let D=S.type||"default",T=(v==null?void 0:v[D])||eE[D];T===void 0&&(j==null||j("011",ks.error011(D)),D="default",T=(v==null?void 0:v.default)||eE.default);const R=!!(S.focusable||t&&typeof S.focusable>"u"),$=typeof h<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),_=!!(S.selectable||r&&typeof S.selectable>"u"),U=m.useRef(null),[I,V]=m.useState(!1),[O,P]=m.useState(!1),L=on(),{zIndex:B,sourceX:q,sourceY:z,targetX:W,targetY:M,sourcePosition:F,targetPosition:G}=At(m.useCallback(Te=>{const ke=Te.nodeLookup.get(S.source),Fe=Te.nodeLookup.get(S.target);if(!ke||!Fe)return{zIndex:S.zIndex,...tE};const oe=hte({id:e,sourceNode:ke,targetNode:Fe,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:Te.connectionMode,onError:j});return{zIndex:ite({selected:S.selected,zIndex:S.zIndex,sourceNode:ke,targetNode:Fe,elevateOnSelect:Te.elevateEdgesOnSelect,zIndexMode:Te.zIndexMode}),...oe||tE}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),sn),H=m.useMemo(()=>S.markerStart?`url('#${bv(S.markerStart,k)}')`:void 0,[S.markerStart,k]),Q=m.useMemo(()=>S.markerEnd?`url('#${bv(S.markerEnd,k)}')`:void 0,[S.markerEnd,k]);if(S.hidden||q===null||z===null||W===null||M===null)return null;const te=Te=>{var we;const{addSelectedEdges:ke,unselectNodesAndEdges:Fe,multiSelectionActive:oe}=L.getState();_&&(L.setState({nodesSelectionActive:!1}),S.selected&&oe?(Fe({nodes:[],edges:[S]}),(we=U.current)==null||we.blur()):ke([e])),o&&o(Te,S)},Z=i?Te=>{i(Te,{...S})}:void 0,ae=a?Te=>{a(Te,{...S})}:void 0,ne=l?Te=>{l(Te,{...S})}:void 0,de=u?Te=>{u(Te,{...S})}:void 0,ye=f?Te=>{f(Te,{...S})}:void 0,Se=Te=>{var ke;if(!N&&w3.includes(Te.key)&&_){const{unselectNodesAndEdges:Fe,addSelectedEdges:oe}=L.getState();Te.key==="Escape"?((ke=U.current)==null||ke.blur(),Fe({edges:[S]})):oe([e])}};return s.jsx("svg",{style:{zIndex:B},children:s.jsxs("g",{className:Sn(["react-flow__edge",`react-flow__edge-${D}`,S.className,b,{selected:S.selected,animated:S.animated,inactive:!_&&!o,updating:I,selectable:_}]),onClick:te,onDoubleClick:Z,onContextMenu:ae,onMouseEnter:ne,onMouseMove:de,onMouseLeave:ye,onKeyDown:R?Se:void 0,tabIndex:R?0:void 0,role:S.ariaRole??(R?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":R?`${Z3}-${k}`:void 0,ref:U,...S.domAttributes,children:[!O&&s.jsx(T,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:_,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:q,sourceY:z,targetX:W,targetY:M,sourcePosition:F,targetPosition:G,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:H,markerEnd:Q,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),$&&s.jsx(kre,{edge:S,isReconnectable:$,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,sourceX:q,sourceY:z,targetX:W,targetY:M,sourcePosition:F,targetPosition:G,setUpdateHover:V,setReconnecting:P})]})})}var Nre=m.memo(Sre);const Cre=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ND({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:h,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,onError:S}=At(Cre,sn),C=ure(t);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(mre,{defaultColor:e,rfId:n}),C.map(D=>s.jsx(Nre,{id:D,edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,onClick:p,reconnectRadius:h,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:v},D))]})}ND.displayName="EdgeRenderer";const Ere=m.memo(ND),Tre=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Rre({children:e}){const t=At(Tre);return s.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Are(e){const t=tg(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Pre=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function _re(e){const t=At(Pre),n=on();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Dre(e){return e.connection.inProgress?{...e.connection,to:Ac(e.connection.to,e.transform)}:{...e.connection}}function $re(e){return Dre}function Ire(e){const t=$re();return At(t,sn)}const Mre=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Lre({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:u}=At(Mre,sn);return!(i&&o&&u)?null:s.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:Sn(["react-flow__connection",S3(l)]),children:s.jsx(CD,{style:t,type:n,CustomComponent:r,isValid:l})})})}const CD=({style:e,type:t=gi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:u,to:f,toNode:p,toHandle:h,toPosition:g,pointer:y}=Ire();if(!o)return;if(n)return s.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:f.x,toY:f.y,fromPosition:u,toPosition:g,connectionStatus:S3(r),toNode:p,toHandle:h,pointer:y});let k="";const v={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:f.x,targetY:f.y,targetPosition:g};switch(t){case gi.Bezier:[k]=M3(v);break;case gi.SimpleBezier:[k]=pD(v);break;case gi.Step:[k]=yv({...v,borderRadius:0});break;case gi.SmoothStep:[k]=yv(v);break;default:[k]=O3(v)}return s.jsx("path",{d:k,fill:"none",className:"react-flow__connection-path",style:e})};CD.displayName="ConnectionLine";const Ore={};function sE(e=Ore){m.useRef(e),on(),m.useEffect(()=>{},[e])}function Fre(){on(),m.useRef(!1),m.useEffect(()=>{},[])}function ED({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:h,onSelectionStart:g,onSelectionEnd:y,connectionLineType:k,connectionLineStyle:v,connectionLineComponent:b,connectionLineContainerStyle:j,selectionKeyCode:N,selectionOnDrag:S,selectionMode:C,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:$,onlyRenderVisibleElements:_,elementsSelectable:U,defaultViewport:I,translateExtent:V,minZoom:O,maxZoom:P,preventScrolling:L,defaultMarkerColor:B,zoomOnScroll:q,zoomOnPinch:z,panOnScroll:W,panOnScrollSpeed:M,panOnScrollMode:F,zoomOnDoubleClick:G,panOnDrag:H,autoPanOnSelection:Q,onPaneClick:te,onPaneMouseEnter:Z,onPaneMouseMove:ae,onPaneMouseLeave:ne,onPaneScroll:de,onPaneContextMenu:ye,paneClickDistance:Se,nodeClickDistance:Te,onEdgeContextMenu:ke,onEdgeMouseEnter:Fe,onEdgeMouseMove:oe,onEdgeMouseLeave:we,reconnectRadius:je,onReconnect:De,onReconnectStart:Be,onReconnectEnd:tt,noDragClassName:Ue,noWheelClassName:it,noPanClassName:xt,disableKeyboardA11y:at,nodeExtent:st,rfId:ce,viewport:xe,onViewportChange:Le}){return sE(e),sE(t),Fre(),Are(n),_re(xe),s.jsx(ere,{onPaneClick:te,onPaneMouseEnter:Z,onPaneMouseMove:ae,onPaneMouseLeave:ne,onPaneContextMenu:ye,onPaneScroll:de,paneClickDistance:Se,deleteKeyCode:$,selectionKeyCode:N,selectionOnDrag:S,selectionMode:C,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:D,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:U,zoomOnScroll:q,zoomOnPinch:z,zoomOnDoubleClick:G,panOnScroll:W,panOnScrollSpeed:M,panOnScrollMode:F,panOnDrag:H,autoPanOnSelection:Q,defaultViewport:I,translateExtent:V,minZoom:O,maxZoom:P,onSelectionContextMenu:h,preventScrolling:L,noDragClassName:Ue,noWheelClassName:it,noPanClassName:xt,disableKeyboardA11y:at,onViewportChange:Le,isControlledViewport:!!xe,children:s.jsxs(Rre,{children:[s.jsx(Ere,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:De,onReconnectStart:Be,onReconnectEnd:tt,onlyRenderVisibleElements:_,onEdgeContextMenu:ke,onEdgeMouseEnter:Fe,onEdgeMouseMove:oe,onEdgeMouseLeave:we,reconnectRadius:je,defaultMarkerColor:B,noPanClassName:xt,disableKeyboardA11y:at,rfId:ce}),s.jsx(Lre,{style:v,type:k,component:b,containerStyle:j}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(cre,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:Te,onlyRenderVisibleElements:_,noPanClassName:xt,noDragClassName:Ue,disableKeyboardA11y:at,nodeExtent:st,rfId:ce}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}ED.displayName="GraphView";const zre=m.memo(ED),Bre=R3(),oE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:h,zIndexMode:g="basic"}={})=>{const y=new Map,k=new Map,v=new Map,b=new Map,j=r??t??[],N=n??e??[],S=p??[0,0],C=h??gd;B3(v,b,j);const{nodesInitialized:D}=vv(N,y,k,{nodeOrigin:S,nodeExtent:C,zIndexMode:g});let T=[0,0,1];if(a&&o&&i){const R=Yd(y,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:$,y:_,zoom:U}=N0(R,o,i,u,f,(l==null?void 0:l.padding)??.1);T=[$,_,U]}return{rfId:"1",width:o??0,height:i??0,transform:T,nodes:N,nodesInitialized:D,nodeLookup:y,parentLookup:k,edges:j,edgeLookup:b,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:f,translateExtent:gd,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:rc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:S,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...k3},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Bre,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:j3,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Ure=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g})=>rne((y,k)=>{async function v(){const{nodeLookup:b,panZoom:j,fitViewOptions:N,fitViewResolver:S,width:C,height:D,minZoom:T,maxZoom:R}=k();j&&(await Zee({nodes:b,width:C,height:D,panZoom:j,minZoom:T,maxZoom:R},N),S==null||S.resolve(!0),y({fitViewResolver:null}))}return{...oE({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:u,maxZoom:f,nodeOrigin:p,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:b=>{const{nodeLookup:j,parentLookup:N,nodeOrigin:S,elevateNodesOnSelect:C,fitViewQueued:D,zIndexMode:T,nodesSelectionActive:R}=k(),{nodesInitialized:$,hasSelectedNodes:_}=vv(b,j,N,{nodeOrigin:S,nodeExtent:h,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:T}),U=R&&_;D&&$?(v(),y({nodes:b,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:U})):y({nodes:b,nodesInitialized:$,nodesSelectionActive:U})},setEdges:b=>{const{connectionLookup:j,edgeLookup:N}=k();B3(j,N,b),y({edges:b})},setDefaultNodesAndEdges:(b,j)=>{if(b){const{setNodes:N}=k();N(b),y({hasDefaultNodes:!0})}if(j){const{setEdges:N}=k();N(j),y({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:j,nodeLookup:N,parentLookup:S,domNode:C,nodeOrigin:D,nodeExtent:T,debug:R,fitViewQueued:$,zIndexMode:_}=k(),{changes:U,updatedInternals:I}=jte(b,N,S,C,D,T,_);I&&(yte(N,S,{nodeOrigin:D,nodeExtent:T,zIndexMode:_}),$?(v(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(U==null?void 0:U.length)>0&&(R&&console.log("React Flow: trigger node changes",U),j==null||j(U)))},updateNodePositions:(b,j=!1)=>{const N=[];let S=[];const{nodeLookup:C,triggerNodeChanges:D,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:$}=k();for(const[_,U]of b){const I=C.get(_),V=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(U!=null&&U.position)),O={id:_,type:"position",position:V?{x:Math.max(0,U.position.x),y:Math.max(0,U.position.y)}:U.position,dragging:j};if(I&&T.inProgress&&T.fromNode.id===I.id){const P=Sa(I,T.fromHandle,lt.Left,!0);R({...T,from:P})}V&&I.parentId&&N.push({id:_,parentId:I.parentId,rect:{...U.internals.positionAbsolute,width:U.measured.width??0,height:U.measured.height??0}}),S.push(O)}if(N.length>0){const{parentLookup:_,nodeOrigin:U}=k(),I=P0(N,C,_,U);S.push(...I)}for(const _ of $.values())S=_(S);D(S)},triggerNodeChanges:b=>{const{onNodesChange:j,setNodes:N,nodes:S,hasDefaultNodes:C,debug:D}=k();if(b!=null&&b.length){if(C){const T=nD(b,S);N(T)}D&&console.log("React Flow: trigger node changes",b),j==null||j(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:j,setEdges:N,edges:S,hasDefaultEdges:C,debug:D}=k();if(b!=null&&b.length){if(C){const T=rD(b,S);N(T)}D&&console.log("React Flow: trigger edge changes",b),j==null||j(b)}},addSelectedNodes:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:D}=k();if(j){const T=b.map(R=>na(R,!0));C(T);return}C(Pl(S,new Set([...b]),!0)),D(Pl(N))},addSelectedEdges:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:D}=k();if(j){const T=b.map(R=>na(R,!0));D(T);return}D(Pl(N,new Set([...b]))),C(Pl(S,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:j}={})=>{const{edges:N,nodes:S,nodeLookup:C,triggerNodeChanges:D,triggerEdgeChanges:T}=k(),R=b||S,$=j||N,_=[];for(const I of R){if(!I.selected)continue;const V=C.get(I.id);V&&(V.selected=!1),_.push(na(I.id,!1))}const U=[];for(const I of $)I.selected&&U.push(na(I.id,!1));D(_),T(U)},setMinZoom:b=>{const{panZoom:j,maxZoom:N}=k();j==null||j.setScaleExtent([b,N]),y({minZoom:b})},setMaxZoom:b=>{const{panZoom:j,minZoom:N}=k();j==null||j.setScaleExtent([N,b]),y({maxZoom:b})},setTranslateExtent:b=>{var j;(j=k().panZoom)==null||j.setTranslateExtent(b),y({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:j,triggerNodeChanges:N,triggerEdgeChanges:S,elementsSelectable:C}=k();if(!C)return;const D=j.reduce((R,$)=>$.selected?[...R,na($.id,!1)]:R,[]),T=b.reduce((R,$)=>$.selected?[...R,na($.id,!1)]:R,[]);N(D),S(T)},setNodeExtent:b=>{const{nodes:j,nodeLookup:N,parentLookup:S,nodeOrigin:C,elevateNodesOnSelect:D,nodeExtent:T,zIndexMode:R}=k();b[0][0]===T[0][0]&&b[0][1]===T[0][1]&&b[1][0]===T[1][0]&&b[1][1]===T[1][1]||(vv(j,N,S,{nodeOrigin:C,nodeExtent:b,elevateNodesOnSelect:D,checkEquality:!1,zIndexMode:R}),y({nodeExtent:b}))},panBy:b=>{const{transform:j,width:N,height:S,panZoom:C,translateExtent:D}=k();return kte({delta:b,panZoom:C,transform:j,translateExtent:D,width:N,height:S})},setCenter:async(b,j,N)=>{const{width:S,height:C,maxZoom:D,panZoom:T}=k();if(!T)return!1;const R=typeof(N==null?void 0:N.zoom)<"u"?N.zoom:D;return await T.setViewport({x:S/2-b*R,y:C/2-j*R,zoom:R},{duration:N==null?void 0:N.duration,ease:N==null?void 0:N.ease,interpolate:N==null?void 0:N.interpolate}),!0},cancelConnection:()=>{y({connection:{...k3}})},updateConnection:b=>{y({connection:b})},reset:()=>y({...oE()})}},Object.is);function Hre({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:u,fitView:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g,children:y}){const[k]=m.useState(()=>Ure({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:f,minZoom:a,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:h,zIndexMode:g}));return s.jsx(sne,{value:k,children:s.jsx(Rne,{children:y})})}function Vre({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:u,minZoom:f,maxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y}){return m.useContext(eg)?s.jsx(s.Fragment,{children:e}):s.jsx(Hre,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:u,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y,children:e})}const Wre={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function qre({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:p,onMoveStart:h,onMoveEnd:g,onConnect:y,onConnectStart:k,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:j,onNodeMouseEnter:N,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:D,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:_,onNodesDelete:U,onEdgesDelete:I,onDelete:V,onSelectionChange:O,onSelectionDragStart:P,onSelectionDrag:L,onSelectionDragStop:B,onSelectionContextMenu:q,onSelectionStart:z,onSelectionEnd:W,onBeforeDelete:M,connectionMode:F,connectionLineType:G=gi.Bezier,connectionLineStyle:H,connectionLineComponent:Q,connectionLineContainerStyle:te,deleteKeyCode:Z="Backspace",selectionKeyCode:ae="Shift",selectionOnDrag:ne=!1,selectionMode:de=xd.Full,panActivationKeyCode:ye="Space",multiSelectionKeyCode:Se=vd()?"Meta":"Control",zoomActivationKeyCode:Te=vd()?"Meta":"Control",snapToGrid:ke,snapGrid:Fe,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:we,nodesDraggable:je,autoPanOnNodeFocus:De,nodesConnectable:Be,nodesFocusable:tt,nodeOrigin:Ue=eD,edgesFocusable:it,edgesReconnectable:xt,elementsSelectable:at=!0,defaultViewport:st=xne,minZoom:ce=.5,maxZoom:xe=2,translateExtent:Le=gd,preventScrolling:Ve=!0,nodeExtent:Ke,defaultMarkerColor:ct="#b1b1b7",zoomOnScroll:le=!0,zoomOnPinch:re=!0,panOnScroll:pe=!1,panOnScrollSpeed:Re=.5,panOnScrollMode:We=ga.Free,zoomOnDoubleClick:X=!0,panOnDrag:be=!0,onPaneClick:He,onPaneMouseEnter:ft,onPaneMouseMove:Ze,onPaneMouseLeave:yt,onPaneScroll:mt,onPaneContextMenu:me,paneClickDistance:Ce=1,nodeClickDistance:Ge=0,children:Ct,onReconnect:Mt,onReconnectStart:Nn,onReconnectEnd:Et,onEdgeContextMenu:Cn,onEdgeDoubleClick:Ft,onEdgeMouseEnter:En,onEdgeMouseMove:en,onEdgeMouseLeave:ue,reconnectRadius:Ee=10,onNodesChange:rt,onEdgesChange:Tn,noDragClassName:kr="nodrag",noWheelClassName:no="nowheel",noPanClassName:bt="nopan",fitView:Pi,fitViewOptions:Do,connectOnClick:_a,attributionPosition:tn,proOptions:$o,defaultEdgeOptions:Da,elevateNodesOnSelect:$a=!0,elevateEdgesOnSelect:_c=!1,disableKeyboardA11y:Ia=!1,autoPanOnConnect:Bt,autoPanOnNodeDrag:_i,autoPanOnSelection:ro=!0,autoPanSpeed:Io,connectionRadius:As,isValidConnection:Mo,onError:Ma,style:Lo,id:rr,nodeDragThreshold:ar,connectionDragThreshold:On,viewport:Oo,onViewportChange:Dc,width:$c,height:Fo,colorMode:Vn="light",debug:so,onScroll:Vr,ariaLabelConfig:La,zIndexMode:Di="basic",...zo},Bo){const Ps=rr||"1",zt=wne(Vn),oo=m.useCallback(_s=>{_s.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Vr==null||Vr(_s)},[Vr]);return s.jsx("div",{"data-testid":"rf__wrapper",...zo,onScroll:oo,style:{...Lo,...Wre},ref:Bo,className:Sn(["react-flow",o,zt]),id:rr,role:"application",children:s.jsxs(Vre,{nodes:e,edges:t,width:$c,height:Fo,fitView:Pi,fitViewOptions:Do,minZoom:ce,maxZoom:xe,nodeOrigin:Ue,nodeExtent:Ke,zIndexMode:Di,children:[s.jsx(vne,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:k,onConnectEnd:v,onClickConnectStart:b,onClickConnectEnd:j,nodesDraggable:je,autoPanOnNodeFocus:De,nodesConnectable:Be,nodesFocusable:tt,edgesFocusable:it,edgesReconnectable:xt,elementsSelectable:at,elevateNodesOnSelect:$a,elevateEdgesOnSelect:_c,minZoom:ce,maxZoom:xe,nodeExtent:Ke,onNodesChange:rt,onEdgesChange:Tn,snapToGrid:ke,snapGrid:Fe,connectionMode:F,translateExtent:Le,connectOnClick:_a,defaultEdgeOptions:Da,fitView:Pi,fitViewOptions:Do,onNodesDelete:U,onEdgesDelete:I,onDelete:V,onNodeDragStart:R,onNodeDrag:$,onNodeDragStop:_,onSelectionDrag:L,onSelectionDragStart:P,onSelectionDragStop:B,onMove:p,onMoveStart:h,onMoveEnd:g,noPanClassName:bt,nodeOrigin:Ue,rfId:Ps,autoPanOnConnect:Bt,autoPanOnNodeDrag:_i,autoPanSpeed:Io,onError:Ma,connectionRadius:As,isValidConnection:Mo,selectNodesOnDrag:we,nodeDragThreshold:ar,connectionDragThreshold:On,onBeforeDelete:M,debug:so,ariaLabelConfig:La,zIndexMode:Di}),s.jsx(zre,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:N,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:D,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:a,connectionLineType:G,connectionLineStyle:H,connectionLineComponent:Q,connectionLineContainerStyle:te,selectionKeyCode:ae,selectionOnDrag:ne,selectionMode:de,deleteKeyCode:Z,multiSelectionKeyCode:Se,panActivationKeyCode:ye,zoomActivationKeyCode:Te,onlyRenderVisibleElements:oe,defaultViewport:st,translateExtent:Le,minZoom:ce,maxZoom:xe,preventScrolling:Ve,zoomOnScroll:le,zoomOnPinch:re,zoomOnDoubleClick:X,panOnScroll:pe,panOnScrollSpeed:Re,panOnScrollMode:We,panOnDrag:be,autoPanOnSelection:ro,onPaneClick:He,onPaneMouseEnter:ft,onPaneMouseMove:Ze,onPaneMouseLeave:yt,onPaneScroll:mt,onPaneContextMenu:me,paneClickDistance:Ce,nodeClickDistance:Ge,onSelectionContextMenu:q,onSelectionStart:z,onSelectionEnd:W,onReconnect:Mt,onReconnectStart:Nn,onReconnectEnd:Et,onEdgeContextMenu:Cn,onEdgeDoubleClick:Ft,onEdgeMouseEnter:En,onEdgeMouseMove:en,onEdgeMouseLeave:ue,reconnectRadius:Ee,defaultMarkerColor:ct,noDragClassName:kr,noWheelClassName:no,noPanClassName:bt,rfId:Ps,disableKeyboardA11y:Ia,nodeExtent:Ke,viewport:Oo,onViewportChange:Dc}),s.jsx(gne,{onSelectionChange:O}),Ct,s.jsx(dne,{proOptions:$o,position:tn}),s.jsx(une,{rfId:Ps,disableKeyboardA11y:Ia})]})})}var Kre=sD(qre);function Gre(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>nD(o,i)),[]);return[t,n,r]}function Yre(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>rD(o,i)),[]);return[t,n,r]}function Xre({dimensions:e,lineWidth:t,variant:n,className:r}){return s.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Sn(["react-flow__background-pattern",n,r])})}function Qre({radius:e,className:t}){return s.jsx("circle",{cx:e,cy:e,r:e,className:Sn(["react-flow__background-pattern","dots",t])})}var bi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(bi||(bi={}));const Jre={[bi.Dots]:1,[bi.Lines]:1,[bi.Cross]:6},Zre=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function TD({id:e,variant:t=bi.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:u,className:f,patternClassName:p}){const h=m.useRef(null),{transform:g,patternId:y}=At(Zre,sn),k=r||Jre[t],v=t===bi.Dots,b=t===bi.Cross,j=Array.isArray(n)?n:[n,n],N=[j[0]*g[2]||1,j[1]*g[2]||1],S=k*g[2],C=Array.isArray(i)?i:[i,i],D=b?[S,S]:N,T=[C[0]*g[2]||1+D[0]/2,C[1]*g[2]||1+D[1]/2],R=`${y}${e||""}`;return s.jsxs("svg",{className:Sn(["react-flow__background",f]),style:{...u,...ng,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:h,"data-testid":"rf__background",children:[s.jsx("pattern",{id:R,x:g[0]%N[0],y:g[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:v?s.jsx(Qre,{radius:S/2,className:p}):s.jsx(Xre,{dimensions:D,lineWidth:o,variant:t,className:p})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}TD.displayName="Background";const ese=m.memo(TD);function tse(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:s.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nse(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:s.jsx("path",{d:"M0 0h32v4.2H0z"})})}function rse(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:s.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function sse(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ose(){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:s.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Cp({children:e,className:t,...n}){return s.jsx("button",{type:"button",className:Sn(["react-flow__controls-button",t]),...n,children:e})}const ise=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function RD({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:u,className:f,children:p,position:h="bottom-left",orientation:g="vertical","aria-label":y}){const k=on(),{isInteractive:v,minZoomReached:b,maxZoomReached:j,ariaLabelConfig:N}=At(ise,sn),{zoomIn:S,zoomOut:C,fitView:D}=tg(),T=()=>{S(),i==null||i()},R=()=>{C(),a==null||a()},$=()=>{D(o),l==null||l()},_=()=>{k.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),u==null||u(!v)},U=g==="horizontal"?"horizontal":"vertical";return s.jsxs(Qd,{className:Sn(["react-flow__controls",U,f]),position:h,style:e,"data-testid":"rf__controls","aria-label":y??N["controls.ariaLabel"],children:[t&&s.jsxs(s.Fragment,{children:[s.jsx(Cp,{onClick:T,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:j,children:s.jsx(tse,{})}),s.jsx(Cp,{onClick:R,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:b,children:s.jsx(nse,{})})]}),n&&s.jsx(Cp,{className:"react-flow__controls-fitview",onClick:$,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:s.jsx(rse,{})}),r&&s.jsx(Cp,{className:"react-flow__controls-interactive",onClick:_,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:v?s.jsx(ose,{}):s.jsx(sse,{})}),p]})}RD.displayName="Controls";const ase=m.memo(RD);function lse({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:u,className:f,borderRadius:p,shapeRendering:h,selected:g,onClick:y}){const{background:k,backgroundColor:v}=i||{},b=a||k||v;return s.jsx("rect",{className:Sn(["react-flow__minimap-node",{selected:g},f]),x:t,y:n,rx:p,ry:p,width:r,height:o,style:{fill:b,stroke:l,strokeWidth:u},shapeRendering:h,onClick:y?j=>y(j,e):void 0})}const cse=m.memo(lse),use=e=>e.nodes.map(t=>t.id),tb=e=>e instanceof Function?e:()=>e;function dse({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=cse,onClick:a}){const l=At(use,sn),u=tb(t),f=tb(e),p=tb(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:l.map(g=>s.jsx(pse,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:h},g))})}function fse({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:u}){const{node:f,x:p,y:h,width:g,height:y}=At(k=>{const v=k.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const b=v.internals.userNode,{x:j,y:N}=v.internals.positionAbsolute,{width:S,height:C}=_o(b);return{node:b,x:j,y:N,width:S,height:C}},sn);return!f||f.hidden||!A3(f)?null:s.jsx(l,{x:p,y:h,width:g,height:y,style:f.style,selected:!!f.selected,className:r(f),color:t(f),borderRadius:o,strokeColor:n(f),strokeWidth:i,shapeRendering:a,onClick:u,id:f.id})}const pse=m.memo(fse);var hse=m.memo(dse);const mse=200,gse=150,xse=e=>!e.hidden,yse=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?T3(Yd(e.nodeLookup,{filter:xse}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bse="react-flow__minimap-desc";function AD({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:p,maskStrokeWidth:h,position:g="bottom-right",onClick:y,onNodeClick:k,pannable:v=!1,zoomable:b=!1,ariaLabel:j,inversePan:N,zoomStep:S=1,offsetScale:C=5}){const D=on(),T=m.useRef(null),{boundingRect:R,viewBB:$,rfId:_,panZoom:U,translateExtent:I,flowWidth:V,flowHeight:O,ariaLabelConfig:P}=At(yse,sn),L=(e==null?void 0:e.width)??mse,B=(e==null?void 0:e.height)??gse,q=R.width/L,z=R.height/B,W=Math.max(q,z),M=W*L,F=W*B,G=C*W,H=R.x-(M-R.width)/2-G,Q=R.y-(F-R.height)/2-G,te=M+G*2,Z=F+G*2,ae=`${bse}-${_}`,ne=m.useRef(0),de=m.useRef();ne.current=W,m.useEffect(()=>{if(T.current&&U)return de.current=_te({domNode:T.current,panZoom:U,getTransform:()=>D.getState().transform,getViewScale:()=>ne.current}),()=>{var ke;(ke=de.current)==null||ke.destroy()}},[U]),m.useEffect(()=>{var ke;(ke=de.current)==null||ke.update({translateExtent:I,width:V,height:O,inversePan:N,pannable:v,zoomStep:S,zoomable:b})},[v,b,N,S,I,V,O]);const ye=y?ke=>{var we;const[Fe,oe]=((we=de.current)==null?void 0:we.pointer(ke))||[0,0];y(ke,{x:Fe,y:oe})}:void 0,Se=k?m.useCallback((ke,Fe)=>{const oe=D.getState().nodeLookup.get(Fe).internals.userNode;k(ke,oe)},[]):void 0,Te=j??P["minimap.ariaLabel"];return s.jsx(Qd,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*W:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Sn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:L,height:B,viewBox:`${H} ${Q} ${te} ${Z}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ae,ref:T,onClick:ye,children:[Te&&s.jsx("title",{id:ae,children:Te}),s.jsx(hse,{onClick:Se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-G},${Q-G}h${te+G*2}v${Z+G*2}h${-te-G*2}z
644
+ M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}AD.displayName="MiniMap";m.memo(AD);const vse=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,wse={[ac.Line]:"right",[ac.Handle]:"bottom-right"};function jse({nodeId:e,position:t,variant:n=ac.Handle,className:r,style:o=void 0,children:i,color:a,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:k,onResizeStart:v,onResize:b,onResizeEnd:j}){const N=lD(),S=typeof e=="string"?e:N,C=on(),D=m.useRef(null),T=n===ac.Handle,R=At(m.useCallback(vse(T&&y),[T,y]),sn),$=m.useRef(null),_=t??wse[n];m.useEffect(()=>{if(!(!D.current||!S))return $.current||($.current=Wte({domNode:D.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:I,transform:V,snapGrid:O,snapToGrid:P,nodeOrigin:L,domNode:B}=C.getState();return{nodeLookup:I,transform:V,snapGrid:O,snapToGrid:P,nodeOrigin:L,paneDomNode:B}},onChange:(I,V)=>{const{triggerNodeChanges:O,nodeLookup:P,parentLookup:L,nodeOrigin:B}=C.getState(),q=[],z={x:I.x,y:I.y},W=P.get(S);if(W&&W.expandParent&&W.parentId){const M=W.origin??B,F=I.width??W.measured.width??0,G=I.height??W.measured.height??0,H={id:W.id,parentId:W.parentId,rect:{width:F,height:G,...P3({x:I.x??W.position.x,y:I.y??W.position.y},{width:F,height:G},W.parentId,P,M)}},Q=P0([H],P,L,B);q.push(...Q),z.x=I.x?Math.max(M[0]*F,I.x):void 0,z.y=I.y?Math.max(M[1]*G,I.y):void 0}if(z.x!==void 0&&z.y!==void 0){const M={id:S,type:"position",position:{...z}};q.push(M)}if(I.width!==void 0&&I.height!==void 0){const F={id:S,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};q.push(F)}for(const M of V){const F={...M,type:"position"};q.push(F)}O(q)},onEnd:({width:I,height:V})=>{const O={id:S,type:"dimensions",resizing:!1,dimensions:{width:I,height:V}};C.getState().triggerNodeChanges([O])}})),$.current.update({controlPosition:_,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:v,onResize:b,onResizeEnd:j,shouldResize:k}),()=>{var I;(I=$.current)==null||I.destroy()}},[_,l,u,f,p,h,v,b,j,k]);const U=_.split("-");return s.jsx("div",{className:Sn(["react-flow__resize-control","nodrag",...U,n,r]),ref:D,style:{...o,scale:R,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:i})}m.memo(jse);var PD=Object.defineProperty,kse=(e,t,n)=>t in e?PD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sse=(e,t)=>{for(var n in t)PD(e,n,{get:t[n],enumerable:!0})},Nse=(e,t,n)=>kse(e,t+"",n),_D={};Sse(_D,{Graph:()=>Rs,alg:()=>D0,json:()=>$D,version:()=>Tse});var Cse=Object.defineProperty,DD=(e,t)=>{for(var n in t)Cse(e,n,{get:t[n],enumerable:!0})},Rs=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,a,l,u=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,a=e.name,arguments.length===2&&(l=t,u=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,u=!0)),o=""+o,i=""+i,a!==void 0&&(a=""+a);let f=Ru(this._isDirected,o,i,a);if(f in this._edgeLabels)return u&&(this._edgeLabels[f]=l),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[f]=u?l:this._defaultEdgeLabelFn(o,i,a);let p=Ese(this._isDirected,o,i,a);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[f]=p,iE(this._preds[i],o),iE(this._sucs[o],i),this._in[i][f]=p,this._out[o][f]=p,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?nb(this._isDirected,e):Ru(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?nb(this._isDirected,e):Ru(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?nb(this._isDirected,e):Ru(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,a=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],aE(this._preds[a],i),aE(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function iE(e,t){e[t]?e[t]++:e[t]=1}function aE(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Ru(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let a=o;o=i,i=a}return o+""+i+""+(r===void 0?"\0":r)}function Ese(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let l=o;o=i,i=l}let a={v:o,w:i};return r&&(a.name=r),a}function nb(e,t){return Ru(e,t.v,t.w,t.name)}var Tse="4.0.1",$D={};DD($D,{read:()=>_se,write:()=>Rse});function Rse(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Ase(e),edges:Pse(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Ase(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function Pse(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function _se(e){let t=new Rs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var D0={};DD(D0,{CycleException:()=>zh,bellmanFord:()=>ID,components:()=>Ise,dijkstra:()=>Fh,dijkstraAll:()=>Ose,findCycles:()=>Fse,floydWarshall:()=>Bse,isAcyclic:()=>Hse,postorder:()=>Wse,preorder:()=>qse,prim:()=>Kse,shortestPaths:()=>Gse,tarjan:()=>LD,topsort:()=>OD});var Dse=()=>1;function ID(e,t,n,r){return $se(e,String(t),n||Dse,r||function(o){return e.outEdges(o)})}function $se(e,t,n,r){let o={},i,a=0,l=e.nodes(),u=function(h){let g=n(h);o[h.v].distance+g<o[h.w].distance&&(o[h.w]={distance:o[h.v].distance+g,predecessor:h.v},i=!0)},f=function(){l.forEach(function(h){r(h).forEach(function(g){let y=g.v===h?g.v:g.w,k=y===g.v?g.w:g.v;u({v:y,w:k})})})};l.forEach(function(h){let g=h===t?0:Number.POSITIVE_INFINITY;o[h]={distance:g,predecessor:""}});let p=l.length;for(let h=1;h<p&&(i=!1,a++,f(),!!i);h++);if(a===p-1&&(i=!1,f(),i))throw new Error("The graph contains a negative weight cycle");return o}function Ise(e){let t={},n=[],r;function o(i){i in t||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var MD=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Mse=()=>1;function Fh(e,t,n,r){let o=function(i){return e.outEdges(i)};return Lse(e,String(t),n||Mse,r||o)}function Lse(e,t,n,r){let o={},i=new MD,a,l,u=function(f){let p=f.v!==a?f.v:f.w,h=o[p],g=n(f),y=l.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+f+" Weight: "+g);y<h.distance&&(h.distance=y,h.predecessor=a,i.decrease(p,y))};for(e.nodes().forEach(function(f){let p=f===t?0:Number.POSITIVE_INFINITY;o[f]={distance:p,predecessor:""},i.add(f,p)});i.size()>0&&(a=i.removeMin(),l=o[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(u);return o}function Ose(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Fh(e,o,t,n),r},{})}function LD(e){let t=0,n=[],r={},o=[];function i(a){let l=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(u){u in r?r[u].onStack&&(l.lowlink=Math.min(l.lowlink,r[u].index)):(i(u),l.lowlink=Math.min(l.lowlink,r[u].lowlink))}),l.lowlink===l.index){let u=[],f;do f=n.pop(),r[f].onStack=!1,u.push(f);while(a!==f);o.push(u)}}return e.nodes().forEach(function(a){a in r||i(a)}),o}function Fse(e){return LD(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var zse=()=>1;function Bse(e,t,n){return Use(e,t||zse,n||function(r){return e.outEdges(r)})}function Use(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},o.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let l=a.v===i?a.w:a.v,u=t(a);r[i][l]={distance:u,predecessor:i}})}),o.forEach(function(i){let a=r[i];o.forEach(function(l){let u=r[l];o.forEach(function(f){let p=u[i],h=a[f],g=u[f],y=p.distance+h.distance;y<g.distance&&(g.distance=y,g.predecessor=h.predecessor)})})}),r}var zh=class extends Error{constructor(...e){super(...e)}};function OD(e){let t={},n={},r=[];function o(i){if(i in n)throw new zh;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new zh;return r}function Hse(e){try{OD(e)}catch(t){if(t instanceof zh)return!1;throw t}return!0}function Vse(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(l=>{var u;return(u=e.isDirected()?e.successors(l):e.neighbors(l))!=null?u:[]}),a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o=FD(e,l,n==="post",a,i,r,o)}),o}function FD(e,t,n,r,o,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),o(t).forEach(function(l){a=FD(e,l,n,r,o,i,a)}),n&&(a=i(a,t))),a}function zD(e,t,n){return Vse(e,t,n,function(r,o){return r.push(o),r},[])}function Wse(e,t){return zD(e,t,"post")}function qse(e,t){return zD(e,t,"pre")}function Kse(e,t){let n=new Rs,r={},o=new MD,i;function a(u){let f=u.v===i?u.w:u.v,p=o.priority(f);if(p!==void 0){let h=t(u);h<p&&(r[f]=i,o.decrease(f,h))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(u){o.add(u,Number.POSITIVE_INFINITY),n.setNode(u)}),o.decrease(e.nodes()[0],0);let l=!1;for(;o.size()>0;){if(i=o.removeMin(),i in r)n.setEdge(i,r[i]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(i).forEach(a)}return n}function Gse(e,t,n,r){return Yse(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function Yse(e,t,n,r){if(n===void 0)return Fh(e,t,n,r);let o=!1,i=e.nodes();for(let a=0;a<i.length;a++){let l=r(i[a]);for(let u=0;u<l.length;u++){let f=l[u],p=f.v===i[a]?f.v:f.w,h=p===f.v?f.w:f.v;n({v:p,w:h})<0&&(o=!0)}if(o)return ID(e,t,n,r)}return Fh(e,t,n,r)}function Pc(e,t,n,r){let o=r;for(;e.hasNode(o);)o=$0(r);return n.dummy=t,e.setNode(o,n),o}function Xse(e){let t=new Rs().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function BD(e){let t=new Rs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function lE(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,a=e.width/2,l=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let u,f;return Math.abs(i)*a>Math.abs(o)*l?(i<0&&(l=-l),u=l*o/i,f=l):(o<0&&(a=-a),u=a,f=a*i/o),{x:n+u,y:r+f}}function sg(e){let t=jd(HD(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function Qse(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=qs(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Jse(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=qs(Math.min,t),r=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;r[l]||(r[l]=[]),r[l].push(a)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,l)=>{a===void 0&&l%i!==0?--o:a!==void 0&&o&&a.forEach(u=>e.node(u).rank+=o)})}function cE(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Pc(e,"border",o,t)}function Zse(e,t=UD){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var UD=65535;function qs(e,t){if(t.length>UD){let n=Zse(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function HD(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return qs(Math.max,t)}function eoe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function toe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function noe(e,t){return t()}var roe=0;function $0(e){let t=++roe;return e+(""+t)}function jd(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function Bh(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function og(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function soe(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var ig="\0",ooe=class{constructor(){Nse(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return uE(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&uE(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,ioe)),n=n._prev;return"["+e.join(", ")+"]"}};function uE(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ioe(e,t){if(e!=="_next"&&e!=="_prev")return t}var aoe=ooe,loe=()=>1;function coe(e,t){if(e.nodeCount()<=1)return[];let n=doe(e,t||loe);return uoe(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function uoe(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)rb(e,t,n,l);for(;l=i.dequeue();)rb(e,t,n,l);if(e.nodeCount()){for(let u=t.length-2;u>0;--u)if(l=(r=t[u])==null?void 0:r.dequeue(),l){o=o.concat(rb(e,t,n,l,!0)||[]);break}}}return o}function rb(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let u=e.edge(l),f=e.node(l.v);o&&i.push({v:l.v,w:l.w}),f.out-=u,kv(t,n,f)}),(e.outEdges(r.v)||[]).forEach(l=>{let u=e.edge(l),f=l.w,p=e.node(f);p.in-=u,kv(t,n,p)}),e.removeNode(r.v),a}function doe(e,t){let n=new Rs,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let u=n.edge(l.v,l.w)||0,f=t(l),p=u+f;n.setEdge(l.v,l.w,p);let h=n.node(l.v),g=n.node(l.w);o=Math.max(o,h.out+=f),r=Math.max(r,g.in+=f)});let i=foe(o+r+3).map(()=>new aoe),a=r+1;return n.nodes().forEach(l=>{kv(i,a,n.node(l))}),{graph:n,buckets:i,zeroIdx:a}}function kv(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function foe(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function poe(e){(e.graph().acyclicer==="greedy"?coe(e,t(e)):hoe(e)).forEach(n=>{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,$0("rev"))});function t(n){return r=>n.edge(r).weight}}function hoe(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):o(a.w)}),delete n[i])}return e.nodes().forEach(o),t}function moe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function goe(e){e.graph().dummyChains=[],e.edges().forEach(t=>xoe(e,t))}function xoe(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,a=t.name,l=e.edge(t),u=l.labelRank;if(i===r+1)return;e.removeEdge(t);let f,p,h;for(h=0,++r;r<i;++h,++r)l.points=[],p={width:0,height:0,edgeLabel:l,edgeObj:t,rank:r},f=Pc(e,"edge",p,"_d"),r===u&&(p.width=l.width,p.height=l.height,p.dummy="edge-label",p.labelpos=l.labelpos),e.setEdge(n,f,{weight:l.weight},a),h===0&&e.graph().dummyChains.push(f),n=f;e.setEdge(n,o,{weight:l.weight},a)}function yoe(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=o,n=e.node(t)})}function I0(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(u=>u==null?Number.POSITIVE_INFINITY:n(u.w)-e.edge(u).minlen):[],l=qs(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),o.rank=l}e.sources().forEach(n)}function cc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var VD=boe;function boe(e){let t=new Rs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,a;for(;voe(t,e)<o&&(i=woe(t,e),!!i);)a=t.hasNode(i.v)?cc(e,i):-cc(e,i),joe(t,e,a);return t}function voe(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let a=i.v,l=r===a?i.w:a;!e.hasNode(l)&&!cc(t,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function woe(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=cc(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function joe(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:koe,postorder:Soe}=D0,Noe=Pa;Pa.initLowLimValues=L0;Pa.initCutValues=M0;Pa.calcCutValue=WD;Pa.leaveEdge=KD;Pa.enterEdge=GD;Pa.exchangeEdges=YD;function Pa(e){e=Xse(e),I0(e);let t=VD(e);L0(t),M0(t,e);let n,r;for(;n=KD(t);)r=GD(t,e,n),YD(t,e,n,r)}function M0(e,t){let n=Soe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Coe(e,t,r))}function Coe(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=WD(e,t,n)}function WD(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),a=0;i||(o=!1,i=t.edge(r,n)),a=i.weight;let l=t.nodeEdges(n);return l&&l.forEach(u=>{let f=u.v===n,p=f?u.w:u.v;if(p!==r){let h=f===o,g=t.edge(u).weight;if(a+=h?g:-g,Toe(e,n,p)){let y=e.edge(n,p).cutvalue;a+=h?-y:y}}}),a}function L0(e,t){arguments.length<2&&(t=e.nodes()[0]),qD(e,{},1,t)}function qD(e,t,n,r,o){let i=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(u=>{Object.hasOwn(t,u)||(n=qD(e,t,n,u,r))}),a.low=i,a.lim=n++,o?a.parent=o:delete a.parent,n}function KD(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function GD(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),a=e.node(o),l=i,u=!1;return i.lim>a.lim&&(l=a,u=!0),t.edges().filter(f=>u===dE(e,e.node(f.v),l)&&u!==dE(e,e.node(f.w),l)).reduce((f,p)=>cc(t,p)<cc(t,f)?p:f)}function YD(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),L0(e),M0(e,t),Eoe(e,t)}function Eoe(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=koe(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,a=t.edge(o,i),l=!1;a||(a=t.edge(i,o),l=!0),t.node(o).rank=t.node(i).rank+(l?a.minlen:-a.minlen)})}function Toe(e,t,n){return e.hasEdge(t,n)}function dE(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Roe=Aoe;function Aoe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":fE(e);break;case"tight-tree":_oe(e);break;case"longest-path":Poe(e);break;case"none":break;default:fE(e)}}var Poe=I0;function _oe(e){I0(e),VD(e)}function fE(e){Noe(e)}var Doe=$oe;function $oe(e){let t=Moe(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=Ioe(e,t,o.v,o.w),a=i.path,l=i.lca,u=0,f=a[u],p=!0;for(;n!==o.w;){if(r=e.node(n),p){for(;(f=a[u])!==l&&e.node(f).maxRank<r.rank;)u++;f===l&&(p=!1)}if(!p){for(;u<a.length-1&&e.node(a[u+1]).minRank<=r.rank;)u++;f=a[u]}f!==void 0&&e.setParent(n,f),n=e.successors(n)[0]}})}function Ioe(e,t,n,r){let o=[],i=[],a=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim),u;u=n;do u=e.parent(u),o.push(u);while(u&&(t[u].low>a||l>t[u].lim));let f=u,p=r;for(;(p=e.parent(p))!==f;)i.push(p);return{path:o.concat(i.reverse()),lca:f}}function Moe(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(ig).forEach(r),t}function Loe(e){let t=Pc(e,"root",{},"_root"),n=Ooe(e),r=Object.values(n),o=qs(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let a=Foe(e)+1;e.children(ig).forEach(l=>XD(e,t,i,a,o,n,l)),e.graph().nodeRankFactor=i}function XD(e,t,n,r,o,i,a){var l;let u=e.children(a);if(!u.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let f=cE(e,"_bt"),p=cE(e,"_bb"),h=e.node(a);e.setParent(f,a),h.borderTop=f,e.setParent(p,a),h.borderBottom=p,u.forEach(g=>{var y;XD(e,t,n,r,o,i,g);let k=e.node(g),v=k.borderTop?k.borderTop:g,b=k.borderBottom?k.borderBottom:g,j=k.borderTop?r:2*r,N=v!==b?1:o-((y=i[a])!=null?y:0)+1;e.setEdge(f,v,{weight:j,minlen:N,nestingEdge:!0}),e.setEdge(b,p,{weight:j,minlen:N,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,f,{weight:0,minlen:o+((l=i[a])!=null?l:0)})}function Ooe(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,o+1)),t[r]=o}return e.children(ig).forEach(r=>n(r,1)),t}function Foe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function zoe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Boe=Uoe;function Uoe(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,a=o.maxRank+1;i<a;++i)pE(e,"borderLeft","_bl",n,o,i),pE(e,"borderRight","_br",n,o,i)}}e.children(ig).forEach(t)}function pE(e,t,n,r,o,i){let a={width:0,height:0,rank:i,borderType:t},l=o[t][i-1],u=Pc(e,"border",a,n);o[t][i]=u,e.setParent(u,r),l&&e.setEdge(l,u,{weight:1})}function Hoe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&QD(e)}function Voe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Woe(e),(n==="lr"||n==="rl")&&(qoe(e),QD(e))}function QD(e){e.nodes().forEach(t=>hE(e.node(t))),e.edges().forEach(t=>hE(e.edge(t)))}function hE(e){let t=e.width;e.width=e.height,e.height=t}function Woe(e){e.nodes().forEach(t=>sb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(sb),Object.hasOwn(r,"y")&&sb(r)})}function sb(e){e.y=-e.y}function qoe(e){e.nodes().forEach(t=>ob(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(ob),Object.hasOwn(r,"x")&&ob(r)})}function ob(e){let t=e.x;e.x=e.y,e.y=t}function Koe(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),o=qs(Math.max,r),i=jd(o+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let u=e.node(l);i[u.rank].push(l);let f=e.successors(l);f&&f.forEach(a)}return n.sort((l,u)=>e.node(l).rank-e.node(u).rank).forEach(a),i}function Goe(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Yoe(e,t[r-1],t[r]);return n}function Yoe(e,t,n){let r=soe(n,n.map((f,p)=>p)),o=t.flatMap(f=>{let p=e.outEdges(f);return p?p.map(h=>({pos:r[h.w],weight:e.edge(h).weight})).sort((h,g)=>h.pos-g.pos):[]}),i=1;for(;i<n.length;)i<<=1;let a=2*i-1;i-=1;let l=new Array(a).fill(0),u=0;return o.forEach(f=>{let p=f.pos+i;l[p]+=f.weight;let h=0;for(;p>0;)p%2&&(h+=l[p+1]),p=p-1>>1,l[p]+=f.weight;u+=f.weight*h}),u}function Xoe(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,a)=>{let l=e.edge(a),u=e.node(a.v);return{sum:i.sum+l.weight*u.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Qoe(e,t){let n={};e.forEach((o,i)=>{let a={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(a.barycenter=o.barycenter,a.weight=o.weight),n[o.v]=a}),t.edges().forEach(o=>{let i=n[o.v],a=n[o.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(o=>!o.indegree);return Joe(r)}function Joe(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Zoe(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>Bh(o,["vs","i","barycenter","weight"]))}function Zoe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function eie(e,t){let n=eoe(e,p=>Object.hasOwn(p,"barycenter")),r=n.lhs,o=n.rhs.sort((p,h)=>h.i-p.i),i=[],a=0,l=0,u=0;r.sort(tie(!!t)),u=mE(i,o,u),r.forEach(p=>{u+=p.vs.length,i.push(p.vs),a+=p.barycenter*p.weight,l+=p.weight,u=mE(i,o,u)});let f={vs:i.flat(1)};return l&&(f.barycenter=a/l,f.weight=l),f}function mE(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function tie(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function JD(e,t,n,r){let o=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,u={};a&&(o=o.filter(g=>g!==a&&g!==l));let f=Xoe(e,o);f.forEach(g=>{if(e.children(g.v).length){let y=JD(e,g.v,n,r);u[g.v]=y,Object.hasOwn(y,"barycenter")&&rie(g,y)}});let p=Qoe(f,n);nie(p,u);let h=eie(p,r);if(a&&l){h.vs=[a,h.vs,l].flat(1);let g=e.predecessors(a);if(g&&g.length){let y=e.node(g[0]),k=e.predecessors(l),v=e.node(k[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+y.order+v.order)/(h.weight+2),h.weight+=2}}return h}function nie(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function rie(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function sie(e,t,n,r){r||(r=e.nodes());let o=oie(e),i=new Rs({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),u=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){i.setNode(a),i.setParent(a,u||o);let f=e[n](a);f&&f.forEach(p=>{let h=p.v===a?p.w:p.v,g=i.edge(h,a),y=g!==void 0?g.weight:0;i.setEdge(h,a,{weight:e.edge(p).weight+y})}),Object.hasOwn(l,"minRank")&&i.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),i}function oie(e){let t;for(;e.hasNode(t=$0("_root")););return t}function iie(e,t,n){let r={},o;n.forEach(i=>{let a=e.parent(i),l,u;for(;a;){if(l=e.parent(a),l?(u=r[l],r[l]=a):(u=o,o=a),u&&u!==a){t.setEdge(u,a);return}a=l}})}function ZD(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ZD);return}let n=HD(e),r=gE(e,jd(1,n+1),"inEdges"),o=gE(e,jd(n-1,-1,-1),"outEdges"),i=Koe(e);if(xE(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,u=t.constraints||[];for(let f=0,p=0;p<4;++f,++p){aie(f%2?r:o,f%4>=2,u),i=sg(e);let h=Goe(e,i);h<a?(p=0,l=Object.assign({},i),a=h):h===a&&(l=structuredClone(i))}xE(e,l)}function gE(e,t,n){let r=new Map,o=(i,a)=>{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&o(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&o(l,i)}return t.map(function(i){return sie(e,i,n,r.get(i)||[])})}function aie(e,t,n){let r=new Rs;e.forEach(function(o){n.forEach(l=>r.setEdge(l.left,l.right));let i=o.graph().root,a=JD(o,i,r,t);a.vs.forEach((l,u)=>o.node(l).order=u),iie(o,r,a.vs)})}function xE(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function lie(e,t){let n={};function r(o,i){let a=0,l=0,u=o.length,f=i[i.length-1];return i.forEach((p,h)=>{let g=uie(e,p),y=g?e.node(g).order:u;(g||p===f)&&(i.slice(l,h+1).forEach(k=>{let v=e.predecessors(k);v&&v.forEach(b=>{let j=e.node(b),N=j.order;(N<a||y<N)&&!(j.dummy&&e.node(k).dummy)&&e$(n,b,k)})}),l=h+1,a=y)}),i}return t.length&&t.reduce(r),n}function cie(e,t){let n={};function r(i,a,l,u,f){jd(a,l).forEach(p=>{let h=i[p];if(h!==void 0&&e.node(h).dummy){let g=e.predecessors(h);g&&g.forEach(y=>{if(y===void 0)return;let k=e.node(y);k.dummy&&(k.order<u||k.order>f)&&e$(n,y,h)})}})}function o(i,a){let l=-1,u=-1,f=0;return a.forEach((p,h)=>{if(e.node(p).dummy==="border"){let g=e.predecessors(p);if(g&&g.length){let y=g[0];if(y===void 0)return;u=e.node(y).order,r(a,f,h,l,u),f=h,l=u}}r(a,f,a.length,u,i.length)}),a}return t.length&&t.reduce(o),n}function uie(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function e$(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function die(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function fie(e,t,n,r){let o={},i={},a={};return t.forEach(l=>{l.forEach((u,f)=>{o[u]=u,i[u]=u,a[u]=f})}),t.forEach(l=>{let u=-1;l.forEach(f=>{let p=r(f);if(p&&p.length){let h=p.sort((y,k)=>{let v=a[y],b=a[k];return(v!==void 0?v:0)-(b!==void 0?b:0)}),g=(h.length-1)/2;for(let y=Math.floor(g),k=Math.ceil(g);y<=k;++y){let v=h[y];if(v===void 0)continue;let b=a[v];if(b!==void 0&&i[f]===f&&u<b&&!die(n,f,v)){let j=o[v];j!==void 0&&(i[v]=f,i[f]=o[f]=j,u=b)}}}})}),{root:o,align:i}}function pie(e,t,n,r,o=!1){let i={},a=hie(e,t,n,o),l=o?"borderLeft":"borderRight";function u(y,k){let v=a.nodes().slice(),b={},j=v.pop();for(;j;){if(b[j])y(j);else{b[j]=!0,v.push(j);for(let N of k(j))v.push(N)}j=v.pop()}}function f(y){let k=a.inEdges(y);k?i[y]=k.reduce((v,b)=>{var j;let N=(j=i[b.v])!=null?j:0,S=a.edge(b);return Math.max(v,N+(S!==void 0?S:0))},0):i[y]=0}function p(y){let k=a.outEdges(y),v=Number.POSITIVE_INFINITY;k&&(v=k.reduce((j,N)=>{let S=i[N.w],C=a.edge(N);return Math.min(j,(S!==void 0?S:0)-(C!==void 0?C:0))},Number.POSITIVE_INFINITY));let b=e.node(y);v!==Number.POSITIVE_INFINITY&&b.borderType!==l&&(i[y]=Math.max(i[y]!==void 0?i[y]:0,v))}function h(y){return a.predecessors(y)||[]}function g(y){return a.successors(y)||[]}return u(f,h),u(p,g),Object.keys(r).forEach(y=>{var k;let v=n[y];v!==void 0&&(i[y]=(k=i[v])!=null?k:0)}),i}function hie(e,t,n,r){let o=new Rs,i=e.graph(),a=bie(i.nodesep,i.edgesep,r);return t.forEach(l=>{let u;l.forEach(f=>{let p=n[f];if(p!==void 0){if(o.setNode(p),u!==void 0){let h=n[u];if(h!==void 0){let g=o.edge(h,p);o.setEdge(h,p,Math.max(a(e,f,u),g||0))}}u=f}})}),o}function mie(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,u])=>{let f=vie(e,l)/2;o=Math.max(u+f,o),i=Math.min(u-f,i)});let a=o-i;return a<n[0]&&(n=[a,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function gie(e,t){let n=Object.values(t),r=qs(Math.min,n),o=qs(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(a=>{let l=i+a,u=e[l];if(!u||u===t)return;let f=Object.values(u),p=r-qs(Math.min,f);a!=="l"&&(p=o-qs(Math.max,f)),p&&(e[l]=og(u,h=>h+p))})})}function xie(e,t=void 0){let n=e.ul;return n?og(n,(r,o)=>{var i,a;if(t){let u=t.toLowerCase(),f=e[u];if(f&&f[o]!==void 0)return f[o]}let l=Object.values(e).map(u=>{let f=u[o];return f!==void 0?f:0}).sort((u,f)=>u-f);return(((i=l[1])!=null?i:0)+((a=l[2])!=null?a:0))/2}):{}}function yie(e){let t=sg(e),n=Object.assign(lie(e,t),cie(e,t)),r={},o;["u","d"].forEach(a=>{o=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(o=o.map(p=>Object.values(p).reverse()));let u=fie(e,o,n,p=>(a==="u"?e.predecessors(p):e.successors(p))||[]),f=pie(e,o,u.root,u.align,l==="r");l==="r"&&(f=og(f,p=>-p)),r[a+l]=f})});let i=mie(e,r);return gie(r,i),xie(r,e.graph().align)}function bie(e,t,n){return(r,o,i)=>{let a=r.node(o),l=r.node(i),u=0,f;if(u+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":f=-a.width/2;break;case"r":f=a.width/2;break}if(f&&(u+=n?f:-f),f=void 0,u+=(a.dummy?t:e)/2,u+=(l.dummy?t:e)/2,u+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":f=l.width/2;break;case"r":f=-l.width/2;break}return f&&(u+=n?f:-f),u}}function vie(e,t){return e.node(t).width}function wie(e){e=BD(e),jie(e),Object.entries(yie(e)).forEach(([t,n])=>e.node(t).x=n)}function jie(e){let t=sg(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(a=>{let l=a.reduce((u,f)=>{var p;let h=(p=e.node(f).height)!=null?p:0;return u>h?u:h},0);a.forEach(u=>{let f=e.node(u);o==="top"?f.y=i+f.height/2:o==="bottom"?f.y=i+l-f.height/2:f.y=i+l/2}),i+=l+r})}function kie(e,t={}){let n=t.debugTiming?toe:noe;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Die(e));return n(" runLayout",()=>Sie(r,n,t)),n(" updateInputGraph",()=>Nie(e,r)),r})}function Sie(e,t,n){t(" makeSpaceForEdgeLabels",()=>$ie(e)),t(" removeSelfEdges",()=>Hie(e)),t(" acyclic",()=>poe(e)),t(" nestingGraph.run",()=>Loe(e)),t(" rank",()=>Roe(BD(e))),t(" injectEdgeLabelProxies",()=>Iie(e)),t(" removeEmptyRanks",()=>Jse(e)),t(" nestingGraph.cleanup",()=>zoe(e)),t(" normalizeRanks",()=>Qse(e)),t(" assignRankMinMax",()=>Mie(e)),t(" removeEdgeLabelProxies",()=>Lie(e)),t(" normalize.run",()=>goe(e)),t(" parentDummyChains",()=>Doe(e)),t(" addBorderSegments",()=>Boe(e)),t(" order",()=>ZD(e,n)),t(" insertSelfEdges",()=>Vie(e)),t(" adjustCoordinateSystem",()=>Hoe(e)),t(" position",()=>wie(e)),t(" positionSelfEdges",()=>Wie(e)),t(" removeBorderNodes",()=>Uie(e)),t(" normalize.undo",()=>yoe(e)),t(" fixupEdgeLabelCoords",()=>zie(e)),t(" undoCoordinateSystem",()=>Voe(e)),t(" translateGraph",()=>Oie(e)),t(" assignNodeIntersects",()=>Fie(e)),t(" reversePoints",()=>Bie(e)),t(" acyclic.undo",()=>moe(e))}function Nie(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Cie=["nodesep","edgesep","ranksep","marginx","marginy"],Eie={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Tie=["acyclicer","ranker","rankdir","align","rankalign"],Rie=["width","height","rank"],yE={width:0,height:0},Aie=["minlen","weight","width","height","labeloffset"],Pie={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_ie=["labelpos"];function Die(e){let t=new Rs({multigraph:!0,compound:!0}),n=ab(e.graph());return t.setGraph(Object.assign({},Eie,ib(n,Cie),Bh(n,Tie))),e.nodes().forEach(r=>{let o=ab(e.node(r)),i=ib(o,Rie);Object.keys(yE).forEach(l=>{i[l]===void 0&&(i[l]=yE[l])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let o=ab(e.edge(r));t.setEdge(r,Object.assign({},Pie,ib(o,Aie),Bh(o,_ie)))}),t}function $ie(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Iie(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};Pc(e,"edge-proxy",o,"_ep")}})}function Mie(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Lie(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Oie(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,l=i.marginy||0;function u(f){let p=f.x,h=f.y,g=f.width,y=f.height;t=Math.min(t,p-g/2),n=Math.max(n,p+g/2),r=Math.min(r,h-y/2),o=Math.max(o,h+y/2)}e.nodes().forEach(f=>u(e.node(f))),e.edges().forEach(f=>{let p=e.edge(f);Object.hasOwn(p,"x")&&u(p)}),t-=a,r-=l,e.nodes().forEach(f=>{let p=e.node(f);p.x-=t,p.y-=r}),e.edges().forEach(f=>{let p=e.edge(f);p.points.forEach(h=>{h.x-=t,h.y-=r}),Object.hasOwn(p,"x")&&(p.x-=t),Object.hasOwn(p,"y")&&(p.y-=r)}),i.width=n-t+a,i.height=o-r+l}function Fie(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=o,a=r),n.points.unshift(lE(r,i)),n.points.push(lE(o,a))})}function zie(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function Bie(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Uie(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Hie(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Vie(e){sg(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(a=>{Pc(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:o+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Wie(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,o=e.node(r.e.v),i=o.x+o.width/2,a=o.y,l=n.x-i,u=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*l/3,y:a-u},{x:i+5*l/6,y:a-u},{x:i+l,y:a},{x:i+5*l/6,y:a+u},{x:i+2*l/3,y:a+u}],r.label.x=n.x,r.label.y=n.y}})}function ib(e,t){return og(Bh(e,t),Number)}function ab(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}/*! For license information please see dagre.esm.js.LEGAL.txt */function qie(e,t,n={}){const r=new Map;if(e.length===0)return r;const o=n.nodeWidth??150,i=n.nodeHeight??64,a=new _D.Graph;a.setGraph({rankdir:n.direction??"LR",nodesep:40,ranksep:90}),a.setDefaultEdgeLabel(()=>({}));const l=new Set;for(const u of e)l.add(u.id),a.setNode(u.id,{width:o,height:i});for(const u of t)l.has(u.from)&&l.has(u.to)&&a.setEdge(u.from,u.to);kie(a);for(const u of l){const f=a.node(u);f&&r.set(u,{x:f.x-o/2,y:f.y-i/2})}return r}function Kie({data:e,selected:t}){const{label:n,statusId:r,color:o,terminal:i,orphan:a,missing:l}=e;return s.jsxs("div",{className:Ne("min-w-[120px] rounded-md border px-3 py-2 text-xs shadow-sm transition-colors",l?"border-dashed border-error-foreground/60 bg-error/10 text-error-foreground":a?"border-warning-foreground/70 bg-warning/10":"border-border/70 bg-card",t&&"ring-2 ring-primary/50"),children:[s.jsx(lc,{type:"target",position:lt.Left,className:"!h-2 !w-2 !bg-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[!l&&s.jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full border border-border/50",style:o?{backgroundColor:o}:void 0}),s.jsx("span",{className:"font-medium text-foreground",children:n}),l&&s.jsx(RL,{className:"h-3 w-3 shrink-0","aria-label":"Undefined status"}),a&&!l&&s.jsx(Yh,{className:"h-3 w-3 shrink-0 text-warning-foreground","aria-label":"Orphan status"})]}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-[10px] text-muted-foreground",children:[s.jsx("span",{children:r}),i&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-muted-foreground",title:"Terminal status",children:[s.jsx(UL,{className:"h-2.5 w-2.5"})," terminal"]})]}),l&&s.jsx("div",{className:"mt-1 text-[10px] font-medium",children:"undefined status"}),a&&!l&&s.jsx("div",{className:"mt-1 text-[10px] text-warning-foreground",children:"no incoming edge"}),s.jsx(lc,{type:"source",position:lt.Right,className:"!h-2 !w-2 !bg-muted-foreground"})]})}const Gie={status:Kie},Yie="oklch(var(--muted-foreground))",Xie="oklch(var(--primary))",Qie="oklch(var(--error-foreground))";function Jie({onRelayout:e}){const{fitView:t}=tg();return s.jsx(Qd,{position:"top-right",children:s.jsxs("button",{type:"button",onClick:()=>{e(),requestAnimationFrame(()=>t({padding:.2}))},className:"shell-action inline-flex items-center gap-1 text-xs",title:"Reset node positions to the automatic layout",children:[s.jsx(KL,{className:"h-3 w-3"}),"Re-layout"]})})}function bE({nodes:e,edges:t,selectedRowKey:n,editable:r,onSelectEdge:o,onCreateEdge:i,onDeleteEdge:a}){const[l,u,f]=Gre([]),[p,h]=Yre([]),g=m.useRef(new Map),[y,k]=m.useState(0),v=m.useMemo(()=>JSON.stringify(e.map(R=>[R.id,R.label,R.color??"",R.terminal,R.orphan,R.missing])),[e]);m.useEffect(()=>{const R=qie(e,t,{direction:"LR"}),$=new Set(e.map(_=>_.id));for(const _ of g.current.keys())$.has(_)||g.current.delete(_);u(e.map(_=>{let U=g.current.get(_.id);return U||(U=R.get(_.id)??{x:0,y:0},g.current.set(_.id,U)),{id:_.id,type:"status",position:U,data:{label:_.label,statusId:_.id,color:_.color,terminal:_.terminal,orphan:_.orphan,missing:_.missing},draggable:!0,deletable:!1}}))},[v,y,u]);const b=m.useCallback(()=>{g.current.clear(),k(R=>R+1)},[]),j=m.useMemo(()=>t.map(R=>`${R.rowKey}:${R.from}>${R.to}:${R.command}:${R.requiresReason?1:0}:${R.undefinedRef?1:0}`).join("|"),[t]);m.useEffect(()=>{h(t.map(R=>{const $=R.rowKey===n,_=R.undefinedRef?Qie:$?Xie:Yie;return{id:R.rowKey,source:R.from,target:R.to,label:R.requiresReason?`${R.command} (reason)`:R.command,selected:$,deletable:r,markerEnd:{type:yd.ArrowClosed,color:_},style:{stroke:_,strokeWidth:$?2.5:1.5},labelStyle:{fill:"oklch(var(--foreground))",fontSize:11,fontFamily:"ui-monospace, monospace"},labelBgStyle:{fill:"oklch(var(--card))"},labelBgPadding:[4,2],labelBgBorderRadius:4}}))},[j,n,r,h]);const N=m.useCallback(R=>{for(const $ of R)$.type==="position"&&$.position&&g.current.set($.id,$.position);f(R)},[f]),S=m.useCallback(R=>{r&&R.source&&R.target&&i(R.source,R.target)},[r,i]),C=m.useCallback(R=>{if(r)for(const $ of R)a($.id)},[r,a]),D=m.useCallback((R,$)=>o($.id),[o]),T=m.useCallback(({edges:R})=>{R.length===1&&o(R[0].id)},[o]);return s.jsx("div",{className:"h-[460px] w-full overflow-hidden rounded-md border border-border/60 bg-background",children:s.jsxs(Kre,{nodes:l,edges:p,nodeTypes:Gie,onNodesChange:N,onConnect:S,onEdgesDelete:C,onEdgeClick:D,onSelectionChange:T,nodesConnectable:r,deleteKeyCode:r?["Backspace","Delete"]:null,elementsSelectable:!0,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!1},children:[s.jsx(ese,{gap:16}),s.jsx(ase,{showInteractive:!1}),s.jsx(Jie,{onRelayout:b})]})})}const Ep="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 Zie({transition:e,statuses:t,knownCommands:n,onChange:r,onDelete:o,disabled:i}){const a=m.useRef(null);if(m.useEffect(()=>{var y;e&&!i&&((y=a.current)==null||y.focus())},[e==null?void 0:e.rowKey]),!e)return s.jsx("div",{className:"surface-panel flex h-full min-h-[120px] items-center justify-center px-4 py-6 text-center text-xs text-muted-foreground",children:"Select a transition edge to edit it, or use “Add transition”."});const l=e,u=new Set(t.map(y=>y.id)),f=!u.has(l.from),p=!u.has(l.to);function h(y){r({...l,...y})}function g(y,k,v,b){const j=u.has(y);return s.jsxs("select",{ref:b,value:y,onChange:N=>k(N.target.value),disabled:i,"aria-label":v,className:`${Ep} w-full font-mono`,children:[!j&&y!==""&&s.jsxs("option",{value:y,children:[y," (undefined)"]}),y===""&&s.jsx("option",{value:"",children:"Select a status…"}),t.map(N=>s.jsxs("option",{value:N.id,children:[N.label," (",N.id,")"]},N.id))]})}return s.jsxs("div",{className:"surface-panel space-y-3 px-4 py-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Edit transition"}),s.jsxs("button",{type:"button",onClick:()=>o(l.rowKey),disabled:i,className:"inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs text-error-foreground hover:bg-error/10","aria-label":"Delete transition",children:[s.jsx(bn,{className:"h-3.5 w-3.5"}),"Delete"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"From status"}),g(l.from,y=>h({from:y}),"From status",a),f&&s.jsxs("span",{className:"block text-[11px] text-error-foreground",children:["“",l.from,"” is not a defined status"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Command"}),s.jsx("input",{type:"text",list:"transition-inspector-commands",value:l.command,onChange:y=>h({command:y.target.value}),disabled:i,placeholder:"command",className:`${Ep} w-full font-mono`})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"To status"}),g(l.to,y=>h({to:y}),"To status"),p&&s.jsxs("span",{className:"block text-[11px] text-error-foreground",children:["“",l.to,"” is not a defined status"]})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Label (optional)"}),s.jsx("input",{type:"text",value:l.label,onChange:y=>h({label:y.target.value}),disabled:i,placeholder:"label",className:`${Ep} w-full`})]}),s.jsxs("label",{className:"block space-y-1",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Description (optional)"}),s.jsx("textarea",{value:l.description,onChange:y=>h({description:y.target.value}),disabled:i,placeholder:"description",rows:2,className:`${Ep} w-full resize-y`})]}),s.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("button",{type:"button",role:"switch","aria-checked":l.requiresReason,"aria-label":"Requires reason",onClick:()=>h({requiresReason:!l.requiresReason}),disabled:i,className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${l.requiresReason?"bg-primary":"bg-muted"}`,children:s.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 rounded-full bg-background shadow-sm transition-transform ${l.requiresReason?"translate-x-4":"translate-x-0"}`})}),"Requires a reason"]}),s.jsx("datalist",{id:"transition-inspector-commands",children:n.map(y=>s.jsx("option",{value:y},y))})]})}function vE(){return s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-2.5 w-4 rounded",style:{backgroundColor:"oklch(var(--error-foreground))"}}),"references an undefined status"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-dashed border-error-foreground/70"}),"ghost (undefined) status"]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm border border-warning-foreground/70 bg-warning/10"}),"orphan status (no incoming edge)"]})]})}function eae({value:e,customizing:t,statuses:n,knownCommands:r,onChange:o,onCustomize:i,disabled:a}){var S;const l=m.useMemo(()=>new Set(n.map(C=>C.id)),[n]),[u,f]=m.useState(null),p=m.useMemo(()=>lv(U_()),[]),h=m.useMemo(()=>ZN(p,n),[p,n]);if(!t&&e.length===0)return s.jsxs(Xe,{title:"Transitions",description:"Which commands move an assignment between statuses, as a state-machine graph. Showing the built-in defaults.",actions:s.jsx("button",{type:"button",onClick:i,disabled:a,className:"shell-action text-xs",children:"Customize defaults"}),children:[s.jsx(vE,{}),s.jsx(bE,{nodes:h.nodes,edges:h.edges,selectedRowKey:null,editable:!1,onSelectEdge:()=>{},onCreateEdge:()=>{},onDeleteEdge:()=>{}})]});const g=H_(e,l),y=ZN(e,n),k=e.find(C=>C.rowKey===u)??null;function v(C){o(e.map(D=>D.rowKey===C.rowKey?C:D))}function b(C){o(e.filter(D=>D.rowKey!==C)),u===C&&f(null)}function j(C,D){const T={rowKey:B_(),from:C,command:r[0]??"",to:D,label:"",description:"",requiresReason:!1};o([...e,T]),f(T.rowKey)}const N=((S=n[0])==null?void 0:S.id)??"";return s.jsxs(Xe,{title:"Transitions",description:"Statuses are nodes; commands are labeled directed edges. Drag node-to-node to add a transition, or use “Add transition”, then edit it in the panel.",actions:s.jsxs("button",{type:"button",onClick:()=>j(N,N),disabled:a||n.length===0,className:"shell-action text-xs inline-flex items-center gap-1 disabled:opacity-50",children:[s.jsx(It,{className:"h-3 w-3"}),"Add transition"]}),children:[g.length>0&&s.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:[s.jsx("p",{className:"font-medium",children:"These transitions won't save until fixed:"}),s.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-4",children:g.map((C,D)=>s.jsx("li",{children:C},D))})]}),s.jsx(vE,{}),s.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(bE,{nodes:y.nodes,edges:y.edges,selectedRowKey:u,editable:!a,onSelectEdge:f,onCreateEdge:j,onDeleteEdge:b})}),s.jsx("div",{className:"w-full shrink-0 lg:w-80",children:s.jsx(Zie,{transition:k,statuses:n,knownCommands:r,onChange:v,onDelete:b,disabled:a})})]})]})}function tae(e){const t=[];e.transitions>0&&t.push({tab:"Transitions",count:e.transitions}),e.derive>0&&t.push({tab:"Derive Rules",count:e.derive}),e.facts>0&&t.push({tab:"Facts",count:e.facts});const n=e.transitions+e.derive+e.facts,r=n===0?"Unsaved changes":`Fix errors in ${t.map(o=>o.tab).join(", ")} to save`;return{total:n,offending:t,message:r}}function nae(){var ct;const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(!1),[a,l]=m.useState([]),[u,f]=m.useState(!1),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(new Set),[b,j]=m.useState(new Map),[N,S]=m.useState({open:!1}),[C,D]=m.useState([]),[T,R]=m.useState([]),[$,_]=m.useState({open:!1}),[U,I]=m.useState(()=>Uy(Lp)),[V,O]=m.useState(!1),[P,L]=m.useState(!1),[B,q]=m.useState(!1),[z,W]=m.useState([]),[M,F]=m.useState(!1),[G,H]=m.useState([]),[Q,te]=m.useState("statuses"),Z=m.useCallback(le=>{const re=WX(le);l(re),i(le.custom),v(new Set(re.map(pe=>pe.id))),j(new Map),D(le.rawFacts??[]),R([]),I(Uy(le.derive??Lp)),O(le.deriveCustom??!1),L(!1),q(!1),W(lv(le.transitions??[])),F(le.transitionsCustom??!1),H(le.knownCommands??[]),y(!1)},[]),ae=m.useCallback(async()=>{try{const le=await fetch("/api/config/statuses");if(!le.ok)throw new Error(`HTTP ${le.status}`);const re=await le.json();Z(re),r(null)}catch(le){r(le instanceof Error?le.message:"Failed to load config")}finally{t(!1)}},[Z]);m.useEffect(()=>{ae()},[ae]);function ne(){setTimeout(()=>h(null),3e3)}const de=m.useMemo(()=>a.map(le=>({id:le.id,label:le.label,color:le.color,terminal:le.terminal})),[a]),ye=m.useMemo(()=>new Set(a.map(le=>le.id)),[a]),Se=m.useMemo(()=>iQ(C),[C]),Te=m.useMemo(()=>Dw(Se),[Se]),ke=m.useMemo(()=>qX(C),[C]),Fe=m.useMemo(()=>{try{return z_(av(U),a,Te)}catch{return["derive rules are malformed"]}},[U,a,Te]),oe=m.useMemo(()=>M?H_(z,ye):[],[z,M,ye]),we=ke.length+Fe.length+oe.length,je=m.useCallback(le=>{D(le),y(!0)},[]),De=m.useCallback(le=>{I(le),L(!0),q(!1),O(!0),y(!0)},[]),Be=m.useCallback(()=>{I(Uy(Lp)),q(!0),L(!0),O(!1),y(!0)},[]),tt=m.useCallback(le=>{W(le),y(!0)},[]),Ue=m.useCallback(()=>{W(le=>le.length>0?le:lv(mQ(U_(),ye))),F(!0),y(!0)},[ye]);async function it(le=T){f(!0),h(null);try{const{body:re}=LX({statuses:a,order:a.map(X=>X.id),pendingResolutions:b,facts:C,factRemovalAcks:le,derive:B?null:P?av(U):void 0,transitions:M?hQ(z):void 0}),pe=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)});if(!pe.ok){const X=await pe.json().catch(()=>null);if(pe.status===409&&(X==null?void 0:X.error)==="unresolved-fact-references"&&X.references){_({open:!0,references:X.references}),f(!1);return}if((X==null?void 0:X.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(X.problems??[]).join("; ")}`);if((X==null?void 0:X.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(X.problems??[]).join("; ")}`);if((X==null?void 0:X.error)==="invalid-facts")throw new Error(`Invalid facts: ${(X.problems??[]).join("; ")}`);if(pe.status===409&&(X==null?void 0:X.error)==="unresolved-orphans"){const be=Array.isArray(X.unresolved)?X.unresolved.map(He=>He.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${be}. Click the trash icon on each row to choose remap or delete.`)}if(pe.status===409&&(X==null?void 0:X.error)==="concurrent-edit"){const be=X.applied?` (${X.applied.remapped} remapped, ${X.applied.deleted} deleted before the conflict)`:"";h({type:"error",message:`Concurrent edit detected${be}: ${X.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await ae();return}if(pe.status===500&&(X==null?void 0:X.error)==="config-write-failed"&&(X!=null&&X.applied)){const{remapped:be,deleted:He}=X.applied,ft=X.message?`: ${X.message}`:"";h({type:"error",message:`Resolutions applied (${be} remapped, ${He} deleted) but the status config write failed${ft}. Click Save again to retry.`}),await ae();return}throw(X==null?void 0:X.error)==="invalid-remap-target"?new Error(`Invalid remap target (${X.reason}): ${X.id} → ${X.target}.`):(X==null?void 0:X.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(X.ids??[]).join(", ")}`):(X==null?void 0:X.error)==="stale-resolution"?new Error(`Stale resolution for id "${X.id??"?"}".`):(X==null?void 0:X.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${X.message??"unknown"}`):(X==null?void 0:X.error)==="remap-write-failed"||(X==null?void 0:X.error)==="delete-failed"||(X==null?void 0:X.error)==="scan-failed"?new Error(`${X.error}: ${X.cause??"unknown"}`):new Error((X==null?void 0:X.error)??`Save failed (HTTP ${pe.status})`)}const Re=await pe.json();Z(Re),F1();const We=Re.applied?` (${Re.applied.remapped} remapped, ${Re.applied.deleted} deleted)`:"";h({type:"success",message:`Status config saved${We}`}),ne()}catch(re){h({type:"error",message:re instanceof Error?re.message:"Save failed"})}finally{f(!1)}}async function xt(){f(!0),h(null);try{const le=await fetch("/api/config/statuses",{method:"DELETE"});if(!le.ok)throw new Error("Reset failed");const re=await le.json();Z(re),F1(),h({type:"success",message:"Reset to defaults"}),ne()}catch(le){h({type:"error",message:le instanceof Error?le.message:"Reset failed"})}finally{f(!1)}}function at(le,re,pe){l(Re=>{const We=[...Re];return We[le]={...We[le],[re]:pe},We}),y(!0)}function st(){const le=`status_${a.length+1}`;l(re=>[...re,{rowKey:M_(),id:le,label:"New Status",description:"",color:"",terminal:!1}]),y(!0)}function ce(le){l(re=>{const pe=re.filter(We=>We.id!==le),Re=new Set(pe.map(We=>We.id));return j(We=>KN(We,Re)),pe}),y(!0)}async function xe(le){const re=a[le].id,pe=OX(re,U,z),Re=FX(re,U);if(!k.has(re)){if(pe.length===0){ce(re);return}S({open:!0,affected:{id:re,count:0,truncated:!1,assignments:[]},pendingId:re,ruleReferences:pe,headlineReferences:Re});return}try{const We=await fetch(`/api/config/statuses/affected/${encodeURIComponent(re)}`);if(!We.ok)throw new Error(`HTTP ${We.status}`);const X=await We.json();if(X.count===0&&pe.length===0){ce(re);return}S({open:!0,affected:X,pendingId:re,ruleReferences:pe,headlineReferences:Re})}catch(We){h({type:"error",message:`Could not check affected assignments for "${re}": ${We instanceof Error?We.message:String(We)}`})}}function Le(le,re){if(!N.open)return;const{pendingId:pe,affected:Re,ruleReferences:We}=N;if(pe!==le.id){S({open:!1});return}if(!a.some(X=>X.id===pe)){h({type:"error",message:`Row for "${pe}" was already removed — modal action ignored.`}),S({open:!1});return}le.mode==="remap"?(I(X=>zX(X,pe,re)),W(X=>BX(X,pe,re))):(I(X=>UX(X,pe,re)),W(X=>HX(X,pe))),We.some(X=>X.section!=="transitions")&&(L(!0),O(!0)),l(X=>{const be=X.filter(ft=>ft.id!==pe),He=new Set(be.map(ft=>ft.id));return j(ft=>{const Ze=KN(ft,He),yt=new Map(Ze);return Re.count>0&&yt.set(pe,le),yt}),be}),y(!0),S({open:!1})}function Ve(){if(!$.open)return;const le=$.references.map(pe=>pe.factName),re=Array.from(new Set([...T,...le]));R(re),_({open:!1}),it(re)}function Ke(){S({open:!1})}return e?s.jsx(jt,{label:"Loading workflow..."}):n?s.jsx(Rt,{error:n}):s.jsx(pa,{children:s.jsxs("div",{className:"space-y-6",children:[s.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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($v,{className:"h-4 w-4"}),o?"Using custom status configuration from ~/.syntaur/config.md":"Using default status configuration"]}),s.jsxs("button",{className:"shell-action text-xs",onClick:xt,disabled:u||!o&&!g,children:[s.jsx(Qs,{className:"h-3 w-3"}),"Reset to Defaults"]})]}),p&&s.jsx("div",{className:`rounded-lg border px-4 py-2 text-sm ${p.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:p.message}),s.jsx($m,{value:Q,onValueChange:te,items:[{value:"statuses",label:"Statuses",content:s.jsx(MX,{statuses:a,savedStatusIds:k,onUpdate:at,onAdd:st,onRemove:xe,onReorder:le=>{l(le),y(!0)}})},{value:"transitions",label:"Transitions",problemCount:oe.length,content:s.jsx(eae,{value:z,customizing:M,statuses:de,knownCommands:G,onChange:tt,onCustomize:Ue,disabled:u})},{value:"derive",label:"Derive Rules",problemCount:Fe.length,content:s.jsx(cQ,{value:U,deriveCustom:V,statuses:de,acceptedFacts:Se,onChange:De,onReset:Be,disabled:u})},{value:"facts",label:"Facts",problemCount:ke.length,content:s.jsx(QX,{rows:C,onChange:je,saving:u})}]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("button",{className:"shell-action bg-primary/10 text-primary hover:bg-primary/20 disabled:opacity-50",onClick:()=>void it(),disabled:u||!g||we>0,children:[s.jsx(Gh,{className:"h-3.5 w-3.5"}),u?"Saving...":"Save Configuration"]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),ae()},disabled:u,children:"Discard Changes"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:tae({transitions:oe.length,derive:Fe.length,facts:ke.length}).message})]})]}),N.open&&s.jsx(_X,{open:N.open,affected:{...N.affected,label:((ct=a.find(le=>le.id===N.affected.id))==null?void 0:ct.label)??N.affected.id},remaining:a.filter(le=>le.id!==N.affected.id&&k.has(le.id)).map(le=>({id:le.id,label:le.label})),ruleReferences:N.ruleReferences,headlineReferences:N.headlineReferences,onResolve:Le,onCancel:Ke}),s.jsx(DX,{open:$.open,references:$.open?$.references:[],onConfirm:Ve,onCancel:()=>{_({open:!1}),f(!1)}})]})})}const bo=e=>`${e.workspace}::${e.id}`;function wE(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function rae(){var We;const{data:e,loading:t,error:n,refetch:r}=_2(),{toast:o,showToast:i,dismissToast:a}=wr(),l=Ht(),[u,f]=m.useState(""),p=m.useRef(null);Ti("list:todos");const[h,g]=m.useState(""),[y,k]=m.useState(""),[v,b]=m.useState(""),[j,N]=m.useState("_global"),[S,C]=m.useState(null),[D,T]=m.useState(null),[R,$]=m.useState(new Set),[_,U]=m.useState(!1),I=m.useRef(null),[V,O]=m.useState(null),P=s0("all"),[L,B]=m.useState(null),[q,z]=m.useState(null),W=m.useRef(null);m.useEffect(()=>{let X=!1;return(async()=>{try{const be=await fetch("/api/projects");if(!be.ok)return;const He=await be.json();X||O(He.filter(ft=>!ft.archived))}catch{}})(),()=>{X=!0}},[]);async function M(X,be){X.stopPropagation(),await Ud(be)&&(C(be),setTimeout(()=>C(He=>He===be?null:He),1500))}const F=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const X=[];for(const be of e.workspaces)for(const He of be.items)X.push({...He,workspace:be.workspace});return X},[e]),G=m.useMemo(()=>{const X=new Set;for(const be of F)for(const He of be.tags)X.add(He);return Array.from(X).sort()},[F]),H=m.useMemo(()=>{let X=F;if(u.trim()){const be=u.toLowerCase();X=X.filter(He=>He.description.toLowerCase().includes(be)||He.tags.some(ft=>ft.toLowerCase().includes(be))||He.id.includes(be))}return h&&(X=X.filter(be=>be.status===h)),y&&(X=X.filter(be=>be.tags.includes(y))),X},[F,u,h,y]);m.useEffect(()=>{$(new Set),I.current=null},[u,h,y]);const Q=m.useMemo(()=>H.filter(X=>R.has(bo(X))),[H,R]),te=H.length>0&&Q.length===H.length,Z=Q.length>0&&!te,ae=m.useMemo(()=>{if(Q.length===0)return null;const X=new Set(Q.map(be=>be.workspace));return X.size===1?[...X][0]:null},[Q]),ne=m.useMemo(()=>{if(!ae||!V)return;const X=V.filter(be=>be.workspace===ae);return X.length===1?X[0].slug:void 0},[ae,V]),de=((We=Q[0])==null?void 0:We.description)??"",ye=m.useMemo(()=>{if(ae)return null;const X=new Map;for(const be of Q)X.has(be.workspace)||X.set(be.workspace,[]),X.get(be.workspace).push(be.id);return Array.from(X,([be,He])=>({workspace:be,todoIds:He}))},[Q,ae]),Se=ae?{kind:"workspace",workspace:ae}:{kind:"aggregate",groups:ye??[]};function Te(X,be,He){const ft=bo(X),Ze=!!(He&&"shiftKey"in He&&He.shiftKey),yt=I.current?st.findIndex(mt=>bo(mt)===I.current):-1;if(Ze&&yt!==-1){const mt=Math.min(yt,be),me=Math.max(yt,be);$(Ce=>{const Ge=new Set(Ce);for(let Ct=mt;Ct<=me;Ct++){const Mt=st[Ct];Mt&&Ge.add(bo(Mt))}return Ge})}else $(mt=>{const me=new Set(mt);return me.has(ft)?me.delete(ft):me.add(ft),me});I.current=ft}function ke(){$(X=>{const be=new Set(X);if(te)for(const He of H)be.delete(bo(He));else for(const He of H)be.add(bo(He));return be})}function Fe(){$(new Set),I.current=null}function oe(X){Fe(),r(),X!=null&&X.assignmentRef&&l(wE(X.assignmentRef))}const we=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const X={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const be of e.workspaces)X.open+=be.counts.open,X.in_progress+=be.counts.in_progress,X.completed+=be.counts.completed,X.blocked+=be.counts.blocked,X.total+=be.counts.total;return X},[e]);function je(X){i(X instanceof Error?X.message:"Action failed","error")}async function De(){if(v.trim())try{await Hv(j,v.trim()),b(""),r(),i("Todo added","success")}catch(X){je(X)}}async function Be(X,be,He){try{switch(He){case"open":await M2(X,be);break;case"in_progress":await I2(X,be);break;case"completed":await D2(X,be);break;case"blocked":await $2(X,be);break}r(),i("Todo updated","success")}catch(ft){je(ft)}}async function tt(X,be){try{await L2(X,be),r(),i("Todo deleted","success")}catch(He){je(He)}}async function Ue(X,be,He){try{await O2(X,be,He),r(),i("Todo updated","success")}catch(ft){throw je(ft),ft}}async function it(X,be,He){try{await F2(X,be,He),r(),i(He.length===1?"Attachment added":`${He.length} attachments added`,"success")}catch(ft){je(ft)}}async function xt(X,be,He){try{await z2(X,be,He),r(),i("Attachment removed","success")}catch(ft){je(ft)}}const at=r0(H),st=at.filter(X=>!P.isCollapsed(X.config.id)).flatMap(X=>X.items),{hotkeyRowProps:ce}=_d(st,{scope:"list:todos",bindO:!1,onOpen:X=>T(bo(X))});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var X;return(X=p.current)==null?void 0:X.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>r()});const[xe,Le]=Ns(),Ve=xe.get("focus");m.useEffect(()=>{if(!Ve)return;const X=F.find(He=>He.id===Ve);if(!X)return;const be=Om(X.status);P.isCollapsed(be)&&P.toggle(be)},[Ve,F]),m.useEffect(()=>{if(!Ve)return;const X=document.querySelector(`[data-todo-id="${CSS.escape(Ve)}"]`);if(!X)return;X.scrollIntoView({block:"nearest"}),X.classList.add("ring-2","ring-primary/60");const be=window.setTimeout(()=>{X.classList.remove("ring-2","ring-primary/60"),Le(He=>{const ft=new URLSearchParams(He);return ft.delete("focus"),ft})},1500);return()=>window.clearTimeout(be)},[Ve,st.length,Le]);const Ke=L?H.find(X=>bo(X)===L)??null:null;function ct(X,be){const He=W.current;if(He!=null&&He.closest(Zl)){X.preventDefault();return}X.dataTransfer.effectAllowed="move",X.dataTransfer.setData("text/plain",be),B(be)}function le(){B(null),z(null)}function re(X,be){!Ke||be.statuses.includes(Ke.status)||(X.preventDefault(),X.dataTransfer.dropEffect="move",z(be.id))}function pe(X,be){q===be.id&&!X.currentTarget.contains(X.relatedTarget)&&z(null)}function Re(X,be){X.preventDefault();const He=Ke;le(),!(!He||be.statuses.includes(He.status))&&Be(He.workspace,He.id,be.dropStatus)}return t?s.jsx(jt,{label:"Loading todos..."}):n?s.jsx(Rt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Hr,{toast:o,onDismiss:a}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Kn,{label:"Open",value:we.open,icon:gs}),s.jsx(Kn,{label:"In Progress",value:we.in_progress,icon:Iv,tone:"info"}),s.jsx(Kn,{label:"Blocked",value:we.blocked,icon:Yh,tone:"warn"}),s.jsx(Kn,{label:"Completed",value:we.completed,icon:gs,tone:"default"})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:j,onChange:X=>N(X.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"_global",children:"Global"}),e==null?void 0:e.workspaces.filter(X=>X.workspace!=="_global").map(X=>s.jsx("option",{value:X.workspace,children:X.workspace},X.workspace))]}),s.jsx("input",{type:"text",placeholder:"Add a todo...",value:v,onChange:X=>b(X.target.value),onKeyDown:X=>X.key==="Enter"&&De(),className:"h-9 flex-1 rounded-md border border-border/70 bg-background px-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"}),s.jsxs("button",{onClick:De,disabled:!v.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:[s.jsx(It,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:p,type:"text",placeholder:"Search todos...",value:u,onChange:X=>f(X.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:h,onChange:X=>g(X.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&s.jsxs("select",{value:y,onChange:X=>k(X.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),G.map(X=>s.jsxs("option",{value:X,children:["#",X]},X))]})]}),Q.length>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[Q.length," selected",ae?s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",s.jsx("strong",{children:ae}),")"]}):s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(Q.map(X=>X.workspace)).size," workspaces"]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>U(!0),className:"shell-action shell-action--cta",children:"Promote to assignment"}),s.jsx("button",{type:"button",onClick:Fe,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,H.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:te,ref:X=>{X&&(X.indeterminate=Z)},onChange:ke,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",H.length,")"]}),s.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let X=-1;return at.map(({config:be,items:He})=>{const ft=!P.isCollapsed(be.id);return s.jsx(n0,{label:be.label,count:He.length,expanded:ft,onToggle:()=>P.toggle(be.id),isDropTarget:q===be.id,onDragOver:Ze=>re(Ze,be),onDragLeave:Ze=>pe(Ze,be),onDrop:Ze=>Re(Ze,be),children:ft&&He.map(Ze=>{X+=1;const yt=X,mt=bo(Ze),me=R.has(mt);return s.jsxs("div",{draggable:!0,"data-todo-id":Ze.id,...ce(yt),onMouseDown:Ce=>{W.current=Ce.target},onDragStart:Ce=>ct(Ce,mt),onDragEnd:le,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${me?"ring-1 ring-foreground/20":""} ${L===mt?"opacity-50 shadow-lg":""}`,children:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${Ze.id}`,title:"Select",checked:me,onChange:()=>{},onClick:Ce=>{Ce.stopPropagation(),Te(Ze,yt,Ce)},className:"mt-1 h-4 w-4 shrink-0 cursor-pointer accent-foreground"}),s.jsx("span",{className:"mt-0.5 self-stretch w-px bg-border/60","aria-hidden":"true"}),s.jsx("div",{className:"mt-0.5 shrink-0",children:s.jsx(zP,{status:Ze.status,onChange:Ce=>Be(Ze.workspace,Ze.id,Ce)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-baseline flex-wrap gap-x-2",children:[s.jsx(UP,{description:Ze.description,status:Ze.status,editing:D===mt,onBeginEdit:()=>T(mt),onEndEdit:()=>T(null),onSave:Ce=>Ue(Ze.workspace,Ze.id,Ce)}),Ze.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:Ze.tags.map(Ce=>`#${Ce}`).join(" ")}),Ze.linkedAssignmentRef?s.jsxs($e,{to:wE(Ze.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:Ce=>Ce.stopPropagation(),children:[s.jsx(qE,{className:"h-2.5 w-2.5"}),Ze.linkedAssignmentRef.includes("/")?Ze.linkedAssignmentRef:`oneoff:${Ze.linkedAssignmentRef.slice(0,8)}`]}):null]}),s.jsx(HP,{item:Ze,attachmentUrl:(Ce,Ge)=>Vv(Ze.workspace,Ce,Ge),onAdd:Ce=>it(Ze.workspace,Ze.id,Ce),onDelete:Ce=>xt(Ze.workspace,Ze.id,Ce)})]}),s.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:Ze.workspace!=="_global"&&s.jsx($e,{to:`/w/${Ze.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:Ce=>Ce.stopPropagation(),children:Ze.workspace})}),S===Ze.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(zr,{className:"h-3 w-3"})," Copied to clipboard"]}):s.jsxs(s.Fragment,{children:[s.jsxs("button",{className:"text-xs text-muted-foreground/60 font-mono hover:text-foreground transition",onClick:Ce=>M(Ce,Ze.id),children:["t:",Ze.id]}),s.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:Ce=>M(Ce,Ze.id),children:s.jsx(rh,{className:"h-3 w-3"})})]}),s.jsx("button",{onClick:Ce=>{Ce.stopPropagation(),tt(Ze.workspace,Ze.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${Ze.workspace}-${Ze.id}`)})},be.id)})})()}),s.jsx(t0,{open:_,selectedIds:Q.map(X=>X.id),scope:Se,onOpenChange:U,onDone:oe,defaultProject:ne,defaultTitle:de,allowOneOff:!0})]})}const sae={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 oae({bundle:e}){const t=sae[e.derivedStatus.status],{counts:n}=e.derivedStatus;return s.jsxs("div",{className:"border rounded-md p-3 mb-2 bg-card",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:`text-lg leading-none ${t.cls}`,title:t.label,children:t.icon}),s.jsxs("span",{className:"font-mono text-sm text-muted-foreground",children:["b:",e.id]}),e.slug&&s.jsx("span",{className:"font-medium",children:e.slug}),s.jsxs("span",{className:"ml-auto text-sm text-muted-foreground",children:[n.completed,"/",n.total," done"]})]}),s.jsxs("div",{className:"mt-2 grid gap-1 text-sm",children:[e.branch&&s.jsxs("div",{className:"text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Branch:"})," ",s.jsx("code",{className:"font-mono",children:e.branch})]}),e.worktreePath&&s.jsxs("div",{className:"text-muted-foreground truncate",children:[s.jsx("span",{className:"font-medium",children:"Worktree:"})," ",s.jsx("code",{className:"font-mono",children:e.worktreePath})]}),e.planDir&&s.jsxs("div",{className:"text-muted-foreground truncate",children:[s.jsx("span",{className:"font-medium",children:"Plan:"})," ",s.jsx("code",{className:"font-mono",children:e.planDir})]})]}),s.jsx("ul",{className:"mt-2 ml-6 text-sm list-disc",children:e.members.map(r=>s.jsxs("li",{className:r.status==="completed"?"line-through text-muted-foreground":"",children:[s.jsxs("span",{className:"font-mono text-xs text-muted-foreground mr-2",children:["t:",r.id]}),r.description]},r.id))})]})}function iae({bundles:e,title:t="Bundles"}){return e.length===0?null:s.jsxs("section",{className:"mb-6",children:[s.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-2",children:[t," (",e.length,")"]}),e.map(n=>s.jsx(oae,{bundle:n},n.id))]})}function aae(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const u=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!u.ok)throw new Error(`HTTP ${u.status}`);n(await u.json()),a(null)}catch(u){a(u instanceof Error?u.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),gc(u=>{u.type==="todos-updated"&&!u.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function lae(){const{workspace:e}=Vt(),t=e||"_global",{data:n,loading:r,error:o,refetch:i}=IO(t),{toast:a,showToast:l,dismissToast:u}=wr(),{data:f}=aae(t),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,v]=m.useState(""),[b,j]=m.useState(""),[N,S]=m.useState(null),[C,D]=m.useState(null),[T,R]=m.useState(new Set),[$,_]=m.useState(!1),[U,I]=m.useState(!1),[V,O]=m.useState(null),P=m.useRef(null);Ti("list:todos");const L=s0("workspace:"+t),[B,q]=m.useState(null),[z,W]=m.useState(null),M=m.useRef(null);async function F(re,pe){re.stopPropagation(),await Ud(pe)&&(S(pe),setTimeout(()=>S(Re=>Re===pe?null:Re),1500))}const G=m.useMemo(()=>{if(!(n!=null&&n.items))return[];const re=new Set;for(const pe of n.items)for(const Re of pe.tags)re.add(Re);return Array.from(re).sort()},[n]),H=m.useMemo(()=>{if(!(n!=null&&n.items))return[];let re=n.items;if(p.trim()){const pe=p.toLowerCase();re=re.filter(Re=>Re.description.toLowerCase().includes(pe)||Re.tags.some(We=>We.toLowerCase().includes(pe))||Re.id.includes(pe))}return g&&(re=re.filter(pe=>pe.status===g)),k&&(re=re.filter(pe=>pe.tags.includes(k))),re},[n,p,g,k]);m.useEffect(()=>{R(new Set)},[p,g,k,t]);const Q=m.useMemo(()=>H.filter(re=>T.has(re.id)).length,[H,T]),te=H.length>0&&Q===H.length,Z=Q>0&&!te;function ae(re){R(pe=>{const Re=new Set(pe);return Re.has(re)?Re.delete(re):Re.add(re),Re})}function ne(){R(re=>{const pe=new Set(re);if(te)for(const Re of H)pe.delete(Re.id);else for(const Re of H)pe.add(Re.id);return pe})}function de(){R(new Set)}const ye=V?[V]:Array.from(T);function Se(){R(new Set),O(null),i()}function Te(){R(new Set),i()}function ke(re){l(re instanceof Error?re.message:"Action failed","error")}async function Fe(){if(b.trim())try{await Hv(t,b.trim()),j(""),i()}catch(re){ke(re)}}async function oe(re,pe,Re){if(re.stopPropagation(),!!window.confirm(`Delete "${Re}"? This can't be undone.`))try{await L2(t,pe),i()}catch(We){ke(We)}}async function we(re,pe){try{switch(pe){case"open":await M2(t,re);break;case"in_progress":await I2(t,re);break;case"completed":await D2(t,re);break;case"blocked":await $2(t,re);break}i()}catch(Re){ke(Re)}}async function je(re,pe){try{await O2(t,re,pe),i()}catch(Re){throw ke(Re),Re}}async function De(re,pe){try{await F2(t,re,pe),i()}catch(Re){ke(Re)}}async function Be(re,pe){try{await z2(t,re,pe),i()}catch(Re){ke(Re)}}const tt=r0(H),Ue=tt.filter(re=>!L.isCollapsed(re.config.id)).flatMap(re=>re.items),{hotkeyRowProps:it}=_d(Ue,{scope:"list:todos",bindO:!1,onOpen:re=>D(re.id)});Jt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var re;return(re=P.current)==null?void 0:re.focus()}}),Jt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[xt,at]=Ns(),st=xt.get("focus");m.useEffect(()=>{if(!st||!(n!=null&&n.items))return;const re=n.items.find(Re=>Re.id===st);if(!re)return;const pe=Om(re.status);L.isCollapsed(pe)&&L.toggle(pe)},[st,n==null?void 0:n.items]),m.useEffect(()=>{if(!st)return;const re=document.querySelector(`[data-todo-id="${window.CSS.escape(st)}"]`);if(!re)return;re.scrollIntoView({block:"nearest"}),re.classList.add("ring-2","ring-primary/60");const pe=window.setTimeout(()=>{re.classList.remove("ring-2","ring-primary/60"),at(Re=>{const We=new URLSearchParams(Re);return We.delete("focus"),We})},1500);return()=>window.clearTimeout(pe)},[st,Ue.length,at]);const ce=B?(n==null?void 0:n.items.find(re=>re.id===B))??null:null;function xe(re,pe){const Re=M.current;if(Re!=null&&Re.closest(Zl)){re.preventDefault();return}re.dataTransfer.effectAllowed="move",re.dataTransfer.setData("text/plain",pe),q(pe)}function Le(){q(null),W(null)}function Ve(re,pe){!ce||pe.statuses.includes(ce.status)||(re.preventDefault(),re.dataTransfer.dropEffect="move",W(pe.id))}function Ke(re,pe){z===pe.id&&!re.currentTarget.contains(re.relatedTarget)&&W(null)}function ct(re,pe){re.preventDefault();const Re=ce;Le(),!(!Re||pe.statuses.includes(Re.status))&&we(Re.id,pe.dropStatus)}if(r)return s.jsx(jt,{label:"Loading todos..."});if(o)return s.jsx(Rt,{error:o});const le=(n==null?void 0:n.counts)||{open:0,in_progress:0,blocked:0,total:0};return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Hr,{toast:a,onDismiss:u}),s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Kn,{label:"Open",value:le.open,icon:gs}),s.jsx(Kn,{label:"In Progress",value:le.in_progress,icon:gs,tone:"info"}),s.jsx(Kn,{label:"Blocked",value:le.blocked,icon:Yh,tone:"warn"}),s.jsx(Kn,{label:"Total",value:le.total,icon:gs})]}),f&&s.jsx(iae,{bundles:f.bundles}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"text",placeholder:"Add a todo...",value:b,onChange:re=>j(re.target.value),onKeyDown:re=>re.key==="Enter"&&Fe(),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"}),s.jsxs("button",{onClick:Fe,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:[s.jsx(It,{className:"h-4 w-4"}),"Add"]})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"relative flex-1 max-w-sm",children:[s.jsx(Ni,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:P,type:"text",placeholder:"Search...",value:p,onChange:re=>h(re.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:g,onChange:re=>y(re.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All statuses"}),s.jsx("option",{value:"open",children:"Open"}),s.jsx("option",{value:"in_progress",children:"In Progress"}),s.jsx("option",{value:"completed",children:"Completed"}),s.jsx("option",{value:"blocked",children:"Blocked"})]}),G.length>0&&s.jsxs("select",{value:k,onChange:re=>v(re.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),G.map(re=>s.jsxs("option",{value:re,children:["#",re]},re))]})]}),T.size>0?s.jsxs("div",{className:"surface-panel flex items-center justify-between gap-3 px-3 py-2",children:[s.jsxs("span",{className:"text-sm font-medium",children:[T.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>_(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{O(null),I(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:de,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,H.length>0&&s.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-xs text-muted-foreground",children:[s.jsx("input",{type:"checkbox","aria-label":"Select all visible todos",checked:te,ref:re=>{re&&(re.indeterminate=Z)},onChange:ne,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",H.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let re=-1;return tt.map(({config:pe,items:Re})=>{const We=!L.isCollapsed(pe.id);return s.jsx(n0,{label:pe.label,count:Re.length,expanded:We,onToggle:()=>L.toggle(pe.id),isDropTarget:z===pe.id,onDragOver:X=>Ve(X,pe),onDragLeave:X=>Ke(X,pe),onDrop:X=>ct(X,pe),children:We&&Re.map(X=>(re+=1,s.jsx(BP,{item:X,copiedId:N,selected:T.has(X.id),editing:C===X.id,onBeginEdit:be=>D(be),onEndEdit:()=>D(null),onPatchDescription:je,onAddAttachments:De,onDeleteAttachment:Be,attachmentUrl:(be,He)=>Vv(t,be,He),onToggleSelected:be=>ae(be),onMoveOne:(be,He)=>{He.stopPropagation(),O(be),I(!0)},onStatusChange:we,onCopyId:F,onDelete:oe,hotkeyRowProps:it(re),onDragOrigin:be=>{M.current=be.target},onDragStart:xe,onDragEnd:Le,isDragging:B===X.id},X.id)))},pe.id)})})()}),s.jsx(t0,{open:$,selectedIds:Array.from(T),scope:{kind:"workspace",workspace:t},onOpenChange:_,onDone:Te}),s.jsx(WP,{open:U,selectedIds:ye,scope:{kind:"workspace",workspace:t},onOpenChange:re=>{I(re),re||O(null)},onDone:Se})]})}function t$(){const{views:e}=Ld();async function t(i,a,l){const u=e.find(h=>h.id===i.id)??i,f=AA(l,u.workspace).config,p=vh(u.config,f,u.config);await mh(i.id,{name:a,config:p})}async function n(i,a,l){const u=e.find(h=>h.id===i.id)??i,f=$w(l,u.workspace).config,p=vh(u.config,f,u.config);await mh(i.id,{name:a,config:p})}async function r(i){await Xl({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await I8(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:r,remove:o}}const jE=80,cae={kanban:"Kanban",list:"List",table:"Table"},uae={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function n$({open:e,onOpenChange:t,workspace:n,initialView:r,onSubmit:o}){const i=!!r,a=Es(),l=Pd(),{data:u}=Zs(),{data:f}=Qh(),[p,h]=m.useState(""),[g,y]=m.useState(pl.viewMode),[k,v]=m.useState([]),[b,j]=m.useState([]),[N,S]=m.useState([]),[C,D]=m.useState([]),[T,R]=m.useState([]),[$,_]=m.useState([]),[U,I]=m.useState("all"),[V,O]=m.useState(null),[P,L]=m.useState(""),[B,q]=m.useState(pl.sortField),[z,W]=m.useState(pl.sortDirection),[M,F]=m.useState(!1),[G,H]=m.useState(null);function Q(){y(pl.viewMode),v([]),j([]),S([]),D([]),R([]),_([]),I("all"),O(null),L(""),q(pl.sortField),W(pl.sortDirection)}m.useEffect(()=>{if(e)if(H(null),F(!1),r){const oe=r.config.filters;h(r.name),y(r.config.viewMode),v(qe(oe.status)),j(qe(oe.priority)),S(qe(oe.type)),D(qe(oe.project)),R(qe(oe.assignee)),_(qe(oe.tags)),I(oe.activity??"all"),O(Am(oe.dateRange)),L(oe.search??""),q(r.config.sortField),W(r.config.sortDirection)}else h(""),Q()},[e,r]);const te=oe=>we=>oe?oe==="_ungrouped"?we.projectWorkspace===null:we.projectWorkspace===oe:!0,Z=m.useMemo(()=>{const oe=je=>n?n==="_ungrouped"?je.workspace===null:je.workspace===n:!0,we=(u??[]).filter(oe);return[{value:"__standalone__",label:"No project"},...we.map(je=>({value:je.slug,label:je.title}))]},[u,n]),ae=m.useMemo(()=>{const oe=new Set,we=te(n);for(const De of(f==null?void 0:f.assignments)??[])we(De)&&De.assignee&&oe.add(De.assignee);const je=[{value:"__unassigned__",label:"Unassigned"}];for(const De of Array.from(oe).sort())je.push({value:De,label:De});return je},[f,n]),ne=m.useMemo(()=>{const oe=new Set,we=te(n);for(const je of(f==null?void 0:f.assignments)??[])if(we(je))for(const De of je.tags??[])oe.add(De);return Array.from(oe).sort().map(je=>({value:je,label:je}))},[f,n]),de=m.useMemo(()=>a.order.map(oe=>({value:oe,label:No(a,oe)})),[a]),ye=m.useMemo(()=>aH.map(oe=>({value:oe,label:oe[0].toUpperCase()+oe.slice(1)})),[]),Se=m.useMemo(()=>l.definitions.map(oe=>({value:oe.id,label:Ml(l,oe.id)})),[l]),Te=iw.map(oe=>({value:oe,label:cae[oe]})),ke=p.trim(),Fe=ke.length>0&&ke.length<=jE;return s.jsx(Ln,{open:e,onOpenChange:t,children:s.jsx(jn,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async oe=>{if(oe.preventDefault(),!Fe||M)return;F(!0),H(null);const we={viewMode:g,filters:{status:k,priority:b,type:N,project:C,assignee:T,tags:$,activity:U,dateRange:ha(V),search:P},sortField:B,sortDirection:z};try{await o(ke,we)}catch(je){H(je instanceof Error?je.message:String(je)),F(!1)}},children:[s.jsx(tr,{children:s.jsx(kn,{children:i?"Edit view":"Create view"})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{className:"block text-xs font-medium text-muted-foreground",htmlFor:"create-view-name",children:"Name"}),s.jsx("input",{id:"create-view-name",type:"text",value:p,autoFocus:!0,required:!0,maxLength:jE,onChange:oe=>h(oe.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"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:"View mode"}),s.jsx(_m,{value:g,onChange:oe=>y(oe),options:Te})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(zs,{label:"Status",children:s.jsx(yn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:de,value:k,onChange:v})}),s.jsx(zs,{label:"Priority",children:s.jsx(yn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:ye,value:b,onChange:j})}),s.jsx(zs,{label:"Type",children:s.jsx(yn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Se,value:N,onChange:S})}),s.jsx(zs,{label:"Project",children:s.jsx(yn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:Z,value:C,onChange:D})}),s.jsx(zs,{label:"Assignee",children:s.jsx(yn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:ae,value:T,onChange:R})}),s.jsx(zs,{label:"Tags",children:s.jsx(yn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:ne,value:$,onChange:_})}),s.jsx(zs,{label:"Activity",children:s.jsxs("select",{value:U,onChange:oe=>I(oe.target.value),className:"editor-input w-full",children:[s.jsx("option",{value:"all",children:"All activity"}),s.jsx("option",{value:"stale",children:"Stale only"}),s.jsx("option",{value:"fresh",children:"Fresh only"})]})}),s.jsx(zs,{label:"Date range",children:s.jsx(Rm,{className:"w-full",value:V,onChange:O})}),s.jsx(zs,{label:"Search",className:"sm:col-span-2",children:s.jsx("input",{type:"text",value:P,onChange:oe=>L(oe.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),s.jsx(zs,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:B,onChange:oe=>q(oe.target.value),className:"editor-input w-full",children:CT.map(oe=>s.jsx("option",{value:oe,children:uae[oe]??oe},oe))}),s.jsx("button",{type:"button",onClick:()=>W(oe=>oe==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:z==="asc"?"Ascending":"Descending",children:z==="asc"?"Asc":"Desc"})]})})]}),G?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:G}):null,s.jsxs(Ur,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:Q,className:"shell-action",disabled:M,children:"Clear all"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>t(!1),className:"shell-action",disabled:M,children:"Cancel"}),s.jsx("button",{type:"submit",disabled:!Fe||M,className:"shell-action shell-action--cta disabled:opacity-50",children:M?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function zs({label:e,className:t,children:n}){return s.jsxs("label",{className:`space-y-1 ${t??""}`,children:[s.jsx("span",{className:"block text-xs font-medium text-muted-foreground",children:e}),n]})}const dae={kanban:"Kanban",list:"List",table:"Table"},fae={assignment:"Assignment",session:"Session"},pae={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function kE(){const{workspace:e}=Vt(),{views:t,loading:n}=Ld(),{submitEdit:r,submitEditSession:o,duplicate:i,remove:a}=t$(),{toast:l,showToast:u,dismissToast:f}=wr(),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,v]=m.useState(!1),[b,j]=m.useState(!1),[N,S]=m.useState(null);async function C(O,P){const{workspace:L,config:B}=AA(P,e??null);try{await Xl({name:O,workspace:L,config:B}),v(!1),u(`Created view "${O}"`)}catch(q){throw u(q instanceof Error?q.message:"Failed to create saved view"),q}}async function D(O,P){const{workspace:L,config:B}=$w(P,e??null);try{await Xl({name:O,workspace:L,config:B,entityType:"session"}),j(!1),u(`Created session view "${O}"`)}catch(q){throw u(q instanceof Error?q.message:"Failed to create session view"),q}}async function T(O,P,L){try{await r(O,P,L),S(null),u(`Updated view "${P}"`)}catch(B){throw u(B instanceof Error?B.message:"Failed to update saved view"),B}}async function R(O,P,L){try{await o(O,P,L),S(null),u(`Updated session view "${P}"`)}catch(B){throw u(B instanceof Error?B.message:"Failed to update session view"),B}}async function $(O){try{await i(O),u(`Duplicated "${O.name}"`)}catch(P){u(P instanceof Error?P.message:"Failed to duplicate saved view")}}async function _(){if(p){y(!0);try{await a(p),h(null)}catch(O){u(O instanceof Error?O.message:"Failed to delete saved view")}finally{y(!1)}}}const U=s.jsxs("button",{type:"button",onClick:()=>v(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[s.jsx(It,{className:"h-4 w-4"}),"Create view"]}),I=s.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(It,{className:"h-4 w-4"}),"Create session view"]}),V=(N==null?void 0:N.entityType)==="session";return s.jsxs("div",{className:"space-y-4",children:[s.jsx(kh,{title:"Saved Views",description:"Create a view here, or open, edit, and reuse views captured from any board.",actions:s.jsxs("div",{className:"flex items-center gap-2",children:[I,U]})}),n?s.jsx(jt,{label:"Loading saved views…"}):t.length===0?s.jsx(Nt,{title:"No saved views yet",description:"Create your first view here, or capture one from any assignments board.",actions:s.jsxs("div",{className:"flex items-center gap-2",children:[I,U]})}):s.jsx(Xe,{children:s.jsx("ul",{className:"divide-y divide-border/60",children:t.map(O=>s.jsx(hae,{view:O,onRequestDelete:()=>h(O),onRequestEdit:()=>S(O),onRequestDuplicate:()=>void $(O)},O.id))})}),s.jsx(n$,{open:k||!V&&N!==null,onOpenChange:O=>{O||(v(!1),V||S(null))},workspace:N&&!V?N.workspace:e??null,initialView:N&&!V?N:null,onSubmit:N&&!V?(O,P)=>T(N,O,P):C}),s.jsx(IA,{open:b||V&&N!==null,onOpenChange:O=>{O||(j(!1),V&&S(null))},workspace:N&&V?N.workspace:e??null,initialView:N&&V?N:null,onSubmit:N&&V?(O,P)=>R(N,O,P):D}),s.jsx(Ai,{open:p!==null,title:"Delete saved view?",description:p?`Delete '${p.name}'? Any Overview widgets referencing this view will become empty.`:"",confirmLabel:"Delete",loading:g,destructive:!0,onConfirm:_,onOpenChange:O=>{!O&&!g&&h(null)}}),s.jsx(Hr,{toast:l,onDismiss:f})]})}function hae({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:r}){const o=Ht(),i=()=>o(_A(e)),a=$A(e.config.filters),l=e.workspace?Dn(e.workspace):null,u=e.entityType??"assignment",f=u==="session",p=f?`limit: ${e.config.limit??"none"} · sort: ${e.config.sortField} ${e.config.sortDirection}`:null;return s.jsxs("li",{className:"flex flex-wrap items-center gap-3 py-3",children:[s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.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}),s.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border border-border/70 px-2 py-0.5 text-xs font-medium ${pae[u]??"bg-muted text-muted-foreground"}`,children:fae[u]??u}),!f&&s.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:dae[e.config.viewMode]}),l?s.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:l}):null]}),s.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[a,p?` · ${p}`:""]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx("button",{type:"button",onClick:i,className:"shell-action",children:"Open"}),s.jsx("button",{type:"button",onClick:n,className:"shell-action",children:"Edit"}),s.jsx("button",{type:"button",onClick:r,className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:t,className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})]})}const mae={kanban:"Kanban",list:"List",table:"Table"};function SE(){const{id:e,workspace:t}=Vt(),n=Ht(),{view:r,ready:o,error:i,refetch:a}=ji(e),{submitEdit:l,duplicate:u,remove:f}=t$(),{toast:p,showToast:h,dismissToast:g}=wr(),[y,k]=m.useState(!1),[v,b]=m.useState(!1),[j,N]=m.useState(!1);if(m.useEffect(()=>{!o||!r||(t??null)!==(r.workspace??null)&&n(_A(r),{replace:!0})},[o,r,t,n]),!o)return s.jsx(jt,{label:"Loading view…"});if(i)return s.jsxs("div",{className:"rounded-lg border border-border/60 bg-card/85 px-4 py-6 text-sm",children:[s.jsx("p",{className:"font-medium text-foreground",children:"Couldn't load view"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:i.message}),s.jsx("button",{type:"button",onClick:()=>a(),className:"shell-action mt-3",children:"Retry"})]});if(!r)return s.jsxs("div",{className:"space-y-3",children:[s.jsx(kh,{title:"View not found",description:"This saved view no longer exists."}),s.jsxs($e,{to:Hp(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(eh,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=r.workspace?Dn(r.workspace):null;async function C(R,$){const _=r;try{await l(_,R,$),k(!1),h(`Updated view "${R}"`)}catch(U){throw h(U instanceof Error?U.message:"Failed to update saved view"),U}}async function D(){const R=r;try{await u(R),h(`Duplicated "${R.name}"`)}catch($){h($ instanceof Error?$.message:"Failed to duplicate saved view")}}async function T(){const R=r;N(!0);try{await f(R),b(!1),n(Hp(R.workspace))}catch($){h($ instanceof Error?$.message:"Failed to delete saved view")}finally{N(!1)}}return s.jsxs("div",{className:"space-y-4",children:[s.jsxs($e,{to:Hp(r.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(eh,{className:"h-4 w-4"})," Saved Views"]}),s.jsx(kh,{title:r.name,description:$A(r.config.filters),actions:s.jsxs(s.Fragment,{children:[s.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:mae[r.config.viewMode]}),S?s.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,s.jsx("button",{type:"button",onClick:()=>k(!0),className:"shell-action",children:"Edit"}),s.jsx("button",{type:"button",onClick:()=>void D(),className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:()=>n(DA(r)),className:"shell-action",children:"Open on board"}),s.jsx("button",{type:"button",onClick:()=>b(!0),className:"shell-action border-destructive/40 text-destructive hover:bg-destructive/10",children:"Delete"})]})}),s.jsx(TA,{view:r}),y?s.jsx(n$,{open:y,onOpenChange:k,workspace:r.workspace,initialView:r,onSubmit:C}):null,s.jsx(Ai,{open:v,title:"Delete saved view?",description:`Delete '${r.name}'? Any Overview widgets referencing this view will become empty.`,confirmLabel:"Delete",loading:j,destructive:!0,onConfirm:T,onOpenChange:R=>{!R&&!j&&b(!1)}}),s.jsx(Hr,{toast:p,onDismiss:g})]})}function gae(){return s.jsx(dL,{children:s.jsx(az,{children:s.jsx(zM,{children:s.jsxs(Je,{element:s.jsx(Lz,{}),children:[s.jsx(Je,{path:"/",element:s.jsx($H,{})}),s.jsx(Je,{path:"/projects",element:s.jsx(NS,{})}),s.jsx(Je,{path:"/archive",element:s.jsx(GH,{})}),s.jsx(Je,{path:"/assignments",element:s.jsx(IN,{})}),s.jsx(Je,{path:"/assignments/new",element:s.jsx(FN,{})}),s.jsx(Je,{path:"/assignments/:id",element:s.jsx(XG,{})}),s.jsx(Je,{path:"/assignments/:id/edit",element:s.jsx(Iy,{})}),s.jsx(Je,{path:"/assignments/:id/plan/edit",element:s.jsx(My,{})}),s.jsx(Je,{path:"/assignments/:id/scratchpad/edit",element:s.jsx(Ly,{})}),s.jsx(Je,{path:"/assignments/:id/handoff/edit",element:s.jsx(Oy,{})}),s.jsx(Je,{path:"/assignments/:id/decision-record/edit",element:s.jsx(Fy,{})}),s.jsx(Je,{path:"/servers",element:s.jsx(BN,{})}),s.jsx(Je,{path:"/inventories",element:s.jsx(UN,{})}),s.jsx(Je,{path:"/schedules",element:s.jsx(BY,{})}),s.jsx(Je,{path:"/usage",element:s.jsx(HN,{})}),s.jsx(Je,{path:"/agent-sessions",element:s.jsx(VN,{})}),s.jsx(Je,{path:"/playbooks",element:s.jsx(qY,{})}),s.jsx(Je,{path:"/playbooks/create",element:s.jsx(GY,{})}),s.jsx(Je,{path:"/playbooks/:slug",element:s.jsx(KY,{})}),s.jsx(Je,{path:"/playbooks/:slug/edit",element:s.jsx(YY,{})}),s.jsx(Je,{path:"/memories",element:s.jsx(XY,{})}),s.jsx(Je,{path:"/memories/new",element:s.jsx(JY,{})}),s.jsx(Je,{path:"/projects/:slug/memories/:itemSlug",element:s.jsx(QY,{})}),s.jsx(Je,{path:"/projects/:slug/memories/:itemSlug/edit",element:s.jsx(ZY,{})}),s.jsx(Je,{path:"/resources",element:s.jsx(eX,{})}),s.jsx(Je,{path:"/resources/new",element:s.jsx(nX,{})}),s.jsx(Je,{path:"/projects/:slug/resources/:itemSlug",element:s.jsx(tX,{})}),s.jsx(Je,{path:"/projects/:slug/resources/:itemSlug/edit",element:s.jsx(rX,{})}),s.jsx(Je,{path:"/todos",element:s.jsx(rae,{})}),s.jsx(Je,{path:"/views",element:s.jsx(kE,{})}),s.jsx(Je,{path:"/views/:id",element:s.jsx(SE,{})}),s.jsx(Je,{path:"/help",element:s.jsx(MH,{})}),s.jsx(Je,{path:"/settings",element:s.jsx(PX,{})}),s.jsx(Je,{path:"/workflow",element:s.jsx(nae,{})}),s.jsx(Je,{path:"/create/project",element:s.jsx(LN,{})}),s.jsx(Je,{path:"/projects/:slug",element:s.jsx(CN,{})}),s.jsx(Je,{path:"/projects/:slug/edit",element:s.jsx(zN,{})}),s.jsx(Je,{path:"/projects/:slug/create/assignment",element:s.jsx(ON,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug",element:s.jsx(PN,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug/edit",element:s.jsx(Iy,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(My,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Ly,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(Oy,{})}),s.jsx(Je,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Fy,{})}),s.jsx(Je,{path:"/w/:workspace/projects",element:s.jsx(NS,{})}),s.jsx(Je,{path:"/w/:workspace/assignments",element:s.jsx(IN,{})}),s.jsx(Je,{path:"/w/:workspace/assignments/new",element:s.jsx(FN,{})}),s.jsx(Je,{path:"/w/:workspace/servers",element:s.jsx(BN,{})}),s.jsx(Je,{path:"/w/:workspace/inventories",element:s.jsx(UN,{})}),s.jsx(Je,{path:"/w/:workspace/usage",element:s.jsx(HN,{})}),s.jsx(Je,{path:"/w/:workspace/agent-sessions",element:s.jsx(VN,{})}),s.jsx(Je,{path:"/w/:workspace/todos",element:s.jsx(lae,{})}),s.jsx(Je,{path:"/w/:workspace/views",element:s.jsx(kE,{})}),s.jsx(Je,{path:"/w/:workspace/views/:id",element:s.jsx(SE,{})}),s.jsx(Je,{path:"/w/:workspace/create/project",element:s.jsx(LN,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug",element:s.jsx(CN,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/edit",element:s.jsx(zN,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/create/assignment",element:s.jsx(ON,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:s.jsx(PN,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:s.jsx(Iy,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(My,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Ly,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx(Oy,{})}),s.jsx(Je,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Fy,{})})]})})})})}eO();zI.createRoot(document.getElementById("root")).render(s.jsx(m.StrictMode,{children:s.jsx(tO,{children:s.jsx(gae,{})})}));export{Kd as C,yr as R,b9 as _,Gu as a,yae as b,y0 as d,o3 as e,kd as g,bae as h,Us as i,l3 as n,pZ as r,Lr as s};