syntaur 0.57.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dashboard/dist/assets/{_basePickBy-JSKTFkEa.js → _basePickBy-BSxL8bBc.js} +1 -1
- package/dashboard/dist/assets/{_baseUniq-B4THfRv6.js → _baseUniq-1f9ohhNp.js} +1 -1
- package/dashboard/dist/assets/{arc-BT5oCPaC.js → arc-DlPK9j9g.js} +1 -1
- package/dashboard/dist/assets/{architectureDiagram-2XIMDMQ5-C0wRHwPD.js → architectureDiagram-2XIMDMQ5-CcV5llaa.js} +1 -1
- package/dashboard/dist/assets/{blockDiagram-WCTKOSBZ-yMj3_K19.js → blockDiagram-WCTKOSBZ-DGkYzINJ.js} +1 -1
- package/dashboard/dist/assets/{c4Diagram-IC4MRINW-6fr_jElW.js → c4Diagram-IC4MRINW-CI4Z5c6N.js} +1 -1
- package/dashboard/dist/assets/channel-Qr2eMXkR.js +1 -0
- package/dashboard/dist/assets/{chunk-4BX2VUAB-BS0AdM9N.js → chunk-4BX2VUAB-C8KasqJp.js} +1 -1
- package/dashboard/dist/assets/{chunk-55IACEB6-Bf3cMgj4.js → chunk-55IACEB6-CgAEilyk.js} +1 -1
- package/dashboard/dist/assets/{chunk-FMBD7UC4-BxhOy53m.js → chunk-FMBD7UC4-DsNiby6p.js} +1 -1
- package/dashboard/dist/assets/{chunk-JSJVCQXG-Da4w_8jA.js → chunk-JSJVCQXG-4eCDFRIx.js} +1 -1
- package/dashboard/dist/assets/{chunk-KX2RTZJC-p3BnTwvF.js → chunk-KX2RTZJC-DHia_zig.js} +1 -1
- package/dashboard/dist/assets/{chunk-NQ4KR5QH-DfvY-FfQ.js → chunk-NQ4KR5QH-V-IiQwer.js} +1 -1
- package/dashboard/dist/assets/{chunk-QZHKN3VN-BY_yeD01.js → chunk-QZHKN3VN-BXTS8E6J.js} +1 -1
- package/dashboard/dist/assets/{chunk-WL4C6EOR-yQKlkPsr.js → chunk-WL4C6EOR-BuLlUWn0.js} +1 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-DHkm1twH.js +1 -0
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-DHkm1twH.js +1 -0
- package/dashboard/dist/assets/clone-ChZeNkMI.js +1 -0
- package/dashboard/dist/assets/{cose-bilkent-S5V4N54A-CDoLPu4r.js → cose-bilkent-S5V4N54A-B1M1ENTo.js} +1 -1
- package/dashboard/dist/assets/{dagre-KLK3FWXG-BsEV2YI1.js → dagre-KLK3FWXG-3pyNBzWY.js} +1 -1
- package/dashboard/dist/assets/{diagram-E7M64L7V-CF2uTCw-.js → diagram-E7M64L7V-B5-5pbKh.js} +1 -1
- package/dashboard/dist/assets/{diagram-IFDJBPK2-CCbV7q-H.js → diagram-IFDJBPK2-CTx5NFFi.js} +1 -1
- package/dashboard/dist/assets/{diagram-P4PSJMXO-C-hmCZ82.js → diagram-P4PSJMXO-B5KRvZqb.js} +1 -1
- package/dashboard/dist/assets/{erDiagram-INFDFZHY-Bqmd6M31.js → erDiagram-INFDFZHY-BhVWsRrc.js} +1 -1
- package/dashboard/dist/assets/{flowDiagram-PKNHOUZH-BoHMjR8s.js → flowDiagram-PKNHOUZH-CuoB0thO.js} +1 -1
- package/dashboard/dist/assets/{ganttDiagram-A5KZAMGK-Bwi2K6t0.js → ganttDiagram-A5KZAMGK-yNNalQY9.js} +1 -1
- package/dashboard/dist/assets/{gitGraphDiagram-K3NZZRJ6-BLg_41tI.js → gitGraphDiagram-K3NZZRJ6-DfEhHzOH.js} +1 -1
- package/dashboard/dist/assets/{graph-D5SqATbG.js → graph-NaP7lLuY.js} +1 -1
- package/dashboard/dist/assets/index-BG_Ed2-k.js +644 -0
- package/dashboard/dist/assets/{infoDiagram-LFFYTUFH-MQGu_WQh.js → infoDiagram-LFFYTUFH-CDAMAxDE.js} +1 -1
- package/dashboard/dist/assets/{ishikawaDiagram-PHBUUO56-Cq2VOOGw.js → ishikawaDiagram-PHBUUO56-DMRl5xeW.js} +1 -1
- package/dashboard/dist/assets/{journeyDiagram-4ABVD52K-DMgBiVbw.js → journeyDiagram-4ABVD52K-DtuQQjW_.js} +1 -1
- package/dashboard/dist/assets/{kanban-definition-K7BYSVSG-CW553HfT.js → kanban-definition-K7BYSVSG-DYGt44vU.js} +1 -1
- package/dashboard/dist/assets/{layout-CY_IT3u3.js → layout-B9sS0Gu9.js} +1 -1
- package/dashboard/dist/assets/{linear-BwR3oULZ.js → linear-DQcNFWB2.js} +1 -1
- package/dashboard/dist/assets/{mermaid.core-CmEGzmWo.js → mermaid.core-CzhsZ1QZ.js} +4 -4
- package/dashboard/dist/assets/{mindmap-definition-YRQLILUH-D__wNWPY.js → mindmap-definition-YRQLILUH-CL8mKZYJ.js} +1 -1
- package/dashboard/dist/assets/{pieDiagram-SKSYHLDU-BsFl-giQ.js → pieDiagram-SKSYHLDU-BULUJrhI.js} +1 -1
- package/dashboard/dist/assets/{quadrantDiagram-337W2JSQ-C-F2YU1C.js → quadrantDiagram-337W2JSQ-CWQC3mf-.js} +1 -1
- package/dashboard/dist/assets/{requirementDiagram-Z7DCOOCP-C0_TmWRh.js → requirementDiagram-Z7DCOOCP-CYadvMn7.js} +1 -1
- package/dashboard/dist/assets/{sankeyDiagram-WA2Y5GQK-DpoaSHiD.js → sankeyDiagram-WA2Y5GQK-e2AhGJiF.js} +1 -1
- package/dashboard/dist/assets/{sequenceDiagram-2WXFIKYE-DBb9oieZ.js → sequenceDiagram-2WXFIKYE-CeWKKFdg.js} +1 -1
- package/dashboard/dist/assets/{stateDiagram-RAJIS63D-Cw5xaaAs.js → stateDiagram-RAJIS63D-BvN-wCps.js} +1 -1
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BV7kxiIj.js +1 -0
- package/dashboard/dist/assets/{timeline-definition-YZTLITO2-rOhPVhqR.js → timeline-definition-YZTLITO2-DOLRfgbL.js} +1 -1
- package/dashboard/dist/assets/{treemap-KZPCXAKY-CD-TOoiS.js → treemap-KZPCXAKY-VqhsqWzF.js} +1 -1
- package/dashboard/dist/assets/{vennDiagram-LZ73GAT5-BH78k9Wk.js → vennDiagram-LZ73GAT5-Dt-knC6b.js} +1 -1
- package/dashboard/dist/assets/{xychartDiagram-JWTSCODW-1hqiJxk_.js → xychartDiagram-JWTSCODW-A3enOtVP.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/dashboard/server.js +208 -131
- package/dist/dashboard/server.js.map +1 -1
- package/dist/index.js +584 -591
- package/dist/index.js.map +1 -1
- package/dist/launch/index.js.map +1 -1
- package/package.json +1 -1
- package/platforms/claude-code/.claude-plugin/plugin.json +1 -1
- package/platforms/codex/.codex-plugin/plugin.json +1 -1
- package/platforms/hermes/plugins/syntaur/__pycache__/__init__.cpython-312.pyc +0 -0
- package/platforms/hermes/plugins/syntaur/__pycache__/boundary.cpython-312.pyc +0 -0
- package/dashboard/dist/assets/channel-BZWZQgJF.js +0 -1
- package/dashboard/dist/assets/classDiagram-VBA2DB6C-obLZNHbe.js +0 -1
- package/dashboard/dist/assets/classDiagram-v2-RAHNMMFH-obLZNHbe.js +0 -1
- package/dashboard/dist/assets/clone-gWuoHRfO.js +0 -1
- package/dashboard/dist/assets/index-CQaTQf_I.js +0 -639
- package/dashboard/dist/assets/stateDiagram-v2-FVOUBMTO-BpeHnq6R.js +0 -1
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
var NI=Object.defineProperty;var CI=(e,t,n)=>t in e?NI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Px=(e,t,n)=>CI(e,typeof t!="symbol"?t+"":t,n);function EI(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 bd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function oae(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 _x={exports:{}},iu={},Dx={exports:{}},jt={};/**
|
|
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 Kk;function TI(){if(Kk)return jt;Kk=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"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.iterator;function g(W){return W===null||typeof W!="object"?null:(W=h&&W[h]||W["@@iterator"],typeof W=="function"?W:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,w={};function b(W,Y,q){this.props=W,this.context=Y,this.refs=w,this.updater=q||y}b.prototype.isReactComponent={},b.prototype.setState=function(W,Y){if(typeof W!="object"&&typeof W!="function"&&W!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,Y,"setState")},b.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function j(){}j.prototype=b.prototype;function N(W,Y,q){this.props=W,this.context=Y,this.refs=w,this.updater=q||y}var S=N.prototype=new j;S.constructor=N,k(S,b.prototype),S.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,T={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function D(W,Y,q){var J,ne={},Q=null,le=null;if(Y!=null)for(J in Y.ref!==void 0&&(le=Y.ref),Y.key!==void 0&&(Q=""+Y.key),Y)I.call(Y,J)&&!R.hasOwnProperty(J)&&(ne[J]=Y[J]);var te=arguments.length-2;if(te===1)ne.children=q;else if(1<te){for(var pe=Array(te),be=0;be<te;be++)pe[be]=arguments[be+2];ne.children=pe}if(W&&W.defaultProps)for(J in te=W.defaultProps,te)ne[J]===void 0&&(ne[J]=te[J]);return{$$typeof:e,type:W,key:Q,ref:le,props:ne,_owner:T.current}}function _(W,Y){return{$$typeof:e,type:W.type,key:Y,ref:W.ref,props:W.props,_owner:W._owner}}function B(W){return typeof W=="object"&&W!==null&&W.$$typeof===e}function $(W){var Y={"=":"=0",":":"=2"};return"$"+W.replace(/[=:]/g,function(q){return Y[q]})}var O=/\/+/g;function z(W,Y){return typeof W=="object"&&W!==null&&W.key!=null?$(""+W.key):Y.toString(36)}function A(W,Y,q,J,ne){var Q=typeof W;(Q==="undefined"||Q==="boolean")&&(W=null);var le=!1;if(W===null)le=!0;else switch(Q){case"string":case"number":le=!0;break;case"object":switch(W.$$typeof){case e:case t:le=!0}}if(le)return le=W,ne=ne(le),W=J===""?"."+z(le,0):J,C(ne)?(q="",W!=null&&(q=W.replace(O,"$&/")+"/"),A(ne,Y,q,"",function(be){return be})):ne!=null&&(B(ne)&&(ne=_(ne,q+(!ne.key||le&&le.key===ne.key?"":(""+ne.key).replace(O,"$&/")+"/")+W)),Y.push(ne)),1;if(le=0,J=J===""?".":J+":",C(W))for(var te=0;te<W.length;te++){Q=W[te];var pe=J+z(Q,te);le+=A(Q,Y,q,pe,ne)}else if(pe=g(W),typeof pe=="function")for(W=pe.call(W),te=0;!(Q=W.next()).done;)Q=Q.value,pe=J+z(Q,te++),le+=A(Q,Y,q,pe,ne);else if(Q==="object")throw Y=String(W),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(W).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return le}function F(W,Y,q){if(W==null)return W;var J=[],ne=0;return A(W,J,"","",function(Q){return Y.call(q,Q,ne++)}),J}function U(W){if(W._status===-1){var Y=W._result;Y=Y(),Y.then(function(q){(W._status===0||W._status===-1)&&(W._status=1,W._result=q)},function(q){(W._status===0||W._status===-1)&&(W._status=2,W._result=q)}),W._status===-1&&(W._status=0,W._result=Y)}if(W._status===1)return W._result.default;throw W._result}var H={current:null},L={transition:null},V={ReactCurrentDispatcher:H,ReactCurrentBatchConfig:L,ReactCurrentOwner:T};function M(){throw Error("act(...) is not supported in production builds of React.")}return jt.Children={map:F,forEach:function(W,Y,q){F(W,function(){Y.apply(this,arguments)},q)},count:function(W){var Y=0;return F(W,function(){Y++}),Y},toArray:function(W){return F(W,function(Y){return Y})||[]},only:function(W){if(!B(W))throw Error("React.Children.only expected to receive a single React element child.");return W}},jt.Component=b,jt.Fragment=n,jt.Profiler=o,jt.PureComponent=N,jt.StrictMode=r,jt.Suspense=d,jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V,jt.act=M,jt.cloneElement=function(W,Y,q){if(W==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+W+".");var J=k({},W.props),ne=W.key,Q=W.ref,le=W._owner;if(Y!=null){if(Y.ref!==void 0&&(Q=Y.ref,le=T.current),Y.key!==void 0&&(ne=""+Y.key),W.type&&W.type.defaultProps)var te=W.type.defaultProps;for(pe in Y)I.call(Y,pe)&&!R.hasOwnProperty(pe)&&(J[pe]=Y[pe]===void 0&&te!==void 0?te[pe]:Y[pe])}var pe=arguments.length-2;if(pe===1)J.children=q;else if(1<pe){te=Array(pe);for(var be=0;be<pe;be++)te[be]=arguments[be+2];J.children=te}return{$$typeof:e,type:W.type,key:ne,ref:Q,props:J,_owner:le}},jt.createContext=function(W){return W={$$typeof:a,_currentValue:W,_currentValue2:W,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},W.Provider={$$typeof:i,_context:W},W.Consumer=W},jt.createElement=D,jt.createFactory=function(W){var Y=D.bind(null,W);return Y.type=W,Y},jt.createRef=function(){return{current:null}},jt.forwardRef=function(W){return{$$typeof:l,render:W}},jt.isValidElement=B,jt.lazy=function(W){return{$$typeof:p,_payload:{_status:-1,_result:W},_init:U}},jt.memo=function(W,Y){return{$$typeof:f,type:W,compare:Y===void 0?null:Y}},jt.startTransition=function(W){var Y=L.transition;L.transition={};try{W()}finally{L.transition=Y}},jt.unstable_act=M,jt.useCallback=function(W,Y){return H.current.useCallback(W,Y)},jt.useContext=function(W){return H.current.useContext(W)},jt.useDebugValue=function(){},jt.useDeferredValue=function(W){return H.current.useDeferredValue(W)},jt.useEffect=function(W,Y){return H.current.useEffect(W,Y)},jt.useId=function(){return H.current.useId()},jt.useImperativeHandle=function(W,Y,q){return H.current.useImperativeHandle(W,Y,q)},jt.useInsertionEffect=function(W,Y){return H.current.useInsertionEffect(W,Y)},jt.useLayoutEffect=function(W,Y){return H.current.useLayoutEffect(W,Y)},jt.useMemo=function(W,Y){return H.current.useMemo(W,Y)},jt.useReducer=function(W,Y,q){return H.current.useReducer(W,Y,q)},jt.useRef=function(W){return H.current.useRef(W)},jt.useState=function(W){return H.current.useState(W)},jt.useSyncExternalStore=function(W,Y,q){return H.current.useSyncExternalStore(W,Y,q)},jt.useTransition=function(){return H.current.useTransition()},jt.version="18.3.1",jt}var Gk;function vd(){return Gk||(Gk=1,Dx.exports=TI()),Dx.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 Yk;function RI(){if(Yk)return iu;Yk=1;var e=vd(),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,d,f){var p,h={},g=null,y=null;f!==void 0&&(g=""+f),d.key!==void 0&&(g=""+d.key),d.ref!==void 0&&(y=d.ref);for(p in d)r.call(d,p)&&!i.hasOwnProperty(p)&&(h[p]=d[p]);if(l&&l.defaultProps)for(p in d=l.defaultProps,d)h[p]===void 0&&(h[p]=d[p]);return{$$typeof:t,type:l,key:g,ref:y,props:h,_owner:o.current}}return iu.Fragment=n,iu.jsx=a,iu.jsxs=a,iu}var Xk;function AI(){return Xk||(Xk=1,_x.exports=RI()),_x.exports}var s=AI(),m=vd();const Mt=bd(m),wE=EI({__proto__:null,default:Mt},[m]);var Gf={},$x={exports:{}},fr={},Ix={exports:{}},Mx={};/**
|
|
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 Qk;function PI(){return Qk||(Qk=1,(function(e){function t(L,V){var M=L.length;L.push(V);e:for(;0<M;){var W=M-1>>>1,Y=L[W];if(0<o(Y,V))L[W]=V,L[M]=Y,M=W;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var V=L[0],M=L.pop();if(M!==V){L[0]=M;e:for(var W=0,Y=L.length,q=Y>>>1;W<q;){var J=2*(W+1)-1,ne=L[J],Q=J+1,le=L[Q];if(0>o(ne,M))Q<Y&&0>o(le,ne)?(L[W]=le,L[Q]=M,W=Q):(L[W]=ne,L[J]=M,W=J);else if(Q<Y&&0>o(le,M))L[W]=le,L[Q]=M,W=Q;else break e}}return V}function o(L,V){var M=L.sortIndex-V.sortIndex;return M!==0?M:L.id-V.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 d=[],f=[],p=1,h=null,g=3,y=!1,k=!1,w=!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(L){for(var V=n(f);V!==null;){if(V.callback===null)r(f);else if(V.startTime<=L)r(f),V.sortIndex=V.expirationTime,t(d,V);else break;V=n(f)}}function C(L){if(w=!1,S(L),!k)if(n(d)!==null)k=!0,U(I);else{var V=n(f);V!==null&&H(C,V.startTime-L)}}function I(L,V){k=!1,w&&(w=!1,j(D),D=-1),y=!0;var M=g;try{for(S(V),h=n(d);h!==null&&(!(h.expirationTime>V)||L&&!$());){var W=h.callback;if(typeof W=="function"){h.callback=null,g=h.priorityLevel;var Y=W(h.expirationTime<=V);V=e.unstable_now(),typeof Y=="function"?h.callback=Y:h===n(d)&&r(d),S(V)}else r(d);h=n(d)}if(h!==null)var q=!0;else{var J=n(f);J!==null&&H(C,J.startTime-V),q=!1}return q}finally{h=null,g=M,y=!1}}var T=!1,R=null,D=-1,_=5,B=-1;function $(){return!(e.unstable_now()-B<_)}function O(){if(R!==null){var L=e.unstable_now();B=L;var V=!0;try{V=R(!0,L)}finally{V?z():(T=!1,R=null)}}else T=!1}var z;if(typeof N=="function")z=function(){N(O)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,F=A.port2;A.port1.onmessage=O,z=function(){F.postMessage(null)}}else z=function(){b(O,0)};function U(L){R=L,T||(T=!0,z())}function H(L,V){D=b(function(){L(e.unstable_now())},V)}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(L){L.callback=null},e.unstable_continueExecution=function(){k||y||(k=!0,U(I))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):_=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(L){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var M=g;g=V;try{return L()}finally{g=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,V){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var M=g;g=L;try{return V()}finally{g=M}},e.unstable_scheduleCallback=function(L,V,M){var W=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?W+M:W):M=W,L){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=M+Y,L={id:p++,callback:V,priorityLevel:L,startTime:M,expirationTime:Y,sortIndex:-1},M>W?(L.sortIndex=M,t(f,L),n(d)===null&&L===n(f)&&(w?(j(D),D=-1):w=!0,H(C,M-W))):(L.sortIndex=Y,t(d,L),k||y||(k=!0,U(I))),L},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(L){var V=g;return function(){var M=g;g=V;try{return L.apply(this,arguments)}finally{g=M}}}})(Mx)),Mx}var Jk;function _I(){return Jk||(Jk=1,Ix.exports=PI()),Ix.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 Zk;function DI(){if(Zk)return fr;Zk=1;var e=vd(),t=_I();function n(c){for(var u="https://reactjs.org/docs/error-decoder.html?invariant="+c,x=1;x<arguments.length;x++)u+="&args[]="+encodeURIComponent(arguments[x]);return"Minified React error #"+c+"; visit "+u+" 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,u){a(c,u),a(c+"Capture",u)}function a(c,u){for(o[c]=u,c=0;c<u.length;c++)r.add(u[c])}var l=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=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 d.call(h,c)?!0:d.call(p,c)?!1:f.test(c)?h[c]=!0:(p[c]=!0,!1)}function y(c,u,x,v){if(x!==null&&x.type===0)return!1;switch(typeof u){case"function":case"symbol":return!0;case"boolean":return v?!1:x!==null?!x.acceptsBooleans:(c=c.toLowerCase().slice(0,5),c!=="data-"&&c!=="aria-");default:return!1}}function k(c,u,x,v){if(u===null||typeof u>"u"||y(c,u,x,v))return!0;if(v)return!1;if(x!==null)switch(x.type){case 3:return!u;case 4:return u===!1;case 5:return isNaN(u);case 6:return isNaN(u)||1>u}return!1}function w(c,u,x,v,E,P,K){this.acceptsBooleans=u===2||u===3||u===4,this.attributeName=v,this.attributeNamespace=E,this.mustUseProperty=x,this.propertyName=c,this.type=u,this.sanitizeURL=P,this.removeEmptyString=K}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(c){b[c]=new w(c,0,!1,c,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(c){var u=c[0];b[u]=new w(u,1,!1,c[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(c){b[c]=new w(c,2,!1,c.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(c){b[c]=new w(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 w(c,3,!1,c.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(c){b[c]=new w(c,3,!0,c,null,!1,!1)}),["capture","download"].forEach(function(c){b[c]=new w(c,4,!1,c,null,!1,!1)}),["cols","rows","size","span"].forEach(function(c){b[c]=new w(c,6,!1,c,null,!1,!1)}),["rowSpan","start"].forEach(function(c){b[c]=new w(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 u=c.replace(j,N);b[u]=new w(u,1,!1,c,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(c){var u=c.replace(j,N);b[u]=new w(u,1,!1,c,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(c){var u=c.replace(j,N);b[u]=new w(u,1,!1,c,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(c){b[c]=new w(c,1,!1,c.toLowerCase(),null,!1,!1)}),b.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(c){b[c]=new w(c,1,!1,c.toLowerCase(),null,!0,!0)});function S(c,u,x,v){var E=b.hasOwnProperty(u)?b[u]:null;(E!==null?E.type!==0:v||!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(k(u,x,E,v)&&(x=null),v||E===null?g(u)&&(x===null?c.removeAttribute(u):c.setAttribute(u,""+x)):E.mustUseProperty?c[E.propertyName]=x===null?E.type===3?!1:"":x:(u=E.attributeName,v=E.attributeNamespace,x===null?c.removeAttribute(u):(E=E.type,x=E===3||E===4&&x===!0?"":""+x,v?c.setAttributeNS(v,u,x):c.setAttribute(u,x))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),T=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),B=Symbol.for("react.provider"),$=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),H=Symbol.for("react.offscreen"),L=Symbol.iterator;function V(c){return c===null||typeof c!="object"?null:(c=L&&c[L]||c["@@iterator"],typeof c=="function"?c:null)}var M=Object.assign,W;function Y(c){if(W===void 0)try{throw Error()}catch(x){var u=x.stack.trim().match(/\n( *(at )?)/);W=u&&u[1]||""}return`
|
|
34
|
+
`+W+c}var q=!1;function J(c,u){if(!c||q)return"";q=!0;var x=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(ge){var v=ge}Reflect.construct(c,[],u)}else{try{u.call()}catch(ge){v=ge}c.call(u.prototype)}else{try{throw Error()}catch(ge){v=ge}c()}}catch(ge){if(ge&&v&&typeof ge.stack=="string"){for(var E=ge.stack.split(`
|
|
35
|
+
`),P=v.stack.split(`
|
|
36
|
+
`),K=E.length-1,X=P.length-1;1<=K&&0<=X&&E[K]!==P[X];)X--;for(;1<=K&&0<=X;K--,X--)if(E[K]!==P[X]){if(K!==1||X!==1)do if(K--,X--,0>X||E[K]!==P[X]){var re=`
|
|
37
|
+
`+E[K].replace(" at new "," at ");return c.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",c.displayName)),re}while(1<=K&&0<=X);break}}}finally{q=!1,Error.prepareStackTrace=x}return(c=c?c.displayName||c.name:"")?Y(c):""}function ne(c){switch(c.tag){case 5:return Y(c.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return c=J(c.type,!1),c;case 11:return c=J(c.type.render,!1),c;case 1:return c=J(c.type,!0),c;default:return""}}function Q(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 D:return"StrictMode";case z:return"Suspense";case A:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case $:return(c.displayName||"Context")+".Consumer";case B:return(c._context.displayName||"Context")+".Provider";case O:var u=c.render;return c=c.displayName,c||(c=u.displayName||u.name||"",c=c!==""?"ForwardRef("+c+")":"ForwardRef"),c;case F:return u=c.displayName||null,u!==null?u:Q(c.type)||"Memo";case U:u=c._payload,c=c._init;try{return Q(c(u))}catch{}}return null}function le(c){var u=c.type;switch(c.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return c=u.render,c=c.displayName||c.name||"",u.displayName||(c!==""?"ForwardRef("+c+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Q(u);case 8:return u===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 u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function te(c){switch(typeof c){case"boolean":case"number":case"string":case"undefined":return c;case"object":return c;default:return""}}function pe(c){var u=c.type;return(c=c.nodeName)&&c.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function be(c){var u=pe(c)?"checked":"value",x=Object.getOwnPropertyDescriptor(c.constructor.prototype,u),v=""+c[u];if(!c.hasOwnProperty(u)&&typeof x<"u"&&typeof x.get=="function"&&typeof x.set=="function"){var E=x.get,P=x.set;return Object.defineProperty(c,u,{configurable:!0,get:function(){return E.call(this)},set:function(K){v=""+K,P.call(this,K)}}),Object.defineProperty(c,u,{enumerable:x.enumerable}),{getValue:function(){return v},setValue:function(K){v=""+K},stopTracking:function(){c._valueTracker=null,delete c[u]}}}}function Ee(c){c._valueTracker||(c._valueTracker=be(c))}function Te(c){if(!c)return!1;var u=c._valueTracker;if(!u)return!0;var x=u.getValue(),v="";return c&&(v=pe(c)?c.checked?"true":"false":c.value),c=v,c!==x?(u.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 Ue(c,u){var x=u.checked;return M({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:x??c._wrapperState.initialChecked})}function oe(c,u){var x=u.defaultValue==null?"":u.defaultValue,v=u.checked!=null?u.checked:u.defaultChecked;x=te(u.value!=null?u.value:x),c._wrapperState={initialChecked:v,initialValue:x,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function je(c,u){u=u.checked,u!=null&&S(c,"checked",u,!1)}function Se(c,u){je(c,u);var x=te(u.value),v=u.type;if(x!=null)v==="number"?(x===0&&c.value===""||c.value!=x)&&(c.value=""+x):c.value!==""+x&&(c.value=""+x);else if(v==="submit"||v==="reset"){c.removeAttribute("value");return}u.hasOwnProperty("value")?ze(c,u.type,x):u.hasOwnProperty("defaultValue")&&ze(c,u.type,te(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(c.defaultChecked=!!u.defaultChecked)}function De(c,u,x){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var v=u.type;if(!(v!=="submit"&&v!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+c._wrapperState.initialValue,x||u===c.value||(c.value=u),c.defaultValue=u}x=c.name,x!==""&&(c.name=""),c.defaultChecked=!!c._wrapperState.initialChecked,x!==""&&(c.name=x)}function ze(c,u,x){(u!=="number"||ke(c.ownerDocument)!==c)&&(x==null?c.defaultValue=""+c._wrapperState.initialValue:c.defaultValue!==""+x&&(c.defaultValue=""+x))}var Ye=Array.isArray;function Oe(c,u,x,v){if(c=c.options,u){u={};for(var E=0;E<x.length;E++)u["$"+x[E]]=!0;for(x=0;x<c.length;x++)E=u.hasOwnProperty("$"+c[x].value),c[x].selected!==E&&(c[x].selected=E),E&&v&&(c[x].defaultSelected=!0)}else{for(x=""+te(x),u=null,E=0;E<c.length;E++){if(c[E].value===x){c[E].selected=!0,v&&(c[E].defaultSelected=!0);return}u!==null||c[E].disabled||(u=c[E])}u!==null&&(u.selected=!0)}}function nt(c,u){if(u.dangerouslySetInnerHTML!=null)throw Error(n(91));return M({},u,{value:void 0,defaultValue:void 0,children:""+c._wrapperState.initialValue})}function wt(c,u){var x=u.value;if(x==null){if(x=u.children,u=u.defaultValue,x!=null){if(u!=null)throw Error(n(92));if(Ye(x)){if(1<x.length)throw Error(n(93));x=x[0]}u=x}u==null&&(u=""),x=u}c._wrapperState={initialValue:te(x)}}function it(c,u){var x=te(u.value),v=te(u.defaultValue);x!=null&&(x=""+x,x!==c.value&&(c.value=x),u.defaultValue==null&&c.defaultValue!==x&&(c.defaultValue=x)),v!=null&&(c.defaultValue=""+v)}function st(c){var u=c.textContent;u===c._wrapperState.initialValue&&u!==""&&u!==null&&(c.value=u)}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 ee(c,u){return c==null||c==="http://www.w3.org/1999/xhtml"?ce(u):c==="http://www.w3.org/2000/svg"&&u==="foreignObject"?"http://www.w3.org/1999/xhtml":c}var xe,ie=(function(c){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(u,x,v,E){MSApp.execUnsafeLocalFunction(function(){return c(u,x,v,E)})}:c})(function(c,u){if(c.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in c)c.innerHTML=u;else{for(xe=xe||document.createElement("div"),xe.innerHTML="<svg>"+u.valueOf().toString()+"</svg>",u=xe.firstChild;c.firstChild;)c.removeChild(c.firstChild);for(;u.firstChild;)c.appendChild(u.firstChild)}});function we(c,u){if(u){var x=c.firstChild;if(x&&x===c.lastChild&&x.nodeType===3){x.nodeValue=u;return}}c.textContent=u}var $e={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},Ce=["Webkit","ms","Moz","O"];Object.keys($e).forEach(function(c){Ce.forEach(function(u){u=u+c.charAt(0).toUpperCase()+c.substring(1),$e[u]=$e[c]})});function se(c,u,x){return u==null||typeof u=="boolean"||u===""?"":x||typeof u!="number"||u===0||$e.hasOwnProperty(c)&&$e[c]?(""+u).trim():u+"px"}function me(c,u){c=c.style;for(var x in u)if(u.hasOwnProperty(x)){var v=x.indexOf("--")===0,E=se(x,u[x],v);x==="float"&&(x="cssFloat"),v?c.setProperty(x,E):c[x]=E}}var Pe=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 qe(c,u){if(u){if(Pe[c]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,c));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function de(c,u){if(c.indexOf("-")===-1)return typeof u.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 pt=null;function yt(c){return c=c.target||c.srcElement||window,c.correspondingUseElement&&(c=c.correspondingUseElement),c.nodeType===3?c.parentNode:c}var St=null,ct=null,ht=null;function Nt(c){if(c=Wc(c)){if(typeof St!="function")throw Error(n(280));var u=c.stateNode;u&&(u=cf(u),St(c.stateNode,c.type,u))}}function ye(c){ct?ht?ht.push(c):ht=[c]:ct=c}function Ve(){if(ct){var c=ct,u=ht;if(ht=ct=null,Nt(c),u)for(c=0;c<u.length;c++)Nt(u[c])}}function Je(c,u){return c(u)}function Ft(){}var zt=!1;function hn(c,u,x){if(zt)return c(u,x);zt=!0;try{return Je(c,u,x)}finally{zt=!1,(ct!==null||ht!==null)&&(Ft(),Ve())}}function Et(c,u){var x=c.stateNode;if(x===null)return null;var v=cf(x);if(v===null)return null;x=v[u];e:switch(u){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(v=!v.disabled)||(c=c.type,v=!(c==="button"||c==="input"||c==="select"||c==="textarea")),c=!v;break e;default:c=!1}if(c)return null;if(x&&typeof x!="function")throw Error(n(231,u,typeof x));return x}var $n=!1;if(l)try{var Tt={};Object.defineProperty(Tt,"passive",{get:function(){$n=!0}}),window.addEventListener("test",Tt,Tt),window.removeEventListener("test",Tt,Tt)}catch{$n=!1}function ue(c,u,x,v,E,P,K,X,re){var ge=Array.prototype.slice.call(arguments,3);try{u.apply(x,ge)}catch(Ae){this.onError(Ae)}}var Be=!1,et=null,bt=!1,Kn=null,wr={onError:function(c){Be=!0,et=c}};function rs(c,u,x,v,E,P,K,X,re){Be=!1,et=null,ue.apply(wr,arguments)}function Ta(c,u,x,v,E,P,K,X,re){if(rs.apply(this,arguments),Be){if(Be){var ge=et;Be=!1,et=null}else throw Error(n(198));bt||(bt=!0,Kn=ge)}}function mt(c){var u=c,x=c;if(c.alternate)for(;u.return;)u=u.return;else{c=u;do u=c,(u.flags&4098)!==0&&(x=u.return),c=u.return;while(c)}return u.tag===3?x:null}function Ti(c){if(c.tag===13){var u=c.memoizedState;if(u===null&&(c=c.alternate,c!==null&&(u=c.memoizedState)),u!==null)return u.dehydrated}return null}function Ro(c){if(mt(c)!==c)throw Error(n(188))}function Ra(c){var u=c.alternate;if(!u){if(u=mt(c),u===null)throw Error(n(188));return u!==c?null:c}for(var x=c,v=u;;){var E=x.return;if(E===null)break;var P=E.alternate;if(P===null){if(v=E.return,v!==null){x=v;continue}break}if(E.child===P.child){for(P=E.child;P;){if(P===x)return Ro(E),c;if(P===v)return Ro(E),u;P=P.sibling}throw Error(n(188))}if(x.return!==v.return)x=E,v=P;else{for(var K=!1,X=E.child;X;){if(X===x){K=!0,x=E,v=P;break}if(X===v){K=!0,v=E,x=P;break}X=X.sibling}if(!K){for(X=P.child;X;){if(X===x){K=!0,x=P,v=E;break}if(X===v){K=!0,v=P,x=E;break}X=X.sibling}if(!K)throw Error(n(189))}}if(x.alternate!==v)throw Error(n(190))}if(x.tag!==3)throw Error(n(188));return x.stateNode.current===x?c:u}function tn(c){return c=Ra(c),c!==null?Ao(c):null}function Ao(c){if(c.tag===5||c.tag===6)return c;for(c=c.child;c!==null;){var u=Ao(c);if(u!==null)return u;c=c.sibling}return null}var Aa=t.unstable_scheduleCallback,Pa=t.unstable_cancelCallback,Tc=t.unstable_shouldYield,_a=t.unstable_requestPaint,Ut=t.unstable_now,Ri=t.unstable_getCurrentPriorityLevel,eo=t.unstable_ImmediatePriority,Po=t.unstable_UserBlockingPriority,Ts=t.unstable_NormalPriority,_o=t.unstable_LowPriority,Da=t.unstable_IdlePriority,Do=null,er=null;function ir(c){if(er&&typeof er.onCommitFiberRoot=="function")try{er.onCommitFiberRoot(Do,c,void 0,(c.current.flags&128)===128)}catch{}}var In=Math.clz32?Math.clz32:Ac,$o=Math.log,Rc=Math.LN2;function Ac(c){return c>>>=0,c===0?32:31-($o(c)/Rc|0)|0}var Io=64,Un=4194304;function to(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 Br(c,u){var x=c.pendingLanes;if(x===0)return 0;var v=0,E=c.suspendedLanes,P=c.pingedLanes,K=x&268435455;if(K!==0){var X=K&~E;X!==0?v=to(X):(P&=K,P!==0&&(v=to(P)))}else K=x&~E,K!==0?v=to(K):P!==0&&(v=to(P));if(v===0)return 0;if(u!==0&&u!==v&&(u&E)===0&&(E=v&-v,P=u&-u,E>=P||E===16&&(P&4194240)!==0))return u;if((v&4)!==0&&(v|=x&16),u=c.entangledLanes,u!==0)for(c=c.entanglements,u&=v;0<u;)x=31-In(u),E=1<<x,v|=c[x],u&=~E;return v}function $a(c,u){switch(c){case 1:case 2:case 4:return u+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 u+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 Ai(c,u){for(var x=c.suspendedLanes,v=c.pingedLanes,E=c.expirationTimes,P=c.pendingLanes;0<P;){var K=31-In(P),X=1<<K,re=E[K];re===-1?((X&x)===0||(X&v)!==0)&&(E[K]=$a(X,u)):re<=u&&(c.expiredLanes|=X),P&=~X}}function Mo(c){return c=c.pendingLanes&-1073741825,c!==0?c:c&1073741824?1073741824:0}function Lo(){var c=Io;return Io<<=1,(Io&4194240)===0&&(Io=64),c}function Rs(c){for(var u=[],x=0;31>x;x++)u.push(c);return u}function Bt(c,u,x){c.pendingLanes|=u,u!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,u=31-In(u),c[u]=x}function no(c,u){var x=c.pendingLanes&~u;c.pendingLanes=u,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=u,c.mutableReadLanes&=u,c.entangledLanes&=u,u=c.entanglements;var v=c.eventTimes;for(c=c.expirationTimes;0<x;){var E=31-In(x),P=1<<E;u[E]=0,v[E]=-1,c[E]=-1,x&=~P}}function As(c,u){var x=c.entangledLanes|=u;for(c=c.entanglements;x;){var v=31-In(x),E=1<<v;E&u|c[v]&u&&(c[v]|=u),x&=~E}}var Lt=0;function Yd(c){return c&=-c,1<c?4<c?(c&268435455)!==0?16:536870912:4:1}var Pc,Pi,_c,ro,Dc,Ia=!1,Oo=[],Ps=null,_s=null,dn=null,_i=new Map,so=new Map,Ds=[],sg="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 Xd(c,u){switch(c){case"focusin":case"focusout":Ps=null;break;case"dragenter":case"dragleave":_s=null;break;case"mouseover":case"mouseout":dn=null;break;case"pointerover":case"pointerout":_i.delete(u.pointerId);break;case"gotpointercapture":case"lostpointercapture":so.delete(u.pointerId)}}function jr(c,u,x,v,E,P){return c===null||c.nativeEvent!==P?(c={blockedOn:u,domEventName:x,eventSystemFlags:v,nativeEvent:P,targetContainers:[E]},u!==null&&(u=Wc(u),u!==null&&Pi(u)),c):(c.eventSystemFlags|=v,u=c.targetContainers,E!==null&&u.indexOf(E)===-1&&u.push(E),c)}function G(c,u,x,v,E){switch(u){case"focusin":return Ps=jr(Ps,c,u,x,v,E),!0;case"dragenter":return _s=jr(_s,c,u,x,v,E),!0;case"mouseover":return dn=jr(dn,c,u,x,v,E),!0;case"pointerover":var P=E.pointerId;return _i.set(P,jr(_i.get(P)||null,c,u,x,v,E)),!0;case"gotpointercapture":return P=E.pointerId,so.set(P,jr(so.get(P)||null,c,u,x,v,E)),!0}return!1}function Z(c){var u=$i(c.target);if(u!==null){var x=mt(u);if(x!==null){if(u=x.tag,u===13){if(u=Ti(x),u!==null){c.blockedOn=u,Dc(c.priority,function(){_c(x)});return}}else if(u===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 u=c.targetContainers;0<u.length;){var x=zo(c.domEventName,c.eventSystemFlags,u[0],c.nativeEvent);if(x===null){x=c.nativeEvent;var v=new x.constructor(x.type,x);pt=v,x.target.dispatchEvent(v),pt=null}else return u=Wc(x),u!==null&&Pi(u),c.blockedOn=x,!1;u.shift()}return!0}function He(c,u,x){ve(c)&&x.delete(u)}function ft(){Ia=!1,Ps!==null&&ve(Ps)&&(Ps=null),_s!==null&&ve(_s)&&(_s=null),dn!==null&&ve(dn)&&(dn=null),_i.forEach(He),so.forEach(He)}function kt(c,u){c.blockedOn===u&&(c.blockedOn=null,Ia||(Ia=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ft)))}function _t(c){function u(E){return kt(E,c)}if(0<Oo.length){kt(Oo[0],c);for(var x=1;x<Oo.length;x++){var v=Oo[x];v.blockedOn===c&&(v.blockedOn=null)}}for(Ps!==null&&kt(Ps,c),_s!==null&&kt(_s,c),dn!==null&&kt(dn,c),_i.forEach(u),so.forEach(u),x=0;x<Ds.length;x++)v=Ds[x],v.blockedOn===c&&(v.blockedOn=null);for(;0<Ds.length&&(x=Ds[0],x.blockedOn===null);)Z(x),x.blockedOn===null&&Ds.shift()}var Sn=C.ReactCurrentBatchConfig,Mn=!0;function Nn(c,u,x,v){var E=Lt,P=Sn.transition;Sn.transition=null;try{Lt=1,Fo(c,u,x,v)}finally{Lt=E,Sn.transition=P}}function kr(c,u,x,v){var E=Lt,P=Sn.transition;Sn.transition=null;try{Lt=4,Fo(c,u,x,v)}finally{Lt=E,Sn.transition=P}}function Fo(c,u,x,v){if(Mn){var E=zo(c,u,x,v);if(E===null)wg(c,u,v,Di,x),Xd(c,v);else if(G(E,c,u,x,v))v.stopPropagation();else if(Xd(c,v),u&4&&-1<sg.indexOf(c)){for(;E!==null;){var P=Wc(E);if(P!==null&&Pc(P),P=zo(c,u,x,v),P===null&&wg(c,u,v,Di,x),P===E)break;E=P}E!==null&&v.stopPropagation()}else wg(c,u,v,null,x)}}var Di=null;function zo(c,u,x,v){if(Di=null,c=yt(v),c=$i(c),c!==null)if(u=mt(c),u===null)c=null;else if(x=u.tag,x===13){if(c=Ti(u),c!==null)return c;c=null}else if(x===3){if(u.stateNode.current.memoizedState.isDehydrated)return u.tag===3?u.stateNode.containerInfo:null;c=null}else u!==c&&(c=null);return Di=c,null}function ss(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(Ri()){case eo:return 1;case Po:return 4;case Ts:case _o:return 16;case Da:return 536870912;default:return 16}default:return 16}}var Bo=null,og=null,Qd=null;function $0(){if(Qd)return Qd;var c,u=og,x=u.length,v,E="value"in Bo?Bo.value:Bo.textContent,P=E.length;for(c=0;c<x&&u[c]===E[c];c++);var K=x-c;for(v=1;v<=K&&u[x-v]===E[P-v];v++);return Qd=E.slice(c,1<v?1-v:void 0)}function Jd(c){var u=c.keyCode;return"charCode"in c?(c=c.charCode,c===0&&u===13&&(c=13)):c=u,c===10&&(c=13),32<=c||c===13?c:0}function Zd(){return!0}function I0(){return!1}function Sr(c){function u(x,v,E,P,K){this._reactName=x,this._targetInst=E,this.type=v,this.nativeEvent=P,this.target=K,this.currentTarget=null;for(var X in c)c.hasOwnProperty(X)&&(x=c[X],this[X]=x?x(P):P[X]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?Zd:I0,this.isPropagationStopped=I0,this}return M(u.prototype,{preventDefault:function(){this.defaultPrevented=!0;var x=this.nativeEvent;x&&(x.preventDefault?x.preventDefault():typeof x.returnValue!="unknown"&&(x.returnValue=!1),this.isDefaultPrevented=Zd)},stopPropagation:function(){var x=this.nativeEvent;x&&(x.stopPropagation?x.stopPropagation():typeof x.cancelBubble!="unknown"&&(x.cancelBubble=!0),this.isPropagationStopped=Zd)},persist:function(){},isPersistent:Zd}),u}var Ma={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(c){return c.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ig=Sr(Ma),$c=M({},Ma,{view:0,detail:0}),JD=Sr($c),ag,lg,Ic,ef=M({},$c,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ug,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!==Ic&&(Ic&&c.type==="mousemove"?(ag=c.screenX-Ic.screenX,lg=c.screenY-Ic.screenY):lg=ag=0,Ic=c),ag)},movementY:function(c){return"movementY"in c?c.movementY:lg}}),M0=Sr(ef),ZD=M({},ef,{dataTransfer:0}),e$=Sr(ZD),t$=M({},$c,{relatedTarget:0}),cg=Sr(t$),n$=M({},Ma,{animationName:0,elapsedTime:0,pseudoElement:0}),r$=Sr(n$),s$=M({},Ma,{clipboardData:function(c){return"clipboardData"in c?c.clipboardData:window.clipboardData}}),o$=Sr(s$),i$=M({},Ma,{data:0}),L0=Sr(i$),a$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},l$={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"},c$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function u$(c){var u=this.nativeEvent;return u.getModifierState?u.getModifierState(c):(c=c$[c])?!!u[c]:!1}function ug(){return u$}var d$=M({},$c,{key:function(c){if(c.key){var u=a$[c.key]||c.key;if(u!=="Unidentified")return u}return c.type==="keypress"?(c=Jd(c),c===13?"Enter":String.fromCharCode(c)):c.type==="keydown"||c.type==="keyup"?l$[c.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ug,charCode:function(c){return c.type==="keypress"?Jd(c):0},keyCode:function(c){return c.type==="keydown"||c.type==="keyup"?c.keyCode:0},which:function(c){return c.type==="keypress"?Jd(c):c.type==="keydown"||c.type==="keyup"?c.keyCode:0}}),f$=Sr(d$),p$=M({},ef,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),O0=Sr(p$),h$=M({},$c,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ug}),m$=Sr(h$),g$=M({},Ma,{propertyName:0,elapsedTime:0,pseudoElement:0}),x$=Sr(g$),y$=M({},ef,{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}),b$=Sr(y$),v$=[9,13,27,32],dg=l&&"CompositionEvent"in window,Mc=null;l&&"documentMode"in document&&(Mc=document.documentMode);var w$=l&&"TextEvent"in window&&!Mc,F0=l&&(!dg||Mc&&8<Mc&&11>=Mc),z0=" ",B0=!1;function U0(c,u){switch(c){case"keyup":return v$.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function H0(c){return c=c.detail,typeof c=="object"&&"data"in c?c.data:null}var La=!1;function j$(c,u){switch(c){case"compositionend":return H0(u);case"keypress":return u.which!==32?null:(B0=!0,z0);case"textInput":return c=u.data,c===z0&&B0?null:c;default:return null}}function k$(c,u){if(La)return c==="compositionend"||!dg&&U0(c,u)?(c=$0(),Qd=og=Bo=null,La=!1,c):null;switch(c){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1<u.char.length)return u.char;if(u.which)return String.fromCharCode(u.which)}return null;case"compositionend":return F0&&u.locale!=="ko"?null:u.data;default:return null}}var S$={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 V0(c){var u=c&&c.nodeName&&c.nodeName.toLowerCase();return u==="input"?!!S$[c.type]:u==="textarea"}function W0(c,u,x,v){ye(v),u=of(u,"onChange"),0<u.length&&(x=new ig("onChange","change",null,x,v),c.push({event:x,listeners:u}))}var Lc=null,Oc=null;function N$(c){cj(c,0)}function tf(c){var u=Ua(c);if(Te(u))return c}function C$(c,u){if(c==="change")return u}var q0=!1;if(l){var fg;if(l){var pg="oninput"in document;if(!pg){var K0=document.createElement("div");K0.setAttribute("oninput","return;"),pg=typeof K0.oninput=="function"}fg=pg}else fg=!1;q0=fg&&(!document.documentMode||9<document.documentMode)}function G0(){Lc&&(Lc.detachEvent("onpropertychange",Y0),Oc=Lc=null)}function Y0(c){if(c.propertyName==="value"&&tf(Oc)){var u=[];W0(u,Oc,c,yt(c)),hn(N$,u)}}function E$(c,u,x){c==="focusin"?(G0(),Lc=u,Oc=x,Lc.attachEvent("onpropertychange",Y0)):c==="focusout"&&G0()}function T$(c){if(c==="selectionchange"||c==="keyup"||c==="keydown")return tf(Oc)}function R$(c,u){if(c==="click")return tf(u)}function A$(c,u){if(c==="input"||c==="change")return tf(u)}function P$(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var os=typeof Object.is=="function"?Object.is:P$;function Fc(c,u){if(os(c,u))return!0;if(typeof c!="object"||c===null||typeof u!="object"||u===null)return!1;var x=Object.keys(c),v=Object.keys(u);if(x.length!==v.length)return!1;for(v=0;v<x.length;v++){var E=x[v];if(!d.call(u,E)||!os(c[E],u[E]))return!1}return!0}function X0(c){for(;c&&c.firstChild;)c=c.firstChild;return c}function Q0(c,u){var x=X0(c);c=0;for(var v;x;){if(x.nodeType===3){if(v=c+x.textContent.length,c<=u&&v>=u)return{node:x,offset:u-c};c=v}e:{for(;x;){if(x.nextSibling){x=x.nextSibling;break e}x=x.parentNode}x=void 0}x=X0(x)}}function J0(c,u){return c&&u?c===u?!0:c&&c.nodeType===3?!1:u&&u.nodeType===3?J0(c,u.parentNode):"contains"in c?c.contains(u):c.compareDocumentPosition?!!(c.compareDocumentPosition(u)&16):!1:!1}function Z0(){for(var c=window,u=ke();u instanceof c.HTMLIFrameElement;){try{var x=typeof u.contentWindow.location.href=="string"}catch{x=!1}if(x)c=u.contentWindow;else break;u=ke(c.document)}return u}function hg(c){var u=c&&c.nodeName&&c.nodeName.toLowerCase();return u&&(u==="input"&&(c.type==="text"||c.type==="search"||c.type==="tel"||c.type==="url"||c.type==="password")||u==="textarea"||c.contentEditable==="true")}function _$(c){var u=Z0(),x=c.focusedElem,v=c.selectionRange;if(u!==x&&x&&x.ownerDocument&&J0(x.ownerDocument.documentElement,x)){if(v!==null&&hg(x)){if(u=v.start,c=v.end,c===void 0&&(c=u),"selectionStart"in x)x.selectionStart=u,x.selectionEnd=Math.min(c,x.value.length);else if(c=(u=x.ownerDocument||document)&&u.defaultView||window,c.getSelection){c=c.getSelection();var E=x.textContent.length,P=Math.min(v.start,E);v=v.end===void 0?P:Math.min(v.end,E),!c.extend&&P>v&&(E=v,v=P,P=E),E=Q0(x,P);var K=Q0(x,v);E&&K&&(c.rangeCount!==1||c.anchorNode!==E.node||c.anchorOffset!==E.offset||c.focusNode!==K.node||c.focusOffset!==K.offset)&&(u=u.createRange(),u.setStart(E.node,E.offset),c.removeAllRanges(),P>v?(c.addRange(u),c.extend(K.node,K.offset)):(u.setEnd(K.node,K.offset),c.addRange(u)))}}for(u=[],c=x;c=c.parentNode;)c.nodeType===1&&u.push({element:c,left:c.scrollLeft,top:c.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<u.length;x++)c=u[x],c.element.scrollLeft=c.left,c.element.scrollTop=c.top}}var D$=l&&"documentMode"in document&&11>=document.documentMode,Oa=null,mg=null,zc=null,gg=!1;function ej(c,u,x){var v=x.window===x?x.document:x.nodeType===9?x:x.ownerDocument;gg||Oa==null||Oa!==ke(v)||(v=Oa,"selectionStart"in v&&hg(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),zc&&Fc(zc,v)||(zc=v,v=of(mg,"onSelect"),0<v.length&&(u=new ig("onSelect","select",null,u,x),c.push({event:u,listeners:v}),u.target=Oa)))}function nf(c,u){var x={};return x[c.toLowerCase()]=u.toLowerCase(),x["Webkit"+c]="webkit"+u,x["Moz"+c]="moz"+u,x}var Fa={animationend:nf("Animation","AnimationEnd"),animationiteration:nf("Animation","AnimationIteration"),animationstart:nf("Animation","AnimationStart"),transitionend:nf("Transition","TransitionEnd")},xg={},tj={};l&&(tj=document.createElement("div").style,"AnimationEvent"in window||(delete Fa.animationend.animation,delete Fa.animationiteration.animation,delete Fa.animationstart.animation),"TransitionEvent"in window||delete Fa.transitionend.transition);function rf(c){if(xg[c])return xg[c];if(!Fa[c])return c;var u=Fa[c],x;for(x in u)if(u.hasOwnProperty(x)&&x in tj)return xg[c]=u[x];return c}var nj=rf("animationend"),rj=rf("animationiteration"),sj=rf("animationstart"),oj=rf("transitionend"),ij=new Map,aj="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 Uo(c,u){ij.set(c,u),i(u,[c])}for(var yg=0;yg<aj.length;yg++){var bg=aj[yg],$$=bg.toLowerCase(),I$=bg[0].toUpperCase()+bg.slice(1);Uo($$,"on"+I$)}Uo(nj,"onAnimationEnd"),Uo(rj,"onAnimationIteration"),Uo(sj,"onAnimationStart"),Uo("dblclick","onDoubleClick"),Uo("focusin","onFocus"),Uo("focusout","onBlur"),Uo(oj,"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 Bc="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(" "),M$=new Set("cancel close invalid load scroll toggle".split(" ").concat(Bc));function lj(c,u,x){var v=c.type||"unknown-event";c.currentTarget=x,Ta(v,u,void 0,c),c.currentTarget=null}function cj(c,u){u=(u&4)!==0;for(var x=0;x<c.length;x++){var v=c[x],E=v.event;v=v.listeners;e:{var P=void 0;if(u)for(var K=v.length-1;0<=K;K--){var X=v[K],re=X.instance,ge=X.currentTarget;if(X=X.listener,re!==P&&E.isPropagationStopped())break e;lj(E,X,ge),P=re}else for(K=0;K<v.length;K++){if(X=v[K],re=X.instance,ge=X.currentTarget,X=X.listener,re!==P&&E.isPropagationStopped())break e;lj(E,X,ge),P=re}}}if(bt)throw c=Kn,bt=!1,Kn=null,c}function Yt(c,u){var x=u[Eg];x===void 0&&(x=u[Eg]=new Set);var v=c+"__bubble";x.has(v)||(uj(u,c,2,!1),x.add(v))}function vg(c,u,x){var v=0;u&&(v|=4),uj(x,c,v,u)}var sf="_reactListening"+Math.random().toString(36).slice(2);function Uc(c){if(!c[sf]){c[sf]=!0,r.forEach(function(x){x!=="selectionchange"&&(M$.has(x)||vg(x,!1,c),vg(x,!0,c))});var u=c.nodeType===9?c:c.ownerDocument;u===null||u[sf]||(u[sf]=!0,vg("selectionchange",!1,u))}}function uj(c,u,x,v){switch(ss(u)){case 1:var E=Nn;break;case 4:E=kr;break;default:E=Fo}x=E.bind(null,u,x,c),E=void 0,!$n||u!=="touchstart"&&u!=="touchmove"&&u!=="wheel"||(E=!0),v?E!==void 0?c.addEventListener(u,x,{capture:!0,passive:E}):c.addEventListener(u,x,!0):E!==void 0?c.addEventListener(u,x,{passive:E}):c.addEventListener(u,x,!1)}function wg(c,u,x,v,E){var P=v;if((u&1)===0&&(u&2)===0&&v!==null)e:for(;;){if(v===null)return;var K=v.tag;if(K===3||K===4){var X=v.stateNode.containerInfo;if(X===E||X.nodeType===8&&X.parentNode===E)break;if(K===4)for(K=v.return;K!==null;){var re=K.tag;if((re===3||re===4)&&(re=K.stateNode.containerInfo,re===E||re.nodeType===8&&re.parentNode===E))return;K=K.return}for(;X!==null;){if(K=$i(X),K===null)return;if(re=K.tag,re===5||re===6){v=P=K;continue e}X=X.parentNode}}v=v.return}hn(function(){var ge=P,Ae=yt(x),_e=[];e:{var Re=ij.get(c);if(Re!==void 0){var Ke=ig,Ze=c;switch(c){case"keypress":if(Jd(x)===0)break e;case"keydown":case"keyup":Ke=f$;break;case"focusin":Ze="focus",Ke=cg;break;case"focusout":Ze="blur",Ke=cg;break;case"beforeblur":case"afterblur":Ke=cg;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":Ke=M0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ke=e$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ke=m$;break;case nj:case rj:case sj:Ke=r$;break;case oj:Ke=x$;break;case"scroll":Ke=JD;break;case"wheel":Ke=b$;break;case"copy":case"cut":case"paste":Ke=o$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ke=O0}var tt=(u&4)!==0,fn=!tt&&c==="scroll",fe=tt?Re!==null?Re+"Capture":null:Re;tt=[];for(var ae=ge,he;ae!==null;){he=ae;var Fe=he.stateNode;if(he.tag===5&&Fe!==null&&(he=Fe,fe!==null&&(Fe=Et(ae,fe),Fe!=null&&tt.push(Hc(ae,Fe,he)))),fn)break;ae=ae.return}0<tt.length&&(Re=new Ke(Re,Ze,null,x,Ae),_e.push({event:Re,listeners:tt}))}}if((u&7)===0){e:{if(Re=c==="mouseover"||c==="pointerover",Ke=c==="mouseout"||c==="pointerout",Re&&x!==pt&&(Ze=x.relatedTarget||x.fromElement)&&($i(Ze)||Ze[oo]))break e;if((Ke||Re)&&(Re=Ae.window===Ae?Ae:(Re=Ae.ownerDocument)?Re.defaultView||Re.parentWindow:window,Ke?(Ze=x.relatedTarget||x.toElement,Ke=ge,Ze=Ze?$i(Ze):null,Ze!==null&&(fn=mt(Ze),Ze!==fn||Ze.tag!==5&&Ze.tag!==6)&&(Ze=null)):(Ke=null,Ze=ge),Ke!==Ze)){if(tt=M0,Fe="onMouseLeave",fe="onMouseEnter",ae="mouse",(c==="pointerout"||c==="pointerover")&&(tt=O0,Fe="onPointerLeave",fe="onPointerEnter",ae="pointer"),fn=Ke==null?Re:Ua(Ke),he=Ze==null?Re:Ua(Ze),Re=new tt(Fe,ae+"leave",Ke,x,Ae),Re.target=fn,Re.relatedTarget=he,Fe=null,$i(Ae)===ge&&(tt=new tt(fe,ae+"enter",Ze,x,Ae),tt.target=he,tt.relatedTarget=fn,Fe=tt),fn=Fe,Ke&&Ze)t:{for(tt=Ke,fe=Ze,ae=0,he=tt;he;he=za(he))ae++;for(he=0,Fe=fe;Fe;Fe=za(Fe))he++;for(;0<ae-he;)tt=za(tt),ae--;for(;0<he-ae;)fe=za(fe),he--;for(;ae--;){if(tt===fe||fe!==null&&tt===fe.alternate)break t;tt=za(tt),fe=za(fe)}tt=null}else tt=null;Ke!==null&&dj(_e,Re,Ke,tt,!1),Ze!==null&&fn!==null&&dj(_e,fn,Ze,tt,!0)}}e:{if(Re=ge?Ua(ge):window,Ke=Re.nodeName&&Re.nodeName.toLowerCase(),Ke==="select"||Ke==="input"&&Re.type==="file")var rt=C$;else if(V0(Re))if(q0)rt=A$;else{rt=T$;var at=E$}else(Ke=Re.nodeName)&&Ke.toLowerCase()==="input"&&(Re.type==="checkbox"||Re.type==="radio")&&(rt=R$);if(rt&&(rt=rt(c,ge))){W0(_e,rt,x,Ae);break e}at&&at(c,Re,ge),c==="focusout"&&(at=Re._wrapperState)&&at.controlled&&Re.type==="number"&&ze(Re,"number",Re.value)}switch(at=ge?Ua(ge):window,c){case"focusin":(V0(at)||at.contentEditable==="true")&&(Oa=at,mg=ge,zc=null);break;case"focusout":zc=mg=Oa=null;break;case"mousedown":gg=!0;break;case"contextmenu":case"mouseup":case"dragend":gg=!1,ej(_e,x,Ae);break;case"selectionchange":if(D$)break;case"keydown":case"keyup":ej(_e,x,Ae)}var lt;if(dg)e:{switch(c){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else La?U0(c,x)&&(ut="onCompositionEnd"):c==="keydown"&&x.keyCode===229&&(ut="onCompositionStart");ut&&(F0&&x.locale!=="ko"&&(La||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&La&&(lt=$0()):(Bo=Ae,og="value"in Bo?Bo.value:Bo.textContent,La=!0)),at=of(ge,ut),0<at.length&&(ut=new L0(ut,c,null,x,Ae),_e.push({event:ut,listeners:at}),lt?ut.data=lt:(lt=H0(x),lt!==null&&(ut.data=lt)))),(lt=w$?j$(c,x):k$(c,x))&&(ge=of(ge,"onBeforeInput"),0<ge.length&&(Ae=new L0("onBeforeInput","beforeinput",null,x,Ae),_e.push({event:Ae,listeners:ge}),Ae.data=lt))}cj(_e,u)})}function Hc(c,u,x){return{instance:c,listener:u,currentTarget:x}}function of(c,u){for(var x=u+"Capture",v=[];c!==null;){var E=c,P=E.stateNode;E.tag===5&&P!==null&&(E=P,P=Et(c,x),P!=null&&v.unshift(Hc(c,P,E)),P=Et(c,u),P!=null&&v.push(Hc(c,P,E))),c=c.return}return v}function za(c){if(c===null)return null;do c=c.return;while(c&&c.tag!==5);return c||null}function dj(c,u,x,v,E){for(var P=u._reactName,K=[];x!==null&&x!==v;){var X=x,re=X.alternate,ge=X.stateNode;if(re!==null&&re===v)break;X.tag===5&&ge!==null&&(X=ge,E?(re=Et(x,P),re!=null&&K.unshift(Hc(x,re,X))):E||(re=Et(x,P),re!=null&&K.push(Hc(x,re,X)))),x=x.return}K.length!==0&&c.push({event:u,listeners:K})}var L$=/\r\n?/g,O$=/\u0000|\uFFFD/g;function fj(c){return(typeof c=="string"?c:""+c).replace(L$,`
|
|
38
|
+
`).replace(O$,"")}function af(c,u,x){if(u=fj(u),fj(c)!==u&&x)throw Error(n(425))}function lf(){}var jg=null,kg=null;function Sg(c,u){return c==="textarea"||c==="noscript"||typeof u.children=="string"||typeof u.children=="number"||typeof u.dangerouslySetInnerHTML=="object"&&u.dangerouslySetInnerHTML!==null&&u.dangerouslySetInnerHTML.__html!=null}var Ng=typeof setTimeout=="function"?setTimeout:void 0,F$=typeof clearTimeout=="function"?clearTimeout:void 0,pj=typeof Promise=="function"?Promise:void 0,z$=typeof queueMicrotask=="function"?queueMicrotask:typeof pj<"u"?function(c){return pj.resolve(null).then(c).catch(B$)}:Ng;function B$(c){setTimeout(function(){throw c})}function Cg(c,u){var x=u,v=0;do{var E=x.nextSibling;if(c.removeChild(x),E&&E.nodeType===8)if(x=E.data,x==="/$"){if(v===0){c.removeChild(E),_t(u);return}v--}else x!=="$"&&x!=="$?"&&x!=="$!"||v++;x=E}while(x);_t(u)}function Ho(c){for(;c!=null;c=c.nextSibling){var u=c.nodeType;if(u===1||u===3)break;if(u===8){if(u=c.data,u==="$"||u==="$!"||u==="$?")break;if(u==="/$")return null}}return c}function hj(c){c=c.previousSibling;for(var u=0;c;){if(c.nodeType===8){var x=c.data;if(x==="$"||x==="$!"||x==="$?"){if(u===0)return c;u--}else x==="/$"&&u++}c=c.previousSibling}return null}var Ba=Math.random().toString(36).slice(2),$s="__reactFiber$"+Ba,Vc="__reactProps$"+Ba,oo="__reactContainer$"+Ba,Eg="__reactEvents$"+Ba,U$="__reactListeners$"+Ba,H$="__reactHandles$"+Ba;function $i(c){var u=c[$s];if(u)return u;for(var x=c.parentNode;x;){if(u=x[oo]||x[$s]){if(x=u.alternate,u.child!==null||x!==null&&x.child!==null)for(c=hj(c);c!==null;){if(x=c[$s])return x;c=hj(c)}return u}c=x,x=c.parentNode}return null}function Wc(c){return c=c[$s]||c[oo],!c||c.tag!==5&&c.tag!==6&&c.tag!==13&&c.tag!==3?null:c}function Ua(c){if(c.tag===5||c.tag===6)return c.stateNode;throw Error(n(33))}function cf(c){return c[Vc]||null}var Tg=[],Ha=-1;function Vo(c){return{current:c}}function Xt(c){0>Ha||(c.current=Tg[Ha],Tg[Ha]=null,Ha--)}function qt(c,u){Ha++,Tg[Ha]=c.current,c.current=u}var Wo={},Gn=Vo(Wo),ar=Vo(!1),Ii=Wo;function Va(c,u){var x=c.type.contextTypes;if(!x)return Wo;var v=c.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===u)return v.__reactInternalMemoizedMaskedChildContext;var E={},P;for(P in x)E[P]=u[P];return v&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=u,c.__reactInternalMemoizedMaskedChildContext=E),E}function lr(c){return c=c.childContextTypes,c!=null}function uf(){Xt(ar),Xt(Gn)}function mj(c,u,x){if(Gn.current!==Wo)throw Error(n(168));qt(Gn,u),qt(ar,x)}function gj(c,u,x){var v=c.stateNode;if(u=u.childContextTypes,typeof v.getChildContext!="function")return x;v=v.getChildContext();for(var E in v)if(!(E in u))throw Error(n(108,le(c)||"Unknown",E));return M({},x,v)}function df(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Wo,Ii=Gn.current,qt(Gn,c),qt(ar,ar.current),!0}function xj(c,u,x){var v=c.stateNode;if(!v)throw Error(n(169));x?(c=gj(c,u,Ii),v.__reactInternalMemoizedMergedChildContext=c,Xt(ar),Xt(Gn),qt(Gn,c)):Xt(ar),qt(ar,x)}var io=null,ff=!1,Rg=!1;function yj(c){io===null?io=[c]:io.push(c)}function V$(c){ff=!0,yj(c)}function qo(){if(!Rg&&io!==null){Rg=!0;var c=0,u=Lt;try{var x=io;for(Lt=1;c<x.length;c++){var v=x[c];do v=v(!0);while(v!==null)}io=null,ff=!1}catch(E){throw io!==null&&(io=io.slice(c+1)),Aa(eo,qo),E}finally{Lt=u,Rg=!1}}return null}var Wa=[],qa=0,pf=null,hf=0,Ur=[],Hr=0,Mi=null,ao=1,lo="";function Li(c,u){Wa[qa++]=hf,Wa[qa++]=pf,pf=c,hf=u}function bj(c,u,x){Ur[Hr++]=ao,Ur[Hr++]=lo,Ur[Hr++]=Mi,Mi=c;var v=ao;c=lo;var E=32-In(v)-1;v&=~(1<<E),x+=1;var P=32-In(u)+E;if(30<P){var K=E-E%5;P=(v&(1<<K)-1).toString(32),v>>=K,E-=K,ao=1<<32-In(u)+E|x<<E|v,lo=P+c}else ao=1<<P|x<<E|v,lo=c}function Ag(c){c.return!==null&&(Li(c,1),bj(c,1,0))}function Pg(c){for(;c===pf;)pf=Wa[--qa],Wa[qa]=null,hf=Wa[--qa],Wa[qa]=null;for(;c===Mi;)Mi=Ur[--Hr],Ur[Hr]=null,lo=Ur[--Hr],Ur[Hr]=null,ao=Ur[--Hr],Ur[Hr]=null}var Nr=null,Cr=null,nn=!1,is=null;function vj(c,u){var x=Kr(5,null,null,0);x.elementType="DELETED",x.stateNode=u,x.return=c,u=c.deletions,u===null?(c.deletions=[x],c.flags|=16):u.push(x)}function wj(c,u){switch(c.tag){case 5:var x=c.type;return u=u.nodeType!==1||x.toLowerCase()!==u.nodeName.toLowerCase()?null:u,u!==null?(c.stateNode=u,Nr=c,Cr=Ho(u.firstChild),!0):!1;case 6:return u=c.pendingProps===""||u.nodeType!==3?null:u,u!==null?(c.stateNode=u,Nr=c,Cr=null,!0):!1;case 13:return u=u.nodeType!==8?null:u,u!==null?(x=Mi!==null?{id:ao,overflow:lo}:null,c.memoizedState={dehydrated:u,treeContext:x,retryLane:1073741824},x=Kr(18,null,null,0),x.stateNode=u,x.return=c,c.child=x,Nr=c,Cr=null,!0):!1;default:return!1}}function _g(c){return(c.mode&1)!==0&&(c.flags&128)===0}function Dg(c){if(nn){var u=Cr;if(u){var x=u;if(!wj(c,u)){if(_g(c))throw Error(n(418));u=Ho(x.nextSibling);var v=Nr;u&&wj(c,u)?vj(v,x):(c.flags=c.flags&-4097|2,nn=!1,Nr=c)}}else{if(_g(c))throw Error(n(418));c.flags=c.flags&-4097|2,nn=!1,Nr=c}}}function jj(c){for(c=c.return;c!==null&&c.tag!==5&&c.tag!==3&&c.tag!==13;)c=c.return;Nr=c}function mf(c){if(c!==Nr)return!1;if(!nn)return jj(c),nn=!0,!1;var u;if((u=c.tag!==3)&&!(u=c.tag!==5)&&(u=c.type,u=u!=="head"&&u!=="body"&&!Sg(c.type,c.memoizedProps)),u&&(u=Cr)){if(_g(c))throw kj(),Error(n(418));for(;u;)vj(c,u),u=Ho(u.nextSibling)}if(jj(c),c.tag===13){if(c=c.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(n(317));e:{for(c=c.nextSibling,u=0;c;){if(c.nodeType===8){var x=c.data;if(x==="/$"){if(u===0){Cr=Ho(c.nextSibling);break e}u--}else x!=="$"&&x!=="$!"&&x!=="$?"||u++}c=c.nextSibling}Cr=null}}else Cr=Nr?Ho(c.stateNode.nextSibling):null;return!0}function kj(){for(var c=Cr;c;)c=Ho(c.nextSibling)}function Ka(){Cr=Nr=null,nn=!1}function $g(c){is===null?is=[c]:is.push(c)}var W$=C.ReactCurrentBatchConfig;function qc(c,u,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 v=x.stateNode}if(!v)throw Error(n(147,c));var E=v,P=""+c;return u!==null&&u.ref!==null&&typeof u.ref=="function"&&u.ref._stringRef===P?u.ref:(u=function(K){var X=E.refs;K===null?delete X[P]:X[P]=K},u._stringRef=P,u)}if(typeof c!="string")throw Error(n(284));if(!x._owner)throw Error(n(290,c))}return c}function gf(c,u){throw c=Object.prototype.toString.call(u),Error(n(31,c==="[object Object]"?"object with keys {"+Object.keys(u).join(", ")+"}":c))}function Sj(c){var u=c._init;return u(c._payload)}function Nj(c){function u(fe,ae){if(c){var he=fe.deletions;he===null?(fe.deletions=[ae],fe.flags|=16):he.push(ae)}}function x(fe,ae){if(!c)return null;for(;ae!==null;)u(fe,ae),ae=ae.sibling;return null}function v(fe,ae){for(fe=new Map;ae!==null;)ae.key!==null?fe.set(ae.key,ae):fe.set(ae.index,ae),ae=ae.sibling;return fe}function E(fe,ae){return fe=ei(fe,ae),fe.index=0,fe.sibling=null,fe}function P(fe,ae,he){return fe.index=he,c?(he=fe.alternate,he!==null?(he=he.index,he<ae?(fe.flags|=2,ae):he):(fe.flags|=2,ae)):(fe.flags|=1048576,ae)}function K(fe){return c&&fe.alternate===null&&(fe.flags|=2),fe}function X(fe,ae,he,Fe){return ae===null||ae.tag!==6?(ae=Nx(he,fe.mode,Fe),ae.return=fe,ae):(ae=E(ae,he),ae.return=fe,ae)}function re(fe,ae,he,Fe){var rt=he.type;return rt===R?Ae(fe,ae,he.props.children,Fe,he.key):ae!==null&&(ae.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===U&&Sj(rt)===ae.type)?(Fe=E(ae,he.props),Fe.ref=qc(fe,ae,he),Fe.return=fe,Fe):(Fe=zf(he.type,he.key,he.props,null,fe.mode,Fe),Fe.ref=qc(fe,ae,he),Fe.return=fe,Fe)}function ge(fe,ae,he,Fe){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==he.containerInfo||ae.stateNode.implementation!==he.implementation?(ae=Cx(he,fe.mode,Fe),ae.return=fe,ae):(ae=E(ae,he.children||[]),ae.return=fe,ae)}function Ae(fe,ae,he,Fe,rt){return ae===null||ae.tag!==7?(ae=Wi(he,fe.mode,Fe,rt),ae.return=fe,ae):(ae=E(ae,he),ae.return=fe,ae)}function _e(fe,ae,he){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=Nx(""+ae,fe.mode,he),ae.return=fe,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case I:return he=zf(ae.type,ae.key,ae.props,null,fe.mode,he),he.ref=qc(fe,null,ae),he.return=fe,he;case T:return ae=Cx(ae,fe.mode,he),ae.return=fe,ae;case U:var Fe=ae._init;return _e(fe,Fe(ae._payload),he)}if(Ye(ae)||V(ae))return ae=Wi(ae,fe.mode,he,null),ae.return=fe,ae;gf(fe,ae)}return null}function Re(fe,ae,he,Fe){var rt=ae!==null?ae.key:null;if(typeof he=="string"&&he!==""||typeof he=="number")return rt!==null?null:X(fe,ae,""+he,Fe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case I:return he.key===rt?re(fe,ae,he,Fe):null;case T:return he.key===rt?ge(fe,ae,he,Fe):null;case U:return rt=he._init,Re(fe,ae,rt(he._payload),Fe)}if(Ye(he)||V(he))return rt!==null?null:Ae(fe,ae,he,Fe,null);gf(fe,he)}return null}function Ke(fe,ae,he,Fe,rt){if(typeof Fe=="string"&&Fe!==""||typeof Fe=="number")return fe=fe.get(he)||null,X(ae,fe,""+Fe,rt);if(typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case I:return fe=fe.get(Fe.key===null?he:Fe.key)||null,re(ae,fe,Fe,rt);case T:return fe=fe.get(Fe.key===null?he:Fe.key)||null,ge(ae,fe,Fe,rt);case U:var at=Fe._init;return Ke(fe,ae,he,at(Fe._payload),rt)}if(Ye(Fe)||V(Fe))return fe=fe.get(he)||null,Ae(ae,fe,Fe,rt,null);gf(ae,Fe)}return null}function Ze(fe,ae,he,Fe){for(var rt=null,at=null,lt=ae,ut=ae=0,Fn=null;lt!==null&&ut<he.length;ut++){lt.index>ut?(Fn=lt,lt=null):Fn=lt.sibling;var It=Re(fe,lt,he[ut],Fe);if(It===null){lt===null&&(lt=Fn);break}c&<&&It.alternate===null&&u(fe,lt),ae=P(It,ae,ut),at===null?rt=It:at.sibling=It,at=It,lt=Fn}if(ut===he.length)return x(fe,lt),nn&&Li(fe,ut),rt;if(lt===null){for(;ut<he.length;ut++)lt=_e(fe,he[ut],Fe),lt!==null&&(ae=P(lt,ae,ut),at===null?rt=lt:at.sibling=lt,at=lt);return nn&&Li(fe,ut),rt}for(lt=v(fe,lt);ut<he.length;ut++)Fn=Ke(lt,fe,ut,he[ut],Fe),Fn!==null&&(c&&Fn.alternate!==null&<.delete(Fn.key===null?ut:Fn.key),ae=P(Fn,ae,ut),at===null?rt=Fn:at.sibling=Fn,at=Fn);return c&<.forEach(function(ti){return u(fe,ti)}),nn&&Li(fe,ut),rt}function tt(fe,ae,he,Fe){var rt=V(he);if(typeof rt!="function")throw Error(n(150));if(he=rt.call(he),he==null)throw Error(n(151));for(var at=rt=null,lt=ae,ut=ae=0,Fn=null,It=he.next();lt!==null&&!It.done;ut++,It=he.next()){lt.index>ut?(Fn=lt,lt=null):Fn=lt.sibling;var ti=Re(fe,lt,It.value,Fe);if(ti===null){lt===null&&(lt=Fn);break}c&<&&ti.alternate===null&&u(fe,lt),ae=P(ti,ae,ut),at===null?rt=ti:at.sibling=ti,at=ti,lt=Fn}if(It.done)return x(fe,lt),nn&&Li(fe,ut),rt;if(lt===null){for(;!It.done;ut++,It=he.next())It=_e(fe,It.value,Fe),It!==null&&(ae=P(It,ae,ut),at===null?rt=It:at.sibling=It,at=It);return nn&&Li(fe,ut),rt}for(lt=v(fe,lt);!It.done;ut++,It=he.next())It=Ke(lt,fe,ut,It.value,Fe),It!==null&&(c&&It.alternate!==null&<.delete(It.key===null?ut:It.key),ae=P(It,ae,ut),at===null?rt=It:at.sibling=It,at=It);return c&<.forEach(function(SI){return u(fe,SI)}),nn&&Li(fe,ut),rt}function fn(fe,ae,he,Fe){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 I:e:{for(var rt=he.key,at=ae;at!==null;){if(at.key===rt){if(rt=he.type,rt===R){if(at.tag===7){x(fe,at.sibling),ae=E(at,he.props.children),ae.return=fe,fe=ae;break e}}else if(at.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===U&&Sj(rt)===at.type){x(fe,at.sibling),ae=E(at,he.props),ae.ref=qc(fe,at,he),ae.return=fe,fe=ae;break e}x(fe,at);break}else u(fe,at);at=at.sibling}he.type===R?(ae=Wi(he.props.children,fe.mode,Fe,he.key),ae.return=fe,fe=ae):(Fe=zf(he.type,he.key,he.props,null,fe.mode,Fe),Fe.ref=qc(fe,ae,he),Fe.return=fe,fe=Fe)}return K(fe);case T:e:{for(at=he.key;ae!==null;){if(ae.key===at)if(ae.tag===4&&ae.stateNode.containerInfo===he.containerInfo&&ae.stateNode.implementation===he.implementation){x(fe,ae.sibling),ae=E(ae,he.children||[]),ae.return=fe,fe=ae;break e}else{x(fe,ae);break}else u(fe,ae);ae=ae.sibling}ae=Cx(he,fe.mode,Fe),ae.return=fe,fe=ae}return K(fe);case U:return at=he._init,fn(fe,ae,at(he._payload),Fe)}if(Ye(he))return Ze(fe,ae,he,Fe);if(V(he))return tt(fe,ae,he,Fe);gf(fe,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,ae!==null&&ae.tag===6?(x(fe,ae.sibling),ae=E(ae,he),ae.return=fe,fe=ae):(x(fe,ae),ae=Nx(he,fe.mode,Fe),ae.return=fe,fe=ae),K(fe)):x(fe,ae)}return fn}var Ga=Nj(!0),Cj=Nj(!1),xf=Vo(null),yf=null,Ya=null,Ig=null;function Mg(){Ig=Ya=yf=null}function Lg(c){var u=xf.current;Xt(xf),c._currentValue=u}function Og(c,u,x){for(;c!==null;){var v=c.alternate;if((c.childLanes&u)!==u?(c.childLanes|=u,v!==null&&(v.childLanes|=u)):v!==null&&(v.childLanes&u)!==u&&(v.childLanes|=u),c===x)break;c=c.return}}function Xa(c,u){yf=c,Ig=Ya=null,c=c.dependencies,c!==null&&c.firstContext!==null&&((c.lanes&u)!==0&&(cr=!0),c.firstContext=null)}function Vr(c){var u=c._currentValue;if(Ig!==c)if(c={context:c,memoizedValue:u,next:null},Ya===null){if(yf===null)throw Error(n(308));Ya=c,yf.dependencies={lanes:0,firstContext:c}}else Ya=Ya.next=c;return u}var Oi=null;function Fg(c){Oi===null?Oi=[c]:Oi.push(c)}function Ej(c,u,x,v){var E=u.interleaved;return E===null?(x.next=x,Fg(u)):(x.next=E.next,E.next=x),u.interleaved=x,co(c,v)}function co(c,u){c.lanes|=u;var x=c.alternate;for(x!==null&&(x.lanes|=u),x=c,c=c.return;c!==null;)c.childLanes|=u,x=c.alternate,x!==null&&(x.childLanes|=u),x=c,c=c.return;return x.tag===3?x.stateNode:null}var Ko=!1;function zg(c){c.updateQueue={baseState:c.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tj(c,u){c=c.updateQueue,u.updateQueue===c&&(u.updateQueue={baseState:c.baseState,firstBaseUpdate:c.firstBaseUpdate,lastBaseUpdate:c.lastBaseUpdate,shared:c.shared,effects:c.effects})}function uo(c,u){return{eventTime:c,lane:u,tag:0,payload:null,callback:null,next:null}}function Go(c,u,x){var v=c.updateQueue;if(v===null)return null;if(v=v.shared,(Dt&2)!==0){var E=v.pending;return E===null?u.next=u:(u.next=E.next,E.next=u),v.pending=u,co(c,x)}return E=v.interleaved,E===null?(u.next=u,Fg(v)):(u.next=E.next,E.next=u),v.interleaved=u,co(c,x)}function bf(c,u,x){if(u=u.updateQueue,u!==null&&(u=u.shared,(x&4194240)!==0)){var v=u.lanes;v&=c.pendingLanes,x|=v,u.lanes=x,As(c,x)}}function Rj(c,u){var x=c.updateQueue,v=c.alternate;if(v!==null&&(v=v.updateQueue,x===v)){var E=null,P=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};P===null?E=P=K:P=P.next=K,x=x.next}while(x!==null);P===null?E=P=u:P=P.next=u}else E=P=u;x={baseState:v.baseState,firstBaseUpdate:E,lastBaseUpdate:P,shared:v.shared,effects:v.effects},c.updateQueue=x;return}c=x.lastBaseUpdate,c===null?x.firstBaseUpdate=u:c.next=u,x.lastBaseUpdate=u}function vf(c,u,x,v){var E=c.updateQueue;Ko=!1;var P=E.firstBaseUpdate,K=E.lastBaseUpdate,X=E.shared.pending;if(X!==null){E.shared.pending=null;var re=X,ge=re.next;re.next=null,K===null?P=ge:K.next=ge,K=re;var Ae=c.alternate;Ae!==null&&(Ae=Ae.updateQueue,X=Ae.lastBaseUpdate,X!==K&&(X===null?Ae.firstBaseUpdate=ge:X.next=ge,Ae.lastBaseUpdate=re))}if(P!==null){var _e=E.baseState;K=0,Ae=ge=re=null,X=P;do{var Re=X.lane,Ke=X.eventTime;if((v&Re)===Re){Ae!==null&&(Ae=Ae.next={eventTime:Ke,lane:0,tag:X.tag,payload:X.payload,callback:X.callback,next:null});e:{var Ze=c,tt=X;switch(Re=u,Ke=x,tt.tag){case 1:if(Ze=tt.payload,typeof Ze=="function"){_e=Ze.call(Ke,_e,Re);break e}_e=Ze;break e;case 3:Ze.flags=Ze.flags&-65537|128;case 0:if(Ze=tt.payload,Re=typeof Ze=="function"?Ze.call(Ke,_e,Re):Ze,Re==null)break e;_e=M({},_e,Re);break e;case 2:Ko=!0}}X.callback!==null&&X.lane!==0&&(c.flags|=64,Re=E.effects,Re===null?E.effects=[X]:Re.push(X))}else Ke={eventTime:Ke,lane:Re,tag:X.tag,payload:X.payload,callback:X.callback,next:null},Ae===null?(ge=Ae=Ke,re=_e):Ae=Ae.next=Ke,K|=Re;if(X=X.next,X===null){if(X=E.shared.pending,X===null)break;Re=X,X=Re.next,Re.next=null,E.lastBaseUpdate=Re,E.shared.pending=null}}while(!0);if(Ae===null&&(re=_e),E.baseState=re,E.firstBaseUpdate=ge,E.lastBaseUpdate=Ae,u=E.shared.interleaved,u!==null){E=u;do K|=E.lane,E=E.next;while(E!==u)}else P===null&&(E.shared.lanes=0);Bi|=K,c.lanes=K,c.memoizedState=_e}}function Aj(c,u,x){if(c=u.effects,u.effects=null,c!==null)for(u=0;u<c.length;u++){var v=c[u],E=v.callback;if(E!==null){if(v.callback=null,v=x,typeof E!="function")throw Error(n(191,E));E.call(v)}}}var Kc={},Is=Vo(Kc),Gc=Vo(Kc),Yc=Vo(Kc);function Fi(c){if(c===Kc)throw Error(n(174));return c}function Bg(c,u){switch(qt(Yc,u),qt(Gc,c),qt(Is,Kc),c=u.nodeType,c){case 9:case 11:u=(u=u.documentElement)?u.namespaceURI:ee(null,"");break;default:c=c===8?u.parentNode:u,u=c.namespaceURI||null,c=c.tagName,u=ee(u,c)}Xt(Is),qt(Is,u)}function Qa(){Xt(Is),Xt(Gc),Xt(Yc)}function Pj(c){Fi(Yc.current);var u=Fi(Is.current),x=ee(u,c.type);u!==x&&(qt(Gc,c),qt(Is,x))}function Ug(c){Gc.current===c&&(Xt(Is),Xt(Gc))}var an=Vo(0);function wf(c){for(var u=c;u!==null;){if(u.tag===13){var x=u.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||x.data==="$?"||x.data==="$!"))return u}else if(u.tag===19&&u.memoizedProps.revealOrder!==void 0){if((u.flags&128)!==0)return u}else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return null;u=u.return}u.sibling.return=u.return,u=u.sibling}return null}var Hg=[];function Vg(){for(var c=0;c<Hg.length;c++)Hg[c]._workInProgressVersionPrimary=null;Hg.length=0}var jf=C.ReactCurrentDispatcher,Wg=C.ReactCurrentBatchConfig,zi=0,ln=null,Cn=null,Ln=null,kf=!1,Xc=!1,Qc=0,q$=0;function Yn(){throw Error(n(321))}function qg(c,u){if(u===null)return!1;for(var x=0;x<u.length&&x<c.length;x++)if(!os(c[x],u[x]))return!1;return!0}function Kg(c,u,x,v,E,P){if(zi=P,ln=u,u.memoizedState=null,u.updateQueue=null,u.lanes=0,jf.current=c===null||c.memoizedState===null?X$:Q$,c=x(v,E),Xc){P=0;do{if(Xc=!1,Qc=0,25<=P)throw Error(n(301));P+=1,Ln=Cn=null,u.updateQueue=null,jf.current=J$,c=x(v,E)}while(Xc)}if(jf.current=Cf,u=Cn!==null&&Cn.next!==null,zi=0,Ln=Cn=ln=null,kf=!1,u)throw Error(n(300));return c}function Gg(){var c=Qc!==0;return Qc=0,c}function Ms(){var c={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ln===null?ln.memoizedState=Ln=c:Ln=Ln.next=c,Ln}function Wr(){if(Cn===null){var c=ln.alternate;c=c!==null?c.memoizedState:null}else c=Cn.next;var u=Ln===null?ln.memoizedState:Ln.next;if(u!==null)Ln=u,Cn=c;else{if(c===null)throw Error(n(310));Cn=c,c={memoizedState:Cn.memoizedState,baseState:Cn.baseState,baseQueue:Cn.baseQueue,queue:Cn.queue,next:null},Ln===null?ln.memoizedState=Ln=c:Ln=Ln.next=c}return Ln}function Jc(c,u){return typeof u=="function"?u(c):u}function Yg(c){var u=Wr(),x=u.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var v=Cn,E=v.baseQueue,P=x.pending;if(P!==null){if(E!==null){var K=E.next;E.next=P.next,P.next=K}v.baseQueue=E=P,x.pending=null}if(E!==null){P=E.next,v=v.baseState;var X=K=null,re=null,ge=P;do{var Ae=ge.lane;if((zi&Ae)===Ae)re!==null&&(re=re.next={lane:0,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null}),v=ge.hasEagerState?ge.eagerState:c(v,ge.action);else{var _e={lane:Ae,action:ge.action,hasEagerState:ge.hasEagerState,eagerState:ge.eagerState,next:null};re===null?(X=re=_e,K=v):re=re.next=_e,ln.lanes|=Ae,Bi|=Ae}ge=ge.next}while(ge!==null&&ge!==P);re===null?K=v:re.next=X,os(v,u.memoizedState)||(cr=!0),u.memoizedState=v,u.baseState=K,u.baseQueue=re,x.lastRenderedState=v}if(c=x.interleaved,c!==null){E=c;do P=E.lane,ln.lanes|=P,Bi|=P,E=E.next;while(E!==c)}else E===null&&(x.lanes=0);return[u.memoizedState,x.dispatch]}function Xg(c){var u=Wr(),x=u.queue;if(x===null)throw Error(n(311));x.lastRenderedReducer=c;var v=x.dispatch,E=x.pending,P=u.memoizedState;if(E!==null){x.pending=null;var K=E=E.next;do P=c(P,K.action),K=K.next;while(K!==E);os(P,u.memoizedState)||(cr=!0),u.memoizedState=P,u.baseQueue===null&&(u.baseState=P),x.lastRenderedState=P}return[P,v]}function _j(){}function Dj(c,u){var x=ln,v=Wr(),E=u(),P=!os(v.memoizedState,E);if(P&&(v.memoizedState=E,cr=!0),v=v.queue,Qg(Mj.bind(null,x,v,c),[c]),v.getSnapshot!==u||P||Ln!==null&&Ln.memoizedState.tag&1){if(x.flags|=2048,Zc(9,Ij.bind(null,x,v,E,u),void 0,null),On===null)throw Error(n(349));(zi&30)!==0||$j(x,u,E)}return E}function $j(c,u,x){c.flags|=16384,c={getSnapshot:u,value:x},u=ln.updateQueue,u===null?(u={lastEffect:null,stores:null},ln.updateQueue=u,u.stores=[c]):(x=u.stores,x===null?u.stores=[c]:x.push(c))}function Ij(c,u,x,v){u.value=x,u.getSnapshot=v,Lj(u)&&Oj(c)}function Mj(c,u,x){return x(function(){Lj(u)&&Oj(c)})}function Lj(c){var u=c.getSnapshot;c=c.value;try{var x=u();return!os(c,x)}catch{return!0}}function Oj(c){var u=co(c,1);u!==null&&us(u,c,1,-1)}function Fj(c){var u=Ms();return typeof c=="function"&&(c=c()),u.memoizedState=u.baseState=c,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Jc,lastRenderedState:c},u.queue=c,c=c.dispatch=Y$.bind(null,ln,c),[u.memoizedState,c]}function Zc(c,u,x,v){return c={tag:c,create:u,destroy:x,deps:v,next:null},u=ln.updateQueue,u===null?(u={lastEffect:null,stores:null},ln.updateQueue=u,u.lastEffect=c.next=c):(x=u.lastEffect,x===null?u.lastEffect=c.next=c:(v=x.next,x.next=c,c.next=v,u.lastEffect=c)),c}function zj(){return Wr().memoizedState}function Sf(c,u,x,v){var E=Ms();ln.flags|=c,E.memoizedState=Zc(1|u,x,void 0,v===void 0?null:v)}function Nf(c,u,x,v){var E=Wr();v=v===void 0?null:v;var P=void 0;if(Cn!==null){var K=Cn.memoizedState;if(P=K.destroy,v!==null&&qg(v,K.deps)){E.memoizedState=Zc(u,x,P,v);return}}ln.flags|=c,E.memoizedState=Zc(1|u,x,P,v)}function Bj(c,u){return Sf(8390656,8,c,u)}function Qg(c,u){return Nf(2048,8,c,u)}function Uj(c,u){return Nf(4,2,c,u)}function Hj(c,u){return Nf(4,4,c,u)}function Vj(c,u){if(typeof u=="function")return c=c(),u(c),function(){u(null)};if(u!=null)return c=c(),u.current=c,function(){u.current=null}}function Wj(c,u,x){return x=x!=null?x.concat([c]):null,Nf(4,4,Vj.bind(null,u,c),x)}function Jg(){}function qj(c,u){var x=Wr();u=u===void 0?null:u;var v=x.memoizedState;return v!==null&&u!==null&&qg(u,v[1])?v[0]:(x.memoizedState=[c,u],c)}function Kj(c,u){var x=Wr();u=u===void 0?null:u;var v=x.memoizedState;return v!==null&&u!==null&&qg(u,v[1])?v[0]:(c=c(),x.memoizedState=[c,u],c)}function Gj(c,u,x){return(zi&21)===0?(c.baseState&&(c.baseState=!1,cr=!0),c.memoizedState=x):(os(x,u)||(x=Lo(),ln.lanes|=x,Bi|=x,c.baseState=!0),u)}function K$(c,u){var x=Lt;Lt=x!==0&&4>x?x:4,c(!0);var v=Wg.transition;Wg.transition={};try{c(!1),u()}finally{Lt=x,Wg.transition=v}}function Yj(){return Wr().memoizedState}function G$(c,u,x){var v=Jo(c);if(x={lane:v,action:x,hasEagerState:!1,eagerState:null,next:null},Xj(c))Qj(u,x);else if(x=Ej(c,u,x,v),x!==null){var E=nr();us(x,c,v,E),Jj(x,u,v)}}function Y$(c,u,x){var v=Jo(c),E={lane:v,action:x,hasEagerState:!1,eagerState:null,next:null};if(Xj(c))Qj(u,E);else{var P=c.alternate;if(c.lanes===0&&(P===null||P.lanes===0)&&(P=u.lastRenderedReducer,P!==null))try{var K=u.lastRenderedState,X=P(K,x);if(E.hasEagerState=!0,E.eagerState=X,os(X,K)){var re=u.interleaved;re===null?(E.next=E,Fg(u)):(E.next=re.next,re.next=E),u.interleaved=E;return}}catch{}finally{}x=Ej(c,u,E,v),x!==null&&(E=nr(),us(x,c,v,E),Jj(x,u,v))}}function Xj(c){var u=c.alternate;return c===ln||u!==null&&u===ln}function Qj(c,u){Xc=kf=!0;var x=c.pending;x===null?u.next=u:(u.next=x.next,x.next=u),c.pending=u}function Jj(c,u,x){if((x&4194240)!==0){var v=u.lanes;v&=c.pendingLanes,x|=v,u.lanes=x,As(c,x)}}var Cf={readContext:Vr,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},X$={readContext:Vr,useCallback:function(c,u){return Ms().memoizedState=[c,u===void 0?null:u],c},useContext:Vr,useEffect:Bj,useImperativeHandle:function(c,u,x){return x=x!=null?x.concat([c]):null,Sf(4194308,4,Vj.bind(null,u,c),x)},useLayoutEffect:function(c,u){return Sf(4194308,4,c,u)},useInsertionEffect:function(c,u){return Sf(4,2,c,u)},useMemo:function(c,u){var x=Ms();return u=u===void 0?null:u,c=c(),x.memoizedState=[c,u],c},useReducer:function(c,u,x){var v=Ms();return u=x!==void 0?x(u):u,v.memoizedState=v.baseState=u,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:u},v.queue=c,c=c.dispatch=G$.bind(null,ln,c),[v.memoizedState,c]},useRef:function(c){var u=Ms();return c={current:c},u.memoizedState=c},useState:Fj,useDebugValue:Jg,useDeferredValue:function(c){return Ms().memoizedState=c},useTransition:function(){var c=Fj(!1),u=c[0];return c=K$.bind(null,c[1]),Ms().memoizedState=c,[u,c]},useMutableSource:function(){},useSyncExternalStore:function(c,u,x){var v=ln,E=Ms();if(nn){if(x===void 0)throw Error(n(407));x=x()}else{if(x=u(),On===null)throw Error(n(349));(zi&30)!==0||$j(v,u,x)}E.memoizedState=x;var P={value:x,getSnapshot:u};return E.queue=P,Bj(Mj.bind(null,v,P,c),[c]),v.flags|=2048,Zc(9,Ij.bind(null,v,P,x,u),void 0,null),x},useId:function(){var c=Ms(),u=On.identifierPrefix;if(nn){var x=lo,v=ao;x=(v&~(1<<32-In(v)-1)).toString(32)+x,u=":"+u+"R"+x,x=Qc++,0<x&&(u+="H"+x.toString(32)),u+=":"}else x=q$++,u=":"+u+"r"+x.toString(32)+":";return c.memoizedState=u},unstable_isNewReconciler:!1},Q$={readContext:Vr,useCallback:qj,useContext:Vr,useEffect:Qg,useImperativeHandle:Wj,useInsertionEffect:Uj,useLayoutEffect:Hj,useMemo:Kj,useReducer:Yg,useRef:zj,useState:function(){return Yg(Jc)},useDebugValue:Jg,useDeferredValue:function(c){var u=Wr();return Gj(u,Cn.memoizedState,c)},useTransition:function(){var c=Yg(Jc)[0],u=Wr().memoizedState;return[c,u]},useMutableSource:_j,useSyncExternalStore:Dj,useId:Yj,unstable_isNewReconciler:!1},J$={readContext:Vr,useCallback:qj,useContext:Vr,useEffect:Qg,useImperativeHandle:Wj,useInsertionEffect:Uj,useLayoutEffect:Hj,useMemo:Kj,useReducer:Xg,useRef:zj,useState:function(){return Xg(Jc)},useDebugValue:Jg,useDeferredValue:function(c){var u=Wr();return Cn===null?u.memoizedState=c:Gj(u,Cn.memoizedState,c)},useTransition:function(){var c=Xg(Jc)[0],u=Wr().memoizedState;return[c,u]},useMutableSource:_j,useSyncExternalStore:Dj,useId:Yj,unstable_isNewReconciler:!1};function as(c,u){if(c&&c.defaultProps){u=M({},u),c=c.defaultProps;for(var x in c)u[x]===void 0&&(u[x]=c[x]);return u}return u}function Zg(c,u,x,v){u=c.memoizedState,x=x(v,u),x=x==null?u:M({},u,x),c.memoizedState=x,c.lanes===0&&(c.updateQueue.baseState=x)}var Ef={isMounted:function(c){return(c=c._reactInternals)?mt(c)===c:!1},enqueueSetState:function(c,u,x){c=c._reactInternals;var v=nr(),E=Jo(c),P=uo(v,E);P.payload=u,x!=null&&(P.callback=x),u=Go(c,P,E),u!==null&&(us(u,c,E,v),bf(u,c,E))},enqueueReplaceState:function(c,u,x){c=c._reactInternals;var v=nr(),E=Jo(c),P=uo(v,E);P.tag=1,P.payload=u,x!=null&&(P.callback=x),u=Go(c,P,E),u!==null&&(us(u,c,E,v),bf(u,c,E))},enqueueForceUpdate:function(c,u){c=c._reactInternals;var x=nr(),v=Jo(c),E=uo(x,v);E.tag=2,u!=null&&(E.callback=u),u=Go(c,E,v),u!==null&&(us(u,c,v,x),bf(u,c,v))}};function Zj(c,u,x,v,E,P,K){return c=c.stateNode,typeof c.shouldComponentUpdate=="function"?c.shouldComponentUpdate(v,P,K):u.prototype&&u.prototype.isPureReactComponent?!Fc(x,v)||!Fc(E,P):!0}function ek(c,u,x){var v=!1,E=Wo,P=u.contextType;return typeof P=="object"&&P!==null?P=Vr(P):(E=lr(u)?Ii:Gn.current,v=u.contextTypes,P=(v=v!=null)?Va(c,E):Wo),u=new u(x,P),c.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Ef,c.stateNode=u,u._reactInternals=c,v&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=E,c.__reactInternalMemoizedMaskedChildContext=P),u}function tk(c,u,x,v){c=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(x,v),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(x,v),u.state!==c&&Ef.enqueueReplaceState(u,u.state,null)}function ex(c,u,x,v){var E=c.stateNode;E.props=x,E.state=c.memoizedState,E.refs={},zg(c);var P=u.contextType;typeof P=="object"&&P!==null?E.context=Vr(P):(P=lr(u)?Ii:Gn.current,E.context=Va(c,P)),E.state=c.memoizedState,P=u.getDerivedStateFromProps,typeof P=="function"&&(Zg(c,u,P,x),E.state=c.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(u=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),u!==E.state&&Ef.enqueueReplaceState(E,E.state,null),vf(c,x,E,v),E.state=c.memoizedState),typeof E.componentDidMount=="function"&&(c.flags|=4194308)}function Ja(c,u){try{var x="",v=u;do x+=ne(v),v=v.return;while(v);var E=x}catch(P){E=`
|
|
39
|
+
Error generating stack: `+P.message+`
|
|
40
|
+
`+P.stack}return{value:c,source:u,stack:E,digest:null}}function tx(c,u,x){return{value:c,source:null,stack:x??null,digest:u??null}}function nx(c,u){try{console.error(u.value)}catch(x){setTimeout(function(){throw x})}}var Z$=typeof WeakMap=="function"?WeakMap:Map;function nk(c,u,x){x=uo(-1,x),x.tag=3,x.payload={element:null};var v=u.value;return x.callback=function(){$f||($f=!0,xx=v),nx(c,u)},x}function rk(c,u,x){x=uo(-1,x),x.tag=3;var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var E=u.value;x.payload=function(){return v(E)},x.callback=function(){nx(c,u)}}var P=c.stateNode;return P!==null&&typeof P.componentDidCatch=="function"&&(x.callback=function(){nx(c,u),typeof v!="function"&&(Xo===null?Xo=new Set([this]):Xo.add(this));var K=u.stack;this.componentDidCatch(u.value,{componentStack:K!==null?K:""})}),x}function sk(c,u,x){var v=c.pingCache;if(v===null){v=c.pingCache=new Z$;var E=new Set;v.set(u,E)}else E=v.get(u),E===void 0&&(E=new Set,v.set(u,E));E.has(x)||(E.add(x),c=pI.bind(null,c,u,x),u.then(c,c))}function ok(c){do{var u;if((u=c.tag===13)&&(u=c.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return c;c=c.return}while(c!==null);return null}function ik(c,u,x,v,E){return(c.mode&1)===0?(c===u?c.flags|=65536:(c.flags|=128,x.flags|=131072,x.flags&=-52805,x.tag===1&&(x.alternate===null?x.tag=17:(u=uo(-1,1),u.tag=2,Go(x,u,1))),x.lanes|=1),c):(c.flags|=65536,c.lanes=E,c)}var eI=C.ReactCurrentOwner,cr=!1;function tr(c,u,x,v){u.child=c===null?Cj(u,null,x,v):Ga(u,c.child,x,v)}function ak(c,u,x,v,E){x=x.render;var P=u.ref;return Xa(u,E),v=Kg(c,u,x,v,P,E),x=Gg(),c!==null&&!cr?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,fo(c,u,E)):(nn&&x&&Ag(u),u.flags|=1,tr(c,u,v,E),u.child)}function lk(c,u,x,v,E){if(c===null){var P=x.type;return typeof P=="function"&&!Sx(P)&&P.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(u.tag=15,u.type=P,ck(c,u,P,v,E)):(c=zf(x.type,null,v,u,u.mode,E),c.ref=u.ref,c.return=u,u.child=c)}if(P=c.child,(c.lanes&E)===0){var K=P.memoizedProps;if(x=x.compare,x=x!==null?x:Fc,x(K,v)&&c.ref===u.ref)return fo(c,u,E)}return u.flags|=1,c=ei(P,v),c.ref=u.ref,c.return=u,u.child=c}function ck(c,u,x,v,E){if(c!==null){var P=c.memoizedProps;if(Fc(P,v)&&c.ref===u.ref)if(cr=!1,u.pendingProps=v=P,(c.lanes&E)!==0)(c.flags&131072)!==0&&(cr=!0);else return u.lanes=c.lanes,fo(c,u,E)}return rx(c,u,x,v,E)}function uk(c,u,x){var v=u.pendingProps,E=v.children,P=c!==null?c.memoizedState:null;if(v.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},qt(el,Er),Er|=x;else{if((x&1073741824)===0)return c=P!==null?P.baseLanes|x:x,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:c,cachePool:null,transitions:null},u.updateQueue=null,qt(el,Er),Er|=c,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},v=P!==null?P.baseLanes:x,qt(el,Er),Er|=v}else P!==null?(v=P.baseLanes|x,u.memoizedState=null):v=x,qt(el,Er),Er|=v;return tr(c,u,E,x),u.child}function dk(c,u){var x=u.ref;(c===null&&x!==null||c!==null&&c.ref!==x)&&(u.flags|=512,u.flags|=2097152)}function rx(c,u,x,v,E){var P=lr(x)?Ii:Gn.current;return P=Va(u,P),Xa(u,E),x=Kg(c,u,x,v,P,E),v=Gg(),c!==null&&!cr?(u.updateQueue=c.updateQueue,u.flags&=-2053,c.lanes&=~E,fo(c,u,E)):(nn&&v&&Ag(u),u.flags|=1,tr(c,u,x,E),u.child)}function fk(c,u,x,v,E){if(lr(x)){var P=!0;df(u)}else P=!1;if(Xa(u,E),u.stateNode===null)Rf(c,u),ek(u,x,v),ex(u,x,v,E),v=!0;else if(c===null){var K=u.stateNode,X=u.memoizedProps;K.props=X;var re=K.context,ge=x.contextType;typeof ge=="object"&&ge!==null?ge=Vr(ge):(ge=lr(x)?Ii:Gn.current,ge=Va(u,ge));var Ae=x.getDerivedStateFromProps,_e=typeof Ae=="function"||typeof K.getSnapshotBeforeUpdate=="function";_e||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(X!==v||re!==ge)&&tk(u,K,v,ge),Ko=!1;var Re=u.memoizedState;K.state=Re,vf(u,v,K,E),re=u.memoizedState,X!==v||Re!==re||ar.current||Ko?(typeof Ae=="function"&&(Zg(u,x,Ae,v),re=u.memoizedState),(X=Ko||Zj(u,x,X,v,Re,re,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"&&(u.flags|=4194308)):(typeof K.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=v,u.memoizedState=re),K.props=v,K.state=re,K.context=ge,v=X):(typeof K.componentDidMount=="function"&&(u.flags|=4194308),v=!1)}else{K=u.stateNode,Tj(c,u),X=u.memoizedProps,ge=u.type===u.elementType?X:as(u.type,X),K.props=ge,_e=u.pendingProps,Re=K.context,re=x.contextType,typeof re=="object"&&re!==null?re=Vr(re):(re=lr(x)?Ii:Gn.current,re=Va(u,re));var Ke=x.getDerivedStateFromProps;(Ae=typeof Ke=="function"||typeof K.getSnapshotBeforeUpdate=="function")||typeof K.UNSAFE_componentWillReceiveProps!="function"&&typeof K.componentWillReceiveProps!="function"||(X!==_e||Re!==re)&&tk(u,K,v,re),Ko=!1,Re=u.memoizedState,K.state=Re,vf(u,v,K,E);var Ze=u.memoizedState;X!==_e||Re!==Ze||ar.current||Ko?(typeof Ke=="function"&&(Zg(u,x,Ke,v),Ze=u.memoizedState),(ge=Ko||Zj(u,x,ge,v,Re,Ze,re)||!1)?(Ae||typeof K.UNSAFE_componentWillUpdate!="function"&&typeof K.componentWillUpdate!="function"||(typeof K.componentWillUpdate=="function"&&K.componentWillUpdate(v,Ze,re),typeof K.UNSAFE_componentWillUpdate=="function"&&K.UNSAFE_componentWillUpdate(v,Ze,re)),typeof K.componentDidUpdate=="function"&&(u.flags|=4),typeof K.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof K.componentDidUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=1024),u.memoizedProps=v,u.memoizedState=Ze),K.props=v,K.state=Ze,K.context=re,v=ge):(typeof K.componentDidUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=4),typeof K.getSnapshotBeforeUpdate!="function"||X===c.memoizedProps&&Re===c.memoizedState||(u.flags|=1024),v=!1)}return sx(c,u,x,v,P,E)}function sx(c,u,x,v,E,P){dk(c,u);var K=(u.flags&128)!==0;if(!v&&!K)return E&&xj(u,x,!1),fo(c,u,P);v=u.stateNode,eI.current=u;var X=K&&typeof x.getDerivedStateFromError!="function"?null:v.render();return u.flags|=1,c!==null&&K?(u.child=Ga(u,c.child,null,P),u.child=Ga(u,null,X,P)):tr(c,u,X,P),u.memoizedState=v.state,E&&xj(u,x,!0),u.child}function pk(c){var u=c.stateNode;u.pendingContext?mj(c,u.pendingContext,u.pendingContext!==u.context):u.context&&mj(c,u.context,!1),Bg(c,u.containerInfo)}function hk(c,u,x,v,E){return Ka(),$g(E),u.flags|=256,tr(c,u,x,v),u.child}var ox={dehydrated:null,treeContext:null,retryLane:0};function ix(c){return{baseLanes:c,cachePool:null,transitions:null}}function mk(c,u,x){var v=u.pendingProps,E=an.current,P=!1,K=(u.flags&128)!==0,X;if((X=K)||(X=c!==null&&c.memoizedState===null?!1:(E&2)!==0),X?(P=!0,u.flags&=-129):(c===null||c.memoizedState!==null)&&(E|=1),qt(an,E&1),c===null)return Dg(u),c=u.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?((u.mode&1)===0?u.lanes=1:c.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(K=v.children,c=v.fallback,P?(v=u.mode,P=u.child,K={mode:"hidden",children:K},(v&1)===0&&P!==null?(P.childLanes=0,P.pendingProps=K):P=Bf(K,v,0,null),c=Wi(c,v,x,null),P.return=u,c.return=u,P.sibling=c,u.child=P,u.child.memoizedState=ix(x),u.memoizedState=ox,c):ax(u,K));if(E=c.memoizedState,E!==null&&(X=E.dehydrated,X!==null))return tI(c,u,K,v,X,E,x);if(P){P=v.fallback,K=u.mode,E=c.child,X=E.sibling;var re={mode:"hidden",children:v.children};return(K&1)===0&&u.child!==E?(v=u.child,v.childLanes=0,v.pendingProps=re,u.deletions=null):(v=ei(E,re),v.subtreeFlags=E.subtreeFlags&14680064),X!==null?P=ei(X,P):(P=Wi(P,K,x,null),P.flags|=2),P.return=u,v.return=u,v.sibling=P,u.child=v,v=P,P=u.child,K=c.child.memoizedState,K=K===null?ix(x):{baseLanes:K.baseLanes|x,cachePool:null,transitions:K.transitions},P.memoizedState=K,P.childLanes=c.childLanes&~x,u.memoizedState=ox,v}return P=c.child,c=P.sibling,v=ei(P,{mode:"visible",children:v.children}),(u.mode&1)===0&&(v.lanes=x),v.return=u,v.sibling=null,c!==null&&(x=u.deletions,x===null?(u.deletions=[c],u.flags|=16):x.push(c)),u.child=v,u.memoizedState=null,v}function ax(c,u){return u=Bf({mode:"visible",children:u},c.mode,0,null),u.return=c,c.child=u}function Tf(c,u,x,v){return v!==null&&$g(v),Ga(u,c.child,null,x),c=ax(u,u.pendingProps.children),c.flags|=2,u.memoizedState=null,c}function tI(c,u,x,v,E,P,K){if(x)return u.flags&256?(u.flags&=-257,v=tx(Error(n(422))),Tf(c,u,K,v)):u.memoizedState!==null?(u.child=c.child,u.flags|=128,null):(P=v.fallback,E=u.mode,v=Bf({mode:"visible",children:v.children},E,0,null),P=Wi(P,E,K,null),P.flags|=2,v.return=u,P.return=u,v.sibling=P,u.child=v,(u.mode&1)!==0&&Ga(u,c.child,null,K),u.child.memoizedState=ix(K),u.memoizedState=ox,P);if((u.mode&1)===0)return Tf(c,u,K,null);if(E.data==="$!"){if(v=E.nextSibling&&E.nextSibling.dataset,v)var X=v.dgst;return v=X,P=Error(n(419)),v=tx(P,v,void 0),Tf(c,u,K,v)}if(X=(K&c.childLanes)!==0,cr||X){if(v=On,v!==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&(v.suspendedLanes|K))!==0?0:E,E!==0&&E!==P.retryLane&&(P.retryLane=E,co(c,E),us(v,c,E,-1))}return kx(),v=tx(Error(n(421))),Tf(c,u,K,v)}return E.data==="$?"?(u.flags|=128,u.child=c.child,u=hI.bind(null,c),E._reactRetry=u,null):(c=P.treeContext,Cr=Ho(E.nextSibling),Nr=u,nn=!0,is=null,c!==null&&(Ur[Hr++]=ao,Ur[Hr++]=lo,Ur[Hr++]=Mi,ao=c.id,lo=c.overflow,Mi=u),u=ax(u,v.children),u.flags|=4096,u)}function gk(c,u,x){c.lanes|=u;var v=c.alternate;v!==null&&(v.lanes|=u),Og(c.return,u,x)}function lx(c,u,x,v,E){var P=c.memoizedState;P===null?c.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:v,tail:x,tailMode:E}:(P.isBackwards=u,P.rendering=null,P.renderingStartTime=0,P.last=v,P.tail=x,P.tailMode=E)}function xk(c,u,x){var v=u.pendingProps,E=v.revealOrder,P=v.tail;if(tr(c,u,v.children,x),v=an.current,(v&2)!==0)v=v&1|2,u.flags|=128;else{if(c!==null&&(c.flags&128)!==0)e:for(c=u.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&gk(c,x,u);else if(c.tag===19)gk(c,x,u);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===u)break e;for(;c.sibling===null;){if(c.return===null||c.return===u)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}v&=1}if(qt(an,v),(u.mode&1)===0)u.memoizedState=null;else switch(E){case"forwards":for(x=u.child,E=null;x!==null;)c=x.alternate,c!==null&&wf(c)===null&&(E=x),x=x.sibling;x=E,x===null?(E=u.child,u.child=null):(E=x.sibling,x.sibling=null),lx(u,!1,E,x,P);break;case"backwards":for(x=null,E=u.child,u.child=null;E!==null;){if(c=E.alternate,c!==null&&wf(c)===null){u.child=E;break}c=E.sibling,E.sibling=x,x=E,E=c}lx(u,!0,x,null,P);break;case"together":lx(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function Rf(c,u){(u.mode&1)===0&&c!==null&&(c.alternate=null,u.alternate=null,u.flags|=2)}function fo(c,u,x){if(c!==null&&(u.dependencies=c.dependencies),Bi|=u.lanes,(x&u.childLanes)===0)return null;if(c!==null&&u.child!==c.child)throw Error(n(153));if(u.child!==null){for(c=u.child,x=ei(c,c.pendingProps),u.child=x,x.return=u;c.sibling!==null;)c=c.sibling,x=x.sibling=ei(c,c.pendingProps),x.return=u;x.sibling=null}return u.child}function nI(c,u,x){switch(u.tag){case 3:pk(u),Ka();break;case 5:Pj(u);break;case 1:lr(u.type)&&df(u);break;case 4:Bg(u,u.stateNode.containerInfo);break;case 10:var v=u.type._context,E=u.memoizedProps.value;qt(xf,v._currentValue),v._currentValue=E;break;case 13:if(v=u.memoizedState,v!==null)return v.dehydrated!==null?(qt(an,an.current&1),u.flags|=128,null):(x&u.child.childLanes)!==0?mk(c,u,x):(qt(an,an.current&1),c=fo(c,u,x),c!==null?c.sibling:null);qt(an,an.current&1);break;case 19:if(v=(x&u.childLanes)!==0,(c.flags&128)!==0){if(v)return xk(c,u,x);u.flags|=128}if(E=u.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),qt(an,an.current),v)break;return null;case 22:case 23:return u.lanes=0,uk(c,u,x)}return fo(c,u,x)}var yk,cx,bk,vk;yk=function(c,u){for(var x=u.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===u)break;for(;x.sibling===null;){if(x.return===null||x.return===u)return;x=x.return}x.sibling.return=x.return,x=x.sibling}},cx=function(){},bk=function(c,u,x,v){var E=c.memoizedProps;if(E!==v){c=u.stateNode,Fi(Is.current);var P=null;switch(x){case"input":E=Ue(c,E),v=Ue(c,v),P=[];break;case"select":E=M({},E,{value:void 0}),v=M({},v,{value:void 0}),P=[];break;case"textarea":E=nt(c,E),v=nt(c,v),P=[];break;default:typeof E.onClick!="function"&&typeof v.onClick=="function"&&(c.onclick=lf)}qe(x,v);var K;x=null;for(ge in E)if(!v.hasOwnProperty(ge)&&E.hasOwnProperty(ge)&&E[ge]!=null)if(ge==="style"){var X=E[ge];for(K in X)X.hasOwnProperty(K)&&(x||(x={}),x[K]="")}else ge!=="dangerouslySetInnerHTML"&&ge!=="children"&&ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&ge!=="autoFocus"&&(o.hasOwnProperty(ge)?P||(P=[]):(P=P||[]).push(ge,null));for(ge in v){var re=v[ge];if(X=E!=null?E[ge]:void 0,v.hasOwnProperty(ge)&&re!==X&&(re!=null||X!=null))if(ge==="style")if(X){for(K in X)!X.hasOwnProperty(K)||re&&re.hasOwnProperty(K)||(x||(x={}),x[K]="");for(K in re)re.hasOwnProperty(K)&&X[K]!==re[K]&&(x||(x={}),x[K]=re[K])}else x||(P||(P=[]),P.push(ge,x)),x=re;else ge==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,X=X?X.__html:void 0,re!=null&&X!==re&&(P=P||[]).push(ge,re)):ge==="children"?typeof re!="string"&&typeof re!="number"||(P=P||[]).push(ge,""+re):ge!=="suppressContentEditableWarning"&&ge!=="suppressHydrationWarning"&&(o.hasOwnProperty(ge)?(re!=null&&ge==="onScroll"&&Yt("scroll",c),P||X===re||(P=[])):(P=P||[]).push(ge,re))}x&&(P=P||[]).push("style",x);var ge=P;(u.updateQueue=ge)&&(u.flags|=4)}},vk=function(c,u,x,v){x!==v&&(u.flags|=4)};function eu(c,u){if(!nn)switch(c.tailMode){case"hidden":u=c.tail;for(var x=null;u!==null;)u.alternate!==null&&(x=u),u=u.sibling;x===null?c.tail=null:x.sibling=null;break;case"collapsed":x=c.tail;for(var v=null;x!==null;)x.alternate!==null&&(v=x),x=x.sibling;v===null?u||c.tail===null?c.tail=null:c.tail.sibling=null:v.sibling=null}}function Xn(c){var u=c.alternate!==null&&c.alternate.child===c.child,x=0,v=0;if(u)for(var E=c.child;E!==null;)x|=E.lanes|E.childLanes,v|=E.subtreeFlags&14680064,v|=E.flags&14680064,E.return=c,E=E.sibling;else for(E=c.child;E!==null;)x|=E.lanes|E.childLanes,v|=E.subtreeFlags,v|=E.flags,E.return=c,E=E.sibling;return c.subtreeFlags|=v,c.childLanes=x,u}function rI(c,u,x){var v=u.pendingProps;switch(Pg(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xn(u),null;case 1:return lr(u.type)&&uf(),Xn(u),null;case 3:return v=u.stateNode,Qa(),Xt(ar),Xt(Gn),Vg(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(c===null||c.child===null)&&(mf(u)?u.flags|=4:c===null||c.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,is!==null&&(vx(is),is=null))),cx(c,u),Xn(u),null;case 5:Ug(u);var E=Fi(Yc.current);if(x=u.type,c!==null&&u.stateNode!=null)bk(c,u,x,v,E),c.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!v){if(u.stateNode===null)throw Error(n(166));return Xn(u),null}if(c=Fi(Is.current),mf(u)){v=u.stateNode,x=u.type;var P=u.memoizedProps;switch(v[$s]=u,v[Vc]=P,c=(u.mode&1)!==0,x){case"dialog":Yt("cancel",v),Yt("close",v);break;case"iframe":case"object":case"embed":Yt("load",v);break;case"video":case"audio":for(E=0;E<Bc.length;E++)Yt(Bc[E],v);break;case"source":Yt("error",v);break;case"img":case"image":case"link":Yt("error",v),Yt("load",v);break;case"details":Yt("toggle",v);break;case"input":oe(v,P),Yt("invalid",v);break;case"select":v._wrapperState={wasMultiple:!!P.multiple},Yt("invalid",v);break;case"textarea":wt(v,P),Yt("invalid",v)}qe(x,P),E=null;for(var K in P)if(P.hasOwnProperty(K)){var X=P[K];K==="children"?typeof X=="string"?v.textContent!==X&&(P.suppressHydrationWarning!==!0&&af(v.textContent,X,c),E=["children",X]):typeof X=="number"&&v.textContent!==""+X&&(P.suppressHydrationWarning!==!0&&af(v.textContent,X,c),E=["children",""+X]):o.hasOwnProperty(K)&&X!=null&&K==="onScroll"&&Yt("scroll",v)}switch(x){case"input":Ee(v),De(v,P,!0);break;case"textarea":Ee(v),st(v);break;case"select":case"option":break;default:typeof P.onClick=="function"&&(v.onclick=lf)}v=E,u.updateQueue=v,v!==null&&(u.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 v.is=="string"?c=K.createElement(x,{is:v.is}):(c=K.createElement(x),x==="select"&&(K=c,v.multiple?K.multiple=!0:v.size&&(K.size=v.size))):c=K.createElementNS(c,x),c[$s]=u,c[Vc]=v,yk(c,u,!1,!1),u.stateNode=c;e:{switch(K=de(x,v),x){case"dialog":Yt("cancel",c),Yt("close",c),E=v;break;case"iframe":case"object":case"embed":Yt("load",c),E=v;break;case"video":case"audio":for(E=0;E<Bc.length;E++)Yt(Bc[E],c);E=v;break;case"source":Yt("error",c),E=v;break;case"img":case"image":case"link":Yt("error",c),Yt("load",c),E=v;break;case"details":Yt("toggle",c),E=v;break;case"input":oe(c,v),E=Ue(c,v),Yt("invalid",c);break;case"option":E=v;break;case"select":c._wrapperState={wasMultiple:!!v.multiple},E=M({},v,{value:void 0}),Yt("invalid",c);break;case"textarea":wt(c,v),E=nt(c,v),Yt("invalid",c);break;default:E=v}qe(x,E),X=E;for(P in X)if(X.hasOwnProperty(P)){var re=X[P];P==="style"?me(c,re):P==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,re!=null&&ie(c,re)):P==="children"?typeof re=="string"?(x!=="textarea"||re!=="")&&we(c,re):typeof re=="number"&&we(c,""+re):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(o.hasOwnProperty(P)?re!=null&&P==="onScroll"&&Yt("scroll",c):re!=null&&S(c,P,re,K))}switch(x){case"input":Ee(c),De(c,v,!1);break;case"textarea":Ee(c),st(c);break;case"option":v.value!=null&&c.setAttribute("value",""+te(v.value));break;case"select":c.multiple=!!v.multiple,P=v.value,P!=null?Oe(c,!!v.multiple,P,!1):v.defaultValue!=null&&Oe(c,!!v.multiple,v.defaultValue,!0);break;default:typeof E.onClick=="function"&&(c.onclick=lf)}switch(x){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}}v&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Xn(u),null;case 6:if(c&&u.stateNode!=null)vk(c,u,c.memoizedProps,v);else{if(typeof v!="string"&&u.stateNode===null)throw Error(n(166));if(x=Fi(Yc.current),Fi(Is.current),mf(u)){if(v=u.stateNode,x=u.memoizedProps,v[$s]=u,(P=v.nodeValue!==x)&&(c=Nr,c!==null))switch(c.tag){case 3:af(v.nodeValue,x,(c.mode&1)!==0);break;case 5:c.memoizedProps.suppressHydrationWarning!==!0&&af(v.nodeValue,x,(c.mode&1)!==0)}P&&(u.flags|=4)}else v=(x.nodeType===9?x:x.ownerDocument).createTextNode(v),v[$s]=u,u.stateNode=v}return Xn(u),null;case 13:if(Xt(an),v=u.memoizedState,c===null||c.memoizedState!==null&&c.memoizedState.dehydrated!==null){if(nn&&Cr!==null&&(u.mode&1)!==0&&(u.flags&128)===0)kj(),Ka(),u.flags|=98560,P=!1;else if(P=mf(u),v!==null&&v.dehydrated!==null){if(c===null){if(!P)throw Error(n(318));if(P=u.memoizedState,P=P!==null?P.dehydrated:null,!P)throw Error(n(317));P[$s]=u}else Ka(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Xn(u),P=!1}else is!==null&&(vx(is),is=null),P=!0;if(!P)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=x,u):(v=v!==null,v!==(c!==null&&c.memoizedState!==null)&&v&&(u.child.flags|=8192,(u.mode&1)!==0&&(c===null||(an.current&1)!==0?En===0&&(En=3):kx())),u.updateQueue!==null&&(u.flags|=4),Xn(u),null);case 4:return Qa(),cx(c,u),c===null&&Uc(u.stateNode.containerInfo),Xn(u),null;case 10:return Lg(u.type._context),Xn(u),null;case 17:return lr(u.type)&&uf(),Xn(u),null;case 19:if(Xt(an),P=u.memoizedState,P===null)return Xn(u),null;if(v=(u.flags&128)!==0,K=P.rendering,K===null)if(v)eu(P,!1);else{if(En!==0||c!==null&&(c.flags&128)!==0)for(c=u.child;c!==null;){if(K=wf(c),K!==null){for(u.flags|=128,eu(P,!1),v=K.updateQueue,v!==null&&(u.updateQueue=v,u.flags|=4),u.subtreeFlags=0,v=x,x=u.child;x!==null;)P=x,c=v,P.flags&=14680066,K=P.alternate,K===null?(P.childLanes=0,P.lanes=c,P.child=null,P.subtreeFlags=0,P.memoizedProps=null,P.memoizedState=null,P.updateQueue=null,P.dependencies=null,P.stateNode=null):(P.childLanes=K.childLanes,P.lanes=K.lanes,P.child=K.child,P.subtreeFlags=0,P.deletions=null,P.memoizedProps=K.memoizedProps,P.memoizedState=K.memoizedState,P.updateQueue=K.updateQueue,P.type=K.type,c=K.dependencies,P.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),x=x.sibling;return qt(an,an.current&1|2),u.child}c=c.sibling}P.tail!==null&&Ut()>tl&&(u.flags|=128,v=!0,eu(P,!1),u.lanes=4194304)}else{if(!v)if(c=wf(K),c!==null){if(u.flags|=128,v=!0,x=c.updateQueue,x!==null&&(u.updateQueue=x,u.flags|=4),eu(P,!0),P.tail===null&&P.tailMode==="hidden"&&!K.alternate&&!nn)return Xn(u),null}else 2*Ut()-P.renderingStartTime>tl&&x!==1073741824&&(u.flags|=128,v=!0,eu(P,!1),u.lanes=4194304);P.isBackwards?(K.sibling=u.child,u.child=K):(x=P.last,x!==null?x.sibling=K:u.child=K,P.last=K)}return P.tail!==null?(u=P.tail,P.rendering=u,P.tail=u.sibling,P.renderingStartTime=Ut(),u.sibling=null,x=an.current,qt(an,v?x&1|2:x&1),u):(Xn(u),null);case 22:case 23:return jx(),v=u.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(u.flags|=8192),v&&(u.mode&1)!==0?(Er&1073741824)!==0&&(Xn(u),u.subtreeFlags&6&&(u.flags|=8192)):Xn(u),null;case 24:return null;case 25:return null}throw Error(n(156,u.tag))}function sI(c,u){switch(Pg(u),u.tag){case 1:return lr(u.type)&&uf(),c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 3:return Qa(),Xt(ar),Xt(Gn),Vg(),c=u.flags,(c&65536)!==0&&(c&128)===0?(u.flags=c&-65537|128,u):null;case 5:return Ug(u),null;case 13:if(Xt(an),c=u.memoizedState,c!==null&&c.dehydrated!==null){if(u.alternate===null)throw Error(n(340));Ka()}return c=u.flags,c&65536?(u.flags=c&-65537|128,u):null;case 19:return Xt(an),null;case 4:return Qa(),null;case 10:return Lg(u.type._context),null;case 22:case 23:return jx(),null;case 24:return null;default:return null}}var Af=!1,Qn=!1,oI=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function Za(c,u){var x=c.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(v){un(c,u,v)}else x.current=null}function ux(c,u,x){try{x()}catch(v){un(c,u,v)}}var wk=!1;function iI(c,u){if(jg=Mn,c=Z0(),hg(c)){if("selectionStart"in c)var x={start:c.selectionStart,end:c.selectionEnd};else e:{x=(x=c.ownerDocument)&&x.defaultView||window;var v=x.getSelection&&x.getSelection();if(v&&v.rangeCount!==0){x=v.anchorNode;var E=v.anchorOffset,P=v.focusNode;v=v.focusOffset;try{x.nodeType,P.nodeType}catch{x=null;break e}var K=0,X=-1,re=-1,ge=0,Ae=0,_e=c,Re=null;t:for(;;){for(var Ke;_e!==x||E!==0&&_e.nodeType!==3||(X=K+E),_e!==P||v!==0&&_e.nodeType!==3||(re=K+v),_e.nodeType===3&&(K+=_e.nodeValue.length),(Ke=_e.firstChild)!==null;)Re=_e,_e=Ke;for(;;){if(_e===c)break t;if(Re===x&&++ge===E&&(X=K),Re===P&&++Ae===v&&(re=K),(Ke=_e.nextSibling)!==null)break;_e=Re,Re=_e.parentNode}_e=Ke}x=X===-1||re===-1?null:{start:X,end:re}}else x=null}x=x||{start:0,end:0}}else x=null;for(kg={focusedElem:c,selectionRange:x},Mn=!1,Xe=u;Xe!==null;)if(u=Xe,c=u.child,(u.subtreeFlags&1028)!==0&&c!==null)c.return=u,Xe=c;else for(;Xe!==null;){u=Xe;try{var Ze=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(Ze!==null){var tt=Ze.memoizedProps,fn=Ze.memoizedState,fe=u.stateNode,ae=fe.getSnapshotBeforeUpdate(u.elementType===u.type?tt:as(u.type,tt),fn);fe.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var he=u.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(Fe){un(u,u.return,Fe)}if(c=u.sibling,c!==null){c.return=u.return,Xe=c;break}Xe=u.return}return Ze=wk,wk=!1,Ze}function tu(c,u,x){var v=u.updateQueue;if(v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&c)===c){var P=E.destroy;E.destroy=void 0,P!==void 0&&ux(u,x,P)}E=E.next}while(E!==v)}}function Pf(c,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var x=u=u.next;do{if((x.tag&c)===c){var v=x.create;x.destroy=v()}x=x.next}while(x!==u)}}function dx(c){var u=c.ref;if(u!==null){var x=c.stateNode;switch(c.tag){case 5:c=x;break;default:c=x}typeof u=="function"?u(c):u.current=c}}function jk(c){var u=c.alternate;u!==null&&(c.alternate=null,jk(u)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(u=c.stateNode,u!==null&&(delete u[$s],delete u[Vc],delete u[Eg],delete u[U$],delete u[H$])),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 kk(c){return c.tag===5||c.tag===3||c.tag===4}function Sk(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||kk(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 fx(c,u,x){var v=c.tag;if(v===5||v===6)c=c.stateNode,u?x.nodeType===8?x.parentNode.insertBefore(c,u):x.insertBefore(c,u):(x.nodeType===8?(u=x.parentNode,u.insertBefore(c,x)):(u=x,u.appendChild(c)),x=x._reactRootContainer,x!=null||u.onclick!==null||(u.onclick=lf));else if(v!==4&&(c=c.child,c!==null))for(fx(c,u,x),c=c.sibling;c!==null;)fx(c,u,x),c=c.sibling}function px(c,u,x){var v=c.tag;if(v===5||v===6)c=c.stateNode,u?x.insertBefore(c,u):x.appendChild(c);else if(v!==4&&(c=c.child,c!==null))for(px(c,u,x),c=c.sibling;c!==null;)px(c,u,x),c=c.sibling}var Hn=null,ls=!1;function Yo(c,u,x){for(x=x.child;x!==null;)Nk(c,u,x),x=x.sibling}function Nk(c,u,x){if(er&&typeof er.onCommitFiberUnmount=="function")try{er.onCommitFiberUnmount(Do,x)}catch{}switch(x.tag){case 5:Qn||Za(x,u);case 6:var v=Hn,E=ls;Hn=null,Yo(c,u,x),Hn=v,ls=E,Hn!==null&&(ls?(c=Hn,x=x.stateNode,c.nodeType===8?c.parentNode.removeChild(x):c.removeChild(x)):Hn.removeChild(x.stateNode));break;case 18:Hn!==null&&(ls?(c=Hn,x=x.stateNode,c.nodeType===8?Cg(c.parentNode,x):c.nodeType===1&&Cg(c,x),_t(c)):Cg(Hn,x.stateNode));break;case 4:v=Hn,E=ls,Hn=x.stateNode.containerInfo,ls=!0,Yo(c,u,x),Hn=v,ls=E;break;case 0:case 11:case 14:case 15:if(!Qn&&(v=x.updateQueue,v!==null&&(v=v.lastEffect,v!==null))){E=v=v.next;do{var P=E,K=P.destroy;P=P.tag,K!==void 0&&((P&2)!==0||(P&4)!==0)&&ux(x,u,K),E=E.next}while(E!==v)}Yo(c,u,x);break;case 1:if(!Qn&&(Za(x,u),v=x.stateNode,typeof v.componentWillUnmount=="function"))try{v.props=x.memoizedProps,v.state=x.memoizedState,v.componentWillUnmount()}catch(X){un(x,u,X)}Yo(c,u,x);break;case 21:Yo(c,u,x);break;case 22:x.mode&1?(Qn=(v=Qn)||x.memoizedState!==null,Yo(c,u,x),Qn=v):Yo(c,u,x);break;default:Yo(c,u,x)}}function Ck(c){var u=c.updateQueue;if(u!==null){c.updateQueue=null;var x=c.stateNode;x===null&&(x=c.stateNode=new oI),u.forEach(function(v){var E=mI.bind(null,c,v);x.has(v)||(x.add(v),v.then(E,E))})}}function cs(c,u){var x=u.deletions;if(x!==null)for(var v=0;v<x.length;v++){var E=x[v];try{var P=c,K=u,X=K;e:for(;X!==null;){switch(X.tag){case 5:Hn=X.stateNode,ls=!1;break e;case 3:Hn=X.stateNode.containerInfo,ls=!0;break e;case 4:Hn=X.stateNode.containerInfo,ls=!0;break e}X=X.return}if(Hn===null)throw Error(n(160));Nk(P,K,E),Hn=null,ls=!1;var re=E.alternate;re!==null&&(re.return=null),E.return=null}catch(ge){un(E,u,ge)}}if(u.subtreeFlags&12854)for(u=u.child;u!==null;)Ek(u,c),u=u.sibling}function Ek(c,u){var x=c.alternate,v=c.flags;switch(c.tag){case 0:case 11:case 14:case 15:if(cs(u,c),Ls(c),v&4){try{tu(3,c,c.return),Pf(3,c)}catch(tt){un(c,c.return,tt)}try{tu(5,c,c.return)}catch(tt){un(c,c.return,tt)}}break;case 1:cs(u,c),Ls(c),v&512&&x!==null&&Za(x,x.return);break;case 5:if(cs(u,c),Ls(c),v&512&&x!==null&&Za(x,x.return),c.flags&32){var E=c.stateNode;try{we(E,"")}catch(tt){un(c,c.return,tt)}}if(v&4&&(E=c.stateNode,E!=null)){var P=c.memoizedProps,K=x!==null?x.memoizedProps:P,X=c.type,re=c.updateQueue;if(c.updateQueue=null,re!==null)try{X==="input"&&P.type==="radio"&&P.name!=null&&je(E,P),de(X,K);var ge=de(X,P);for(K=0;K<re.length;K+=2){var Ae=re[K],_e=re[K+1];Ae==="style"?me(E,_e):Ae==="dangerouslySetInnerHTML"?ie(E,_e):Ae==="children"?we(E,_e):S(E,Ae,_e,ge)}switch(X){case"input":Se(E,P);break;case"textarea":it(E,P);break;case"select":var Re=E._wrapperState.wasMultiple;E._wrapperState.wasMultiple=!!P.multiple;var Ke=P.value;Ke!=null?Oe(E,!!P.multiple,Ke,!1):Re!==!!P.multiple&&(P.defaultValue!=null?Oe(E,!!P.multiple,P.defaultValue,!0):Oe(E,!!P.multiple,P.multiple?[]:"",!1))}E[Vc]=P}catch(tt){un(c,c.return,tt)}}break;case 6:if(cs(u,c),Ls(c),v&4){if(c.stateNode===null)throw Error(n(162));E=c.stateNode,P=c.memoizedProps;try{E.nodeValue=P}catch(tt){un(c,c.return,tt)}}break;case 3:if(cs(u,c),Ls(c),v&4&&x!==null&&x.memoizedState.isDehydrated)try{_t(u.containerInfo)}catch(tt){un(c,c.return,tt)}break;case 4:cs(u,c),Ls(c);break;case 13:cs(u,c),Ls(c),E=c.child,E.flags&8192&&(P=E.memoizedState!==null,E.stateNode.isHidden=P,!P||E.alternate!==null&&E.alternate.memoizedState!==null||(gx=Ut())),v&4&&Ck(c);break;case 22:if(Ae=x!==null&&x.memoizedState!==null,c.mode&1?(Qn=(ge=Qn)||Ae,cs(u,c),Qn=ge):cs(u,c),Ls(c),v&8192){if(ge=c.memoizedState!==null,(c.stateNode.isHidden=ge)&&!Ae&&(c.mode&1)!==0)for(Xe=c,Ae=c.child;Ae!==null;){for(_e=Xe=Ae;Xe!==null;){switch(Re=Xe,Ke=Re.child,Re.tag){case 0:case 11:case 14:case 15:tu(4,Re,Re.return);break;case 1:Za(Re,Re.return);var Ze=Re.stateNode;if(typeof Ze.componentWillUnmount=="function"){v=Re,x=Re.return;try{u=v,Ze.props=u.memoizedProps,Ze.state=u.memoizedState,Ze.componentWillUnmount()}catch(tt){un(v,x,tt)}}break;case 5:Za(Re,Re.return);break;case 22:if(Re.memoizedState!==null){Ak(_e);continue}}Ke!==null?(Ke.return=Re,Xe=Ke):Ak(_e)}Ae=Ae.sibling}e:for(Ae=null,_e=c;;){if(_e.tag===5){if(Ae===null){Ae=_e;try{E=_e.stateNode,ge?(P=E.style,typeof P.setProperty=="function"?P.setProperty("display","none","important"):P.display="none"):(X=_e.stateNode,re=_e.memoizedProps.style,K=re!=null&&re.hasOwnProperty("display")?re.display:null,X.style.display=se("display",K))}catch(tt){un(c,c.return,tt)}}}else if(_e.tag===6){if(Ae===null)try{_e.stateNode.nodeValue=ge?"":_e.memoizedProps}catch(tt){un(c,c.return,tt)}}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;Ae===_e&&(Ae=null),_e=_e.return}Ae===_e&&(Ae=null),_e.sibling.return=_e.return,_e=_e.sibling}}break;case 19:cs(u,c),Ls(c),v&4&&Ck(c);break;case 21:break;default:cs(u,c),Ls(c)}}function Ls(c){var u=c.flags;if(u&2){try{e:{for(var x=c.return;x!==null;){if(kk(x)){var v=x;break e}x=x.return}throw Error(n(160))}switch(v.tag){case 5:var E=v.stateNode;v.flags&32&&(we(E,""),v.flags&=-33);var P=Sk(c);px(c,P,E);break;case 3:case 4:var K=v.stateNode.containerInfo,X=Sk(c);fx(c,X,K);break;default:throw Error(n(161))}}catch(re){un(c,c.return,re)}c.flags&=-3}u&4096&&(c.flags&=-4097)}function aI(c,u,x){Xe=c,Tk(c)}function Tk(c,u,x){for(var v=(c.mode&1)!==0;Xe!==null;){var E=Xe,P=E.child;if(E.tag===22&&v){var K=E.memoizedState!==null||Af;if(!K){var X=E.alternate,re=X!==null&&X.memoizedState!==null||Qn;X=Af;var ge=Qn;if(Af=K,(Qn=re)&&!ge)for(Xe=E;Xe!==null;)K=Xe,re=K.child,K.tag===22&&K.memoizedState!==null?Pk(E):re!==null?(re.return=K,Xe=re):Pk(E);for(;P!==null;)Xe=P,Tk(P),P=P.sibling;Xe=E,Af=X,Qn=ge}Rk(c)}else(E.subtreeFlags&8772)!==0&&P!==null?(P.return=E,Xe=P):Rk(c)}}function Rk(c){for(;Xe!==null;){var u=Xe;if((u.flags&8772)!==0){var x=u.alternate;try{if((u.flags&8772)!==0)switch(u.tag){case 0:case 11:case 15:Qn||Pf(5,u);break;case 1:var v=u.stateNode;if(u.flags&4&&!Qn)if(x===null)v.componentDidMount();else{var E=u.elementType===u.type?x.memoizedProps:as(u.type,x.memoizedProps);v.componentDidUpdate(E,x.memoizedState,v.__reactInternalSnapshotBeforeUpdate)}var P=u.updateQueue;P!==null&&Aj(u,P,v);break;case 3:var K=u.updateQueue;if(K!==null){if(x=null,u.child!==null)switch(u.child.tag){case 5:x=u.child.stateNode;break;case 1:x=u.child.stateNode}Aj(u,K,x)}break;case 5:var X=u.stateNode;if(x===null&&u.flags&4){x=X;var re=u.memoizedProps;switch(u.type){case"button":case"input":case"select":case"textarea":re.autoFocus&&x.focus();break;case"img":re.src&&(x.src=re.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(u.memoizedState===null){var ge=u.alternate;if(ge!==null){var Ae=ge.memoizedState;if(Ae!==null){var _e=Ae.dehydrated;_e!==null&&_t(_e)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Qn||u.flags&512&&dx(u)}catch(Re){un(u,u.return,Re)}}if(u===c){Xe=null;break}if(x=u.sibling,x!==null){x.return=u.return,Xe=x;break}Xe=u.return}}function Ak(c){for(;Xe!==null;){var u=Xe;if(u===c){Xe=null;break}var x=u.sibling;if(x!==null){x.return=u.return,Xe=x;break}Xe=u.return}}function Pk(c){for(;Xe!==null;){var u=Xe;try{switch(u.tag){case 0:case 11:case 15:var x=u.return;try{Pf(4,u)}catch(re){un(u,x,re)}break;case 1:var v=u.stateNode;if(typeof v.componentDidMount=="function"){var E=u.return;try{v.componentDidMount()}catch(re){un(u,E,re)}}var P=u.return;try{dx(u)}catch(re){un(u,P,re)}break;case 5:var K=u.return;try{dx(u)}catch(re){un(u,K,re)}}}catch(re){un(u,u.return,re)}if(u===c){Xe=null;break}var X=u.sibling;if(X!==null){X.return=u.return,Xe=X;break}Xe=u.return}}var lI=Math.ceil,_f=C.ReactCurrentDispatcher,hx=C.ReactCurrentOwner,qr=C.ReactCurrentBatchConfig,Dt=0,On=null,mn=null,Vn=0,Er=0,el=Vo(0),En=0,nu=null,Bi=0,Df=0,mx=0,ru=null,ur=null,gx=0,tl=1/0,po=null,$f=!1,xx=null,Xo=null,If=!1,Qo=null,Mf=0,su=0,yx=null,Lf=-1,Of=0;function nr(){return(Dt&6)!==0?Ut():Lf!==-1?Lf:Lf=Ut()}function Jo(c){return(c.mode&1)===0?1:(Dt&2)!==0&&Vn!==0?Vn&-Vn:W$.transition!==null?(Of===0&&(Of=Lo()),Of):(c=Lt,c!==0||(c=window.event,c=c===void 0?16:ss(c.type)),c)}function us(c,u,x,v){if(50<su)throw su=0,yx=null,Error(n(185));Bt(c,x,v),((Dt&2)===0||c!==On)&&(c===On&&((Dt&2)===0&&(Df|=x),En===4&&Zo(c,Vn)),dr(c,v),x===1&&Dt===0&&(u.mode&1)===0&&(tl=Ut()+500,ff&&qo()))}function dr(c,u){var x=c.callbackNode;Ai(c,u);var v=Br(c,c===On?Vn:0);if(v===0)x!==null&&Pa(x),c.callbackNode=null,c.callbackPriority=0;else if(u=v&-v,c.callbackPriority!==u){if(x!=null&&Pa(x),u===1)c.tag===0?V$(Dk.bind(null,c)):yj(Dk.bind(null,c)),z$(function(){(Dt&6)===0&&qo()}),x=null;else{switch(Yd(v)){case 1:x=eo;break;case 4:x=Po;break;case 16:x=Ts;break;case 536870912:x=Da;break;default:x=Ts}x=Bk(x,_k.bind(null,c))}c.callbackPriority=u,c.callbackNode=x}}function _k(c,u){if(Lf=-1,Of=0,(Dt&6)!==0)throw Error(n(327));var x=c.callbackNode;if(nl()&&c.callbackNode!==x)return null;var v=Br(c,c===On?Vn:0);if(v===0)return null;if((v&30)!==0||(v&c.expiredLanes)!==0||u)u=Ff(c,v);else{u=v;var E=Dt;Dt|=2;var P=Ik();(On!==c||Vn!==u)&&(po=null,tl=Ut()+500,Hi(c,u));do try{dI();break}catch(X){$k(c,X)}while(!0);Mg(),_f.current=P,Dt=E,mn!==null?u=0:(On=null,Vn=0,u=En)}if(u!==0){if(u===2&&(E=Mo(c),E!==0&&(v=E,u=bx(c,E))),u===1)throw x=nu,Hi(c,0),Zo(c,v),dr(c,Ut()),x;if(u===6)Zo(c,v);else{if(E=c.current.alternate,(v&30)===0&&!cI(E)&&(u=Ff(c,v),u===2&&(P=Mo(c),P!==0&&(v=P,u=bx(c,P))),u===1))throw x=nu,Hi(c,0),Zo(c,v),dr(c,Ut()),x;switch(c.finishedWork=E,c.finishedLanes=v,u){case 0:case 1:throw Error(n(345));case 2:Vi(c,ur,po);break;case 3:if(Zo(c,v),(v&130023424)===v&&(u=gx+500-Ut(),10<u)){if(Br(c,0)!==0)break;if(E=c.suspendedLanes,(E&v)!==v){nr(),c.pingedLanes|=c.suspendedLanes&E;break}c.timeoutHandle=Ng(Vi.bind(null,c,ur,po),u);break}Vi(c,ur,po);break;case 4:if(Zo(c,v),(v&4194240)===v)break;for(u=c.eventTimes,E=-1;0<v;){var K=31-In(v);P=1<<K,K=u[K],K>E&&(E=K),v&=~P}if(v=E,v=Ut()-v,v=(120>v?120:480>v?480:1080>v?1080:1920>v?1920:3e3>v?3e3:4320>v?4320:1960*lI(v/1960))-v,10<v){c.timeoutHandle=Ng(Vi.bind(null,c,ur,po),v);break}Vi(c,ur,po);break;case 5:Vi(c,ur,po);break;default:throw Error(n(329))}}}return dr(c,Ut()),c.callbackNode===x?_k.bind(null,c):null}function bx(c,u){var x=ru;return c.current.memoizedState.isDehydrated&&(Hi(c,u).flags|=256),c=Ff(c,u),c!==2&&(u=ur,ur=x,u!==null&&vx(u)),c}function vx(c){ur===null?ur=c:ur.push.apply(ur,c)}function cI(c){for(var u=c;;){if(u.flags&16384){var x=u.updateQueue;if(x!==null&&(x=x.stores,x!==null))for(var v=0;v<x.length;v++){var E=x[v],P=E.getSnapshot;E=E.value;try{if(!os(P(),E))return!1}catch{return!1}}}if(x=u.child,u.subtreeFlags&16384&&x!==null)x.return=u,u=x;else{if(u===c)break;for(;u.sibling===null;){if(u.return===null||u.return===c)return!0;u=u.return}u.sibling.return=u.return,u=u.sibling}}return!0}function Zo(c,u){for(u&=~mx,u&=~Df,c.suspendedLanes|=u,c.pingedLanes&=~u,c=c.expirationTimes;0<u;){var x=31-In(u),v=1<<x;c[x]=-1,u&=~v}}function Dk(c){if((Dt&6)!==0)throw Error(n(327));nl();var u=Br(c,0);if((u&1)===0)return dr(c,Ut()),null;var x=Ff(c,u);if(c.tag!==0&&x===2){var v=Mo(c);v!==0&&(u=v,x=bx(c,v))}if(x===1)throw x=nu,Hi(c,0),Zo(c,u),dr(c,Ut()),x;if(x===6)throw Error(n(345));return c.finishedWork=c.current.alternate,c.finishedLanes=u,Vi(c,ur,po),dr(c,Ut()),null}function wx(c,u){var x=Dt;Dt|=1;try{return c(u)}finally{Dt=x,Dt===0&&(tl=Ut()+500,ff&&qo())}}function Ui(c){Qo!==null&&Qo.tag===0&&(Dt&6)===0&&nl();var u=Dt;Dt|=1;var x=qr.transition,v=Lt;try{if(qr.transition=null,Lt=1,c)return c()}finally{Lt=v,qr.transition=x,Dt=u,(Dt&6)===0&&qo()}}function jx(){Er=el.current,Xt(el)}function Hi(c,u){c.finishedWork=null,c.finishedLanes=0;var x=c.timeoutHandle;if(x!==-1&&(c.timeoutHandle=-1,F$(x)),mn!==null)for(x=mn.return;x!==null;){var v=x;switch(Pg(v),v.tag){case 1:v=v.type.childContextTypes,v!=null&&uf();break;case 3:Qa(),Xt(ar),Xt(Gn),Vg();break;case 5:Ug(v);break;case 4:Qa();break;case 13:Xt(an);break;case 19:Xt(an);break;case 10:Lg(v.type._context);break;case 22:case 23:jx()}x=x.return}if(On=c,mn=c=ei(c.current,null),Vn=Er=u,En=0,nu=null,mx=Df=Bi=0,ur=ru=null,Oi!==null){for(u=0;u<Oi.length;u++)if(x=Oi[u],v=x.interleaved,v!==null){x.interleaved=null;var E=v.next,P=x.pending;if(P!==null){var K=P.next;P.next=E,v.next=K}x.pending=v}Oi=null}return c}function $k(c,u){do{var x=mn;try{if(Mg(),jf.current=Cf,kf){for(var v=ln.memoizedState;v!==null;){var E=v.queue;E!==null&&(E.pending=null),v=v.next}kf=!1}if(zi=0,Ln=Cn=ln=null,Xc=!1,Qc=0,hx.current=null,x===null||x.return===null){En=1,nu=u,mn=null;break}e:{var P=c,K=x.return,X=x,re=u;if(u=Vn,X.flags|=32768,re!==null&&typeof re=="object"&&typeof re.then=="function"){var ge=re,Ae=X,_e=Ae.tag;if((Ae.mode&1)===0&&(_e===0||_e===11||_e===15)){var Re=Ae.alternate;Re?(Ae.updateQueue=Re.updateQueue,Ae.memoizedState=Re.memoizedState,Ae.lanes=Re.lanes):(Ae.updateQueue=null,Ae.memoizedState=null)}var Ke=ok(K);if(Ke!==null){Ke.flags&=-257,ik(Ke,K,X,P,u),Ke.mode&1&&sk(P,ge,u),u=Ke,re=ge;var Ze=u.updateQueue;if(Ze===null){var tt=new Set;tt.add(re),u.updateQueue=tt}else Ze.add(re);break e}else{if((u&1)===0){sk(P,ge,u),kx();break e}re=Error(n(426))}}else if(nn&&X.mode&1){var fn=ok(K);if(fn!==null){(fn.flags&65536)===0&&(fn.flags|=256),ik(fn,K,X,P,u),$g(Ja(re,X));break e}}P=re=Ja(re,X),En!==4&&(En=2),ru===null?ru=[P]:ru.push(P),P=K;do{switch(P.tag){case 3:P.flags|=65536,u&=-u,P.lanes|=u;var fe=nk(P,re,u);Rj(P,fe);break e;case 1:X=re;var ae=P.type,he=P.stateNode;if((P.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||he!==null&&typeof he.componentDidCatch=="function"&&(Xo===null||!Xo.has(he)))){P.flags|=65536,u&=-u,P.lanes|=u;var Fe=rk(P,X,u);Rj(P,Fe);break e}}P=P.return}while(P!==null)}Lk(x)}catch(rt){u=rt,mn===x&&x!==null&&(mn=x=x.return);continue}break}while(!0)}function Ik(){var c=_f.current;return _f.current=Cf,c===null?Cf:c}function kx(){(En===0||En===3||En===2)&&(En=4),On===null||(Bi&268435455)===0&&(Df&268435455)===0||Zo(On,Vn)}function Ff(c,u){var x=Dt;Dt|=2;var v=Ik();(On!==c||Vn!==u)&&(po=null,Hi(c,u));do try{uI();break}catch(E){$k(c,E)}while(!0);if(Mg(),Dt=x,_f.current=v,mn!==null)throw Error(n(261));return On=null,Vn=0,En}function uI(){for(;mn!==null;)Mk(mn)}function dI(){for(;mn!==null&&!Tc();)Mk(mn)}function Mk(c){var u=zk(c.alternate,c,Er);c.memoizedProps=c.pendingProps,u===null?Lk(c):mn=u,hx.current=null}function Lk(c){var u=c;do{var x=u.alternate;if(c=u.return,(u.flags&32768)===0){if(x=rI(x,u,Er),x!==null){mn=x;return}}else{if(x=sI(x,u),x!==null){x.flags&=32767,mn=x;return}if(c!==null)c.flags|=32768,c.subtreeFlags=0,c.deletions=null;else{En=6,mn=null;return}}if(u=u.sibling,u!==null){mn=u;return}mn=u=c}while(u!==null);En===0&&(En=5)}function Vi(c,u,x){var v=Lt,E=qr.transition;try{qr.transition=null,Lt=1,fI(c,u,x,v)}finally{qr.transition=E,Lt=v}return null}function fI(c,u,x,v){do nl();while(Qo!==null);if((Dt&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 P=x.lanes|x.childLanes;if(no(c,P),c===On&&(mn=On=null,Vn=0),(x.subtreeFlags&2064)===0&&(x.flags&2064)===0||If||(If=!0,Bk(Ts,function(){return nl(),null})),P=(x.flags&15990)!==0,(x.subtreeFlags&15990)!==0||P){P=qr.transition,qr.transition=null;var K=Lt;Lt=1;var X=Dt;Dt|=4,hx.current=null,iI(c,x),Ek(x,c),_$(kg),Mn=!!jg,kg=jg=null,c.current=x,aI(x),_a(),Dt=X,Lt=K,qr.transition=P}else c.current=x;if(If&&(If=!1,Qo=c,Mf=E),P=c.pendingLanes,P===0&&(Xo=null),ir(x.stateNode),dr(c,Ut()),u!==null)for(v=c.onRecoverableError,x=0;x<u.length;x++)E=u[x],v(E.value,{componentStack:E.stack,digest:E.digest});if($f)throw $f=!1,c=xx,xx=null,c;return(Mf&1)!==0&&c.tag!==0&&nl(),P=c.pendingLanes,(P&1)!==0?c===yx?su++:(su=0,yx=c):su=0,qo(),null}function nl(){if(Qo!==null){var c=Yd(Mf),u=qr.transition,x=Lt;try{if(qr.transition=null,Lt=16>c?16:c,Qo===null)var v=!1;else{if(c=Qo,Qo=null,Mf=0,(Dt&6)!==0)throw Error(n(331));var E=Dt;for(Dt|=4,Xe=c.current;Xe!==null;){var P=Xe,K=P.child;if((Xe.flags&16)!==0){var X=P.deletions;if(X!==null){for(var re=0;re<X.length;re++){var ge=X[re];for(Xe=ge;Xe!==null;){var Ae=Xe;switch(Ae.tag){case 0:case 11:case 15:tu(8,Ae,P)}var _e=Ae.child;if(_e!==null)_e.return=Ae,Xe=_e;else for(;Xe!==null;){Ae=Xe;var Re=Ae.sibling,Ke=Ae.return;if(jk(Ae),Ae===ge){Xe=null;break}if(Re!==null){Re.return=Ke,Xe=Re;break}Xe=Ke}}}var Ze=P.alternate;if(Ze!==null){var tt=Ze.child;if(tt!==null){Ze.child=null;do{var fn=tt.sibling;tt.sibling=null,tt=fn}while(tt!==null)}}Xe=P}}if((P.subtreeFlags&2064)!==0&&K!==null)K.return=P,Xe=K;else e:for(;Xe!==null;){if(P=Xe,(P.flags&2048)!==0)switch(P.tag){case 0:case 11:case 15:tu(9,P,P.return)}var fe=P.sibling;if(fe!==null){fe.return=P.return,Xe=fe;break e}Xe=P.return}}var ae=c.current;for(Xe=ae;Xe!==null;){K=Xe;var he=K.child;if((K.subtreeFlags&2064)!==0&&he!==null)he.return=K,Xe=he;else e:for(K=ae;Xe!==null;){if(X=Xe,(X.flags&2048)!==0)try{switch(X.tag){case 0:case 11:case 15:Pf(9,X)}}catch(rt){un(X,X.return,rt)}if(X===K){Xe=null;break e}var Fe=X.sibling;if(Fe!==null){Fe.return=X.return,Xe=Fe;break e}Xe=X.return}}if(Dt=E,qo(),er&&typeof er.onPostCommitFiberRoot=="function")try{er.onPostCommitFiberRoot(Do,c)}catch{}v=!0}return v}finally{Lt=x,qr.transition=u}}return!1}function Ok(c,u,x){u=Ja(x,u),u=nk(c,u,1),c=Go(c,u,1),u=nr(),c!==null&&(Bt(c,1,u),dr(c,u))}function un(c,u,x){if(c.tag===3)Ok(c,c,x);else for(;u!==null;){if(u.tag===3){Ok(u,c,x);break}else if(u.tag===1){var v=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Xo===null||!Xo.has(v))){c=Ja(x,c),c=rk(u,c,1),u=Go(u,c,1),c=nr(),u!==null&&(Bt(u,1,c),dr(u,c));break}}u=u.return}}function pI(c,u,x){var v=c.pingCache;v!==null&&v.delete(u),u=nr(),c.pingedLanes|=c.suspendedLanes&x,On===c&&(Vn&x)===x&&(En===4||En===3&&(Vn&130023424)===Vn&&500>Ut()-gx?Hi(c,0):mx|=x),dr(c,u)}function Fk(c,u){u===0&&((c.mode&1)===0?u=1:(u=Un,Un<<=1,(Un&130023424)===0&&(Un=4194304)));var x=nr();c=co(c,u),c!==null&&(Bt(c,u,x),dr(c,x))}function hI(c){var u=c.memoizedState,x=0;u!==null&&(x=u.retryLane),Fk(c,x)}function mI(c,u){var x=0;switch(c.tag){case 13:var v=c.stateNode,E=c.memoizedState;E!==null&&(x=E.retryLane);break;case 19:v=c.stateNode;break;default:throw Error(n(314))}v!==null&&v.delete(u),Fk(c,x)}var zk;zk=function(c,u,x){if(c!==null)if(c.memoizedProps!==u.pendingProps||ar.current)cr=!0;else{if((c.lanes&x)===0&&(u.flags&128)===0)return cr=!1,nI(c,u,x);cr=(c.flags&131072)!==0}else cr=!1,nn&&(u.flags&1048576)!==0&&bj(u,hf,u.index);switch(u.lanes=0,u.tag){case 2:var v=u.type;Rf(c,u),c=u.pendingProps;var E=Va(u,Gn.current);Xa(u,x),E=Kg(null,u,v,c,E,x);var P=Gg();return u.flags|=1,typeof E=="object"&&E!==null&&typeof E.render=="function"&&E.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,lr(v)?(P=!0,df(u)):P=!1,u.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,zg(u),E.updater=Ef,u.stateNode=E,E._reactInternals=u,ex(u,v,c,x),u=sx(null,u,v,!0,P,x)):(u.tag=0,nn&&P&&Ag(u),tr(null,u,E,x),u=u.child),u;case 16:v=u.elementType;e:{switch(Rf(c,u),c=u.pendingProps,E=v._init,v=E(v._payload),u.type=v,E=u.tag=xI(v),c=as(v,c),E){case 0:u=rx(null,u,v,c,x);break e;case 1:u=fk(null,u,v,c,x);break e;case 11:u=ak(null,u,v,c,x);break e;case 14:u=lk(null,u,v,as(v.type,c),x);break e}throw Error(n(306,v,""))}return u;case 0:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:as(v,E),rx(c,u,v,E,x);case 1:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:as(v,E),fk(c,u,v,E,x);case 3:e:{if(pk(u),c===null)throw Error(n(387));v=u.pendingProps,P=u.memoizedState,E=P.element,Tj(c,u),vf(u,v,null,x);var K=u.memoizedState;if(v=K.element,P.isDehydrated)if(P={element:v,isDehydrated:!1,cache:K.cache,pendingSuspenseBoundaries:K.pendingSuspenseBoundaries,transitions:K.transitions},u.updateQueue.baseState=P,u.memoizedState=P,u.flags&256){E=Ja(Error(n(423)),u),u=hk(c,u,v,x,E);break e}else if(v!==E){E=Ja(Error(n(424)),u),u=hk(c,u,v,x,E);break e}else for(Cr=Ho(u.stateNode.containerInfo.firstChild),Nr=u,nn=!0,is=null,x=Cj(u,null,v,x),u.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(Ka(),v===E){u=fo(c,u,x);break e}tr(c,u,v,x)}u=u.child}return u;case 5:return Pj(u),c===null&&Dg(u),v=u.type,E=u.pendingProps,P=c!==null?c.memoizedProps:null,K=E.children,Sg(v,E)?K=null:P!==null&&Sg(v,P)&&(u.flags|=32),dk(c,u),tr(c,u,K,x),u.child;case 6:return c===null&&Dg(u),null;case 13:return mk(c,u,x);case 4:return Bg(u,u.stateNode.containerInfo),v=u.pendingProps,c===null?u.child=Ga(u,null,v,x):tr(c,u,v,x),u.child;case 11:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:as(v,E),ak(c,u,v,E,x);case 7:return tr(c,u,u.pendingProps,x),u.child;case 8:return tr(c,u,u.pendingProps.children,x),u.child;case 12:return tr(c,u,u.pendingProps.children,x),u.child;case 10:e:{if(v=u.type._context,E=u.pendingProps,P=u.memoizedProps,K=E.value,qt(xf,v._currentValue),v._currentValue=K,P!==null)if(os(P.value,K)){if(P.children===E.children&&!ar.current){u=fo(c,u,x);break e}}else for(P=u.child,P!==null&&(P.return=u);P!==null;){var X=P.dependencies;if(X!==null){K=P.child;for(var re=X.firstContext;re!==null;){if(re.context===v){if(P.tag===1){re=uo(-1,x&-x),re.tag=2;var ge=P.updateQueue;if(ge!==null){ge=ge.shared;var Ae=ge.pending;Ae===null?re.next=re:(re.next=Ae.next,Ae.next=re),ge.pending=re}}P.lanes|=x,re=P.alternate,re!==null&&(re.lanes|=x),Og(P.return,x,u),X.lanes|=x;break}re=re.next}}else if(P.tag===10)K=P.type===u.type?null:P.child;else if(P.tag===18){if(K=P.return,K===null)throw Error(n(341));K.lanes|=x,X=K.alternate,X!==null&&(X.lanes|=x),Og(K,x,u),K=P.sibling}else K=P.child;if(K!==null)K.return=P;else for(K=P;K!==null;){if(K===u){K=null;break}if(P=K.sibling,P!==null){P.return=K.return,K=P;break}K=K.return}P=K}tr(c,u,E.children,x),u=u.child}return u;case 9:return E=u.type,v=u.pendingProps.children,Xa(u,x),E=Vr(E),v=v(E),u.flags|=1,tr(c,u,v,x),u.child;case 14:return v=u.type,E=as(v,u.pendingProps),E=as(v.type,E),lk(c,u,v,E,x);case 15:return ck(c,u,u.type,u.pendingProps,x);case 17:return v=u.type,E=u.pendingProps,E=u.elementType===v?E:as(v,E),Rf(c,u),u.tag=1,lr(v)?(c=!0,df(u)):c=!1,Xa(u,x),ek(u,v,E),ex(u,v,E,x),sx(null,u,v,!0,c,x);case 19:return xk(c,u,x);case 22:return uk(c,u,x)}throw Error(n(156,u.tag))};function Bk(c,u){return Aa(c,u)}function gI(c,u,x,v){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=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=v,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kr(c,u,x,v){return new gI(c,u,x,v)}function Sx(c){return c=c.prototype,!(!c||!c.isReactComponent)}function xI(c){if(typeof c=="function")return Sx(c)?1:0;if(c!=null){if(c=c.$$typeof,c===O)return 11;if(c===F)return 14}return 2}function ei(c,u){var x=c.alternate;return x===null?(x=Kr(c.tag,u,c.key,c.mode),x.elementType=c.elementType,x.type=c.type,x.stateNode=c.stateNode,x.alternate=c,c.alternate=x):(x.pendingProps=u,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,u=c.dependencies,x.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},x.sibling=c.sibling,x.index=c.index,x.ref=c.ref,x}function zf(c,u,x,v,E,P){var K=2;if(v=c,typeof c=="function")Sx(c)&&(K=1);else if(typeof c=="string")K=5;else e:switch(c){case R:return Wi(x.children,E,P,u);case D:K=8,E|=8;break;case _:return c=Kr(12,x,u,E|2),c.elementType=_,c.lanes=P,c;case z:return c=Kr(13,x,u,E),c.elementType=z,c.lanes=P,c;case A:return c=Kr(19,x,u,E),c.elementType=A,c.lanes=P,c;case H:return Bf(x,E,P,u);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case B:K=10;break e;case $:K=9;break e;case O:K=11;break e;case F:K=14;break e;case U:K=16,v=null;break e}throw Error(n(130,c==null?c:typeof c,""))}return u=Kr(K,x,u,E),u.elementType=c,u.type=v,u.lanes=P,u}function Wi(c,u,x,v){return c=Kr(7,c,v,u),c.lanes=x,c}function Bf(c,u,x,v){return c=Kr(22,c,v,u),c.elementType=H,c.lanes=x,c.stateNode={isHidden:!1},c}function Nx(c,u,x){return c=Kr(6,c,null,u),c.lanes=x,c}function Cx(c,u,x){return u=Kr(4,c.children!==null?c.children:[],c.key,u),u.lanes=x,u.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},u}function yI(c,u,x,v,E){this.tag=u,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=Rs(0),this.expirationTimes=Rs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rs(0),this.identifierPrefix=v,this.onRecoverableError=E,this.mutableSourceEagerHydrationData=null}function Ex(c,u,x,v,E,P,K,X,re){return c=new yI(c,u,x,X,re),u===1?(u=1,P===!0&&(u|=8)):u=0,P=Kr(3,null,null,u),c.current=P,P.stateNode=c,P.memoizedState={element:v,isDehydrated:x,cache:null,transitions:null,pendingSuspenseBoundaries:null},zg(P),c}function bI(c,u,x){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:v==null?null:""+v,children:c,containerInfo:u,implementation:x}}function Uk(c){if(!c)return Wo;c=c._reactInternals;e:{if(mt(c)!==c||c.tag!==1)throw Error(n(170));var u=c;do{switch(u.tag){case 3:u=u.stateNode.context;break e;case 1:if(lr(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break e}}u=u.return}while(u!==null);throw Error(n(171))}if(c.tag===1){var x=c.type;if(lr(x))return gj(c,x,u)}return u}function Hk(c,u,x,v,E,P,K,X,re){return c=Ex(x,v,!0,c,E,P,K,X,re),c.context=Uk(null),x=c.current,v=nr(),E=Jo(x),P=uo(v,E),P.callback=u??null,Go(x,P,E),c.current.lanes=E,Bt(c,E,v),dr(c,v),c}function Uf(c,u,x,v){var E=u.current,P=nr(),K=Jo(E);return x=Uk(x),u.context===null?u.context=x:u.pendingContext=x,u=uo(P,K),u.payload={element:c},v=v===void 0?null:v,v!==null&&(u.callback=v),c=Go(E,u,K),c!==null&&(us(c,E,K,P),bf(c,E,K)),K}function Hf(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 Vk(c,u){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var x=c.retryLane;c.retryLane=x!==0&&x<u?x:u}}function Tx(c,u){Vk(c,u),(c=c.alternate)&&Vk(c,u)}function vI(){return null}var Wk=typeof reportError=="function"?reportError:function(c){console.error(c)};function Rx(c){this._internalRoot=c}Vf.prototype.render=Rx.prototype.render=function(c){var u=this._internalRoot;if(u===null)throw Error(n(409));Uf(c,u,null,null)},Vf.prototype.unmount=Rx.prototype.unmount=function(){var c=this._internalRoot;if(c!==null){this._internalRoot=null;var u=c.containerInfo;Ui(function(){Uf(null,c,null,null)}),u[oo]=null}};function Vf(c){this._internalRoot=c}Vf.prototype.unstable_scheduleHydration=function(c){if(c){var u=ro();c={blockedOn:null,target:c,priority:u};for(var x=0;x<Ds.length&&u!==0&&u<Ds[x].priority;x++);Ds.splice(x,0,c),x===0&&Z(c)}};function Ax(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)}function Wf(c){return!(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11&&(c.nodeType!==8||c.nodeValue!==" react-mount-point-unstable "))}function qk(){}function wI(c,u,x,v,E){if(E){if(typeof v=="function"){var P=v;v=function(){var ge=Hf(K);P.call(ge)}}var K=Hk(u,v,c,0,null,!1,!1,"",qk);return c._reactRootContainer=K,c[oo]=K.current,Uc(c.nodeType===8?c.parentNode:c),Ui(),K}for(;E=c.lastChild;)c.removeChild(E);if(typeof v=="function"){var X=v;v=function(){var ge=Hf(re);X.call(ge)}}var re=Ex(c,0,!1,null,null,!1,!1,"",qk);return c._reactRootContainer=re,c[oo]=re.current,Uc(c.nodeType===8?c.parentNode:c),Ui(function(){Uf(u,re,x,v)}),re}function qf(c,u,x,v,E){var P=x._reactRootContainer;if(P){var K=P;if(typeof E=="function"){var X=E;E=function(){var re=Hf(K);X.call(re)}}Uf(u,K,c,E)}else K=wI(x,u,c,E,v);return Hf(K)}Pc=function(c){switch(c.tag){case 3:var u=c.stateNode;if(u.current.memoizedState.isDehydrated){var x=to(u.pendingLanes);x!==0&&(As(u,x|1),dr(u,Ut()),(Dt&6)===0&&(tl=Ut()+500,qo()))}break;case 13:Ui(function(){var v=co(c,1);if(v!==null){var E=nr();us(v,c,1,E)}}),Tx(c,1)}},Pi=function(c){if(c.tag===13){var u=co(c,134217728);if(u!==null){var x=nr();us(u,c,134217728,x)}Tx(c,134217728)}},_c=function(c){if(c.tag===13){var u=Jo(c),x=co(c,u);if(x!==null){var v=nr();us(x,c,u,v)}Tx(c,u)}},ro=function(){return Lt},Dc=function(c,u){var x=Lt;try{return Lt=c,u()}finally{Lt=x}},St=function(c,u,x){switch(u){case"input":if(Se(c,x),u=x.name,x.type==="radio"&&u!=null){for(x=c;x.parentNode;)x=x.parentNode;for(x=x.querySelectorAll("input[name="+JSON.stringify(""+u)+'][type="radio"]'),u=0;u<x.length;u++){var v=x[u];if(v!==c&&v.form===c.form){var E=cf(v);if(!E)throw Error(n(90));Te(v),Se(v,E)}}}break;case"textarea":it(c,x);break;case"select":u=x.value,u!=null&&Oe(c,!!x.multiple,u,!1)}},Je=wx,Ft=Ui;var jI={usingClientEntryPoint:!1,Events:[Wc,Ua,cf,ye,Ve,wx]},ou={findFiberByHostInstance:$i,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},kI={bundleType:ou.bundleType,version:ou.version,rendererPackageName:ou.rendererPackageName,rendererConfig:ou.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:ou.findFiberByHostInstance||vI,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 Kf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kf.isDisabled&&Kf.supportsFiber)try{Do=Kf.inject(kI),er=Kf}catch{}}return fr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jI,fr.createPortal=function(c,u){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ax(u))throw Error(n(200));return bI(c,u,null,x)},fr.createRoot=function(c,u){if(!Ax(c))throw Error(n(299));var x=!1,v="",E=Wk;return u!=null&&(u.unstable_strictMode===!0&&(x=!0),u.identifierPrefix!==void 0&&(v=u.identifierPrefix),u.onRecoverableError!==void 0&&(E=u.onRecoverableError)),u=Ex(c,1,!1,null,null,x,!1,v,E),c[oo]=u.current,Uc(c.nodeType===8?c.parentNode:c),new Rx(u)},fr.findDOMNode=function(c){if(c==null)return null;if(c.nodeType===1)return c;var u=c._reactInternals;if(u===void 0)throw typeof c.render=="function"?Error(n(188)):(c=Object.keys(c).join(","),Error(n(268,c)));return c=tn(u),c=c===null?null:c.stateNode,c},fr.flushSync=function(c){return Ui(c)},fr.hydrate=function(c,u,x){if(!Wf(u))throw Error(n(200));return qf(null,c,u,!0,x)},fr.hydrateRoot=function(c,u,x){if(!Ax(c))throw Error(n(405));var v=x!=null&&x.hydratedSources||null,E=!1,P="",K=Wk;if(x!=null&&(x.unstable_strictMode===!0&&(E=!0),x.identifierPrefix!==void 0&&(P=x.identifierPrefix),x.onRecoverableError!==void 0&&(K=x.onRecoverableError)),u=Hk(u,null,c,1,x??null,E,!1,P,K),c[oo]=u.current,Uc(c),v)for(c=0;c<v.length;c++)x=v[c],E=x._getVersion,E=E(x._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[x,E]:u.mutableSourceEagerHydrationData.push(x,E);return new Vf(u)},fr.render=function(c,u,x){if(!Wf(u))throw Error(n(200));return qf(null,c,u,!1,x)},fr.unmountComponentAtNode=function(c){if(!Wf(c))throw Error(n(40));return c._reactRootContainer?(Ui(function(){qf(null,null,c,!1,function(){c._reactRootContainer=null,c[oo]=null})}),!0):!1},fr.unstable_batchedUpdates=wx,fr.unstable_renderSubtreeIntoContainer=function(c,u,x,v){if(!Wf(x))throw Error(n(200));if(c==null||c._reactInternals===void 0)throw Error(n(38));return qf(c,u,x,!1,v)},fr.version="18.3.1-next-f1338f8080-20240426",fr}var e1;function jE(){if(e1)return $x.exports;e1=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(),$x.exports=DI(),$x.exports}var t1;function $I(){if(t1)return Gf;t1=1;var e=jE();return Gf.createRoot=e.createRoot,Gf.hydrateRoot=e.hydrateRoot,Gf}var II=$I();/**
|
|
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 n1="popstate";function r1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function MI(e={}){function t(r,o){var f;let i=(f=o.state)==null?void 0:f.masked,{pathname:a,search:l,hash:d}=i||r.location;return sb("",{pathname:a,search:l,hash:d},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:qu(o)}return OI(t,n,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ms(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function LI(){return Math.random().toString(36).substring(2,10)}function s1(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 sb(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ic(t):t,state:n,key:t&&t.key||r||LI(),unstable_mask:o}}function qu({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 ic(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 OI(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:i=!1}=r,a=o.history,l="POP",d=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,d&&d({action:l,location:w.location,delta:j})}function g(b,j){l="PUSH";let N=r1(b)?b:sb(w.location,b,j);f=p()+1;let S=s1(N,f),C=w.createHref(N.unstable_mask||N);try{a.pushState(S,"",C)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;o.location.assign(C)}i&&d&&d({action:l,location:w.location,delta:1})}function y(b,j){l="REPLACE";let N=r1(b)?b:sb(w.location,b,j);f=p();let S=s1(N,f),C=w.createHref(N.unstable_mask||N);a.replaceState(S,"",C),i&&d&&d({action:l,location:w.location,delta:0})}function k(b){return FI(b)}let w={get action(){return l},get location(){return e(o,a)},listen(b){if(d)throw new Error("A history only accepts one active listener");return o.addEventListener(n1,h),d=b,()=>{o.removeEventListener(n1,h),d=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 w}function FI(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:qu(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function kE(e,t,n="/"){return zI(e,t,n,!1)}function zI(e,t,n,r){let o=typeof t=="string"?ic(t):t,i=wo(o.pathname||"/",n);if(i==null)return null;let a=SE(e);BI(a);let l=null;for(let d=0;l==null&&d<a.length;++d){let f=JI(i);l=XI(a[d],f,r)}return l}function SE(e,t=[],n=[],r="",o=!1){let i=(a,l,d=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)&&d)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=Ws([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}".`),SE(a.children,t,g,h,d)),!(a.path==null&&!a.index)&&t.push({path:h,score:GI(h,a.index),routesMeta:g})};return e.forEach((a,l)=>{var d;if(a.path===""||!((d=a.path)!=null&&d.includes("?")))i(a,l);else for(let f of NE(a.path))i(a,l,!0,f)}),t}function NE(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=NE(r.join("/")),l=[];return l.push(...a.map(d=>d===""?i:[i,d].join("/"))),o&&l.push(...a),l.map(d=>e.startsWith("/")&&d===""?"/":d)}function BI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:YI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var UI=/^:[\w-]+$/,HI=3,VI=2,WI=1,qI=10,KI=-2,o1=e=>e==="*";function GI(e,t){let n=e.split("/"),r=n.length;return n.some(o1)&&(r+=KI),t&&(r+=VI),n.filter(o=>!o1(o)).reduce((o,i)=>o+(UI.test(i)?HI:i===""?WI:qI),r)}function YI(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 XI(e,t,n=!1){let{routesMeta:r}=e,o={},i="/",a=[];for(let l=0;l<r.length;++l){let d=r[l],f=l===r.length-1,p=i==="/"?t:t.slice(i.length)||"/",h=Yp({path:d.relativePath,caseSensitive:d.caseSensitive,end:f},p),g=d.route;if(!h&&f&&n&&!r[r.length-1].route.index&&(h=Yp({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},p)),!h)return null;Object.assign(o,h.params),a.push({params:o,pathname:Ws([i,h.pathname]),pathnameBase:nM(Ws([i,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(i=Ws([i,h.pathnameBase]))}return a}function Yp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=QI(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 QI(e,t=!1,n=!0){ms(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,d,f,p)=>{if(r.push({paramName:l,isOptional:d!=null}),d){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 JI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ms(!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 wo(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 ZI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function eM(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?ic(e):e,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=i1(n.substring(1),"/"):i=i1(n,t)):i=t,{pathname:i,search:rM(r),hash:sM(o)}}function i1(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 Lx(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 tM(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function CE(e){let t=tM(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function vv(e,t,n,r=!1){let o;typeof e=="string"?o=ic(e):(o={...e},cn(!o.pathname||!o.pathname.includes("?"),Lx("?","pathname","search",o)),cn(!o.pathname||!o.pathname.includes("#"),Lx("#","pathname","hash",o)),cn(!o.search||!o.search.includes("#"),Lx("#","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 d=eM(o,l),f=a&&a!=="/"&&a.endsWith("/"),p=(i||a===".")&&n.endsWith("/");return!d.pathname.endsWith("/")&&(f||p)&&(d.pathname+="/"),d}var Ws=e=>e.join("/").replace(/\/\/+/g,"/"),nM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),rM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,sM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,oM=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 iM(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function aM(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var EE=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function TE(e,t){let n=e;if(typeof n!="string"||!ZI.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(EE)try{let i=new URL(window.location.href),a=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=wo(a.pathname,t);a.origin===i.origin&&l!=null?n=l+a.search+a.hash:o=!0}catch{ms(!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 RE=["POST","PUT","PATCH","DELETE"];new Set(RE);var lM=["GET",...RE];new Set(lM);var ac=m.createContext(null);ac.displayName="DataRouter";var Fh=m.createContext(null);Fh.displayName="DataRouterState";var cM=m.createContext(!1),AE=m.createContext({isTransitioning:!1});AE.displayName="ViewTransition";var uM=m.createContext(new Map);uM.displayName="Fetchers";var dM=m.createContext(null);dM.displayName="Await";var Zr=m.createContext(null);Zr.displayName="Navigation";var wd=m.createContext(null);wd.displayName="Location";var js=m.createContext({outlet:null,matches:[],isDataRoute:!1});js.displayName="Route";var wv=m.createContext(null);wv.displayName="RouteError";var PE="REACT_ROUTER_ERROR",fM="REDIRECT",pM="ROUTE_ERROR_RESPONSE";function hM(e){if(e.startsWith(`${PE}:${fM}:{`))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 mM(e){if(e.startsWith(`${PE}:${pM}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new oM(t.status,t.statusText,t.data)}catch{}}function gM(e,{relative:t}={}){cn(jd(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=m.useContext(Zr),{hash:o,pathname:i,search:a}=kd(e,{relative:t}),l=i;return n!=="/"&&(l=i==="/"?n:Ws([n,i])),r.createHref({pathname:l,search:a,hash:o})}function jd(){return m.useContext(wd)!=null}function rr(){return cn(jd(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(wd).location}var _E="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function DE(e){m.useContext(Zr).static||m.useLayoutEffect(e)}function Vt(){let{isDataRoute:e}=m.useContext(js);return e?PM():xM()}function xM(){cn(jd(),"useNavigate() may be used only in the context of a <Router> component.");let e=m.useContext(ac),{basename:t,navigator:n}=m.useContext(Zr),{matches:r}=m.useContext(js),{pathname:o}=rr(),i=JSON.stringify(CE(r)),a=m.useRef(!1);return DE(()=>{a.current=!0}),m.useCallback((d,f={})=>{if(ms(a.current,_E),!a.current)return;if(typeof d=="number"){n.go(d);return}let p=vv(d,JSON.parse(i),o,f.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Ws([t,p.pathname])),(f.replace?n.replace:n.push)(p,f.state,f)},[t,n,i,o,e])}var yM=m.createContext(null);function bM(e){let t=m.useContext(js).outlet;return m.useMemo(()=>t&&m.createElement(yM.Provider,{value:e},t),[t,e])}function Wt(){let{matches:e}=m.useContext(js),t=e[e.length-1];return t?t.params:{}}function kd(e,{relative:t}={}){let{matches:n}=m.useContext(js),{pathname:r}=rr(),o=JSON.stringify(CE(n));return m.useMemo(()=>vv(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function vM(e,t){return $E(e,t)}function $E(e,t,n){var b;cn(jd(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=m.useContext(Zr),{matches:o}=m.useContext(js),i=o[o.length-1],a=i?i.params:{},l=i?i.pathname:"/",d=i?i.pathnameBase:"/",f=i&&i.route;{let j=f&&f.path||"";ME(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=rr(),h;if(t){let j=typeof t=="string"?ic(t):t;cn(d==="/"||((b=j.pathname)==null?void 0:b.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${j.pathname}" was given in the \`location\` prop.`),h=j}else h=p;let g=h.pathname||"/",y=g;if(d!=="/"){let j=d.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(j.length).join("/")}let k=kE(e,{pathname:y});ms(f||k!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),ms(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 w=NM(k&&k.map(j=>Object.assign({},j,{params:Object.assign({},a,j.params),pathname:Ws([d,r.encodeLocation?r.encodeLocation(j.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?d:Ws([d,r.encodeLocation?r.encodeLocation(j.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,n);return t&&w?m.createElement(wd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},w):w}function wM(){let e=AM(),t=iM(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 jM=m.createElement(wM,null),IE=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=mM(e.digest);n&&(e=n)}let t=e!==void 0?m.createElement(js.Provider,{value:this.props.routeContext},m.createElement(wv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?m.createElement(kM,{error:e},t):t}};IE.contextType=cM;var Ox=new WeakMap;function kM({children:e,error:t}){let{basename:n}=m.useContext(Zr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=hM(t.digest);if(r){let o=Ox.get(t);if(o)throw o;let i=TE(r.location,n);if(EE&&!Ox.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 Ox.set(t,a),a}return m.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return e}function SM({routeContext:e,match:t,children:n}){let r=m.useContext(ac);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),m.createElement(js.Provider,{value:e},n)}function NM(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 d=n==null?void 0:n.onError,f=r&&d?(p,h)=>{var g,y;d(p,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:aM(r.matches),errorInfo:h})}:void 0;return o.reduceRight((p,h,g)=>{let y,k=!1,w=null,b=null;r&&(y=i&&h.route.id?i[h.route.id]:void 0,w=h.route.errorElement||jM,a&&(l<0&&g===0?(ME("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=w:k?S=b:h.route.Component?S=m.createElement(h.route.Component,null):h.route.element?S=h.route.element:S=p,m.createElement(SM,{match:h,routeContext:{outlet:p,matches:j,isDataRoute:r!=null},children:S})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?m.createElement(IE,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:N(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:f}):N()},null)}function jv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function CM(e){let t=m.useContext(ac);return cn(t,jv(e)),t}function EM(e){let t=m.useContext(Fh);return cn(t,jv(e)),t}function TM(e){let t=m.useContext(js);return cn(t,jv(e)),t}function kv(e){let t=TM(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 RM(){return kv("useRouteId")}function AM(){var r;let e=m.useContext(wv),t=EM("useRouteError"),n=kv("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function PM(){let{router:e}=CM("useNavigate"),t=kv("useNavigate"),n=m.useRef(!1);return DE(()=>{n.current=!0}),m.useCallback(async(o,i={})=>{ms(n.current,_E),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...i}))},[e,t])}var a1={};function ME(e,t,n){!t&&!a1[e]&&(a1[e]=!0,ms(!1,n))}m.memo(_M);function _M({routes:e,future:t,state:n,isStatic:r,onError:o}){return $E(e,void 0,{state:n,isStatic:r,onError:o})}function DM(e){return bM(e.context)}function Qe(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 $M({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:i=!1,unstable_useTransitions:a}){cn(!jd(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),d=m.useMemo(()=>({basename:l,navigator:o,static:i,unstable_useTransitions:a,future:{}}),[l,o,i,a]);typeof n=="string"&&(n=ic(n));let{pathname:f="/",search:p="",hash:h="",state:g=null,key:y="default",unstable_mask:k}=n,w=m.useMemo(()=>{let b=wo(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 ms(w!=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.`),w==null?null:m.createElement(Zr.Provider,{value:d},m.createElement(wd.Provider,{children:t,value:w}))}function IM({children:e,location:t}){return vM(ob(e),t)}function ob(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,ob(r.props.children,i));return}cn(r.type===Qe,`[${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=ob(r.props.children,i)),n.push(a)}),n}var Np="get",Cp="application/x-www-form-urlencoded";function zh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function MM(e){return zh(e)&&e.tagName.toLowerCase()==="button"}function LM(e){return zh(e)&&e.tagName.toLowerCase()==="form"}function OM(e){return zh(e)&&e.tagName.toLowerCase()==="input"}function FM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zM(e,t){return e.button===0&&(!t||t==="_self")&&!FM(e)}function ib(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 BM(e,t){let n=ib(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}var Yf=null;function UM(){if(Yf===null)try{new FormData(document.createElement("form"),0),Yf=!1}catch{Yf=!0}return Yf}var HM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fx(e){return e!=null&&!HM.has(e)?(ms(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cp}"`),null):e}function VM(e,t){let n,r,o,i,a;if(LM(e)){let l=e.getAttribute("action");r=l?wo(l,t):null,n=e.getAttribute("method")||Np,o=Fx(e.getAttribute("enctype"))||Cp,i=new FormData(e)}else if(MM(e)||OM(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 d=e.getAttribute("formaction")||l.getAttribute("action");if(r=d?wo(d,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Np,o=Fx(e.getAttribute("formenctype"))||Fx(l.getAttribute("enctype"))||Cp,i=new FormData(l,e),!UM()){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(zh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Np,r=null,o=Cp,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 Sv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function WM(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&&wo(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 KM(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 GM(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 JM(r.flat(1).filter(KM).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function l1(e,t,n,r,o,i){let a=(d,f)=>n[f]?d.route.id!==n[f].route.id:!0,l=(d,f)=>{var p;return n[f].pathname!==d.pathname||((p=n[f].route.path)==null?void 0:p.endsWith("*"))&&n[f].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,f)=>a(d,f)||l(d,f)):i==="data"?t.filter((d,f)=>{var h;let p=r.routes[d.route.id];if(!p||!p.hasLoader)return!1;if(a(d,f)||l(d,f))return!0;if(d.route.shouldRevalidate){let g=d.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:d.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function YM(e,t,{includeHydrateFallback:n}={}){return XM(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 XM(e){return[...new Set(e)]}function QM(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function JM(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let i=JSON.stringify(QM(o));return n.has(i)||(n.add(i),r.push({key:i,link:o})),r},[])}function LE(){let e=m.useContext(ac);return Sv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function ZM(){let e=m.useContext(Fh);return Sv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Nv=m.createContext(void 0);Nv.displayName="FrameworkContext";function OE(){let e=m.useContext(Nv);return Sv(e,"You must render this element inside a <HydratedRouter> element"),e}function eL(e,t){let n=m.useContext(Nv),[r,o]=m.useState(!1),[i,a]=m.useState(!1),{onFocus:l,onBlur:d,onMouseEnter:f,onMouseLeave:p,onTouchStart:h}=t,g=m.useRef(null);m.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let w=j=>{j.forEach(N=>{a(N.isIntersecting)})},b=new IntersectionObserver(w,{threshold:.5});return g.current&&b.observe(g.current),()=>{b.disconnect()}}},[e]),m.useEffect(()=>{if(r){let w=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},k=()=>{o(!1),a(!1)};return n?e!=="intent"?[i,g,{}]:[i,g,{onFocus:au(l,y),onBlur:au(d,k),onMouseEnter:au(f,y),onMouseLeave:au(p,k),onTouchStart:au(h,y)}]:[!1,g,{}]}function au(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tL({page:e,...t}){let{router:n}=LE(),r=m.useMemo(()=>kE(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?m.createElement(rL,{page:e,matches:r,...t}):null}function nL(e){let{manifest:t,routeModules:n}=OE(),[r,o]=m.useState([]);return m.useEffect(()=>{let i=!1;return GM(e,t,n).then(a=>{i||o(a)}),()=>{i=!0}},[e,t,n]),r}function rL({page:e,matches:t,...n}){let r=rr(),{future:o,manifest:i,routeModules:a}=OE(),{basename:l}=LE(),{loaderData:d,matches:f}=ZM(),p=m.useMemo(()=>l1(e,t,f,i,r,"data"),[e,t,f,i,r]),h=m.useMemo(()=>l1(e,t,f,i,r,"assets"),[e,t,f,i,r]),g=m.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,b=!1;if(t.forEach(N=>{var C;let S=i.routes[N.route.id];!S||!S.hasLoader||(!p.some(I=>I.route.id===N.route.id)&&N.route.id in d&&((C=a[N.route.id])!=null&&C.shouldRevalidate)||S.hasClientLoader?b=!0:w.add(N.route.id))}),w.size===0)return[];let j=WM(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return b&&w.size>0&&j.searchParams.set("_routes",t.filter(N=>w.has(N.route.id)).map(N=>N.route.id).join(",")),[j.pathname+j.search]},[l,o.unstable_trailingSlashAwareDataRequests,d,r,i,p,t,e,a]),y=m.useMemo(()=>YM(h,i),[h,i]),k=nL(h);return m.createElement(m.Fragment,null,g.map(w=>m.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>m.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),k.map(({key:w,link:b})=>m.createElement("link",{key:w,nonce:n.nonce,...b,crossOrigin:b.crossOrigin??n.crossOrigin})))}function sL(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var oL=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{oL&&(window.__reactRouterVersion="7.13.1")}catch{}function iL({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=m.useRef();o.current==null&&(o.current=MI({window:r,v5Compat:!0}));let i=o.current,[a,l]=m.useState({action:i.action,location:i.location}),d=m.useCallback(f=>{n===!1?l(f):m.startTransition(()=>l(f))},[n]);return m.useLayoutEffect(()=>i.listen(d),[i,d]),m.createElement($M,{basename:e,children:t,location:a.location,navigationType:a.action,navigator:i,unstable_useTransitions:n})}var FE=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ie=m.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:i,replace:a,unstable_mask:l,state:d,target:f,to:p,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:y,...k},w){let{basename:b,navigator:j,unstable_useTransitions:N}=m.useContext(Zr),S=typeof p=="string"&&FE.test(p),C=TE(p,b);p=C.to;let I=gM(p,{relative:o}),T=rr(),R=null;if(l){let F=vv(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);b!=="/"&&(F.pathname=F.pathname==="/"?b:Ws([b,F.pathname])),R=j.createHref(F)}let[D,_,B]=eL(r,k),$=uL(p,{replace:a,unstable_mask:l,state:d,target:f,preventScrollReset:h,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:N});function O(F){t&&t(F),F.defaultPrevented||$(F)}let z=!(C.isExternal||i),A=m.createElement("a",{...k,...B,href:(z?R:void 0)||C.absoluteURL||I,onClick:z?O:t,ref:sL(w,_),target:f,"data-discover":!S&&n==="render"?"true":void 0});return D&&!S?m.createElement(m.Fragment,null,A,m.createElement(tL,{page:I})):A});Ie.displayName="Link";var aL=m.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:i,to:a,viewTransition:l,children:d,...f},p){let h=kd(a,{relative:f.relative}),g=rr(),y=m.useContext(Fh),{navigator:k,basename:w}=m.useContext(Zr),b=y!=null&&mL(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&&w&&(S=wo(S,w)||S);const C=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let I=N===j||!o&&N.startsWith(j)&&N.charAt(C)==="/",T=S!=null&&(S===j||!o&&S.startsWith(j)&&S.charAt(j.length)==="/"),R={isActive:I,isPending:T,isTransitioning:b},D=I?t:void 0,_;typeof r=="function"?_=r(R):_=[r,I?"active":null,T?"pending":null,b?"transitioning":null].filter(Boolean).join(" ");let B=typeof i=="function"?i(R):i;return m.createElement(Ie,{...f,"aria-current":D,className:_,ref:p,style:B,to:a,viewTransition:l},typeof d=="function"?d(R):d)});aL.displayName="NavLink";var lL=m.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:i,method:a=Np,action:l,onSubmit:d,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g,...y},k)=>{let{unstable_useTransitions:w}=m.useContext(Zr),b=pL(),j=hL(l,{relative:f}),N=a.toLowerCase()==="get"?"get":"post",S=typeof l=="string"&&FE.test(l),C=I=>{if(d&&d(I),I.defaultPrevented)return;I.preventDefault();let T=I.nativeEvent.submitter,R=(T==null?void 0:T.getAttribute("formmethod"))||a,D=()=>b(T||I.currentTarget,{fetcherKey:t,method:R,navigate:n,replace:o,state:i,relative:f,preventScrollReset:p,viewTransition:h,unstable_defaultShouldRevalidate:g});w&&n!==!1?m.startTransition(()=>D()):D()};return m.createElement("form",{ref:k,method:N,action:j,onSubmit:r?d:C,...y,"data-discover":!S&&e==="render"?"true":void 0})});lL.displayName="Form";function cL(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zE(e){let t=m.useContext(ac);return cn(t,cL(e)),t}function uL(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:d,unstable_useTransitions:f}={}){let p=Vt(),h=rr(),g=kd(e,{relative:a});return m.useCallback(y=>{if(zM(y,t)){y.preventDefault();let k=n!==void 0?n:qu(h)===qu(g),w=()=>p(e,{replace:k,unstable_mask:r,state:o,preventScrollReset:i,relative:a,viewTransition:l,unstable_defaultShouldRevalidate:d});f?m.startTransition(()=>w()):w()}},[h,p,g,n,r,o,t,e,i,a,l,d,f])}function ks(e){ms(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(ib(e)),n=m.useRef(!1),r=rr(),o=m.useMemo(()=>BM(r.search,n.current?null:t.current),[r.search]),i=Vt(),a=m.useCallback((l,d)=>{const f=ib(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,i("?"+f,d)},[i,o]);return[o,a]}var dL=0,fL=()=>`__${String(++dL)}__`;function pL(){let{router:e}=zE("useSubmit"),{basename:t}=m.useContext(Zr),n=RM(),r=e.fetch,o=e.navigate;return m.useCallback(async(i,a={})=>{let{action:l,method:d,encType:f,formData:p,body:h}=VM(i,t);if(a.navigate===!1){let g=a.fetcherKey||fL();await r(g,n,a.action||l,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:p,body:h,formMethod:a.method||d,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||d,formEncType:a.encType||f,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,t,n])}function hL(e,{relative:t}={}){let{basename:n}=m.useContext(Zr),r=m.useContext(js);cn(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),i={...kd(e||".",{relative:t})},a=rr();if(e==null){i.search=a.search;let l=new URLSearchParams(i.search),d=l.getAll("index");if(d.some(p=>p==="")){l.delete("index"),d.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:Ws([n,i.pathname])),qu(i)}function mL(e,{relative:t}={}){let n=m.useContext(AE);cn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=zE("useViewTransitionState"),o=kd(e,{relative:t});if(!n.isTransitioning)return!1;let i=wo(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=wo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Yp(o.pathname,a)!=null||Yp(o.pathname,i)!=null}var xo=jE();const gL=bd(xo);/**
|
|
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 xL=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BE=(...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 yL={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 bL=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...l},d)=>m.createElement("svg",{ref:d,...yL,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:BE("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 Me=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(bL,{ref:i,iconNode:t,className:BE(`lucide-${xL(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 Bh=Me("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 Xp=Me("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 Uh=Me("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 Qp=Me("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 Hh=Me("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 UE=Me("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 Jp=Me("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 vL=Me("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 wL=Me("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 HE=Me("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 Vh=Me("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 jL=Me("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 VE=Me("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 Or=Me("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 br=Me("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 kL=Me("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 WE=Me("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 qE=Me("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 Zp=Me("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 Cv=Me("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 ab=Me("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 SL=Me("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 NL=Me("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 CL=Me("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 EL=Me("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 TL=Me("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 RL=Me("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 AL=Me("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 Sd=Me("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 PL=Me("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 KE=Me("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 eh=Me("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 _L=Me("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 DL=Me("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 lc=Me("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 c1=Me("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 $L=Me("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 IL=Me("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 GE=Me("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 ML=Me("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 LL=Me("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 Ev=Me("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 OL=Me("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 Tv=Me("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 FL=Me("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 cc=Me("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 zL=Me("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 BL=Me("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 Rv=Me("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 lb=Me("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 UL=Me("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 YE=Me("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 HL=Me("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 VL=Me("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 WL=Me("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=Me("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 KL=Me("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 Av=Me("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 GL=Me("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 YL=Me("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 Pv=Me("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 XL=Me("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 zx=Me("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 XE=Me("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 uc=Me("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 QL=Me("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 $t=Me("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 QE=Me("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 JL=Me("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 ZL=Me("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 Ys=Me("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 Wh=Me("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 e4=Me("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 ji=Me("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 t4=Me("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 n4=Me("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 r4=Me("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 s4=Me("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 o4=Me("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 Xr=Me("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 u1=Me("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 d1=Me("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 _v=Me("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 i4=Me("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 JE=Me("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 Tl=Me("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 vn=Me("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 qh=Me("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 a4=Me("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 l4=Me("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 c4=Me("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 Nd=Me("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ZE(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=ZE(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function u4(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ZE(e))&&(r&&(r+=" "),r+=t);return r}const Dv="-",d4=e=>{const t=p4(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{const l=a.split(Dv);return l[0]===""&&l.length!==1&&l.shift(),e2(l,t)||f4(a)},getConflictingClassGroupIds:(a,l)=>{const d=n[a]||[];return l&&r[a]?[...d,...r[a]]:d}}},e2=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?e2(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Dv);return(a=t.validators.find(({validator:l})=>l(i)))==null?void 0:a.classGroupId},f1=/^\[(.+)\]$/,f4=e=>{if(f1.test(e)){const t=f1.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},p4=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return m4(Object.entries(e.classGroups),n).forEach(([i,a])=>{cb(a,r,i,t)}),r},cb=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:p1(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(h4(o)){cb(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,a])=>{cb(a,p1(t,i),n,r)})})},p1=(e,t)=>{let n=e;return t.split(Dv).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},h4=e=>e.isThemeGetter,m4=(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,g4=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)}}},t2="!",x4=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,a=l=>{const d=[];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)){d.push(l.slice(p,b)),p=b+i;continue}if(j==="/"){h=b;continue}}j==="["?f++:j==="]"&&f--}const g=d.length===0?l:l.substring(p),y=g.startsWith(t2),k=y?g.substring(1):g,w=h&&h>p?h-p:void 0;return{modifiers:d,hasImportantModifier:y,baseClassName:k,maybePostfixModifierPosition:w}};return n?l=>n({className:l,parseClassName:a}):a},y4=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},b4=e=>({cache:g4(e.cacheSize),parseClassName:x4(e),...d4(e)}),v4=/\s+/,w4=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],a=e.trim().split(v4);let l="";for(let d=a.length-1;d>=0;d-=1){const f=a[d],{modifiers:p,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}=n(f);let k=!!y,w=r(k?g.substring(0,y):g);if(!w){if(!k){l=f+(l.length>0?" "+l:l);continue}if(w=r(g),!w){l=f+(l.length>0?" "+l:l);continue}k=!1}const b=y4(p).join(":"),j=h?b+t2:b,N=j+w;if(i.includes(N))continue;i.push(N);const S=o(w,k);for(let C=0;C<S.length;++C){const I=S[C];i.push(j+I)}l=f+(l.length>0?" "+l:l)}return l};function j4(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=n2(t))&&(r&&(r+=" "),r+=n);return r}const n2=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=n2(e[r]))&&(n&&(n+=" "),n+=t);return n};function k4(e,...t){let n,r,o,i=a;function a(d){const f=t.reduce((p,h)=>h(p),e());return n=b4(f),r=n.cache.get,o=n.cache.set,i=l,l(d)}function l(d){const f=r(d);if(f)return f;const p=w4(d,n);return o(d,p),p}return function(){return i(j4.apply(null,arguments))}}const Qt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},r2=/^\[(?:([a-z-]+):)?(.+)\]$/i,S4=/^\d+\/\d+$/,N4=new Set(["px","full","screen"]),C4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E4=/\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$/,T4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,R4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ho=e=>Rl(e)||N4.has(e)||S4.test(e),ni=e=>dc(e,"length",O4),Rl=e=>!!e&&!Number.isNaN(Number(e)),Bx=e=>dc(e,"number",Rl),lu=e=>!!e&&Number.isInteger(Number(e)),P4=e=>e.endsWith("%")&&Rl(e.slice(0,-1)),gt=e=>r2.test(e),ri=e=>C4.test(e),_4=new Set(["length","size","percentage"]),D4=e=>dc(e,_4,s2),$4=e=>dc(e,"position",s2),I4=new Set(["image","url"]),M4=e=>dc(e,I4,z4),L4=e=>dc(e,"",F4),cu=()=>!0,dc=(e,t,n)=>{const r=r2.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},O4=e=>E4.test(e)&&!T4.test(e),s2=()=>!1,F4=e=>R4.test(e),z4=e=>A4.test(e),B4=()=>{const e=Qt("colors"),t=Qt("spacing"),n=Qt("blur"),r=Qt("brightness"),o=Qt("borderColor"),i=Qt("borderRadius"),a=Qt("borderSpacing"),l=Qt("borderWidth"),d=Qt("contrast"),f=Qt("grayscale"),p=Qt("hueRotate"),h=Qt("invert"),g=Qt("gap"),y=Qt("gradientColorStops"),k=Qt("gradientColorStopPositions"),w=Qt("inset"),b=Qt("margin"),j=Qt("opacity"),N=Qt("padding"),S=Qt("saturate"),C=Qt("scale"),I=Qt("sepia"),T=Qt("skew"),R=Qt("space"),D=Qt("translate"),_=()=>["auto","contain","none"],B=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",gt,t],O=()=>[gt,t],z=()=>["",ho,ni],A=()=>["auto",Rl,gt],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",gt],M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Rl,gt];return{cacheSize:500,separator:":",theme:{colors:[cu],spacing:[ho,ni],blur:["none","",ri,gt],brightness:W(),borderColor:[e],borderRadius:["none","","full",ri,gt],borderSpacing:O(),borderWidth:z(),contrast:W(),grayscale:V(),hueRotate:W(),invert:V(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[P4,ni],inset:$(),margin:$(),opacity:W(),padding:O(),saturate:W(),scale:W(),sepia:V(),skew:W(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[ri]}],"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:[...F(),gt]}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",lu,gt]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",lu,gt]}],"grid-cols":[{"grid-cols":[cu]}],"col-start-end":[{col:["auto",{span:["full",lu,gt]},gt]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[cu]}],"row-start-end":[{row:["auto",{span:[lu,gt]},gt]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"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",gt,t]}],"min-w":[{"min-w":[gt,t,"min","max","fit"]}],"max-w":[{"max-w":[gt,t,"none","full","min","max","fit","prose",{screen:[ri]},ri]}],h:[{h:[gt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ri,ni]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Bx]}],"font-family":[{font:[cu]}],"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",gt]}],"line-clamp":[{"line-clamp":["none",Rl,Bx]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ho,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"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:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ho,ni]}],"underline-offset":[{"underline-offset":["auto",ho,gt]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],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",gt]}],"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:[...F(),$4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",D4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},M4]}],"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:[...U(),"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:U()}],"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:["",...U()]}],"outline-offset":[{"outline-offset":[ho,gt]}],"outline-w":[{outline:[ho,ni]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[ho,ni]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ri,L4]}],"shadow-color":[{shadow:[cu]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",ri,gt]}],grayscale:[{grayscale:[f]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[I]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"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":[I]}],"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",gt]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[lu,gt]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"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",gt]}],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",gt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",gt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ho,ni,Bx]}],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"]}}},U4=k4(B4);function Ne(...e){return U4(u4(e))}function qn(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 Jr(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 o2(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function i2(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 a2(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 Hl(e){return e.toLocaleString("en-US")}function Vl(e){return`$${e.toFixed(4)}`}function H4(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 Tn(e){return e.split(/[_\s-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function l2(e){return!e||e==="/"?"/":e.endsWith("/")?e.slice(0,-1):e}function V4(e){let t=l2(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 c2(e,t){return V4(e)===t}function u2(e){let n=l2(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:Tn(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:Tn(n[1]),path:`${a}/projects/${n[1]}`}),o=Tn(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:Tn(n[3]),path:`${a}/projects/${n[1]}/assignments/${n[3]}`}),o=Tn(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",d=n[2]==="memories"?"/memories":"/resources";r.push({label:l,path:d}),r.push({label:Tn(n[3]),path:`${a}/projects/${n[1]}/${n[2]}/${n[3]}`}),o=Tn(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:Tn(n[1]),path:`/playbooks/${n[1]}`}),o="Edit Playbook"):n[1]&&(r.push({label:Tn(n[1]),path:`/playbooks/${n[1]}`}),o=Tn(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 h1({items:e,onNavigate:t}){const n=rr();return s.jsx("nav",{className:"space-y-1",children:e.map(r=>{const o=r.icon,i=c2(n.pathname,r.to)&&!n.pathname.startsWith("/w/");return s.jsxs(Ie,{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 d2=[{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)"}}],W4=d2.map(e=>e.slug),th="default";function f2(e){return typeof e=="string"&&W4.includes(e)}const p2={preset:th,custom:!1};let Cu=null,rl=null;function $v(e){if(!e||typeof e!="object")return p2;const t=e;return{preset:f2(t.preset)?t.preset:th,custom:t.custom===!0}}function q4(){return Cu?Promise.resolve(Cu):rl||(rl=fetch("/api/config/theme").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=$v(e);return Cu=t,rl=null,t}).catch(()=>(rl=null,p2)),rl)}async function K4(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=$v(await t.json());return Cu=n,n}async function G4(){const e=await fetch("/api/config/theme",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=$v(await e.json());return Cu=t,t}const ub="syntaur-theme",Ep="syntaur-preset",h2=m.createContext(null);function db(){try{const e=window.localStorage.getItem(ub);return e==="light"||e==="dark"?e:null}catch{return null}}function m2(){try{const e=window.localStorage.getItem(Ep);return f2(e)?e:th}catch{return th}}function g2(){return typeof window>"u"||!window.matchMedia?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function x2(e){document.documentElement.classList.toggle("dark",e==="dark")}function y2(e){document.documentElement.dataset.theme=e}function Y4(){typeof document>"u"||(x2(db()??g2()),y2(m2()))}function X4({children:e}){const[t,n]=m.useState(()=>db()),[r,o]=m.useState(()=>db()??g2()),[i,a]=m.useState(()=>m2());m.useEffect(()=>{x2(r)},[r]),m.useEffect(()=>{y2(i)},[i]),m.useEffect(()=>{let p=!1;return q4().then(h=>{if(!p&&h.preset!==i){a(h.preset);try{window.localStorage.setItem(Ep,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(Ep,p)}catch{}await K4(p)}async function d(){const p=await G4();a(p.preset);try{window.localStorage.setItem(Ep,p.preset)}catch{}}const f={resolvedTheme:r,explicitTheme:t,setTheme:p=>{window.localStorage.setItem(ub,p),n(p),o(p)},toggleTheme:()=>{const p=r==="dark"?"light":"dark";window.localStorage.setItem(ub,p),n(p),o(p)},preset:i,setPreset:l,resetPreset:d};return s.jsx(h2.Provider,{value:f,children:e})}function Iv(){const e=m.useContext(h2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Q4=2e3,Eu=new Set;let hr=null,na=null,Tp=!1;function J4(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}let Z4=J4;function eO(){na&&clearTimeout(na),na=setTimeout(()=>{na=null,b2()},Q4)}function b2(){hr&&(hr.readyState===WebSocket.OPEN||hr.readyState===WebSocket.CONNECTING)||(Tp=!1,hr=new WebSocket(Z4()),hr.onmessage=e=>{try{const t=JSON.parse(e.data);for(const n of Eu)n(t)}catch{}},hr.onclose=()=>{if(hr=null,Tp||Eu.size===0){Tp=!1;return}eO()},hr.onerror=()=>{hr==null||hr.close()})}function tO(e){return Eu.add(e),b2(),()=>{Eu.delete(e),Eu.size===0&&(na&&(clearTimeout(na),na=null),hr&&(Tp=!0,hr.close(),hr=null))}}function fc(e){const t=m.useRef(e);t.current=e,m.useEffect(()=>tO(o=>t.current(o)),[])}const Kh=["7d","30d","90d","all","custom"],v2="30d",nO=/^\d{4}-\d{2}-\d{2}$/,Cd=["project","workspace","model","tool"],rO={"7d":7,"30d":30,"90d":90};function Tu(e){if(typeof e!="string"||!nO.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 m1(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 sO(e,t){return new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+t))}function oO(e,t=new Date){const n=e.window??v2;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:m1(sO(r,-(rO[n]-1))),until:m1(r)}}function iO(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&&!Kh.includes(n.window)&&t.push(`invalid window: ${String(n.window)}`);for(const r of["since","until"])n[r]!==void 0&&!Tu(n[r])&&t.push(`invalid ${r}: ${String(n[r])} (expected YYYY-MM-DD)`);for(const r of Cd)n[r]!==void 0&&(typeof n[r]!="string"||n[r].length===0)&&t.push(`invalid ${r}: must be a non-empty string`);return Tu(n.since)&&Tu(n.until)&&n.since>n.until&&t.push("since must be on or before until"),{ok:t.length===0,errors:t}}function Ed(e){const t={};if(!e||typeof e!="object"||Array.isArray(e))return t;const n=e;typeof n.window=="string"&&Kh.includes(n.window)&&(t.window=n.window),Tu(n.since)&&(t.since=n.since),Tu(n.until)&&(t.until=n.until);for(const r of Cd)typeof n[r]=="string"&&n[r].length>0&&(t[r]=n[r]);return t.window!=="custom"&&(delete t.since,delete t.until),t}function fb(e){const t=Ed(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 Cd)t[r]&&n.set(r,t[r]);return n}function aO(e){const t={};for(const n of["window","since","until",...Cd]){const r=e.get(n);r!==null&&(t[n]=r)}return Ed(t)}function w2(e,t=new Date){const n=Ed(e),{since:r,until:o}=oO(n,t),i=new URLSearchParams;r&&i.set("since",r),o&&i.set("until",o);for(const a of Cd)n[a]&&i.set(a,n[a]);return i}const lO={"7d":"Last 7 days","30d":"Last 30 days","90d":"Last 90 days",all:"All time",custom:"Custom range"};function g1(e){const t=Ed(e),n=t.window??v2,r=[];return r.push(n==="custom"?`${t.since??"…"} → ${t.until??"…"}`:lO[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 en(e,t,n=!0,r=!1){const[o,i]=m.useState(null),[a,l]=m.useState(!0),[d,f]=m.useState(null),[p,h]=m.useState(0),g=n?e:null,y=m.useCallback(()=>{h(w=>w+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 w=!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=>{w||(i(b),l(!1))}).catch(b=>{w||(f(b.message),l(!1))}),()=>{w=!0}},[g,p]),fc(w=>{!t||!g||((w.type==="project-updated"||w.type==="assignment-updated")&&y(),w.type==="servers-updated"&&t==="servers"&&y(),w.type==="agent-sessions-updated"&&(t==="agent-sessions"||t==="overview")&&y(),w.type==="playbooks-updated"&&t==="playbooks"&&y(),w.type==="leases-updated"&&t==="inventories"&&y())}),{data:o,loading:a,error:d,refetch:y}}function Qs(e=!0){return en("/api/projects","projects",e)}function ja(){return en("/api/workspaces","projects")}function pn(){const{workspace:e}=Wt();return e?`/w/${e}`:""}function cO(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 en(r,"overview")}function Gh(e=!0){return en("/api/assignments","assignments",e)}function uO(e=!0){return en("/api/archived","assignments",e)}function j2(){return en("/api/help")}function k2(e){const t=e?`/api/projects/${e}`:null;return en(t,"project")}function dO(e,t){const n=e&&t?`/api/projects/${e}/assignments/${t}`:null;return en(n,"assignment")}function fO(e){const t=e?`/api/assignments/${e}`:null;return en(t,"assignment")}function S2(e){return en(e)}function Mv(e=!0){return en("/api/servers","servers",e)}function N2(){return en("/api/leases","inventories")}function Yh(){return en("/api/agent-sessions","agent-sessions")}function pO(e,t){const n=e&&t?`/api/agent-sessions/${e}?assignment=${t}`:null;return en(n,"agent-sessions")}function hO(e){const t=e?`/api/assignments/${e}/sessions`:null;return en(t,"agent-sessions")}function mO(e,t){const n=e&&t?`/api/usage/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}`:null;return en(n,void 0,!0,!0)}function gO(e){const t=e?`/api/usage/standalone/${encodeURIComponent(e)}`:null;return en(t,void 0,!0,!0)}function Lv(e=!0){return en("/api/playbooks","playbooks",e)}function xO(e){const t=w2(e).toString(),n=t?`/api/usage?${t}`:"/api/usage";return en(n,void 0,!0,!0)}function C2(e=!0){return en("/api/usage/facets",void 0,e)}function yO(e){const t=e?`/api/playbooks/${e}`:null;return en(t,"playbooks")}function bO(){return en("/api/memories","project")}function vO(e,t){const n=e&&t?`/api/projects/${e}/memories/${t}`:null;return en(n,"project")}function wO(){return en("/api/resources","project")}function jO(e,t){const n=e&&t?`/api/projects/${e}/resources/${t}`:null;return en(n,"project")}const Xh=["new-workspace","new-project","new-todo","new-assignment"];function kO(e){return typeof e=="string"&&Xh.includes(e)}const SO=["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","[","]"],NO=["mod","ctrl","alt","shift"];function gr(e){if(typeof e!="string")return"";const t=e.trim();if(!t)return"";if(/\s/.test(t)&&!t.includes("+"))return t.split(/\s+/).map(gr).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 NO)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 CO(e){const t=gr(e);return t?SO.includes(t):!1}const EO={"new-workspace":gr("Mod+Shift+Alt+w"),"new-project":gr("Mod+Shift+Alt+p"),"new-todo":gr("Mod+Shift+Alt+t"),"new-assignment":gr("Mod+Shift+Alt+a")};function TO(e){const t={...EO};for(const n of Xh){const r=e[n];typeof r=="string"&&r.length>0&&(t[n]=r)}return t}function ea(){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 RO(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 Xf(e,t){const n=RO(t);if(e.key.toLowerCase()!==n.key)return!1;const o=ea()?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 E2(e){const t=[],n=ea()?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 gr(a)}function qs(e){return e.split("+").map(n=>{const r=n.toLowerCase();return r==="mod"?ea()?"⌘":"Ctrl":r==="shift"?ea()?"⇧":"Shift":r==="alt"?ea()?"⌥":"Alt":r==="ctrl"?ea()?"⌃":"Ctrl":r==="enter"?"↵":r==="escape"?"Esc":r==="arrowup"?"↑":r==="arrowdown"?"↓":n.length===1?n.toUpperCase():n}).join(ea()?"":"+")}function AO(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch(`/api/todos/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),fc(d=>{d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function T2(e=!0){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch("/api/todos");if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[]);return m.useEffect(()=>{if(!e){o(!1);return}l()},[l,e]),fc(d=>{e&&d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}async function Ov(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function R2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function A2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function P2(e,t,n){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function _2(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function D2(e,t){await fetch(`/api/todos/${encodeURIComponent(e)}/${t}`,{method:"DELETE"})}async function $2(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 Fv(e,t,n){return`/api/todos/${encodeURIComponent(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function I2(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 M2(e,t,n){const r=await fetch(Fv(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function zv(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 PO(e,t){return await zv(`/api/todos/${encodeURIComponent(e)}/promote`,t)}async function _O(e){return await zv("/api/todos/promote-bulk",e)}async function DO(e,t,n){await zv(`/api/todos/${encodeURIComponent(e)}/${t}/move`,{to:n})}const Qh=["assignment","project","todo","server","playbook"],la={defaultScope:"all",aliases:{a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},externalIds:!0},L2=["kind","status","tag","tags","assignee","type","project","externalid","jira","title","search"],pb="all",O2=/^[a-z][a-z0-9]*$/;function Bv(e){return typeof e=="string"&&Qh.includes(e)}function $O(e){return e==="all"||Bv(e)}function IO(e){if(!e||typeof e!="object")return LO();const t=e,n=$O(t.defaultScope)?t.defaultScope:la.defaultScope,r=typeof t.externalIds=="boolean"?t.externalIds:la.externalIds;let o;if(t.aliases&&typeof t.aliases=="object"){o={};for(const[i,a]of Object.entries(t.aliases))O2.test(i)&&i!==pb&&!L2.includes(i)&&Bv(a)&&(o[i]=a)}else o={...la.aliases};return{defaultScope:n,aliases:o,externalIds:r}}function MO(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))O2.test(n)||t.push(`alias key "${n}" must be lowercase and match [a-z][a-z0-9]*`),n===pb&&t.push(`alias key "${pb}" is reserved (the "search everything" escape)`),L2.includes(n)&&t.push(`alias key "${n}" collides with the reserved field name "${n}"`),Bv(r)||t.push(`alias "${n}" must map to one of: ${Qh.join(", ")}`);return t.length===0?{ok:!0}:{ok:!1,errors:t}}function LO(){return{defaultScope:la.defaultScope,aliases:{...la.aliases},externalIds:la.externalIds}}const Uv={search:la,custom:!1};let vl=null,sl=null,nh=0;const hb=new Set;function F2(e){vl=e;for(const t of hb)t(e)}function Hv(e){if(!e||typeof e!="object")return Uv;const t=e;return{search:IO(t.search),custom:t.custom===!0}}function OO(){if(vl)return Promise.resolve(vl);if(sl)return sl;const e=++nh;return sl=fetch("/api/config/search").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{sl=null;const n=Hv(t);return e!==nh?vl??n:(vl=n,n)}).catch(()=>(sl=null,Uv)),sl}function Vv(){const[e,t]=m.useState(()=>vl??Uv);return m.useEffect(()=>{let n=!1;return OO().then(r=>{n||t(r)}),hb.add(t),()=>{n=!0,hb.delete(t)}},[]),e}async function FO(e){var r;++nh;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=Hv(await t.json());return F2(n),n}async function zO(){++nh;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=Hv(await e.json());return F2(t),t}const BO=new Set(["/projects","/assignments","/servers","/todos"]);function Rp(e,t){return BO.has(e)?`${t}${e}`:e}const UO=[{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 HO(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 VO(e){const t=[],n=e.externalIds!==!1,r=i=>n?HO(i):[],o=i=>n?i:void 0;for(const i of UO)t.push({type:"page",id:i.id,title:i.title,keywords:[...i.keywords],route:Rp(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:`${Rp("/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=Rp("/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 Rr(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function Ap(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)}async function WO(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 Ux(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 x1(){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 y1(){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 Hx(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 qi(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),d=JSON.stringify(n),f=new RegExp(`^${t}:\\s*.*$`,"m");let p;return f.test(i)?p=i.replace(f,`${t}: ${d}`):p=`${i}
|
|
535
|
+
${t}: ${d}`,`${o}${p}${a}${l}`}const qO=/^[a-z0-9][a-z0-9-]*$/;function KO(e){const{playbooks:t,projectSlug:n,currentProjectTitle:r,currentProjectWorkspace:o,wsPrefix:i,refetchPlaybooks:a,navigate:l,toggleTheme:d}=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:qO,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 x1(),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=Rr(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");let w=await Hx("/api/templates/project");w=qi(w,"slug",k),w=qi(w,"title",y),g&&g!=="_ungrouped"&&(w=qi(w,"workspace",g));const b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),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([x1(),y1()]),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 Ov(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 y1(),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=Rr(y);if(!k)throw new Error("Title must contain at least one alphanumeric character");if(g==="_standalone"){let C=await Hx("/api/templates/assignment?standalone=1");C=qi(C,"slug",k),C=qi(C,"title",y);const I=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:C})}),T=await I.json().catch(()=>({}));if(!I.ok)throw new Error(T.error||`Failed to create assignment (HTTP ${I.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 w=await Hx("/api/templates/assignment");w=qi(w,"slug",k),w=qi(w,"title",y);const b=await fetch(`/api/projects/${encodeURIComponent(g)}/assignments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:w})}),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 Ux("_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 Ux(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 Ux(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:()=>WO(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:()=>d()}),f}const GO=["low","medium","high","critical"],Jh={status:{kind:"enum"},priority:{kind:"ordinal",order:GO},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 YO(e,t){return e[t.toLowerCase()]??null}function Ar(e,t,n){return e.get?e.get(n):n[t]??n[t.toLowerCase()]}class Pr extends Error{constructor(t){super(t.map(n=>`${n.message} (at ${n.pos})`).join("; ")),this.errors=t,this.name="CompileError"}}function z2(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 mb(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 Ru(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 Vx(e,t){return typeof e=="string"&&e.toLowerCase()===t.toLowerCase()}function XO(e){return e==null||e===""}function Pp(e,t,n,r){switch(e.kind){case"enum":case"string":return e.noneSentinel&&n.raw.toLowerCase()==="none"?o=>XO(Ar(e,t,o)):o=>Vx(Ar(e,t,o),n.raw);case"substring":return o=>{const i=Ar(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 Pr([{pos:n.pos,message:`Field "${t}" is boolean — use ${t}:true or ${t}:false`}]);const i=o==="true";return a=>{const l=Ar(e,t,a),d=typeof l=="boolean"?l:l==="true"?!0:l==="false"||l===null||l===void 0||l===""?!1:null;return d!==null&&d===i}}case"number":{const o=n.num??Ru(n.raw);if(o===null)throw new Pr([{pos:n.pos,message:`Field "${t}" is numeric — "${n.raw}" is not a number`}]);return i=>Ru(Ar(e,t,i))===o}case"ordinal":return o=>Vx(Ar(e,t,o),n.raw);case"list":return o=>{const i=Ar(e,t,o);return Array.isArray(i)&&i.some(a=>Vx(a,n.raw))};case"timestamp":{if(n.type==="date"){const[o,i]=z2(n.raw);return a=>{const l=mb(Ar(e,t,a));return l!==null&&l>=o&&l<i}}throw new Pr([{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 Pr([{pos:r,message:`Field "${t}" is a duration — use a comparison (e.g. ${t} > 3d)`}])}}function QO(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??Ru(r.raw);if(i===null)throw new Pr([{pos:r.pos,message:`"${r.raw}" is not a number (field "${t}")`}]);return a=>{const l=Ru(Ar(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 Pr([{pos:r.pos,message:`"${r.raw}" is not a valid ${t} (expected one of: ${i.join(", ")})`}]);return l=>{const d=Ar(e,t,l),f=typeof d=="string"?i.findIndex(p=>p.toLowerCase()===d.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,d)=>{const f=mb(Ar(e,t,l));return f!==null&&o(f,d.now+a)}}if(r.type==="date"){const[i,a]=z2(r.raw);return l=>{const d=mb(Ar(e,t,l));if(d===null)return!1;switch(n){case"<":return d<i;case"<=":return d<a;case">":return d>=a;case">=":return d>=i;case"=":return d>=i&&d<a;case"!=":return d<i||d>=a;default:return!1}}}throw new Pr([{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 Pr([{pos:r.pos,message:`Compare duration field "${t}" to a duration literal (e.g. 3d)`}]);const i=r.num??0;return a=>{const l=Ru(Ar(e,t,a));return l!==null&&o(l,i)}}case"enum":case"string":case"substring":case"list":{if(n==="=")return Pp(e,t,r,r.pos);if(n==="!="){const i=Pp(e,t,r,r.pos);return(a,l)=>!i(a,l)}throw new Pr([{pos:r.pos,message:`Field "${t}" does not support ordering comparisons (use ":" or "=").`}])}case"bool":{if(n==="="||n==="!="){const i=Pp(e,t,r,r.pos);return n==="="?i:(a,l)=>!i(a,l)}throw new Pr([{pos:r.pos,message:`Field "${t}" is boolean — use ${t}:true / ${t}:false`}])}}}function JO(e,t){const n=YO(t,e.field);if(!n)throw new Pr([{pos:e.pos,message:`Unknown field "${e.field}"`}]);if(e.op===":"){const r=e.values.map(o=>Pp(n,e.field,o,e.pos));return r.length===1?r[0]:(o,i)=>r.some(a=>a(o,i))}return QO(n,e.field,e.op,e.values[0])}function Au(e,t){switch(e.kind){case"all":return()=>!0;case"atom":return JO(e,t);case"not":{const n=Au(e.child,t);return(r,o)=>!n(r,o)}case"and":{const n=e.children.map(r=>Au(r,t));return(r,o)=>n.every(i=>i(r,o))}case"or":{const n=e.children.map(r=>Au(r,t));return(r,o)=>n.some(i=>i(r,o))}}}class ta extends Error{constructor(t,n){super(n),this.pos=t,this.name="LexError"}}const ZO={h:36e5,d:864e5,w:7*864e5,m:30*864e5,mo:30*864e5,y:365*864e5},e5=/[A-Za-z_]/,t5=/[A-Za-z0-9_-]/,n5=/^\d{4}-\d{2}-\d{2}/;function Zh(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 d="";for(;a<e.length&&/[a-z]/i.test(e[a]);)d+=e[a],a++;if(n=a,d.length>0){const f=ZO[d.toLowerCase()];if(f===void 0)throw new ta(o,`Unknown duration unit "${d}" (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 ta(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,d="";for(;l<e.length&&e[l]!==a;)e[l]==="\\"&&l+1<e.length?(d+=e[l+1],l+=2):(d+=e[l],l++);if(l>=e.length)throw new ta(i,"Unterminated string literal");t.push({type:"STRING",text:d,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 ta(i,'Unexpected "+"')}if(/\d/.test(o)){const a=e.slice(n).match(n5);if(a){t.push({type:"DATE",text:a[0],pos:i}),n+=a[0].length;continue}t.push(r(i,0));continue}if(e5.test(o)){let a=n+1;for(;a<e.length&&t5.test(e[a]);)a++;const l=e.slice(n,a),d=l.toLowerCase();d==="and"?t.push({type:"AND",text:l,pos:i}):d==="or"?t.push({type:"OR",text:l,pos:i}):d==="not"?t.push({type:"NOT",text:l,pos:i}):t.push({type:"IDENT",text:l,pos:i}),n=a;continue}throw new ta(i,`Unexpected character "${o}"`)}return t.push({type:"EOF",text:"",pos:e.length}),t}class Gi extends Error{constructor(t,n){super(n),this.pos=t,this.name="ParseError"}}const r5=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]),s5=new Set(["IDENT","NOT","MINUS","LPAREN","STAR"]);class o5{constructor(t){Px(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 Gi(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 Gi(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(s5.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 Gi(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 Gi(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 Gi(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(!r5.has(t.type))throw new Gi(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 em(e){try{const t=Zh(e);return{ast:new o5(t).parseQuery(),errors:[]}}catch(t){if(t instanceof ta||t instanceof Gi)return{ast:null,errors:[{pos:t.pos,message:t.message}]};throw t}}function Wl(e,t=Jh){const n=em(e);if(!n.ast)return{query:null,errors:n.errors};try{return{query:{predicate:Au(n.ast,t),ast:n.ast},errors:[]}}catch(r){if(r instanceof Pr)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 b1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function tm(...e){return t=>{let n=!1;const r=e.map(o=>{const i=b1(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():b1(e[o],null)}}}}function Jn(...e){return m.useCallback(tm(...e),e)}function i5(e,t){const n=m.createContext(t),r=i=>{const{children:a,...l}=i,d=m.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:d,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 ka(e,t=[]){let n=[];function r(i,a){const l=m.createContext(a),d=n.length;n=[...n,a];const f=h=>{var j;const{scope:g,children:y,...k}=h,w=((j=g==null?void 0:g[e])==null?void 0:j[d])||l,b=m.useMemo(()=>k,Object.values(k));return s.jsx(w.Provider,{value:b,children:y})};f.displayName=i+"Provider";function p(h,g){var w;const y=((w=g==null?void 0:g[e])==null?void 0:w[d])||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 d=(l==null?void 0:l[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return o.scopeName=e,[r,a5(o,...t)]}function a5(...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:d,scopeName:f})=>{const h=d(i)[`__scope${f}`];return{...l,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var gi=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},l5=wE[" useId ".trim().toString()]||(()=>{}),c5=0;function Al(e){const[t,n]=m.useState(l5());return gi(()=>{n(r=>r??String(c5++))},[e]),e||(t?`radix-${t}`:"")}var u5=wE[" useInsertionEffect ".trim().toString()]||gi;function nm({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=d5({defaultProp:t,onChange:n}),l=e!==void 0,d=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=f5(p)?p(e):p;g!==e&&((h=a.current)==null||h.call(a,g))}else i(p)},[l,e,i,a]);return[d,f]}function d5({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return u5(()=>{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 f5(e){return typeof e=="function"}function p5(e){const t=h5(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(g5);if(d){const f=d.props.children,p=l.map(h=>h===d?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 h5(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=y5(o),l=x5(i,o.props);return o.type!==m.Fragment&&(l.ref=r?tm(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 m5=Symbol("radix.slottable");function g5(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===m5}function x5(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function y5(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 b5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jn=b5.reduce((e,t)=>{const n=p5(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:a,...l}=o,d=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(d,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function v5(e,t){e&&xo.flushSync(()=>e.dispatchEvent(t))}function ha(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 w5(e,t=globalThis==null?void 0:globalThis.document){const n=ha(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 j5="DismissableLayer",gb="dismissableLayer.update",k5="dismissableLayer.pointerDownOutside",S5="dismissableLayer.focusOutside",v1,B2=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wv=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...d}=e,f=m.useContext(B2),[p,h]=m.useState(null),g=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=m.useState({}),k=Jn(t,R=>h(R)),w=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),j=w.indexOf(b),N=p?w.indexOf(p):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,C=N>=j,I=E5(R=>{const D=R.target,_=[...f.branches].some(B=>B.contains(D));!C||_||(o==null||o(R),a==null||a(R),R.defaultPrevented||l==null||l())},g),T=T5(R=>{const D=R.target;[...f.branches].some(B=>B.contains(D))||(i==null||i(R),a==null||a(R),R.defaultPrevented||l==null||l())},g);return w5(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&&(v1=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),w1(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=v1)}},[p,g,n,f]),m.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),w1())},[p,f]),m.useEffect(()=>{const R=()=>y({});return document.addEventListener(gb,R),()=>document.removeEventListener(gb,R)},[]),s.jsx(jn.div,{...d,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,I.onPointerDownCapture)})});Wv.displayName=j5;var N5="DismissableLayerBranch",C5=m.forwardRef((e,t)=>{const n=m.useContext(B2),r=m.useRef(null),o=Jn(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(jn.div,{...e,ref:o})});C5.displayName=N5;function E5(e,t=globalThis==null?void 0:globalThis.document){const n=ha(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let d=function(){U2(k5,n,f,{discrete:!0})};const f={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}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 T5(e,t=globalThis==null?void 0:globalThis.document){const n=ha(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&U2(S5,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 w1(){const e=new CustomEvent(gb);document.dispatchEvent(e)}function U2(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?v5(o,i):o.dispatchEvent(i)}var Wx="focusScope.autoFocusOnMount",qx="focusScope.autoFocusOnUnmount",j1={bubbles:!1,cancelable:!0},R5="FocusScope",H2=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,d]=m.useState(null),f=ha(o),p=ha(i),h=m.useRef(null),g=Jn(t,w=>d(w)),y=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let w=function(S){if(y.paused||!l)return;const C=S.target;l.contains(C)?h.current=C:ui(h.current,{select:!0})},b=function(S){if(y.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||ui(h.current,{select:!0}))},j=function(S){if(document.activeElement===document.body)for(const I of S)I.removedNodes.length>0&&ui(l)};document.addEventListener("focusin",w),document.addEventListener("focusout",b);const N=new MutationObserver(j);return l&&N.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",b),N.disconnect()}}},[r,l,y.paused]),m.useEffect(()=>{if(l){S1.add(y);const w=document.activeElement;if(!l.contains(w)){const j=new CustomEvent(Wx,j1);l.addEventListener(Wx,f),l.dispatchEvent(j),j.defaultPrevented||(A5(I5(V2(l)),{select:!0}),document.activeElement===w&&ui(l))}return()=>{l.removeEventListener(Wx,f),setTimeout(()=>{const j=new CustomEvent(qx,j1);l.addEventListener(qx,p),l.dispatchEvent(j),j.defaultPrevented||ui(w??document.body,{select:!0}),l.removeEventListener(qx,p),S1.remove(y)},0)}}},[l,f,p,y]);const k=m.useCallback(w=>{if(!n&&!r||y.paused)return;const b=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,j=document.activeElement;if(b&&j){const N=w.currentTarget,[S,C]=P5(N);S&&C?!w.shiftKey&&j===C?(w.preventDefault(),n&&ui(S,{select:!0})):w.shiftKey&&j===S&&(w.preventDefault(),n&&ui(C,{select:!0})):j===N&&w.preventDefault()}},[n,r,y.paused]);return s.jsx(jn.div,{tabIndex:-1,...a,ref:g,onKeyDown:k})});H2.displayName=R5;function A5(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ui(r,{select:t}),document.activeElement!==n)return}function P5(e){const t=V2(e),n=k1(t,e),r=k1(t.reverse(),e);return[n,r]}function V2(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 k1(e,t){for(const n of e)if(!_5(n,{upTo:t}))return n}function _5(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 D5(e){return e instanceof HTMLInputElement&&"select"in e}function ui(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&D5(e)&&t&&e.select()}}var S1=$5();function $5(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=N1(e,t),e.unshift(t)},remove(t){var n;e=N1(e,t),(n=e[0])==null||n.resume()}}}function N1(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function I5(e){return e.filter(t=>t.tagName!=="A")}var M5="Portal",qv=m.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,i]=m.useState(!1);gi(()=>i(!0),[]);const a=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return a?gL.createPortal(s.jsx(jn.div,{...r,ref:t}),a):null});qv.displayName=M5;function L5(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Sa=e=>{const{present:t,children:n}=e,r=O5(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=Jn(r.ref,F5(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Sa.displayName="Presence";function O5(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),a=e?"mounted":"unmounted",[l,d]=L5(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const f=Qf(r.current);i.current=l==="mounted"?f:"none"},[l]),gi(()=>{const f=r.current,p=o.current;if(p!==e){const g=i.current,y=Qf(f);e?d("MOUNT"):y==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(p&&g!==y?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),gi(()=>{if(t){let f;const p=t.ownerDocument.defaultView??window,h=y=>{const w=Qf(r.current).includes(CSS.escape(y.animationName));if(y.target===t&&w&&(d("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=Qf(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 d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:m.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Qf(e){return(e==null?void 0:e.animationName)||"none"}function F5(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 Kx=0;function z5(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??C1()),document.body.insertAdjacentElement("beforeend",e[1]??C1()),Kx++,()=>{Kx===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Kx--}},[])}function C1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Bs=function(){return Bs=Object.assign||function(t){for(var n,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},Bs.apply(this,arguments)};function W2(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 B5(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 _p="right-scroll-bar-position",Dp="width-before-scroll-bar",U5="with-scroll-bars-hidden",H5="--removed-body-scroll-bar-size";function Gx(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function V5(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 W5=typeof window<"u"?m.useLayoutEffect:m.useEffect,E1=new WeakMap;function q5(e,t){var n=V5(null,function(r){return e.forEach(function(o){return Gx(o,r)})});return W5(function(){var r=E1.get(n);if(r){var o=new Set(r),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||Gx(l,null)}),i.forEach(function(l){o.has(l)||Gx(l,a)})}E1.set(n,e)},[e]),n}function K5(e){return e}function G5(e,t){t===void 0&&(t=K5);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 d=function(){var p=a;a=[],p.forEach(i)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(p){a.push(p),f()},filter:function(p){return a=a.filter(p),n}}}};return o}function Y5(e){e===void 0&&(e={});var t=G5(null);return t.options=Bs({async:!0,ssr:!1},e),t}var q2=function(e){var t=e.sideCar,n=W2(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,Bs({},n))};q2.isSideCarExport=!0;function X5(e,t){return e.useMedium(t),q2}var K2=Y5(),Yx=function(){},rm=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:Yx,onWheelCapture:Yx,onTouchMoveCapture:Yx}),o=r[0],i=r[1],a=e.forwardProps,l=e.children,d=e.className,f=e.removeScrollBar,p=e.enabled,h=e.shards,g=e.sideCar,y=e.noRelative,k=e.noIsolation,w=e.inert,b=e.allowPinchZoom,j=e.as,N=j===void 0?"div":j,S=e.gapMode,C=W2(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=g,T=q5([n,t]),R=Bs(Bs({},C),o);return m.createElement(m.Fragment,null,p&&m.createElement(I,{sideCar:K2,removeScrollBar:f,shards:h,noRelative:y,noIsolation:k,inert:w,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:S}),a?m.cloneElement(m.Children.only(l),Bs(Bs({},R),{ref:T})):m.createElement(N,Bs({},R,{className:d,ref:T}),l))});rm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};rm.classNames={fullWidth:Dp,zeroRight:_p};var Q5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function J5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Q5();return t&&e.setAttribute("nonce",t),e}function Z5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function eF(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var tF=function(){var e=0,t=null;return{add:function(n){e==0&&(t=J5())&&(Z5(t,n),eF(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},nF=function(){var e=tF();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},G2=function(){var e=nF(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},rF={left:0,top:0,right:0,gap:0},Xx=function(e){return parseInt(e||"",10)||0},sF=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[Xx(n),Xx(r),Xx(o)]},oF=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return rF;var t=sF(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])}},iF=G2(),Pl="data-scroll-locked",aF=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(U5,` {
|
|
538
|
+
overflow: hidden `).concat(r,`;
|
|
539
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
540
|
+
}
|
|
541
|
+
body[`).concat(Pl,`] {
|
|
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(_p,` {
|
|
555
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.`).concat(Dp,` {
|
|
559
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.`).concat(_p," .").concat(_p,` {
|
|
563
|
+
right: 0 `).concat(r,`;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.`).concat(Dp," .").concat(Dp,` {
|
|
567
|
+
margin-right: 0 `).concat(r,`;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
body[`).concat(Pl,`] {
|
|
571
|
+
`).concat(H5,": ").concat(l,`px;
|
|
572
|
+
}
|
|
573
|
+
`)},T1=function(){var e=parseInt(document.body.getAttribute(Pl)||"0",10);return isFinite(e)?e:0},lF=function(){m.useEffect(function(){return document.body.setAttribute(Pl,(T1()+1).toString()),function(){var e=T1()-1;e<=0?document.body.removeAttribute(Pl):document.body.setAttribute(Pl,e.toString())}},[])},cF=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;lF();var i=m.useMemo(function(){return oF(o)},[o]);return m.createElement(iF,{styles:aF(i,!t,o,n?"":"!important")})},xb=!1;if(typeof window<"u")try{var Jf=Object.defineProperty({},"passive",{get:function(){return xb=!0,!0}});window.addEventListener("test",Jf,Jf),window.removeEventListener("test",Jf,Jf)}catch{xb=!1}var ol=xb?{passive:!1}:!1,uF=function(e){return e.tagName==="TEXTAREA"},Y2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!uF(e)&&n[t]==="visible")},dF=function(e){return Y2(e,"overflowY")},fF=function(e){return Y2(e,"overflowX")},R1=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=X2(e,r);if(o){var i=Q2(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},pF=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},hF=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},X2=function(e,t){return e==="v"?dF(t):fF(t)},Q2=function(e,t){return e==="v"?pF(t):hF(t)},mF=function(e,t){return e==="h"&&t==="rtl"?-1:1},gF=function(e,t,n,r,o){var i=mF(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,d=t.contains(l),f=!1,p=a>0,h=0,g=0;do{if(!l)break;var y=Q2(e,l),k=y[0],w=y[1],b=y[2],j=w-b-i*k;(k||j)&&X2(e,l)&&(h+=j,g+=k);var N=l.parentNode;l=N&&N.nodeType===Node.DOCUMENT_FRAGMENT_NODE?N.host:N}while(!d&&l!==document.body||d&&(t.contains(l)||t===l));return(p&&Math.abs(h)<1||!p&&Math.abs(g)<1)&&(f=!0),f},Zf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},A1=function(e){return[e.deltaX,e.deltaY]},P1=function(e){return e&&"current"in e?e.current:e},xF=function(e,t){return e[0]===t[0]&&e[1]===t[1]},yF=function(e){return`
|
|
574
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
575
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
576
|
+
`)},bF=0,il=[];function vF(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(bF++)[0],i=m.useState(G2)[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 w=B5([e.lockRef.current],(e.shards||[]).map(P1),!0).filter(Boolean);return w.forEach(function(b){return b.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),w.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(w,b){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!a.current.allowPinchZoom;var j=Zf(w),N=n.current,S="deltaX"in w?w.deltaX:N[0]-j[0],C="deltaY"in w?w.deltaY:N[1]-j[1],I,T=w.target,R=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in w&&R==="h"&&T.type==="range")return!1;var D=window.getSelection(),_=D&&D.anchorNode,B=_?_===T||_.contains(T):!1;if(B)return!1;var $=R1(R,T);if(!$)return!0;if($?I=R:(I=R==="v"?"h":"v",$=R1(R,T)),!$)return!1;if(!r.current&&"changedTouches"in w&&(S||C)&&(r.current=I),!I)return!0;var O=r.current||I;return gF(O,b,w,O==="h"?S:C)},[]),d=m.useCallback(function(w){var b=w;if(!(!il.length||il[il.length-1]!==i)){var j="deltaY"in b?A1(b):Zf(b),N=t.current.filter(function(I){return I.name===b.type&&(I.target===b.target||b.target===I.shadowParent)&&xF(I.delta,j)})[0];if(N&&N.should){b.cancelable&&b.preventDefault();return}if(!N){var S=(a.current.shards||[]).map(P1).filter(Boolean).filter(function(I){return I.contains(b.target)}),C=S.length>0?l(b,S[0]):!a.current.noIsolation;C&&b.cancelable&&b.preventDefault()}}},[]),f=m.useCallback(function(w,b,j,N){var S={name:w,delta:b,target:j,should:N,shadowParent:wF(j)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),p=m.useCallback(function(w){n.current=Zf(w),r.current=void 0},[]),h=m.useCallback(function(w){f(w.type,A1(w),w.target,l(w,e.lockRef.current))},[]),g=m.useCallback(function(w){f(w.type,Zf(w),w.target,l(w,e.lockRef.current))},[]);m.useEffect(function(){return il.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",d,ol),document.addEventListener("touchmove",d,ol),document.addEventListener("touchstart",p,ol),function(){il=il.filter(function(w){return w!==i}),document.removeEventListener("wheel",d,ol),document.removeEventListener("touchmove",d,ol),document.removeEventListener("touchstart",p,ol)}},[]);var y=e.removeScrollBar,k=e.inert;return m.createElement(m.Fragment,null,k?m.createElement(i,{styles:yF(o)}):null,y?m.createElement(cF,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wF(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const jF=X5(K2,vF);var J2=m.forwardRef(function(e,t){return m.createElement(rm,Bs({},e,{ref:t,sideCar:jF}))});J2.classNames=rm.classNames;var kF=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},al=new WeakMap,ep=new WeakMap,tp={},Qx=0,Z2=function(e){return e&&(e.host||Z2(e.parentNode))},SF=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Z2(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})},NF=function(e,t,n,r){var o=SF(t,Array.isArray(e)?e:[e]);tp[n]||(tp[n]=new WeakMap);var i=tp[n],a=[],l=new Set,d=new Set(o),f=function(h){!h||l.has(h)||(l.add(h),f(h.parentNode))};o.forEach(f);var p=function(h){!h||d.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",w=(al.get(g)||0)+1,b=(i.get(g)||0)+1;al.set(g,w),i.set(g,b),a.push(g),w===1&&k&&ep.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(),Qx++,function(){a.forEach(function(h){var g=al.get(h)-1,y=i.get(h)-1;al.set(h,g),i.set(h,y),g||(ep.has(h)||h.removeAttribute(r),ep.delete(h)),y||h.removeAttribute(n)}),Qx--,Qx||(al=new WeakMap,al=new WeakMap,ep=new WeakMap,tp={})}},CF=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=kF(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),NF(r,o,n,"aria-hidden")):function(){return null}};function EF(e){const t=TF(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(AF);if(d){const f=d.props.children,p=l.map(h=>h===d?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 TF(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=_F(o),l=PF(i,o.props);return o.type!==m.Fragment&&(l.ref=r?tm(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 RF=Symbol("radix.slottable");function AF(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===RF}function PF(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function _F(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 sm="Dialog",[eT,tT]=ka(sm),[DF,Ss]=eT(sm),nT=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=m.useRef(null),d=m.useRef(null),[f,p]=nm({prop:r,defaultProp:o??!1,onChange:i,caller:sm});return s.jsx(DF,{scope:t,triggerRef:l,contentRef:d,contentId:Al(),titleId:Al(),descriptionId:Al(),open:f,onOpenChange:p,onOpenToggle:m.useCallback(()=>p(h=>!h),[p]),modal:a,children:n})};nT.displayName=sm;var rT="DialogTrigger",sT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ss(rT,n),i=Jn(t,o.triggerRef);return s.jsx(jn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Yv(o.open),...r,ref:i,onClick:rn(e.onClick,o.onOpenToggle)})});sT.displayName=rT;var Kv="DialogPortal",[$F,oT]=eT(Kv,{forceMount:void 0}),iT=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Ss(Kv,t);return s.jsx($F,{scope:t,forceMount:n,children:m.Children.map(r,a=>s.jsx(Sa,{present:n||i.open,children:s.jsx(qv,{asChild:!0,container:o,children:a})}))})};iT.displayName=Kv;var rh="DialogOverlay",aT=m.forwardRef((e,t)=>{const n=oT(rh,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ss(rh,e.__scopeDialog);return i.modal?s.jsx(Sa,{present:r||i.open,children:s.jsx(MF,{...o,ref:t})}):null});aT.displayName=rh;var IF=EF("DialogOverlay.RemoveScroll"),MF=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ss(rh,n);return s.jsx(J2,{as:IF,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(jn.div,{"data-state":Yv(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ma="DialogContent",lT=m.forwardRef((e,t)=>{const n=oT(ma,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Ss(ma,e.__scopeDialog);return s.jsx(Sa,{present:r||i.open,children:i.modal?s.jsx(LF,{...o,ref:t}):s.jsx(OF,{...o,ref:t})})});lT.displayName=ma;var LF=m.forwardRef((e,t)=>{const n=Ss(ma,e.__scopeDialog),r=m.useRef(null),o=Jn(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return CF(i)},[]),s.jsx(cT,{...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())})}),OF=m.forwardRef((e,t)=>{const n=Ss(ma,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return s.jsx(cT,{...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 d,f;(d=e.onInteractOutside)==null||d.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()}})}),cT=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=Ss(ma,n),d=m.useRef(null),f=Jn(t,d);return z5(),s.jsxs(s.Fragment,{children:[s.jsx(H2,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:s.jsx(Wv,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Yv(l.open),...a,ref:f,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(zF,{titleId:l.titleId}),s.jsx(UF,{contentRef:d,descriptionId:l.descriptionId})]})]})}),Gv="DialogTitle",uT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ss(Gv,n);return s.jsx(jn.h2,{id:o.titleId,...r,ref:t})});uT.displayName=Gv;var dT="DialogDescription",fT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ss(dT,n);return s.jsx(jn.p,{id:o.descriptionId,...r,ref:t})});fT.displayName=dT;var pT="DialogClose",hT=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ss(pT,n);return s.jsx(jn.button,{type:"button",...r,ref:t,onClick:rn(e.onClick,()=>o.onOpenChange(!1))})});hT.displayName=pT;function Yv(e){return e?"open":"closed"}var mT="DialogTitleWarning",[FF,gT]=i5(mT,{contentName:ma,titleName:Gv,docsSlug:"dialog"}),zF=({titleId:e})=>{const t=gT(mT),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},BF="DialogDescriptionWarning",UF=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gT(BF).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},xT=nT,yT=sT,bT=iT,Xv=aT,Qv=lT,Jv=uT,Zv=fT,ew=hT;const Bn=xT,HF=yT,VF=bT,WF=ew,vT=m.forwardRef(({className:e,...t},n)=>s.jsx(Xv,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));vT.displayName=Xv.displayName;const _n=m.forwardRef(({className:e,children:t,...n},r)=>s.jsxs(VF,{children:[s.jsx(vT,{}),s.jsx(Qv,{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})]}));_n.displayName=Qv.displayName;function sr({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function zr({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const Dn=m.forwardRef(({className:e,...t},n)=>s.jsx(Jv,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));Dn.displayName=Jv.displayName;const es=m.forwardRef(({className:e,...t},n)=>s.jsx(Zv,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));es.displayName=Zv.displayName;const qF=-1,KF=-40;function Jx(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 d=!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(KF,i*qF)),o=r,i=0,r++,d=!0;break}else i++,r++;if(!d)return-1/0}return n}const _1={page:0,project:1,assignment:2,playbook:3,server:4,todo:5};function tw(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=Jx(r,a.title.toLowerCase())*1,d=a.subtitle?Jx(r,a.subtitle.toLowerCase())*.5:-1/0,f=(h=a.keywords)!=null&&h.length?Jx(r,a.keywords.join(" ").toLowerCase())*.3:-1/0,p=Math.max(l,d,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:(_1[a.type]??99)-(_1[l.type]??99)),i.slice(0,n)}const GF={a:"assignment",p:"project",t:"todo",s:"server",pb:"playbook"},D1=Symbol("absent");function np(e){return e.replace(/\s+/g," ").trim()}const $1=new Set(["IDENT","STRING","NUMBER","DATE","DURATION"]);function YF(e){const t=e.externalIds;return Array.isArray(t)?t.map(n=>n&&typeof n=="object"?`${n.system}:${n.id}`:"").join(" "):""}function XF(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 Ku={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:D1},type:{kind:"enum",get:e=>e.assignmentType},project:{kind:"string",noneSentinel:!0,get:e=>"project"in e?e.project:D1},externalid:{kind:"substring",get:YF},jira:{kind:"substring",get:XF},title:{kind:"substring"},search:{kind:"substring",get:e=>e.searchText??e.title}};function QF(e,t=GF,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=ZF(a,t),d={aqlExpr:l.aqlExpr,fuzzy:l.fuzzy};if(r!=="all"&&!i&&e.trim()!==""&&!JF(l.aqlExpr)){const f=`kind:${r}`;d.aqlExpr=l.aqlExpr?l.explicit?`${f} (${l.aqlExpr})`:`${f} ${l.aqlExpr}`:f}return d}function JF(e){if(!e)return!1;let t;try{t=Zh(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 ZF(e,t){let n;try{n=Zh(e)}catch(h){if(h instanceof ta)return{aqlExpr:"",fuzzy:np(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=np(n6(e,n,r,t));return Wl(h,Ku).query?{aqlExpr:h,fuzzy:"",explicit:!0}:{aqlExpr:"",fuzzy:np(e),explicit:!0}}const a=[],l=[];let d=0,f=0;const p=h=>{if(h>f){const g=np(o(f,h));g&&l.push(g)}};for(;d<r-1;){const h=e6(n,d,t);if(h){p(d),a.push(h.atom),d=h.end,f=d;continue}const g=t6(n,d,r);if(g!==null){const y=o(d,g).trim();if(Wl(y,Ku).query){p(d),a.push(y),d=g,f=d;continue}d=g;continue}d++}return p(r-1),{aqlExpr:a.join(" "),fuzzy:l.join(" "),explicit:!1}}function e6(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 t6(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(Ku,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 d=r+2;d<n;d++)if(e[d].type==="LPAREN")l++;else if(e[d].type==="RPAREN"){if(l--,l===0)return d+1}else if(e[d].type==="EOF")return null;return null}return $1.has(a.type)?r+3:null}if(i.type==="OP"){const a=e[r+2];return a&&$1.has(a.type)?r+3:null}return null}function n6(e,t,n,r){var a;let o="",i=0;for(let l=0;l<n;l++){const d=t[l];d.type==="IDENT"&&Object.prototype.hasOwnProperty.call(r,d.text.toLowerCase())&&((a=t[l+1])==null?void 0:a.type)==="COLON"&&(o+=e.slice(i,d.pos)+`kind:${r[d.text.toLowerCase()]} `,i=t[l+1].pos+1)}return o+=e.slice(i),o}const nw=["kanban","list","table"],wT=["title","status","priority","assignee","dependencies","created","updated"],r6=["asc","desc"],s6=["comfortable","compact"],o6=["none","status","type","priority","assignee","project"],i6=["last_24h","last_7d","last_30d","last_90d","older_7d","older_30d"];function We(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 a6(e,t){const n=We(e),r=We(t);return n.length===r.length&&n.every(o=>r.includes(o))}const l6={defaultView:"kanban",sortField:"updated",sortDirection:"desc",density:"comfortable",grouping:"none",filters:{status:"all",type:"all",priority:"all",assignee:"all",project:"all",activity:"all"}},Gu={version:1,global:l6,projects:{}};function Zx(e){return e==="table"?"table":"kanban"}function c6(e,t){return t?{...e,...t}:{...e}}function jT(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:c6(n.filters,r.filters)}:n}const u6=/^[A-Za-z_][A-Za-z0-9_-]*$/,d6=new Set(["and","or","not"]);function rw(e){return u6.test(e)&&!d6.has(e.toLowerCase())?e:kT(e)}function kT(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}const ST="__unassigned__",NT="__standalone__",f6={last_24h:"24h",last_7d:"7d",last_30d:"30d",last_90d:"90d",older_7d:"7d",older_30d:"30d"};function p6(e){return e.startsWith("older_")?"<":">="}const sw=["status","type","priority","assignee","project","tags"],h6=["created","updated"];function m6(e){var i;const t={};for(const a of sw){const l=We(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=g6(o);if(a)r||(r=a);else{const l=x6(o);l&&(t.dateRange=l)}}return r&&(t.activity=r),t}function g6(e){return e.field!=="updated"||!e.preset?null:e.preset==="older_7d"?"stale":e.preset==="last_7d"?"fresh":null}function x6(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 Pu(e){const t=m6(e),n=[];for(const r of sw){const o=t[r]??[];o.length&&n.push(y6(r,o))}return t.search&&n.push(`search:${kT(t.search)}`),t.activity==="stale"?n.push("updated < -7d"):t.activity==="fresh"&&n.push("updated >= -7d"),t.dateRange&&n.push(...v6(t.dateRange)),n.join(" AND ")}function y6(e,t){const n=t.map(r=>b6(e,r));return n.length===1?`${e}:${n[0]}`:`${e}:(${n.join(", ")})`}function b6(e,t){return e==="assignee"&&t===ST||e==="project"&&t===NT?"none":rw(t)}function v6(e){if(e.preset)return[`${e.field} ${p6(e.preset)} -${f6[e.preset]}`];const t=[];return e.from&&t.push(`${e.field} >= ${e.from}`),e.to&&t.push(`${e.field} <= ${e.to}`),t}function _u(e){const t=em(e);if(!t.ast)return null;const n=w6(t.ast);if(n===null)return null;const r={},o=new Set,i=new Map;for(const a of n){const l=j6(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 d=`date:${l.field}`;if(o.has(d)||i.has(l.field))return null;o.add(d),r.dateRange={field:l.field,preset:l.preset};break}case"dateBound":{const d=`date:${l.field}`;if(o.has(d))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 d={field:a};l.from!==void 0&&(d.from=l.from),l.to!==void 0&&(d.to=l.to),r.dateRange=d}return r}function w6(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 j6(e){const t=e.field.toLowerCase();if(e.op===":"){if(sw.includes(t)){const o=t,i=[];for(const a of e.values){const l=E6(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(!h6.includes(t))return null;const n=t;if(e.values.length!==1)return null;const r=e.values[0];return r.type==="duration"?k6(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 k6(e,t,n){if(n.sign!==-1)return null;const r=S6(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=C6(t,r);return o?{kind:"datePreset",field:e,preset:o}:null}function S6(e){return e.replace(/^[-+]/,"")}const N6={">=":{"24h":"last_24h","7d":"last_7d","30d":"last_30d","90d":"last_90d"},"<":{"7d":"older_7d","30d":"older_30d"}};function C6(e,t){return e!==">="&&e!=="<"?null:N6[e][t]??null}function E6(e,t){const n=t.raw;return e==="assignee"&&n.toLowerCase()==="none"?ST:e==="project"&&n.toLowerCase()==="none"?NT:n}const T6=new Set(["status","type","tag","assignee","externalid"]),ey=new Set(["IDENT","STRING","NUMBER","DATE","DURATION","STAR"]),I1=8;function R6(e,t,n){var k,w,b,j,N;let r;try{r=Zh(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 d=null,f=null,p="";if(a>=0&&r[a].type==="COLON"&&((k=r[a-1])==null?void 0:k.type)==="IDENT"?(d=r[a-1].text.toLowerCase(),f=[t,t]):a>=0&&ey.has(r[a].type)&&((w=r[a-1])==null?void 0:w.type)==="COLON"&&((b=r[a-2])==null?void 0:b.type)==="IDENT"?(d=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"&&(d=r[l-1].text.toLowerCase(),f=[t,t]),d!==null){if(!T6.has(d))return[];const S=n.values[d]??[],C=p.toLowerCase(),I=[];for(const T of S)if(!(C&&!T.toLowerCase().startsWith(C))&&T.toLowerCase()!==C&&(I.push({label:T,insert:rw(T),replace:f,kind:"value"}),I.length>=I1))break;return I}if(a>=0&&!ey.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"||ey.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,I1)}const $p={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 A6(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 d=l.when==="*"?null:n(l.when);d&&r.push(`phaseLadder rung "${l.phase}": invalid condition — ${d}`)}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 d=n(l.when);d&&r.push(`disposition rule "${l.is}": invalid condition — ${d}`)}const a=e.disposition.map((l,d)=>l.when===null?d:-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 CT={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:$p,deriveCustom:!1,knownCommands:[],factDeclarations:[],rawFacts:[]};let Du=null,Yi=null;function P6(){return Du?Promise.resolve(Du):Yi||(Yi=fetch("/api/config/statuses").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Du=e,Yi=null,e)).catch(()=>(Yi=null,CT)),Yi)}function Ns(){const[e,t]=m.useState(()=>Du??CT);return m.useEffect(()=>{P6().then(t)},[]),e}function M1(){Du=null,Yi=null}function xi(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 ET={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 Ip=null,ll=null;function _6(){return Ip?Promise.resolve(Ip):ll||(ll=fetch("/api/config/types").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>(Ip=e,ll=null,e)).catch(()=>(ll=null,ET)),ll)}function Td(){const[e,t]=m.useState(()=>Ip??ET);return m.useEffect(()=>{_6().then(t)},[]),e}function _l(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 D6(e,t){return t?e.definitions.find(n=>n.id===t)??null:null}const $6={page:"Page",project:"Project",assignment:"Assignment",playbook:"Playbook",server:"Server",todo:"Todo"};function I6({entries:e}){const{paletteOpen:t,closePalette:n}=ki(),r=Vt(),[o,i]=m.useState(""),[a,l]=m.useState(0),[d,f]=m.useState(0),[p,h]=m.useState(!0),[g,y]=m.useState(0),k=m.useRef(null),w=m.useRef(null),{search:b}=Vv(),j=Ns(),N=Td(),{aqlExpr:S,fuzzy:C}=m.useMemo(()=>QF(o,b.aliases,{defaultScope:b.defaultScope}),[o,b.aliases,b.defaultScope]),I=m.useMemo(()=>{const O=new Set,z=new Set,A=new Set;for(const U of e){for(const H of U.tags??[])O.add(H);U.assignee&&z.add(U.assignee);for(const H of U.externalIds??[])H.id&&(A.add(H.id),H.system&&A.add(`${H.system}:${H.id}`))}const F=Object.keys(Ku);return{aliases:b.aliases,fields:b.externalIds?F:F.filter(U=>U!=="jira"&&U!=="externalid"),values:{status:j.statuses.map(U=>U.id),type:N.definitions.map(U=>U.id),tag:[...O],assignee:[...z],externalid:b.externalIds?[...A]:[]}}},[e,b.aliases,b.externalIds,j.statuses,N.definitions]),T=m.useMemo(()=>R6(o,d,I),[o,d,I]),R=p&&T.length>0&&o.trim()!=="",D=m.useMemo(()=>{let O=e,z=C;if(S){const A=Wl(S,Ku);if(A.query){const F=Date.now(),{predicate:U}=A.query;O=e.filter(H=>U(H,{now:F}))}else z=o}return tw(z,O,50)},[e,S,C,o]);m.useEffect(()=>{l(0)},[o,t]),m.useEffect(()=>{y(0)},[T]),m.useEffect(()=>{t||(i(""),f(0),h(!0))},[t]),m.useEffect(()=>{var z;const O=(z=k.current)==null?void 0:z.querySelector(`[data-palette-idx="${a}"]`);O==null||O.scrollIntoView({block:"nearest"})},[a]);function _(O){r(O.route),n()}function B(O){const z=o.slice(0,O.replace[0])+O.insert+o.slice(O.replace[1]),A=O.replace[0]+O.insert.length;i(z),f(A),requestAnimationFrame(()=>{const F=w.current;F&&(F.focus(),F.setSelectionRange(A,A))})}function $(O){if(R){if(O.key==="Tab"||O.key==="ArrowRight"&&d>=o.length){O.preventDefault();const z=T[g];z&&B(z);return}if(O.key==="ArrowDown"){O.preventDefault(),y(z=>Math.min(T.length-1,z+1));return}if(O.key==="ArrowUp"){O.preventDefault(),y(z=>Math.max(0,z-1));return}if(O.key==="Enter"){O.preventDefault();const z=D[a];z&&_(z);return}return}if(O.key==="ArrowDown")O.preventDefault(),l(z=>Math.min(D.length-1,z+1));else if(O.key==="ArrowUp")O.preventDefault(),l(z=>Math.max(0,z-1));else if(O.key==="Enter"){O.preventDefault();const z=D[a];z&&_(z)}}return s.jsx(Bn,{open:t,onOpenChange:O=>O?null:n(),children:s.jsxs(_n,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:O=>{R&&(O.preventDefault(),h(!1))},children:[s.jsx(Dn,{className:"sr-only",children:"Command palette"}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{ref:w,autoFocus:!0,type:"text",value:o,onChange:O=>{i(O.target.value),f(O.target.selectionStart??O.target.value.length),h(!0)},onSelect:O=>f(O.currentTarget.selectionStart??0),onKeyDown:$,placeholder:"Search… try a: p: jira:PROJ-123 tag:backend",className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0"}),R?s.jsx("div",{className:"absolute left-0 right-0 top-full z-50 max-h-64 overflow-y-auto border-b border-border/70 bg-background shadow-lg",children:T.map((O,z)=>{const A=z===g;return s.jsxs("button",{type:"button",onMouseDown:F=>{F.preventDefault(),B(O)},onMouseEnter:()=>y(z),className:`flex w-full items-center justify-between gap-3 px-4 py-1.5 text-left text-sm ${A?"bg-accent text-accent-foreground":"text-foreground"}`,children:[s.jsx("code",{className:"truncate",children:O.label}),s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:O.kind})]},`${O.kind}-${O.insert}-${z}`)})}):null]}),S?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:S}),C?s.jsxs("span",{children:[" · ranking “",C,"”"]}):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(b.aliases).map(O=>s.jsxs("code",{className:"mr-1",children:[O,":"]},O))," · ",s.jsx("code",{children:"status:"})," ",s.jsx("code",{children:"tag:"})," ",s.jsx("code",{children:"assignee:"})," ",s.jsx("code",{children:"type:"})," ",b.externalIds?s.jsx("code",{children:"jira:"}):null]}):null,s.jsx("div",{ref:k,className:"max-h-[60vh] overflow-y-auto p-1",children:D.length===0?s.jsx("div",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No matches"}):D.map((O,z)=>{const A=z===a;return s.jsxs("button",{type:"button","data-palette-idx":z,onClick:()=>_(O),onMouseEnter:()=>l(z),className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors ${A?"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:$6[O.type]??O.type}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.title}),O.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:O.subtitle}):null]},O.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.jsx("span",{children:R?"⇥/→ accept · ↑↓ suggestions · Esc close":"↑↓ navigate · ↵ open · Esc close"}),s.jsxs("span",{children:[D.length," result",D.length===1?"":"s"]})]})]})})}function M6({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(kL,{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 L6({step:e,initialValue:t,disabled:n,onSubmit:r}){const[o,i]=m.useState(t??""),[a,l]=m.useState(!1),d=m.useRef(null);m.useEffect(()=>{var k;(k=d.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:d,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:ring-0 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 O6({step:e,disabled:t,onSubmit:n}){const[r,o]=m.useState({phase:"loading"}),[i,a]=m.useState(""),[l,d]=m.useState(0),[f,p]=m.useState(0),h=m.useRef(null),g=m.useRef(null);m.useEffect(()=>{var w;(w=h.current)==null||w.focus()},[]),m.useEffect(()=>{let w=!1;return o({phase:"loading"}),Promise.resolve().then(()=>e.loadOptions()).then(b=>{w||o({phase:"loaded",options:b})}).catch(b=>{if(w)return;const j=b instanceof Error?b.message:"Failed to load options";o({phase:"error",message:j})}),()=>{w=!0}},[e,f]);const y=m.useMemo(()=>{if(r.phase!=="loaded")return[];const w=r.options.map(b=>({type:"option",title:b.label,subtitle:b.hint,keywords:[b.value],option:b}));return tw(i,w,100)},[r,i]);m.useEffect(()=>{d(0)},[y.length]),m.useEffect(()=>{var b;const w=(b=g.current)==null?void 0:b.querySelector(`[data-picker-idx="${l}"]`);w==null||w.scrollIntoView({block:"nearest"})},[l]);function k(w){if(r.phase==="loaded"){if(w.key==="ArrowDown")w.preventDefault(),d(b=>Math.min(y.length-1,b+1));else if(w.key==="ArrowUp")w.preventDefault(),d(b=>Math.max(0,b-1));else if(w.key==="Enter"){w.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:w=>a(w.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:ring-0 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(w=>w+1),className:"rounded border border-border/70 bg-background/60 px-2 py-1 text-xs text-foreground hover:bg-accent/40",children:"Retry"})]}):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((w,b)=>{const j=b===l;return s.jsxs("button",{type:"button","data-picker-idx":b,onClick:()=>n(w.option.value),onMouseEnter:()=>d(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:w.option.label}),w.option.hint?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:w.option.hint}):null]},w.option.value)})})]})}function F6({entries:e}){var J,ne;const t=Vt(),{actionsPaletteOpen:n,closeActionsPalette:r,customBindings:o,bindAction:i,findConflict:a,pendingActionKind:l,consumePendingActionKind:d}=ki(),[f,p]=m.useState(""),[h,g]=m.useState(0),[y,k]=m.useState(null),[w,b]=m.useState(""),[j,N]=m.useState(null),[S,C]=m.useState(null),[I,T]=m.useState(!1),[R,D]=m.useState(null),_=m.useRef(null),B=m.useMemo(()=>e.map(Q=>({type:Q.group.toLowerCase(),title:Q.title,subtitle:Q.subtitle,keywords:Q.keywords,action:Q})),[e]),$=m.useMemo(()=>tw(f,B,50),[f,B]);m.useEffect(()=>{g(0)},[f,n]),m.useEffect(()=>{n||(p(""),k(null),b(""),N(null),C(null),T(!1),D(null))},[n]),m.useEffect(()=>{if(!n||!l)return;const Q=d();if(!Q)return;const le=e.find(te=>te.bindableKind===Q);le&&O(le)},[n,l]),m.useEffect(()=>{var le;const Q=(le=_.current)==null?void 0:le.querySelector(`[data-palette-idx="${h}"]`);Q==null||Q.scrollIntoView({block:"nearest"})},[h]);async function O(Q){if(!I){if(Q.flow&&Q.flow.steps.length>0){N({action:Q,stepIndex:0,values:{}}),D(null);return}if(Q.requiresInput){k(Q),b(""),D(null);return}if(Q.run){T(!0),D(null);try{await Q.run(),r()}catch(le){D(le instanceof Error?le.message:"Action failed")}finally{T(!1)}}}}async function z(Q){if(!j)return;const le=j.action.flow.steps[j.stepIndex],te={...j.values,[le.id]:Q};if(j.stepIndex+1<j.action.flow.steps.length){N({action:j.action,stepIndex:j.stepIndex+1,values:te});return}T(!0),D(null);try{await j.action.flow.submit(te,{navigate:t}),r()}catch(pe){D(pe instanceof Error?pe.message:"Action failed")}finally{T(!1)}}function A(){if(j&&!I){if(j.stepIndex===0){N(null),D(null);return}N({action:j.action,stepIndex:j.stepIndex-1,values:j.values}),D(null)}}async function F(){if(I||!(y!=null&&y.requiresInput))return;const Q=w.trim();if(Q){T(!0),D(null);try{await y.requiresInput.runWithInput(Q),r()}catch(le){D(le instanceof Error?le.message:"Action failed")}finally{T(!1)}}}function U(Q){if(Q.key==="ArrowDown")Q.preventDefault(),g(le=>Math.min($.length-1,le+1));else if(Q.key==="ArrowUp")Q.preventDefault(),g(le=>Math.max(0,le-1));else if(Q.key==="Enter"&&(Q.metaKey||Q.ctrlKey)){Q.preventDefault();const le=$[h];le!=null&&le.action.bindableKind&&C({action:le.action,combo:null,conflict:null,saving:!1,error:null})}else if(Q.key==="Enter"){Q.preventDefault();const le=$[h];le&&O(le.action)}}function H(Q){Q.key==="Enter"?(Q.preventDefault(),F()):Q.key==="Escape"&&(Q.preventDefault(),k(null),b(""))}function L(Q){if(!S||Q.key==="Escape"||Q.key==="Enter"&&!S.combo)return;if(Q.key==="Enter"&&S.combo){Q.preventDefault(),Q.stopPropagation(),V();return}Q.preventDefault(),Q.stopPropagation();const le=E2(Q.nativeEvent);if(!le)return;const te=a(le,S.action.bindableKind);C({...S,combo:le,conflict:te,error:null})}async function V(){var Q;if(!(!S||!S.combo||!S.action.bindableKind)){if((Q=S.conflict)!=null&&Q.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(le){C({...S,saving:!1,error:le instanceof Error?le.message:"Failed to save binding"})}}}const M=y!==null,W=j!==null,Y=S!==null,q=j?j.action.flow.steps[j.stepIndex]:null;return s.jsx(Bn,{open:n,onOpenChange:Q=>Q?null:r(),children:s.jsxs(_n,{className:"max-w-xl p-0 gap-0",onEscapeKeyDown:Q=>{if(!I){if(Y){Q.preventDefault(),C(null);return}if(W){Q.preventDefault(),A();return}M&&(Q.preventDefault(),k(null),b(""),D(null))}},children:[s.jsx(Dn,{className:"sr-only",children:"Actions palette"}),Y&&S?s.jsxs("div",{onKeyDown:L,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(lb,{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:qs(S.combo)}),(J=S.conflict)!=null&&J.description?s.jsxs("div",{className:"text-sm text-destructive",children:["Reserved: ",S.conflict.description," (cannot bind)"]}):(ne=S.conflict)!=null&&ne.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 V(),"data-bind-confirm":!0}),s.jsx("input",{type:"hidden",onKeyDown:Q=>{Q.key==="Enter"&&V()}})]}):W&&q&&j?s.jsxs(s.Fragment,{children:[s.jsx(M6,{label:`${j.action.title} · ${q.label}`,onBack:A,disabled:I,stepCounter:{current:j.stepIndex+1,total:j.action.flow.steps.length}}),q.kind==="text"?s.jsx(L6,{step:q,initialValue:j.values[q.id],disabled:I,onSubmit:z}):s.jsx(O6,{step:q,disabled:I,onSubmit:z}),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:I?"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:w,onChange:Q=>b(Q.target.value),onKeyDown:H,placeholder:y.requiresInput.placeholder,disabled:I,className:"w-full border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),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:I?"Running…":""})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("input",{autoFocus:!0,type:"text",value:f,onChange:Q=>p(Q.target.value),onKeyDown:U,placeholder:"Run an action: new project, new todo, toggle…",disabled:I,className:"w-full rounded-t-xl border-0 border-b border-border/70 bg-transparent px-4 py-3 text-sm text-foreground outline-none focus:ring-0 disabled:opacity-60"}),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:$.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"}):$.map((Q,le)=>{const te=le===h,pe=Q.action.bindableKind,be=pe?o[pe]:void 0;return s.jsxs("button",{type:"button","data-palette-idx":le,onClick:()=>O(Q.action),onMouseEnter:()=>g(le),disabled:I,className:`group flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors disabled:opacity-60 ${te?"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:Q.action.group}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:Q.action.title}),Q.action.subtitle?s.jsx("span",{className:"shrink-0 truncate text-xs text-muted-foreground",children:Q.action.subtitle}):null,be?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:qs(be)}):null,pe?s.jsx("span",{role:"button",tabIndex:-1,"aria-label":"Bind hotkey",onClick:Ee=>{Ee.preventDefault(),Ee.stopPropagation(),C({action:Q.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 ${te?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:s.jsx(lb,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):null]},Q.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:I?"Running…":`${$.length} action${$.length===1?"":"s"}`})]})]})]})})}const z6=[{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 B6(e){const t=gr(e);return t?z6.find(n=>n.combo===t)??null:null}const uu={"new-workspace":"New Workspace","new-project":"New Project","new-todo":"New Todo","new-assignment":"New Assignment"},U6={global:"Global","list:overview":"Overview","list:projects":"Projects list","list:assignments":"Assignments list","list:todos":"Todos list",assignment:"Assignment detail",project:"Project detail"},H6=["global","list:overview","list:projects","list:assignments","list:todos","project","assignment"];function L1(e){if(e.includes(" ")){const[t,n]=e.split(" ");return`${qs(t)} then ${qs(n)}`}return qs(e)}function V6(){const{cheatsheetOpen:e,closeCheatsheet:t,listBindings:n,customBindings:r,actionEntries:o}=ki(),i=m.useMemo(()=>{const d=new Set;for(const f of Object.values(r))typeof f=="string"&&f&&d.add(gr(f));return d},[r]),a=m.useMemo(()=>{if(!e)return new Map;const d=n(),f=new Map;for(const p of d){if(i.has(gr(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 d=[];for(const[f,p]of Object.entries(r)){if(!p)continue;const h=o.find(g=>g.bindableKind===f);d.push({kind:f,combo:p,title:h?h.title:f})}return d},[r,o]);return s.jsx(Bn,{open:e,onOpenChange:d=>d?null:t(),children:s.jsxs(_n,{className:"max-w-2xl",children:[s.jsx(Dn,{children:"Keyboard shortcuts"}),s.jsxs(es,{children:["Press Esc to close. ",qs("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:[H6.map(d=>{const f=a.get(d);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:U6[d]}),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:L1(p.keys)})]},`${d}-${p.keys}-${h}`))})]},d)}),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(d=>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:d.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:L1(d.combo)})]},`custom-${d.kind}`))})]}):null]})]})})}const ow={bindings:{},custom:!1};let $u=null,cl=null;const yb=new Set;function TT(e){$u=e;for(const t of yb)t(e)}function iw(e){if(!e||typeof e!="object")return ow;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(!kO(r)||typeof o!="string"||o.trim()==="")continue;const i=gr(o);i&&(n[r]=i)}return{bindings:n,custom:t.custom===!0}}function W6(){return $u?Promise.resolve($u):cl||(cl=fetch("/api/config/hotkeys").then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}).then(e=>{const t=iw(e);return $u=t,cl=null,t}).catch(()=>(cl=null,ow)),cl)}function q6(){const[e,t]=m.useState(()=>$u??ow);return m.useEffect(()=>{let n=!1;return W6().then(r=>{n||t(r)}),yb.add(t),()=>{n=!0,yb.delete(t)}},[]),e}async function O1(e){const t={};for(const o of Xh){const i=e[o];if(typeof i!="string")continue;const a=gr(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=iw(await n.json());return TT(r),r}async function K6(){const e=await fetch("/api/config/hotkeys",{method:"DELETE"});if(!e.ok)throw new Error(`HTTP ${e.status}`);const t=iw(await e.json());return TT(t),t}const F1=1500;function G6(e){const t=e.match(/^\/w\/([^/]+)(?:\/|$)/);return t?`/w/${t[1]}`:""}const RT=m.createContext(null);function Y6({children:e}){const{toggleTheme:t}=Iv(),n=rr(),r=Vt(),o=G6(n.pathname),[i,a]=m.useState(!1),l=Qs(i),d=Gh(i),f=Lv(i),p=Mv(i),h=T2(i),{search:g}=Vv(),y=m.useMemo(()=>{var nt,wt,it,st;const je=l.data??[],Se=((nt=d.data)==null?void 0:nt.assignments)??[],De=((wt=f.data)==null?void 0:wt.playbooks)??[],ze=((it=p.data)==null?void 0:it.sessions)??[],Oe=(((st=h.data)==null?void 0:st.workspaces)??[]).flatMap(ce=>ce.items.map(ee=>({...ee,workspace:ce.workspace})));return VO({projects:je,assignments:Se,playbooks:De,servers:ze,todos:Oe,wsPrefix:o,externalIds:g.externalIds})},[l.data,d.data,f.data,p.data,h.data,o,g.externalIds]),w=m.useMemo(()=>u2(n.pathname),[n.pathname]).projectSlug,b=m.useMemo(()=>{var je;return w?((je=l.data)==null?void 0:je.find(Se=>Se.slug===w))??null:null},[l.data,w]),j=(b==null?void 0:b.title)??null,N=(b==null?void 0:b.workspace)??null,S=m.useMemo(()=>{var je;return KO({playbooks:((je=f.data)==null?void 0:je.playbooks)??[],projectSlug:w,currentProjectTitle:j,currentProjectWorkspace:N,wsPrefix:o,refetchPlaybooks:f.refetch,navigate:r,toggleTheme:t})},[f.data,f.refetch,w,j,N,o,r,t]),C=m.useRef(new Map),I=m.useRef(["global"]),T=m.useRef({phase:"idle"}),R=m.useRef(null),D=m.useRef(1),[_,B]=m.useState(!1),[$,O]=m.useState(!1),[z,A]=m.useState(!1),[F,U]=m.useState(null);m.useEffect(()=>{(_||z)&&a(!0)},[_,z]);const{bindings:H}=q6(),L=m.useMemo(()=>TO(H),[H]),V=m.useCallback(je=>{const Se=D.current++;return C.current.set(Se,{...je,id:Se}),Se},[]),M=m.useCallback(je=>{C.current.delete(je)},[]),W=m.useCallback(je=>{I.current.push(je)},[]),Y=m.useCallback(je=>{const Se=I.current;for(let De=Se.length-1;De>=0;De--)if(Se[De]===je){Se.splice(De,1);return}},[]),q=m.useCallback(()=>B(!0),[]),J=m.useCallback(()=>B(!1),[]),ne=m.useCallback(()=>O(!0),[]),Q=m.useCallback(()=>O(!1),[]),le=m.useCallback(()=>A(!0),[]),te=m.useCallback(()=>{A(!1),U(null)},[]),pe=m.useCallback(()=>Array.from(C.current.values()),[]),be=m.useCallback(()=>{let je=null;return U(Se=>(je=Se,null)),je},[]),Ee=m.useCallback(je=>{U(je),A(!0)},[]),Te=m.useCallback((je,Se)=>{const De=gr(je);if(!De)return null;if(CO(De)){const ze=B6(De);return{description:(ze==null?void 0:ze.description)??"Reserved built-in shortcut"}}for(const[ze,Ye]of Object.entries(L))if(!(Se&&ze===Se)&&Ye===De)return{kind:ze};return null},[L]),ke=m.useCallback(async(je,Se)=>{const De=gr(Se);if(!De)throw new Error("Empty combo");const ze=Te(De,je);if(ze){const Oe=ze.description?`Reserved: ${ze.description}`:`Already bound to "${ze.kind}"`;throw new Error(Oe)}const Ye={...H,[je]:De};return await O1(Ye),De},[H,Te]),Ue=m.useCallback(async je=>{if(!H[je])return;const Se={...H};delete Se[je],await O1(Se)},[H]);m.useEffect(()=>{T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)},[n.pathname]),m.useEffect(()=>{function je(Oe){if(!(Oe instanceof HTMLElement))return!1;const nt=Oe.tagName;return!!(nt==="INPUT"||nt==="TEXTAREA"||nt==="SELECT"||Oe.isContentEditable||Oe.closest('[role="combobox"], [role="textbox"]'))}function Se(){return!!(document.querySelector('[role="dialog"][data-state="open"]')||document.querySelector('[role="alertdialog"][data-state="open"]'))}function De(){const Oe=I.current;return Oe[Oe.length-1]??"global"}function ze(Oe){return Oe.scope==="global"?!0:Oe.scope===De()}function Ye(Oe){const nt=Xf(Oe,"Mod+k"),wt=Xf(Oe,"Mod+Shift+k"),it=Oe.key==="Escape",st=nt||wt||it;if(Se()&&!st||je(Oe.target)&&!st)return;const ce=T.current;if(ce.phase==="awaiting-second")if(Date.now()-ce.startedAt>F1)T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null);else{const ie=Array.from(C.current.values());for(const we of ie){if(!ze(we))continue;const $e=we.keys.split(" ");if(!($e.length!==2||$e[0]!=="g")&&Xf(Oe,$e[1])&&!(we.when&&!we.when())){Oe.preventDefault(),T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null),we.handler(Oe);return}}T.current={phase:"idle"},R.current!==null&&(window.clearTimeout(R.current),R.current=null)}const ee=Array.from(C.current.values());for(const xe of ee){if(!ze(xe))continue;const ie=xe.keys.split(" ");if(ie.length===1&&Xf(Oe,ie[0])&&!(xe.when&&!xe.when())){Oe.preventDefault(),xe.handler(Oe);return}}Oe.key==="g"&&!Oe.metaKey&&!Oe.ctrlKey&&!Oe.altKey&&!Oe.shiftKey&&Array.from(C.current.values()).some(ie=>ze(ie)&&ie.keys.startsWith("g "))&&(Oe.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},F1))}return window.addEventListener("keydown",Ye),()=>{window.removeEventListener("keydown",Ye),R.current!==null&&(window.clearTimeout(R.current),R.current=null)}},[]),m.useEffect(()=>{const je=V({keys:"Shift+t",handler:()=>t(),scope:"global",description:"Toggle light/dark theme"});return()=>M(je)},[V,M,t]),m.useEffect(()=>{const je=V({keys:"?",scope:"global",description:"Show keyboard shortcuts",handler:()=>ne()});return()=>M(je)},[V,M,ne]),m.useEffect(()=>{const je=V({keys:"Mod+k",scope:"global",description:"Open command palette",handler:()=>{if(_){J();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||q()}});return()=>M(je)},[V,M,q,J,_]),m.useEffect(()=>{const je=V({keys:"Mod+Shift+k",scope:"global",description:"Open actions palette",handler:()=>{if(z){te();return}document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||le()}});return()=>M(je)},[V,M,le,te,z]),m.useEffect(()=>{const Se=[{suffix:"o",basePath:"/",desc:"Go to Overview"},{suffix:"m",basePath:"/projects",desc:"Go to Projects"},{suffix:"a",basePath:"/assignments",desc:"Go to Assignments"},{suffix:"t",basePath:"/todos",desc:"Go to Todos"},{suffix:"s",basePath:"/servers",desc:"Go to Servers"},{suffix:",",basePath:"/settings",desc:"Go to Settings"}].map(De=>V({keys:`g ${De.suffix}`,scope:"global",description:De.desc,handler:()=>r(Rp(De.basePath,o))}));return()=>Se.forEach(M)},[V,M,r,o]),m.useEffect(()=>{const je=[];for(const[Se,De]of Object.entries(L)){if(!De)continue;const ze=S.find(Oe=>Oe.bindableKind===Se),Ye=ze?`Custom: ${ze.title}`:`Custom: ${Se}`;je.push(V({keys:De,scope:"global",description:Ye,handler:()=>{U(Se),A(!0)}}))}return()=>je.forEach(M)},[V,M,L,S]);const oe=m.useMemo(()=>({register:V,unregister:M,pushScope:W,popScope:Y,openPalette:q,closePalette:J,paletteOpen:_,openCheatsheet:ne,closeCheatsheet:Q,cheatsheetOpen:$,openActionsPalette:le,closeActionsPalette:te,actionsPaletteOpen:z,listBindings:pe,wsPrefix:o,paletteEntries:y,actionEntries:S,userBindings:H,customBindings:L,bindAction:ke,unbindAction:Ue,findConflict:Te,openActionsPaletteWithAction:Ee,pendingActionKind:F,consumePendingActionKind:be}),[V,M,W,Y,q,J,_,ne,Q,$,le,te,z,pe,o,y,S,H,L,ke,Ue,Te,Ee,F,be]);return s.jsxs(RT.Provider,{value:oe,children:[e,s.jsx(I6,{entries:y}),s.jsx(F6,{entries:S}),s.jsx(V6,{})]})}function ki(){const e=m.useContext(RT);if(!e)throw new Error("useHotkeyContext must be used within HotkeyProvider");return e}function Zt({keys:e,handler:t,scope:n="global",description:r,when:o,enabled:i=!0}){const{register:a,unregister:l}=ki(),d=m.useRef(t),f=m.useRef(o);m.useEffect(()=>{d.current=t,f.current=o},[t,o]),m.useEffect(()=>{if(!i)return;const p=a({keys:e,handler:h=>d.current(h),scope:n,description:r,when:f.current?()=>f.current():void 0});return()=>l(p)},[a,l,e,n,r,i])}function Si(e){const{pushScope:t,popScope:n}=ki();m.useEffect(()=>(t(e),()=>n(e)),[t,n,e])}function Rd(e,t){const[n,r]=m.useState(e.length===0?-1:0),o=rr();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 d=Number(l.getAttribute("data-hotkey-row-index"));l.setAttribute("data-hotkey-selected",d===n?"true":"false")}),n>=0){const l=document.querySelector(`[data-hotkey-row-index="${n}"]`);l==null||l.scrollIntoView({block:"nearest"})}},[n,e.length]),Zt({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))}),Zt({keys:"k",scope:t.scope,description:"Select previous row",handler:()=>r(a=>e.length===0?-1:Math.max(0,a<0?0:a-1))}),Zt({keys:"Enter",scope:t.scope,description:"Open selected row",handler:()=>{n>=0&&n<e.length&&t.onOpen(e[n],n)}}),Zt({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 X6({title:e,breadcrumbs:t,projectSlug:n,onOpenMobileNav:r}){const o=pn(),{resolvedTheme:i,toggleTheme:a}=Iv(),{openPalette:l}=ki();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(YL,{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((d,f)=>s.jsxs("span",{className:"flex items-center gap-1.5",children:[f>0?s.jsx("span",{children:"/"}):null,s.jsx(Ie,{to:d.path,className:"hover:text-foreground",children:d.label})]},d.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(ji,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline font-mono text-xs",children:qs("Mod+k")})]}),s.jsx(Ie,{className:"shell-action",to:"/help",children:"Help"}),s.jsxs(Ie,{className:"shell-action",to:`${o}/create/project`,children:[s.jsx($t,{className:"h-4 w-4"}),s.jsx("span",{children:"New Project"})]}),n?s.jsxs(Ie,{className:"shell-action",to:`${o}/projects/${n}/create/assignment`,children:[s.jsx($t,{className:"h-4 w-4"}),s.jsx("span",{children:"New Assignment"})]}):null,s.jsxs("button",{type:"button",onClick:a,className:"shell-action","aria-label":"Toggle theme",children:[i==="dark"?s.jsx(i4,{className:"h-4 w-4"}):s.jsx(XL,{className:"h-4 w-4"}),s.jsx("span",{children:i==="dark"?"Light":"Dark"})]})]})]})})}const sh="_ungrouped",Q6=256;function J6(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>Q6||/[\r\n]/.test(o)||t.has(o)||(t.add(o),n.push(o)))}return n}function Z6(e,t){if(t.length===0)return[...e];const n=new Set(t);return e.filter(r=>!n.has(r))}function ez(e,t){return t.includes(e)}const aw={hidden:[],custom:!1};let yo=null,Xi=null,Yu=0;const bb=new Set;function AT(e){yo=e;for(const t of bb)t(e)}function lw(e){if(!e||typeof e!="object")return aw;const t=e;return{hidden:J6(t.hidden),custom:t.custom===!0}}function tz(){if(yo)return Promise.resolve({value:yo,ok:!0});if(Xi)return Xi;const e=++Yu;return Xi=fetch("/api/config/workspace-visibility").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{Xi=null;const n=lw(t);return e!==Yu?{value:yo??n,ok:!0}:(yo=n,{value:n,ok:!0})}).catch(()=>(Xi=null,{value:aw,ok:!1})),Xi}function PT(){const[e,t]=m.useState(()=>yo??aw),[n,r]=m.useState(()=>yo===null),[o,i]=m.useState(!1),[a,l]=m.useState(0);m.useEffect(()=>{let f=!1;return r(yo===null),tz().then(p=>{f||(t(p.value),r(!1),i(!p.ok))}),bb.add(t),()=>{f=!0,bb.delete(t)}},[a]);function d(){nz(),l(f=>f+1)}return{...e,loading:n,error:o,reload:d}}function nz(){yo=null,Xi=null,++Yu}async function rz(e){++Yu;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=lw(await t.json());return AT(n),n}async function sz(){++Yu;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=lw(await e.json());return AT(t),t}var oz=Symbol("radix.slottable");function iz(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=oz,t}var _T="AlertDialog",[az]=ka(_T,[tT]),No=tT(),DT=e=>{const{__scopeAlertDialog:t,...n}=e,r=No(t);return s.jsx(xT,{...r,...n,modal:!0})};DT.displayName=_T;var lz="AlertDialogTrigger",cz=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=No(n);return s.jsx(yT,{...o,...r,ref:t})});cz.displayName=lz;var uz="AlertDialogPortal",$T=e=>{const{__scopeAlertDialog:t,...n}=e,r=No(t);return s.jsx(bT,{...r,...n})};$T.displayName=uz;var dz="AlertDialogOverlay",IT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=No(n);return s.jsx(Xv,{...o,...r,ref:t})});IT.displayName=dz;var Dl="AlertDialogContent",[fz,pz]=az(Dl),hz=iz("AlertDialogContent"),MT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=No(n),a=m.useRef(null),l=Jn(t,a),d=m.useRef(null);return s.jsx(FF,{contentName:Dl,titleName:LT,docsSlug:"alert-dialog",children:s.jsx(fz,{scope:n,cancelRef:d,children:s.jsxs(Qv,{role:"alertdialog",...i,...o,ref:l,onOpenAutoFocus:rn(o.onOpenAutoFocus,f=>{var p;f.preventDefault(),(p=d.current)==null||p.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[s.jsx(hz,{children:r}),s.jsx(gz,{contentRef:a})]})})})});MT.displayName=Dl;var LT="AlertDialogTitle",OT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=No(n);return s.jsx(Jv,{...o,...r,ref:t})});OT.displayName=LT;var FT="AlertDialogDescription",zT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=No(n);return s.jsx(Zv,{...o,...r,ref:t})});zT.displayName=FT;var mz="AlertDialogAction",BT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=No(n);return s.jsx(ew,{...o,...r,ref:t})});BT.displayName=mz;var UT="AlertDialogCancel",HT=m.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=pz(UT,n),i=No(n),a=Jn(t,o);return s.jsx(ew,{...i,...r,ref:a})});HT.displayName=UT;var gz=({contentRef:e})=>{const t=`\`${Dl}\` requires a description for the component to be accessible for screen reader users.
|
|
581
|
+
|
|
582
|
+
You can add a description to the \`${Dl}\` by passing a \`${FT}\` 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 \`${Dl}\`. 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},xz=DT,yz=$T,VT=IT,WT=MT,qT=BT,KT=HT,GT=OT,YT=zT;const wl=xz,bz=yz,XT=m.forwardRef(({className:e,...t},n)=>s.jsx(VT,{ref:n,className:Ne("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",e),...t}));XT.displayName=VT.displayName;const ra=m.forwardRef(({className:e,...t},n)=>s.jsxs(bz,{children:[s.jsx(XT,{}),s.jsx(WT,{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})]}));ra.displayName=WT.displayName;function jl({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col space-y-2 text-left",e),...t})}function kl({className:e,...t}){return s.jsx("div",{className:Ne("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}const sa=m.forwardRef(({className:e,...t},n)=>s.jsx(GT,{ref:n,className:Ne("text-lg font-semibold tracking-tight text-foreground",e),...t}));sa.displayName=GT.displayName;const oa=m.forwardRef(({className:e,...t},n)=>s.jsx(YT,{ref:n,className:Ne("text-sm leading-6 text-muted-foreground",e),...t}));oa.displayName=YT.displayName;const pi=m.forwardRef(({className:e,...t},n)=>s.jsx(qT,{ref:n,className:Ne(e),...t}));pi.displayName=qT.displayName;const Xu=m.forwardRef(({className:e,...t},n)=>s.jsx(KT,{ref:n,className:Ne(e),...t}));Xu.displayName=KT.displayName;const vz=[{to:"/",label:"Overview",icon:KE},{to:"/playbooks",label:"Playbooks",icon:HE},{to:"/memories",label:"Memories",icon:jL},{to:"/resources",label:"Resources",icon:HL},{to:"/inventories",label:"Inventories",icon:Vh},{to:"/schedules",label:"Schedules",icon:VE},{to:"/usage",label:"Usage",icon:Sd},{to:"/todos",label:"Todos",icon:Xr},{to:"/views",label:"Saved Views",icon:YE},{to:"/archive",label:"Archive",icon:Uh}],wz=[{suffix:"/projects",label:"Projects",icon:Ev},{suffix:"/assignments",label:"Assignments",icon:qL},{suffix:"/servers",label:"Servers",icon:Pv},{suffix:"/inventories",label:"Inventories",icon:Vh},{suffix:"/usage",label:"Usage",icon:Sd},{suffix:"/agent-sessions",label:"Agent Sessions",icon:Bh},{suffix:"/todos",label:"Todos",icon:Xr}],jz=[{to:"/help",label:"Help",icon:VL},{to:"/workflow",label:"Workflow",icon:c4},{to:"/settings",label:"Settings",icon:s4}];function kz({title:e,breadcrumbs:t,projectSlug:n,workspace:r,children:o}){const[i,a]=m.useState(!1);return Zt({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(z1,{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(Ie,{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",children:s.jsx(Nd,{className:"h-4 w-4"})})]}),s.jsx(z1,{activeWorkspace:r,onNavigate:()=>a(!1)})]})}):null,s.jsxs("div",{className:"min-w-0",children:[s.jsx(X6,{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 z1({activeWorkspace:e,onNavigate:t}){const{data:n}=ja(),r=(n==null?void 0:n.workspaces)??[],o=(n==null?void 0:n.hasUngrouped)??!1,{hidden:i}=PT(),a=rr(),[l,d]=m.useState(new Set),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null),[S,C]=m.useState(!1),I=Vt();function T(B){d($=>{const O=new Set($);return O.has(B)?O.delete(B):O.add(B),O})}const R=Z6([...r,...o?[sh]:[]],i);async function D(B){if(w){C(!0);try{const $=`/api/workspaces/${encodeURIComponent(w)}${B?"?cascade=true":""}`,O=await fetch($,{method:"DELETE"});if(O.status===409){const z=await O.json().catch(()=>({}));N((z==null?void 0:z.blockedBy)??{projects:[],standalones:[]});return}if(!O.ok){const z=await O.json().catch(()=>({}));throw new Error(z.error||"Failed to delete workspace")}b(null),N(null)}catch($){console.error($),alert($ instanceof Error?$.message:"Failed to delete workspace")}finally{C(!1)}}}async function _(B,$){try{if(B.type==="project"){const O=await fetch(`/api/projects/${encodeURIComponent(B.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:$})});if(!O.ok){const z=await O.json().catch(()=>({}));throw new Error(z.error||"Failed to move project")}return}if(B.type==="standalone-assignment"){const O=await fetch(`/api/assignments/${encodeURIComponent(B.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:$})});if(!O.ok){const z=await O.json().catch(()=>({}));throw new Error(z.error||"Failed to move assignment")}return}if(B.type==="project-assignment"){alert("Assignments inherit workspace from their project — drag the project (or move it) to change workspaces.");return}}catch(O){console.error(O),alert(O instanceof Error?O.message:"Failed to move item")}}return s.jsxs("div",{className:"flex h-full flex-col gap-3",children:[s.jsx("div",{className:"space-y-3",children:s.jsxs(Ie,{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(h1,{items:vz,onNavigate:t}),s.jsx("div",{className:"border-t border-border/40"}),s.jsxs("div",{className:"flex-1 space-y-1 overflow-y-auto",children:[R.length===0&&!f&&s.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground/60",children:"No workspaces yet"}),R.map(B=>{const $=B==="_ungrouped",O=$?"Ungrouped":Tn(B),z=$?"/w/_ungrouped":`/w/${B}`,A=l.has(B),F=e===B||e===null&&$&&a.pathname.startsWith("/w/_ungrouped"),U=y===B;return s.jsxs("div",{className:`rounded-md transition ${U?"bg-accent/40 ring-1 ring-ring/40":""}`,onDragOver:H=>{H.dataTransfer.types.includes("application/json")&&(H.preventDefault(),H.dataTransfer.dropEffect="move",k(B))},onDragLeave:H=>{H.currentTarget.contains(H.relatedTarget)||k(L=>L===B?null:L)},onDrop:async H=>{try{const L=H.dataTransfer.getData("application/json");if(!L)return;H.preventDefault();let V;try{V=JSON.parse(L)}catch{return}if(!(V!=null&&V.type)||!(V!=null&&V.id))return;await _(V,$?null:B)}finally{k(null)}},children:[s.jsxs("div",{className:"group flex items-center",children:[s.jsxs("button",{type:"button",onClick:()=>T(B),className:`flex flex-1 items-center gap-2 rounded-md px-3 py-1.5 text-xs font-semibold uppercase tracking-wider transition ${F?"text-foreground":"text-muted-foreground/70 hover:text-muted-foreground"}`,children:[s.jsx(br,{className:`h-3 w-3 transition-transform ${A?"-rotate-90":""}`}),O]}),$?null:s.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),b(B),N(null)},title:`Delete workspace "${B}"`,"aria-label":`Delete workspace "${B}"`,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(vn,{className:"h-3 w-3"})})]}),!A&&s.jsx("nav",{className:"ml-2 space-y-0.5",children:wz.map(H=>{const L=`${z}${H.suffix}`,V=c2(a.pathname,H.suffix)&&a.pathname.startsWith(z),M=H.icon;return s.jsxs(Ie,{to:L,onClick:t,className:`flex items-center gap-3 rounded-md px-3 py-1.5 text-sm font-medium transition ${V?"bg-foreground text-background shadow-sm":"text-muted-foreground hover:bg-background/80 hover:text-foreground"}`,children:[s.jsx(M,{className:"h-4 w-4"}),s.jsx("span",{children:H.label})]},L)})})]},B)}),f?s.jsx("form",{className:"px-3 py-1.5",onSubmit:B=>{B.preventDefault();const $=h.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");$&&(p(!1),g(""),fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:$})}).then(()=>{t==null||t(),I(`/w/${$}/projects`)}))},children:s.jsx("input",{autoFocus:!0,type:"text",value:h,onChange:B=>g(B.target.value),onKeyDown:B=>{B.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($t,{className:"h-3 w-3"}),"New Workspace"]})]}),s.jsx("div",{className:"border-t border-border/40"}),s.jsx(h1,{items:jz,onNavigate:t}),s.jsx(wl,{open:w!==null,onOpenChange:B=>{S||B||(b(null),N(null))},children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsx(sa,{children:j?"Workspace has references":"Delete workspace?"}),s.jsx(oa,{children:j?s.jsxs(s.Fragment,{children:["The workspace ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5",children:w})," 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:w})," 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(B=>s.jsx("li",{children:s.jsx(Ie,{to:`/projects/${B}`,className:"hover:underline",children:B})},B))})]}):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(B=>s.jsx("li",{children:s.jsx(Ie,{to:`/assignments/${B}`,className:"hover:underline",children:B})},B))})]}):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(kl,{children:[s.jsx(Xu,{disabled:S,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),j?s.jsx(pi,{disabled:S,onClick:B=>{B.preventDefault(),D(!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(pi,{disabled:S,onClick:B=>{B.preventDefault(),D(!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 Sz(){const e=rr(),{workspace:t}=Wt(),{title:n,breadcrumbs:r,projectSlug:o}=u2(e.pathname);return s.jsx(kz,{title:n,breadcrumbs:r,projectSlug:o,workspace:t??null,children:s.jsx(DM,{})})}function Nz(){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 om=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function pc(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function cw(e){return"nodeType"in e}function or(e){var t,n;return e?pc(e)?e:cw(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function uw(e){const{Document:t}=or(e);return e instanceof t}function Ad(e){return pc(e)?!1:e instanceof or(e).HTMLElement}function QT(e){return e instanceof or(e).SVGElement}function hc(e){return e?pc(e)?e.document:cw(e)?uw(e)?e:Ad(e)||QT(e)?e.ownerDocument:document:document:document}const gs=om?m.useLayoutEffect:m.useEffect;function im(e){const t=m.useRef(e);return gs(()=>{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 Cz(){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 Qu(e,t){t===void 0&&(t=[e]);const n=m.useRef(e);return gs(()=>{n.current!==e&&(n.current=e)},t),n}function Pd(e,t){const n=m.useRef();return m.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function oh(e){const t=im(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 ih(e){const t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}let ty={};function _d(e,t){return m.useMemo(()=>{if(t)return t;const n=ty[e]==null?0:ty[e]+1;return ty[e]=n,e+"-"+n},[e,t])}function JT(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[d,f]of l){const p=i[d];p!=null&&(i[d]=p+e*f)}return i},{...t})}}const $l=JT(1),Ju=JT(-1);function Ez(e){return"clientX"in e&&"clientY"in e}function am(e){if(!e)return!1;const{KeyboardEvent:t}=or(e.target);return t&&e instanceof t}function Tz(e){if(!e)return!1;const{TouchEvent:t}=or(e.target);return t&&e instanceof t}function ah(e){if(Tz(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 Ez(e)?{x:e.clientX,y:e.clientY}:null}const xs=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[xs.Translate.toString(e),xs.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),B1="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Rz(e){return e.matches(B1)?e:e.querySelector(B1)}const Az={display:"none"};function Pz(e){let{id:t,value:n}=e;return Mt.createElement("div",{id:t,style:Az},n)}function _z(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 Mt.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Dz(){const[e,t]=m.useState("");return{announce:m.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const ZT=m.createContext(null);function $z(e){const t=m.useContext(ZT);m.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Iz(){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 Mz={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
|
+
`},Lz={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 Oz(e){let{announcements:t=Lz,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Mz}=e;const{announce:i,announcement:a}=Dz(),l=_d("DndLiveRegion"),[d,f]=m.useState(!1);if(m.useEffect(()=>{f(!0)},[]),$z(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])),!d)return null;const p=Mt.createElement(Mt.Fragment,null,Mt.createElement(Pz,{id:r,value:o.draggable}),Mt.createElement(_z,{id:l,announcement:a}));return n?xo.createPortal(p,n):p}var Rn;(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"})(Rn||(Rn={}));function lh(){}function yi(e,t){return m.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function lm(){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 ys=Object.freeze({x:0,y:0});function eR(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fz(e,t){const n=ah(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 tR(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 U1(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 nR(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function H1(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 cm=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=H1(t,t.left,t.top),i=[];for(const a of r){const{id:l}=a,d=n.get(l);if(d){const f=eR(H1(d),o);i.push({id:l,data:{droppableContainer:a,value:f}})}}return i.sort(tR)},Bz=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=U1(t),i=[];for(const a of r){const{id:l}=a,d=n.get(l);if(d){const f=U1(d),p=o.reduce((g,y,k)=>g+eR(f[k],y),0),h=Number((p/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(tR)};function Uz(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 d=t.width*t.height,f=e.width*e.height,p=a*l,h=p/(d+f-p);return Number(h.toFixed(4))}return 0}const Hz=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 d=Uz(l,t);d>0&&o.push({id:a,data:{droppableContainer:i,value:d}})}}return o.sort(zz)};function Vz(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function rR(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ys}function Wz(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 qz=Wz(1);function sR(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 Kz(e,t,n){const r=sR(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:l}=r,d=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:d+p,bottom:f+h,left:d}}const Gz={ignoreTransform:!1};function mc(e,t){t===void 0&&(t=Gz);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:f,transformOrigin:p}=or(e).getComputedStyle(e);f&&(n=Kz(n,f,p))}const{top:r,left:o,width:i,height:a,bottom:l,right:d}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:d}}function V1(e){return mc(e,{ignoreTransform:!0})}function Yz(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Xz(e,t){return t===void 0&&(t=or(e).getComputedStyle(e)),t.position==="fixed"}function Qz(e,t){t===void 0&&(t=or(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 um(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(uw(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Ad(o)||QT(o)||n.includes(o))return n;const i=or(e).getComputedStyle(o);return o!==e&&Qz(o,i)&&n.push(o),Xz(o,i)?n:r(o.parentNode)}return e?r(e):n}function oR(e){const[t]=um(e,1);return t??null}function ny(e){return!om||!e?null:pc(e)?e:cw(e)?uw(e)||e===hc(e).scrollingElement?window:Ad(e)?e:null:null}function iR(e){return pc(e)?e.scrollX:e.scrollLeft}function aR(e){return pc(e)?e.scrollY:e.scrollTop}function vb(e){return{x:iR(e),y:aR(e)}}var zn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zn||(zn={}));function lR(e){return!om||!e?!1:e===document.scrollingElement}function cR(e){const t={x:0,y:0},n=lR(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 Jz={x:.2,y:.2};function Zz(e,t,n,r,o){let{top:i,left:a,right:l,bottom:d}=n;r===void 0&&(r=10),o===void 0&&(o=Jz);const{isTop:f,isBottom:p,isLeft:h,isRight:g}=cR(e),y={x:0,y:0},k={x:0,y:0},w={height:t.height*o.y,width:t.width*o.x};return!f&&i<=t.top+w.height?(y.y=zn.Backward,k.y=r*Math.abs((t.top+w.height-i)/w.height)):!p&&d>=t.bottom-w.height&&(y.y=zn.Forward,k.y=r*Math.abs((t.bottom-w.height-d)/w.height)),!g&&l>=t.right-w.width?(y.x=zn.Forward,k.x=r*Math.abs((t.right-w.width-l)/w.width)):!h&&a<=t.left+w.width&&(y.x=zn.Backward,k.x=r*Math.abs((t.left+w.width-a)/w.width)),{direction:y,speed:k}}function eB(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 uR(e){return e.reduce((t,n)=>$l(t,vb(n)),ys)}function tB(e){return e.reduce((t,n)=>t+iR(n),0)}function nB(e){return e.reduce((t,n)=>t+aR(n),0)}function dR(e,t){if(t===void 0&&(t=mc),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);oR(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const rB=[["x",["left","right"],tB],["y",["top","bottom"],nB]];class dw{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=um(n),o=uR(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,l]of rB)for(const d of a)Object.defineProperty(this,d,{get:()=>{const f=l(r),p=o[i]-f;return this.rect[d]+p},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Iu{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 sB(e){const{EventTarget:t}=or(e);return e instanceof t?e:hc(e)}function ry(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 Gr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Gr||(Gr={}));function W1(e){e.preventDefault()}function oB(e){e.stopPropagation()}var Ct;(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"})(Ct||(Ct={}));const fR={start:[Ct.Space,Ct.Enter],cancel:[Ct.Esc],end:[Ct.Space,Ct.Enter,Ct.Tab]},iB=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ct.Right:return{...n,x:n.x+25};case Ct.Left:return{...n,x:n.x-25};case Ct.Down:return{...n,y:n.y+25};case Ct.Up:return{...n,y:n.y-25}}};class gc{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 Iu(hc(n)),this.windowListeners=new Iu(or(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Gr.Resize,this.handleCancel),this.windowListeners.add(Gr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Gr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&dR(r),n(ys)}handleKeyDown(t){if(am(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=fR,coordinateGetter:a=iB,scrollBehavior:l="smooth"}=o,{code:d}=t;if(i.end.includes(d)){this.handleEnd(t);return}if(i.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:f}=r.current,p=f?{x:f.left,y:f.top}:ys;this.referenceCoordinates||(this.referenceCoordinates=p);const h=a(t,{active:n,context:r.current,currentCoordinates:p});if(h){const g=Ju(h,p),y={x:0,y:0},{scrollableAncestors:k}=r.current;for(const w of k){const b=t.code,{isTop:j,isRight:N,isLeft:S,isBottom:C,maxScroll:I,minScroll:T}=cR(w),R=eB(w),D={x:Math.min(b===Ct.Right?R.right-R.width/2:R.right,Math.max(b===Ct.Right?R.left:R.left+R.width/2,h.x)),y:Math.min(b===Ct.Down?R.bottom-R.height/2:R.bottom,Math.max(b===Ct.Down?R.top:R.top+R.height/2,h.y))},_=b===Ct.Right&&!N||b===Ct.Left&&!S,B=b===Ct.Down&&!C||b===Ct.Up&&!j;if(_&&D.x!==h.x){const $=w.scrollLeft+g.x,O=b===Ct.Right&&$<=I.x||b===Ct.Left&&$>=T.x;if(O&&!g.y){w.scrollTo({left:$,behavior:l});return}O?y.x=w.scrollLeft-$:y.x=b===Ct.Right?w.scrollLeft-I.x:w.scrollLeft-T.x,y.x&&w.scrollBy({left:-y.x,behavior:l});break}else if(B&&D.y!==h.y){const $=w.scrollTop+g.y,O=b===Ct.Down&&$<=I.y||b===Ct.Up&&$>=T.y;if(O&&!g.x){w.scrollTo({top:$,behavior:l});return}O?y.y=w.scrollTop-$:y.y=b===Ct.Down?w.scrollTop-I.y:w.scrollTop-T.y,y.y&&w.scrollBy({top:-y.y,behavior:l});break}}this.handleMove(t,$l(Ju(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()}}gc.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=fR,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 q1(e){return!!(e&&"distance"in e)}function K1(e){return!!(e&&"delay"in e)}class fw{constructor(t,n,r){var o;r===void 0&&(r=sB(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=hc(a),this.documentListeners=new Iu(this.document),this.listeners=new Iu(r),this.windowListeners=new Iu(or(a)),this.initialCoordinates=(o=ah(i))!=null?o:ys,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(Gr.Resize,this.handleCancel),this.windowListeners.add(Gr.DragStart,W1),this.windowListeners.add(Gr.VisibilityChange,this.handleCancel),this.windowListeners.add(Gr.ContextMenu,W1),this.documentListeners.add(Gr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(K1(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(q1(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(Gr.Click,oB,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Gr.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 d=(n=ah(t))!=null?n:ys,f=Ju(o,d);if(!r&&l){if(q1(l)){if(l.tolerance!=null&&ry(f,l.tolerance))return this.handleCancel();if(ry(f,l.distance))return this.handleStart()}if(K1(l)&&ry(f,l.tolerance))return this.handleCancel();this.handlePending(l,f);return}t.cancelable&&t.preventDefault(),a(d)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Ct.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const aB={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class xc extends fw{constructor(t){const{event:n}=t,r=hc(n.target);super(t,aB,r)}}xc.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 lB={move:{name:"mousemove"},end:{name:"mouseup"}};var wb;(function(e){e[e.RightClick=2]="RightClick"})(wb||(wb={}));class cB extends fw{constructor(t){super(t,lB,hc(t.event.target))}}cB.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===wb.RightClick?!1:(r==null||r({event:n}),!0)}}];const sy={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class uB extends fw{constructor(t){super(t,sy)}static setup(){return window.addEventListener(sy.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(sy.move.name,t)};function t(){}}}uB.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 Mu;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Mu||(Mu={}));var ch;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(ch||(ch={}));function dB(e){let{acceleration:t,activator:n=Mu.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:l=ch.TreeOrder,pointerCoordinates:d,scrollableAncestors:f,scrollableAncestorRects:p,delta:h,threshold:g}=e;const y=pB({delta:h,disabled:!i}),[k,w]=Cz(),b=m.useRef({x:0,y:0}),j=m.useRef({x:0,y:0}),N=m.useMemo(()=>{switch(n){case Mu.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case Mu.DraggableRect:return o}},[n,o,d]),S=m.useRef(null),C=m.useCallback(()=>{const T=S.current;if(!T)return;const R=b.current.x*j.current.x,D=b.current.y*j.current.y;T.scrollBy(R,D)},[]),I=m.useMemo(()=>l===ch.TreeOrder?[...f].reverse():f,[l,f]);m.useEffect(()=>{if(!i||!f.length||!N){w();return}for(const T of I){if((r==null?void 0:r(T))===!1)continue;const R=f.indexOf(T),D=p[R];if(!D)continue;const{direction:_,speed:B}=Zz(T,D,N,t,g);for(const $ of["x","y"])y[$][_[$]]||(B[$]=0,_[$]=0);if(B.x>0||B.y>0){w(),S.current=T,k(C,a),b.current=B,j.current=_;return}}b.current={x:0,y:0},j.current={x:0,y:0},w()},[t,C,r,w,i,a,JSON.stringify(N),JSON.stringify(y),k,f,I,p,JSON.stringify(g)])}const fB={x:{[zn.Backward]:!1,[zn.Forward]:!1},y:{[zn.Backward]:!1,[zn.Forward]:!1}};function pB(e){let{delta:t,disabled:n}=e;const r=ih(t);return Pd(o=>{if(n||!r||!o)return fB;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[zn.Backward]:o.x[zn.Backward]||i.x===-1,[zn.Forward]:o.x[zn.Forward]||i.x===1},y:{[zn.Backward]:o.y[zn.Backward]||i.y===-1,[zn.Forward]:o.y[zn.Forward]||i.y===1}}},[n,t,r])}function hB(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Pd(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function mB(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 Zu;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Zu||(Zu={}));var jb;(function(e){e.Optimized="optimized"})(jb||(jb={}));const G1=new Map;function gB(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=m.useState(null),{frequency:l,measure:d,strategy:f}=o,p=m.useRef(e),h=b(),g=Qu(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),w=Pd(j=>{if(h&&!n)return G1;if(!j||j===G1||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,I=C?new dw(d(C),C):null;S.rect.current=I,I&&N.set(S.id,I)}return N}return j},[e,i,n,h,d]);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:w,measureDroppableContainers:y,measuringScheduled:i!=null};function b(){switch(f){case Zu.Always:return!1;case Zu.BeforeDragging:return n;default:return!n}}}function pw(e,t){return Pd(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function xB(e,t){return pw(e,t)}function yB(e){let{callback:t,disabled:n}=e;const r=im(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 dm(e){let{callback:t,disabled:n}=e;const r=im(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 bB(e){return new dw(mc(e),e)}function Y1(e,t,n){t===void 0&&(t=bB);const[r,o]=m.useState(null);function i(){o(d=>{if(!e)return null;if(e.isConnected===!1){var f;return(f=d??n)!=null?f:null}const p=t(e);return JSON.stringify(d)===JSON.stringify(p)?d:p})}const a=yB({callback(d){if(e)for(const f of d){const{type:p,target:h}=f;if(p==="childList"&&h instanceof HTMLElement&&h.contains(e)){i();break}}}}),l=dm({callback:i});return gs(()=>{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 vB(e){const t=pw(e);return rR(e,t)}const X1=[];function wB(e){const t=m.useRef(e),n=Pd(r=>e?r&&r!==X1&&e&&t.current&&e.parentNode===t.current.parentNode?r:um(e):X1,[e]);return m.useEffect(()=>{t.current=e},[e]),n}function jB(e){const[t,n]=m.useState(null),r=m.useRef(e),o=m.useCallback(i=>{const a=ny(i.target);a&&n(l=>l?(l.set(a,vb(a)),new Map(l)):null)},[]);return m.useEffect(()=>{const i=r.current;if(e!==i){a(i);const l=e.map(d=>{const f=ny(d);return f?(f.addEventListener("scroll",o,{passive:!0}),[f,vb(f)]):null}).filter(d=>d!=null);n(l.length?new Map(l):null),r.current=e}return()=>{a(e),a(i)};function a(l){l.forEach(d=>{const f=ny(d);f==null||f.removeEventListener("scroll",o)})}},[o,e]),m.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>$l(i,a),ys):uR(e):ys,[e,t])}function Q1(e,t){t===void 0&&(t=[]);const n=m.useRef(null);return m.useEffect(()=>{n.current=null},t),m.useEffect(()=>{const r=e!==ys;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Ju(e,n.current):ys}function kB(e){m.useEffect(()=>{if(!om)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 SB(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 pR(e){return m.useMemo(()=>e?Yz(e):null,[e])}const J1=[];function NB(e,t){t===void 0&&(t=mc);const[n]=e,r=pR(n?or(n):null),[o,i]=m.useState(J1);function a(){i(()=>e.length?e.map(d=>lR(d)?r:new dw(t(d),d)):J1)}const l=dm({callback:a});return gs(()=>{l==null||l.disconnect(),a(),e.forEach(d=>l==null?void 0:l.observe(d))},[e]),o}function hR(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ad(t)?t:e}function CB(e){let{measure:t}=e;const[n,r]=m.useState(null),o=m.useCallback(f=>{for(const{target:p}of f)if(Ad(p)){r(h=>{const g=t(p);return h?{...h,width:g.width,height:g.height}:g});break}},[t]),i=dm({callback:o}),a=m.useCallback(f=>{const p=hR(f);i==null||i.disconnect(),p&&(i==null||i.observe(p)),r(p?t(p):null)},[t,i]),[l,d]=oh(a);return m.useMemo(()=>({nodeRef:l,rect:n,setRef:d}),[n,l,d])}const EB=[{sensor:xc,options:{}},{sensor:gc,options:{}}],TB={current:{}},Mp={draggable:{measure:V1},droppable:{measure:V1,strategy:Zu.WhileDragging,frequency:jb.Optimized},dragOverlay:{measure:mc}};class Lu 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 RB={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Lu,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lh},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mp,measureDroppableContainers:lh,windowRect:null,measuringScheduled:!1},mR={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:lh,draggableNodes:new Map,over:null,measureDroppableContainers:lh},Dd=m.createContext(mR),gR=m.createContext(RB);function AB(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Lu}}}function PB(e,t){switch(t.type){case Rn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Rn.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 Rn.DragEnd:case Rn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Rn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Lu(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Rn.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 Lu(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Rn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Lu(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function _B(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=m.useContext(Dd),i=ih(r),a=ih(n==null?void 0:n.id);return m.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!am(i)||document.activeElement===i.target)return;const l=o.get(a);if(!l)return;const{activatorNode:d,node:f}=l;if(!d.current&&!f.current)return;requestAnimationFrame(()=>{for(const p of[d.current,f.current]){if(!p)continue;const h=Rz(p);if(h){h.focus();break}}})}},[r,t,o,a,i]),null}function xR(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function DB(e){return m.useMemo(()=>({draggable:{...Mp.draggable,...e==null?void 0:e.draggable},droppable:{...Mp.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Mp.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 $B(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;gs(()=>{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=rR(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=oR(f);g&&g.scrollBy({top:h.y,left:h.x})}},[t,a,l,r,n])}const fm=m.createContext({...ys,scaleX:1,scaleY:1});var di;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(di||(di={}));const pm=m.memo(function(t){var n,r,o,i;let{id:a,accessibility:l,autoScroll:d=!0,children:f,sensors:p=EB,collisionDetection:h=Hz,measuring:g,modifiers:y,...k}=t;const w=m.useReducer(PB,void 0,AB),[b,j]=w,[N,S]=Iz(),[C,I]=m.useState(di.Uninitialized),T=C===di.Initialized,{draggable:{active:R,nodes:D,translate:_},droppable:{containers:B}}=b,$=R!=null?D.get(R):null,O=m.useRef({initial:null,translated:null}),z=m.useMemo(()=>{var ht;return R!=null?{id:R,data:(ht=$==null?void 0:$.data)!=null?ht:TB,rect:O}:null},[R,$]),A=m.useRef(null),[F,U]=m.useState(null),[H,L]=m.useState(null),V=Qu(k,Object.values(k)),M=_d("DndDescribedBy",a),W=m.useMemo(()=>B.getEnabled(),[B]),Y=DB(g),{droppableRects:q,measureDroppableContainers:J,measuringScheduled:ne}=gB(W,{dragging:T,dependencies:[_.x,_.y],config:Y.droppable}),Q=hB(D,R),le=m.useMemo(()=>H?ah(H):null,[H]),te=ct(),pe=xB(Q,Y.draggable.measure);$B({activeNode:R!=null?D.get(R):null,config:te.layoutShiftCompensation,initialRect:pe,measure:Y.draggable.measure});const be=Y1(Q,Y.draggable.measure,pe),Ee=Y1(Q?Q.parentElement:null),Te=m.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ke=B.getNodeFor((n=Te.current.over)==null?void 0:n.id),Ue=CB({measure:Y.dragOverlay.measure}),oe=(r=Ue.nodeRef.current)!=null?r:Q,je=T?(o=Ue.rect)!=null?o:be:null,Se=!!(Ue.nodeRef.current&&Ue.rect),De=vB(Se?null:be),ze=pR(oe?or(oe):null),Ye=wB(T?ke??Q:null),Oe=NB(Ye),nt=xR(y,{transform:{x:_.x-De.x,y:_.y-De.y,scaleX:1,scaleY:1},activatorEvent:H,active:z,activeNodeRect:be,containerNodeRect:Ee,draggingNodeRect:je,over:Te.current.over,overlayNodeRect:Ue.rect,scrollableAncestors:Ye,scrollableAncestorRects:Oe,windowRect:ze}),wt=le?$l(le,_):null,it=jB(Ye),st=Q1(it),ce=Q1(it,[be]),ee=$l(nt,st),xe=je?qz(je,nt):null,ie=z&&xe?h({active:z,collisionRect:xe,droppableRects:q,droppableContainers:W,pointerCoordinates:wt}):null,we=nR(ie,"id"),[$e,Ce]=m.useState(null),se=Se?nt:$l(nt,ce),me=Vz(se,(i=$e==null?void 0:$e.rect)!=null?i:null,be),Pe=m.useRef(null),qe=m.useCallback((ht,Nt)=>{let{sensor:ye,options:Ve}=Nt;if(A.current==null)return;const Je=D.get(A.current);if(!Je)return;const Ft=ht.nativeEvent,zt=new ye({active:A.current,activeNode:Je,event:Ft,options:Ve,context:Te,onAbort(Et){if(!D.get(Et))return;const{onDragAbort:Tt}=V.current,ue={id:Et};Tt==null||Tt(ue),N({type:"onDragAbort",event:ue})},onPending(Et,$n,Tt,ue){if(!D.get(Et))return;const{onDragPending:et}=V.current,bt={id:Et,constraint:$n,initialCoordinates:Tt,offset:ue};et==null||et(bt),N({type:"onDragPending",event:bt})},onStart(Et){const $n=A.current;if($n==null)return;const Tt=D.get($n);if(!Tt)return;const{onDragStart:ue}=V.current,Be={activatorEvent:Ft,active:{id:$n,data:Tt.data,rect:O}};xo.unstable_batchedUpdates(()=>{ue==null||ue(Be),I(di.Initializing),j({type:Rn.DragStart,initialCoordinates:Et,active:$n}),N({type:"onDragStart",event:Be}),U(Pe.current),L(Ft)})},onMove(Et){j({type:Rn.DragMove,coordinates:Et})},onEnd:hn(Rn.DragEnd),onCancel:hn(Rn.DragCancel)});Pe.current=zt;function hn(Et){return async function(){const{active:Tt,collisions:ue,over:Be,scrollAdjustedTranslate:et}=Te.current;let bt=null;if(Tt&&et){const{cancelDrop:Kn}=V.current;bt={activatorEvent:Ft,active:Tt,collisions:ue,delta:et,over:Be},Et===Rn.DragEnd&&typeof Kn=="function"&&await Promise.resolve(Kn(bt))&&(Et=Rn.DragCancel)}A.current=null,xo.unstable_batchedUpdates(()=>{j({type:Et}),I(di.Uninitialized),Ce(null),U(null),L(null),Pe.current=null;const Kn=Et===Rn.DragEnd?"onDragEnd":"onDragCancel";if(bt){const wr=V.current[Kn];wr==null||wr(bt),N({type:Kn,event:bt})}})}}},[D]),de=m.useCallback((ht,Nt)=>(ye,Ve)=>{const Je=ye.nativeEvent,Ft=D.get(Ve);if(A.current!==null||!Ft||Je.dndKit||Je.defaultPrevented)return;const zt={active:Ft};ht(ye,Nt.options,zt)===!0&&(Je.dndKit={capturedBy:Nt.sensor},A.current=Ve,qe(ye,Nt))},[D,qe]),pt=mB(p,de);kB(p),gs(()=>{be&&C===di.Initializing&&I(di.Initialized)},[be,C]),m.useEffect(()=>{const{onDragMove:ht}=V.current,{active:Nt,activatorEvent:ye,collisions:Ve,over:Je}=Te.current;if(!Nt||!ye)return;const Ft={active:Nt,activatorEvent:ye,collisions:Ve,delta:{x:ee.x,y:ee.y},over:Je};xo.unstable_batchedUpdates(()=>{ht==null||ht(Ft),N({type:"onDragMove",event:Ft})})},[ee.x,ee.y]),m.useEffect(()=>{const{active:ht,activatorEvent:Nt,collisions:ye,droppableContainers:Ve,scrollAdjustedTranslate:Je}=Te.current;if(!ht||A.current==null||!Nt||!Je)return;const{onDragOver:Ft}=V.current,zt=Ve.get(we),hn=zt&&zt.rect.current?{id:zt.id,rect:zt.rect.current,data:zt.data,disabled:zt.disabled}:null,Et={active:ht,activatorEvent:Nt,collisions:ye,delta:{x:Je.x,y:Je.y},over:hn};xo.unstable_batchedUpdates(()=>{Ce(hn),Ft==null||Ft(Et),N({type:"onDragOver",event:Et})})},[we]),gs(()=>{Te.current={activatorEvent:H,active:z,activeNode:Q,collisionRect:xe,collisions:ie,droppableRects:q,draggableNodes:D,draggingNode:oe,draggingNodeRect:je,droppableContainers:B,over:$e,scrollableAncestors:Ye,scrollAdjustedTranslate:ee},O.current={initial:je,translated:xe}},[z,Q,ie,xe,D,oe,je,q,B,$e,Ye,ee]),dB({...te,delta:_,draggingRect:xe,pointerCoordinates:wt,scrollableAncestors:Ye,scrollableAncestorRects:Oe});const yt=m.useMemo(()=>({active:z,activeNode:Q,activeNodeRect:be,activatorEvent:H,collisions:ie,containerNodeRect:Ee,dragOverlay:Ue,draggableNodes:D,droppableContainers:B,droppableRects:q,over:$e,measureDroppableContainers:J,scrollableAncestors:Ye,scrollableAncestorRects:Oe,measuringConfiguration:Y,measuringScheduled:ne,windowRect:ze}),[z,Q,be,H,ie,Ee,Ue,D,B,q,$e,J,Ye,Oe,Y,ne,ze]),St=m.useMemo(()=>({activatorEvent:H,activators:pt,active:z,activeNodeRect:be,ariaDescribedById:{draggable:M},dispatch:j,draggableNodes:D,over:$e,measureDroppableContainers:J}),[H,pt,z,be,j,M,D,$e,J]);return Mt.createElement(ZT.Provider,{value:S},Mt.createElement(Dd.Provider,{value:St},Mt.createElement(gR.Provider,{value:yt},Mt.createElement(fm.Provider,{value:me},f)),Mt.createElement(_B,{disabled:(l==null?void 0:l.restoreFocus)===!1})),Mt.createElement(Oz,{...l,hiddenTextDescribedById:M}));function ct(){const ht=(F==null?void 0:F.autoScrollEnabled)===!1,Nt=typeof d=="object"?d.enabled===!1:d===!1,ye=T&&!ht&&!Nt;return typeof d=="object"?{...d,enabled:ye}:{enabled:ye}}}),IB=m.createContext(null),Z1="button",MB="Draggable";function LB(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=_d(MB),{activators:a,activatorEvent:l,active:d,activeNodeRect:f,ariaDescribedById:p,draggableNodes:h,over:g}=m.useContext(Dd),{role:y=Z1,roleDescription:k="draggable",tabIndex:w=0}=o??{},b=(d==null?void 0:d.id)===t,j=m.useContext(b?fm:IB),[N,S]=oh(),[C,I]=oh(),T=SB(a,t),R=Qu(n);gs(()=>(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 D=m.useMemo(()=>({role:y,tabIndex:w,"aria-disabled":r,"aria-pressed":b&&y===Z1?!0:void 0,"aria-roledescription":k,"aria-describedby":p.draggable}),[r,y,w,b,k,p.draggable]);return{active:d,activatorEvent:l,activeNodeRect:f,attributes:D,isDragging:b,listeners:r?void 0:T,node:N,over:g,setNodeRef:S,setActivatorNodeRef:I,transform:j}}function yR(){return m.useContext(gR)}const OB="Droppable",FB={timeout:25};function zB(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=_d(OB),{active:a,dispatch:l,over:d,measureDroppableContainers:f}=m.useContext(Dd),p=m.useRef({disabled:n}),h=m.useRef(!1),g=m.useRef(null),y=m.useRef(null),{disabled:k,updateMeasurementsFor:w,timeout:b}={...FB,...o},j=Qu(w??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=dm({callback:N,disabled:k||!a}),C=m.useCallback((D,_)=>{S&&(_&&(S.unobserve(_),h.current=!1),D&&S.observe(D))},[S]),[I,T]=oh(C),R=Qu(t);return m.useEffect(()=>{!S||!I.current||(S.disconnect(),h.current=!1,S.observe(I.current))},[I,S]),m.useEffect(()=>(l({type:Rn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:I,rect:g,data:R}}),()=>l({type:Rn.UnregisterDroppable,key:i,id:r})),[r]),m.useEffect(()=>{n!==p.current.disabled&&(l({type:Rn.SetDroppableDisabled,id:r,key:i,disabled:n}),p.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:(d==null?void 0:d.id)===r,node:I,over:d,setNodeRef:T}}function BB(e){let{animation:t,children:n}=e;const[r,o]=m.useState(null),[i,a]=m.useState(null),l=ih(n);return!n&&!r&&l&&o(l),gs(()=>{if(!i)return;const d=r==null?void 0:r.key,f=r==null?void 0:r.props.id;if(d==null||f==null){o(null);return}Promise.resolve(t(f,i)).then(()=>{o(null)})},[t,r,i]),Mt.createElement(Mt.Fragment,null,n,r?m.cloneElement(r,{ref:a}):null)}const UB={x:0,y:0,scaleX:1,scaleY:1};function HB(e){let{children:t}=e;return Mt.createElement(Dd.Provider,{value:mR},Mt.createElement(fm.Provider,{value:UB},t))}const VB={position:"fixed",touchAction:"none"},WB=e=>am(e)?"transform 250ms ease":void 0,qB=m.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:o,children:i,className:a,rect:l,style:d,transform:f,transition:p=WB}=e;if(!l)return null;const h=o?f:{...f,scaleX:1,scaleY:1},g={...VB,width:l.width,height:l.height,top:l.top,left:l.left,transform:xs.Transform.toString(h),transformOrigin:o&&r?Fz(r,l):void 0,transition:typeof p=="function"?p(r):p,...d};return Mt.createElement(n,{className:a,style:g,ref:t},i)}),KB=e=>t=>{let{active:n,dragOverlay:r}=t;const o={},{styles:i,className:a}=e;if(i!=null&&i.active)for(const[l,d]of Object.entries(i.active))d!==void 0&&(o[l]=n.node.style.getPropertyValue(l),n.node.style.setProperty(l,d));if(i!=null&&i.dragOverlay)for(const[l,d]of Object.entries(i.dragOverlay))d!==void 0&&r.node.style.setProperty(l,d);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[d,f]of Object.entries(o))n.node.style.setProperty(d,f);a!=null&&a.active&&n.node.classList.remove(a.active)}},GB=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:xs.Transform.toString(t)},{transform:xs.Transform.toString(n)}]},YB={duration:250,easing:"ease",keyframes:GB,sideEffects:KB({styles:{active:{opacity:"0"}}})};function XB(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:o}=e;return im((i,a)=>{if(t===null)return;const l=n.get(i);if(!l)return;const d=l.node.current;if(!d)return;const f=hR(a);if(!f)return;const{transform:p}=or(a).getComputedStyle(a),h=sR(p);if(!h)return;const g=typeof t=="function"?t:QB(t);return dR(d,o.draggable.measure),g({active:{id:i,data:l.data,node:d,rect:o.draggable.measure(d)},draggableNodes:n,dragOverlay:{node:a,rect:o.dragOverlay.measure(f)},droppableContainers:r,measuringConfiguration:o,transform:h})})}function QB(e){const{duration:t,easing:n,sideEffects:r,keyframes:o}={...YB,...e};return i=>{let{active:a,dragOverlay:l,transform:d,...f}=i;if(!t)return;const p={x:l.rect.left-a.rect.left,y:l.rect.top-a.rect.top},h={scaleX:d.scaleX!==1?a.rect.width*d.scaleX/l.rect.width:1,scaleY:d.scaleY!==1?a.rect.height*d.scaleY/l.rect.height:1},g={x:d.x-p.x,y:d.y-p.y,...h},y=o({...f,active:a,dragOverlay:l,transform:{initial:d,final:g}}),[k]=y,w=y[y.length-1];if(JSON.stringify(k)===JSON.stringify(w))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 eS=0;function JB(e){return m.useMemo(()=>{if(e!=null)return eS++,eS},[e])}const ZB=Mt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:o,transition:i,modifiers:a,wrapperElement:l="div",className:d,zIndex:f=999}=e;const{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggableNodes:k,droppableContainers:w,dragOverlay:b,over:j,measuringConfiguration:N,scrollableAncestors:S,scrollableAncestorRects:C,windowRect:I}=yR(),T=m.useContext(fm),R=JB(h==null?void 0:h.id),D=xR(a,{activatorEvent:p,active:h,activeNodeRect:g,containerNodeRect:y,draggingNodeRect:b.rect,over:j,overlayNodeRect:b.rect,scrollableAncestors:S,scrollableAncestorRects:C,transform:T,windowRect:I}),_=pw(g),B=XB({config:r,draggableNodes:k,droppableContainers:w,measuringConfiguration:N}),$=_?b.setRef:void 0;return Mt.createElement(HB,null,Mt.createElement(BB,{animation:B},h&&R?Mt.createElement(qB,{key:R,id:h.id,ref:$,as:l,activatorEvent:p,adjustScale:t,className:d,transition:i,rect:_,style:{zIndex:f,...o},transform:D},n):null))});function yc(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function e8(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function rp(e){return e!==null&&e>=0}function t8(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 n8(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const hw=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=yc(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}},sp={scaleX:1,scaleY:1},mw=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,...sp}:null}const d=r8(i,o,n);return o>n&&o<=a?{x:0,y:-l.height-d,...sp}:o<n&&o>=a?{x:0,y:l.height+d,...sp}:{x:0,y:0,...sp}};function r8(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 bR="Sortable",vR=Mt.createContext({activeIndex:-1,containerId:bR,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hw,disabled:{draggable:!1,droppable:!1}});function hm(e){let{children:t,id:n,items:r,strategy:o=hw,disabled:i=!1}=e;const{active:a,dragOverlay:l,droppableRects:d,over:f,measureDroppableContainers:p}=yR(),h=_d(bR,n),g=l.rect!==null,y=m.useMemo(()=>r.map(T=>typeof T=="object"&&"id"in T?T.id:T),[r]),k=a!=null,w=a?y.indexOf(a.id):-1,b=f?y.indexOf(f.id):-1,j=m.useRef(y),N=!t8(y,j.current),S=b!==-1&&w===-1||N,C=n8(i);gs(()=>{N&&k&&p(y)},[N,y,k,p]),m.useEffect(()=>{j.current=y},[y]);const I=m.useMemo(()=>({activeIndex:w,containerId:h,disabled:C,disableTransforms:S,items:y,overIndex:b,useDragOverlay:g,sortedRects:e8(y,d),strategy:o}),[w,h,C.draggable,C.droppable,S,y,b,d,g,o]);return Mt.createElement(vR.Provider,{value:I},t)}const s8=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return yc(n,r,o).indexOf(t)},o8=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:d,transition:f}=e;return!f||!r||l!==i&&o===a?!1:n?!0:a!==o&&t===d},i8={duration:200,easing:"ease"},wR="transform",a8=xs.Transition.toString({property:wR,duration:0,easing:"linear"}),l8={roleDescription:"sortable"};function c8(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=m.useState(null),l=m.useRef(n);return gs(()=>{if(!t&&n!==l.current&&r.current){const d=o.current;if(d){const f=mc(r.current,{ignoreTransform:!0}),p={x:d.left-f.left,y:d.top-f.top,scaleX:d.width/f.width,scaleY:d.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 mm(e){let{animateLayoutChanges:t=o8,attributes:n,disabled:r,data:o,getNewIndex:i=s8,id:a,strategy:l,resizeObserverConfig:d,transition:f=i8}=e;const{items:p,containerId:h,activeIndex:g,disabled:y,disableTransforms:k,sortedRects:w,overIndex:b,useDragOverlay:j,strategy:N}=m.useContext(vR),S=u8(r,y),C=p.indexOf(a),I=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:D,isOver:_,setNodeRef:B}=zB({id:a,data:I,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:T,...d}}),{active:$,activatorEvent:O,activeNodeRect:z,attributes:A,setNodeRef:F,listeners:U,isDragging:H,over:L,setActivatorNodeRef:V,transform:M}=LB({id:a,data:I,attributes:{...l8,...n},disabled:S.draggable}),W=Nz(B,F),Y=!!$,q=Y&&!k&&rp(g)&&rp(b),J=!j&&H,ne=J&&q?M:null,le=q?ne??(l??N)({rects:w,activeNodeRect:z,activeIndex:g,overIndex:b,index:C}):null,te=rp(g)&&rp(b)?i({id:a,items:p,activeIndex:g,overIndex:b}):C,pe=$==null?void 0:$.id,be=m.useRef({activeId:pe,items:p,newIndex:te,containerId:h}),Ee=p!==be.current.items,Te=t({active:$,containerId:h,isDragging:H,isSorting:Y,id:a,index:C,items:p,newIndex:be.current.newIndex,previousItems:be.current.items,previousContainerId:be.current.containerId,transition:f,wasDragging:be.current.activeId!=null}),ke=c8({disabled:!Te,index:C,node:D,rect:R});return m.useEffect(()=>{Y&&be.current.newIndex!==te&&(be.current.newIndex=te),h!==be.current.containerId&&(be.current.containerId=h),p!==be.current.items&&(be.current.items=p)},[Y,te,h,p]),m.useEffect(()=>{if(pe===be.current.activeId)return;if(pe!=null&&be.current.activeId==null){be.current.activeId=pe;return}const oe=setTimeout(()=>{be.current.activeId=pe},50);return()=>clearTimeout(oe)},[pe]),{active:$,activeIndex:g,attributes:A,data:I,rect:R,index:C,newIndex:te,items:p,isOver:_,isSorting:Y,isDragging:H,listeners:U,node:D,overIndex:b,over:L,setNodeRef:W,setActivatorNodeRef:V,setDroppableNodeRef:B,setDraggableNodeRef:F,transform:ke??le,transition:Ue()};function Ue(){if(ke||Ee&&be.current.newIndex===C)return a8;if(!(J&&!am(O)||!f)&&(Y||Te))return xs.Transition.toString({...f,property:wR})}}function u8(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 uh(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 d8=[Ct.Down,Ct.Right,Ct.Up,Ct.Left],jR=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(d8.includes(e.code)){if(e.preventDefault(),!n||!r)return;const d=[];i.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=o.get(h.id);if(g)switch(e.code){case Ct.Down:r.top<g.top&&d.push(h);break;case Ct.Up:r.top>g.top&&d.push(h);break;case Ct.Left:r.left>g.left&&d.push(h);break;case Ct.Right:r.left<g.left&&d.push(h);break}});const f=Bz({collisionRect:r,droppableRects:o,droppableContainers:d});let p=nR(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=um(k).some((T,R)=>l[R]!==T),j=kR(h,g),N=f8(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:Ju(C,S)}}}};function kR(e,t){return!uh(e)||!uh(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function f8(e,t){return!uh(e)||!uh(t)||!kR(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function vt({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 Pt({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 Lp({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 Ge({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 p8({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(Ge,{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(Ie,{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(Lp,{command:r.command.command,example:r.command.example}):null]})]})},r.title))})})}const oy={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."},ca={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 h8(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function m8({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:ca.emptyStateCleanTitle}),s.jsx("h2",{id:"overview-hero-title",className:"mt-2 text-2xl font-semibold tracking-tight text-foreground",children:oy.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(Ie,{to:`${n}/projects`,className:"shell-action shell-action--cta",children:ca.emptyStateCleanCTA})})]});const r=e.itemId?t[e.itemId]:void 0,o=(r==null?void 0:r.assignmentTitle)??"",i=oy[e.copyKey]??oy[e.kind],a=h8(i,{total:e.total,title:o}),l=r?g8(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:"What needs you today"}),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(Ie,{to:l,className:"shell-action shell-action--cta",children:["Open ",o||"assignment"]})})]})}function g8(e,t){return e.projectSlug?`${t}${e.href}`:e.href}const iy=["title","status","priority","assignee","dependencies","created","updated"],ed=24,SR=60;function x8(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Number.isInteger(t.w)&&t.w>=1&&t.w<=ed&&Number.isInteger(t.h)&&t.h>=1&&t.h<=SR}const y8={status:"all",priority:"all",assignee:"all",project:"all",activity:"all"},tS="2026-05-21T00:00:00Z";function ay(e,t,n){return{id:e,name:t,workspace:null,entityType:"assignment",config:{viewMode:"list",filters:{...y8,...n},sortField:"updated",sortDirection:"desc",listSectionVisibility:{collapsed:[]},kanbanColumnVisibility:{hidden:[]},tableColumnVisibility:{hidden:[]}},createdAt:tS,updatedAt:tS}}const hi={version:1,views:[ay("default-recently-updated","Recently updated",{}),ay("default-high-priority","High priority",{priority:"high"}),ay("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 NR(e,t){const n=We(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&&_u(a)===null;return r&&(!o||o==="all")&&!i&&!l}function CR(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?NR(e.config,t.slug):!1}}const ER=`syntaur.savedViews.cache.v${hi.version}`;let Il=b8(),Qi=null,gw=null;const kb=new Set,dh=new Set;let TR=0;function RR(){return++TR}function Sb(e){return e===TR}function b8(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(ER);if(!e)return null;const t=JSON.parse(e);return t.version!==hi.version?null:t}catch{return null}}function v8(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(ER,JSON.stringify(e))}catch{}}function AR(e){Il=e,gw=null,v8(e);for(const t of kb)t(e);for(const t of dh)t(null)}function w8(e){gw=e;for(const t of dh)t(e)}function PR(e){if(!e||typeof e!="object")return hi;const t=e;return t.version!==hi.version||!Array.isArray(t.views)||!t.dashboard?hi:t}function nS(){if(Qi)return Qi;const e=RR();return Qi=fetch("/api/saved-views").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=PR(t);return Sb(e)&&AR(n),Qi=null,Il??n}).catch(t=>{const n=t instanceof Error?t:new Error(String(t));return Sb(e)&&w8(n),Qi=null,Il??hi}),Qi}function xw(){const[e,t]=m.useState(()=>Il??hi),[n,r]=m.useState(()=>Il===null),[o,i]=m.useState(!1),[a,l]=m.useState(()=>gw);return m.useEffect(()=>{let f=!1;Il===null&&r(!0),nS().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 kb.add(p),dh.add(h),()=>{f=!0,kb.delete(p),dh.delete(h)}},[]),{file:e,loading:n,ready:o,error:a,refetch:()=>{Qi=null,r(!0),l(null),i(!1),nS()}}}function $d(){const{file:e,loading:t}=xw();return{views:e.views,loading:t}}function _R(){const{file:e,loading:t}=xw();return{layout:e.dashboard,loading:t}}function bi(e){const{file:t,loading:n,ready:r,error:o,refetch:i}=xw();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 gm(e,t,n){const r=RR(),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=PR(await o.json());return Sb(r)&&AR(i),i}function ql(e){return gm("POST","/api/saved-views",e)}function fh(e,t){return gm("PATCH",`/api/saved-views/${encodeURIComponent(e)}`,t)}function j8(e){return gm("DELETE",`/api/saved-views/${encodeURIComponent(e)}`)}function Nb(e){return gm("PUT","/api/dashboard",{slots:e})}const k8=["top","right","bottom","left"],vi=Math.min,_r=Math.max,ph=Math.round,op=Math.floor,Ks=e=>({x:e,y:e}),S8={left:"right",right:"left",bottom:"top",top:"bottom"};function Cb(e,t,n){return _r(e,vi(t,n))}function jo(e,t){return typeof e=="function"?e(t):e}function ko(e){return e.split("-")[0]}function bc(e){return e.split("-")[1]}function yw(e){return e==="x"?"y":"x"}function bw(e){return e==="y"?"height":"width"}function Hs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function vw(e){return yw(Hs(e))}function N8(e,t,n){n===void 0&&(n=!1);const r=bc(e),o=vw(e),i=bw(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=hh(a)),[a,hh(a)]}function C8(e){const t=hh(e);return[Eb(e),t,Eb(t)]}function Eb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rS=["left","right"],sS=["right","left"],E8=["top","bottom"],T8=["bottom","top"];function R8(e,t,n){switch(e){case"top":case"bottom":return n?t?sS:rS:t?rS:sS;case"left":case"right":return t?E8:T8;default:return[]}}function A8(e,t,n,r){const o=bc(e);let i=R8(ko(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(Eb)))),i}function hh(e){const t=ko(e);return S8[t]+e.slice(t.length)}function P8(e){return{top:0,right:0,bottom:0,left:0,...e}}function DR(e){return typeof e!="number"?P8(e):{top:e,right:e,bottom:e,left:e}}function mh(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 oS(e,t,n){let{reference:r,floating:o}=e;const i=Hs(t),a=vw(t),l=bw(a),d=ko(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(d){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(bc(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 _8(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:g=!1,padding:y=0}=jo(t,e),k=DR(y),b=l[g?h==="floating"?"reference":"floating":h],j=mh(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:d})),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},I=mh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:S,strategy:d}):N);return{top:(j.top-I.top+k.top)/C.y,bottom:(I.bottom-j.bottom+k.bottom)/C.y,left:(j.left-I.left+k.left)/C.x,right:(I.right-j.right+k.right)/C.x}}const D8=50,$8=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:_8},d=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:p,y:h}=oS(f,r,d),g=r,y=0;const k={};for(let w=0;w<i.length;w++){const b=i[w];if(!b)continue;const{name:j,fn:N}=b,{x:S,y:C,data:I,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],...I},T&&y<D8&&(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}=oS(f,g,d)),w=-1)}return{x:p,y:h,placement:g,strategy:o,middlewareData:k}},I8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:d}=t,{element:f,padding:p=0}=jo(e,t)||{};if(f==null)return{};const h=DR(p),g={x:n,y:r},y=vw(o),k=bw(y),w=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],I=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 D=C/2-I/2,_=R/2-w[k]/2-1,B=vi(h[j],_),$=vi(h[N],_),O=B,z=R-w[k]-$,A=R/2-w[k]/2+D,F=Cb(O,A,z),U=!d.arrow&&bc(o)!=null&&A!==F&&i.reference[k]/2-(A<O?B:$)-w[k]/2<0,H=U?A<O?A-O:A-z:0;return{[y]:g[y]+H,data:{[y]:F,centerOffset:A-F-H,...U&&{alignmentOffset:H}},reset:U}}}),M8=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:d,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:k="none",flipAlignment:w=!0,...b}=jo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const j=ko(o),N=Hs(l),S=ko(l)===l,C=await(d.isRTL==null?void 0:d.isRTL(f.floating)),I=g||(S||!w?[hh(l)]:C8(l)),T=k!=="none";!g&&T&&I.push(...A8(l,w,k,C));const R=[l,...I],D=await d.detectOverflow(t,b),_=[];let B=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&_.push(D[j]),h){const A=N8(o,a,C);_.push(D[A[0]],D[A[1]])}if(B=[...B,{placement:o,overflows:_}],!_.every(A=>A<=0)){var $,O;const A=((($=i.flip)==null?void 0:$.index)||0)+1,F=R[A];if(F&&(!(h==="alignment"?N!==Hs(F):!1)||B.every(L=>Hs(L.placement)===N?L.overflows[0]>0:!0)))return{data:{index:A,overflows:B},reset:{placement:F}};let U=(O=B.filter(H=>H.overflows[0]<=0).sort((H,L)=>H.overflows[1]-L.overflows[1])[0])==null?void 0:O.placement;if(!U)switch(y){case"bestFit":{var z;const H=(z=B.filter(L=>{if(T){const V=Hs(L.placement);return V===N||V==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(V=>V>0).reduce((V,M)=>V+M,0)]).sort((L,V)=>L[1]-V[1])[0])==null?void 0:z[0];H&&(U=H);break}case"initialPlacement":U=l;break}if(o!==U)return{reset:{placement:U}}}return{}}}};function iS(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aS(e){return k8.some(t=>e[t]>=0)}const L8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=jo(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=iS(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:aS(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=iS(a,n.floating);return{data:{escapedOffsets:l,escaped:aS(l)}}}default:return{}}}}},$R=new Set(["left","top"]);async function O8(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=ko(n),l=bc(n),d=Hs(n)==="y",f=$R.has(a)?-1:1,p=i&&d?-1:1,h=jo(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),d?{x:y*p,y:g*f}:{x:g*f,y:y*p}}const F8=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,d=await O8(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:i+d.y,data:{...d,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:d={fn:j=>{let{x:N,y:S}=j;return{x:N,y:S}}},...f}=jo(e,t),p={x:n,y:r},h=await i.detectOverflow(t,f),g=Hs(ko(o)),y=yw(g);let k=p[y],w=p[g];if(a){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",S=k+h[j],C=k-h[N];k=Cb(S,k,C)}if(l){const j=g==="y"?"top":"left",N=g==="y"?"bottom":"right",S=w+h[j],C=w-h[N];w=Cb(S,w,C)}const b=d.fn({...t,[y]:k,[g]:w});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:a,[g]:l}}}}}},B8=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:d=!0,crossAxis:f=!0}=jo(e,t),p={x:n,y:r},h=Hs(o),g=yw(h);let y=p[g],k=p[h];const w=jo(l,t),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+b.mainAxis,I=i.reference[g]+i.reference[S]-b.mainAxis;y<C?y=C:y>I&&(y=I)}if(f){var j,N;const S=g==="y"?"width":"height",C=$R.has(ko(o)),I=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<I?k=I:k>T&&(k=T)}return{[g]:y,[h]:k}}}},U8=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:d=()=>{},...f}=jo(e,t),p=await a.detectOverflow(t,f),h=ko(o),g=bc(o),y=Hs(o)==="y",{width:k,height:w}=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=w-p.top-p.bottom,S=k-p.left-p.right,C=vi(w-p[b],N),I=vi(k-p[j],S),T=!t.middlewareData.shift;let R=C,D=I;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(D=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(R=N),T&&!g){const B=_r(p.left,0),$=_r(p.right,0),O=_r(p.top,0),z=_r(p.bottom,0);y?D=k-2*(B!==0||$!==0?B+$:_r(p.left,p.right)):R=w-2*(O!==0||z!==0?O+z:_r(p.top,p.bottom))}await d({...t,availableWidth:D,availableHeight:R});const _=await a.getDimensions(l.floating);return k!==_.width||w!==_.height?{reset:{rects:!0}}:{}}}};function xm(){return typeof window<"u"}function vc(e){return IR(e)?(e.nodeName||"").toLowerCase():"#document"}function Lr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Js(e){var t;return(t=(IR(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function IR(e){return xm()?e instanceof Node||e instanceof Lr(e).Node:!1}function bs(e){return xm()?e instanceof Element||e instanceof Lr(e).Element:!1}function Co(e){return xm()?e instanceof HTMLElement||e instanceof Lr(e).HTMLElement:!1}function lS(e){return!xm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Lr(e).ShadowRoot}function Id(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=vs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function H8(e){return/^(table|td|th)$/.test(vc(e))}function ym(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const V8=/transform|translate|scale|rotate|perspective|filter/,W8=/paint|layout|strict|content/,Ki=e=>!!e&&e!=="none";let ly;function ww(e){const t=bs(e)?vs(e):e;return Ki(t.transform)||Ki(t.translate)||Ki(t.scale)||Ki(t.rotate)||Ki(t.perspective)||!jw()&&(Ki(t.backdropFilter)||Ki(t.filter))||V8.test(t.willChange||"")||W8.test(t.contain||"")}function q8(e){let t=wi(e);for(;Co(t)&&!Kl(t);){if(ww(t))return t;if(ym(t))return null;t=wi(t)}return null}function jw(){return ly==null&&(ly=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ly}function Kl(e){return/^(html|body|#document)$/.test(vc(e))}function vs(e){return Lr(e).getComputedStyle(e)}function bm(e){return bs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wi(e){if(vc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lS(e)&&e.host||Js(e);return lS(t)?t.host:t}function MR(e){const t=wi(e);return Kl(t)?e.ownerDocument?e.ownerDocument.body:e.body:Co(t)&&Id(t)?t:MR(t)}function td(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=MR(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=Lr(o);if(i){const l=Tb(a);return t.concat(a,a.visualViewport||[],Id(o)?o:[],l&&n?td(l):[])}else return t.concat(o,td(o,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function LR(e){const t=vs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Co(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=ph(n)!==i||ph(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function kw(e){return bs(e)?e:e.contextElement}function Ml(e){const t=kw(e);if(!Co(t))return Ks(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=LR(t);let a=(i?ph(n.width):n.width)/r,l=(i?ph(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const K8=Ks(0);function OR(e){const t=Lr(e);return!jw()||!t.visualViewport?K8:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function G8(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Lr(e)?!1:t}function ga(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=kw(e);let a=Ks(1);t&&(r?bs(r)&&(a=Ml(r)):a=Ml(e));const l=G8(i,n,r)?OR(i):Ks(0);let d=(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=Lr(i),y=r&&bs(r)?Lr(r):r;let k=g,w=Tb(k);for(;w&&r&&y!==k;){const b=Ml(w),j=w.getBoundingClientRect(),N=vs(w),S=j.left+(w.clientLeft+parseFloat(N.paddingLeft))*b.x,C=j.top+(w.clientTop+parseFloat(N.paddingTop))*b.y;d*=b.x,f*=b.y,p*=b.x,h*=b.y,d+=S,f+=C,k=Lr(w),w=Tb(k)}}return mh({width:p,height:h,x:d,y:f})}function vm(e,t){const n=bm(e).scrollLeft;return t?t.left+n:ga(Js(e)).left+n}function FR(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-vm(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Y8(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=Js(r),l=t?ym(t.floating):!1;if(r===a||l&&i)return n;let d={scrollLeft:0,scrollTop:0},f=Ks(1);const p=Ks(0),h=Co(r);if((h||!h&&!i)&&((vc(r)!=="body"||Id(a))&&(d=bm(r)),h)){const y=ga(r);f=Ml(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const g=a&&!h&&!i?FR(a,d):Ks(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+p.x+g.x,y:n.y*f.y-d.scrollTop*f.y+p.y+g.y}}function X8(e){return Array.from(e.getClientRects())}function Q8(e){const t=Js(e),n=bm(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+vm(e);const l=-n.scrollTop;return vs(r).direction==="rtl"&&(a+=_r(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const cS=25;function J8(e,t){const n=Lr(e),r=Js(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,d=0;if(o){i=o.width,a=o.height;const p=jw();(!p||p&&t==="fixed")&&(l=o.offsetLeft,d=o.offsetTop)}const f=vm(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<=cS&&(i-=k)}else f<=cS&&(i+=f);return{width:i,height:a,x:l,y:d}}function Z8(e,t){const n=ga(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Co(e)?Ml(e):Ks(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,d=o*i.x,f=r*i.y;return{width:a,height:l,x:d,y:f}}function uS(e,t,n){let r;if(t==="viewport")r=J8(e,n);else if(t==="document")r=Q8(Js(e));else if(bs(t))r=Z8(t,n);else{const o=OR(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return mh(r)}function zR(e,t){const n=wi(e);return n===t||!bs(n)||Kl(n)?!1:vs(n).position==="fixed"||zR(n,t)}function e7(e,t){const n=t.get(e);if(n)return n;let r=td(e,[],!1).filter(l=>bs(l)&&vc(l)!=="body"),o=null;const i=vs(e).position==="fixed";let a=i?wi(e):e;for(;bs(a)&&!Kl(a);){const l=vs(a),d=ww(a);!d&&l.position==="fixed"&&(o=null),(i?!d&&!o:!d&&l.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Id(a)&&!d&&zR(e,a))?r=r.filter(p=>p!==a):o=l,a=wi(a)}return t.set(e,r),r}function t7(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?ym(t)?[]:e7(t,this._c):[].concat(n),r],l=uS(t,a[0],o);let d=l.top,f=l.right,p=l.bottom,h=l.left;for(let g=1;g<a.length;g++){const y=uS(t,a[g],o);d=_r(y.top,d),f=vi(y.right,f),p=vi(y.bottom,p),h=_r(y.left,h)}return{width:f-h,height:p-d,x:h,y:d}}function n7(e){const{width:t,height:n}=LR(e);return{width:t,height:n}}function r7(e,t,n){const r=Co(t),o=Js(t),i=n==="fixed",a=ga(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const d=Ks(0);function f(){d.x=vm(o)}if(r||!r&&!i)if((vc(t)!=="body"||Id(o))&&(l=bm(t)),r){const y=ga(t,!0,i,t);d.x=y.x+t.clientLeft,d.y=y.y+t.clientTop}else o&&f();i&&!r&&o&&f();const p=o&&!r&&!i?FR(o,l):Ks(0),h=a.left+l.scrollLeft-d.x-p.x,g=a.top+l.scrollTop-d.y-p.y;return{x:h,y:g,width:a.width,height:a.height}}function cy(e){return vs(e).position==="static"}function dS(e,t){if(!Co(e)||vs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Js(e)===n&&(n=n.ownerDocument.body),n}function BR(e,t){const n=Lr(e);if(ym(e))return n;if(!Co(e)){let o=wi(e);for(;o&&!Kl(o);){if(bs(o)&&!cy(o))return o;o=wi(o)}return n}let r=dS(e,t);for(;r&&H8(r)&&cy(r);)r=dS(r,t);return r&&Kl(r)&&cy(r)&&!ww(r)?n:r||q8(e)||n}const s7=async function(e){const t=this.getOffsetParent||BR,n=this.getDimensions,r=await n(e.floating);return{reference:r7(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function o7(e){return vs(e).direction==="rtl"}const i7={convertOffsetParentRelativeRectToViewportRelativeRect:Y8,getDocumentElement:Js,getClippingRect:t7,getOffsetParent:BR,getElementRects:s7,getClientRects:X8,getDimensions:n7,getScale:Ml,isElement:bs,isRTL:o7};function UR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function a7(e,t){let n=null,r;const o=Js(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,d){l===void 0&&(l=!1),d===void 0&&(d=1),i();const f=e.getBoundingClientRect(),{left:p,top:h,width:g,height:y}=f;if(l||t(),!g||!y)return;const k=op(h),w=op(o.clientWidth-(p+g)),b=op(o.clientHeight-(h+y)),j=op(p),S={rootMargin:-k+"px "+-w+"px "+-b+"px "+-j+"px",threshold:_r(0,vi(1,d))||1};let C=!0;function I(T){const R=T[0].intersectionRatio;if(R!==d){if(!C)return a();R?a(!1,R):r=setTimeout(()=>{a(!1,1e-7)},1e3)}R===1&&!UR(f,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(I,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(I,S)}n.observe(e)}return a(!0),i}function l7(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:d=!1}=r,f=kw(e),p=o||i?[...f?td(f):[],...t?td(t):[]]:[];p.forEach(j=>{o&&j.addEventListener("scroll",n,{passive:!0}),i&&j.addEventListener("resize",n)});const h=f&&l?a7(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&&!d&&y.observe(f),t&&y.observe(t));let k,w=d?ga(e):null;d&&b();function b(){const j=ga(e);w&&!UR(w,j)&&n(),w=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,d&&cancelAnimationFrame(k)}}const c7=F8,u7=z8,d7=M8,f7=U8,p7=L8,fS=I8,h7=B8,m7=(e,t,n)=>{const r=new Map,o={platform:i7,...n},i={...o.platform,_c:r};return $8(e,t,{...o,platform:i})};var g7=typeof document<"u",x7=function(){},Op=g7?m.useLayoutEffect:x7;function gh(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(!gh(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)&&!gh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function HR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pS(e,t){const n=HR(e);return Math.round(t*n)/n}function uy(e){const t=m.useRef(e);return Op(()=>{t.current=e}),t}function y7(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:d,open:f}=e,[p,h]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,y]=m.useState(r);gh(g,r)||y(r);const[k,w]=m.useState(null),[b,j]=m.useState(null),N=m.useCallback(L=>{L!==T.current&&(T.current=L,w(L))},[]),S=m.useCallback(L=>{L!==R.current&&(R.current=L,j(L))},[]),C=i||k,I=a||b,T=m.useRef(null),R=m.useRef(null),D=m.useRef(p),_=d!=null,B=uy(d),$=uy(o),O=uy(f),z=m.useCallback(()=>{if(!T.current||!R.current)return;const L={placement:t,strategy:n,middleware:g};$.current&&(L.platform=$.current),m7(T.current,R.current,L).then(V=>{const M={...V,isPositioned:O.current!==!1};A.current&&!gh(D.current,M)&&(D.current=M,xo.flushSync(()=>{h(M)}))})},[g,t,n,$,O]);Op(()=>{f===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,h(L=>({...L,isPositioned:!1})))},[f]);const A=m.useRef(!1);Op(()=>(A.current=!0,()=>{A.current=!1}),[]),Op(()=>{if(C&&(T.current=C),I&&(R.current=I),C&&I){if(B.current)return B.current(C,I,z);z()}},[C,I,z,B,_]);const F=m.useMemo(()=>({reference:T,floating:R,setReference:N,setFloating:S}),[N,S]),U=m.useMemo(()=>({reference:C,floating:I}),[C,I]),H=m.useMemo(()=>{const L={position:n,left:0,top:0};if(!U.floating)return L;const V=pS(U.floating,p.x),M=pS(U.floating,p.y);return l?{...L,transform:"translate("+V+"px, "+M+"px)",...HR(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:M}},[n,l,U.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:z,refs:F,elements:U,floatingStyles:H}),[p,z,F,U,H])}const b7=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?fS({element:r.current,padding:o}).fn(n):{}:r?fS({element:r,padding:o}).fn(n):{}}}},v7=(e,t)=>{const n=c7(e);return{name:n.name,fn:n.fn,options:[e,t]}},w7=(e,t)=>{const n=u7(e);return{name:n.name,fn:n.fn,options:[e,t]}},j7=(e,t)=>({fn:h7(e).fn,options:[e,t]}),k7=(e,t)=>{const n=d7(e);return{name:n.name,fn:n.fn,options:[e,t]}},S7=(e,t)=>{const n=f7(e);return{name:n.name,fn:n.fn,options:[e,t]}},N7=(e,t)=>{const n=p7(e);return{name:n.name,fn:n.fn,options:[e,t]}},C7=(e,t)=>{const n=b7(e);return{name:n.name,fn:n.fn,options:[e,t]}};var E7="Arrow",VR=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(jn.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"})})});VR.displayName=E7;var T7=VR;function R7(e){const[t,n]=m.useState(void 0);return gi(()=>{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 d=i.borderBoxSize,f=Array.isArray(d)?d[0]:d;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 Sw="Popper",[WR,qR]=ka(Sw),[A7,KR]=WR(Sw),GR=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return s.jsx(A7,{scope:t,anchor:r,onAnchorChange:o,children:n})};GR.displayName=Sw;var YR="PopperAnchor",XR=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=KR(YR,n),a=m.useRef(null),l=Jn(t,a),d=m.useRef(null);return m.useEffect(()=>{const f=d.current;d.current=(r==null?void 0:r.current)||a.current,f!==d.current&&i.onAnchorChange(d.current)}),r?null:s.jsx(jn.div,{...o,ref:l})});XR.displayName=YR;var Nw="PopperContent",[P7,_7]=WR(Nw),QR=m.forwardRef((e,t)=>{var le,te,pe,be,Ee,Te;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:y="optimized",onPlaced:k,...w}=e,b=KR(Nw,n),[j,N]=m.useState(null),S=Jn(t,ke=>N(ke)),[C,I]=m.useState(null),T=R7(C),R=(T==null?void 0:T.width)??0,D=(T==null?void 0:T.height)??0,_=r+(i!=="center"?"-"+i:""),B=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(f)?f:[f],O=$.length>0,z={padding:B,boundary:$.filter($7),altBoundary:O},{refs:A,floatingStyles:F,placement:U,isPositioned:H,middlewareData:L}=y7({strategy:"fixed",placement:_,whileElementsMounted:(...ke)=>l7(...ke,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[v7({mainAxis:o+D,alignmentAxis:a}),d&&w7({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?j7():void 0,...z}),d&&k7({...z}),S7({...z,apply:({elements:ke,rects:Ue,availableWidth:oe,availableHeight:je})=>{const{width:Se,height:De}=Ue.reference,ze=ke.floating.style;ze.setProperty("--radix-popper-available-width",`${oe}px`),ze.setProperty("--radix-popper-available-height",`${je}px`),ze.setProperty("--radix-popper-anchor-width",`${Se}px`),ze.setProperty("--radix-popper-anchor-height",`${De}px`)}}),C&&C7({element:C,padding:l}),I7({arrowWidth:R,arrowHeight:D}),g&&N7({strategy:"referenceHidden",...z})]}),[V,M]=eA(U),W=ha(k);gi(()=>{H&&(W==null||W())},[H,W]);const Y=(le=L.arrow)==null?void 0:le.x,q=(te=L.arrow)==null?void 0:te.y,J=((pe=L.arrow)==null?void 0:pe.centerOffset)!==0,[ne,Q]=m.useState();return gi(()=>{j&&Q(window.getComputedStyle(j).zIndex)},[j]),s.jsx("div",{ref:A.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:H?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(be=L.transformOrigin)==null?void 0:be.x,(Ee=L.transformOrigin)==null?void 0:Ee.y].join(" "),...((Te=L.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(P7,{scope:n,placedSide:V,onArrowChange:I,arrowX:Y,arrowY:q,shouldHideArrow:J,children:s.jsx(jn.div,{"data-side":V,"data-align":M,...w,ref:S,style:{...w.style,animation:H?void 0:"none"}})})})});QR.displayName=Nw;var JR="PopperArrow",D7={top:"bottom",right:"left",bottom:"top",left:"right"},ZR=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=_7(JR,r),a=D7[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(T7,{...o,ref:n,style:{...o.style,display:"block"}})})});ZR.displayName=JR;function $7(e){return e!==null}var I7=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,d=a?0:e.arrowHeight,[f,p]=eA(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)+d/2;let k="",w="";return f==="bottom"?(k=a?h:`${g}px`,w=`${-d}px`):f==="top"?(k=a?h:`${g}px`,w=`${r.floating.height+d}px`):f==="right"?(k=`${-d}px`,w=a?h:`${y}px`):f==="left"&&(k=`${r.floating.width+d}px`,w=a?h:`${y}px`),{data:{x:k,y:w}}}});function eA(e){const[t,n="center"]=e.split("-");return[t,n]}var M7=GR,L7=XR,O7=QR,F7=ZR,z7=Symbol("radix.slottable");function B7(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=z7,t}var U7=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"}),H7="VisuallyHidden",tA=m.forwardRef((e,t)=>s.jsx(jn.span,{...e,ref:t,style:{...U7,...e.style}}));tA.displayName=H7;var V7=tA,[wm]=ka("Tooltip",[qR]),jm=qR(),nA="TooltipProvider",W7=700,Rb="tooltip.open",[q7,Cw]=wm(nA),rA=e=>{const{__scopeTooltip:t,delayDuration:n=W7,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=m.useRef(!0),l=m.useRef(!1),d=m.useRef(0);return m.useEffect(()=>{const f=d.current;return()=>window.clearTimeout(f)},[]),s.jsx(q7,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(d.current),a.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(f=>{l.current=f},[]),disableHoverableContent:o,children:i})};rA.displayName=nA;var nd="Tooltip",[K7,Md]=wm(nd),sA=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,d=Cw(nd,e.__scopeTooltip),f=jm(t),[p,h]=m.useState(null),g=Al(),y=m.useRef(0),k=a??d.disableHoverableContent,w=l??d.delayDuration,b=m.useRef(!1),[j,N]=nm({prop:r,defaultProp:o??!1,onChange:R=>{R?(d.onOpen(),document.dispatchEvent(new CustomEvent(Rb))):d.onClose(),i==null||i(R)},caller:nd}),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]),I=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},w)},[w,N]);return m.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),s.jsx(M7,{...f,children:s.jsx(K7,{scope:t,contentId:g,open:j,stateAttribute:S,trigger:p,onTriggerChange:h,onTriggerEnter:m.useCallback(()=>{d.isOpenDelayedRef.current?T():C()},[d.isOpenDelayedRef,T,C]),onTriggerLeave:m.useCallback(()=>{k?I():(window.clearTimeout(y.current),y.current=0)},[I,k]),onOpen:C,onClose:I,disableHoverableContent:k,children:n})})};sA.displayName=nd;var Ab="TooltipTrigger",oA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Md(Ab,n),i=Cw(Ab,n),a=jm(n),l=m.useRef(null),d=Jn(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(L7,{asChild:!0,...a,children:s.jsx(jn.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:d,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)})})});oA.displayName=Ab;var Ew="TooltipPortal",[G7,Y7]=wm(Ew,{forceMount:void 0}),iA=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Md(Ew,t);return s.jsx(G7,{scope:t,forceMount:n,children:s.jsx(Sa,{present:n||i.open,children:s.jsx(qv,{asChild:!0,container:o,children:r})})})};iA.displayName=Ew;var Gl="TooltipContent",aA=m.forwardRef((e,t)=>{const n=Y7(Gl,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=Md(Gl,e.__scopeTooltip);return s.jsx(Sa,{present:r||a.open,children:a.disableHoverableContent?s.jsx(lA,{side:o,...i,ref:t}):s.jsx(X7,{side:o,...i,ref:t})})}),X7=m.forwardRef((e,t)=>{const n=Md(Gl,e.__scopeTooltip),r=Cw(Gl,e.__scopeTooltip),o=m.useRef(null),i=Jn(t,o),[a,l]=m.useState(null),{trigger:d,onClose:f}=n,p=o.current,{onPointerInTransitChange:h}=r,g=m.useCallback(()=>{l(null),h(!1)},[h]),y=m.useCallback((k,w)=>{const b=k.currentTarget,j={x:k.clientX,y:k.clientY},N=tU(j,b.getBoundingClientRect()),S=nU(j,N),C=rU(w.getBoundingClientRect()),I=oU([...S,...C]);l(I),h(!0)},[h]);return m.useEffect(()=>()=>g(),[g]),m.useEffect(()=>{if(d&&p){const k=b=>y(b,p),w=b=>y(b,d);return d.addEventListener("pointerleave",k),p.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",k),p.removeEventListener("pointerleave",w)}}},[d,p,y,g]),m.useEffect(()=>{if(a){const k=w=>{const b=w.target,j={x:w.clientX,y:w.clientY},N=(d==null?void 0:d.contains(b))||(p==null?void 0:p.contains(b)),S=!sU(j,a);N?g():S&&(g(),f())};return document.addEventListener("pointermove",k),()=>document.removeEventListener("pointermove",k)}},[d,p,a,f,g]),s.jsx(lA,{...e,ref:i})}),[Q7,J7]=wm(nd,{isInside:!1}),Z7=B7("TooltipContent"),lA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,d=Md(Gl,n),f=jm(n),{onClose:p}=d;return m.useEffect(()=>(document.addEventListener(Rb,p),()=>document.removeEventListener(Rb,p)),[p]),m.useEffect(()=>{if(d.trigger){const h=g=>{const y=g.target;y!=null&&y.contains(d.trigger)&&p()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[d.trigger,p]),s.jsx(Wv,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:p,children:s.jsxs(O7,{"data-state":d.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(Z7,{children:r}),s.jsx(Q7,{scope:n,isInside:!0,children:s.jsx(V7,{id:d.contentId,role:"tooltip",children:o||r})})]})})});aA.displayName=Gl;var cA="TooltipArrow",eU=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=jm(n);return J7(cA,n).isInside?null:s.jsx(F7,{...o,...r,ref:t})});eU.displayName=cA;function tU(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 nU(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 rU(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 sU(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],d=t[a],f=l.x,p=l.y,h=d.x,g=d.y;p>r!=g>r&&n<(h-f)*(r-p)/(g-p)+f&&(o=!o)}return o}function oU(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),iU(t)}function iU(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 aU=rA,lU=sA,cU=oA,uU=iA,uA=aA;const ua=aU,Dr=lU,$r=cU,mr=m.forwardRef(({className:e,sideOffset:t=4,...n},r)=>s.jsx(uU,{children:s.jsx(uA,{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})}));mr.displayName=uA.displayName;function Tw({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 d(p){a.current&&!a.current.contains(p.target)&&r(!1)}function f(p){p.key==="Escape"&&r(!1)}return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[n]),e.length===0)return null;function l(d,f){const p=d.icon,h=Ne("flex w-full items-center gap-2 px-3 py-1.5 text-sm text-left transition",f&&"pl-8",d.disabled?"opacity-50 cursor-not-allowed":d.destructive?"text-destructive hover:bg-destructive/10":"hover:bg-foreground/5"),g=f?d.active?s.jsx(Or,{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:d.label})]});if(d.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 d.disabledReason?s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:k}),s.jsx(mr,{side:"left",children:d.disabledReason})]},d.key):s.jsx("div",{children:k},d.key)}return d.href?s.jsx(Ie,{to:d.href,className:h,onClick:()=>r(!1),children:y},d.key):s.jsx("button",{type:"button",className:h,onClick:()=>{var k;(k=d.onSelect)==null||k.call(d),r(!1)},children:y},d.key)}return s.jsxs("div",{className:"relative",ref:a,children:[s.jsx("button",{type:"button",onClick:()=>r(d=>!d),className:"shell-action",title:"More actions","aria-haspopup":"true","aria-expanded":n,children:s.jsx(DL,{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(ua,{delayDuration:200,children:e.map(d=>{if(d.submenu&&d.submenu.length>0){const f=d.icon,p=o===d.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:d.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:d.label}),p?s.jsx(br,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):s.jsx(WE,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"})]}),p?d.submenu.map(h=>l(h,!0)):null]},d.key)}return l(d,!1)})})})]})}function hS(e){const t=Date.parse(e);return Number.isNaN(t)?!1:Date.now()-t>10080*60*1e3}const dU={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 fU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,0,0,0,0).getTime()}function pU(e){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r,23,59,59,999).getTime()}function hU(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=dU[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<fU(i)||a&&o>pU(a))}function mU(e,t,n={}){const{workspace:r,search:o,includeArchived:i}=n;if(e.archived===!0&&!i)return!1;const a=We(t.status),l=We(t.priority),d=We(t.type),f=We(t.assignee),p=We(t.project),h=We(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)||d.length&&!d.includes(e.type??"")||g==="stale"&&!hS(e.updated)||g==="fresh"&&hS(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(!hU(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 rd(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}const mS={critical:0,high:1,medium:2,low:3};function ip(e){return Date.parse(e??"")||0}function Ld(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=(mS[o.priority]??99)-(mS[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=ip(o.created)-ip(i.created);break;case"updated":a=ip(o.updated)-ip(i.updated);break}return n==="asc"?a:-a})}function gU(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 dA(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 d=gU(l);return t.predicate(d,a)})}const km={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 Sm(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 xU(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 Pb(e){const t=[],n=new Map;for(const r of Object.keys(km))n.set(r,"built-in");for(const r of Object.keys(Jh))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=Sm(i==="attestation"?{name:o,type:i}:{name:o,type:i}).registryKeys,d=l.find(f=>n.has(f));if(d!==void 0){const f=n.get(d);f==="built-in"?t.push(`fact "${o}": exported field "${d}" 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 "${d}" collides with fact "${f}"`);continue}for(const f of l)n.set(f,o)}return t}function yU(e){const t=new Set([...Object.keys(km),...Object.keys(Jh)]),n=[];for(const r of e){const o=Sm(r).registryKeys;if(!o.some(i=>t.has(i))){for(const i of o)t.add(i);n.push(r)}}return n}function fA(e,t){const n=Sm(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 Rw(e){const t={...km};for(const n of e)fA(t,n);return t}function pA(e){const t={...Jh};for(const n of e)fA(t,n);return t}function hA(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=Sm(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 Rt({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 Yl='a, button, input, select, textarea, [contenteditable="true"], [role="button"], [data-no-drag]';function Nm({columns:e,items:t,getItemId:n,getColumnId:r,renderCard:o,canDrop:i,onMove:a,getExternalDragData:l,onCardContextMenu:d,emptyMessage:f="No cards in this column.",hiddenColumnIds:p,onHideColumn:h,compact:g=!1,dragDisabled:y=!1}){const k=m.useMemo(()=>new Set(p??[]),[p]),w=m.useMemo(()=>e.filter(A=>!k.has(A.id)),[e,k]),b=m.useMemo(()=>e.filter(A=>k.has(A.id)),[e,k]),[j,N]=m.useState(null),[S,C]=m.useState(null),I=m.useRef(null),T=m.useMemo(()=>new Map(t.map(A=>[n(A),A])),[n,t]),R=m.useMemo(()=>w.map(A=>({column:A,items:t.filter(F=>r(F)===A.id)})),[w,r,t]),D=j?T.get(j)??null:null;function _(A){if(!D)return{allowed:!1};const F=r(D);return(i==null?void 0:i({item:D,fromColumnId:F,toColumnId:A}))??{allowed:!0}}function B(){N(null),C(null)}function $(A,F,U){if(y)return;const H=(l==null?void 0:l(F))??null;!a&&!H||(A.dataTransfer.effectAllowed="move",A.dataTransfer.setData("text/plain",U),H&&A.dataTransfer.setData("application/json",JSON.stringify(H)),a&&N(U))}function O(A,F,U){y||!a||!D||!_(F).allowed||(A.preventDefault(),A.dataTransfer.dropEffect="move",C(L=>(L==null?void 0:L.columnId)===F&&L.index===U?L:{columnId:F,index:U}))}async function z(A,F,U){var W;if(A.preventDefault(),y||!a||!D){B();return}const H=r(D),V=(((W=R.find(Y=>Y.column.id===H))==null?void 0:W.items)??[]).findIndex(Y=>n(Y)===n(D));if(!_(F).allowed||V<0){B();return}if(H===F&&(U===V||U===V+1)){B();return}try{await a({item:D,fromColumnId:H,toColumnId:F,fromIndex:V,toIndex:U})}finally{B()}}return s.jsxs("div",{className:"relative overflow-x-auto pb-2",style:{scrollbarColor:"oklch(var(--border)) transparent",scrollbarWidth:"thin"},children:[b.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:"}),b.map(A=>s.jsxs("button",{type:"button",onClick:()=>h(A.id),className:"rounded-full border border-dashed border-border/60 px-2 py-0.5 hover:border-border hover:text-foreground",title:`Restore "${A.title}" column`,children:[A.title," ×"]},A.id))]}):null,s.jsx("div",{className:Ne("grid min-w-max grid-flow-col gap-4",g?"auto-cols-[minmax(240px,280px)]":"auto-cols-[minmax(300px,360px)]"),children:R.map(({column:A,items:F})=>{const U=_(A.id),H=(S==null?void 0:S.columnId)===A.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",D&&!U.allowed?"border-dashed opacity-65":"",D&&U.allowed?"border-primary/30 bg-accent/30":"",H?"ring-2 ring-ring/30":""),title:D&&!U.allowed?U.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:A.title}),A.description&&!g?s.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:A.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:F.length}),h?s.jsx("button",{type:"button",onClick:()=>h(A.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 "${A.title}" column`,"aria-label":`Hide column ${A.title}`,children:"×"}):null]})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-3",onDragOver:L=>O(L,A.id,F.length),onDrop:L=>z(L,A.id,F.length),children:[F.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(A):f}):s.jsx(bU,{active:(S==null?void 0:S.columnId)===A.id&&S.index===0,disabled:!!D&&!U.allowed,children:typeof f=="function"?f(A):f}):null,F.map((L,V)=>{const M=n(L),W=j===M;return s.jsxs(m.Fragment,{children:[s.jsx("div",{className:Ne("h-2 rounded-full transition",(S==null?void 0:S.columnId)===A.id&&S.index===V?"bg-primary/70":"bg-transparent"),onDragOver:Y=>O(Y,A.id,V),onDrop:Y=>z(Y,A.id,V)}),s.jsx("div",{draggable:!y&&!!(a||l),onMouseDown:Y=>{I.current=Y.target},onDragStart:Y=>{const q=I.current;if(q!=null&&q.closest(Yl)){Y.preventDefault();return}$(Y,L,M)},onDragEnd:B,onContextMenu:Y=>{if(!d)return;const q=Y.target;q!=null&&q.closest(Yl)||d(L,Y)},className:Ne("transition",!y&&(a||l)?"cursor-grab active:cursor-grabbing":"",W?"scale-[0.98] opacity-50":""),children:o(L,{dragging:W})})]},M)}),F.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",(S==null?void 0:S.columnId)===A.id&&S.index===F.length?"border-primary/50 bg-primary/10 text-foreground":"border-border/60",D&&!U.allowed?"opacity-40":""),children:"Drop here to place at the end"}):null]})]},A.id)})})]})}function bU({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 bo="border-status-pending-foreground/30 bg-status-pending text-status-pending-foreground",Ll="border-status-in-progress-foreground/30 bg-status-in-progress text-status-in-progress-foreground",mA="border-status-blocked-foreground/30 bg-status-blocked text-status-blocked-foreground",_b="border-status-review-foreground/30 bg-status-review text-status-review-foreground",gA="border-status-completed-foreground/30 bg-status-completed text-status-completed-foreground",xA="border-status-failed-foreground/30 bg-status-failed text-status-failed-foreground",yA="border-status-archived-foreground/30 bg-status-archived text-status-archived-foreground",Fp=bo,vU={draft:bo,pending:bo,ready_for_planning:bo,ready_to_implement:Ll,in_progress:Ll,blocked:mA,review:_b,code_review:_b,completed:gA,failed:xA,active:Ll,stopped:bo,archived:yA};function wU(e){return vU[e]??Fp}const jU={slate:Fp,gray:Fp,grey:Fp};function bA(e){return e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function kU(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 SU(e,t){const n=t==null?void 0:t.trim();if(n)if(n.startsWith("#")){const r=kU(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=jU[n.toLowerCase()];if(r)return{className:r}}return{className:wU(e)}}function sd(e,t){const n=e.find(i=>i.id===t),{className:r,style:o}=SU(t,n==null?void 0:n.color);return{label:(n==null?void 0:n.label)??bA(t),className:r,style:o,iconName:n==null?void 0:n.icon}}function Db(e){return e?!!e.terminal||e.id==="completed"||e.id==="failed":!1}function vA(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)??bA(a),terminal:Db(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 wA={draft:{label:"Draft",description:"Just-created stub; not yet shaped.",className:bo,icon:uc},pending:{label:"Pending",description:"Waiting to start or waiting on dependencies.",className:bo,icon:EL},ready_for_planning:{label:"Ready for Planning",description:"Objective and acceptance criteria written; awaiting a plan.",className:bo,icon:KE},ready_to_implement:{label:"Ready to Implement",description:"Plan written and approved; ready to start coding.",className:Ll,icon:QL},in_progress:{label:"In Progress",description:"Actively being worked on.",className:Ll,icon:Av},blocked:{label:"Blocked",description:"Blocked by an explicit obstacle that needs intervention.",className:mA,icon:Zp},review:{label:"Review",description:"Ready for inspection or approval.",className:_b,icon:e4},completed:{label:"Completed",description:"Finished successfully.",className:gA,icon:Cv},failed:{label:"Failed",description:"Could not be completed as planned.",className:xA,icon:Zp},active:{label:"Active",description:"The project has active or review work in flight.",className:Ll,icon:ab},stopped:{label:"Stopped",description:"Session ended without completing.",className:bo,icon:NL},archived:{label:"Archived",description:"Hidden from normal views; restorable from the Archive page.",className:yA,icon:ab}},jA="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 $b(e){var t;return((t=wA[e])==null?void 0:t.icon)??ab}function wn({status:e,className:t,showIcon:n=!0,progress:r}){var y;const o=Ns(),i=sd(o.statuses,e),a=$b(e),l=i.label,d=((y=o.statuses.find(k=>k.id===e))==null?void 0:y.description)??Od(e),f=r&&r.total>0,p=f?Math.min(1,Math.max(0,r.checked/r.total)):0,h=f?`${l} — ${d} (${r.checked}/${r.total} criteria)`:`${l} — ${d}`,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(jA,i.className,t),style:i.style,children:[g,s.jsx("span",{className:"min-w-0 truncate",children:l})]})}function Od(e){var t;return((t=wA[e])==null?void 0:t.description)??`Status: ${e}`}function Na({type:e,className:t,compact:n=!1}){const r=Td();if(!e)return null;const o=D6(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 Fd(e){if(navigator.clipboard&&typeof navigator.clipboard.writeText=="function")try{return await navigator.clipboard.writeText(e),!0}catch{}return NU(e)}function NU(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 Qr({value:e,label:t,disabled:n=!1,disabledReason:r,onError:o}){const[i,a]=m.useState(!1);async function l(){n||(await Fd(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(eh,{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(Or,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(eh,{className:"h-3 w-3","aria-hidden":"true"})})}function CU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function EU({items:e,statusOrder:t,sortField:n,sortDirection:r,listSectionVisibility:o,compact:i=!1}){const a=Ns(),[l,d]=m.useState(()=>new Set(o.collapsed));m.useEffect(()=>{d(new Set(o.collapsed))},[o]);const f=p=>{d(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=Ld(e.filter(k=>k.status===p),n,r);if(h.length===0)return null;const g=!l.has(p),y=xi(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(br,{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 w=CU(k);return s.jsx("li",{children:s.jsxs(Ie,{to:w,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:qn(k.updated)})]})},`${k.projectSlug??"standalone"}:${k.id}`)})})]},p)})})}function TU(e){return e.projectSlug===null?`/assignments/${e.id}`:`${e.projectWorkspace?`/w/${e.projectWorkspace}`:""}/projects/${e.projectSlug}/assignments/${e.slug}`}function RU({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=Ld(e,t,n),d=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",d),children:"Assignment"}):null,a("status")?s.jsx("th",{className:Ne("font-medium",d),children:"Status"}):null,a("priority")?s.jsx("th",{className:Ne("font-medium",d),children:"Priority"}):null,a("assignee")?s.jsx("th",{className:Ne("font-medium",d),children:"Assignee"}):null,a("dependencies")?s.jsx("th",{className:Ne("font-medium",d),children:"Dependencies"}):null,a("created")?s.jsx("th",{className:Ne("font-medium",d),children:"Created"}):null,a("updated")?s.jsx("th",{className:Ne("font-medium",d),children:"Updated"}):null]})}),s.jsx("tbody",{children:l.map(p=>{const h=TU(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:d,children:[s.jsx(Ie,{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:d,children:s.jsx(wn,{status:p.status,className:"max-w-[150px]"})}):null,a("priority")?s.jsx("td",{className:Ne("capitalize text-muted-foreground",d),children:p.priority}):null,a("assignee")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:p.assignee??"Unassigned"}):null,a("dependencies")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:p.dependsOn.length}):null,a("created")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:qn(p.created)}):null,a("updated")?s.jsx("td",{className:Ne("text-muted-foreground",d),children:qn(p.updated)}):null]},g)})})]})})}function kA({view:e,compact:t,emptyDescription:n}){const{data:r,loading:o,error:i}=Gh(),a=Ns(),l=m.useMemo(()=>a.order.map(p=>({id:p,title:xi(a,p),description:Od(p)})),[a]),d=m.useMemo(()=>pA(a.factDeclarations),[a.factDeclarations]),f=m.useMemo(()=>{if(!r)return[];const p=e.config.filters.query??Pu(e.config.filters);let h=null;p.trim()!==""&&(h=Wl(p,d).query);const g=dA(r.assignments,h,{workspace:e.workspace});return Ld(g,e.config.sortField,e.config.sortDirection)},[r,e,d]);if(o&&!r)return s.jsx(vt,{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(Rt,{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(Nm,{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(AU,{item:p}):s.jsx(PU,{item:p})});case"list":return s.jsx(EU,{items:f,statusOrder:a.order,sortField:e.config.sortField,sortDirection:e.config.sortDirection,listSectionVisibility:e.config.listSectionVisibility,compact:t});case"table":return s.jsx(RU,{items:f,sortField:e.config.sortField,sortDirection:e.config.sortDirection,tableColumnVisibility:e.config.tableColumnVisibility,compact:t})}}function AU({item:e}){const t=rd(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(Ie,{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(wn,{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:qn(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(Qr,{value:e.id})]}):null]})}function PU({item:e}){const t=rd(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(Ie,{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(wn,{status:e.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[s.jsx(Na,{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:qn(e.updated)})]})]})}function _U({viewId:e,onPickAnother:t}){const{view:n,loading:r,error:o,refetch:i}=bi(e);return r?s.jsx(vt,{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(kA,{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 SA({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:ca.recentSessionsEmptyTitle}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:ca.recentSessionsEmptyHint})]}):s.jsx("ul",{className:"divide-y divide-border/40",children:e.map(t=>s.jsx("li",{children:s.jsx(DU,{session:t})},t.sessionId))})]})}function DU({session:e}){const t=pn(),[n,r]=m.useState(!1),o=$U(e,t),i=IU(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(Ie,{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," · ",a2(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:ca.recentSessionsCopyFallbackHint})]}):null]}),s.jsx(Qr,{value:e.path,label:ca.recentSessionsCopyPathLabel,disabled:a,disabledReason:ca.recentSessionsCopyPathDisabled,onError:()=>r(!0)})]})}function $U(e,t){return e.projectSlug&&e.assignmentSlug?`${t}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`:(!e.projectSlug&&e.assignmentSlug,"/agent-sessions")}function IU(e){return e.assignmentSlug&&e.projectSlug?`${e.projectSlug}/${e.assignmentSlug}`:e.assignmentSlug?`standalone/${e.assignmentSlug}`:"standalone"}const MU={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 Ji(e){if(!e)return 0;const t=Date.parse(e);return Number.isNaN(t)?0:t}function LU(e,t,n=Date.now()){const r=Ji(e);if(t.preset){const a=MU[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 OU(e,t,n=Date.now()){const{dateRange:r,project:o,agent:i,sessionStatus:a}=t,l=new Set(o??[]),d=new Set(i??[]),f=new Set(a??[]);return e.filter(p=>{if(r&&!LU(p.started,r,n))return!1;if(l.size>0){const h=p.projectSlug??"__standalone__";if(!l.has(h))return!1}if(d.size>0&&!Array.from(d).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 FU(e,t,n){return[...e].sort((o,i)=>{let a=0;switch(t){case"started":a=Ji(o.started)-Ji(i.started);break;case"lastActivity":a=Ji(o.updatedAt)-Ji(i.updatedAt);break;case"projectName":{const l=o.projectSlug??"",d=i.projectSlug??"";a=l.localeCompare(d);break}case"agentName":a=o.agent.localeCompare(i.agent);break;default:a=Ji(o.started)-Ji(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 BU({view:e,emptyDescription:t}){const{data:n,loading:r,error:o}=Yh(),i=m.useMemo(()=>{if(!n)return[];const a=n.sessions??[],{config:l}=e,d=l.filters,f={dateRange:d.dateRange?{...d.dateRange,field:"started"}:void 0,project:We(d.project),agent:We(d.agent),sessionStatus:We(d.sessionStatus),limit:l.limit};let p=OU(a,f);return p=FU(p,l.sortField,l.sortDirection),p=zU(p,l.limit),p},[n,e]);return r&&!n?s.jsx(vt,{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(Rt,{title:"No sessions match this view.",description:t??"Adjust the view's filters to surface different sessions."}):s.jsx(SA,{sessions:i})}function UU({activeViewId:e,onSelectView:t,onCreateNew:n}){const{views:r,loading:o}=$d(),[i,a]=m.useState(!1),l=m.useRef(null),d=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(br,{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(Or,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),s.jsx("span",{children:"All sessions"})]}),d.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-1 border-t border-border/40"}),d.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(Or,{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($t,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),s.jsx("span",{children:"Create new view…"})]})]})]})}const HU={__unassigned__:"Unassigned",__standalone__:"No project"};function bn({options:e,value:t,onChange:n,allLabel:r="Any",className:o,disabled:i,ariaLabel:a}){const[l,d]=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:HU[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)&&d(!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 w(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,I=S.findIndex(R=>R===C);N.key==="ArrowDown"?(N.preventDefault(),b(I<0?0:I+1)):N.key==="ArrowUp"?(N.preventDefault(),b(I<0?g.length-1:I-1)):N.key==="Home"?(N.preventDefault(),b(0)):N.key==="End"?(N.preventDefault(),b(g.length-1)):N.key==="Escape"&&(N.preventDefault(),d(!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:()=>d(N=>!N),onKeyDown:N=>{!l&&(N.key==="ArrowDown"||N.key==="ArrowUp")&&(N.preventDefault(),d(!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(br,{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:I=>{h.current[S]=I},type:"button",role:"menuitemcheckbox","aria-checked":C,tabIndex:-1,onClick:()=>w(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(Or,{className:"h-3 w-3"}):null}),s.jsx("span",{className:"truncate",children:N.label})]},N.value)})]}):null]})}const gS={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"},VU=["updated","created"];function Cm({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",d=!!(e&&!e.preset&&(e.from||e.to)),[f,p]=m.useState(d);m.useEffect(()=>p(d),[d]),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}: ${gS[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 w(){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(br,{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:VU.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(dy,{label:"Any date",selected:!h,onClick:w}),i6.map(j=>s.jsx(dy,{label:gS[j],selected:(e==null?void 0:e.preset)===j,onClick:()=>k(j)},j)),s.jsx(dy,{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 dy({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(Or,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}):null]})}const WU=new Set(["status","type","priority","assignee","project","tags","activity","dateRange","search","query","sessionStatus","agent"]);function qU(e,t){const n={};for(const[r,o]of Object.entries(e))WU.has(r)||(n[r]=o);return{...n,...t}}function xh(e,t,n){return{...e,viewMode:t.viewMode,filters:qU(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 KU(e,t){var g,y;const n={},r=We(e.status);r.length&&(n.status=r);const o=We(e.type);o.length&&(n.type=o);const i=We(e.priority);i.length&&(n.priority=i);const a=We(e.assignee);a.length&&(n.assignee=a);const l=We(e.tags);if(l.length&&(n.tags=l),t&&t!=="all")n.project=[t];else{const k=We(e.project);k.length&&(n.project=k)}e.activity&&e.activity!=="all"&&(n.activity=e.activity);const d=We(e.sessionStatus);d.length&&(n.sessionStatus=d);const f=We(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 Xl(e){const t={viewMode:e.state.viewMode,filters:KU(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 ul={viewMode:"kanban",sortField:"updated",sortDirection:"desc"},ap={sortField:"started",sortDirection:"desc"};function NA(e,t){const{config:n}=Xl({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 Aw(e,t){const{config:n}=Xl({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 da(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 Em(e){return e?{field:e.field,preset:e.preset??"",from:e.from??"",to:e.to??""}:null}function CA(e,t){var r,o,i,a,l,d,f,p,h,g,y,k,w,b,j;const{config:n}=e;if((r=t.setViewMode)==null||r.call(t,n.viewMode),(o=t.setStatusFilter)==null||o.call(t,We(n.filters.status)),(i=t.setTypeFilter)==null||i.call(t,We(n.filters.type)),(a=t.setPriorityFilter)==null||a.call(t,We(n.filters.priority)),(l=t.setAssigneeFilter)==null||l.call(t,We(n.filters.assignee)),(d=t.setProjectFilter)==null||d.call(t,We(n.filters.project)),(f=t.setTagsFilter)==null||f.call(t,We(n.filters.tags)),(p=t.setDateRange)==null||p.call(t,Em(n.filters.dateRange)),(h=t.setSearch)==null||h.call(t,n.filters.search??""),(g=t.setQuery)==null||g.call(t,n.filters.query??Pu(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),(w=t.setListSectionVisibility)==null||w.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 zp(e){return e?`/w/${e}/views`:"/views"}function EA(e){return`${zp(e.workspace)}/${encodeURIComponent(e.id)}`}function TA(e){const t=e.workspace?`/w/${e.workspace}`:"",n=We(e.config.filters.project);return n.length===1&&n[0]!=="__standalone__"&&NR(e.config,n[0])?`${t}/projects/${n[0]}?tab=assignments&loadView=${encodeURIComponent(e.id)}`:`${t}/assignments?loadView=${encodeURIComponent(e.id)}`}const GU=["critical","high","medium","low"],YU={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 XU(e){if(e.preset)return`${e.field} ${YU[e.preset]??e.preset}`;const t=e.from??"…",n=e.to??"…";return`${e.field} ${t}→${n}`}function RA(e){var o,i;const t=(o=e.query)==null?void 0:o.trim();if(t&&_u(t)===null)return`query: ${t}`;const n=[];for(const a of["status","priority","type","assignee","project","tags"]){const l=We(e[a]);l.length&&n.push(`${a}=${l.join(", ")}`)}e.activity&&e.activity!=="all"&&n.push(`activity=${e.activity}`),e.dateRange&&n.push(XU(e.dateRange));const r=(i=e.search)==null?void 0:i.trim();return r&&n.push(`search="${r}"`),n.join(" · ")||"no filters"}const xS=80,QU=["started","lastActivity","projectName","agentName"],JU={started:"Start time",lastActivity:"Last updated",projectName:"Project",agentName:"Agent"},ZU=[{value:"active",label:"Active"},{value:"ended",label:"Ended"},{value:"tracked",label:"Tracked"},{value:"untracked",label:"Untracked"}];function AA({open:e,onOpenChange:t,initialView:n,onSubmit:r}){const o=!!n,{data:i}=Qs(),{data:a}=Yh(),[l,d]=m.useState(""),[f,p]=m.useState([]),[h,g]=m.useState([]),[y,k]=m.useState([]),[w,b]=m.useState(null),[j,N]=m.useState(ap.sortField),[S,C]=m.useState(ap.sortDirection),[I,T]=m.useState(""),[R,D]=m.useState(!1),[_,B]=m.useState(null);function $(){p([]),g([]),k([]),b(null),N(ap.sortField),C(ap.sortDirection),T("")}m.useEffect(()=>{if(e)if(B(null),D(!1),n){const L=n.config.filters;d(n.name),p(We(L.project)),g(We(L.agent)),k(We(L.sessionStatus)),b(Em(L.dateRange)),N(n.config.sortField),C(n.config.sortDirection),T(n.config.limit!==void 0?String(n.config.limit):"")}else d(""),$()},[e,n]);const O=m.useMemo(()=>[{value:"__standalone__",label:"No project"},...(i??[]).map(V=>({value:V.slug,label:V.title}))],[i]),z=m.useMemo(()=>{const L=new Set;for(const V of(a==null?void 0:a.sessions)??[])V.agent&&L.add(V.agent);return Array.from(L).sort().map(V=>({value:V,label:V}))},[a]),A=l.trim(),F=A.length>0&&A.length<=xS,U=I.trim()===""?void 0:parseInt(I.trim(),10),H=I.trim()===""||Number.isFinite(U)&&U!==void 0&&U>0&&U<=500;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async L=>{if(L.preventDefault(),!F||!H||R)return;D(!0),B(null);const V=da(w),M=V?{...V,field:"started"}:void 0,W={filters:{project:f,agent:h,sessionStatus:y,dateRange:M},sortField:j,sortDirection:S,limit:U};try{await r(A,W)}catch(Y){B(Y instanceof Error?Y.message:String(Y)),D(!1)}},children:[s.jsx(sr,{children:s.jsx(Dn,{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:xS,onChange:L=>d(L.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(dl,{label:"Date range (session start)",children:s.jsx(Cm,{className:"w-full",value:w,onChange:b})}),s.jsx(dl,{label:"Project",children:s.jsx(bn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:O,value:f,onChange:p})}),s.jsx(dl,{label:"Agent",children:s.jsx(bn,{ariaLabel:"Agent filter",className:"w-full",allLabel:"All agents",options:z,value:h,onChange:g})}),s.jsx(dl,{label:"Session status",children:s.jsx(bn,{ariaLabel:"Session status filter",className:"w-full",allLabel:"All statuses",options:ZU,value:y,onChange:k})}),s.jsx(dl,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:j,onChange:L=>N(L.target.value),className:"editor-input w-full",children:QU.map(L=>s.jsx("option",{value:L,children:JU[L]??L},L))}),s.jsx("button",{type:"button",onClick:()=>C(L=>L==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:S==="asc"?"Ascending":"Descending",children:S==="asc"?"Asc":"Desc"})]})}),s.jsxs(dl,{label:"Max results",className:"sm:col-span-2",children:[s.jsx("input",{type:"number",min:1,max:500,value:I,onChange:L=>T(L.target.value),placeholder:"No limit",className:"editor-input w-full"}),H?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(zr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:$,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:!F||!H||R,className:"shell-action shell-action--cta disabled:opacity-50",children:R?"Saving…":o?"Save changes":"Create view"})]})]})]})})})}function dl({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 eH=4e3;function Eo(){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},eH)},[]);return m.useEffect(()=>()=>{n.current!==null&&clearTimeout(n.current)},[]),{toast:e,showToast:o,dismissToast:r}}function Ni({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)})}function fy({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 tH({viewId:e,slotId:t,onPickAnother:n}){const{data:r,loading:o,error:i}=Yh(),{view:a,loading:l,ready:d}=bi(e??null),{layout:f}=_R(),{showToast:p}=Eo(),[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 Nb(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}=Aw(j,null);try{const I=(await ql({name:b,workspace:N,config:S,entityType:"session"})).views.find(T=>T.name===b&&T.entityType==="session");I&&await y(I.id),g(!1),p(`Created session view "${b}"`)}catch(C){throw p(C instanceof Error?C.message:"Failed to create session view"),C}}let w;return e?l&&!d?w=s.jsx(vt,{label:"Loading view…"}):a?a.entityType!=="session"?w=s.jsx(fy,{title:"Wrong view type",message:"This widget is bound to an assignment view. Choose a session view above, or pick a different widget.",onPickAnother:n}):w=s.jsx(BU,{view:a,emptyDescription:"Adjust the view's filters to surface different sessions, or pick another widget for this slot."}):w=s.jsx(fy,{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?w=s.jsx(vt,{label:"Loading sessions…"}):i?w=s.jsx(fy,{title:"Couldn't load sessions",message:i}):w=s.jsx(SA,{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(UU,{activeViewId:e??null,onSelectView:b=>void y(b),onCreateNew:()=>g(!0)})}):null,w,s.jsx(AA,{open:h,onOpenChange:g,workspace:null,onSubmit:k})]})}const nH=5;function rH(){const{data:e,loading:t,error:n}=N2();if(t&&!e)return s.jsx(vt,{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,nH);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(Ie,{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,d=i.members.length,f=a.display_name??a.slug;return s.jsx("li",{children:s.jsxs(Ie,{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,"/",d," leased"]})]})},a.slug)})})]})}function sH(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 yS({filters:e,metric:t}){const n=e??{},{data:r,loading:o,error:i}=xO(n),a=t==="cost"?"Spend":"Token Usage",l=`/usage?${fb(n).toString()}`;let d;if(o&&!r)d=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"});else if(i&&!r)d=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)d=s.jsx("p",{className:"text-sm text-muted-foreground",children:"No usage for these filters."});else{const{tokens:f,cost:p}=sH(r),h=t==="cost"?{label:"Total spend",value:Vl(p)}:{label:"Total tokens",value:Hl(f)},g=t==="cost"?{label:"Tokens",value:Hl(f)}:{label:"Spend",value:Vl(p)};d=s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(bS,{label:h.label,value:h.value,emphasize:!0}),s.jsx(bS,{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:g1(n),children:g1(n)})]}),s.jsx(Ie,{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:d})]})}function bS({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 oH={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"};function iH(e){return e.kind==="token-usage"||e.kind==="spend"?e.filters??{}:{}}const fl="bg-background border border-border rounded px-2 py-1 text-sm text-foreground";function vS({config:e,open:t,onSave:n,onCancel:r}){const o=e.kind==="spend"?"Configure Spend":"Configure Token Usage",{data:i}=Qs(),{data:a}=ja(),{data:l}=C2(t),[d,f]=m.useState("30d"),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,w]=m.useState(""),[b,j]=m.useState(""),[N,S]=m.useState(""),[C,I]=m.useState(""),[T,R]=m.useState(!1),[D,_]=m.useState(null);m.useEffect(()=>{if(!t)return;const F=iH(e);f(F.window??"30d"),h(F.since??""),y(F.until??""),w(F.project??""),j(F.workspace??""),S(F.model??""),I(F.tool??""),R(!1),_(null)},[t,e]);function B(){return Ed({window:d,since:d==="custom"?p:void 0,until:d==="custom"?g:void 0,project:k||void 0,workspace:b||void 0,model:N||void 0,tool:C||void 0})}async function $(F){if(F.preventDefault(),T)return;const U=B(),H=iO(U);if(!H.ok){_(H.errors.join("; "));return}R(!0),_(null);const L=e.kind==="token-usage"?{kind:"token-usage",filters:U}:e.kind==="spend"?{kind:"spend",filters:U}:e;try{await n(L)}catch(V){_(V instanceof Error?V.message:String(V)),R(!1)}}const O=(i==null?void 0:i.map(F=>F.slug))??[],z=(a==null?void 0:a.workspaces)??[],A=(a==null?void 0:a.hasUngrouped)??!1;return s.jsx(Bn,{open:t,onOpenChange:F=>{F||r()},children:s.jsx(_n,{className:"max-w-md",children:s.jsxs("form",{onSubmit:$,children:[s.jsx(sr,{children:s.jsx(Dn,{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:Kh.map(F=>s.jsx("button",{type:"button",onClick:()=>f(F),className:"rounded px-2.5 py-1 text-sm border "+(F===d?"border-primary bg-primary/10 text-foreground":"border-border text-muted-foreground hover:text-foreground"),children:oH[F]},F))})]}),d==="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:F=>h(F.target.value),className:fl})]}),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:F=>y(F.target.value),className:fl})]})]}):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:F=>{j(F.target.value),F.target.value&&w("")},className:fl,children:[s.jsx("option",{value:"",children:"All workspaces"}),A?s.jsx("option",{value:"_ungrouped",children:"(ungrouped)"}):null,z.map(F=>s.jsx("option",{value:F,children:F},F))]})]}),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:F=>{w(F.target.value),F.target.value&&j("")},className:fl,children:[s.jsx("option",{value:"",children:"All projects"}),O.map(F=>s.jsx("option",{value:F,children:F},F))]})]}),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:F=>S(F.target.value),className:fl,children:[s.jsx("option",{value:"",children:"All models"}),((l==null?void 0:l.models)??[]).map(F=>s.jsx("option",{value:F,children:F},F))]})]}),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:F=>I(F.target.value),className:fl,children:[s.jsx("option",{value:"",children:"All tools"}),((l==null?void 0:l.tools)??[]).map(F=>s.jsx("option",{value:F,children:F},F))]})]})]}),D?s.jsx("p",{className:"text-xs text-destructive",role:"alert",children:D}):null]}),s.jsxs(zr,{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 Pw={"saved-view":{title:"Saved view",icon:YE,render:(e,t)=>e.kind!=="saved-view"?null:m.createElement(_U,{viewId:e.viewId,onPickAnother:t.onPickAnother})},"agent-sessions":{title:"Agent sessions",icon:Bh,render:(e,t)=>e.kind!=="agent-sessions"?null:m.createElement(tH,{viewId:e.viewId,slotId:t.slotId,onPickAnother:t.onPickAnother})},inventories:{title:"Inventories",icon:Vh,render:()=>m.createElement(rH)},"token-usage":{title:"Token Usage",icon:BL,render:e=>e.kind!=="token-usage"?null:m.createElement(yS,{filters:e.filters,metric:"tokens"}),ConfigEditor:vS},spend:{title:"Spend",icon:Sd,render:e=>e.kind!=="spend"?null:m.createElement(yS,{filters:e.filters,metric:"cost"}),ConfigEditor:vS}},PA=50,Ib=16,aH=2,ia=6,yh=11,Mb={w:6,h:2};function Bp(e,t,n){return Math.min(Math.max(e,t),n)}const lH=[{minWidth:1280,columns:24},{minWidth:1024,columns:16},{minWidth:768,columns:12},{minWidth:640,columns:6},{minWidth:0,columns:1}];function cH(e){if(!Number.isFinite(e)||e<0)return 1;for(const t of lH)if(e>=t.minWidth)return t.columns;return 1}function Up(e,t){return t<=0?1:Bp(Math.round(e/ed*t),1,t)}function Lb(e){if(x8(e))return e;switch(e){case"small":return{w:8,h:ia};case"wide":return{w:16,h:ia};case"tall":return{w:8,h:yh};case"large":return{w:16,h:yh};default:return{w:8,h:ia}}}function uH(e,t){return t>0?Math.round(e/t):0}function dH(e,t=PA){return Math.round(e/t)}const fH=[{label:"Third",w:8,h:ia},{label:"Half",w:12,h:ia},{label:"Two-thirds",w:16,h:ia},{label:"Full",w:24,h:ia},{label:"Half tall",w:12,h:yh},{label:"Full tall",w:24,h:yh}];function pH({slot:e,activeColumns:t,colWidthPx:n,onReplace:r,onRemove:o,onRemoveSlot:i,onResize:a,onConfigChange:l}){const[d,f]=m.useState(!1),[p,h]=m.useState(null),g=m.useRef(null),{attributes:y,listeners:k,setNodeRef:w,setActivatorNodeRef:b,transform:j,transition:N,isDragging:S}=mm({id:e.id}),C=Lb(e.size),I=p?p.renderW:Up(C.w,t),T=p?p.h:C.h,R={transform:xs.Translate.toString(j),transition:N,zIndex:S?50:void 0,position:S?"relative":void 0,gridColumn:`span ${I}`,gridRow:`span ${T}`};function D(U){g.current=null;try{U.currentTarget.releasePointerCapture(U.pointerId)}catch{}h(null)}function _(U){return{onPointerDown:H=>{if(g.current)return;H.preventDefault(),H.stopPropagation(),H.currentTarget.setPointerCapture(H.pointerId);const L=Up(C.w,t);g.current={pointerId:H.pointerId,startX:H.clientX,startY:H.clientY,startRenderW:L,startH:C.h,axis:U,lastRenderW:L,lastH:C.h},h({renderW:L,h:C.h})},onPointerMove:H=>{const L=g.current;if(!L||H.pointerId!==L.pointerId)return;let V=L.startRenderW,M=L.startH;(L.axis==="w"||L.axis==="both")&&(V=Bp(L.startRenderW+uH(H.clientX-L.startX,n),1,t)),(L.axis==="h"||L.axis==="both")&&(M=Bp(L.startH+dH(H.clientY-L.startY),aH,SR)),L.lastRenderW=V,L.lastH=M,h({renderW:V,h:M})},onPointerUp:H=>{const L=g.current;if(!L||H.pointerId!==L.pointerId)return;const V=Lb(e.size),W={w:L.axis==="h"?V.w:Bp(Math.round(L.lastRenderW/t*ed),1,ed),h:L.lastH};D(H),(W.w!==V.w||W.h!==V.h)&&a(W)},onPointerCancel:H=>{const L=g.current;L&&H.pointerId===L.pointerId&&D(H)},onLostPointerCapture:H=>{const L=g.current;L&&H.pointerId===L.pointerId&&D(H)}}}const B="absolute z-10 touch-none rounded-sm bg-transparent transition hover:bg-primary/30",$=s.jsxs(s.Fragment,{children:[t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(B,"right-0 top-0 h-full w-1.5 cursor-ew-resize"),..._("w")}):null,s.jsx("div",{"aria-hidden":"true",className:Ne(B,"bottom-0 left-0 h-1.5 w-full cursor-ns-resize"),..._("h")}),t>1?s.jsx("div",{"aria-hidden":"true",className:Ne(B,"bottom-0 right-0 h-3 w-3 cursor-nwse-resize"),..._("both")}):null]}),O=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(cc,{className:"h-4 w-4","aria-hidden":"true"})});if(e.widget===null)return s.jsxs("div",{ref:w,style:{...R,gridColumn:`span ${Up(Mb.w,t)}`,gridRow:`span ${Mb.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:O}),s.jsx("button",{type:"button","aria-label":"Remove slot",onClick:i,onPointerDown:U=>U.stopPropagation(),className:"absolute right-2 top-2 z-10 text-muted-foreground/50 transition hover:text-destructive",children:s.jsx(vn,{className:"h-4 w-4"})}),s.jsxs("button",{type:"button",onClick:r,className:"shell-action inline-flex items-center gap-2",children:[s.jsx($t,{className:"h-4 w-4"}),"Add widget"]})]});const z=Pw[e.widget.kind];if(!z)return s.jsxs("div",{ref:w,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:[O,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]})]}),$]});const A=z.icon,F=z.ConfigEditor;return s.jsxs("div",{ref:w,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:[O,s.jsx(A,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:s.jsx(mH,{slot:e,fallback:z.title})})]}),s.jsx(Tw,{items:[{key:"replace",label:"Replace…",icon:JL,onSelect:r},...z.ConfigEditor?[{key:"configure",label:"Configure…",icon:r4,onSelect:()=>f(!0)}]:[],{key:"size",label:"Size",icon:GL,submenu:fH.map(U=>({key:`size-${U.label}`,label:U.label,active:C.w===U.w&&C.h===U.h,onSelect:()=>a({w:U.w,h:U.h})}))},{key:"remove",label:"Remove",icon:vn,destructive:!0,onSelect:o}]})]}),s.jsx("div",{children:z.render(e.widget,{slotId:e.id,onPickAnother:r})}),F?s.jsx(F,{config:e.widget,open:d,onSave:async U=>{await l(U),f(!1)},onCancel:()=>f(!1)}):null,$]})}function hH({slot:e,activeColumns:t,colWidthPx:n}){const r=e.widget?Pw[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?Mb:Lb(e.size),l=Up(a.w,t),d=n>0?l*n+(l-1)*Ib: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:d?`${Math.max(d,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(cc,{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 mH({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}=bi(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 gH=["agent-sessions","inventories","token-usage","spend"];function xH({open:e,onOpenChange:t,onSelect:n}){const{views:r,loading:o}=$d();function i(a){n(a),t(!1)}return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Add a widget"}),s.jsx(es,{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:gH.map(a=>{const l=Pw[a],d=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(d,{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(Ie,{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 yH=(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 d=a[l+r],f=d===void 0?null:n.droppableRects.get(d),p=n.collisionRect;return!f||!p?t:{x:f.left+(f.width-p.width)/2,y:f.top+(f.height-p.height)/2}};function bH(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 vH(e,t){const n={id:bH(e),widget:null};return[...e,n]}function wH(e,t){return e.filter(n=>n.id!==t)}function jH(){const{data:e,error:t,refetch:n}=cO(),{data:r}=j2(),{layout:o}=_R(),[i,a]=m.useState(!1),[l,d]=m.useState(null),[f,p]=m.useState(null),[h,g]=m.useState(o.slots),[y,k]=m.useState(null),w=m.useRef(null),[b,j]=m.useState(ed),[N,S]=m.useState(0);m.useEffect(()=>{const H=w.current;if(!H)return;const L=new ResizeObserver(V=>{for(const M of V){const W=M.contentRect.width,Y=cH(W),q=Y>0?(W-(Y-1)*Ib)/Y:0;j(Y),S(q)}});return L.observe(H),()=>L.disconnect()},[]),m.useEffect(()=>{g(o.slots)},[o.slots]);const C=lm(yi(xc,{activationConstraint:{distance:8}}),yi(gc,{coordinateGetter:yH}));Si("list:overview"),Zt({keys:"r",description:"Refresh",scope:"list:overview",handler:()=>{n()}});const I=m.useCallback(H=>{d(H),a(!0)},[]),T=m.useCallback(async(H,L)=>{p(null),g(H);try{await Nb(H)}catch(V){g(L),p(V instanceof Error?V.message:String(V))}},[]),R=m.useCallback(H=>{if(l===null)return;const L=h.map((V,M)=>M===l?{...V,widget:H}:V);d(null),T(L,h)},[h,l,T]),D=m.useCallback(H=>{const L=h.map((V,M)=>M===H?{...V,widget:null,size:void 0}:V);T(L,h)},[h,T]),_=m.useCallback(H=>{const L=wH(h,H);T(L,h)},[h,T]),B=m.useCallback(()=>{const H=vH(h);T(H,h)},[h,T]),$=m.useCallback((H,L)=>{const V=h.map((M,W)=>W===H?{...M,size:L}:M);T(V,h)},[h,T]),O=m.useCallback(H=>{const{active:L,over:V}=H;if(k(null),!V||L.id===V.id)return;const M=h.findIndex(q=>q.id===L.id),W=h.findIndex(q=>q.id===V.id);if(M===-1||W===-1)return;const Y=yc(h,M,W);T(Y,h)},[h,T]),z=m.useCallback(H=>{k(String(H.active.id))},[]),A=h.find(H=>H.id===y)??null,F=m.useCallback(async(H,L)=>{const V=h,M=h.map((W,Y)=>Y===H?{...W,widget:L}:W);p(null),g(M);try{await Nb(M)}catch(W){g(V);const Y=W instanceof Error?W.message:String(W);throw p(Y),W instanceof Error?W:new Error(Y)}},[h]),U={};if(e)for(const H of Object.keys(e.segments))for(const L of e.segments[H].items)U[L.id]=L;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(m8,{hero:e.hero,itemsById:U}):t?s.jsx(Pt,{error:t}):s.jsx(vt,{label:"Loading overview…"}),e!=null&&e.firstRun?s.jsx(p8,{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(pm,{sensors:C,collisionDetection:cm,onDragStart:z,onDragCancel:()=>k(null),onDragEnd:O,children:[s.jsx(hm,{items:h.map(H=>H.id),strategy:hw,children:s.jsx("div",{ref:w,style:{display:"grid",gridTemplateColumns:`repeat(${b}, minmax(0, 1fr))`,gridAutoRows:`${PA}px`,gridAutoFlow:"dense",gap:`${Ib}px`},children:h.map((H,L)=>s.jsx(pH,{slot:H,index:L,activeColumns:b,colWidthPx:N,onReplace:()=>I(L),onRemove:()=>D(L),onRemoveSlot:()=>_(H.id),onResize:V=>$(L,V),onConfigChange:V=>F(L,V)},H.id))})}),s.jsx(ZB,{dropAnimation:null,children:A?s.jsx(hH,{slot:A,activeColumns:b,colWidthPx:N}):null})]}),s.jsxs("button",{type:"button",onClick:B,className:"shell-action inline-flex items-center gap-2",children:[s.jsx($t,{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(Pv,{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(xH,{open:i,onOpenChange:H=>{a(H),H||d(null)},onSelect:R})]})}function kH({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 SH(){const{data:e,loading:t,error:n}=j2(),{openCheatsheet:r}=ki();return t?s.jsx(vt,{label:"Loading help…"}):n||!e?s.jsx(Pt,{error:n||"Help content is unavailable."}):s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ge,{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. ",qs("Mod+k")," opens the command palette."]})]})}),s.jsx(Ge,{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(Ge,{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(Lp,{command:o.command.command,description:o.command.description,example:o.command.example}):null,o.href?s.jsx(Ie,{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(Ge,{title:"Core Concepts",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:e.coreConcepts.map(o=>s.jsx(kH,{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(Ge,{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(wn,{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(Ge,{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(Ge,{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(Ie,{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(Ge,{title:"CLI Quick Reference",children:s.jsx("div",{className:"grid gap-3 xl:grid-cols-2",children:e.commands.map(o=>s.jsx(Lp,{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(Ge,{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(Ge,{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(Lp,{command:o.command.command,example:o.command.example}):null,o.href?s.jsx(Ie,{className:"inline-flex text-sm font-semibold text-primary hover:underline",to:o.href,children:"Open the related surface"}):null]})]})},o.title))})})]})]})}function _w({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 Tm=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(ji,{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"})]}));Tm.displayName="SearchInput";function Rm({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 NH={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"},wS=["bg-primary","bg-secondary","bg-accent-coral","bg-accent-teal","bg-accent-amber"];function bh({progress:e,className:t,showLegend:n=!1}){const r=Ns(),o=m.useMemo(()=>{let a=0;return(r.order.length>0?r.order:Object.keys(e).filter(d=>d!=="total")).map(d=>({key:d,className:NH[d]??wS[a++%wS.length]}))},[r.order,e]),i=o.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:`${Tn(a.key)}: ${e[a.key]??0}`},a.key))}),n?s.jsx("div",{className:"flex flex-wrap gap-2 text-xs text-muted-foreground",children:o.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:Tn(a.key)}),s.jsx("span",{className:"font-medium text-foreground",children:e[a.key]??0})]},a.key))}):null]})}const CH=["pending","active","blocked","failed","completed"],Dw=CH,EH=["draft","pending","ready_for_planning","ready_to_implement","in_progress","blocked","review","completed","failed"];function _A(e){return e&&e.length>0?e:[...EH]}function TH(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 RH=220,lp=8;function DA({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)??RH,d=(a==null?void 0:a.offsetHeight)??0,f=Math.max(lp,window.innerWidth-l-lp),p=Math.max(lp,window.innerHeight-d-lp);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 d(){n()}return document.addEventListener("mousedown",a),document.addEventListener("keydown",l),document.addEventListener("contextmenu",a),window.addEventListener("scroll",d,!0),()=>{document.removeEventListener("mousedown",a),document.removeEventListener("keydown",l),document.removeEventListener("contextmenu",a),window.removeEventListener("scroll",d,!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(ua,{delayDuration:200,children:t.map(a=>{const l=a.icon,d=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:d,children:f})});return a.disabledReason?s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:p}),s.jsx(mr,{side:"left",children:a.disabledReason})]},a.key):s.jsx("div",{children:p},a.key)}return a.href?s.jsx(Ie,{to:a.href,className:d,onClick:()=>n(),children:f},a.key):s.jsx("button",{type:"button",className:d,onClick:()=>{var p;(p=a.onSelect)==null||p.call(a),n()},children:f},a.key)})})})}const AH="__ungrouped__";function $w({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}=ja(),[d,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:AH,label:"Ungrouped",value:null}],[a]),w=!p&&d!==n;async function b(){if(w){h(!0),y(null);try{await r(d),t(!1)}catch(j){y(j instanceof Error?j.message:"Failed to move item")}finally{h(!1)}}}return s.jsx(Bn,{open:e,onOpenChange:j=>p?void 0:t(j),children:s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:o}),s.jsx(es,{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(Av,{className:"h-4 w-4 animate-spin"})," Loading workspaces…"]}):k.map(j=>{const N=j.value===n,S=j.value===d;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(Or,{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(zr,{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:!w,className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:p?"Moving…":"Move"})]})]})})}function jS(){const{workspace:e}=Wt(),t=pn(),n=Vt(),{data:r,loading:o,error:i,refetch:a}=Qs(),l=m.useRef(null);Si("list:projects");const[d,f]=m.useState(""),[p,h]=m.useState("all"),[g,y]=m.useState("all"),[k,w]=m.useState("updated"),[b,j]=ks(),N=b.get("view"),S=N==="table"||N==="kanban"?N:"cards",C=L=>{j(V=>{const M=new URLSearchParams(V);return L==="cards"?M.delete("view"):M.set("view",L),M})},[I,T]=m.useState({}),[R,D]=m.useState(null),[_,B]=m.useState(null),$=m.useMemo(()=>r?r.filter(L=>{if(e){if(e==="_ungrouped"){if(L.workspace!==null)return!1}else if(L.workspace!==e)return!1}return p!=="all"&&L.status!==p||g!=="all"&&!L.tags.includes(g)?!1:d.trim()?`${L.title} ${L.tags.join(" ")} ${L.slug}`.toLowerCase().includes(d.toLowerCase()):!0}).sort((L,V)=>DH(L,V,k)):[],[r,d,p,g,k,e]),O=$.map(L=>`${L.slug}:${L.status}`).join("|");m.useEffect(()=>{T($H($))},[O,k]);const z=m.useMemo(()=>{const L=new Map($.map(V=>[V.slug,V]));return Dw.flatMap(V=>(I[V]??$.filter(W=>W.status===V).map(W=>W.slug)).map(W=>L.get(W)).filter(W=>!!W))},[$,I]),{visibleItems:A,visibleIndexByKey:F}=m.useMemo(()=>{const L=S==="kanban"?z:$,V=new Map;return L.forEach((M,W)=>V.set(M.slug,W)),{visibleItems:L,visibleIndexByKey:V}},[S,$,z]),{hotkeyRowProps:U}=Rd(A,{scope:"list:projects",onOpen:L=>n(`${t}/projects/${L.slug}`)});if(Zt({keys:"/",scope:"list:projects",description:"Focus filter",handler:()=>{var L;return(L=l.current)==null?void 0:L.focus()}}),Zt({keys:"r",scope:"list:projects",description:"Refresh",handler:()=>a()}),o)return s.jsx(vt,{label:"Loading projects…"});if(i||!r)return s.jsx(Pt,{error:i||"Project list is unavailable."});const H=Array.from(new Set(r.flatMap(L=>L.tags))).sort();return s.jsxs("div",{className:"space-y-5",children:[s.jsxs(_w,{children:[s.jsx(Tm,{ref:l,value:d,onChange:f,placeholder:"Search by project title or tag"}),s.jsxs("select",{value:p,onChange:L=>h(L.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:g,onChange:L=>y(L.target.value),className:"editor-input max-w-[180px]",children:[s.jsx("option",{value:"all",children:"All tags"}),H.map(L=>s.jsx("option",{value:L,children:L},L))]}),s.jsxs("select",{value:k,onChange:L=>w(L.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(Rm,{value:S,onChange:L=>C(L),options:[{value:"cards",label:"Cards"},{value:"table",label:"Table"},{value:"kanban",label:"Kanban"}]})]}),$.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(Ie,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create your first project"}),s.jsx(Ie,{className:"shell-action",to:"/help",children:"Read the spec"})]})]}):s.jsx(Rt,{title:"No projects match these filters",description:"Adjust the current search and filters or create a new project.",actions:s.jsx(Ie,{className:"shell-action shell-action--solid",to:`${t}/create/project`,children:"Create Project"})}):S==="cards"?s.jsx("div",{className:"grid gap-3 lg:grid-cols-2 2xl:grid-cols-3",children:$.map((L,V)=>s.jsxs(Ie,{to:`${t}/projects/${L.slug}`,className:"block rounded-lg border border-border/60 bg-card/90 p-3 shadow-sm transition hover:border-primary/40 hover:shadow-md",...U(V),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:L.title}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",qn(L.updated)]})]}),s.jsx(wn,{status:L.status})]}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsx(bh,{progress:L.progress,showLegend:!0}),s.jsx("div",{className:"flex flex-wrap gap-2",children:L.tags.map(M=>s.jsx("span",{className:"rounded-full border border-border/60 bg-background/80 px-2.5 py-1 text-xs text-foreground",children:M},M))}),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:L.needsAttention.blockedCount+L.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:L.progress.total})]})]})]})]},L.slug))}):S==="table"?s.jsx(Ge,{title:`${$.length} project${$.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:$.map((L,V)=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",...U(V),children:[s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(Ie,{to:`${t}/projects/${L.slug}`,className:"font-semibold text-foreground hover:text-primary",children:L.title}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",children:L.tags.map(M=>s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:M},M))})]}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx(wn,{status:L.status})}),s.jsx("td",{className:"py-4 pr-4",children:s.jsx("div",{className:"min-w-[220px]",children:s.jsx(bh,{progress:L.progress})})}),s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:L.needsAttention.blockedCount+L.needsAttention.failedCount}),s.jsx("td",{className:"py-4 text-muted-foreground",children:qn(L.updated)})]},L.slug))})]})})}):s.jsx(Nm,{columns:_H,items:z,getItemId:L=>L.slug,getColumnId:L=>L.status,canDrop:({fromColumnId:L,toColumnId:V})=>({allowed:!0,reason:L===V?void 0:"This will set a manual status override on the project."}),onMove:({item:L,fromColumnId:V,toColumnId:M,fromIndex:W,toIndex:Y})=>{if(V===M){const q=I[V]??$.filter(J=>J.status===V).map(J=>J.slug);T(J=>({...J,[V]:TH(q,W,Y)}));return}fetch(`/api/projects/${L.slug}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:M})}).then(()=>{window.location.reload()})},getExternalDragData:L=>({type:"project",id:L.slug}),onCardContextMenu:(L,V)=>{V.preventDefault(),D({project:L,anchor:{x:V.clientX,y:V.clientY}})},emptyMessage:L=>`No ${L.title.toLowerCase()} projects.`,renderCard:(L,{dragging:V})=>{const M=F.get(L.slug)??-1;return s.jsx("div",{...M>=0?U(M):{},children:s.jsx(IH,{project:L,dragging:V})})}}),s.jsx(DA,{anchor:(R==null?void 0:R.anchor)??null,items:R?[{key:"edit",label:"Edit",icon:uc,onSelect:()=>n(`${t}/projects/${R.project.slug}`)},{key:"move",label:"Move to workspace…",icon:Hh,onSelect:()=>B(R.project)}]:[],onClose:()=>D(null)}),s.jsx($w,{open:_!==null,onOpenChange:L=>{L||B(null)},currentWorkspace:(_==null?void 0:_.workspace)??null,title:"Move project to workspace",onSubmit:async L=>{if(!_)return;const V=await fetch(`/api/projects/${encodeURIComponent(_.slug)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:L})});if(!V.ok){const M=await V.json().catch(()=>({}));throw new Error(M.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(Rv,{className:"mt-0.5 h-4 w-4"}),s.jsxs("p",{children:["Project status is derived from assignment state by default.",S==="kanban"?" Drag projects between columns or use":" Use"," the status override on the project detail page to set a manual status."]})]})})]})}const PH={pending:"Pending",active:"Active",blocked:"Blocked",failed:"Failed",completed:"Completed"},_H=Dw.map(e=>({id:e,title:PH[e],description:Od(e)}));function DH(e,t,n){switch(n){case"created":return t.created.localeCompare(e.created);case"title":return e.title.localeCompare(t.title);case"attention":return kS(t)-kS(e);case"updated":default:return t.updated.localeCompare(e.updated)}}function kS(e){return e.needsAttention.failedCount*10+e.needsAttention.blockedCount*5+e.needsAttention.openQuestions}function $H(e){return Object.fromEntries(Dw.map(t=>[t,e.filter(n=>n.status===t).map(n=>n.slug)]))}function IH({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(Ie,{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 ",qn(e.updated)]})]}),s.jsx(wn,{status:e.status})]}),s.jsx("div",{className:"mt-4",children:s.jsx(bh,{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 vh({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 MH(){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(Uh,{className:"h-3 w-3"}),"Archived"]})}function SS(e){return e.projectSlug?`/projects/${e.projectSlug}/assignments/${e.slug}`:`/assignments/${e.id}`}function LH(){const{data:e,loading:t,error:n,refetch:r}=uO(),[o,i]=m.useState(null),[a,l]=m.useState(null),[d,f]=m.useState({}),{toast:p,showToast:h,dismissToast:g}=Eo();async function y(S,C,I){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(I,"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 w(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(vt,{label:"Loading archived content…"});if(n)return s.jsx(Pt,{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(Ni,{toast:p,onDismiss:g}),s.jsx(vh,{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(Rt,{title:"Nothing archived",description:"Archived projects and assignments will appear here, ready to restore."}):s.jsxs(s.Fragment,{children:[b.length>0&&s.jsx(Ge,{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=d[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(I=>({...I,[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(br,{className:"h-4 w-4"}):s.jsx(WE,{className:"h-4 w-4"}),s.jsx(Ev,{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?Jr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(Ie,{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(Xp,{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(I=>s.jsxs("li",{className:"flex flex-wrap items-center gap-2 text-sm",children:[s.jsx(Ie,{to:SS(I),className:"text-foreground hover:text-foreground/80",children:I.title}),s.jsx(wn,{status:I.status,showIcon:!1}),s.jsx("span",{className:"text-xs text-muted-foreground",children:I.archived?"Archived individually — stays archived after restore":"Hidden via project — returns on restore"})]},I.id))})]},S.slug)})})}),j.length>0&&s.jsx(Ge,{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(Ie,{to:SS(S),className:"text-sm font-medium text-foreground hover:text-foreground/80",children:S.title}),s.jsx(wn,{status:S.status,showIcon:!1}),s.jsx(MH,{}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[S.projectTitle??"Standalone"," · Archived"," ",S.archivedAt?Jr(S.archivedAt):"with no timestamp",S.archivedReason?` · ${S.archivedReason}`:""]}),s.jsxs("button",{type:"button",onClick:()=>w(S),disabled:o===`assignment:${S.id}`,className:"ml-auto inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground disabled:opacity-50",children:[s.jsx(Xp,{className:"h-3 w-3"}),"Restore"]})]},S.id))})})]})]})}const NS="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",CS="block min-w-0 truncate";function Iw({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(NS,"transition-colors hover:text-foreground hover:border-foreground/40"),title:`Open ${o} in ${n.system}`,children:[s.jsx("span",{className:CS,children:o}),s.jsx(lc,{className:"h-2.5 w-2.5 shrink-0"})]},i):s.jsx("span",{className:NS,title:o,children:s.jsx("span",{className:CS,children:o})},i)})})}const OH={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 Wn({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]}),l=Ne(OH[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(Ie,{to:i,className:l,children:a}):s.jsx("article",{className:l,children:a})}function ES(e){const t=FH(e),n=m.forwardRef((r,o)=>{const{children:i,...a}=r,l=m.Children.toArray(i),d=l.find(BH);if(d){const f=d.props.children,p=l.map(h=>h===d?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 FH(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const a=HH(o),l=UH(i,o.props);return o.type!==m.Fragment&&(l.ref=r?tm(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 zH=Symbol("radix.slottable");function BH(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zH}function UH(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 d=i(...l);return o(...l),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function HH(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 VH(e){const t=e+"CollectionProvider",[n,r]=ka(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=w=>{const{scope:b,children:j}=w,N=Mt.useRef(null),S=Mt.useRef(new Map).current;return s.jsx(o,{scope:b,itemMap:S,collectionRef:N,children:j})};a.displayName=t;const l=e+"CollectionSlot",d=ES(l),f=Mt.forwardRef((w,b)=>{const{scope:j,children:N}=w,S=i(l,j),C=Jn(b,S.collectionRef);return s.jsx(d,{ref:C,children:N})});f.displayName=l;const p=e+"CollectionItemSlot",h="data-radix-collection-item",g=ES(p),y=Mt.forwardRef((w,b)=>{const{scope:j,children:N,...S}=w,C=Mt.useRef(null),I=Jn(b,C),T=i(p,j);return Mt.useEffect(()=>(T.itemMap.set(C,{ref:C,...S}),()=>void T.itemMap.delete(C))),s.jsx(g,{[h]:"",ref:I,children:N})});y.displayName=p;function k(w){const b=i(e+"CollectionConsumer",w);return Mt.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 WH=m.createContext(void 0);function $A(e){const t=m.useContext(WH);return e||t||"ltr"}var py="rovingFocusGroup.onEntryFocus",qH={bubbles:!1,cancelable:!0},zd="RovingFocusGroup",[Ob,IA,KH]=VH(zd),[GH,MA]=ka(zd,[KH]),[YH,XH]=GH(zd),LA=m.forwardRef((e,t)=>s.jsx(Ob.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ob.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(QH,{...e,ref:t})})}));LA.displayName=zd;var QH=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:p=!1,...h}=e,g=m.useRef(null),y=Jn(t,g),k=$A(i),[w,b]=nm({prop:a,defaultProp:l??null,onChange:d,caller:zd}),[j,N]=m.useState(!1),S=ha(f),C=IA(n),I=m.useRef(!1),[T,R]=m.useState(0);return m.useEffect(()=>{const D=g.current;if(D)return D.addEventListener(py,S),()=>D.removeEventListener(py,S)},[S]),s.jsx(YH,{scope:n,orientation:r,dir:k,loop:o,currentTabStopId:w,onItemFocus:m.useCallback(D=>b(D),[b]),onItemShiftTab:m.useCallback(()=>N(!0),[]),onFocusableItemAdd:m.useCallback(()=>R(D=>D+1),[]),onFocusableItemRemove:m.useCallback(()=>R(D=>D-1),[]),children:s.jsx(jn.div,{tabIndex:j||T===0?-1:0,"data-orientation":r,...h,ref:y,style:{outline:"none",...e.style},onMouseDown:rn(e.onMouseDown,()=>{I.current=!0}),onFocus:rn(e.onFocus,D=>{const _=!I.current;if(D.target===D.currentTarget&&_&&!j){const B=new CustomEvent(py,qH);if(D.currentTarget.dispatchEvent(B),!B.defaultPrevented){const $=C().filter(U=>U.focusable),O=$.find(U=>U.active),z=$.find(U=>U.id===w),F=[O,z,...$].filter(Boolean).map(U=>U.ref.current);zA(F,p)}}I.current=!1}),onBlur:rn(e.onBlur,()=>N(!1))})})}),OA="RovingFocusGroupItem",FA=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,d=Al(),f=i||d,p=XH(OA,n),h=p.currentTabStopId===f,g=IA(n),{onFocusableItemAdd:y,onFocusableItemRemove:k,currentTabStopId:w}=p;return m.useEffect(()=>{if(r)return y(),()=>k()},[r,y,k]),s.jsx(Ob.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:s.jsx(jn.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=e9(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?t9(S,C+1):S.slice(C+1)}setTimeout(()=>zA(S))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:w!=null}):a})})});FA.displayName=OA;var JH={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ZH(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function e9(e,t,n){const r=ZH(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return JH[r]}function zA(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function t9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var n9=LA,r9=FA,Am="Tabs",[s9]=ka(Am,[MA]),BA=MA(),[o9,Mw]=s9(Am),UA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:d="automatic",...f}=e,p=$A(l),[h,g]=nm({prop:r,onChange:o,defaultProp:i??"",caller:Am});return s.jsx(o9,{scope:n,baseId:Al(),value:h,onValueChange:g,orientation:a,dir:p,activationMode:d,children:s.jsx(jn.div,{dir:p,"data-orientation":a,...f,ref:t})})});UA.displayName=Am;var HA="TabsList",VA=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Mw(HA,n),a=BA(n);return s.jsx(n9,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(jn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});VA.displayName=HA;var WA="TabsTrigger",qA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=Mw(WA,n),l=BA(n),d=YA(a.baseId,r),f=XA(a.baseId,r),p=r===a.value;return s.jsx(r9,{asChild:!0,...l,focusable:!o,active:p,children:s.jsx(jn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":f,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...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=WA;var KA="TabsContent",GA=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=Mw(KA,n),d=YA(l.baseId,r),f=XA(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(Sa,{present:o||p,children:({present:g})=>s.jsx(jn.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":d,hidden:!g,id:f,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:g&&i})})});GA.displayName=KA;function YA(e,t){return`${e}-trigger-${t}`}function XA(e,t){return`${e}-content-${t}`}var QA=UA,JA=VA,Fb=qA,zb=GA;function Pm({value:e,onValueChange:t,items:n,className:r}){return s.jsxs(QA,{value:e,onValueChange:t,className:r,children:[s.jsx(JA,{className:"scrollbar-none flex gap-2 overflow-x-auto rounded-md border border-border/70 bg-card/80 p-1",children:n.map(o=>s.jsxs(Fb,{value:o.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:o.label}),typeof o.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:o.count}):null,o.problemCount&&o.problemCount>0?s.jsx("span",{className:"rounded-full bg-destructive/15 px-2 py-0.5 text-xs text-destructive","aria-label":`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,title:`${o.problemCount} ${o.problemCount===1?"error":"errors"}`,children:o.problemCount}):null]},o.value))}),n.map(o=>s.jsx(zb,{value:o.value,className:"pt-3",children:o.content},o.value))]})}const i9="modulepreload",a9=function(e){return"/"+e},TS={},l9=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]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=a(n.map(f=>{if(f=a9(f),f in TS)return;TS[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":i9,p||(g.as="script"),g.crossOrigin="",g.href=f,d&&g.setAttribute("nonce",d),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 c9({definition:e,className:t,nodeRoutes:n={}}){const r=m.useRef(null),[o,i]=m.useState(null),[a,l]=m.useState(!0),d=Vt(),f=document.documentElement.classList.contains("dark")?"dark":"default";return m.useEffect(()=>{let p=!1;async function h(){if(r.current)try{const g=(await l9(async()=>{const{default:w}=await import("./mermaid.core-CzhsZ1QZ.js").then(b=>b.bs);return{default:w}},[])).default;if(g.initialize({startOnLoad:!1,theme:"base",themeVariables:u9(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,d9(r.current,n,d),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,d,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 u9(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"),d=n("--muted"),f=n("--muted-foreground"),p=n("--secondary");return{background:r,primaryColor:r,primaryTextColor:o,primaryBorderColor:i,secondaryColor:d,secondaryTextColor:o,secondaryBorderColor:i,tertiaryColor:d,tertiaryTextColor:f,tertiaryBorderColor:i,lineColor:e?f:i,textColor:o,mainBkg:r,nodeBkg:r,nodeTextColor:o,nodeBorder:i,clusterBkg:d,clusterBorder:i,edgeLabelBackground:r,titleColor:o,activeTaskBkgColor:a,activeTaskBorderColor:a,altBackground:d,labelColor:o,errorBkgColor:p,errorTextColor:l}}function d9(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",d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l())})}}function f9(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const p9=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,h9=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,m9={};function RS(e,t){return(m9.jsx?h9:p9).test(e)}const g9=/[ \t\n\f\r]/g;function x9(e){return typeof e=="object"?e.type==="text"?AS(e.value):!1:AS(e)}function AS(e){return e.replace(g9,"")===""}class Bd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Bd.prototype.normal={};Bd.prototype.property={};Bd.prototype.space=void 0;function ZA(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Bd(n,r,t)}function Bb(e){return e.toLowerCase()}class vr{constructor(t,n){this.attribute=n,this.property=t}}vr.prototype.attribute="";vr.prototype.booleanish=!1;vr.prototype.boolean=!1;vr.prototype.commaOrSpaceSeparated=!1;vr.prototype.commaSeparated=!1;vr.prototype.defined=!1;vr.prototype.mustUseProperty=!1;vr.prototype.number=!1;vr.prototype.overloadedBoolean=!1;vr.prototype.property="";vr.prototype.spaceSeparated=!1;vr.prototype.space=void 0;let y9=0;const xt=Ca(),xn=Ca(),Ub=Ca(),Le=Ca(),Kt=Ca(),Ol=Ca(),Tr=Ca();function Ca(){return 2**++y9}const Hb=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:xn,commaOrSpaceSeparated:Tr,commaSeparated:Ol,number:Le,overloadedBoolean:Ub,spaceSeparated:Kt},Symbol.toStringTag,{value:"Module"})),hy=Object.keys(Hb);class Lw extends vr{constructor(t,n,r,o){let i=-1;if(super(t,n),PS(this,"space",o),typeof r=="number")for(;++i<hy.length;){const a=hy[i];PS(this,hy[i],(r&Hb[a])===Hb[a])}}}Lw.prototype.defined=!0;function PS(e,t,n){n&&(e[t]=n)}function wc(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new Lw(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Bb(r)]=r,n[Bb(i.attribute)]=r}return new Bd(t,n,e.space)}const eP=wc({properties:{ariaActiveDescendant:null,ariaAtomic:xn,ariaAutoComplete:null,ariaBusy:xn,ariaChecked:xn,ariaColCount:Le,ariaColIndex:Le,ariaColSpan:Le,ariaControls:Kt,ariaCurrent:null,ariaDescribedBy:Kt,ariaDetails:null,ariaDisabled:xn,ariaDropEffect:Kt,ariaErrorMessage:null,ariaExpanded:xn,ariaFlowTo:Kt,ariaGrabbed:xn,ariaHasPopup:null,ariaHidden:xn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kt,ariaLevel:Le,ariaLive:null,ariaModal:xn,ariaMultiLine:xn,ariaMultiSelectable:xn,ariaOrientation:null,ariaOwns:Kt,ariaPlaceholder:null,ariaPosInSet:Le,ariaPressed:xn,ariaReadOnly:xn,ariaRelevant:null,ariaRequired:xn,ariaRoleDescription:Kt,ariaRowCount:Le,ariaRowIndex:Le,ariaRowSpan:Le,ariaSelected:xn,ariaSetSize:Le,ariaSort:null,ariaValueMax:Le,ariaValueMin:Le,ariaValueNow:Le,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function tP(e,t){return t in e?e[t]:t}function nP(e,t){return tP(e,t.toLowerCase())}const b9=wc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ol,acceptCharset:Kt,accessKey:Kt,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:Kt,autoFocus:xt,autoPlay:xt,blocking:Kt,capture:null,charSet:null,checked:xt,cite:null,className:Kt,cols:Le,colSpan:null,content:null,contentEditable:xn,controls:xt,controlsList:Kt,coords:Le|Ol,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:Ub,draggable:xn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:Kt,height:Le,hidden:Ub,high:Le,href:null,hrefLang:null,htmlFor:Kt,httpEquiv:Kt,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:Kt,itemRef:Kt,itemScope:xt,itemType:Kt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:Le,manifest:null,max:null,maxLength:Le,media:null,method:null,min:null,minLength:Le,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,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:xt,optimum:Le,pattern:null,ping:Kt,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:Kt,required:xt,reversed:xt,rows:Le,rowSpan:Le,sandbox:Kt,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:Le,sizes:null,slot:null,span:Le,spellCheck:xn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Le,step:null,style:null,tabIndex:Le,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:xn,width:Le,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kt,axis:null,background:null,bgColor:null,border:Le,borderColor:null,bottomMargin:Le,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:Le,leftMargin:Le,link:null,longDesc:null,lowSrc:null,marginHeight:Le,marginWidth:Le,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:Le,rules:null,scheme:null,scrolling:xn,standby:null,summary:null,text:null,topMargin:Le,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Le,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:Le,security:null,unselectable:null},space:"html",transform:nP}),v9=wc({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:Tr,accentHeight:Le,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Le,amplitude:Le,arabicForm:null,ascent:Le,attributeName:null,attributeType:null,azimuth:Le,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Le,by:null,calcMode:null,capHeight:Le,className:Kt,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:Le,diffuseConstant:Le,direction:null,display:null,dur:null,divisor:Le,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Le,enableBackground:null,end:null,event:null,exponent:Le,externalResourcesRequired:null,fill:null,fillOpacity:Le,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:Ol,g2:Ol,glyphName:Ol,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Le,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Le,horizOriginX:Le,horizOriginY:Le,id:null,ideographic:Le,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Le,k:Le,k1:Le,k2:Le,k3:Le,k4:Le,kernelMatrix:Tr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Le,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:Le,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:Le,overlineThickness:Le,paintOrder:null,panose1:null,path:null,pathLength:Le,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Le,pointsAtY:Le,pointsAtZ:Le,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tr,rev:Tr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tr,requiredFeatures:Tr,requiredFonts:Tr,requiredFormats:Tr,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:Le,specularExponent:Le,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Le,strikethroughThickness:Le,string:null,stroke:null,strokeDashArray:Tr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Le,strokeOpacity:Le,strokeWidth:null,style:null,surfaceScale:Le,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tr,tabIndex:Le,tableValues:null,target:null,targetX:Le,targetY:Le,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Le,underlineThickness:Le,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Le,values:null,vAlphabetic:Le,vMathematical:Le,vectorEffect:null,vHanging:Le,vIdeographic:Le,version:null,vertAdvY:Le,vertOriginX:Le,vertOriginY:Le,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Le,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:tP}),rP=wc({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()}}),sP=wc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:nP}),oP=wc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),w9={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"},j9=/[A-Z]/g,_S=/-[a-z]/g,k9=/^data[-\w.:]+$/i;function S9(e,t){const n=Bb(t);let r=t,o=vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&k9.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(_S,C9);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!_S.test(i)){let a=i.replace(j9,N9);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=Lw}return new o(r,t)}function N9(e){return"-"+e.toLowerCase()}function C9(e){return e.charAt(1).toUpperCase()}const E9=ZA([eP,b9,rP,sP,oP],"html"),Ow=ZA([eP,v9,rP,sP,oP],"svg");function T9(e){return e.join(" ").trim()}var pl={},my,DS;function R9(){if(DS)return my;DS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,d=`
|
|
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(A){var F=A.match(t);F&&(N+=F.length);var U=A.lastIndexOf(d);S=~U?A.length-U:S+A.length}function I(){var A={line:N,column:S};return function(F){return F.position=new T(A),_(),F}}function T(A){this.start=A,this.end={line:N,column:S},this.source=j.source}T.prototype.content=b;function R(A){var F=new Error(j.source+":"+N+":"+S+": "+A);if(F.reason=A,F.filename=j.source,F.line=N,F.column=S,F.source=b,!j.silent)throw F}function D(A){var F=A.exec(b);if(F){var U=F[0];return C(U),b=b.slice(U.length),F}}function _(){D(n)}function B(A){var F;for(A=A||[];F=$();)F!==!1&&A.push(F);return A}function $(){var A=I();if(!(f!=b.charAt(0)||p!=b.charAt(1))){for(var F=2;h!=b.charAt(F)&&(p!=b.charAt(F)||f!=b.charAt(F+1));)++F;if(F+=2,h===b.charAt(F-1))return R("End of comment missing");var U=b.slice(2,F-2);return S+=2,C(U),b=b.slice(F),S+=2,A({type:g,comment:U})}}function O(){var A=I(),F=D(r);if(F){if($(),!D(o))return R("property missing ':'");var U=D(i),H=A({type:y,property:w(F[0].replace(e,h)),value:U?w(U[0].replace(e,h)):h});return D(a),H}}function z(){var A=[];B(A);for(var F;F=O();)F!==!1&&(A.push(F),B(A));return A}return _(),z()}function w(b){return b?b.replace(l,h):h}return my=k,my}var $S;function A9(){if($S)return pl;$S=1;var e=pl&&pl.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(pl,"__esModule",{value:!0}),pl.default=n;const t=e(R9());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(d=>{if(d.type!=="declaration")return;const{property:f,value:p}=d;l?o(f,p,d):p&&(i=i||{},i[f]=p)}),i}return pl}var du={},IS;function P9(){if(IS)return du;IS=1,Object.defineProperty(du,"__esModule",{value:!0}),du.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,"-")},d=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 du.camelCase=d,du}var fu,MS;function _9(){if(MS)return fu;MS=1;var e=fu&&fu.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(A9()),n=P9();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,d){l&&d&&(a[(0,n.camelCase)(l,i)]=d)}),a}return r.default=r,fu=r,fu}var D9=_9();const $9=bd(D9),iP=aP("end"),Fw=aP("start");function aP(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 I9(e){const t=Fw(e),n=iP(e);if(t&&n)return{start:t,end:n}}function Ou(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?LS(e.position):"start"in e||"end"in e?LS(e):"line"in e||"column"in e?Vb(e):""}function Vb(e){return OS(e&&e.line)+":"+OS(e&&e.column)}function LS(e){return Vb(e&&e.start)+"-"+Vb(e&&e.end)}function OS(e){return e&&typeof e=="number"?e:1}class Zn 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 d=r.indexOf(":");d===-1?i.ruleId=r:(i.source=r.slice(0,d),i.ruleId=r.slice(d+1))}if(!i.place&&i.ancestors&&i.ancestors){const d=i.ancestors[i.ancestors.length-1];d&&(i.place=d.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=Ou(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}}Zn.prototype.file="";Zn.prototype.name="";Zn.prototype.reason="";Zn.prototype.message="";Zn.prototype.stack="";Zn.prototype.column=void 0;Zn.prototype.line=void 0;Zn.prototype.ancestors=void 0;Zn.prototype.cause=void 0;Zn.prototype.fatal=void 0;Zn.prototype.place=void 0;Zn.prototype.ruleId=void 0;Zn.prototype.source=void 0;const zw={}.hasOwnProperty,M9=new Map,L9=/[A-Z]/g,O9=new Set(["table","tbody","thead","tfoot","tr"]),F9=new Set(["td","th"]),lP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function z9(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=G9(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=K9(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"?Ow:E9,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=cP(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function cP(e,t,n){if(t.type==="element")return B9(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return U9(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return V9(e,t,n);if(t.type==="mdxjsEsm")return H9(e,t);if(t.type==="root")return W9(e,t,n);if(t.type==="text")return q9(e,t)}function B9(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Ow,e.schema=o),e.ancestors.push(t);const i=dP(e,t.tagName,!1),a=Y9(e,t);let l=Uw(e,t);return O9.has(t.tagName)&&(l=l.filter(function(d){return typeof d=="string"?!x9(d):!0})),uP(e,a,i,t),Bw(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function U9(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)}od(e,t.position)}function H9(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);od(e,t.position)}function V9(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Ow,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:dP(e,t.name,!0),a=X9(e,t),l=Uw(e,t);return uP(e,a,i,t),Bw(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function W9(e,t,n){const r={};return Bw(r,Uw(e,t)),e.create(t,e.Fragment,r,n)}function q9(e,t){return t.value}function uP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function K9(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 G9(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),d=Fw(r);return t(o,i,a,l,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function Y9(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&zw.call(t.properties,o)){const i=Q9(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&F9.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 X9(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 od(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 od(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function Uw(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:M9;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const d=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(d){const f=o.get(d)||0;a=d+"-"+f,o.set(d,f+1)}}const l=cP(e,i,a);l!==void 0&&n.push(l)}return n}function Q9(e,t,n){const r=S9(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?f9(n):T9(n)),r.property==="style"){let o=typeof n=="object"?n:J9(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Z9(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?w9[r.property]||r.property:r.attribute,n]}}function J9(e,t){try{return $9(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new Zn("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=lP+"#cannot-parse-style-attribute",o}}function dP(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=RS(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=RS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return zw.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);od(e)}function od(e,t){const n=new Zn("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=lP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Z9(e){const t={};let n;for(n in e)zw.call(e,n)&&(t[eV(n)]=e[n]);return t}function eV(e){let t=e.replace(L9,tV);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function tV(e){return"-"+e.toLowerCase()}const gy={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"]},nV={};function rV(e,t){const n=nV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return fP(e,r,o)}function fP(e,t,n){if(sV(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 FS(e.children,t,n)}return Array.isArray(e)?FS(e,t,n):""}function FS(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=fP(e[o],t,n);return r.join("")}function sV(e){return!!(e&&typeof e=="object")}const zS=document.createElement("i");function Hw(e){const t="&"+e+";";zS.innerHTML=t;const n=zS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Xs(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 Yr(e,t){return e.length>0?(Xs(e,e.length,0,t),e):t}const BS={}.hasOwnProperty;function oV(e){const t={};let n=-1;for(;++n<e.length;)iV(t,e[n]);return t}function iV(e,t){let n;for(n in t){const o=(BS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){BS.call(o,a)||(o[a]=[]);const l=i[a];aV(o[a],Array.isArray(l)?l:l?[l]:[])}}}function aV(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Xs(e,0,0,r)}function pP(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 Fl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Us=Ci(/[A-Za-z]/),Mr=Ci(/[\dA-Za-z]/),lV=Ci(/[#-'*+\--9=?A-Z^-~]/);function Wb(e){return e!==null&&(e<32||e===127)}const qb=Ci(/\d/),cV=Ci(/[\dA-Fa-f]/),uV=Ci(/[!-/:-@[-`{-~]/);function dt(e){return e!==null&&e<-2}function yr(e){return e!==null&&(e<0||e===32)}function Ot(e){return e===-2||e===-1||e===32}const dV=Ci(new RegExp("\\p{P}|\\p{S}","u")),fV=Ci(/\s/);function Ci(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function jc(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Mr(e.charCodeAt(n+1))&&Mr(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 Gt(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(d){return Ot(d)?(e.enter(n),l(d)):t(d)}function l(d){return Ot(d)&&i++<o?(e.consume(d),l):(e.exit(n),t(d))}}const pV={tokenize:hV};function hV(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"),Gt(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return dt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const mV={tokenize:gV},US={tokenize:xV};function gV(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,d,f)(S)}return f(S)}function d(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&N();const C=t.events.length;let I=C,T;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){T=t.events[I][1].end;break}j(r);let R=C;for(;R<t.events.length;)t.events[R][1].end={...T},R++;return Xs(t.events,I+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(US,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(US,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}),w(S)}function w(S){if(S===null){b(e.exit("chunkFlow"),!0),j(0),e.consume(S);return}return dt(S)?(e.consume(S),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(S),w)}function b(S,C){const I=t.sliceStream(S);if(C&&I.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(I),t.parser.lazy[S.start.line]){let 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 D=R,_,B;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){if(_){B=t.events[D][1].end;break}_=!0}for(j(r),T=R;T<t.events.length;)t.events[T][1].end={...B},T++;Xs(t.events,D+1,0,t.events.slice(R)),t.events.length=T}}function j(S){let C=n.length;for(;C-- >S;){const I=n[C];t.containerState=I[1],I[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 xV(e,t,n){return Gt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function HS(e){if(e===null||yr(e)||fV(e))return 1;if(dV(e))return 2}function Vw(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 Kb={name:"attention",resolveAll:yV,tokenize:bV};function yV(e,t){let n=-1,r,o,i,a,l,d,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;d=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};VS(h,-d),VS(g,d),a={type:d>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},l={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:g},i={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>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=Yr(f,[["enter",e[r][1],t],["exit",e[r][1],t]])),f=Yr(f,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),f=Yr(f,Vw(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),f=Yr(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=Yr(f,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Xs(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 bV(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=HS(r);let i;return a;function a(d){return i=d,e.enter("attentionSequence"),l(d)}function l(d){if(d===i)return e.consume(d),l;const f=e.exit("attentionSequence"),p=HS(d),h=!p||p===2&&o||n.includes(d),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(d)}}function VS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const vV={name:"autolink",tokenize:wV};function wV(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 Us(y)?(e.consume(y),a):y===64?n(y):f(y)}function a(y){return y===43||y===45||y===46||Mr(y)?(r=1,l(y)):f(y)}function l(y){return y===58?(e.consume(y),r=0,d):(y===43||y===45||y===46||Mr(y))&&r++<32?(e.consume(y),l):(r=0,f(y))}function d(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||Wb(y)?n(y):(e.consume(y),d)}function f(y){return y===64?(e.consume(y),p):lV(y)?(e.consume(y),f):n(y)}function p(y){return Mr(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||Mr(y))&&r++<63){const k=y===45?g:h;return e.consume(y),k}return n(y)}}const _m={partial:!0,tokenize:jV};function jV(e,t,n){return r;function r(i){return Ot(i)?Gt(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||dt(i)?t(i):n(i)}}const hP={continuation:{tokenize:SV},exit:NV,name:"blockQuote",tokenize:kV};function kV(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 SV(e,t,n){const r=this;return o;function o(a){return Ot(a)?Gt(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(hP,t,n)(a)}}function NV(e){e.exit("blockQuote")}const mP={name:"characterEscape",tokenize:CV};function CV(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 uV(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const gP={name:"characterReference",tokenize:EV};function EV(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"),d}function d(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),i=31,a=Mr,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=cV,p):(e.enter("characterReferenceValue"),i=7,a=qb,p(h))}function p(h){if(h===59&&o){const g=e.exit("characterReferenceValue");return a===Mr&&!Hw(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 WS={partial:!0,tokenize:RV},qS={concrete:!0,name:"codeFenced",tokenize:TV};function TV(e,t,n){const r=this,o={partial:!0,tokenize:I};let i=0,a=0,l;return d;function d(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)?Gt(e,h,"whitespace")(T):h(T))}function h(T){return T===null||dt(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(WS,w,C)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),g(T))}function g(T){return T===null||dt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(T)):Ot(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Gt(e,y,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),g)}function y(T){return T===null||dt(T)?h(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(T))}function k(T){return T===null||dt(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(T)):T===96&&T===l?n(T):(e.consume(T),k)}function w(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)?Gt(e,N,"linePrefix",i+1)(T):N(T)}function N(T){return T===null||dt(T)?e.check(WS,w,C)(T):(e.enter("codeFlowValue"),S(T))}function S(T){return T===null||dt(T)?(e.exit("codeFlowValue"),N(T)):(e.consume(T),S)}function C(T){return e.exit("codeFenced"),t(T)}function I(T,R,D){let _=0;return B;function B(F){return T.enter("lineEnding"),T.consume(F),T.exit("lineEnding"),$}function $(F){return T.enter("codeFencedFence"),Ot(F)?Gt(T,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):O(F)}function O(F){return F===l?(T.enter("codeFencedFenceSequence"),z(F)):D(F)}function z(F){return F===l?(_++,T.consume(F),z):_>=a?(T.exit("codeFencedFenceSequence"),Ot(F)?Gt(T,A,"whitespace")(F):A(F)):D(F)}function A(F){return F===null||dt(F)?(T.exit("codeFencedFence"),R(F)):D(F)}}}function RV(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 xy={name:"codeIndented",tokenize:PV},AV={partial:!0,tokenize:_V};function PV(e,t,n){const r=this;return o;function o(f){return e.enter("codeIndented"),Gt(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?d(f):dt(f)?e.attempt(AV,a,d)(f):(e.enter("codeFlowValue"),l(f))}function l(f){return f===null||dt(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),l)}function d(f){return e.exit("codeIndented"),t(f)}}function _V(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):dt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Gt(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):dt(a)?o(a):n(a)}}const DV={name:"codeText",previous:IV,resolve:$V,tokenize:MV};function $V(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 IV(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function MV(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"),d(h))}function d(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),d):h===96?(i=e.enter("codeTextSequence"),o=0,p(h)):dt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("codeTextData"),f(h))}function f(h){return h===null||h===32||h===96||dt(h)?(e.exit("codeTextData"),d(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 LV{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&&pu(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),pu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pu(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);pu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pu(this.left,n.reverse())}}}function pu(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 xP(e){const t={};let n=-1,r,o,i,a,l,d,f;const p=new LV(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"&&(d=r[1]._tokenizer.events,i=0,i<d.length&&d[i][1].type==="lineEndingBlank"&&(i+=2),i<d.length&&d[i][1].type==="content"))for(;++i<d.length&&d[i][1].type!=="content";)d[i][1].type==="chunkText"&&(d[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,OV(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 Xs(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!f}function OV(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,d=[],f={};let p,h,g=-1,y=n,k=0,w=0;const b=[w];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&&(w=g+1,b.push(w),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();d.push([N,N+j.length-1]),e.splice(N,2,j)}for(d.reverse(),g=-1;++g<d.length;)f[k+d[g][0]]=k+d[g][1],k+=d[g][1]-d[g][0]-1;return f}const FV={resolve:BV,tokenize:UV},zV={partial:!0,tokenize:HV};function BV(e){return xP(e),e}function UV(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):dt(l)?e.check(zV,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 HV(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Gt(e,i,"linePrefix")}function i(a){if(a===null||dt(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 yP(e,t,n,r,o,i,a,l,d){const f=d||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||Wb(j)?n(j):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(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||dt(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 w(j){return!p&&(j===null||j===41||yr(j))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(j)):p<f&&j===40?(e.consume(j),p++,w):j===41?(e.consume(j),p--,w):j===null||j===32||j===40||Wb(j)?n(j):(e.consume(j),j===92?b:w)}function b(j){return j===40||j===41||j===92?(e.consume(j),w):w(j)}}function bP(e,t,n,r,o,i){const a=this;let l=0,d;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&&!d||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):dt(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||dt(y)||l++>999?(e.exit("chunkString"),p(y)):(e.consume(y),d||(d=!Ot(y)),y===92?g:h)}function g(y){return y===91||y===92||y===93?(e.consume(y),l++,h):h(y)}}function vP(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,d):n(g)}function d(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),d(a)):g===null?n(g):dt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),Gt(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===a||g===null||dt(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 Fu(e,t){let n;return r;function r(o){return dt(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ot(o)?Gt(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const VV={name:"definition",tokenize:qV},WV={partial:!0,tokenize:KV};function qV(e,t,n){const r=this;let o;return i;function i(y){return e.enter("definition"),a(y)}function a(y){return bP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function l(y){return o=Fl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),d):n(y)}function d(y){return yr(y)?Fu(e,f)(y):f(y)}function f(y){return yP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function p(y){return e.attempt(WV,h,h)(y)}function h(y){return Ot(y)?Gt(e,g,"whitespace")(y):g(y)}function g(y){return y===null||dt(y)?(e.exit("definition"),r.parser.defined.push(o),t(y)):n(y)}}function KV(e,t,n){return r;function r(l){return yr(l)?Fu(e,o)(l):n(l)}function o(l){return vP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ot(l)?Gt(e,a,"whitespace")(l):a(l)}function a(l){return l===null||dt(l)?t(l):n(l)}}const GV={name:"hardBreakEscape",tokenize:YV};function YV(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return dt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const XV={name:"headingAtx",resolve:QV,tokenize:JV};function QV(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"},Xs(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function JV(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||yr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),d(p)):p===null||dt(p)?(e.exit("atxHeading"),t(p)):Ot(p)?Gt(e,l,"whitespace")(p):(e.enter("atxHeadingText"),f(p))}function d(p){return p===35?(e.consume(p),d):(e.exit("atxHeadingSequence"),l(p))}function f(p){return p===null||p===35||yr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),f)}}const ZV=["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"],KS=["pre","script","style","textarea"],eW={concrete:!0,name:"htmlFlow",resolveTo:rW,tokenize:sW},tW={partial:!0,tokenize:iW},nW={partial:!0,tokenize:oW};function rW(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 sW(e,t,n){const r=this;let o,i,a,l,d;return f;function f(q){return p(q)}function p(q){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(q),h}function h(q){return q===33?(e.consume(q),g):q===47?(e.consume(q),i=!0,w):q===63?(e.consume(q),o=3,r.interrupt?t:M):Us(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function g(q){return q===45?(e.consume(q),o=2,y):q===91?(e.consume(q),o=5,l=0,k):Us(q)?(e.consume(q),o=4,r.interrupt?t:M):n(q)}function y(q){return q===45?(e.consume(q),r.interrupt?t:M):n(q)}function k(q){const J="CDATA[";return q===J.charCodeAt(l++)?(e.consume(q),l===J.length?r.interrupt?t:O:k):n(q)}function w(q){return Us(q)?(e.consume(q),a=String.fromCharCode(q),b):n(q)}function b(q){if(q===null||q===47||q===62||yr(q)){const J=q===47,ne=a.toLowerCase();return!J&&!i&&KS.includes(ne)?(o=1,r.interrupt?t(q):O(q)):ZV.includes(a.toLowerCase())?(o=6,J?(e.consume(q),j):r.interrupt?t(q):O(q)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(q):i?N(q):S(q))}return q===45||Mr(q)?(e.consume(q),a+=String.fromCharCode(q),b):n(q)}function j(q){return q===62?(e.consume(q),r.interrupt?t:O):n(q)}function N(q){return Ot(q)?(e.consume(q),N):B(q)}function S(q){return q===47?(e.consume(q),B):q===58||q===95||Us(q)?(e.consume(q),C):Ot(q)?(e.consume(q),S):B(q)}function C(q){return q===45||q===46||q===58||q===95||Mr(q)?(e.consume(q),C):I(q)}function I(q){return q===61?(e.consume(q),T):Ot(q)?(e.consume(q),I):S(q)}function T(q){return q===null||q===60||q===61||q===62||q===96?n(q):q===34||q===39?(e.consume(q),d=q,R):Ot(q)?(e.consume(q),T):D(q)}function R(q){return q===d?(e.consume(q),d=null,_):q===null||dt(q)?n(q):(e.consume(q),R)}function D(q){return q===null||q===34||q===39||q===47||q===60||q===61||q===62||q===96||yr(q)?I(q):(e.consume(q),D)}function _(q){return q===47||q===62||Ot(q)?S(q):n(q)}function B(q){return q===62?(e.consume(q),$):n(q)}function $(q){return q===null||dt(q)?O(q):Ot(q)?(e.consume(q),$):n(q)}function O(q){return q===45&&o===2?(e.consume(q),U):q===60&&o===1?(e.consume(q),H):q===62&&o===4?(e.consume(q),W):q===63&&o===3?(e.consume(q),M):q===93&&o===5?(e.consume(q),V):dt(q)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(tW,Y,z)(q)):q===null||dt(q)?(e.exit("htmlFlowData"),z(q)):(e.consume(q),O)}function z(q){return e.check(nW,A,Y)(q)}function A(q){return e.enter("lineEnding"),e.consume(q),e.exit("lineEnding"),F}function F(q){return q===null||dt(q)?z(q):(e.enter("htmlFlowData"),O(q))}function U(q){return q===45?(e.consume(q),M):O(q)}function H(q){return q===47?(e.consume(q),a="",L):O(q)}function L(q){if(q===62){const J=a.toLowerCase();return KS.includes(J)?(e.consume(q),W):O(q)}return Us(q)&&a.length<8?(e.consume(q),a+=String.fromCharCode(q),L):O(q)}function V(q){return q===93?(e.consume(q),M):O(q)}function M(q){return q===62?(e.consume(q),W):q===45&&o===2?(e.consume(q),M):O(q)}function W(q){return q===null||dt(q)?(e.exit("htmlFlowData"),Y(q)):(e.consume(q),W)}function Y(q){return e.exit("htmlFlow"),t(q)}}function oW(e,t,n){const r=this;return o;function o(a){return dt(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 iW(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(_m,t,n)}}const aW={name:"htmlText",tokenize:lW};function lW(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),d}function d(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),I):M===63?(e.consume(M),S):Us(M)?(e.consume(M),D):n(M)}function f(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),i=0,k):Us(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):dt(M)?(a=h,H(M)):(e.consume(M),h)}function g(M){return M===45?(e.consume(M),y):h(M)}function y(M){return M===62?U(M):M===45?g(M):h(M)}function k(M){const W="CDATA[";return M===W.charCodeAt(i++)?(e.consume(M),i===W.length?w:k):n(M)}function w(M){return M===null?n(M):M===93?(e.consume(M),b):dt(M)?(a=w,H(M)):(e.consume(M),w)}function b(M){return M===93?(e.consume(M),j):w(M)}function j(M){return M===62?U(M):M===93?(e.consume(M),j):w(M)}function N(M){return M===null||M===62?U(M):dt(M)?(a=N,H(M)):(e.consume(M),N)}function S(M){return M===null?n(M):M===63?(e.consume(M),C):dt(M)?(a=S,H(M)):(e.consume(M),S)}function C(M){return M===62?U(M):S(M)}function I(M){return Us(M)?(e.consume(M),T):n(M)}function T(M){return M===45||Mr(M)?(e.consume(M),T):R(M)}function R(M){return dt(M)?(a=R,H(M)):Ot(M)?(e.consume(M),R):U(M)}function D(M){return M===45||Mr(M)?(e.consume(M),D):M===47||M===62||yr(M)?_(M):n(M)}function _(M){return M===47?(e.consume(M),U):M===58||M===95||Us(M)?(e.consume(M),B):dt(M)?(a=_,H(M)):Ot(M)?(e.consume(M),_):U(M)}function B(M){return M===45||M===46||M===58||M===95||Mr(M)?(e.consume(M),B):$(M)}function $(M){return M===61?(e.consume(M),O):dt(M)?(a=$,H(M)):Ot(M)?(e.consume(M),$):_(M)}function O(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),o=M,z):dt(M)?(a=O,H(M)):Ot(M)?(e.consume(M),O):(e.consume(M),A)}function z(M){return M===o?(e.consume(M),o=void 0,F):M===null?n(M):dt(M)?(a=z,H(M)):(e.consume(M),z)}function A(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||yr(M)?_(M):(e.consume(M),A)}function F(M){return M===47||M===62||yr(M)?_(M):n(M)}function U(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function H(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),L}function L(M){return Ot(M)?Gt(e,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):V(M)}function V(M){return e.enter("htmlTextData"),a(M)}}const Ww={name:"labelEnd",resolveAll:fW,resolveTo:pW,tokenize:hW},cW={tokenize:mW},uW={tokenize:gW},dW={tokenize:xW};function fW(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&&Xs(e,0,e.length,n),e}function pW(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 d={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",d,t],["enter",f,t]],l=Yr(l,e.slice(i+1,i+r+3)),l=Yr(l,[["enter",p,t]]),l=Yr(l,Vw(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Yr(l,[["exit",p,t],e[a-2],e[a-1],["exit",f,t]]),l=Yr(l,e.slice(a+1)),l=Yr(l,[["exit",d,t]]),Xs(e,i,e.length,l),e}function hW(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(Fl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),e.exit("labelEnd"),d):n(g)}function d(g){return g===40?e.attempt(cW,p,a?p:h)(g):g===91?e.attempt(uW,p,a?f:h)(g):a?p(g):h(g)}function f(g){return e.attempt(dW,p,h)(g)}function p(g){return t(g)}function h(g){return i._balanced=!0,n(g)}}function mW(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 yr(h)?Fu(e,i)(h):i(h)}function i(h){return h===41?p(h):yP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return yr(h)?Fu(e,d)(h):p(h)}function l(h){return n(h)}function d(h){return h===34||h===39||h===40?vP(e,f,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):p(h)}function f(h){return yr(h)?Fu(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 gW(e,t,n){const r=this;return o;function o(l){return bP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Fl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function xW(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 yW={name:"labelStartImage",resolveAll:Ww.resolveAll,tokenize:bW};function bW(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 vW={name:"labelStartLink",resolveAll:Ww.resolveAll,tokenize:wW};function wW(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 yy={name:"lineEnding",tokenize:jW};function jW(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Gt(e,t,"linePrefix")}}const Hp={name:"thematicBreak",tokenize:kW};function kW(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"),d(f)):r>=3&&(f===null||dt(f))?(e.exit("thematicBreak"),t(f)):n(f)}function d(f){return f===o?(e.consume(f),r++,d):(e.exit("thematicBreakSequence"),Ot(f)?Gt(e,l,"whitespace")(f):l(f))}}const pr={continuation:{tokenize:EW},exit:RW,name:"list",tokenize:CW},SW={partial:!0,tokenize:AW},NW={partial:!0,tokenize:TW};function CW(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:qb(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(Hp,n,f)(y):f(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(y)}return n(y)}function d(y){return qb(y)&&++a<10?(e.consume(y),d):(!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(_m,r.interrupt?n:p,e.attempt(SW,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 EW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(_m,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gt(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(NW,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gt(e,e.attempt(pr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function TW(e,t,n){const r=this;return Gt(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 RW(e){e.exit(this.containerState.type)}function AW(e,t,n){const r=this;return Gt(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 GS={name:"setextUnderline",resolveTo:PW,tokenize:_W};function PW(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 _W(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)?Gt(e,d,"lineSuffix")(f):d(f))}function d(f){return f===null||dt(f)?(e.exit("setextHeadingLine"),t(f)):n(f)}}const DW={tokenize:$W};function $W(e){const t=this,n=e.attempt(_m,r,e.attempt(this.parser.constructs.flowInitial,o,Gt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(FV,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 IW={resolveAll:jP()},MW=wP("string"),LW=wP("text");function wP(e){return{resolveAll:jP(e==="text"?OW: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),d}function d(p){return f(p)?(n.exit("data"),i(p)):(n.consume(p),d)}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 jP(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 OW(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,d;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)d=!0,l++;else if(f!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const f={type:n===e.length||d||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 FW={42:pr,43:pr,45:pr,48:pr,49:pr,50:pr,51:pr,52:pr,53:pr,54:pr,55:pr,56:pr,57:pr,62:hP},zW={91:VV},BW={[-2]:xy,[-1]:xy,32:xy},UW={35:XV,42:Hp,45:[GS,Hp],60:eW,61:GS,95:Hp,96:qS,126:qS},HW={38:gP,92:mP},VW={[-5]:yy,[-4]:yy,[-3]:yy,33:yW,38:gP,42:Kb,60:[vV,aW],91:vW,92:[GV,mP],93:Ww,95:Kb,96:DV},WW={null:[Kb,IW]},qW={null:[42,95]},KW={null:[]},GW=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:qW,contentInitial:zW,disable:KW,document:FW,flow:UW,flowInitial:BW,insideSpan:WW,string:HW,text:VW},Symbol.toStringTag,{value:"Module"}));function YW(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 d={attempt:R(I),check:R(T),consume:N,enter:S,exit:C,interrupt:R(T,{interrupt:!0})},f={code:null,containerState:{},defineSkip:w,events:[],now:k,parser:e,previous:null,sliceSerialize:g,sliceStream:y,write:h};let p=t.tokenize.call(f,d);return t.resolveAll&&i.push(t),f;function h($){return a=Yr(a,$),b(),a[a.length-1]!==null?[]:(D(t,0),f.events=Vw(i,f.events,f),f.events)}function g($,O){return QW(y($),O)}function y($){return XW(a,$)}function k(){const{_bufferIndex:$,_index:O,line:z,column:A,offset:F}=r;return{_bufferIndex:$,_index:O,line:z,column:A,offset:F}}function w($){o[$.line]=$.column,B()}function b(){let $;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for($=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===$&&r._bufferIndex<O.length;)j(O.charCodeAt(r._bufferIndex));else j(O)}}function j($){p=p($)}function N($){dt($)?(r.line++,r.column=1,r.offset+=$===-3?2:1,B()):$!==-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=$}function S($,O){const z=O||{};return z.type=$,z.start=k(),f.events.push(["enter",z,f]),l.push(z),z}function C($){const O=l.pop();return O.end=k(),f.events.push(["exit",O,f]),O}function I($,O){D($,O.from)}function T($,O){O.restore()}function R($,O){return z;function z(A,F,U){let H,L,V,M;return Array.isArray(A)?Y(A):"tokenize"in A?Y([A]):W(A);function W(Q){return le;function le(te){const pe=te!==null&&Q[te],be=te!==null&&Q.null,Ee=[...Array.isArray(pe)?pe:pe?[pe]:[],...Array.isArray(be)?be:be?[be]:[]];return Y(Ee)(te)}}function Y(Q){return H=Q,L=0,Q.length===0?U:q(Q[L])}function q(Q){return le;function le(te){return M=_(),V=Q,Q.partial||(f.currentConstruct=Q),Q.name&&f.parser.constructs.disable.null.includes(Q.name)?ne():Q.tokenize.call(O?Object.assign(Object.create(f),O):f,d,J,ne)(te)}}function J(Q){return $(V,M),F}function ne(Q){return M.restore(),++L<H.length?q(H[L]):U}}}function D($,O){$.resolveAll&&!i.includes($)&&i.push($),$.resolve&&Xs(f.events,O,f.events.length-O,$.resolve(f.events.slice(O),f)),$.resolveTo&&(f.events=$.resolveTo(f.events,f))}function _(){const $=k(),O=f.previous,z=f.currentConstruct,A=f.events.length,F=Array.from(l);return{from:A,restore:U};function U(){r=$,f.previous=O,f.currentConstruct=z,f.events.length=A,l=F,B()}}function B(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function XW(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 QW(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 JW(e){const r={constructs:oV([GW,...(e||{}).extensions||[]]),content:o(pV),defined:[],document:o(mV),flow:o(DW),lazy:{},string:o(MW),text:o(LW)};return r;function o(i){return a;function a(l){return YW(r,i,l)}}}function ZW(e){for(;!xP(e););return e}const YS=/[\0\t\n\r]/g;function eq(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const d=[];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(YS.lastIndex=h,f=YS.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)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),h<g&&(d.push(i.slice(h,g)),e+=g-h),y){case 0:{d.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,d.push(-2);e++<p;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}h=g+1}return l&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const tq=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function nq(e){return e.replace(tq,rq)}function rq(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return pP(n.slice(i?2:1),i?16:10)}return Hw(n)||e}const kP={}.hasOwnProperty;function sq(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),oq(n)(ZW(JW(n).document().write(eq()(e,t,!0))))}function oq(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ze),autolinkProtocol:_,autolinkEmail:_,atxHeading:i(oe),blockQuote:i(be),characterEscape:_,characterReference:_,codeFenced:i(Ee),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(Ee,a),codeText:i(Te,a),codeTextData:_,data:_,codeFlowValue:_,definition:i(ke),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(Ue),hardBreakEscape:i(je),hardBreakTrailing:i(je),htmlFlow:i(Se,a),htmlFlowData:_,htmlText:i(Se,a),htmlTextData:_,image:i(De),label:a,link:i(ze),listItem:i(Oe),listItemValue:g,listOrdered:i(Ye,h),listUnordered:i(Ye),paragraph:i(nt),reference:q,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(oe),strong:i(wt),thematicBreak:i(st)},exit:{atxHeading:d(),atxHeadingSequence:I,autolink:d(),autolinkEmail:pe,autolinkProtocol:te,blockQuote:d(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:Q,characterReference:le,codeFenced:d(b),codeFencedFence:w,codeFencedFenceInfo:y,codeFencedFenceMeta:k,codeFlowValue:B,codeIndented:d(j),codeText:d(F),codeTextData:B,data:B,definition:d(),definitionDestinationString:C,definitionLabelString:N,definitionTitleString:S,emphasis:d(),hardBreakEscape:d(O),hardBreakTrailing:d(O),htmlFlow:d(z),htmlFlowData:B,htmlText:d(A),htmlTextData:B,image:d(H),label:V,labelText:L,lineEnding:$,link:d(U),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:J,resourceDestinationString:M,resourceTitleString:W,resource:Y,setextHeading:d(D),setextHeadingLineSequence:R,setextHeadingText:T,strong:d(),thematicBreak:d()}};SP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ce){let ee={type:"root",children:[]};const xe={stack:[ee],tokenStack:[],config:t,enter:l,exit:f,buffer:a,resume:p,data:n},ie=[];let we=-1;for(;++we<ce.length;)if(ce[we][1].type==="listOrdered"||ce[we][1].type==="listUnordered")if(ce[we][0]==="enter")ie.push(we);else{const $e=ie.pop();we=o(ce,$e,we)}for(we=-1;++we<ce.length;){const $e=t[ce[we][0]];kP.call($e,ce[we][1].type)&&$e[ce[we][1].type].call(Object.assign({sliceSerialize:ce[we][2].sliceSerialize},xe),ce[we][1])}if(xe.tokenStack.length>0){const $e=xe.tokenStack[xe.tokenStack.length-1];($e[1]||XS).call(xe,void 0,$e[0])}for(ee.position={start:si(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:si(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},we=-1;++we<t.transforms.length;)ee=t.transforms[we](ee)||ee;return ee}function o(ce,ee,xe){let ie=ee-1,we=-1,$e=!1,Ce,se,me,Pe;for(;++ie<=xe;){const qe=ce[ie];switch(qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{qe[0]==="enter"?we++:we--,Pe=void 0;break}case"lineEndingBlank":{qe[0]==="enter"&&(Ce&&!Pe&&!we&&!me&&(me=ie),Pe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Pe=void 0}if(!we&&qe[0]==="enter"&&qe[1].type==="listItemPrefix"||we===-1&&qe[0]==="exit"&&(qe[1].type==="listUnordered"||qe[1].type==="listOrdered")){if(Ce){let de=ie;for(se=void 0;de--;){const pt=ce[de];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;se&&(ce[se][1].type="lineEndingBlank",$e=!0),pt[1].type="lineEnding",se=de}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarker"||pt[1].type==="listItemIndent"))break}me&&(!se||me<se)&&(Ce._spread=!0),Ce.end=Object.assign({},se?ce[se][1].start:qe[1].end),ce.splice(se||ie,0,["exit",Ce,qe[2]]),ie++,xe++}if(qe[1].type==="listItemPrefix"){const de={type:"listItem",_spread:!1,start:Object.assign({},qe[1].start),end:void 0};Ce=de,ce.splice(ie,0,["enter",de,qe[2]]),ie++,xe++,me=void 0,Pe=!0}}}return ce[ee][1]._spread=$e,xe}function i(ce,ee){return xe;function xe(ie){l.call(this,ce(ie),ie),ee&&ee.call(this,ie)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ce,ee,xe){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([ee,xe||void 0]),ce.position={start:si(ee.start),end:void 0}}function d(ce){return ee;function ee(xe){ce&&ce.call(this,xe),f.call(this,xe)}}function f(ce,ee){const xe=this.stack.pop(),ie=this.tokenStack.pop();if(ie)ie[0].type!==ce.type&&(ee?ee.call(this,ce,ie[0]):(ie[1]||XS).call(this,ce,ie[0]));else throw new Error("Cannot close `"+ce.type+"` ("+Ou({start:ce.start,end:ce.end})+"): it’s not open");xe.position.end=si(ce.end)}function p(){return rV(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ce){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=ce}function k(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=ce}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function j(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.value=ce.replace(/(\r?\n|\r)$/g,"")}function N(ce){const ee=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ee,xe.identifier=Fl(this.sliceSerialize(ce)).toLowerCase()}function S(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.title=ce}function C(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.url=ce}function I(ce){const ee=this.stack[this.stack.length-1];if(!ee.depth){const xe=this.sliceSerialize(ce).length;ee.depth=xe}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function R(ce){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function D(){this.data.setextHeadingSlurpLineEnding=void 0}function _(ce){const xe=this.stack[this.stack.length-1].children;let ie=xe[xe.length-1];(!ie||ie.type!=="text")&&(ie=it(),ie.position={start:si(ce.start),end:void 0},xe.push(ie)),this.stack.push(ie)}function B(ce){const ee=this.stack.pop();ee.value+=this.sliceSerialize(ce),ee.position.end=si(ce.end)}function $(ce){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const xe=ee.children[ee.children.length-1];xe.position.end=si(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&(_.call(this,ce),B.call(this,ce))}function O(){this.data.atHardBreak=!0}function z(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.value=ce}function A(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.value=ce}function F(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.value=ce}function U(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ee,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function H(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=ee,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function L(ce){const ee=this.sliceSerialize(ce),xe=this.stack[this.stack.length-2];xe.label=nq(ee),xe.identifier=Fl(ee).toLowerCase()}function V(){const ce=this.stack[this.stack.length-1],ee=this.resume(),xe=this.stack[this.stack.length-1];if(this.data.inReference=!0,xe.type==="link"){const ie=ce.children;xe.children=ie}else xe.alt=ee}function M(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.url=ce}function W(){const ce=this.resume(),ee=this.stack[this.stack.length-1];ee.title=ce}function Y(){this.data.inReference=void 0}function q(){this.data.referenceType="collapsed"}function J(ce){const ee=this.resume(),xe=this.stack[this.stack.length-1];xe.label=ee,xe.identifier=Fl(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function ne(ce){this.data.characterReferenceType=ce.type}function Q(ce){const ee=this.sliceSerialize(ce),xe=this.data.characterReferenceType;let ie;xe?(ie=pP(ee,xe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ie=Hw(ee);const we=this.stack[this.stack.length-1];we.value+=ie}function le(ce){const ee=this.stack.pop();ee.position.end=si(ce.end)}function te(ce){B.call(this,ce);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(ce)}function pe(ce){B.call(this,ce);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(ce)}function be(){return{type:"blockquote",children:[]}}function Ee(){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 Ue(){return{type:"emphasis",children:[]}}function oe(){return{type:"heading",depth:0,children:[]}}function je(){return{type:"break"}}function Se(){return{type:"html",value:""}}function De(){return{type:"image",title:null,url:"",alt:null}}function ze(){return{type:"link",title:null,url:"",children:[]}}function Ye(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Oe(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function nt(){return{type:"paragraph",children:[]}}function wt(){return{type:"strong",children:[]}}function it(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function si(e){return{line:e.line,column:e.column,offset:e.offset}}function SP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?SP(e,r):iq(e,r)}}function iq(e,t){let n;for(n in t)if(kP.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 XS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ou({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ou({start:t.start,end:t.end})+") is still open")}function aq(e){const t=this;t.parser=n;function n(r){return sq(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function lq(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 cq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
594
|
+
`}]}function uq(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 dq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function fq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pq(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=jc(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 d={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,d);const f={type:"element",tagName:"sup",properties:{},children:[d]};return e.patch(t,f),e.applyData(t,f)}function hq(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 mq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function NP(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 gq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return NP(e,t);const o={src:jc(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 xq(e,t){const n={src:jc(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 yq(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 bq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return NP(e,t);const o={href:jc(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 vq(e,t){const n={href:jc(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 wq(e,t,n){const r=e.all(t),o=n?jq(n):CP(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 d=r[r.length-1];d&&(o||d.type!=="element"||d.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 jq(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=CP(n[r])}return t}function CP(e){const t=e.spread;return t??e.children.length>1}function kq(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 Sq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Cq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Eq(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=Fw(t.children[1]),d=iP(t.children[t.children.length-1]);l&&d&&(a.position={start:l,end:d}),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 Tq(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 d=-1;const f=[];for(;++d<l;){const h=t.children[d],g={},y=a?a[d]: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 Rq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const QS=9,JS=32;function Aq(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(ZS(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(ZS(t.slice(o),o>0,!1)),i.join("")}function ZS(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===QS||i===JS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===QS||i===JS;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function Pq(e,t){const n={type:"text",value:Aq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _q(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Dq={blockquote:lq,break:cq,code:uq,delete:dq,emphasis:fq,footnoteReference:pq,heading:hq,html:mq,imageReference:gq,image:xq,inlineCode:yq,linkReference:bq,link:vq,listItem:wq,list:kq,paragraph:Sq,root:Nq,strong:Cq,table:Eq,tableCell:Rq,tableRow:Tq,text:Pq,thematicBreak:_q,toml:cp,yaml:cp,definition:cp,footnoteDefinition:cp};function cp(){}const EP=-1,Dm=0,zu=1,wh=2,qw=3,Kw=4,Gw=5,Yw=6,TP=7,RP=8,eN=typeof self=="object"?self:globalThis,$q=(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 Dm:case EP:return n(a,o);case zu:{const l=n([],o);for(const d of a)l.push(r(d));return l}case wh:{const l=n({},o);for(const[d,f]of a)l[r(d)]=r(f);return l}case qw:return n(new Date(a),o);case Kw:{const{source:l,flags:d}=a;return n(new RegExp(l,d),o)}case Gw:{const l=n(new Map,o);for(const[d,f]of a)l.set(r(d),r(f));return l}case Yw:{const l=n(new Set,o);for(const d of a)l.add(r(d));return l}case TP:{const{name:l,message:d}=a;return n(new eN[l](d),o)}case RP: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 eN[i](a),o)};return r},tN=e=>$q(new Map,e)(0),hl="",{toString:Iq}={},{keys:Mq}=Object,hu=e=>{const t=typeof e;if(t!=="object"||!e)return[Dm,t];const n=Iq.call(e).slice(8,-1);switch(n){case"Array":return[zu,hl];case"Object":return[wh,hl];case"Date":return[qw,hl];case"RegExp":return[Kw,hl];case"Map":return[Gw,hl];case"Set":return[Yw,hl];case"DataView":return[zu,n]}return n.includes("Array")?[zu,n]:n.includes("Error")?[TP,n]:[wh,n]},up=([e,t])=>e===Dm&&(t==="function"||t==="symbol"),Lq=(e,t,n,r)=>{const o=(a,l)=>{const d=r.push(a)-1;return n.set(l,d),d},i=a=>{if(n.has(a))return n.get(a);let[l,d]=hu(a);switch(l){case Dm:{let p=a;switch(d){case"bigint":l=RP,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+d);p=null;break;case"undefined":return o([EP],a)}return o([l,p],a)}case zu:{if(d){let g=a;return d==="DataView"?g=new Uint8Array(a.buffer):d==="ArrayBuffer"&&(g=new Uint8Array(a)),o([d,[...g]],a)}const p=[],h=o([l,p],a);for(const g of a)p.push(i(g));return h}case wh:{if(d)switch(d){case"BigInt":return o([d,a.toString()],a);case"Boolean":case"Number":case"String":return o([d,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],h=o([l,p],a);for(const g of Mq(a))(e||!up(hu(a[g])))&&p.push([i(g),i(a[g])]);return h}case qw:return o([l,a.toISOString()],a);case Kw:{const{source:p,flags:h}=a;return o([l,{source:p,flags:h}],a)}case Gw:{const p=[],h=o([l,p],a);for(const[g,y]of a)(e||!(up(hu(g))||up(hu(y))))&&p.push([i(g),i(y)]);return h}case Yw:{const p=[],h=o([l,p],a);for(const g of a)(e||!up(hu(g)))&&p.push(i(g));return h}}const{message:f}=a;return o([l,{name:d,message:f}],a)};return i},nN=(e,{json:t,lossy:n}={})=>{const r=[];return Lq(!(t||n),!!t,new Map,r)(e),r},jh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?tN(nN(e,t)):structuredClone(e):(e,t)=>tN(nN(e,t));function Oq(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 Fq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function zq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Oq,r=e.options.footnoteBackLabel||Fq,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let d=-1;for(;++d<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[d]);if(!f)continue;const p=e.all(f),h=String(f.identifier).toUpperCase(),g=jc(h.toLowerCase());let y=0;const k=[],w=e.footnoteCounts.get(h);for(;w!==void 0&&++y<=w;){k.length>0&&k.push({type:"text",value:" "});let N=typeof n=="string"?n:n(d,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(d,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:{...jh(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 AP=(function(e){if(e==null)return Vq;if(typeof e=="function")return $m(e);if(typeof e=="object")return Array.isArray(e)?Bq(e):Uq(e);if(typeof e=="string")return Hq(e);throw new Error("Expected function, string, or object as test")});function Bq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=AP(e[n]);return $m(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function Uq(e){const t=e;return $m(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function Hq(e){return $m(t);function t(n){return n&&n.type===e}}function $m(e){return t;function t(n,r,o){return!!(Wq(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function Vq(){return!0}function Wq(e){return e!==null&&typeof e=="object"&&"type"in e}const PP=[],qq=!0,rN=!1,Kq="skip";function Gq(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=AP(o),a=r?-1:1;l(e,void 0,[])();function l(d,f,p){const h=d&&typeof d=="object"?d:{};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 ("+(d.type+(y?"<"+y+">":""))+")"})}return g;function g(){let y=PP,k,w,b;if((!t||i(d,f,p[p.length-1]||void 0))&&(y=Yq(n(d,p)),y[0]===rN))return y;if("children"in d&&d.children){const j=d;if(j.children&&y[0]!==Kq)for(w=(r?j.children.length:-1)+a,b=p.concat(j);w>-1&&w<j.children.length;){const N=j.children[w];if(k=l(N,w,b)(),k[0]===rN)return k;w=typeof k[1]=="number"?k[1]:w+a}}return y}}}function Yq(e){return Array.isArray(e)?e:typeof e=="number"?[qq,e]:e==null?PP:[e]}function _P(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),Gq(e,i,l,o);function l(d,f){const p=f[f.length-1],h=p?p.children.indexOf(d):void 0;return a(d,h,p)}}const Gb={}.hasOwnProperty,Xq={};function Qq(e,t){const n=t||Xq,r=new Map,o=new Map,i=new Map,a={...Dq,...n.handlers},l={all:f,applyData:Zq,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:d,options:n,patch:Jq,wrap:tK};return _P(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 d(p,h){const g=p.type,y=l.handlers[g];if(Gb.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:w,...b}=p,j=jh(b);return j.children=l.all(p),j}return jh(p)}return(l.options.unknownHandler||eK)(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=sN(k.value)),!Array.isArray(k)&&k.type==="element")){const w=k.children[0];w&&w.type==="text"&&(w.value=sN(w.value))}Array.isArray(k)?h.push(...k):h.push(k)}}}return h}}function Jq(e,t){e.position&&(t.position=I9(e))}function Zq(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,jh(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function eK(e,t){const n=t.data||{},r="value"in t&&!(Gb.call(n,"hProperties")||Gb.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 tK(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 sN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function oN(e,t){const n=Qq(e,t),r=n.one(e,void 0),o=zq(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 nK(e,t){return e&&"run"in e?async function(n,r){const o=oN(n,{file:r,...t});await e.run(o,r)}:function(n,r){return oN(n,{file:r,...e||t})}}function iN(e){if(e)throw e}var by,aN;function rK(){if(aN)return by;aN=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 by=function d(){var f,p,h,g,y,k,w=arguments[0],b=1,j=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},b=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});b<j;++b)if(f=arguments[b],f!=null)for(p in f)h=l(w,p),g=l(f,p),w!==g&&(N&&g&&(i(g)||(y=o(g)))?(y?(y=!1,k=h&&o(h)?h:[]):k=h&&i(h)?h:{},a(w,{name:p,newValue:d(N,k,g)})):typeof g<"u"&&a(w,{name:p,newValue:g}));return w},by}var sK=rK();const vy=bd(sK);function Yb(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 oK(){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(d,...f){const p=e[++i];let h=-1;if(d){a(d);return}for(;++h<o.length;)(f[h]===null||f[h]===void 0)&&(f[h]=o[h]);o=f,p?iK(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 iK(e,t){let n;return r;function r(...a){const l=e.length>a.length;let d;l&&a.push(o);try{d=e.apply(this,a)}catch(f){const p=f;if(l&&n)throw p;return o(p)}l||(d&&d.then&&typeof d.then=="function"?d.then(i,o):d instanceof Error?o(d):i(d))}function o(a,...l){n||(n=!0,t(a,...l))}function i(a){o(null,a)}}const Fs={basename:aK,dirname:lK,extname:cK,join:uK,sep:"/"};function aK(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ud(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 lK(e){if(Ud(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 cK(e){Ud(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 uK(...e){let t=-1,n;for(;++t<e.length;)Ud(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":dK(n)}function dK(e){Ud(e);const t=e.codePointAt(0)===47;let n=fK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function fK(e,t){let n="",r=0,o=-1,i=0,a=-1,l,d;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(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),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 Ud(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const pK={cwd:hK};function hK(){return"/"}function Xb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function mK(e){if(typeof e=="string")e=new URL(e);else if(!Xb(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 gK(e)}function gK(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 wy=["history","path","basename","stem","extname","dirname"];class DP{constructor(t){let n;t?Xb(t)?n={path:t}:typeof t=="string"||xK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":pK.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<wy.length;){const i=wy[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)wy.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Fs.basename(this.path):void 0}set basename(t){ky(t,"basename"),jy(t,"basename"),this.path=Fs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Fs.dirname(this.path):void 0}set dirname(t){lN(this.basename,"dirname"),this.path=Fs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Fs.extname(this.path):void 0}set extname(t){if(jy(t,"extname"),lN(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=Fs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Xb(t)&&(t=mK(t)),ky(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Fs.basename(this.path,this.extname):void 0}set stem(t){ky(t,"stem"),jy(t,"stem"),this.path=Fs.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 Zn(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 jy(e,t){if(e&&e.includes(Fs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Fs.sep+"`")}function ky(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function lN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function xK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const yK=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),bK={}.hasOwnProperty;class Xw extends yK{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=oK()}copy(){const t=new Xw;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(vy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Cy("data",this.frozen),this.namespace[t]=n,this):bK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Cy("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=dp(t),r=this.parser||this.Parser;return Sy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Sy("process",this.parser||this.Parser),Ny("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const l=dp(t),d=r.parse(l);r.run(d,l,function(p,h,g){if(p||!h||!g)return f(p);const y=h,k=r.stringify(y,g);jK(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(),Sy("processSync",this.parser||this.Parser),Ny("processSync",this.compiler||this.Compiler),this.process(t,o),uN("processSync","process",n),r;function o(i,a){n=!0,iN(i),r=a}}run(t,n,r){cN(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 d=dp(n);o.run(t,d,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),uN("runSync","run",r),o;function i(a,l){iN(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=dp(n),o=this.compiler||this.Compiler;return Ny("stringify",o),cN(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Cy("use",this.frozen),t!=null)if(typeof t=="function")d(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")d(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[p,...h]=f;d(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=vy(!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 d(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 w=r[g][1];Yb(w)&&Yb(y)&&(y=vy(!0,w,y)),r[g]=[f,y,...k]}}}}const vK=new Xw().freeze();function Sy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ny(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Cy(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 cN(e){if(!Yb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function uN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function dp(e){return wK(e)?e:new DP(e)}function wK(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function jK(e){return typeof e=="string"||kK(e)}function kK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const SK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",dN=[],fN={allowDangerousHtml:!0},NK=/^(https?|ircs?|mailto|xmpp)$/i,CK=[{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 EK(e){const t=TK(e),n=RK(e);return AK(t.runSync(t.parse(n),n),e)}function TK(e){const t=e.rehypePlugins||dN,n=e.remarkPlugins||dN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...fN}:fN;return vK().use(aq).use(n).use(nK,r).use(t)}function RK(e){const t=e.children||"",n=new DP;return typeof t=="string"&&(n.value=t),n}function AK(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,d=t.urlTransform||PK;for(const p of CK)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+SK+p.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),_P(e,f),z9(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 gy)if(Object.hasOwn(gy,y)&&Object.hasOwn(p.properties,y)){const k=p.properties[y],w=gy[y];(w===null||w.includes(p.tagName))&&(p.properties[y]=d(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 PK(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||NK.test(e.slice(0,t))?e:""}function yn({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(EK,{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 ts(e){return`/api/projects/${encodeURIComponent(e)}/todos`}function _K(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 d=await fetch(ts(e));if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch todos")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),fc(d=>{d.type==="todos-updated"&&d.projectSlug===e&&l()}),{data:t,loading:r,error:i,refetch:l}}async function DK(e,t,n){await fetch(ts(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({description:t,tags:n})})}async function $K(e,t,n){await fetch(`${ts(e)}/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({summary:"Completed."})})}async function IK(e,t,n){await fetch(`${ts(e)}/${t}/block`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:n})})}async function MK(e,t,n){await fetch(`${ts(e)}/${t}/start`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({session:n})})}async function LK(e,t){await fetch(`${ts(e)}/${t}/reopen`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})}async function OK(e,t){await fetch(`${ts(e)}/${t}`,{method:"DELETE"})}async function FK(e,t,n){const r=await fetch(`${ts(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 $P(e,t,n){return`${ts(e)}/${t}/attachments/${encodeURIComponent(n)}`}async function zK(e,t,n){for(const r of n){const o=await fetch(`${ts(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 BK(e,t,n){const r=await fetch($P(e,t,n),{method:"DELETE"});if(!r.ok)throw new Error(await r.text().catch(()=>"")||`HTTP ${r.status}`)}async function IP(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 UK(e,t){return await IP(`${ts(e)}/promote`,t)}async function HK(e,t,n){await IP(`${ts(e)}/${t}/move`,{to:n})}const pN=[{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 MP({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=pN.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:pN.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 LP({item:e,copiedId:t,selected:n,editing:r,onBeginEdit:o,onEndEdit:i,onPatchDescription:a,onAddAttachments:l,onDeleteAttachment:d,attachmentUrl:f,onToggleSelected:p,onMoveOne:h,onStatusChange:g,onCopyId:y,onDelete:k,hotkeyRowProps:w,onDragOrigin:b,onDragStart:j,onDragEnd:N,isDragging:S}){return s.jsxs("div",{draggable:!0,"data-todo-id":e.id,...w??{},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(MP,{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(OP,{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(GK,{item:e})]}),s.jsx(FP,{item:e,attachmentUrl:f,onAdd:C=>l(e.id,C),onDelete:C=>d(e.id,C)})]}),t===e.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Or,{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(eh,{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(Hh,{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(vn,{className:"h-3 w-3"})})]})]})}function OP({description:e,status:t,editing:n,onBeginEdit:r,onEndEdit:o,onSave:i}){return n?s.jsx(VK,{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 VK({initialValue:e,onSave:t,onExit:n}){const r=m.useRef(e),[o,i]=m.useState(e),[a,l]=m.useState(!1),[d,f]=m.useState(!1),p=m.useRef(null),h=m.useRef(!1);m.useEffect(()=>{const w=p.current;w&&(w.focus(),w.select())},[]);const g=m.useCallback(()=>{var w;f(!0),window.setTimeout(()=>f(!1),260),(w=p.current)==null||w.focus()},[]),y=m.useCallback(async()=>{if(h.current)return;const w=o.trim();if(w.length===0){g();return}if(w===r.current){n();return}h.current=!0,l(!0);try{await t(w)}catch{}finally{l(!1),n()}},[o,n,t,g]);function k(w){w.key==="Enter"?(w.preventDefault(),y()):w.key==="Escape"&&(w.preventDefault(),h.current=!0,n())}return s.jsx("input",{ref:p,type:"text","data-no-drag":!0,disabled:a,value:o,onClick:w=>w.stopPropagation(),onChange:w=>i(w.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",d&&"syntaur-input-shake",a&&"opacity-70")})}function WK(e){return e.startsWith("image/")&&e!=="image/svg+xml"}function qK(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 FP({item:e,attachmentUrl:t,onAdd:n,onDelete:r}){const o=e.attachments??[],[i,a]=m.useState(!1),[l,d]=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){d(!0);try{await n(g),a(!1)}finally{d(!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(KK,{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(XE,{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=qK(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 KK({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:[WK(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(XE,{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(Nd,{className:"h-3 w-3"})})]})}function GK({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(ua,{delayDuration:120,children:s.jsxs(Dr,{children:[s.jsx($r,{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(Tv,{className:"h-2.5 w-2.5"}),s.jsx("span",{className:"block min-w-0 max-w-[120px] truncate",children:e.branch})]})}),s.jsx(mr,{children:e.branch})]})}):null,e.planDir?s.jsx(ua,{delayDuration:120,children:s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsx("button",{type:"button","data-no-drag":!0,onClick:n=>{n.stopPropagation(),Fd(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(GE,{className:"h-2.5 w-2.5"})})}),s.jsxs(mr,{children:["Plan: ",e.planDir]})]})}):null,e.worktreePath||e.createdAt||e.updatedAt?s.jsx(ua,{delayDuration:120,children:s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsx("span",{className:"text-[10px] text-muted-foreground/60 cursor-default",children:"·"})}),s.jsx(mr,{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 zP="__one_off__";function Qw({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o,defaultProject:i,defaultTitle:a,allowOneOff:l=!0}){const[d,f]=m.useState("new"),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,w]=m.useState(null),[b,j]=m.useState(null),[N,S]=m.useState(""),[C,I]=m.useState(""),[T,R]=m.useState(""),[D,_]=m.useState(""),[B,$]=m.useState(""),[O,z]=m.useState(""),[A,F]=m.useState(null),[U,H]=m.useState(!1),L=t.length>1;m.useEffect(()=>{if(!e){f("new"),y(null),S(""),I(""),R(""),_(""),$(""),z(""),F(null);return}S(i??""),I(a??"");let J=!1;return(async()=>{try{const ne=await fetch("/api/projects");if(!ne.ok)throw new Error(`HTTP ${ne.status}`);const Q=await ne.json();J||w(Q.filter(le=>!le.archived))}catch(ne){J||j(ne instanceof Error?ne.message:String(ne))}})(),()=>{J=!0}},[e,i,a]),m.useEffect(()=>{if(!B){F(null);return}let J=!1;return H(!0),(async()=>{try{const ne=await fetch(`/api/projects/${encodeURIComponent(B)}/assignments`);if(!ne.ok)throw new Error(`HTTP ${ne.status}`);const Q=await ne.json();J||F(Q)}catch{J||F([])}finally{J||H(!1)}})(),()=>{J=!0}},[B]);const V=m.useMemo(()=>k??[],[k]);async function M(J){if(J.preventDefault(),!N){y('Pick a target project (or "One-off").');return}if(L&&!C.trim()){y("Title is required when promoting multiple todos.");return}const ne=N===zP?{oneOff:!0}:{project:N};if(n.kind==="aggregate"){const le={groups:n.groups,mode:"new-assignment",target:ne,title:C.trim()||void 0,type:T.trim()||void 0,priority:D||void 0};await q(le);return}const Q={todoIds:t,mode:"new-assignment",target:ne,title:C.trim()||void 0,type:T.trim()||void 0,priority:D||void 0};await Y(Q)}async function W(J){if(J.preventDefault(),n.kind==="aggregate"){y("Existing-assignment mode does not support cross-workspace selections yet.");return}if(!B||!O){y("Pick both project and assignment.");return}const ne={todoIds:t,mode:"to-assignment",target:{assignment:`${B}/${O}`}};await Y(ne)}async function Y(J){h(!0),y(null);try{let ne;if(n.kind==="workspace")ne=await PO(n.workspace,J);else if(n.kind==="project")ne=await UK(n.projectId,J);else throw new Error("Aggregate scope requires runBulkMutation.");o(ne),r(!1)}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{h(!1)}}async function q(J){h(!0),y(null);try{const ne=await _O(J);o(ne),r(!1)}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{h(!1)}}return s.jsx(Bn,{open:e,onOpenChange:J=>p?void 0:r(J),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:["Promote ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(es,{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(QA,{value:d,onValueChange:J=>f(J),children:[s.jsxs(JA,{className:"flex gap-2 rounded-md border border-border/70 bg-card/80 p-1 mb-4",children:[s.jsx(Fb,{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(Fb,{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(zb,{value:"new",children:s.jsxs("form",{onSubmit:M,className:"space-y-4",children:[s.jsx(ml,{label:"Target project",children:s.jsx(hN,{value:N,onChange:S,projects:V,error:b,disabled:p,allowOneOff:l})}),s.jsx(ml,{label:L?"Title (required)":"Title (defaults to first todo)",children:s.jsx("input",{type:"text",value:C,onChange:J=>I(J.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(ml,{label:"Type",children:s.jsx("input",{type:"text",value:T,onChange:J=>R(J.target.value),placeholder:"feature",disabled:p,className:"editor-input bg-background/95 font-sans"})}),s.jsx(ml,{label:"Priority",children:s.jsxs("select",{value:D,onChange:J=>_(J.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(mN,{message:g}):null,s.jsx(gN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})}),s.jsx(zb,{value:"existing",children:s.jsxs("form",{onSubmit:W,className:"space-y-4",children:[s.jsx(ml,{label:"Project",children:s.jsx(hN,{value:B,onChange:J=>{$(J),z("")},projects:V,error:b,disabled:p})}),s.jsx(ml,{label:U?"Assignment (loading...)":"Assignment",children:s.jsxs("select",{value:O,onChange:J=>z(J.target.value),disabled:p||!B||U,className:"editor-input bg-background/95 font-sans",children:[s.jsx("option",{value:"",children:B?"Select assignment...":"Pick a project first"}),(A??[]).map(J=>s.jsxs("option",{value:J.slug,children:[J.title," (",J.status,")"]},J.slug))]})}),g?s.jsx(mN,{message:g}):null,s.jsx(gN,{onCancel:()=>r(!1),submitting:p,submitLabel:"Promote"})]})})]})]})})}function ml({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 hN({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:zP,children:"One-off (no project)"}):null,n.map(a=>s.jsxs("option",{value:a.slug,children:[a.title," (",a.slug,")"]},a.slug))]})}function mN({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 gN({onCancel:e,submitting:t,submitLabel:n}){return s.jsxs(zr,{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 BP({open:e,selectedIds:t,scope:n,onOpenChange:r,onDone:o}){const[i,a]=m.useState("project"),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(!1),[y,k]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null);m.useEffect(()=>{if(!e){a("project"),d(""),p(""),k(null),b(null);return}let R=!1;return(async()=>{try{const D=await fetch("/api/projects");if(!D.ok)throw new Error(`HTTP ${D.status}`);const _=await D.json();R||N(_.filter(B=>!B.archived))}catch(D){R||b(D instanceof Error?D.message:String(D))}})(),()=>{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 I(R,D){try{return n.kind==="workspace"?await DO(n.workspace,R,D):await HK(n.projectId,R,D),{ok:!0}}catch(_){return{ok:!1,error:_ instanceof Error?_.message:String(_)}}}async function T(R){R.preventDefault(),b(null);const D=C();if(typeof D=="string"){b(D);return}g(!0),k(null);const _=[],B=[];for(const $ of t){const O=await I($,D);O.ok?_.push($):B.push({id:$,error:O.error})}g(!1),o(),B.length===0?r(!1):k({succeeded:_,failed:B})}return s.jsx(Bn,{open:e,onOpenChange:R=>h?void 0:r(R),children:s.jsx(_n,{className:"max-w-xl",children:s.jsxs("form",{onSubmit:T,className:"space-y-4",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:["Move ",t.length," todo",t.length===1?"":"s"]}),s.jsxs(es,{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(Ey,{kind:"project",checked:i==="project",onChange:()=>a("project"),label:"Project"}),s.jsx(Ey,{kind:"workspace",checked:i==="workspace",onChange:()=>a("workspace"),label:"Workspace"}),s.jsx(Ey,{kind:"global",checked:i==="global",onChange:()=>a("global"),label:"Global"})]}),i==="project"?s.jsx(xN,{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(xN,{label:"Target workspace name",children:s.jsx("input",{type:"text",value:l,onChange:R=>d(R.target.value),disabled:h,placeholder:"e.g. syntaur",className:"editor-textarea w-full bg-background/95 font-sans"})}):null,w?s.jsx(YK,{message:w}):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(zr,{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 xN({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 Ey({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 YK({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 Jw({label:e,count:t,expanded:n,onToggle:r,isDropTarget:o=!1,onDragOver:i,onDragLeave:a,onDrop:l,children:d}){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(br,{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:d})]})}const UP=[{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 Im(e){switch(e){case"in_progress":return"in-progress";case"completed":return"done";case"open":case"blocked":default:return"open-blocked"}}function Zw(e){const t={"open-blocked":[],"in-progress":[],done:[]};for(const n of e)t[Im(n.status)].push(n);return UP.map(n=>({config:n,items:t[n.id]}))}const HP="syntaur.todos.sections.collapsed.v1",yN=Object.fromEntries(UP.map(e=>[e.id,e.defaultCollapsed]));function Ty(){if(typeof window>"u"||!window.localStorage)return{};try{const e=window.localStorage.getItem(HP);if(!e)return{};const t=JSON.parse(e);return t&&typeof t=="object"?t:{}}catch{return{}}}function XK(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(HP,JSON.stringify(e))}catch{}}function e0(e){const[t,n]=m.useState(()=>Ty()[e]??{});m.useEffect(()=>{n(Ty()[e]??{})},[e]);const r=m.useCallback(i=>t[i]??yN[i],[t]),o=m.useCallback(i=>{const a=Ty(),l=a[e]??{},d=l[i]??yN[i],f={...l,[i]:!d};a[e]=f,XK(a),n(f)},[e]);return{isCollapsed:r,toggle:o}}function QK({projectId:e}){const{data:t,loading:n,error:r,refetch:o}=_K(e),[i,a]=m.useState(""),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(""),[y,k]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(new Set),[S,C]=m.useState(!1),[I,T]=m.useState(!1),[R,D]=m.useState(null),_=m.useRef(null);Si("list:todos");const B=e0("project:"+e),[$,O]=m.useState(null),[z,A]=m.useState(null),F=m.useRef(null);async function U(ee,xe){ee.stopPropagation(),await Fd(xe)&&(k(xe),setTimeout(()=>k(ie=>ie===xe?null:ie),1500))}const H=m.useMemo(()=>{if(!(t!=null&&t.items))return[];const ee=new Set;for(const xe of t.items)for(const ie of xe.tags)ee.add(ie);return Array.from(ee).sort()},[t]),L=m.useMemo(()=>{if(!(t!=null&&t.items))return[];let ee=t.items;if(i.trim()){const xe=i.toLowerCase();ee=ee.filter(ie=>ie.description.toLowerCase().includes(xe)||ie.tags.some(we=>we.toLowerCase().includes(xe))||ie.id.includes(xe))}return l&&(ee=ee.filter(xe=>xe.status===l)),f&&(ee=ee.filter(xe=>xe.tags.includes(f))),ee},[t,i,l,f]);m.useEffect(()=>{N(new Set)},[i,l,f,e]);const V=m.useMemo(()=>L.filter(ee=>j.has(ee.id)).length,[L,j]),M=L.length>0&&V===L.length,W=V>0&&!M;function Y(ee){N(xe=>{const ie=new Set(xe);return ie.has(ee)?ie.delete(ee):ie.add(ee),ie})}function q(){N(ee=>{const xe=new Set(ee);if(M)for(const ie of L)xe.delete(ie.id);else for(const ie of L)xe.add(ie.id);return xe})}function J(){N(new Set)}const ne=R?[R]:Array.from(j);function Q(){N(new Set),D(null),o()}function le(){N(new Set),o()}async function te(){h.trim()&&(await DK(e,h.trim()),g(""),o())}async function pe(ee,xe,ie){ee.stopPropagation(),window.confirm(`Delete "${ie}"? This can't be undone.`)&&(await OK(e,xe),o())}async function be(ee,xe){switch(xe){case"open":await LK(e,ee);break;case"in_progress":await MK(e,ee);break;case"completed":await $K(e,ee);break;case"blocked":await IK(e,ee);break}o()}async function Ee(ee,xe){await FK(e,ee,xe),o()}async function Te(ee,xe){await zK(e,ee,xe),o()}async function ke(ee,xe){await BK(e,ee,xe),o()}const Ue=Zw(L),oe=Ue.filter(ee=>!B.isCollapsed(ee.config.id)).flatMap(ee=>ee.items),{hotkeyRowProps:je}=Rd(oe,{scope:"list:todos",bindO:!1,onOpen:ee=>b(ee.id)});Zt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ee;return(ee=_.current)==null?void 0:ee.focus()}}),Zt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>o()});const[Se,De]=ks(),ze=Se.get("focus");m.useEffect(()=>{if(!ze||!(t!=null&&t.items))return;const ee=t.items.find(ie=>ie.id===ze);if(!ee)return;const xe=Im(ee.status);B.isCollapsed(xe)&&B.toggle(xe)},[ze,t==null?void 0:t.items]),m.useEffect(()=>{if(!ze)return;const ee=document.querySelector(`[data-todo-id="${window.CSS.escape(ze)}"]`);if(!ee)return;ee.scrollIntoView({block:"nearest"}),ee.classList.add("ring-2","ring-primary/60");const xe=window.setTimeout(()=>{ee.classList.remove("ring-2","ring-primary/60"),De(ie=>{const we=new URLSearchParams(ie);return we.delete("focus"),we},{replace:!0})},1500);return()=>window.clearTimeout(xe)},[ze,oe.length,De]);const Ye=$?(t==null?void 0:t.items.find(ee=>ee.id===$))??null:null;function Oe(ee,xe){const ie=F.current;if(ie!=null&&ie.closest(Yl)){ee.preventDefault();return}ee.dataTransfer.effectAllowed="move",ee.dataTransfer.setData("text/plain",xe),O(xe)}function nt(){O(null),A(null)}function wt(ee,xe){!Ye||xe.statuses.includes(Ye.status)||(ee.preventDefault(),ee.dataTransfer.dropEffect="move",A(xe.id))}function it(ee,xe){z===xe.id&&!ee.currentTarget.contains(ee.relatedTarget)&&A(null)}function st(ee,xe){ee.preventDefault();const ie=Ye;nt(),!(!ie||xe.statuses.includes(ie.status))&&be(ie.id,xe.dropStatus)}if(n)return s.jsx(vt,{label:"Loading todos..."});if(r)return s.jsx(Pt,{error:r});const ce=(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.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Wn,{label:"Open",value:ce.open,icon:Xr}),s.jsx(Wn,{label:"In Progress",value:ce.in_progress,icon:Xr,tone:"info"}),s.jsx(Wn,{label:"Blocked",value:ce.blocked,icon:qh,tone:"warn"}),s.jsx(Wn,{label:"Total",value:ce.total,icon:Xr})]}),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:h,onChange:ee=>g(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&te(),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:te,disabled:!h.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($t,{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(ji,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:_,type:"text",placeholder:"Search...",value:i,onChange:ee=>a(ee.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs("select",{value:l,onChange:ee=>d(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[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"})]}),H.length>0&&s.jsxs("select",{value:f,onChange:ee=>p(ee.target.value),className:"h-9 rounded-md border border-border/70 bg-background px-2 text-sm text-foreground focus:border-foreground/30 focus:outline-none",children:[s.jsx("option",{value:"",children:"All tags"}),H.map(ee=>s.jsxs("option",{value:ee,children:["#",ee]},ee))]})]}),j.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:[j.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>C(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{D(null),T(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:J,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,L.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:M,ref:ee=>{ee&&(ee.indeterminate=W)},onChange:q,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",L.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let ee=-1;return Ue.map(({config:xe,items:ie})=>{const we=!B.isCollapsed(xe.id);return s.jsx(Jw,{label:xe.label,count:ie.length,expanded:we,onToggle:()=>B.toggle(xe.id),isDropTarget:z===xe.id,onDragOver:$e=>wt($e,xe),onDragLeave:$e=>it($e,xe),onDrop:$e=>st($e,xe),children:we&&ie.map($e=>(ee+=1,s.jsx(LP,{item:$e,copiedId:y,selected:j.has($e.id),editing:w===$e.id,onBeginEdit:Ce=>b(Ce),onEndEdit:()=>b(null),onPatchDescription:Ee,onAddAttachments:Te,onDeleteAttachment:ke,attachmentUrl:(Ce,se)=>$P(e,Ce,se),onToggleSelected:Ce=>Y(Ce),onMoveOne:(Ce,se)=>{se.stopPropagation(),D(Ce),T(!0)},onStatusChange:be,onCopyId:U,onDelete:pe,hotkeyRowProps:je(ee),onDragOrigin:Ce=>{F.current=Ce.target},onDragStart:Oe,onDragEnd:nt,isDragging:$===$e.id},$e.id)))},xe.id)})})()}),s.jsx(Qw,{open:S,selectedIds:Array.from(j),scope:{kind:"project",projectId:e},onOpenChange:C,onDone:le}),s.jsx(BP,{open:I,selectedIds:ne,scope:{kind:"project",projectId:e},onOpenChange:ee=>{T(ee),ee||D(null)},onDone:Q})]})}const JK={title:"Assignment",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},bN=new Set(["title"]);function VP({visibility:e,onChange:t}){const[n,r]=m.useState(!1);function o(a){if(bN.has(a))return;const d=e.hidden.includes(a)?e.hidden.filter(f=>f!==a):[...e.hidden,a];t({hidden:d})}const i=e.hidden.length;return s.jsxs(Bn,{open:n,onOpenChange:r,children:[s.jsx(HF,{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(PL,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsxs("span",{children:["Columns",i>0?` (${iy.length-i}/${iy.length})`:""]})]})}),s.jsxs(_n,{className:"max-w-sm",children:[s.jsx(sr,{children:s.jsx(Dn,{children:"Columns"})}),s.jsx("div",{className:"space-y-2",children:iy.map(a=>{const l=e.hidden.includes(a),d=bN.has(a);return s.jsxs("label",{className:`flex items-center gap-2 rounded-md px-2 py-1.5 text-sm ${d?"opacity-60":"cursor-pointer hover:bg-background/80"}`,children:[s.jsx("input",{type:"checkbox",checked:!l,onChange:()=>o(a),disabled:d,className:"h-4 w-4 rounded border-border accent-foreground"}),s.jsx("span",{children:JK[a]}),d?s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"always shown"}):null]},a)})})]})]})}const zl={...Gu,custom:!1},WP=`view-prefs.cache.v${Gu.version}`;let id=ZK(),gl=null;const ad=new Set;let qP=0;function t0(){return++qP}function n0(e){return e===qP}function ZK(){if(typeof window>"u"||!window.localStorage)return null;try{const e=window.localStorage.getItem(WP);if(!e)return null;const t=JSON.parse(e);return t.version!==Gu.version?null:t}catch{return null}}function eG(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(WP,JSON.stringify(e))}catch{}}function r0(e){id=e,eG(e);for(const t of ad)t(e)}function s0(e){if(!e||typeof e!="object")return zl;const t=e;return t.version!==Gu.version||!t.global||!t.projects?zl:{version:Gu.version,global:t.global,projects:t.projects,custom:t.custom===!0}}function o0(){if(gl)return gl;const e=t0();return gl=fetch("/api/view-prefs").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{const n=s0(t);return n0(e)&&r0(n),gl=null,id??n}).catch(()=>(gl=null,id??zl)),gl}function KP(e){const[t,n]=m.useState(()=>id??zl);return m.useEffect(()=>{let r=!1;return o0().then(o=>{r||n(o)}),ad.add(n),()=>{r=!0,ad.delete(n)}},[]),jT(t,e??null)}function tG(){const[e,t]=m.useState(()=>id??zl);return m.useEffect(()=>{let n=!1;return o0().then(r=>{n||t(r)}),ad.add(t),()=>{n=!0,ad.delete(t)}},[]),e}async function GP(e){const t=t0(),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=s0(await n.json());return n0(t)&&r0(r),r}function YP(e){return GP({global:e})}function XP(e,t){return GP({projects:{[e]:t}})}async function nG(){const e=t0(),t=await fetch("/api/view-prefs",{method:"DELETE"});if(!t.ok)throw new Error(`HTTP ${t.status}`);const n=s0(await t.json());return n0(e)&&r0(n),n}const vN=80;function QP({open:e,onOpenChange:t,initialName:n="",onSubmit:r,title:o="Save view"}){const[i,a]=m.useState(n),[l,d]=m.useState(!1),[f,p]=m.useState(null);m.useEffect(()=>{e&&(a(n),p(null),d(!1))},[e,n]);const h=i.trim(),g=h.length>0&&h.length<=vN;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-md",children:s.jsxs("form",{className:"space-y-4",onSubmit:async y=>{if(y.preventDefault(),!(!g||l)){d(!0),p(null);try{await r(h)}catch(k){p(k instanceof Error?k.message:String(k)),d(!1)}}},children:[s.jsx(sr,{children:s.jsx(Dn,{children:o})}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{type:"text",value:i,autoFocus:!0,required:!0,maxLength:vN,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(zr,{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 JP({scope:e,loadedViewId:t,onApply:n,onOpenSaveDialog:r}){const{views:o,loading:i}=$d(),[a,l]=m.useState(!1),d=m.useRef(null);m.useEffect(()=>{if(!a)return;function g(k){d.current&&!d.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=>CR(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:d,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:"Saved views",children:[s.jsx("span",{className:"max-w-[160px] truncate",children:h}),s.jsx(br,{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(Or,{className:"h-3.5 w-3.5","aria-hidden":"true"}):null}),s.jsx("span",{className:"truncate",children:g.name})]},g.id)})})]})}const rG=new Set(["overview","assignments","todos","dependencies","knowledge"]),wN="__unknown_type__";function jN(){const{slug:e,workspace:t}=Wt(),n=pn(),r=Vt();Si("project"),Zt({keys:"a",scope:"project",description:"Create assignment",handler:()=>r(`${n}/projects/${e}/create/assignment`)}),Zt({keys:"e",scope:"project",description:"Edit project",handler:()=>r(`${n}/projects/${e}/edit`)});const{data:o,loading:i,error:a,refetch:l}=k2(e),d=Ns(),f=Td(),{data:p}=ja(),[h,g]=ks(),y=h.get("tab"),k=y&&rG.has(y)?y:"overview";function w(ue){g(Be=>{const et=new URLSearchParams(Be);return ue==="overview"?et.delete("tab"):et.set("tab",ue),et},{replace:!0})}const b=e?`p:${e}`:null,j=KP(b),[N,S]=m.useState(()=>Zx(j.defaultView)),[C,I]=m.useState(()=>We(j.filters.status)),[T,R]=m.useState(()=>We(j.filters.assignee)),[D,_]=m.useState(()=>We(j.filters.priority)),[B,$]=m.useState(()=>We(j.filters.type)),[O,z]=m.useState(()=>We(j.filters.tags)),[A,F]=m.useState(null),[U,H]=m.useState(()=>j.grouping),[L,V]=m.useState(()=>j.sortField),[M,W]=m.useState(()=>j.sortDirection),[Y,q]=m.useState(()=>({collapsed:[]})),[J,ne]=m.useState(()=>({hidden:[]})),[Q,le]=m.useState(()=>({hidden:[]})),[te,pe]=m.useState(null),[be,Ee]=m.useState(!1),[Te,ke]=m.useState(!1),{toast:Ue,showToast:oe,dismissToast:je}=Eo(),Se={kind:"project",slug:e??"",workspace:t??null},De=h.get("loadView"),{view:ze,loading:Ye,error:Oe}=bi(De),{view:nt,loading:wt,error:it}=bi(te),st=m.useRef(null);m.useEffect(()=>{te&&!wt&&!it&&!nt&&pe(null)},[nt,it,te,wt]),m.useEffect(()=>{pe(null),st.current=null,F(null)},[e,t]),m.useEffect(()=>{S(Zx(j.defaultView)),I(We(j.filters.status)),R(We(j.filters.assignee)),_(We(j.filters.priority)),$(We(j.filters.type)),z(We(j.filters.tags)),H(j.grouping),V(j.sortField),W(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&&XP(b,ue).catch(Be=>{console.warn("Failed to persist project view prefs:",Be)})},[b]),ee=m.useCallback(ue=>{S(ue),ce({defaultView:ue})},[ce]),xe=m.useCallback(ue=>{I(ue),ce({filters:{status:ue}})},[ce]),ie=m.useCallback(ue=>{R(ue),ce({filters:{assignee:ue}})},[ce]),we=m.useCallback(ue=>{_(ue),ce({filters:{priority:ue}})},[ce]),$e=m.useCallback(ue=>{$(ue),ce({filters:{type:ue}})},[ce]),Ce=m.useCallback(ue=>{z(ue),ce({filters:{tags:ue}})},[ce]),se=m.useCallback(ue=>{H(ue),ce({grouping:ue})},[ce]),me=m.useCallback(ue=>{V(ue),ce({sortField:ue})},[ce]),Pe=m.useCallback(ue=>{W(ue),ce({sortDirection:ue})},[ce]),qe=m.useCallback(()=>({viewMode:N,filters:{status:C,priority:D,type:B,assignee:T,tags:O,project:"all",activity:"all",dateRange:da(A)},sortField:L,sortDirection:M,listSectionVisibility:Y,kanbanColumnVisibility:J,tableColumnVisibility:Q}),[N,C,D,B,T,O,A,L,M,Y,J,Q]),de=m.useCallback(ue=>{CA(ue,{setViewMode:Be=>S(Zx(Be)),setStatusFilter:xe,setPriorityFilter:we,setTypeFilter:$e,setAssigneeFilter:ie,setTagsFilter:Ce,setDateRange:F,setSortField:me,setSortDirection:Pe,setListSectionVisibility:q,setKanbanColumnVisibility:ne,setTableColumnVisibility:le}),pe(ue.id)},[xe,we,$e,ie,Ce,me,Pe]),pt=m.useCallback(ue=>{de(ue),st.current=ue.id,g(Be=>{const et=new URLSearchParams(Be);return et.set("loadView",ue.id),et},{replace:!0})},[de,g]),yt=m.useCallback(async ue=>{try{const Be=Xl({name:ue,context:{workspace:t??null,projectSlug:e??null},state:qe()}),et=await ql(Be),bt=et.views[et.views.length-1];pe((bt==null?void 0:bt.id)??null),bt&&(st.current=bt.id,g(Kn=>{const wr=new URLSearchParams(Kn);return wr.set("loadView",bt.id),wr},{replace:!0})),Ee(!1),ke(!1),oe(`Saved view "${ue}"`,"success")}catch(Be){throw oe(Be instanceof Error?Be.message:"Failed to save view","error"),Be}},[qe,g,oe,e,t]),St=m.useCallback(async()=>{if(!(!te||!nt))try{const ue=We(nt.config.filters.project)[0]??null,Be=Xl({name:nt.name,context:{workspace:t??null,projectSlug:ue},state:qe()}),et=xh(nt.config,Be.config,Be.config);await fh(te,{config:et}),oe("View updated","success")}catch(ue){oe(ue instanceof Error?ue.message:"Failed to update view","error")}},[qe,nt,te,oe,t]);m.useEffect(()=>{if(!De){st.current=null;return}if(st.current!==De&&(te&&te!==De&&pe(null),!Ye)){if(Oe){oe("Couldn't load saved view — try again","error");return}if(ze){if(st.current=De,!CR(ze,{kind:"project",slug:e??"",workspace:t??null})){r(TA(ze),{replace:!0});return}de(ze),g(ue=>{const Be=new URLSearchParams(ue);return Be.delete("loadView"),Be},{replace:!0});return}st.current=De,oe("Saved view no longer exists","error"),g(ue=>{const Be=new URLSearchParams(ue);return Be.delete("loadView"),Be},{replace:!0})}},[De,ze,Ye,Oe,te,de,g,oe,r,e,t]);function ct(ue){L===ue?Pe(M==="asc"?"desc":"asc"):(me(ue),Pe("asc"))}const ht=m.useMemo(()=>o?Object.fromEntries(o.assignments.flatMap(ue=>{const Be=`${n}/projects/${o.slug}/assignments/${ue.slug}`;return[[ue.slug,Be],[ue.title,Be]]})):{},[o]);async function Nt(ue){try{const Be=await fetch(`/api/projects/${e}/status-override`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:ue})});if(!Be.ok){const et=await Be.json().catch(()=>null);oe((et==null?void 0:et.error)||`HTTP ${Be.status}`,"error");return}l(),oe(ue?"Status override set":"Status override cleared","success")}catch(Be){oe(Be instanceof Error?Be.message:"Failed to update status","error")}}async function ye(ue){try{const Be=await fetch(`/api/projects/${e}/${ue?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Be.ok){const et=await Be.json().catch(()=>null);oe((et==null?void 0:et.error)||`HTTP ${Be.status}`,"error");return}l(),oe(ue?"Project archived":"Project restored","success")}catch(Be){oe(Be instanceof Error?Be.message:"Failed to update archive state","error")}}async function Ve(ue){try{const Be=await fetch(`/api/projects/${e}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace:ue})});if(!Be.ok){const et=await Be.json().catch(()=>null);oe((et==null?void 0:et.error)||`HTTP ${Be.status}`,"error");return}l(),oe(ue?`Moved to "${ue}"`:"Moved to ungrouped","success")}catch(Be){oe(Be instanceof Error?Be.message:"Failed to move workspace","error")}}if(i)return s.jsx(vt,{label:"Loading project workspace…"});if(a||!o)return s.jsx(Pt,{error:a||"Project not found."});const Je=(()=>{const ue=new Set;for(const et of o.assignments)et.assignee&&ue.add(et.assignee);const Be=[{value:"__unassigned__",label:"Unassigned"}];for(const et of Array.from(ue).sort())Be.push({value:et,label:et});return Be})(),Ft=Array.from(new Set(o.assignments.flatMap(ue=>ue.tags??[]))).sort().map(ue=>({value:ue,label:ue})),zt=o.assignments.filter(ue=>mU(ue,{status:C,priority:D,type:B,assignee:T,tags:O,dateRange:da(A)})),hn=Ld(zt,L,M),Et=new Set(f.definitions.map(ue=>ue.id)),$n=U==="type"?[...f.definitions.map(ue=>({id:ue.id,title:_l(f,ue.id),description:ue.description})),...zt.some(ue=>!ue.type||!Et.has(ue.type))?[{id:wN,title:"Other",description:"Assignments with no recognized type."}]:[]]:_A(d.order).map(ue=>({id:ue,title:xi(d,ue),description:Od(ue)}));function Tt({field:ue,children:Be}){const et=L===ue;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>ct(ue),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Be,et?M==="asc"?s.jsx(qE,{className:"h-3 w-3"}):s.jsx(br,{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(wn,{status:o.status}),o.statusOverride&&s.jsx("button",{type:"button",className:"shell-action border-warning-foreground/40 text-warning-foreground",onClick:()=>Nt(null),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",value:"",onChange:ue=>{ue.target.value&&Nt(ue.target.value)},title:"Override project status",children:[s.jsx("option",{value:"",children:"Set Status…"}),d.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",onClick:()=>ye(!o.archived),title:o.archived?"Restore this project and its cascade-hidden assignments":"Archive this project (hides it and its assignments from normal views)",children:o.archived?"Restore":"Archive"}),p&&p.workspaces.length>0&&s.jsxs("select",{className:"shell-action appearance-none bg-transparent text-sm",value:"",onChange:ue=>{ue.target.value==="_ungrouped"?Ve(null):ue.target.value&&Ve(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(Ie,{className:"shell-action",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(u1,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Project"})]}),s.jsxs(Ie,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx($t,{className:"h-4 w-4"}),s.jsx("span",{children:"New Assignment"})]}),s.jsx(Iw,{externalIds:o.externalIds}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Created ",qn(o.created),". Last source update ",Jr(o.updated),"."]})]}),s.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-5",children:[s.jsx(Wn,{label:"Assignments",value:o.progress.total}),s.jsx(Wn,{label:"In Progress",value:o.progress.in_progress??0,tone:"info"}),s.jsx(Wn,{label:"Review",value:o.progress.review??0,tone:"info"}),s.jsx(Wn,{label:"Blocked",value:o.progress.blocked??0,tone:"warn"}),s.jsx(Wn,{label:"Completed",value:o.progress.completed??0,tone:"success"})]}),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(Pm,{value:k,onValueChange:w,items:[{value:"overview",label:"Overview",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ge,{title:"Project Overview",children:s.jsx(yn,{content:o.body,emptyState:"This project does not have overview content yet."})})})},{value:"assignments",label:"Assignments",count:o.assignments.filter(ue=>!ue.archived).length,content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ge,{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(bn,{ariaLabel:"Status filter",className:"max-w-[170px]",allLabel:"All statuses",options:d.statuses.map(ue=>({value:ue.id,label:ue.label})),value:C,onChange:xe}),s.jsx(bn,{ariaLabel:"Assignee filter",className:"max-w-[170px]",allLabel:"All assignees",options:Je,value:T,onChange:ie}),s.jsx(bn,{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:D,onChange:we}),s.jsx(bn,{ariaLabel:"Type filter",className:"max-w-[170px]",allLabel:"All types",options:f.definitions.map(ue=>({value:ue.id,label:_l(f,ue.id)})),value:B,onChange:$e}),s.jsx(bn,{ariaLabel:"Tags filter",className:"max-w-[170px]",allLabel:"Any tags",options:Ft,value:O,onChange:Ce}),s.jsx(Cm,{className:"max-w-[190px]",value:A,onChange:F}),N==="kanban"&&s.jsxs("select",{value:U==="type"?"type":"status",onChange:ue=>se(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(Rm,{value:N,onChange:ue=>ee(ue),options:[{value:"kanban",label:"Kanban"},{value:"table",label:"Table"}]}),s.jsx(JP,{scope:Se,loadedViewId:te,onApply:pt,onOpenSaveDialog:()=>{ke(!1),Ee(!0)}}),s.jsx("button",{type:"button",onClick:()=>{nt?St():(ke(!1),Ee(!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:nt?`Update ${nt.name}`:"Save current view",children:nt?`Update '${nt.name}'`:"Save view"}),nt?s.jsx("button",{type:"button",onClick:()=>{ke(!0),Ee(!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:zt.length===0?s.jsx(Rt,{title:"No assignments match these filters",description:"Clear the current filters or create a new assignment for this project.",actions:s.jsx(Ie,{className:"shell-action shell-action--cta",to:`${n}/projects/${o.slug}/create/assignment`,children:"Create Assignment"})}):N==="kanban"?s.jsx(Nm,{columns:$n,items:hn,getItemId:ue=>ue.slug,getColumnId:ue=>U==="type"?ue.type&&Et.has(ue.type)?ue.type:wN:ue.status,dragDisabled:!0,renderCard:ue=>s.jsx(sG,{projectSlug:o.slug,assignment:ue}),emptyMessage:ue=>`No ${ue.title.toLowerCase()} assignments.`,hiddenColumnIds:J.hidden,onHideColumn:ue=>ne(Be=>({hidden:Be.hidden.includes(ue)?Be.hidden.filter(bt=>bt!==ue):[...Be.hidden,ue]}))}):(()=>{const ue=new Set(Q.hidden),Be=et=>et==="title"||!ue.has(et);return s.jsxs("div",{className:"overflow-x-auto",children:[s.jsx("div",{className:"mb-3 flex items-center justify-end",children:s.jsx(VP,{visibility:Q,onChange:le})}),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:[Be("title")?s.jsx(Tt,{field:"title",children:"Assignment"}):null,Be("status")?s.jsx(Tt,{field:"status",children:"Status"}):null,s.jsx("th",{className:"pb-3 font-medium",children:"Type"}),Be("priority")?s.jsx(Tt,{field:"priority",children:"Priority"}):null,Be("assignee")?s.jsx(Tt,{field:"assignee",children:"Assignee"}):null,Be("dependencies")?s.jsx(Tt,{field:"dependencies",children:"Dependencies"}):null,Be("created")?s.jsx(Tt,{field:"created",children:"Created"}):null,Be("updated")?s.jsx(Tt,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:hn.map(et=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[Be("title")?s.jsx("td",{className:"py-4",children:s.jsx(Ie,{to:`${n}/projects/${o.slug}/assignments/${et.slug}`,className:"font-semibold text-foreground hover:text-primary",children:et.title})}):null,Be("status")?s.jsx("td",{className:"py-4",children:s.jsx(wn,{status:et.status,className:"max-w-[150px]"})}):null,s.jsx("td",{className:"py-4",children:s.jsx(Na,{type:et.type,compact:!0})}),Be("priority")?s.jsx("td",{className:"py-4 capitalize text-muted-foreground",children:et.priority}):null,Be("assignee")?s.jsx("td",{className:"py-4 text-muted-foreground",children:et.assignee??"—"}):null,Be("dependencies")?s.jsx("td",{className:"py-4 text-muted-foreground",children:et.dependsOn.length}):null,Be("created")?s.jsx("td",{className:"py-4 text-muted-foreground",children:qn(et.created)}):null,Be("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:qn(et.updated)}):null]},et.slug))})]})]})})()})})},{value:"todos",label:"Todos",content:s.jsx(QK,{projectId:o.slug})},{value:"dependencies",label:"Dependencies",content:o.dependencyGraph?s.jsx(Ge,{title:"Dependency Graph",description:"Rendered from the derived graph when available, with a source-based fallback.",children:s.jsx(c9,{definition:o.dependencyGraph,nodeRoutes:ht})}):s.jsx(Rt,{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(Ge,{title:"Resources",description:"Shared project references.",actions:s.jsxs(Ie,{className:"shell-action",to:`/resources/new?project=${o.slug}`,children:[s.jsx($t,{className:"h-4 w-4"}),s.jsx("span",{children:"New Resource"})]}),children:o.resources.length===0?s.jsx(Rt,{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(Ie,{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(Ge,{title:"Memories",description:"Learnings and patterns captured during the project.",actions:s.jsxs(Ie,{className:"shell-action",to:`/memories/new?project=${o.slug}`,children:[s.jsx($t,{className:"h-4 w-4"}),s.jsx("span",{children:"New Memory"})]}),children:o.memories.length===0?s.jsx(Rt,{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(Ie,{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(Ge,{title:"Progress Summary",children:s.jsx(bh,{progress:o.progress,showLegend:!0})}),s.jsx(Ge,{title:"Attention",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Blocked"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.blockedCount})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Failed"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.failedCount})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("dt",{className:"text-muted-foreground",children:"Unanswered questions"}),s.jsx("dd",{className:"font-semibold text-foreground",children:o.needsAttention.openQuestions})]})]})}),s.jsx(Ge,{title:"Quick Links",children:s.jsxs("div",{className:"space-y-2 text-sm",children:[s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/edit`,children:[s.jsx(u1,{className:"h-4 w-4"}),"Edit project source"]}),s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:`${n}/projects/${o.slug}/create/assignment`,children:[s.jsx($t,{className:"h-4 w-4"}),"Create assignment"]}),s.jsxs(Ie,{className:"flex items-center gap-2 text-primary hover:underline",to:"/help",children:[s.jsx(wL,{className:"h-4 w-4"}),"Review project rules"]}),s.jsxs("button",{type:"button",onClick:()=>w("dependencies"),className:"flex items-center gap-2 text-primary hover:underline",children:[s.jsx(Tv,{className:"h-4 w-4"}),"Jump to dependencies"]})]})}),o.archived?s.jsxs(Ge,{title:"Archive Metadata",children:[s.jsxs("p",{className:"text-sm leading-6 text-muted-foreground",children:["Archived ",o.archivedAt?Jr(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(Ni,{toast:Ue,onDismiss:je}),s.jsx(QP,{open:be,onOpenChange:ue=>{Ee(ue),ue||ke(!1)},initialName:Te&&nt?`${nt.name} (copy)`:"",title:Te?"Save as new view":"Save view",onSubmit:yt})]})}function sG({projectSlug:e,assignment:t}){const n=pn();return s.jsxs(Ie,{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(Qr,{value:t.id})})]}),s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Updated ",qn(t.updated)]})]}),s.jsx(wn,{status:t.status,className:"max-w-[150px]"})]}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsx(Na,{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 ZP({sessionId:e,disabled:t=!1,disabledReason:n,onError:r,onNotice:o}){const[i,a]=m.useState(!1),[l,d]=m.useState(!1);async function f(){var h;if(t||l)return;d(!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{d(!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(d1,{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(Or,{className:"h-3 w-3 text-status-completed-foreground","aria-hidden":"true"}):s.jsx(d1,{className:"h-3 w-3","aria-hidden":"true"})})}function mu(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 oG(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 iG(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 e_(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 t_(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 aG(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 n_(e){return e.requiresReason||e.command==="block"}async function lG(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 cG(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 uG(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 dG(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 i0 extends Error{constructor(t,n){super(t),this.stderr=n,this.name="CreateWorktreeError"}}async function a0(e){const t=await e.json().catch(()=>null);return new i0((t==null?void 0:t.error)||`HTTP ${e.status}`,t==null?void 0:t.stderr)}async function fG(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 pG(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 hG(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 a0(r);return(await r.json()).assignment}async function mG(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 a0(n);return(await n.json()).assignment}async function gG(e){const{url:t}=oG(e),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"});if(!n.ok)throw await a0(n);return await n.json()}async function Mm(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 xG(e,t,n){const r=await fetch(`/api/projects/${e}/assignments/${t}/repository-branches?repo=${encodeURIComponent(n)}`);return Mm(r)}async function yG(e,t){const n=await fetch(`/api/assignments/${e}/repository-branches?repo=${encodeURIComponent(t)}`);return Mm(n)}async function bG(e,t){const n=await fetch(`/api/projects/${e}/assignments/${t}/source-assignments`);return(await Mm(n)).sourceAssignments}async function vG(e){const t=await fetch(`/api/assignments/${e}/source-assignments`);return(await Mm(t)).sourceAssignments}function r_(){const[e,t]=m.useState(!1),[n,r]=m.useState(null),[o,i]=m.useState(null),[a,l]=m.useState(null),[d,f]=m.useState(null),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,w]=m.useState(null),[b,j]=m.useState(null);async function N(T,R,D,_){if(!e){t(!0);try{const B=await fetch("/api/launch/preflight",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:{kind:T.kind,id:T.id}})});if(!B.ok){window.location.href=mu(T,R,void 0,D,_);return}const $=await B.json();if($.ok){window.location.href=mu(T,R,void 0,D,_);return}if($.reason==="workspace-path-invalid"){$.recreate?(f($.recreate),h({target:T,mode:R,agentId:D,prompt:_})):l($.message);return}r($),i({target:T,mode:R,agentId:D,prompt:_})}catch(B){console.warn("preflight failed, firing without override:",B),window.location.href=mu(T,R,void 0,D,_)}finally{t(!1)}}}function S(){!n||!o||(window.location.href=mu(o.target,o.mode,n.suggestedFallback,o.agentId,o.prompt),r(null),i(null))}async function C(){if(!(!d||!p||g)){y(!0),w(null);try{const T=await gG({kind:d.kind,id:d.id,projectSlug:d.projectSlug,assignmentSlug:d.assignmentSlug}),{target:R,mode:D,agentId:_,prompt:B}=p;f(null),h(null),window.location.href=mu(R,D,void 0,_,B),!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){w(T instanceof i0&&T.stderr?`${T.message}
|
|
604
|
+
${T.stderr}`:T instanceof Error?T.message:String(T))}finally{y(!1)}}}const I=s.jsxs(s.Fragment,{children:[s.jsx(wl,{open:n!==null,onOpenChange:T=>!T&&(r(null),i(null)),children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsxs(sa,{children:[n==null?void 0:n.terminal," is not installed"]}),s.jsxs(oa,{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(Ie,{to:"/settings",className:"underline hover:text-foreground",onClick:()=>{r(null),i(null)},children:"Settings"}),"."]})]}),s.jsxs(kl,{children:[s.jsx(Xu,{className:"shell-action mt-0",children:"Cancel"}),s.jsxs(pi,{className:"shell-action mt-0 shell-action--cta",onClick:T=>{T.preventDefault(),S()},children:["Open in ",n==null?void 0:n.suggestedFallback]})]})]})}),s.jsx(wl,{open:a!==null,onOpenChange:T=>!T&&l(null),children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsx(sa,{children:"Can't open in agent"}),s.jsxs(oa,{children:[a," Set a valid worktree or repository, then try again."]})]}),s.jsx(kl,{children:s.jsx(pi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>l(null),children:"OK"})})]})}),s.jsx(wl,{open:d!==null,onOpenChange:T=>{!T&&!g&&(f(null),h(null),w(null))},children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsx(sa,{children:"Worktree was deleted"}),s.jsxs(oa,{children:["The worktree at ",s.jsx("code",{children:d==null?void 0:d.deletedPath})," no longer exists. Recreate it",d!=null&&d.branch?s.jsxs(s.Fragment,{children:[" ","on branch ",s.jsx("code",{children:d.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(kl,{children:[s.jsx(Xu,{className:"shell-action mt-0",disabled:g,children:"No"}),s.jsx(pi,{className:"shell-action mt-0 shell-action--cta",disabled:g,onClick:T=>{T.preventDefault(),C()},children:g?"Recreating…":"Yes, recreate"})]})]})}),s.jsx(wl,{open:b!==null,onOpenChange:T=>!T&&j(null),children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsx(sa,{children:"Worktree recreated"}),s.jsx(oa,{children:b})]}),s.jsx(kl,{children:s.jsx(pi,{className:"shell-action mt-0 shell-action--cta",onClick:()=>j(null),children:"OK"})})]})})]});return{open:N,pending:e,dialogs:I}}function s_({session:e,onMarkStopped:t}){const n=r_(),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(ua,{delayDuration:200,children:s.jsxs("div",{className:"inline-flex items-center gap-1",children:[l&&s.jsxs(Dr,{children:[s.jsx($r,{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(Tl,{className:o}),s.jsx("span",{children:"Reopen"})]})})}),s.jsx(mr,{side:"top",children:"Reopen unavailable — this agent has no resume/fork command configured"})]}),e.resumeSupported&&(e.isLive?s.jsxs(Dr,{children:[s.jsx($r,{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(Tl,{className:o}),s.jsx("span",{children:"Resume"})]})})}),s.jsx(mr,{side:"top",children:"Session appears active — fork instead to avoid transcript corruption"})]}):s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"resume"),children:[s.jsx(Tl,{className:o}),s.jsx("span",{children:"Resume"})]})}),s.jsx(mr,{side:"top",children:"Continue this session in its agent (same session id, same transcript)"})]})),e.forkSupported&&s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,disabled:n.pending,onClick:()=>void n.open(r,"fork"),children:[s.jsx(FL,{className:o}),s.jsx("span",{children:"Fork"})]})}),s.jsx(mr,{side:"top",children:"Branch a new session from this point — safe even when the original is still running"})]}),e.status==="active"&&s.jsxs(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsxs("button",{type:"button",className:i,onClick:()=>t(e.sessionId),children:[s.jsx(_v,{className:o}),s.jsx("span",{children:"Mark stopped"})]})}),s.jsx(mr,{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 wG(e){await fetch(`/api/agent-sessions/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})})}function o_({sessions:e,loading:t,error:n,onError:r,onNotice:o}){return t&&!e?null:n&&!e?s.jsx(Ge,{title:"Agent Sessions",children:s.jsx(Rt,{title:"Couldn't load sessions",description:n})}):!e||e.length===0?s.jsx(Ge,{title:"Agent Sessions",children:s.jsx(Rt,{title:"No agent sessions yet",description:"Sessions appear here when an agent registers one via /grab-assignment or syntaur track-session."})}):s.jsx(Ge,{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(Bh,{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(Qr,{value:i.sessionId,onError:r}),s.jsx(ZP,{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(wn,{status:i.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Jr(i.started)})]}),s.jsx(s_,{session:i,onMarkStopped:wG})]},i.sessionId))})})}const Ry="Cost / Usage";function i_({summary:e,error:t}){return t&&!e?s.jsx(Ge,{title:Ry,children:s.jsx(Rt,{title:"Couldn't load usage",description:t})}):e?e.lastEventDay===null?s.jsx(Ge,{title:Ry,children:s.jsx(Rt,{title:"No usage recorded yet",description:"Cost and token totals appear here once the usage collector records activity for this assignment."})}):s.jsx(Ge,{title:Ry,children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(kN,{label:"Total cost",value:Vl(e.totalCost)}),s.jsx(kN,{label:"Total tokens",value:Hl(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(Sd,{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:[Hl(n.totalTokens)," · ",Vl(n.totalCost)]})]},n.model))})]}):null,s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Last usage recorded ",H4(e.lastEventDay)]})]})}):null}function kN({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 a_({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 d=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(Bn,{open:e,onOpenChange:g=>r?void 0:i(g),children:s.jsx(_n,{className:"max-w-xl",children:s.jsxs("form",{className:"space-y-5",onSubmit:g=>{g.preventDefault(),o(h)},children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:f}),s.jsx(es,{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:d}),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(zr,{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 Ei({open:e,title:t,description:n,confirmLabel:r,cancelLabel:o="Cancel",loading:i=!1,destructive:a=!1,onConfirm:l,onOpenChange:d}){return s.jsx(wl,{open:e,onOpenChange:f=>i?void 0:d(f),children:s.jsxs(ra,{children:[s.jsxs(jl,{children:[s.jsx(sa,{children:t}),s.jsx(oa,{children:n})]}),s.jsxs(kl,{children:[s.jsx(Xu,{disabled:i,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:o}),s.jsx(pi,{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 jG=/^[a-z0-9][a-z0-9_-]*$/,l_=["first","last","none"];class c_ extends Error{constructor(n,r){super(n);Px(this,"fieldErrors");this.name="AgentsConfigError",this.fieldErrors=r}}const l0={agents:[],custom:!1};let Sl=null,xl=null,kh=0;const Qb=new Set;function u_(e){Sl=e;for(const t of Qb)t(e)}function kG(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"&&l_.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 c0(e){if(!e||typeof e!="object")return l0;const t=e,n=Array.isArray(t.agents)?t.agents:[],r=[];for(const o of n){const i=kG(o);i&&r.push(i)}return{agents:r,custom:t.custom===!0}}function SG(){if(Sl)return Promise.resolve(Sl);if(xl)return xl;const e=++kh;return xl=fetch("/api/config/agents").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{xl=null;const n=c0(t);return e!==kh?Sl??n:(Sl=n,n)}).catch(()=>(xl=null,l0)),xl}function d_(){const[e,t]=m.useState(()=>Sl??l0);return m.useEffect(()=>{let n=!1;return SG().then(r=>{n||t(r)}),Qb.add(t),()=>{n=!0,Qb.delete(t)}},[]),e}async function f_(e){const t=await e.json().catch(()=>null),n=(t==null?void 0:t.error)??`HTTP ${e.status}`;return new c_(n,t==null?void 0:t.fieldErrors)}async function NG(e){++kh;const t=await fetch("/api/config/agents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agents:e})});if(!t.ok)throw await f_(t);const n=c0(await t.json());return u_(n),n}async function CG(){++kh;const e=await fetch("/api/config/agents",{method:"DELETE"});if(!e.ok)throw await f_(e);const t=c0(await e.json());return u_(t),t}const SN=/[A-Za-z0-9_-]/,EG=/^[a-z0-9]+(-[a-z0-9]+)*$/,NN=/(^|\s)@([A-Za-z0-9_-]+)/g,Jb="assignment";function p_(e,t){const n=Math.max(0,Math.min(t,e.length));let r=n;for(;r>0&&SN.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&&SN.test(e[i]);)i++;return{start:o,end:i,partial:e.slice(o+1,n)}}function h_(e,t){const n=[Jb,...t.filter(a=>a!==Jb)],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 m_(e,t,n){const r=`@${n}`;return{text:e.slice(0,t.start)+r+e.slice(t.end),caret:t.start+r.length}}function g_(e,t){const n=t instanceof Set?t:new Set(t),r=[];NN.lastIndex=0;let o;for(;(o=NN.exec(e))!==null;){const i=o[2];i!==Jb&&(EG.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 CN=2e3;function TG({open:e,assignmentId:t,agentId:n,onConfirm:r,onOpenChange:o}){const[i,a]=m.useState(""),[l,d]=m.useState([]),[f,p]=m.useState(!1),[h,g]=m.useState(null),[y,k]=m.useState(0),[w,b]=m.useState(0),[j,N]=m.useState(!1),S=m.useRef(null);m.useEffect(()=>{if(!e)return;let A=!1;p(!0),g(null),N(!1);const F=new URLSearchParams({assignment:t});return n&&F.set("agent",n),fetch(`/api/launch/prompt?${F.toString()}`).then(async U=>{if(!U.ok){const H=await U.json().catch(()=>null);throw new Error((H==null?void 0:H.error)??`HTTP ${U.status}`)}return await U.json()}).then(U=>{A||(a(U.template??""),d(U.knownPlaybookSlugs??[]),k((U.template??"").length))}).catch(U=>{A||g(U instanceof Error?U.message:String(U))}).finally(()=>{A||p(!1)}),()=>{A=!0}},[e,t,n]);const C=p_(i,y),I=C?h_(C.partial,l):[],T=e&&!f&&!j&&I.length>0,R=g_(i,l),D=i.length>CN;function _(A){a(A.target.value),k(A.target.selectionStart??A.target.value.length),b(0),N(!1)}function B(A){k(A.currentTarget.selectionStart??i.length),b(0)}function $(A){if(!C||!A)return;const F=m_(i,C,A);a(F.text),k(F.caret),b(0),N(!0),requestAnimationFrame(()=>{const U=S.current;U&&(U.focus(),U.setSelectionRange(F.caret,F.caret))})}function O(A){T&&(A.key==="ArrowDown"?(A.preventDefault(),b(F=>Math.min(F+1,I.length-1))):A.key==="ArrowUp"?(A.preventDefault(),b(F=>Math.max(F-1,0))):(A.key==="Enter"||A.key==="Tab")&&(A.preventDefault(),$(I[w])))}function z(){D||f||(r(i),o(!1))}return s.jsx(Bn,{open:e,onOpenChange:o,children:s.jsxs(_n,{onEscapeKeyDown:A=>{T&&(A.preventDefault(),N(!0))},children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Edit launch prompt"}),s.jsxs(es,{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:O,onKeyUp:B,onClick:B,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",D&&"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:I.map((A,F)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":F===w,onMouseDown:U=>{U.preventDefault(),$(A)},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",F===w&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:A})]})},A))})]}),R.length>0&&!h&&s.jsx("ul",{className:"space-y-0.5 text-[11px] text-error-foreground",children:R.map(A=>s.jsx("li",{children:A},A))}),D&&s.jsxs("p",{className:"text-[11px] text-error-foreground",children:["Too long — keep it under ",CN," characters (",i.length,")."]}),s.jsxs(zr,{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||D||h!==null,onClick:z,children:"Launch"})]})]})})}function x_({target:e,worktreePath:t=null,repository:n=null,size:r="default",title:o}){const i=e.kind==="assignment"&&!t&&!n,a=r_(),[l,d]=m.useState(null),p=d_().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,w=m.useRef(null),[b,j]=m.useState(!1);m.useEffect(()=>{if(!b)return;function R(_){w.current&&!w.current.contains(_.target)&&j(!1)}function D(_){_.key==="Escape"&&j(!1)}return document.addEventListener("mousedown",R),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",R),document.removeEventListener("keydown",D)}},[b]);function N(R){var D,_;if(e.kind==="assignment"){const B=p.find(O=>O.id===R)??p.find(O=>O.default)??p[0];!!((D=B==null?void 0:B.launchPrompt)!=null&&D.trim())||!!((_=B==null?void 0:B.playbook)!=null&&_.trim())?a.open(e,void 0,R):d({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",I=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:I,"aria-disabled":!0,children:[s.jsx(Tl,{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:w,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(I,y&&"rounded-r-none"),children:[s.jsx(Tl,{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(I,"-ml-px rounded-l-none",r==="compact"?"px-1":"px-1.5"),children:s.jsx(br,{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(Or,{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(TG,{open:!0,assignmentId:e.id,agentId:l.agentId,onConfirm:R=>{a.open(e,void 0,l.agentId,R)},onOpenChange:R=>{R||d(null)}})]})}const Ay="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 y_({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,d]=m.useState(!1),[f,p]=m.useState("new-branch"),[h,g]=m.useState(null),[y,k]=m.useState(null),[w,b]=m.useState(""),[j,N]=m.useState(!1),[S,C]=m.useState(""),[I,T]=m.useState([]),[R,D]=m.useState(!1),[_,B]=m.useState(null),[$,O]=m.useState(""),[z,A]=m.useState(null),[F,U]=m.useState(null),[H,L]=m.useState(""),[V,M]=m.useState(r),[W,Y]=m.useState(!1),[q,J]=m.useState(null);m.useEffect(()=>{if(!l)return;let oe=!1;return p("new-branch"),g(null),k(null),b(""),N(!1),C(""),T([]),D(!1),B(null),O(""),A(null),U(null),L(""),M(r),J(null),(a.kind==="project-nested"?fG(a.projectSlug):pG(a.assignmentId)).then(De=>{if(!oe)if(g(De),De.length===0)N(!0);else{const ze=De.find(Oe=>Oe.source==="project"),Ye=De.find(Oe=>Oe.source==="sibling");b((ze==null?void 0:ze.path)??(Ye==null?void 0:Ye.path)??De[0].path)}}).catch(De=>{oe||(k(De.message),g([]),N(!0))}),(a.kind==="project-nested"?bG(a.projectSlug,a.assignmentSlug):vG(a.assignmentId)).then(De=>{oe||A(De)}).catch(De=>{oe||(U(De.message),A([]))}),()=>{oe=!0}},[l,r,o,e,t,n]);const ne=f==="branch-off"?(z??[]).find(oe=>oe.id===H)??null:null,Q=f==="branch-off"?(ne==null?void 0:ne.repository)??"":j?S.trim():w;m.useEffect(()=>{if(!l||f!=="new-branch")return;if(!Q){T([]),B(null),D(!1),O("");return}let oe=!1;return D(!0),B(null),O(""),(a.kind==="project-nested"?xG(a.projectSlug,a.assignmentSlug,Q):yG(a.assignmentId,Q)).then(Se=>{if(oe)return;T(Se.branches);const De=(Se.defaultBranch&&Se.branches.includes(Se.defaultBranch)?Se.defaultBranch:Se.branches.includes(o)?o:Se.branches[0])??"";O(De),D(!1)}).catch(Se=>{oe||(T([]),B(Se.message),D(!1))}),()=>{oe=!0}},[l,f,Q,o,e,t,n]);const le=iG(V.trim()),te=m.useMemo(()=>!Q||!V.trim()?"":`${Q.replace(/\/+$/,"")}/.worktrees/${V.trim()}`,[Q,V]),pe=h!==null&&h.length===0,be=z!==null&&z.length===0,Ee=oe=>{oe!==f&&(p(oe),L(""),J(null),oe==="branch-off"&&(O(""),T([]),B(null),D(!1)))},Te=oe=>{L(oe);const je=(z??[]).find(Se=>Se.id===oe);O((je==null?void 0:je.branch)??"")},ke=W||le!==null||!Q||!$.trim()||(f==="new-branch"?h===null||R:z===null||!H),Ue=async()=>{Y(!0),J(null);try{const oe={repository:Q,branch:V.trim(),parentBranch:$.trim()};a.kind==="project-nested"?await hG(a.projectSlug,a.assignmentSlug,oe):await mG(a.assignmentId,oe),d(!1),i()}catch(oe){oe instanceof i0?J({message:oe.message,stderr:oe.stderr}):oe instanceof Error?J({message:oe.message}):J({message:String(oe)})}finally{Y(!1)}};return s.jsxs(Bn,{open:l,onOpenChange:oe=>W?void 0:d(oe),children:[s.jsxs("button",{type:"button",className:"shell-action inline-flex items-center gap-1.5",onClick:()=>d(!0),children:[s.jsx(OL,{className:"h-3.5 w-3.5","aria-hidden":"true"}),s.jsx("span",{children:"Create worktree"})]}),s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Create worktree"}),s.jsxs(es,{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:W,onClick:()=>Ee("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:W,onClick:()=>Ee("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:[pe?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:Ay,value:w,onChange:oe=>b(oe.target.value),disabled:W||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}`))}),pe?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:W,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:W}):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:Ay,value:$,onChange:oe=>O(oe.target.value),disabled:W||R||I.length===0,children:R?s.jsx("option",{value:"",children:"Loading branches…"}):I.length===0?s.jsx("option",{value:"",children:_?"Could not load branches":Q?"No branches found":"— pick a repository —"}):I.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:[F?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: ",F]}):null,be?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:Ay,value:H,onChange:oe=>Te(oe.target.value),disabled:W||z===null,children:[s.jsx("option",{value:"",children:"— select an assignment —"}),(z??[]).map(oe=>s.jsxs("option",{value:oe.id,children:[oe.title," (",oe.branch,")"]},oe.id))]})]}),ne?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:ne.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:ne.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:V,onChange:oe=>M(oe.target.value),disabled:W}),le?s.jsx("span",{className:"text-[11px] text-error-foreground",children:le}):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:te||s.jsx("span",{className:"opacity-60",children:"— pick a repo & branch —"})})]}),q?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:q.message}),q.stderr?s.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-[11px] opacity-90",children:q.stderr}):null]}):null]}),s.jsxs(zr,{children:[s.jsx(WF,{disabled:W,className:"shell-action mt-0 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"}),s.jsx("button",{type:"button",disabled:ke,onClick:()=>void Ue(),className:"shell-action mt-0 shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:W?"Working…":"Create worktree"})]})]})]})}function RG(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 AG(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 PG({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(Cv,{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(br,{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(Zp,{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(Ge,{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(Ie,{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(wn,{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(Jp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},l.slug))})})]})}function _G({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(Ge,{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(Ie,{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(UE,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(wn,{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(Jp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`fwd-${o.slug}`)),r.map(o=>s.jsxs(Ie,{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(Qp,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx(wn,{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(Jp,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},`rev-${o.slug}`))]})})}function DG(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 $G(e,t){return e===null?`/api/assignments/${encodeURIComponent(t)}/comments`:`/api/projects/${encodeURIComponent(e)}/assignments/${encodeURIComponent(t)}/comments`}function b_({projectSlug:e,assignmentSlug:t,entries:n}){const[r,o]=m.useState(n);m.useEffect(()=>{o(n)},[n]);const i=m.useMemo(()=>DG(r),[r]),[a,l]=m.useState(""),[d,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:d,body:a,resolved:d==="question"?!1:void 0};o(C=>[...C,N]);try{const C=await fetch($G(e,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:a,type:d})});if(!C.ok){const R=await C.text();throw new Error(R||`HTTP ${C.status}`)}const I=await C.json().catch(()=>null),T=(S=I==null?void 0:I.comment)==null?void 0:S.id;o(R=>R.map(D=>D.id===j?{...D,id:T??D.id}:D)),l(""),window.dispatchEvent(new CustomEvent("syntaur-refresh"))}catch(C){y(C instanceof Error?C.message:String(C)),o(I=>I.filter(T=>T.id!==j))}finally{h(!1)}}async function w(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(Ge,{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(v_,{node:b,onToggleResolved:w,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:d,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 v_({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(Cv,{className:"h-3 w-3"}):s.jsx(CL,{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(ZL,{className:"h-3 w-3"}),r.replyTo]}):null]}),s.jsx(yn,{content:r.body}),o.length>0?s.jsx("div",{className:"space-y-2",children:o.map(a=>s.jsx(v_,{node:a,depth:t+1,onToggleResolved:n},a.entry.id))}):null]})}const IG=["review","complete","shape","plan-ready","implement","unblock","start","block","fail","reopen"];function EN(){var me,Pe,qe,de,pt,yt,St,ct,ht,Nt;const{slug:e,aslug:t}=Wt(),n=Vt(),r=pn(),[o,i]=ks(),[a,l]=m.useState(null),{toast:d,showToast:f,dismissToast:p}=Eo(),[h,g]=m.useState(null),[y,k]=m.useState(null),[w,b]=m.useState(null),[j,N]=m.useState(null),[S,C]=m.useState({}),[I,T]=m.useState(!1),[R,D]=m.useState(!1),[_,B]=m.useState(0),$=o.get("tab")??"summary",O=Ns(),{data:z,loading:A,error:F,refetch:U}=dO(e,t),{data:H}=k2(e),{data:L}=Mv(),{data:V,loading:M,error:W}=pO(e,t),{data:Y,loading:q,error:J}=mO(e,t),ne=m.useMemo(()=>{if(!z||!H)return[];const ye=new Map(H.assignments.map(Ve=>[Ve.slug,Ve]));return z.dependsOn.map(Ve=>{const Je=ye.get(Ve);return{slug:Ve,title:(Je==null?void 0:Je.title)??Ve,status:(Je==null?void 0:Je.status)??"pending",priority:(Je==null?void 0:Je.priority)??"medium",assignee:(Je==null?void 0:Je.assignee)??null}})},[z,H]),Q=ne.filter(ye=>ye.status!=="completed"&&ye.status!=="review");Si("assignment");const le=m.useMemo(()=>((H==null?void 0:H.assignments)??[]).map(ye=>ye.slug),[H]),te=t?le.indexOf(t):-1,pe=te>0?le[te-1]:null,be=te>=0&&te<le.length-1?le[te+1]:null,Ee=`${r}/projects/${e}/assignments/${t}`;Zt({keys:"e",scope:"assignment",description:"Edit assignment",handler:()=>n(`${Ee}/edit`)}),Zt({keys:"p",scope:"assignment",description:"Edit plan",handler:()=>n(`${Ee}/plan/edit`)}),Zt({keys:"h",scope:"assignment",description:"Append handoff",handler:()=>n(`${Ee}/handoff/edit`)}),Zt({keys:"d",scope:"assignment",description:"Append decision record",handler:()=>n(`${Ee}/decision-record/edit`)}),Zt({keys:"s",scope:"assignment",description:"Edit scratchpad",handler:()=>n(`${Ee}/scratchpad/edit`)}),Zt({keys:"[",scope:"assignment",description:"Previous assignment in project",enabled:!!pe,handler:()=>pe&&n(`${r}/projects/${e}/assignments/${pe}`)}),Zt({keys:"]",scope:"assignment",description:"Next assignment in project",enabled:!!be,handler:()=>be&&n(`${r}/projects/${e}/assignments/${be}`)});const Te=m.useMemo(()=>z?RG(z.body):{acceptanceCriteria:[],summaryBody:""},[z]);m.useEffect(()=>{C({})},[z]);const ke=m.useMemo(()=>AG(Te.summaryBody),[Te.summaryBody]),Ue=Te.acceptanceCriteria,oe=Ue.filter(ye=>ye.checked).length,je=Ue.length>0&&oe===Ue.length,Se=m.useRef(je),De=m.useRef(!1);if(m.useEffect(()=>{if(z){if(!De.current){Se.current=je,De.current=!0;return}je&&!Se.current&&B(ye=>ye+1),Se.current=je}},[je,z]),A)return s.jsx(vt,{label:"Loading assignment workspace…"});if(F||!z||!e||!t)return s.jsx(Pt,{error:F||"Assignment not found."});const ze=e,Ye=t,Oe=Ue.length>0?{checked:oe,total:Ue.length}:void 0,nt=z.availableTransitions??[],wt=nt.filter(ye=>!ye.disabled&&ye.targetStatus!==z.status),it=IG.map(ye=>wt.find(Ve=>Ve.command===ye)).find(Boolean)??wt[0]??null,st=[];if(L!=null&&L.sessions)for(const ye of L.sessions)for(const Ve of ye.windows)for(const Je of Ve.panes)((me=Je.assignment)==null?void 0:me.project)===e&&((Pe=Je.assignment)==null?void 0:Pe.slug)===t&&st.push({sessionName:ye.name,command:Je.command,urls:Je.urls});async function ce(ye){l(null);try{await t_(ze,Ye,ye),U()}catch(Ve){l(Ve.message)}}async function ee(ye){l(null);try{const Ve=await fetch(`/api/projects/${ze}/assignments/${Ye}/${ye?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!Ve.ok){const Je=await Ve.json().catch(()=>null);throw new Error((Je==null?void 0:Je.error)||`HTTP ${Ve.status}`)}U(),f(ye?"Assignment archived":"Assignment restored","success")}catch(Ve){l(Ve.message)}}async function xe(){D(!0);try{await aG(ze,Ye),n(`${r}/projects/${ze}`)}catch(ye){l(ye.message),D(!1),T(!1)}}async function ie(ye,Ve){l(null),g(ye.command);try{return await e_(ze,Ye,ye,Ve),U(),!0}catch(Je){return l(Je.message),!1}finally{g(null)}}function we(ye){if(n_(ye)){k(ye);return}ie(ye)}async function $e(ye,Ve){b(null),N(ye),C(Je=>({...Je,[ye]:Ve}));try{const Je=await fetch(`/api/projects/${ze}/assignments/${Ye}/acceptance-criteria/${ye}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({checked:Ve})}),Ft=await Je.json();if(!Je.ok)throw new Error(Ft.error||`HTTP ${Je.status}`);U()}catch(Je){C(zt=>{const hn={...zt};return delete hn[ye],hn});const Ft=Je.message;b(Ft),f(Ft||"Failed to update acceptance criterion","error")}finally{N(null)}}const Ce=[...wt.filter(ye=>ye!==it).map(ye=>({key:`transition-${ye.command}`,label:ye.label,onSelect:()=>we(ye),disabled:h===ye.command})),...nt.filter(ye=>ye.disabled||ye.targetStatus===z.status).map(ye=>({key:`transition-${ye.command}`,label:ye.label,disabled:!0,disabledReason:ye.targetStatus===z.status?`Already ${z.status.replace(/_/g," ")}`:ye.disabledReason??ye.warning??ye.description})),...O.statuses.map(ye=>({key:`override-${ye.id}`,label:`Override → ${ye.label}`,onSelect:()=>ce(ye.id),disabled:ye.id===z.status,disabledReason:ye.id===z.status?"Already in this status":void 0})),{key:"edit-assignment",label:"Edit assignment source",icon:IL,href:`${r}/projects/${e}/assignments/${t}/edit`},{key:"edit-plan",label:"Edit plan",icon:t4,href:`${r}/projects/${e}/assignments/${t}/plan/edit`},{key:"edit-scratchpad",label:"Edit scratchpad",icon:zx,href:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`},{key:"append-handoff",label:"Append handoff",icon:Jp,href:`${r}/projects/${e}/assignments/${t}/handoff/edit`},{key:"append-decision",label:"Append decision",icon:zL,href:`${r}/projects/${e}/assignments/${t}/decision-record/edit`},{key:z.archived?"unarchive":"archive",label:z.archived?"Restore assignment":"Archive assignment",icon:z.archived?Xp:Uh,onSelect:()=>ee(!z.archived)},{key:"delete",label:"Delete assignment",icon:vn,destructive:!0,onSelect:()=>T(!0)}],se=(it==null?void 0:it.command)==="review";return s.jsxs("div",{className:"space-y-5",children:[s.jsx(Ni,{toast:d,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(wn,{status:z.status,progress:Oe}),z.phase&&z.phase!==z.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: ",z.phase]}),z.disposition&&z.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:z.disposition}),s.jsx(Na,{type:z.type}),s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:z.title}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Updated ",a2(z.updated)]}),Q.length>0&&s.jsxs("span",{className:"text-xs text-warning-foreground",children:["⚠ ",Q.length," unmet dep",Q.length===1?"":"s"]}),s.jsx(Iw,{externalIds:z.externalIds}),s.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[s.jsx(x_,{target:{kind:"assignment",id:z.id},worktreePath:((qe=z.workspace)==null?void 0:qe.worktreePath)??null,repository:((de=z.workspace)==null?void 0:de.repository)??null}),!((pt=z.workspace)!=null&&pt.worktreePath)&&e&&t&&s.jsx(y_,{projectSlug:e,assignmentSlug:t,defaultBranch:`syntaur/${e}/${t}`,onCreated:()=>U()}),it&&s.jsx("button",{type:"button",title:it.warning||it.description,disabled:h===it.command,onClick:()=>we(it),className:Ne("shell-action disabled:cursor-not-allowed disabled:opacity-50",it.warning&&"border-warning-foreground/40",se&&_>0&&"send-to-review-glow"),children:s.jsx("span",{children:h===it.command?"Working…":it.label})},se?`review-${_}`:it.command),s.jsx(Tw,{items:Ce,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,z.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:"})," ",z.blockedReason]}):null,z.override&&z.derived&&z.derived.derivedStatus!==z.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 ",z.status]})," by ",z.override.source,z.override.reason?s.jsxs(s.Fragment,{children:[" — “",z.override.reason,"”"]}):null," · ","would otherwise be ",s.jsx("strong",{children:z.derived.derivedStatus})]}):null,(yt=z.derived)!=null&&yt.nextAction?s.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium text-foreground",children:"Next:"})," ",z.derived.nextAction]}):null]}),z.derived&&(Object.keys(z.derived.customFacts??{}).length>0||(z.derived.attestations??[]).length>0)?s.jsx(Ge,{title:"Facts",description:"Custom asserted facts and review attestations, materialized server-side.",children:s.jsxs("div",{className:"space-y-3",children:[Object.keys(z.derived.customFacts??{}).length>0&&s.jsx("div",{className:"flex flex-wrap items-center gap-2",children:Object.entries(z.derived.customFacts??{}).map(([ye,Ve])=>s.jsxs("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-[11px] text-muted-foreground",children:[ye,": ",s.jsx("span",{className:"font-medium text-foreground",children:String(Ve)})]},ye))}),(z.derived.attestations??[]).map(ye=>s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-[11px] font-medium text-foreground",children:ye.fact}),s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["(",ye.binds,")"]}),ye.records.length===0?s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"— no attestations yet"}):ye.records.map(Ve=>s.jsxs("span",{title:`${Ve.verdict}${Ve.note?` — ${Ve.note}`:""}${Ve.stale?" (stale — revision moved)":""} · ${Ve.at}`,className:Ne("rounded-full border px-2 py-0.5 text-[11px]",Ve.stale?"border-border/40 text-muted-foreground line-through":Ve.verdict==="approved"?"border-success-foreground/40 text-success-foreground":"border-warning-foreground/40 text-warning-foreground"),children:[Ve.actor,": ",Ve.verdict==="approved"?"approved":"changes",Ve.stale?" (stale)":""]},Ve.actor))]},ye.fact))]})}):null,ne.length>0&&s.jsx(PG,{projectSlug:e,dependencies:ne,blockedReason:z.blockedReason}),z.enrichedLinks&&z.enrichedLinks.length>0&&s.jsx(_G,{links:z.enrichedLinks}),z.referencedBy&&z.referencedBy.length>0&&s.jsx(Ge,{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:z.referencedBy.map(ye=>{const Ve=ye.sourceProjectSlug===null?`/assignments/${ye.sourceId}`:`${r}/projects/${ye.sourceProjectSlug}/assignments/${ye.sourceSlug}`;return s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ie,{to:Ve,className:"text-foreground hover:text-primary",children:ye.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",ye.mentions," mention",ye.mentions===1?"":"s",")"]}),ye.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]},ye.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(Pm,{value:$,onValueChange:ye=>i({tab:ye}),items:[{value:"summary",label:"Summary",content:s.jsxs("div",{className:"space-y-5",children:[Te.acceptanceCriteria.length>0?s.jsx(Ge,{title:"Acceptance Criteria",description:"These checkboxes update the source assignment markdown.",children:s.jsxs("div",{className:"space-y-3",children:[w?s.jsx("p",{className:"rounded-md border border-error-foreground/30 bg-error px-4 py-3 text-sm text-error-foreground",children:w}):null,Te.acceptanceCriteria.map((ye,Ve)=>{const Je=j!==null,Ft=Ve in S?S[Ve]:ye.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:Ft,disabled:Je,onChange:zt=>$e(Ve,zt.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":Ft,children:ye.text})]},`${Ve}-${ye.text}`)})]})}):null,ke.hasSection?s.jsx(Ge,{title:"Todos",description:"Checklist of work items from assignment.md. Links point to plan files.",children:s.jsx(yn,{content:ke.todosMarkdown,emptyState:"No todos yet."})}):null,s.jsx(Ge,{title:"Assignment Summary",children:s.jsx(yn,{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:z.plan?1:0,content:z.plan?s.jsx("div",{className:"space-y-5",children:s.jsxs(Ge,{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(Ie,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/plan/edit`,children:[s.jsx(zx,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Plan"})]}),children:[s.jsx("div",{className:"mb-4",children:s.jsx(wn,{status:z.plan.status})}),s.jsx(yn,{content:z.plan.body,emptyState:"No plan content yet."})]})}):s.jsx(Rt,{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:z.scratchpad?1:0,content:z.scratchpad?s.jsx(Ge,{title:"Scratchpad",actions:s.jsxs(Ie,{className:"shell-action",to:`${r}/projects/${e}/assignments/${t}/scratchpad/edit`,children:[s.jsx(zx,{className:"h-4 w-4"}),s.jsx("span",{children:"Edit Scratchpad"})]}),children:s.jsx(yn,{content:z.scratchpad.body,emptyState:"Scratchpad is empty."})}):s.jsx(Rt,{title:"No scratchpad yet",description:"Scratchpad notes appear here when you use the Edit Scratchpad action."})},{value:"handoff",label:"Handoff",count:((St=z.handoff)==null?void 0:St.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:z.handoff?s.jsx(Ge,{children:s.jsx(yn,{content:z.handoff.body,emptyState:"No handoff history yet."})}):s.jsx(Rt,{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:((ct=z.progress)==null?void 0:ct.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:z.progress&&z.progress.entries.length>0?s.jsx(Ge,{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:z.progress.entries.map((ye,Ve)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:ye.timestamp}),s.jsx(yn,{content:ye.body})]},`${ye.timestamp}-${Ve}`))})}):s.jsx(Rt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((ht=z.comments)==null?void 0:ht.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:z.comments&&z.comments.entries.length>0?s.jsx(b_,{projectSlug:e,assignmentSlug:t,entries:z.comments.entries}):s.jsx(Rt,{title:"No comments yet",description:"Comments appear here when agents or humans post via `syntaur comment` or the dashboard."})})},{value:"decisions",label:"Decisions",count:((Nt=z.decisionRecord)==null?void 0:Nt.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:z.decisionRecord?s.jsx(Ge,{children:s.jsx(yn,{content:z.decisionRecord.body,emptyState:"No decision history yet."})}):s.jsx(Rt,{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(Ge,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(oi,{label:"ID",value:z.id,copyable:!0}),s.jsx(oi,{label:"Priority",value:z.priority}),z.assignee&&s.jsx(oi,{label:"Assignee",value:z.assignee}),s.jsx(oi,{label:"Updated",value:`${i2(z.updated)} · Created ${o2(z.created)}`}),z.workspace.repository&&s.jsx(oi,{label:"Repository",value:z.workspace.repository,copyable:!0}),z.workspace.worktreePath&&s.jsx(oi,{label:"Worktree",value:z.workspace.worktreePath,copyable:!0}),z.workspace.branch&&s.jsx(oi,{label:"Branch",value:z.workspace.branch,copyable:!0}),z.workspace.parentBranch&&s.jsx(oi,{label:"Parent branch",value:z.workspace.parentBranch,copyable:!0}),z.externalIds.map((ye,Ve)=>s.jsx(MG,{entry:ye},`${ye.system}:${ye.id}:${Ve}`))]})}),st.length>0&&s.jsx(Ge,{title:"Servers",children:s.jsx("div",{className:"space-y-2",children:st.map((ye,Ve)=>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:ye.command,children:ye.command}),s.jsx("span",{className:"min-w-0 max-w-full truncate text-xs text-muted-foreground",title:ye.sessionName,children:ye.sessionName}),ye.urls.map(Je=>s.jsxs("a",{href:Je,target:"_blank",rel:"noopener noreferrer",title:Je,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:Je.replace("http://localhost:",":")}),s.jsx(lc,{className:"h-2.5 w-2.5 shrink-0"})]},Je))]},Ve))})}),s.jsx(o_,{sessions:V==null?void 0:V.sessions,loading:M,error:W,onError:ye=>f(ye.message,"error"),onNotice:ye=>f(ye,"success")}),s.jsx(i_,{summary:Y==null?void 0:Y.summary,loading:q,error:J})]})]}),s.jsx(a_,{open:y!==null,action:y,assignmentTitle:z.title,loading:h===(y==null?void 0:y.command),onOpenChange:ye=>{ye||k(null)},onConfirm:async ye=>{if(!y)return;await ie(y,ye)&&k(null)}}),s.jsx(Ei,{open:I,title:"Delete assignment?",description:`This will permanently delete "${z.title}" and all its files (plan, scratchpad, handoff, decision record). This cannot be undone.`,confirmLabel:"Delete Assignment",destructive:!0,loading:R,onOpenChange:ye=>{ye||T(!1)},onConfirm:xe})]})}function oi({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(Qr,{value:t})]})]})}function MG({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(lc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function LG(){var T,R,D,_,B,$,O,z;const{id:e}=Wt(),[t,n]=ks(),r=t.get("tab")??"summary",{data:o,loading:i,error:a,refetch:l}=fO(e),{data:d,loading:f,error:p}=hO(e),{data:h,loading:g,error:y}=gO(o==null?void 0:o.slug),[k,w]=m.useState(!1),[b,j]=m.useState(null),{toast:N,showToast:S,dismissToast:C}=Eo();async function I(A){if(e){j(null);try{const F=await fetch(`/api/assignments/${e}/${A?"archive":"unarchive"}`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!F.ok){const U=await F.json().catch(()=>null);throw new Error((U==null?void 0:U.error)||`HTTP ${F.status}`)}l(),S(A?"Assignment archived":"Assignment restored","success")}catch(F){j(F instanceof Error?F.message:"Archive failed")}}}return i?s.jsx(vt,{}):a?s.jsx(Pt,{error:a}):o?s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ni,{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(wn,{status:o.status}),s.jsx(Na,{type:o.type}),s.jsx("span",{className:"text-xs font-mono text-muted-foreground",children:o.id}),s.jsx(Iw,{externalIds:o.externalIds}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(x_,{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"}),!((D=o.workspace)!=null&&D.worktreePath)&&s.jsx(y_,{assignmentId:o.id,defaultBranch:`syntaur/${o.slug}`,onCreated:()=>l()}),s.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",children:[s.jsx(Hh,{className:"h-3 w-3"}),"Move to workspace…"]}),s.jsx(Ie,{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:()=>I(!o.archived),className:"inline-flex items-center gap-1.5 rounded border border-border px-2 py-1 text-xs text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:o.archived?"Restore this assignment":"Archive this assignment",children:[o.archived?s.jsx(Xp,{className:"h-3 w-3"}):s.jsx(Uh,{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(Ge,{title:"Referenced by",description:"Other assignments whose bodies link to this one.",children:s.jsx("ul",{className:"space-y-2",children:o.referencedBy.map(A=>s.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Ie,{to:A.sourceProjectSlug===null?`/assignments/${A.sourceId}`:`/projects/${A.sourceProjectSlug}/assignments/${A.sourceSlug}`,className:"text-foreground hover:text-primary",children:A.sourceTitle}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",A.mentions," mention",A.mentions===1?"":"s",")"]})]},A.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(Pm,{value:r,onValueChange:A=>n({tab:A}),items:[{value:"summary",label:"Summary",content:s.jsx("div",{className:"space-y-5",children:s.jsx(Ge,{title:"Assignment",children:s.jsx(yn,{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(Ge,{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((A,F)=>s.jsxs("li",{className:"border-l-2 border-border pl-3",children:[s.jsx("div",{className:"text-xs font-mono text-muted-foreground",children:A.timestamp}),s.jsx(yn,{content:A.body})]},`${A.timestamp}-${F}`))})}):s.jsx(Rt,{title:"No progress entries yet",description:"Progress entries appear here as the agent appends them to progress.md."})})},{value:"comments",label:"Comments",count:((B=o.comments)==null?void 0:B.entryCount)??0,content:s.jsx("div",{className:"space-y-5",children:s.jsx(b_,{projectSlug:null,assignmentSlug:o.id,entries:(($=o.comments)==null?void 0:$.entries)??[]})})},{value:"plan",label:"Plan",content:s.jsx("div",{className:"space-y-5",children:o.plan?s.jsxs(Ge,{children:[s.jsx(yn,{content:o.plan.body,emptyState:"Plan file exists but is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Rt,{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(Ge,{children:[s.jsx(yn,{content:o.scratchpad.body,emptyState:"Scratchpad is empty."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Rt,{title:"No scratchpad yet",description:"Scratchpad is scaffolded at assignment creation time."})})},{value:"handoff",label:"Handoff",count:((O=o.handoff)==null?void 0:O.handoffCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.handoff?s.jsxs(Ge,{children:[s.jsx(yn,{content:o.handoff.body,emptyState:"No handoff history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Rt,{title:"No handoff log yet",description:"Handoffs appear here when an agent appends one."})})},{value:"decisions",label:"Decisions",count:((z=o.decisionRecord)==null?void 0:z.decisionCount)??0,content:s.jsx("div",{className:"space-y-5",children:o.decisionRecord?s.jsxs(Ge,{children:[s.jsx(yn,{content:o.decisionRecord.body,emptyState:"No decision history yet."}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(Ie,{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(Rt,{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(Ge,{title:"Details",children:s.jsxs("dl",{className:"space-y-3 text-sm",children:[s.jsx(ii,{label:"ID",value:o.id,copyable:!0}),s.jsx(ii,{label:"Priority",value:o.priority}),o.assignee&&s.jsx(ii,{label:"Assignee",value:o.assignee}),s.jsx(ii,{label:"Updated",value:`${i2(o.updated)} · Created ${o2(o.created)}`}),o.workspace.repository&&s.jsx(ii,{label:"Repository",value:o.workspace.repository,copyable:!0}),o.workspace.worktreePath&&s.jsx(ii,{label:"Worktree",value:o.workspace.worktreePath,copyable:!0}),o.workspace.branch&&s.jsx(ii,{label:"Branch",value:o.workspace.branch,copyable:!0}),o.workspace.parentBranch&&s.jsx(ii,{label:"Parent branch",value:o.workspace.parentBranch,copyable:!0}),o.externalIds.map((A,F)=>s.jsx(OG,{entry:A},`${A.system}:${A.id}:${F}`))]})}),s.jsx(o_,{sessions:d==null?void 0:d.sessions,loading:f,error:p,onError:A=>S(A.message,"error"),onNotice:A=>S(A,"success")}),s.jsx(i_,{summary:h==null?void 0:h.summary,loading:g,error:y})]})]}),s.jsx($w,{open:k,onOpenChange:w,currentWorkspace:o.projectWorkspace,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async A=>{const F=await fetch(`/api/assignments/${encodeURIComponent(o.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:A})});if(!F.ok){const U=await F.json().catch(()=>({}));throw new Error(U.error||"Failed to move assignment")}l()}})]}):s.jsx(Pt,{error:"Assignment not found"})}function ii({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(Qr,{value:t})]})]})}function OG({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(lc,{className:"h-2.5 w-2.5 shrink-0"})]}):s.jsx("span",{className:"truncate min-w-0",title:e.id,children:e.id})})]})}function FG({currentStatus:e,availableTransitions:t,onSelect:n,overrideTargets:r,onOverride:o,disabled:i=!1,className:a}){const[l,d]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(0),y=m.useRef(null),k=m.useRef(null),w=m.useId(),b=Ns(),j=sd(b.statuses,e),N=$b(e),S=r??[],C=t.length+S.length,I=m.useCallback($=>{d(!1),$&&requestAnimationFrame(()=>{var O;(O=y.current)==null||O.focus()})},[]),T=m.useCallback(()=>{var O;const $=(O=y.current)==null?void 0:O.getBoundingClientRect();$&&p({top:$.top,left:$.left,width:$.width,bottom:$.bottom})},[]);m.useLayoutEffect(()=>{l&&T()},[l,T]),m.useEffect(()=>{if(!l)return;const $=()=>T();return window.addEventListener("scroll",$,!0),window.addEventListener("resize",$),()=>{window.removeEventListener("scroll",$,!0),window.removeEventListener("resize",$)}},[l,T]),m.useEffect(()=>{if(!l)return;const $=O=>{var A,F;const z=O.target;z&&((A=k.current)!=null&&A.contains(z)||(F=y.current)!=null&&F.contains(z)||I(!1))};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[l,I]),m.useEffect(()=>{l&&g(0)},[l,C]);function R($){return!$.disabled&&$.id!==e}function D($){if($<t.length){const z=t[$];z&&(n(z),I(!0));return}const O=S[$-t.length];O&&R(O)&&(o==null||o(O.id),I(!0))}function _($){($.key==="Enter"||$.key===" "||$.key==="ArrowDown")&&($.preventDefault(),d(!0))}function B($){if(C===0){$.key==="Escape"&&($.preventDefault(),I(!0));return}$.key==="ArrowDown"?($.preventDefault(),g(O=>(O+1)%C)):$.key==="ArrowUp"?($.preventDefault(),g(O=>(O-1+C)%C)):$.key==="Home"?($.preventDefault(),g(0)):$.key==="End"?($.preventDefault(),g(C-1)):$.key==="Enter"?($.preventDefault(),D(h)):$.key==="Escape"&&($.preventDefault(),I(!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?w:void 0,onClick:()=>{i||d($=>!$)},onKeyDown:_,title:`Status: ${j.label}. Click to change.`,style:j.style,className:Ne(jA,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"?xo.createPortal(s.jsx("div",{ref:k,id:w,role:"menu",tabIndex:-1,autoFocus:!0,onKeyDown:B,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(($,O)=>{const z=$b($.targetStatus),A=O===h;return s.jsxs("button",{type:"button",role:"menuitem","data-no-drag":!0,onMouseEnter:()=>g(O),onClick:()=>D(O),title:$.warning||$.description,className:Ne("flex w-full flex-col items-stretch gap-0.5 px-3 py-1.5 text-left text-sm transition",A?"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(z,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:$.label})]}),s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:xi(b,$.targetStatus)})]}),$.warning?s.jsx("span",{className:"text-[11px] leading-snug text-warning-foreground",children:$.warning}):null]},`${$.command}:${$.targetStatus}`)}),S.length>0&&t.length>0?s.jsx("div",{className:"my-1 border-t border-border/60",role:"separator"}):null,S.map(($,O)=>{const z=t.length+O,A=z===h,F=!R($),U=sd(b.statuses,$.id);return s.jsx("button",{type:"button",role:"menuitem","data-no-drag":!0,disabled:F,onMouseEnter:()=>g(z),onClick:()=>D(z),title:F?$.disabledReason??($.id===e?"Already in this status":void 0):`Set status to ${$.label}`,className:Ne("flex w-full items-center justify-between gap-2 px-3 py-1.5 text-left text-sm transition",F?"cursor-not-allowed text-muted-foreground/60":A?"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",U.style?void 0:U.className),style:U.style?{backgroundColor:U.style.color}:void 0}),s.jsxs("span",{className:"truncate",children:["Override → ",$.label]})]})},`override-${$.id}`)})]})}),document.body):null]})}function w_({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(Ie,{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(lc,{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,d]=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,d(!0);try{await n(b)}catch{}finally{d(!1),r()}},[i,r,n,y]);function w(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:w,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 j_(e){const t=Vt(),n=m.useRef(null),r=m.useRef(!1),o=m.useCallback(()=>{const a=n.current,l=!!(a!=null&&a.querySelector('[aria-expanded="true"]')),d=!!document.querySelector('[role="menu"]'),f=document.activeElement,p=!!(f&&(a!=null&&a.contains(f))&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"));r.current=l||d||p},[]),i=m.useCallback(a=>{if(r.current)return;const l=a.target;!l||l.closest(Yl)||t(e)},[t,e]);return{containerRef:n,onMouseDown:o,onClick:i}}const TN=/[A-Za-z0-9_-]/;function RN(e,t){const n=Math.max(0,Math.min(t,e.length)),r=BG(e,n);if(r)return r;let o=n;for(;o>0&&TN.test(e[o-1]);)o--;let i=n;for(;i<e.length&&TN.test(e[i]);)i++;const a=e.slice(o,n),l=e.slice(0,o),d=l.match(/([A-Za-z_][A-Za-z0-9_-]*)\s*(:|>=|<=|!=|=|>|<)\s*$/);if(d)return{kind:"value",field:d[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 BG(e,t){let n=-1;for(let d=t-1;d>=0;d--)if(e[d]==='"'&&(d===0||e[d-1]!=="\\")){n=d;break}if(n<0)return null;for(let d=n+1;d<t;d++)if(e[d]==='"'&&e[d-1]!=="\\")return null;let 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 UG(e,t){const n=hA(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 HG(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 VG(e,t,n){let r;return t.kind==="field"?r=`${n}:`:r=rw(n),{text:e.slice(0,t.tokenStart)+r+e.slice(t.tokenEnd),caret:t.tokenStart+r.length}}const WG=180;function qG(e,t){const[n,r]=m.useState(e);return m.useEffect(()=>{const o=setTimeout(()=>r(e),t);return()=>clearTimeout(o)},[e,t]),n}function KG({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 d=m.useRef(null),f=m.useRef(null),p=qG(e,WG),[h,g]=m.useState([]),[y,k]=m.useState([]),[w,b]=m.useState("field"),[j,N]=m.useState(-1),[S,C]=m.useState(!1),I=m.useRef(e.length);m.useEffect(()=>{if(p.trim()===""){g([]),n==null||n(null);return}const A=Wl(p,r);A.errors.length>0?(g(A.errors),n==null||n(null)):(g([]),n==null||n(A.query))},[p,r,n]);const T=m.useCallback((A,F)=>{const U=RN(A,F);if(!U){k([]),C(!1);return}if(U.kind==="field"){const H=UG(U.partial,o);k(H),b("field"),C(H.length>0)}else{const H=HG(U.field,U.partial,i,r);k(H),b("value"),C(H.length>0)}N(-1)},[o,i,r]),R=m.useCallback(A=>{const F=A.target.value,U=A.target.selectionStart??F.length;I.current=U,t(F),T(F,U)},[t,T]),D=m.useCallback(A=>{const F=d.current,U=(F==null?void 0:F.selectionStart)??I.current,H=RN(e,U);if(!H)return;const{text:L,caret:V}=VG(e,H,A);t(L),C(!1),k([]),requestAnimationFrame(()=>{d.current&&(d.current.focus(),d.current.setSelectionRange(V,V),I.current=V)})},[e,t]),_=m.useCallback(A=>{if(!(!S||y.length===0))switch(A.key){case"ArrowDown":A.preventDefault(),N(F=>Math.min(F+1,y.length-1));break;case"ArrowUp":A.preventDefault(),N(F=>Math.max(F-1,-1));break;case"Enter":case"Tab":j>=0&&(A.preventDefault(),D(y[j]));break;case"Escape":C(!1),k([]);break}},[S,y,j,D]),B=m.useRef(null),$=m.useCallback(()=>{B.current=setTimeout(()=>C(!1),120)},[]);m.useEffect(()=>()=>{B.current!==null&&clearTimeout(B.current)},[]);const O=m.useCallback(()=>{var F;const A=((F=d.current)==null?void 0:F.selectionStart)??e.length;T(e,A)},[e,T]);m.useEffect(()=>{var A,F;S&&((F=(A=f.current)==null?void 0:A.querySelector('[aria-selected="true"]'))==null||F.scrollIntoView({block:"nearest"}))},[j,S]);const z=h.length>0&&p.trim()!=="";return s.jsxs("div",{className:`relative flex flex-col gap-1 ${l??""}`,children:[s.jsx("input",{ref:d,type:"text",value:e,onChange:R,onKeyDown:_,onBlur:$,onFocus:O,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",z?"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":w==="field"?"Field suggestions":"Value suggestions",className:"absolute top-full z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-md border border-border bg-popover py-1 shadow-md",children:y.map((A,F)=>s.jsx("li",{role:"option","aria-selected":F===j,onMouseDown:U=>{U.preventDefault(),D(A)},className:["cursor-pointer px-3 py-1.5 font-mono text-sm",F===j?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"].join(" "),children:A},A))}),z&&s.jsx("ul",{className:"space-y-0.5",role:"status","aria-live":"polite",children:h.map((A,F)=>s.jsxs("li",{className:"font-mono text-xs text-destructive",children:["at ",A.pos,": ",A.message]},F))})]})}const AN=nw;function fp(e){return e==="1"?"stale":e==="0"?"fresh":"all"}function GG(e,t){return e.toString()===t.toString()}function PN(){const{workspace:e}=Wt(),t=pn(),n=Vt(),r=m.useRef(null);Si("list:assignments");const{data:o,loading:i,error:a,refetch:l}=Gh(),d=Ns(),f=Td(),[p,h]=ks(),g=e?`w:${e}`:null,y=KP(g),k=m.useRef(void 0),w=m.useMemo(()=>_A(d.order),[d]),b=m.useMemo(()=>{const G={};for(const Z of w)G[Z]=xi(d,Z);return G},[w,d]),j=m.useMemo(()=>w.map(G=>({id:G,title:b[G]??G,description:Od(G)})),[w,b]),N=m.useMemo(()=>f.definitions.map(G=>({id:G.id,title:_l(f,G.id),description:G.description})),[f]),S="__unknown_type__",C=m.useMemo(()=>new Set(["all",...w]),[w]),I=p.get("view"),T=p.get("status"),R=p.get("stale"),D=I&&AN.includes(I)?I:"kanban";function _(G){if(!G)return[];const Z=[];for(const ve of G.split(",")){const He=ve.trim();!He||He==="all"||!C.has(He)||Z.includes(He)||Z.push(He)}return Z}const B=m.useCallback(G=>{h(Z=>{const ve=new URLSearchParams(Z);return G==="kanban"?ve.delete("view"):ve.set("view",G),ve})},[h]),[$,O]=m.useState(""),[z,A]=m.useState(()=>_(T)),[F,U]=m.useState(()=>We(y.filters.priority)),[H,L]=m.useState(()=>We(y.filters.type)),[V,M]=m.useState(()=>We(y.filters.assignee)),[W,Y]=m.useState(()=>We(y.filters.project)),[q,J]=m.useState(()=>We(y.filters.tags)),[ne,Q]=m.useState(null),[le,te]=m.useState(()=>fp(R)),[pe,be]=m.useState(()=>Pu({status:_(T),priority:We(y.filters.priority),type:We(y.filters.type),assignee:We(y.filters.assignee),project:We(y.filters.project),tags:We(y.filters.tags),activity:fp(R)})),[Ee,Te]=m.useState(()=>y.sortField),[ke,Ue]=m.useState(()=>y.sortDirection),[oe,je]=m.useState(()=>({hidden:[]})),[Se,De]=m.useState(()=>({hidden:[]})),[ze,Ye]=m.useState(()=>y.grouping),Oe=ze==="type"?"type":"status",[nt,wt]=m.useState(()=>new Set),[it,st]=m.useState([]),{toast:ce,showToast:ee,dismissToast:xe}=Eo(),[ie,we]=m.useState(null),[$e,Ce]=m.useState(null),[se,me]=m.useState(null),[Pe,qe]=m.useState(null),[de,pt]=m.useState(null),[yt,St]=m.useState(null),[ct,ht]=m.useState(null),[Nt,ye]=m.useState(null),[Ve,Je]=m.useState(null),[Ft,zt]=m.useState(!1),[hn,Et]=m.useState(!1),$n=e?{kind:"workspace",workspace:e}:{kind:"global"},Tt=p.get("loadView"),{view:ue,loading:Be,error:et}=bi(Tt),{view:bt,loading:Kn,error:wr}=bi(Ve),rs=m.useRef(null);m.useEffect(()=>{st((o==null?void 0:o.assignments)??[])},[o]),m.useEffect(()=>{Ve&&!Kn&&!wr&&!bt&&Je(null)},[bt,wr,Ve,Kn]),m.useEffect(()=>{Je(null),rs.current=null,Q(null),O("")},[e]);const Ta=m.useRef({status:T,stale:R});m.useEffect(()=>{const G=_(T),Z=fp(R);a6(G,z)||A(G),Z!==le&&te(Z);const ve=Ta.current,He=ve.status!==T||ve.stale!==R;Ta.current={status:T,stale:R},He&&tn({status:G,activity:Z})},[le,R,z,T]),m.useEffect(()=>{k.current===g&&h(G=>{const Z=new URLSearchParams(G);return z.length===0?Z.delete("status"):Z.set("status",z.join(",")),le==="all"?Z.delete("stale"):le==="stale"?Z.set("stale","1"):Z.set("stale","0"),GG(G,Z)?G:Z})},[le,g,h,z]),m.useEffect(()=>{U(We(y.filters.priority)),L(We(y.filters.type)),M(We(y.filters.assignee)),Y(We(y.filters.project)),J(We(y.filters.tags)),Te(y.sortField),Ue(y.sortDirection),Ye(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 G=!1;return o0().then(Z=>{if(G||k.current===g)return;const ve=jT(Z,g),He=ve.defaultView,ft=We(ve.filters.status),kt=ve.filters.activity??"all",_t=new URLSearchParams(window.location.search);let Sn=!1;const Mn=new URLSearchParams(_t);_t.get("view")===null&&He!=="kanban"&&AN.includes(He)&&(Mn.set("view",He),Sn=!0),_t.get("status")===null&&ft.length>0&&(Mn.set("status",ft.join(",")),A(ft),Sn=!0),_t.get("stale")===null&&kt!=="all"&&(Mn.set("stale",kt==="stale"?"1":"0"),te(kt),Sn=!0),Sn&&h(Mn,{replace:!0});const Nn=_(Mn.get("status")),kr=Mn.get("stale")===null?kt:fp(Mn.get("stale"));be(Pu({status:Nn,priority:We(ve.filters.priority),type:We(ve.filters.type),assignee:We(ve.filters.assignee),project:We(ve.filters.project),tags:We(ve.filters.tags),activity:kr==="fresh"||kr==="stale"?kr:"all"})),queueMicrotask(()=>{k.current=g})}),()=>{G=!0}},[g]);const mt=m.useCallback(G=>{(g===null?YP(G):XP(g,G)).catch(ve=>{console.warn("Failed to persist view prefs:",ve)})},[g]),Ti=m.useCallback(G=>{B(G),mt({defaultView:G})},[B,mt]),Ro=m.useRef(null);Ro.current={status:z,priority:F,type:H,assignee:V,project:W,tags:q,activity:le,dateRange:ne,search:$};const Ra=m.useCallback((G={})=>{const Z=Ro.current;return{status:Z.status,priority:Z.priority,type:Z.type,assignee:Z.assignee,project:Z.project,tags:Z.tags,activity:Z.activity,dateRange:da(Z.dateRange),search:Z.search,...G}},[]),tn=m.useCallback((G={})=>{be(Pu(Ra(G)))},[Ra]),Ao=m.useCallback(G=>{A(G),mt({filters:{status:G}}),tn({status:G})},[mt,tn]),Aa=m.useCallback(G=>{U(G),mt({filters:{priority:G}}),tn({priority:G})},[mt,tn]),Pa=m.useCallback(G=>{L(G),mt({filters:{type:G}}),tn({type:G})},[mt,tn]),Tc=m.useCallback(G=>{M(G),mt({filters:{assignee:G}}),tn({assignee:G})},[mt,tn]),_a=m.useCallback(G=>{Y(G),mt({filters:{project:G}}),tn({project:G})},[mt,tn]),Ut=m.useCallback(G=>{J(G),mt({filters:{tags:G}}),tn({tags:G})},[mt,tn]),Ri=m.useCallback(G=>{te(G),mt({filters:{activity:G}}),tn({activity:G})},[mt,tn]),eo=m.useCallback(G=>{O(G),tn({search:G})},[tn]),Po=m.useCallback(G=>{Q(G),tn({dateRange:da(G)})},[tn]),Ts=m.useCallback(G=>{Te(G),mt({sortField:G})},[mt]),_o=m.useCallback(G=>{Ue(G),mt({sortDirection:G})},[mt]),Da=m.useCallback(G=>{Ye(G),mt({grouping:G})},[mt]),Do=m.useCallback(()=>{eo(""),Ao([]),Ut([]),Po(null),Ri("all")},[eo,Ao,Ut,Po,Ri]),er=m.useCallback(G=>{be(G);const Z=_u(G);Z&&(A(We(Z.status)),U(We(Z.priority)),L(We(Z.type)),M(We(Z.assignee)),Y(We(Z.project)),J(We(Z.tags)),O(Z.search??""),te(Z.activity&&Z.activity!=="all"?Z.activity:"all"),Q(Em(Z.dateRange)))},[]),ir=m.useMemo(()=>_u(pe)!==null,[pe]),In=m.useCallback(()=>{const Z=_u(pe)!==null?{status:z,priority:F,type:H,assignee:V,project:W,tags:q,activity:le,dateRange:da(ne),search:$}:{};return{viewMode:D,filters:{...Z,query:pe},sortField:Ee,sortDirection:ke,listSectionVisibility:{collapsed:[...nt]},kanbanColumnVisibility:oe,tableColumnVisibility:Se}},[D,pe,z,F,H,V,W,q,le,ne,$,Ee,ke,nt,oe,Se]),$o=m.useCallback(G=>{CA(G,{setViewMode:B,setQuery:be,setStatusFilter:Z=>{A(Z),mt({filters:{status:Z}})},setPriorityFilter:Z=>{U(Z),mt({filters:{priority:Z}})},setTypeFilter:Z=>{L(Z),mt({filters:{type:Z}})},setAssigneeFilter:Z=>{M(Z),mt({filters:{assignee:Z}})},setProjectFilter:Z=>{Y(Z),mt({filters:{project:Z}})},setTagsFilter:Z=>{J(Z),mt({filters:{tags:Z}})},setActivityFilter:Z=>{te(Z),mt({filters:{activity:Z}})},setDateRange:Q,setSearch:O,setSortField:Ts,setSortDirection:_o,setListSectionVisibility:Z=>wt(new Set(Z.collapsed)),setKanbanColumnVisibility:je,setTableColumnVisibility:De}),Je(G.id)},[B,mt,Ts,_o]),Rc=m.useCallback(G=>{$o(G),rs.current=G.id,h(Z=>{const ve=new URLSearchParams(Z);return ve.set("loadView",G.id),ve},{replace:!0})},[$o,h]),Ac=m.useCallback(async G=>{try{const Z=Xl({name:G,context:{workspace:e??null,projectSlug:null},state:In()}),ve=await ql(Z),He=ve.views[ve.views.length-1];Je((He==null?void 0:He.id)??null),He&&(rs.current=He.id,h(ft=>{const kt=new URLSearchParams(ft);return kt.set("loadView",He.id),kt},{replace:!0})),zt(!1),Et(!1),ee(`Saved view "${G}"`,"success")}catch(Z){throw ee(Z instanceof Error?Z.message:"Failed to save view","error"),Z}},[In,h,ee,e]),Io=m.useCallback(async()=>{if(!(!Ve||!bt))try{const G=Xl({name:bt.name,context:{workspace:e??null,projectSlug:null},state:In()}),Z=xh(bt.config,G.config,G.config);await fh(Ve,{config:Z}),ee("View updated","success")}catch(G){ee(G instanceof Error?G.message:"Failed to update view","error")}},[In,bt,Ve,ee,e]);m.useEffect(()=>{if(!Tt){rs.current=null;return}if(rs.current!==Tt&&(Ve&&Ve!==Tt&&Je(null),!Be)){if(et){ee("Couldn't load saved view — try again","error");return}if(ue){rs.current=Tt,$o(ue),h(G=>{const Z=new URLSearchParams(G);return Z.delete("loadView"),Z},{replace:!0});return}rs.current=Tt,ee("Saved view no longer exists","error"),h(G=>{const Z=new URLSearchParams(G);return Z.delete("loadView"),Z},{replace:!0})}},[Tt,ue,Be,et,Ve,$o,h,ee]);const Un=m.useMemo(()=>it.filter(G=>e?e==="_ungrouped"?G.projectWorkspace===null:G.projectWorkspace===e:!0),[it,e]),to=m.useMemo(()=>Array.from(new Set(Un.map(G=>G.status))).sort(),[Un]),Br=m.useMemo(()=>Array.from(new Set(Un.map(G=>G.priority))).sort(),[Un]),$a=m.useMemo(()=>Array.from(new Set(Un.map(G=>G.assignee??"__unassigned__"))).sort(),[Un]),Ai=m.useMemo(()=>Array.from(new Map(Un.filter(G=>G.projectSlug!==null).map(G=>[G.projectSlug,G.projectTitle]))).sort(([,G],[,Z])=>G.localeCompare(Z)),[Un]),Mo=m.useMemo(()=>Array.from(new Set(Un.flatMap(G=>G.tags??[]))).sort(),[Un]),Lo=m.useMemo(()=>pA(d.factDeclarations),[d.factDeclarations]),Rs=m.useMemo(()=>pe.trim()===""?null:Wl(pe,Lo).query,[pe,Lo]),Bt=m.useMemo(()=>dA(it,Rs,{workspace:e}),[it,Rs,e]),no=m.useMemo(()=>Ld(Bt,Ee,ke),[Bt,Ee,ke]),As=m.useMemo(()=>{if(ze==="none")return[{id:"__all__",label:"All assignments",items:Bt}];if(ze==="type"){const G=f.definitions.map(He=>({id:He.id,label:_l(f,He.id),items:Bt.filter(ft=>ft.type===He.id)})),Z=new Set(f.definitions.map(He=>He.id)),ve=Bt.filter(He=>!He.type||!Z.has(He.type));return ve.length>0&&G.push({id:S,label:"Other",items:ve}),G}if(ze==="priority")return["critical","high","medium","low"].map(Z=>({id:Z,label:Z.charAt(0).toUpperCase()+Z.slice(1),items:Bt.filter(ve=>ve.priority===Z)}));if(ze==="assignee")return Array.from(new Set(Bt.map(Z=>Z.assignee??"__unassigned__"))).sort().map(Z=>({id:Z,label:Z==="__unassigned__"?"Unassigned":Z,items:Bt.filter(ve=>(ve.assignee??"__unassigned__")===Z)}));if(ze==="project"){const G=new Map;for(const Z of Bt){const ve=Z.projectSlug??"__standalone__",He=Z.projectTitle??"Standalone";G.has(ve)||G.set(ve,He)}return Array.from(G.entries()).sort(([,Z],[,ve])=>Z.localeCompare(ve)).map(([Z,ve])=>({id:Z,label:ve,items:Bt.filter(He=>(He.projectSlug??"__standalone__")===Z)}))}return w.map(G=>({id:G,label:b[G]??G,items:Bt.filter(Z=>Z.status===G)}))},[ze,Bt,f,w,b]),Lt=m.useMemo(()=>{const G=new Set(f.definitions.map(ve=>ve.id));return Bt.some(ve=>!ve.type||!G.has(ve.type))?[...N,{id:S,title:"Other",description:"Assignments with no recognized type."}]:N},[N,f,Bt]),{visibleItems:Yd,visibleIndexByKey:Pc}=m.useMemo(()=>{let G;if(D==="table")G=no;else if(D==="kanban"){const ve=new Set(f.definitions.map(He=>He.id));Oe==="type"?G=[...f.definitions.flatMap(He=>Bt.filter(ft=>ft.type===He.id)),...Bt.filter(He=>!He.type||!ve.has(He.type))]:G=w.flatMap(He=>Bt.filter(ft=>ft.status===He))}else G=As.flatMap(ve=>ve.items);const Z=new Map;return G.forEach((ve,He)=>Z.set(gn(ve),He)),{visibleItems:G,visibleIndexByKey:Z}},[D,no,As,Oe,f,Bt,w]),{hotkeyRowProps:Pi}=Rd(Yd,{scope:"list:assignments",onOpen:G=>{if(G.projectSlug===null){n(`/assignments/${G.id}`);return}const Z=G.projectWorkspace?`/w/${G.projectWorkspace}`:t;n(`${Z}/projects/${G.projectSlug}/assignments/${G.slug}`)}});if(Zt({keys:"/",scope:"list:assignments",description:"Focus filter",handler:()=>{var G;return(G=r.current)==null?void 0:G.focus()}}),Zt({keys:"r",scope:"list:assignments",description:"Refresh",handler:()=>l()}),i)return s.jsx(vt,{label:"Loading assignments board…"});if(a||!o)return s.jsx(Pt,{error:a||"Assignments board is unavailable."});async function _c({item:G,toColumnId:Z,action:ve,reason:He}){if(!ve){const kt=d.statuses.find(_t=>_t.id===Z);if(Db(kt??{id:Z}))return ee(`Reach “${xi(d,Z)}” through its complete/fail transition.`,"error"),!1}we(gn(G));const ft=it;st(kt=>kt.map(_t=>gn(_t)===gn(G)?{..._t,status:Z,blockedReason:Z==="blocked"?He??_t.blockedReason:null}:_t));try{const kt=G.projectSlug===null?ve?await lG(G.id,ve,He):await cG(G.id,Z):ve?await e_(G.projectSlug,G.slug,ve,He):await t_(G.projectSlug,G.slug,Z);return st(_t=>_t.map(Sn=>gn(Sn)===gn(G)?{...Sn,status:kt.status,blockedReason:kt.blockedReason,availableTransitions:kt.availableTransitions,updated:kt.updated}:Sn)),l(),!0}catch(kt){return st(ft),ee(kt.message,"error"),!1}finally{we(null)}}async function ro({item:G,toColumnId:Z,action:ve}){if(G.status===Z)return;const He=ve??gu(G,Z);if(He!=null&&He.disabled){ee(He.disabledReason||`Cannot move this assignment to ${Z}.`,"error");return}if(He&&n_(He)){qe({item:G,toColumnId:Z,action:He});return}await _c({item:G,toColumnId:Z,action:He})}function Dc(G){return vA(d).map(Z=>Z.id===G.status?{id:Z.id,label:Z.label,disabled:!0,disabledReason:"Already in this status"}:Z.terminal&&!G.availableTransitions.find(He=>He.targetStatus===Z.id&&!He.disabled)?{id:Z.id,label:Z.label,disabled:!0,disabledReason:`Reach ${Z.label} via its transition when available`}:{id:Z.id,label:Z.label})}function Ia(G,Z){ro({item:G,toColumnId:Z})}async function Oo(G,Z){if(Z===G.title)return;const ve=gn(G),He=it;st(ft=>ft.map(kt=>gn(kt)===ve?{...kt,title:Z}:kt)),we(ve);try{const ft=G.projectSlug===null?await dG({id:G.id,title:Z}):await uG({projectSlug:G.projectSlug,assignmentSlug:G.slug,title:Z});st(kt=>kt.map(_t=>gn(_t)===ve?{..._t,title:ft.title,updated:ft.updated}:_t)),l()}catch(ft){throw st(He),ee(ft.message,"error"),ft}finally{we(null)}}function Ps(G){wt(Z=>{const ve=new Set(Z);return ve.has(G)?ve.delete(G):ve.add(G),ve})}function _s(G){Ee===G?_o(ke==="asc"?"desc":"asc"):(Ts(G),_o("asc"))}const dn=$e?it.find(G=>gn(G)===$e)??null:null;function _i(G,Z){G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",Z),Ce(Z)}function so(){Ce(null),me(null)}function Ds(G,Z){if(!dn)return;const ve=gu(dn,Z);dn.status===Z||ve!=null&&ve.disabled||(G.preventDefault(),G.dataTransfer.dropEffect="move",me(Z))}function sg(G,Z){se===Z&&!G.currentTarget.contains(G.relatedTarget)&&me(null)}function Xd(G,Z){if(G.preventDefault(),!dn||dn.status===Z){so();return}so(),ro({item:dn,toColumnId:Z})}function jr({field:G,children:Z}){const ve=Ee===G;return s.jsx("th",{className:"pb-3 font-medium",children:s.jsxs("button",{type:"button",onClick:()=>_s(G),className:"inline-flex items-center gap-1 hover:text-foreground",children:[Z,ve?ke==="asc"?s.jsx(qE,{className:"h-3 w-3"}):s.jsx(br,{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(Ie,{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($t,{className:"h-4 w-4"}),"New Assignment"]})}),s.jsxs(_w,{children:[s.jsx(KG,{className:"w-full md:min-w-[320px] md:flex-1",value:pe,onChange:er,registry:Lo,declarations:d.factDeclarations,valueSources:{statuses:d.order,priorities:Br,types:f.definitions.map(G=>G.id),assignees:$a.filter(G=>G!=="__unassigned__"),projects:Ai.map(([G])=>G),tags:Mo}}),ir?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(Tm,{ref:r,value:$,onChange:ir?eo:()=>{},placeholder:"Search assignments or projects"}),s.jsx(bn,{ariaLabel:"Status filter",className:"max-w-[180px]",allLabel:"All statuses",disabled:!ir,options:to.map(G=>({value:G,label:b[G]??G})),value:z,onChange:Ao}),s.jsx(bn,{ariaLabel:"Priority filter",className:"max-w-[180px]",allLabel:"All priorities",disabled:!ir,options:Br.map(G=>({value:G,label:G[0].toUpperCase()+G.slice(1)})),value:F,onChange:Aa}),s.jsx(bn,{ariaLabel:"Type filter",className:"max-w-[180px]",allLabel:"All types",disabled:!ir,options:f.definitions.map(G=>({value:G.id,label:_l(f,G.id)})),value:H,onChange:Pa}),s.jsx(bn,{ariaLabel:"Assignee filter",className:"max-w-[180px]",allLabel:"All assignees",disabled:!ir,options:[{value:"__unassigned__",label:"Unassigned"},...$a.filter(G=>G!=="__unassigned__").map(G=>({value:G,label:G}))],value:V,onChange:Tc}),s.jsx(bn,{ariaLabel:"Project filter",className:"max-w-[180px]",allLabel:"All projects",disabled:!ir,options:[{value:"__standalone__",label:"Standalone"},...Ai.map(([G,Z])=>({value:G,label:Z}))],value:W,onChange:_a}),s.jsx(bn,{ariaLabel:"Tags filter",className:"max-w-[180px]",allLabel:"Any tags",disabled:!ir,options:Mo.map(G=>({value:G,label:G})),value:q,onChange:Ut}),s.jsx(Cm,{className:"max-w-[200px]",value:ne,onChange:ir?Po:()=>{}}),s.jsxs("select",{value:le,disabled:!ir,onChange:G=>Ri(G.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:D==="kanban"?Oe:ze,onChange:G=>Da(G.target.value),className:"editor-input max-w-[180px]",title:"Group by",children:o6.map(G=>{const Z=D==="kanban"&&G!=="status"&&G!=="type",ve=G==="none"?"No grouping":`Group: ${G.charAt(0).toUpperCase()+G.slice(1)}`;return s.jsx("option",{value:G,disabled:Z,children:Z?`${ve} (list only)`:ve},G)})}),s.jsx(Rm,{value:D,onChange:G=>Ti(G),options:[{value:"table",label:"Table"},{value:"list",label:"List"},{value:"kanban",label:"Kanban"}]}),D==="table"?s.jsx(VP,{visibility:Se,onChange:De}):null,s.jsx(JP,{scope:$n,loadedViewId:Ve,onApply:Rc,onOpenSaveDialog:()=>{Et(!1),zt(!0)}}),s.jsx("button",{type:"button",onClick:()=>{bt?Io():(Et(!1),zt(!0))},className:"inline-flex items-center gap-1.5 rounded-md border border-border/60 bg-background/60 px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-background",title:bt?`Update ${bt.name}`:"Save current view",children:bt?`Update '${bt.name}'`:"Save view"}),bt?s.jsx("button",{type:"button",onClick:()=>{Et(!0),zt(!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(Rt,{title:"No assignments yet",description:"Assignments appear here once projects contain concrete work items.",actions:s.jsxs(Ie,{className:"shell-action shell-action--cta",to:`${t}/projects`,children:[s.jsx(Ev,{className:"h-4 w-4"}),s.jsx("span",{children:"Browse Projects"})]})}):Bt.length===0?s.jsx(Rt,{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:Do,className:"shell-action shell-action--cta",children:[s.jsx(ML,{className:"h-4 w-4"}),s.jsx("span",{children:"Clear all filters"})]})}):D==="table"?(()=>{const G=new Set(Se.hidden),Z=ve=>ve==="title"||!G.has(ve);return s.jsx(Ge,{title:`${no.length} assignment${no.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:[Z("title")?s.jsx(jr,{field:"title",children:"Assignment"}):null,Z("status")?s.jsx(jr,{field:"status",children:"Status"}):null,s.jsx("th",{className:"py-2 pr-4 text-xs font-medium uppercase tracking-wider",children:"Type"}),Z("priority")?s.jsx(jr,{field:"priority",children:"Priority"}):null,Z("assignee")?s.jsx(jr,{field:"assignee",children:"Assignee"}):null,Z("dependencies")?s.jsx(jr,{field:"dependencies",children:"Dependencies"}):null,Z("created")?s.jsx(jr,{field:"created",children:"Created"}):null,Z("updated")?s.jsx(jr,{field:"updated",children:"Updated"}):null]})}),s.jsx("tbody",{children:no.map((ve,He)=>s.jsxs(XG,{detailHref:rd(ve),className:"cursor-pointer border-b border-border/50 transition hover:bg-muted/40 last:border-0",...Pi(He),children:[Z("title")?s.jsxs("td",{className:"py-4 pr-4",children:[s.jsx(w_,{title:ve.title,detailHref:rd(ve),onSave:ft=>Oo(ve,ft),disabled:ie===gn(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(Qr,{value:ve.id})]})]}):null,Z("status")?s.jsx("td",{className:"py-4 pr-4",children:s.jsx("select",{value:ve.status,disabled:ie===gn(ve),onChange:ft=>ro({item:ve,toColumnId:ft.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")]`,sd(d.statuses,ve.status).className,ie===gn(ve)&&"animate-pulse opacity-60"),style:sd(d.statuses,ve.status).style,children:w.map(ft=>{const kt=ve.status===ft,_t=kt?void 0:gu(ve,ft),Sn=d.statuses.find(Fo=>Fo.id===ft),Mn=!kt&&Db(Sn??{id:ft})&&!_t,Nn=((_t==null?void 0:_t.disabled)??!1)||Mn,kr=Mn?`Reach ${b[ft]??ft} via its transition when available`:(_t==null?void 0:_t.disabledReason)??void 0;return s.jsx("option",{value:ft,disabled:Nn,title:Nn?kr:void 0,children:b[ft]},ft)})})}):null,s.jsx("td",{className:"py-4 pr-4",children:s.jsx(Na,{type:ve.type,compact:!0})}),Z("priority")?s.jsx("td",{className:"py-4 pr-4 capitalize text-muted-foreground",children:ve.priority}):null,Z("assignee")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.assignee??"Unassigned"}):null,Z("dependencies")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:ve.dependsOn.length}):null,Z("created")?s.jsx("td",{className:"py-4 pr-4 text-muted-foreground",children:qn(ve.created)}):null,Z("updated")?s.jsx("td",{className:"py-4 text-muted-foreground",children:qn(ve.updated)}):null]},gn(ve)))})]})})})})():D==="list"?s.jsx("div",{className:"space-y-3",children:As.map(({id:G,label:Z,items:ve})=>{var Mn;if(ve.length===0&&!(dn&&ze==="status"))return null;const He=!nt.has(G),ft=ze==="status",kt=ft&&dn?dn.status!==G&&!((Mn=gu(dn,G))!=null&&Mn.disabled):!1,_t=ft&&dn?dn.status!==G&&!kt:!1,Sn=ft&&se===G;return s.jsxs("div",{className:Ne("rounded-lg border border-border/60 bg-card/90 transition",Sn&&kt&&"ring-2 ring-ring/30",_t&&"border-dashed opacity-65"),onDragOver:ft?Nn=>Ds(Nn,G):void 0,onDragLeave:ft?Nn=>sg(Nn,G):void 0,onDrop:ft?Nn=>Xd(Nn,G):void 0,children:[s.jsxs("button",{type:"button",onClick:()=>Ps(G),className:"flex w-full items-center gap-2 px-4 py-3 text-left",children:[s.jsx(br,{className:`h-4 w-4 text-muted-foreground transition-transform ${He?"":"-rotate-90"}`}),s.jsx("span",{className:"font-semibold text-foreground",children:Z}),s.jsx("span",{className:"rounded-full border border-border/60 px-2 py-0.5 text-xs text-muted-foreground",children:ve.length})]}),He&&ve.length>0&&s.jsx("div",{className:"space-y-3 px-4 pb-4",children:ve.map(Nn=>{const kr=gn(Nn),Fo=$e===kr,Di=Pc.get(kr)??-1,zo=ft;return s.jsx("div",{draggable:zo,onDragStart:zo?ss=>_i(ss,kr):void 0,onDragEnd:zo?so:void 0,...Di>=0?Pi(Di):{},className:Ne("transition",zo&&"cursor-grab active:cursor-grabbing",Fo&&"scale-[0.98] opacity-50"),children:s.jsx(_N,{assignment:Nn,dragging:Fo,transitioning:ie===kr,onPillSelect:ss=>void ro({item:Nn,toColumnId:ss.targetStatus,action:ss}),overrideTargets:Dc(Nn),onOverride:ss=>Ia(Nn,ss),onRenameTitle:ss=>Oo(Nn,ss)})},kr)})})]},G)})}):s.jsx(Nm,{columns:Oe==="type"?Lt:j,items:Bt,getItemId:gn,getColumnId:G=>Oe==="type"?G.type&&f.definitions.some(Z=>Z.id===G.type)?G.type:S:G.status,canDrop:({item:G,fromColumnId:Z,toColumnId:ve})=>{if(Z===ve)return{allowed:!0};const He=gu(G,ve);return He!=null&&He.disabled?{allowed:!1,reason:He.disabledReason||He.description}:{allowed:!0,reason:He?He.warning||He.description:`Move to ${ve} (direct status change).`}},onMove:Oe==="type"?void 0:({item:G,toColumnId:Z})=>ro({item:G,toColumnId:Z}),dragDisabled:Oe==="type",getExternalDragData:G=>G.projectSlug===null?{type:"standalone-assignment",id:G.id}:{type:"project-assignment",id:G.id},onCardContextMenu:(G,Z)=>{Z.preventDefault(),pt({item:G,anchor:{x:Z.clientX,y:Z.clientY}})},emptyMessage:G=>`No ${G.title.toLowerCase()} assignments.`,hiddenColumnIds:oe.hidden,onHideColumn:G=>je(Z=>({hidden:Z.hidden.includes(G)?Z.hidden.filter(He=>He!==G):[...Z.hidden,G]})),renderCard:(G,{dragging:Z})=>{const ve=Pc.get(gn(G))??-1;return s.jsx("div",{...ve>=0?Pi(ve):{},children:s.jsx(_N,{assignment:G,dragging:Z,transitioning:ie===gn(G),onPillSelect:He=>void ro({item:G,toColumnId:He.targetStatus,action:He}),overrideTargets:Dc(G),onOverride:He=>Ia(G,He),onRenameTitle:He=>Oo(G,He)})})}}),s.jsx(Ni,{toast:ce,onDismiss:xe}),s.jsx(QP,{open:Ft,onOpenChange:G=>{zt(G),G||Et(!1)},initialName:hn&&bt?`${bt.name} (copy)`:"",title:hn?"Save as new view":"Save view",onSubmit:Ac}),s.jsx(a_,{open:Pe!==null,action:(Pe==null?void 0:Pe.action)??null,assignmentTitle:(Pe==null?void 0:Pe.item.title)??"Assignment",loading:ie===(Pe?gn(Pe.item):null),onOpenChange:G=>{G||qe(null)},onConfirm:async G=>{if(!Pe)return;const Z=Pe;await _c({item:Z.item,toColumnId:Z.toColumnId,action:Z.action,reason:G})&&qe(null)}}),s.jsx(DA,{anchor:(de==null?void 0:de.anchor)??null,items:de?YG(de.item,{onEdit:()=>{const G=de.item,Z=G.projectSlug===null?`/assignments/${G.id}`:`${G.projectWorkspace?`/w/${G.projectWorkspace}`:t}/projects/${G.projectSlug}/assignments/${G.slug}`;n(Z)},onDelete:()=>St(de.item),onMove:()=>ye(de.item)}):[],onClose:()=>pt(null)}),s.jsx(Ei,{open:yt!==null,title:"Delete assignment?",description:yt?`"${yt.title}" will be permanently removed. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:ct!==null,onOpenChange:G=>{!G&&ct===null&&St(null)},onConfirm:async()=>{if(!yt||yt.projectSlug===null){St(null);return}const G=gn(yt);ht(G);try{const Z=await fetch(`/api/projects/${encodeURIComponent(yt.projectSlug)}/assignments/${encodeURIComponent(yt.slug)}`,{method:"DELETE"});if(!Z.ok){const ve=await Z.json().catch(()=>({}));throw new Error(ve.error||"Failed to delete assignment")}St(null),l(),ee("Assignment deleted","success")}catch(Z){ee(Z instanceof Error?Z.message:"Failed to delete assignment","error")}finally{ht(null)}}}),s.jsx($w,{open:Nt!==null,onOpenChange:G=>{G||ye(null)},currentWorkspace:(Nt==null?void 0:Nt.projectWorkspace)??null,title:"Move assignment to workspace",description:"Standalone assignments belong to a project-workspace via the workspaceGroup frontmatter field.",onSubmit:async G=>{if(!Nt)return;const Z=await fetch(`/api/assignments/${encodeURIComponent(Nt.id)}/move-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaceGroup:G})});if(!Z.ok){const ve=await Z.json().catch(()=>({}));throw new Error(ve.error||"Failed to move assignment")}l()}})]})}function YG(e,t){const n=[{key:"edit",label:"Edit",icon:uc,onSelect:t.onEdit}];return e.projectSlug!==null?n.push({key:"delete",label:"Delete",icon:vn,destructive:!0,onSelect:t.onDelete}):n.push({key:"move",label:"Move to workspace…",icon:Hh,onSelect:t.onMove}),n}function XG({detailHref:e,children:t,className:n,...r}){const o=j_(e);return s.jsx("tr",{...r,ref:o.containerRef,className:n,onMouseDown:o.onMouseDown,onClick:o.onClick,children:t})}function _N({assignment:e,dragging:t,transitioning:n,onPillSelect:r,overrideTargets:o,onOverride:i,onRenameTitle:a}){var p;const l=rd(e),d=!!(r&&a),f=j_(l);return s.jsxs("div",{ref:d?f.containerRef:void 0,className:Ne("vp-card rounded-lg border border-border/60 bg-background/85 p-3 shadow-sm",d&&"cursor-pointer"),onMouseDown:d?f.onMouseDown:void 0,onClick:d?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:[d?s.jsx(w_,{title:e.title,detailHref:l,onSave:a,disabled:n}):s.jsx(Ie,{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(Qr,{value:e.id})]})]}),d?s.jsx(FG,{currentStatus:e.status,availableTransitions:e.availableTransitions,onSelect:r,overrideTargets:o,onOverride:i,disabled:n,className:"max-w-[150px]"}):s.jsx(wn,{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(Na,{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"}),s.jsxs("span",{className:"rounded-full border border-border/60 px-2.5 py-1 text-xs text-muted-foreground",children:[e.dependsOn.length," dependencies"]})]}),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:qn(e.updated)})]})]})}function gu(e,t){return e.availableTransitions.find(n=>n.targetStatus===t)}function gn(e){return e.id||e.slug||"unknown"}function ns(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,d=[];const f=()=>{l&&(i.push(l),a.set(l,d))};for(const p of o){const h=p.match(/^([A-Za-z_][A-Za-z0-9_-]*):/);if(h&&!p.startsWith(" ")){f(),l=h[1],d=[p];continue}l&&d.push(p)}return f(),{order:i,blocks:a,body:r}}function kc(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 QG=/[:#{}[\],&*?|>!%@`]/;function Zb(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 k_(e){return QG.test(e)||/^\s|\s$/.test(e)||/^["']|["']$/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:e}function An(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"?"":Zb(o)}function JG(e,t){return An(e,t)==="true"}function ZG(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 Bu(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?ZG(o[1]).map(i=>Zb(i.trim())).filter(i=>i.length>0):n.slice(1).map(i=>i.trim()).filter(i=>i.startsWith("- ")).map(i=>Zb(i.slice(2).trim()))}function eY(e){return typeof e=="boolean"?e?"true":"false":e===null||e===""?"null":k_(e)}function Pn(e,t,n){e.blocks.has(t)||e.order.push(t),e.blocks.set(t,[`${t}: ${eY(n)}`])}function Uu(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=>` - ${k_(r)}`)])}function Hu(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Lm(e){const t=ns(e);return{title:An(t,"title"),slug:An(t,"slug"),workspace:An(t,"workspace"),archived:JG(t,"archived"),archivedAt:An(t,"archivedAt"),archivedReason:An(t,"archivedReason"),tags:Bu(t,"tags").join(", "),body:t.body}}function tY(e,t){const n=ns(e),r={...Lm(e),...t};return Pn(n,"title",r.title),Pn(n,"slug",r.slug),Pn(n,"workspace",r.workspace||null),Pn(n,"archived",r.archived),Pn(n,"archivedAt",r.archivedAt||null),Pn(n,"archivedReason",r.archivedReason||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,kc(n)}function Om(e){const t=ns(e);return{title:An(t,"title"),slug:An(t,"slug"),status:An(t,"status"),priority:An(t,"priority")||"medium",assignee:An(t,"assignee"),dependsOn:Bu(t,"dependsOn").join(", "),links:Bu(t,"links").join(", "),blockedReason:An(t,"blockedReason"),tags:Bu(t,"tags").join(", "),body:t.body}}function nY(e,t){const n=ns(e),r={...Om(e),...t};return Pn(n,"title",r.title),Pn(n,"slug",r.slug),Pn(n,"status",r.status),Pn(n,"priority",r.priority),Pn(n,"assignee",r.assignee||null),Uu(n,"dependsOn",Hu(r.dependsOn)),Uu(n,"links",Hu(r.links)),Pn(n,"blockedReason",r.blockedReason||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,kc(n)}function Fm(e){const t=ns(e);return{assignment:An(t,"assignment"),status:An(t,"status"),body:t.body}}function rY(e,t){const n=ns(e),r={...Fm(e),...t};return Pn(n,"assignment",r.assignment),Pn(n,"status",r.status),n.body=r.body,kc(n)}function zm(e){const t=ns(e);return{assignment:An(t,"assignment"),body:t.body}}function sY(e,t){const n=ns(e),r={...zm(e),...t};return Pn(n,"assignment",r.assignment),n.body=r.body,kc(n)}function Bm(e){const t=ns(e);return{name:An(t,"name"),slug:An(t,"slug"),description:An(t,"description"),whenToUse:An(t,"when_to_use"),tags:Bu(t,"tags").join(", "),body:t.body}}function oY(e,t){const n=ns(e),r={...Bm(e),...t};return Pn(n,"name",r.name),Pn(n,"slug",r.slug),Pn(n,"description",r.description||null),Pn(n,"when_to_use",r.whenToUse||null),Uu(n,"tags",Hu(r.tags)),n.body=r.body,kc(n)}function u0(e){return{body:ns(e).body}}function S_(e){return u0(e)}function N_(e,t){const n=ns(e);return t.body!==void 0&&(n.body=t.body),kc(n)}function iY(e,t){return N_(e,t)}function Jt(e,t,n){switch(e){case"project":return tY(t,n);case"assignment":return nY(t,n);case"plan":return rY(t,n);case"scratchpad":return sY(t,n);case"playbook":return oY(t,n);case"memory":return N_(t,n);case"resource":return iY(t,n);default:return t}}function Sc({initialContent:e,documentType:t,mode:n="edit",onSave:r,saving:o,error:i,title:a,description:l,onCancel:d,helpTitle:f,helpBody:p,allowSlugEdit:h=!1}){const[g,y]=m.useState(e),[k,w]=m.useState(!1),[b,j]=m.useState("edit");m.useEffect(()=>{y(e)},[e]);const N=uY(t,g),S=g!==e,C=cY(t,g),I=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:I})]}),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:d,className:"shell-action",children:[s.jsx(Qp,{className:"h-4 w-4"}),s.jsx("span",{children:"Back"})]}),T?s.jsxs("button",{type:"button",onClick:()=>w(R=>!R),className:"shell-action",children:[s.jsx($L,{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(Wh,{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(c1,{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(aY,{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(c1,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Preview"})]}),s.jsx(yn,{content:C,emptyState:"Write markdown body content to preview it here."})]})})]})]})}function aY({documentType:e,content:t,onChange:n,allowSlugEdit:r}){const o=Ns();if(e==="project"){const a=Lm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(xu,{children:[s.jsx(Ht,{label:"Project title",children:s.jsx("input",{value:a.title,onChange:l=>{const d=l.target.value,f={title:d};r&&(a.slug===Rr(a.title)||!a.slug.trim())&&(f.slug=Rr(d)),n(Jt(e,t,f))},className:"editor-input"})}),s.jsx(Ht,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:l=>n(Jt(e,t,{slug:Rr(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(Ht,{label:"Tags",children:s.jsx("input",{value:a.tags,onChange:l=>n(Jt(e,t,{tags:l.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(lY,{value:a.workspace,onChange:l=>n(Jt(e,t,{workspace:l}))})]}),s.jsx(Ht,{label:"Project body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Jt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="assignment"){const a=Om(t),l=vA(o),d=!l.some(f=>f.id===a.status);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(xu,{children:[s.jsx(Ht,{label:"Assignment title",children:s.jsx("input",{value:a.title,onChange:f=>{const p=f.target.value,h={title:p};r&&(a.slug===Rr(a.title)||!a.slug.trim())&&(h.slug=Rr(p)),n(Jt(e,t,h))},className:"editor-input"})}),s.jsx(Ht,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:a.slug,disabled:!r,onChange:f=>n(Jt(e,t,{slug:Rr(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(Ht,{label:"Status",children:s.jsxs("select",{value:a.status,onChange:f=>n(Jt(e,t,{status:f.target.value})),className:"editor-input",children:[d?s.jsx("option",{value:a.status,children:xi(o,a.status)}):null,l.map(f=>s.jsx("option",{value:f.id,children:f.label},f.id))]})}),s.jsx(Ht,{label:"Priority",children:s.jsxs("select",{value:a.priority,onChange:f=>n(Jt(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(Ht,{label:"Assignee",children:s.jsx("input",{value:a.assignee,onChange:f=>n(Jt(e,t,{assignee:f.target.value})),placeholder:"Agent name",className:"editor-input"})}),s.jsx(Ht,{label:"Depends on",className:"md:col-span-2",children:s.jsx("input",{value:a.dependsOn,onChange:f=>n(Jt(e,t,{dependsOn:f.target.value})),placeholder:"Comma-separated assignment slugs",className:"editor-input"})}),s.jsx(Ht,{label:"Links",className:"md:col-span-2",children:s.jsx("input",{value:a.links,onChange:f=>n(Jt(e,t,{links:f.target.value})),placeholder:"Comma-separated: projectSlug/assignmentSlug",className:"editor-input"})}),s.jsx(Ht,{label:"Blocked reason",className:"md:col-span-2",children:s.jsx("input",{value:a.blockedReason,onChange:f=>n(Jt(e,t,{blockedReason:f.target.value})),placeholder:"Read-only unless the assignment is actually blocked",className:"editor-input"})}),s.jsx(Ht,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:a.tags,onChange:f=>n(Jt(e,t,{tags:f.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})})]}),s.jsx(Ht,{label:"Assignment body",children:s.jsx("textarea",{value:a.body,onChange:f=>n(Jt(e,t,{body:f.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="plan"){const a=Fm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(xu,{children:[s.jsx(Ht,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})}),s.jsx(Ht,{label:"Plan status",children:s.jsxs("select",{value:a.status,onChange:l=>n(Jt(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(Ht,{label:"Plan body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Jt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="scratchpad"){const a=zm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(xu,{children:s.jsx(Ht,{label:"Assignment",children:s.jsx("input",{value:a.assignment,disabled:!0,className:"editor-input editor-input-disabled"})})}),s.jsx(Ht,{label:"Scratchpad body",children:s.jsx("textarea",{value:a.body,onChange:l=>n(Jt(e,t,{body:l.target.value})),className:"editor-textarea",spellCheck:!1})})]})}if(e==="memory"||e==="resource"){const a=e==="memory"?u0(t):S_(t),l=e==="memory"?"Memory body":"Resource body";return s.jsxs("div",{className:"space-y-3",children:[s.jsx(Ht,{label:l,children:s.jsx("textarea",{value:a.body,onChange:d=>n(Jt(e,t,{body:d.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=Bm(t);return s.jsxs("div",{className:"space-y-3",children:[s.jsxs(xu,{children:[s.jsx(Ht,{label:"Playbook name",children:s.jsx("input",{value:i.name,onChange:a=>{const l=a.target.value,d={name:l};r&&(i.slug===Rr(i.name)||!i.slug.trim())&&(d.slug=Rr(l)),n(Jt(e,t,d))},className:"editor-input"})}),s.jsx(Ht,{label:"Slug",children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("input",{value:i.slug,disabled:!r,onChange:a=>n(Jt(e,t,{slug:Rr(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(Ht,{label:"Description",className:"md:col-span-2",children:s.jsx("input",{value:i.description,onChange:a=>n(Jt(e,t,{description:a.target.value})),placeholder:"One-line description of what this playbook does",className:"editor-input"})}),s.jsx(Ht,{label:"Tags",className:"md:col-span-2",children:s.jsx("input",{value:i.tags,onChange:a=>n(Jt(e,t,{tags:a.target.value})),placeholder:"Comma-separated tags",className:"editor-input"})}),s.jsx(Ht,{label:"When to use",className:"md:col-span-2",children:s.jsx("input",{value:i.whenToUse,onChange:a=>n(Jt(e,t,{whenToUse:a.target.value})),placeholder:"Describe when agents should apply this playbook",className:"editor-input"})})]}),s.jsx(Ht,{label:"Playbook rules",children:s.jsx("textarea",{value:i.body,onChange:a=>n(Jt(e,t,{body:a.target.value})),className:"editor-textarea",spellCheck:!1})})]})}function xu({children:e}){return s.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:e})}function Ht({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 lY({value:e,onChange:t}){const{data:n}=ja(),r=(n==null?void 0:n.workspaces)??[];return s.jsx(Ht,{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 cY(e,t){switch(e){case"project":return Lm(t).body;case"assignment":return Om(t).body;case"plan":return Fm(t).body;case"scratchpad":return zm(t).body;case"playbook":return Bm(t).body;case"memory":return u0(t).body;case"resource":return S_(t).body}}function uY(e,t){switch(e){case"project":{const n=Lm(t);return[n.title.trim()?null:"Project title is required.",n.slug.trim()?null:"Project slug is required.",n.slug.trim()&&!Ap(n.slug)?"Project slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"assignment":{const n=Om(t);return[n.title.trim()?null:"Assignment title is required.",n.slug.trim()?null:"Assignment slug is required.",n.slug.trim()&&!Ap(n.slug)?"Assignment slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"plan":return Fm(t).assignment.trim()?[]:["Plan assignment is required."];case"scratchpad":return zm(t).assignment.trim()?[]:["Scratchpad assignment is required."];case"playbook":{const n=Bm(t);return[n.name.trim()?null:"Playbook name is required.",n.slug.trim()?null:"Playbook slug is required.",n.slug.trim()&&!Ap(n.slug)?"Playbook slug must be lowercase letters, numbers, and hyphens only.":null].filter(r=>!!r)}case"memory":case"resource":return[]}}function DN(){const e=Vt(),{workspace:t}=Wt(),n=pn(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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){d(!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}`),d(!1);return}e(`${n}/projects/${k.slug}`)}catch(y){p(y.message),d(!1);return}d(!1)}return i?s.jsx(vt,{label:"Loading project template…"}):f&&!r?s.jsx(Pt,{error:f}):s.jsx(Sc,{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 $N(){const{slug:e}=Wt(),t=pn(),n=Vt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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}d(!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}`),d(!1);return}n(`${t}/projects/${e}/assignments/${k.slug}`)}catch(y){p(y.message),d(!1);return}d(!1)}return i?s.jsx(vt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Pt,{error:f}):s.jsx(Sc,{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 IN(){const{workspace:e}=Wt(),t=pn(),n=Vt(),[r,o]=m.useState(null),[i,a]=m.useState(!0),[l,d]=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;d(!0),p(null);try{const k=await fetch("/api/assignments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:g})}),w=await k.json();if(!k.ok){p(w.error||`HTTP ${k.status}`),d(!1);return}const b=(y=w==null?void 0:w.assignment)==null?void 0:y.id;if(!b){p("Server did not return the new assignment id."),d(!1);return}n(`/assignments/${b}`)}catch(k){p(k.message),d(!1);return}d(!1)}return i?s.jsx(vt,{label:"Loading assignment template…"}):f&&!r?s.jsx(Pt,{error:f}):s.jsx(Sc,{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 Nc({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,documentType:i,helpTitle:a,helpBody:l}){const d=Vt(),{data:f,loading:p,error:h}=S2(e),[g,y]=m.useState(!1),[k,w]=m.useState(null);async function b(j){y(!0),w(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){w(S.error||`HTTP ${N.status}`),y(!1);return}d(n)}catch(N){w(N.message),y(!1);return}y(!1)}return p?s.jsx(vt,{label:`Loading ${r.toLowerCase()}…`}):h||!f?s.jsx(Pt,{error:h||`${r} is unavailable.`}):s.jsx(Sc,{initialContent:f.content,documentType:i,onSave:b,saving:g,error:k,title:r,description:o,onCancel:()=>d(n),helpTitle:a,helpBody:l})}function MN(){const{slug:e}=Wt(),t=pn(),n=e??"";return s.jsx(Nc,{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 Py(){const{slug:e,aslug:t,id:n}=Wt(),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(Nc,{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 _y(){const{slug:e,aslug:t,id:n}=Wt(),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(Nc,{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 Dy(){const{slug:e,aslug:t,id:n}=Wt(),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(Nc,{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 C_({loadUrl:e,saveUrl:t,redirectTo:n,title:r,description:o,helpTitle:i,helpBody:a}){const l=Vt(),{data:d,loading:f,error:p}=S2(e),[h,g]=m.useState(""),[y,k]=m.useState(""),[w,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})}),I=await C.json();if(!C.ok){N(I.error||`HTTP ${C.status}`),b(!1);return}l(n)}catch(C){N(C.message),b(!1);return}b(!1)}return f?s.jsx(vt,{label:`Loading ${r.toLowerCase()}…`}):p||!d?s.jsx(Pt,{error:p||`${r} is unavailable.`}):s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ge,{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:w||!y.trim(),className:"shell-action shell-action--cta disabled:cursor-not-allowed disabled:opacity-50",children:w?"Appending…":"Append Entry"})]})]})}),s.jsx(Ge,{title:"Current Document",children:s.jsx(yn,{content:d.content.replace(/^---[\s\S]*?---\n?/,""),emptyState:"No existing content."})})]})}function $y(){const{slug:e,aslug:t,id:n}=Wt(),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(C_,{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 Iy(){const{slug:e,aslug:t,id:n}=Wt(),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(C_,{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 LN(){const{workspace:e}=Wt(),{data:t}=Qs(),{data:n,loading:r,error:o,refetch:i}=Mv(),{toast:a,showToast:l,dismissToast:d}=Eo(),[f,p]=m.useState(!1),[h,g]=m.useState(""),[y,k]=m.useState(!1),[w,b]=m.useState(null),[j,N]=m.useState(!1),S=rr();m.useEffect(()=>{const _=S.hash.match(/^#server-(.+)/);if(!_)return;const B=decodeURIComponent(_[1]),$=document.querySelector(`[data-server-name="${window.CSS.escape(B)}"]`);if(!$)return;$.scrollIntoView({block:"nearest"}),$.classList.add("ring-2","ring-primary/60");const O=window.setTimeout(()=>$.classList.remove("ring-2","ring-primary/60"),1500);return()=>window.clearTimeout(O)},[S.hash,n]);const C=(()=>{if(!e||!n)return(n==null?void 0:n.sessions)??[];if(!t)return[];const _=new Set(t.filter(B=>e==="_ungrouped"?B.workspace===null:B.workspace===e).map(B=>B.slug));return n.sessions.filter(B=>B.windows.some($=>$.panes.some(O=>O.assignment&&O.assignment.project!==null&&_.has(O.assignment.project))))})();async function I(_){if(_.preventDefault(),!!h.trim())try{await fetch("/api/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h.trim()})}),g(""),p(!1),i()}catch{}}async function T(){k(!0);try{await fetch("/api/servers/refresh",{method:"POST"}),i()}finally{k(!1)}}async function R(_){N(!0);try{const B=await fetch(`/api/servers/${encodeURIComponent(_)}`,{method:"DELETE"});if(!B.ok){const $=await B.json().catch(()=>null);l(($==null?void 0:$.error)||`HTTP ${B.status}`,"error");return}b(null),i(),l(`Stopped tracking "${_}"`,"success")}catch(B){l(B instanceof Error?B.message:"Failed to remove session","error")}finally{N(!1)}}async function D(_){await fetch(`/api/servers/${encodeURIComponent(_)}/refresh`,{method:"POST"}),i()}return r?s.jsx(vt,{label:"Loading servers…"}):o?s.jsx(Pt,{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:I,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($t,{className:"h-3.5 w-3.5"}),"Track Session"]}),s.jsxs("button",{className:"shell-action",onClick:T,disabled:y,children:[s.jsx(QE,{className:`h-3.5 w-3.5 ${y?"animate-spin":""}`}),"Refresh All"]})]}),C.length===0?s.jsx(Rt,{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(dY,{session:_,onRefresh:()=>D(_.name),onRemove:()=>b(_.name),onRefetch:i},_.name))}),s.jsx(Ei,{open:w!==null,title:"Stop tracking session?",description:`Remove "${w??""}" from tracked servers. This does not stop the tmux session itself.`,confirmLabel:"Stop Tracking",destructive:!0,loading:j,onOpenChange:_=>{!_&&!j&&b(null)},onConfirm:async()=>{w&&await R(w)}}),s.jsx(Ni,{toast:a,onDismiss:d})]}):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(Tl,{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 dY({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(Pv,{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(QE,{className:"h-3.5 w-3.5"})}),s.jsx("button",{className:"shell-action",onClick:n,title:"Remove",children:s.jsx(vn,{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(fY,{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(n4,{className:"h-4 w-4"}),s.jsx("span",{children:e.kind==="process"?"Process no longer running":"Session no longer exists"})]})]})}function fY({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(Qr,{value:e.cwd})]}),e.branch&&s.jsxs("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Tv,{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(lc,{className:"h-2.5 w-2.5"})]},a))}),s.jsx("div",{className:"ml-auto shrink-0",children:e.assignment?s.jsxs(Ie,{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(WL,{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_(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 pY(e,t){const n=Date.parse(e),r=Math.floor((n-t)/1e3);return Number.isNaN(r)?"–":r<=0?"expired":E_(r)}function hY(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 mY(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ON(){const{data:e,loading:t,error:n,refetch:r}=N2(),[o,i]=m.useState(()=>Date.now()),[a,l]=m.useState(null),[d,f]=m.useState(!1);if(m.useEffect(()=>{const h=window.setInterval(()=>i(Date.now()),1e3);return()=>window.clearInterval(h)},[]),t)return s.jsx(vt,{label:"Loading inventories…"});if(n)return s.jsx(Pt,{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(Rt,{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(gY,{detail:h,now:o,onForceRelease:g=>l({slug:h.inventory.slug,lease:g})},h.inventory.slug))}),s.jsx(Ei,{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:d,onConfirm:p,onOpenChange:h=>{h||l(null)}})]})}function gY({detail:e,now:t,onForceRelease:n}){const{inventory:r,members:o,active_leases:i}=e,a=o.filter(d=>d.status==="idle").length,l=o.filter(d=>d.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(Vh,{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=",E_(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(d=>s.jsx(xY,{member:d},d.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(d=>s.jsx(yY,{lease:d,now:t,onForceRelease:()=>n(d)},d.lease_id))})]})]})}function xY({member:e}){const t=mY(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 ${hY(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 yY({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(TL,{className:"h-3 w-3"}),pY(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(o4,{className:"h-3 w-3"}),"Force release"]})]})]})}function bY(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 vY(){const e=await fetch("/api/schedules");if(!e.ok)throw new Error(`HTTP ${e.status}`);return(await e.json()).schedules}async function wY(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 jY(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 kY(){const[e,t]=m.useState(null),[n,r]=m.useState(!0),[o,i]=m.useState(null),a=m.useCallback(async()=>{try{t(await vY()),i(null)}catch(l){i(l instanceof Error?l.message:"Failed to fetch schedules")}finally{r(!1)}},[]);return m.useEffect(()=>{a()},[a]),fc(l=>{l.type==="schedules-updated"&&a()}),{data:e,loading:n,error:o,refetch:a}}const SY=[{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 NY({open:e,onOpenChange:t,onCreated:n}){const[r,o]=m.useState(""),[i,a]=m.useState("claude"),[l,d]=m.useState("cron"),[f,p]=m.useState(!0),[h,g]=m.useState(""),[y,k]=m.useState(""),[w,b]=m.useState("0 3 * * *"),[j,N]=m.useState(""),[S,C]=m.useState(""),[I,T]=m.useState("5"),[R,D]=m.useState("claude"),[_,B]=m.useState(""),[$,O]=m.useState("rolling-5h"),[z,A]=m.useState("ready_to_implement"),[F,U]=m.useState(""),[H,L]=m.useState(!1),[V,M]=m.useState(null);if(!e)return null;function W(){switch(l){case"cron":return{kind:l,expr:w,...j?{tz:j}:{}};case"at":return{kind:l,at:S};case"in":return{kind:l,durationMs:Math.round(Number(I)*36e5),anchorIso:new Date().toISOString()};case"after-reset":return{kind:l,provider:R,anchor:{windowStartIso:_||new Date().toISOString(),windowKind:$}};case"when-status":return{kind:l,status:z,...F?{assignmentId:F}:{}};case"when-plan-lands":return{kind:l,...F?{assignmentId:F}:{}}}}async function Y(){L(!0),M(null);try{const ne={assignmentId:r.trim(),agentId:i.trim(),trigger:W(),unattended:f,terminalPreference:h.trim()||null,promptTemplate:y.trim()||null};if(!ne.assignmentId)throw new Error("Assignment id is required");await wY(ne),n(),t(!1)}catch(ne){M(ne instanceof Error?ne.message:"Create failed")}finally{L(!1)}}const q="w-full rounded border bg-background px-2 py-1 text-sm",J="block text-xs font-medium text-muted-foreground";return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:s.jsxs("div",{className:"max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-lg border bg-card p-5",children:[s.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"New schedule"}),s.jsx("button",{type:"button",onClick:()=>t(!1),className:"text-muted-foreground hover:text-foreground",children:s.jsx(Nd,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Assignment id / slug"}),s.jsx("input",{className:q,value:r,onChange:ne=>o(ne.target.value),placeholder:"scheduled-agents"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Agent"}),s.jsx("input",{className:q,value:i,onChange:ne=>a(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Terminal (optional)"}),s.jsx("input",{className:q,value:h,onChange:ne=>g(ne.target.value),placeholder:"default"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Trigger"}),s.jsx("select",{className:q,value:l,onChange:ne=>d(ne.target.value),children:SY.map(ne=>s.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),l==="cron"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Cron expr"}),s.jsx("input",{className:q,value:w,onChange:ne=>b(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Timezone (optional)"}),s.jsx("input",{className:q,value:j,onChange:ne=>N(ne.target.value),placeholder:"local"})]})]}),l==="at"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"ISO timestamp"}),s.jsx("input",{className:q,value:S,onChange:ne=>C(ne.target.value),placeholder:"2026-06-16T03:00:00Z"})]}),l==="in"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Delay (hours)"}),s.jsx("input",{className:q,type:"number",value:I,onChange:ne=>T(ne.target.value)})]}),l==="after-reset"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Provider"}),s.jsxs("select",{className:q,value:R,onChange:ne=>D(ne.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:J,children:"Window kind"}),s.jsxs("select",{className:q,value:$,onChange:ne=>O(ne.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:J,children:"Window start (optional ISO)"}),s.jsx("input",{className:q,value:_,onChange:ne=>B(ne.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:J,children:"Status"}),s.jsx("input",{className:q,value:z,onChange:ne=>A(ne.target.value)})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Watch assignment (optional)"}),s.jsx("input",{className:q,value:F,onChange:ne=>U(ne.target.value),placeholder:"this assignment"})]})]}),l==="when-plan-lands"&&s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Watch assignment (optional)"}),s.jsx("input",{className:q,value:F,onChange:ne=>U(ne.target.value),placeholder:"this assignment"})]}),s.jsxs("div",{children:[s.jsx("label",{className:J,children:"Prompt template (optional)"}),s.jsx("input",{className:q,value:y,onChange:ne=>k(ne.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:ne=>p(ne.target.checked)}),"Unattended (hard limits + kill switch apply)"]}),V&&s.jsx("p",{className:"text-sm text-destructive",children:V})]}),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:Y,disabled:H,className:"rounded bg-primary px-3 py-1 text-sm text-primary-foreground disabled:opacity-50",children:H?"Creating…":"Create"})]})]})})}const CY=new Set(["completed","failed","launch_failed","cancelled","killed"]);function EY(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 TY(){const{data:e,loading:t,error:n,refetch:r}=kY(),[o,i]=m.useState(!1);if(t)return s.jsx(vt,{label:"Loading schedules…"});if(n)return s.jsx(Pt,{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 jY(l.id),r()}catch(d){window.alert(d instanceof Error?`Cancel failed: ${d.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($t,{className:"h-4 w-4"}),"New schedule"]})]}),!e||e.length===0?s.jsx(Rt,{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(VE,{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 ${EY(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:[bY(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]})]})]}),!CY.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(vL,{className:"h-3 w-3"}),"Cancel"]})]},l.id))}),s.jsx(NY,{open:o,onOpenChange:i,onCreated:r})]})}const RY={"7d":"7 days","30d":"30 days","90d":"90 days",all:"All time",custom:"Custom"},ai="bg-zinc-950 border border-zinc-700 rounded px-2 py-1 text-sm";function FN(){const[e,t]=ks(),n=aO(e),r=n.window??"30d",o=e.get("groupBy")==="assignment"?"assignment":"project",{data:i}=Qs(),{data:a}=ja(),{data:l}=C2(),[d,f]=m.useState(null),[p,h]=m.useState(!0),[g,y]=m.useState(null);m.useEffect(()=>{if(!e.get("window")){const b=fb({window:"30d",...n});o==="assignment"&&b.set("groupBy","assignment"),t(b,{replace:!0})}},[]);const k=w2({window:r,...n}).toString();m.useEffect(()=>{const b=new AbortController;h(!0),y(null);const j=k?`/api/usage?${k}&groupBy=${o}`:`/api/usage?groupBy=${o}`;return fetch(j,{signal:b.signal}).then(async N=>{if(!N.ok){const S=await N.json().catch(()=>({}));throw new Error(S.error??`HTTP ${N.status}`)}return N.json()}).then(N=>{f(N),h(!1)}).catch(N=>{N instanceof Error&&N.name==="AbortError"||(y(N instanceof Error?N.message:String(N)),h(!1))}),()=>b.abort()},[k,o]);function w(b,j=o){const N=fb(b);j==="assignment"&&N.set("groupBy","assignment"),t(N)}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(Sd,{className:"w-6 h-6 text-amber-400"}),s.jsx("h1",{className:"text-2xl font-semibold",children:"Token usage"})]}),s.jsxs("div",{className:"flex flex-wrap gap-4 items-end mb-6 p-4 rounded-lg bg-zinc-900/50 border border-zinc-800",children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Window"}),s.jsx("select",{value:r,onChange:b=>w({...n,window:b.target.value}),className:ai,children:Kh.map(b=>s.jsx("option",{value:b,children:RY[b]},b))})]}),r==="custom"?s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Since"}),s.jsx("input",{type:"date",value:n.since??"",onChange:b=>w({...n,window:"custom",since:b.target.value||void 0}),className:ai})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Until"}),s.jsx("input",{type:"date",value:n.until??"",onChange:b=>w({...n,window:"custom",until:b.target.value||void 0}),className:ai})]})]}):null,s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Workspace"}),s.jsxs("select",{value:n.workspace??"",onChange:b=>w({...n,workspace:b.target.value||void 0,project:void 0}),className:ai,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(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Project"}),s.jsxs("select",{value:n.project??"",onChange:b=>w({...n,project:b.target.value||void 0,workspace:void 0}),className:ai,children:[s.jsx("option",{value:"",children:"All"}),(i??[]).map(b=>s.jsx("option",{value:b.slug,children:b.slug},b.slug))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Model"}),s.jsxs("select",{value:n.model??"",onChange:b=>w({...n,model:b.target.value||void 0}),className:ai,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.models)??[]).map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Tool"}),s.jsxs("select",{value:n.tool??"",onChange:b=>w({...n,tool:b.target.value||void 0}),className:ai,children:[s.jsx("option",{value:"",children:"All"}),((l==null?void 0:l.tools)??[]).map(b=>s.jsx("option",{value:b,children:b},b))]})]}),s.jsxs("label",{className:"flex flex-col gap-1 text-sm",children:[s.jsx("span",{className:"text-zinc-400",children:"Group by"}),s.jsxs("select",{value:o,onChange:b=>w(n,b.target.value),className:ai,children:[s.jsx("option",{value:"project",children:"Project"}),s.jsx("option",{value:"assignment",children:"Assignment"})]})]})]}),p&&s.jsx("p",{className:"text-zinc-400",children:"Loading…"}),g&&s.jsxs("p",{className:"text-red-400",children:["Error: ",g]}),d&&!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"}),d.summary.length===0?s.jsxs("p",{className:"text-zinc-500 text-sm",children:["No usage data for these filters. Run"," ",s.jsx("code",{className:"bg-zinc-800 px-1 py-0.5 rounded text-amber-300",children:"syntaur usage"})," ","to ingest the latest ccusage data."]}):s.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-zinc-900 text-zinc-400",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:d.summary.map((b,j)=>s.jsxs("tr",{className:"border-t border-zinc-800",children:[s.jsx("td",{className:"px-3 py-2",children:b.projectSlug||"(unattributed)"}),o==="assignment"&&s.jsx("td",{className:"px-3 py-2",children:b.assignmentSlug||"(unattributed)"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Hl(b.totalTokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Vl(b.totalCost)}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.lastEventDay})]},j))})]})]}),s.jsxs("section",{children:[s.jsx("h2",{className:"text-lg font-medium mb-2",children:"Daily breakdown"}),d.daily.length===0?s.jsx("p",{className:"text-zinc-500 text-sm",children:"No daily rows."}):s.jsxs("table",{className:"w-full text-sm border border-zinc-800 rounded overflow-hidden",children:[s.jsx("thead",{className:"bg-zinc-900 text-zinc-400",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:d.daily.map((b,j)=>s.jsxs("tr",{className:"border-t border-zinc-800",children:[s.jsx("td",{className:"px-3 py-2 tabular-nums",children:b.day}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.tool}),s.jsx("td",{className:"px-3 py-2 text-zinc-400",children:b.model}),s.jsx("td",{className:"px-3 py-2",children:b.project_slug||"–"}),s.jsx("td",{className:"px-3 py-2",children:b.assignment_slug||"–"}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Hl(b.total_tokens)}),s.jsx("td",{className:"px-3 py-2 text-right tabular-nums",children:Vl(b.total_cost)})]},j))})]})]})]})]})}function zN(){const{workspace:e}=Wt(),{data:t}=Qs(),{data:n,loading:r,error:o}=Yh(),[i,a]=m.useState(""),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState("started_desc"),[y,k]=m.useState(0),[w,b]=m.useState(new Set),[j,N]=m.useState(!1),[S,C]=m.useState(null),[I,T]=m.useState(null),R=(n==null?void 0:n.sessions.some(A=>A.status==="active"))??!1;m.useEffect(()=>{if(!R)return;const A=window.setInterval(()=>k(F=>F+1),3e4);return()=>window.clearInterval(A)},[R]),m.useEffect(()=>{b(A=>{if(A.size===0)return A;const F=new Set((n==null?void 0:n.sessions.map(H=>H.sessionId))??[]),U=new Set([...A].filter(H=>F.has(H)));return U.size===A.size?A:U})},[n]);const D=m.useMemo(()=>{if(!n)return[];if(e&&!t)return[];const A=i.trim().toLowerCase();return[...n.sessions.filter(U=>{var V;if(e&&t){const M=((V=t.find(W=>W.slug===U.projectSlug))==null?void 0:V.workspace)??null;if(e==="_ungrouped"){if(M!==null)return!1}else if(M!==e)return!1}const H=PY(U.started);return l&&(!H||H<l)||f&&(!H||H>f)?!1:A?[U.projectSlug??"",U.assignmentSlug??"",U.agent,U.sessionId,U.path,U.description??"",U.transcriptPath??""].join(" ").toLowerCase().includes(A):!0})].sort((U,H)=>_Y(U,H,h))},[n,i,h,l,f,y,e,t]);function _(A){b(F=>{const U=new Set(F);return U.has(A)?U.delete(A):U.add(A),U})}function B(){w.size===D.length&&D.length>0?b(new Set):b(new Set(D.map(A=>A.sessionId)))}async function $(A){C(null),N(!0);try{const F=await fetch("/api/agent-sessions",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionIds:A})}),U=await F.json().catch(()=>null);if(!F.ok)throw new Error((U==null?void 0:U.error)||`HTTP ${F.status}`);b(H=>new Set([...H].filter(L=>!A.includes(L)))),T(null)}catch(F){C(F.message)}finally{N(!1)}}async function O(A){try{const F=await fetch(`/api/agent-sessions/${encodeURIComponent(A)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:"stopped"})});if(!F.ok){const U=await F.json().catch(()=>null);C((U==null?void 0:U.error)||`Failed to mark session stopped: HTTP ${F.status}`)}}catch(F){C(F.message)}}if(r)return s.jsx(vt,{label:"Loading agent sessions..."});if(o)return s.jsx(Pt,{error:o});if(!n)return null;const z=n.sessions.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs(_w,{children:[s.jsx(Tm,{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:A=>d(A.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:A=>p(A.target.value),className:"editor-input min-w-[150px]"})]}),s.jsxs("select",{value:h,onChange:A=>g(A.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,w.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:[w.size," session",w.size!==1?"s":""," selected"]}),s.jsxs("button",{className:"shell-action text-destructive",onClick:()=>T({sessionIds:[...w],title:`Delete ${w.size} selected session${w.size===1?"":"s"}?`,description:"This removes the selected agent session records from the dashboard. This cannot be undone.",confirmLabel:w.size===1?"Delete Session":"Delete Sessions"}),disabled:j,children:[s.jsx(vn,{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"})]}),z?D.length===0?s.jsx(Rt,{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-[1280px] table-fixed text-sm",children:[s.jsxs("colgroup",{children:[s.jsx("col",{style:{width:"32px"}}),s.jsx("col",{style:{width:"140px"}}),s.jsx("col",{style:{width:"160px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"110px"}}),s.jsx("col",{style:{width:"130px"}}),s.jsx("col",{style:{width:"140px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"200px"}}),s.jsx("col",{style:{width:"40px"}})]}),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:"pb-2 pr-3",children:s.jsx("button",{onClick:B,className:"text-muted-foreground hover:text-foreground",children:w.size===D.length&&D.length>0?s.jsx(Xr,{className:"h-4 w-4"}):s.jsx(_v,{className:"h-4 w-4"})})}),s.jsx("th",{className:"pb-2 pr-3",children:"Project"}),s.jsx("th",{className:"pb-2 pr-3",children:"Assignment"}),s.jsx("th",{className:"pb-2 pr-3",children:"Description"}),s.jsx("th",{className:"pb-2 pr-3",children:"Agent"}),s.jsx("th",{className:"pb-2 pr-3",children:"Session ID"}),s.jsx("th",{className:"pb-2 pr-3",children:"Started"}),s.jsx("th",{className:"pb-2 pr-3",children:"Path"}),s.jsx("th",{className:"pb-2 pr-3",children:"Transcript"}),s.jsx("th",{className:"pb-2"})]})}),s.jsx("tbody",{children:D.map(A=>s.jsx(AY,{session:A,selected:w.has(A.sessionId),onToggle:()=>_(A.sessionId),onDelete:()=>T({sessionIds:[A.sessionId],title:`Delete session ${A.sessionId.slice(0,8)}...?`,description:`Remove this ${A.agent} session record${A.assignmentSlug?` for ${A.assignmentSlug}`:""}. This cannot be undone.`,confirmLabel:"Delete Session"}),onMarkStopped:O,onCopyError:C},A.sessionId))})]})}):s.jsx(Rt,{title:"No agent sessions",description:"No agent sessions have been registered yet. Use /grab-assignment or syntaur track-session to register one."}),s.jsx(Ei,{open:I!==null,title:(I==null?void 0:I.title)??"Delete session?",description:(I==null?void 0:I.description)??"",confirmLabel:(I==null?void 0:I.confirmLabel)??"Delete",destructive:!0,loading:j,onOpenChange:A=>{A||T(null)},onConfirm:async()=>{I&&await $(I.sessionIds)}})]})}function AY({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,d=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(Xr,{className:"h-4 w-4"}):s.jsx(_v,{className:"h-4 w-4"})})}),s.jsx("td",{className:"py-2 pr-3",children:e.projectSlug?s.jsx(Ie,{to:`${a}/projects/${e.projectSlug}`,className:"block truncate text-primary hover:underline",title:Tn(e.projectSlug),children:Tn(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(Ie,{to:`${a}/projects/${e.projectSlug}/assignments/${e.assignmentSlug}`,className:"block truncate text-primary hover:underline",title:Tn(e.assignmentSlug),children:Tn(e.assignmentSlug)}):e.assignmentSlug?s.jsx(Ie,{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(Bh,{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:"py-2 pr-3",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(Qr,{value:e.sessionId}),s.jsx(ZP,{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:Jr(e.started)})}),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("span",{className:"block min-w-0 truncate text-xs text-muted-foreground",title:e.path,children:d}),e.path&&s.jsx(Qr,{value:e.path})]})}),s.jsx("td",{className:"py-2 pr-3",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(Qr,{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(s_,{session:e,onMarkStopped:o}),s.jsx("button",{onClick:r,className:"text-muted-foreground hover:text-destructive",title:"Delete session",children:s.jsx(vn,{className:"h-3.5 w-3.5"})})]})})]})}function PY(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 pp(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 _Y(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 pp(e)-pp(t);case"duration_desc":return pp(t)-pp(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 DY(){const{data:e,loading:t,error:n,refetch:r}=Lv(),[o,i]=m.useState(""),[a,l]=m.useState(null),[d,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 w=o.toLowerCase();return e.playbooks.filter(b=>b.name.toLowerCase().includes(w)||b.description.toLowerCase().includes(w)||b.slug.toLowerCase().includes(w)||b.tags.some(j=>j.toLowerCase().includes(w)))},[e,o]);async function y(w,b,j){if(w.preventDefault(),w.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(d){h(d.slug);try{const w=await fetch(`/api/playbooks/${encodeURIComponent(d.slug)}`,{method:"DELETE"});if(!w.ok){const b=await w.json().catch(()=>({}));throw new Error(b.error||"Failed to delete playbook")}f(null),r()}catch(w){console.error(w),alert(w instanceof Error?w.message:"Failed to delete playbook")}finally{h(null)}}}return t?s.jsx(vt,{label:"Loading playbooks..."}):n?s.jsx(Pt,{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(ji,{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:w=>i(w.target.value),className:"h-9 w-full rounded-md border border-border/70 bg-background pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground/60 focus:border-foreground/30 focus:outline-none"})]}),s.jsxs(Ie,{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($t,{className:"h-4 w-4"}),"Create Playbook"]})]}),s.jsxs(Ie,{to:"/playbooks/manifest",className:"surface-panel group flex items-center gap-3 p-3 transition hover:border-foreground/20",children:[s.jsx(GE,{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(Rt,{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(Ie,{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($t,{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(w=>{const b=a===w.slug,j=[{key:"delete",label:"Delete",icon:vn,destructive:!0,onSelect:()=>f({slug:w.slug,name:w.name})}];return s.jsxs("div",{className:`surface-panel relative flex flex-col gap-2 p-4 transition hover:border-foreground/20 ${w.enabled?"":"opacity-75"}`,children:[s.jsx("div",{className:"absolute right-3 top-3 z-10",children:s.jsx(Tw,{items:j})}),s.jsxs(Ie,{to:`/playbooks/${w.slug}`,className:"group flex flex-col gap-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(HE,{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:w.name}),w.description?s.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground line-clamp-2",children:w.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:[w.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(JE,{className:"h-2.5 w-2.5"}),N]},N)),w.tags.length>3?s.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:["+",w.tags.length-3]}):null]})})]}),s.jsx("button",{type:"button",role:"switch","aria-checked":w.enabled,"aria-label":w.enabled?"Disable playbook":"Enable playbook",onClick:N=>y(N,w.slug,w.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 ${w.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 ${w.enabled?"translate-x-[18px] bg-background":"translate-x-[2px] bg-foreground/70"}`})})]},w.slug)})}),s.jsx(Ei,{open:d!==null,title:"Delete playbook?",description:d?`"${d.name}" will be removed from disk and the playbook manifest will be regenerated. This cannot be undone.`:"",confirmLabel:"Delete",destructive:!0,loading:p!==null,onConfirm:k,onOpenChange:w=>{w||f(null)}})]})}function $Y(){const{slug:e}=Wt(),t=Vt(),{data:n,loading:r,error:o,refetch:i}=yO(e),[a,l]=m.useState(!1),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(!1),[k,w]=m.useState(""),[b,j]=m.useState(!1),[N,S]=m.useState(null),C=e==="manifest";m.useEffect(()=>{g&&(w(e??""),S(null))},[g,e]);const I=Rr(k),T=I.length>0&&Ap(I)&&I!=="manifest",R=I!==e;async function D(){if(!(!e||!T||!R)){j(!0),S(null);try{const $=await fetch(`/api/playbooks/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({newSlug:I})});if(!$.ok){const O=await $.json().catch(()=>({}));throw new Error(O.error||"Failed to rename playbook")}y(!1),t(`/playbooks/${I}`)}catch($){S($ instanceof Error?$.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 B(){if(!(!e||!n)){h(!0);try{const $=n.enabled?"disable":"enable",O=await fetch(`/api/playbooks/${encodeURIComponent(e)}/${$}`,{method:"POST"});if(!O.ok){const z=await O.json().catch(()=>({}));throw new Error(z.error||`Failed to ${$} playbook`)}i()}catch($){console.error($),alert($ instanceof Error?$.message:"Failed to update playbook")}finally{h(!1)}}}return r?s.jsx(vt,{label:"Loading playbook..."}):o?s.jsx(Pt,{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 ",Jr(n.created)]}),s.jsxs("span",{children:["Updated ",Jr(n.updated)]})]}),n.tags.length>0?s.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:n.tags.map($=>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(JE,{className:"h-3 w-3"}),$]},$))}):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:B,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(Ie,{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(uc,{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(a4,{className:"h-3 w-3"}),"Rename"]}),a?s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:_,disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting...":"Confirm"}),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(vn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(yn,{content:n.body})}),s.jsx(Bn,{open:g,onOpenChange:$=>b?void 0:y($),children:s.jsxs(_n,{children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Rename playbook"}),s.jsx(es,{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:$=>w($.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&&I!==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:I||"—"})]}):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(zr,{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:D,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 IY(){const e=Vt(),[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(!1),[l,d]=m.useState(null);m.useEffect(()=>{fetch("/api/playbooks/template/new").then(p=>p.json()).then(p=>{n(p.content),o(!1)}).catch(p=>{d(p.message),o(!1)})},[]);async function f(p){a(!0),d(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){d(g.error||`HTTP ${h.status}`),a(!1);return}e(`/playbooks/${g.slug}`)}catch(h){d(h.message),a(!1);return}a(!1)}return r?s.jsx(vt,{label:"Loading playbook template..."}):l&&!t?s.jsx(Pt,{error:l}):s.jsx(Sc,{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 MY(){const{slug:e}=Wt(),t=Vt(),[n,r]=m.useState(null),[o,i]=m.useState(!0),[a,l]=m.useState(!1),[d,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(vt,{label:"Loading playbook..."}):d&&!n?s.jsx(Pt,{error:d}):s.jsx(Sc,{initialContent:n||"",documentType:"playbook",mode:"edit",onSave:p,saving:a,error:d,title:"Edit Playbook",onCancel:()=>t(`/playbooks/${e}`)})}function LY(){const{data:e,loading:t,error:n}=bO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,d]=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]),w=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(vt,{label:"Loading memories…"}):n?s.jsx(Pt,{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(ji,{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=>d(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(Ie,{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($t,{className:"h-4 w-4"}),"New Memory"]})]}),w.length===0?s.jsx(Rt,{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(Ie,{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($t,{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:w.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(Ie,{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(Ie,{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:qn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function OY(){const{slug:e,itemSlug:t}=Wt(),n=Vt(),{data:r,loading:o,error:i}=vO(e,t),[a,l]=m.useState(!1),[d,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(vt,{label:"Loading memory…"}):i?s.jsx(Pt,{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(Ie,{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 ",Jr(r.created)]}),s.jsxs("span",{children:["Updated ",Jr(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(Ie,{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(uc,{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:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),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(vn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(yn,{content:r.body})})]}):null}function FY(){const e=Vt(),[t]=ks(),n=t.get("project"),{data:r,loading:o,error:i}=Qs(),[a,l]=m.useState(n??""),[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,w]=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||!d.trim())){y(!0),w(null);try{const N=await fetch(`/api/projects/${a}/memories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:p||void 0})}),S=await N.json();if(!N.ok){w(S.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${S.projectSlug}/memories/${S.slug}`)}catch(N){w(N.message),y(!1)}}}return o?s.jsx(vt,{label:"Loading projects…"}):i?s.jsx(Pt,{error:i}):!r||r.length===0?s.jsx(Pt,{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:d,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||!d.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}=Wt();return s.jsx(Nc,{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 BY(){const{data:e,loading:t,error:n}=wO(),[r,o]=m.useState(""),[i,a]=m.useState("all"),[l,d]=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]),w=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(vt,{label:"Loading resources…"}):n?s.jsx(Pt,{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(ji,{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=>d(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(Ie,{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($t,{className:"h-4 w-4"}),"New Resource"]})]}),w.length===0?s.jsx(Rt,{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(Ie,{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($t,{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:w.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(Ie,{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(Ie,{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:qn(b.updated)})]},`${b.projectSlug}/${b.slug}`))})]})})]})}function UY(){const{slug:e,itemSlug:t}=Wt(),n=Vt(),{data:r,loading:o,error:i}=jO(e,t),[a,l]=m.useState(!1),[d,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(vt,{label:"Loading resource…"}):i?s.jsx(Pt,{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(Ie,{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 ",Jr(r.created)]}),s.jsxs("span",{children:["Updated ",Jr(r.updated)]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(Ie,{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(uc,{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:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition hover:bg-destructive/90 disabled:opacity-50",children:d?"Deleting…":"Confirm"}),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(vn,{className:"h-3 w-3"}),"Delete"]})]})]}),s.jsx("div",{className:"surface-panel p-4",children:s.jsx(yn,{content:r.body})})]}):null}function HY(){const e=Vt(),[t]=ks(),n=t.get("project"),{data:r,loading:o,error:i}=Qs(),[a,l]=m.useState(n??""),[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(!1),[k,w]=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||!d.trim())){y(!0),w(null);try{const N=await fetch(`/api/projects/${a}/resources`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:d.trim(),body:p||void 0})}),S=await N.json();if(!N.ok){w(S.error||`HTTP ${N.status}`),y(!1);return}e(`/projects/${S.projectSlug}/resources/${S.slug}`)}catch(N){w(N.message),y(!1)}}}return o?s.jsx(vt,{label:"Loading projects…"}):i?s.jsx(Pt,{error:i}):!r||r.length===0?s.jsx(Pt,{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:d,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||!d.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 VY(){const{slug:e,itemSlug:t}=Wt();return s.jsx(Nc,{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 ev=["projects","playbooks","todos","servers","config"];function WY(e){const t=new Set;for(const n of e.split(",").map(r=>r.trim()))ev.includes(n)&&t.add(n);return t}function BN(e){if(!e)return"never";try{return new Date(e).toLocaleString()}catch{return e}}function qY(){const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(""),[a,l]=m.useState(new Set(ev)),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),[k,w]=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(WY(R.categories)),f(!1)}catch(T){w({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 D=new Set(R);return D.has(T)?D.delete(T):D.add(T),D}),f(!0)}async function N(){h(!0),w(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})}),D=await R.json();if(!R.ok)throw new Error(D.error||`HTTP ${R.status}`);r(D),f(!1),w({type:"success",message:"Backup configuration saved."})}catch(T){w({type:"error",message:`Save failed: ${T instanceof Error?T.message:String(T)}`})}finally{h(!1)}}async function S(){y("push"),w(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}`);w({type:"success",message:R.message||"Backup complete."}),await b()}catch(T){w({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"),w(null);try{const R=await fetch("/api/backup/pull",{method:"POST"}),D=await R.json();if(!R.ok||D.success===!1)throw new Error(D.error||D.message||`HTTP ${R.status}`);w({type:"success",message:D.message||"Restore complete."}),await b()}catch(R){w({type:"error",message:`Restore failed: ${R instanceof Error?R.message:String(R)}`})}finally{y(null)}}}if(e)return s.jsx(Ge,{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 I=!!o.trim()&&a.size>0&&!g&&!d;return s.jsx(Ge,{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:ev.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: "}),BN((n==null?void 0:n.lastBackup)??null)]}),s.jsxs("div",{children:[s.jsx("span",{className:"font-medium text-foreground",children:"Last restore: "}),BN((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||!d,children:[s.jsx(Wh,{className:"h-3.5 w-3.5"}),p?"Saving...":"Save Config"]}),s.jsxs("button",{className:"shell-action",onClick:S,disabled:!I,title:I?"Back up now":d?"Save config first":"Set repo and pick categories",children:[s.jsx(l4,{className:"h-3.5 w-3.5"}),g==="push"?"Backing up...":"Back Up Now"]}),s.jsxs("button",{className:"shell-action",onClick:C,disabled:!I,title:I?"Restore from backup":d?"Save config first":"Set repo and pick categories",children:[s.jsx(_L,{className:"h-3.5 w-3.5"}),g==="pull"?"Restoring...":"Restore"]}),d&&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(RL,{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 KY(){const{customBindings:e,userBindings:t,actionEntries:n,findConflict:r,bindAction:o,unbindAction:i}=ki(),[a,l]=m.useState(null),[d,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 w(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=E2(S.nativeEvent);if(!C)return;const I=r(C,a.kind);l({...a,combo:C,conflict:I,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 ${uu[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 ${uu[S]} binding`)}catch(C){y("error",C instanceof Error?C.message:"Failed to clear binding")}}async function N(){if(!p){h(!0);try{await K6(),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(Ge,{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(Ys,{className:"h-3 w-3"}),"Restore defaults"]}):void 0,children:[d?s.jsx("div",{className:`mb-3 rounded-md border px-3 py-1.5 text-xs ${d.type==="success"?"border-success-foreground/30 bg-success text-success-foreground":"border-error-foreground/30 bg-error text-error-foreground"}`,children:d.message}):null,s.jsx("ul",{className:"space-y-2",children:Xh.map(S=>{var D,_;const C=n.find(B=>B.bindableKind===S),I=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(lb,{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)??uu[S]}),C!=null&&C.subtitle?s.jsx("div",{className:"text-xs text-muted-foreground",children:C.subtitle}):null]}),I?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:qs(I)}),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:I?"Rebind":"Bind"}),T?s.jsxs("button",{type:"button",className:"shell-action text-xs",onClick:()=>void j(S),"aria-label":`Restore default ${uu[S]} binding`,children:[s.jsx(Nd,{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:w,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:qs(a.combo)}),(D=a.conflict)!=null&&D.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 "',uu[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 GY={kanban:"Kanban",list:"List",table:"Table"},YY={comfortable:"Comfortable",compact:"Compact"},XY={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"},QY={asc:"Ascending",desc:"Descending"};function JY(){const e=tG(),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 YP({[f]:p}),a("success","Saved")}catch(h){a("error",h instanceof Error?h.message:"Failed to save")}finally{r(!1)}}}async function d(){if(e.custom){r(!0);try{await nG(),a("success","Reset to defaults")}catch(f){a("error",f instanceof Error?f.message:"Failed to reset")}finally{r(!1)}}}return s.jsxs(Ge,{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:d,disabled:n,children:[s.jsx(Ys,{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:nw.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:GY[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:s6.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:YY[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:wT.map(f=>s.jsx("option",{value:f,children:XY[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:r6.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:QY[f]},f))})]})]})]})}function ZY({value:e,onChange:t,knownSlugs:n,rows:r=2,placeholder:o,className:i,wrapperClassName:a,singleLine:l,"aria-label":d}){const[f,p]=m.useState(0),[h,g]=m.useState(0),[y,k]=m.useState(!1),w=m.useRef(null),b=p_(e,f),j=b?h_(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 I(_){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 B=m_(e,b,_);t(C(B.text)),p(B.caret),g(0),k(!0),requestAnimationFrame(()=>{const $=w.current;$&&($.focus(),$.setSelectionRange(B.caret,B.caret))})}function D(_){N&&(_.key==="ArrowDown"?(_.preventDefault(),g(B=>Math.min(B+1,j.length-1))):_.key==="ArrowUp"?(_.preventDefault(),g(B=>Math.max(B-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:w,value:e,rows:r,placeholder:o,"aria-label":d,onChange:I,onKeyDown:D,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((_,B)=>s.jsx("li",{children:s.jsxs("button",{type:"button",role:"option","aria-selected":B===S,onMouseDown:$=>{$.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",B===S&&"bg-accent"),children:[s.jsx("span",{className:"text-muted-foreground",children:"@"}),s.jsx("span",{className:"truncate",children:_})]})},_))})]})}const eX={first:"first",last:"last",none:"none"};function T_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function yu(e){return e.map(t=>({rowKey:T_(),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 tX(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 nX(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 rX(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 sX(e){return e.map(t=>Object.keys(t.fieldErrors).length===0?t:{...t,fieldErrors:{}})}function oX(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 iX({row:e,index:t,canRemove:n,playbooks:r,onPatch:o,onSetDefault:i,onRemove:a}){const{attributes:l,listeners:d,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=mm({id:e.rowKey}),k={transform:xs.Transform.toString(h),transition:g,zIndex:y?50:void 0,position:y?"relative":void 0};function w(C){const I={label:C};if(e.autoSlugFromLabel){const T=Rr(C);T&&jG.test(T)?I.id=T:I.id=`agent-${t+1}`}o(I)}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(()=>g_(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,...d,type:"button","aria-label":"Drag to reorder",className:"cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(cc,{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(vn,{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=>w(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:l_.map(C=>s.jsx("option",{value:C,children:eX[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(ZY,{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 aX(){const e=d_(),t=Lv(),n=m.useMemo(()=>{var D;return(((D=t.data)==null?void 0:D.playbooks)??[]).filter(_=>_.enabled).map(_=>({slug:_.slug,name:_.name}))},[t.data]),[r,o]=m.useState(()=>yu(e.agents)),[i,a]=m.useState(()=>yu(e.agents)),[l,d]=m.useState(!1),[f,p]=m.useState(null),[h,g]=m.useState(null);m.useEffect(()=>{const D=yu(e.agents);o(D),a(D),p(null)},[e.agents]);const y=m.useMemo(()=>!oX(r,i),[r,i]),k=lm(yi(xc,{activationConstraint:{distance:8}}),yi(gc));function w(D,_){g({type:D,message:_}),setTimeout(()=>g(null),2500)}function b(D,_){o(B=>B.map($=>$.rowKey===D?{...$,..._,fieldErrors:lX($.fieldErrors,_)}:$))}function j(D){o(_=>_.map(B=>({...B,default:B.rowKey===D})))}function N(){o(D=>{const _=new Set(D.map(F=>F.id)),B="new-agent";let $=B,O=1;for(;_.has($);)O+=1,$=`${B}-${O}`;const z=O===1?"New Agent":`New Agent ${O}`,A={rowKey:T_(),id:$,originalId:null,isNew:!0,idEditable:!0,autoSlugFromLabel:!0,label:z,command:"",argsText:"",promptArgPosition:"first",resolveFromShellAliases:!0,default:!1,model:"",playbook:"",launchPrompt:"",fieldErrors:{}};return[...D,A]})}function S(D){o(_=>_.filter(B=>B.rowKey!==D))}async function C(){d(!0),p(null);try{const D=nX(r),_=tX(D),B=await NG(_),$=yu(B.agents);o($),a($),w("success","Agents saved")}catch(D){if(D instanceof c_)p(D.message),o(_=>rX(sX(_),D.fieldErrors)),w("error",D.message);else{const _=D instanceof Error?D.message:"Failed to save";p(_),w("error",_)}}finally{d(!1)}}function I(){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.")){d(!0),p(null);try{const D=await CG(),_=yu(D.agents);o(_),a(_),w("success","Reset to defaults")}catch(D){const _=D instanceof Error?D.message:"Failed to reset";p(_),w("error",_)}finally{d(!1)}}}function R(D){const{active:_,over:B}=D;!B||_.id===B.id||o($=>{const O=$.findIndex(A=>A.rowKey===_.id),z=$.findIndex(A=>A.rowKey===B.id);return O===-1||z===-1?$:yc($,O,z)})}return s.jsxs(Ge,{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(Ys,{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(Rv,{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(pm,{sensors:k,collisionDetection:cm,onDragEnd:R,children:s.jsx(hm,{items:r.map(D=>D.rowKey),strategy:mw,children:s.jsx("div",{className:"space-y-2",children:r.map((D,_)=>s.jsx(iX,{row:D,index:_,canRemove:r.length>1,playbooks:n,onPatch:B=>b(D.rowKey,B),onSetDefault:()=>j(D.rowKey),onRemove:()=>S(D.rowKey)},D.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($t,{className:"h-3 w-3"}),"Add agent"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:I,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(Wh,{className:"h-3 w-3"}),"Save"]})]})]})]})}function lX(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 R_=["terminal-app","iterm","ghostty","alacritty","warp","kitty","cmux"],Sh={terminal:"terminal-app",custom:!1};let Nl=null,yl=null,Nh=0;const tv=new Set;function A_(e){Nl=e;for(const t of tv)t(e)}function d0(e){if(!e||typeof e!="object")return Sh;const t=e;return{terminal:typeof t.terminal=="string"&&R_.includes(t.terminal)?t.terminal:Sh.terminal,custom:t.custom===!0}}function cX(){if(Nl)return Promise.resolve(Nl);if(yl)return yl;const e=++Nh;return yl=fetch("/api/config/terminal").then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}).then(t=>{yl=null;const n=d0(t);return e!==Nh?Nl??n:(Nl=n,n)}).catch(()=>(yl=null,Sh)),yl}function uX(){const[e,t]=m.useState(()=>Nl??Sh);return m.useEffect(()=>{let n=!1;return cX().then(r=>{n||t(r)}),tv.add(t),()=>{n=!0,tv.delete(t)}},[]),e}async function dX(e){++Nh;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=d0(await t.json());return A_(n),n}async function fX(){++Nh;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=d0(await e.json());return A_(t),t}const hp={"terminal-app":"Terminal (macOS built-in)",iterm:"iTerm2",ghostty:"Ghostty",alacritty:"Alacritty",warp:"Warp",kitty:"kitty",cmux:"cmux"};function pX(){const{terminal:e,custom:t}=uX(),[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 dX(f),a({type:"success",message:`Terminal set to ${hp[f]}.`})}catch(p){a({type:"error",message:p instanceof Error?p.message:"Save failed."})}finally{r(!1)}}}async function d(){r(!0);try{const f=await fX();a({type:"success",message:`Reset to OS default (${hp[f.terminal]}).`})}catch(f){a({type:"error",message:f instanceof Error?f.message:"Reset failed."})}finally{r(!1)}}return s.jsxs(Ge,{title:"Terminal",description:`Which terminal "Open in agent" launches. Defaults to the OS choice (currently ${hp[e]}) when unset.`,actions:t?s.jsxs("button",{className:"shell-action text-xs",onClick:d,disabled:n,type:"button",children:[s.jsx(Ys,{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:R_.map(f=>s.jsx("option",{value:f,children:hp[f]},f))})]})]})}const UN={all:"Everything",assignment:"Assignments",project:"Projects",todo:"Todos",server:"Servers",playbook:"Playbooks"},hX=["all",...Qh];function My(e){return Object.entries(e).map(([t,n])=>({prefix:t,kind:n}))}function mX(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=MO(n);return o.ok||t.push(...o.errors),{map:n,errors:t}}function gX(){const{search:e,custom:t}=Vv(),[n,r]=m.useState(e.defaultScope),[o,i]=m.useState(e.externalIds),[a,l]=m.useState(()=>My(e.aliases)),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[g,y]=m.useState(null),k=JSON.stringify(e);m.useEffect(()=>{d||(r(e.defaultScope),i(e.externalIds),l(My(e.aliases)))},[k]);const{map:w,errors:b}=mX(a);function j(_){y(_),setTimeout(()=>y(null),2500)}function N(){l(_=>[..._,{prefix:"",kind:"assignment"}]),f(!0)}function S(_){l(B=>B.filter(($,O)=>O!==_)),f(!0)}function C(_,B){l($=>$.map((O,z)=>z===_?{...O,...B}:O)),f(!0)}function I(_){r(_.defaultScope),i(_.externalIds),l(My(_.aliases)),f(!1)}async function T(){if(!(b.length>0)){h(!0);try{const _=await FO({defaultScope:n,aliases:w,externalIds:o});I(_.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 zO();I(_.search),j({type:"success",message:"Reset to defaults."})}catch(_){j({type:"error",message:_ instanceof Error?_.message:"Reset failed."})}finally{h(!1)}}const D=d&&b.length===0&&!p;return s.jsxs(Ge,{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(Ys,{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:hX.map(_=>s.jsx("option",{value:_,children:UN[_]},_))}),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((_,B)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"text",value:_.prefix,onChange:$=>C(B,{prefix:$.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:$=>C(B,{kind:$.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:Qh.map($=>s.jsx("option",{value:$,children:UN[$]},$))}),s.jsx("button",{type:"button",onClick:()=>S(B),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(Nd,{className:"h-3.5 w-3.5"})})]},B))}),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($t,{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."]})]})]}),d&&b.length>0&&s.jsx("ul",{className:"space-y-1 text-xs text-error-foreground",children:b.map((_,B)=>s.jsx("li",{children:_},B))}),s.jsx("div",{children:s.jsx("button",{type:"button",onClick:T,disabled:!D,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 bu(e){return e===sh?"Ungrouped":e}function xX(){const{data:e,loading:t,error:n,refetch:r}=ja(),{hidden:o,custom:i,loading:a,error:l,reload:d}=PT(),[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?[sh]:[]]:[];async function w(j,N){const S=N?o.filter(C=>C!==j):[...o,j];p(!0);try{await rz(S),y({type:"success",message:N?`Showing "${bu(j)}" in the left nav.`:`Hiding "${bu(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 sz(),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(Ge,{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(Ys,{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&&d()},children:[s.jsx(Ys,{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=!ez(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:bu(j),children:[bu(j),j===sh&&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 "${bu(j)}" in the left nav`,onClick:()=>w(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 yX(){const{preset:e,setPreset:t,resetPreset:n}=Iv(),[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 d(){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(Ge,{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:d,disabled:r,children:[s.jsx(Ys,{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:d2.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(Or,{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(KY,{}),s.jsx(pX,{}),s.jsx(gX,{}),s.jsx(xX,{}),s.jsx(aX,{}),s.jsx(JY,{}),s.jsx(qY,{})]})}function bX({open:e,affected:t,remaining:n,ruleReferences:r,headlineReferences:o,onResolve:i,onCancel:a}){var I,T;const[l,d]=m.useState(n.length>0?"remap":"delete"),[f,p]=m.useState(((I=n[0])==null?void 0:I.id)??""),[h,g]=m.useState(((T=n[0])==null?void 0:T.id)??""),[y,k]=m.useState(!1),w=t.count>0;m.useEffect(()=>{var R,D;e&&(d(n.length>0?"remap":"delete"),p(((R=n[0])==null?void 0:R.id)??""),g(((D=n[0])==null?void 0:D.id)??""),k(!1))},[e,n]);const b=!o||h!==""&&h!==t.id,j=l==="remap"&&n.length>0&&f!==""&&f!==t.id||l==="delete"&&(!w||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(Bn,{open:e,onOpenChange:R=>R?void 0:a(),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsxs(Dn,{children:['Delete status "',t.label,'"',w?` — ${t.count} assignment${t.count===1?"":"s"} reference it`:""]}),s.jsx(es,{children:w?"Choose how to resolve the affected assignments before this status is removed from the workflow.":"No assignments use this status, but workflow rules reference it. Choose how to resolve them."})]}),w&&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,D)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-foreground",children:R.section}),s.jsx("span",{className:"mx-1",children:"·"}),R.detail]},D))}),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:()=>d("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:w?"Remap to another status":"Remap rules to another status"}),s.jsxs("select",{value:f,onChange:R=>p(R.target.value),onClick:()=>d("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:()=>d("delete"),className:"mt-1"}),s.jsxs("span",{className:"flex-1",children:[s.jsx("span",{className:"block text-sm font-medium text-error-foreground",children:w?"Delete these assignments":"Drop the referencing rules"}),s.jsx("span",{className:"block text-xs text-muted-foreground mt-1",children:w?`Permanently removes ${t.count} assignment${t.count===1?"":"s"} from disk. This cannot be undone.`:"Ladder rungs and transitions referencing this status are removed."}),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"&&w&&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(zr,{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"?w?`Remap ${t.count} → ${f||"..."}`:`Remap rules → ${f||"..."}`:w?`Delete ${t.count}`:"Drop rules"})]})]})})}function vX({open:e,references:t,onConfirm:n,onCancel:r}){return s.jsx(Bn,{open:e,onOpenChange:o=>o?void 0:r(),children:s.jsxs(_n,{className:"max-w-xl",children:[s.jsxs(sr,{children:[s.jsx(Dn,{children:"Delete fact — referenced by derive rules"}),s.jsx(es,{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(zr,{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 wX({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 jX({row:e,isSaved:t,onUpdate:n,onRemove:r}){const{attributes:o,listeners:i,setNodeRef:a,setActivatorNodeRef:l,transform:d,transition:f,isDragging:p}=mm({id:e.rowKey}),h={transform:xs.Transform.toString(d),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(cc,{className:"h-4 w-4"})}),s.jsx("div",{className:"min-w-[8rem] flex-1",children:t?s.jsxs(Dr,{children:[s.jsx($r,{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(mr,{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(wX,{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(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsx("span",{className:"cursor-help text-xs text-muted-foreground underline decoration-dotted underline-offset-4",children:"Done"})}),s.jsx(mr,{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(vn,{className:"h-3.5 w-3.5"})})]})}function kX({statuses:e,savedStatusIds:t,onUpdate:n,onAdd:r,onRemove:o,onReorder:i}){const a=lm(yi(xc,{activationConstraint:{distance:8}}),yi(gc,{coordinateGetter:jR}));function l(d){const{active:f,over:p}=d;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(yc(e,h,g))}return s.jsx(Ge,{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($t,{className:"h-3 w-3"}),"Add Status"]}),children:s.jsx(pm,{sensors:a,collisionDetection:cm,onDragEnd:l,children:s.jsx(hm,{items:e.map(d=>d.rowKey),strategy:mw,children:s.jsx("div",{className:"space-y-2",children:e.map((d,f)=>s.jsx(jX,{row:d,isSaved:t.has(d.id),onUpdate:(p,h)=>n(f,p,h),onRemove:()=>o(f)},d.rowKey))})})})})}function SX(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 NX(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 CX(e,t){return t.headline.parked===e||t.headline.blocked===e}function EX(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 TX(e,t,n){return e.map(r=>({...r,from:r.from===t?n:r.from,to:r.to===t?n:r.to}))}function RX(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 AX(e,t){return e.filter(n=>n.from!==t&&n.to!==t)}function PX(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 HN(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 P_(){return`row_${Math.random().toString(36).slice(2,10)}_${Date.now().toString(36)}`}function _X(e){const t=e.statuses.map(n=>({rowKey:P_(),id:n.id,label:n.label,description:n.description??"",color:n.color??"",terminal:n.terminal??!1}));return PX(t,e.order)}function DX(e){return Pb(e)}function VN(e){const t=new Map;for(const n of e)t.set(n,(t.get(n)??0)+1);return t}function $X(e){const t=new Map;for(let n=0;n<e.length;n++){const r=VN(Pb(e.slice(0,n))),o=VN(Pb(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 IX=[{value:"bool",label:"bool"},{value:"number",label:"number"},{value:"attestation",label:"attestation"}],MX=[{value:"plan",label:"plan"},{value:"commit",label:"commit"},{value:"none",label:"none"}];function LX(){return{name:"",type:"bool",binds:null}}function OX({rows:e,onChange:t,saving:n}){const r=$X(e),o=m.useCallback(()=>{t([...e,LX()])},[e,t]),i=m.useCallback((l,d,f)=>{t(e.map((p,h)=>h===l?{...p,[d]:f}:p))},[e,t]),a=m.useCallback(l=>{t(e.filter((d,f)=>f!==l))},[e,t]);return s.jsxs(Ge,{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,d)=>{const f=r.get(d),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(d,"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===d?{...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:IX.map(h=>s.jsx("option",{value:h.value,children:h.label},h.value))}),p?s.jsx("select",{value:l.binds??"none",onChange:h=>i(d,"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:MX.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(Dr,{children:[s.jsx($r,{asChild:!0,children:s.jsx("span",{className:"mt-1 inline-flex text-error-foreground","aria-label":"Invalid fact",children:s.jsx(Zp,{className:"h-3.5 w-3.5 flex-shrink-0"})})}),s.jsx(mr,{className:"max-w-xs text-xs font-normal normal-case tracking-normal",children:f})]}),s.jsx("button",{type:"button",onClick:()=>a(d),disabled:n,className:"mt-0.5 shell-action text-xs text-muted-foreground hover:text-error disabled:opacity-50",title:"Delete",children:s.jsx(vn,{className:"h-3.5 w-3.5"})})]}),f&&s.jsx("p",{className:"mt-1 text-xs text-error-foreground",children:f})]},d)})]}),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($t,{className:"h-3.5 w-3.5"}),"Add fact"]})]})}function __(e,t=km){var r,o;if(e==="*")return null;const n=em(e);if(!n.ast)return((r=n.errors[0])==null?void 0:r.message)??"unparseable condition";try{return Au(n.ast,t),null}catch(i){if(i instanceof Pr)return((o=i.errors[0])==null?void 0:o.message)??"invalid condition";throw i}}function Ly(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 FX(e){if(e.kind==="atom"){const t=Ly(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=Ly(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 d=Ly(l);if(!d)return null;a.push(d)}o.push({join:r,comparisons:a})}else return null;return{outerJoin:t,groups:o}}return null}function WN(e){const t=e.trim();if(t===""||t==="*")return null;const n=em(t);return n.ast?FX(n.ast):null}const zX=/^[A-Za-z_][A-Za-z0-9_-]*$/;function BX(e){return e===""||!zX.test(e)||/^(and|or|not)$/i.test(e)}function UX(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function HX(e){return e.valueType==="number"||e.valueType==="date"||e.valueType==="duration"?e.value:BX(e.value)?UX(e.value):e.value}function VX(e){const t=HX(e);return e.op===":"?`${e.field}:${t}`:`${e.field} ${e.op} ${t}`}function WX(e){return e.groups.map(n=>{const r=n.comparisons.map(VX).join(` ${n.join} `);return n.comparisons.length>1?`(${r})`:r}).join(` ${e.outerJoin} `)}function qX(e,t){return e.trim()==="*"?null:e.trim()===""?"condition is empty":__(e,t)}function KX(e){return yU(xU(e))}function GX(e){const t=Rw(e),n=[];for(const r of hA(e)){const o=t[r.toLowerCase()];o&&n.push({name:r,kind:o.kind})}return n}function D_(e){switch(e){case"bool":return"word";case"number":case"ordinal":case"duration":case"timestamp":return"number";default:return"string"}}function nv(e){switch(e){case"bool":return[":"];case"number":case"ordinal":case"duration":case"timestamp":return[":","=","!=","<","<=",">",">="];default:return[":","!="]}}function vu(e){const t=e[0];return{outerJoin:"AND",groups:[{join:"AND",comparisons:[t?{field:t.name,op:nv(t.kind)[0],value:t.kind==="bool"?"true":"",valueType:D_(t.kind)}:{field:"",op:":",value:""}]}]}}function $_({value:e,onChange:t,fieldOptions:n,registry:r,disabled:o}){const i=m.useMemo(()=>WN(e),[e]),a=e.trim()===""||i!==null,[l,d]=m.useState(a?"builder":"raw"),[f,p]=m.useState(()=>i??vu(n)),h=m.useRef(e);m.useEffect(()=>{if(e===h.current)return;const T=WN(e);T&&p(T),!(e.trim()===""||T)&&l==="builder"&&d("raw"),h.current=e},[e]);const g=qX(e,r);function y(T){h.current=T,t(T)}function k(T){p(T),y(WX(T))}function w(T){k({outerJoin:T,groups:f.groups.map(R=>({...R,join:T==="AND"?"OR":"AND"}))})}function b(T,R,D){const _=f.groups.map((B,$)=>$===T?{...B,comparisons:B.comparisons.map((O,z)=>z===R?{...O,...D}:O)}:B);k({...f,groups:_})}function j(T){const R=vu(n).groups[0].comparisons[0],D=f.groups.map((_,B)=>B===T?{..._,comparisons:[..._.comparisons,{...R}]}:_);k({...f,groups:D})}function N(T,R){let D=f.groups.map((_,B)=>B===T?{..._,comparisons:_.comparisons.filter(($,O)=>O!==R)}:_);D=D.filter(_=>_.comparisons.length>0),D.length===0&&(D=vu(n).groups),k({...f,groups:D})}function S(){const T=f.outerJoin==="AND"?"OR":"AND";k({...f,groups:[...f.groups,{join:T,comparisons:[vu(n).groups[0].comparisons[0]]}]})}function C(){if(l==="builder"){d("raw");return}a&&(p(i??vu(n)),d("builder"))}const I="rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60";return 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(AL,{className:"h-3 w-3"}):s.jsx(KL,{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:`${I} 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:()=>w(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((D,_)=>{const B=n.find(z=>z.name===D.field),$=(B==null?void 0:B.kind)??"string",O=nv($);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:D.field,onChange:z=>{const A=n.find(H=>H.name===z.target.value),F=(A==null?void 0:A.kind)??"string",U=nv(F);b(R,_,{field:z.target.value,op:U.includes(D.op)?D.op:U[0],value:F==="bool"?"true":D.value,valueType:D_(F)})},disabled:o,className:`${I} font-mono`,children:[n.length===0&&s.jsx("option",{value:"",children:"(no fields)"}),!n.some(z=>z.name===D.field)&&D.field!==""&&s.jsx("option",{value:D.field,children:D.field}),n.map(z=>s.jsx("option",{value:z.name,children:z.name},z.name))]}),s.jsx("select",{value:D.op,onChange:z=>b(R,_,{op:z.target.value}),disabled:o,className:`${I} font-mono`,children:O.map(z=>s.jsx("option",{value:z,children:z},z))}),$==="bool"?s.jsxs("select",{value:D.value||"true",onChange:z=>b(R,_,{value:z.target.value}),disabled:o,className:`${I} font-mono`,children:[s.jsx("option",{value:"true",children:"true"}),s.jsx("option",{value:"false",children:"false"})]}):s.jsx("input",{type:"text",value:D.value,onChange:z=>b(R,_,{value:z.target.value}),disabled:o,placeholder:"value",className:`${I} 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(vn,{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($t,{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($t,{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 qN=0;function Ch(){return qN+=1,`dr_${qN}_${Math.random().toString(36).slice(2,8)}`}function Oy(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:Ch(),phase:n.phase,when:n.when,next:n.next??""})),disposition:t.map(n=>({rowKey:Ch(),when:n.when,is:n.is})),headline:{parked:e.headline.parked,blocked:e.headline.blocked}}}function rv(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 YX(e){return e.findIndex(t=>t.when.trim()==="*")}function I_(e,t,n){return A6(e,{statuses:t},r=>__(r,n))}const KN=["active","blocked","parked"];function XX({value:e,deriveCustom:t,statuses:n,acceptedFacts:r,onChange:o,onReset:i,disabled:a}){const l=m.useMemo(()=>Rw(r),[r]),d=m.useMemo(()=>GX(r),[r]),f=lm(yi(xc,{activationConstraint:{distance:8}}),yi(gc,{coordinateGetter:jR})),p=m.useMemo(()=>{try{return I_(rv(e),n,l)}catch{return["derive rules are malformed"]}},[e,n,l]),h=YX(e.phaseLadder),g=h>=0?e.phaseLadder[h]:null,y=e.phaseLadder.filter((_,B)=>B!==h);function k(_,B){o({...e,phaseLadder:[..._?[_]:[],...B]})}function w(_,B){const $=e.phaseLadder.map(O=>O.rowKey===_?{...O,...B}:O);o({...e,phaseLadder:$})}function b(){var B;const _={rowKey:Ch(),phase:((B=n[0])==null?void 0:B.id)??"",when:"",next:""};k(g,[...y,_])}function j(_){o({...e,phaseLadder:e.phaseLadder.filter(B=>B.rowKey!==_)})}function N(_){const{active:B,over:$}=_;if(!$||B.id===$.id)return;const O=y.findIndex(A=>A.rowKey===B.id),z=y.findIndex(A=>A.rowKey===$.id);O===-1||z===-1||k(g,yc(y,O,z))}function S(_,B){o({...e,disposition:e.disposition.map($=>$.rowKey===_?{...$,...B}:$)})}function C(){const _={rowKey:Ch(),when:"",is:"active"},B=e.disposition.findIndex(O=>O.when===null),$=[...e.disposition];B>=0?$.splice(B,0,_):$.push(_),o({...e,disposition:$})}function I(_){o({...e,disposition:e.disposition.filter(B=>B.rowKey!==_)})}function T(_,B){o({...e,headline:{...e.headline,[_]:B}})}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 D(_,B,$){return s.jsxs("select",{value:_,onChange:O=>B(O.target.value),disabled:a,"aria-label":$,className:`${R} font-mono`,children:[!n.some(O=>O.id===_)&&_!==""&&s.jsx("option",{value:_,children:_}),n.map(O=>s.jsxs("option",{value:O.id,children:[O.label," (",O.id,")"]},O.id))]})}return s.jsxs(Ge,{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(Ys,{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((_,B)=>s.jsx("li",{children:_},B))})]}),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(cc,{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)"}),D(g.phase,_=>w(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:_=>w(g.rowKey,{next:_.target.value}),disabled:a,className:`${R} w-full`})]})]}),s.jsx(pm,{sensors:f,collisionDetection:cm,onDragEnd:N,children:s.jsx(hm,{items:y.map(_=>_.rowKey),strategy:mw,children:s.jsx("div",{className:"space-y-2",children:y.map(_=>s.jsx(QX,{rung:_,disabled:a,statusSelect:D,fieldOptions:d,registry:l,onUpdate:B=>w(_.rowKey,B),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($t,{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:B=>S(_.rowKey,{is:B.target.value}),disabled:a,className:`${R} font-mono`,children:KN.map(B=>s.jsx("option",{value:B,children:B},B))})]},_.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($_,{value:_.when,onChange:B=>S(_.rowKey,{when:B}),fieldOptions:d,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:B=>S(_.rowKey,{is:B.target.value}),disabled:a,className:`${R} font-mono`,children:KN.map(B=>s.jsx("option",{value:B,children:B},B))}),s.jsx("button",{type:"button",onClick:()=>I(_.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(vn,{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($t,{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"}),D(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"}),D(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 QX({rung:e,disabled:t,statusSelect:n,fieldOptions:r,registry:o,onUpdate:i,onRemove:a}){const{attributes:l,listeners:d,setNodeRef:f,setActivatorNodeRef:p,transform:h,transition:g,isDragging:y}=mm({id:e.rowKey}),k={transform:xs.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,...d,type:"button","aria-label":"Drag to reorder rung",className:"mt-1 cursor-grab active:cursor-grabbing text-muted-foreground/40 hover:text-muted-foreground transition touch-none",children:s.jsx(cc,{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,w=>i({phase:w}),"Rung phase")]}),s.jsx("div",{className:"min-w-[14rem] flex-1",children:s.jsx($_,{value:e.when,onChange:w=>i({when:w}),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:w=>i({next:w.target.value}),disabled:t,className:"w-full rounded-md border border-border/60 bg-background px-2 py-1 text-sm focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/30 disabled:opacity-60"})]}),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(vn,{className:"h-3.5 w-3.5"})})]})}const JX=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 GN=0;function M_(){return GN+=1,`tr_${GN}_${Math.random().toString(36).slice(2,8)}`}function ZX(e){return{rowKey:M_(),from:e.from,command:e.command,to:e.to,label:e.label??"",description:e.description??"",requiresReason:e.requiresReason??!1}}function sv(e){return e.map(ZX)}function eQ(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 tQ(e){return e.map(eQ)}function L_(){const e=[];for(const[t,n]of JX){const r=t.indexOf(":");e.push({from:t.slice(0,r),command:t.slice(r+1),to:n})}return e}function nQ(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to))}function O_(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 rQ(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 YN(e,t){const n=new Set(t.map(l=>l.id)),r=rQ(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 d of[l.from,l.to])d&&!i.has(d)&&(i.add(d),o.push({id:d,label:d,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 kn(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=kn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var sQ={value:()=>{}};function Um(){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 Vp(n)}function Vp(e){this._=e}function oQ(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}})}Vp.prototype=Um.prototype={constructor:Vp,on:function(e,t){var n=this._,r=oQ(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=iQ(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]=XN(n[o],e.name,t);else if(t==null)for(o in n)n[o]=XN(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 Vp(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 iQ(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function XN(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=sQ,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var ov="http://www.w3.org/1999/xhtml";const QN={svg:"http://www.w3.org/2000/svg",xhtml:ov,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Hm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),QN.hasOwnProperty(t)?{space:QN[t],local:e}:e}function aQ(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ov&&t.documentElement.namespaceURI===ov?t.createElement(e):t.createElementNS(n,e)}}function lQ(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function F_(e){var t=Hm(e);return(t.local?lQ:aQ)(t)}function cQ(){}function f0(e){return e==null?cQ:function(){return this.querySelector(e)}}function uQ(e){typeof e!="function"&&(e=f0(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),d,f,p=0;p<a;++p)(d=i[p])&&(f=e.call(d,d.__data__,p,i))&&("__data__"in d&&(f.__data__=d.__data__),l[p]=f);return new Fr(r,this._parents)}function dQ(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function fQ(){return[]}function z_(e){return e==null?fQ:function(){return this.querySelectorAll(e)}}function pQ(e){return function(){return dQ(e.apply(this,arguments))}}function hQ(e){typeof e=="function"?e=pQ(e):e=z_(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,d,f=0;f<l;++f)(d=a[f])&&(r.push(e.call(d,d.__data__,f,a)),o.push(d));return new Fr(r,o)}function B_(e){return function(){return this.matches(e)}}function U_(e){return function(t){return t.matches(e)}}var mQ=Array.prototype.find;function gQ(e){return function(){return mQ.call(this.children,e)}}function xQ(){return this.firstElementChild}function yQ(e){return this.select(e==null?xQ:gQ(typeof e=="function"?e:U_(e)))}var bQ=Array.prototype.filter;function vQ(){return Array.from(this.children)}function wQ(e){return function(){return bQ.call(this.children,e)}}function jQ(e){return this.selectAll(e==null?vQ:wQ(typeof e=="function"?e:U_(e)))}function kQ(e){typeof e!="function"&&(e=B_(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]=[],d,f=0;f<a;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&l.push(d);return new Fr(r,this._parents)}function H_(e){return new Array(e.length)}function SQ(){return new Fr(this._enter||this._groups.map(H_),this._parents)}function Eh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Eh.prototype={constructor:Eh,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 NQ(e){return function(){return e}}function CQ(e,t,n,r,o,i){for(var a=0,l,d=t.length,f=i.length;a<f;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Eh(e,i[a]);for(;a<d;++a)(l=t[a])&&(o[a]=l)}function EQ(e,t,n,r,o,i,a){var l,d,f=new Map,p=t.length,h=i.length,g=new Array(p),y;for(l=0;l<p;++l)(d=t[l])&&(g[l]=y=a.call(d,d.__data__,l,t)+"",f.has(y)?o[l]=d:f.set(y,d));for(l=0;l<h;++l)y=a.call(e,i[l],l,i)+"",(d=f.get(y))?(r[l]=d,d.__data__=i[l],f.delete(y)):n[l]=new Eh(e,i[l]);for(l=0;l<p;++l)(d=t[l])&&f.get(g[l])===d&&(o[l]=d)}function TQ(e){return e.__data__}function RQ(e,t){if(!arguments.length)return Array.from(this,TQ);var n=t?EQ:CQ,r=this._parents,o=this._groups;typeof e!="function"&&(e=NQ(e));for(var i=o.length,a=new Array(i),l=new Array(i),d=new Array(i),f=0;f<i;++f){var p=r[f],h=o[f],g=h.length,y=AQ(e.call(p,p&&p.__data__,f,r)),k=y.length,w=l[f]=new Array(k),b=a[f]=new Array(k),j=d[f]=new Array(g);n(p,h,w,b,j,y,t);for(var N=0,S=0,C,I;N<k;++N)if(C=w[N]){for(N>=S&&(S=N+1);!(I=b[S])&&++S<k;);C._next=I||null}}return a=new Fr(a,r),a._enter=l,a._exit=d,a}function AQ(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function PQ(){return new Fr(this._exit||this._groups.map(H_),this._parents)}function _Q(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 DQ(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),d=0;d<a;++d)for(var f=n[d],p=r[d],h=f.length,g=l[d]=new Array(h),y,k=0;k<h;++k)(y=f[k]||p[k])&&(g[k]=y);for(;d<o;++d)l[d]=n[d];return new Fr(l,this._parents)}function $Q(){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 IQ(e){e||(e=MQ);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,d=o[i]=new Array(l),f,p=0;p<l;++p)(f=a[p])&&(d[p]=f);d.sort(t)}return new Fr(o,this._parents).order()}function MQ(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function LQ(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function OQ(){return Array.from(this)}function FQ(){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 BQ(){return!this.node()}function UQ(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 HQ(e){return function(){this.removeAttribute(e)}}function VQ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function WQ(e,t){return function(){this.setAttribute(e,t)}}function qQ(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function KQ(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function GQ(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 YQ(e,t){var n=Hm(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?VQ:HQ:typeof t=="function"?n.local?GQ:KQ:n.local?qQ:WQ)(n,t))}function V_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function XQ(e){return function(){this.style.removeProperty(e)}}function QQ(e,t,n){return function(){this.style.setProperty(e,t,n)}}function JQ(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ZQ(e,t,n){return arguments.length>1?this.each((t==null?XQ:typeof t=="function"?JQ:QQ)(e,t,n??"")):Ql(this.node(),e)}function Ql(e,t){return e.style.getPropertyValue(t)||V_(e).getComputedStyle(e,null).getPropertyValue(t)}function eJ(e){return function(){delete this[e]}}function tJ(e,t){return function(){this[e]=t}}function nJ(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function rJ(e,t){return arguments.length>1?this.each((t==null?eJ:typeof t=="function"?nJ:tJ)(e,t)):this.node()[e]}function W_(e){return e.trim().split(/^|\s+/)}function p0(e){return e.classList||new q_(e)}function q_(e){this._node=e,this._names=W_(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 K_(e,t){for(var n=p0(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function G_(e,t){for(var n=p0(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function sJ(e){return function(){K_(this,e)}}function oJ(e){return function(){G_(this,e)}}function iJ(e,t){return function(){(t.apply(this,arguments)?K_:G_)(this,e)}}function aJ(e,t){var n=W_(e+"");if(arguments.length<2){for(var r=p0(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?iJ:t?sJ:oJ)(n,t))}function lJ(){this.textContent=""}function cJ(e){return function(){this.textContent=e}}function uJ(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function dJ(e){return arguments.length?this.each(e==null?lJ:(typeof e=="function"?uJ:cJ)(e)):this.node().textContent}function fJ(){this.innerHTML=""}function pJ(e){return function(){this.innerHTML=e}}function hJ(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function mJ(e){return arguments.length?this.each(e==null?fJ:(typeof e=="function"?hJ:pJ)(e)):this.node().innerHTML}function gJ(){this.nextSibling&&this.parentNode.appendChild(this)}function xJ(){return this.each(gJ)}function yJ(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function bJ(){return this.each(yJ)}function vJ(e){var t=typeof e=="function"?e:F_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wJ(){return null}function jJ(e,t){var n=typeof e=="function"?e:F_(e),r=t==null?wJ:typeof t=="function"?t:f0(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kJ(){var e=this.parentNode;e&&e.removeChild(this)}function SJ(){return this.each(kJ)}function NJ(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function CJ(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function EJ(e){return this.select(e?CJ:NJ)}function TJ(e){return arguments.length?this.property("__data__",e):this.node().__data__}function RJ(e){return function(t){e.call(this,t,this.__data__)}}function AJ(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 PJ(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 _J(e,t,n){return function(){var r=this.__on,o,i=RJ(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 DJ(e,t,n){var r=AJ(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var d=0,f=l.length,p;d<f;++d)for(o=0,p=l[d];o<i;++o)if((a=r[o]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?_J:PJ,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function Y_(e,t,n){var r=V_(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 $J(e,t){return function(){return Y_(this,e,t)}}function IJ(e,t){return function(){return Y_(this,e,t.apply(this,arguments))}}function MJ(e,t){return this.each((typeof t=="function"?IJ:$J)(e,t))}function*LJ(){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 X_=[null];function Fr(e,t){this._groups=e,this._parents=t}function Hd(){return new Fr([[document.documentElement]],X_)}function OJ(){return this}Fr.prototype=Hd.prototype={constructor:Fr,select:uQ,selectAll:hQ,selectChild:yQ,selectChildren:jQ,filter:kQ,data:RQ,enter:SQ,exit:PQ,join:_Q,merge:DQ,selection:OJ,order:$Q,sort:IQ,call:LQ,nodes:OQ,node:FQ,size:zQ,empty:BQ,each:UQ,attr:YQ,style:ZQ,property:rJ,classed:aJ,text:dJ,html:mJ,raise:xJ,lower:bJ,append:vJ,insert:jJ,remove:SJ,clone:EJ,datum:TJ,on:DJ,dispatch:MJ,[Symbol.iterator]:LJ};function Ir(e){return typeof e=="string"?new Fr([[document.querySelector(e)]],[document.documentElement]):new Fr([[e]],X_)}function FJ(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ds(e,t){if(e=FJ(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},ld={capture:!0,passive:!1};function Fy(e){e.stopImmediatePropagation()}function Bl(e){e.preventDefault(),e.stopImmediatePropagation()}function Q_(e){var t=e.document.documentElement,n=Ir(e).on("dragstart.drag",Bl,ld);"onselectstart"in t?n.on("selectstart.drag",Bl,ld):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function J_(e,t){var n=e.document.documentElement,r=Ir(e).on("dragstart.drag",null);t&&(r.on("click.drag",Bl,ld),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 mp=e=>()=>e;function iv(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:a,y:l,dx:d,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:d,enumerable:!0,configurable:!0},dy:{value:f,enumerable:!0,configurable:!0},_:{value:p}})}iv.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function BJ(e){return!e.ctrlKey&&!e.button}function UJ(){return this.parentNode}function HJ(e,t){return t??{x:e.x,y:e.y}}function VJ(){return navigator.maxTouchPoints||"ontouchstart"in this}function Z_(){var e=BJ,t=UJ,n=HJ,r=VJ,o={},i=Um("start","drag","end"),a=0,l,d,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,I){if(!(p||!e.call(this,C,I))){var T=S(this,t.call(this,C,I),C,I,"mouse");T&&(Ir(C.view).on("mousemove.drag",k,ld).on("mouseup.drag",w,ld),Q_(C.view),Fy(C),f=!1,l=C.clientX,d=C.clientY,T("start",C))}}function k(C){if(Bl(C),!f){var I=C.clientX-l,T=C.clientY-d;f=I*I+T*T>h}o.mouse("drag",C)}function w(C){Ir(C.view).on("mousemove.drag mouseup.drag",null),J_(C.view,f),Bl(C),o.mouse("end",C)}function b(C,I){if(e.call(this,C,I)){var T=C.changedTouches,R=t.call(this,C,I),D=T.length,_,B;for(_=0;_<D;++_)(B=S(this,R,C,I,T[_].identifier,T[_]))&&(Fy(C),B("start",C,T[_]))}}function j(C){var I=C.changedTouches,T=I.length,R,D;for(R=0;R<T;++R)(D=o[I[R].identifier])&&(Bl(C),D("drag",C,I[R]))}function N(C){var I=C.changedTouches,T=I.length,R,D;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),R=0;R<T;++R)(D=o[I[R].identifier])&&(Fy(C),D("end",C,I[R]))}function S(C,I,T,R,D,_){var B=i.copy(),$=ds(_||T,I),O,z,A;if((A=n.call(C,new iv("beforestart",{sourceEvent:T,target:g,identifier:D,active:a,x:$[0],y:$[1],dx:0,dy:0,dispatch:B}),R))!=null)return O=A.x-$[0]||0,z=A.y-$[1]||0,function F(U,H,L){var V=$,M;switch(U){case"start":o[D]=F,M=a++;break;case"end":delete o[D],--a;case"drag":$=ds(L||H,I),M=a;break}B.call(U,C,new iv(U,{sourceEvent:H,subject:A,target:g,identifier:D,active:M,x:$[0]+O,y:$[1]+z,dx:$[0]-V[0],dy:$[1]-V[1],dispatch:B}),R)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:mp(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:mp(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:mp(C),g):n},g.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:mp(!!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 h0(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function e3(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Vd(){}var cd=.7,Th=1/cd,Ul="\\s*([+-]?\\d+)\\s*",ud="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Gs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",WJ=/^#([0-9a-f]{3,8})$/,qJ=new RegExp(`^rgb\\(${Ul},${Ul},${Ul}\\)$`),KJ=new RegExp(`^rgb\\(${Gs},${Gs},${Gs}\\)$`),GJ=new RegExp(`^rgba\\(${Ul},${Ul},${Ul},${ud}\\)$`),YJ=new RegExp(`^rgba\\(${Gs},${Gs},${Gs},${ud}\\)$`),XJ=new RegExp(`^hsl\\(${ud},${Gs},${Gs}\\)$`),QJ=new RegExp(`^hsla\\(${ud},${Gs},${Gs},${ud}\\)$`),JN={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};h0(Vd,xa,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ZN,formatHex:ZN,formatHex8:JJ,formatHsl:ZJ,formatRgb:eC,toString:eC});function ZN(){return this.rgb().formatHex()}function JJ(){return this.rgb().formatHex8()}function ZJ(){return t3(this).formatHsl()}function eC(){return this.rgb().formatRgb()}function xa(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=WJ.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?tC(t):n===3?new xr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?gp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?gp(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=qJ.exec(e))?new xr(t[1],t[2],t[3],1):(t=KJ.exec(e))?new xr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=GJ.exec(e))?gp(t[1],t[2],t[3],t[4]):(t=YJ.exec(e))?gp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=XJ.exec(e))?sC(t[1],t[2]/100,t[3]/100,1):(t=QJ.exec(e))?sC(t[1],t[2]/100,t[3]/100,t[4]):JN.hasOwnProperty(e)?tC(JN[e]):e==="transparent"?new xr(NaN,NaN,NaN,0):null}function tC(e){return new xr(e>>16&255,e>>8&255,e&255,1)}function gp(e,t,n,r){return r<=0&&(e=t=n=NaN),new xr(e,t,n,r)}function eZ(e){return e instanceof Vd||(e=xa(e)),e?(e=e.rgb(),new xr(e.r,e.g,e.b,e.opacity)):new xr}function av(e,t,n,r){return arguments.length===1?eZ(e):new xr(e,t,n,r??1)}function xr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}h0(xr,av,e3(Vd,{brighter(e){return e=e==null?Th:Math.pow(Th,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new xr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xr(fa(this.r),fa(this.g),fa(this.b),Rh(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:nC,formatHex:nC,formatHex8:tZ,formatRgb:rC,toString:rC}));function nC(){return`#${aa(this.r)}${aa(this.g)}${aa(this.b)}`}function tZ(){return`#${aa(this.r)}${aa(this.g)}${aa(this.b)}${aa((isNaN(this.opacity)?1:this.opacity)*255)}`}function rC(){const e=Rh(this.opacity);return`${e===1?"rgb(":"rgba("}${fa(this.r)}, ${fa(this.g)}, ${fa(this.b)}${e===1?")":`, ${e})`}`}function Rh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function fa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function aa(e){return e=fa(e),(e<16?"0":"")+e.toString(16)}function sC(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fs(e,t,n,r)}function t3(e){if(e instanceof fs)return new fs(e.h,e.s,e.l,e.opacity);if(e instanceof Vd||(e=xa(e)),!e)return new fs;if(e instanceof fs)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,d=(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/=d<.5?i+o:2-i-o,a*=60):l=d>0&&d<1?0:a,new fs(a,l,d,e.opacity)}function nZ(e,t,n,r){return arguments.length===1?t3(e):new fs(e,t,n,r??1)}function fs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}h0(fs,nZ,e3(Vd,{brighter(e){return e=e==null?Th:Math.pow(Th,e),new fs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cd:Math.pow(cd,e),new fs(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 xr(zy(e>=240?e-240:e+120,o,r),zy(e,o,r),zy(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new fs(oC(this.h),xp(this.s),xp(this.l),Rh(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=Rh(this.opacity);return`${e===1?"hsl(":"hsla("}${oC(this.h)}, ${xp(this.s)*100}%, ${xp(this.l)*100}%${e===1?")":`, ${e})`}`}}));function oC(e){return e=(e||0)%360,e<0?e+360:e}function xp(e){return Math.max(0,Math.min(1,e||0))}function zy(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 Vm=e=>()=>e;function n3(e,t){return function(n){return e+n*t}}function rZ(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 iae(e,t){var n=t-e;return n?n3(e,n>180||n<-180?n-360*Math.round(n/360):n):Vm(isNaN(e)?t:e)}function sZ(e){return(e=+e)==1?r3:function(t,n){return n-t?rZ(t,n,e):Vm(isNaN(t)?n:t)}}function r3(e,t){var n=t-e;return n?n3(e,n):Vm(isNaN(e)?t:e)}const Ah=(function e(t){var n=sZ(t);function r(o,i){var a=n((o=av(o)).r,(i=av(i)).r),l=n(o.g,i.g),d=n(o.b,i.b),f=r3(o.opacity,i.opacity);return function(p){return o.r=a(p),o.g=l(p),o.b=d(p),o.opacity=f(p),o+""}}return r.gamma=e,r})(1);function oZ(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 iZ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function aZ(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]=Vu(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 lZ(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function zs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function cZ(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]=Vu(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var lv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,By=new RegExp(lv.source,"g");function uZ(e){return function(){return e}}function dZ(e){return function(t){return e(t)+""}}function s3(e,t){var n=lv.lastIndex=By.lastIndex=0,r,o,i,a=-1,l=[],d=[];for(e=e+"",t=t+"";(r=lv.exec(e))&&(o=By.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,d.push({i:a,x:zs(r,o)})),n=By.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?d[0]?dZ(d[0].x):uZ(t):(t=d.length,function(f){for(var p=0,h;p<t;++p)l[(h=d[p]).i]=h.x(f);return l.join("")})}function Vu(e,t){var n=typeof t,r;return t==null||n==="boolean"?Vm(t):(n==="number"?zs:n==="string"?(r=xa(t))?(t=r,Ah):s3:t instanceof xa?Ah:t instanceof Date?lZ:iZ(t)?oZ:Array.isArray(t)?aZ:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?cZ:zs)(e,t)}var iC=180/Math.PI,cv={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function o3(e,t,n,r,o,i){var a,l,d;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(d=e*n+t*r)&&(n-=e*d,r-=t*d),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,d/=l),e*r<t*n&&(e=-e,t=-t,d=-d,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*iC,skewX:Math.atan(d)*iC,scaleX:a,scaleY:l}}var yp;function fZ(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cv:o3(t.a,t.b,t.c,t.d,t.e,t.f)}function pZ(e){return e==null||(yp||(yp=document.createElementNS("http://www.w3.org/2000/svg","g")),yp.setAttribute("transform",e),!(e=yp.transform.baseVal.consolidate()))?cv:(e=e.matrix,o3(e.a,e.b,e.c,e.d,e.e,e.f))}function i3(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 w=y.push("translate(",null,t,null,n);k.push({i:w-4,x:zs(f,h)},{i:w-2,x:zs(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:zs(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:zs(f,p)}):p&&h.push(o(h)+"skewX("+p+r)}function d(f,p,h,g,y,k){if(f!==h||p!==g){var w=y.push(o(y)+"scale(",null,",",null,")");k.push({i:w-4,x:zs(f,h)},{i:w-2,x:zs(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),d(f.scaleX,f.scaleY,p.scaleX,p.scaleY,h,g),f=p=null,function(y){for(var k=-1,w=g.length,b;++k<w;)h[(b=g[k]).i]=b.x(y);return h.join("")}}}var hZ=i3(fZ,"px, ","px)","deg)"),mZ=i3(pZ,", ",")",")"),gZ=1e-12;function aC(e){return((e=Math.exp(e))+1/e)/2}function xZ(e){return((e=Math.exp(e))-1/e)/2}function yZ(e){return((e=Math.exp(2*e))-1)/(e+1)}const Wp=(function e(t,n,r){function o(i,a){var l=i[0],d=i[1],f=i[2],p=a[0],h=a[1],g=a[2],y=p-l,k=h-d,w=y*y+k*k,b,j;if(w<gZ)j=Math.log(g/f)/t,b=function(R){return[l+R*y,d+R*k,f*Math.exp(t*R*j)]};else{var N=Math.sqrt(w),S=(g*g-f*f+r*w)/(2*f*n*N),C=(g*g-f*f-r*w)/(2*g*n*N),I=Math.log(Math.sqrt(S*S+1)-S),T=Math.log(Math.sqrt(C*C+1)-C);j=(T-I)/t,b=function(R){var D=R*j,_=aC(I),B=f/(n*N)*(_*yZ(t*D+I)-xZ(I));return[l+B*y,d+B*k,f*_/aC(t*D+I)]}}return b.duration=j*1e3*t/Math.SQRT2,b}return o.rho=function(i){var a=Math.max(.001,+i),l=a*a,d=l*l;return e(a,l,d)},o})(Math.SQRT2,2,4);var Jl=0,ku=0,wu=0,a3=1e3,Ph,Su,_h=0,ya=0,Wm=0,dd=typeof performance=="object"&&performance.now?performance:Date,l3=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function m0(){return ya||(l3(bZ),ya=dd.now()+Wm)}function bZ(){ya=0}function Dh(){this._call=this._time=this._next=null}Dh.prototype=c3.prototype={constructor:Dh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?m0():+n)+(t==null?0:+t),!this._next&&Su!==this&&(Su?Su._next=this:Ph=this,Su=this),this._call=e,this._time=n,uv()},stop:function(){this._call&&(this._call=null,this._time=1/0,uv())}};function c3(e,t,n){var r=new Dh;return r.restart(e,t,n),r}function vZ(){m0(),++Jl;for(var e=Ph,t;e;)(t=ya-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jl}function lC(){ya=(_h=dd.now())+Wm,Jl=ku=0;try{vZ()}finally{Jl=0,jZ(),ya=0}}function wZ(){var e=dd.now(),t=e-_h;t>a3&&(Wm-=t,_h=e)}function jZ(){for(var e,t=Ph,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:Ph=n);Su=e,uv(r)}function uv(e){if(!Jl){ku&&(ku=clearTimeout(ku));var t=e-ya;t>24?(e<1/0&&(ku=setTimeout(lC,e-dd.now()-Wm)),wu&&(wu=clearInterval(wu))):(wu||(_h=dd.now(),wu=setInterval(wZ,a3)),Jl=1,l3(lC))}}function cC(e,t,n){var r=new Dh;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var kZ=Um("start","end","cancel","interrupt"),SZ=[],u3=0,uC=1,dv=2,qp=3,dC=4,fv=5,Kp=6;function qm(e,t,n,r,o,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;NZ(e,n,{name:t,index:r,group:o,on:kZ,tween:SZ,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:u3})}function g0(e,t){var n=Cs(e,t);if(n.state>u3)throw new Error("too late; already scheduled");return n}function Zs(e,t){var n=Cs(e,t);if(n.state>qp)throw new Error("too late; already running");return n}function Cs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function NZ(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=c3(i,0,n.time);function i(f){n.state=uC,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!==uC)return d();for(p in r)if(y=r[p],y.name===n.name){if(y.state===qp)return cC(a);y.state===dC?(y.state=Kp,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+p<t&&(y.state=Kp,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete r[p])}if(cC(function(){n.state===qp&&(n.state=dC,n.timer.restart(l,n.delay,n.time),l(f))}),n.state=dv,n.on.call("start",e,e.__data__,n.index,n.group),n.state===dv){for(n.state=qp,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(d),n.state=fv,1),h=-1,g=o.length;++h<g;)o[h].call(e,p);n.state===fv&&(n.on.call("end",e,e.__data__,n.index,n.group),d())}function d(){n.state=Kp,n.timer.stop(),delete r[t];for(var f in r)return;delete e.__transition}}function Gp(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>dv&&r.state<fv,r.state=Kp,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function CZ(e){return this.each(function(){Gp(this,e)})}function EZ(e,t){var n,r;return function(){var o=Zs(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 TZ(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Zs(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var l={name:t,value:n},d=0,f=o.length;d<f;++d)if(o[d].name===t){o[d]=l;break}d===f&&o.push(l)}i.tween=o}}function RZ(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Cs(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?EZ:TZ)(n,e,t))}function x0(e,t,n){var r=e._id;return e.each(function(){var o=Zs(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Cs(o,r).value[t]}}function d3(e,t){var n;return(typeof t=="number"?zs:t instanceof xa?Ah:(n=xa(t))?(t=n,Ah):s3)(e,t)}function AZ(e){return function(){this.removeAttribute(e)}}function PZ(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _Z(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 DZ(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 $Z(e,t,n){var r,o,i;return function(){var a,l=n(this),d;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),d=l+"",a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l)))}}function IZ(e,t,n){var r,o,i;return function(){var a,l=n(this),d;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),d=l+"",a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l)))}}function MZ(e,t){var n=Hm(e),r=n==="transform"?mZ:d3;return this.attrTween(e,typeof t=="function"?(n.local?IZ:$Z)(n,r,x0(this,"attr."+e,t)):t==null?(n.local?PZ:AZ)(n):(n.local?DZ:_Z)(n,r,t))}function LZ(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function OZ(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function FZ(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&OZ(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)&&LZ(e,i)),n}return o._value=t,o}function BZ(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=Hm(e);return this.tween(n,(r.local?FZ:zZ)(r,t))}function UZ(e,t){return function(){g0(this,e).delay=+t.apply(this,arguments)}}function HZ(e,t){return t=+t,function(){g0(this,e).delay=t}}function VZ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?UZ:HZ)(t,e)):Cs(this.node(),t).delay}function WZ(e,t){return function(){Zs(this,e).duration=+t.apply(this,arguments)}}function qZ(e,t){return t=+t,function(){Zs(this,e).duration=t}}function KZ(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?WZ:qZ)(t,e)):Cs(this.node(),t).duration}function GZ(e,t){if(typeof t!="function")throw new Error;return function(){Zs(this,e).ease=t}}function YZ(e){var t=this._id;return arguments.length?this.each(GZ(t,e)):Cs(this.node(),t).ease}function XZ(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Zs(this,e).ease=n}}function QZ(e){if(typeof e!="function")throw new Error;return this.each(XZ(this._id,e))}function JZ(e){typeof e!="function"&&(e=B_(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]=[],d,f=0;f<a;++f)(d=i[f])&&e.call(d,d.__data__,f,i)&&l.push(d);return new So(r,this._parents,this._name,this._id)}function ZZ(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 d=t[l],f=n[l],p=d.length,h=a[l]=new Array(p),g,y=0;y<p;++y)(g=d[y]||f[y])&&(h[y]=g);for(;l<r;++l)a[l]=t[l];return new So(a,this._parents,this._name,this._id)}function eee(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 tee(e,t,n){var r,o,i=eee(t)?g0:Zs;return function(){var a=i(this,e),l=a.on;l!==r&&(o=(r=l).copy()).on(t,n),a.on=o}}function nee(e,t){var n=this._id;return arguments.length<2?Cs(this.node(),n).on.on(e):this.each(tee(n,e,t))}function ree(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function see(){return this.on("end.remove",ree(this._id))}function oee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=f0(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var l=r[a],d=l.length,f=i[a]=new Array(d),p,h,g=0;g<d;++g)(p=l[g])&&(h=e.call(p,p.__data__,g,l))&&("__data__"in p&&(h.__data__=p.__data__),f[g]=h,qm(f[g],t,n,g,f,Cs(p,n)));return new So(i,this._parents,t,n)}function iee(e){var t=this._name,n=this._id;typeof e!="function"&&(e=z_(e));for(var r=this._groups,o=r.length,i=[],a=[],l=0;l<o;++l)for(var d=r[l],f=d.length,p,h=0;h<f;++h)if(p=d[h]){for(var g=e.call(p,p.__data__,h,d),y,k=Cs(p,n),w=0,b=g.length;w<b;++w)(y=g[w])&&qm(y,t,n,w,g,k);i.push(g),a.push(p)}return new So(i,a,t,n)}var aee=Hd.prototype.constructor;function lee(){return new aee(this._groups,this._parents)}function cee(e,t){var n,r,o;return function(){var i=Ql(this,e),a=(this.style.removeProperty(e),Ql(this,e));return i===a?null:i===n&&a===r?o:o=t(n=i,r=a)}}function f3(e){return function(){this.style.removeProperty(e)}}function uee(e,t,n){var r,o=n+"",i;return function(){var a=Ql(this,e);return a===o?null:a===r?i:i=t(r=a,n)}}function dee(e,t,n){var r,o,i;return function(){var a=Ql(this,e),l=n(this),d=l+"";return l==null&&(d=l=(this.style.removeProperty(e),Ql(this,e))),a===d?null:a===r&&d===o?i:(o=d,i=t(r=a,l))}}function fee(e,t){var n,r,o,i="style."+t,a="end."+i,l;return function(){var d=Zs(this,e),f=d.on,p=d.value[i]==null?l||(l=f3(t)):void 0;(f!==n||o!==p)&&(r=(n=f).copy()).on(a,o=p),d.on=r}}function pee(e,t,n){var r=(e+="")=="transform"?hZ:d3;return t==null?this.styleTween(e,cee(e,r)).on("end.style."+e,f3(e)):typeof t=="function"?this.styleTween(e,dee(e,r,x0(this,"style."+e,t))).each(fee(this._id,e)):this.styleTween(e,uee(e,r,t),n).on("end.style."+e,null)}function hee(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function mee(e,t,n){var r,o;function i(){var a=t.apply(this,arguments);return a!==o&&(r=(o=a)&&hee(e,a,n)),r}return i._value=t,i}function gee(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,mee(e,t,n??""))}function xee(e){return function(){this.textContent=e}}function yee(e){return function(){var t=e(this);this.textContent=t??""}}function bee(e){return this.tween("text",typeof e=="function"?yee(x0(this,"text",e)):xee(e==null?"":e+""))}function vee(e){return function(t){this.textContent=e.call(this,t)}}function wee(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&vee(o)),t}return r._value=e,r}function jee(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,wee(e))}function kee(){for(var e=this._name,t=this._id,n=p3(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a=r[i],l=a.length,d,f=0;f<l;++f)if(d=a[f]){var p=Cs(d,t);qm(d,e,n,f,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new So(r,this._parents,e,n)}function See(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,a){var l={value:a},d={value:function(){--o===0&&i()}};n.each(function(){var f=Zs(this,r),p=f.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(d)),f.on=t}),o===0&&i()})}var Nee=0;function So(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function p3(){return++Nee}var mo=Hd.prototype;So.prototype={constructor:So,select:oee,selectAll:iee,selectChild:mo.selectChild,selectChildren:mo.selectChildren,filter:JZ,merge:ZZ,selection:lee,transition:kee,call:mo.call,nodes:mo.nodes,node:mo.node,size:mo.size,empty:mo.empty,each:mo.each,on:nee,attr:MZ,attrTween:BZ,style:pee,styleTween:gee,text:bee,textTween:jee,remove:see,tween:RZ,delay:VZ,duration:KZ,ease:YZ,easeVarying:QZ,end:See,[Symbol.iterator]:mo[Symbol.iterator]};function Cee(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Eee={time:null,delay:0,duration:250,ease:Cee};function Tee(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 Ree(e){var t,n;e instanceof So?(t=e._id,e=e._name):(t=p3(),(n=Eee).time=m0(),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,d,f=0;f<l;++f)(d=a[f])&&qm(d,e,t,f,a,n||Tee(d,t));return new So(r,this._parents,e,t)}Hd.prototype.interrupt=CZ;Hd.prototype.transition=Ree;const bp=e=>()=>e;function Aee(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 vo(e,t,n){this.k=e,this.x=t,this.y=n}vo.prototype={constructor:vo,scale:function(e){return e===1?this:new vo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new vo(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 Km=new vo(1,0,0);h3.prototype=vo.prototype;function h3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Km;return e.__zoom}function Uy(e){e.stopImmediatePropagation()}function ju(e){e.preventDefault(),e.stopImmediatePropagation()}function Pee(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _ee(){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 fC(){return this.__zoom||Km}function Dee(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $ee(){return navigator.maxTouchPoints||"ontouchstart"in this}function Iee(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 m3(){var e=Pee,t=_ee,n=Iee,r=Dee,o=$ee,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Wp,f=Um("start","zoom","end"),p,h,g,y=500,k=150,w=0,b=10;function j(A){A.property("__zoom",fC).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",_).on("dblclick.zoom",B).filter(o).on("touchstart.zoom",$).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}j.transform=function(A,F,U,H){var L=A.selection?A.selection():A;L.property("__zoom",fC),A!==L?I(A,F,U,H):L.interrupt().each(function(){T(this,arguments).event(H).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},j.scaleBy=function(A,F,U,H){j.scaleTo(A,function(){var L=this.__zoom.k,V=typeof F=="function"?F.apply(this,arguments):F;return L*V},U,H)},j.scaleTo=function(A,F,U,H){j.transform(A,function(){var L=t.apply(this,arguments),V=this.__zoom,M=U==null?C(L):typeof U=="function"?U.apply(this,arguments):U,W=V.invert(M),Y=typeof F=="function"?F.apply(this,arguments):F;return n(S(N(V,Y),M,W),L,a)},U,H)},j.translateBy=function(A,F,U,H){j.transform(A,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof U=="function"?U.apply(this,arguments):U),t.apply(this,arguments),a)},null,H)},j.translateTo=function(A,F,U,H,L){j.transform(A,function(){var V=t.apply(this,arguments),M=this.__zoom,W=H==null?C(V):typeof H=="function"?H.apply(this,arguments):H;return n(Km.translate(W[0],W[1]).scale(M.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof U=="function"?-U.apply(this,arguments):-U),V,a)},H,L)};function N(A,F){return F=Math.max(i[0],Math.min(i[1],F)),F===A.k?A:new vo(F,A.x,A.y)}function S(A,F,U){var H=F[0]-U[0]*A.k,L=F[1]-U[1]*A.k;return H===A.x&&L===A.y?A:new vo(A.k,H,L)}function C(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function I(A,F,U,H){A.on("start.zoom",function(){T(this,arguments).event(H).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(H).end()}).tween("zoom",function(){var L=this,V=arguments,M=T(L,V).event(H),W=t.apply(L,V),Y=U==null?C(W):typeof U=="function"?U.apply(L,V):U,q=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),J=L.__zoom,ne=typeof F=="function"?F.apply(L,V):F,Q=d(J.invert(Y).concat(q/J.k),ne.invert(Y).concat(q/ne.k));return function(le){if(le===1)le=ne;else{var te=Q(le),pe=q/te[2];le=new vo(pe,Y[0]-te[0]*pe,Y[1]-te[1]*pe)}M.zoom(null,le)}})}function T(A,F,U){return!U&&A.__zooming||new R(A,F)}function R(A,F){this.that=A,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,F),this.taps=0}R.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,F){return this.mouse&&A!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var F=Ir(this.that).datum();f.call(A,this.that,new Aee(A,{sourceEvent:this.sourceEvent,target:j,transform:this.that.__zoom,dispatch:f}),F)}};function D(A,...F){if(!e.apply(this,arguments))return;var U=T(this,F).event(A),H=this.__zoom,L=Math.max(i[0],Math.min(i[1],H.k*Math.pow(2,r.apply(this,arguments)))),V=ds(A);if(U.wheel)(U.mouse[0][0]!==V[0]||U.mouse[0][1]!==V[1])&&(U.mouse[1]=H.invert(U.mouse[0]=V)),clearTimeout(U.wheel);else{if(H.k===L)return;U.mouse=[V,H.invert(V)],Gp(this),U.start()}ju(A),U.wheel=setTimeout(M,k),U.zoom("mouse",n(S(N(H,L),U.mouse[0],U.mouse[1]),U.extent,a));function M(){U.wheel=null,U.end()}}function _(A,...F){if(g||!e.apply(this,arguments))return;var U=A.currentTarget,H=T(this,F,!0).event(A),L=Ir(A.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",q,!0),V=ds(A,U),M=A.clientX,W=A.clientY;Q_(A.view),Uy(A),H.mouse=[V,this.__zoom.invert(V)],Gp(this),H.start();function Y(J){if(ju(J),!H.moved){var ne=J.clientX-M,Q=J.clientY-W;H.moved=ne*ne+Q*Q>w}H.event(J).zoom("mouse",n(S(H.that.__zoom,H.mouse[0]=ds(J,U),H.mouse[1]),H.extent,a))}function q(J){L.on("mousemove.zoom mouseup.zoom",null),J_(J.view,H.moved),ju(J),H.event(J).end()}}function B(A,...F){if(e.apply(this,arguments)){var U=this.__zoom,H=ds(A.changedTouches?A.changedTouches[0]:A,this),L=U.invert(H),V=U.k*(A.shiftKey?.5:2),M=n(S(N(U,V),H,L),t.apply(this,F),a);ju(A),l>0?Ir(this).transition().duration(l).call(I,M,H,A):Ir(this).call(j.transform,M,H,A)}}function $(A,...F){if(e.apply(this,arguments)){var U=A.touches,H=U.length,L=T(this,F,A.changedTouches.length===H).event(A),V,M,W,Y;for(Uy(A),M=0;M<H;++M)W=U[M],Y=ds(W,this),Y=[Y,this.__zoom.invert(Y),W.identifier],L.touch0?!L.touch1&&L.touch0[2]!==Y[2]&&(L.touch1=Y,L.taps=0):(L.touch0=Y,V=!0,L.taps=1+!!p);p&&(p=clearTimeout(p)),V&&(L.taps<2&&(h=Y[0],p=setTimeout(function(){p=null},y)),Gp(this),L.start())}}function O(A,...F){if(this.__zooming){var U=T(this,F).event(A),H=A.changedTouches,L=H.length,V,M,W,Y;for(ju(A),V=0;V<L;++V)M=H[V],W=ds(M,this),U.touch0&&U.touch0[2]===M.identifier?U.touch0[0]=W:U.touch1&&U.touch1[2]===M.identifier&&(U.touch1[0]=W);if(M=U.that.__zoom,U.touch1){var q=U.touch0[0],J=U.touch0[1],ne=U.touch1[0],Q=U.touch1[1],le=(le=ne[0]-q[0])*le+(le=ne[1]-q[1])*le,te=(te=Q[0]-J[0])*te+(te=Q[1]-J[1])*te;M=N(M,Math.sqrt(le/te)),W=[(q[0]+ne[0])/2,(q[1]+ne[1])/2],Y=[(J[0]+Q[0])/2,(J[1]+Q[1])/2]}else if(U.touch0)W=U.touch0[0],Y=U.touch0[1];else return;U.zoom("touch",n(S(M,W,Y),U.extent,a))}}function z(A,...F){if(this.__zooming){var U=T(this,F).event(A),H=A.changedTouches,L=H.length,V,M;for(Uy(A),g&&clearTimeout(g),g=setTimeout(function(){g=null},y),V=0;V<L;++V)M=H[V],U.touch0&&U.touch0[2]===M.identifier?delete U.touch0:U.touch1&&U.touch1[2]===M.identifier&&delete U.touch1;if(U.touch1&&!U.touch0&&(U.touch0=U.touch1,delete U.touch1),U.touch0)U.touch0[1]=this.__zoom.invert(U.touch0[0]);else if(U.end(),U.taps===2&&(M=ds(M,this),Math.hypot(h[0]-M[0],h[1]-M[1])<b)){var W=Ir(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return j.wheelDelta=function(A){return arguments.length?(r=typeof A=="function"?A:bp(+A),j):r},j.filter=function(A){return arguments.length?(e=typeof A=="function"?A:bp(!!A),j):e},j.touchable=function(A){return arguments.length?(o=typeof A=="function"?A:bp(!!A),j):o},j.extent=function(A){return arguments.length?(t=typeof A=="function"?A:bp([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),j):t},j.scaleExtent=function(A){return arguments.length?(i[0]=+A[0],i[1]=+A[1],j):[i[0],i[1]]},j.translateExtent=function(A){return arguments.length?(a[0][0]=+A[0][0],a[1][0]=+A[1][0],a[0][1]=+A[0][1],a[1][1]=+A[1][1],j):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},j.constrain=function(A){return arguments.length?(n=A,j):n},j.duration=function(A){return arguments.length?(l=+A,j):l},j.interpolate=function(A){return arguments.length?(d=A,j):d},j.on=function(){var A=f.on.apply(f,arguments);return A===f?j:A},j.clickDistance=function(A){return arguments.length?(w=(A=+A)*A,j):Math.sqrt(w)},j.tapDistance=function(A){return arguments.length?(b=+A,j):b},j}const ws={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.`},fd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],g3=["Enter"," ","Escape"],x3={"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 Zl;(function(e){e.Strict="strict",e.Loose="loose"})(Zl||(Zl={}));var pa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(pa||(pa={}));var pd;(function(e){e.Partial="partial",e.Full="full"})(pd||(pd={}));const y3={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var fi;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(fi||(fi={}));var hd;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(hd||(hd={}));var ot;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ot||(ot={}));const pC={[ot.Left]:ot.Right,[ot.Right]:ot.Left,[ot.Top]:ot.Bottom,[ot.Bottom]:ot.Top};function b3(e){return e===null?null:e?"valid":"invalid"}const v3=e=>"id"in e&&"source"in e&&"target"in e,Mee=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),y0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Wd=(e,t=[0,0])=>{const{width:n,height:r}=To(e),o=e.origin??t,i=n*o[0],a=r*o[1];return{x:e.position.x-i,y:e.position.y-a}},Lee=(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):y0(o)?o:t.nodeLookup.get(o.id));const l=a?$h(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Gm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ym(n)},qd=(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=Gm(n,$h(o)),r=!0)}),r?Ym(n):{x:0,y:0,width:0,height:0}},b0=(e,t,[n,r,o]=[0,0,1],i=!1,a=!1)=>{const l={...Cc(t,[n,r,o]),width:t.width/o,height:t.height/o},d=[];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,w=md(l,tc(f)),b=(y??0)*(k??0),j=i&&w>0;(!f.internals.handleBounds||j||w>=b||f.dragging)&&d.push(f)}return d},Oee=(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 Fee(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=Fee(e,a),d=qd(l),f=w0(d,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 w3({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:d,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",ws.error005());else{const y=l.measured.width,k=l.measured.height;y&&k&&(h=[[d,f],[d+y,f+k]])}else l&&va(a.extent)&&(h=[[a.extent[0][0]+d,a.extent[0][1]+f],[a.extent[1][0]+d,a.extent[1][1]+f]]);const g=va(h)?ba(t,h,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",ws.error015())),{position:{x:g.x-d+(a.measured.width??0)*p[0],y:g.y-f+(a.measured.height??0)*p[1]},positionAbsolute:g}}async function Bee({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(w=>w.id===g.parentId);(y||k)&&a.push(g)}const l=new Set(t.map(g=>g.id)),d=r.filter(g=>g.deletable!==!1),p=Oee(a,d);for(const g of d)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 ec=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ba=(e={x:0,y:0},t,n)=>({x:ec(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ec(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function j3(e,t,n){const{width:r,height:o}=To(n),{x:i,y:a}=n.internals.positionAbsolute;return ba(e,[[i,a],[i+r,a+o]],t)}const hC=(e,t,n)=>e<t?ec(Math.abs(e-t),1,t)/t:e>n?-ec(Math.abs(e-n),1,t)/t:0,v0=(e,t,n=15,r=40)=>{const o=hC(e.x,r,t.width-r)*n,i=hC(e.y,r,t.height-r)*n;return[o,i]},Gm=(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)}),pv=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ym=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tc=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=y0(e)?e.internals.positionAbsolute:Wd(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}},$h=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=y0(e)?e.internals.positionAbsolute:Wd(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)}},k3=(e,t)=>Ym(Gm(pv(e),pv(t))),md=(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)},mC=e=>ps(e.width)&&ps(e.height)&&ps(e.x)&&ps(e.y),ps=e=>!isNaN(e)&&isFinite(e),S3=(e,t)=>(n,r)=>{},Kd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Cc=({x:e,y:t},[n,r,o],i=!1,a=[1,1])=>{const l={x:(e-n)/o,y:(t-r)/o};return i?Kd(l,a):l},nc=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function bl(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 Uee(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=bl(e,n),o=bl(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=bl(e.top??e.y??0,n),o=bl(e.bottom??e.y??0,n),i=bl(e.left??e.x??0,t),a=bl(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 Hee(e,t,n,r,o,i){const{x:a,y:l}=nc(e,[t,n,r]),{x:d,y:f}=nc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=o-d,h=i-f;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(h)}}const w0=(e,t,n,r,o,i)=>{const a=Uee(i,t,n),l=(t-a.x)/e.width,d=(n-a.y)/e.height,f=Math.min(l,d),p=ec(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,w=Hee(e,y,k,p,t,n),b={left:Math.min(w.left-a.left,0),top:Math.min(w.top-a.top,0),right:Math.min(w.right-a.right,0),bottom:Math.min(w.bottom-a.bottom,0)};return{x:y-b.left+b.right,y:k-b.top+b.bottom,zoom:p}},gd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function va(e){return e!=null&&e!=="parent"}function To(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 N3(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 C3(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 gC(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vee(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Wee(e){return{...x3,...e||{}}}function Wu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:a}=hs(e),l=Cc({x:i-((o==null?void 0:o.left)??0),y:a-((o==null?void 0:o.top)??0)},r),{x:d,y:f}=n?Kd(l,t):l;return{xSnapped:d,ySnapped:f,...l}}const j0=e=>({width:e.offsetWidth,height:e.offsetHeight}),E3=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},qee=["INPUT","SELECT","TEXTAREA"];function T3(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:qee.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const R3=e=>"clientX"in e,hs=(e,t)=>{var i,a;const n=R3(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)}},xC=(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,...j0(a)}})};function A3({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:a,targetControlY:l}){const d=e*.125+o*.375+a*.375+n*.125,f=t*.125+i*.375+l*.375+r*.125,p=Math.abs(d-e),h=Math.abs(f-t);return[d,f,p,h]}function vp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yC({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case ot.Left:return[t-vp(t-r,i),n];case ot.Right:return[t+vp(r-t,i),n];case ot.Top:return[t,n-vp(n-o,i)];case ot.Bottom:return[t,n+vp(o-n,i)]}}function P3({sourceX:e,sourceY:t,sourcePosition:n=ot.Bottom,targetX:r,targetY:o,targetPosition:i=ot.Top,curvature:a=.25}){const[l,d]=yC({pos:n,x1:e,y1:t,x2:r,y2:o,c:a}),[f,p]=yC({pos:i,x1:r,y1:o,x2:e,y2:t,c:a}),[h,g,y,k]=A3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:l,sourceControlY:d,targetControlX:f,targetControlY:p});return[`M${e},${t} C${l},${d} ${f},${p} ${r},${o}`,h,g,y,k]}function _3({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 Kee({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 Gee({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=Gm($h(e),$h(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 md(a,Ym(i))>0}const Yee=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Xee=(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)),Qee=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",ws.error006()),t;const r=n.getEdgeId||Yee;let o;return v3(e)?o={...e}:o={...e,id:r(e)},Xee(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function D3({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,a,l]=_3({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,a,l]}const bC={[ot.Left]:{x:-1,y:0},[ot.Right]:{x:1,y:0},[ot.Top]:{x:0,y:-1},[ot.Bottom]:{x:0,y:1}},Jee=({source:e,sourcePosition:t=ot.Bottom,target:n})=>t===ot.Left||t===ot.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},vC=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Zee({source:e,sourcePosition:t=ot.Bottom,target:n,targetPosition:r=ot.Top,center:o,offset:i,stepPosition:a}){const l=bC[t],d=bC[r],f={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+d.x*i,y:n.y+d.y*i},h=Jee({source:f,sourcePosition:t,target:p}),g=h.x!==0?"x":"y",y=h[g];let k=[],w,b;const j={x:0,y:0},N={x:0,y:0},[,,S,C]=_3({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*d[g]===-1){g==="x"?(w=o.x??f.x+(p.x-f.x)*a,b=o.y??(f.y+p.y)/2):(w=o.x??(f.x+p.x)/2,b=o.y??f.y+(p.y-f.y)*a);const D=[{x:w,y:f.y},{x:w,y:p.y}],_=[{x:f.x,y:b},{x:p.x,y:b}];l[g]===y?k=g==="x"?D:_:k=g==="x"?_:D}else{const D=[{x:f.x,y:p.y}],_=[{x:p.x,y:f.y}];if(g==="x"?k=l.x===y?_:D:k=l.y===y?D:_,t===r){const A=Math.abs(e[g]-n[g]);if(A<=i){const F=Math.min(i-1,i-A);l[g]===y?j[g]=(f[g]>e[g]?-1:1)*F:N[g]=(p[g]>n[g]?-1:1)*F}}if(t!==r){const A=g==="x"?"y":"x",F=l[g]===d[A],U=f[A]>p[A],H=f[A]<p[A];(l[g]===1&&(!F&&U||F&&H)||l[g]!==1&&(!F&&H||F&&U))&&(k=g==="x"?D:_)}const B={x:f.x+j.x,y:f.y+j.y},$={x:p.x+N.x,y:p.y+N.y},O=Math.max(Math.abs(B.x-k[0].x),Math.abs($.x-k[0].x)),z=Math.max(Math.abs(B.y-k[0].y),Math.abs($.y-k[0].y));O>=z?(w=(B.x+$.x)/2,b=k[0].y):(w=k[0].x,b=(B.y+$.y)/2)}const I={x:f.x+j.x,y:f.y+j.y},T={x:p.x+N.x,y:p.y+N.y};return[[e,...I.x!==k[0].x||I.y!==k[0].y?[I]:[],...k,...T.x!==k[k.length-1].x||T.y!==k[k.length-1].y?[T]:[],n],w,b,S,C]}function ete(e,t,n,r){const o=Math.min(vC(e,t)/2,vC(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,d=e.y<n.y?-1:1;return`L ${i},${a+o*d}Q ${i},${a} ${i+o*l},${a}`}function hv({sourceX:e,sourceY:t,sourcePosition:n=ot.Bottom,targetX:r,targetY:o,targetPosition:i=ot.Top,borderRadius:a=5,centerX:l,centerY:d,offset:f=20,stepPosition:p=.5}){const[h,g,y,k,w]=Zee({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:l,y:d},offset:f,stepPosition:p});let b=`M${h[0].x} ${h[0].y}`;for(let j=1;j<h.length-1;j++)b+=ete(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,w]}function wC(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function tte(e){var h;const{sourceNode:t,targetNode:n}=e;if(!wC(t)||!wC(n))return null;const r=t.internals.handleBounds||jC(t.handles),o=n.internals.handleBounds||jC(n.handles),i=kC((r==null?void 0:r.source)??[],e.sourceHandle),a=kC(e.connectionMode===Zl.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",ws.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||ot.Bottom,d=(a==null?void 0:a.position)||ot.Top,f=wa(t,i,l),p=wa(n,a,d);return{sourceX:f.x,sourceY:f.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:d}}function jC(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 wa(e,t,n=ot.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??To(e);if(r)return{x:o+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case ot.Top:return{x:o+a/2,y:i};case ot.Right:return{x:o+a,y:i+l/2};case ot.Bottom:return{x:o+a/2,y:i+l};case ot.Left:return{x:o,y:i+l/2}}}function kC(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function mv(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function nte(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(d=>{if(d&&typeof d=="object"){const f=mv(d,t);i.has(f)||(a.push({id:f,color:d.color||n,...d}),i.add(f))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const $3=1e3,rte=10,k0={nodeOrigin:[0,0],nodeExtent:fd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ste={...k0,checkEquality:!0};function S0(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function ote(e,t,n){const r=S0(k0,n);for(const o of e.values())if(o.parentId)C0(o,e,t,r);else{const i=Wd(o,r.nodeOrigin),a=va(o.extent)?o.extent:r.nodeExtent,l=ba(i,a,To(o));o.internals.positionAbsolute=l}}function ite(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 N0(e){return e==="manual"}function gv(e,t,n,r={}){var p,h;const o=S0(ste,r),i={i:0},a=new Map(t),l=o!=null&&o.elevateNodesOnSelect&&!N0(o.zIndexMode)?$3:0;let d=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=Wd(g,o.nodeOrigin),w=va(g.extent)?g.extent:o.nodeExtent,b=ba(k,w,To(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:ite(g,y),z:I3(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&&(d=!1),g.parentId&&C0(y,t,n,r,i),f||(f=g.selected??!1)}return{nodesInitialized:d,hasSelectedNodes:f}}function ate(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 C0(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:d}=S0(k0,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}ate(e,n),o&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++o.i,p.internals.z=p.internals.z+o.i*rte),o&&p.internals.rootParentIndex!==void 0&&(o.i=p.internals.rootParentIndex);const h=i&&!N0(d)?$3:0,{x:g,y,z:k}=lte(e,p,a,l,h,d),{positionAbsolute:w}=e.internals,b=g!==w.x||y!==w.y;(b||k!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y}:w,z:k}})}function I3(e,t,n){const r=ps(e.zIndex)?e.zIndex:0;return N0(n)?r:r+(e.selected?t:0)}function lte(e,t,n,r,o,i){const{x:a,y:l}=t.internals.positionAbsolute,d=To(e),f=Wd(e,n),p=va(e.extent)?ba(f,e.extent,d):f;let h=ba({x:a+p.x,y:l+p.y},r,d);e.extent==="parent"&&(h=j3(h,d,t));const g=I3(e,o,i),y=t.internals.z??0;return{x:h.x,y:h.y,z:y>=g?y+1:g}}function E0(e,t,n,r=[0,0]){var a;const o=[],i=new Map;for(const l of e){const d=t.get(l.parentId);if(!d)continue;const f=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??tc(d),p=k3(f,l.rect);i.set(l.parentId,{expandedRect:p,parent:d})}return i.size>0&&i.forEach(({expandedRect:l,parent:d},f)=>{var S;const p=d.internals.positionAbsolute,h=To(d),g=d.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,w=Math.max(h.width,Math.round(l.width)),b=Math.max(h.height,Math.round(l.height)),j=(w-h.width)*g[0],N=(b-h.height)*g[1];(y>0||k>0||j||N)&&(o.push({id:f,type:"position",position:{x:d.position.x-y+j,y:d.position.y-k+N}}),(S=n.get(f))==null||S.forEach(C=>{e.some(I=>I.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:w+(y?g[0]*y-j:0),height:b+(k?g[1]*k-N:0)}})}),o}function cte(e,t,n,r,o,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let d=!1;if(!l)return{changes:[],updatedInternals:d};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}}),d=!0;continue}const w=j0(y.nodeElement),b=k.measured.width!==w.width||k.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!k.internals.handleBounds||y.force))){const N=y.nodeElement.getBoundingClientRect(),S=va(k.extent)?k.extent:i;let{positionAbsolute:C}=k.internals;k.parentId&&k.extent==="parent"?C=j3(C,w,t.get(k.parentId)):S&&(C=ba(C,S,w));const I={...k,measured:w,internals:{...k.internals,positionAbsolute:C,handleBounds:{source:xC("source",y.nodeElement,N,h,k.id),target:xC("target",y.nodeElement,N,h,k.id)}}};t.set(k.id,I),k.parentId&&C0(I,t,n,{nodeOrigin:o,zIndexMode:a}),d=!0,b&&(f.push({id:k.id,type:"dimensions",dimensions:w}),k.expandParent&&k.parentId&&g.push({id:k.id,parentId:k.parentId,rect:tc(I,o)}))}}if(g.length>0){const y=E0(g,t,n,o);f.push(...y)}return{changes:f,updatedInternals:d}}async function ute({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 SC(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 d=r.get(a)||new Map;if(r.set(a,d.set(n,t)),i){a=`${o}-${e}-${i}`;const f=r.get(a)||new Map;r.set(a,f.set(n,t))}}function M3(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:a=null,targetHandle:l=null}=r,d={edgeId:r.id,source:o,target:i,sourceHandle:a,targetHandle:l},f=`${o}-${a}--${i}-${l}`,p=`${i}-${l}--${o}-${a}`;SC("source",d,p,e,o,a),SC("target",d,f,e,i,l),t.set(r.id,r)}}function L3(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:L3(n,t):!1}function NC(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 dte(e,t,n,r){const o=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!L3(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 Hy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,d;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:((d=t.get(e))==null?void 0:d.position)||i.position,dragging:r}:o[0],o]}function fte({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=Kd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function pte({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},a=0,l=new Map,d=!1,f={x:0,y:0},p=null,h=!1,g=null,y=!1,k=!1,w=null;function b({noDragClassName:N,handleSelector:S,domNode:C,isSelectable:I,nodeId:T,nodeClickDistance:R=0}){g=Ir(C);function D({x:O,y:z}){const{nodeLookup:A,nodeExtent:F,snapGrid:U,snapToGrid:H,nodeOrigin:L,onNodeDrag:V,onSelectionDrag:M,onError:W,updateNodePositions:Y}=t();i={x:O,y:z};let q=!1;const J=l.size>1,ne=J&&F?pv(qd(l)):null,Q=J&&H?fte({dragItems:l,snapGrid:U,x:O,y:z}):null;for(const[le,te]of l){if(!A.has(le))continue;let pe={x:O-te.distance.x,y:z-te.distance.y};H&&(pe=Q?{x:Math.round(pe.x+Q.x),y:Math.round(pe.y+Q.y)}:Kd(pe,U));let be=null;if(J&&F&&!te.extent&&ne){const{positionAbsolute:ke}=te.internals,Ue=ke.x-ne.x+F[0][0],oe=ke.x+te.measured.width-ne.x2+F[1][0],je=ke.y-ne.y+F[0][1],Se=ke.y+te.measured.height-ne.y2+F[1][1];be=[[Ue,je],[oe,Se]]}const{position:Ee,positionAbsolute:Te}=w3({nodeId:le,nextPosition:pe,nodeLookup:A,nodeExtent:be||F,nodeOrigin:L,onError:W});q=q||te.position.x!==Ee.x||te.position.y!==Ee.y,te.position=Ee,te.internals.positionAbsolute=Te}if(k=k||q,!!q&&(Y(l,!0),w&&(r||V||!T&&M))){const[le,te]=Hy({nodeId:T,dragItems:l,nodeLookup:A});r==null||r(w,l,le,te),V==null||V(w,le,te),T||M==null||M(w,te)}}async function _(){if(!p)return;const{transform:O,panBy:z,autoPanSpeed:A,autoPanOnNodeDrag:F}=t();if(!F){d=!1,cancelAnimationFrame(a);return}const[U,H]=v0(f,p,A);(U!==0||H!==0)&&(i.x=(i.x??0)-U/O[2],i.y=(i.y??0)-H/O[2],await z({x:U,y:H})&&D(i)),a=requestAnimationFrame(_)}function B(O){var J;const{nodeLookup:z,multiSelectionActive:A,nodesDraggable:F,transform:U,snapGrid:H,snapToGrid:L,selectNodesOnDrag:V,onNodeDragStart:M,onSelectionDragStart:W,unselectNodesAndEdges:Y}=t();h=!0,(!V||!I)&&!A&&T&&((J=z.get(T))!=null&&J.selected||Y()),I&&V&&T&&(e==null||e(T));const q=Wu(O.sourceEvent,{transform:U,snapGrid:H,snapToGrid:L,containerBounds:p});if(i=q,l=dte(z,F,q,T),l.size>0&&(n||M||!T&&W)){const[ne,Q]=Hy({nodeId:T,dragItems:l,nodeLookup:z});n==null||n(O.sourceEvent,l,ne,Q),M==null||M(O.sourceEvent,ne,Q),T||W==null||W(O.sourceEvent,Q)}}const $=Z_().clickDistance(R).on("start",O=>{const{domNode:z,nodeDragThreshold:A,transform:F,snapGrid:U,snapToGrid:H}=t();p=(z==null?void 0:z.getBoundingClientRect())||null,y=!1,k=!1,w=O.sourceEvent,A===0&&B(O),i=Wu(O.sourceEvent,{transform:F,snapGrid:U,snapToGrid:H,containerBounds:p}),f=hs(O.sourceEvent,p)}).on("drag",O=>{const{autoPanOnNodeDrag:z,transform:A,snapGrid:F,snapToGrid:U,nodeDragThreshold:H,nodeLookup:L}=t(),V=Wu(O.sourceEvent,{transform:A,snapGrid:F,snapToGrid:U,containerBounds:p});if(w=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||T&&!L.has(T))&&(y=!0),!y){if(!d&&z&&h&&(d=!0,_()),!h){const M=hs(O.sourceEvent,p),W=M.x-f.x,Y=M.y-f.y;Math.sqrt(W*W+Y*Y)>H&&B(O)}(i.x!==V.xSnapped||i.y!==V.ySnapped)&&l&&h&&(f=hs(O.sourceEvent,p),D(V))}}).on("end",O=>{if(!h||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(d=!1,h=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:z,updateNodePositions:A,onNodeDragStop:F,onSelectionDragStop:U}=t();if(k&&(A(l,!1),k=!1),o||F||!T&&U){const[H,L]=Hy({nodeId:T,dragItems:l,nodeLookup:z,dragging:!1});o==null||o(O.sourceEvent,l,H,L),F==null||F(O.sourceEvent,H,L),T||U==null||U(O.sourceEvent,L)}}}).filter(O=>{const z=O.target;return!O.button&&(!N||!NC(z,`.${N}`,C))&&(!S||NC(z,S,C))});g.call($)}function j(){g==null||g.on(".drag",null)}return{update:b,destroy:j}}function hte(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())md(o,tc(i))>0&&r.push(i);return r}const mte=250;function gte(e,t,n,r){var l,d;let o=[],i=1/0;const a=hte(e,n,t+mte);for(const f of a){const p=[...((l=f.internals.handleBounds)==null?void 0:l.source)??[],...((d=f.internals.handleBounds)==null?void 0:d.target)??[]];for(const h of p){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:g,y}=wa(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 O3(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)??[]],d=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return d&&i?{...d,...wa(a,d,d.position,!0)}:d}function F3(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function xte(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const z3=()=>!0;function yte(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:d,lib:f,autoPanOnConnect:p,flowId:h,panBy:g,cancelConnection:y,onConnectStart:k,onConnect:w,onConnectEnd:b,isValidConnection:j=z3,onReconnectEnd:N,updateConnection:S,getTransform:C,getFromHandle:I,autoPanSpeed:T,dragThreshold:R=1,handleDomNode:D}){const _=E3(e.target);let B=0,$;const{x:O,y:z}=hs(e),A=F3(i,D),F=l==null?void 0:l.getBoundingClientRect();let U=!1;if(!F||!A)return;const H=O3(o,A,r,d,t);if(!H)return;let L=hs(e,F),V=!1,M=null,W=!1,Y=null;function q(){if(!p||!F)return;const[Ee,Te]=v0(L,F,T);g({x:Ee,y:Te}),B=requestAnimationFrame(q)}const J={...H,nodeId:o,type:A,position:H.position},ne=d.get(o);let le={inProgress:!0,isValid:null,from:wa(ne,J,ot.Left,!0),fromHandle:J,fromPosition:J.position,fromNode:ne,to:L,toHandle:null,toPosition:pC[J.position],toNode:null,pointer:L};function te(){U=!0,S(le),k==null||k(e,{nodeId:o,handleId:r,handleType:A})}R===0&&te();function pe(Ee){if(!U){const{x:Se,y:De}=hs(Ee),ze=Se-O,Ye=De-z;if(!(ze*ze+Ye*Ye>R*R))return;te()}if(!I()||!J){be(Ee);return}const Te=C();L=hs(Ee,F),$=gte(Cc(L,Te,!1,[1,1]),n,d,J),V||(q(),V=!0);const ke=B3(Ee,{handle:$,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:a?"target":"source",isValidConnection:j,doc:_,lib:f,flowId:h,nodeLookup:d});Y=ke.handleDomNode,M=ke.connection,W=xte(!!$,ke.isValid);const Ue=d.get(o),oe=Ue?wa(Ue,J,ot.Left,!0):le.from,je={...le,from:oe,isValid:W,to:ke.toHandle&&W?nc({x:ke.toHandle.x,y:ke.toHandle.y},Te):L,toHandle:ke.toHandle,toPosition:W&&ke.toHandle?ke.toHandle.position:pC[J.position],toNode:ke.toHandle?d.get(ke.toHandle.nodeId):null,pointer:L};S(je),le=je}function be(Ee){if(!("touches"in Ee&&Ee.touches.length>0)){if(U){($||Y)&&M&&W&&(w==null||w(M));const{inProgress:Te,...ke}=le,Ue={...ke,toPosition:le.toHandle?le.toPosition:null};b==null||b(Ee,Ue),i&&(N==null||N(Ee,Ue))}y(),cancelAnimationFrame(B),V=!1,W=!1,M=null,Y=null,_.removeEventListener("mousemove",pe),_.removeEventListener("mouseup",be),_.removeEventListener("touchmove",pe),_.removeEventListener("touchend",be)}}_.addEventListener("mousemove",pe),_.addEventListener("mouseup",be),_.addEventListener("touchmove",pe),_.addEventListener("touchend",be)}function B3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:a,lib:l,flowId:d,isValidConnection:f=z3,nodeLookup:p}){const h=i==="target",g=t?a.querySelector(`.${l}-flow__handle[data-id="${d}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:k}=hs(e),w=a.elementFromPoint(y,k),b=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:g,j={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const N=F3(void 0,b),S=b.getAttribute("data-nodeid"),C=b.getAttribute("data-handleid"),I=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 _=I&&T&&(n===Zl.Strict?h&&N==="source"||!h&&N==="target":S!==r||C!==o);j.isValid=_&&f(R),j.toHandle=O3(S,N,C,p,n,!0)}return j}const xv={onPointerDown:yte,isValid:B3};function bte({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Ir(e);function i({translateExtent:l,width:d,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(),I=S.sourceEvent.ctrlKey&&gd()?10:1,T=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*p,R=C[2]*Math.pow(2,T*I);t.scaleTo(R)};let w=[0,0];const b=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(w=[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 I=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],T=[I[0]-w[0],I[1]-w[1]];w=I;const R=r()*Math.max(C[2],Math.log(C[2]))*(y?-1:1),D={x:C[0]-T[0]*R,y:C[1]-T[1]*R},_=[[0,0],[d,f]];t.setViewportConstrained({x:D.x,y:D.y,zoom:C[2]},_,l)},N=m3().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:ds}}const Xm=e=>({x:e.x,y:e.y,zoom:e.k}),Vy=({x:e,y:t,zoom:n})=>Km.translate(e,t).scale(n),Cl=(e,t)=>e.target.closest(`.${t}`),U3=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),vte=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Wy=(e,t=0,n=vte,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},H3=e=>{const t=e.ctrlKey&&gd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function wte({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:d,onPanZoomEnd:f}){return p=>{if(Cl(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=ds(p),j=H3(p),N=h*Math.pow(2,j);r.scaleTo(n,N,b,p);return}const g=p.deltaMode===1?20:1;let y=o===pa.Vertical?0:p.deltaX*g,k=o===pa.Horizontal?0:p.deltaY*g;!gd()&&p.shiftKey&&o!==pa.Vertical&&(y=p.deltaY*g,k=0),r.translateBy(n,-(y/h)*i,-(k/h)*i,{internal:!0});const w=Xm(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(d==null||d(p,w),e.panScrollTimeout=setTimeout(()=>{f==null||f(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function jte({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Cl(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,o)}}function kte({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Xm(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 Ste({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&U3(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,Xm(i.transform)))}}function Nte({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&&U3(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const d=Xm(a.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(a.sourceEvent,d)},n?150:0)}}}function Cte({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:d,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"&&(Cl(h,`${f}-flow__node`)||Cl(h,`${f}-flow__edge`)))return!0;if(!r&&!g&&!o&&!i&&!n||a||p&&!k||Cl(h,l)&&k||Cl(h,d)&&(!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 w=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||k)&&w}}function Ete({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:d}){const f={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),h=m3().scaleExtent([t,n]).translateExtent(r),g=Ir(e).call(h);N({x:o.x,y:o.y,zoom:ec(o.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),k=g.on("dblclick.zoom");h.wheelDelta(H3);async function w($,O){return g?new Promise(z=>{h==null||h.interpolate((O==null?void 0:O.interpolate)==="linear"?Vu:Wp).transform(Wy(g,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>z(!0)),$)}):!1}function b({noWheelClassName:$,noPanClassName:O,onPaneContextMenu:z,userSelectionActive:A,panOnScroll:F,panOnDrag:U,panOnScrollMode:H,panOnScrollSpeed:L,preventScrolling:V,zoomOnPinch:M,zoomOnScroll:W,zoomOnDoubleClick:Y,zoomActivationKeyPressed:q,lib:J,onTransformChange:ne,connectionInProgress:Q,paneClickDistance:le,selectionOnDrag:te}){A&&!f.isZoomingOrPanning&&j();const pe=F&&!q&&!A;h.clickDistance(te?1/0:!ps(le)||le<0?0:le);const be=pe?wte({zoomPanValues:f,noWheelClassName:$,d3Selection:g,d3Zoom:h,panOnScrollMode:H,panOnScrollSpeed:L,zoomOnPinch:M,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):jte({noWheelClassName:$,preventScrolling:V,d3ZoomHandler:y});g.on("wheel.zoom",be,{passive:!1});const Ee=kte({zoomPanValues:f,onDraggingChange:d,onPanZoomStart:a});h.on("start",Ee);const Te=Ste({zoomPanValues:f,panOnDrag:U,onPaneContextMenu:!!z,onPanZoom:i,onTransformChange:ne});h.on("zoom",Te);const ke=Nte({zoomPanValues:f,panOnDrag:U,panOnScroll:F,onPaneContextMenu:z,onPanZoomEnd:l,onDraggingChange:d});h.on("end",ke);const Ue=Cte({zoomActivationKeyPressed:q,panOnDrag:U,zoomOnScroll:W,panOnScroll:F,zoomOnDoubleClick:Y,zoomOnPinch:M,userSelectionActive:A,noPanClassName:O,noWheelClassName:$,lib:J,connectionInProgress:Q});h.filter(Ue),Y?g.on("dblclick.zoom",k):g.on("dblclick.zoom",null)}function j(){h.on("zoom",null)}async function N($,O,z){const A=Vy($),F=h==null?void 0:h.constrain()(A,O,z);return F&&await w(F),F}async function S($,O){const z=Vy($);return await w(z,O),z}function C($){if(g){const O=Vy($),z=g.property("__zoom");(z.k!==$.zoom||z.x!==$.x||z.y!==$.y)&&(h==null||h.transform(g,O,null,{sync:!0}))}}function I(){const $=g?h3(g.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}async function T($,O){return g?new Promise(z=>{h==null||h.interpolate((O==null?void 0:O.interpolate)==="linear"?Vu:Wp).scaleTo(Wy(g,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>z(!0)),$)}):!1}async function R($,O){return g?new Promise(z=>{h==null||h.interpolate((O==null?void 0:O.interpolate)==="linear"?Vu:Wp).scaleBy(Wy(g,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>z(!0)),$)}):!1}function D($){h==null||h.scaleExtent($)}function _($){h==null||h.translateExtent($)}function B($){const O=!ps($)||$<0?0:$;h==null||h.clickDistance(O)}return{update:b,destroy:j,setViewport:S,setViewportConstrained:N,getViewport:I,scaleTo:T,scaleBy:R,setScaleExtent:D,setTranslateExtent:_,syncViewport:C,setClickDistance:B}}var rc;(function(e){e.Line="line",e.Handle="handle"})(rc||(rc={}));function Tte({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const a=e-t,l=n-r,d=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&o&&(d[0]=d[0]*-1),l&&i&&(d[1]=d[1]*-1),d}function CC(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 li(e,t){return Math.max(0,t-e)}function ci(e,t){return Math.max(0,e-t)}function wp(e,t,n){return Math.max(0,t-e,e-n)}function EC(e,t){return e?!t:t}function Rte(e,t,n,r,o,i,a,l){let{affectsX:d,affectsY:f}=t;const{isHorizontal:p,isVertical:h}=t,g=p&&h,{xSnapped:y,ySnapped:k}=n,{minWidth:w,maxWidth:b,minHeight:j,maxHeight:N}=r,{x:S,y:C,width:I,height:T,aspectRatio:R}=e;let D=Math.floor(p?y-e.pointerX:0),_=Math.floor(h?k-e.pointerY:0);const B=I+(d?-D:D),$=T+(f?-_:_),O=-i[0]*I,z=-i[1]*T;let A=wp(B,w,b),F=wp($,j,N);if(a){let L=0,V=0;d&&D<0?L=li(S+D+O,a[0][0]):!d&&D>0&&(L=ci(S+B+O,a[1][0])),f&&_<0?V=li(C+_+z,a[0][1]):!f&&_>0&&(V=ci(C+$+z,a[1][1])),A=Math.max(A,L),F=Math.max(F,V)}if(l){let L=0,V=0;d&&D>0?L=ci(S+D,l[0][0]):!d&&D<0&&(L=li(S+B,l[1][0])),f&&_>0?V=ci(C+_,l[0][1]):!f&&_<0&&(V=li(C+$,l[1][1])),A=Math.max(A,L),F=Math.max(F,V)}if(o){if(p){const L=wp(B/R,j,N)*R;if(A=Math.max(A,L),a){let V=0;!d&&!f||d&&!f&&g?V=ci(C+z+B/R,a[1][1])*R:V=li(C+z+(d?D:-D)/R,a[0][1])*R,A=Math.max(A,V)}if(l){let V=0;!d&&!f||d&&!f&&g?V=li(C+B/R,l[1][1])*R:V=ci(C+(d?D:-D)/R,l[0][1])*R,A=Math.max(A,V)}}if(h){const L=wp($*R,w,b)/R;if(F=Math.max(F,L),a){let V=0;!d&&!f||f&&!d&&g?V=ci(S+$*R+O,a[1][0])/R:V=li(S+(f?_:-_)*R+O,a[0][0])/R,F=Math.max(F,V)}if(l){let V=0;!d&&!f||f&&!d&&g?V=li(S+$*R,l[1][0])/R:V=ci(S+(f?_:-_)*R,l[0][0])/R,F=Math.max(F,V)}}}_=_+(_<0?F:-F),D=D+(D<0?A:-A),o&&(g?B>$*R?_=(EC(d,f)?-D:D)/R:D=(EC(d,f)?-_:_)*R:p?(_=D/R,f=d):(D=_*R,d=f));const U=d?S+D:S,H=f?C+_:C;return{width:I+(d?-D:D),height:T+(f?-_:_),x:i[0]*D*(d?-1:1)+U,y:i[1]*_*(f?-1:1)+H}}const V3={width:0,height:0,x:0,y:0},Ate={...V3,pointerX:0,pointerY:0,aspectRatio:1};function Pte(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,d=n[1]*a;return[[r-l,o-d],[r+i-l,o+a-d]]}function _te({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=Ir(e);let a={controlDirection:CC("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:w,shouldResize:b}){let j={...V3},N={...Ate};a={boundaries:p,resizeDirection:g,keepAspectRatio:h,controlDirection:CC(f)};let S,C=null,I=[],T,R,D,_=!1;const B=Z_().on("start",$=>{const{nodeLookup:O,transform:z,snapGrid:A,snapToGrid:F,nodeOrigin:U,paneDomNode:H}=n();if(S=O.get(t),!S)return;C=(H==null?void 0:H.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:V}=Wu($.sourceEvent,{transform:z,snapGrid:A,snapToGrid:F,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:L,pointerY:V,aspectRatio:j.width/j.height},T=void 0,R=va(S.extent)?S.extent:void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(T=O.get(S.parentId)),T&&S.extent==="parent"&&(R=[[0,0],[T.measured.width,T.measured.height]]),I=[],D=void 0;for(const[M,W]of O)if(W.parentId===t&&(I.push({id:M,position:{...W.position},extent:W.extent}),W.extent==="parent"||W.expandParent)){const Y=Pte(W,S,W.origin??U);D?D=[[Math.min(Y[0][0],D[0][0]),Math.min(Y[0][1],D[0][1])],[Math.max(Y[1][0],D[1][0]),Math.max(Y[1][1],D[1][1])]]:D=Y}y==null||y($,{...j})}).on("drag",$=>{const{transform:O,snapGrid:z,snapToGrid:A,nodeOrigin:F}=n(),U=Wu($.sourceEvent,{transform:O,snapGrid:z,snapToGrid:A,containerBounds:C}),H=[];if(!S)return;const{x:L,y:V,width:M,height:W}=j,Y={},q=S.origin??F,{width:J,height:ne,x:Q,y:le}=Rte(N,a.controlDirection,U,a.boundaries,a.keepAspectRatio,q,R,D),te=J!==M,pe=ne!==W,be=Q!==L&&te,Ee=le!==V&&pe;if(!be&&!Ee&&!te&&!pe)return;if((be||Ee||q[0]===1||q[1]===1)&&(Y.x=be?Q:j.x,Y.y=Ee?le:j.y,j.x=Y.x,j.y=Y.y,I.length>0)){const oe=Q-L,je=le-V;for(const Se of I)Se.position={x:Se.position.x-oe+q[0]*(J-M),y:Se.position.y-je+q[1]*(ne-W)},H.push(Se)}if((te||pe)&&(Y.width=te&&(!a.resizeDirection||a.resizeDirection==="horizontal")?J:j.width,Y.height=pe&&(!a.resizeDirection||a.resizeDirection==="vertical")?ne:j.height,j.width=Y.width,j.height=Y.height),T&&S.expandParent){const oe=q[0]*(Y.width??0);Y.x&&Y.x<oe&&(j.x=oe,N.x=N.x-(Y.x-oe));const je=q[1]*(Y.height??0);Y.y&&Y.y<je&&(j.y=je,N.y=N.y-(Y.y-je))}const Te=Tte({width:j.width,prevWidth:M,height:j.height,prevHeight:W,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),ke={...j,direction:Te};(b==null?void 0:b($,ke))!==!1&&(_=!0,k==null||k($,ke),r(Y,H))}).on("end",$=>{_&&(w==null||w($,{...j}),o==null||o({...j}),_=!1)});i.call(B)}function d(){i.on(".drag",null)}return{update:l,destroy:d}}var qy={exports:{}},Ky={},Gy={exports:{}},Yy={};/**
|
|
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 TC;function Dte(){if(TC)return Yy;TC=1;var e=vd();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}}),w=k[0].inst,b=k[1];return i(function(){w.value=y,w.getSnapshot=g,d(w)&&b({inst:w})},[h,y,g]),o(function(){return d(w)&&b({inst:w}),h(function(){d(w)&&b({inst:w})})},[h]),a(y),y}function d(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 Yy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Yy}var RC;function $te(){return RC||(RC=1,Gy.exports=Dte()),Gy.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 AC;function Ite(){if(AC)return Ky;AC=1;var e=vd(),t=$te();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,d=e.useDebugValue;return Ky.useSyncExternalStoreWithSelector=function(f,p,h,g,y){var k=i(null);if(k.current===null){var w={hasValue:!1,value:null};k.current=w}else w=k.current;k=l(function(){function j(T){if(!N){if(N=!0,S=T,T=g(T),y!==void 0&&w.hasValue){var R=w.value;if(y(R,T))return C=R}return C=T}if(R=C,r(S,T))return R;var D=g(T);return y!==void 0&&y(R,D)?(S=T,R):(S=T,C=D)}var N=!1,S,C,I=h===void 0?null:h;return[function(){return j(p())},I===null?void 0:function(){return j(I())}]},[p,h,g,y]);var b=o(f,k[0],k[1]);return a(function(){w.hasValue=!0,w.value=b},[b]),d(b),b},Ky}var PC;function Mte(){return PC||(PC=1,qy.exports=Ite()),qy.exports}var Lte=Mte();const Ote=bd(Lte),Fte={},_C=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,d={setState:r,getState:o,getInitialState:()=>f,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Fte?"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,d);return d},zte=e=>e?_C(e):_C,{useDebugValue:Bte}=Mt,{useSyncExternalStoreWithSelector:Ute}=Ote,Hte=e=>e;function W3(e,t=Hte,n){const r=Ute(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Bte(r),r}const DC=(e,t)=>{const n=zte(e),r=(o,i=t)=>W3(n,o,i);return Object.assign(r,n),r},Vte=(e,t)=>e?DC(e,t):DC;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 Qm=m.createContext(null),Wte=Qm.Provider,q3=ws.error001("react");function At(e,t){const n=m.useContext(Qm);if(n===null)throw new Error(q3);return W3(n,e,t)}function on(){const e=m.useContext(Qm);if(e===null)throw new Error(q3);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $C={display:"none"},qte={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},K3="react-flow__node-desc",G3="react-flow__edge-desc",Kte="react-flow__aria-live",Gte=e=>e.ariaLiveMessage,Yte=e=>e.ariaLabelConfig;function Xte({rfId:e}){const t=At(Gte);return s.jsx("div",{id:`${Kte}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:qte,children:t})}function Qte({rfId:e,disableKeyboardA11y:t}){const n=At(Yte);return s.jsxs(s.Fragment,{children:[s.jsx("div",{id:`${K3}-${e}`,style:$C,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),s.jsx("div",{id:`${G3}-${e}`,style:$C,children:n["edge.a11yDescription.default"]}),!t&&s.jsx(Xte,{rfId:e})]})}const Gd=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const a=`${e}`.split("-");return s.jsx("div",{className:kn(["react-flow__panel",n,...a]),style:r,ref:i,...o,children:t})});Gd.displayName="Panel";function Jte({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:s.jsx(Gd,{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 Zte=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}},jp=e=>e.id;function ene(e,t){return sn(e.selectedNodes.map(jp),t.selectedNodes.map(jp))&&sn(e.selectedEdges.map(jp),t.selectedEdges.map(jp))}function tne({onSelectionChange:e}){const t=on(),{selectedNodes:n,selectedEdges:r}=At(Zte,ene);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 nne=e=>!!e.onSelectionChangeHandlers;function rne({onSelectionChange:e}){const t=At(nne);return e||t?s.jsx(tne,{onSelectionChange:e}):null}const Y3=[0,0],sne={x:0,y:0,zoom:1},one=["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"],IC=[...one,"rfId"],ine=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}),MC={translateExtent:fd,nodeOrigin:Y3,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ane(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:d}=At(ine,sn),f=on();m.useEffect(()=>(d(e.defaultNodes,e.defaultEdges),()=>{p.current=MC,l()}),[]);const p=m.useRef(MC);return m.useEffect(()=>{for(const h of IC){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:Wee(g)}):h==="fitView"?f.setState({fitViewQueued:g}):h==="fitViewOptions"?f.setState({fitViewOptions:g}):f.setState({[h]:g})))}p.current=e},IC.map(h=>e[h])),null}function LC(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function lne(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const o=LC(),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=LC())!=null&&r.matches?"dark":"light"}const OC=typeof document<"u"?document:null;function xd(e=null,t={target:OC,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 d=(t==null?void 0:t.target)??OC,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)&&T3(y))return!1;const w=zC(y.code,l);if(i.current.add(y[w]),FC(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=zC(y.code,l);FC(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 d==null||d.addEventListener("keydown",p),d==null||d.addEventListener("keyup",h),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{d==null||d.removeEventListener("keydown",p),d==null||d.removeEventListener("keyup",h),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function FC(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function zC(e,t){return t.includes(e)?"code":"key"}const cne=()=>{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(),d=w0(t,r,o,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(d,{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:d}=a.getBoundingClientRect(),f={x:t.x-l,y:t.y-d},p=n.snapGrid??o,h=n.snapToGrid??i;return Cc(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=nc(t,n);return{x:a.x+o,y:a.y+i}}}),[])};function X3(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 d of a)une(d,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 une(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 Q3(e,t){return X3(e,t)}function J3(e,t){return X3(e,t)}function Zi(e,t){return{id:e,type:"select",selected:t}}function El(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(Zi(i.id,a)))}return r}function BC({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),d=((o=l==null?void 0:l.internals)==null?void 0:o.userNode)??l;d!==void 0&&d!==a&&n.push({id:a.id,item:a,type:"replace"}),d===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 UC(e){return{id:e.id,type:"remove"}}const dne=S3();function fne(e,t,n={}){return Qee(e,t,{...n,onError:n.onError??dne})}const HC=e=>Mee(e),pne=e=>v3(e);function Z3(e){return m.forwardRef(e)}const hne=typeof window<"u"?m.useLayoutEffect:m.useEffect;function VC(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>mne(()=>n(o=>o+BigInt(1))));return hne(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function mne(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const eD=m.createContext(null);function gne({children:e}){const t=on(),n=m.useCallback(l=>{const{nodes:d=[],setNodes:f,hasDefaultNodes:p,onNodesChange:h,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:k}=t.getState();let w=d;for(const j of l)w=typeof j=="function"?j(w):j;let b=BC({items:w,lookup:g});for(const j of k.values())b=j(b);p&&f(w),b.length>0?h==null||h(b):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:j,nodes:N,setNodes:S}=t.getState();j&&S(N)})},[]),r=VC(n),o=m.useCallback(l=>{const{edges:d=[],setEdges:f,hasDefaultEdges:p,onEdgesChange:h,edgeLookup:g}=t.getState();let y=d;for(const k of l)y=typeof k=="function"?k(y):k;p?f(y):h&&h(BC({items:y,lookup:g}))},[]),i=VC(o),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return s.jsx(eD.Provider,{value:a,children:e})}function xne(){const e=m.useContext(eD);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const yne=e=>!!e.panZoom;function Jm(){const e=cne(),t=on(),n=xne(),r=At(yne),o=m.useMemo(()=>{const i=h=>t.getState().nodeLookup.get(h),a=h=>{n.nodeQueue.push(h)},l=h=>{n.edgeQueue.push(h)},d=h=>{var j,N;const{nodeLookup:g,nodeOrigin:y}=t.getState(),k=HC(h)?h:g.get(h.id),w=k.parentId?C3(k.position,k.measured,k.parentId,g,y):k.position,b={...k,position:w,width:((j=k.measured)==null?void 0:j.width)??k.width,height:((N=k.measured)==null?void 0:N.height)??k.height};return tc(b)},f=(h,g,y={replace:!1})=>{a(k=>k.map(w=>{if(w.id===h){const b=typeof g=="function"?g(w):g;return y.replace&&HC(b)?b:{...w,...b}}return w}))},p=(h,g,y={replace:!1})=>{l(k=>k.map(w=>{if(w.id===h){const b=typeof g=="function"?g(w):g;return y.replace&&pne(b)?b:{...w,...b}}return w}))};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,w,b]=y;return{nodes:h.map(j=>({...j})),edges:g.map(j=>({...j})),viewport:{x:k,y:w,zoom:b}}},deleteElements:async({nodes:h=[],edges:g=[]})=>{const{nodes:y,edges:k,onNodesDelete:w,onEdgesDelete:b,triggerNodeChanges:j,triggerEdgeChanges:N,onDelete:S,onBeforeDelete:C}=t.getState(),{nodes:I,edges:T}=await Bee({nodesToRemove:h,edgesToRemove:g,nodes:y,edges:k,onBeforeDelete:C}),R=T.length>0,D=I.length>0;if(R){const _=T.map(UC);b==null||b(T),N(_)}if(D){const _=I.map(UC);w==null||w(I),j(_)}return(D||R)&&(S==null||S({nodes:I,edges:T})),{deletedNodes:I,deletedEdges:T}},getIntersectingNodes:(h,g=!0,y)=>{const k=mC(h),w=k?h:d(h),b=y!==void 0;return w?(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=tc(b?j:N),C=md(S,w);return g&&C>0||C>=S.width*S.height||C>=w.width*w.height}):[]},isNodeIntersecting:(h,g,y=!0)=>{const w=mC(h)?h:d(h);if(!w)return!1;const b=md(w,g);return y&&b>0||b>=g.width*g.height||b>=w.width*w.height},updateNode:f,updateNodeData:(h,g,y={replace:!1})=>{f(h,k=>{const w=typeof g=="function"?g(k):g;return y.replace?{...k,data:w}:{...k,data:{...k.data,...w}}},y)},updateEdge:p,updateEdgeData:(h,g,y={replace:!1})=>{p(h,k=>{const w=typeof g=="function"?g(k):g;return y.replace?{...k,data:w}:{...k,data:{...k.data,...w}}},y)},getNodesBounds:h=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return Lee(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??Vee();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 WC=e=>e.selected,bne=typeof window<"u"?window:void 0;function vne({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=on(),{deleteElements:r}=Jm(),o=xd(e,{actInsideInputWithModifier:!1}),i=xd(t,{target:bne});m.useEffect(()=>{if(o){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(WC),edges:a.filter(WC)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function wne(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=j0(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",ws.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 Zm={position:"absolute",width:"100%",height:"100%",top:0,left:0},jne=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function kne({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=pa.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:d,translateExtent:f,minZoom:p,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:y=!0,children:k,noWheelClassName:w,noPanClassName:b,onViewportChange:j,isControlledViewport:N,paneClickDistance:S,selectionOnDrag:C}){const I=on(),T=m.useRef(null),{userSelectionActive:R,lib:D,connectionInProgress:_}=At(jne,sn),B=xd(g),$=m.useRef();wne(T);const O=m.useCallback(z=>{j==null||j({x:z[0],y:z[1],zoom:z[2]}),N||I.setState({transform:z})},[j,N]);return m.useEffect(()=>{if(T.current){$.current=Ete({domNode:T.current,minZoom:p,maxZoom:h,translateExtent:f,viewport:d,onDraggingChange:U=>I.setState(H=>H.paneDragging===U?H:{paneDragging:U}),onPanZoomStart:(U,H)=>{const{onViewportChangeStart:L,onMoveStart:V}=I.getState();V==null||V(U,H),L==null||L(H)},onPanZoom:(U,H)=>{const{onViewportChange:L,onMove:V}=I.getState();V==null||V(U,H),L==null||L(H)},onPanZoomEnd:(U,H)=>{const{onViewportChangeEnd:L,onMoveEnd:V}=I.getState();V==null||V(U,H),L==null||L(H)}});const{x:z,y:A,zoom:F}=$.current.getViewport();return I.setState({panZoom:$.current,transform:[z,A,F],domNode:T.current.closest(".react-flow")}),()=>{var U;(U=$.current)==null||U.destroy()}}},[]),m.useEffect(()=>{var z;(z=$.current)==null||z.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:B,preventScrolling:y,noPanClassName:b,userSelectionActive:R,noWheelClassName:w,lib:D,onTransformChange:O,connectionInProgress:_,selectionOnDrag:C,paneClickDistance:S})},[e,t,n,r,o,i,a,l,B,y,b,R,w,D,O,_,C,S]),s.jsx("div",{className:"react-flow__renderer",ref:T,style:Zm,children:k})}const Sne=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Nne(){const{userSelectionActive:e,userSelectionRect:t}=At(Sne,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 Xy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Cne=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Ene({isSelecting:e,selectionKeyPressed:t,selectionMode:n=pd.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:d,onPaneClick:f,onPaneContextMenu:p,onPaneScroll:h,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:k,children:w}){const b=m.useRef(0),j=on(),{userSelectionActive:N,elementsSelectable:S,dragging:C,connectionInProgress:I,panBy:T,autoPanSpeed:R}=At(Cne,sn),D=S&&(e||N),_=m.useRef(null),B=m.useRef(),$=m.useRef(new Set),O=m.useRef(new Set),z=m.useRef(!1),A=m.useRef({x:0,y:0}),F=m.useRef(!1),U=te=>{if(z.current||I){z.current=!1;return}f==null||f(te),j.getState().resetSelectedElements(),j.setState({nodesSelectionActive:!1})},H=te=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){te.preventDefault();return}p==null||p(te)},L=h?te=>h(te):void 0,V=te=>{z.current&&(te.stopPropagation(),z.current=!1)},M=te=>{var Se,De;const{domNode:pe,transform:be}=j.getState();if(B.current=pe==null?void 0:pe.getBoundingClientRect(),!B.current)return;const Ee=te.target===_.current;if(!Ee&&!!te.target.closest(".nokey")||!e||!(a&&Ee||t)||te.button!==0||!te.isPrimary)return;(De=(Se=te.target)==null?void 0:Se.setPointerCapture)==null||De.call(Se,te.pointerId),z.current=!1;const{x:Ue,y:oe}=hs(te.nativeEvent,B.current),je=Cc({x:Ue,y:oe},be);j.setState({userSelectionRect:{width:0,height:0,startX:je.x,startY:je.y,x:Ue,y:oe}}),Ee||(te.stopPropagation(),te.preventDefault())};function W(te,pe){const{userSelectionRect:be}=j.getState();if(!be)return;const{transform:Ee,nodeLookup:Te,edgeLookup:ke,connectionLookup:Ue,triggerNodeChanges:oe,triggerEdgeChanges:je,defaultEdgeOptions:Se}=j.getState(),De={x:be.startX,y:be.startY},{x:ze,y:Ye}=nc(De,Ee),Oe={startX:De.x,startY:De.y,x:te<ze?te:ze,y:pe<Ye?pe:Ye,width:Math.abs(te-ze),height:Math.abs(pe-Ye)},nt=$.current,wt=O.current;$.current=new Set(b0(Te,Oe,Ee,n===pd.Partial,!0).map(st=>st.id)),O.current=new Set;const it=(Se==null?void 0:Se.selectable)??!0;for(const st of $.current){const ce=Ue.get(st);if(ce)for(const{edgeId:ee}of ce.values()){const xe=ke.get(ee);xe&&(xe.selectable??it)&&O.current.add(ee)}}if(!gC(nt,$.current)){const st=El(Te,$.current,!0);oe(st)}if(!gC(wt,O.current)){const st=El(ke,O.current);je(st)}j.setState({userSelectionRect:Oe,userSelectionActive:!0,nodesSelectionActive:!1})}function Y(){if(!o||!B.current)return;const[te,pe]=v0(A.current,B.current,R);T({x:te,y:pe}).then(be=>{if(!z.current||!be){b.current=requestAnimationFrame(Y);return}const{x:Ee,y:Te}=A.current;W(Ee,Te),b.current=requestAnimationFrame(Y)})}const q=()=>{cancelAnimationFrame(b.current),b.current=0,F.current=!1};m.useEffect(()=>()=>q(),[]);const J=te=>{const{userSelectionRect:pe,transform:be,resetSelectedElements:Ee}=j.getState();if(!B.current||!pe)return;const{x:Te,y:ke}=hs(te.nativeEvent,B.current);A.current={x:Te,y:ke};const Ue=nc({x:pe.startX,y:pe.startY},be);if(!z.current){const oe=t?0:i;if(Math.hypot(Te-Ue.x,ke-Ue.y)<=oe)return;Ee(),l==null||l(te)}z.current=!0,F.current||(Y(),F.current=!0),W(Te,ke)},ne=te=>{var pe,be;te.button===0&&((be=(pe=te.target)==null?void 0:pe.releasePointerCapture)==null||be.call(pe,te.pointerId),!N&&te.target===_.current&&j.getState().userSelectionRect&&(U==null||U(te)),j.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(d==null||d(te),j.setState({nodesSelectionActive:$.current.size>0})),q())},Q=te=>{var pe,be;(be=(pe=te.target)==null?void 0:pe.releasePointerCapture)==null||be.call(pe,te.pointerId),q()},le=r===!0||Array.isArray(r)&&r.includes(0);return s.jsxs("div",{className:kn(["react-flow__pane",{draggable:le,dragging:C,selection:e}]),onClick:D?void 0:Xy(U,_),onContextMenu:Xy(H,_),onWheel:Xy(L,_),onPointerEnter:D?void 0:g,onPointerMove:D?J:y,onPointerUp:D?ne:void 0,onPointerCancel:D?Q:void 0,onPointerDownCapture:D?M:void 0,onClickCapture:D?V:void 0,onPointerLeave:k,ref:_,style:Zm,children:[w,s.jsx(Nne,{})]})}function yv({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:d}=t.getState(),f=l.get(e);if(!f){d==null||d("012",ws.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 tD({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:a}){const l=on(),[d,f]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=pte({getStoreItems:()=>l.getState(),onNodeMouseDown:h=>{yv({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]),d}const Tne=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function nD(){const e=on();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:d,nodeLookup:f,nodeOrigin:p}=e.getState(),h=new Map,g=Tne(a),y=o?i[0]:5,k=o?i[1]:5,w=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+w,y:j.internals.positionAbsolute.y+b};o&&(N=Kd(N,i));const{position:S,positionAbsolute:C}=w3({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)}d(h)},[])}const T0=m.createContext(null),Rne=T0.Provider;T0.Consumer;const rD=()=>m.useContext(T0),Ane=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Pne=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:d,isValid:f}=a,p=(d==null?void 0:d.nodeId)===e&&(d==null?void 0:d.id)===t&&(d==null?void 0:d.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===Zl.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 _ne({type:e="source",position:t=ot.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:d,className:f,onMouseDown:p,onTouchStart:h,...g},y){var F,U;const k=a||null,w=e==="target",b=on(),j=rD(),{connectOnClick:N,noPanClassName:S,rfId:C}=At(Ane,sn),{connectingFrom:I,connectingTo:T,clickConnecting:R,isPossibleEndHandle:D,connectionInProcess:_,clickConnectionInProcess:B,valid:$}=At(Pne(j,k,e),sn);j||(U=(F=b.getState()).onError)==null||U.call(F,"010",ws.error010());const O=H=>{const{defaultEdgeOptions:L,onConnect:V,hasDefaultEdges:M}=b.getState(),W={...L,...H};if(M){const{edges:Y,setEdges:q,onError:J}=b.getState();q(fne(W,Y,{onError:J}))}V==null||V(W),l==null||l(W)},z=H=>{if(!j)return;const L=R3(H.nativeEvent);if(o&&(L&&H.button===0||!L)){const V=b.getState();xv.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:V.autoPanOnConnect,connectionMode:V.connectionMode,connectionRadius:V.connectionRadius,domNode:V.domNode,nodeLookup:V.nodeLookup,lib:V.lib,isTarget:w,handleId:k,nodeId:j,flowId:V.rfId,panBy:V.panBy,cancelConnection:V.cancelConnection,onConnectStart:V.onConnectStart,onConnectEnd:(...M)=>{var W,Y;return(Y=(W=b.getState()).onConnectEnd)==null?void 0:Y.call(W,...M)},updateConnection:V.updateConnection,onConnect:O,isValidConnection:n||((...M)=>{var W,Y;return((Y=(W=b.getState()).isValidConnection)==null?void 0:Y.call(W,...M))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:V.autoPanSpeed,dragThreshold:V.connectionDragThreshold})}L?p==null||p(H):h==null||h(H)},A=H=>{const{onClickConnectStart:L,onClickConnectEnd:V,connectionClickStartHandle:M,connectionMode:W,isValidConnection:Y,lib:q,rfId:J,nodeLookup:ne,connection:Q}=b.getState();if(!j||!M&&!o)return;if(!M){L==null||L(H.nativeEvent,{nodeId:j,handleId:k,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:j,type:e,id:k}});return}const le=E3(H.target),te=n||Y,{connection:pe,isValid:be}=xv.isValid(H.nativeEvent,{handle:{nodeId:j,id:k,type:e},connectionMode:W,fromNodeId:M.nodeId,fromHandleId:M.id||null,fromType:M.type,isValidConnection:te,flowId:J,doc:le,lib:q,nodeLookup:ne});be&&pe&&O(pe);const Ee=structuredClone(Q);delete Ee.inProgress,Ee.toPosition=Ee.toHandle?Ee.toHandle.position:null,V==null||V(H,Ee),b.setState({connectionClickStartHandle:null})};return s.jsx("div",{"data-handleid":k,"data-nodeid":j,"data-handlepos":t,"data-id":`${C}-${j}-${k}-${e}`,className:kn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,f,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:i,clickconnecting:R,connectingfrom:I,connectingto:T,valid:$,connectionindicator:r&&(!_||D)&&(_||B?i:o)}]),onMouseDown:z,onTouchStart:z,onClick:N?A:void 0,ref:y,...g,children:d})}const sc=m.memo(Z3(_ne));function Dne({data:e,isConnectable:t,sourcePosition:n=ot.Bottom}){return s.jsxs(s.Fragment,{children:[e==null?void 0:e.label,s.jsx(sc,{type:"source",position:n,isConnectable:t})]})}function $ne({data:e,isConnectable:t,targetPosition:n=ot.Top,sourcePosition:r=ot.Bottom}){return s.jsxs(s.Fragment,{children:[s.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,s.jsx(sc,{type:"source",position:r,isConnectable:t})]})}function Ine(){return null}function Mne({data:e,isConnectable:t,targetPosition:n=ot.Top}){return s.jsxs(s.Fragment,{children:[s.jsx(sc,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ih={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},qC={input:Dne,default:$ne,output:Mne,group:Ine};function Lne(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 One=e=>{const{width:t,height:n,x:r,y:o}=qd(e.nodeLookup,{filter:i=>!!i.selected});return{width:ps(t)?t:null,height:ps(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 Fne({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=on(),{width:o,height:i,transformString:a,userSelectionActive:l}=At(One,sn),d=nD(),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(tD({nodeRef:f,disabled:!p}),!p)return null;const h=e?y=>{const k=r.getState().nodes.filter(w=>w.selected);e(y,k)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Ih,y.key)&&(y.preventDefault(),d({direction:Ih[y.key],factor:y.shiftKey?4:1}))};return s.jsx("div",{className:kn(["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 KC=typeof window<"u"?window:void 0,zne=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sD({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:f,selectionOnDrag:p,selectionMode:h,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:k,panActivationKeyCode:w,zoomActivationKeyCode:b,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:S,panOnScroll:C,panOnScrollSpeed:I,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:D,autoPanOnSelection:_,defaultViewport:B,translateExtent:$,minZoom:O,maxZoom:z,preventScrolling:A,onSelectionContextMenu:F,noWheelClassName:U,noPanClassName:H,disableKeyboardA11y:L,onViewportChange:V,isControlledViewport:M}){const{nodesSelectionActive:W,userSelectionActive:Y}=At(zne,sn),q=xd(f,{target:KC}),J=xd(w,{target:KC}),ne=J||D,Q=J||C,le=p&&ne!==!0,te=q||Y||le;return vne({deleteKeyCode:d,multiSelectionKeyCode:k}),s.jsx(kne,{onPaneContextMenu:i,elementsSelectable:j,zoomOnScroll:N,zoomOnPinch:S,panOnScroll:Q,panOnScrollSpeed:I,panOnScrollMode:T,zoomOnDoubleClick:R,panOnDrag:!q&&ne,defaultViewport:B,translateExtent:$,minZoom:O,maxZoom:z,zoomActivationKeyCode:b,preventScrolling:A,noWheelClassName:U,noPanClassName:H,onViewportChange:V,isControlledViewport:M,paneClickDistance:l,selectionOnDrag:le,children:s.jsxs(Ene,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ne,autoPanOnSelection:_,isSelecting:!!te,selectionMode:h,selectionKeyPressed:q,paneClickDistance:l,selectionOnDrag:le,children:[e,W&&s.jsx(Fne,{onSelectionContextMenu:F,noPanClassName:H,disableKeyboardA11y:L})]})})}sD.displayName="FlowRenderer";const Bne=m.memo(sD),Une=e=>t=>e?b0(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 Hne(e){return At(m.useCallback(Une(e),[e]),sn)}const Vne=e=>e.updateNodeInternals;function Wne(){const e=At(Vne),[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 qne({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=on(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),d=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=d.current!==e.targetPosition;(h||g||y)&&(f.current=t,l.current=e.sourcePosition,d.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 Kne({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:d,nodesConnectable:f,nodesFocusable:p,resizeObserver:h,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:k,rfId:w,nodeTypes:b,nodeClickDistance:j,onError:N}){const{node:S,internals:C,isParent:I}=At(te=>{const pe=te.nodeLookup.get(e),be=te.parentLookup.has(e);return{node:pe,internals:pe.internals,isParent:be}},sn);let T=S.type||"default",R=(b==null?void 0:b[T])||qC[T];R===void 0&&(N==null||N("003",ws.error003(T)),T="default",R=(b==null?void 0:b.default)||qC.default);const D=!!(S.draggable||l&&typeof S.draggable>"u"),_=!!(S.selectable||d&&typeof S.selectable>"u"),B=!!(S.connectable||f&&typeof S.connectable>"u"),$=!!(S.focusable||p&&typeof S.focusable>"u"),O=on(),z=N3(S),A=qne({node:S,nodeType:T,hasDimensions:z,resizeObserver:h}),F=tD({nodeRef:A,disabled:S.hidden||!D,noDragClassName:g,handleSelector:S.dragHandle,nodeId:e,isSelectable:_,nodeClickDistance:j}),U=nD();if(S.hidden)return null;const H=To(S),L=Lne(S),V=_||D||t||n||r||o,M=n?te=>n(te,{...C.userNode}):void 0,W=r?te=>r(te,{...C.userNode}):void 0,Y=o?te=>o(te,{...C.userNode}):void 0,q=i?te=>i(te,{...C.userNode}):void 0,J=a?te=>a(te,{...C.userNode}):void 0,ne=te=>{const{selectNodesOnDrag:pe,nodeDragThreshold:be}=O.getState();_&&(!pe||!D||be>0)&&yv({id:e,store:O,nodeRef:A}),t&&t(te,{...C.userNode})},Q=te=>{if(!(T3(te.nativeEvent)||k)){if(g3.includes(te.key)&&_){const pe=te.key==="Escape";yv({id:e,store:O,unselect:pe,nodeRef:A})}else if(D&&S.selected&&Object.prototype.hasOwnProperty.call(Ih,te.key)){te.preventDefault();const{ariaLabelConfig:pe}=O.getState();O.setState({ariaLiveMessage:pe["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),U({direction:Ih[te.key],factor:te.shiftKey?4:1})}}},le=()=>{var Ue;if(k||!((Ue=A.current)!=null&&Ue.matches(":focus-visible")))return;const{transform:te,width:pe,height:be,autoPanOnNodeFocus:Ee,setCenter:Te}=O.getState();if(!Ee)return;b0(new Map([[e,S]]),{x:0,y:0,width:pe,height:be},te,!0).length>0||Te(S.position.x+H.width/2,S.position.y+H.height/2,{zoom:te[2]})};return s.jsx("div",{className:kn(["react-flow__node",`react-flow__node-${T}`,{[y]:D},S.className,{selected:S.selected,selectable:_,parent:I,draggable:D,dragging:F}]),ref:A,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:V?"all":"none",visibility:z?"visible":"hidden",...S.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:M,onMouseMove:W,onMouseLeave:Y,onContextMenu:q,onClick:ne,onDoubleClick:J,onKeyDown:$?Q:void 0,tabIndex:$?0:void 0,onFocus:$?le:void 0,role:S.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":k?void 0:`${K3}-${w}`,"aria-label":S.ariaLabel,...S.domAttributes,children:s.jsx(Rne,{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:D,deletable:S.deletable??!0,isConnectable:B,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:F,dragHandle:S.dragHandle,zIndex:C.z,parentId:S.parentId,...H})})})}var Gne=m.memo(Kne);const Yne=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function oD(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=At(Yne,sn),a=Hne(e.onlyRenderVisibleElements),l=Wne();return s.jsx("div",{className:"react-flow__nodes",style:Zm,children:a.map(d=>s.jsx(Gne,{id:d,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},d))})}oD.displayName="NodeRenderer";const Xne=m.memo(oD);function Qne(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&&Gee({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),sn)}const Jne=({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"})},Zne=({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"})},GC={[hd.Arrow]:Jne,[hd.ArrowClosed]:Zne};function ere(e){const t=on();return m.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(GC,e)?GC[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",ws.error009(e)),null)},[e])}const tre=({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 d=ere(t);return d?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(d,{color:n,strokeWidth:a})}):null},iD=({defaultColor:e,rfId:t})=>{const n=At(i=>i.edges),r=At(i=>i.defaultEdgeOptions),o=m.useMemo(()=>nte(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(tre,{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};iD.displayName="MarkerDefinitions";var nre=m.memo(iD);function aD({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:d,className:f,...p}){const[h,g]=m.useState({x:1,y:0,width:0,height:0}),y=kn(["react-flow__edge-textwrapper",f]),k=m.useRef(null);return m.useEffect(()=>{if(k.current){const w=k.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.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}),d]}):null}aD.displayName="EdgeText";const rre=m.memo(aD);function eg({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d,interactionWidth:f=20,...p}){return s.jsxs(s.Fragment,{children:[s.jsx("path",{...p,d:e,fill:"none",className:kn(["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&&ps(t)&&ps(n)?s.jsx(rre,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:d}):null]})}function YC({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===ot.Left||e===ot.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function lD({sourceX:e,sourceY:t,sourcePosition:n=ot.Bottom,targetX:r,targetY:o,targetPosition:i=ot.Top}){const[a,l]=YC({pos:n,x1:e,y1:t,x2:r,y2:o}),[d,f]=YC({pos:i,x1:r,y1:o,x2:e,y2:t}),[p,h,g,y]=A3({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:d,targetControlY:f});return[`M${e},${t} C${a},${l} ${d},${f} ${r},${o}`,p,h,g,y]}function cD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a,targetPosition:l,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:w,markerStart:b,interactionWidth:j})=>{const[N,S,C]=lD({sourceX:n,sourceY:r,sourcePosition:a,targetX:o,targetY:i,targetPosition:l}),I=e.isInternal?void 0:t;return s.jsx(eg,{id:I,path:N,labelX:S,labelY:C,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:w,markerStart:b,interactionWidth:j})})}const sre=cD({isInternal:!1}),uD=cD({isInternal:!0});sre.displayName="SimpleBezierEdge";uD.displayName="SimpleBezierEdgeInternal";function dD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,sourcePosition:y=ot.Bottom,targetPosition:k=ot.Top,markerEnd:w,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[S,C,I]=hv({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(eg,{id:T,path:S,labelX:C,labelY:I,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:b,interactionWidth:N})})}const fD=dD({isInternal:!1}),pD=dD({isInternal:!0});fD.displayName="SmoothStepEdge";pD.displayName="SmoothStepEdgeInternal";function hD(e){return m.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return s.jsx(fD,{...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 ore=hD({isInternal:!1}),mD=hD({isInternal:!0});ore.displayName="StepEdge";mD.displayName="StepEdgeInternal";function gD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:w})=>{const[b,j,N]=D3({sourceX:n,sourceY:r,targetX:o,targetY:i}),S=e.isInternal?void 0:t;return s.jsx(eg,{id:S,path:b,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:k,interactionWidth:w})})}const ire=gD({isInternal:!1}),xD=gD({isInternal:!0});ire.displayName="StraightEdge";xD.displayName="StraightEdgeInternal";function yD(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:a=ot.Bottom,targetPosition:l=ot.Top,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:w,markerStart:b,pathOptions:j,interactionWidth:N})=>{const[S,C,I]=P3({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(eg,{id:T,path:S,labelX:C,labelY:I,label:d,labelStyle:f,labelShowBg:p,labelBgStyle:h,labelBgPadding:g,labelBgBorderRadius:y,style:k,markerEnd:w,markerStart:b,interactionWidth:N})})}const are=yD({isInternal:!1}),bD=yD({isInternal:!0});are.displayName="BezierEdge";bD.displayName="BezierEdgeInternal";const XC={default:bD,straight:xD,step:mD,smoothstep:pD,simplebezier:uD},QC={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},lre=(e,t,n)=>n===ot.Left?e-t:n===ot.Right?e+t:e,cre=(e,t,n)=>n===ot.Top?e-t:n===ot.Bottom?e+t:e,JC="react-flow__edgeupdater";function ZC({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:kn([JC,`${JC}-${l}`]),cx:lre(t,r,e),cy:cre(n,r,e),r,stroke:"transparent",fill:"transparent"})}function ure({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:a,sourcePosition:l,targetPosition:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,setReconnecting:g,setUpdateHover:y}){const k=on(),w=(C,I)=>{if(C.button!==0)return;const{autoPanOnConnect:T,domNode:R,connectionMode:D,connectionRadius:_,lib:B,onConnectStart:$,cancelConnection:O,nodeLookup:z,rfId:A,panBy:F,updateConnection:U}=k.getState(),H=I.type==="target",L=(W,Y)=>{g(!1),h==null||h(W,n,I.type,Y)},V=W=>f==null?void 0:f(n,W),M=(W,Y)=>{g(!0),p==null||p(C,n,I.type),$==null||$(W,Y)};xv.onPointerDown(C.nativeEvent,{autoPanOnConnect:T,connectionMode:D,connectionRadius:_,domNode:R,handleId:I.id,nodeId:I.nodeId,nodeLookup:z,isTarget:H,edgeUpdaterType:I.type,lib:B,flowId:A,cancelConnection:O,panBy:F,isValidConnection:(...W)=>{var Y,q;return((q=(Y=k.getState()).isValidConnection)==null?void 0:q.call(Y,...W))??!0},onConnect:V,onConnectStart:M,onConnectEnd:(...W)=>{var Y,q;return(q=(Y=k.getState()).onConnectEnd)==null?void 0:q.call(Y,...W)},onReconnectEnd:L,updateConnection:U,getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,dragThreshold:k.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},b=C=>w(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),j=C=>w(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(ZC,{position:l,centerX:r,centerY:o,radius:t,onMouseDown:b,onMouseEnter:N,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&s.jsx(ZC,{position:d,centerX:i,centerY:a,radius:t,onMouseDown:j,onMouseEnter:N,onMouseOut:S,type:"target"})]})}function dre({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:d,onMouseLeave:f,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,rfId:k,edgeTypes:w,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 I=S.type||"default",T=(w==null?void 0:w[I])||XC[I];T===void 0&&(j==null||j("011",ws.error011(I)),I="default",T=(w==null?void 0:w.default)||XC.default);const R=!!(S.focusable||t&&typeof S.focusable>"u"),D=typeof h<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),_=!!(S.selectable||r&&typeof S.selectable>"u"),B=m.useRef(null),[$,O]=m.useState(!1),[z,A]=m.useState(!1),F=on(),{zIndex:U,sourceX:H,sourceY:L,targetX:V,targetY:M,sourcePosition:W,targetPosition:Y}=At(m.useCallback(Te=>{const ke=Te.nodeLookup.get(S.source),Ue=Te.nodeLookup.get(S.target);if(!ke||!Ue)return{zIndex:S.zIndex,...QC};const oe=tte({id:e,sourceNode:ke,targetNode:Ue,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:Te.connectionMode,onError:j});return{zIndex:Kee({selected:S.selected,zIndex:S.zIndex,sourceNode:ke,targetNode:Ue,elevateOnSelect:Te.elevateEdgesOnSelect,zIndexMode:Te.zIndexMode}),...oe||QC}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),sn),q=m.useMemo(()=>S.markerStart?`url('#${mv(S.markerStart,k)}')`:void 0,[S.markerStart,k]),J=m.useMemo(()=>S.markerEnd?`url('#${mv(S.markerEnd,k)}')`:void 0,[S.markerEnd,k]);if(S.hidden||H===null||L===null||V===null||M===null)return null;const ne=Te=>{var je;const{addSelectedEdges:ke,unselectNodesAndEdges:Ue,multiSelectionActive:oe}=F.getState();_&&(F.setState({nodesSelectionActive:!1}),S.selected&&oe?(Ue({nodes:[],edges:[S]}),(je=B.current)==null||je.blur()):ke([e])),o&&o(Te,S)},Q=i?Te=>{i(Te,{...S})}:void 0,le=a?Te=>{a(Te,{...S})}:void 0,te=l?Te=>{l(Te,{...S})}:void 0,pe=d?Te=>{d(Te,{...S})}:void 0,be=f?Te=>{f(Te,{...S})}:void 0,Ee=Te=>{var ke;if(!N&&g3.includes(Te.key)&&_){const{unselectNodesAndEdges:Ue,addSelectedEdges:oe}=F.getState();Te.key==="Escape"?((ke=B.current)==null||ke.blur(),Ue({edges:[S]})):oe([e])}};return s.jsx("svg",{style:{zIndex:U},children:s.jsxs("g",{className:kn(["react-flow__edge",`react-flow__edge-${I}`,S.className,b,{selected:S.selected,animated:S.animated,inactive:!_&&!o,updating:$,selectable:_}]),onClick:ne,onDoubleClick:Q,onContextMenu:le,onMouseEnter:te,onMouseMove:pe,onMouseLeave:be,onKeyDown:R?Ee: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?`${G3}-${k}`:void 0,ref:B,...S.domAttributes,children:[!z&&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:H,sourceY:L,targetX:V,targetY:M,sourcePosition:W,targetPosition:Y,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:q,markerEnd:J,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),D&&s.jsx(ure,{edge:S,isReconnectable:D,reconnectRadius:p,onReconnect:h,onReconnectStart:g,onReconnectEnd:y,sourceX:H,sourceY:L,targetX:V,targetY:M,sourcePosition:W,targetPosition:Y,setUpdateHover:O,setReconnecting:A})]})})}var fre=m.memo(dre);const pre=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function vD({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:p,reconnectRadius:h,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,disableKeyboardA11y:w}){const{edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,onError:S}=At(pre,sn),C=Qne(t);return s.jsxs("div",{className:"react-flow__edges",children:[s.jsx(nre,{defaultColor:e,rfId:n}),C.map(I=>s.jsx(fre,{id:I,edgesFocusable:b,edgesReconnectable:j,elementsSelectable:N,noPanClassName:o,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:d,onMouseLeave:f,onClick:p,reconnectRadius:h,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:k,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:w},I))]})}vD.displayName="EdgeRenderer";const hre=m.memo(vD),mre=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function gre({children:e}){const t=At(mre);return s.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function xre(e){const t=Jm(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const yre=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function bre(e){const t=At(yre),n=on();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function vre(e){return e.connection.inProgress?{...e.connection,to:Cc(e.connection.to,e.transform)}:{...e.connection}}function wre(e){return vre}function jre(e){const t=wre();return At(t,sn)}const kre=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Sre({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:a,isValid:l,inProgress:d}=At(kre,sn);return!(i&&o&&d)?null:s.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:s.jsx("g",{className:kn(["react-flow__connection",b3(l)]),children:s.jsx(wD,{style:t,type:n,CustomComponent:r,isValid:l})})})}const wD=({style:e,type:t=fi.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:a,fromHandle:l,fromPosition:d,to:f,toNode:p,toHandle:h,toPosition:g,pointer:y}=jre();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:d,toPosition:g,connectionStatus:b3(r),toNode:p,toHandle:h,pointer:y});let k="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:d,targetX:f.x,targetY:f.y,targetPosition:g};switch(t){case fi.Bezier:[k]=P3(w);break;case fi.SimpleBezier:[k]=lD(w);break;case fi.Step:[k]=hv({...w,borderRadius:0});break;case fi.SmoothStep:[k]=hv(w);break;default:[k]=D3(w)}return s.jsx("path",{d:k,fill:"none",className:"react-flow__connection-path",style:e})};wD.displayName="ConnectionLine";const Nre={};function eE(e=Nre){m.useRef(e),on(),m.useEffect(()=>{},[e])}function Cre(){on(),m.useRef(!1),m.useEffect(()=>{},[])}function jD({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:h,onSelectionStart:g,onSelectionEnd:y,connectionLineType:k,connectionLineStyle:w,connectionLineComponent:b,connectionLineContainerStyle:j,selectionKeyCode:N,selectionOnDrag:S,selectionMode:C,multiSelectionKeyCode:I,panActivationKeyCode:T,zoomActivationKeyCode:R,deleteKeyCode:D,onlyRenderVisibleElements:_,elementsSelectable:B,defaultViewport:$,translateExtent:O,minZoom:z,maxZoom:A,preventScrolling:F,defaultMarkerColor:U,zoomOnScroll:H,zoomOnPinch:L,panOnScroll:V,panOnScrollSpeed:M,panOnScrollMode:W,zoomOnDoubleClick:Y,panOnDrag:q,autoPanOnSelection:J,onPaneClick:ne,onPaneMouseEnter:Q,onPaneMouseMove:le,onPaneMouseLeave:te,onPaneScroll:pe,onPaneContextMenu:be,paneClickDistance:Ee,nodeClickDistance:Te,onEdgeContextMenu:ke,onEdgeMouseEnter:Ue,onEdgeMouseMove:oe,onEdgeMouseLeave:je,reconnectRadius:Se,onReconnect:De,onReconnectStart:ze,onReconnectEnd:Ye,noDragClassName:Oe,noWheelClassName:nt,noPanClassName:wt,disableKeyboardA11y:it,nodeExtent:st,rfId:ce,viewport:ee,onViewportChange:xe}){return eE(e),eE(t),Cre(),xre(n),bre(ee),s.jsx(Bne,{onPaneClick:ne,onPaneMouseEnter:Q,onPaneMouseMove:le,onPaneMouseLeave:te,onPaneContextMenu:be,onPaneScroll:pe,paneClickDistance:Ee,deleteKeyCode:D,selectionKeyCode:N,selectionOnDrag:S,selectionMode:C,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:I,panActivationKeyCode:T,zoomActivationKeyCode:R,elementsSelectable:B,zoomOnScroll:H,zoomOnPinch:L,zoomOnDoubleClick:Y,panOnScroll:V,panOnScrollSpeed:M,panOnScrollMode:W,panOnDrag:q,autoPanOnSelection:J,defaultViewport:$,translateExtent:O,minZoom:z,maxZoom:A,onSelectionContextMenu:h,preventScrolling:F,noDragClassName:Oe,noWheelClassName:nt,noPanClassName:wt,disableKeyboardA11y:it,onViewportChange:xe,isControlledViewport:!!ee,children:s.jsxs(gre,{children:[s.jsx(hre,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:a,onReconnect:De,onReconnectStart:ze,onReconnectEnd:Ye,onlyRenderVisibleElements:_,onEdgeContextMenu:ke,onEdgeMouseEnter:Ue,onEdgeMouseMove:oe,onEdgeMouseLeave:je,reconnectRadius:Se,defaultMarkerColor:U,noPanClassName:wt,disableKeyboardA11y:it,rfId:ce}),s.jsx(Sre,{style:w,type:k,component:b,containerStyle:j}),s.jsx("div",{className:"react-flow__edgelabel-renderer"}),s.jsx(Xne,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,nodeClickDistance:Te,onlyRenderVisibleElements:_,noPanClassName:wt,noDragClassName:Oe,disableKeyboardA11y:it,nodeExtent:st,rfId:ce}),s.jsx("div",{className:"react-flow__viewport-portal"})]})})}jD.displayName="GraphView";const Ere=m.memo(jD),Tre=S3(),tE=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d=.5,maxZoom:f=2,nodeOrigin:p,nodeExtent:h,zIndexMode:g="basic"}={})=>{const y=new Map,k=new Map,w=new Map,b=new Map,j=r??t??[],N=n??e??[],S=p??[0,0],C=h??fd;M3(w,b,j);const{nodesInitialized:I}=gv(N,y,k,{nodeOrigin:S,nodeExtent:C,zIndexMode:g});let T=[0,0,1];if(a&&o&&i){const R=qd(y,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:D,y:_,zoom:B}=w0(R,o,i,d,f,(l==null?void 0:l.padding)??.1);T=[D,_,B]}return{rfId:"1",width:o??0,height:i??0,transform:T,nodes:N,nodesInitialized:I,nodeLookup:y,parentLookup:k,edges:j,edgeLookup:b,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:d,maxZoom:f,translateExtent:fd,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Zl.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:{...y3},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tre,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:x3,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Rre=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g})=>Vte((y,k)=>{async function w(){const{nodeLookup:b,panZoom:j,fitViewOptions:N,fitViewResolver:S,width:C,height:I,minZoom:T,maxZoom:R}=k();j&&(await zee({nodes:b,width:C,height:I,panZoom:j,minZoom:T,maxZoom:R},N),S==null||S.resolve(!0),y({fitViewResolver:null}))}return{...tE({nodes:e,edges:t,width:o,height:i,fitView:a,fitViewOptions:l,minZoom:d,maxZoom:f,nodeOrigin:p,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:b=>{const{nodeLookup:j,parentLookup:N,nodeOrigin:S,elevateNodesOnSelect:C,fitViewQueued:I,zIndexMode:T,nodesSelectionActive:R}=k(),{nodesInitialized:D,hasSelectedNodes:_}=gv(b,j,N,{nodeOrigin:S,nodeExtent:h,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:T}),B=R&&_;I&&D?(w(),y({nodes:b,nodesInitialized:D,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):y({nodes:b,nodesInitialized:D,nodesSelectionActive:B})},setEdges:b=>{const{connectionLookup:j,edgeLookup:N}=k();M3(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:I,nodeExtent:T,debug:R,fitViewQueued:D,zIndexMode:_}=k(),{changes:B,updatedInternals:$}=cte(b,N,S,C,I,T,_);$&&(ote(N,S,{nodeOrigin:I,nodeExtent:T,zIndexMode:_}),D?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(B==null?void 0:B.length)>0&&(R&&console.log("React Flow: trigger node changes",B),j==null||j(B)))},updateNodePositions:(b,j=!1)=>{const N=[];let S=[];const{nodeLookup:C,triggerNodeChanges:I,connection:T,updateConnection:R,onNodesChangeMiddlewareMap:D}=k();for(const[_,B]of b){const $=C.get(_),O=!!($!=null&&$.expandParent&&($!=null&&$.parentId)&&(B!=null&&B.position)),z={id:_,type:"position",position:O?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:j};if($&&T.inProgress&&T.fromNode.id===$.id){const A=wa($,T.fromHandle,ot.Left,!0);R({...T,from:A})}O&&$.parentId&&N.push({id:_,parentId:$.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),S.push(z)}if(N.length>0){const{parentLookup:_,nodeOrigin:B}=k(),$=E0(N,C,_,B);S.push(...$)}for(const _ of D.values())S=_(S);I(S)},triggerNodeChanges:b=>{const{onNodesChange:j,setNodes:N,nodes:S,hasDefaultNodes:C,debug:I}=k();if(b!=null&&b.length){if(C){const T=Q3(b,S);N(T)}I&&console.log("React Flow: trigger node changes",b),j==null||j(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:j,setEdges:N,edges:S,hasDefaultEdges:C,debug:I}=k();if(b!=null&&b.length){if(C){const T=J3(b,S);N(T)}I&&console.log("React Flow: trigger edge changes",b),j==null||j(b)}},addSelectedNodes:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:I}=k();if(j){const T=b.map(R=>Zi(R,!0));C(T);return}C(El(S,new Set([...b]),!0)),I(El(N))},addSelectedEdges:b=>{const{multiSelectionActive:j,edgeLookup:N,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:I}=k();if(j){const T=b.map(R=>Zi(R,!0));I(T);return}I(El(N,new Set([...b]))),C(El(S,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:j}={})=>{const{edges:N,nodes:S,nodeLookup:C,triggerNodeChanges:I,triggerEdgeChanges:T}=k(),R=b||S,D=j||N,_=[];for(const $ of R){if(!$.selected)continue;const O=C.get($.id);O&&(O.selected=!1),_.push(Zi($.id,!1))}const B=[];for(const $ of D)$.selected&&B.push(Zi($.id,!1));I(_),T(B)},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 I=j.reduce((R,D)=>D.selected?[...R,Zi(D.id,!1)]:R,[]),T=b.reduce((R,D)=>D.selected?[...R,Zi(D.id,!1)]:R,[]);N(I),S(T)},setNodeExtent:b=>{const{nodes:j,nodeLookup:N,parentLookup:S,nodeOrigin:C,elevateNodesOnSelect:I,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]||(gv(j,N,S,{nodeOrigin:C,nodeExtent:b,elevateNodesOnSelect:I,checkEquality:!1,zIndexMode:R}),y({nodeExtent:b}))},panBy:b=>{const{transform:j,width:N,height:S,panZoom:C,translateExtent:I}=k();return ute({delta:b,panZoom:C,transform:j,translateExtent:I,width:N,height:S})},setCenter:async(b,j,N)=>{const{width:S,height:C,maxZoom:I,panZoom:T}=k();if(!T)return!1;const R=typeof(N==null?void 0:N.zoom)<"u"?N.zoom:I;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:{...y3}})},updateConnection:b=>{y({connection:b})},reset:()=>y({...tE()})}},Object.is);function Are({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:d,fitView:f,nodeOrigin:p,nodeExtent:h,zIndexMode:g,children:y}){const[k]=m.useState(()=>Rre({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:f,minZoom:a,maxZoom:l,fitViewOptions:d,nodeOrigin:p,nodeExtent:h,zIndexMode:g}));return s.jsx(Wte,{value:k,children:s.jsx(gne,{children:y})})}function Pre({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:a,fitView:l,fitViewOptions:d,minZoom:f,maxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y}){return m.useContext(Qm)?s.jsx(s.Fragment,{children:e}):s.jsx(Are,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:p,nodeOrigin:h,nodeExtent:g,zIndexMode:y,children:e})}const _re={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Dre({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:d,onInit:f,onMove:p,onMoveStart:h,onMoveEnd:g,onConnect:y,onConnectStart:k,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:j,onNodeMouseEnter:N,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:T,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:_,onNodesDelete:B,onEdgesDelete:$,onDelete:O,onSelectionChange:z,onSelectionDragStart:A,onSelectionDrag:F,onSelectionDragStop:U,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:V,onBeforeDelete:M,connectionMode:W,connectionLineType:Y=fi.Bezier,connectionLineStyle:q,connectionLineComponent:J,connectionLineContainerStyle:ne,deleteKeyCode:Q="Backspace",selectionKeyCode:le="Shift",selectionOnDrag:te=!1,selectionMode:pe=pd.Full,panActivationKeyCode:be="Space",multiSelectionKeyCode:Ee=gd()?"Meta":"Control",zoomActivationKeyCode:Te=gd()?"Meta":"Control",snapToGrid:ke,snapGrid:Ue,onlyRenderVisibleElements:oe=!1,selectNodesOnDrag:je,nodesDraggable:Se,autoPanOnNodeFocus:De,nodesConnectable:ze,nodesFocusable:Ye,nodeOrigin:Oe=Y3,edgesFocusable:nt,edgesReconnectable:wt,elementsSelectable:it=!0,defaultViewport:st=sne,minZoom:ce=.5,maxZoom:ee=2,translateExtent:xe=fd,preventScrolling:ie=!0,nodeExtent:we,defaultMarkerColor:$e="#b1b1b7",zoomOnScroll:Ce=!0,zoomOnPinch:se=!0,panOnScroll:me=!1,panOnScrollSpeed:Pe=.5,panOnScrollMode:qe=pa.Free,zoomOnDoubleClick:de=!0,panOnDrag:pt=!0,onPaneClick:yt,onPaneMouseEnter:St,onPaneMouseMove:ct,onPaneMouseLeave:ht,onPaneScroll:Nt,onPaneContextMenu:ye,paneClickDistance:Ve=1,nodeClickDistance:Je=0,children:Ft,onReconnect:zt,onReconnectStart:hn,onReconnectEnd:Et,onEdgeContextMenu:$n,onEdgeDoubleClick:Tt,onEdgeMouseEnter:ue,onEdgeMouseMove:Be,onEdgeMouseLeave:et,reconnectRadius:bt=10,onNodesChange:Kn,onEdgesChange:wr,noDragClassName:rs="nodrag",noWheelClassName:Ta="nowheel",noPanClassName:mt="nopan",fitView:Ti,fitViewOptions:Ro,connectOnClick:Ra,attributionPosition:tn,proOptions:Ao,defaultEdgeOptions:Aa,elevateNodesOnSelect:Pa=!0,elevateEdgesOnSelect:Tc=!1,disableKeyboardA11y:_a=!1,autoPanOnConnect:Ut,autoPanOnNodeDrag:Ri,autoPanOnSelection:eo=!0,autoPanSpeed:Po,connectionRadius:Ts,isValidConnection:_o,onError:Da,style:Do,id:er,nodeDragThreshold:ir,connectionDragThreshold:In,viewport:$o,onViewportChange:Rc,width:Ac,height:Io,colorMode:Un="light",debug:to,onScroll:Br,ariaLabelConfig:$a,zIndexMode:Ai="basic",...Mo},Lo){const Rs=er||"1",Bt=lne(Un),no=m.useCallback(As=>{As.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Br==null||Br(As)},[Br]);return s.jsx("div",{"data-testid":"rf__wrapper",...Mo,onScroll:no,style:{...Do,..._re},ref:Lo,className:kn(["react-flow",o,Bt]),id:er,role:"application",children:s.jsxs(Pre,{nodes:e,edges:t,width:Ac,height:Io,fitView:Ti,fitViewOptions:Ro,minZoom:ce,maxZoom:ee,nodeOrigin:Oe,nodeExtent:we,zIndexMode:Ai,children:[s.jsx(ane,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:k,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:j,nodesDraggable:Se,autoPanOnNodeFocus:De,nodesConnectable:ze,nodesFocusable:Ye,edgesFocusable:nt,edgesReconnectable:wt,elementsSelectable:it,elevateNodesOnSelect:Pa,elevateEdgesOnSelect:Tc,minZoom:ce,maxZoom:ee,nodeExtent:we,onNodesChange:Kn,onEdgesChange:wr,snapToGrid:ke,snapGrid:Ue,connectionMode:W,translateExtent:xe,connectOnClick:Ra,defaultEdgeOptions:Aa,fitView:Ti,fitViewOptions:Ro,onNodesDelete:B,onEdgesDelete:$,onDelete:O,onNodeDragStart:R,onNodeDrag:D,onNodeDragStop:_,onSelectionDrag:F,onSelectionDragStart:A,onSelectionDragStop:U,onMove:p,onMoveStart:h,onMoveEnd:g,noPanClassName:mt,nodeOrigin:Oe,rfId:Rs,autoPanOnConnect:Ut,autoPanOnNodeDrag:Ri,autoPanSpeed:Po,onError:Da,connectionRadius:Ts,isValidConnection:_o,selectNodesOnDrag:je,nodeDragThreshold:ir,connectionDragThreshold:In,onBeforeDelete:M,debug:to,ariaLabelConfig:$a,zIndexMode:Ai}),s.jsx(Ere,{onInit:f,onNodeClick:l,onEdgeClick:d,onNodeMouseEnter:N,onNodeMouseMove:S,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:T,nodeTypes:i,edgeTypes:a,connectionLineType:Y,connectionLineStyle:q,connectionLineComponent:J,connectionLineContainerStyle:ne,selectionKeyCode:le,selectionOnDrag:te,selectionMode:pe,deleteKeyCode:Q,multiSelectionKeyCode:Ee,panActivationKeyCode:be,zoomActivationKeyCode:Te,onlyRenderVisibleElements:oe,defaultViewport:st,translateExtent:xe,minZoom:ce,maxZoom:ee,preventScrolling:ie,zoomOnScroll:Ce,zoomOnPinch:se,zoomOnDoubleClick:de,panOnScroll:me,panOnScrollSpeed:Pe,panOnScrollMode:qe,panOnDrag:pt,autoPanOnSelection:eo,onPaneClick:yt,onPaneMouseEnter:St,onPaneMouseMove:ct,onPaneMouseLeave:ht,onPaneScroll:Nt,onPaneContextMenu:ye,paneClickDistance:Ve,nodeClickDistance:Je,onSelectionContextMenu:H,onSelectionStart:L,onSelectionEnd:V,onReconnect:zt,onReconnectStart:hn,onReconnectEnd:Et,onEdgeContextMenu:$n,onEdgeDoubleClick:Tt,onEdgeMouseEnter:ue,onEdgeMouseMove:Be,onEdgeMouseLeave:et,reconnectRadius:bt,defaultMarkerColor:$e,noDragClassName:rs,noWheelClassName:Ta,noPanClassName:mt,rfId:Rs,disableKeyboardA11y:_a,nodeExtent:we,viewport:$o,onViewportChange:Rc}),s.jsx(rne,{onSelectionChange:z}),Ft,s.jsx(Jte,{proOptions:Ao,position:tn}),s.jsx(Qte,{rfId:Rs,disableKeyboardA11y:_a})]})})}var $re=Z3(Dre);function Ire(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>Q3(o,i)),[]);return[t,n,r]}function Mre(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>J3(o,i)),[]);return[t,n,r]}function Lre({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:kn(["react-flow__background-pattern",n,r])})}function Ore({radius:e,className:t}){return s.jsx("circle",{cx:e,cy:e,r:e,className:kn(["react-flow__background-pattern","dots",t])})}var mi;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(mi||(mi={}));const Fre={[mi.Dots]:1,[mi.Lines]:1,[mi.Cross]:6},zre=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function kD({id:e,variant:t=mi.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:a,bgColor:l,style:d,className:f,patternClassName:p}){const h=m.useRef(null),{transform:g,patternId:y}=At(zre,sn),k=r||Fre[t],w=t===mi.Dots,b=t===mi.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],I=b?[S,S]:N,T=[C[0]*g[2]||1+I[0]/2,C[1]*g[2]||1+I[1]/2],R=`${y}${e||""}`;return s.jsxs("svg",{className:kn(["react-flow__background",f]),style:{...d,...Zm,"--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:w?s.jsx(Ore,{radius:S/2,className:p}):s.jsx(Lre,{dimensions:I,lineWidth:o,variant:t,className:p})}),s.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${R})`})]})}kD.displayName="Background";const Bre=m.memo(kD);function Ure(){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 Hre(){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 Vre(){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 Wre(){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 qre(){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 kp({children:e,className:t,...n}){return s.jsx("button",{type:"button",className:kn(["react-flow__controls-button",t]),...n,children:e})}const Kre=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function SD({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:d,className:f,children:p,position:h="bottom-left",orientation:g="vertical","aria-label":y}){const k=on(),{isInteractive:w,minZoomReached:b,maxZoomReached:j,ariaLabelConfig:N}=At(Kre,sn),{zoomIn:S,zoomOut:C,fitView:I}=Jm(),T=()=>{S(),i==null||i()},R=()=>{C(),a==null||a()},D=()=>{I(o),l==null||l()},_=()=>{k.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d==null||d(!w)},B=g==="horizontal"?"horizontal":"vertical";return s.jsxs(Gd,{className:kn(["react-flow__controls",B,f]),position:h,style:e,"data-testid":"rf__controls","aria-label":y??N["controls.ariaLabel"],children:[t&&s.jsxs(s.Fragment,{children:[s.jsx(kp,{onClick:T,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:j,children:s.jsx(Ure,{})}),s.jsx(kp,{onClick:R,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:b,children:s.jsx(Hre,{})})]}),n&&s.jsx(kp,{className:"react-flow__controls-fitview",onClick:D,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:s.jsx(Vre,{})}),r&&s.jsx(kp,{className:"react-flow__controls-interactive",onClick:_,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:w?s.jsx(qre,{}):s.jsx(Wre,{})}),p]})}SD.displayName="Controls";const Gre=m.memo(SD);function Yre({id:e,x:t,y:n,width:r,height:o,style:i,color:a,strokeColor:l,strokeWidth:d,className:f,borderRadius:p,shapeRendering:h,selected:g,onClick:y}){const{background:k,backgroundColor:w}=i||{},b=a||k||w;return s.jsx("rect",{className:kn(["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:d},shapeRendering:h,onClick:y?j=>y(j,e):void 0})}const Xre=m.memo(Yre),Qre=e=>e.nodes.map(t=>t.id),Qy=e=>e instanceof Function?e:()=>e;function Jre({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=Xre,onClick:a}){const l=At(Qre,sn),d=Qy(t),f=Qy(e),p=Qy(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return s.jsx(s.Fragment,{children:l.map(g=>s.jsx(ese,{id:g,nodeColorFunc:d,nodeStrokeColorFunc:f,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:a,shapeRendering:h},g))})}function Zre({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:d}){const{node:f,x:p,y:h,width:g,height:y}=At(k=>{const w=k.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const b=w.internals.userNode,{x:j,y:N}=w.internals.positionAbsolute,{width:S,height:C}=To(b);return{node:b,x:j,y:N,width:S,height:C}},sn);return!f||f.hidden||!N3(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:d,id:f.id})}const ese=m.memo(Zre);var tse=m.memo(Jre);const nse=200,rse=150,sse=e=>!e.hidden,ose=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?k3(qd(e.nodeLookup,{filter:sse}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ise="react-flow__minimap-desc";function ND({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:d,maskColor:f,maskStrokeColor:p,maskStrokeWidth:h,position:g="bottom-right",onClick:y,onNodeClick:k,pannable:w=!1,zoomable:b=!1,ariaLabel:j,inversePan:N,zoomStep:S=1,offsetScale:C=5}){const I=on(),T=m.useRef(null),{boundingRect:R,viewBB:D,rfId:_,panZoom:B,translateExtent:$,flowWidth:O,flowHeight:z,ariaLabelConfig:A}=At(ose,sn),F=(e==null?void 0:e.width)??nse,U=(e==null?void 0:e.height)??rse,H=R.width/F,L=R.height/U,V=Math.max(H,L),M=V*F,W=V*U,Y=C*V,q=R.x-(M-R.width)/2-Y,J=R.y-(W-R.height)/2-Y,ne=M+Y*2,Q=W+Y*2,le=`${ise}-${_}`,te=m.useRef(0),pe=m.useRef();te.current=V,m.useEffect(()=>{if(T.current&&B)return pe.current=bte({domNode:T.current,panZoom:B,getTransform:()=>I.getState().transform,getViewScale:()=>te.current}),()=>{var ke;(ke=pe.current)==null||ke.destroy()}},[B]),m.useEffect(()=>{var ke;(ke=pe.current)==null||ke.update({translateExtent:$,width:O,height:z,inversePan:N,pannable:w,zoomStep:S,zoomable:b})},[w,b,N,S,$,O,z]);const be=y?ke=>{var je;const[Ue,oe]=((je=pe.current)==null?void 0:je.pointer(ke))||[0,0];y(ke,{x:Ue,y:oe})}:void 0,Ee=k?m.useCallback((ke,Ue)=>{const oe=I.getState().nodeLookup.get(Ue).internals.userNode;k(ke,oe)},[]):void 0,Te=j??A["minimap.ariaLabel"];return s.jsx(Gd,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof d=="string"?d: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*V: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:kn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:s.jsxs("svg",{width:F,height:U,viewBox:`${q} ${J} ${ne} ${Q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":le,ref:T,onClick:be,children:[Te&&s.jsx("title",{id:le,children:Te}),s.jsx(tse,{onClick:Ee,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:a,nodeComponent:l}),s.jsx("path",{className:"react-flow__minimap-mask",d:`M${q-Y},${J-Y}h${ne+Y*2}v${Q+Y*2}h${-ne-Y*2}z
|
|
644
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ND.displayName="MiniMap";m.memo(ND);const ase=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,lse={[rc.Line]:"right",[rc.Handle]:"bottom-right"};function cse({nodeId:e,position:t,variant:n=rc.Handle,className:r,style:o=void 0,children:i,color:a,minWidth:l=10,minHeight:d=10,maxWidth:f=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:g,autoScale:y=!0,shouldResize:k,onResizeStart:w,onResize:b,onResizeEnd:j}){const N=rD(),S=typeof e=="string"?e:N,C=on(),I=m.useRef(null),T=n===rc.Handle,R=At(m.useCallback(ase(T&&y),[T,y]),sn),D=m.useRef(null),_=t??lse[n];m.useEffect(()=>{if(!(!I.current||!S))return D.current||(D.current=_te({domNode:I.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:$,transform:O,snapGrid:z,snapToGrid:A,nodeOrigin:F,domNode:U}=C.getState();return{nodeLookup:$,transform:O,snapGrid:z,snapToGrid:A,nodeOrigin:F,paneDomNode:U}},onChange:($,O)=>{const{triggerNodeChanges:z,nodeLookup:A,parentLookup:F,nodeOrigin:U}=C.getState(),H=[],L={x:$.x,y:$.y},V=A.get(S);if(V&&V.expandParent&&V.parentId){const M=V.origin??U,W=$.width??V.measured.width??0,Y=$.height??V.measured.height??0,q={id:V.id,parentId:V.parentId,rect:{width:W,height:Y,...C3({x:$.x??V.position.x,y:$.y??V.position.y},{width:W,height:Y},V.parentId,A,M)}},J=E0([q],A,F,U);H.push(...J),L.x=$.x?Math.max(M[0]*W,$.x):void 0,L.y=$.y?Math.max(M[1]*Y,$.y):void 0}if(L.x!==void 0&&L.y!==void 0){const M={id:S,type:"position",position:{...L}};H.push(M)}if($.width!==void 0&&$.height!==void 0){const W={id:S,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};H.push(W)}for(const M of O){const W={...M,type:"position"};H.push(W)}z(H)},onEnd:({width:$,height:O})=>{const z={id:S,type:"dimensions",resizing:!1,dimensions:{width:$,height:O}};C.getState().triggerNodeChanges([z])}})),D.current.update({controlPosition:_,boundaries:{minWidth:l,minHeight:d,maxWidth:f,maxHeight:p},keepAspectRatio:h,resizeDirection:g,onResizeStart:w,onResize:b,onResizeEnd:j,shouldResize:k}),()=>{var $;($=D.current)==null||$.destroy()}},[_,l,d,f,p,h,w,b,j,k]);const B=_.split("-");return s.jsx("div",{className:kn(["react-flow__resize-control","nodrag",...B,n,r]),ref:I,style:{...o,scale:R,...a&&{[T?"backgroundColor":"borderColor"]:a}},children:i})}m.memo(cse);var CD=Object.defineProperty,use=(e,t,n)=>t in e?CD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dse=(e,t)=>{for(var n in t)CD(e,n,{get:t[n],enumerable:!0})},fse=(e,t,n)=>use(e,t+"",n),ED={};dse(ED,{Graph:()=>Es,alg:()=>R0,json:()=>RD,version:()=>mse});var pse=Object.defineProperty,TD=(e,t)=>{for(var n in t)pse(e,n,{get:t[n],enumerable:!0})},Es=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,d=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,a=e.name,arguments.length===2&&(l=t,d=!0)):(o=e,i=t,a=r,arguments.length>2&&(l=n,d=!0)),o=""+o,i=""+i,a!==void 0&&(a=""+a);let f=Nu(this._isDirected,o,i,a);if(f in this._edgeLabels)return d&&(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]=d?l:this._defaultEdgeLabelFn(o,i,a);let p=hse(this._isDirected,o,i,a);return o=p.v,i=p.w,Object.freeze(p),this._edgeObjs[f]=p,nE(this._preds[i],o),nE(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?Jy(this._isDirected,e):Nu(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?Jy(this._isDirected,e):Nu(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Jy(this._isDirected,e):Nu(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],rE(this._preds[a],i),rE(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 nE(e,t){e[t]?e[t]++:e[t]=1}function rE(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Nu(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 hse(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 Jy(e,t){return Nu(e,t.v,t.w,t.name)}var mse="4.0.1",RD={};TD(RD,{read:()=>bse,write:()=>gse});function gse(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:xse(e),edges:yse(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function xse(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 yse(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 bse(e){let t=new Es(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 R0={};TD(R0,{CycleException:()=>Lh,bellmanFord:()=>AD,components:()=>jse,dijkstra:()=>Mh,dijkstraAll:()=>Nse,findCycles:()=>Cse,floydWarshall:()=>Tse,isAcyclic:()=>Ase,postorder:()=>_se,preorder:()=>Dse,prim:()=>$se,shortestPaths:()=>Ise,tarjan:()=>_D,topsort:()=>DD});var vse=()=>1;function AD(e,t,n,r){return wse(e,String(t),n||vse,r||function(o){return e.outEdges(o)})}function wse(e,t,n,r){let o={},i,a=0,l=e.nodes(),d=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;d({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 jse(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 PD=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}},kse=()=>1;function Mh(e,t,n,r){let o=function(i){return e.outEdges(i)};return Sse(e,String(t),n||kse,r||o)}function Sse(e,t,n,r){let o={},i=new PD,a,l,d=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(d);return o}function Nse(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Mh(e,o,t,n),r},{})}function _D(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(d){d in r?r[d].onStack&&(l.lowlink=Math.min(l.lowlink,r[d].index)):(i(d),l.lowlink=Math.min(l.lowlink,r[d].lowlink))}),l.lowlink===l.index){let d=[],f;do f=n.pop(),r[f].onStack=!1,d.push(f);while(a!==f);o.push(d)}}return e.nodes().forEach(function(a){a in r||i(a)}),o}function Cse(e){return _D(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Ese=()=>1;function Tse(e,t,n){return Rse(e,t||Ese,n||function(r){return e.outEdges(r)})}function Rse(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,d=t(a);r[i][l]={distance:d,predecessor:i}})}),o.forEach(function(i){let a=r[i];o.forEach(function(l){let d=r[l];o.forEach(function(f){let p=d[i],h=a[f],g=d[f],y=p.distance+h.distance;y<g.distance&&(g.distance=y,g.predecessor=h.predecessor)})})}),r}var Lh=class extends Error{constructor(...e){super(...e)}};function DD(e){let t={},n={},r=[];function o(i){if(i in n)throw new Lh;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 Lh;return r}function Ase(e){try{DD(e)}catch(t){if(t instanceof Lh)return!1;throw t}return!0}function Pse(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(l=>{var d;return(d=e.isDirected()?e.successors(l):e.neighbors(l))!=null?d:[]}),a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);o=$D(e,l,n==="post",a,i,r,o)}),o}function $D(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=$D(e,l,n,r,o,i,a)}),n&&(a=i(a,t))),a}function ID(e,t,n){return Pse(e,t,n,function(r,o){return r.push(o),r},[])}function _se(e,t){return ID(e,t,"post")}function Dse(e,t){return ID(e,t,"pre")}function $se(e,t){let n=new Es,r={},o=new PD,i;function a(d){let f=d.v===i?d.w:d.v,p=o.priority(f);if(p!==void 0){let h=t(d);h<p&&(r[f]=i,o.decrease(f,h))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(d){o.add(d,Number.POSITIVE_INFINITY),n.setNode(d)}),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 Ise(e,t,n,r){return Mse(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function Mse(e,t,n,r){if(n===void 0)return Mh(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 d=0;d<l.length;d++){let f=l[d],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 AD(e,t,n,r)}return Mh(e,t,n,r)}function Ec(e,t,n,r){let o=r;for(;e.hasNode(o);)o=A0(r);return n.dummy=t,e.setNode(o,n),o}function Lse(e){let t=new Es().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 MD(e){let t=new Es({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 sE(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 d,f;return Math.abs(i)*a>Math.abs(o)*l?(i<0&&(l=-l),d=l*o/i,f=l):(o<0&&(a=-a),d=a,f=a*i/o),{x:n+d,y:r+f}}function tg(e){let t=yd(OD(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 Ose(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Vs(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Fse(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=Vs(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(d=>e.node(d).rank+=o)})}function oE(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),Ec(e,"border",o,t)}function zse(e,t=LD){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var LD=65535;function Vs(e,t){if(t.length>LD){let n=zse(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function OD(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Vs(Math.max,t)}function Bse(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Use(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Hse(e,t){return t()}var Vse=0;function A0(e){let t=++Vse;return e+(""+t)}function yd(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 Oh(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function ng(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 Wse(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var rg="\0",qse=class{constructor(){fse(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return iE(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&iE(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,Kse)),n=n._prev;return"["+e.join(", ")+"]"}};function iE(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Kse(e,t){if(e!=="_next"&&e!=="_prev")return t}var Gse=qse,Yse=()=>1;function Xse(e,t){if(e.nodeCount()<=1)return[];let n=Jse(e,t||Yse);return Qse(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function Qse(e,t,n){var r;let o=[],i=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Zy(e,t,n,l);for(;l=i.dequeue();)Zy(e,t,n,l);if(e.nodeCount()){for(let d=t.length-2;d>0;--d)if(l=(r=t[d])==null?void 0:r.dequeue(),l){o=o.concat(Zy(e,t,n,l,!0)||[]);break}}}return o}function Zy(e,t,n,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let d=e.edge(l),f=e.node(l.v);o&&i.push({v:l.v,w:l.w}),f.out-=d,bv(t,n,f)}),(e.outEdges(r.v)||[]).forEach(l=>{let d=e.edge(l),f=l.w,p=e.node(f);p.in-=d,bv(t,n,p)}),e.removeNode(r.v),a}function Jse(e,t){let n=new Es,r=0,o=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let d=n.edge(l.v,l.w)||0,f=t(l),p=d+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=Zse(o+r+3).map(()=>new Gse),a=r+1;return n.nodes().forEach(l=>{bv(i,a,n.node(l))}),{graph:n,buckets:i,zeroIdx:a}}function bv(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 Zse(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function eoe(e){(e.graph().acyclicer==="greedy"?Xse(e,t(e)):toe(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,A0("rev"))});function t(n){return r=>n.edge(r).weight}}function toe(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 noe(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 roe(e){e.graph().dummyChains=[],e.edges().forEach(t=>soe(e,t))}function soe(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),d=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=Ec(e,"edge",p,"_d"),r===d&&(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 ooe(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 P0(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(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-e.edge(d).minlen):[],l=Vs(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),o.rank=l}e.sources().forEach(n)}function oc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var FD=ioe;function ioe(e){let t=new Es({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(;aoe(t,e)<o&&(i=loe(t,e),!!i);)a=t.hasNode(i.v)?oc(e,i):-oc(e,i),coe(t,e,a);return t}function aoe(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)&&!oc(t,i)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function loe(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=oc(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function coe(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:uoe,postorder:doe}=R0,foe=Ea;Ea.initLowLimValues=D0;Ea.initCutValues=_0;Ea.calcCutValue=zD;Ea.leaveEdge=UD;Ea.enterEdge=HD;Ea.exchangeEdges=VD;function Ea(e){e=Lse(e),P0(e);let t=FD(e);D0(t),_0(t,e);let n,r;for(;n=UD(t);)r=HD(t,e,n),VD(t,e,n,r)}function _0(e,t){let n=doe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>poe(e,t,r))}function poe(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=zD(e,t,n)}function zD(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(d=>{let f=d.v===n,p=f?d.w:d.v;if(p!==r){let h=f===o,g=t.edge(d).weight;if(a+=h?g:-g,moe(e,n,p)){let y=e.edge(n,p).cutvalue;a+=h?-y:y}}}),a}function D0(e,t){arguments.length<2&&(t=e.nodes()[0]),BD(e,{},1,t)}function BD(e,t,n,r,o){let i=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(d=>{Object.hasOwn(t,d)||(n=BD(e,t,n,d,r))}),a.low=i,a.lim=n++,o?a.parent=o:delete a.parent,n}function UD(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function HD(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,d=!1;return i.lim>a.lim&&(l=a,d=!0),t.edges().filter(f=>d===aE(e,e.node(f.v),l)&&d!==aE(e,e.node(f.w),l)).reduce((f,p)=>oc(t,p)<oc(t,f)?p:f)}function VD(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),D0(e),_0(e,t),hoe(e,t)}function hoe(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=uoe(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 moe(e,t,n){return e.hasEdge(t,n)}function aE(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var goe=xoe;function xoe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":lE(e);break;case"tight-tree":boe(e);break;case"longest-path":yoe(e);break;case"none":break;default:lE(e)}}var yoe=P0;function boe(e){P0(e),FD(e)}function lE(e){foe(e)}var voe=woe;function woe(e){let t=koe(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=joe(e,t,o.v,o.w),a=i.path,l=i.lca,d=0,f=a[d],p=!0;for(;n!==o.w;){if(r=e.node(n),p){for(;(f=a[d])!==l&&e.node(f).maxRank<r.rank;)d++;f===l&&(p=!1)}if(!p){for(;d<a.length-1&&e.node(a[d+1]).minRank<=r.rank;)d++;f=a[d]}f!==void 0&&e.setParent(n,f),n=e.successors(n)[0]}})}function joe(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),d;d=n;do d=e.parent(d),o.push(d);while(d&&(t[d].low>a||l>t[d].lim));let f=d,p=r;for(;(p=e.parent(p))!==f;)i.push(p);return{path:o.concat(i.reverse()),lca:f}}function koe(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(rg).forEach(r),t}function Soe(e){let t=Ec(e,"root",{},"_root"),n=Noe(e),r=Object.values(n),o=Vs(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=i);let a=Coe(e)+1;e.children(rg).forEach(l=>WD(e,t,i,a,o,n,l)),e.graph().nodeRankFactor=i}function WD(e,t,n,r,o,i,a){var l;let d=e.children(a);if(!d.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let f=oE(e,"_bt"),p=oE(e,"_bb"),h=e.node(a);e.setParent(f,a),h.borderTop=f,e.setParent(p,a),h.borderBottom=p,d.forEach(g=>{var y;WD(e,t,n,r,o,i,g);let k=e.node(g),w=k.borderTop?k.borderTop:g,b=k.borderBottom?k.borderBottom:g,j=k.borderTop?r:2*r,N=w!==b?1:o-((y=i[a])!=null?y:0)+1;e.setEdge(f,w,{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 Noe(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(rg).forEach(r=>n(r,1)),t}function Coe(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Eoe(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Toe=Roe;function Roe(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)cE(e,"borderLeft","_bl",n,o,i),cE(e,"borderRight","_br",n,o,i)}}e.children(rg).forEach(t)}function cE(e,t,n,r,o,i){let a={width:0,height:0,rank:i,borderType:t},l=o[t][i-1],d=Ec(e,"border",a,n);o[t][i]=d,e.setParent(d,r),l&&e.setEdge(l,d,{weight:1})}function Aoe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&qD(e)}function Poe(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&_oe(e),(n==="lr"||n==="rl")&&(Doe(e),qD(e))}function qD(e){e.nodes().forEach(t=>uE(e.node(t))),e.edges().forEach(t=>uE(e.edge(t)))}function uE(e){let t=e.width;e.width=e.height,e.height=t}function _oe(e){e.nodes().forEach(t=>eb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(eb),Object.hasOwn(r,"y")&&eb(r)})}function eb(e){e.y=-e.y}function Doe(e){e.nodes().forEach(t=>tb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(tb),Object.hasOwn(r,"x")&&tb(r)})}function tb(e){let t=e.x;e.x=e.y,e.y=t}function $oe(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),o=Vs(Math.max,r),i=yd(o+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let d=e.node(l);i[d.rank].push(l);let f=e.successors(l);f&&f.forEach(a)}return n.sort((l,d)=>e.node(l).rank-e.node(d).rank).forEach(a),i}function Ioe(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Moe(e,t[r-1],t[r]);return n}function Moe(e,t,n){let r=Wse(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),d=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;d+=f.weight*h}),d}function Loe(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),d=e.node(a.v);return{sum:i.sum+l.weight*d.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Ooe(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 Foe(r)}function Foe(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=>Oh(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 Boe(e,t){let n=Bse(e,p=>Object.hasOwn(p,"barycenter")),r=n.lhs,o=n.rhs.sort((p,h)=>h.i-p.i),i=[],a=0,l=0,d=0;r.sort(Uoe(!!t)),d=dE(i,o,d),r.forEach(p=>{d+=p.vs.length,i.push(p.vs),a+=p.barycenter*p.weight,l+=p.weight,d=dE(i,o,d)});let f={vs:i.flat(1)};return l&&(f.barycenter=a/l,f.weight=l),f}function dE(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 Uoe(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function KD(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,d={};a&&(o=o.filter(g=>g!==a&&g!==l));let f=Loe(e,o);f.forEach(g=>{if(e.children(g.v).length){let y=KD(e,g.v,n,r);d[g.v]=y,Object.hasOwn(y,"barycenter")&&Voe(g,y)}});let p=Ooe(f,n);Hoe(p,d);let h=Boe(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),w=e.node(k[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+y.order+w.order)/(h.weight+2),h.weight+=2}}return h}function Hoe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function Voe(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 Woe(e,t,n,r){r||(r=e.nodes());let o=qoe(e),i=new Es({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),d=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){i.setNode(a),i.setParent(a,d||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 qoe(e){let t;for(;e.hasNode(t=A0("_root")););return t}function Koe(e,t,n){let r={},o;n.forEach(i=>{let a=e.parent(i),l,d;for(;a;){if(l=e.parent(a),l?(d=r[l],r[l]=a):(d=o,o=a),d&&d!==a){t.setEdge(d,a);return}a=l}})}function GD(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,GD);return}let n=OD(e),r=fE(e,yd(1,n+1),"inEdges"),o=fE(e,yd(n-1,-1,-1),"outEdges"),i=$oe(e);if(pE(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,d=t.constraints||[];for(let f=0,p=0;p<4;++f,++p){Goe(f%2?r:o,f%4>=2,d),i=tg(e);let h=Ioe(e,i);h<a?(p=0,l=Object.assign({},i),a=h):h===a&&(l=structuredClone(i))}pE(e,l)}function fE(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 Woe(e,i,n,r.get(i)||[])})}function Goe(e,t,n){let r=new Es;e.forEach(function(o){n.forEach(l=>r.setEdge(l.left,l.right));let i=o.graph().root,a=KD(o,i,r,t);a.vs.forEach((l,d)=>o.node(l).order=d),Koe(o,r,a.vs)})}function pE(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function Yoe(e,t){let n={};function r(o,i){let a=0,l=0,d=o.length,f=i[i.length-1];return i.forEach((p,h)=>{let g=Qoe(e,p),y=g?e.node(g).order:d;(g||p===f)&&(i.slice(l,h+1).forEach(k=>{let w=e.predecessors(k);w&&w.forEach(b=>{let j=e.node(b),N=j.order;(N<a||y<N)&&!(j.dummy&&e.node(k).dummy)&&YD(n,b,k)})}),l=h+1,a=y)}),i}return t.length&&t.reduce(r),n}function Xoe(e,t){let n={};function r(i,a,l,d,f){yd(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<d||k.order>f)&&YD(n,y,h)})}})}function o(i,a){let l=-1,d=-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;d=e.node(y).order,r(a,f,h,l,d),f=h,l=d}}r(a,f,a.length,d,i.length)}),a}return t.length&&t.reduce(o),n}function Qoe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function YD(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 Joe(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 Zoe(e,t,n,r){let o={},i={},a={};return t.forEach(l=>{l.forEach((d,f)=>{o[d]=d,i[d]=d,a[d]=f})}),t.forEach(l=>{let d=-1;l.forEach(f=>{let p=r(f);if(p&&p.length){let h=p.sort((y,k)=>{let w=a[y],b=a[k];return(w!==void 0?w: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 w=h[y];if(w===void 0)continue;let b=a[w];if(b!==void 0&&i[f]===f&&d<b&&!Joe(n,f,w)){let j=o[w];j!==void 0&&(i[w]=f,i[f]=o[f]=j,d=b)}}}})}),{root:o,align:i}}function eie(e,t,n,r,o=!1){let i={},a=tie(e,t,n,o),l=o?"borderLeft":"borderRight";function d(y,k){let w=a.nodes().slice(),b={},j=w.pop();for(;j;){if(b[j])y(j);else{b[j]=!0,w.push(j);for(let N of k(j))w.push(N)}j=w.pop()}}function f(y){let k=a.inEdges(y);k?i[y]=k.reduce((w,b)=>{var j;let N=(j=i[b.v])!=null?j:0,S=a.edge(b);return Math.max(w,N+(S!==void 0?S:0))},0):i[y]=0}function p(y){let k=a.outEdges(y),w=Number.POSITIVE_INFINITY;k&&(w=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);w!==Number.POSITIVE_INFINITY&&b.borderType!==l&&(i[y]=Math.max(i[y]!==void 0?i[y]:0,w))}function h(y){return a.predecessors(y)||[]}function g(y){return a.successors(y)||[]}return d(f,h),d(p,g),Object.keys(r).forEach(y=>{var k;let w=n[y];w!==void 0&&(i[y]=(k=i[w])!=null?k:0)}),i}function tie(e,t,n,r){let o=new Es,i=e.graph(),a=iie(i.nodesep,i.edgesep,r);return t.forEach(l=>{let d;l.forEach(f=>{let p=n[f];if(p!==void 0){if(o.setNode(p),d!==void 0){let h=n[d];if(h!==void 0){let g=o.edge(h,p);o.setEdge(h,p,Math.max(a(e,f,d),g||0))}}d=f}})}),o}function nie(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,d])=>{let f=aie(e,l)/2;o=Math.max(d+f,o),i=Math.min(d-f,i)});let a=o-i;return a<n[0]&&(n=[a,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function rie(e,t){let n=Object.values(t),r=Vs(Math.min,n),o=Vs(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(a=>{let l=i+a,d=e[l];if(!d||d===t)return;let f=Object.values(d),p=r-Vs(Math.min,f);a!=="l"&&(p=o-Vs(Math.max,f)),p&&(e[l]=ng(d,h=>h+p))})})}function sie(e,t=void 0){let n=e.ul;return n?ng(n,(r,o)=>{var i,a;if(t){let d=t.toLowerCase(),f=e[d];if(f&&f[o]!==void 0)return f[o]}let l=Object.values(e).map(d=>{let f=d[o];return f!==void 0?f:0}).sort((d,f)=>d-f);return(((i=l[1])!=null?i:0)+((a=l[2])!=null?a:0))/2}):{}}function oie(e){let t=tg(e),n=Object.assign(Yoe(e,t),Xoe(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 d=Zoe(e,o,n,p=>(a==="u"?e.predecessors(p):e.successors(p))||[]),f=eie(e,o,d.root,d.align,l==="r");l==="r"&&(f=ng(f,p=>-p)),r[a+l]=f})});let i=nie(e,r);return rie(r,i),sie(r,e.graph().align)}function iie(e,t,n){return(r,o,i)=>{let a=r.node(o),l=r.node(i),d=0,f;if(d+=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&&(d+=n?f:-f),f=void 0,d+=(a.dummy?t:e)/2,d+=(l.dummy?t:e)/2,d+=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&&(d+=n?f:-f),d}}function aie(e,t){return e.node(t).width}function lie(e){e=MD(e),cie(e),Object.entries(oie(e)).forEach(([t,n])=>e.node(t).x=n)}function cie(e){let t=tg(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(a=>{let l=a.reduce((d,f)=>{var p;let h=(p=e.node(f).height)!=null?p:0;return d>h?d:h},0);a.forEach(d=>{let f=e.node(d);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 uie(e,t={}){let n=t.debugTiming?Use:Hse;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>vie(e));return n(" runLayout",()=>die(r,n,t)),n(" updateInputGraph",()=>fie(e,r)),r})}function die(e,t,n){t(" makeSpaceForEdgeLabels",()=>wie(e)),t(" removeSelfEdges",()=>Aie(e)),t(" acyclic",()=>eoe(e)),t(" nestingGraph.run",()=>Soe(e)),t(" rank",()=>goe(MD(e))),t(" injectEdgeLabelProxies",()=>jie(e)),t(" removeEmptyRanks",()=>Fse(e)),t(" nestingGraph.cleanup",()=>Eoe(e)),t(" normalizeRanks",()=>Ose(e)),t(" assignRankMinMax",()=>kie(e)),t(" removeEdgeLabelProxies",()=>Sie(e)),t(" normalize.run",()=>roe(e)),t(" parentDummyChains",()=>voe(e)),t(" addBorderSegments",()=>Toe(e)),t(" order",()=>GD(e,n)),t(" insertSelfEdges",()=>Pie(e)),t(" adjustCoordinateSystem",()=>Aoe(e)),t(" position",()=>lie(e)),t(" positionSelfEdges",()=>_ie(e)),t(" removeBorderNodes",()=>Rie(e)),t(" normalize.undo",()=>ooe(e)),t(" fixupEdgeLabelCoords",()=>Eie(e)),t(" undoCoordinateSystem",()=>Poe(e)),t(" translateGraph",()=>Nie(e)),t(" assignNodeIntersects",()=>Cie(e)),t(" reversePoints",()=>Tie(e)),t(" acyclic.undo",()=>noe(e))}function fie(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 pie=["nodesep","edgesep","ranksep","marginx","marginy"],hie={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},mie=["acyclicer","ranker","rankdir","align","rankalign"],gie=["width","height","rank"],hE={width:0,height:0},xie=["minlen","weight","width","height","labeloffset"],yie={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},bie=["labelpos"];function vie(e){let t=new Es({multigraph:!0,compound:!0}),n=rb(e.graph());return t.setGraph(Object.assign({},hie,nb(n,pie),Oh(n,mie))),e.nodes().forEach(r=>{let o=rb(e.node(r)),i=nb(o,gie);Object.keys(hE).forEach(l=>{i[l]===void 0&&(i[l]=hE[l])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let o=rb(e.edge(r));t.setEdge(r,Object.assign({},yie,nb(o,xie),Oh(o,bie)))}),t}function wie(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 jie(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};Ec(e,"edge-proxy",o,"_ep")}})}function kie(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 Sie(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 Nie(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 d(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=>d(e.node(f))),e.edges().forEach(f=>{let p=e.edge(f);Object.hasOwn(p,"x")&&d(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 Cie(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(sE(r,i)),n.points.push(sE(o,a))})}function Eie(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 Tie(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Rie(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 Aie(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 Pie(e){tg(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(a=>{Ec(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 _ie(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,d=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*l/3,y:a-d},{x:i+5*l/6,y:a-d},{x:i+l,y:a},{x:i+5*l/6,y:a+d},{x:i+2*l/3,y:a+d}],r.label.x=n.x,r.label.y=n.y}})}function nb(e,t){return ng(Oh(e,t),Number)}function rb(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 Die(e,t,n={}){const r=new Map;if(e.length===0)return r;const o=n.nodeWidth??150,i=n.nodeHeight??64,a=new ED.Graph;a.setGraph({rankdir:n.direction??"LR",nodesep:40,ranksep:90}),a.setDefaultEdgeLabel(()=>({}));const l=new Set;for(const d of e)l.add(d.id),a.setNode(d.id,{width:o,height:i});for(const d of t)l.has(d.from)&&l.has(d.to)&&a.setEdge(d.from,d.to);uie(a);for(const d of l){const f=a.node(d);f&&r.set(d,{x:f.x-o/2,y:f.y-i/2})}return r}function $ie({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(sc,{type:"target",position:ot.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(SL,{className:"h-3 w-3 shrink-0","aria-label":"Undefined status"}),a&&!l&&s.jsx(qh,{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(LL,{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(sc,{type:"source",position:ot.Right,className:"!h-2 !w-2 !bg-muted-foreground"})]})}const Iie={status:$ie},Mie="oklch(var(--muted-foreground))",Lie="oklch(var(--primary))",Oie="oklch(var(--error-foreground))";function Fie({onRelayout:e}){const{fitView:t}=Jm();return s.jsx(Gd,{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(UL,{className:"h-3 w-3"}),"Re-layout"]})})}function mE({nodes:e,edges:t,selectedRowKey:n,editable:r,onSelectEdge:o,onCreateEdge:i,onDeleteEdge:a}){const[l,d,f]=Ire([]),[p,h]=Mre([]),g=m.useRef(new Map),[y,k]=m.useState(0),w=m.useMemo(()=>JSON.stringify(e.map(R=>[R.id,R.label,R.color??"",R.terminal,R.orphan,R.missing])),[e]);m.useEffect(()=>{const R=Die(e,t,{direction:"LR"}),D=new Set(e.map(_=>_.id));for(const _ of g.current.keys())D.has(_)||g.current.delete(_);d(e.map(_=>{let B=g.current.get(_.id);return B||(B=R.get(_.id)??{x:0,y:0},g.current.set(_.id,B)),{id:_.id,type:"status",position:B,data:{label:_.label,statusId:_.id,color:_.color,terminal:_.terminal,orphan:_.orphan,missing:_.missing},draggable:!0,deletable:!1}}))},[w,y,d]);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 D=R.rowKey===n,_=R.undefinedRef?Oie:D?Lie:Mie;return{id:R.rowKey,source:R.from,target:R.to,label:R.requiresReason?`${R.command} (reason)`:R.command,selected:D,deletable:r,markerEnd:{type:hd.ArrowClosed,color:_},style:{stroke:_,strokeWidth:D?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 D of R)D.type==="position"&&D.position&&g.current.set(D.id,D.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 D of R)a(D.id)},[r,a]),I=m.useCallback((R,D)=>o(D.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($re,{nodes:l,edges:p,nodeTypes:Iie,onNodesChange:N,onConnect:S,onEdgesDelete:C,onEdgeClick:I,onSelectionChange:T,nodesConnectable:r,deleteKeyCode:r?["Backspace","Delete"]:null,elementsSelectable:!0,fitView:!0,fitViewOptions:{padding:.2},proOptions:{hideAttribution:!1},children:[s.jsx(Bre,{gap:16}),s.jsx(Gre,{showInteractive:!1}),s.jsx(Fie,{onRelayout:b})]})})}const Sp="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,d=new Set(t.map(y=>y.id)),f=!d.has(l.from),p=!d.has(l.to);function h(y){r({...l,...y})}function g(y,k,w,b){const j=d.has(y);return s.jsxs("select",{ref:b,value:y,onChange:N=>k(N.target.value),disabled:i,"aria-label":w,className:`${Sp} 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(vn,{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:`${Sp} 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:`${Sp} 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:`${Sp} 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 gE(){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 Bie({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]),[d,f]=m.useState(null),p=m.useMemo(()=>sv(L_()),[]),h=m.useMemo(()=>YN(p,n),[p,n]);if(!t&&e.length===0)return s.jsxs(Ge,{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(gE,{}),s.jsx(mE,{nodes:h.nodes,edges:h.edges,selectedRowKey:null,editable:!1,onSelectEdge:()=>{},onCreateEdge:()=>{},onDeleteEdge:()=>{}})]});const g=O_(e,l),y=YN(e,n),k=e.find(C=>C.rowKey===d)??null;function w(C){o(e.map(I=>I.rowKey===C.rowKey?C:I))}function b(C){o(e.filter(I=>I.rowKey!==C)),d===C&&f(null)}function j(C,I){const T={rowKey:M_(),from:C,command:r[0]??"",to:I,label:"",description:"",requiresReason:!1};o([...e,T]),f(T.rowKey)}const N=((S=n[0])==null?void 0:S.id)??"";return s.jsxs(Ge,{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($t,{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,I)=>s.jsx("li",{children:C},I))})]}),s.jsx(gE,{}),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(mE,{nodes:y.nodes,edges:y.edges,selectedRowKey:d,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:w,onDelete:b,disabled:a})})]})]})}function Uie(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 Hie(){var $e;const[e,t]=m.useState(!0),[n,r]=m.useState(null),[o,i]=m.useState(!1),[a,l]=m.useState([]),[d,f]=m.useState(!1),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,w]=m.useState(new Set),[b,j]=m.useState(new Map),[N,S]=m.useState({open:!1}),[C,I]=m.useState([]),[T,R]=m.useState([]),[D,_]=m.useState({open:!1}),[B,$]=m.useState(()=>Oy($p)),[O,z]=m.useState(!1),[A,F]=m.useState(!1),[U,H]=m.useState(!1),[L,V]=m.useState([]),[M,W]=m.useState(!1),[Y,q]=m.useState([]),[J,ne]=m.useState("statuses"),Q=m.useCallback(Ce=>{const se=_X(Ce);l(se),i(Ce.custom),w(new Set(se.map(me=>me.id))),j(new Map),I(Ce.rawFacts??[]),R([]),$(Oy(Ce.derive??$p)),z(Ce.deriveCustom??!1),F(!1),H(!1),V(sv(Ce.transitions??[])),W(Ce.transitionsCustom??!1),q(Ce.knownCommands??[]),y(!1)},[]),le=m.useCallback(async()=>{try{const Ce=await fetch("/api/config/statuses");if(!Ce.ok)throw new Error(`HTTP ${Ce.status}`);const se=await Ce.json();Q(se),r(null)}catch(Ce){r(Ce instanceof Error?Ce.message:"Failed to load config")}finally{t(!1)}},[Q]);m.useEffect(()=>{le()},[le]);function te(){setTimeout(()=>h(null),3e3)}const pe=m.useMemo(()=>a.map(Ce=>({id:Ce.id,label:Ce.label,color:Ce.color,terminal:Ce.terminal})),[a]),be=m.useMemo(()=>new Set(a.map(Ce=>Ce.id)),[a]),Ee=m.useMemo(()=>KX(C),[C]),Te=m.useMemo(()=>Rw(Ee),[Ee]),ke=m.useMemo(()=>DX(C),[C]),Ue=m.useMemo(()=>{try{return I_(rv(B),a,Te)}catch{return["derive rules are malformed"]}},[B,a,Te]),oe=m.useMemo(()=>M?O_(L,be):[],[L,M,be]),je=ke.length+Ue.length+oe.length,Se=m.useCallback(Ce=>{I(Ce),y(!0)},[]),De=m.useCallback(Ce=>{$(Ce),F(!0),H(!1),z(!0),y(!0)},[]),ze=m.useCallback(()=>{$(Oy($p)),H(!0),F(!0),z(!1),y(!0)},[]),Ye=m.useCallback(Ce=>{V(Ce),y(!0)},[]),Oe=m.useCallback(()=>{V(Ce=>Ce.length>0?Ce:sv(nQ(L_(),be))),W(!0),y(!0)},[be]);async function nt(Ce=T){f(!0),h(null);try{const{body:se}=SX({statuses:a,order:a.map(de=>de.id),pendingResolutions:b,facts:C,factRemovalAcks:Ce,derive:U?null:A?rv(B):void 0,transitions:M?tQ(L):void 0}),me=await fetch("/api/config/statuses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(se)});if(!me.ok){const de=await me.json().catch(()=>null);if(me.status===409&&(de==null?void 0:de.error)==="unresolved-fact-references"&&de.references){_({open:!0,references:de.references}),f(!1);return}if((de==null?void 0:de.error)==="invalid-derive")throw new Error(`Invalid derive rules: ${(de.problems??[]).join("; ")}`);if((de==null?void 0:de.error)==="invalid-transitions")throw new Error(`Invalid transitions: ${(de.problems??[]).join("; ")}`);if((de==null?void 0:de.error)==="invalid-facts")throw new Error(`Invalid facts: ${(de.problems??[]).join("; ")}`);if(me.status===409&&(de==null?void 0:de.error)==="unresolved-orphans"){const pt=Array.isArray(de.unresolved)?de.unresolved.map(yt=>yt.id).join(", "):"";throw new Error(`Cannot save — these statuses have assignments that need a resolution: ${pt}. Click the trash icon on each row to choose remap or delete.`)}if(me.status===409&&(de==null?void 0:de.error)==="concurrent-edit"){const pt=de.applied?` (${de.applied.remapped} remapped, ${de.applied.deleted} deleted before the conflict)`:"";h({type:"error",message:`Concurrent edit detected${pt}: ${de.cause??"an assignment moved to a still-dropped status during save"}. Refreshing — please re-resolve.`}),await le();return}if(me.status===500&&(de==null?void 0:de.error)==="config-write-failed"&&(de!=null&&de.applied)){const{remapped:pt,deleted:yt}=de.applied,St=de.message?`: ${de.message}`:"";h({type:"error",message:`Resolutions applied (${pt} remapped, ${yt} deleted) but the status config write failed${St}. Click Save again to retry.`}),await le();return}throw(de==null?void 0:de.error)==="invalid-remap-target"?new Error(`Invalid remap target (${de.reason}): ${de.id} → ${de.target}.`):(de==null?void 0:de.error)==="duplicate-resolution-ids"?new Error(`Duplicate resolution ids: ${(de.ids??[]).join(", ")}`):(de==null?void 0:de.error)==="stale-resolution"?new Error(`Stale resolution for id "${de.id??"?"}".`):(de==null?void 0:de.error)==="malformed-resolutions"?new Error(`Malformed resolutions: ${de.message??"unknown"}`):(de==null?void 0:de.error)==="remap-write-failed"||(de==null?void 0:de.error)==="delete-failed"||(de==null?void 0:de.error)==="scan-failed"?new Error(`${de.error}: ${de.cause??"unknown"}`):new Error((de==null?void 0:de.error)??`Save failed (HTTP ${me.status})`)}const Pe=await me.json();Q(Pe),M1();const qe=Pe.applied?` (${Pe.applied.remapped} remapped, ${Pe.applied.deleted} deleted)`:"";h({type:"success",message:`Status config saved${qe}`}),te()}catch(se){h({type:"error",message:se instanceof Error?se.message:"Save failed"})}finally{f(!1)}}async function wt(){f(!0),h(null);try{const Ce=await fetch("/api/config/statuses",{method:"DELETE"});if(!Ce.ok)throw new Error("Reset failed");const se=await Ce.json();Q(se),M1(),h({type:"success",message:"Reset to defaults"}),te()}catch(Ce){h({type:"error",message:Ce instanceof Error?Ce.message:"Reset failed"})}finally{f(!1)}}function it(Ce,se,me){l(Pe=>{const qe=[...Pe];return qe[Ce]={...qe[Ce],[se]:me},qe}),y(!0)}function st(){const Ce=`status_${a.length+1}`;l(se=>[...se,{rowKey:P_(),id:Ce,label:"New Status",description:"",color:"",terminal:!1}]),y(!0)}function ce(Ce){l(se=>{const me=se.filter(qe=>qe.id!==Ce),Pe=new Set(me.map(qe=>qe.id));return j(qe=>HN(qe,Pe)),me}),y(!0)}async function ee(Ce){const se=a[Ce].id,me=NX(se,B,L),Pe=CX(se,B);if(!k.has(se)){if(me.length===0){ce(se);return}S({open:!0,affected:{id:se,count:0,truncated:!1,assignments:[]},pendingId:se,ruleReferences:me,headlineReferences:Pe});return}try{const qe=await fetch(`/api/config/statuses/affected/${encodeURIComponent(se)}`);if(!qe.ok)throw new Error(`HTTP ${qe.status}`);const de=await qe.json();if(de.count===0&&me.length===0){ce(se);return}S({open:!0,affected:de,pendingId:se,ruleReferences:me,headlineReferences:Pe})}catch(qe){h({type:"error",message:`Could not check affected assignments for "${se}": ${qe instanceof Error?qe.message:String(qe)}`})}}function xe(Ce,se){if(!N.open)return;const{pendingId:me,affected:Pe,ruleReferences:qe}=N;if(me!==Ce.id){S({open:!1});return}if(!a.some(de=>de.id===me)){h({type:"error",message:`Row for "${me}" was already removed — modal action ignored.`}),S({open:!1});return}Ce.mode==="remap"?($(de=>EX(de,me,se)),V(de=>TX(de,me,se))):($(de=>RX(de,me,se)),V(de=>AX(de,me))),qe.some(de=>de.section!=="transitions")&&(F(!0),z(!0)),l(de=>{const pt=de.filter(St=>St.id!==me),yt=new Set(pt.map(St=>St.id));return j(St=>{const ct=HN(St,yt),ht=new Map(ct);return Pe.count>0&&ht.set(me,Ce),ht}),pt}),y(!0),S({open:!1})}function ie(){if(!D.open)return;const Ce=D.references.map(me=>me.factName),se=Array.from(new Set([...T,...Ce]));R(se),_({open:!1}),nt(se)}function we(){S({open:!1})}return e?s.jsx(vt,{label:"Loading workflow..."}):n?s.jsx(Pt,{error:n}):s.jsx(ua,{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(Rv,{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:wt,disabled:d||!o&&!g,children:[s.jsx(Ys,{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(Pm,{value:J,onValueChange:ne,items:[{value:"statuses",label:"Statuses",content:s.jsx(kX,{statuses:a,savedStatusIds:k,onUpdate:it,onAdd:st,onRemove:ee,onReorder:Ce=>{l(Ce),y(!0)}})},{value:"transitions",label:"Transitions",problemCount:oe.length,content:s.jsx(Bie,{value:L,customizing:M,statuses:pe,knownCommands:Y,onChange:Ye,onCustomize:Oe,disabled:d})},{value:"derive",label:"Derive Rules",problemCount:Ue.length,content:s.jsx(XX,{value:B,deriveCustom:O,statuses:pe,acceptedFacts:Ee,onChange:De,onReset:ze,disabled:d})},{value:"facts",label:"Facts",problemCount:ke.length,content:s.jsx(OX,{rows:C,onChange:Se,saving:d})}]}),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 nt(),disabled:d||!g||je>0,children:[s.jsx(Wh,{className:"h-3.5 w-3.5"}),d?"Saving...":"Save Configuration"]}),g&&s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"shell-action text-xs",onClick:()=>{t(!0),le()},disabled:d,children:"Discard Changes"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:Uie({transitions:oe.length,derive:Ue.length,facts:ke.length}).message})]})]}),N.open&&s.jsx(bX,{open:N.open,affected:{...N.affected,label:(($e=a.find(Ce=>Ce.id===N.affected.id))==null?void 0:$e.label)??N.affected.id},remaining:a.filter(Ce=>Ce.id!==N.affected.id&&k.has(Ce.id)).map(Ce=>({id:Ce.id,label:Ce.label})),ruleReferences:N.ruleReferences,headlineReferences:N.headlineReferences,onResolve:xe,onCancel:we}),s.jsx(vX,{open:D.open,references:D.open?D.references:[],onConfirm:ie,onCancel:()=>{_({open:!1}),f(!1)}})]})})}const go=e=>`${e.workspace}::${e.id}`;function xE(e){if(e.includes("/")){const[t,n]=e.split("/");return`/projects/${t}/assignments/${n}`}return`/assignments/${e}`}function Vie(){var Ce;const{data:e,loading:t,error:n,refetch:r}=T2(),o=Vt(),[i,a]=m.useState(""),l=m.useRef(null);Si("list:todos");const[d,f]=m.useState(""),[p,h]=m.useState(""),[g,y]=m.useState(""),[k,w]=m.useState("_global"),[b,j]=m.useState(null),[N,S]=m.useState(null),[C,I]=m.useState(new Set),[T,R]=m.useState(!1),D=m.useRef(null),[_,B]=m.useState(null),$=e0("all"),[O,z]=m.useState(null),[A,F]=m.useState(null),U=m.useRef(null);m.useEffect(()=>{let se=!1;return(async()=>{try{const me=await fetch("/api/projects");if(!me.ok)return;const Pe=await me.json();se||B(Pe.filter(qe=>!qe.archived))}catch{}})(),()=>{se=!0}},[]);async function H(se,me){se.stopPropagation(),await Fd(me)&&(j(me),setTimeout(()=>j(Pe=>Pe===me?null:Pe),1500))}const L=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return[];const se=[];for(const me of e.workspaces)for(const Pe of me.items)se.push({...Pe,workspace:me.workspace});return se},[e]),V=m.useMemo(()=>{const se=new Set;for(const me of L)for(const Pe of me.tags)se.add(Pe);return Array.from(se).sort()},[L]),M=m.useMemo(()=>{let se=L;if(i.trim()){const me=i.toLowerCase();se=se.filter(Pe=>Pe.description.toLowerCase().includes(me)||Pe.tags.some(qe=>qe.toLowerCase().includes(me))||Pe.id.includes(me))}return d&&(se=se.filter(me=>me.status===d)),p&&(se=se.filter(me=>me.tags.includes(p))),se},[L,i,d,p]);m.useEffect(()=>{I(new Set),D.current=null},[i,d,p]);const W=m.useMemo(()=>M.filter(se=>C.has(go(se))),[M,C]),Y=M.length>0&&W.length===M.length,q=W.length>0&&!Y,J=m.useMemo(()=>{if(W.length===0)return null;const se=new Set(W.map(me=>me.workspace));return se.size===1?[...se][0]:null},[W]),ne=m.useMemo(()=>{if(!J||!_)return;const se=_.filter(me=>me.workspace===J);return se.length===1?se[0].slug:void 0},[J,_]),Q=((Ce=W[0])==null?void 0:Ce.description)??"",le=m.useMemo(()=>{if(J)return null;const se=new Map;for(const me of W)se.has(me.workspace)||se.set(me.workspace,[]),se.get(me.workspace).push(me.id);return Array.from(se,([me,Pe])=>({workspace:me,todoIds:Pe}))},[W,J]),te=J?{kind:"workspace",workspace:J}:{kind:"aggregate",groups:le??[]};function pe(se,me,Pe){const qe=go(se),de=!!(Pe&&"shiftKey"in Pe&&Pe.shiftKey),pt=D.current?Oe.findIndex(yt=>go(yt)===D.current):-1;if(de&&pt!==-1){const yt=Math.min(pt,me),St=Math.max(pt,me);I(ct=>{const ht=new Set(ct);for(let Nt=yt;Nt<=St;Nt++){const ye=Oe[Nt];ye&&ht.add(go(ye))}return ht})}else I(yt=>{const St=new Set(yt);return St.has(qe)?St.delete(qe):St.add(qe),St});D.current=qe}function be(){I(se=>{const me=new Set(se);if(Y)for(const Pe of M)me.delete(go(Pe));else for(const Pe of M)me.add(go(Pe));return me})}function Ee(){I(new Set),D.current=null}function Te(se){Ee(),r(),se!=null&&se.assignmentRef&&o(xE(se.assignmentRef))}const ke=m.useMemo(()=>{if(!(e!=null&&e.workspaces))return{open:0,in_progress:0,completed:0,blocked:0,total:0};const se={open:0,in_progress:0,completed:0,blocked:0,total:0};for(const me of e.workspaces)se.open+=me.counts.open,se.in_progress+=me.counts.in_progress,se.completed+=me.counts.completed,se.blocked+=me.counts.blocked,se.total+=me.counts.total;return se},[e]);async function Ue(){g.trim()&&(await Ov(k,g.trim()),y(""),r())}async function oe(se,me,Pe){switch(Pe){case"open":await _2(se,me);break;case"in_progress":await P2(se,me);break;case"completed":await R2(se,me);break;case"blocked":await A2(se,me);break}r()}async function je(se,me){await D2(se,me),r()}async function Se(se,me,Pe){await $2(se,me,Pe),r()}async function De(se,me,Pe){await I2(se,me,Pe),r()}async function ze(se,me,Pe){await M2(se,me,Pe),r()}const Ye=Zw(M),Oe=Ye.filter(se=>!$.isCollapsed(se.config.id)).flatMap(se=>se.items),{hotkeyRowProps:nt}=Rd(Oe,{scope:"list:todos",bindO:!1,onOpen:se=>S(go(se))});Zt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var se;return(se=l.current)==null?void 0:se.focus()}}),Zt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>r()});const[wt,it]=ks(),st=wt.get("focus");m.useEffect(()=>{if(!st)return;const se=L.find(Pe=>Pe.id===st);if(!se)return;const me=Im(se.status);$.isCollapsed(me)&&$.toggle(me)},[st,L]),m.useEffect(()=>{if(!st)return;const se=document.querySelector(`[data-todo-id="${CSS.escape(st)}"]`);if(!se)return;se.scrollIntoView({block:"nearest"}),se.classList.add("ring-2","ring-primary/60");const me=window.setTimeout(()=>{se.classList.remove("ring-2","ring-primary/60"),it(Pe=>{const qe=new URLSearchParams(Pe);return qe.delete("focus"),qe})},1500);return()=>window.clearTimeout(me)},[st,Oe.length,it]);const ce=O?M.find(se=>go(se)===O)??null:null;function ee(se,me){const Pe=U.current;if(Pe!=null&&Pe.closest(Yl)){se.preventDefault();return}se.dataTransfer.effectAllowed="move",se.dataTransfer.setData("text/plain",me),z(me)}function xe(){z(null),F(null)}function ie(se,me){!ce||me.statuses.includes(ce.status)||(se.preventDefault(),se.dataTransfer.dropEffect="move",F(me.id))}function we(se,me){A===me.id&&!se.currentTarget.contains(se.relatedTarget)&&F(null)}function $e(se,me){se.preventDefault();const Pe=ce;xe(),!(!Pe||me.statuses.includes(Pe.status))&&oe(Pe.workspace,Pe.id,me.dropStatus)}return t?s.jsx(vt,{label:"Loading todos..."}):n?s.jsx(Pt,{error:n}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Wn,{label:"Open",value:ke.open,icon:Xr}),s.jsx(Wn,{label:"In Progress",value:ke.in_progress,icon:Av,tone:"info"}),s.jsx(Wn,{label:"Blocked",value:ke.blocked,icon:qh,tone:"warn"}),s.jsx(Wn,{label:"Completed",value:ke.completed,icon:Xr,tone:"default"})]}),s.jsx("div",{className:"surface-panel p-3",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:k,onChange:se=>w(se.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(se=>se.workspace!=="_global").map(se=>s.jsx("option",{value:se.workspace,children:se.workspace},se.workspace))]}),s.jsx("input",{type:"text",placeholder:"Add a todo...",value:g,onChange:se=>y(se.target.value),onKeyDown:se=>se.key==="Enter"&&Ue(),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:Ue,disabled:!g.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[s.jsx($t,{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(ji,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:l,type:"text",placeholder:"Search todos...",value:i,onChange:se=>a(se.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:d,onChange:se=>f(se.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"})]}),V.length>0&&s.jsxs("select",{value:p,onChange:se=>h(se.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"}),V.map(se=>s.jsxs("option",{value:se,children:["#",se]},se))]})]}),W.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:[W.length," selected",J?s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["(from ",s.jsx("strong",{children:J}),")"]}):s.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:["across ",new Set(W.map(se=>se.workspace)).size," workspaces"]})]}),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 to assignment"}),s.jsx("button",{type:"button",onClick:Ee,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,M.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:Y,ref:se=>{se&&(se.indeterminate=q)},onChange:be,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",M.length,")"]}),s.jsx("span",{className:"text-muted-foreground/60",children:"— shift-click for range select"})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let se=-1;return Ye.map(({config:me,items:Pe})=>{const qe=!$.isCollapsed(me.id);return s.jsx(Jw,{label:me.label,count:Pe.length,expanded:qe,onToggle:()=>$.toggle(me.id),isDropTarget:A===me.id,onDragOver:de=>ie(de,me),onDragLeave:de=>we(de,me),onDrop:de=>$e(de,me),children:qe&&Pe.map(de=>{se+=1;const pt=se,yt=go(de),St=C.has(yt);return s.jsxs("div",{draggable:!0,"data-todo-id":de.id,...nt(pt),onMouseDown:ct=>{U.current=ct.target},onDragStart:ct=>ee(ct,yt),onDragEnd:xe,className:`surface-panel flex items-start gap-3 px-3 py-2 group cursor-grab active:cursor-grabbing hover:bg-foreground/[0.03] transition ${St?"ring-1 ring-foreground/20":""} ${O===yt?"opacity-50 shadow-lg":""}`,children:[s.jsx("input",{type:"checkbox","data-no-drag":!0,"aria-label":`Select todo ${de.id}`,title:"Select",checked:St,onChange:()=>{},onClick:ct=>{ct.stopPropagation(),pe(de,pt,ct)},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(MP,{status:de.status,onChange:ct=>oe(de.workspace,de.id,ct)})}),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(OP,{description:de.description,status:de.status,editing:N===yt,onBeginEdit:()=>S(yt),onEndEdit:()=>S(null),onSave:ct=>Se(de.workspace,de.id,ct)}),de.tags.length>0&&s.jsx("span",{className:"text-xs text-muted-foreground",children:de.tags.map(ct=>`#${ct}`).join(" ")}),de.linkedAssignmentRef?s.jsxs(Ie,{to:xE(de.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:ct=>ct.stopPropagation(),children:[s.jsx(UE,{className:"h-2.5 w-2.5"}),de.linkedAssignmentRef.includes("/")?de.linkedAssignmentRef:`oneoff:${de.linkedAssignmentRef.slice(0,8)}`]}):null]}),s.jsx(FP,{item:de,attachmentUrl:(ct,ht)=>Fv(de.workspace,ct,ht),onAdd:ct=>De(de.workspace,de.id,ct),onDelete:ct=>ze(de.workspace,de.id,ct)})]}),s.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono",children:de.workspace!=="_global"&&s.jsx(Ie,{to:`/w/${de.workspace}/todos`,className:"hover:text-foreground transition mr-2",onClick:ct=>ct.stopPropagation(),children:de.workspace})}),b===de.id?s.jsxs("span",{className:"text-xs text-status-completed-foreground flex items-center gap-1",children:[s.jsx(Or,{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:ct=>H(ct,de.id),children:["t:",de.id]}),s.jsx("button",{className:"text-muted-foreground/40 hover:text-foreground transition",title:"Copy ID",onClick:ct=>H(ct,de.id),children:s.jsx(eh,{className:"h-3 w-3"})})]}),s.jsx("button",{onClick:ct=>{ct.stopPropagation(),je(de.workspace,de.id)},className:"text-xs text-muted-foreground/40 hover:text-destructive transition opacity-0 group-hover:opacity-100",children:"delete"})]},`${de.workspace}-${de.id}`)})},me.id)})})()}),s.jsx(Qw,{open:T,selectedIds:W.map(se=>se.id),scope:te,onOpenChange:R,onDone:Te,defaultProject:ne,defaultTitle:Q,allowOneOff:!0})]})}const Wie={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 qie({bundle:e}){const t=Wie[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 Kie({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(qie,{bundle:n},n.id))]})}function Gie(e){const[t,n]=m.useState(null),[r,o]=m.useState(!0),[i,a]=m.useState(null),l=m.useCallback(async()=>{try{const d=await fetch(`/api/bundles/${encodeURIComponent(e)}`);if(!d.ok)throw new Error(`HTTP ${d.status}`);n(await d.json()),a(null)}catch(d){a(d instanceof Error?d.message:"Failed to fetch bundles")}finally{o(!1)}},[e]);return m.useEffect(()=>{l()},[l]),fc(d=>{d.type==="todos-updated"&&!d.projectSlug&&l()}),{data:t,loading:r,error:i,refetch:l}}function Yie(){const{workspace:e}=Wt(),t=e||"_global",{data:n,loading:r,error:o,refetch:i}=AO(t),{data:a}=Gie(t),[l,d]=m.useState(""),[f,p]=m.useState(""),[h,g]=m.useState(""),[y,k]=m.useState(""),[w,b]=m.useState(null),[j,N]=m.useState(null),[S,C]=m.useState(new Set),[I,T]=m.useState(!1),[R,D]=m.useState(!1),[_,B]=m.useState(null),$=m.useRef(null);Si("list:todos");const O=e0("workspace:"+t),[z,A]=m.useState(null),[F,U]=m.useState(null),H=m.useRef(null);async function L(ie,we){ie.stopPropagation(),await Fd(we)&&(b(we),setTimeout(()=>b($e=>$e===we?null:$e),1500))}const V=m.useMemo(()=>{if(!(n!=null&&n.items))return[];const ie=new Set;for(const we of n.items)for(const $e of we.tags)ie.add($e);return Array.from(ie).sort()},[n]),M=m.useMemo(()=>{if(!(n!=null&&n.items))return[];let ie=n.items;if(l.trim()){const we=l.toLowerCase();ie=ie.filter($e=>$e.description.toLowerCase().includes(we)||$e.tags.some(Ce=>Ce.toLowerCase().includes(we))||$e.id.includes(we))}return f&&(ie=ie.filter(we=>we.status===f)),h&&(ie=ie.filter(we=>we.tags.includes(h))),ie},[n,l,f,h]);m.useEffect(()=>{C(new Set)},[l,f,h,t]);const W=m.useMemo(()=>M.filter(ie=>S.has(ie.id)).length,[M,S]),Y=M.length>0&&W===M.length,q=W>0&&!Y;function J(ie){C(we=>{const $e=new Set(we);return $e.has(ie)?$e.delete(ie):$e.add(ie),$e})}function ne(){C(ie=>{const we=new Set(ie);if(Y)for(const $e of M)we.delete($e.id);else for(const $e of M)we.add($e.id);return we})}function Q(){C(new Set)}const le=_?[_]:Array.from(S);function te(){C(new Set),B(null),i()}function pe(){C(new Set),i()}async function be(){y.trim()&&(await Ov(t,y.trim()),k(""),i())}async function Ee(ie,we,$e){ie.stopPropagation(),window.confirm(`Delete "${$e}"? This can't be undone.`)&&(await D2(t,we),i())}async function Te(ie,we){switch(we){case"open":await _2(t,ie);break;case"in_progress":await P2(t,ie);break;case"completed":await R2(t,ie);break;case"blocked":await A2(t,ie);break}i()}async function ke(ie,we){await $2(t,ie,we),i()}async function Ue(ie,we){await I2(t,ie,we),i()}async function oe(ie,we){await M2(t,ie,we),i()}const je=Zw(M),Se=je.filter(ie=>!O.isCollapsed(ie.config.id)).flatMap(ie=>ie.items),{hotkeyRowProps:De}=Rd(Se,{scope:"list:todos",bindO:!1,onOpen:ie=>N(ie.id)});Zt({keys:"/",scope:"list:todos",description:"Focus filter",handler:()=>{var ie;return(ie=$.current)==null?void 0:ie.focus()}}),Zt({keys:"r",scope:"list:todos",description:"Refresh",handler:()=>i()});const[ze,Ye]=ks(),Oe=ze.get("focus");m.useEffect(()=>{if(!Oe||!(n!=null&&n.items))return;const ie=n.items.find($e=>$e.id===Oe);if(!ie)return;const we=Im(ie.status);O.isCollapsed(we)&&O.toggle(we)},[Oe,n==null?void 0:n.items]),m.useEffect(()=>{if(!Oe)return;const ie=document.querySelector(`[data-todo-id="${window.CSS.escape(Oe)}"]`);if(!ie)return;ie.scrollIntoView({block:"nearest"}),ie.classList.add("ring-2","ring-primary/60");const we=window.setTimeout(()=>{ie.classList.remove("ring-2","ring-primary/60"),Ye($e=>{const Ce=new URLSearchParams($e);return Ce.delete("focus"),Ce})},1500);return()=>window.clearTimeout(we)},[Oe,Se.length,Ye]);const nt=z?(n==null?void 0:n.items.find(ie=>ie.id===z))??null:null;function wt(ie,we){const $e=H.current;if($e!=null&&$e.closest(Yl)){ie.preventDefault();return}ie.dataTransfer.effectAllowed="move",ie.dataTransfer.setData("text/plain",we),A(we)}function it(){A(null),U(null)}function st(ie,we){!nt||we.statuses.includes(nt.status)||(ie.preventDefault(),ie.dataTransfer.dropEffect="move",U(we.id))}function ce(ie,we){F===we.id&&!ie.currentTarget.contains(ie.relatedTarget)&&U(null)}function ee(ie,we){ie.preventDefault();const $e=nt;it(),!(!$e||we.statuses.includes($e.status))&&Te($e.id,we.dropStatus)}if(r)return s.jsx(vt,{label:"Loading todos..."});if(o)return s.jsx(Pt,{error:o});const xe=(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.jsxs("div",{className:"grid gap-3 grid-cols-[repeat(auto-fill,minmax(140px,1fr))]",children:[s.jsx(Wn,{label:"Open",value:xe.open,icon:Xr}),s.jsx(Wn,{label:"In Progress",value:xe.in_progress,icon:Xr,tone:"info"}),s.jsx(Wn,{label:"Blocked",value:xe.blocked,icon:qh,tone:"warn"}),s.jsx(Wn,{label:"Total",value:xe.total,icon:Xr})]}),a&&s.jsx(Kie,{bundles:a.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:y,onChange:ie=>k(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&be(),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:be,disabled:!y.trim(),className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-foreground px-3 text-sm font-medium text-background transition hover:bg-foreground/90 disabled:opacity-40",children:[s.jsx($t,{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(ji,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),s.jsx("input",{ref:$,type:"text",placeholder:"Search...",value:l,onChange:ie=>d(ie.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:f,onChange:ie=>p(ie.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"})]}),V.length>0&&s.jsxs("select",{value:h,onChange:ie=>g(ie.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"}),V.map(ie=>s.jsxs("option",{value:ie,children:["#",ie]},ie))]})]}),S.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:[S.size," selected"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:()=>T(!0),className:"shell-action shell-action--cta",children:"Promote selected"}),s.jsx("button",{type:"button",onClick:()=>{B(null),D(!0)},className:"shell-action",children:"Move to…"}),s.jsx("button",{type:"button",onClick:Q,className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}):null,M.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:Y,ref:ie=>{ie&&(ie.indeterminate=q)},onChange:ne,className:"h-4 w-4 cursor-pointer accent-foreground"}),s.jsxs("span",{children:["Select all in current filter (",M.length,")"]})]}),s.jsx("div",{className:"space-y-3",children:(()=>{let ie=-1;return je.map(({config:we,items:$e})=>{const Ce=!O.isCollapsed(we.id);return s.jsx(Jw,{label:we.label,count:$e.length,expanded:Ce,onToggle:()=>O.toggle(we.id),isDropTarget:F===we.id,onDragOver:se=>st(se,we),onDragLeave:se=>ce(se,we),onDrop:se=>ee(se,we),children:Ce&&$e.map(se=>(ie+=1,s.jsx(LP,{item:se,copiedId:w,selected:S.has(se.id),editing:j===se.id,onBeginEdit:me=>N(me),onEndEdit:()=>N(null),onPatchDescription:ke,onAddAttachments:Ue,onDeleteAttachment:oe,attachmentUrl:(me,Pe)=>Fv(t,me,Pe),onToggleSelected:me=>J(me),onMoveOne:(me,Pe)=>{Pe.stopPropagation(),B(me),D(!0)},onStatusChange:Te,onCopyId:L,onDelete:Ee,hotkeyRowProps:De(ie),onDragOrigin:me=>{H.current=me.target},onDragStart:wt,onDragEnd:it,isDragging:z===se.id},se.id)))},we.id)})})()}),s.jsx(Qw,{open:I,selectedIds:Array.from(S),scope:{kind:"workspace",workspace:t},onOpenChange:T,onDone:pe}),s.jsx(BP,{open:R,selectedIds:le,scope:{kind:"workspace",workspace:t},onOpenChange:ie=>{D(ie),ie||B(null)},onDone:te})]})}function XD(){const{views:e}=$d();async function t(i,a,l){const d=e.find(h=>h.id===i.id)??i,f=NA(l,d.workspace).config,p=xh(d.config,f,d.config);await fh(i.id,{name:a,config:p})}async function n(i,a,l){const d=e.find(h=>h.id===i.id)??i,f=Aw(l,d.workspace).config,p=xh(d.config,f,d.config);await fh(i.id,{name:a,config:p})}async function r(i){await ql({name:`${i.name} (copy)`,workspace:i.workspace,config:i.config,entityType:i.entityType})}async function o(i){await j8(i.id)}return{submitEdit:t,submitEditSession:n,duplicate:r,remove:o}}const yE=80,Xie={kanban:"Kanban",list:"List",table:"Table"},Qie={title:"Title",status:"Status",priority:"Priority",assignee:"Assignee",dependencies:"Dependencies",created:"Created",updated:"Updated"};function QD({open:e,onOpenChange:t,workspace:n,initialView:r,onSubmit:o}){const i=!!r,a=Ns(),l=Td(),{data:d}=Qs(),{data:f}=Gh(),[p,h]=m.useState(""),[g,y]=m.useState(ul.viewMode),[k,w]=m.useState([]),[b,j]=m.useState([]),[N,S]=m.useState([]),[C,I]=m.useState([]),[T,R]=m.useState([]),[D,_]=m.useState([]),[B,$]=m.useState("all"),[O,z]=m.useState(null),[A,F]=m.useState(""),[U,H]=m.useState(ul.sortField),[L,V]=m.useState(ul.sortDirection),[M,W]=m.useState(!1),[Y,q]=m.useState(null);function J(){y(ul.viewMode),w([]),j([]),S([]),I([]),R([]),_([]),$("all"),z(null),F(""),H(ul.sortField),V(ul.sortDirection)}m.useEffect(()=>{if(e)if(q(null),W(!1),r){const oe=r.config.filters;h(r.name),y(r.config.viewMode),w(We(oe.status)),j(We(oe.priority)),S(We(oe.type)),I(We(oe.project)),R(We(oe.assignee)),_(We(oe.tags)),$(oe.activity??"all"),z(Em(oe.dateRange)),F(oe.search??""),H(r.config.sortField),V(r.config.sortDirection)}else h(""),J()},[e,r]);const ne=oe=>je=>oe?oe==="_ungrouped"?je.projectWorkspace===null:je.projectWorkspace===oe:!0,Q=m.useMemo(()=>{const oe=Se=>n?n==="_ungrouped"?Se.workspace===null:Se.workspace===n:!0,je=(d??[]).filter(oe);return[{value:"__standalone__",label:"No project"},...je.map(Se=>({value:Se.slug,label:Se.title}))]},[d,n]),le=m.useMemo(()=>{const oe=new Set,je=ne(n);for(const De of(f==null?void 0:f.assignments)??[])je(De)&&De.assignee&&oe.add(De.assignee);const Se=[{value:"__unassigned__",label:"Unassigned"}];for(const De of Array.from(oe).sort())Se.push({value:De,label:De});return Se},[f,n]),te=m.useMemo(()=>{const oe=new Set,je=ne(n);for(const Se of(f==null?void 0:f.assignments)??[])if(je(Se))for(const De of Se.tags??[])oe.add(De);return Array.from(oe).sort().map(Se=>({value:Se,label:Se}))},[f,n]),pe=m.useMemo(()=>a.order.map(oe=>({value:oe,label:xi(a,oe)})),[a]),be=m.useMemo(()=>GU.map(oe=>({value:oe,label:oe[0].toUpperCase()+oe.slice(1)})),[]),Ee=m.useMemo(()=>l.definitions.map(oe=>({value:oe.id,label:_l(l,oe.id)})),[l]),Te=nw.map(oe=>({value:oe,label:Xie[oe]})),ke=p.trim(),Ue=ke.length>0&&ke.length<=yE;return s.jsx(Bn,{open:e,onOpenChange:t,children:s.jsx(_n,{className:"max-w-lg",children:s.jsxs("form",{className:"space-y-4",onSubmit:async oe=>{if(oe.preventDefault(),!Ue||M)return;W(!0),q(null);const je={viewMode:g,filters:{status:k,priority:b,type:N,project:C,assignee:T,tags:D,activity:B,dateRange:da(O),search:A},sortField:U,sortDirection:L};try{await o(ke,je)}catch(Se){q(Se instanceof Error?Se.message:String(Se)),W(!1)}},children:[s.jsx(sr,{children:s.jsx(Dn,{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:yE,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(Rm,{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(Os,{label:"Status",children:s.jsx(bn,{ariaLabel:"Status filter",className:"w-full",allLabel:"All statuses",options:pe,value:k,onChange:w})}),s.jsx(Os,{label:"Priority",children:s.jsx(bn,{ariaLabel:"Priority filter",className:"w-full",allLabel:"All priorities",options:be,value:b,onChange:j})}),s.jsx(Os,{label:"Type",children:s.jsx(bn,{ariaLabel:"Type filter",className:"w-full",allLabel:"All types",options:Ee,value:N,onChange:S})}),s.jsx(Os,{label:"Project",children:s.jsx(bn,{ariaLabel:"Project filter",className:"w-full",allLabel:"All projects",options:Q,value:C,onChange:I})}),s.jsx(Os,{label:"Assignee",children:s.jsx(bn,{ariaLabel:"Assignee filter",className:"w-full",allLabel:"All assignees",options:le,value:T,onChange:R})}),s.jsx(Os,{label:"Tags",children:s.jsx(bn,{ariaLabel:"Tags filter",className:"w-full",allLabel:"Any tags",options:te,value:D,onChange:_})}),s.jsx(Os,{label:"Activity",children:s.jsxs("select",{value:B,onChange:oe=>$(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(Os,{label:"Date range",children:s.jsx(Cm,{className:"w-full",value:O,onChange:z})}),s.jsx(Os,{label:"Search",className:"sm:col-span-2",children:s.jsx("input",{type:"text",value:A,onChange:oe=>F(oe.target.value),placeholder:"Title / slug / project contains…",className:"editor-input w-full"})}),s.jsx(Os,{label:"Sort by",className:"sm:col-span-2",children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("select",{value:U,onChange:oe=>H(oe.target.value),className:"editor-input w-full",children:wT.map(oe=>s.jsx("option",{value:oe,children:Qie[oe]??oe},oe))}),s.jsx("button",{type:"button",onClick:()=>V(oe=>oe==="asc"?"desc":"asc"),className:"shell-action shrink-0",title:L==="asc"?"Ascending":"Descending",children:L==="asc"?"Asc":"Desc"})]})})]}),Y?s.jsx("p",{className:"text-xs text-error-foreground",role:"alert",children:Y}):null,s.jsxs(zr,{className:"sm:justify-between",children:[s.jsx("button",{type:"button",onClick:J,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:!Ue||M,className:"shell-action shell-action--cta disabled:opacity-50",children:M?"Saving…":i?"Save changes":"Create view"})]})]})]})})})}function Os({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 Jie={kanban:"Kanban",list:"List",table:"Table"},Zie={assignment:"Assignment",session:"Session"},eae={assignment:"bg-muted text-muted-foreground",session:"bg-primary/10 text-primary"};function bE(){const{workspace:e}=Wt(),{views:t,loading:n}=$d(),{submitEdit:r,submitEditSession:o,duplicate:i,remove:a}=XD(),{toast:l,showToast:d,dismissToast:f}=Eo(),[p,h]=m.useState(null),[g,y]=m.useState(!1),[k,w]=m.useState(!1),[b,j]=m.useState(!1),[N,S]=m.useState(null);async function C(z,A){const{workspace:F,config:U}=NA(A,e??null);try{await ql({name:z,workspace:F,config:U}),w(!1),d(`Created view "${z}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to create saved view"),H}}async function I(z,A){const{workspace:F,config:U}=Aw(A,e??null);try{await ql({name:z,workspace:F,config:U,entityType:"session"}),j(!1),d(`Created session view "${z}"`)}catch(H){throw d(H instanceof Error?H.message:"Failed to create session view"),H}}async function T(z,A,F){try{await r(z,A,F),S(null),d(`Updated view "${A}"`)}catch(U){throw d(U instanceof Error?U.message:"Failed to update saved view"),U}}async function R(z,A,F){try{await o(z,A,F),S(null),d(`Updated session view "${A}"`)}catch(U){throw d(U instanceof Error?U.message:"Failed to update session view"),U}}async function D(z){try{await i(z),d(`Duplicated "${z.name}"`)}catch(A){d(A instanceof Error?A.message:"Failed to duplicate saved view")}}async function _(){if(p){y(!0);try{await a(p),h(null)}catch(z){d(z instanceof Error?z.message:"Failed to delete saved view")}finally{y(!1)}}}const B=s.jsxs("button",{type:"button",onClick:()=>w(!0),className:"shell-action inline-flex items-center gap-1.5 shell-action--cta",children:[s.jsx($t,{className:"h-4 w-4"}),"Create view"]}),$=s.jsxs("button",{type:"button",onClick:()=>j(!0),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx($t,{className:"h-4 w-4"}),"Create session view"]}),O=(N==null?void 0:N.entityType)==="session";return s.jsxs("div",{className:"space-y-4",children:[s.jsx(vh,{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:[$,B]})}),n?s.jsx(vt,{label:"Loading saved views…"}):t.length===0?s.jsx(Rt,{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:[$,B]})}):s.jsx(Ge,{children:s.jsx("ul",{className:"divide-y divide-border/60",children:t.map(z=>s.jsx(tae,{view:z,onRequestDelete:()=>h(z),onRequestEdit:()=>S(z),onRequestDuplicate:()=>void D(z)},z.id))})}),s.jsx(QD,{open:k||!O&&N!==null,onOpenChange:z=>{z||(w(!1),O||S(null))},workspace:N&&!O?N.workspace:e??null,initialView:N&&!O?N:null,onSubmit:N&&!O?(z,A)=>T(N,z,A):C}),s.jsx(AA,{open:b||O&&N!==null,onOpenChange:z=>{z||(j(!1),O&&S(null))},workspace:N&&O?N.workspace:e??null,initialView:N&&O?N:null,onSubmit:N&&O?(z,A)=>R(N,z,A):I}),s.jsx(Ei,{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:z=>{!z&&!g&&h(null)}}),s.jsx(Ni,{toast:l,onDismiss:f})]})}function tae({view:e,onRequestDelete:t,onRequestEdit:n,onRequestDuplicate:r}){const o=Vt(),i=()=>o(EA(e)),a=RA(e.config.filters),l=e.workspace?Tn(e.workspace):null,d=e.entityType??"assignment",f=d==="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 ${eae[d]??"bg-muted text-muted-foreground"}`,children:Zie[d]??d}),!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:Jie[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 nae={kanban:"Kanban",list:"List",table:"Table"};function vE(){const{id:e,workspace:t}=Wt(),n=Vt(),{view:r,ready:o,error:i,refetch:a}=bi(e),{submitEdit:l,duplicate:d,remove:f}=XD(),{toast:p,showToast:h,dismissToast:g}=Eo(),[y,k]=m.useState(!1),[w,b]=m.useState(!1),[j,N]=m.useState(!1);if(m.useEffect(()=>{!o||!r||(t??null)!==(r.workspace??null)&&n(EA(r),{replace:!0})},[o,r,t,n]),!o)return s.jsx(vt,{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(vh,{title:"View not found",description:"This saved view no longer exists."}),s.jsxs(Ie,{to:zp(t??null),className:"shell-action inline-flex items-center gap-1.5",children:[s.jsx(Qp,{className:"h-4 w-4"})," Back to Saved Views"]})]});const S=r.workspace?Tn(r.workspace):null;async function C(R,D){const _=r;try{await l(_,R,D),k(!1),h(`Updated view "${R}"`)}catch(B){throw h(B instanceof Error?B.message:"Failed to update saved view"),B}}async function I(){const R=r;try{await d(R),h(`Duplicated "${R.name}"`)}catch(D){h(D instanceof Error?D.message:"Failed to duplicate saved view")}}async function T(){const R=r;N(!0);try{await f(R),b(!1),n(zp(R.workspace))}catch(D){h(D instanceof Error?D.message:"Failed to delete saved view")}finally{N(!1)}}return s.jsxs("div",{className:"space-y-4",children:[s.jsxs(Ie,{to:zp(r.workspace),className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[s.jsx(Qp,{className:"h-4 w-4"})," Saved Views"]}),s.jsx(vh,{title:r.name,description:RA(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:nae[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 I(),className:"shell-action",children:"Duplicate"}),s.jsx("button",{type:"button",onClick:()=>n(TA(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(kA,{view:r}),y?s.jsx(QD,{open:y,onOpenChange:k,workspace:r.workspace,initialView:r,onSubmit:C}):null,s.jsx(Ei,{open:w,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(Ni,{toast:p,onDismiss:g})]})}function rae(){return s.jsx(iL,{children:s.jsx(Y6,{children:s.jsx(IM,{children:s.jsxs(Qe,{element:s.jsx(Sz,{}),children:[s.jsx(Qe,{path:"/",element:s.jsx(jH,{})}),s.jsx(Qe,{path:"/projects",element:s.jsx(jS,{})}),s.jsx(Qe,{path:"/archive",element:s.jsx(LH,{})}),s.jsx(Qe,{path:"/assignments",element:s.jsx(PN,{})}),s.jsx(Qe,{path:"/assignments/new",element:s.jsx(IN,{})}),s.jsx(Qe,{path:"/assignments/:id",element:s.jsx(LG,{})}),s.jsx(Qe,{path:"/assignments/:id/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/assignments/:id/plan/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/assignments/:id/scratchpad/edit",element:s.jsx(Dy,{})}),s.jsx(Qe,{path:"/assignments/:id/handoff/edit",element:s.jsx($y,{})}),s.jsx(Qe,{path:"/assignments/:id/decision-record/edit",element:s.jsx(Iy,{})}),s.jsx(Qe,{path:"/servers",element:s.jsx(LN,{})}),s.jsx(Qe,{path:"/inventories",element:s.jsx(ON,{})}),s.jsx(Qe,{path:"/schedules",element:s.jsx(TY,{})}),s.jsx(Qe,{path:"/usage",element:s.jsx(FN,{})}),s.jsx(Qe,{path:"/agent-sessions",element:s.jsx(zN,{})}),s.jsx(Qe,{path:"/playbooks",element:s.jsx(DY,{})}),s.jsx(Qe,{path:"/playbooks/create",element:s.jsx(IY,{})}),s.jsx(Qe,{path:"/playbooks/:slug",element:s.jsx($Y,{})}),s.jsx(Qe,{path:"/playbooks/:slug/edit",element:s.jsx(MY,{})}),s.jsx(Qe,{path:"/memories",element:s.jsx(LY,{})}),s.jsx(Qe,{path:"/memories/new",element:s.jsx(FY,{})}),s.jsx(Qe,{path:"/projects/:slug/memories/:itemSlug",element:s.jsx(OY,{})}),s.jsx(Qe,{path:"/projects/:slug/memories/:itemSlug/edit",element:s.jsx(zY,{})}),s.jsx(Qe,{path:"/resources",element:s.jsx(BY,{})}),s.jsx(Qe,{path:"/resources/new",element:s.jsx(HY,{})}),s.jsx(Qe,{path:"/projects/:slug/resources/:itemSlug",element:s.jsx(UY,{})}),s.jsx(Qe,{path:"/projects/:slug/resources/:itemSlug/edit",element:s.jsx(VY,{})}),s.jsx(Qe,{path:"/todos",element:s.jsx(Vie,{})}),s.jsx(Qe,{path:"/views",element:s.jsx(bE,{})}),s.jsx(Qe,{path:"/views/:id",element:s.jsx(vE,{})}),s.jsx(Qe,{path:"/help",element:s.jsx(SH,{})}),s.jsx(Qe,{path:"/settings",element:s.jsx(yX,{})}),s.jsx(Qe,{path:"/workflow",element:s.jsx(Hie,{})}),s.jsx(Qe,{path:"/create/project",element:s.jsx(DN,{})}),s.jsx(Qe,{path:"/projects/:slug",element:s.jsx(jN,{})}),s.jsx(Qe,{path:"/projects/:slug/edit",element:s.jsx(MN,{})}),s.jsx(Qe,{path:"/projects/:slug/create/assignment",element:s.jsx($N,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug",element:s.jsx(EN,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Dy,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx($y,{})}),s.jsx(Qe,{path:"/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Iy,{})}),s.jsx(Qe,{path:"/w/:workspace/projects",element:s.jsx(jS,{})}),s.jsx(Qe,{path:"/w/:workspace/assignments",element:s.jsx(PN,{})}),s.jsx(Qe,{path:"/w/:workspace/assignments/new",element:s.jsx(IN,{})}),s.jsx(Qe,{path:"/w/:workspace/servers",element:s.jsx(LN,{})}),s.jsx(Qe,{path:"/w/:workspace/inventories",element:s.jsx(ON,{})}),s.jsx(Qe,{path:"/w/:workspace/usage",element:s.jsx(FN,{})}),s.jsx(Qe,{path:"/w/:workspace/agent-sessions",element:s.jsx(zN,{})}),s.jsx(Qe,{path:"/w/:workspace/todos",element:s.jsx(Yie,{})}),s.jsx(Qe,{path:"/w/:workspace/views",element:s.jsx(bE,{})}),s.jsx(Qe,{path:"/w/:workspace/views/:id",element:s.jsx(vE,{})}),s.jsx(Qe,{path:"/w/:workspace/create/project",element:s.jsx(DN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug",element:s.jsx(jN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/edit",element:s.jsx(MN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/create/assignment",element:s.jsx($N,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug",element:s.jsx(EN,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/edit",element:s.jsx(Py,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/plan/edit",element:s.jsx(_y,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/scratchpad/edit",element:s.jsx(Dy,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/handoff/edit",element:s.jsx($y,{})}),s.jsx(Qe,{path:"/w/:workspace/projects/:slug/assignments/:aslug/decision-record/edit",element:s.jsx(Iy,{})})]})})})})}Y4();II.createRoot(document.getElementById("root")).render(s.jsx(m.StrictMode,{children:s.jsx(X4,{children:s.jsx(rae,{})})}));export{Vd as C,xr as R,l9 as _,Vu as a,oae as b,h0 as d,e3 as e,bd as g,iae as h,zs as i,r3 as n,eZ as r,Ir as s};
|